Skip to contentSkip to conversation

add 16bit pre-scaled adc mode to Gateworks GSC hwmon

PATCH Applied Tim Harvey 4 participants 7 messages Jun 9, 2020 – Jun 23, 2020

Subsystems (4)
lore
Share & tools
lore

Tim Harvey

author maintainer
#0 lore raw

cover add 16bit pre-scaled adc mode to Gateworks GSC hwmon

The Gateworks GSC hwmon driver supports multiple modes of ADC's. Add a mode for 16-bit pre-scaled values and clarify that the existing pre-scale mode is 24-bit.

Tim Harvey (2):
dt-bindings: mfd: gateworks-gsc: add 16bit pre-scaled voltage mode
hwmon: (gsc): add 16bit pre-scaled voltage mode

 Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml | 5 +++--
 drivers/hwmon/gsc-hwmon.c                                | 8 +++++---
 include/linux/platform_data/gsc_hwmon.h                  | 3 ++-
 3 files changed, 10 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH 1/2 dt-bindings: mfd: gateworks-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.

---
 Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml +3 -2
index 487a844..ceec33f 100644
@@ -79,11 +79,12 @@ properties:
             description: |
               conversion mode:
                 0 - temperature, in C*10
-                1 - pre-scaled voltage value
+                1 - pre-scaled 24-bit voltage value
                 2 - scaled voltage based on an optional resistor divider
                     and optional offset
+                3 - pre-scaled 16-bit voltage value
             $ref: /schemas/types.yaml#/definitions/uint32
-            enum: [0, 1, 2]
+            enum: [0, 1, 2, 3]
 
           gw,voltage-divider-ohms:
             description: Values of resistors for divider on raw ADC input
Signature · 1 line
2.7.4
maintainer Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] dt-bindings: mfd: gateworks-gsc: add 16bit pre-scaled voltage mode

Quoted 8 lines · Tim Harvey

add a 16-bit pre-scaled voltage mode to adc and clarify that existing pre-scaled mode is 24bit.

---
 Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
#3 lore raw

Re: [PATCH 1/2] dt-bindings: mfd: gateworks-gsc: add 16bit pre-scaled voltage mode

In reply to Tim Harvey
Quoted 7 lines · Tim Harvey

add a 16-bit pre-scaled voltage mode to adc and clarify that existing pre-scaled mode is 24bit.

---
 Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Fixed the grammar in the subject and commit message.

Patch applied, thanks.

Quoted 19 lines
Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml +3 -2
index 487a844..ceec33f 100644
@@ -79,11 +79,12 @@ properties:
             description: |
               conversion mode:
                 0 - temperature, in C*10
-                1 - pre-scaled voltage value
+                1 - pre-scaled 24-bit voltage value
                 2 - scaled voltage based on an optional resistor divider
                     and optional offset
+                3 - pre-scaled 16-bit voltage value
             $ref: /schemas/types.yaml#/definitions/uint32
-            enum: [0, 1, 2]
+            enum: [0, 1, 2, 3]
 
           gw,voltage-divider-ohms:
             description: Values of resistors for divider on raw ADC input
Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#4 lore raw

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

In reply to Tim Harvey

add a 16-bit pre-scaled voltage mode to adc and clarify that existing pre-scaled mode is 24bit.

---
 drivers/hwmon/gsc-hwmon.c               | 8 +++++---
 include/linux/platform_data/gsc_hwmon.h | 3 ++-
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/hwmon/gsc-hwmon.c +5 -3
index 2137bc6..3dfe2ca 100644
@@ -159,7 +159,7 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
 		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);
 	if (ret)
 		return ret;
@@ -186,7 +186,8 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
 		/* adjust by uV offset */
 		tmp += ch->mvoffset;
 		break;
-	case mode_voltage:
+	case mode_voltage_24bit:
+	case mode_voltage_16bit:
 		/* no adjustment needed */
 		break;
 	}
@@ -336,7 +337,8 @@ static int gsc_hwmon_probe(struct platform_device *pdev)
 						     HWMON_T_LABEL;
 			i_temp++;
 			break;
-		case mode_voltage:
+		case mode_voltage_24bit:
+		case mode_voltage_16bit:
 		case mode_voltage_raw:
 			if (i_in == GSC_HWMON_MAX_IN_CH) {
 				dev_err(gsc->dev, "too many input channels\n");
include/linux/platform_data/gsc_hwmon.h +2 -1
index ec1611a..37a8f554d 100644
@@ -4,8 +4,9 @@
 
 enum gsc_hwmon_mode {
 	mode_temperature,
-	mode_voltage,
+	mode_voltage_24bit,
 	mode_voltage_raw,
+	mode_voltage_16bit,
 	mode_max,
 };
 
Signature · 1 line
2.7.4
maintainer Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] hwmon: (gsc): add 16bit pre-scaled voltage mode

Quoted 4 lines · Tim Harvey

add a 16-bit pre-scaled voltage mode to adc and clarify that existing pre-scaled mode is 24bit.

For my reference:

We'll have to wait for DT approval.

Guenter

Quoted 54 lines
---
 drivers/hwmon/gsc-hwmon.c               | 8 +++++---
 include/linux/platform_data/gsc_hwmon.h | 3 ++-
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/hwmon/gsc-hwmon.c +5 -3
index 2137bc6..3dfe2ca 100644
@@ -159,7 +159,7 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
 		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);
 	if (ret)
 		return ret;
@@ -186,7 +186,8 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
 		/* adjust by uV offset */
 		tmp += ch->mvoffset;
 		break;
-	case mode_voltage:
+	case mode_voltage_24bit:
+	case mode_voltage_16bit:
 		/* no adjustment needed */
 		break;
 	}
@@ -336,7 +337,8 @@ static int gsc_hwmon_probe(struct platform_device *pdev)
 						     HWMON_T_LABEL;
 			i_temp++;
 			break;
-		case mode_voltage:
+		case mode_voltage_24bit:
+		case mode_voltage_16bit:
 		case mode_voltage_raw:
 			if (i_in == GSC_HWMON_MAX_IN_CH) {
 				dev_err(gsc->dev, "too many input channels\n");
include/linux/platform_data/gsc_hwmon.h +2 -1
index ec1611a..37a8f554d 100644
@@ -4,8 +4,9 @@
 
 enum gsc_hwmon_mode {
 	mode_temperature,
-	mode_voltage,
+	mode_voltage_24bit,
 	mode_voltage_raw,
+	mode_voltage_16bit,
 	mode_max,
 };
 
maintainer Applied
#6 lore raw

Re: [PATCH 2/2] hwmon: (gsc): add 16bit pre-scaled voltage mode

In reply to Tim Harvey
Quoted 5 lines · Tim Harvey

add a 16-bit pre-scaled voltage mode to adc and clarify that existing pre-scaled mode is 24bit.

Applied.

Thanks,
Guenter

Quoted 53 lines
---
 drivers/hwmon/gsc-hwmon.c               | 8 +++++---
 include/linux/platform_data/gsc_hwmon.h | 3 ++-
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/hwmon/gsc-hwmon.c +5 -3
index 2137bc6..3dfe2ca 100644
@@ -159,7 +159,7 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
 		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);
 	if (ret)
 		return ret;
@@ -186,7 +186,8 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
 		/* adjust by uV offset */
 		tmp += ch->mvoffset;
 		break;
-	case mode_voltage:
+	case mode_voltage_24bit:
+	case mode_voltage_16bit:
 		/* no adjustment needed */
 		break;
 	}
@@ -336,7 +337,8 @@ static int gsc_hwmon_probe(struct platform_device *pdev)
 						     HWMON_T_LABEL;
 			i_temp++;
 			break;
-		case mode_voltage:
+		case mode_voltage_24bit:
+		case mode_voltage_16bit:
 		case mode_voltage_raw:
 			if (i_in == GSC_HWMON_MAX_IN_CH) {
 				dev_err(gsc->dev, "too many input channels\n");
include/linux/platform_data/gsc_hwmon.h +2 -1
index ec1611a..37a8f554d 100644
@@ -4,8 +4,9 @@
 
 enum gsc_hwmon_mode {
 	mode_temperature,
-	mode_voltage,
+	mode_voltage_24bit,
 	mode_voltage_raw,
+	mode_voltage_16bit,
 	mode_max,
 };