linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] hwmon: (pmbus_core) Check adapter PEC support
@ 2021-06-05  5:27 Paul Menzel
  2021-06-06 12:50 ` Guenter Roeck
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Menzel @ 2021-06-05  5:27 UTC (permalink / raw)
  To: Guenter Roeck, Jean Delvare
  Cc: Madhava Reddy Siddareddygari, Paul Menzel, linux-hwmon, linux-kernel

From: Madhava Reddy Siddareddygari <msiddare@cisco.com>

Currently, for Packet Error Checking (PEC) only the controller
is checked for support. This causes problems on the cisco-8000
platform where a SMBUS transaction errors are observed. This is
because PEC has to be enabled only if both controller and
adapter support it.

Added code to check PEC capability for adapter and enable it
only if both controller and adapter supports PEC.

Signed-off-by: Madhava Reddy Siddareddygari <msiddare@cisco.com>
[Upstream from SONiC https://github.com/Azure/sonic-linux-kernel/pull/215]
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
---
v2: Do not revert check introduced by commit e5befc02 (hwmon: (pmbus)
    Add a PMBUS_NO_CAPABILITY platform data flag).

 drivers/hwmon/pmbus/pmbus_core.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index bbd745178147..2fd0fec59d4f 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -2214,11 +2214,15 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
 		data->has_status_word = true;
 	}
 
-	/* Enable PEC if the controller supports it */
+	/* Enable PEC if the controller and bus supports it */
 	if (!(data->flags & PMBUS_NO_CAPABILITY)) {
 		ret = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
-		if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK))
-			client->flags |= I2C_CLIENT_PEC;
+		if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK)) {
+			if (i2c_check_functionality(client->adapter,
+						I2C_FUNC_SMBUS_PEC)) {
+				client->flags |= I2C_CLIENT_PEC;
+			}
+		}
 	}
 
 	/*
-- 
2.32.0.rc2


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

* Re: [PATCH v2] hwmon: (pmbus_core) Check adapter PEC support
  2021-06-05  5:27 [PATCH v2] hwmon: (pmbus_core) Check adapter PEC support Paul Menzel
@ 2021-06-06 12:50 ` Guenter Roeck
  2021-12-01 15:58   ` Paul Menzel
  0 siblings, 1 reply; 4+ messages in thread
From: Guenter Roeck @ 2021-06-06 12:50 UTC (permalink / raw)
  To: Paul Menzel
  Cc: Jean Delvare, Madhava Reddy Siddareddygari, linux-hwmon, linux-kernel

On Sat, Jun 05, 2021 at 07:27:02AM +0200, Paul Menzel wrote:
> From: Madhava Reddy Siddareddygari <msiddare@cisco.com>
> 
> Currently, for Packet Error Checking (PEC) only the controller
> is checked for support. This causes problems on the cisco-8000
> platform where a SMBUS transaction errors are observed. This is
> because PEC has to be enabled only if both controller and
> adapter support it.
> 
> Added code to check PEC capability for adapter and enable it
> only if both controller and adapter supports PEC.
> 
> Signed-off-by: Madhava Reddy Siddareddygari <msiddare@cisco.com>
> [Upstream from SONiC https://github.com/Azure/sonic-linux-kernel/pull/215]
> Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>

Applied.

Thanks,
Guenter

> ---
> v2: Do not revert check introduced by commit e5befc02 (hwmon: (pmbus)
>     Add a PMBUS_NO_CAPABILITY platform data flag).
> 
>  drivers/hwmon/pmbus/pmbus_core.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index bbd745178147..2fd0fec59d4f 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -2214,11 +2214,15 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
>  		data->has_status_word = true;
>  	}
>  
> -	/* Enable PEC if the controller supports it */
> +	/* Enable PEC if the controller and bus supports it */
>  	if (!(data->flags & PMBUS_NO_CAPABILITY)) {
>  		ret = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
> -		if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK))
> -			client->flags |= I2C_CLIENT_PEC;
> +		if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK)) {
> +			if (i2c_check_functionality(client->adapter,
> +						I2C_FUNC_SMBUS_PEC)) {
> +				client->flags |= I2C_CLIENT_PEC;
> +			}
> +		}
>  	}
>  
>  	/*

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

* Re: [PATCH v2] hwmon: (pmbus_core) Check adapter PEC support
  2021-06-06 12:50 ` Guenter Roeck
@ 2021-12-01 15:58   ` Paul Menzel
  2021-12-01 19:57     ` Guenter Roeck
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Menzel @ 2021-12-01 15:58 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Jean Delvare, Madhava Reddy Siddareddygari, linux-hwmon, linux-kernel

Dear Guenter,


Am 06.06.21 um 14:50 schrieb Guenter Roeck:
> On Sat, Jun 05, 2021 at 07:27:02AM +0200, Paul Menzel wrote:
>> From: Madhava Reddy Siddareddygari <msiddare@cisco.com>
>>
>> Currently, for Packet Error Checking (PEC) only the controller
>> is checked for support. This causes problems on the cisco-8000
>> platform where a SMBUS transaction errors are observed. This is
>> because PEC has to be enabled only if both controller and
>> adapter support it.
>>
>> Added code to check PEC capability for adapter and enable it
>> only if both controller and adapter supports PEC.
>>
>> Signed-off-by: Madhava Reddy Siddareddygari <msiddare@cisco.com>
>> [Upstream from SONiC https://github.com/Azure/sonic-linux-kernel/pull/215]
>> Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
> 
> Applied.

Thank you very much. Would it be alright, if I asked the stable series 
maintainers to backport this patch to the Linux 5.10 LTS series?


Kind regards,

Paul

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

* Re: [PATCH v2] hwmon: (pmbus_core) Check adapter PEC support
  2021-12-01 15:58   ` Paul Menzel
@ 2021-12-01 19:57     ` Guenter Roeck
  0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2021-12-01 19:57 UTC (permalink / raw)
  To: Paul Menzel
  Cc: Jean Delvare, Madhava Reddy Siddareddygari, linux-hwmon, linux-kernel

Hi Paul,

On 12/1/21 7:58 AM, Paul Menzel wrote:
> Dear Guenter,
> 
> 
> Am 06.06.21 um 14:50 schrieb Guenter Roeck:
>> On Sat, Jun 05, 2021 at 07:27:02AM +0200, Paul Menzel wrote:
>>> From: Madhava Reddy Siddareddygari <msiddare@cisco.com>
>>>
>>> Currently, for Packet Error Checking (PEC) only the controller
>>> is checked for support. This causes problems on the cisco-8000
>>> platform where a SMBUS transaction errors are observed. This is
>>> because PEC has to be enabled only if both controller and
>>> adapter support it.
>>>
>>> Added code to check PEC capability for adapter and enable it
>>> only if both controller and adapter supports PEC.
>>>
>>> Signed-off-by: Madhava Reddy Siddareddygari <msiddare@cisco.com>
>>> [Upstream from SONiC https://github.com/Azure/sonic-linux-kernel/pull/215]
>>> Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
>>
>> Applied.
> 
> Thank you very much. Would it be alright, if I asked the stable series maintainers to backport this patch to the Linux 5.10 LTS series?
> 
That is not how it works. The stable maintainers will apply
a backport if you prepare one and send it to the stable
mailing list, but they won't do the work for you.

Having said that, if you want to provide such a backport,
sure, go ahead.

Guenter

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

end of thread, other threads:[~2021-12-01 19:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-05  5:27 [PATCH v2] hwmon: (pmbus_core) Check adapter PEC support Paul Menzel
2021-06-06 12:50 ` Guenter Roeck
2021-12-01 15:58   ` Paul Menzel
2021-12-01 19:57     ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).