hwmon fixes for v6.11-rc8/v6.11

- Fix clearing status register bits for chips supporting older
   PMBus versions
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEiHPvMQj9QTOCiqgVyx8mb86fmYEFAmbjIKIACgkQyx8mb86f
 mYHbtw/9H9OqgP0ITdt4VCcJoGPvBsTdNGaltJ4b+eBAebNRruG5UAI8bFKMiGpE
 WUIT87RSYs4MQlmvmkZzRNTpVlLqAOTJDaSOLPF4eft9yvXa9FnovtN/XsFoNeDp
 KJYYmo9+hBH7wmQkOinUeQCK8NRGbb5FmG5t0HLyLavHOcMUCbbvuptiSY5lYasy
 hTAeBBHI3INK8kDahXqJsm7TNlfyuxWbAazlmpFZA0Rh3CNcEiluw0b912u9JCer
 4xJbMKyo2KPcjCjZyA57AuqbQZedqawYzwIpZ/c2WbvpEobS7a7sykxF3loh8QVK
 njjjcJczeMkHY8TI2SzR5NcS9MEa8ycECfDidhNK2YbULtyXZypv4q+vNed7Rln7
 f5X9WcmRVPuIzg+Sy2O8p3REtTZzpNHLg4i3myXv+EWkHyTbPQLqOMVXQfJYu0D5
 mpk5hil80UDZs56KRsSvawuKd/s0xtonOmc+eP41o+oUqB2DGKTlzJFCYUyh8Sjr
 ukIwC/7dGlf3UvBLVTkLwuvzhxedKIy7RDRP50AvmPkzqVbzYRB7kUBrOPlXdPK1
 n59tuJlvU6klqJdxmyzn0YOXtqcfeEXINITBNLRwedWp0jnEmWGi96tLcX3VPQXK
 lAsdURYPcDw3s8ZqIgMZKBfZ6HzVaceV1SNErJU2YudeDJ39Pp4=
 =gEd7
 -----END PGP SIGNATURE-----

Merge tag 'hwmon-for-v6.11-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fix from Guenter Roeck:

 - Fix clearing status register bits for chips supporting older
   PMBus versions

* tag 'hwmon-for-v6.11-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (pmbus) Conditionally clear individual status bits for pmbus rev >= 1.2
This commit is contained in:
Linus Torvalds 2024-09-12 14:27:47 -07:00
commit fdf042df04
2 changed files with 20 additions and 3 deletions

View File

@ -418,6 +418,12 @@ enum pmbus_sensor_classes {
enum pmbus_data_format { linear = 0, ieee754, direct, vid }; enum pmbus_data_format { linear = 0, ieee754, direct, vid };
enum vrm_version { vr11 = 0, vr12, vr13, imvp9, amd625mv }; enum vrm_version { vr11 = 0, vr12, vr13, imvp9, amd625mv };
/* PMBus revision identifiers */
#define PMBUS_REV_10 0x00 /* PMBus revision 1.0 */
#define PMBUS_REV_11 0x11 /* PMBus revision 1.1 */
#define PMBUS_REV_12 0x22 /* PMBus revision 1.2 */
#define PMBUS_REV_13 0x33 /* PMBus revision 1.3 */
struct pmbus_driver_info { struct pmbus_driver_info {
int pages; /* Total number of pages */ int pages; /* Total number of pages */
u8 phases[PMBUS_PAGES]; /* Number of phases per page */ u8 phases[PMBUS_PAGES]; /* Number of phases per page */

View File

@ -85,6 +85,8 @@ struct pmbus_data {
u32 flags; /* from platform data */ u32 flags; /* from platform data */
u8 revision; /* The PMBus revision the device is compliant with */
int exponent[PMBUS_PAGES]; int exponent[PMBUS_PAGES];
/* linear mode: exponent for output voltages */ /* linear mode: exponent for output voltages */
@ -1095,9 +1097,14 @@ static int pmbus_get_boolean(struct i2c_client *client, struct pmbus_boolean *b,
regval = status & mask; regval = status & mask;
if (regval) { if (regval) {
ret = _pmbus_write_byte_data(client, page, reg, regval); if (data->revision >= PMBUS_REV_12) {
if (ret) ret = _pmbus_write_byte_data(client, page, reg, regval);
goto unlock; if (ret)
goto unlock;
} else {
pmbus_clear_fault_page(client, page);
}
} }
if (s1 && s2) { if (s1 && s2) {
s64 v1, v2; s64 v1, v2;
@ -2640,6 +2647,10 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
data->flags |= PMBUS_WRITE_PROTECTED | PMBUS_SKIP_STATUS_CHECK; data->flags |= PMBUS_WRITE_PROTECTED | PMBUS_SKIP_STATUS_CHECK;
} }
ret = i2c_smbus_read_byte_data(client, PMBUS_REVISION);
if (ret >= 0)
data->revision = ret;
if (data->info->pages) if (data->info->pages)
pmbus_clear_faults(client); pmbus_clear_faults(client);
else else