diff mbox series

hwmon:(adm1275) Enable adm1278 ADM1278_TEMP1_EN

Message ID 20200528141523.GA8810@cnn
State Not Applicable, archived
Headers show
Series hwmon:(adm1275) Enable adm1278 ADM1278_TEMP1_EN | expand

Commit Message

Manikandan May 28, 2020, 2:15 p.m. UTC
The adm1278 temperature sysfs attribute need it for one of the our openbmc platform . 
This functionality is not enabled by default, so PMON_CONFIG needs to be modified in order to enable it.

---
 drivers/hwmon/pmbus/adm1275.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Vijay Khemka May 28, 2020, 5:34 p.m. UTC | #1
On 5/28/20, 7:15 AM, "Manikandan Elumalai" <manikandan.hcl.ers.epl@gmail.com> wrote:

    
    The adm1278 temperature sysfs attribute need it for one of the our openbmc platform . 
    This functionality is not enabled by default, so PMON_CONFIG needs to be modified in order to enable it.

There is no Signed-off-by.
    
    ---
     drivers/hwmon/pmbus/adm1275.c | 15 +++++++++++++++
     1 file changed, 15 insertions(+)
    
    diff --git a/drivers/hwmon/pmbus/adm1275.c b/drivers/hwmon/pmbus/adm1275.c
    index 5caa37fb..47b293d 100644
    --- a/drivers/hwmon/pmbus/adm1275.c
    +++ b/drivers/hwmon/pmbus/adm1275.c
    @@ -681,6 +681,21 @@ static int adm1275_probe(struct i2c_client *client,
     			}
     		}
     
    +		config = i2c_smbus_read_byte_data(client, ADM1275_PMON_CONFIG);
    +		if (config < 0)
    +			return config;
    +
    +		/* Enable TEMP1 by defult */
    +		config |= ADM1278_TEMP1_EN;
    +		ret = i2c_smbus_write_byte_data(client,
    +					ADM1275_PMON_CONFIG,
    +					config);
    +		if (ret < 0) {
    +		dev_err(&client->dev,
    +			"Failed to enable temperature config\n");
    +		return -ENODEV;
    +		}
    +
     		if (config & ADM1278_TEMP1_EN)

This check becomes irrelevant as you are enabling it above then rather than
enabling it just remove this check.

     			info->func[0] |=
     				PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
    -- 
    2.7.4
Manikandan May 29, 2020, 9:48 a.m. UTC | #2
On Thu, May 28, 2020 at 05:34:22PM +0000, Vijay Khemka wrote:
> 
> 
> On 5/28/20, 7:15 AM, "Manikandan Elumalai" <manikandan.hcl.ers.epl@gmail.com> wrote:
> 
>     
>     The adm1278 temperature sysfs attribute need it for one of the our openbmc platform . 
>     This functionality is not enabled by default, so PMON_CONFIG needs to be modified in order to enable it.
> 
> There is no Signed-off-by.
>     
>     ---
>      drivers/hwmon/pmbus/adm1275.c | 15 +++++++++++++++
>      1 file changed, 15 insertions(+)
>     
>     diff --git a/drivers/hwmon/pmbus/adm1275.c b/drivers/hwmon/pmbus/adm1275.c
>     index 5caa37fb..47b293d 100644
>     --- a/drivers/hwmon/pmbus/adm1275.c
>     +++ b/drivers/hwmon/pmbus/adm1275.c
>     @@ -681,6 +681,21 @@ static int adm1275_probe(struct i2c_client *client,
>      			}
>      		}
>      
>     +		config = i2c_smbus_read_byte_data(client, ADM1275_PMON_CONFIG);
>     +		if (config < 0)
>     +			return config;
>     +
>     +		/* Enable TEMP1 by defult */
>     +		config |= ADM1278_TEMP1_EN;
>     +		ret = i2c_smbus_write_byte_data(client,
>     +					ADM1275_PMON_CONFIG,
>     +					config);
>     +		if (ret < 0) {
>     +		dev_err(&client->dev,
>     +			"Failed to enable temperature config\n");
>     +		return -ENODEV;
>     +		}
>     +
>      		if (config & ADM1278_TEMP1_EN)
> 
> This check becomes irrelevant as you are enabling it above then rather than
> enabling it just remove this check.
     Thanks for review Vijay. I will submit changes in v2.
> 
>      			info->func[0] |=
>      				PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
>     -- 
>     2.7.4
>     
>     
>
Patrick Williams May 29, 2020, 12:49 p.m. UTC | #3
On Thu, May 28, 2020 at 07:45:23PM +0530, Manikandan Elumalai wrote:

Hi Manikandan,

Adding the PMBus maintainers...

> 
> The adm1278 temperature sysfs attribute need it for one of the our openbmc platform . 
> This functionality is not enabled by default, so PMON_CONFIG needs to be modified in order to enable it.

Vijay already mentioned the Signed-off-by here.

Since this is a kernel patch and your first time contributing one, please
read through:
    https://www.kernel.org/doc/html/latest/process/1.Intro.html
and the MAINTAINERS file.  Another thing you've missed is using the
get_maintainer.pl script to find out who you're suppose to CC.  It is
fine to have additional CCs but we're missing the pmbus maintainer on
this patch.

> 
> ---
>  drivers/hwmon/pmbus/adm1275.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/hwmon/pmbus/adm1275.c b/drivers/hwmon/pmbus/adm1275.c
> index 5caa37fb..47b293d 100644
> --- a/drivers/hwmon/pmbus/adm1275.c
> +++ b/drivers/hwmon/pmbus/adm1275.c
> @@ -681,6 +681,21 @@ static int adm1275_probe(struct i2c_client *client,
>  			}
>  		}
>  
> +		config = i2c_smbus_read_byte_data(client, ADM1275_PMON_CONFIG);
> +		if (config < 0)
> +			return config;
> +
> +		/* Enable TEMP1 by defult */
> +		config |= ADM1278_TEMP1_EN;
> +		ret = i2c_smbus_write_byte_data(client,
> +					ADM1275_PMON_CONFIG,
> +					config);
> +		if (ret < 0) {
> +		dev_err(&client->dev,
> +			"Failed to enable temperature config\n");
> +		return -ENODEV;
> +		}
> +

This code might work for your design, but likely doesn't work for
everyone and isn't likely to be accepted in its current state.  I think
you need some kind of detection logic here to know if TEMP1_EN *should*
be enabled.  Do we need a device-tree entry for this?


>  		if (config & ADM1278_TEMP1_EN)
>  			info->func[0] |=
>  				PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
> -- 
> 2.7.4
>
diff mbox series

Patch

diff --git a/drivers/hwmon/pmbus/adm1275.c b/drivers/hwmon/pmbus/adm1275.c
index 5caa37fb..47b293d 100644
--- a/drivers/hwmon/pmbus/adm1275.c
+++ b/drivers/hwmon/pmbus/adm1275.c
@@ -681,6 +681,21 @@  static int adm1275_probe(struct i2c_client *client,
 			}
 		}
 
+		config = i2c_smbus_read_byte_data(client, ADM1275_PMON_CONFIG);
+		if (config < 0)
+			return config;
+
+		/* Enable TEMP1 by defult */
+		config |= ADM1278_TEMP1_EN;
+		ret = i2c_smbus_write_byte_data(client,
+					ADM1275_PMON_CONFIG,
+					config);
+		if (ret < 0) {
+		dev_err(&client->dev,
+			"Failed to enable temperature config\n");
+		return -ENODEV;
+		}
+
 		if (config & ADM1278_TEMP1_EN)
 			info->func[0] |=
 				PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;