Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull hwmon fixes from Guenter Roeck:

- ltc2992, adm1266: Set missing can_sleep flag

- tmp512/tmp513: Drop of_match_ptr for ID table to fix build with
!CONFIG_OF

- ucd90320: Fix back-to-back access problem

- ina3221: Fix bad error return from probe function

- xgene: Fix use-after-free bug in remove function

- adt7475: Fix hysteresis register bit masks, and fix association of
'smoothing' attributes

* tag 'hwmon-for-v6.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
hwmon: (ltc2992) Set `can_sleep` flag for GPIO chip
hwmon: (adm1266) Set `can_sleep` flag for GPIO chip
hwmon: tmp512: drop of_match_ptr for ID table
hwmon: (ucd90320) Add minimum delay between bus accesses
hwmon: (ina3221) return prober error code
hwmon: (xgene) Fix use after free bug in xgene_hwmon_remove due to race condition
hwmon: (adt7475) Fix masking of hysteresis registers
hwmon: (adt7475) Display smoothing attributes in correct order

+84 -6
+4 -4
drivers/hwmon/adt7475.c
··· 488 488 val = (temp - val) / 1000; 489 489 490 490 if (sattr->index != 1) { 491 - data->temp[HYSTERSIS][sattr->index] &= 0xF0; 491 + data->temp[HYSTERSIS][sattr->index] &= 0x0F; 492 492 data->temp[HYSTERSIS][sattr->index] |= (val & 0xF) << 4; 493 493 } else { 494 - data->temp[HYSTERSIS][sattr->index] &= 0x0F; 494 + data->temp[HYSTERSIS][sattr->index] &= 0xF0; 495 495 data->temp[HYSTERSIS][sattr->index] |= (val & 0xF); 496 496 } 497 497 ··· 556 556 val = data->enh_acoustics[0] & 0xf; 557 557 break; 558 558 case 1: 559 - val = (data->enh_acoustics[1] >> 4) & 0xf; 559 + val = data->enh_acoustics[1] & 0xf; 560 560 break; 561 561 case 2: 562 562 default: 563 - val = data->enh_acoustics[1] & 0xf; 563 + val = (data->enh_acoustics[1] >> 4) & 0xf; 564 564 break; 565 565 } 566 566
+1 -1
drivers/hwmon/ina3221.c
··· 772 772 return ret; 773 773 } else if (val > INA3221_CHANNEL3) { 774 774 dev_err(dev, "invalid reg %d of %pOFn\n", val, child); 775 - return ret; 775 + return -EINVAL; 776 776 } 777 777 778 778 input = &ina->inputs[val];
+1
drivers/hwmon/ltc2992.c
··· 323 323 st->gc.label = name; 324 324 st->gc.parent = &st->client->dev; 325 325 st->gc.owner = THIS_MODULE; 326 + st->gc.can_sleep = true; 326 327 st->gc.base = -1; 327 328 st->gc.names = st->gpio_names; 328 329 st->gc.ngpio = ARRAY_SIZE(st->gpio_names);
+1
drivers/hwmon/pmbus/adm1266.c
··· 301 301 data->gc.label = name; 302 302 data->gc.parent = &data->client->dev; 303 303 data->gc.owner = THIS_MODULE; 304 + data->gc.can_sleep = true; 304 305 data->gc.base = -1; 305 306 data->gc.names = data->gpio_names; 306 307 data->gc.ngpio = ARRAY_SIZE(data->gpio_names);
+75
drivers/hwmon/pmbus/ucd9000.c
··· 7 7 */ 8 8 9 9 #include <linux/debugfs.h> 10 + #include <linux/delay.h> 10 11 #include <linux/kernel.h> 11 12 #include <linux/module.h> 12 13 #include <linux/of_device.h> ··· 17 16 #include <linux/i2c.h> 18 17 #include <linux/pmbus.h> 19 18 #include <linux/gpio/driver.h> 19 + #include <linux/timekeeping.h> 20 20 #include "pmbus.h" 21 21 22 22 enum chips { ucd9000, ucd90120, ucd90124, ucd90160, ucd90320, ucd9090, ··· 67 65 struct gpio_chip gpio; 68 66 #endif 69 67 struct dentry *debugfs; 68 + ktime_t write_time; 70 69 }; 71 70 #define to_ucd9000_data(_info) container_of(_info, struct ucd9000_data, info) 72 71 ··· 75 72 struct i2c_client *client; 76 73 u8 index; 77 74 }; 75 + 76 + /* 77 + * It has been observed that the UCD90320 randomly fails register access when 78 + * doing another access right on the back of a register write. To mitigate this 79 + * make sure that there is a minimum delay between a write access and the 80 + * following access. The 250us is based on experimental data. At a delay of 81 + * 200us the issue seems to go away. Add a bit of extra margin to allow for 82 + * system to system differences. 83 + */ 84 + #define UCD90320_WAIT_DELAY_US 250 85 + 86 + static inline void ucd90320_wait(const struct ucd9000_data *data) 87 + { 88 + s64 delta = ktime_us_delta(ktime_get(), data->write_time); 89 + 90 + if (delta < UCD90320_WAIT_DELAY_US) 91 + udelay(UCD90320_WAIT_DELAY_US - delta); 92 + } 93 + 94 + static int ucd90320_read_word_data(struct i2c_client *client, int page, 95 + int phase, int reg) 96 + { 97 + const struct pmbus_driver_info *info = pmbus_get_driver_info(client); 98 + struct ucd9000_data *data = to_ucd9000_data(info); 99 + 100 + if (reg >= PMBUS_VIRT_BASE) 101 + return -ENXIO; 102 + 103 + ucd90320_wait(data); 104 + return pmbus_read_word_data(client, page, phase, reg); 105 + } 106 + 107 + static int ucd90320_read_byte_data(struct i2c_client *client, int page, int reg) 108 + { 109 + const struct pmbus_driver_info *info = pmbus_get_driver_info(client); 110 + struct ucd9000_data *data = to_ucd9000_data(info); 111 + 112 + ucd90320_wait(data); 113 + return pmbus_read_byte_data(client, page, reg); 114 + } 115 + 116 + static int ucd90320_write_word_data(struct i2c_client *client, int page, 117 + int reg, u16 word) 118 + { 119 + const struct pmbus_driver_info *info = pmbus_get_driver_info(client); 120 + struct ucd9000_data *data = to_ucd9000_data(info); 121 + int ret; 122 + 123 + ucd90320_wait(data); 124 + ret = pmbus_write_word_data(client, page, reg, word); 125 + data->write_time = ktime_get(); 126 + 127 + return ret; 128 + } 129 + 130 + static int ucd90320_write_byte(struct i2c_client *client, int page, u8 value) 131 + { 132 + const struct pmbus_driver_info *info = pmbus_get_driver_info(client); 133 + struct ucd9000_data *data = to_ucd9000_data(info); 134 + int ret; 135 + 136 + ucd90320_wait(data); 137 + ret = pmbus_write_byte(client, page, value); 138 + data->write_time = ktime_get(); 139 + 140 + return ret; 141 + } 78 142 79 143 static int ucd9000_get_fan_config(struct i2c_client *client, int fan) 80 144 { ··· 668 598 info->read_byte_data = ucd9000_read_byte_data; 669 599 info->func[0] |= PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12 670 600 | PMBUS_HAVE_FAN34 | PMBUS_HAVE_STATUS_FAN34; 601 + } else if (mid->driver_data == ucd90320) { 602 + info->read_byte_data = ucd90320_read_byte_data; 603 + info->read_word_data = ucd90320_read_word_data; 604 + info->write_byte = ucd90320_write_byte; 605 + info->write_word_data = ucd90320_write_word_data; 671 606 } 672 607 673 608 ucd9000_probe_gpio(client, mid, data);
+1 -1
drivers/hwmon/tmp513.c
··· 758 758 static struct i2c_driver tmp51x_driver = { 759 759 .driver = { 760 760 .name = "tmp51x", 761 - .of_match_table = of_match_ptr(tmp51x_of_match), 761 + .of_match_table = tmp51x_of_match, 762 762 }, 763 763 .probe_new = tmp51x_probe, 764 764 .id_table = tmp51x_id,
+1
drivers/hwmon/xgene-hwmon.c
··· 761 761 { 762 762 struct xgene_hwmon_dev *ctx = platform_get_drvdata(pdev); 763 763 764 + cancel_work_sync(&ctx->workq); 764 765 hwmon_device_unregister(ctx->hwmon_dev); 765 766 kfifo_free(&ctx->async_msg_fifo); 766 767 if (acpi_disabled)