From patchwork Sat Nov 22 07:45:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhilash Kesavan X-Patchwork-Id: 5358991 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EA94D9F39B for ; Sat, 22 Nov 2014 07:48:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DBA8B20158 for ; Sat, 22 Nov 2014 07:48:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6811720154 for ; Sat, 22 Nov 2014 07:48:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xs5Oy-0003AB-Hc; Sat, 22 Nov 2014 07:46:40 +0000 Received: from mail-pa0-x229.google.com ([2607:f8b0:400e:c03::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xs5Ou-00036l-KG for linux-arm-kernel@lists.infradead.org; Sat, 22 Nov 2014 07:46:37 +0000 Received: by mail-pa0-f41.google.com with SMTP id rd3so6387882pab.14 for ; Fri, 21 Nov 2014 23:46:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=EI38w1d4BiHXpF+Fa+DQZook7tYCZRviUI3B4ZxkwHM=; b=xobWPB5kR+kJa06k8zCfmWckkH9W8iRWPzpaXqivzf3mI3IVX72pjS0/gxtKC4XRO3 I2bqybrkoKKUgnseqqrrKxW6iI28xGcw+/ZPf/+ZMHbApK/gPl0bi/smoNb7mwhfFnqG pBOt9OvyAqUNsIETMbHhcWcVcSoPTKD5a0E2cD4EDUDhwELoYaIWWPAyQ8RC5hbuwZ6O ftTlOFG2VUrM4ygdoJpXMHXiVvaqOLpSPB7Xf6KGzj9EGKdKDJMXH0c/p7/UEF1TqDyC lK3qZfYbTF1CEb+FRj1G/poSDlcX/WVi3sLy26jCaCueNoUAabPGrikU/h1yvASB+x9u 67MQ== X-Received: by 10.68.129.69 with SMTP id nu5mr14062141pbb.51.1416642374650; Fri, 21 Nov 2014 23:46:14 -0800 (PST) Received: from localhost.localdomain ([122.171.83.129]) by mx.google.com with ESMTPSA id hb6sm6655674pbc.31.2014.11.21.23.46.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 21 Nov 2014 23:46:14 -0800 (PST) From: Abhilash Kesavan To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] thermal: exynos: add optional sclk support Date: Sat, 22 Nov 2014 13:15:56 +0530 Message-Id: <1416642356-8694-1-git-send-email-a.kesavan@samsung.com> X-Mailer: git-send-email 2.1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141121_234636_711264_40457349 X-CRM114-Status: GOOD ( 15.48 ) X-Spam-Score: -0.7 (/) Cc: l.majewski@samsung.com, b.zolnierkie@samsung.com, kesavan.abhilash@gmail.com, edubezval@gmail.com, amit.daniel@samsung.com, rui.zhang@intel.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Exynos7 has a special clock required for the functional operation of the TMU that is not present in earlier SoCs. Add support for this optional clock and update the binding documentation. Signed-off-by: Abhilash Kesavan --- This patch was earlier part of the series adding TMU support for Exynos7 [1]. It has been split out as it does not impact the on-going consolidation in the exynos tmu driver and can be considered independently. .../devicetree/bindings/thermal/exynos-thermal.txt | 3 +++ drivers/thermal/samsung/exynos_tmu.c | 27 ++++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/thermal/exynos-thermal.txt b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt index ae738f5..2393eac 100644 --- a/Documentation/devicetree/bindings/thermal/exynos-thermal.txt +++ b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt @@ -32,10 +32,13 @@ - clocks : The main clocks for TMU device -- 1. operational clock for TMU channel -- 2. optional clock to access the shared registers of TMU channel + -- 3. optional special clock for functional operation - clock-names : Thermal system clock name -- "tmu_apbif" operational clock for current TMU channel -- "tmu_triminfo_apbif" clock to access the shared triminfo register for current TMU channel + -- "tmu_sclk" clock for functional operation of the current TMU + channel - vtmu-supply: This entry is optional and provides the regulator node supplying voltage to TMU. If needed this entry can be placed inside board/platform specific dts file. diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index d44d91d..6627937 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -128,6 +128,7 @@ * @lock: lock to implement synchronization. * @clk: pointer to the clock structure. * @clk_sec: pointer to the clock structure for accessing the base_second. + * @sclk: pointer to the clock structure for accessing the tmu special clk. * @temp_error1: fused value of the first point trim. * @temp_error2: fused value of the second point trim. * @regulator: pointer to the TMU regulator structure. @@ -147,7 +148,7 @@ struct exynos_tmu_data { enum soc_type soc; struct work_struct irq_work; struct mutex lock; - struct clk *clk, *clk_sec; + struct clk *clk, *clk_sec, *sclk; u8 temp_error1, temp_error2; struct regulator *regulator; struct thermal_sensor_conf *reg_conf; @@ -883,10 +884,21 @@ static int exynos_tmu_probe(struct platform_device *pdev) goto err_clk_sec; } + data->sclk = devm_clk_get(&pdev->dev, "tmu_sclk"); + if (IS_ERR(data->sclk)) { + dev_err(&pdev->dev, "Failed to get optional special clock\n"); + } else { + ret = clk_prepare_enable(data->sclk); + if (ret) { + dev_err(&pdev->dev, "Failed to enable special clock\n"); + goto err_clk; + } + } + ret = exynos_tmu_initialize(pdev); if (ret) { dev_err(&pdev->dev, "Failed to initialize TMU\n"); - goto err_clk; + goto err_sclk; } exynos_tmu_control(pdev, true); @@ -896,7 +908,7 @@ static int exynos_tmu_probe(struct platform_device *pdev) sizeof(struct thermal_sensor_conf), GFP_KERNEL); if (!sensor_conf) { ret = -ENOMEM; - goto err_clk; + goto err_sclk; } sprintf(sensor_conf->name, "therm_zone%d", data->id); sensor_conf->read_temperature = (int (*)(void *))exynos_tmu_read; @@ -928,7 +940,7 @@ static int exynos_tmu_probe(struct platform_device *pdev) ret = exynos_register_thermal(sensor_conf); if (ret) { dev_err(&pdev->dev, "Failed to register thermal interface\n"); - goto err_clk; + goto err_sclk; } data->reg_conf = sensor_conf; @@ -936,10 +948,13 @@ static int exynos_tmu_probe(struct platform_device *pdev) IRQF_TRIGGER_RISING | IRQF_SHARED, dev_name(&pdev->dev), data); if (ret) { dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq); - goto err_clk; + goto err_sclk; } return 0; +err_sclk: + if (!IS_ERR(data->sclk)) + clk_disable_unprepare(data->sclk); err_clk: clk_unprepare(data->clk); err_clk_sec: @@ -956,6 +971,8 @@ static int exynos_tmu_remove(struct platform_device *pdev) exynos_tmu_control(pdev, false); + if (!IS_ERR(data->sclk)) + clk_disable_unprepare(data->sclk); clk_unprepare(data->clk); if (!IS_ERR(data->clk_sec)) clk_unprepare(data->clk_sec);