Hello. I'm sending a new version of my patch on max31790. This new version fixes the cache issue and actually makes it work by setting .cache_type. You were right about the "yes/no" ranges, so I flipped those. By the way, it seems that the reason your reply got lost is because of weird addresses in the "Cc:" email field, they end with "cesnet.cz", so it could be that I'm sending email incorrectly. Let me know if I'm doing something wrong. Thanks, Václav čt 22. 4. 2021 v 3:31 odesílatel Guenter Roeck <linux@xxxxxxxxxxxx> napsal: > > On 4/12/21 7:59 PM, Václav Kubernát wrote: > > Converting the driver to use regmap makes it more generic. It also makes > > it a lot easier to debug through debugfs. > > > > Signed-off-by: Václav Kubernát <kubernat@xxxxxxxxx> > > --- > > drivers/hwmon/Kconfig | 1 + > > drivers/hwmon/max31790.c | 254 ++++++++++++++++++++------------------- > > 2 files changed, 133 insertions(+), 122 deletions(-) > > > > diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig > > index 1ecf697d8d99..9f11d036c316 100644 > > --- a/drivers/hwmon/Kconfig > > +++ b/drivers/hwmon/Kconfig > > @@ -1095,6 +1095,7 @@ config SENSORS_MAX6697 > > config SENSORS_MAX31790 > > tristate "Maxim MAX31790 sensor chip" > > depends on I2C > > + select REGMAP_I2C > > help > > If you say yes here you get support for 6-Channel PWM-Output > > Fan RPM Controller. > > diff --git a/drivers/hwmon/max31790.c b/drivers/hwmon/max31790.c > > index 2c6b333a28e9..e3765ce4444a 100644 > > --- a/drivers/hwmon/max31790.c > > +++ b/drivers/hwmon/max31790.c > > @@ -12,6 +12,7 @@ > > #include <linux/init.h> > > #include <linux/jiffies.h> > > #include <linux/module.h> > > +#include <linux/regmap.h> > > #include <linux/slab.h> > > > > /* MAX31790 registers */ > > @@ -46,92 +47,53 @@ > > > > #define NR_CHANNEL 6 > > > > +#define MAX31790_REG_USER_BYTE_67 0x67 > > + > > +#define BULK_TO_U16(msb, lsb) (((msb) << 8) + (lsb)) > > +#define U16_MSB(num) (((num) & 0xFF00) >> 8) > > +#define U16_LSB(num) ((num) & 0x00FF) > > + > > +static const struct regmap_range max31790_ro_range = { > > + .range_min = MAX31790_REG_TACH_COUNT(0), > > + .range_max = MAX31790_REG_PWMOUT(0) - 1, > > +}; > > + > > +static const struct regmap_access_table max31790_wr_table = { > > + .no_ranges = &max31790_ro_range, > > + .n_no_ranges = 1, > > +}; > > + > > +static const struct regmap_range max31790_volatile_ranges[] = { > > + regmap_reg_range(MAX31790_REG_TACH_COUNT(0), MAX31790_REG_TACH_COUNT(12)), > > + regmap_reg_range(MAX31790_REG_FAN_FAULT_STATUS2, MAX31790_REG_FAN_FAULT_STATUS1), > > +}; > > + > > +static const struct regmap_access_table max31790_volatile_table = { > > + .no_ranges = max31790_volatile_ranges, > > + .n_no_ranges = 2, > > + .n_yes_ranges = 0 > > +}; > > Looks like my reply to this got lost. Other regmap code suggests that > volatile register ranges are identified with yes_ranges, not with no_ranges. > "no" seems to mean "not volatile". Please verify and confirm if the > above code does what you want it to do. > > Thanks, > Guenter