Skip to contentSkip to conversation

thermal: of: look for sensor driver parent node if device node missing

PATCH-REPOST Laxman Dewangan 3 participants 5 messages Jul 25, 2014 – Jul 30, 2014 Thermal

lore
Share & tools
lore
#0 lore raw

There are some mfd devices which supports junction thermal interrupt like ams,AS3722. The DT binding of these devices are defined as the flat and drivers for sub module of such devices are registered as the mfd_add_devices. In this method, the sub devices registered as platform driver and these do not have the of_node pointer on their device structure. In this case, use the parent of_node pointer to get the required of_node pointer.

---
I typed differnet email ID for Eduardo and so it did not reach to him. Resending the patch with correct ID.

 drivers/thermal/of-thermal.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/thermal/of-thermal.c +2 -0
index 04b1be7..85a7d71 100644
@@ -396,6 +396,8 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id,
 		return ERR_PTR(-EINVAL);
 
 	sensor_np = dev->of_node;
+	if (!sensor_np && dev->parent)
+		sensor_np = dev->parent->of_node;
 
 	for_each_child_of_node(np, child) {
 		struct of_phandle_args sensor_specs;
Signature · 1 line
1.8.1.5
#1 lore raw

[Fixed Eduardo's email *again*]

Quoted 33 lines · Laxman Dewangan

There are some mfd devices which supports junction thermal interrupt like ams,AS3722. The DT binding of these devices are defined as the flat and drivers for sub module of such devices are registered as the mfd_add_devices. In this method, the sub devices registered as platform driver and these do not have the of_node pointer on their device structure. In this case, use the parent of_node pointer to get the required of_node pointer.

---
I typed differnet email ID for Eduardo and so it did not reach to him. Resending the patch with correct ID.

 drivers/thermal/of-thermal.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/thermal/of-thermal.c +2 -0
index 04b1be7..85a7d71 100644
@@ -396,6 +396,8 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id,
 		return ERR_PTR(-EINVAL);
 
 	sensor_np = dev->of_node;
+	if (!sensor_np && dev->parent)
+		sensor_np = dev->parent->of_node;
 
 	for_each_child_of_node(np, child) {
 		struct of_phandle_args sensor_specs;
Signature · 1 line
1.8.1.5
#2 lore raw
In reply to Laxman Dewangan

Hello Laxman,

Quoted 8 lines · Laxman Dewangan

There are some mfd devices which supports junction thermal interrupt like ams,AS3722. The DT binding of these devices are defined as the flat and drivers for sub module of such devices are registered as the mfd_add_devices. In this method, the sub devices registered as platform driver and these do not have the of_node pointer on their device structure. In this case, use the parent of_node pointer to get the required of_node pointer.

Can you please elaborate a bit more on your proposal? So, you would append the thermal zones on the DT node of the MFD device?

To me looks like MFD becomes sowhat obsolete with DT.

Besides, to what I could see from past iterations, MFD with DT seams to be a controvertial subject. That is, we have people that agree to have it, and people that are not fan of it.

Quoted 28 lines

---
I typed differnet email ID for Eduardo and so it did not reach to him. Resending the patch with correct ID.

 drivers/thermal/of-thermal.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/thermal/of-thermal.c +2 -0
index 04b1be7..85a7d71 100644
@@ -396,6 +396,8 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id,
 		return ERR_PTR(-EINVAL);
 
 	sensor_np = dev->of_node;
+	if (!sensor_np && dev->parent)
+		sensor_np = dev->parent->of_node;
 
 	for_each_child_of_node(np, child) {
 		struct of_phandle_args sensor_specs;
Signature · 6 lines
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
Quoted 11 lines · Eduardo Valentin

Hello Laxman,

Quoted 8 lines · Laxman Dewangan

There are some mfd devices which supports junction thermal interrupt like ams,AS3722. The DT binding of these devices are defined as the flat and drivers for sub module of such devices are registered as the mfd_add_devices. In this method, the sub devices registered as platform driver and these do not have the of_node pointer on their device structure. In this case, use the parent of_node pointer to get the required of_node pointer.

Quoted 2 lines

Can you please elaborate a bit more on your proposal? So, you would append the thermal zones on the DT node of the MFD device?

Yes, mfd node for ams,as3722 is flat node, almost all sub-module driver have their property on this node only. Regulator have their own sub node under this node.

as3722 {
        compatible = "ams,as3722";
        #gpio-contorller;
        #gpio-cells = <2>;
    ::::::::::
        regulator {
                ::::
        };
};

So in this, the thermal sensor driver's property is on the as3722 node only and thermal zone need to refer this node for sensor.

However, as3722 thermal sensor driver is register as sub mfd devices through mfd_add_devices() and thermal sensor drivers pdev->dev.of_node does not have any valid pointer.

#4 lore raw

Laxman,

Quoted 30 lines · Laxman Dewangan
Quoted 11 lines · Eduardo Valentin

Hello Laxman,

Quoted 8 lines · Laxman Dewangan

There are some mfd devices which supports junction thermal interrupt like ams,AS3722. The DT binding of these devices are defined as the flat and drivers for sub module of such devices are registered as the mfd_add_devices. In this method, the sub devices registered as platform driver and these do not have the of_node pointer on their device structure. In this case, use the parent of_node pointer to get the required of_node pointer.

Quoted 2 lines

Can you please elaborate a bit more on your proposal? So, you would append the thermal zones on the DT node of the MFD device?

Yes, mfd node for ams,as3722 is flat node, almost all sub-module driver have their property on this node only. Regulator have their own sub node under this node.

as3722 {
         compatible = "ams,as3722";
         #gpio-contorller;
         #gpio-cells = <2>;
     ::::::::::
         regulator {
                 ::::
         };
};
Quoted 6 lines

So in this, the thermal sensor driver's property is on the as3722 node only and thermal zone need to refer this node for sensor.

However, as3722 thermal sensor driver is register as sub mfd devices through mfd_add_devices() and thermal sensor drivers pdev->dev.of_node does not have any valid pointer.

In such case, the MFD driver shall populate the required data while creating the sub device, right?