Thread (2 messages) 2 messages, 1 author, 2021-09-26
DORMANTno replies

[PATCH 2/2] thermal: qcom: tsens: fix VER_0 support

From: Dmitry Baryshkov <hidden>
Date: 2021-09-26 00:17:15
Also in: linux-arm-msm
Subsystem: arm/qualcomm mailing list, qualcomm tsens thermal driver, the rest, thermal · Maintainers: Amit Kucheria, Thara Gopinath, Linus Torvalds, Rafael J. Wysocki, Daniel Lezcano

For VER_0 tsens shares the device with the clock controller, but
nevertheless it does not use syscon for these registers. Drop
syscon_node_to_regmap() and acquire the regmap on our own.

apq8064 has tsens as a part of gcc device tree node, ipq8064 puts tsens
node as a child node of gcc. Thus check whether tsens resource can be
fetched either from the device itself or from it's parent.

Fixes: 53e2a20e4c41 ("thermal/drivers/tsens: Add VER_0 tsens version")
Signed-off-by: Dmitry Baryshkov <redacted>
---
 drivers/thermal/qcom/tsens.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index 6aeea74c1bb0..4c3960c188da 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -773,19 +773,19 @@ int __init init_common(struct tsens_priv *priv)
 	if (tsens_version(priv) >= VER_0_1) {
 		res = platform_get_resource(op, IORESOURCE_MEM, 0);
 		tm_base = devm_ioremap_resource(dev, res);
-		if (IS_ERR(tm_base)) {
-			ret = PTR_ERR(tm_base);
-			goto err_put_device;
-		}
-
-		priv->tm_map = devm_regmap_init_mmio(dev, tm_base, &tsens_config);
 	} else { /* VER_0 share the same gcc regs using a syscon */
-		struct device *parent = priv->dev->parent;
+		res = platform_get_resource(op, IORESOURCE_MEM, 0);
+		if (!res)
+			res = platform_get_resource(priv->dev->parent, IORESOURCE_MEM, 0);
+		tm_base = devm_ioremap(dev, res->start, resource_size(res));
+	}
 
-		if (parent)
-			priv->tm_map = syscon_node_to_regmap(parent->of_node);
+	if (IS_ERR(tm_base)) {
+		ret = PTR_ERR(tm_base);
+		goto err_put_device;
 	}
 
+	priv->tm_map = devm_regmap_init_mmio(dev, tm_base, &tsens_config);
 	if (IS_ERR_OR_NULL(priv->tm_map)) {
 		if (!priv->tm_map)
 			ret = -ENODEV;
-- 
2.30.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help