From patchwork Fri Oct 20 15:11:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 10020495 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 6F12460234 for ; Fri, 20 Oct 2017 15:13:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7744728EA3 for ; Fri, 20 Oct 2017 15:13:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BDA828EBB; Fri, 20 Oct 2017 15:13:18 +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 1246A28EA3 for ; Fri, 20 Oct 2017 15:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752031AbdJTPNQ (ORCPT ); Fri, 20 Oct 2017 11:13:16 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:54971 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752082AbdJTPNO (ORCPT ); Fri, 20 Oct 2017 11:13:14 -0400 Received: by mail-wm0-f65.google.com with SMTP id r68so3610343wmr.3 for ; Fri, 20 Oct 2017 08:13:14 -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=MvbYRQngN+o16XFR8dQ/dNheCloQu9ahh7gfLIEtDn4/0REOzM9QRq3O/mbLR6Sc1o e5e1rnbS4/qyF+q1BmV6h2fIdJwKg70j/MsCrsWMQghD2hW/BesMgLynrYkItbsOCaAP aeGfHmnsOP7ledTP587TgRxwVMzdUdukQ9Gr0= 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=kmSuu0qWe4XdEBeWTAf0RddVIra0gqpPK8jbcfNKNsD6n1CdywDBfQBiaZMcCzGEHe FTC+Dgzz1S5eFd35ckV1PW3XQA3bmEc+H1cbpicpDGVjRj3tA51VoDDLk2aHeIV7mdEO TM/LQLOtkPMBm7L4QUvLDZdhJ2itTNsdfB2njbKSCtI+UVqEuCICB07jdYNFtiCryuT2 sc0TLa/YmaH6t+pQnl2ha/vx4LjEUwBn5UYtM7g4iZuuAwnl8x2b3ttHIgZRlRiitlfX /moqw0y2/Q1Hr1t9nxPqB4+T9O5YM+nk9pKE3FPHRs/8h+mzCDIA9HZqUZ7OQBPN13Nn +1YA== X-Gm-Message-State: AMCzsaVWDpekzBtgQG823jhnpZOSkzjge6jnfx9d7e5tFPJIigHrQrGm i4GTPgTlc4ZmQDC9ZMgZfL0C9w== X-Google-Smtp-Source: ABhQp+SB5JEVD2JwAczB4V3dQ1yVS5G7Q6d4vwbvu6aZKqp1VGszyGO20IYGIF9Rtg4k7DdlfZCkRw== X-Received: by 10.28.29.68 with SMTP id d65mr1978232wmd.93.1508512393489; Fri, 20 Oct 2017 08:13:13 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:3dc8:5a4d:8d23:3c7c]) by smtp.gmail.com with ESMTPSA id 4sm1249416wmm.1.2017.10.20.08.13.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Oct 2017 08:13:12 -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 V2 1/4] thermal/drivers/hisi: Put platform code together Date: Fri, 20 Oct 2017 17:11:04 +0200 Message-Id: <1508512267-18302-2-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508512267-18302-1-git-send-email-daniel.lezcano@linaro.org> References: <1508512267-18302-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;