From patchwork Mon Jun 24 10:50:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kachhap X-Patchwork-Id: 2769971 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 D6AB0C0AB1 for ; Mon, 24 Jun 2013 10:54:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F32C5201CA for ; Mon, 24 Jun 2013 10:54:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 181A1201C3 for ; Mon, 24 Jun 2013 10:54:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753346Ab3FXKxA (ORCPT ); Mon, 24 Jun 2013 06:53:00 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:50468 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753321Ab3FXKw7 (ORCPT ); Mon, 24 Jun 2013 06:52:59 -0400 Received: by mail-pa0-f52.google.com with SMTP id kq13so10839719pab.39 for ; Mon, 24 Jun 2013 03:52:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=qc9fq/HqJ8p5/biZR6B1Cb0+6iC2rkKX1FHa8Bf+SHk=; b=NjDnKlebvqRiu6wu1MGhFKuRCT1aUomGlO88sl6bbok1QaTG1IYirdLyciI2lry7Pd goe7ORkjkG/HYgo31/2Dz7W637dzPMDc8Rfj2mmpTQkl6rkDD6tFy4lhlUj1v0Kow09y lVEAqI0zq0kkC7qEhRxqDU7lb0Jil7kBMI+rVIiSZoNtguj/IMyVHIZtlEgLAXByB13b 4MmnF2DT42eWPcECiD1jvbmM74pfgmbqgAW42TvlIa6vrgFj0L2xtilPKV+JMwRdlnv/ 6S6SOONu7y8XAa1GxzMKyOGxbxba90M9+sPPbKdWVd+4vsSGX8yf9gr6wfftEAKxWabv LWew== X-Received: by 10.66.164.199 with SMTP id ys7mr26948206pab.104.1372071178441; Mon, 24 Jun 2013 03:52:58 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPSA id tq8sm17631973pbc.30.2013.06.24.03.52.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 24 Jun 2013 03:52:57 -0700 (PDT) From: Amit Daniel Kachhap To: linux-pm@vger.kernel.org, Zhang Rui , Eduardo Valentin Cc: linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, amit.kachhap@gmail.com, Kukjin Kim Subject: [PATCH V7 26/30] thermal: exynos: Support for TMU regulator defined at device tree Date: Mon, 24 Jun 2013 16:20:47 +0530 Message-Id: <1372071051-3167-27-git-send-email-amit.daniel@samsung.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1372071051-3167-1-git-send-email-amit.daniel@samsung.com> References: <1372071051-3167-1-git-send-email-amit.daniel@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 TMU probe function now checks for a device tree defined regulator. For compatibility reasons it is allowed to probe driver even without this regulator defined. Acked-by: Jonghwa Lee Acked-by: Eduardo Valentin Signed-off-by: Lukasz Majewski Signed-off-by: Kyungmin Park Signed-off-by: Amit Daniel Kachhap --- drivers/thermal/samsung/exynos_tmu.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 34b999b..80d1786 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "exynos_thermal_common.h" #include "exynos_tmu.h" @@ -48,6 +49,7 @@ * @clk: pointer to the clock structure. * @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. * @reg_conf: pointer to structure to register with core thermal. */ struct exynos_tmu_data { @@ -61,6 +63,7 @@ struct exynos_tmu_data { struct mutex lock; struct clk *clk; u8 temp_error1, temp_error2; + struct regulator *regulator; struct thermal_sensor_conf *reg_conf; }; @@ -511,10 +514,27 @@ static int exynos_map_dt_data(struct platform_device *pdev) struct exynos_tmu_data *data = platform_get_drvdata(pdev); struct exynos_tmu_platform_data *pdata; struct resource res; + int ret; if (!data) return -ENODEV; + /* + * Try enabling the regulator if found + * TODO: Add regulator as an SOC feature, so that regulator enable + * is a compulsory call. + */ + data->regulator = devm_regulator_get(&pdev->dev, "vtmu"); + if (!IS_ERR(data->regulator)) { + ret = regulator_enable(data->regulator); + if (ret) { + dev_err(&pdev->dev, "failed to enable vtmu\n"); + return ret; + } + } else { + dev_info(&pdev->dev, "Regulator node (vtmu) not found\n"); + } + data->id = of_alias_get_id(pdev->dev.of_node, "tmuctrl"); if (data->id < 0) data->id = 0; @@ -682,6 +702,9 @@ static int exynos_tmu_remove(struct platform_device *pdev) clk_unprepare(data->clk); + if (!IS_ERR(data->regulator)) + regulator_disable(data->regulator); + return 0; }