Commit a4872f7a authored by Tim Harvey's avatar Tim Harvey Committed by Guenter Roeck

hwmon: (gsc) add 16bit pre-scaled voltage mode

add a 16-bit pre-scaled voltage mode to adc and clarify that existing
pre-scaled mode is 24bit.
Signed-off-by: default avatarTim Harvey <tharvey@gateworks.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/1591714640-10332-3-git-send-email-tharvey@gateworks.comSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent a37881de
...@@ -159,7 +159,7 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, ...@@ -159,7 +159,7 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
sz = (ch->mode == mode_voltage) ? 3 : 2; sz = (ch->mode == mode_voltage_24bit) ? 3 : 2;
ret = regmap_bulk_read(hwmon->regmap, ch->reg, buf, sz); ret = regmap_bulk_read(hwmon->regmap, ch->reg, buf, sz);
if (ret) if (ret)
return ret; return ret;
...@@ -186,7 +186,8 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, ...@@ -186,7 +186,8 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
/* adjust by uV offset */ /* adjust by uV offset */
tmp += ch->mvoffset; tmp += ch->mvoffset;
break; break;
case mode_voltage: case mode_voltage_24bit:
case mode_voltage_16bit:
/* no adjustment needed */ /* no adjustment needed */
break; break;
} }
...@@ -336,7 +337,8 @@ static int gsc_hwmon_probe(struct platform_device *pdev) ...@@ -336,7 +337,8 @@ static int gsc_hwmon_probe(struct platform_device *pdev)
HWMON_T_LABEL; HWMON_T_LABEL;
i_temp++; i_temp++;
break; break;
case mode_voltage: case mode_voltage_24bit:
case mode_voltage_16bit:
case mode_voltage_raw: case mode_voltage_raw:
if (i_in == GSC_HWMON_MAX_IN_CH) { if (i_in == GSC_HWMON_MAX_IN_CH) {
dev_err(gsc->dev, "too many input channels\n"); dev_err(gsc->dev, "too many input channels\n");
......
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
enum gsc_hwmon_mode { enum gsc_hwmon_mode {
mode_temperature, mode_temperature,
mode_voltage, mode_voltage_24bit,
mode_voltage_raw, mode_voltage_raw,
mode_voltage_16bit,
mode_max, mode_max,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment