All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] lm87: Allow channel data to be set from dts file.
@ 2016-09-20  5:22 Mahoda Ratnayaka
  2016-09-20  9:55   ` Guenter Roeck
  2016-09-20 17:24   ` Frank Rowand
  0 siblings, 2 replies; 8+ messages in thread
From: Mahoda Ratnayaka @ 2016-09-20  5:22 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck, linux-hwmon, devicetree, Rob Herring
  Cc: Mahoda Ratnayaka, Chris Packham

Currently there is no method for setting the channel
value from the DTS file. When, the driver uses a dts
file to initialize the driver platform_data is not set.
As a the result channel variable may not be set correctly.

Without the channel variable set correctly, some of the
sensors will not be initialized correctly. For example
temp3 sensor sysfs entries.

This adds the required functionality to set the channel
variable from the DTS file. This is done via reading the
reading a property named "channel" from the lm87 driver.

Signed-off-by: Mahoda Ratnayaka <mahoda.ratnayaka@alliedtelesis.co.nz>
---

Notes:
     changes since v1:
     Removed unncessary variables channel and np.
     Update the code as per review comments.

 Documentation/devicetree/bindings/hwmon/lm87.txt | 9 +++++++++
 drivers/hwmon/lm87.c                             | 7 ++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/hwmon/lm87.txt b/Documentation/devicetree/bindings/hwmon/lm87.txt
index fefcb48..1906e08 100644
--- a/Documentation/devicetree/bindings/hwmon/lm87.txt
+++ b/Documentation/devicetree/bindings/hwmon/lm87.txt
@@ -6,9 +6,18 @@ Required properties:
 
 - reg: I2C address
 
+optional properties:
+- channels: Value for the channel mode register.
+            This allows configuration of pins with
+            selectable uses on the LM87 device (e.g.
+            choosing between voltage and temperature
+            inputs).
+            See hwmon/lm87 for further information
+
 Example:
 
 lm87@2e {
 	compatible = "ti,lm87";
 	reg = <0x2e>;
+	channels=<0x4>;
 };
diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c
index a5e2958..358c1d4 100644
--- a/drivers/hwmon/lm87.c
+++ b/drivers/hwmon/lm87.c
@@ -858,8 +858,13 @@ static void lm87_remove_files(struct i2c_client *client)
 static void lm87_init_client(struct i2c_client *client)
 {
 	struct lm87_data *data = i2c_get_clientdata(client);
+	u8 val = 0;
 
-	if (dev_get_platdata(&client->dev)) {
+	if (!of_property_read_u8(client->dev.of_node, "channels", &val)) {
+		data->channel = val;
+		lm87_write_value(client,
+				 LM87_REG_CHANNEL_MODE, data->channel);
+	} else if (dev_get_platdata(&client->dev)) {
 		data->channel = *(u8 *)dev_get_platdata(&client->dev);
 		lm87_write_value(client,
 				 LM87_REG_CHANNEL_MODE, data->channel);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] lm87: Allow channel data to be set from dts file.
@ 2016-09-20  9:55   ` Guenter Roeck
  0 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2016-09-20  9:55 UTC (permalink / raw)
  To: Mahoda Ratnayaka, Jean Delvare, linux-hwmon, devicetree, Rob Herring
  Cc: Chris Packham

On 09/19/2016 10:22 PM, Mahoda Ratnayaka wrote:
> Currently there is no method for setting the channel
> value from the DTS file. When, the driver uses a dts
> file to initialize the driver platform_data is not set.
> As a the result channel variable may not be set correctly.
>
> Without the channel variable set correctly, some of the
> sensors will not be initialized correctly. For example
> temp3 sensor sysfs entries.
>
> This adds the required functionality to set the channel
> variable from the DTS file. This is done via reading the
> reading a property named "channel" from the lm87 driver.
>
> Signed-off-by: Mahoda Ratnayaka <mahoda.ratnayaka@alliedtelesis.co.nz>
> ---
>
> Notes:
>      changes since v1:
>      Removed unncessary variables channel and np.
>      Update the code as per review comments.
>
>  Documentation/devicetree/bindings/hwmon/lm87.txt | 9 +++++++++
>  drivers/hwmon/lm87.c                             | 7 ++++++-
>  2 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/hwmon/lm87.txt b/Documentation/devicetree/bindings/hwmon/lm87.txt
> index fefcb48..1906e08 100644
> --- a/Documentation/devicetree/bindings/hwmon/lm87.txt
> +++ b/Documentation/devicetree/bindings/hwmon/lm87.txt
> @@ -6,9 +6,18 @@ Required properties:
>
>  - reg: I2C address
>
> +optional properties:
> +- channels: Value for the channel mode register.
> +            This allows configuration of pins with
> +            selectable uses on the LM87 device (e.g.
> +            choosing between voltage and temperature
> +            inputs).
> +            See hwmon/lm87 for further information

Rob is the ultimate person to comment here, but I think the property description
by itself should be complete and technically independent of the implementation.
Documentation/hwmon/lm87 describes the implementation, so an (incomplete)
reference to it seems inappropriate.

> +
>  Example:
>
>  lm87@2e {
>  	compatible = "ti,lm87";
>  	reg = <0x2e>;
> +	channels=<0x4>;
>  };

Please move those property descriptions into the first patch. It is confusing
to have two patches touching the properties, and the first patch as it is right now
is really useless.

> diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c
> index a5e2958..358c1d4 100644
> --- a/drivers/hwmon/lm87.c
> +++ b/drivers/hwmon/lm87.c
> @@ -858,8 +858,13 @@ static void lm87_remove_files(struct i2c_client *client)
>  static void lm87_init_client(struct i2c_client *client)
>  {
>  	struct lm87_data *data = i2c_get_clientdata(client);
> +	u8 val = 0;
>
> -	if (dev_get_platdata(&client->dev)) {
> +	if (!of_property_read_u8(client->dev.of_node, "channels", &val)) {

This ignores property value errors (-ENODATA, -EOVERFLOW).
Is this what you want ?

> +		data->channel = val;
> +		lm87_write_value(client,
> +				 LM87_REG_CHANNEL_MODE, data->channel);
> +	} else if (dev_get_platdata(&client->dev)) {
>  		data->channel = *(u8 *)dev_get_platdata(&client->dev);
>  		lm87_write_value(client,
>  				 LM87_REG_CHANNEL_MODE, data->channel);
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] lm87: Allow channel data to be set from dts file.
@ 2016-09-20  9:55   ` Guenter Roeck
  0 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2016-09-20  9:55 UTC (permalink / raw)
  To: Mahoda Ratnayaka, Jean Delvare,
	linux-hwmon-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring
  Cc: Chris Packham

On 09/19/2016 10:22 PM, Mahoda Ratnayaka wrote:
> Currently there is no method for setting the channel
> value from the DTS file. When, the driver uses a dts
> file to initialize the driver platform_data is not set.
> As a the result channel variable may not be set correctly.
>
> Without the channel variable set correctly, some of the
> sensors will not be initialized correctly. For example
> temp3 sensor sysfs entries.
>
> This adds the required functionality to set the channel
> variable from the DTS file. This is done via reading the
> reading a property named "channel" from the lm87 driver.
>
> Signed-off-by: Mahoda Ratnayaka <mahoda.ratnayaka-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
> ---
>
> Notes:
>      changes since v1:
>      Removed unncessary variables channel and np.
>      Update the code as per review comments.
>
>  Documentation/devicetree/bindings/hwmon/lm87.txt | 9 +++++++++
>  drivers/hwmon/lm87.c                             | 7 ++++++-
>  2 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/hwmon/lm87.txt b/Documentation/devicetree/bindings/hwmon/lm87.txt
> index fefcb48..1906e08 100644
> --- a/Documentation/devicetree/bindings/hwmon/lm87.txt
> +++ b/Documentation/devicetree/bindings/hwmon/lm87.txt
> @@ -6,9 +6,18 @@ Required properties:
>
>  - reg: I2C address
>
> +optional properties:
> +- channels: Value for the channel mode register.
> +            This allows configuration of pins with
> +            selectable uses on the LM87 device (e.g.
> +            choosing between voltage and temperature
> +            inputs).
> +            See hwmon/lm87 for further information

Rob is the ultimate person to comment here, but I think the property description
by itself should be complete and technically independent of the implementation.
Documentation/hwmon/lm87 describes the implementation, so an (incomplete)
reference to it seems inappropriate.

> +
>  Example:
>
>  lm87@2e {
>  	compatible = "ti,lm87";
>  	reg = <0x2e>;
> +	channels=<0x4>;
>  };

Please move those property descriptions into the first patch. It is confusing
to have two patches touching the properties, and the first patch as it is right now
is really useless.

> diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c
> index a5e2958..358c1d4 100644
> --- a/drivers/hwmon/lm87.c
> +++ b/drivers/hwmon/lm87.c
> @@ -858,8 +858,13 @@ static void lm87_remove_files(struct i2c_client *client)
>  static void lm87_init_client(struct i2c_client *client)
>  {
>  	struct lm87_data *data = i2c_get_clientdata(client);
> +	u8 val = 0;
>
> -	if (dev_get_platdata(&client->dev)) {
> +	if (!of_property_read_u8(client->dev.of_node, "channels", &val)) {

This ignores property value errors (-ENODATA, -EOVERFLOW).
Is this what you want ?

> +		data->channel = val;
> +		lm87_write_value(client,
> +				 LM87_REG_CHANNEL_MODE, data->channel);
> +	} else if (dev_get_platdata(&client->dev)) {
>  		data->channel = *(u8 *)dev_get_platdata(&client->dev);
>  		lm87_write_value(client,
>  				 LM87_REG_CHANNEL_MODE, data->channel);
>

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] lm87: Allow channel data to be set from dts file.
@ 2016-09-20 17:24   ` Frank Rowand
  0 siblings, 0 replies; 8+ messages in thread
From: Frank Rowand @ 2016-09-20 17:24 UTC (permalink / raw)
  To: Mahoda Ratnayaka, Jean Delvare, Guenter Roeck, linux-hwmon,
	devicetree, Rob Herring
  Cc: Chris Packham

On 09/19/16 22:22, Mahoda Ratnayaka wrote:
> Currently there is no method for setting the channel
> value from the DTS file. When, the driver uses a dts
> file to initialize the driver platform_data is not set.
> As a the result channel variable may not be set correctly.
> 
> Without the channel variable set correctly, some of the
> sensors will not be initialized correctly. For example
> temp3 sensor sysfs entries.
> 
> This adds the required functionality to set the channel
> variable from the DTS file. This is done via reading the
> reading a property named "channel" from the lm87 driver.
> 
> Signed-off-by: Mahoda Ratnayaka <mahoda.ratnayaka@alliedtelesis.co.nz>
> ---
> 
> Notes:
>      changes since v1:
>      Removed unncessary variables channel and np.
>      Update the code as per review comments.
> 
>  Documentation/devicetree/bindings/hwmon/lm87.txt | 9 +++++++++
>  drivers/hwmon/lm87.c                             | 7 ++++++-
>  2 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/lm87.txt b/Documentation/devicetree/bindings/hwmon/lm87.txt
> index fefcb48..1906e08 100644
> --- a/Documentation/devicetree/bindings/hwmon/lm87.txt
> +++ b/Documentation/devicetree/bindings/hwmon/lm87.txt

I do not see the file Documentation/devicetree/bindings/hwmon/lm87.txt in
Linux 4.8-rc7.  I am guessing that it might already be in a tree headed
upstream.  Can you point me to it?


> @@ -6,9 +6,18 @@ Required properties:
>  
>  - reg: I2C address
>  
> +optional properties:
> +- channels: Value for the channel mode register.
> +            This allows configuration of pins with
> +            selectable uses on the LM87 device (e.g.
> +            choosing between voltage and temperature
> +            inputs).
> +            See hwmon/lm87 for further information
> +

That is configuration information, not hardware description.
Devicetree contains hardware description.

Hardware description would instead be a property that said what
is hooked up to the shared pins, eg temp3, fan1, fan2, VID, or
IRQ.  The driver should know what value to place in channel for
each of the different cases.

>  Example:
>  
>  lm87@2e {
>  	compatible = "ti,lm87";
>  	reg = <0x2e>;
> +	channels=<0x4>;
>  };
> diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c
> index a5e2958..358c1d4 100644
> --- a/drivers/hwmon/lm87.c
> +++ b/drivers/hwmon/lm87.c
> @@ -858,8 +858,13 @@ static void lm87_remove_files(struct i2c_client *client)
>  static void lm87_init_client(struct i2c_client *client)
>  {
>  	struct lm87_data *data = i2c_get_clientdata(client);
> +	u8 val = 0;
>  
> -	if (dev_get_platdata(&client->dev)) {
> +	if (!of_property_read_u8(client->dev.of_node, "channels", &val)) {
> +		data->channel = val;
> +		lm87_write_value(client,
> +				 LM87_REG_CHANNEL_MODE, data->channel);
> +	} else if (dev_get_platdata(&client->dev)) {
>  		data->channel = *(u8 *)dev_get_platdata(&client->dev);
>  		lm87_write_value(client,
>  				 LM87_REG_CHANNEL_MODE, data->channel);
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] lm87: Allow channel data to be set from dts file.
@ 2016-09-20 17:24   ` Frank Rowand
  0 siblings, 0 replies; 8+ messages in thread
From: Frank Rowand @ 2016-09-20 17:24 UTC (permalink / raw)
  To: Mahoda Ratnayaka, Jean Delvare, Guenter Roeck,
	linux-hwmon-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring
  Cc: Chris Packham

On 09/19/16 22:22, Mahoda Ratnayaka wrote:
> Currently there is no method for setting the channel
> value from the DTS file. When, the driver uses a dts
> file to initialize the driver platform_data is not set.
> As a the result channel variable may not be set correctly.
> 
> Without the channel variable set correctly, some of the
> sensors will not be initialized correctly. For example
> temp3 sensor sysfs entries.
> 
> This adds the required functionality to set the channel
> variable from the DTS file. This is done via reading the
> reading a property named "channel" from the lm87 driver.
> 
> Signed-off-by: Mahoda Ratnayaka <mahoda.ratnayaka-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
> ---
> 
> Notes:
>      changes since v1:
>      Removed unncessary variables channel and np.
>      Update the code as per review comments.
> 
>  Documentation/devicetree/bindings/hwmon/lm87.txt | 9 +++++++++
>  drivers/hwmon/lm87.c                             | 7 ++++++-
>  2 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/lm87.txt b/Documentation/devicetree/bindings/hwmon/lm87.txt
> index fefcb48..1906e08 100644
> --- a/Documentation/devicetree/bindings/hwmon/lm87.txt
> +++ b/Documentation/devicetree/bindings/hwmon/lm87.txt

I do not see the file Documentation/devicetree/bindings/hwmon/lm87.txt in
Linux 4.8-rc7.  I am guessing that it might already be in a tree headed
upstream.  Can you point me to it?


> @@ -6,9 +6,18 @@ Required properties:
>  
>  - reg: I2C address
>  
> +optional properties:
> +- channels: Value for the channel mode register.
> +            This allows configuration of pins with
> +            selectable uses on the LM87 device (e.g.
> +            choosing between voltage and temperature
> +            inputs).
> +            See hwmon/lm87 for further information
> +

That is configuration information, not hardware description.
Devicetree contains hardware description.

Hardware description would instead be a property that said what
is hooked up to the shared pins, eg temp3, fan1, fan2, VID, or
IRQ.  The driver should know what value to place in channel for
each of the different cases.

>  Example:
>  
>  lm87@2e {
>  	compatible = "ti,lm87";
>  	reg = <0x2e>;
> +	channels=<0x4>;
>  };
> diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c
> index a5e2958..358c1d4 100644
> --- a/drivers/hwmon/lm87.c
> +++ b/drivers/hwmon/lm87.c
> @@ -858,8 +858,13 @@ static void lm87_remove_files(struct i2c_client *client)
>  static void lm87_init_client(struct i2c_client *client)
>  {
>  	struct lm87_data *data = i2c_get_clientdata(client);
> +	u8 val = 0;
>  
> -	if (dev_get_platdata(&client->dev)) {
> +	if (!of_property_read_u8(client->dev.of_node, "channels", &val)) {
> +		data->channel = val;
> +		lm87_write_value(client,
> +				 LM87_REG_CHANNEL_MODE, data->channel);
> +	} else if (dev_get_platdata(&client->dev)) {
>  		data->channel = *(u8 *)dev_get_platdata(&client->dev);
>  		lm87_write_value(client,
>  				 LM87_REG_CHANNEL_MODE, data->channel);
> 

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] lm87: Allow channel data to be set from dts file.
  2016-09-20  9:55   ` Guenter Roeck
  (?)
@ 2016-09-21 21:58   ` Mahoda Ratnayaka
  -1 siblings, 0 replies; 8+ messages in thread
From: Mahoda Ratnayaka @ 2016-09-21 21:58 UTC (permalink / raw)
  To: Guenter Roeck, Jean Delvare, linux-hwmon, devicetree, Rob Herring
  Cc: Chris Packham

Thanks Guenter for the reply, I'll update things as you suggested and send the patches back again. I'll try to get the documentation approved first and then send back the lm87 driver update patch.

Thanks,
Mahoda
________________________________________
From: linux-hwmon-owner@vger.kernel.org <linux-hwmon-owner@vger.kernel.org> on behalf of Guenter Roeck <linux@roeck-us.net>
Sent: Tuesday, 20 September 2016 9:55 p.m.
To: Mahoda Ratnayaka; Jean Delvare; linux-hwmon@vger.kernel.org; devicetree@vger.kernel.org; Rob Herring
Cc: Chris Packham
Subject: Re: [PATCH v2] lm87: Allow channel data to be set from dts file.

On 09/19/2016 10:22 PM, Mahoda Ratnayaka wrote:
> Currently there is no method for setting the channel
> value from the DTS file. When, the driver uses a dts
> file to initialize the driver platform_data is not set.
> As a the result channel variable may not be set correctly.
>
> Without the channel variable set correctly, some of the
> sensors will not be initialized correctly. For example
> temp3 sensor sysfs entries.
>
> This adds the required functionality to set the channel
> variable from the DTS file. This is done via reading the
> reading a property named "channel" from the lm87 driver.
>
> Signed-off-by: Mahoda Ratnayaka <mahoda.ratnayaka@alliedtelesis.co.nz>
> ---
>
> Notes:
>      changes since v1:
>      Removed unncessary variables channel and np.
>      Update the code as per review comments.
>
>  Documentation/devicetree/bindings/hwmon/lm87.txt | 9 +++++++++
>  drivers/hwmon/lm87.c                             | 7 ++++++-
>  2 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/hwmon/lm87.txt b/Documentation/devicetree/bindings/hwmon/lm87.txt
> index fefcb48..1906e08 100644
> --- a/Documentation/devicetree/bindings/hwmon/lm87.txt
> +++ b/Documentation/devicetree/bindings/hwmon/lm87.txt
> @@ -6,9 +6,18 @@ Required properties:
>
>  - reg: I2C address
>
> +optional properties:
> +- channels: Value for the channel mode register.
> +            This allows configuration of pins with
> +            selectable uses on the LM87 device (e.g.
> +            choosing between voltage and temperature
> +            inputs).
> +            See hwmon/lm87 for further information

Rob is the ultimate person to comment here, but I think the property description
by itself should be complete and technically independent of the implementation.
Documentation/hwmon/lm87 describes the implementation, so an (incomplete)
reference to it seems inappropriate.

> +
>  Example:
>
>  lm87@2e {
>       compatible = "ti,lm87";
>       reg = <0x2e>;
> +     channels=<0x4>;
>  };

Please move those property descriptions into the first patch. It is confusing
to have two patches touching the properties, and the first patch as it is right now
is really useless.

> diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c
> index a5e2958..358c1d4 100644
> --- a/drivers/hwmon/lm87.c
> +++ b/drivers/hwmon/lm87.c
> @@ -858,8 +858,13 @@ static void lm87_remove_files(struct i2c_client *client)
>  static void lm87_init_client(struct i2c_client *client)
>  {
>       struct lm87_data *data = i2c_get_clientdata(client);
> +     u8 val = 0;
>
> -     if (dev_get_platdata(&client->dev)) {
> +     if (!of_property_read_u8(client->dev.of_node, "channels", &val)) {

This ignores property value errors (-ENODATA, -EOVERFLOW).
Is this what you want ?

> +             data->channel = val;
> +             lm87_write_value(client,
> +                              LM87_REG_CHANNEL_MODE, data->channel);
> +     } else if (dev_get_platdata(&client->dev)) {
>               data->channel = *(u8 *)dev_get_platdata(&client->dev);
>               lm87_write_value(client,
>                                LM87_REG_CHANNEL_MODE, data->channel);
>

--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] lm87: Allow channel data to be set from dts file.
@ 2016-09-23 18:10     ` Rob Herring
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2016-09-23 18:10 UTC (permalink / raw)
  To: Guenter Roeck, Mahoda Ratnayaka
  Cc: Jean Delvare, linux-hwmon, devicetree, Chris Packham

On Tue, Sep 20, 2016 at 02:55:42AM -0700, Guenter Roeck wrote:
> On 09/19/2016 10:22 PM, Mahoda Ratnayaka wrote:
> >Currently there is no method for setting the channel
> >value from the DTS file. When, the driver uses a dts
> >file to initialize the driver platform_data is not set.
> >As a the result channel variable may not be set correctly.
> >
> >Without the channel variable set correctly, some of the
> >sensors will not be initialized correctly. For example
> >temp3 sensor sysfs entries.
> >
> >This adds the required functionality to set the channel
> >variable from the DTS file. This is done via reading the
> >reading a property named "channel" from the lm87 driver.
> >
> >Signed-off-by: Mahoda Ratnayaka <mahoda.ratnayaka@alliedtelesis.co.nz>
> >---
> >
> >Notes:
> >     changes since v1:
> >     Removed unncessary variables channel and np.
> >     Update the code as per review comments.
> >
> > Documentation/devicetree/bindings/hwmon/lm87.txt | 9 +++++++++
> > drivers/hwmon/lm87.c                             | 7 ++++++-
> > 2 files changed, 15 insertions(+), 1 deletion(-)
> >
> >diff --git a/Documentation/devicetree/bindings/hwmon/lm87.txt b/Documentation/devicetree/bindings/hwmon/lm87.txt
> >index fefcb48..1906e08 100644
> >--- a/Documentation/devicetree/bindings/hwmon/lm87.txt
> >+++ b/Documentation/devicetree/bindings/hwmon/lm87.txt
> >@@ -6,9 +6,18 @@ Required properties:
> >
> > - reg: I2C address
> >
> >+optional properties:
> >+- channels: Value for the channel mode register.
> >+            This allows configuration of pins with
> >+            selectable uses on the LM87 device (e.g.
> >+            choosing between voltage and temperature
> >+            inputs).
> >+            See hwmon/lm87 for further information
> 
> Rob is the ultimate person to comment here, but I think the property description
> by itself should be complete and technically independent of the implementation.
> Documentation/hwmon/lm87 describes the implementation, so an (incomplete)
> reference to it seems inappropriate.

Yes, please make the binding stand on its own. And please put all of the 
binding in one patch. You're describing h/w, not adding s/w features.

As far as whether this is configuration or h/w description, it depends 
on what defines the configuration. If it is fixed by the h/w design then 
this is okay. If it is a user choice, then no it should not be in DT. 
Seems like this would be the former case as probably temperature 
measurement requires a thermistor or something.

Rob

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] lm87: Allow channel data to be set from dts file.
@ 2016-09-23 18:10     ` Rob Herring
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2016-09-23 18:10 UTC (permalink / raw)
  To: Guenter Roeck, Mahoda Ratnayaka
  Cc: Jean Delvare, linux-hwmon-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Chris Packham

On Tue, Sep 20, 2016 at 02:55:42AM -0700, Guenter Roeck wrote:
> On 09/19/2016 10:22 PM, Mahoda Ratnayaka wrote:
> >Currently there is no method for setting the channel
> >value from the DTS file. When, the driver uses a dts
> >file to initialize the driver platform_data is not set.
> >As a the result channel variable may not be set correctly.
> >
> >Without the channel variable set correctly, some of the
> >sensors will not be initialized correctly. For example
> >temp3 sensor sysfs entries.
> >
> >This adds the required functionality to set the channel
> >variable from the DTS file. This is done via reading the
> >reading a property named "channel" from the lm87 driver.
> >
> >Signed-off-by: Mahoda Ratnayaka <mahoda.ratnayaka-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
> >---
> >
> >Notes:
> >     changes since v1:
> >     Removed unncessary variables channel and np.
> >     Update the code as per review comments.
> >
> > Documentation/devicetree/bindings/hwmon/lm87.txt | 9 +++++++++
> > drivers/hwmon/lm87.c                             | 7 ++++++-
> > 2 files changed, 15 insertions(+), 1 deletion(-)
> >
> >diff --git a/Documentation/devicetree/bindings/hwmon/lm87.txt b/Documentation/devicetree/bindings/hwmon/lm87.txt
> >index fefcb48..1906e08 100644
> >--- a/Documentation/devicetree/bindings/hwmon/lm87.txt
> >+++ b/Documentation/devicetree/bindings/hwmon/lm87.txt
> >@@ -6,9 +6,18 @@ Required properties:
> >
> > - reg: I2C address
> >
> >+optional properties:
> >+- channels: Value for the channel mode register.
> >+            This allows configuration of pins with
> >+            selectable uses on the LM87 device (e.g.
> >+            choosing between voltage and temperature
> >+            inputs).
> >+            See hwmon/lm87 for further information
> 
> Rob is the ultimate person to comment here, but I think the property description
> by itself should be complete and technically independent of the implementation.
> Documentation/hwmon/lm87 describes the implementation, so an (incomplete)
> reference to it seems inappropriate.

Yes, please make the binding stand on its own. And please put all of the 
binding in one patch. You're describing h/w, not adding s/w features.

As far as whether this is configuration or h/w description, it depends 
on what defines the configuration. If it is fixed by the h/w design then 
this is okay. If it is a user choice, then no it should not be in DT. 
Seems like this would be the former case as probably temperature 
measurement requires a thermistor or something.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-09-23 18:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-20  5:22 [PATCH v2] lm87: Allow channel data to be set from dts file Mahoda Ratnayaka
2016-09-20  9:55 ` Guenter Roeck
2016-09-20  9:55   ` Guenter Roeck
2016-09-21 21:58   ` Mahoda Ratnayaka
2016-09-23 18:10   ` Rob Herring
2016-09-23 18:10     ` Rob Herring
2016-09-20 17:24 ` Frank Rowand
2016-09-20 17:24   ` Frank Rowand

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.