From patchwork Thu Nov 13 15:01:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 5298321 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7F87AC11AC for ; Thu, 13 Nov 2014 15:10:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A4D252020F for ; Thu, 13 Nov 2014 15:10:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C7C53201FA for ; Thu, 13 Nov 2014 15:10:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754077AbaKMPFa (ORCPT ); Thu, 13 Nov 2014 10:05:30 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:61717 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932269AbaKMPFY (ORCPT ); Thu, 13 Nov 2014 10:05:24 -0500 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NEZ001ENGKYI620@mailout2.samsung.com>; Fri, 14 Nov 2014 00:05:22 +0900 (KST) X-AuditID: cbfee61b-f79d76d0000024d6-dd-5464c8b2c9f9 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id B7.90.09430.2B8C4645; Fri, 14 Nov 2014 00:05:22 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NEZ00J8WGELNZ00@mmp2.samsung.com>; Fri, 14 Nov 2014 00:05:22 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Eduardo Valentin Cc: Zhang Rui , Amit Daniel Kachhap , Lukasz Majewski , Kyungmin Park , linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v2 19/33] thermal: exynos: add get_con_reg() helper Date: Thu, 13 Nov 2014 16:01:14 +0100 Message-id: <1415890888-8881-20-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1415890888-8881-1-git-send-email-b.zolnierkie@samsung.com> References: <1415890888-8881-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprJLMWRmVeSWpSXmKPExsVy+t9jQd1NJ1JCDE4dNrJouBpisXHGelaL +VeusVqcbXrDbvHm4WZGi8u75rBZfO49wmgx4/w+JosnD/vYHDg9ds66y+6xeM9LJo++LasY PT5vkgtgieKySUnNySxLLdK3S+DK6Jh4g61gj2DFxHkzWBsY3/N1MXJySAiYSKw6d4QRwhaT uHBvPVsXIxeHkMB0Ronf58+yQjhdTBI3P01nBaliE7CSmNi+CqxDREBL4sSl7UwgRcwCy5gk Ln2bzwSSEBZwllix/CyYzSKgKtH09ggbiM0r4CEx/dVXJoh1ihLdzyaAxTmB4q+m/gUbKiTg LnHt0TvmCYy8CxgZVjGKphYkFxQnpeca6RUn5haX5qXrJefnbmIEB9gz6R2MqxosDjEKcDAq 8fC+YEkJEWJNLCuuzD3EKMHBrCTC630YKMSbklhZlVqUH19UmpNafIhRmoNFSZz3YKt1oJBA emJJanZqakFqEUyWiYNTqoGxqybjU9U5j0Rx1k9sJ9TSWy5xJb18ImUXu6f871OdftnsXf+q rfsevsj/smy2AqdgxL/+iYv9fx4zY9Q5s9Jhnvd96awTfj0asdOr3mufqLN1+jKrrDZnz4lC 8ckdwvLRCp6vwo3q9k4++MohT425+sejh0+Wl/2P2m/Hyu9oZ7r13tJb8ZeUWIozEg21mIuK EwFW7NXgLAIAAA== Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Factor out code for preparing TMU_CONTROL register value from exynos_tmu_control() into get_con_reg(). This is a preparation for introducing per-SoC type tmu_control method. There should be no functional changes caused by this patch. Cc: Amit Daniel Kachhap Cc: Lukasz Majewski Cc: Eduardo Valentin Cc: Zhang Rui Signed-off-by: Bartlomiej Zolnierkiewicz Acked-by: Kyungmin Park --- drivers/thermal/samsung/exynos_tmu.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 736ef78..f65e6d8 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -197,17 +197,9 @@ static int exynos_tmu_initialize(struct platform_device *pdev) return ret; } -static void exynos_tmu_control(struct platform_device *pdev, bool on) +static u32 get_con_reg(struct exynos_tmu_data *data, u32 con) { - struct exynos_tmu_data *data = platform_get_drvdata(pdev); struct exynos_tmu_platform_data *pdata = data->pdata; - const struct exynos_tmu_registers *reg = pdata->registers; - unsigned int con, interrupt_en; - - mutex_lock(&data->lock); - clk_enable(data->clk); - - con = readl(data->base + reg->tmu_ctrl); if (pdata->test_mux) con |= (pdata->test_mux << EXYNOS4412_MUX_ADDR_SHIFT); @@ -223,6 +215,21 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on) con |= (pdata->noise_cancel_mode << EXYNOS_TMU_TRIP_MODE_SHIFT); } + return con; +} + +static void exynos_tmu_control(struct platform_device *pdev, bool on) +{ + struct exynos_tmu_data *data = platform_get_drvdata(pdev); + struct exynos_tmu_platform_data *pdata = data->pdata; + const struct exynos_tmu_registers *reg = pdata->registers; + unsigned int con, interrupt_en; + + mutex_lock(&data->lock); + clk_enable(data->clk); + + con = get_con_reg(data, readl(data->base + reg->tmu_ctrl)); + if (on) { con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT); interrupt_en =