summaryrefslogtreecommitdiffstats
path: root/drivers/thermal
diff options
context:
space:
mode:
authorMichael Kao <michael.kao@mediatek.com>2019-02-01 15:38:11 +0800
committerEduardo Valentin <edubezval@gmail.com>2019-02-05 17:01:47 -0800
commitcb82aaade9d1bf87dadd95534c31304fb4b2ffe8 (patch)
tree4512bc9ae98a2ab66bf5b619b0168f6932209ba7 /drivers/thermal
parentbd9403943d7d19ce54ae462762beecb54a751c44 (diff)
downloadlinux-cb82aaade9d1bf87dadd95534c31304fb4b2ffe8.tar.bz2
thermal: mediatek: add flag for bank selection
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> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/mtk_thermal.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
index c96a746c42ea..0a3944e4a62a 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 @@ static const struct mtk_thermal_data mt8173_thermal_data = {
.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 @@ static const struct mtk_thermal_data mt2701_thermal_data = {
.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 @@ static const struct mtk_thermal_data mt2712_thermal_data = {
.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 @@ static const struct mtk_thermal_data mt7622_thermal_data = {
.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);
}
/**