2023-08-04 23:36:19

by Tao Ren

[permalink] [raw]
Subject: [PATCH v2] hwmon: (pmbus/bel-pfe) Enable PMBUS_SKIP_STATUS_CHECK for pfe1100

From: Tao Ren <[email protected]>

Skip status check for both pfe1100 and pfe3000 because the communication
error is also observed on pfe1100 devices.

Signed-off-by: Tao Ren <[email protected]>
---
Changes in v2:
- improving comments.
- removing unnecessary {}

drivers/hwmon/pmbus/bel-pfe.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/hwmon/pmbus/bel-pfe.c b/drivers/hwmon/pmbus/bel-pfe.c
index fa5070ae26bc..7c5f4b10a7c1 100644
--- a/drivers/hwmon/pmbus/bel-pfe.c
+++ b/drivers/hwmon/pmbus/bel-pfe.c
@@ -17,12 +17,13 @@
enum chips {pfe1100, pfe3000};

/*
- * Disable status check for pfe3000 devices, because some devices report
- * communication error (invalid command) for VOUT_MODE command (0x20)
- * although correct VOUT_MODE (0x16) is returned: it leads to incorrect
- * exponent in linear mode.
+ * Disable status check because some devices report communication error
+ * (invalid command) for VOUT_MODE command (0x20) although the correct
+ * VOUT_MODE (0x16) is returned: it leads to incorrect exponent in linear
+ * mode.
+ * This affects both pfe3000 and pfe1100.
*/
-static struct pmbus_platform_data pfe3000_plat_data = {
+static struct pmbus_platform_data pfe_plat_data = {
.flags = PMBUS_SKIP_STATUS_CHECK,
};

@@ -94,16 +95,15 @@ static int pfe_pmbus_probe(struct i2c_client *client)
int model;

model = (int)i2c_match_id(pfe_device_id, client)->driver_data;
+ client->dev.platform_data = &pfe_plat_data;

/*
* PFE3000-12-069RA devices may not stay in page 0 during device
* probe which leads to probe failure (read status word failed).
* So let's set the device to page 0 at the beginning.
*/
- if (model == pfe3000) {
- client->dev.platform_data = &pfe3000_plat_data;
+ if (model == pfe3000)
i2c_smbus_write_byte_data(client, PMBUS_PAGE, 0);
- }

return pmbus_do_probe(client, &pfe_driver_info[model]);
}
--
2.40.1



2023-08-06 15:01:47

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH v2] hwmon: (pmbus/bel-pfe) Enable PMBUS_SKIP_STATUS_CHECK for pfe1100

On Fri, Aug 04, 2023 at 03:14:03PM -0700, [email protected] wrote:
> From: Tao Ren <[email protected]>
>
> Skip status check for both pfe1100 and pfe3000 because the communication
> error is also observed on pfe1100 devices.
>
> Signed-off-by: Tao Ren <[email protected]>

Applied.

Thanks,
Guenter

> ---
> Changes in v2:
> - improving comments.
> - removing unnecessary {}
>
> drivers/hwmon/pmbus/bel-pfe.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/hwmon/pmbus/bel-pfe.c b/drivers/hwmon/pmbus/bel-pfe.c
> index fa5070ae26bc..7c5f4b10a7c1 100644
> --- a/drivers/hwmon/pmbus/bel-pfe.c
> +++ b/drivers/hwmon/pmbus/bel-pfe.c
> @@ -17,12 +17,13 @@
> enum chips {pfe1100, pfe3000};
>
> /*
> - * Disable status check for pfe3000 devices, because some devices report
> - * communication error (invalid command) for VOUT_MODE command (0x20)
> - * although correct VOUT_MODE (0x16) is returned: it leads to incorrect
> - * exponent in linear mode.
> + * Disable status check because some devices report communication error
> + * (invalid command) for VOUT_MODE command (0x20) although the correct
> + * VOUT_MODE (0x16) is returned: it leads to incorrect exponent in linear
> + * mode.
> + * This affects both pfe3000 and pfe1100.
> */
> -static struct pmbus_platform_data pfe3000_plat_data = {
> +static struct pmbus_platform_data pfe_plat_data = {
> .flags = PMBUS_SKIP_STATUS_CHECK,
> };
>
> @@ -94,16 +95,15 @@ static int pfe_pmbus_probe(struct i2c_client *client)
> int model;
>
> model = (int)i2c_match_id(pfe_device_id, client)->driver_data;
> + client->dev.platform_data = &pfe_plat_data;
>
> /*
> * PFE3000-12-069RA devices may not stay in page 0 during device
> * probe which leads to probe failure (read status word failed).
> * So let's set the device to page 0 at the beginning.
> */
> - if (model == pfe3000) {
> - client->dev.platform_data = &pfe3000_plat_data;
> + if (model == pfe3000)
> i2c_smbus_write_byte_data(client, PMBUS_PAGE, 0);
> - }
>
> return pmbus_do_probe(client, &pfe_driver_info[model]);
> }