* [PATCH 0/3] hwmon: (pmbus) Add support for additional Flex BMR converters to the pmbus driver @ 2021-05-05 18:32 Erik Rosen 2021-05-05 18:32 ` [PATCH 1/3] hwmon: (pmbus) Add new flag PMBUS_READ_STATUS_AFTER_FAILED_CHECK Erik Rosen ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Erik Rosen @ 2021-05-05 18:32 UTC (permalink / raw) To: Jean Delvare, Guenter Roeck, Jonathan Corbet, linux-hwmon, linux-doc, linux-kernel Cc: Erik Rosen Some Flex PMBus converters (BMR310, BMR458, BMR80, BMR490 and BMR491) end up in an undefined state when trying to read an register that does not exist in the chip. This causes the following chip access to also fail even if it is a valid register read. This will mess up the pmbus driver auto-detection process. One way to reset the pmbus state machine to a known state is to read a register that is known to exist. This read will fail but will also reset the chip into a known state. For such chips we suggest adding a new pmbus flag: PMBUS_READ_STATUS_AFTER_FAILED_CHECK By setting this flag the driver will try to read the STATUS register after each failed register check. This read may fail, but it will put the chip into a known state so that the auto-detection process can proceed correctly. Add support for Flex BMR310, BMR456, BMR457, BMR458, BMR480, BMR490, BMR491 and BMR492 to the pmbus driver This patch has been tested with Flex BMR310, BMR456, BMR457, BMR458, BMR480, BMR490, BMR491 and BMR492 converter modules Erik Rosen (3): Add new flag PMBUS_READ_STATUS_AFTER_FAILED_CHECK Add documentation for new flags Add support for Flex BMR310, BMR456, BMR457, BMR458, BMR480, BMR490, BMR491 and BMR492 to the pmbus driver Documentation/hwmon/pmbus-core.rst | 24 ++++++++++++++++++++++-- Documentation/hwmon/pmbus.rst | 11 +++++++---- drivers/hwmon/pmbus/Kconfig | 7 ++++--- drivers/hwmon/pmbus/pmbus.c | 24 ++++++++++++++++++++++-- drivers/hwmon/pmbus/pmbus_core.c | 2 ++ include/linux/pmbus.h | 13 +++++++++++++ 6 files changed, 70 insertions(+), 11 deletions(-) base-commit: 1e28eed17697bcf343c6743f0028cc3b5dd88bf0 -- 2.20.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] hwmon: (pmbus) Add new flag PMBUS_READ_STATUS_AFTER_FAILED_CHECK 2021-05-05 18:32 [PATCH 0/3] hwmon: (pmbus) Add support for additional Flex BMR converters to the pmbus driver Erik Rosen @ 2021-05-05 18:32 ` Erik Rosen 2021-05-06 4:06 ` Guenter Roeck 2021-05-05 18:32 ` [PATCH 2/3] hwmon: (pmbus) Add documentation for new flags Erik Rosen 2021-05-05 18:32 ` [PATCH 3/3] hwmon: (pmbus) Add support for additional Flex BMR converters to pmbus Erik Rosen 2 siblings, 1 reply; 7+ messages in thread From: Erik Rosen @ 2021-05-05 18:32 UTC (permalink / raw) To: Jean Delvare, Guenter Roeck, Jonathan Corbet, linux-hwmon, linux-doc, linux-kernel Cc: Erik Rosen Some PMBus chips end up in an undefined state when trying to read an unsupported register. For such chips, it is necessary to reset the chip pmbus controller to a known state after a failed register check. This can be done by reading a known register. By setting this flag the driver will try to read the STATUS register after each failed register check. This read may fail, but it will put the chip into a known state. Signed-off-by: Erik Rosen <erik.rosen@metormote.com> --- drivers/hwmon/pmbus/pmbus_core.c | 2 ++ include/linux/pmbus.h | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index aadea85fe630..cb0b3c7c3434 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -512,6 +512,8 @@ static bool pmbus_check_register(struct i2c_client *client, rv = func(client, page, reg); if (rv >= 0 && !(data->flags & PMBUS_SKIP_STATUS_CHECK)) rv = pmbus_check_status_cml(client); + if (rv < 0 && (data->flags & PMBUS_READ_STATUS_AFTER_FAILED_CHECK)) + data->read_status(client, -1); pmbus_clear_fault_page(client, -1); return rv >= 0; } diff --git a/include/linux/pmbus.h b/include/linux/pmbus.h index 12cbbf305969..edd7c84fef65 100644 --- a/include/linux/pmbus.h +++ b/include/linux/pmbus.h @@ -43,6 +43,19 @@ */ #define PMBUS_NO_CAPABILITY BIT(2) +/* + * PMBUS_READ_STATUS_AFTER_FAILED_CHECK + * + * Some PMBus chips end up in an undefined state when trying to read an + * unsupported register. For such chips, it is necessary to reset the + * chip pmbus controller to a known state after a failed register check. + * This can be done by reading a known register. By setting this flag the + * driver will try to read the STATUS register after each failed + * register check. This read may fail, but it will put the chip in a + * known state. + */ +#define PMBUS_READ_STATUS_AFTER_FAILED_CHECK BIT(3) + struct pmbus_platform_data { u32 flags; /* Device specific flags */ -- 2.20.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] hwmon: (pmbus) Add new flag PMBUS_READ_STATUS_AFTER_FAILED_CHECK 2021-05-05 18:32 ` [PATCH 1/3] hwmon: (pmbus) Add new flag PMBUS_READ_STATUS_AFTER_FAILED_CHECK Erik Rosen @ 2021-05-06 4:06 ` Guenter Roeck 0 siblings, 0 replies; 7+ messages in thread From: Guenter Roeck @ 2021-05-06 4:06 UTC (permalink / raw) To: Erik Rosen, Jean Delvare, Jonathan Corbet, linux-hwmon, linux-doc, linux-kernel On 5/5/21 11:32 AM, Erik Rosen wrote: > Some PMBus chips end up in an undefined state when trying to read an > unsupported register. For such chips, it is necessary to reset the > chip pmbus controller to a known state after a failed register check. > This can be done by reading a known register. By setting this flag the > driver will try to read the STATUS register after each failed > register check. This read may fail, but it will put the chip into a > known state. > > Signed-off-by: Erik Rosen <erik.rosen@metormote.com> For my reference: Reviewed-by: Guenter Roeck <linux@roeck-us.net> > --- > drivers/hwmon/pmbus/pmbus_core.c | 2 ++ > include/linux/pmbus.h | 13 +++++++++++++ > 2 files changed, 15 insertions(+) > > diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c > index aadea85fe630..cb0b3c7c3434 100644 > --- a/drivers/hwmon/pmbus/pmbus_core.c > +++ b/drivers/hwmon/pmbus/pmbus_core.c > @@ -512,6 +512,8 @@ static bool pmbus_check_register(struct i2c_client *client, > rv = func(client, page, reg); > if (rv >= 0 && !(data->flags & PMBUS_SKIP_STATUS_CHECK)) > rv = pmbus_check_status_cml(client); > + if (rv < 0 && (data->flags & PMBUS_READ_STATUS_AFTER_FAILED_CHECK)) > + data->read_status(client, -1); > pmbus_clear_fault_page(client, -1); > return rv >= 0; > } > diff --git a/include/linux/pmbus.h b/include/linux/pmbus.h > index 12cbbf305969..edd7c84fef65 100644 > --- a/include/linux/pmbus.h > +++ b/include/linux/pmbus.h > @@ -43,6 +43,19 @@ > */ > #define PMBUS_NO_CAPABILITY BIT(2) > > +/* > + * PMBUS_READ_STATUS_AFTER_FAILED_CHECK > + * > + * Some PMBus chips end up in an undefined state when trying to read an > + * unsupported register. For such chips, it is necessary to reset the > + * chip pmbus controller to a known state after a failed register check. > + * This can be done by reading a known register. By setting this flag the > + * driver will try to read the STATUS register after each failed > + * register check. This read may fail, but it will put the chip in a > + * known state. > + */ > +#define PMBUS_READ_STATUS_AFTER_FAILED_CHECK BIT(3) > + > struct pmbus_platform_data { > u32 flags; /* Device specific flags */ > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] hwmon: (pmbus) Add documentation for new flags 2021-05-05 18:32 [PATCH 0/3] hwmon: (pmbus) Add support for additional Flex BMR converters to the pmbus driver Erik Rosen 2021-05-05 18:32 ` [PATCH 1/3] hwmon: (pmbus) Add new flag PMBUS_READ_STATUS_AFTER_FAILED_CHECK Erik Rosen @ 2021-05-05 18:32 ` Erik Rosen 2021-05-06 4:04 ` Guenter Roeck 2021-05-05 18:32 ` [PATCH 3/3] hwmon: (pmbus) Add support for additional Flex BMR converters to pmbus Erik Rosen 2 siblings, 1 reply; 7+ messages in thread From: Erik Rosen @ 2021-05-05 18:32 UTC (permalink / raw) To: Jean Delvare, Guenter Roeck, Jonathan Corbet, linux-hwmon, linux-doc, linux-kernel Cc: Erik Rosen Add documentation for the new pmbus flags PMBUS_WRITE_PROTECTED and PMBUS_READ_STATUS_AFTER_FAILED_CHECK Signed-off-by: Erik Rosen <erik.rosen@metormote.com> --- Documentation/hwmon/pmbus-core.rst | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Documentation/hwmon/pmbus-core.rst b/Documentation/hwmon/pmbus-core.rst index 73e23ab42cc3..001c64f0f8c0 100644 --- a/Documentation/hwmon/pmbus-core.rst +++ b/Documentation/hwmon/pmbus-core.rst @@ -289,9 +289,13 @@ PMBus driver platform data ========================== PMBus platform data is defined in include/linux/pmbus.h. Platform data -currently only provides a flag field with a single bit used:: +currently only provides a flag field with three bits used:: - #define PMBUS_SKIP_STATUS_CHECK (1 << 0) + #define PMBUS_SKIP_STATUS_CHECK BIT(0) + + #define PMBUS_WRITE_PROTECTED BIT(1) + + #define PMBUS_READ_STATUS_AFTER_FAILED_CHECK BIT(2) struct pmbus_platform_data { u32 flags; /* Device specific flags */ @@ -315,3 +319,19 @@ status register must be disabled. Some i2c controllers do not support single-byte commands (write commands with no data, i2c_smbus_write_byte()). With such controllers, clearing the status register is impossible, and the PMBUS_SKIP_STATUS_CHECK flag must be set. + +PMBUS_WRITE_PROTECTED + +Set if the chip is write protected and write protection is not determined +by the standard WRITE_PROTECT command. + +PMBUS_READ_STATUS_AFTER_FAILED_CHECK + Read the STATUS register after each failed register check. + +Some PMBus chips end up in an undefined state when trying to read an +unsupported register. For such chips, it is necessary to reset the +chip pmbus controller to a known state after a failed register check. +This can be done by reading a known register. By setting this flag the +driver will try to read the STATUS register after each failed +register check. This read may fail, but it will put the chip into a +known state. \ No newline at end of file -- 2.20.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] hwmon: (pmbus) Add documentation for new flags 2021-05-05 18:32 ` [PATCH 2/3] hwmon: (pmbus) Add documentation for new flags Erik Rosen @ 2021-05-06 4:04 ` Guenter Roeck 0 siblings, 0 replies; 7+ messages in thread From: Guenter Roeck @ 2021-05-06 4:04 UTC (permalink / raw) To: Erik Rosen, Jean Delvare, Jonathan Corbet, linux-hwmon, linux-doc, linux-kernel On 5/5/21 11:32 AM, Erik Rosen wrote: > Add documentation for the new pmbus flags PMBUS_WRITE_PROTECTED and > PMBUS_READ_STATUS_AFTER_FAILED_CHECK > > Signed-off-by: Erik Rosen <erik.rosen@metormote.com> > --- > Documentation/hwmon/pmbus-core.rst | 24 ++++++++++++++++++++++-- > 1 file changed, 22 insertions(+), 2 deletions(-) > > diff --git a/Documentation/hwmon/pmbus-core.rst b/Documentation/hwmon/pmbus-core.rst > index 73e23ab42cc3..001c64f0f8c0 100644 > --- a/Documentation/hwmon/pmbus-core.rst > +++ b/Documentation/hwmon/pmbus-core.rst > @@ -289,9 +289,13 @@ PMBus driver platform data > ========================== > > PMBus platform data is defined in include/linux/pmbus.h. Platform data > -currently only provides a flag field with a single bit used:: > +currently only provides a flag field with three bits used:: > > - #define PMBUS_SKIP_STATUS_CHECK (1 << 0) > + #define PMBUS_SKIP_STATUS_CHECK BIT(0) > + > + #define PMBUS_WRITE_PROTECTED BIT(1) > + > + #define PMBUS_READ_STATUS_AFTER_FAILED_CHECK BIT(2) > > struct pmbus_platform_data { > u32 flags; /* Device specific flags */ > @@ -315,3 +319,19 @@ status register must be disabled. > Some i2c controllers do not support single-byte commands (write commands with > no data, i2c_smbus_write_byte()). With such controllers, clearing the status > register is impossible, and the PMBUS_SKIP_STATUS_CHECK flag must be set. > + > +PMBUS_WRITE_PROTECTED > + > +Set if the chip is write protected and write protection is not determined > +by the standard WRITE_PROTECT command. > + > +PMBUS_READ_STATUS_AFTER_FAILED_CHECK > + Read the STATUS register after each failed register check. > + > +Some PMBus chips end up in an undefined state when trying to read an > +unsupported register. For such chips, it is necessary to reset the > +chip pmbus controller to a known state after a failed register check. > +This can be done by reading a known register. By setting this flag the > +driver will try to read the STATUS register after each failed > +register check. This read may fail, but it will put the chip into a > +known state. > \ No newline at end of file > Formatting looks way off in this file. Please update to have it look nice. Thanks, Guenter ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] hwmon: (pmbus) Add support for additional Flex BMR converters to pmbus 2021-05-05 18:32 [PATCH 0/3] hwmon: (pmbus) Add support for additional Flex BMR converters to the pmbus driver Erik Rosen 2021-05-05 18:32 ` [PATCH 1/3] hwmon: (pmbus) Add new flag PMBUS_READ_STATUS_AFTER_FAILED_CHECK Erik Rosen 2021-05-05 18:32 ` [PATCH 2/3] hwmon: (pmbus) Add documentation for new flags Erik Rosen @ 2021-05-05 18:32 ` Erik Rosen 2021-05-06 4:02 ` Guenter Roeck 2 siblings, 1 reply; 7+ messages in thread From: Erik Rosen @ 2021-05-05 18:32 UTC (permalink / raw) To: Jean Delvare, Guenter Roeck, Jonathan Corbet, linux-hwmon, linux-doc, linux-kernel Cc: Erik Rosen Add support for Flex BMR310, BMR456, BMR457, BMR458, BMR480, BMR490, BMR491 and BMR492 to the pmbus driver Signed-off-by: Erik Rosen <erik.rosen@metormote.com> --- Documentation/hwmon/pmbus.rst | 11 +++++++---- drivers/hwmon/pmbus/Kconfig | 7 ++++--- drivers/hwmon/pmbus/pmbus.c | 24 ++++++++++++++++++++++-- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/Documentation/hwmon/pmbus.rst b/Documentation/hwmon/pmbus.rst index c44f14115413..0514c3052d4a 100644 --- a/Documentation/hwmon/pmbus.rst +++ b/Documentation/hwmon/pmbus.rst @@ -3,15 +3,18 @@ Kernel driver pmbus Supported chips: - * Ericsson BMR453, BMR454 + * Flex BMR453, BMR454, BMR456, BMR457, BMR458, BMR480, + BMR490, BMR491, BMR310, BMR492 - Prefixes: 'bmr453', 'bmr454' + Prefixes: 'bmr453', 'bmr454', 'bmr456', 'bmr457', 'bmr458', 'bmr480', + 'bmr490', 'bmr491', 'bmr310', 'bmr492' Addresses scanned: - - Datasheet: + Datasheets: + + https://flexpowermodules.com/products - http://archive.ericsson.net/service/internet/picov/get?DocNo=28701-EN/LZT146395 * ON Semiconductor ADP4000, NCP4200, NCP4208 diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index 32d2fc850621..59080d142bf7 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig @@ -19,9 +19,10 @@ config SENSORS_PMBUS default y help If you say yes here you get hardware monitoring support for generic - PMBus devices, including but not limited to ADP4000, BMR453, BMR454, - MAX20796, MDT040, NCP4200, NCP4208, PDT003, PDT006, PDT012, TPS40400, - TPS544B20, TPS544B25, TPS544C20, TPS544C25, and UDT020. + PMBus devices, including but not limited to ADP4000, BMR310, BMR453, + BMR454, BMR456, BMR457, BMR458, BMR480, BMR490, BMR491, BMR492, + MAX20796, MDT040, NCP4200, NCP4208, PDT003, PDT006, PDT012, + TPS40400, TPS544B20, TPS544B25, TPS544C20, TPS544C25, and UDT020. This driver can also be built as a module. If so, the module will be called pmbus. diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c index a1b4260e75b2..688c4a3a87e0 100644 --- a/drivers/hwmon/pmbus/pmbus.c +++ b/drivers/hwmon/pmbus/pmbus.c @@ -173,13 +173,18 @@ static int pmbus_probe(struct i2c_client *client) return -ENOMEM; device_info = (struct pmbus_device_info *)i2c_match_id(pmbus_id, client)->driver_data; - if (device_info->flags & PMBUS_SKIP_STATUS_CHECK) { + if (device_info->flags & PMBUS_SKIP_STATUS_CHECK || + device_info->flags & PMBUS_READ_STATUS_AFTER_FAILED_CHECK) { pdata = devm_kzalloc(dev, sizeof(struct pmbus_platform_data), GFP_KERNEL); if (!pdata) return -ENOMEM; - pdata->flags = PMBUS_SKIP_STATUS_CHECK; + pdata->flags = 0; + if (device_info->flags & PMBUS_SKIP_STATUS_CHECK) + pdata->flags |= PMBUS_SKIP_STATUS_CHECK; + if (device_info->flags & PMBUS_READ_STATUS_AFTER_FAILED_CHECK) + pdata->flags |= PMBUS_READ_STATUS_AFTER_FAILED_CHECK; } info->pages = device_info->pages; @@ -193,22 +198,37 @@ static const struct pmbus_device_info pmbus_info_one = { .pages = 1, .flags = 0 }; + static const struct pmbus_device_info pmbus_info_zero = { .pages = 0, .flags = 0 }; + static const struct pmbus_device_info pmbus_info_one_skip = { .pages = 1, .flags = PMBUS_SKIP_STATUS_CHECK }; +static const struct pmbus_device_info pmbus_info_one_status = { + .pages = 1, + .flags = PMBUS_READ_STATUS_AFTER_FAILED_CHECK +}; + /* * Use driver_data to set the number of pages supported by the chip. */ static const struct i2c_device_id pmbus_id[] = { {"adp4000", (kernel_ulong_t)&pmbus_info_one}, + {"bmr310", (kernel_ulong_t)&pmbus_info_one_status}, {"bmr453", (kernel_ulong_t)&pmbus_info_one}, {"bmr454", (kernel_ulong_t)&pmbus_info_one}, + {"bmr456", (kernel_ulong_t)&pmbus_info_one}, + {"bmr457", (kernel_ulong_t)&pmbus_info_one}, + {"bmr458", (kernel_ulong_t)&pmbus_info_one_status}, + {"bmr480", (kernel_ulong_t)&pmbus_info_one_status}, + {"bmr490", (kernel_ulong_t)&pmbus_info_one_status}, + {"bmr491", (kernel_ulong_t)&pmbus_info_one_status}, + {"bmr492", (kernel_ulong_t)&pmbus_info_one}, {"dps460", (kernel_ulong_t)&pmbus_info_one_skip}, {"dps650ab", (kernel_ulong_t)&pmbus_info_one_skip}, {"dps800", (kernel_ulong_t)&pmbus_info_one_skip}, -- 2.20.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] hwmon: (pmbus) Add support for additional Flex BMR converters to pmbus 2021-05-05 18:32 ` [PATCH 3/3] hwmon: (pmbus) Add support for additional Flex BMR converters to pmbus Erik Rosen @ 2021-05-06 4:02 ` Guenter Roeck 0 siblings, 0 replies; 7+ messages in thread From: Guenter Roeck @ 2021-05-06 4:02 UTC (permalink / raw) To: Erik Rosen, Jean Delvare, Jonathan Corbet, linux-hwmon, linux-doc, linux-kernel On 5/5/21 11:32 AM, Erik Rosen wrote: > Add support for Flex BMR310, BMR456, BMR457, BMR458, BMR480, BMR490, > BMR491 and BMR492 to the pmbus driver > > Signed-off-by: Erik Rosen <erik.rosen@metormote.com> > --- > Documentation/hwmon/pmbus.rst | 11 +++++++---- > drivers/hwmon/pmbus/Kconfig | 7 ++++--- > drivers/hwmon/pmbus/pmbus.c | 24 ++++++++++++++++++++++-- > 3 files changed, 33 insertions(+), 9 deletions(-) > > diff --git a/Documentation/hwmon/pmbus.rst b/Documentation/hwmon/pmbus.rst > index c44f14115413..0514c3052d4a 100644 > --- a/Documentation/hwmon/pmbus.rst > +++ b/Documentation/hwmon/pmbus.rst > @@ -3,15 +3,18 @@ Kernel driver pmbus > > Supported chips: > > - * Ericsson BMR453, BMR454 > + * Flex BMR453, BMR454, BMR456, BMR457, BMR458, BMR480, > + BMR490, BMR491, BMR310, BMR492 > > - Prefixes: 'bmr453', 'bmr454' > + Prefixes: 'bmr453', 'bmr454', 'bmr456', 'bmr457', 'bmr458', 'bmr480', > + 'bmr490', 'bmr491', 'bmr310', 'bmr492' > > Addresses scanned: - > > - Datasheet: > + Datasheets: > + > + https://flexpowermodules.com/products > > - http://archive.ericsson.net/service/internet/picov/get?DocNo=28701-EN/LZT146395 > > * ON Semiconductor ADP4000, NCP4200, NCP4208 > > diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig > index 32d2fc850621..59080d142bf7 100644 > --- a/drivers/hwmon/pmbus/Kconfig > +++ b/drivers/hwmon/pmbus/Kconfig > @@ -19,9 +19,10 @@ config SENSORS_PMBUS > default y > help > If you say yes here you get hardware monitoring support for generic > - PMBus devices, including but not limited to ADP4000, BMR453, BMR454, > - MAX20796, MDT040, NCP4200, NCP4208, PDT003, PDT006, PDT012, TPS40400, > - TPS544B20, TPS544B25, TPS544C20, TPS544C25, and UDT020. > + PMBus devices, including but not limited to ADP4000, BMR310, BMR453, > + BMR454, BMR456, BMR457, BMR458, BMR480, BMR490, BMR491, BMR492, > + MAX20796, MDT040, NCP4200, NCP4208, PDT003, PDT006, PDT012, > + TPS40400, TPS544B20, TPS544B25, TPS544C20, TPS544C25, and UDT020. > > This driver can also be built as a module. If so, the module will > be called pmbus. > diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c > index a1b4260e75b2..688c4a3a87e0 100644 > --- a/drivers/hwmon/pmbus/pmbus.c > +++ b/drivers/hwmon/pmbus/pmbus.c > @@ -173,13 +173,18 @@ static int pmbus_probe(struct i2c_client *client) > return -ENOMEM; > > device_info = (struct pmbus_device_info *)i2c_match_id(pmbus_id, client)->driver_data; > - if (device_info->flags & PMBUS_SKIP_STATUS_CHECK) { > + if (device_info->flags & PMBUS_SKIP_STATUS_CHECK || > + device_info->flags & PMBUS_READ_STATUS_AFTER_FAILED_CHECK) { I don't think it makes sense to skip WRITE_PROTECT here. Just make this if (device_info->flags) { > pdata = devm_kzalloc(dev, sizeof(struct pmbus_platform_data), > GFP_KERNEL); > if (!pdata) > return -ENOMEM; > > - pdata->flags = PMBUS_SKIP_STATUS_CHECK; > + pdata->flags = 0; > + if (device_info->flags & PMBUS_SKIP_STATUS_CHECK) > + pdata->flags |= PMBUS_SKIP_STATUS_CHECK; > + if (device_info->flags & PMBUS_READ_STATUS_AFTER_FAILED_CHECK) > + pdata->flags |= PMBUS_READ_STATUS_AFTER_FAILED_CHECK; and this pdata->flags = device_info->flags; Guenter > } > > info->pages = device_info->pages; > @@ -193,22 +198,37 @@ static const struct pmbus_device_info pmbus_info_one = { > .pages = 1, > .flags = 0 > }; > + > static const struct pmbus_device_info pmbus_info_zero = { > .pages = 0, > .flags = 0 > }; > + > static const struct pmbus_device_info pmbus_info_one_skip = { > .pages = 1, > .flags = PMBUS_SKIP_STATUS_CHECK > }; > > +static const struct pmbus_device_info pmbus_info_one_status = { > + .pages = 1, > + .flags = PMBUS_READ_STATUS_AFTER_FAILED_CHECK > +}; > + > /* > * Use driver_data to set the number of pages supported by the chip. > */ > static const struct i2c_device_id pmbus_id[] = { > {"adp4000", (kernel_ulong_t)&pmbus_info_one}, > + {"bmr310", (kernel_ulong_t)&pmbus_info_one_status}, > {"bmr453", (kernel_ulong_t)&pmbus_info_one}, > {"bmr454", (kernel_ulong_t)&pmbus_info_one}, > + {"bmr456", (kernel_ulong_t)&pmbus_info_one}, > + {"bmr457", (kernel_ulong_t)&pmbus_info_one}, > + {"bmr458", (kernel_ulong_t)&pmbus_info_one_status}, > + {"bmr480", (kernel_ulong_t)&pmbus_info_one_status}, > + {"bmr490", (kernel_ulong_t)&pmbus_info_one_status}, > + {"bmr491", (kernel_ulong_t)&pmbus_info_one_status}, > + {"bmr492", (kernel_ulong_t)&pmbus_info_one}, > {"dps460", (kernel_ulong_t)&pmbus_info_one_skip}, > {"dps650ab", (kernel_ulong_t)&pmbus_info_one_skip}, > {"dps800", (kernel_ulong_t)&pmbus_info_one_skip}, > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-05-06 4:06 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-05-05 18:32 [PATCH 0/3] hwmon: (pmbus) Add support for additional Flex BMR converters to the pmbus driver Erik Rosen 2021-05-05 18:32 ` [PATCH 1/3] hwmon: (pmbus) Add new flag PMBUS_READ_STATUS_AFTER_FAILED_CHECK Erik Rosen 2021-05-06 4:06 ` Guenter Roeck 2021-05-05 18:32 ` [PATCH 2/3] hwmon: (pmbus) Add documentation for new flags Erik Rosen 2021-05-06 4:04 ` Guenter Roeck 2021-05-05 18:32 ` [PATCH 3/3] hwmon: (pmbus) Add support for additional Flex BMR converters to pmbus Erik Rosen 2021-05-06 4:02 ` Guenter Roeck
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.