diff --git i/drivers/thermal/qcom/tsens-common.c w/drivers/thermal/qcom/tsens-common.c index b1449ad..7982867 100644 --- i/drivers/thermal/qcom/tsens-common.c +++ w/drivers/thermal/qcom/tsens-common.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include "tsens.h" @@ -126,6 +127,12 @@ static const struct regmap_config tsens_config = { int __init init_common(struct tsens_device *tmdev) { void __iomem *base; + struct platform_device *op = of_find_device_by_node(tmdev->dev->of_node); + + if (op->num_resources > 1) + tmdev->status_offset = 0xa0; + else + tmdev->status_offset = 0x10a0; base = of_iomap(tmdev->dev->of_node, 0); if (!base) diff --git i/drivers/thermal/qcom/tsens-v2.c w/drivers/thermal/qcom/tsens-v2.c index 0473f33..8400290 100644 --- i/drivers/thermal/qcom/tsens-v2.c +++ w/drivers/thermal/qcom/tsens-v2.c @@ -10,7 +10,6 @@ #define TRDY_OFFSET 0xe4 #define TRDY_READY_BIT BIT(0) -#define STATUS_OFFSET 0xa0 #define LAST_TEMP_MASK 0xfff #define STATUS_VALID_BIT BIT(21) #define CODE_SIGN_BIT BIT(11) @@ -28,7 +27,7 @@ static int get_temp_tsens_v2(struct tsens_device *tmdev, int id, int *temp) if (code & TRDY_READY_BIT) return -ENODATA; - sensor_addr = STATUS_OFFSET + s->hw_id * 4; + sensor_addr = tmdev->status_offset + s->hw_id * 4; ret = regmap_read(tmdev->map, sensor_addr, &code); if (ret) return ret; diff --git i/drivers/thermal/qcom/tsens.h w/drivers/thermal/qcom/tsens.h index 69212cb..8a42a70 100644 --- i/drivers/thermal/qcom/tsens.h +++ w/drivers/thermal/qcom/tsens.h @@ -77,6 +77,7 @@ struct tsens_device { struct device *dev; u32 num_sensors; struct regmap *map; + u32 status_offset; struct tsens_context ctx; const struct tsens_ops *ops; struct tsens_sensor sensor[0];