Linux-Hwmon Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/2] add 16bit pre-scaled adc mode to Gateworks GSC hwmon
@ 2020-06-09 14:57 Tim Harvey
  2020-06-09 14:57 ` [PATCH 1/2] dt-bindings: mfd: gateworks-gsc: add 16bit pre-scaled voltage mode Tim Harvey
  2020-06-09 14:57 ` [PATCH 2/2] hwmon: (gsc): " Tim Harvey
  0 siblings, 2 replies; 7+ messages in thread
From: Tim Harvey @ 2020-06-09 14:57 UTC (permalink / raw)
  To: Rob Herring, Jean Delvare, Guenter Roeck
  Cc: Lee Jones, Robert Jones, devicetree, linux-kernel, linux-hwmon,
	Tim Harvey

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(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] dt-bindings: mfd: gateworks-gsc: add 16bit pre-scaled voltage mode
  2020-06-09 14:57 [PATCH 0/2] add 16bit pre-scaled adc mode to Gateworks GSC hwmon Tim Harvey
@ 2020-06-09 14:57 ` Tim Harvey
  2020-06-17 21:47   ` Rob Herring
  2020-06-18  7:39   ` Lee Jones
  2020-06-09 14:57 ` [PATCH 2/2] hwmon: (gsc): " Tim Harvey
  1 sibling, 2 replies; 7+ messages in thread
From: Tim Harvey @ 2020-06-09 14:57 UTC (permalink / raw)
  To: Rob Herring, Jean Delvare, Guenter Roeck
  Cc: Lee Jones, Robert Jones, devicetree, linux-kernel, linux-hwmon,
	Tim Harvey

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

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml b/Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml
index 487a844..ceec33f 100644
--- a/Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml
+++ b/Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml
@@ -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
-- 
2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2] hwmon: (gsc): add 16bit pre-scaled voltage mode
  2020-06-09 14:57 [PATCH 0/2] add 16bit pre-scaled adc mode to Gateworks GSC hwmon Tim Harvey
  2020-06-09 14:57 ` [PATCH 1/2] dt-bindings: mfd: gateworks-gsc: add 16bit pre-scaled voltage mode Tim Harvey
@ 2020-06-09 14:57 ` Tim Harvey
  2020-06-11 13:47   ` Guenter Roeck
  2020-06-23 14:09   ` Guenter Roeck
  1 sibling, 2 replies; 7+ messages in thread
From: Tim Harvey @ 2020-06-09 14:57 UTC (permalink / raw)
  To: Rob Herring, Jean Delvare, Guenter Roeck
  Cc: Lee Jones, Robert Jones, devicetree, linux-kernel, linux-hwmon,
	Tim Harvey

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

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 drivers/hwmon/gsc-hwmon.c               | 8 +++++---
 include/linux/platform_data/gsc_hwmon.h | 3 ++-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/hwmon/gsc-hwmon.c b/drivers/hwmon/gsc-hwmon.c
index 2137bc6..3dfe2ca 100644
--- a/drivers/hwmon/gsc-hwmon.c
+++ b/drivers/hwmon/gsc-hwmon.c
@@ -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");
diff --git a/include/linux/platform_data/gsc_hwmon.h b/include/linux/platform_data/gsc_hwmon.h
index ec1611a..37a8f554d 100644
--- a/include/linux/platform_data/gsc_hwmon.h
+++ b/include/linux/platform_data/gsc_hwmon.h
@@ -4,8 +4,9 @@
 
 enum gsc_hwmon_mode {
 	mode_temperature,
-	mode_voltage,
+	mode_voltage_24bit,
 	mode_voltage_raw,
+	mode_voltage_16bit,
 	mode_max,
 };
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] hwmon: (gsc): add 16bit pre-scaled voltage mode
  2020-06-09 14:57 ` [PATCH 2/2] hwmon: (gsc): " Tim Harvey
@ 2020-06-11 13:47   ` Guenter Roeck
  2020-06-23 14:09   ` Guenter Roeck
  1 sibling, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2020-06-11 13:47 UTC (permalink / raw)
  To: Tim Harvey, Rob Herring, Jean Delvare
  Cc: Lee Jones, Robert Jones, devicetree, linux-kernel, linux-hwmon

On 6/9/20 7:57 AM, Tim Harvey wrote:
> add a 16-bit pre-scaled voltage mode to adc and clarify that existing
> pre-scaled mode is 24bit.
> 
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>

For my reference:

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

We'll have to wait for DT approval.

Guenter

> ---
>  drivers/hwmon/gsc-hwmon.c               | 8 +++++---
>  include/linux/platform_data/gsc_hwmon.h | 3 ++-
>  2 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hwmon/gsc-hwmon.c b/drivers/hwmon/gsc-hwmon.c
> index 2137bc6..3dfe2ca 100644
> --- a/drivers/hwmon/gsc-hwmon.c
> +++ b/drivers/hwmon/gsc-hwmon.c
> @@ -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");
> diff --git a/include/linux/platform_data/gsc_hwmon.h b/include/linux/platform_data/gsc_hwmon.h
> index ec1611a..37a8f554d 100644
> --- a/include/linux/platform_data/gsc_hwmon.h
> +++ b/include/linux/platform_data/gsc_hwmon.h
> @@ -4,8 +4,9 @@
>  
>  enum gsc_hwmon_mode {
>  	mode_temperature,
> -	mode_voltage,
> +	mode_voltage_24bit,
>  	mode_voltage_raw,
> +	mode_voltage_16bit,
>  	mode_max,
>  };
>  
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] dt-bindings: mfd: gateworks-gsc: add 16bit pre-scaled voltage mode
  2020-06-09 14:57 ` [PATCH 1/2] dt-bindings: mfd: gateworks-gsc: add 16bit pre-scaled voltage mode Tim Harvey
@ 2020-06-17 21:47   ` Rob Herring
  2020-06-18  7:39   ` Lee Jones
  1 sibling, 0 replies; 7+ messages in thread
From: Rob Herring @ 2020-06-17 21:47 UTC (permalink / raw)
  To: Tim Harvey
  Cc: devicetree, linux-kernel, Robert Jones, Rob Herring, Lee Jones,
	linux-hwmon, Jean Delvare, Guenter Roeck

On Tue, 09 Jun 2020 07:57:19 -0700, Tim Harvey wrote:
> add a 16-bit pre-scaled voltage mode to adc and clarify that existing
> pre-scaled mode is 24bit.
> 
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
>  Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] dt-bindings: mfd: gateworks-gsc: add 16bit pre-scaled voltage mode
  2020-06-09 14:57 ` [PATCH 1/2] dt-bindings: mfd: gateworks-gsc: add 16bit pre-scaled voltage mode Tim Harvey
  2020-06-17 21:47   ` Rob Herring
@ 2020-06-18  7:39   ` Lee Jones
  1 sibling, 0 replies; 7+ messages in thread
From: Lee Jones @ 2020-06-18  7:39 UTC (permalink / raw)
  To: Tim Harvey
  Cc: Rob Herring, Jean Delvare, Guenter Roeck, Robert Jones,
	devicetree, linux-kernel, linux-hwmon

On Tue, 09 Jun 2020, Tim Harvey wrote:

> add a 16-bit pre-scaled voltage mode to adc and clarify that existing
> pre-scaled mode is 24bit.
> 
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
>  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.

> diff --git a/Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml b/Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml
> index 487a844..ceec33f 100644
> --- a/Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml
> +++ b/Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml
> @@ -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

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] hwmon: (gsc): add 16bit pre-scaled voltage mode
  2020-06-09 14:57 ` [PATCH 2/2] hwmon: (gsc): " Tim Harvey
  2020-06-11 13:47   ` Guenter Roeck
@ 2020-06-23 14:09   ` Guenter Roeck
  1 sibling, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2020-06-23 14:09 UTC (permalink / raw)
  To: Tim Harvey
  Cc: Rob Herring, Jean Delvare, Lee Jones, Robert Jones, devicetree,
	linux-kernel, linux-hwmon

On Tue, Jun 09, 2020 at 07:57:20AM -0700, Tim Harvey wrote:
> add a 16-bit pre-scaled voltage mode to adc and clarify that existing
> pre-scaled mode is 24bit.
> 
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/gsc-hwmon.c               | 8 +++++---
>  include/linux/platform_data/gsc_hwmon.h | 3 ++-
>  2 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hwmon/gsc-hwmon.c b/drivers/hwmon/gsc-hwmon.c
> index 2137bc6..3dfe2ca 100644
> --- a/drivers/hwmon/gsc-hwmon.c
> +++ b/drivers/hwmon/gsc-hwmon.c
> @@ -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");
> diff --git a/include/linux/platform_data/gsc_hwmon.h b/include/linux/platform_data/gsc_hwmon.h
> index ec1611a..37a8f554d 100644
> --- a/include/linux/platform_data/gsc_hwmon.h
> +++ b/include/linux/platform_data/gsc_hwmon.h
> @@ -4,8 +4,9 @@
>  
>  enum gsc_hwmon_mode {
>  	mode_temperature,
> -	mode_voltage,
> +	mode_voltage_24bit,
>  	mode_voltage_raw,
> +	mode_voltage_16bit,
>  	mode_max,
>  };
>  

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09 14:57 [PATCH 0/2] add 16bit pre-scaled adc mode to Gateworks GSC hwmon Tim Harvey
2020-06-09 14:57 ` [PATCH 1/2] dt-bindings: mfd: gateworks-gsc: add 16bit pre-scaled voltage mode Tim Harvey
2020-06-17 21:47   ` Rob Herring
2020-06-18  7:39   ` Lee Jones
2020-06-09 14:57 ` [PATCH 2/2] hwmon: (gsc): " Tim Harvey
2020-06-11 13:47   ` Guenter Roeck
2020-06-23 14:09   ` Guenter Roeck

Linux-Hwmon Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-hwmon/0 linux-hwmon/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hwmon linux-hwmon/ https://lore.kernel.org/linux-hwmon \
		linux-hwmon@vger.kernel.org
	public-inbox-index linux-hwmon

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-hwmon


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git