From patchwork Sun Oct 22 08:54:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 116631 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3456591qgn; Sun, 22 Oct 2017 01:57:39 -0700 (PDT) X-Received: by 10.84.178.37 with SMTP id y34mr4221602plb.99.1508662659258; Sun, 22 Oct 2017 01:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508662659; cv=none; d=google.com; s=arc-20160816; b=sPVoyhginRv+CLLKWNpIu9iYHKbMnqA1VtmDN5uSNDWf5givirXAJvzmDEvDcFBzlJ AkkHHDs9a1HsJKnxlLQ/EBy64d7pq+RoidNzypq3xCLVOZ8CHcE+eVpXabc4v53IE/Wh ek9h+kLDK/8kwMJyGjd7KOvtlW3G8IWlVBkkLNa9xjXVOelD20klolXGjmHJp+NP/JuP 1ZznOaTmDi+hWhzvTq3+6bM4SXwyXYkc+uzbq2wT+/O91vbcGSmORT3kvFjTGL0Er/N7 MkeZH38O5D1YVjk8C1IvVSVrdstR9kwo2s+zjnDonPTx/7usdG5Peqe5HrblyGBxAbZv 1iKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=LCLK7pu2wZE8rYfD7zJV7uj1SakCL4JqpkUYsfr8Jz4=; b=dllp43zPQ7z6a+rXZdFcuHyp+xlrMVb/TQp6ym72xa18PMTzrPZMbphnSDJPL/OC6H fPfuOfzbTvVWL+/NKx/oon8QxJrWf2kE7RVd9mGieb3Fsx2+u8LV/9GNpsyJM6H0jr1f FXopX6l+4HsWavqkqXg3PH0YuwkT0oPPgLCTd9vGJOnMYWNw7xEg+527XddYISRv6rMz 2STr72xomKOk2cvfDDY56ZE8LeJCtllLlLHK0M/jp7WQsXRqAeKXgbt8PNu8omG/tQ1l jHzv7a5y3gMD2qFNgCkJ3O7dYDO8o1WEN2K0pHKtrhD9Jkxtm8c5DymWlOzS9aWzLRTM Whiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R3Cs6jq+; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x66si3281415pgb.590.2017.10.22.01.57.39; Sun, 22 Oct 2017 01:57:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R3Cs6jq+; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751638AbdJVI5i (ORCPT + 12 others); Sun, 22 Oct 2017 04:57:38 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:57056 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751398AbdJVI4o (ORCPT ); Sun, 22 Oct 2017 04:56:44 -0400 Received: by mail-wm0-f66.google.com with SMTP id l68so4579472wmd.5 for ; Sun, 22 Oct 2017 01:56:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LCLK7pu2wZE8rYfD7zJV7uj1SakCL4JqpkUYsfr8Jz4=; b=R3Cs6jq+sdXLoewwtf2wkJ7shg5hcV+sZF67Tp4Li4yZzky3dnWwQDq182SJGJaeRN e7jZHmcsmz2gucrPCbZ6UhQyx1uzGk2eEcgej0flYhFyb1NLniCgb8BrNx46E+l6ejlQ 4saPgTfYZ6uMForObaH7cKWiyKXZ5DlzyjzCY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LCLK7pu2wZE8rYfD7zJV7uj1SakCL4JqpkUYsfr8Jz4=; b=QAiC8yx2kC37MwNW5PypQGnNpfVLdqWbj/Uqz7nBqswDt9BxKE/iqTCVs9al3SNQ2i p+IzwqEuJdnQRmGTpHDNGcmxy+v/iV3DMS6CVWrdpBplScrcPS6BGS3c6WisT9fwTmHm /hjMqmmHs87c+3hOGR4yL1+WN+iZe5ObJ3YOodvWlgfvI6c2r4bBD8glNYe7TiaiqFMI Ndt79NrMSMtKZVaGSOvFS4D1f5VC65XsvdIoQgNbJiFmkMtVeazc5WpPhv0im+Za2ItQ g3NaCWEZzcRdDsLJ6MoK8BEqpgj+QSu8FeNO/yttnszX96a15gtidbnjJwY4c3LhM/Yj yr4A== X-Gm-Message-State: AMCzsaUbctEt764nyWaNPbd9capLR4aaEuqda6xOvQbsfdsk7jt7q3CU w/vtEOGiJXJrt2FAK73xZ1bnOQ== X-Google-Smtp-Source: ABhQp+Q2Dw52VAzbIy5U168C3rkNVDYeqWJkyPNYD0n8rLuVaTtgMmozQHTC7ul5nIbSZ1HA0wG1WA== X-Received: by 10.28.10.147 with SMTP id 141mr2095430wmk.40.1508662603595; Sun, 22 Oct 2017 01:56:43 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:e9f1:dbdd:7436:9f6d]) by smtp.gmail.com with ESMTPSA id v8sm2701809wrg.80.2017.10.22.01.56.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 22 Oct 2017 01:56:43 -0700 (PDT) From: Daniel Lezcano To: edubezval@gmail.com Cc: daniel.lezcano@linaro.org, rui.zhang@intel.com, kevin.wangtao@linaro.org, leo.yan@linaro.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH V3 1/4] thermal/drivers/hisi: Put platform code together Date: Sun, 22 Oct 2017 10:54:32 +0200 Message-Id: <1508662475-6763-2-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508662475-6763-1-git-send-email-daniel.lezcano@linaro.org> References: <1508662475-6763-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Kevin Wangtao Reorganize the code for next patches by moving the functions upper in the file which will prevent a forward declaration. There is no functional change here. Signed-off-by: Kevin Wangtao Tested-by: Daniel Lezcano # hikey6220 Signed-off-by: Daniel Lezcano --- drivers/thermal/hisi_thermal.c | 76 +++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 38 deletions(-) -- 2.7.4 diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index b48e47e..ffa00b4 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -201,6 +201,44 @@ static void hisi_thermal_disable_sensor(struct hisi_thermal_data *data) clk_disable_unprepare(data->clk); } +static int hisi_thermal_setup(struct hisi_thermal_data *data) +{ + struct hisi_thermal_sensor *sensor = &data->sensor; + int ret; + + /* enable clock for tsensor */ + ret = clk_prepare_enable(data->clk); + if (ret) + return ret; + + /* disable module firstly */ + hisi_thermal_reset_enable(data->regs, 0); + hisi_thermal_enable(data->regs, 0); + + /* select sensor id */ + hisi_thermal_sensor_select(data->regs, sensor->id); + + /* setting the hdak time */ + hisi_thermal_hdak_set(data->regs, 0); + + /* setting lag value between current temp and the threshold */ + hisi_thermal_set_lag(data->regs, HISI_TEMP_LAG); + + /* enable for interrupt */ + hisi_thermal_alarm_set(data->regs, sensor->thres_temp); + + hisi_thermal_reset_set(data->regs, HISI_TEMP_RESET); + + /* enable module */ + hisi_thermal_reset_enable(data->regs, 1); + hisi_thermal_enable(data->regs, 1); + + hisi_thermal_alarm_clear(data->regs, 0); + hisi_thermal_alarm_enable(data->regs, 1); + + return 0; +} + static int hisi_thermal_get_temp(void *__data, int *temp) { struct hisi_thermal_data *data = __data; @@ -291,44 +329,6 @@ static void hisi_thermal_toggle_sensor(struct hisi_thermal_sensor *sensor, on ? THERMAL_DEVICE_ENABLED : THERMAL_DEVICE_DISABLED); } -static int hisi_thermal_setup(struct hisi_thermal_data *data) -{ - struct hisi_thermal_sensor *sensor = &data->sensor; - int ret; - - /* enable clock for tsensor */ - ret = clk_prepare_enable(data->clk); - if (ret) - return ret; - - /* disable module firstly */ - hisi_thermal_reset_enable(data->regs, 0); - hisi_thermal_enable(data->regs, 0); - - /* select sensor id */ - hisi_thermal_sensor_select(data->regs, sensor->id); - - /* setting the hdak time */ - hisi_thermal_hdak_set(data->regs, 0); - - /* setting lag value between current temp and the threshold */ - hisi_thermal_set_lag(data->regs, HISI_TEMP_LAG); - - /* enable for interrupt */ - hisi_thermal_alarm_set(data->regs, sensor->thres_temp); - - hisi_thermal_reset_set(data->regs, HISI_TEMP_RESET); - - /* enable module */ - hisi_thermal_reset_enable(data->regs, 1); - hisi_thermal_enable(data->regs, 1); - - hisi_thermal_alarm_clear(data->regs, 0); - hisi_thermal_alarm_enable(data->regs, 1); - - return 0; -} - static int hisi_thermal_probe(struct platform_device *pdev) { struct hisi_thermal_data *data;