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: 10021635 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7922160245 for ; Sun, 22 Oct 2017 08:57:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D3652860F for ; Sun, 22 Oct 2017 08:57:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60D0728618; Sun, 22 Oct 2017 08:57:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08E3A2860F for ; Sun, 22 Oct 2017 08:57:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751638AbdJVI5i (ORCPT ); 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 X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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;