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: 116508 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1799856qgn; Fri, 20 Oct 2017 08:13:18 -0700 (PDT) X-Received: by 10.101.77.74 with SMTP id j10mr4781907pgt.324.1508512398536; Fri, 20 Oct 2017 08:13:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508512398; cv=none; d=google.com; s=arc-20160816; b=djlWwkbpN3zBWYyGdM/jvFrKtghMkqjBNKvGSTV4XXR/K6HTBPB8EP0tkSsN9CYNLR m0gZn5Zikoz/ryOfxg1U2n9Zbv2vlA0/vJAd4rmz1WsyQ/Sm3lPo+c8CO4WOASG7Cne9 kwDyoE0FG4mWxDabp0FQ6I/Pw2K+3xMADlPrSgTiJdEomyu6/JNF2mzJAm23HwiVccmW x3TrH0ZuBKbdU6guSlUvK1G9eosRtCmh4hz/yksEkjqOo9E6oYQlD6ckRCcsVpHX6u4E jfCihYUzL8P07iamRgTiYzCVakJ1xvXOPexf73ckbyKR1ptqGhVyABbpq5CDApeU8W8i xBlQ== 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=BB2xNdqdACcC2Wvys6dJDSyn31BzqU0HylWuXf5B9S+r3hF0PpoLTMx8CC6I/UOZaA A2CAzZHp1DR7GihjGuj7ZG+kqqht88MHAsfRatQLHSAakr2sgdU1Qxdky/do/RFHdra3 8+5za2t8bIqQYYSdVtZiVBn6OE3JZwfWh2eiRnvpYnFinHIjPPOnuQL/wPT/HNuMa7pd jF/mz4UEP0r4S0v+WDXFwfmzT82BwSi5jP0pZbmDpyu3LVLsOl/AQAoC7hbg0rtib8Pd ITn8EppGGQTaYCktG3+IZkTb/yJPG8G2v2yB5O3eTuKiymNnStKWkq4VPi4gEqpoLKHi Y/bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MvbYRQng; 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 x5si904494pfx.187.2017.10.20.08.13.17; Fri, 20 Oct 2017 08:13:18 -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=MvbYRQng; 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 S1752031AbdJTPNQ (ORCPT + 12 others); 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 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;