From patchwork Tue Oct 10 18:02:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 9996915 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 8976B60216 for ; Tue, 10 Oct 2017 18:06:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8040E286C6 for ; Tue, 10 Oct 2017 18:06:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7570228700; Tue, 10 Oct 2017 18:06:51 +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=unavailable 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 1953B286C6 for ; Tue, 10 Oct 2017 18:06:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932672AbdJJSFU (ORCPT ); Tue, 10 Oct 2017 14:05:20 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:50811 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932665AbdJJSFS (ORCPT ); Tue, 10 Oct 2017 14:05:18 -0400 Received: by mail-wm0-f45.google.com with SMTP id u138so7493929wmu.5 for ; Tue, 10 Oct 2017 11:05:17 -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=LVMPc6PvZ///EJBUOnr5Vy8p3tP3rB0lSv32gwuCQuc=; b=a/DfNW8P1tovMNLWzW0/v2pMZ49Oca1cunJAzA1vc8byWUFffm0/C3dxm786UazgWP 6T052iIpR4g4ay8HAlM+obNmKq4MpJH6h47vEkQ5YX1qgRl7op1TgB/CSF5jPLk46S1Y uMxFEHc2OXns7/9tzBzbCczKl56bsUv0ImmII= 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=LVMPc6PvZ///EJBUOnr5Vy8p3tP3rB0lSv32gwuCQuc=; b=cpqfgYKRLMs3626xuiPAlbBXZ2kr7i8y7q/YHkIdoMGtTHZ62KUsJG66BDLvVDNXJS qzv1V2O5w+R6X5gxgO45rBaPqZaMT3XWCKaWADv9KygTeMq2XQQvBQRBp+MqDdH82dy1 irum8C6mg6z5qY1nOuL6RUfvNqHc5r/6y9grJvw2eWECUQ4yNBuvPF3bQcAcbzZ3c2uK maeB7tiTPxNJO8r2TdiuBmKWyefW9+ZRobomNr3l1aD/2jlsqD0AH9kU8wCYrG1htWh4 AbAEBUlI17GcQH0rhhiFu03QS9m9sKDGVBvYgbQFRid98hQs7nHYe9wMPE2aHXOXl3dh NBvg== X-Gm-Message-State: AMCzsaU7TubkehBLsITWLfeSvmtdenZk55oqyE5ClpndsuaVsNcYogep hbel50st6J49ANzjNUuAzloXOA== X-Google-Smtp-Source: AOwi7QBOYRbcoDOOSHGqPwySQfRrr8+AYNw8AAUTWTGfayl7fycZdziIIvqm1wu3d1c8v+gy0W/PjA== X-Received: by 10.28.175.197 with SMTP id y188mr10644587wme.20.1507658716825; Tue, 10 Oct 2017 11:05:16 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:4f9:3ae1:43d2:31ae]) by smtp.gmail.com with ESMTPSA id l73sm12513428wmd.47.2017.10.10.11.05.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Oct 2017 11:05:16 -0700 (PDT) From: Daniel Lezcano To: edubezval@gmail.com, rui.zhang@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, kevin.wangtao@linaro.org Subject: [PATCH 19/25] thermal/drivers/hisi: Put platform code together Date: Tue, 10 Oct 2017 20:02:44 +0200 Message-Id: <1507658570-32675-19-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507658570-32675-1-git-send-email-daniel.lezcano@linaro.org> References: <79a5f10c-0fb7-3e4f-caac-c1625904b137@linaro.org> <1507658570-32675-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 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 befdb28..ff9055a 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;