[V6,2/3] sensors: occ: Add DT compatible string for current(A) sensor

Message ID 1497873981-24454-3-git-send-email-shilpa.bhat@linux.vnet.ibm.com
State New
Headers show

Commit Message

Shilpasri G Bhat June 19, 2017, 12:06 p.m.
Add a new DT compatible string "ibm,opal-sensor-current" for
current(A) sensors.

Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
---
 hw/occ-sensor.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

C├ędric Le Goater June 19, 2017, 12:54 p.m. | #1
On 06/19/2017 02:06 PM, Shilpasri G Bhat wrote:
> Add a new DT compatible string "ibm,opal-sensor-current" for
> current(A) sensors.
> 
> Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
> ---
>  hw/occ-sensor.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/occ-sensor.c b/hw/occ-sensor.c
> index 75f00d5..debfba5 100644
> --- a/hw/occ-sensor.c
> +++ b/hw/occ-sensor.c
> @@ -586,8 +586,12 @@ void occ_sensors_init(void)
>  			handler = sensor_handler(occ_num, i, SENSOR_MIN);
>  			dt_add_property_cells(node, "sensor-data-min", handler);
>  
> -			dt_add_property_string(node, "compatible",
> -					       "ibm,opal-sensor");
> +			if (md[i].type == OCC_SENSOR_TYPE_CURRENT)
> +				dt_add_property_string(node, "compatible",
> +						"ibm,opal-sensor-current");

I think this is not the correct method. We should be using the
'sensor-type' property. Please see my response on the ibmpowernv 
patch.

C.


> +			else
> +				dt_add_property_string(node, "compatible",
> +						       "ibm,opal-sensor");
>
>
>  			dt_add_property_string(node, "occ_label", md[i].name);
>  			add_sensor_label(node, &md[i], chip->id);
>  		}
>

Patch

diff --git a/hw/occ-sensor.c b/hw/occ-sensor.c
index 75f00d5..debfba5 100644
--- a/hw/occ-sensor.c
+++ b/hw/occ-sensor.c
@@ -586,8 +586,12 @@  void occ_sensors_init(void)
 			handler = sensor_handler(occ_num, i, SENSOR_MIN);
 			dt_add_property_cells(node, "sensor-data-min", handler);
 
-			dt_add_property_string(node, "compatible",
-					       "ibm,opal-sensor");
+			if (md[i].type == OCC_SENSOR_TYPE_CURRENT)
+				dt_add_property_string(node, "compatible",
+						"ibm,opal-sensor-current");
+			else
+				dt_add_property_string(node, "compatible",
+						       "ibm,opal-sensor");
 			dt_add_property_string(node, "occ_label", md[i].name);
 			add_sensor_label(node, &md[i], chip->id);
 		}