Thread (31 messages) 31 messages, 6 authors, 2025-08-03

Re: [PATCH v2 4/9] thermal: mediatek: lvts: Add platform ops to support alternative conversion logic

From: Fei Shao <hidden>
Date: 2025-07-31 04:03:52
Also in: linux-devicetree, linux-mediatek, linux-pm, lkml

On Wed, Jul 30, 2025 at 11:35 PM Laura Nao [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Introduce lvts_platform_ops struct to support SoC-specific versions of
lvts_raw_to_temp() and lvts_temp_to_raw() conversion functions.

This is in preparation for supporting SoCs like MT8196/MT6991, which
require a different lvts_temp_to_raw() implementation.

Signed-off-by: Laura Nao <redacted>
---
 drivers/thermal/mediatek/lvts_thermal.c | 46 +++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 3 deletions(-)
diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index 8398af657ba2..6e4a35ecaf34 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -125,8 +125,14 @@ struct lvts_ctrl_data {
                        continue; \
                else

+struct lvts_platform_ops {
+       int (*lvts_raw_to_temp)(u32 raw_temp, int temp_factor);
+       u32 (*lvts_temp_to_raw)(int temperature, int temp_factor);
+};
+
 struct lvts_data {
        const struct lvts_ctrl_data *lvts_ctrl;
+       struct lvts_platform_ops ops;
nit: I think this can also be a const struct, since ops are all
initialized in the platform data and never change.

Anyway, the changes look good IMO, so
Reviewed-by: Fei Shao <redacted>
        const u32 *conn_cmd;
        const u32 *init_cmd;
        int num_cal_offsets;
[...]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help