Linux Hardware Monitor development
 help / color / mirror / Atom feed
* [PATCH] hwmon: (pmbus) allow to use a custom read_byte_data function for PMBUS_CAPABILITY
@ 2022-04-19 21:52 Adam Wujek
  2022-04-19 22:08 ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Wujek @ 2022-04-19 21:52 UTC (permalink / raw)
  Cc: Adam Wujek, Guenter Roeck, Jean Delvare, linux-hwmon,
	linux-kernel

Some devices returns a wrong value in PMBUS_CAPABILITY register.
Allow the use of read_byte_data function defined in a driver for
a specific device.

Signed-off-by: Adam Wujek <dev_public@wujek.eu>
---
 drivers/hwmon/pmbus/pmbus_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index f8ca36759b0a..ef9989be8f89 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -2011,7 +2011,7 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
 	}

 	/* Enable PEC if the controller supports it */
-	ret = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
+	ret = _pmbus_read_byte_data(client, -1, PMBUS_CAPABILITY);
 	if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK))
 		client->flags |= I2C_CLIENT_PEC;
 	else
--
2.17.1



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

* Re: [PATCH] hwmon: (pmbus) allow to use a custom read_byte_data function for PMBUS_CAPABILITY
  2022-04-19 21:52 [PATCH] hwmon: (pmbus) allow to use a custom read_byte_data function for PMBUS_CAPABILITY Adam Wujek
@ 2022-04-19 22:08 ` Guenter Roeck
  2022-04-19 22:18   ` wujek dev
  0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2022-04-19 22:08 UTC (permalink / raw)
  To: Adam Wujek; +Cc: Jean Delvare, linux-hwmon, linux-kernel

On 4/19/22 14:52, Adam Wujek wrote:
> Some devices returns a wrong value in PMBUS_CAPABILITY register.
> Allow the use of read_byte_data function defined in a driver for
> a specific device.

Those devices should set PMBUS_NO_CAPABILITY.

Guenter

> 
> Signed-off-by: Adam Wujek <dev_public@wujek.eu>
> ---
>   drivers/hwmon/pmbus/pmbus_core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index f8ca36759b0a..ef9989be8f89 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -2011,7 +2011,7 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
>   	}
> 
>   	/* Enable PEC if the controller supports it */
> -	ret = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
> +	ret = _pmbus_read_byte_data(client, -1, PMBUS_CAPABILITY);
>   	if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK))
>   		client->flags |= I2C_CLIENT_PEC;
>   	else
> --
> 2.17.1
> 
> 


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

* Re: [PATCH] hwmon: (pmbus) allow to use a custom read_byte_data function for PMBUS_CAPABILITY
  2022-04-19 22:08 ` Guenter Roeck
@ 2022-04-19 22:18   ` wujek dev
  0 siblings, 0 replies; 3+ messages in thread
From: wujek dev @ 2022-04-19 22:18 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Jean Delvare, linux-hwmon, linux-kernel

------- Original Message -------
On Wednesday, April 20th, 2022 at 00:08, Guenter Roeck <linux@roeck-us.net> wrote:


>
>
> On 4/19/22 14:52, Adam Wujek wrote:
>
> > Some devices returns a wrong value in PMBUS_CAPABILITY register.
> > Allow the use of read_byte_data function defined in a driver for
> > a specific device.
>
>
> Those devices should set PMBUS_NO_CAPABILITY.
>
> Guenter
Yes, you're correct. I was working with the older kernel. Please ignore this patch.

Adam
>
> > Signed-off-by: Adam Wujek dev_public@wujek.eu
> > ---
> > drivers/hwmon/pmbus/pmbus_core.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> > index f8ca36759b0a..ef9989be8f89 100644
> > --- a/drivers/hwmon/pmbus/pmbus_core.c
> > +++ b/drivers/hwmon/pmbus/pmbus_core.c
> > @@ -2011,7 +2011,7 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
> > }
> >
> > /* Enable PEC if the controller supports it */
> > - ret = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
> > + ret = _pmbus_read_byte_data(client, -1, PMBUS_CAPABILITY);
> > if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK))
> > client->flags |= I2C_CLIENT_PEC;
> > else
> > --
> > 2.17.1

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

end of thread, other threads:[~2022-04-19 22:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-19 21:52 [PATCH] hwmon: (pmbus) allow to use a custom read_byte_data function for PMBUS_CAPABILITY Adam Wujek
2022-04-19 22:08 ` Guenter Roeck
2022-04-19 22:18   ` wujek dev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox