From patchwork Fri Sep 22 09:42:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wangtao \(Kevin, Kirin\)" X-Patchwork-Id: 114006 Delivered-To: patch@linaro.org Received: by 10.80.163.150 with SMTP id s22csp2885889edb; Fri, 22 Sep 2017 02:51:17 -0700 (PDT) X-Google-Smtp-Source: AOwi7QAHKGXHnIjseD2Ut1JLPijcFGERQc0bX+AKWaKwVB8k3qSxj9rLqVXL2hG6qCrELtImJPG0 X-Received: by 10.159.218.69 with SMTP id x5mr8345660plv.4.1506073876985; Fri, 22 Sep 2017 02:51:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506073876; cv=none; d=google.com; s=arc-20160816; b=HRRU8kpSZjxXUEqXZ8Db6A3qRG8U6r+JjgM8ERFvBurSmQCptTAi5TJZhu6prQ3AuE /LROVcDGWwB6eO4XmXvfceBqFUdOjkvFKwUTDCFctQ9cS36201mICbccrA66fpn1cWws dD2TUkiwcIzE9Ebe6EYkezYvE4RQG4M05EtuBt0+jZVYJ+GK8i1l54SqUuTkblJFlDWl 0pQR49WsxpisWTYNh6kqQxQxEJEntzV5SAPekU0tH2pmpC8/t2IxL+CrUbqUeHN+xMnN zVE9tCgfTh+CAUdTVMAQ/9sLyR3JbYFIpxZ2qRC29a1EzGzknd8AjgGzA91QCLLj9TxY k2bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=FnEK45JYj427+wk6hp4jDMJwkXhTG2Sml43xCyXHtrE=; b=y2D+UmbmFpImFM1njJRdqKprhc8bz2q7ai9DJ8CaFNZxXqa7oDRVeAh5vqz+bFxl2+ mEqAR4yqACK32P+GRrAuydu/xYLugqcrIgfaC6CR8fnrDkFRkKffHdRhVJKxcxtdh/NC ViOiKvj90RSal8pDW2VIdpoGnnhHEjiRu+wmI9FiCpQc3Rk//kZvRWLL+ZOwdBmlBsra ah/MvB8XRBMLiHBm3nle01iNEvfGYbsvUkEFbd/wQ7ScUIrcVtJdqh3CwcJq+VbC1Xki bd1V++RbK5iVkcA5sK7CYALpsFOktalJVmkDF1tEneI7DFCdzYWnmQwzSo+OISfol2c3 NmvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q87si2492153pfa.98.2017.09.22.02.51.16; Fri, 22 Sep 2017 02:51:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752106AbdIVJt2 (ORCPT + 26 others); Fri, 22 Sep 2017 05:49:28 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6976 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752051AbdIVJtZ (ORCPT ); Fri, 22 Sep 2017 05:49:25 -0400 Received: from 172.30.72.58 (EHLO DGGEMS403-HUB.china.huawei.com) ([172.30.72.58]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DHT00606; Fri, 22 Sep 2017 17:49:21 +0800 (CST) Received: from HSH1000038028.huawei.com (10.177.161.152) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.301.0; Fri, 22 Sep 2017 17:49:12 +0800 From: Tao Wang To: , , , , , , CC: , , , , , , , , , , , Kevin Wangtao Subject: [PATCH 3/9] thermal/drivers/hisi: put platform code together Date: Fri, 22 Sep 2017 17:42:06 +0800 Message-ID: <1506073332-92438-4-git-send-email-kevin.wangtao@hisilicon.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1506073332-92438-1-git-send-email-kevin.wangtao@hisilicon.com> References: <1506073332-92438-1-git-send-email-kevin.wangtao@hisilicon.com> MIME-Version: 1.0 X-Originating-IP: [10.177.161.152] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.59C4DCA1.0147, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: a12a1efced07047c35b9682db7c76b67 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kevin Wangtao reorganize code for follow-up patch, there is no functional change here. Signed-off-by: Kevin Wangtao --- drivers/thermal/hisi_thermal.c | 76 +++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 38 deletions(-) -- 2.8.1 diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index c8b651d..96904b4 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;