diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-10-13 10:15:31 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-10-13 10:15:31 -0700 |
commit | c4439713e82a0d746e533ae5ddd7dfa832e2a486 (patch) | |
tree | af1590a67536a4af13b4a94bb672ca98313870e0 /drivers/hwmon/gsc-hwmon.c | |
parent | 0486beaf88d2460e9dbcbba281dab683a838f0c6 (diff) | |
parent | 9b20aec24b8ab2860ea41182ba554dfcc444c0c8 (diff) |
Merge tag 'hwmon-for-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon updates from Guenter Roeck:
"New driver and chip support:
- Moortec MR75203 PVT controller
- MPS Multi-phase mp2975 controller
- ADM1266
- Zen3 CPUs
- Intel MAX 10 BMC
Enhancements:
- Support for rated attributes in hwmon core
- MAX20730:
- Device monitoring via debugfs
- VOUT readin adjustment vie devicetree bindings
- LM75:
- Devicetree support
- Regulator support
- Improved accumulationm logic in amd_energy driver
- Added fan sensor to gsc-hwmon driver
- Support for simplified I2C probing
Various other minor fixes and improvements"
* tag 'hwmon-for-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (64 commits)
hwmon: (pmbus/max20730) adjust the vout reading given voltage divider
dt-bindings: hwmon: max20730: adding device tree doc for max20730
hwmon: Add hardware monitoring driver for Moortec MR75203 PVT controller
hwmon: Add DT bindings schema for PVT controller
dt-bindings: hwmon: Add the +vs supply to the lm75 bindings
dt-bindings: hwmon: Convert lm75 bindings to yaml
docs: hwmon: (ltc2945) update datasheet link
hwmon: (mlxreg-fan) Fix double "Mellanox"
hwmon: (pmbus/max20730) add device monitoring via debugfs
hwmon: (pmbus/max34440) Fix OC fault limits
hwmon: (bt1-pvt) Wait for the completion with timeout
hwmon: (bt1-pvt) Cache current update timeout
hwmon: (bt1-pvt) Test sensor power supply on probe
hwmon: (lm75) Add regulator support
hwmon: Add hwmon driver for Intel MAX 10 BMC
dt-bindings: Add MP2975 voltage regulator device
hwmon: (pmbus) Add support for MPS Multi-phase mp2975 controller
hwmon: (tmp513) fix spelling typo in comments
hwmon: (amd_energy) Update driver documentation
hwmon: (amd_energy) Improve the accumulation logic
...
Diffstat (limited to 'drivers/hwmon/gsc-hwmon.c')
-rw-r--r-- | drivers/hwmon/gsc-hwmon.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/drivers/hwmon/gsc-hwmon.c b/drivers/hwmon/gsc-hwmon.c index c6d4567f3952..1fe37418ff46 100644 --- a/drivers/hwmon/gsc-hwmon.c +++ b/drivers/hwmon/gsc-hwmon.c @@ -17,6 +17,7 @@ #define GSC_HWMON_MAX_TEMP_CH 16 #define GSC_HWMON_MAX_IN_CH 16 +#define GSC_HWMON_MAX_FAN_CH 16 #define GSC_HWMON_RESOLUTION 12 #define GSC_HWMON_VREF 2500 @@ -27,11 +28,14 @@ struct gsc_hwmon_data { struct regmap *regmap; const struct gsc_hwmon_channel *temp_ch[GSC_HWMON_MAX_TEMP_CH]; const struct gsc_hwmon_channel *in_ch[GSC_HWMON_MAX_IN_CH]; + const struct gsc_hwmon_channel *fan_ch[GSC_HWMON_MAX_FAN_CH]; u32 temp_config[GSC_HWMON_MAX_TEMP_CH + 1]; u32 in_config[GSC_HWMON_MAX_IN_CH + 1]; + u32 fan_config[GSC_HWMON_MAX_FAN_CH + 1]; struct hwmon_channel_info temp_info; struct hwmon_channel_info in_info; - const struct hwmon_channel_info *info[3]; + struct hwmon_channel_info fan_info; + const struct hwmon_channel_info *info[4]; struct hwmon_chip_info chip; }; @@ -155,6 +159,9 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, case hwmon_temp: ch = hwmon->temp_ch[channel]; break; + case hwmon_fan: + ch = hwmon->fan_ch[channel]; + break; default: return -EOPNOTSUPP; } @@ -187,6 +194,9 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, /* adjust by uV offset */ tmp += ch->mvoffset; break; + case mode_fan: + tmp *= 30; /* convert to revolutions per minute */ + break; case mode_voltage_24bit: case mode_voltage_16bit: /* no adjustment needed */ @@ -211,6 +221,9 @@ gsc_hwmon_read_string(struct device *dev, enum hwmon_sensor_types type, case hwmon_temp: *buf = hwmon->temp_ch[channel]->name; break; + case hwmon_fan: + *buf = hwmon->fan_ch[channel]->name; + break; default: return -ENOTSUPP; } @@ -304,7 +317,7 @@ static int gsc_hwmon_probe(struct platform_device *pdev) struct gsc_hwmon_platform_data *pdata = dev_get_platdata(dev); struct gsc_hwmon_data *hwmon; const struct attribute_group **groups; - int i, i_in, i_temp; + int i, i_in, i_temp, i_fan; if (!pdata) { pdata = gsc_hwmon_get_devtree_pdata(dev); @@ -324,7 +337,7 @@ static int gsc_hwmon_probe(struct platform_device *pdev) if (IS_ERR(hwmon->regmap)) return PTR_ERR(hwmon->regmap); - for (i = 0, i_in = 0, i_temp = 0; i < hwmon->pdata->nchannels; i++) { + for (i = 0, i_in = 0, i_temp = 0, i_fan = 0; i < hwmon->pdata->nchannels; i++) { const struct gsc_hwmon_channel *ch = &pdata->channels[i]; switch (ch->mode) { @@ -338,6 +351,16 @@ static int gsc_hwmon_probe(struct platform_device *pdev) HWMON_T_LABEL; i_temp++; break; + case mode_fan: + if (i_fan == GSC_HWMON_MAX_FAN_CH) { + dev_err(gsc->dev, "too many fan channels\n"); + return -EINVAL; + } + hwmon->fan_ch[i_fan] = ch; + hwmon->fan_config[i_fan] = HWMON_F_INPUT | + HWMON_F_LABEL; + i_fan++; + break; case mode_voltage_24bit: case mode_voltage_16bit: case mode_voltage_raw: @@ -361,10 +384,13 @@ static int gsc_hwmon_probe(struct platform_device *pdev) hwmon->chip.info = hwmon->info; hwmon->info[0] = &hwmon->temp_info; hwmon->info[1] = &hwmon->in_info; + hwmon->info[2] = &hwmon->fan_info; hwmon->temp_info.type = hwmon_temp; hwmon->temp_info.config = hwmon->temp_config; hwmon->in_info.type = hwmon_in; hwmon->in_info.config = hwmon->in_config; + hwmon->fan_info.type = hwmon_fan; + hwmon->fan_info.config = hwmon->fan_config; groups = pdata->fan_base ? gsc_hwmon_groups : NULL; hwmon_dev = devm_hwmon_device_register_with_info(dev, |