[d-kernel] [PATCH 16/39] PVT: support register addressing with new firmware

Daniil Gnusarev gnusarevda на basealt.ru
Пн Окт 14 17:01:57 MSK 2024


In the latest SDKs, the addressing of PVT registers has changed.
Instead of an index, a request is made specifying the base address.
If the dts does not have the specified pvt_id, then we access the
registers using the new scheme

Signed-off-by: Daniil Gnusarev <gnusarevda на basealt.ru>
---
 drivers/hwmon/bt1-pvt.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/bt1-pvt.c b/drivers/hwmon/bt1-pvt.c
index 0299df1ac325f..71a1c0dea484f 100644
--- a/drivers/hwmon/bt1-pvt.c
+++ b/drivers/hwmon/bt1-pvt.c
@@ -934,7 +934,16 @@ static int pvt_request_regs(struct pvt_hwmon *pvt)
 #else
 	err = of_property_read_u32(pvt->dev->of_node, "pvt_id", &(pvt->pvt_id));
 	if (err) {
-		dev_err(pvt->dev, "couldn't find pvt_id\n");
+		struct resource *res;
+
+		dev_warn(pvt->dev, "couldn't find pvt_id, assume direct addressing\n");
+		res = platform_get_resource(to_platform_device(pvt->dev), IORESOURCE_MEM, 0);
+		if (!res)
+			dev_err(pvt->dev, "couldn't find base address\n");
+			else {
+				pvt->pvt_id = res->start;
+				err = 0;
+			}
 	}
 #endif
 
-- 
2.42.2



Подробная информация о списке рассылки devel-kernel