diff mbox series

[v2] hwmon: (pmbus/mp2975) Fix PGOOD in READ_STATUS_WORD

Message ID 20230731092204.2933045-1-Naresh.Solanki@9elements.com (mailing list archive)
State Accepted
Headers show
Series [v2] hwmon: (pmbus/mp2975) Fix PGOOD in READ_STATUS_WORD | expand

Commit Message

Naresh Solanki July 31, 2023, 9:22 a.m. UTC
From: Patrick Rudolph <patrick.rudolph@9elements.com>

MP2973 & MP2971 returns PGOOD instead of PB_STATUS_POWER_GOOD_N.
Fix that in the read_word_data hook.
MP2975 might be affected but needs verification.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com>
---
 drivers/hwmon/pmbus/mp2975.c | 5 +++++
 1 file changed, 5 insertions(+)


base-commit: cb7022b8976e3c4d12cea2e7bb820a2944e2fd7b

Comments

Vadim Pasternak July 31, 2023, 9:54 a.m. UTC | #1
> -----Original Message-----
> From: Naresh Solanki <naresh.solanki@9elements.com>
> Sent: Monday, 31 July 2023 12:22
> To: Guenter Roeck <linux@roeck-us.net>; Jean Delvare <jdelvare@suse.com>
> Cc: Vadim Pasternak <vadimp@nvidia.com>; Patrick Rudolph
> <patrick.rudolph@9elements.com>; Naresh Solanki
> <Naresh.Solanki@9elements.com>; linux-hwmon@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH v2] hwmon: (pmbus/mp2975) Fix PGOOD in
> READ_STATUS_WORD
> 
> From: Patrick Rudolph <patrick.rudolph@9elements.com>
> 
> MP2973 & MP2971 returns PGOOD instead of PB_STATUS_POWER_GOOD_N.
> Fix that in the read_word_data hook.
> MP2975 might be affected but needs verification.

Hi,

According to MP2975 regmap datasheet for STATUS_WORD, bit 11 reports:
 11	 POWER_GOOD_N	1’b0: PG is active.
				1’b1: PG not active has occurred
Is it the same what stays MP2971 and MP2973 docs?

Thanks,
Vadim.

> 
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com>
> ---
>  drivers/hwmon/pmbus/mp2975.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/hwmon/pmbus/mp2975.c
> b/drivers/hwmon/pmbus/mp2975.c index 28f33f4618fa..27bb39370662
> 100644
> --- a/drivers/hwmon/pmbus/mp2975.c
> +++ b/drivers/hwmon/pmbus/mp2975.c
> @@ -297,6 +297,11 @@ static int mp2973_read_word_data(struct i2c_client
> *client, int page,
>  	int ret;
> 
>  	switch (reg) {
> +	case PMBUS_STATUS_WORD:
> +		/* MP2973 & MP2971 returns PGOOD instead of
> PB_STATUS_POWER_GOOD_N. */
> +		ret = pmbus_read_word_data(client, page, phase, reg);
> +		ret ^= PB_STATUS_POWER_GOOD_N;
> +		break;
>  	case PMBUS_OT_FAULT_LIMIT:
>  		ret = mp2975_read_word_helper(client, page, phase, reg,
>  					      GENMASK(7, 0));
> 
> base-commit: cb7022b8976e3c4d12cea2e7bb820a2944e2fd7b
> --
> 2.41.0
Guenter Roeck July 31, 2023, 1:52 p.m. UTC | #2
On 7/31/23 02:54, Vadim Pasternak wrote:
> 
> 
>> -----Original Message-----
>> From: Naresh Solanki <naresh.solanki@9elements.com>
>> Sent: Monday, 31 July 2023 12:22
>> To: Guenter Roeck <linux@roeck-us.net>; Jean Delvare <jdelvare@suse.com>
>> Cc: Vadim Pasternak <vadimp@nvidia.com>; Patrick Rudolph
>> <patrick.rudolph@9elements.com>; Naresh Solanki
>> <Naresh.Solanki@9elements.com>; linux-hwmon@vger.kernel.org; linux-
>> kernel@vger.kernel.org
>> Subject: [PATCH v2] hwmon: (pmbus/mp2975) Fix PGOOD in
>> READ_STATUS_WORD
>>
>> From: Patrick Rudolph <patrick.rudolph@9elements.com>
>>
>> MP2973 & MP2971 returns PGOOD instead of PB_STATUS_POWER_GOOD_N.
>> Fix that in the read_word_data hook.
>> MP2975 might be affected but needs verification.
> 
> Hi,
> 
> According to MP2975 regmap datasheet for STATUS_WORD, bit 11 reports:
>   11	 POWER_GOOD_N	1’b0: PG is active.
> 				1’b1: PG not active has occurred
> Is it the same what stays MP2971 and MP2973 docs?
> 

I don't have a datasheet for any of the chips, so I can not confirm
either way. The above looks like the standard definition, suggesting
that MP2975 would not be affected.

If that is the case, the commit should say that MP2975 is not affected
according to the datasheet, but that this has not been confirmed on
real hardware (unless you can confirm it).

Thanks,
Guenter

> Thanks,
> Vadim.
> 
>>
>> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
>> Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com>
>> ---
>>   drivers/hwmon/pmbus/mp2975.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/hwmon/pmbus/mp2975.c
>> b/drivers/hwmon/pmbus/mp2975.c index 28f33f4618fa..27bb39370662
>> 100644
>> --- a/drivers/hwmon/pmbus/mp2975.c
>> +++ b/drivers/hwmon/pmbus/mp2975.c
>> @@ -297,6 +297,11 @@ static int mp2973_read_word_data(struct i2c_client
>> *client, int page,
>>   	int ret;
>>
>>   	switch (reg) {
>> +	case PMBUS_STATUS_WORD:
>> +		/* MP2973 & MP2971 returns PGOOD instead of
>> PB_STATUS_POWER_GOOD_N. */
>> +		ret = pmbus_read_word_data(client, page, phase, reg);
>> +		ret ^= PB_STATUS_POWER_GOOD_N;
>> +		break;
>>   	case PMBUS_OT_FAULT_LIMIT:
>>   		ret = mp2975_read_word_helper(client, page, phase, reg,
>>   					      GENMASK(7, 0));
>>
>> base-commit: cb7022b8976e3c4d12cea2e7bb820a2944e2fd7b
>> --
>> 2.41.0
>
Guenter Roeck July 31, 2023, 4:11 p.m. UTC | #3
On Mon, Jul 31, 2023 at 11:22:04AM +0200, Naresh Solanki wrote:
> From: Patrick Rudolph <patrick.rudolph@9elements.com>
> 
> MP2973 & MP2971 returns PGOOD instead of PB_STATUS_POWER_GOOD_N.
> Fix that in the read_word_data hook.
> MP2975 might be affected but needs verification.
> 
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com>

Applied, after rephrasing description to indicate that MP2975 is likely
not affected. Also added Fixes: tags.

Guenter

> ---
>  drivers/hwmon/pmbus/mp2975.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> 
> base-commit: cb7022b8976e3c4d12cea2e7bb820a2944e2fd7b
> 
> diff --git a/drivers/hwmon/pmbus/mp2975.c b/drivers/hwmon/pmbus/mp2975.c
> index 28f33f4618fa..27bb39370662 100644
> --- a/drivers/hwmon/pmbus/mp2975.c
> +++ b/drivers/hwmon/pmbus/mp2975.c
> @@ -297,6 +297,11 @@ static int mp2973_read_word_data(struct i2c_client *client, int page,
>  	int ret;
>  
>  	switch (reg) {
> +	case PMBUS_STATUS_WORD:
> +		/* MP2973 & MP2971 returns PGOOD instead of PB_STATUS_POWER_GOOD_N. */
> +		ret = pmbus_read_word_data(client, page, phase, reg);
> +		ret ^= PB_STATUS_POWER_GOOD_N;
> +		break;
>  	case PMBUS_OT_FAULT_LIMIT:
>  		ret = mp2975_read_word_helper(client, page, phase, reg,
>  					      GENMASK(7, 0));
diff mbox series

Patch

diff --git a/drivers/hwmon/pmbus/mp2975.c b/drivers/hwmon/pmbus/mp2975.c
index 28f33f4618fa..27bb39370662 100644
--- a/drivers/hwmon/pmbus/mp2975.c
+++ b/drivers/hwmon/pmbus/mp2975.c
@@ -297,6 +297,11 @@  static int mp2973_read_word_data(struct i2c_client *client, int page,
 	int ret;
 
 	switch (reg) {
+	case PMBUS_STATUS_WORD:
+		/* MP2973 & MP2971 returns PGOOD instead of PB_STATUS_POWER_GOOD_N. */
+		ret = pmbus_read_word_data(client, page, phase, reg);
+		ret ^= PB_STATUS_POWER_GOOD_N;
+		break;
 	case PMBUS_OT_FAULT_LIMIT:
 		ret = mp2975_read_word_helper(client, page, phase, reg,
 					      GENMASK(7, 0));