From: Amjad Ouled-Ameur <aouledameur@baylibre.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Amit Kucheria <amitk@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Zhang Rui <rui.zhang@intel.com>
Cc: AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Fabien Parent <fparent@baylibre.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Markus Schneider-Pargmann <msp@baylibre.com>,
linux-pm@vger.kernel.org, Rob Herring <robh@kernel.org>,
Michael Kao <michael.kao@mediatek.com>,
linux-kernel@vger.kernel.org, Hsin-Yi Wang <hsinyi@chromium.org>,
Amjad Ouled-Ameur <aouledameur@baylibre.com>,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org
Subject: [PATCH v7 2/4] thermal: mediatek: control buffer enablement tweaks
Date: Fri, 18 Nov 2022 12:04:28 +0100 [thread overview]
Message-ID: <20221018-up-i350-thermal-bringup-v7-2-ebf08ff2eddb@baylibre.com> (raw)
In-Reply-To: <20221018-up-i350-thermal-bringup-v7-0-ebf08ff2eddb@baylibre.com>
From: Markus Schneider-Pargmann <msp@baylibre.com>
Add logic in order to be able to turn on the control buffer on MT8365.
This change now allows to have control buffer support for MTK_THERMAL_V1,
and it allows to define the register offset, and mask used to enable it.
Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/thermal/mtk_thermal.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
index 8440692e3890..d8ddceb75372 100644
--- a/drivers/thermal/mtk_thermal.c
+++ b/drivers/thermal/mtk_thermal.c
@@ -271,6 +271,9 @@ struct mtk_thermal_data {
bool need_switch_bank;
struct thermal_bank_cfg bank_data[MAX_NUM_ZONES];
enum mtk_thermal_version version;
+ u32 apmixed_buffer_ctl_reg;
+ u32 apmixed_buffer_ctl_mask;
+ u32 apmixed_buffer_ctl_set;
};
struct mtk_thermal {
@@ -514,6 +517,9 @@ static const struct mtk_thermal_data mt7622_thermal_data = {
.adcpnp = mt7622_adcpnp,
.sensor_mux_values = mt7622_mux_values,
.version = MTK_THERMAL_V2,
+ .apmixed_buffer_ctl_reg = APMIXED_SYS_TS_CON1,
+ .apmixed_buffer_ctl_mask = GENMASK(31, 6) | BIT(3),
+ .apmixed_buffer_ctl_set = BIT(0),
};
/*
@@ -963,14 +969,18 @@ static const struct of_device_id mtk_thermal_of_match[] = {
};
MODULE_DEVICE_TABLE(of, mtk_thermal_of_match);
-static void mtk_thermal_turn_on_buffer(void __iomem *apmixed_base)
+static void mtk_thermal_turn_on_buffer(struct mtk_thermal *mt,
+ void __iomem *apmixed_base)
{
- int tmp;
+ u32 tmp;
+
+ if (!mt->conf->apmixed_buffer_ctl_reg)
+ return;
- tmp = readl(apmixed_base + APMIXED_SYS_TS_CON1);
- tmp &= ~(0x37);
- tmp |= 0x1;
- writel(tmp, apmixed_base + APMIXED_SYS_TS_CON1);
+ tmp = readl(apmixed_base + mt->conf->apmixed_buffer_ctl_reg);
+ tmp &= mt->conf->apmixed_buffer_ctl_mask;
+ tmp |= mt->conf->apmixed_buffer_ctl_set;
+ writel(tmp, apmixed_base + mt->conf->apmixed_buffer_ctl_reg);
udelay(200);
}
@@ -1070,8 +1080,9 @@ static int mtk_thermal_probe(struct platform_device *pdev)
goto err_disable_clk_auxadc;
}
+ mtk_thermal_turn_on_buffer(mt, apmixed_base);
+
if (mt->conf->version == MTK_THERMAL_V2) {
- mtk_thermal_turn_on_buffer(apmixed_base);
mtk_thermal_release_periodic_ts(mt, auxadc_base);
}
--
b4 0.10.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-11-18 11:06 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-18 11:04 [PATCH v7 0/4] thermal: mediatek: Add support for MT8365 SoC Amjad Ouled-Ameur
2022-11-18 11:04 ` [PATCH v7 1/4] dt-bindings: thermal: mediatek: add binding documentation " Amjad Ouled-Ameur
2022-11-18 11:04 ` Amjad Ouled-Ameur [this message]
2022-11-18 11:04 ` [PATCH v7 3/4] thermal: mediatek: add support " Amjad Ouled-Ameur
2022-11-18 11:04 ` [PATCH v7 4/4] thermal: mediatek: add another get_temp ops for thermal sensors Amjad Ouled-Ameur
2022-12-04 17:26 ` Daniel Lezcano
2022-12-05 10:41 ` Amjad Ouled-Ameur
2022-12-05 19:39 ` Daniel Lezcano
2022-12-06 9:18 ` Amjad Ouled-Ameur
2022-12-26 10:27 ` Amjad Ouled-Ameur
2022-12-29 15:49 ` Daniel Lezcano
2023-01-19 17:03 ` Amjad Ouled-Ameur
2023-01-24 10:08 ` Amjad Ouled-Ameur
2023-01-24 16:54 ` Daniel Lezcano
2023-01-24 17:46 ` Amjad Ouled-Ameur
2023-01-24 17:55 ` Daniel Lezcano
2023-01-24 22:27 ` Amjad Ouled-Ameur
2023-01-25 10:02 ` Daniel Lezcano
2023-01-25 10:27 ` Amjad Ouled-Ameur
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=20221018-up-i350-thermal-bringup-v7-2-ebf08ff2eddb@baylibre.com \
--to=aouledameur@baylibre.com \
--cc=amitk@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=daniel.lezcano@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=fparent@baylibre.com \
--cc=hsinyi@chromium.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--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=matthias.bgg@gmail.com \
--cc=michael.kao@mediatek.com \
--cc=msp@baylibre.com \
--cc=rafael@kernel.org \
--cc=robh+dt@kernel.org \
--cc=robh@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