From patchwork Mon May 14 11:42:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10398095 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 462C1601E7 for ; Mon, 14 May 2018 11:46:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DEE429114 for ; Mon, 14 May 2018 11:46:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2039829115; Mon, 14 May 2018 11:46: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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 695BC2910D for ; Mon, 14 May 2018 11:46:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752260AbeENLp6 (ORCPT ); Mon, 14 May 2018 07:45:58 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:22526 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752733AbeENLne (ORCPT ); Mon, 14 May 2018 07:43:34 -0400 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20180514114333epoutp01dd2e41ddb392100a9aebcab60d1d637e~ugCNm1-Cs0604106041epoutp01g; Mon, 14 May 2018 11:43:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20180514114333epoutp01dd2e41ddb392100a9aebcab60d1d637e~ugCNm1-Cs0604106041epoutp01g DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1526298213; bh=1maPX7vBf9q2neu1uLFx5oRdr95X06ULQAHnytZ+mTY=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=uOx8+q534Cy8Qs+i+JPZoBvGi1p9OIhkALB0kL9n6j4vKvhQxnRsE5RUOCNL3i3MZ 0Ty63ZVAZsqwvyypsgymnZPBR8RWV+1rc4VNt2SrIkYW/zTkawRV40NClLLqj8P1dT rI5LMyGs34rOBEjzIqA3IVZCSwZ0+u2WHkA1POos= Received: from epsmges2p1.samsung.com (unknown [182.195.42.69]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20180514114332epcas2p390dcf2766aa14d26ce2c63a4c9f5a168~ugCMj3dTQ1711717117epcas2p3Z; Mon, 14 May 2018 11:43:32 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 6A.39.04128.36679FA5; Mon, 14 May 2018 20:43:31 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20180514114331epcas2p3d52dea1f2feda21ff2cce1548f3f5bd4~ugCL5WzbB1711717117epcas2p3Y; Mon, 14 May 2018 11:43:31 +0000 (GMT) X-AuditID: b6c32a45-8dbff70000001020-d9-5af97663c583 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 63.DA.03817.36679FA5; Mon, 14 May 2018 20:43:31 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P8P00KHHV793330@mmp1.samsung.com>; Mon, 14 May 2018 20:43:31 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Eduardo Valentin , Keerthy Cc: Zhang Rui , linux-pm@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH 06/14] thermal: ti-soc-thermal: remove ->threshold_[thot,tcold]_mask fields Date: Mon, 14 May 2018 13:42:13 +0200 Message-id: <1526298141-14045-7-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1526298141-14045-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrMIsWRmVeSWpSXmKPExsWy7bCmhW5K2c8og85fjBYbZ6xntZh/5Rqr xantTUwWl3fNYbOYvaSfxeJz7xFGiycP+9gc2D12zrrL7rF4z0smj74tqxg9jt/YzuTxeZNc AGsUl01Kak5mWWqRvl0CV8a1OzNZCo77V7w9cYetgfG7SxcjJ4eEgInEpq7tzF2MXBxCAjsY JR492skO4XxnlDjbepoNpmrJ0XusEIndjBJfbm5iAUkICfxilFi+JhDEZhOwkpjYvooRxBYR cJOYteQPmM0sMJVRYtOEehBbWCBW4sKlP2BDWQRUJaZPmg42h1fAQ+Jt5212iGVyEiePTWYF sTkFPCU2tL9kA1ksITCBTeLQ8tNMEEUuEr/W/WWGsIUlXh3fAtUsLfFs1UZGiIZmRolvO/ZA FU1glNizXgjCtpY4fPwiK8R1fBIdh/8CNXMAxXklOtqEIEwPiTv9URDVjhJH1x9mgXh+DqPE ygV/mCYwSi1gZFjFKJZaUJybnlpsVGCoV5yYW1yal66XnJ+7iREclVquOxhnnPM5xCjAwajE w7ti5Y8oIdbEsuLK3EOMEhzMSiK8u41+RgnxpiRWVqUW5ccXleakFh9ilOZgURLnXaP0NUpI ID2xJDU7NbUgtQgmy8TBKdXA6KWqffQrF6ukb4rIyderefZfTE+VrC3Sexx2MFj82YkN1826 Ur4+9s517JqY/q4x3+6S3nn/V4dfq7tHXNYpeuyxI1fo8DetwFC+zAU9YjMWnTodYutyOKEz 7QSf8jSunWXbWz+o7Kn+UOXSt1x0y96jSq+WO5h1BW8VcYmNLGJa823BkTuJSizFGYmGWsxF xYkAVUOWTcYCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphluLIzCtJLcpLzFFi42I5/e+xgG5y2c8og/dTxSw2zljPajH/yjVW i1Pbm5gsLu+aw2Yxe0k/i8Xn3iOMFk8e9rE5sHvsnHWX3WPxnpdMHn1bVjF6HL+xncnj8ya5 ANYoLpuU1JzMstQifbsEroxrd2ayFBz3r3h74g5bA+N3ly5GTg4JAROJJUfvsXYxcnEICexk lFj38i4TSEJI4BejRNt0YxCbTcBKYmL7KkYQW0TATWLWkj+MIA3MAlMZJSZ/OsUGkhAWiJW4 cOkPmM0ioCoxfdJ0FhCbV8BD4m3nbXaIbXISJ49NZgWxOQU8JTa0v2SDWOYhcft3C9sERp4F jAyrGCVTC4pz03OLjQqM8lLL9YoTc4tL89L1kvNzNzECw2jbYa3+HYyPl8QfYhTgYFTi4Q1Y /iNKiDWxrLgy9xCjBAezkgjvbqOfUUK8KYmVValF+fFFpTmpxYcYpTlYlMR5+fOPRQoJpCeW pGanphakFsFkmTg4pRoYDffVm4j4Ceovkfnk0/eWTSUosGR3dIfRnruJiwymdH944al8aH99 esVnu7932i8aOX/y5vnlvJ/9ir8F95ZvD4qVP5QH7wnONvrXqL+Vp0xrU4PXQ4PVr6yDGJ4+ Uj3zpZ9TbLrdwo3SMzco7vjEMGulvVaZu7Lec96jbJbqohO4K6Oz1yxRYinOSDTUYi4qTgQA H1tPkh8CAAA= X-CMS-MailID: 20180514114331epcas2p3d52dea1f2feda21ff2cce1548f3f5bd4 X-Msg-Generator: CA CMS-TYPE: 102P X-CMS-RootMailID: 20180514114331epcas2p3d52dea1f2feda21ff2cce1548f3f5bd4 X-RootMTR: 20180514114331epcas2p3d52dea1f2feda21ff2cce1548f3f5bd4 References: <1526298141-14045-1-git-send-email-b.zolnierkie@samsung.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP .threshold_[thot,tcold]_mask fields are set to identical values for all sensors supporting TALERT feature so remove them and use common defines instead. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/ti-soc-thermal/dra752-bandgap.h | 4 ---- drivers/thermal/ti-soc-thermal/dra752-thermal-data.c | 10 ---------- drivers/thermal/ti-soc-thermal/omap4-thermal-data.c | 2 -- drivers/thermal/ti-soc-thermal/omap4xxx-bandgap.h | 4 ---- drivers/thermal/ti-soc-thermal/omap5-thermal-data.c | 6 ------ drivers/thermal/ti-soc-thermal/omap5xxx-bandgap.h | 4 ---- drivers/thermal/ti-soc-thermal/ti-bandgap.c | 20 ++++++++++++++++---- drivers/thermal/ti-soc-thermal/ti-bandgap.h | 8 ++++---- 8 files changed, 20 insertions(+), 38 deletions(-) diff --git a/drivers/thermal/ti-soc-thermal/dra752-bandgap.h b/drivers/thermal/ti-soc-thermal/dra752-bandgap.h index 9490cd6..b7156bf 100644 --- a/drivers/thermal/ti-soc-thermal/dra752-bandgap.h +++ b/drivers/thermal/ti-soc-thermal/dra752-bandgap.h @@ -132,10 +132,6 @@ #define DRA752_TEMP_SENSOR_EOCZ_MASK BIT(10) #define DRA752_TEMP_SENSOR_DTEMP_MASK (0x3ff << 0) -/* DRA752.BANDGAP_THRESHOLD */ -#define DRA752_BANDGAP_THRESHOLD_HOT_MASK (0x3ff << 16) -#define DRA752_BANDGAP_THRESHOLD_COLD_MASK (0x3ff << 0) - /** * Temperature limits and thresholds for DRA752 * diff --git a/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c b/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c index c854642..a88a0e5 100644 --- a/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c +++ b/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c @@ -44,8 +44,6 @@ .mask_counter_delay_mask = DRA752_BANDGAP_CTRL_1_COUNTER_DELAY_MASK, .mask_freeze_mask = DRA752_BANDGAP_CTRL_1_FREEZE_CORE_MASK, .bgap_threshold = DRA752_BANDGAP_THRESHOLD_CORE_OFFSET, - .threshold_thot_mask = DRA752_BANDGAP_THRESHOLD_HOT_MASK, - .threshold_tcold_mask = DRA752_BANDGAP_THRESHOLD_COLD_MASK, .bgap_status = DRA752_BANDGAP_STATUS_1_OFFSET, .status_hot_mask = DRA752_BANDGAP_STATUS_1_HOT_CORE_MASK, .status_cold_mask = DRA752_BANDGAP_STATUS_1_COLD_CORE_MASK, @@ -69,8 +67,6 @@ .mask_counter_delay_mask = DRA752_BANDGAP_CTRL_1_COUNTER_DELAY_MASK, .mask_freeze_mask = DRA752_BANDGAP_CTRL_2_FREEZE_IVA_MASK, .bgap_threshold = DRA752_BANDGAP_THRESHOLD_IVA_OFFSET, - .threshold_thot_mask = DRA752_BANDGAP_THRESHOLD_HOT_MASK, - .threshold_tcold_mask = DRA752_BANDGAP_THRESHOLD_COLD_MASK, .bgap_status = DRA752_BANDGAP_STATUS_2_OFFSET, .status_hot_mask = DRA752_BANDGAP_STATUS_2_HOT_IVA_MASK, .status_cold_mask = DRA752_BANDGAP_STATUS_2_COLD_IVA_MASK, @@ -94,8 +90,6 @@ .mask_counter_delay_mask = DRA752_BANDGAP_CTRL_1_COUNTER_DELAY_MASK, .mask_freeze_mask = DRA752_BANDGAP_CTRL_1_FREEZE_MPU_MASK, .bgap_threshold = DRA752_BANDGAP_THRESHOLD_MPU_OFFSET, - .threshold_thot_mask = DRA752_BANDGAP_THRESHOLD_HOT_MASK, - .threshold_tcold_mask = DRA752_BANDGAP_THRESHOLD_COLD_MASK, .bgap_status = DRA752_BANDGAP_STATUS_1_OFFSET, .status_hot_mask = DRA752_BANDGAP_STATUS_1_HOT_MPU_MASK, .status_cold_mask = DRA752_BANDGAP_STATUS_1_COLD_MPU_MASK, @@ -119,8 +113,6 @@ .mask_counter_delay_mask = DRA752_BANDGAP_CTRL_1_COUNTER_DELAY_MASK, .mask_freeze_mask = DRA752_BANDGAP_CTRL_2_FREEZE_DSPEVE_MASK, .bgap_threshold = DRA752_BANDGAP_THRESHOLD_DSPEVE_OFFSET, - .threshold_thot_mask = DRA752_BANDGAP_THRESHOLD_HOT_MASK, - .threshold_tcold_mask = DRA752_BANDGAP_THRESHOLD_COLD_MASK, .bgap_status = DRA752_BANDGAP_STATUS_2_OFFSET, .status_hot_mask = DRA752_BANDGAP_STATUS_2_HOT_DSPEVE_MASK, .status_cold_mask = DRA752_BANDGAP_STATUS_2_COLD_DSPEVE_MASK, @@ -144,8 +136,6 @@ .mask_counter_delay_mask = DRA752_BANDGAP_CTRL_1_COUNTER_DELAY_MASK, .mask_freeze_mask = DRA752_BANDGAP_CTRL_1_FREEZE_GPU_MASK, .bgap_threshold = DRA752_BANDGAP_THRESHOLD_GPU_OFFSET, - .threshold_thot_mask = DRA752_BANDGAP_THRESHOLD_HOT_MASK, - .threshold_tcold_mask = DRA752_BANDGAP_THRESHOLD_COLD_MASK, .bgap_status = DRA752_BANDGAP_STATUS_1_OFFSET, .status_hot_mask = DRA752_BANDGAP_STATUS_1_HOT_GPU_MASK, .status_cold_mask = DRA752_BANDGAP_STATUS_1_COLD_GPU_MASK, diff --git a/drivers/thermal/ti-soc-thermal/omap4-thermal-data.c b/drivers/thermal/ti-soc-thermal/omap4-thermal-data.c index 14d9fe2..9545fe3 100644 --- a/drivers/thermal/ti-soc-thermal/omap4-thermal-data.c +++ b/drivers/thermal/ti-soc-thermal/omap4-thermal-data.c @@ -108,8 +108,6 @@ .counter_mask = OMAP4460_COUNTER_MASK, .bgap_threshold = OMAP4460_BGAP_THRESHOLD_OFFSET, - .threshold_thot_mask = OMAP4460_T_HOT_MASK, - .threshold_tcold_mask = OMAP4460_T_COLD_MASK, .tshut_threshold = OMAP4460_BGAP_TSHUT_OFFSET, .tshut_hot_mask = OMAP4460_TSHUT_HOT_MASK, diff --git a/drivers/thermal/ti-soc-thermal/omap4xxx-bandgap.h b/drivers/thermal/ti-soc-thermal/omap4xxx-bandgap.h index b87c8659..c1da37d 100644 --- a/drivers/thermal/ti-soc-thermal/omap4xxx-bandgap.h +++ b/drivers/thermal/ti-soc-thermal/omap4xxx-bandgap.h @@ -130,10 +130,6 @@ /* OMAP4460.BANDGAP_COUNTER bits */ #define OMAP4460_COUNTER_MASK (0xffffff << 0) -/* OMAP4460.BANDGAP_THRESHOLD bits */ -#define OMAP4460_T_HOT_MASK (0x3ff << 16) -#define OMAP4460_T_COLD_MASK (0x3ff << 0) - /* OMAP4460.TSHUT_THRESHOLD bits */ #define OMAP4460_TSHUT_HOT_MASK (0x3ff << 16) #define OMAP4460_TSHUT_COLD_MASK (0x3ff << 0) diff --git a/drivers/thermal/ti-soc-thermal/omap5-thermal-data.c b/drivers/thermal/ti-soc-thermal/omap5-thermal-data.c index 843faa7..51a6ab4 100644 --- a/drivers/thermal/ti-soc-thermal/omap5-thermal-data.c +++ b/drivers/thermal/ti-soc-thermal/omap5-thermal-data.c @@ -42,8 +42,6 @@ .mask_freeze_mask = OMAP5430_MASK_FREEZE_MPU_MASK, .bgap_threshold = OMAP5430_BGAP_THRESHOLD_MPU_OFFSET, - .threshold_thot_mask = OMAP5430_T_HOT_MASK, - .threshold_tcold_mask = OMAP5430_T_COLD_MASK, .tshut_threshold = OMAP5430_BGAP_TSHUT_MPU_OFFSET, .tshut_hot_mask = OMAP5430_TSHUT_HOT_MASK, @@ -75,8 +73,6 @@ .mask_freeze_mask = OMAP5430_MASK_FREEZE_GPU_MASK, .bgap_threshold = OMAP5430_BGAP_THRESHOLD_GPU_OFFSET, - .threshold_thot_mask = OMAP5430_T_HOT_MASK, - .threshold_tcold_mask = OMAP5430_T_COLD_MASK, .tshut_threshold = OMAP5430_BGAP_TSHUT_GPU_OFFSET, .tshut_hot_mask = OMAP5430_TSHUT_HOT_MASK, @@ -109,8 +105,6 @@ .mask_freeze_mask = OMAP5430_MASK_FREEZE_CORE_MASK, .bgap_threshold = OMAP5430_BGAP_THRESHOLD_CORE_OFFSET, - .threshold_thot_mask = OMAP5430_T_HOT_MASK, - .threshold_tcold_mask = OMAP5430_T_COLD_MASK, .tshut_threshold = OMAP5430_BGAP_TSHUT_CORE_OFFSET, .tshut_hot_mask = OMAP5430_TSHUT_HOT_MASK, diff --git a/drivers/thermal/ti-soc-thermal/omap5xxx-bandgap.h b/drivers/thermal/ti-soc-thermal/omap5xxx-bandgap.h index 223c7a8..ec536d8 100644 --- a/drivers/thermal/ti-soc-thermal/omap5xxx-bandgap.h +++ b/drivers/thermal/ti-soc-thermal/omap5xxx-bandgap.h @@ -93,10 +93,6 @@ #define OMAP5430_MASK_HOT_MPU_MASK BIT(1) #define OMAP5430_MASK_COLD_MPU_MASK BIT(0) -/* OMAP5430.BANDGAP_THRESHOLD */ -#define OMAP5430_T_HOT_MASK (0x3ff << 16) -#define OMAP5430_T_COLD_MASK (0x3ff << 0) - /* OMAP5430.TSHUT_THRESHOLD */ #define OMAP5430_TSHUT_HOT_MASK (0x3ff << 16) #define OMAP5430_TSHUT_COLD_MASK (0x3ff << 0) diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c index 3ac74fe..cb9a27e 100644 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c @@ -92,6 +92,18 @@ static void ti_bandgap_writel(struct ti_bandgap *bgp, u32 val, u32 reg) ti_bandgap_writel(bgp, r, t->reg); \ } while (0) +#define RMW_BITS2(bgp, id, reg, mask, val) \ +do { \ + struct temp_sensor_registers *t; \ + u32 r; \ + \ + t = bgp->conf->sensors[(id)].registers; \ + r = ti_bandgap_readl(bgp, t->reg); \ + r &= ~mask; \ + r |= (val) << __ffs(mask); \ + ti_bandgap_writel(bgp, r, t->reg); \ +} while (0) + /*** Basic helper functions ***/ /** @@ -980,10 +992,10 @@ int ti_bandgap_probe(struct platform_device *pdev) if (TI_BANDGAP_HAS(bgp, TALERT)) { /* Set initial Talert thresholds */ - RMW_BITS(bgp, i, bgap_threshold, - threshold_tcold_mask, ts_data->t_cold); - RMW_BITS(bgp, i, bgap_threshold, - threshold_thot_mask, ts_data->t_hot); + RMW_BITS2(bgp, i, bgap_threshold, + OMAP_T_COLD_MASK, ts_data->t_cold); + RMW_BITS2(bgp, i, bgap_threshold, + OMAP_T_HOT_MASK, ts_data->t_hot); /* Enable the alert events */ RMW_BITS(bgp, i, bgap_mask_ctrl, mask_hot_mask, 1); RMW_BITS(bgp, i, bgap_mask_ctrl, mask_cold_mask, 1); diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.h b/drivers/thermal/ti-soc-thermal/ti-bandgap.h index 809dbdc..2e5b146 100644 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.h +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.h @@ -68,6 +68,10 @@ * sensors, representing every sensor instance present in this bandgap. */ +/* BANDGAP_THRESHOLD */ +#define OMAP_T_HOT_MASK (0x3ff << 16) +#define OMAP_T_COLD_MASK (0x3ff << 0) + /** * struct temp_sensor_registers - descriptor to access registers and bitfields * @temp_sensor_ctrl: TEMP_SENSOR_CTRL register offset @@ -85,8 +89,6 @@ * @bgap_counter: BANDGAP_COUNTER register offset * @counter_mask: mask to bandgap_counter.counter * @bgap_threshold: BANDGAP_THRESHOLD register offset (TALERT thresholds) - * @threshold_thot_mask: mask to bandgap_threhold.thot - * @threshold_tcold_mask: mask to bandgap_threhold.tcold * @tshut_threshold: TSHUT_THRESHOLD register offset (TSHUT thresholds) * @tshut_hot_mask: mask to tshut_threhold.thot * @tshut_cold_mask: mask to tshut_threhold.thot @@ -126,8 +128,6 @@ struct temp_sensor_registers { u32 counter_mask; u32 bgap_threshold; - u32 threshold_thot_mask; - u32 threshold_tcold_mask; u32 tshut_threshold; u32 tshut_hot_mask;