From: <michael.kao@mediatek.com>
To: Zhang Rui <rui.zhang@intel.com>,
Eduardo Valentin <edubezval@gmail.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Matthias Brugger <matthias.bgg@gmail.com>
Cc: <linux-pm@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
Michael Kao <michael.kao@mediatek.com>
Subject: [PATCH v2,5/7] thermal: mediatek: add flag for bank selection
Date: Wed, 20 Feb 2019 20:31:31 +0800 [thread overview]
Message-ID: <1550665893-22561-6-git-send-email-michael.kao@mediatek.com> (raw)
In-Reply-To: <1550665893-22561-1-git-send-email-michael.kao@mediatek.com>
From: Michael Kao <michael.kao@mediatek.com>
For past ic designs, the thermal controller should select banks before
reading the thermal sensor.
And the new ic design architecture removes this mechanism.
Signed-off-by: Michael Kao <michael.kao@mediatek.com>
---
drivers/thermal/mtk_thermal.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
index c96a746..0a3944e 100644
--- a/drivers/thermal/mtk_thermal.c
+++ b/drivers/thermal/mtk_thermal.c
@@ -213,6 +213,7 @@ struct mtk_thermal_data {
const int cali_val;
const int num_controller;
const int *controller_offset;
+ bool need_switch_bank;
struct thermal_bank_cfg bank_data[];
};
@@ -327,6 +328,7 @@ struct mtk_thermal {
.cali_val = MT8173_CALIBRATION,
.num_controller = MT8173_NUM_CONTROLLER,
.controller_offset = mt8173_tc_offset,
+ .need_switch_bank = true,
.bank_data = {
{
.num_sensors = 2,
@@ -365,6 +367,7 @@ struct mtk_thermal {
.cali_val = MT2701_CALIBRATION,
.num_controller = MT2701_NUM_CONTROLLER,
.controller_offset = mt2701_tc_offset,
+ .need_switch_bank = true,
.bank_data = {
{
.num_sensors = 3,
@@ -394,6 +397,7 @@ struct mtk_thermal {
.cali_val = MT2712_CALIBRATION,
.num_controller = MT2712_NUM_CONTROLLER,
.controller_offset = mt2712_tc_offset,
+ .need_switch_bank = true,
.bank_data = {
{
.num_sensors = 4,
@@ -417,6 +421,7 @@ struct mtk_thermal {
.cali_val = MT7622_CALIBRATION,
.num_controller = MT7622_NUM_CONTROLLER,
.controller_offset = mt7622_tc_offset,
+ .need_switch_bank = true,
.bank_data = {
{
.num_sensors = 1,
@@ -463,12 +468,14 @@ static void mtk_thermal_get_bank(struct mtk_thermal_bank *bank)
struct mtk_thermal *mt = bank->mt;
u32 val;
- mutex_lock(&mt->lock);
+ if (mt->conf->need_switch_bank) {
+ mutex_lock(&mt->lock);
- val = readl(mt->thermal_base + PTPCORESEL);
- val &= ~0xf;
- val |= bank->id;
- writel(val, mt->thermal_base + PTPCORESEL);
+ val = readl(mt->thermal_base + PTPCORESEL);
+ val &= ~0xf;
+ val |= bank->id;
+ writel(val, mt->thermal_base + PTPCORESEL);
+ }
}
/**
@@ -481,7 +488,8 @@ static void mtk_thermal_put_bank(struct mtk_thermal_bank *bank)
{
struct mtk_thermal *mt = bank->mt;
- mutex_unlock(&mt->lock);
+ if (mt->conf->need_switch_bank)
+ mutex_unlock(&mt->lock);
}
/**
--
1.9.1
next prev parent reply other threads:[~2019-02-20 12:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-20 12:31 [PATCH v2,0/7] Add Mediatek thermal dirver for mt8183 michael.kao
2019-02-20 12:31 ` [PATCH v2,1/7] thermal: mediatek: fix register index error michael.kao
2019-02-20 12:31 ` [PATCH v2,2/7] thermal: mediatek: add common index of vts settings michael.kao
2019-02-20 12:31 ` [PATCH v2,3/7] thermal: mediatek: add calibration item michael.kao
2019-02-20 12:31 ` [PATCH v2,4/7] thermal: mediatek: add thermal controller offset michael.kao
2019-02-20 12:31 ` michael.kao [this message]
2019-02-20 12:31 ` [PATCH v2,6/7] dt-bindings: thermal: add binding document for mt8183 thermal controller michael.kao
2019-02-22 20:41 ` Rob Herring
2019-02-20 12:31 ` [PATCH v2,7/7] thermal: mediatek: add support for MT8183 michael.kao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1550665893-22561-6-git-send-email-michael.kao@mediatek.com \
--to=michael.kao@mediatek.com \
--cc=daniel.lezcano@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=edubezval@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=matthias.bgg@gmail.com \
--cc=robh+dt@kernel.org \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).