From patchwork Wed Oct 17 15:52:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10645781 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6C0F0112B for ; Wed, 17 Oct 2018 15:53:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BCEF285D2 for ; Wed, 17 Oct 2018 15:53:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F86228678; Wed, 17 Oct 2018 15:53:35 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 B6152285D2 for ; Wed, 17 Oct 2018 15:53:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727082AbeJQXto (ORCPT ); Wed, 17 Oct 2018 19:49:44 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:63163 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeJQXtn (ORCPT ); Wed, 17 Oct 2018 19:49:43 -0400 Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20181017155322epoutp012efa71b25e477579e11d8b0a67951db6~ecE3SZxfP2823228232epoutp01V; Wed, 17 Oct 2018 15:53:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20181017155322epoutp012efa71b25e477579e11d8b0a67951db6~ecE3SZxfP2823228232epoutp01V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539791602; bh=zXiQkIrgh934kgpE1fNu/NcAgjpz4HbWCFW9J27Tr7I=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=VgzyAxaC0cwZ+qXceriaWTBZGODVYPX2VUgXM3owivqP7A2sZ+3qWW6mv42Ou9fAk mNnYkt3Re97RpodCOoSHUYxZ0Yu1BGnb/te1F6UoL/+lcuIGe+a0yDx56GmLhPoBfX Wl1HRDb4Xv4tIH1mxKXo1MfJpk7sItgNGXiKzOmg= Received: from epsmges2p1.samsung.com (unknown [182.195.42.69]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20181017155321epcas2p3012c65e8926fa7d3341db4b477877b90~ecE2nX5GY1998019980epcas2p3f; Wed, 17 Oct 2018 15:53:21 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 17.57.04015.1FA57CB5; Thu, 18 Oct 2018 00:53:21 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20181017155320epcas2p439b713149d94aa485b3c2ffba063ea03~ecE1lbude2479824798epcas2p4Y; Wed, 17 Oct 2018 15:53:20 +0000 (GMT) X-AuditID: b6c32a45-6c1ff70000000faf-ce-5bc75af15d23 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id DF.34.03633.FEA57CB5; Thu, 18 Oct 2018 00:53:20 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGR00KZM2SD3M00@mmp2.samsung.com>; Thu, 18 Oct 2018 00:53:19 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Zhang Rui , Eduardo Valentin Cc: Amit kucheria , Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v2 01/17] thermal: add thermal_zone_set_mode() helper Date: Wed, 17 Oct 2018 17:52:27 +0200 Message-id: <1539791563-5959-2-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSbUhTYRTHe+69u7sbrW7z7VFDaiSpmKaoPGWlH7JuFBGBUY6ooZcpOh27 Kml9MCdp1kQNU9Y0U4MYvqSY74I63a0sWWim5guamKUYscoUzZi3vv3Oc35/nnPgULg8R+RB JSSnsrpkVZKClBItFt+wQ99jeOVhvsgZ6bOqMdRY1iBCC3YeoDrDAIEej4yKUM/tYYC25pZE 6HVrNoZyjFUEqpmfFaPhDhOJ7IZ+gEwrH8VofraARIvNbqjp2RiJ1joqCNQ9bQeRcib7m5Vk jDNvSabdOCVmXkyEMtVdXzCmyXyXZCZHu0jGoF8hmYJmM2BaRytw5mXpKsHwY60YY2/yuiCL kR6LY5MS0lld4Inr0vjSkRpcOxN+436njcwCncH5QEJBOgTqV21YPpBScroNwJlaExCKVQDr B5fxfEBtW6WTnCMgp58D+LPsvOCsAzg8XSN2NEj6KCzKNQOH70yfhc21lOMZpwcI+Mnu62An OgpWrbVs6wTtDWfrxzAHy+jTsNtgwIWBvOAr6wORgyU0A4e2KknHX5CuEMOCiWJMkE7C3ie1 QGAn+JVvFgvsCRfMjUAIlAK4vP6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QV1pld55Z8d9jbrKa1+WCB8PrtGzPcfd3esjN/y/rlzeV76lnK vMmG9d+lJ7x+48Rl/+L8/czvz/LLBENabR3chOpV1Lbo3p+jlng9xfw1a07hO+dra3eu3bd3 uTfPM6UJLzfM2zaxfF1XqrdvSV/i0h/nat4bNO1Z8pPZhlWJpTgj0VCLuag4EQBeA3DAewIA AA== X-CMS-MailID: 20181017155320epcas2p439b713149d94aa485b3c2ffba063ea03 X-Msg-Generator: CA CMS-TYPE: 102P X-CMS-RootMailID: 20181017155320epcas2p439b713149d94aa485b3c2ffba063ea03 References: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> 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 In order to remove the code duplication and prepare for further changes: * Add thermal_zone_set_mode() helper. Then update core code and drivers to use it. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/hisi_thermal.c | 14 ++------------ drivers/thermal/of-thermal.c | 3 ++- drivers/thermal/rockchip_thermal.c | 26 +++++++++----------------- drivers/thermal/thermal_helpers.c | 14 ++++++++++++++ drivers/thermal/thermal_sysfs.c | 8 +++++--- include/linux/thermal.h | 5 +++++ 6 files changed, 37 insertions(+), 33 deletions(-) diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 761d055..b3f8d9f 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -515,15 +515,6 @@ static int hisi_thermal_register_sensor(struct platform_device *pdev, }; MODULE_DEVICE_TABLE(of, of_hisi_thermal_match); -static void hisi_thermal_toggle_sensor(struct hisi_thermal_sensor *sensor, - bool on) -{ - struct thermal_zone_device *tzd = sensor->tzd; - - tzd->ops->set_mode(tzd, - on ? THERMAL_DEVICE_ENABLED : THERMAL_DEVICE_DISABLED); -} - static int hisi_thermal_probe(struct platform_device *pdev) { struct hisi_thermal_data *data; @@ -571,7 +562,7 @@ static int hisi_thermal_probe(struct platform_device *pdev) } } - hisi_thermal_toggle_sensor(&data->sensor, true); + thermal_zone_set_mode((&data->sensor)->tzd, THERMAL_DEVICE_ENABLED); return 0; } @@ -579,9 +570,8 @@ static int hisi_thermal_probe(struct platform_device *pdev) static int hisi_thermal_remove(struct platform_device *pdev) { struct hisi_thermal_data *data = platform_get_drvdata(pdev); - struct hisi_thermal_sensor *sensor = &data->sensor; - hisi_thermal_toggle_sensor(sensor, false); + thermal_zone_set_mode((&data->sensor)->tzd, THERMAL_DEVICE_DISABLED); data->disable_sensor(data); diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 4f28165..118910c 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -496,7 +496,8 @@ struct thermal_zone_device * tzd = thermal_zone_of_add_sensor(child, sensor_np, data, ops); if (!IS_ERR(tzd)) - tzd->ops->set_mode(tzd, THERMAL_DEVICE_ENABLED); + thermal_zone_set_mode(tzd, + THERMAL_DEVICE_ENABLED); of_node_put(sensor_specs.np); of_node_put(child); diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index f36375d..2edd44c 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1022,15 +1022,6 @@ static void rk_tsadcv2_tshut_mode(int chn, void __iomem *regs, }; MODULE_DEVICE_TABLE(of, of_rockchip_thermal_match); -static void -rockchip_thermal_toggle_sensor(struct rockchip_thermal_sensor *sensor, bool on) -{ - struct thermal_zone_device *tzd = sensor->tzd; - - tzd->ops->set_mode(tzd, - on ? THERMAL_DEVICE_ENABLED : THERMAL_DEVICE_DISABLED); -} - static irqreturn_t rockchip_thermal_alarm_irq_thread(int irq, void *dev) { struct rockchip_thermal_data *thermal = dev; @@ -1292,7 +1283,8 @@ static int rockchip_thermal_probe(struct platform_device *pdev) thermal->chip->control(thermal->regs, true); for (i = 0; i < thermal->chip->chn_num; i++) - rockchip_thermal_toggle_sensor(&thermal->sensors[i], true); + thermal_zone_set_mode((&thermal->sensors[i])->tzd, + THERMAL_DEVICE_ENABLED); platform_set_drvdata(pdev, thermal); @@ -1311,11 +1303,9 @@ static int rockchip_thermal_remove(struct platform_device *pdev) struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev); int i; - for (i = 0; i < thermal->chip->chn_num; i++) { - struct rockchip_thermal_sensor *sensor = &thermal->sensors[i]; - - rockchip_thermal_toggle_sensor(sensor, false); - } + for (i = 0; i < thermal->chip->chn_num; i++) + thermal_zone_set_mode((&thermal->sensors[i])->tzd, + THERMAL_DEVICE_DISABLED); thermal->chip->control(thermal->regs, false); @@ -1332,7 +1322,8 @@ static int __maybe_unused rockchip_thermal_suspend(struct device *dev) int i; for (i = 0; i < thermal->chip->chn_num; i++) - rockchip_thermal_toggle_sensor(&thermal->sensors[i], false); + thermal_zone_set_mode((&thermal->sensors[i])->tzd, + THERMAL_DEVICE_DISABLED); thermal->chip->control(thermal->regs, false); @@ -1383,7 +1374,8 @@ static int __maybe_unused rockchip_thermal_resume(struct device *dev) thermal->chip->control(thermal->regs, true); for (i = 0; i < thermal->chip->chn_num; i++) - rockchip_thermal_toggle_sensor(&thermal->sensors[i], true); + thermal_zone_set_mode((&thermal->sensors[i])->tzd, + THERMAL_DEVICE_ENABLED); pinctrl_pm_select_default_state(dev); diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c index 2ba756a..b18cee2 100644 --- a/drivers/thermal/thermal_helpers.c +++ b/drivers/thermal/thermal_helpers.c @@ -224,3 +224,17 @@ int thermal_zone_get_offset(struct thermal_zone_device *tz) return 0; } EXPORT_SYMBOL_GPL(thermal_zone_get_offset); + +/** + * thermal_zone_set_mode() - sets mode of thermal zone device + * @tz: a valid pointer to a struct thermal_zone_device + * @mode: mode to be set + * + * Return: On success returns 0, an error code otherwise. + */ +int thermal_zone_set_mode(struct thermal_zone_device *tz, + enum thermal_device_mode mode) +{ + return tz->ops->set_mode(tz, mode); +} +EXPORT_SYMBOL_GPL(thermal_zone_set_mode); diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c index 2241cea..2e9e762 100644 --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -69,17 +69,19 @@ { struct thermal_zone_device *tz = to_thermal_zone(dev); int result; + enum thermal_device_mode mode; if (!tz->ops->set_mode) return -EPERM; if (!strncmp(buf, "enabled", sizeof("enabled") - 1)) - result = tz->ops->set_mode(tz, THERMAL_DEVICE_ENABLED); + mode = THERMAL_DEVICE_ENABLED; else if (!strncmp(buf, "disabled", sizeof("disabled") - 1)) - result = tz->ops->set_mode(tz, THERMAL_DEVICE_DISABLED); + mode = THERMAL_DEVICE_DISABLED; else - result = -EINVAL; + return -EINVAL; + result = thermal_zone_set_mode(tz, mode); if (result) return result; diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 5f4705f..9d21fd1 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -452,6 +452,8 @@ struct thermal_cooling_device * int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp); int thermal_zone_get_slope(struct thermal_zone_device *tz); int thermal_zone_get_offset(struct thermal_zone_device *tz); +int thermal_zone_set_mode(struct thermal_zone_device *tz, + enum thermal_device_mode mode); int get_tz_trend(struct thermal_zone_device *, int); struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, @@ -518,6 +520,9 @@ static inline int thermal_zone_get_slope( static inline int thermal_zone_get_offset( struct thermal_zone_device *tz) { return -ENODEV; } +static inline int thermal_zone_set_mode( + struct thermal_zone_device *tz, enum thermal_device_mode mode) +{ return -ENODEV; } static inline int get_tz_trend(struct thermal_zone_device *tz, int trip) { return -ENODEV; } static inline struct thermal_instance * From patchwork Wed Oct 17 15:52:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10645783 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3BB20112B for ; Wed, 17 Oct 2018 15:53:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2ABFF2848D for ; Wed, 17 Oct 2018 15:53:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1EF6128675; Wed, 17 Oct 2018 15:53:36 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 0C8042848D for ; Wed, 17 Oct 2018 15:53:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727670AbeJQXtw (ORCPT ); Wed, 17 Oct 2018 19:49:52 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:12689 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727610AbeJQXtw (ORCPT ); Wed, 17 Oct 2018 19:49:52 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20181017155328epoutp0477ddd7eb8b8ff9b2e1f737c7c72f760a~ecE9jPu0X1081110811epoutp04K; Wed, 17 Oct 2018 15:53:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20181017155328epoutp0477ddd7eb8b8ff9b2e1f737c7c72f760a~ecE9jPu0X1081110811epoutp04K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539791608; bh=7L1kC/TmyT9YRI3WBDij9zX1MyTUxGD2G3jsOBNRKkk=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=uauP6mIpDLHNPg2H8J1dmBTQKtuCCFb5IMhl6luaKeok8n/8i9qCF5MpknC0O45YW 9RzzwQ5+LL4NbyHU6YYymd0xlmdsr37zg6MFqO9yKKe2ZKB5QeFOMfxUQwWzzRCi/O lOVJyA4EizVfJNcUpp/HmV5I+0LyPHF0I1sZYX/8= Received: from epsmges2p2.samsung.com (unknown [182.195.42.70]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20181017155327epcas2p44c2dd8c1b300fd2eb63915f9fe37ae5a~ecE8cyXtr0130401304epcas2p4G; Wed, 17 Oct 2018 15:53:27 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 2F.CF.04077.7FA57CB5; Thu, 18 Oct 2018 00:53:27 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20181017155326epcas2p21d8b703f27fe54561a0f741fa7920dce~ecE7X655E1329013290epcas2p2n; Wed, 17 Oct 2018 15:53:26 +0000 (GMT) X-AuditID: b6c32a46-475ff70000000fed-9a-5bc75af7374d Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 01.44.03633.6FA57CB5; Thu, 18 Oct 2018 00:53:26 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGR00KZM2SD3M00@mmp2.samsung.com>; Thu, 18 Oct 2018 00:53:26 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Zhang Rui , Eduardo Valentin Cc: Amit kucheria , Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v2 02/17] thermal: add thermal_zone_device_check() helper Date: Wed, 17 Oct 2018 17:52:28 +0200 Message-id: <1539791563-5959-3-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSa0hTYRjHe7dzczQ5TtE3F0IDP2hkKVkvGRIUddRBQp/SMEeevE7HjpqK 1NSaF9CSCMVbkhdsTczlXRPxsmmZYg6xvGWZzTRDhpliLbZj3/7P8/z+zwUeSih5gHtS8cmp rDpZkSQjRFjHkM+ZEzsRpshTz7dkKE9TJ0Ct5S04WrWaAGouHsHQU/MMjgZypgGyfV7H0ZvO XAG6X/EMQ/UryySa7qkikLV4GKCqzTkSrSyXEMjS5oEMTbME2u2pwdDrRSu4IGFyfxoJpmLp HcF0VyyQTPvHQKaub03AGHSFBDM/00cwxXmbBFPSpgNM50yNkBkt28EY02yngLEavMLFEaLz MWxSfDqrPhkcLYqzLGzhqo0SkPGk9xepAe8zioATBenTsGx/VVgERJSE7gIwb6wDtxck9A6A Sw+DigDlgCosCp55CeD2h0+AD/YA1BZMEnYDQZ+Dpfk6YDe40WGwTU/Z00J6BINfrD527UqH wNECs6M/RnvD/fVKh1VMX4Gb+jGCX8gLjhkfOxgnmoETtlrCPgvSZSS0fZvHeegSLB+dI3nt Cr+b2g60FK7qWsGBAcCNvQaMD1oA1I8bBTwVBIdMUzi/njMsGPpD8meKYYFWwiMMbC9dwvgr KwEssjWAR+BILTikA+6silPGslyAKsCPUyi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4VevO8mi9a95zolDl/eEp7v2H Xv5PtXohrSqftEFSvJrnvfNGqWyTPyv+bGacILEv+luxEktxRqKhFnNRcSIAJjnioHwCAAA= X-CMS-MailID: 20181017155326epcas2p21d8b703f27fe54561a0f741fa7920dce X-Msg-Generator: CA CMS-TYPE: 102P X-CMS-RootMailID: 20181017155326epcas2p21d8b703f27fe54561a0f741fa7920dce References: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> 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 In order to remove the code duplication and prepare for further changes: * Rename static thermal_zone_device_check() helper in thermal_core.c to thermal_zone_device_work_check(). * Add thermal_zone_device_check() helper. Then update core code and drivers to use it. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/acpi/thermal.c | 3 +-- drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 3 ++- drivers/platform/x86/acerhdf.c | 4 +++- drivers/regulator/max8973-regulator.c | 3 +-- drivers/thermal/da9062-thermal.c | 7 ++----- drivers/thermal/db8500_thermal.c | 3 ++- drivers/thermal/hisi_thermal.c | 4 +--- drivers/thermal/imx_thermal.c | 5 +++-- drivers/thermal/intel_bxt_pmic_thermal.c | 3 +-- drivers/thermal/intel_soc_dts_iosf.c | 3 +-- drivers/thermal/max77620_thermal.c | 3 +-- drivers/thermal/of-thermal.c | 3 ++- drivers/thermal/qcom-spmi-temp-alarm.c | 2 +- drivers/thermal/rcar_gen3_thermal.c | 3 +-- drivers/thermal/rcar_thermal.c | 3 +-- drivers/thermal/rockchip_thermal.c | 3 +-- drivers/thermal/samsung/exynos_tmu.c | 2 +- drivers/thermal/st/st_thermal_memmap.c | 3 +-- drivers/thermal/thermal_core.c | 14 ++++++-------- drivers/thermal/thermal_helpers.c | 6 ++++++ drivers/thermal/thermal_sysfs.c | 6 +++--- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 2 +- drivers/thermal/uniphier_thermal.c | 2 +- drivers/thermal/x86_pkg_temp_thermal.c | 2 +- include/linux/thermal.h | 3 +++ 25 files changed, 47 insertions(+), 48 deletions(-) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 551b71a..b8b275e1 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -520,8 +520,7 @@ static void acpi_thermal_check(void *data) if (!tz->tz_enabled) return; - thermal_zone_device_update(tz->thermal_zone, - THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(tz->thermal_zone); } /* sys I/F for generic thermal sysfs support */ diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c index 6d29dc4..b0afd36 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c @@ -169,7 +169,8 @@ static int mlxsw_thermal_set_mode(struct thermal_zone_device *tzdev, mutex_unlock(&tzdev->lock); thermal->mode = mode; - thermal_zone_device_update(tzdev, THERMAL_EVENT_UNSPECIFIED); + + thermal_zone_device_check(tzdev); return 0; } diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 5052242..5a2b93a 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c @@ -417,7 +417,9 @@ static inline void acerhdf_enable_kernelmode(void) kernelmode = 1; thz_dev->polling_delay = interval*1000; - thermal_zone_device_update(thz_dev, THERMAL_EVENT_UNSPECIFIED); + + thermal_zone_device_check(thz_dev); + pr_notice("kernel mode fan control ON\n"); } diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8973-regulator.c index 7cd493e..9a522ed 100644 --- a/drivers/regulator/max8973-regulator.c +++ b/drivers/regulator/max8973-regulator.c @@ -495,8 +495,7 @@ static irqreturn_t max8973_thermal_irq(int irq, void *data) { struct max8973_chip *mchip = data; - thermal_zone_device_update(mchip->tz_device, - THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(mchip->tz_device); return IRQ_HANDLED; } diff --git a/drivers/thermal/da9062-thermal.c b/drivers/thermal/da9062-thermal.c index dd8dd94..8c6721b 100644 --- a/drivers/thermal/da9062-thermal.c +++ b/drivers/thermal/da9062-thermal.c @@ -102,9 +102,7 @@ static void da9062_thermal_poll_on(struct work_struct *work) mutex_lock(&thermal->lock); thermal->temperature = DA9062_MILLI_CELSIUS(125); mutex_unlock(&thermal->lock); - thermal_zone_device_update(thermal->zone, - THERMAL_EVENT_UNSPECIFIED); - + thermal_zone_device_check(thermal->zone); delay = msecs_to_jiffies(thermal->zone->passive_delay); schedule_delayed_work(&thermal->work, delay); return; @@ -113,8 +111,7 @@ static void da9062_thermal_poll_on(struct work_struct *work) mutex_lock(&thermal->lock); thermal->temperature = DA9062_MILLI_CELSIUS(0); mutex_unlock(&thermal->lock); - thermal_zone_device_update(thermal->zone, - THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(thermal->zone); err_enable_irq: enable_irq(thermal->irq); diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c index f491faf..ab66b2d7 100644 --- a/drivers/thermal/db8500_thermal.c +++ b/drivers/thermal/db8500_thermal.c @@ -306,7 +306,8 @@ static void db8500_thermal_work(struct work_struct *work) if (cur_mode == THERMAL_DEVICE_DISABLED) return; - thermal_zone_device_update(pzone->therm_dev, THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(pzone->therm_dev); + dev_dbg(&pzone->therm_dev->device, "thermal work finished.\n"); } diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index b3f8d9f..63d4fc3 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -461,9 +461,7 @@ static irqreturn_t hisi_thermal_alarm_irq_thread(int irq, void *dev) dev_crit(&data->pdev->dev, "THERMAL ALARM: %d > %d\n", temp, sensor->thres_temp); - thermal_zone_device_update(data->sensor.tzd, - THERMAL_EVENT_UNSPECIFIED); - + thermal_zone_device_check(data->sensor.tzd); } else { dev_crit(&data->pdev->dev, "THERMAL ALARM stopped: %d < %d\n", temp, sensor->thres_temp); diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index aa452ac..22f57ef 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -384,7 +384,8 @@ static int imx_set_mode(struct thermal_zone_device *tz, } data->mode = mode; - thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); + + thermal_zone_device_check(tz); return 0; } @@ -635,7 +636,7 @@ static irqreturn_t imx_thermal_alarm_irq_thread(int irq, void *dev) dev_dbg(&data->tz->device, "THERMAL ALARM: T > %d\n", data->alarm_temp / 1000); - thermal_zone_device_update(data->tz, THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(data->tz); return IRQ_HANDLED; } diff --git a/drivers/thermal/intel_bxt_pmic_thermal.c b/drivers/thermal/intel_bxt_pmic_thermal.c index 94cfd00..73fe97b 100644 --- a/drivers/thermal/intel_bxt_pmic_thermal.c +++ b/drivers/thermal/intel_bxt_pmic_thermal.c @@ -203,8 +203,7 @@ static irqreturn_t pmic_thermal_irq_handler(int irq, void *data) tzd = thermal_zone_get_zone_by_name(td->maps[i].handle); if (!IS_ERR(tzd)) - thermal_zone_device_update(tzd, - THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(tzd); /* Clear the appropriate irq */ regmap_write(regmap, reg, reg_val & mask); diff --git a/drivers/thermal/intel_soc_dts_iosf.c b/drivers/thermal/intel_soc_dts_iosf.c index e0813df..caa8776 100644 --- a/drivers/thermal/intel_soc_dts_iosf.c +++ b/drivers/thermal/intel_soc_dts_iosf.c @@ -391,8 +391,7 @@ void intel_soc_dts_iosf_interrupt_handler(struct intel_soc_dts_sensors *sensors) for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i) { pr_debug("TZD update for zone %d\n", i); - thermal_zone_device_update(sensors->soc_dts[i].tzone, - THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(sensors->soc_dts[i].tzone); } } else spin_unlock_irqrestore(&sensors->intr_notify_lock, flags); diff --git a/drivers/thermal/max77620_thermal.c b/drivers/thermal/max77620_thermal.c index 159bbce..e6bc69f 100644 --- a/drivers/thermal/max77620_thermal.c +++ b/drivers/thermal/max77620_thermal.c @@ -82,8 +82,7 @@ static irqreturn_t max77620_thermal_irq(int irq, void *data) else if (irq == mtherm->irq_tjalarm2) dev_crit(mtherm->dev, "Junction Temp Alarm2(140C) occurred\n"); - thermal_zone_device_update(mtherm->tz_device, - THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(mtherm->tz_device); return IRQ_HANDLED; } diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 118910c..c422b08 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -271,7 +271,8 @@ static int of_thermal_set_mode(struct thermal_zone_device *tz, mutex_unlock(&tz->lock); data->mode = mode; - thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); + + thermal_zone_device_check(tz); return 0; } diff --git a/drivers/thermal/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom-spmi-temp-alarm.c index ad4f3a8..d3910be 100644 --- a/drivers/thermal/qcom-spmi-temp-alarm.c +++ b/drivers/thermal/qcom-spmi-temp-alarm.c @@ -188,7 +188,7 @@ static irqreturn_t qpnp_tm_isr(int irq, void *data) { struct qpnp_tm_chip *chip = data; - thermal_zone_device_update(chip->tz_dev, THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(chip->tz_dev); return IRQ_HANDLED; } diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c index 7aed533..e0d9424 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -256,8 +256,7 @@ static irqreturn_t rcar_gen3_thermal_irq_thread(int irq, void *data) int i; for (i = 0; i < priv->num_tscs; i++) - thermal_zone_device_update(priv->tscs[i]->zone, - THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(priv->tscs[i]->zone); spin_lock_irqsave(&priv->lock, flags); rcar_thermal_irq_set(priv, true); diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 78f9328..6619a48 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -391,8 +391,7 @@ static void rcar_thermal_work(struct work_struct *work) return; if (nctemp != cctemp) - thermal_zone_device_update(priv->zone, - THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(priv->zone); } static u32 rcar_thermal_had_changed(struct rcar_thermal_priv *priv, u32 status) diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index 2edd44c..5640675 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1032,8 +1032,7 @@ static irqreturn_t rockchip_thermal_alarm_irq_thread(int irq, void *dev) thermal->chip->irq_ack(thermal->regs); for (i = 0; i < thermal->chip->chn_num; i++) - thermal_zone_device_update(thermal->sensors[i].tzd, - THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(thermal->sensors[i].tzd); return IRQ_HANDLED; } diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 48eef55..9e98b12 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -789,7 +789,7 @@ static void exynos_tmu_work(struct work_struct *work) struct exynos_tmu_data *data = container_of(work, struct exynos_tmu_data, irq_work); - thermal_zone_device_update(data->tzd, THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(data->tzd); mutex_lock(&data->lock); clk_enable(data->clk); diff --git a/drivers/thermal/st/st_thermal_memmap.c b/drivers/thermal/st/st_thermal_memmap.c index 91d4231..323c42f 100644 --- a/drivers/thermal/st/st_thermal_memmap.c +++ b/drivers/thermal/st/st_thermal_memmap.c @@ -42,8 +42,7 @@ static irqreturn_t st_mmap_thermal_trip_handler(int irq, void *sdata) { struct st_thermal_sensor *sensor = sdata; - thermal_zone_device_update(sensor->thermal_dev, - THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(sensor->thermal_dev); return IRQ_HANDLED; } diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 6ab9823..1fbd4bd 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -501,12 +501,12 @@ void thermal_notify_framework(struct thermal_zone_device *tz, int trip) } EXPORT_SYMBOL_GPL(thermal_notify_framework); -static void thermal_zone_device_check(struct work_struct *work) +static void thermal_zone_device_work_check(struct work_struct *work) { struct thermal_zone_device *tz = container_of(work, struct thermal_zone_device, poll_queue.work); - thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(tz); } /* @@ -990,8 +990,7 @@ static void bind_cdev(struct thermal_cooling_device *cdev) mutex_lock(&thermal_list_lock); list_for_each_entry(pos, &thermal_tz_list, node) if (atomic_cmpxchg(&pos->need_update, 1, 0)) - thermal_zone_device_update(pos, - THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(pos); mutex_unlock(&thermal_list_lock); return cdev; @@ -1273,12 +1272,12 @@ struct thermal_zone_device * /* Bind cooling devices for this zone */ bind_tz(tz); - INIT_DELAYED_WORK(&tz->poll_queue, thermal_zone_device_check); + INIT_DELAYED_WORK(&tz->poll_queue, thermal_zone_device_work_check); thermal_zone_device_reset(tz); /* Update the new thermal zone and mark it as already updated. */ if (atomic_cmpxchg(&tz->need_update, 1, 0)) - thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(tz); return tz; @@ -1502,8 +1501,7 @@ static int thermal_pm_notify(struct notifier_block *nb, atomic_set(&in_suspend, 0); list_for_each_entry(tz, &thermal_tz_list, node) { thermal_zone_device_reset(tz); - thermal_zone_device_update(tz, - THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(tz); } break; default: diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c index b18cee2..14b7a7e 100644 --- a/drivers/thermal/thermal_helpers.c +++ b/drivers/thermal/thermal_helpers.c @@ -238,3 +238,9 @@ int thermal_zone_set_mode(struct thermal_zone_device *tz, return tz->ops->set_mode(tz, mode); } EXPORT_SYMBOL_GPL(thermal_zone_set_mode); + +void thermal_zone_device_check(struct thermal_zone_device *tz) +{ + thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); +} +EXPORT_SYMBOL_GPL(thermal_zone_device_check); diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c index 2e9e762..3b38fb9 100644 --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -141,7 +141,7 @@ if (ret) return ret; - thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(tz); return count; } @@ -246,7 +246,7 @@ tz->forced_passive = state; - thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(tz); return count; } @@ -313,7 +313,7 @@ } if (!ret) - thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(tz); return ret ? ret : count; } diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index b4f981d..b80b6e2 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -54,7 +54,7 @@ static void ti_thermal_work(struct work_struct *work) struct ti_thermal_data *data = container_of(work, struct ti_thermal_data, thermal_wq); - thermal_zone_device_update(data->ti_thermal, THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(data->ti_thermal); dev_dbg(&data->ti_thermal->device, "updated thermal zone %s\n", data->ti_thermal->type); diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_thermal.c index 55477d7..bb95983 100644 --- a/drivers/thermal/uniphier_thermal.c +++ b/drivers/thermal/uniphier_thermal.c @@ -248,7 +248,7 @@ static irqreturn_t uniphier_tm_alarm_irq_thread(int irq, void *_tdev) { struct uniphier_tm_dev *tdev = _tdev; - thermal_zone_device_update(tdev->tz_dev, THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(tdev->tz_dev); return IRQ_HANDLED; } diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c index 1ef937d..745defc 100644 --- a/drivers/thermal/x86_pkg_temp_thermal.c +++ b/drivers/thermal/x86_pkg_temp_thermal.c @@ -317,7 +317,7 @@ static void pkg_temp_thermal_threshold_work_fn(struct work_struct *work) * concurrent removal in the cpu offline callback. */ if (tzone) - thermal_zone_device_update(tzone, THERMAL_EVENT_UNSPECIFIED); + thermal_zone_device_check(tzone); mutex_unlock(&thermal_zone_mutex); } diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 9d21fd1..3e325b3 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -454,6 +454,7 @@ struct thermal_cooling_device * int thermal_zone_get_offset(struct thermal_zone_device *tz); int thermal_zone_set_mode(struct thermal_zone_device *tz, enum thermal_device_mode mode); +void thermal_zone_device_check(struct thermal_zone_device *tz); int get_tz_trend(struct thermal_zone_device *, int); struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, @@ -523,6 +524,8 @@ static inline int thermal_zone_get_offset( static inline int thermal_zone_set_mode( struct thermal_zone_device *tz, enum thermal_device_mode mode) { return -ENODEV; } +static inline void thermal_zone_device_check(struct thermal_zone_device *tz) +{ } static inline int get_tz_trend(struct thermal_zone_device *tz, int trip) { return -ENODEV; } static inline struct thermal_instance * From patchwork Wed Oct 17 15:52:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10645813 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 178403B73 for ; Wed, 17 Oct 2018 15:55:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0566C283A8 for ; Wed, 17 Oct 2018 15:55:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED84E285D2; Wed, 17 Oct 2018 15:55:25 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 1BF282847D for ; Wed, 17 Oct 2018 15:55:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727875AbeJQXt6 (ORCPT ); Wed, 17 Oct 2018 19:49:58 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:31501 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727610AbeJQXt6 (ORCPT ); Wed, 17 Oct 2018 19:49:58 -0400 Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20181017155334epoutp02bd8925a5f3fd046b73d015c2fddabcda~ecFDHUVWv2037720377epoutp02L; Wed, 17 Oct 2018 15:53:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20181017155334epoutp02bd8925a5f3fd046b73d015c2fddabcda~ecFDHUVWv2037720377epoutp02L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539791614; bh=53+PoU65i0BeaWqbTJPfGy0Z01gG7y7JijUIPI9SaCc=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=AZrx7/HQwJoqCY3BJbhFziB+pOQhrtZTIU6Nyku82rorjzQF88Snf3h8Iebn4zL+y MFFYOmJ8HIBDpsBtJoHtAH/MJH9FR/ZHraFQOdGB4nDPPB9Fu+j0Z0FKXpzhfknHp+ Ji6stQX/8sbKV9aHvLD5xHoWikp8t6sy9tx3g7MI= Received: from epsmges2p1.samsung.com (unknown [182.195.42.69]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20181017155333epcas2p260b5a85d31424e3733b8ba46fe906fbc~ecFB-it-k1311413114epcas2p2q; Wed, 17 Oct 2018 15:53:33 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 1C.57.04015.DFA57CB5; Thu, 18 Oct 2018 00:53:33 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20181017155332epcas2p499ac9d53678d82a9984b3533e723a0dd~ecFBJmu-t0750407504epcas2p45; Wed, 17 Oct 2018 15:53:32 +0000 (GMT) X-AuditID: b6c32a45-6c1ff70000000faf-dc-5bc75afd992a Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 32.44.03633.CFA57CB5; Thu, 18 Oct 2018 00:53:32 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGR00KZM2SD3M00@mmp2.samsung.com>; Thu, 18 Oct 2018 00:53:32 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Zhang Rui , Eduardo Valentin Cc: Amit kucheria , Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v2 03/17] thermal: separate sensor enable and check operations Date: Wed, 17 Oct 2018 17:52:29 +0200 Message-id: <1539791563-5959-4-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSe0hTcRTHO3d3d9fR4jbN/VTwsfAPJS2j6Ic9SMq6VIRSgrSoRl5UdDo2 FTXyMR+poBhFLVsmLkNWYY6V71CnW0aKj2GiltlDKqMHI5aGWdvV/z7nfL+H8z1waIG0VOhP p2ZkcZoMZbqcEpNPrWF7IlbO2BU7ZuaDcUmRkcCt+hYhXnDaAT+qHiTxXcekEPcWTwBefbco xC/adAQurWsk8b0P8yI80WmgsLN6ALDh24wIf5ivofAniwybm6covNRZT+KeN044KGV1320U Wzc3TLEdda9F7JPp3ayx+zPBmk2VFDs72U2x1SXfKLbGYgK2bbJewD6/6SJZ+1QbwTrNgXGS M+J9SVx6ag6n2X7ggjjlQcczQt19Mnd4dExQBGUxVeBFI2YX6vk7J3SzlGkHVN4UXQXi/+wC 5OhbFaybzKVGIS88BuTqvUvxxTKgxi/jHhfFRKOrV0xQBTTtwxxHloe0uy1gBkn03hnmZm8m DhlK68HNJBOKPq/+8LCEOYqKHa+AXxaIhmzXPIm8GBaNrDZ4diHmpgiNm26RvOkwMnTZ1tgb fbFbRDwHoAVTK6wNAPq63ETyRQughy9tBO/ai6z2MSEfbxOqsK6I3KkRI0EV5VIeWdTyK5s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j6N4XUsz6 L3DOGZvsbRm5FceknvAtWbTMf0b9HLvwf/cSfuXp/F1mvky7sbcy46rYw9h1duwHBE0FInY4 s135/2jJ4nsT/PqjVbzV1020NlDbObmqxT93SZYqb8ViJZbijERDLeai4kQALGxvvnwCAAA= X-CMS-MailID: 20181017155332epcas2p499ac9d53678d82a9984b3533e723a0dd X-Msg-Generator: CA CMS-TYPE: 102P X-CMS-RootMailID: 20181017155332epcas2p499ac9d53678d82a9984b3533e723a0dd References: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> 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 [devm]_thermal_zone_of_sensor_register() is used to register thermal sensor by thermal drivers using DeviceTree. Besides registering sensor this function also immediately: - enables it: tzd->ops->set_mode(tzd, THERMAL_DEVICE_ENABLED) (->set_mode is set to of_thermal_set_mode() in of-thermal.c) - checks it (indirectly by using of_thermal_set_mode()): thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); (which in turn ends up using ->get_temp method). For many DT thermal drivers this causes a problem because: - [devm]_thermal_zone_of_sensor_register() need to be called in order to obtain data about thermal trips which are then used to finish hardware sensor setup (only after which ->get_temp can be used) There is also related issue for DT thermal drivers that support IRQ (i.e. exynos and rockchip ones): - sensor hardware should be enabled only after IRQ handler is requested (because otherwise we might get IRQs that we can't handle) - IRQ handler needs tzd structure which is obtained from [devm_]thermal_zone_of_sensor_register() - after [devm_]thermal_zone_of_sensor_register() call core thermal code assumes that sensor is enabled and ready to use (i.e. that IRQ handler has been requested and sensor hardware has been enabled) In order to prepare for fixing all abovementioned issues separate sensor enable and check operations in the core thermal code and update thermal drivers accordingly: * Add set_mode_skip_check flag to struct thermal_zone_device_ops and set it in drivers that don't check the thermal zone device in their ->set_mode method implementations. * Move thermal_zone_device_check() from ->set_mode implementations to the users of thermal_zone_set_mode() (only place which calls ->set_mode). Modify mode_store() in thermal_sysfs.c accordingly. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/acpi/thermal.c | 2 ++ drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 2 -- drivers/platform/x86/acerhdf.c | 2 ++ drivers/thermal/db8500_thermal.c | 2 ++ drivers/thermal/hisi_thermal.c | 2 ++ drivers/thermal/imx_thermal.c | 2 -- drivers/thermal/int340x_thermal/int3400_thermal.c | 1 + drivers/thermal/of-thermal.c | 6 +++--- drivers/thermal/rockchip_thermal.c | 16 ++++++++++++---- drivers/thermal/thermal_sysfs.c | 3 +++ include/linux/thermal.h | 2 ++ 11 files changed, 29 insertions(+), 11 deletions(-) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index b8b275e1..a7e3d9e 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -879,6 +879,8 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, .get_crit_temp = thermal_get_crit_temp, .get_trend = thermal_get_trend, .notify = thermal_notify, + + .set_mode_skip_check = true, }; static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c index b0afd36..5f4b3bd 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c @@ -170,8 +170,6 @@ static int mlxsw_thermal_set_mode(struct thermal_zone_device *tzdev, thermal->mode = mode; - thermal_zone_device_check(tzdev); - return 0; } diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 5a2b93a..884fd83 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c @@ -507,6 +507,8 @@ static int acerhdf_get_crit_temp(struct thermal_zone_device *thermal, .get_trip_hyst = acerhdf_get_trip_hyst, .get_trip_temp = acerhdf_get_trip_temp, .get_crit_temp = acerhdf_get_crit_temp, + + .set_mode_skip_check = true, }; diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c index ab66b2d7..c4d0fb1 100644 --- a/drivers/thermal/db8500_thermal.c +++ b/drivers/thermal/db8500_thermal.c @@ -220,6 +220,8 @@ static int db8500_sys_get_crit_temp(struct thermal_zone_device *thermal, .get_trip_type = db8500_sys_get_trip_type, .get_trip_temp = db8500_sys_get_trip_temp, .get_crit_temp = db8500_sys_get_crit_temp, + + .set_mode_skip_check = true, }; static void db8500_thermal_update_config(struct db8500_thermal_zone *pzone, diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 63d4fc3..6151e55 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -561,6 +561,7 @@ static int hisi_thermal_probe(struct platform_device *pdev) } thermal_zone_set_mode((&data->sensor)->tzd, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check((&data->sensor)->tzd); return 0; } @@ -570,6 +571,7 @@ static int hisi_thermal_remove(struct platform_device *pdev) struct hisi_thermal_data *data = platform_get_drvdata(pdev); thermal_zone_set_mode((&data->sensor)->tzd, THERMAL_DEVICE_DISABLED); + thermal_zone_device_check((&data->sensor)->tzd); data->disable_sensor(data); diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 22f57ef..7abad6c 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -385,8 +385,6 @@ static int imx_set_mode(struct thermal_zone_device *tz, data->mode = mode; - thermal_zone_device_check(tz); - return 0; } diff --git a/drivers/thermal/int340x_thermal/int3400_thermal.c b/drivers/thermal/int340x_thermal/int3400_thermal.c index e26b01c..d1f0641 100644 --- a/drivers/thermal/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/int340x_thermal/int3400_thermal.c @@ -305,6 +305,7 @@ static int int3400_thermal_probe(struct platform_device *pdev) if (priv->uuid_bitmap & 1 << INT3400_THERMAL_PASSIVE_1) { int3400_thermal_ops.get_mode = int3400_thermal_get_mode; int3400_thermal_ops.set_mode = int3400_thermal_set_mode; + int3400_thermal_ops.set_mode_skip_check = true; } priv->thermal = thermal_zone_device_register("INT3400 Thermal", 0, 0, priv, &int3400_thermal_ops, diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index c422b08..f1dcb7d 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -272,8 +272,6 @@ static int of_thermal_set_mode(struct thermal_zone_device *tz, data->mode = mode; - thermal_zone_device_check(tz); - return 0; } @@ -496,9 +494,11 @@ struct thermal_zone_device * if (sensor_specs.np == sensor_np && id == sensor_id) { tzd = thermal_zone_of_add_sensor(child, sensor_np, data, ops); - if (!IS_ERR(tzd)) + if (!IS_ERR(tzd)) { thermal_zone_set_mode(tzd, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(tzd); + } of_node_put(sensor_specs.np); of_node_put(child); diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index 5640675..715f4cd 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1281,9 +1281,11 @@ static int rockchip_thermal_probe(struct platform_device *pdev) thermal->chip->control(thermal->regs, true); - for (i = 0; i < thermal->chip->chn_num; i++) + for (i = 0; i < thermal->chip->chn_num; i++) { thermal_zone_set_mode((&thermal->sensors[i])->tzd, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check((&thermal->sensors[i])->tzd); + } platform_set_drvdata(pdev, thermal); @@ -1302,9 +1304,11 @@ static int rockchip_thermal_remove(struct platform_device *pdev) struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev); int i; - for (i = 0; i < thermal->chip->chn_num; i++) + for (i = 0; i < thermal->chip->chn_num; i++) { thermal_zone_set_mode((&thermal->sensors[i])->tzd, THERMAL_DEVICE_DISABLED); + thermal_zone_device_check((&thermal->sensors[i])->tzd); + } thermal->chip->control(thermal->regs, false); @@ -1320,9 +1324,11 @@ static int __maybe_unused rockchip_thermal_suspend(struct device *dev) struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev); int i; - for (i = 0; i < thermal->chip->chn_num; i++) + for (i = 0; i < thermal->chip->chn_num; i++) { thermal_zone_set_mode((&thermal->sensors[i])->tzd, THERMAL_DEVICE_DISABLED); + thermal_zone_device_check((&thermal->sensors[i])->tzd); + } thermal->chip->control(thermal->regs, false); @@ -1372,9 +1378,11 @@ static int __maybe_unused rockchip_thermal_resume(struct device *dev) thermal->chip->control(thermal->regs, true); - for (i = 0; i < thermal->chip->chn_num; i++) + for (i = 0; i < thermal->chip->chn_num; i++) { thermal_zone_set_mode((&thermal->sensors[i])->tzd, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check((&thermal->sensors[i])->tzd); + } pinctrl_pm_select_default_state(dev); diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c index 3b38fb9..ac39fb6 100644 --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -85,6 +85,9 @@ if (result) return result; + if (!tz->ops->set_mode_skip_check) + thermal_zone_device_check(tz); + return count; } diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 3e325b3..92c460e 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -113,6 +113,8 @@ struct thermal_zone_device_ops { enum thermal_trend *); int (*notify) (struct thermal_zone_device *, int, enum thermal_trip_type); + + bool set_mode_skip_check; }; struct thermal_cooling_device_ops { From patchwork Wed Oct 17 15:52:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10645811 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3765E112B for ; Wed, 17 Oct 2018 15:55:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25980283A8 for ; Wed, 17 Oct 2018 15:55:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 191292847D; Wed, 17 Oct 2018 15:55:19 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 D31BD28479 for ; Wed, 17 Oct 2018 15:55:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727441AbeJQXuH (ORCPT ); Wed, 17 Oct 2018 19:50:07 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:31522 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727610AbeJQXuE (ORCPT ); Wed, 17 Oct 2018 19:50:04 -0400 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20181017155340epoutp0292464d300eb7fd3c238239ba75661a73~ecFIkRy0Z2037720377epoutp02M; Wed, 17 Oct 2018 15:53:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20181017155340epoutp0292464d300eb7fd3c238239ba75661a73~ecFIkRy0Z2037720377epoutp02M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539791620; bh=IPE4QZwtj36iCYq+US3BoBvPhzhDgbiYj05fqSwL6Io=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=u+s1xYxXtz+CIK06uxqJP3F8DCP3UXVjjFRrJ1aowxCjpHkPQQWwKOCSzSnKVSKpk rVCNINyqSilktx5mEN0KCALMGy30nvpSfg2XpFe+vPLvFs8Yuo9m1HiWyuy97wiau4 Z+3q646fLojtH4Mjq59kPGv8l5mZ7AmX11v4ICIA= Received: from epsmges1p3.samsung.com (unknown [182.195.42.55]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20181017155339epcas1p3f720192fada686db2ad5391167b7e557~ecFHaptJT0323503235epcas1p3m; Wed, 17 Oct 2018 15:53:39 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id 81.82.04073.30B57CB5; Thu, 18 Oct 2018 00:53:39 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20181017155338epcas1p3a22cd0b22e757c3e51eb72ccee545478~ecFG8MQc90486304863epcas1p3R; Wed, 17 Oct 2018 15:53:38 +0000 (GMT) X-AuditID: b6c32a37-3edff70000000fe9-9b-5bc75b0312c6 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 64.A6.03743.20B57CB5; Thu, 18 Oct 2018 00:53:38 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGR00KZM2SD3M00@mmp2.samsung.com>; Thu, 18 Oct 2018 00:53:38 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Zhang Rui , Eduardo Valentin Cc: Amit kucheria , Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v2 04/17] thermal: separate sensor registration and enable+check operations Date: Wed, 17 Oct 2018 17:52:30 +0200 Message-id: <1539791563-5959-5-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSe0hTYRjG+7Zzzo7LxWGKfiqIDqQUs8SsDy81xOiAFRER1KgcelDxNnbU 0j90aVbeMy1NzWQaybC0uZx5IZ26ZZSZiop2wRTJuzDN0tCcR/97nu/9Pd/7vvCSfHEm7khG xSUwyjh5jIQQYk1d7l6H+TKT7OjyjCPKUFXz0OvSehxNm00AvczrwdCzoWEcddweBGjr5xyO PujTeehOmRpDNVMTAjTYUkEgc143QBWL4wI0NZFPoF86e6StHSXQ35ZKDLV/NwOpmE5fMhJ0 2Y9PBP227JuAfjPmS1e3zfBorSaLoL8OtxF0XsYiQefrNIDWD1fy6fclaxhtGtXzaLPW+YLo qjAgnImJSmKUR06GCiN1C5mEYusJuLWasY6rwEpaNrAiIXUM5nc+xrOBkBRTzQDOF4zzOLMG oLm8COxR6oJljCs0AKjKKiU4sw7gbM1vvoUiKD9YeE+znSBJWyoE6upIyzOf6sHgpNndom2o a3B6SCOwaIxyg3WZI7gFF1FnYGORNdfLGfYai3CLtqJo2LdVtdMKUiUCuLGxvDtQMOzZaOJx 2gbOmnQCyz+QcoIDPYG7/PY2688xztQDWPfRuBvwh12mLzg33AG4uJqLc2ERvH9XzCE0XJpo 5XM7lgNoGswVPAAOVWCfBtgxCjY2gmG9FT5erDyWTYyL8AqLj9WCnePwONEMGvrOGgBFAom1 qNnOKBPj8iQ2OdYAIMmX2IpSXE0ysShcnpzCKONvKBNjGNYAnEhMYi+acnwqE1MR8gQmmmEU jHKvyiOtHFUAcwk+dJp5pz4oT/YPYs8P/PP7HL8Srg4sdus7lyNb9bT/Qyw5Z7vM+9w0dEjb 9USq/dPGSd/o/utzl3trE/uVLxoCFguPj6lthAP705yKN9nWK0hvHH4YikZCwra6H7EXF3Jk k2OunauXPFMrX4X5BTU5+FU2n8qR1ko3pesCCcZGyr09+EpW/h+PK1YqGAMAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRmVeSWpSXmKPExsVy+t9jQV2m6OPRBkdPmFo0Nyxmstg4Yz2r xbPPxxkt1vYeZbGYf+Uaq8WBxsuMFv8fvWa1OLW9icmiZdYiFoslTx6yW1zeNYfN4nPvEUaL Oe9us1s8edjHZvFii7jFphU32Cx+7prHYrH33mdGByGPpvfH2Dxm3T/L5rFz1l12j623TD0W 73nJ5LFpVSebx51re9g8epvfsXn0bVnF6LH92jxmjxPTv7N4HL+xncnj8ya5AN4oLpuU1JzM stQifbsErowtb1vZCv7PZKz42vyLtYHxS30XIyeHhICJxKL+DyxdjFwcQgLrGCU6tv5jhHB+ MUpMPXafHaSKTcBKYmL7KqAEB4eIgLfEljUcIDXMAkdZJNbO+MYGUiMsECvx7MoqsHoWAVWJ Na3XWUHqeQXcJTZP5oFYJidx8thkVhCbU8BD4tz/BWCtQkAlJ3e8ZJ/AyLOAkWEVo2RqQXFu em6xUYFhXmq5XnFibnFpXrpecn7uJkZgBGw7rNW3g/H+kvhDjAIcjEo8vDvEjkULsSaWFVfm HmKU4GBWEuGtUjweLcSbklhZlVqUH19UmpNafIhRmoNFSZz3dt6xSCGB9MSS1OzU1ILUIpgs EwenVAPjSs1thVyVcs5G5ktX72v9+Pv+6YNvdq77qfDgZfbG31anRKdXB75e5SbQyPyTt0jl y/s/Rksi/xneV/awlzxydc4atvC8364ZJ8KPvK7b/VzeuT2ZMfF8alj97l8Gyi/DQv6LXimT imN3sgu9beYjWcVk+urPl/zAn3YH9lyt9357pSmqOppbiaU4I9FQi7moOBEA+TV+CXwCAAA= X-CMS-MailID: 20181017155338epcas1p3a22cd0b22e757c3e51eb72ccee545478 X-Msg-Generator: CA CMS-TYPE: 101P X-CMS-RootMailID: 20181017155338epcas1p3a22cd0b22e757c3e51eb72ccee545478 References: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> 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 [devm]_thermal_zone_of_sensor_register() is used to register thermal sensor by thermal drivers using DeviceTree. Besides registering sensor this function also immediately: - enables it: tzd->ops->set_mode(tzd, THERMAL_DEVICE_ENABLED) (->set_mode is set to of_thermal_set_mode() in of-thermal.c) - checks it (indirectly by using of_thermal_set_mode()): thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); (which in turn ends up using ->get_temp method). For many DT thermal drivers this causes a problem because: - [devm]_thermal_zone_of_sensor_register() need to be called in order to obtain data about thermal trips which are then used to finish hardware sensor setup (only after which ->get_temp can be used) There is also related issue for DT thermal drivers that support IRQ (i.e. exynos and rockchip ones): - sensor hardware should be enabled only after IRQ handler is requested (because otherwise we might get IRQs that we can't handle) - IRQ handler needs tzd structure which is obtained from [devm_]thermal_zone_of_sensor_register() - after [devm_]thermal_zone_of_sensor_register() call core thermal code assumes that sensor is enabled and ready to use (i.e. that IRQ handler has been requested and sensor hardware has been enabled) In order to prepare for fixing all abovementioned issues separate sensor registration and enable+check operations in the core DT thermal code and update DT thermal drivers accordingly: * Move thermal_zone_[set_mode,device_check]() calls to the users of [devm]_thermal_zone_of_sensor_register(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ata/ahci_imx.c | 10 ++++++++-- drivers/hwmon/hwmon.c | 5 +++++ drivers/hwmon/ntc_thermistor.c | 4 ++++ drivers/hwmon/scpi-hwmon.c | 4 ++++ drivers/iio/adc/sun4i-gpadc-iio.c | 5 +++++ drivers/input/touchscreen/sun4i-ts.c | 8 +++++++- drivers/regulator/max8973-regulator.c | 3 +++ drivers/thermal/armada_thermal.c | 3 +++ drivers/thermal/broadcom/bcm2835_thermal.c | 3 +++ drivers/thermal/broadcom/brcmstb_thermal.c | 3 +++ drivers/thermal/broadcom/ns-thermal.c | 3 +++ drivers/thermal/hisi_thermal.c | 3 +++ drivers/thermal/max77620_thermal.c | 3 +++ drivers/thermal/mtk_thermal.c | 3 +++ drivers/thermal/of-thermal.c | 6 ------ drivers/thermal/qcom-spmi-temp-alarm.c | 3 +++ drivers/thermal/qcom/tsens.c | 6 ++++++ drivers/thermal/qoriq_thermal.c | 3 +++ drivers/thermal/rcar_gen3_thermal.c | 4 ++++ drivers/thermal/rcar_thermal.c | 4 ++++ drivers/thermal/rockchip_thermal.c | 3 +++ drivers/thermal/samsung/exynos_tmu.c | 3 +++ drivers/thermal/tango_thermal.c | 5 +++++ drivers/thermal/tegra/soctherm.c | 3 +++ drivers/thermal/tegra/tegra-bpmp-thermal.c | 3 +++ drivers/thermal/thermal-generic-adc.c | 3 +++ drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 3 +++ drivers/thermal/uniphier_thermal.c | 3 +++ drivers/thermal/zx2967_thermal.c | 3 +++ 29 files changed, 106 insertions(+), 9 deletions(-) diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c index b00799d..f1dcc3d 100644 --- a/drivers/ata/ahci_imx.c +++ b/drivers/ata/ahci_imx.c @@ -1141,6 +1141,7 @@ static int imx_ahci_probe(struct platform_device *pdev) IS_ENABLED(CONFIG_HWMON)) { /* Add the temperature monitor */ struct device *hwmon_dev; + struct thermal_zone_device *tzd; hwmon_dev = devm_hwmon_device_register_with_groups(dev, @@ -1151,8 +1152,13 @@ static int imx_ahci_probe(struct platform_device *pdev) ret = PTR_ERR(hwmon_dev); goto disable_clk; } - devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev, - &fsl_sata_ahci_of_thermal_ops); + tzd = devm_thermal_zone_of_sensor_register(hwmon_dev, 0, + hwmon_dev, + &fsl_sata_ahci_of_thermal_ops); + if (!IS_ERR(tzd)) { + thermal_zone_set_mode(tzd, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(tzd); + } dev_info(dev, "%s: sensor 'sata_ahci'\n", dev_name(hwmon_dev)); } diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index ac1cdf8..486d7a0 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -161,6 +161,11 @@ static int hwmon_thermal_add_sensor(struct device *dev, if (IS_ERR(tzd) && (PTR_ERR(tzd) != -ENODEV)) return PTR_ERR(tzd); + if (!IS_ERR(tzd)) { + thermal_zone_set_mode(tzd, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(tzd); + } + return 0; } #else diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c index c52d07c..d423b0f 100644 --- a/drivers/hwmon/ntc_thermistor.c +++ b/drivers/hwmon/ntc_thermistor.c @@ -647,6 +647,10 @@ static int ntc_thermistor_probe(struct platform_device *pdev) &ntc_of_thermal_ops); if (IS_ERR(tz)) dev_dbg(dev, "Failed to register to thermal fw.\n"); + else { + thermal_zone_set_mode(tz, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(tz); + } return 0; } diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c index 111d521..ad5c5d7 100644 --- a/drivers/hwmon/scpi-hwmon.c +++ b/drivers/hwmon/scpi-hwmon.c @@ -288,6 +288,10 @@ static int scpi_hwmon_probe(struct platform_device *pdev) */ if (IS_ERR(z)) devm_kfree(dev, zone); + else { + thermal_zone_set_mode(z, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(z); + } } return 0; diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index 04d7147..ff67f72 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -659,6 +659,11 @@ static int sun4i_gpadc_probe(struct platform_device *pdev) PTR_ERR(info->tzd)); return PTR_ERR(info->tzd); } + if (!IS_ERR(info->tzd)) { + thermal_zone_set_mode(info->tzd, + THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(info->tzd); + } } ret = devm_iio_device_register(&pdev->dev, indio_dev); diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c index d2e14d9..d38bf69 100644 --- a/drivers/input/touchscreen/sun4i-ts.c +++ b/drivers/input/touchscreen/sun4i-ts.c @@ -246,6 +246,7 @@ static int sun4i_ts_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; struct device *hwmon; + struct thermal_zone_device *tzd; int error; u32 reg; bool ts_attached; @@ -365,7 +366,12 @@ static int sun4i_ts_probe(struct platform_device *pdev) if (IS_ERR(hwmon)) return PTR_ERR(hwmon); - devm_thermal_zone_of_sensor_register(ts->dev, 0, ts, &sun4i_ts_tz_ops); + tzd = devm_thermal_zone_of_sensor_register(ts->dev, 0, ts, + &sun4i_ts_tz_ops); + if (!IS_ERR(tzd)) { + thermal_zone_set_mode(tzd, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(tzd); + } writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC); diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8973-regulator.c index 9a522ed..65b445e 100644 --- a/drivers/regulator/max8973-regulator.c +++ b/drivers/regulator/max8973-regulator.c @@ -523,6 +523,9 @@ static int max8973_thermal_init(struct max8973_chip *mchip) return ret; } + thermal_zone_set_mode(tzd, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(tzd); + if (mchip->irq <= 0) return 0; diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index 2c2f6d9..5a07a8d 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -692,6 +692,9 @@ static int armada_thermal_probe(struct platform_device *pdev) devm_kfree(&pdev->dev, sensor); continue; } + + thermal_zone_set_mode(tz, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(tz); } return 0; diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c index 23ad4f9..687a00c 100644 --- a/drivers/thermal/broadcom/bcm2835_thermal.c +++ b/drivers/thermal/broadcom/bcm2835_thermal.c @@ -227,6 +227,9 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) goto err_clk; } + thermal_zone_set_mode(tz, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(tz); + /* * right now the FW does set up the HW-block, so we are not * touching the configuration registers. diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 1919f91..3511ce6 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -336,6 +336,9 @@ static int brcmstb_thermal_probe(struct platform_device *pdev) return ret; } + thermal_zone_set_mode(thermal, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(thermal); + priv->thermal = thermal; irq = platform_get_irq(pdev, 0); diff --git a/drivers/thermal/broadcom/ns-thermal.c b/drivers/thermal/broadcom/ns-thermal.c index 322e741..8ace201 100644 --- a/drivers/thermal/broadcom/ns-thermal.c +++ b/drivers/thermal/broadcom/ns-thermal.c @@ -71,6 +71,9 @@ static int ns_thermal_probe(struct platform_device *pdev) return PTR_ERR(ns_thermal->tz); } + thermal_zone_set_mode(ns_thermal->tz, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(ns_thermal->tz); + platform_set_drvdata(pdev, ns_thermal); return 0; diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 6151e55..cc4e2ca 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -488,6 +488,9 @@ static int hisi_thermal_register_sensor(struct platform_device *pdev, return ret; } + thermal_zone_set_mode(sensor->tzd, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(sensor->tzd); + trip = of_thermal_get_trip_points(sensor->tzd); for (i = 0; i < of_thermal_get_ntrips(sensor->tzd); i++) { diff --git a/drivers/thermal/max77620_thermal.c b/drivers/thermal/max77620_thermal.c index e6bc69f..ffca9a7 100644 --- a/drivers/thermal/max77620_thermal.c +++ b/drivers/thermal/max77620_thermal.c @@ -125,6 +125,9 @@ static int max77620_thermal_probe(struct platform_device *pdev) return ret; } + thermal_zone_set_mode(mtherm->tz_device, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(mtherm->tz_device); + ret = devm_request_threaded_irq(&pdev->dev, mtherm->irq_tjalarm1, NULL, max77620_thermal_irq, IRQF_ONESHOT | IRQF_SHARED, diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c index 0691f26..e18cb0e 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -766,6 +766,9 @@ static int mtk_thermal_probe(struct platform_device *pdev) goto err_disable_clk_peri_therm; } + thermal_zone_set_mode(tzdev, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(tzdev); + return 0; err_disable_clk_peri_therm: diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index f1dcb7d..523ac5c 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -494,12 +494,6 @@ struct thermal_zone_device * if (sensor_specs.np == sensor_np && id == sensor_id) { tzd = thermal_zone_of_add_sensor(child, sensor_np, data, ops); - if (!IS_ERR(tzd)) { - thermal_zone_set_mode(tzd, - THERMAL_DEVICE_ENABLED); - thermal_zone_device_check(tzd); - } - of_node_put(sensor_specs.np); of_node_put(child); goto exit; diff --git a/drivers/thermal/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom-spmi-temp-alarm.c index d3910be..7ba73ca 100644 --- a/drivers/thermal/qcom-spmi-temp-alarm.c +++ b/drivers/thermal/qcom-spmi-temp-alarm.c @@ -320,6 +320,9 @@ static int qpnp_tm_probe(struct platform_device *pdev) return PTR_ERR(chip->tz_dev); } + thermal_zone_set_mode(chip->tz_dev, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(chip->tz_dev); + return 0; } diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index a2c9bfa..dbd2556 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -98,12 +98,18 @@ static int tsens_register(struct tsens_device *tmdev) for (i = 0; i < tmdev->num_sensors; i++) { tmdev->sensor[i].tmdev = tmdev; tmdev->sensor[i].id = i; + tzd = devm_thermal_zone_of_sensor_register(tmdev->dev, i, &tmdev->sensor[i], &tsens_of_ops); if (IS_ERR(tzd)) continue; + + thermal_zone_set_mode(tzd, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(tzd); + tmdev->sensor[i].tzd = tzd; + if (tmdev->ops->enable) tmdev->ops->enable(tmdev, i); } diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c index 450ed66..d8a80448 100644 --- a/drivers/thermal/qoriq_thermal.c +++ b/drivers/thermal/qoriq_thermal.c @@ -233,6 +233,9 @@ static int qoriq_tmu_probe(struct platform_device *pdev) goto err_tmu; } + thermal_zone_set_mode(data->tz, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(data->tz); + /* Enable monitoring */ site = 0x1 << (15 - data->sensor_id); tmu_write(data, site | TMR_ME | TMR_ALPF, &data->regs->tmr); diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c index e0d9424..c72453e 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -420,6 +420,10 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) ret = PTR_ERR(zone); goto error_unregister; } + + thermal_zone_set_mode(zone, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(zone); + tsc->zone = zone; ret = of_thermal_get_ntrips(tsc->zone); diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 6619a48..f2f7ad3 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -566,6 +566,10 @@ static int rcar_thermal_probe(struct platform_device *pdev) } if (chip->use_of_thermal) { + thermal_zone_set_mode(priv->zone, + THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(priv->zone); + /* * thermal_zone doesn't enable hwmon as default, * but, enable it here to keep compatible diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index 715f4cd..90d8175 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1161,6 +1161,9 @@ static int rockchip_configure_from_dt(struct device *dev, return error; } + thermal_zone_set_mode(sensor->tzd, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(sensor->tzd); + return 0; } diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 9e98b12..8ec74a62 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -1109,6 +1109,9 @@ static int exynos_tmu_probe(struct platform_device *pdev) goto err_sclk; } + thermal_zone_set_mode(data->tzd, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(data->tzd); + ret = exynos_tmu_initialize(pdev); if (ret) { dev_err(&pdev->dev, "Failed to initialize TMU\n"); diff --git a/drivers/thermal/tango_thermal.c b/drivers/thermal/tango_thermal.c index 4e67795..caa4036 100644 --- a/drivers/thermal/tango_thermal.c +++ b/drivers/thermal/tango_thermal.c @@ -90,6 +90,11 @@ static int tango_thermal_probe(struct platform_device *pdev) tango_thermal_init(priv); tzdev = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv, &ops); + if (!IS_ERR(tzdev)) { + thermal_zone_set_mode(tzdev, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(tzdev); + } + return PTR_ERR_OR_ZERO(tzdev); } diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c index ed28110..2ac9f81 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -1375,6 +1375,9 @@ static int tegra_soctherm_probe(struct platform_device *pdev) goto disable_clocks; } + thermal_zone_set_mode(z, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(z); + zone->tz = z; tegra->thermctl_tzs[soc->ttgs[i]->id] = z; diff --git a/drivers/thermal/tegra/tegra-bpmp-thermal.c b/drivers/thermal/tegra/tegra-bpmp-thermal.c index b0980db..3181110 100644 --- a/drivers/thermal/tegra/tegra-bpmp-thermal.c +++ b/drivers/thermal/tegra/tegra-bpmp-thermal.c @@ -213,6 +213,9 @@ static int tegra_bpmp_thermal_probe(struct platform_device *pdev) continue; } + thermal_zone_set_mode(tzd, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(tzd); + zone->tzd = tzd; INIT_WORK(&zone->tz_device_update_work, tz_device_update_work_fn); diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/thermal-generic-adc.c index bf1c628..c1c3746 100644 --- a/drivers/thermal/thermal-generic-adc.c +++ b/drivers/thermal/thermal-generic-adc.c @@ -143,6 +143,9 @@ static int gadc_thermal_probe(struct platform_device *pdev) return ret; } + thermal_zone_set_mode(gti->tz_dev, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(gti->tz_dev); + return 0; } diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index b80b6e2..aa15719 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -197,6 +197,9 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, return PTR_ERR(data->ti_thermal); } + thermal_zone_set_mode(data->ti_thermal, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(data->ti_thermal); + ti_bandgap_set_sensor_data(bgp, id, data); ti_bandgap_write_update_interval(bgp, data->sensor_id, data->ti_thermal->polling_delay); diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_thermal.c index bb95983..ed3a920 100644 --- a/drivers/thermal/uniphier_thermal.c +++ b/drivers/thermal/uniphier_thermal.c @@ -307,6 +307,9 @@ static int uniphier_tm_probe(struct platform_device *pdev) return PTR_ERR(tdev->tz_dev); } + thermal_zone_set_mode(tdev->tz_dev, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(tdev->tz_dev); + /* get trip points */ trips = of_thermal_get_trip_points(tdev->tz_dev); ntrips = of_thermal_get_ntrips(tdev->tz_dev); diff --git a/drivers/thermal/zx2967_thermal.c b/drivers/thermal/zx2967_thermal.c index 6acce0b..3c08e1d 100644 --- a/drivers/thermal/zx2967_thermal.c +++ b/drivers/thermal/zx2967_thermal.c @@ -168,6 +168,9 @@ static int zx2967_thermal_probe(struct platform_device *pdev) goto disable_clk_all; } + thermal_zone_set_mode(priv->tzd, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(priv->tzd); + if (priv->tzd->tzp->slope == 0) { thermal_zone_of_sensor_unregister(&pdev->dev, priv->tzd); dev_err(&pdev->dev, "coefficients of sensor is invalid\n"); From patchwork Wed Oct 17 15:52:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10645785 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6FD8113B0 for ; Wed, 17 Oct 2018 15:53:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BCF1285D2 for ; Wed, 17 Oct 2018 15:53:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CD2928647; Wed, 17 Oct 2018 15:53:57 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 296C6285D2 for ; Wed, 17 Oct 2018 15:53:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727989AbeJQXuI (ORCPT ); Wed, 17 Oct 2018 19:50:08 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:63290 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbeJQXuH (ORCPT ); Wed, 17 Oct 2018 19:50:07 -0400 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20181017155346epoutp01a97af298635505c65307adb5a6ef3caa~ecFOESDfM2806228062epoutp01h; Wed, 17 Oct 2018 15:53:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20181017155346epoutp01a97af298635505c65307adb5a6ef3caa~ecFOESDfM2806228062epoutp01h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539791626; bh=G9v961x7gTaUJ3IgOF7OjZMws+07qhAKZWxmjW9kIhg=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=EyOrKyubSlC1adEZvBP44L/8wW/QYOTz4AfGQMX9pCrOaGAy54V3DEkyYhOgHJA8m OVNXda2rkrsHL/UPdrAaD8TcaZ8Ues6PRk7MAOCE8vTUNhOFXR5UblGnTBjo9PvEb5 w0xw8Av5zuFeUHac5Q3yVgjf5VEFvQaCgaJ0dBOg= Received: from epsmges1p1.samsung.com (unknown [182.195.42.53]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20181017155345epcas1p13d4067385b5ccdc39eb3691ec37c8b6c~ecFNTNsfv1224012240epcas1p1Q; Wed, 17 Oct 2018 15:53:45 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id DB.3F.04073.90B57CB5; Thu, 18 Oct 2018 00:53:45 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20181017155345epcas1p18dee37b9a46f2bf0b68aa3ded43f2717~ecFMq4zcf2660926609epcas1p1o; Wed, 17 Oct 2018 15:53:45 +0000 (GMT) X-AuditID: b6c32a35-69fff70000000fe9-b5-5bc75b09eec9 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 95.A6.03743.80B57CB5; Thu, 18 Oct 2018 00:53:45 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGR00KZM2SD3M00@mmp2.samsung.com>; Thu, 18 Oct 2018 00:53:44 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Zhang Rui , Eduardo Valentin Cc: Amit kucheria , Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v2 05/17] thermal: bcm2835: enable+check sensor after its setup is finished Date: Wed, 17 Oct 2018 17:52:31 +0200 Message-id: <1539791563-5959-6-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSe0hTYRjG+7Zz22hxXKJfGkIDLaM0K+EryySCDlpkUf3RqBztpLJN146G FcR0kstaNyNr3m+QK6nW5iwK1HKnIruZJmYta9Sy0GReSkJrHv3ved739z7vx8dLieUmPIzK zMphDVkqrYKQYs2PomNWSpS8cpXHtQKZjHUidOfqLRx99fMANVk6MFT1tgdHrfldAE1//oGj Z64CESq01mKo3jtAoq775QTyWx4DVD70nkTegXME8jlCkf16L4H+3K/E0MOPfpAkZwqG3QRj 9XQSzD3rB5Jx9sUzdQ++ixi77TTB9Pc8IBiLaYhgzjlsgHH1VIqZJ6UTGMP3ukSM3x6RKtsn 3aBmtZlHWUNsYpo0o6jKSupLJXnXe0zACL6RxUBCQXot9JvLQDGQUnK6BUCf5TwpmAkAzY3d 2BzlKyvChMZtAC+db8UFMwlgzS/nTBZBr4cXi2z/sygqmE6BjptUoCymOzD4xR8d0Avp/dDe WQUCGqMjYX79XzKAy+itMP/MEWFXBHzqLsEDWkIz8MV0NRFYBekSEn7qLsQDPKS3wIH+VIFf CAd5BymUw+Gbjo0CXgrgz8kGTDC3ALz53C0SBhLgI/41LrxtARwaOzubKYPmU3IBYeDtmrbZ XykD8Ef+a9EFsKgazLOBEFbP6dJZLk4fF8OpdFxuVnrMoWydHcycxvL4FnD5xbZ2QFNAMV/W EuJWynHVUe6Yrh1ASqwIlh1fwivlMrXq2HHWkH3QkKtluXYQTmGKUJk3rEIpp9NVOayGZfWs Ya4roiRhRrDOkShrSlwV2VGb5hv97fuSd+fK+Deze9jbEGXdHNS3eo8miXvZtPtdasKkiDc0 V1i2qg9vmnJ38mSGr3FppXLQE+oZd4Z37zx5QBPCrxlNDp1StnU5b4wVqkcu7F2cHBWbV3Nt pGG7TxX0yuWpFGOTKTu4uxO7jcu0ak39rhMKjMtQxS0XGzjVP55NM5QWAwAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBLMWRmVeSWpSXmKPExsVy+t9jQV3O6OPRBk8+M1s0Nyxmstg4Yz2r xbPPxxkt1vYeZbGYf+Uaq8WBxsuMFv8fvWa1OLW9icmiZdYiFoslTx6yW1zeNYfN4nPvEUaL Oe9us1s8edjHZvFii7jFphU32Cx+7prHYrH33mdGByGPpvfH2Dxm3T/L5rFz1l12j623TD0W 73nJ5LFpVSebx51re9g8epvfsXn0bVnF6LH92jxmjxPTv7N4HL+xncnj8ya5AN4oLpuU1JzM stQifbsEroz2+bPYC6ZzVqy41szYwPicvYuRk0NCwETixex2li5GLg4hgXWMEs/3/mWHcH4x SvxbcJMRpIpNwEpiYvsqIJuDQ0TAW2LLGg6QGmaBoywSa2d8YwOpERaIldjbeA7MZhFQlWhc 8ocdpJ5XwF2isbsQYpmcxMljk1lBbE4BD4lz/xeAlQsBlZzc8ZJ9AiPPAkaGVYySqQXFuem5 xUYFhnmp5XrFibnFpXnpesn5uZsYgeG/7bBW3w7G+0viDzEKcDAq8fDuEDsWLcSaWFZcmXuI UYKDWUmEt0rxeLQQb0piZVVqUX58UWlOavEhRmkOFiVx3tt5xyKFBNITS1KzU1MLUotgskwc nFINjO1d26wyVQwMDxh8CLj8+IFudoSUxQfmtvYvSuwOUeeCS520dnrNW/lmVeLkR00hNxSY XSfsl/666tDmcNF583t+5nGaFUbV7H5e8OrWjMVvX50XFz4w8+0E3e4d9U8zMyWnLjpXWHnL WjDG6KGW7PUXn09+LfOfWJ7vNG1JvKOBEf9Of0dFKyWW4oxEQy3mouJEAIqMWl17AgAA X-CMS-MailID: 20181017155345epcas1p18dee37b9a46f2bf0b68aa3ded43f2717 X-Msg-Generator: CA CMS-TYPE: 101P X-CMS-RootMailID: 20181017155345epcas1p18dee37b9a46f2bf0b68aa3ded43f2717 References: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> 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 Enable+check sensor after HW-block setup (if necessary) and setting data->tz. Cc: Eric Anholt Cc: Stefan Wahren Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/broadcom/bcm2835_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c index 687a00c..ec82fef 100644 --- a/drivers/thermal/broadcom/bcm2835_thermal.c +++ b/drivers/thermal/broadcom/bcm2835_thermal.c @@ -227,9 +227,6 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) goto err_clk; } - thermal_zone_set_mode(tz, THERMAL_DEVICE_ENABLED); - thermal_zone_device_check(tz); - /* * right now the FW does set up the HW-block, so we are not * touching the configuration registers. @@ -276,6 +273,9 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) data->tz = tz; + thermal_zone_set_mode(tz, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(tz); + platform_set_drvdata(pdev, tz); bcm2835_thermal_debugfs(pdev); From patchwork Wed Oct 17 15:52:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10645807 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 319CE112B for ; Wed, 17 Oct 2018 15:55:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C8112847D for ; Wed, 17 Oct 2018 15:55:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10B8B28608; Wed, 17 Oct 2018 15:55:14 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 A69332847D for ; Wed, 17 Oct 2018 15:55:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727352AbeJQXuP (ORCPT ); Wed, 17 Oct 2018 19:50:15 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:12808 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbeJQXuO (ORCPT ); Wed, 17 Oct 2018 19:50:14 -0400 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20181017155352epoutp043607b889f6e2ff3cd430dd41af30d6c8~ecFT2duyJ1081110811epoutp04M; Wed, 17 Oct 2018 15:53:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20181017155352epoutp043607b889f6e2ff3cd430dd41af30d6c8~ecFT2duyJ1081110811epoutp04M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539791632; bh=+LQAm2YggAZ+WEiZTLMgtllvteUFmBuEekm20hRy5lQ=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=CdaqCIiq/b4mNO3D4puA+U8gndAJmOXF5X21hGuFzv5npF5kASoEPgGdMZBfA0dKV T5qZqVKqfb/CzM6Ndn8uU+epMX94oie88xUtFzQofZs9gg94D1146fTu7QDkjTx1I3 7uTxrv/nX3mjR71gC4YYDHXxBuMGJ6aTXvg9tA78= Received: from epsmges1p5.samsung.com (unknown [182.195.42.57]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20181017155352epcas1p17a3b7143594b6af0954f966abbf18055~ecFTin_ZK2660926609epcas1p1q; Wed, 17 Oct 2018 15:53:52 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id 61.D9.04081.01B57CB5; Thu, 18 Oct 2018 00:53:52 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20181017155351epcas1p171637911ef29cdec96dda648cfac51a5~ecFSfWAxx1224012240epcas1p1T; Wed, 17 Oct 2018 15:53:51 +0000 (GMT) X-AuditID: b6c32a39-689ff70000000ff1-39-5bc75b10e106 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 07.A6.03743.F0B57CB5; Thu, 18 Oct 2018 00:53:51 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGR00KZM2SD3M00@mmp2.samsung.com>; Thu, 18 Oct 2018 00:53:51 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Zhang Rui , Eduardo Valentin Cc: Amit kucheria , Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v2 06/17] thermal: brcmstb: enable+check sensor after its setup is finished Date: Wed, 17 Oct 2018 17:52:32 +0200 Message-id: <1539791563-5959-7-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAA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yz2r xbPPxxkt1vYeZbGYf+Uaq8WBxsuMFv8fvWa1OLW9icmiZdYiFoslTx6yW1zeNYfN4nPvEUaL Oe9us1s8edjHZvFii7jFphU32Cx+7prHYrH33mdGByGPpvfH2Dxm3T/L5rFz1l12j623TD0W 73nJ5LFpVSebx51re9g8epvfsXn0bVnF6LH92jxmjxPTv7N4HL+xncnj8ya5AN4oLpuU1JzM stQifbsEroy+bx1sBSvZK57PPMLcwLiIrYuRk0NCwESi7dBc5i5GLg4hgXWMEhs3XIRyfjFK rJ/3gh2kik3ASmJi+yrGLkYODhEBb4ktazhAapgFjrJIrJ3xDWySsECsxOZ9a8FsFgFVibaP 05lBbF4Bd4m76y6zQGyTkzh5bDIriM0p4CFx7v8CsHohoJqTO16yT2DkWcDIsIpRMrWgODc9 t9iowDAvtVyvODG3uDQvXS85P3cTIzACth3W6tvBeH9J/CFGAQ5GJR7eHWLHooVYE8uKK3MP MUpwMCuJ8FYpHo8W4k1JrKxKLcqPLyrNSS0+xCjNwaIkzns771ikkEB6YklqdmpqQWoRTJaJ g1OqgZFt5WLJ65GTZlpt3jHj78xQd61ikVPbNzlvqf/xWEy7ptSGKYPtqc3FedcWC7hseZW4 d9K5beqBr4Wn2rtO+f51VbdbWMyDYJafvuGLrXJ/3rjYYqdcwzTrRumtdV+3VHnsFryQqLDq Yf+C5ACpK2UJO7P/1q1jfut5POnkdIcXol/tjth1Wt1XYinOSDTUYi4qTgQA75LOYXwCAAA= X-CMS-MailID: 20181017155351epcas1p171637911ef29cdec96dda648cfac51a5 X-Msg-Generator: CA CMS-TYPE: 101P X-CMS-RootMailID: 20181017155351epcas1p171637911ef29cdec96dda648cfac51a5 References: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> 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 Enable+check sensor after setting priv->thermal. Cc: Markus Mayer Cc: bcm-kernel-feedback-list@broadcom.com Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/broadcom/brcmstb_thermal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 3511ce6..5650a6a 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -336,11 +336,11 @@ static int brcmstb_thermal_probe(struct platform_device *pdev) return ret; } + priv->thermal = thermal; + thermal_zone_set_mode(thermal, THERMAL_DEVICE_ENABLED); thermal_zone_device_check(thermal); - priv->thermal = thermal; - irq = platform_get_irq(pdev, 0); if (irq < 0) { dev_err(&pdev->dev, "could not get IRQ\n"); From patchwork Wed Oct 17 15:52:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10645787 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A397C112B for ; Wed, 17 Oct 2018 15:54:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 938F0285D2 for ; Wed, 17 Oct 2018 15:54:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86D3428614; Wed, 17 Oct 2018 15:54:09 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 27E5B285D2 for ; Wed, 17 Oct 2018 15:54:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728034AbeJQXuW (ORCPT ); Wed, 17 Oct 2018 19:50:22 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:18323 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbeJQXuV (ORCPT ); Wed, 17 Oct 2018 19:50:21 -0400 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20181017155359epoutp03daca6f889c99df4b424a420a10afec6e~ecFaLBLjq1144411444epoutp03D; Wed, 17 Oct 2018 15:53:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20181017155359epoutp03daca6f889c99df4b424a420a10afec6e~ecFaLBLjq1144411444epoutp03D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539791639; bh=BjHWSgE6ioPfo1cNsI+0aulJ9sCAkQ2i4MrtRlzD37Y=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=VUBQ1a/1721XQrT7RIXAZN3NIebztTmd1G2xVL0ElZEK6JAygeUbsL4Ryd4McxAU1 oGBF+h6IwsGWTHbqDGZqu302nSAb5wu28q0s8Be+d+QWLi6V8u/z08+ppnxVIWMLLL IeApuchZQFu0qpuNMjM5F2WsIDNvxCcK6++etgeU= Received: from epsmges1p2.samsung.com (unknown [182.195.42.54]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20181017155358epcas1p2ed29860f0fc6594a3eee6c81bb039a9f~ecFZkgmVF2440224402epcas1p22; Wed, 17 Oct 2018 15:53:58 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id B5.4D.04078.61B57CB5; Thu, 18 Oct 2018 00:53:58 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20181017155357epcas1p3900b1d3522c636fdee27ab9928c076e1~ecFYR7OVr0486304863epcas1p3Z; Wed, 17 Oct 2018 15:53:57 +0000 (GMT) X-AuditID: b6c32a36-b25ff70000000fee-d6-5bc75b1637ef Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 38.A6.03743.51B57CB5; Thu, 18 Oct 2018 00:53:57 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGR00KZM2SD3M00@mmp2.samsung.com>; Thu, 18 Oct 2018 00:53:57 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Zhang Rui , Eduardo Valentin Cc: Amit kucheria , Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v2 07/17] thermal: hisi_thermal: enable+check sensor after its setup is finished Date: Wed, 17 Oct 2018 17:52:33 +0200 Message-id: <1539791563-5959-8-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSXUiTYRTHe7b3a9bi5VXmk4LRwIspaUbmY37kReBrdlE3BQ6pmS8qTV2b H2lBS6OpNCm60OYnamVL03TmFCvxY0stzRyiqZU6zTT0YoofFdZ89e5/zvn9zzkcDiVkcnEP KikljVOnKJRSwgV73S3zPyqRW+XHLD+CUK62WoBeFTfga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jxmjxPTv7N4HL+xncnj8ya5AN4oLpuU1JzM stQifbsEroxZ69rZCzZwV/Q1n2RvYLzI2cXIySEhYCIx48p+9i5GLg4hgXWMEs1tCxghnF+M Eu+3zWACqWITsJKY2L4KKMHBISLgLbFlDQdIDbPAURaJtTO+sYHUCAskScy8eIoFxGYRUJV4 Om82M0g9r4C7xPz3DhDL5CROHpvMCmJzCnhInPu/AKxVCKjk5I6X7BMYeRYwMqxilEwtKM5N zy02KjDMSy3XK07MLS7NS9dLzs/dxAgM/22Htfp2MN5fEn+IUYCDUYmHd4fYsWgh1sSy4src Q4wSHMxKIrxVisejhXhTEiurUovy44tKc1KLDzFKc7AoifPezjsWKSSQnliSmp2aWpBaBJNl 4uCUamD0koo+tP+kiGRPxJ7FGyYHsxnPqtt1xUnE/qBc5s63rJyfsuStly2ptbhgt+5gbcdE +6T9qkrrdz76Mm93Smvz9cuSbcbHhSYIu8U8fyHxWaQx0Evk6+RApuA18QI5l847b1tXe708 qmXeivz0TkWr75WGEzVW5BlY+W8108k4KvXvyOFI691KLMUZiYZazEXFiQCOnuUxewIAAA== X-CMS-MailID: 20181017155357epcas1p3900b1d3522c636fdee27ab9928c076e1 X-Msg-Generator: CA CMS-TYPE: 101P X-CMS-RootMailID: 20181017155357epcas1p3900b1d3522c636fdee27ab9928c076e1 References: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> 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 * Enable+check sensor after checking ntrips and doing chipset specific enable operation. * Remove superfluous second sensor enable+check attempt. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/hisi_thermal.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index cc4e2ca..370696c 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -488,9 +488,6 @@ static int hisi_thermal_register_sensor(struct platform_device *pdev, return ret; } - thermal_zone_set_mode(sensor->tzd, THERMAL_DEVICE_ENABLED); - thermal_zone_device_check(sensor->tzd); - trip = of_thermal_get_trip_points(sensor->tzd); for (i = 0; i < of_thermal_get_ntrips(sensor->tzd); i++) { @@ -553,6 +550,9 @@ static int hisi_thermal_probe(struct platform_device *pdev) return ret; } + thermal_zone_set_mode((&data->sensor)->tzd, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check((&data->sensor)->tzd); + if (data->irq) { ret = devm_request_threaded_irq(dev, data->irq, NULL, hisi_thermal_alarm_irq_thread, @@ -563,9 +563,6 @@ static int hisi_thermal_probe(struct platform_device *pdev) } } - thermal_zone_set_mode((&data->sensor)->tzd, THERMAL_DEVICE_ENABLED); - thermal_zone_device_check((&data->sensor)->tzd); - return 0; } From patchwork Wed Oct 17 15:52:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10645789 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C63BC13B0 for ; Wed, 17 Oct 2018 15:54:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5B592847D for ; Wed, 17 Oct 2018 15:54:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A984028614; Wed, 17 Oct 2018 15:54:12 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 520302847D for ; Wed, 17 Oct 2018 15:54:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728062AbeJQXu3 (ORCPT ); Wed, 17 Oct 2018 19:50:29 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:18354 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbeJQXu2 (ORCPT ); Wed, 17 Oct 2018 19:50:28 -0400 Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20181017155406epoutp03538e316b4a990c068c5e462cf58fe10b~ecFgWozoZ1091710917epoutp03O; Wed, 17 Oct 2018 15:54:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20181017155406epoutp03538e316b4a990c068c5e462cf58fe10b~ecFgWozoZ1091710917epoutp03O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539791646; bh=iglxUMcPMhfUuAOYi+sNjf7vJUSJgka/85V7M93nyvo=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=EACGM29piTvSiEhaji4eos+8X4qK51JbT2mkk/T4h6aalTldLIuJnnC51nsckKNjO immpZDnPcgdyoCNXh1PB5FeRYyJKWk8YZKjTk78y3voLTZ6lrqZLi+IYWjHBISUcED S+PWwkAsuH0AkQtQ0mEJb/Egcjn/pZsTQxM9JLuA= Received: from epsmges2p4.samsung.com (unknown [182.195.42.72]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20181017155405epcas2p476aa1492bd61ab944ab4b6a3dd14c842~ecFfuBoPz2479824798epcas2p4r; Wed, 17 Oct 2018 15:54:05 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id EE.4F.04069.D1B57CB5; Thu, 18 Oct 2018 00:54:05 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20181017155403epcas2p1ed9777e96c6b2c77c2c5b67466be9843~ecFeBb2NA1266212662epcas2p1Y; Wed, 17 Oct 2018 15:54:03 +0000 (GMT) X-AuditID: b6c32a48-e59ff70000000fe5-05-5bc75b1dc546 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 44.44.03633.B1B57CB5; Thu, 18 Oct 2018 00:54:03 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGR00KZM2SD3M00@mmp2.samsung.com>; Thu, 18 Oct 2018 00:54:03 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Zhang Rui , Eduardo Valentin Cc: Amit kucheria , Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v2 08/17] thermal: qcom: tsens: enable+check sensor after its setup is finished Date: Wed, 17 Oct 2018 17:52:34 +0200 Message-id: <1539791563-5959-9-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzVSfyyUcRzue/e+771uvXo74huLdeUPNkqjfadm2TTfJat/2lrXlot3KI7d i+IP49xE7aQwOT9HoZuSC4exyY87STZdM0tIocKU3WRYiXv573k+z/Ps83y2Dy2WaUk3Ok6V z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ti0qpPN4861PWwevc3v2Dz6tqxi9Nh+bR6zx4np31k8jt/YzuTxeZNcAG8Ul01Kak5m WWqRvl0CV8bB7qNMBb/ZKrZ3zGVuYHzD2sXIySEhYCLR8XEKWxcjF4eQwDpGiV2nvzFBOL8Y Jb7t/c4OUsUmYCUxsX0VYxcjB4eIgLfEljUcIDXMAkdZJNbO+MYGUiMskCjx+948MJtFQFWi 6fRkZhCbV8BdYu/eFewQ2+QkTh6bDLaZU8BD4tz/BWD1QkA1J3e8ZJ/AyLOAkWEVo2RqQXFu em6xUYFRXmq5XnFibnFpXrpecn7uJkZgBGw7rNW/g/HxkvhDjAIcjEo8vDvEjkULsSaWFVfm HmKU4GBWEuGtUjweLcSbklhZlVqUH19UmpNafIhRmoNFSZyXP/9YpJBAemJJanZqakFqEUyW iYNTqoGxPL7QbOLq24dLm6Idy07EH+s5GpKs/N/4+Ldkl5i/xRETfOZdurn1tVtBoucpvVPH 76XOfl+f4rXucp53UFabJXf0vVLFvVM+cz48lLxOt+iPTMSHXy07eFOC2WqWxm7ZNOWJkde3 qRv3hot++vGx6dYlm3Vzptu3PW8JFfkvs0mVIzlCQ+awEktxRqKhFnNRcSIAY1i+L3wCAAA= X-CMS-MailID: 20181017155403epcas2p1ed9777e96c6b2c77c2c5b67466be9843 X-Msg-Generator: CA CMS-TYPE: 102P X-CMS-RootMailID: 20181017155403epcas2p1ed9777e96c6b2c77c2c5b67466be9843 References: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> 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 Enable+check sensor after setting tmdev->sensor[i].tzd and calling chipset specific enable operation. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/qcom/tsens.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index dbd2556..01bff96 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -105,13 +105,13 @@ static int tsens_register(struct tsens_device *tmdev) if (IS_ERR(tzd)) continue; - thermal_zone_set_mode(tzd, THERMAL_DEVICE_ENABLED); - thermal_zone_device_check(tzd); - tmdev->sensor[i].tzd = tzd; if (tmdev->ops->enable) tmdev->ops->enable(tmdev, i); + + thermal_zone_set_mode(tzd, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(tzd); } return 0; } From patchwork Wed Oct 17 15:52:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10645791 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 034AC13B0 for ; Wed, 17 Oct 2018 15:54:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E73AB2856A for ; Wed, 17 Oct 2018 15:54:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DADAD28608; Wed, 17 Oct 2018 15:54:16 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 781182856A for ; Wed, 17 Oct 2018 15:54:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728081AbeJQXue (ORCPT ); Wed, 17 Oct 2018 19:50:34 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:12874 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbeJQXud (ORCPT ); Wed, 17 Oct 2018 19:50:33 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20181017155411epoutp043b3a9aa575bb8570a99b7df764b657ac~ecFltWc_-0668806688epoutp044; Wed, 17 Oct 2018 15:54:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20181017155411epoutp043b3a9aa575bb8570a99b7df764b657ac~ecFltWc_-0668806688epoutp044 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539791652; bh=fjqApFgO1XTp91HWbt7qKPbS5qEV11jI5OGBzjdAFiY=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=dp8Qmq57p/KQ/u4Wp3A0+XVvVbYPAfJH11IpeivpdGLy1eoDjosfGQWsCiso+xflk LuEzyTICqEDNmoKfkYVwDEEV3cLvY4jlORHAGV3toPE/fUszgXHwmC2trf8PgwDC4q 1DikfeYXtDnm9VcMoaRjouI/z/PR9lvRHF4X66D4= Received: from epsmges2p1.samsung.com (unknown [182.195.42.69]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20181017155411epcas2p3c90e292309e9b0b754e4fcf11cade851~ecFk-rUiG2604526045epcas2p3f; Wed, 17 Oct 2018 15:54:11 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 07.67.04015.32B57CB5; Thu, 18 Oct 2018 00:54:11 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20181017155409epcas2p41b5770668abdb4af99646841a3dd24ec~ecFjzPh010750407504epcas2p4J; Wed, 17 Oct 2018 15:54:09 +0000 (GMT) X-AuditID: b6c32a45-6a9ff70000000faf-0d-5bc75b23fdbd Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 75.44.03633.12B57CB5; Thu, 18 Oct 2018 00:54:09 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGR00KZM2SD3M00@mmp2.samsung.com>; Thu, 18 Oct 2018 00:54:09 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Zhang Rui , Eduardo Valentin Cc: Amit kucheria , Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v2 09/17] thermal: qoriq: enable+check sensor after its setup is finished Date: Wed, 17 Oct 2018 17:52:35 +0200 Message-id: <1539791563-5959-10-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzVSZ0xTYRTla997fTRWX8r6AIOhaCIYUIzK5wjyw/GMI/pDYqyDCi+ATFtA lglLVgAlhEDKagQjaSBAKYIVHAXaQhjBKsGFMiwKhGoaJeBAyoN/55x7Tu65ySW5wru4Cxke HcdIoyWRIoKPPe729PP2EOvFe4aXbVFmWi0HtZQ34chk0QPUWNiLoZrXozh6kW4EaGVyDkf9 7RkclCV/gKG66QkeMmoqCWQp7AGocuE9D01PFBHoq9oJqerHCLSkqcZQ17gFBAjpDLOOoOWf Bgn6ifwjj257t5+u7fzGoVXKPIL+MNpJ0IWZCwRdpFYCun20mksbyhYxWj/W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GYRUJVY 0jUVLM4r4CFxasEGdohtchInj00G28wJFD/3fwFYjZCAu8TJHS/ZJzDyLGBkWMUomVpQnJue W2xUYJSXWq5XnJhbXJqXrpecn7uJERgB2w5r9e9gfLwk/hCjAAejEg/vDrFj0UKsiWXFlbmH GCU4mJVEeKsUj0cL8aYkVlalFuXHF5XmpBYfYpTmYFES5+XPPxYpJJCeWJKanZpakFoEk2Xi 4JRqYNRMOrn/cse2gxdNZL1nuGnF7j0nyBB2ZLv/zBlLJ1evuf+lRuDoheqYlXLcyU7LHVyL nKbqu8y0eJW78jJjSn6U3b/p+e0brryYK1il99D9TXdxEusWrfidrLK3QnZfrJzaoaRxUEsz dIHBsh85P67mWOf67dynxPPacfcG6R1b9h60OSYmHaDEUpyRaKjFXFScCABt4OTgfAIAAA== X-CMS-MailID: 20181017155409epcas2p41b5770668abdb4af99646841a3dd24ec X-Msg-Generator: CA CMS-TYPE: 102P X-CMS-RootMailID: 20181017155409epcas2p41b5770668abdb4af99646841a3dd24ec References: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> 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 Enable+check sensor after enabling monitoring. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/qoriq_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c index d8a80448..fb1750f 100644 --- a/drivers/thermal/qoriq_thermal.c +++ b/drivers/thermal/qoriq_thermal.c @@ -233,13 +233,13 @@ static int qoriq_tmu_probe(struct platform_device *pdev) goto err_tmu; } - thermal_zone_set_mode(data->tz, THERMAL_DEVICE_ENABLED); - thermal_zone_device_check(data->tz); - /* Enable monitoring */ site = 0x1 << (15 - data->sensor_id); tmu_write(data, site | TMR_ME | TMR_ALPF, &data->regs->tmr); + thermal_zone_set_mode(data->tz, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(data->tz); + return 0; err_tmu: From patchwork Wed Oct 17 15:52:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10645793 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C7BA8112B for ; Wed, 17 Oct 2018 15:54:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B66CF283A8 for ; Wed, 17 Oct 2018 15:54:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A996228479; Wed, 17 Oct 2018 15:54:29 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 BBC4D28462 for ; Wed, 17 Oct 2018 15:54:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727288AbeJQXuk (ORCPT ); Wed, 17 Oct 2018 19:50:40 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:63366 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbeJQXuj (ORCPT ); Wed, 17 Oct 2018 19:50:39 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20181017155418epoutp01ef3021c391a5f319ee502bad01c5d14e~ecFrXvXo62806228062epoutp01l; Wed, 17 Oct 2018 15:54:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20181017155418epoutp01ef3021c391a5f319ee502bad01c5d14e~ecFrXvXo62806228062epoutp01l DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539791658; bh=CNGKVTRYfXVdSjJbQ49PGA9Orip/uVvSegZ9MuPr7to=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=MKuQRRcqdRLILgzdDUx3y1eFmPocBxsR3Bo1neSXEuOcR3KGhnrojLNDyL5PG2UVU ItOui/IlRHZTzMo2kGduyfhcfFkE2zANDhNNRhIYcWu0lUGdWf7cmz541TFhMT9qpW 1ykSjLrH6kdCZbnaHuIw5ePwXEqJF4f1anyXHk18= Received: from epsmges2p1.samsung.com (unknown [182.195.42.69]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20181017155417epcas2p34f8c248193156f5f60af69e400620d32~ecFqftACi0461104611epcas2p3Q; Wed, 17 Oct 2018 15:54:17 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 38.67.04015.92B57CB5; Thu, 18 Oct 2018 00:54:17 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20181017155416epcas2p32f63571e9c06cd1aba2b40bcf23de8e1~ecFpk1h501998019980epcas2p3w; Wed, 17 Oct 2018 15:54:16 +0000 (GMT) X-AuditID: b6c32a45-6c1ff70000000faf-14-5bc75b29991d Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id A6.44.03633.72B57CB5; Thu, 18 Oct 2018 00:54:16 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGR00KZM2SD3M00@mmp2.samsung.com>; Thu, 18 Oct 2018 00:54:15 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Zhang Rui , Eduardo Valentin Cc: Amit kucheria , Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v2 10/17] thermal: rcar_gen3_thermal: enable+check sensor after its setup is finished Date: Wed, 17 Oct 2018 17:52:36 +0200 Message-id: <1539791563-5959-11-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSa0hTYRzGfbdz22pxOkq+KlgtxAtpXrLeMsoPGQcqunyrfcihpynexqaS 1oel4Q0Ul6TmrakVugxzrLxnzbZlqHgJ0dLEC+I9bKSmhTmPfvv9n+f5839eeCkhk4a7UtHx iZwqXh4rJcTYu07vU77eMqvMvzUfR+maagFqKK7H0YzNCtDrXDOGnn0dwtGHh4MAbU0u4OhL Y5oAPSqpwtDz6QkSDbaUEciW+wmgsuXvJJqeyCPQrNEZGWqGCfSnpQJD7T9sIJRh035aCLZk vIdgm0vGSPbtt2C2um1OwBr02QQ7OtRGsLnpywSbZ9QDtnGoQsh+LlrDWOtwo4C1GdyvS26L z0VysdHJnOrE+XBxVJ1VgysrqXulRbVAAzaJHCCiIH0SZo/NkTlATDF0E4AV7euY3WDoNQCr yrz2QrrCbsDrbwAczlTxCxsA1vSvknaDoM9CbaZ+O0RRTvRlaKyj7LKQNmNwyuZtZ0daAZd7 tDuHMdoDDkyadlhCs9Dc9XG3kDvsshTgdhZt671bul29gIRDJQ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5849FCgmkJ5akZqemFqQWwWSZODil Ghj7zxlr7lp2vmEbT8mdE5X/9afl5AZaRDLk34tlvv26wE067/Nq5/9NbDkSVxXZDvxYFp56 Y7vqvrDzGXc8ZR2yLJeJn/xZ6t65QrWP/fiMpox+qYnloZM/rXhzt8p8R8O99xNk+1PPqRRO eTV/6uxvX09vZ2R9vKH9cdeFfcaxMqyCDhvCt81SYinOSDTUYi4qTgQAaU2JQ3wCAAA= X-CMS-MailID: 20181017155416epcas2p32f63571e9c06cd1aba2b40bcf23de8e1 X-Msg-Generator: CA CMS-TYPE: 102P X-CMS-RootMailID: 20181017155416epcas2p32f63571e9c06cd1aba2b40bcf23de8e1 References: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> 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 Enable+check sensor after setting tsc->zone and checking ntrips. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/rcar_gen3_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c index c72453e..eb50f33 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -421,9 +421,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) goto error_unregister; } - thermal_zone_set_mode(zone, THERMAL_DEVICE_ENABLED); - thermal_zone_device_check(zone); - tsc->zone = zone; ret = of_thermal_get_ntrips(tsc->zone); @@ -431,6 +428,9 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) goto error_unregister; dev_info(dev, "TSC%d: Loaded %d trip points\n", i, ret); + + thermal_zone_set_mode(zone, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(zone); } priv->num_tscs = i; From patchwork Wed Oct 17 15:52:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10645795 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8191E112B for ; Wed, 17 Oct 2018 15:54:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7209C283A8 for ; Wed, 17 Oct 2018 15:54:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 666252847D; Wed, 17 Oct 2018 15:54:35 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 C04A828479 for ; Wed, 17 Oct 2018 15:54:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727018AbeJQXur (ORCPT ); Wed, 17 Oct 2018 19:50:47 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:18416 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbeJQXuq (ORCPT ); Wed, 17 Oct 2018 19:50:46 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20181017155424epoutp036af53c68a83d83721de404c5f7b6c4a9~ecFxqA1Er1091710917epoutp03S; Wed, 17 Oct 2018 15:54:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20181017155424epoutp036af53c68a83d83721de404c5f7b6c4a9~ecFxqA1Er1091710917epoutp03S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539791664; bh=EVdvRRzAO2L/q6VAysCXdYzmLoTBThv6IQRdbpQDC8g=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=e/WnkwCGr1aaqxvtyTfysIwhUEulEeKGOkacVp6xh/fGu2Ed7PyQchMyLXNNw8+rj sqNgfcWB89po3KSMjW68lRYqLZ9bNltfvJJawOG2F33xMfhtAQpoMcS6kHg65S5R0+ NauurvQaXJpLKLOqGzX4mfbAEIBju+VqK7uPPWPY= Received: from epsmges1p2.samsung.com (unknown [182.195.42.54]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20181017155423epcas1p2915446b973abf6fffd0f48c11b2941f4~ecFwtwIfD2587525875epcas1p2B; Wed, 17 Oct 2018 15:54:23 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id C7.4D.04078.F2B57CB5; Thu, 18 Oct 2018 00:54:23 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20181017155422epcas1p1644d897c62ceb36b57d33ecd4e3bc81c~ecFvYHYxN2660926609epcas1p11; Wed, 17 Oct 2018 15:54:22 +0000 (GMT) X-AuditID: b6c32a36-b25ff70000000fee-f6-5bc75b2fd120 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id E9.A6.03743.E2B57CB5; Thu, 18 Oct 2018 00:54:22 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGR00KZM2SD3M00@mmp2.samsung.com>; Thu, 18 Oct 2018 00:54:22 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Zhang Rui , Eduardo Valentin Cc: Amit kucheria , Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v2 11/17] thermal: rockchip_thermal: enable+check sensor after its setup is finished Date: Wed, 17 Oct 2018 17:52:37 +0200 Message-id: <1539791563-5959-12-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSa0hTYRjHfXcuO462TkfTt1mSCz+oeIuMN03xg8IJ+xB9EdsHHXqalzll RyUNwksX0zYyMctMzXvLsuY1MdB5WYYKqZiYZpaEulRkiCmEOU9++z/P8/s//+eFl8KYAkJO JWkzOJ1WpVGQErxzwMvX119pUQasWXxQQW6dCL170kqgXzYLQK/1QziqnpomUF/eJEB7P6wE +tSVL0K3K2pxVL+0KEaTPZUksukHAapc/ypGS4sGEi23uyJT8wyJdnqqcPThmw2EM2z+xjDJ ViyMkez7inkx2zEbxNb1rohYk/E+yc5N95KsvmCdZA3tRsB2TVdh7MfybZy1zHSJWJvJ/Yr0 muRiAqdJyuJ0/mFxksS6hi0svUR6Y/CRVZQLdiRFwJGC9DnYY3iMFQEJxdDdAM5uLmD2AUNv A1i9yhxC+tEiQoDeAvj7adN/xy6AVVUmwk6RdDAsuWcERYCinOko2N5C2dsYPYTDnzYvu3ai r8OR1mKxXeO0J8ydqiftWkqz8N78MiaEucOR4dKDlY77/fG9GtKeBelSMexrWiMFKAJWvOnH Be0EVy3tYnsupN3gxFCowJfvH7rbgAtFK4Ato8MiwRACByyfCeE6GVzfekAIZiksvMsIkoU7 Vo3wxmcAbpjbwENwog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3lVvBoLy2RIcvtWVRp2xv+mne2FvP8vXbwm453Q1I7g3+fHfZhg+nE6ZG bJc3n9SV+TyTl+1Klt6io67HWh7/0Cjy/bi8dvodJZbijERDLeai4kQADcsMZnwCAAA= X-CMS-MailID: 20181017155422epcas1p1644d897c62ceb36b57d33ecd4e3bc81c X-Msg-Generator: CA CMS-TYPE: 101P X-CMS-RootMailID: 20181017155422epcas1p1644d897c62ceb36b57d33ecd4e3bc81c References: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> 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 * Enable+check sensor explicitly in rockchip_thermal_probe() (also check sensor after doing chipset specific control operation). * Remove superfluous second sensor enable+check attempt. Cc: Heiko Stuebner Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/rockchip_thermal.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index 90d8175..ef9e2aa 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1161,9 +1161,6 @@ static int rockchip_configure_from_dt(struct device *dev, return error; } - thermal_zone_set_mode(sensor->tzd, THERMAL_DEVICE_ENABLED); - thermal_zone_device_check(sensor->tzd); - return 0; } @@ -1272,6 +1269,10 @@ static int rockchip_thermal_probe(struct platform_device *pdev) } } + for (i = 0; i < thermal->chip->chn_num; i++) + thermal_zone_set_mode((&thermal->sensors[i])->tzd, + THERMAL_DEVICE_ENABLED); + error = devm_request_threaded_irq(&pdev->dev, irq, NULL, &rockchip_thermal_alarm_irq_thread, IRQF_ONESHOT, @@ -1284,11 +1285,8 @@ static int rockchip_thermal_probe(struct platform_device *pdev) thermal->chip->control(thermal->regs, true); - for (i = 0; i < thermal->chip->chn_num; i++) { - thermal_zone_set_mode((&thermal->sensors[i])->tzd, - THERMAL_DEVICE_ENABLED); + for (i = 0; i < thermal->chip->chn_num; i++) thermal_zone_device_check((&thermal->sensors[i])->tzd); - } platform_set_drvdata(pdev, thermal); From patchwork Wed Oct 17 15:52:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10645799 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C2B513B0 for ; Wed, 17 Oct 2018 15:54:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B76227861 for ; Wed, 17 Oct 2018 15:54:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F7EC283E7; Wed, 17 Oct 2018 15:54:46 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 E225C27861 for ; Wed, 17 Oct 2018 15:54:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727304AbeJQXux (ORCPT ); Wed, 17 Oct 2018 19:50:53 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:63400 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbeJQXuw (ORCPT ); Wed, 17 Oct 2018 19:50:52 -0400 Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20181017155430epoutp018e84d6d39ec6a3c6e95cc037bc3b043b~ecF29lpfw3012130121epoutp01D; Wed, 17 Oct 2018 15:54:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20181017155430epoutp018e84d6d39ec6a3c6e95cc037bc3b043b~ecF29lpfw3012130121epoutp01D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539791670; bh=U1IhVFsSqW2TG06k3HCt9gp0mnPHXvzkI3ko6pz8vZs=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=MZIdGFi5liua3bG5uUyQVdUMynBrvfKJvDRLzTbruoAy6XVNquCV0pigXbbAxBRdN ls9TBK5xMIysjiZqwoAVIh2RmVrmTXZ/gUAnCJsO3Ho/+RJPqr5WwGvZUFQ0dK/s2n +ecKWn/XCk9G4IS39YOwyKISLOEXOOfkpir3eTPo= Received: from epsmges2p4.samsung.com (unknown [182.195.42.72]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20181017155429epcas2p4248d231b6e5ebae6c9df0f02b411546a~ecF18wDyQ0750407504epcas2p4V; Wed, 17 Oct 2018 15:54:29 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id D3.5F.04069.53B57CB5; Thu, 18 Oct 2018 00:54:29 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20181017155428epcas2p1aca0b5e7b30b89db7be7026dfa740fc6~ecF1IC3ZR2791227912epcas2p1Q; Wed, 17 Oct 2018 15:54:28 +0000 (GMT) X-AuditID: b6c32a48-e59ff70000000fe5-21-5bc75b35ce67 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id F7.44.03633.43B57CB5; Thu, 18 Oct 2018 00:54:28 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGR00KZM2SD3M00@mmp2.samsung.com>; Thu, 18 Oct 2018 00:54:28 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Zhang Rui , Eduardo Valentin Cc: Amit kucheria , Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v2 12/17] thermal: exynos: enable+check sensor after its setup is finished Date: Wed, 17 Oct 2018 17:52:38 +0200 Message-id: <1539791563-5959-13-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSa0hTYRjHfbezs7PZ5DBN3zSsFhIKWYnG25UgPxyywE9dXGWHdpiSm7Iz Jf1QpuUNp+WMeVmz1EyGlxzLTbPwumXkogyz0tVKzC5YtEDSwtyOfvv/n+f/8HseeAi+tEgQ TqSrtYxGTWfIcDHWPRS9e3uC3Cnf+du2HhXmN/FQV02nAM16nQC160Yw1PBqQoD6r4wDtPzx mwA9tRXw0NW6Rgw1z3iEaLzXiCOvbhgg4/w7IZrxVOBozhqGLK2TOPrTa8LQI7cXHJJSBT8c OFX3fgyneuqmhdSDtwlUU98XHmUxl+LU1EQfTukK53GqwmoGlG3CxKeeGBYwyjlp41FeS2Sy JEW8X8FkpOcwmh0Hz4nTBjp6+Fk14ot6nR3LBy6iDIgISMbD6govvwyICSlpB3DIWQ84swCg y9gtWEt9vuPBucZ9AMvdvRhnFgEs7O/AfSmc3AtvFJtXxgkihEyC1jY/gk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+JP8QowMGoxMO7Q+xYtBBrYllx Ze4hRgkOZiUR3irF49FCvCmJlVWpRfnxRaU5qcWHGKU5WJTEefnzj0UKCaQnlqRmp6YWpBbB ZJk4OKUaGE1/twZwfon7nu5neGT65ZmCt+5OsNq8XMol8nuFlGBO3F6jImm7yXrKU9prf044 waZ96Nj5M9qHd7733XorNfEJx8+iy1vctpidZp+57AtL0EUB+7q2HQsX16yRktv26dX5ZS7l F6XrPDklEnrW96QG5K6cL3CIv2J5yd84DSldI6Ub+js3rVRiKc5INNRiLipOBADFkLNLewIA AA== X-CMS-MailID: 20181017155428epcas2p1aca0b5e7b30b89db7be7026dfa740fc6 X-Msg-Generator: CA CMS-TYPE: 102P X-CMS-RootMailID: 20181017155428epcas2p1aca0b5e7b30b89db7be7026dfa740fc6 References: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> 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 Enable sensor after doing chipset specific initialization operation and check sensor after doing chipset specific control operation. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/samsung/exynos_tmu.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 8ec74a62..796a868 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -1109,15 +1109,14 @@ static int exynos_tmu_probe(struct platform_device *pdev) goto err_sclk; } - thermal_zone_set_mode(data->tzd, THERMAL_DEVICE_ENABLED); - thermal_zone_device_check(data->tzd); - ret = exynos_tmu_initialize(pdev); if (ret) { dev_err(&pdev->dev, "Failed to initialize TMU\n"); goto err_thermal; } + thermal_zone_set_mode(data->tzd, THERMAL_DEVICE_ENABLED); + ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq, IRQF_TRIGGER_RISING | IRQF_SHARED, dev_name(&pdev->dev), data); if (ret) { @@ -1126,6 +1125,9 @@ static int exynos_tmu_probe(struct platform_device *pdev) } exynos_tmu_control(pdev, true); + + thermal_zone_device_check(data->tzd); + return 0; err_thermal: From patchwork Wed Oct 17 15:52:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10645797 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D6B6E13B0 for ; Wed, 17 Oct 2018 15:54:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C605F27861 for ; Wed, 17 Oct 2018 15:54:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA267283E7; Wed, 17 Oct 2018 15:54:42 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 3982D27861 for ; Wed, 17 Oct 2018 15:54:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728124AbeJQXu5 (ORCPT ); Wed, 17 Oct 2018 19:50:57 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:63425 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbeJQXu4 (ORCPT ); Wed, 17 Oct 2018 19:50:56 -0400 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20181017155435epoutp01feea25e17fef6f07078a495b592bef70~ecF7ul2Uj2806228062epoutp01o; Wed, 17 Oct 2018 15:54:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20181017155435epoutp01feea25e17fef6f07078a495b592bef70~ecF7ul2Uj2806228062epoutp01o DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539791675; bh=q0417HQ33V8ssuZYKNqKRW9dtdIEQNq9i6uyn1Jgybk=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=r7QTb6dO7IWX72v3DhAxiIESnRuUH5zFXVud5Eu718ju5+d+G+yW2Iha0J5y9YGYK 5oiq5ux11pKB37LODzbpxq9H9Q8eW7CKkAkXCIMLbVQQ6Wp/QutnQg/GtAXbdj6BhS OkmR0WASf7/MpEIvu3d3jO1LyvbZjC/Ymi9kfTSQ= Received: from epsmges1p2.samsung.com (unknown [182.195.42.54]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20181017155435epcas1p383f48a2d3cb5b81fccb4a06ea948ecd7~ecF7VRzTG0486304863epcas1p3g; Wed, 17 Oct 2018 15:54:35 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 59.4D.04078.B3B57CB5; Thu, 18 Oct 2018 00:54:35 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20181017155434epcas1p33a6de1fda3c69cc966f954796a95a935~ecF67ZgmI0883908839epcas1p3a; Wed, 17 Oct 2018 15:54:34 +0000 (GMT) X-AuditID: b6c32a36-b3dff70000000fee-05-5bc75b3b1c4a Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 1B.A6.03743.A3B57CB5; Thu, 18 Oct 2018 00:54:34 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGR00KZM2SD3M00@mmp2.samsung.com>; Thu, 18 Oct 2018 00:54:34 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Zhang Rui , Eduardo Valentin Cc: Amit kucheria , Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v2 13/17] thermal: tegra: enable+check sensor after its setup is finished Date: Wed, 17 Oct 2018 17:52:39 +0200 Message-id: <1539791563-5959-14-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSfUhTURjGO3f33l2ta7cpelIQWkVoqC0sTloRkXHDAqH/2h829KKi07Gr koriV2nTSSJimKlomi3DD8zNj0CmbjnK8qNpmZo5QkvUmKIZuZxX//u97/O8PM+BQ4kkeYQ3 FZeYzKkTFQlS0hXv7PcLDAiVm+VnVnoPorzsegy1PW4h0A+7GaBX2kEc1YxbCdSXMwaQ4/sv Aln0uRjKr6zD0TPbnBiNdVeRyK4dAKhqeUqMbHMlJFro8ELtTZMk+tNdjaM3M3ZwRcLmrphI tnL2Pcl2VU6L2ddfzrH1vYsY2657SLJfrb0kq81bJtmSDh1g9dZqEfu2YgNnzZN6jLW3+0bQ d1wvRnMJcamcOujyXdfYmno9UK1R9zTdPUQ2MIk1wIWCTDAsMjtwDXClJIwBwO1qCyEMGwAu VVvJfddmiUMkCK0AWuvrCKcgYbYANG7fcjL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5+duYgRGwLbDWn07GO8viT/EKMDBqMTDu0PsWLQQa2JZcWXu IUYJDmYlEd4qxePRQrwpiZVVqUX58UWlOanFhxilOViUxHlv5x2LFBJITyxJzU5NLUgtgsky cXBKNTAaP50292yIUP+7DPOi0IeH/jeIJc25MuPp+sCTzpEGkXdzJ5y7ZPw6yGXFk0oh4d7Y N1phHe9fnD5wZv/2YwYC/NOOJ8x+eiyofWngFhENzXV72MN+PZfPiTrgUyvra3cz0/7evPKa ik7LTbPusVs+0FhcmZ3jVyzc2FrVKHzq4sG03uszvgkqsRRnJBpqMRcVJwIATPVN/3wCAAA= X-CMS-MailID: 20181017155434epcas1p33a6de1fda3c69cc966f954796a95a935 X-Msg-Generator: CA CMS-TYPE: 101P X-CMS-RootMailID: 20181017155434epcas1p33a6de1fda3c69cc966f954796a95a935 References: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> 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 Enable+check sensor after setting zone->tz and programming hwtrips. Cc: Thierry Reding Cc: Jonathan Hunter Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/tegra/soctherm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c index 2ac9f81..394b34e 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -1375,9 +1375,6 @@ static int tegra_soctherm_probe(struct platform_device *pdev) goto disable_clocks; } - thermal_zone_set_mode(z, THERMAL_DEVICE_ENABLED); - thermal_zone_device_check(z); - zone->tz = z; tegra->thermctl_tzs[soc->ttgs[i]->id] = z; @@ -1385,6 +1382,9 @@ static int tegra_soctherm_probe(struct platform_device *pdev) err = tegra_soctherm_set_hwtrips(&pdev->dev, soc->ttgs[i], z); if (err) goto disable_clocks; + + thermal_zone_set_mode(z, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(z); } soctherm_debug_init(pdev); From patchwork Wed Oct 17 15:52:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10645801 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0EF4E112B for ; Wed, 17 Oct 2018 15:54:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2339283A8 for ; Wed, 17 Oct 2018 15:54:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E599B28479; Wed, 17 Oct 2018 15:54:47 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 823EF283A8 for ; Wed, 17 Oct 2018 15:54:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728149AbeJQXvF (ORCPT ); Wed, 17 Oct 2018 19:51:05 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:12955 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbeJQXvF (ORCPT ); Wed, 17 Oct 2018 19:51:05 -0400 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20181017155443epoutp04ef1cfc5380017884c5cef126d93ec9c5~ecGC4zUxo0668806688epoutp049; Wed, 17 Oct 2018 15:54:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20181017155443epoutp04ef1cfc5380017884c5cef126d93ec9c5~ecGC4zUxo0668806688epoutp049 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539791683; bh=UQ4eoVxr3LPXmaXuV9z+qSoklL/ynuV49Be7ea1NhGI=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=vNFxEm+5DWzkcfuGqbrkKs12cAGbcOZYZMkbxLkXC5O9cZyB8RRpbV93WzdxHDbcz 9TpaEDOJ7l9E8G4EbjzbwTL12R8oioR4Vx6HD1ri+yHcCqCjKBn1wTsR8mYLsEMXTx Zi3kUYY3TJkD7LS3m+1A/JsVOwBCw04bTU33g5bM= Received: from epsmges1p5.samsung.com (unknown [182.195.42.57]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20181017155442epcas1p246b2e004b4aad1bff572db8c4ccdd750~ecGCEKuJB1629016290epcas1p2C; Wed, 17 Oct 2018 15:54:42 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id 54.D9.04081.24B57CB5; Thu, 18 Oct 2018 00:54:42 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20181017155440epcas1p12c33048a8c1c083496d1a8996591d884~ecGAs9xoa1224012240epcas1p1k; Wed, 17 Oct 2018 15:54:40 +0000 (GMT) X-AuditID: b6c32a39-689ff70000000ff1-77-5bc75b4222b3 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 4C.A6.03743.04B57CB5; Thu, 18 Oct 2018 00:54:40 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGR00KZM2SD3M00@mmp2.samsung.com>; Thu, 18 Oct 2018 00:54:40 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Zhang Rui , Eduardo Valentin Cc: Amit kucheria , Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v2 14/17] thermal: ti-soc-thermal: enable+check sensor after its setup is finished Date: Wed, 17 Oct 2018 17:52:40 +0200 Message-id: <1539791563-5959-15-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSbUhTURjHO7t3d9fh5DZNjwpGoyAFNS3zZGUhFRcqivpQNMpG3lTyrXtV 0rLWlExNsaQsXdOysJZlDd8SBV/mrqZJqYg1y3xBKsdCV82UNOe1b7//8/ye85wDh8TkmWIv MjYhmWETVHEKQorXtfsG+kcoeeWmEYs7ylRXiNCru9ViNGnjAXqe34GjsoFBMWq52g/Q4tiU GL2p14hQVslDHD2aGJWg/kYtgWz5RoC0VrMETYwWEOhrjQcyPBki0J9GHY6aP9vAbjmt+WEi 6JKRtwT9uuSThK79GEJXNH0T0QZ9DkEPDzYRdH6mlaALavSArh/UYXRnsR2n+aF6EW0z+ByW nZDuiGLiYlMZNjD8tDRmobIIS9I4XbC844EaTElyAUlCagusNDC5QErKqQYAa28/EAvBDmCX 2bwUnJYla36PSGi8BPBnwQwmhDkA7bOluMMiqDB4M1sPHMe6UfthTRXpKGNUBw7Hbb4OdqWi 4GzfNHAwTm2ARWVqiYNlFA1vP5tYWeYDu0xF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IhRmoNFSZz3dt6xSCGB9MSS1OzU1ILUIpgs EwenVAOjYrJK8KxtbKs4LISEe1y8Dv2+q3Zl/0bpv49vF9g6fHypFr3v7HEZqdbtP8sld+v8 1w/Z9+aE5sfy9RVXuAwFni1I2TnTcKXqkd0q3n92eFiIrpuiXfDJ+VRMk2HaTGV7ldlvb7Jt mzS9stSPXW3Vbk+JnptC6paiUpufp2v4uAYESO/vabdRYinOSDTUYi4qTgQAq9U703wCAAA= X-CMS-MailID: 20181017155440epcas1p12c33048a8c1c083496d1a8996591d884 X-Msg-Generator: CA CMS-TYPE: 101P X-CMS-RootMailID: 20181017155440epcas1p12c33048a8c1c083496d1a8996591d884 References: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> 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 Enable sensor after setting sensor data and check sensor after writing update interval. Cc: Eduardo Valentin Cc: Keerthy Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index aa15719..4675d96 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -197,13 +197,15 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, return PTR_ERR(data->ti_thermal); } + ti_bandgap_set_sensor_data(bgp, id, data); + thermal_zone_set_mode(data->ti_thermal, THERMAL_DEVICE_ENABLED); - thermal_zone_device_check(data->ti_thermal); - ti_bandgap_set_sensor_data(bgp, id, data); ti_bandgap_write_update_interval(bgp, data->sensor_id, data->ti_thermal->polling_delay); + thermal_zone_device_check(data->ti_thermal); + return 0; } From patchwork Wed Oct 17 15:52:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10645803 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D5E3C13B0 for ; Wed, 17 Oct 2018 15:54:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C493227861 for ; Wed, 17 Oct 2018 15:54:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B775A283E7; Wed, 17 Oct 2018 15:54:52 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 37DE927861 for ; Wed, 17 Oct 2018 15:54:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727330AbeJQXvK (ORCPT ); Wed, 17 Oct 2018 19:51:10 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:12977 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbeJQXvK (ORCPT ); Wed, 17 Oct 2018 19:51:10 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20181017155448epoutp04eb40f9fed910036d58e937c00b28fdca~ecGH1aG5w0269102691epoutp04j; Wed, 17 Oct 2018 15:54:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20181017155448epoutp04eb40f9fed910036d58e937c00b28fdca~ecGH1aG5w0269102691epoutp04j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539791688; bh=dhe+bkWFIacRqoxR5vBYCjnNquU4LvLJTXdac2+zIdQ=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=ZbkHzNOci8wOT4Vblgk+0BLoZDE95nhic9OUsosUe6Lg7c+jehnA/I2t09Unjl2tT vDOeqC/t4a5tAa6qnf/f/8u0YO8IKUlnAw/2F3iXplfl4u7Ia7I/F8HNgsOeTCipDD XaNRsGUkBoNAbozltA+jV/NzlYorqLE8IZ95gKBk= Received: from epsmges2p2.samsung.com (unknown [182.195.42.70]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20181017155447epcas2p3cf3d552600e8c4879fbc4cebf1b738c8~ecGHIS7qO2404124041epcas2p32; Wed, 17 Oct 2018 15:54:47 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id B5.EF.04077.74B57CB5; Thu, 18 Oct 2018 00:54:47 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20181017155447epcas2p2db761f6575de357b65eb5e39b709fead~ecGGfdRXC1848918489epcas2p22; Wed, 17 Oct 2018 15:54:47 +0000 (GMT) X-AuditID: b6c32a46-475ff70000000fed-05-5bc75b475139 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 89.44.03633.64B57CB5; Thu, 18 Oct 2018 00:54:47 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGR00KZM2SD3M00@mmp2.samsung.com>; Thu, 18 Oct 2018 00:54:46 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Zhang Rui , Eduardo Valentin Cc: Amit kucheria , Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v2 15/17] thermal: uniphier: enable+check sensor after its setup is finished Date: Wed, 17 Oct 2018 17:52:41 +0200 Message-id: <1539791563-5959-16-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSe0hTYRjG+7azc46jyWGKfjkSWhgpaaldPl1X0jzQhaAIdKGNPKjkVDYn 6j95CVNho8jyfsFL2DKcY+myCeJl89IkXZlWJposK1vhKM1Max7973nf9/fwvC+8JFdYwPMh k1LSGUWKLFmM87H2Xv8jgVFSi/SAaTgY5ec0cFBbWSsP2Z0WgJ6o+zFU+2qch7pzbQCtz37l oaGOPA66VVGPoca5GQLZOqtw5FT3AVTleEeguRkNjuYN3kjfPIGj3501GOr64AQnhXTedzNO V0xbcfpZxRRBP317iG4wfebQem0RTr8fN+G0Ot+B0xqDFtAd4zVceqB0CaMtEx0c2qn3vSiI 4R+NZ5KTMhjF/uPX+InLZh2WVsTPtGpsRA6wksXAjYTUQdjeo+MWAz4ppIwAaqrLCbZYAnDt tYO7RQ2VVWwOdACamhyblhUAG/PHMBeFU+Hw7m0tKAYk6UmdhYaWjQgu1Y/Bj05/l/agYuH8 SAnPpTHKD06UfNqwCigazht+ADbMFw6a720wbv/7I+t1uCsLUqUEVHetEiwUAe3GnxirPeAX i2GzL4J2bRvYNAC4sNKEsUUrgC0vzByWksBeyyiPXc8dFvb+JVxbQ0oACwuELELDl/UdOHtl J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5pmXuz3 ipwhI290OP7N/wmtcq526xKkb/nan7NrsOTwX73ktvYsqYzChbVXBZZyljfvMbn69vp8nwyr vBm2+12mu/d+m9e3y2mZ4X3lJ+KFhy2TgyZdL3o0f7cSS3FGoqEWc1FxIgBejN1oewIAAA== X-CMS-MailID: 20181017155447epcas2p2db761f6575de357b65eb5e39b709fead X-Msg-Generator: CA CMS-TYPE: 102P X-CMS-RootMailID: 20181017155447epcas2p2db761f6575de357b65eb5e39b709fead References: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> 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 Enable sensor after checking trip points (unipher_tm_enable_sensor() enables IRQ so we need to toggle sensor before calling it) and check sensor after doing chipset specific enable sensor operation. Cc: Masahiro Yamada Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/uniphier_thermal.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_thermal.c index ed3a920..9ccc1fc 100644 --- a/drivers/thermal/uniphier_thermal.c +++ b/drivers/thermal/uniphier_thermal.c @@ -307,9 +307,6 @@ static int uniphier_tm_probe(struct platform_device *pdev) return PTR_ERR(tdev->tz_dev); } - thermal_zone_set_mode(tdev->tz_dev, THERMAL_DEVICE_ENABLED); - thermal_zone_device_check(tdev->tz_dev); - /* get trip points */ trips = of_thermal_get_trip_points(tdev->tz_dev); ntrips = of_thermal_get_ntrips(tdev->tz_dev); @@ -332,8 +329,12 @@ static int uniphier_tm_probe(struct platform_device *pdev) return -EINVAL; } + thermal_zone_set_mode(tdev->tz_dev, THERMAL_DEVICE_ENABLED); + uniphier_tm_enable_sensor(tdev); + thermal_zone_device_check(tdev->tz_dev); + return 0; } From patchwork Wed Oct 17 15:52:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10645805 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0546D13B0 for ; Wed, 17 Oct 2018 15:55:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E928D283A8 for ; Wed, 17 Oct 2018 15:55:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCD0728592; Wed, 17 Oct 2018 15:55:04 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 778B8283E7 for ; Wed, 17 Oct 2018 15:55:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727272AbeJQXvR (ORCPT ); Wed, 17 Oct 2018 19:51:17 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:18484 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbeJQXvQ (ORCPT ); Wed, 17 Oct 2018 19:51:16 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20181017155454epoutp0362736228c3f58e5f5f49772990c8205e~ecGNos2lr1091710917epoutp03W; Wed, 17 Oct 2018 15:54:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20181017155454epoutp0362736228c3f58e5f5f49772990c8205e~ecGNos2lr1091710917epoutp03W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539791694; bh=LbMNnsGTpMcl/rBDxuDnGfFAAXGRpSxdja42TCVwLdc=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=Z+u2/OAwf77eAcrXlU/1k/3qwyDP4lbpG4vgnJeEL+jQIzJfqo0SRDfNSBVlRSZ/6 EQNPSQhbxnk+We9dgs0pYazYXoYXhRI3Q85kZHY+UgkCtcWQYR3QT3TyDbKZnL3Nn0 cyTP87hDSi33PUYirkXygHhOpOe9/87yp8MzDOo0= Received: from epsmges1p5.samsung.com (unknown [182.195.42.57]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20181017155454epcas1p446c53c16fc040b74bd226497dfc4fc1e~ecGNL2-dn0539705397epcas1p4X; Wed, 17 Oct 2018 15:54:54 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id E5.D9.04081.E4B57CB5; Thu, 18 Oct 2018 00:54:54 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20181017155453epcas1p3be6976375c18583bcbebc7ff7853ae50~ecGMQeGj90323503235epcas1p39; Wed, 17 Oct 2018 15:54:53 +0000 (GMT) X-AuditID: b6c32a39-689ff70000000ff1-85-5bc75b4e5db7 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id BD.A6.03743.D4B57CB5; Thu, 18 Oct 2018 00:54:53 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGR00KZM2SD3M00@mmp2.samsung.com>; Thu, 18 Oct 2018 00:54:53 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Zhang Rui , Eduardo Valentin Cc: Amit kucheria , Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v2 16/17] thermal: zx2967: enable+check sensor after its setup is finished Date: Wed, 17 Oct 2018 17:52:42 +0200 Message-id: <1539791563-5959-17-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSa0hTYRjHe7dzzs5Gs9M0fVOQWvhBK01JeC27UBEvKVKUUK6wYSeTvMwd L2V+mDO6iJPMSvHWyowainOuNNOKqZuZGeUF84q17GZTWxlWZOnJb//n//yeGzy0UJZNetJx iSmsOlEZL6ckxP0W3w3rIxQ2xQZ9pSvK1lQIUG1RDYnGnTaAqnVtBLre00eiJ1ndAM29+Uyi jnqtAJ0tvkmgW/YxEepuLKWQU9cKUKljUITsY3kU+mD2QKY7/RSabSwnUPOIE2yXYe2klcLF o88p/KB4WITvDQTjiqaPAmwyXKTwUF8ThXXZDgrnmQ0A1/eVC3F74Q8C2/rrBdhp8t4rjZKE HmPj49JYdcDWo5ITX3rbRSqb+JRhWiPUgBI6B4hpyGyEN67WUTlAQsuYBgBr2i+TfPADwJcd M8JF6n3HlIBPGAGc0k39p34COJn/bYGimE0w/7wB5ACadmPCoLlqYYSQaSPgW6fvvO3KHIZ2 zYp5m2B84MjEHzCvpQyGs9MFJD/LGz618lr8z++a0y9sB5kCEXSMZwl4aBfUNNpFvHaFn2xm 0Xx/yHjBV21beL4QwImflQQf1ABY1Wn9X7wZtthekvxyLtDxPZfki6XwwjkZLzG0FuznTywB cOT3uPASWKkHSwzAnVVxCb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5evcwQacU5KTt3P6tyCeINK7nRZ63kZPFQY7rf16tSNroeeh3fDolvyP3A NtfkUf/iz6fF+dcmHCjg3XmokONa9O0LvPU665hUlFiKMxINtZiLihMBWBlVI3wCAAA= X-CMS-MailID: 20181017155453epcas1p3be6976375c18583bcbebc7ff7853ae50 X-Msg-Generator: CA CMS-TYPE: 101P X-CMS-RootMailID: 20181017155453epcas1p3be6976375c18583bcbebc7ff7853ae50 References: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> 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 Enable+check sensor after checking sensor coefficients. Cc: Jun Nie Cc: Baoyou Xie Cc: Shawn Guo Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/zx2967_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/zx2967_thermal.c b/drivers/thermal/zx2967_thermal.c index 3c08e1d..4e30b1f 100644 --- a/drivers/thermal/zx2967_thermal.c +++ b/drivers/thermal/zx2967_thermal.c @@ -168,9 +168,6 @@ static int zx2967_thermal_probe(struct platform_device *pdev) goto disable_clk_all; } - thermal_zone_set_mode(priv->tzd, THERMAL_DEVICE_ENABLED); - thermal_zone_device_check(priv->tzd); - if (priv->tzd->tzp->slope == 0) { thermal_zone_of_sensor_unregister(&pdev->dev, priv->tzd); dev_err(&pdev->dev, "coefficients of sensor is invalid\n"); @@ -178,6 +175,9 @@ static int zx2967_thermal_probe(struct platform_device *pdev) goto disable_clk_all; } + thermal_zone_set_mode(priv->tzd, THERMAL_DEVICE_ENABLED); + thermal_zone_device_check(priv->tzd); + priv->dev = &pdev->dev; platform_set_drvdata(pdev, priv); From patchwork Wed Oct 17 15:52:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10645809 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 594FD13B0 for ; Wed, 17 Oct 2018 15:55:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 474D528479 for ; Wed, 17 Oct 2018 15:55:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B5D728592; Wed, 17 Oct 2018 15:55:12 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 CABDD28479 for ; Wed, 17 Oct 2018 15:55:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727788AbeJQXvX (ORCPT ); Wed, 17 Oct 2018 19:51:23 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:13018 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbeJQXvX (ORCPT ); Wed, 17 Oct 2018 19:51:23 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20181017155501epoutp045191e2d958d75bf6499617949fd5cccc~ecGUCVN1e0668806688epoutp04A; Wed, 17 Oct 2018 15:55:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20181017155501epoutp045191e2d958d75bf6499617949fd5cccc~ecGUCVN1e0668806688epoutp04A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539791701; bh=pxP8DeqDYXDPZXv4SFu8SA/qiItJUsaW7Awn5Qn1Be0=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=dAMSNETSIcj8dLe9dodtUIqpMspcbShWqKbbkEH/ZjZY4cJw8/uhF2ulkl9KN9d23 G3eQiWQUEqtyCyjEJIPARt6u35BYyt/H/UzBNtR4q9640lPwi+yjCHZVi6ecaQPA6m XlfzdgDiqGAVA8efkz6KSG9OH5Na9X+e1E6Rnv/M= Received: from epsmges1p1.samsung.com (unknown [182.195.42.53]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20181017155500epcas1p30b76f626586f26847a992f2333dc01dc~ecGSsGYO40486304863epcas1p3l; Wed, 17 Oct 2018 15:55:00 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id 0F.3F.04073.45B57CB5; Thu, 18 Oct 2018 00:55:00 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20181017155459epcas1p470bd73f433cdbb0f7a11aa8d46212e4e~ecGSCM97Z0540205402epcas1p4a; Wed, 17 Oct 2018 15:54:59 +0000 (GMT) X-AuditID: b6c32a35-69fff70000000fe9-0b-5bc75b548924 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id EE.A6.03743.35B57CB5; Thu, 18 Oct 2018 00:54:59 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGR00KZM2SD3M00@mmp2.samsung.com>; Thu, 18 Oct 2018 00:54:59 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Zhang Rui , Eduardo Valentin Cc: Amit kucheria , Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v2 17/17] thermal: warn on attempts to read temperature on disabled sensors Date: Wed, 17 Oct 2018 17:52:43 +0200 Message-id: <1539791563-5959-18-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSa0hTYRjHfXcuO4qzwzR9VTAaSGhqCUkvXaQPSgf1Q0EYNDVHHlTadOyo pRF4WWrWpMhSl5rmpRBFHTMvKYi6rQ0TzUtiamhmmmblKNGw1Tz67fd/nt/D87zwUpj4DuFF JaeksaoUmVxCOuGvBvyCAi9JTdLj40suKC+7VoDayloItGQ1AdSsMeDo2fgkgfpyxgCyLawS yNKRK0Bq7XMc1S3OC9FYdwWJrJpBgCrWPwjR4nwxiZb1Hkj3copEW91VOOqds4JzYib3u5Fk tB/fkkyXdlbItE+HMLU9KwJG13iXZGYme0hGk7dOMsX6RsB0TFZhzJvSTZwxTXUIGKvO54Lo itOZBFaenMGqjoXGOyUZ84YIZfGBm3NbZiwbdDgXAUcK0idgbqsNKwJOlJjuBFA7mUfyYRNA y5dmsG+VzPYRfKMVwC5LKc6HbQDV9U27Fkmfgg8LGv8zRbnRkVDfRNnLGG3A4Sern51d6Vi4 sNCM2xmnfeGTIT1mZxHNwPLVcZJf5gPNxkeEnR3/14dt1bsXQbpUCMt/FGC8FAbXXmuEPLvC rya90L4X0t7wneHsng/g2nY9zocWAJuGjAJ+4DQcMI0S/HUucP3XfYIfFsHCfDGvMNBc1rb3 yKcAlhRWkA+AZzVwaATurJJTJLJcsDI4iJMpuPSUxKBrqQod2P0c/iGdoGQ4qh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77u7OCrq7x 1FE9PUlY/vDm9G1lJy96C8u+Wl2ju1IoLLr205+fzV+VWIozEg21mIuKEwGb2RIwfAIAAA== X-CMS-MailID: 20181017155459epcas1p470bd73f433cdbb0f7a11aa8d46212e4e X-Msg-Generator: CA CMS-TYPE: 101P X-CMS-RootMailID: 20181017155459epcas1p470bd73f433cdbb0f7a11aa8d46212e4e References: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> 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 * Add ops_of_thermal flag to struct thermal_zone_device_ops and set it in of-thermal.c. * Add checking sensor mode for drivers using of-thermal.c to thermal_zone_get_temp() (print a warning if sensor is disabled). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/of-thermal.c | 2 ++ drivers/thermal/thermal_helpers.c | 12 ++++++++++++ include/linux/thermal.h | 1 + 3 files changed, 15 insertions(+) diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 523ac5c..912bd85 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -378,6 +378,8 @@ static int of_thermal_get_crit_temp(struct thermal_zone_device *tz, .bind = of_thermal_bind, .unbind = of_thermal_unbind, + + .ops_of_thermal = true, }; /*** sensor API ***/ diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c index 14b7a7e..12d1f53 100644 --- a/drivers/thermal/thermal_helpers.c +++ b/drivers/thermal/thermal_helpers.c @@ -84,6 +84,18 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) if (!tz || IS_ERR(tz) || !tz->ops->get_temp) goto exit; + if (tz->ops->ops_of_thermal) { + enum thermal_device_mode mode; + + ret = tz->ops->get_mode(tz, &mode); + if (ret) + goto exit; + + if (mode == THERMAL_DEVICE_DISABLED) + dev_warn_once(&tz->device, + "trying to read out disabled thermal zone\n"); + } + mutex_lock(&tz->lock); ret = tz->ops->get_temp(tz, temp); diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 92c460e..2215e11 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -115,6 +115,7 @@ struct thermal_zone_device_ops { enum thermal_trip_type); bool set_mode_skip_check; + bool ops_of_thermal; }; struct thermal_cooling_device_ops {