1 --- a/drivers/thermal/qcom/tsens-ipq8064.c
2 +++ b/drivers/thermal/qcom/tsens-ipq8064.c
4 #include <linux/regmap.h>
5 #include <linux/thermal.h>
6 #include <linux/nvmem-consumer.h>
7 +#include <linux/of_platform.h>
9 #include <linux/interrupt.h>
11 @@ -320,15 +321,42 @@ static void hw_init(struct tsens_priv *p
12 INIT_WORK(&priv->tsens_work, tsens_scheduler_fn);
15 +static const struct regmap_config tsens_config = {
22 static int init_ipq8064(struct tsens_priv *priv)
25 + struct device *dev = priv->dev;
26 u32 reg_cntl, offset = 0;
27 + struct resource *res;
28 + resource_size_t size;
31 + struct platform_device *op = of_find_device_by_node(priv->dev->of_node);
39 + /* old DTs where SROT and TM were in a contiguous 2K block */
40 + priv->tm_offset = 0x1000;
42 + res = platform_get_resource(op, IORESOURCE_MEM, 0);
43 + size = resource_size(res);
44 + base = devm_ioremap(&op->dev, res->start, size);
46 + ret = PTR_ERR(base);
47 + goto err_put_device;
50 + priv->tm_map = devm_regmap_init_mmio(dev, base, &tsens_config);
51 + if (IS_ERR(priv->tm_map)) {
52 + ret = PTR_ERR(priv->tm_map);
53 + goto err_put_device;
56 * The status registers for each sensor are discontiguous
57 * because some SoCs have 5 sensors while others have more
58 @@ -367,6 +395,10 @@ static int init_ipq8064(struct tsens_pri
64 + put_device(&op->dev);
68 static int calibrate_ipq8064(struct tsens_priv *priv)