All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] iio: adc: aspeed: Remove the trim valid dts property.
@ 2022-10-31 11:32 ` Billy Tsai
  0 siblings, 0 replies; 10+ messages in thread
From: Billy Tsai @ 2022-10-31 11:32 UTC (permalink / raw)
  To: jic23, lars, robh+dt, joel, andrew, billy_tsai, colin.king,
	linux-iio, devicetree, linux-arm-kernel, linux-aspeed,
	linux-kernel, BMC-SW

The dts property "aspeed,trim-data-valid" is used to determin whether to
read the OTP register. If the image with the aspeed,trim-data-vali
install to the chip without valid trimming data the adc controller will
become confused. This patch use the default otp value 0 as a criterion
for determining whether trimming data is valid instead of the dts
property. The chip with actually trimming value is 0 should be filter out.

Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
---
 drivers/iio/adc/aspeed_adc.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/adc/aspeed_adc.c b/drivers/iio/adc/aspeed_adc.c
index ffae64f39221..0f065f0bb8e7 100644
--- a/drivers/iio/adc/aspeed_adc.c
+++ b/drivers/iio/adc/aspeed_adc.c
@@ -201,6 +201,8 @@ static int aspeed_adc_set_trim_data(struct iio_dev *indio_dev)
 				((scu_otp) &
 				 (data->model_data->trim_locate->field)) >>
 				__ffs(data->model_data->trim_locate->field);
+			if (!trimming_val)
+				trimming_val = 0x8;
 		}
 		dev_dbg(data->dev,
 			"trimming val = %d, offset = %08x, fields = %08x\n",
@@ -562,12 +564,9 @@ static int aspeed_adc_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	if (of_find_property(data->dev->of_node, "aspeed,trim-data-valid",
-			     NULL)) {
-		ret = aspeed_adc_set_trim_data(indio_dev);
-		if (ret)
-			return ret;
-	}
+	ret = aspeed_adc_set_trim_data(indio_dev);
+	if (ret)
+		return ret;
 
 	if (of_find_property(data->dev->of_node, "aspeed,battery-sensing",
 			     NULL)) {
-- 
2.25.1


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

* [PATCH 1/2] iio: adc: aspeed: Remove the trim valid dts property.
@ 2022-10-31 11:32 ` Billy Tsai
  0 siblings, 0 replies; 10+ messages in thread
From: Billy Tsai @ 2022-10-31 11:32 UTC (permalink / raw)
  To: jic23, lars, robh+dt, joel, andrew, billy_tsai, colin.king,
	linux-iio, devicetree, linux-arm-kernel, linux-aspeed,
	linux-kernel, BMC-SW

The dts property "aspeed,trim-data-valid" is used to determin whether to
read the OTP register. If the image with the aspeed,trim-data-vali
install to the chip without valid trimming data the adc controller will
become confused. This patch use the default otp value 0 as a criterion
for determining whether trimming data is valid instead of the dts
property. The chip with actually trimming value is 0 should be filter out.

Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
---
 drivers/iio/adc/aspeed_adc.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/adc/aspeed_adc.c b/drivers/iio/adc/aspeed_adc.c
index ffae64f39221..0f065f0bb8e7 100644
--- a/drivers/iio/adc/aspeed_adc.c
+++ b/drivers/iio/adc/aspeed_adc.c
@@ -201,6 +201,8 @@ static int aspeed_adc_set_trim_data(struct iio_dev *indio_dev)
 				((scu_otp) &
 				 (data->model_data->trim_locate->field)) >>
 				__ffs(data->model_data->trim_locate->field);
+			if (!trimming_val)
+				trimming_val = 0x8;
 		}
 		dev_dbg(data->dev,
 			"trimming val = %d, offset = %08x, fields = %08x\n",
@@ -562,12 +564,9 @@ static int aspeed_adc_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	if (of_find_property(data->dev->of_node, "aspeed,trim-data-valid",
-			     NULL)) {
-		ret = aspeed_adc_set_trim_data(indio_dev);
-		if (ret)
-			return ret;
-	}
+	ret = aspeed_adc_set_trim_data(indio_dev);
+	if (ret)
+		return ret;
 
 	if (of_find_property(data->dev->of_node, "aspeed,battery-sensing",
 			     NULL)) {
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/2] dt-bindings: iio: adc: Remove the property "aspeed,trim-data-valid"
  2022-10-31 11:32 ` Billy Tsai
@ 2022-10-31 11:32   ` Billy Tsai
  -1 siblings, 0 replies; 10+ messages in thread
From: Billy Tsai @ 2022-10-31 11:32 UTC (permalink / raw)
  To: jic23, lars, robh+dt, joel, andrew, billy_tsai, colin.king,
	linux-iio, devicetree, linux-arm-kernel, linux-aspeed,
	linux-kernel, BMC-SW

The valid of the trimming data will use the otp default value as a
criterion.

Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
---
 .../devicetree/bindings/iio/adc/aspeed,ast2600-adc.yaml    | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/adc/aspeed,ast2600-adc.yaml b/Documentation/devicetree/bindings/iio/adc/aspeed,ast2600-adc.yaml
index b283c8ca2bbf..5c08d8b6e995 100644
--- a/Documentation/devicetree/bindings/iio/adc/aspeed,ast2600-adc.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/aspeed,ast2600-adc.yaml
@@ -62,13 +62,6 @@ properties:
     description:
       Inform the driver that last channel will be used to sensor battery.
 
-  aspeed,trim-data-valid:
-    type: boolean
-    description: |
-      The ADC reference voltage can be calibrated to obtain the trimming
-      data which will be stored in otp. This property informs the driver that
-      the data store in the otp is valid.
-
 required:
   - compatible
   - reg
-- 
2.25.1


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

* [PATCH 2/2] dt-bindings: iio: adc: Remove the property "aspeed,trim-data-valid"
@ 2022-10-31 11:32   ` Billy Tsai
  0 siblings, 0 replies; 10+ messages in thread
From: Billy Tsai @ 2022-10-31 11:32 UTC (permalink / raw)
  To: jic23, lars, robh+dt, joel, andrew, billy_tsai, colin.king,
	linux-iio, devicetree, linux-arm-kernel, linux-aspeed,
	linux-kernel, BMC-SW

The valid of the trimming data will use the otp default value as a
criterion.

Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
---
 .../devicetree/bindings/iio/adc/aspeed,ast2600-adc.yaml    | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/adc/aspeed,ast2600-adc.yaml b/Documentation/devicetree/bindings/iio/adc/aspeed,ast2600-adc.yaml
index b283c8ca2bbf..5c08d8b6e995 100644
--- a/Documentation/devicetree/bindings/iio/adc/aspeed,ast2600-adc.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/aspeed,ast2600-adc.yaml
@@ -62,13 +62,6 @@ properties:
     description:
       Inform the driver that last channel will be used to sensor battery.
 
-  aspeed,trim-data-valid:
-    type: boolean
-    description: |
-      The ADC reference voltage can be calibrated to obtain the trimming
-      data which will be stored in otp. This property informs the driver that
-      the data store in the otp is valid.
-
 required:
   - compatible
   - reg
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/2] dt-bindings: iio: adc: Remove the property "aspeed,trim-data-valid"
  2022-10-31 11:32   ` Billy Tsai
@ 2022-11-02 16:07     ` Rob Herring
  -1 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2022-11-02 16:07 UTC (permalink / raw)
  To: Billy Tsai
  Cc: joel, devicetree, linux-aspeed, linux-arm-kernel, colin.king,
	robh+dt, andrew, linux-kernel, BMC-SW, jic23, lars, linux-iio


On Mon, 31 Oct 2022 19:32:08 +0800, Billy Tsai wrote:
> The valid of the trimming data will use the otp default value as a
> criterion.
> 
> Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
> ---
>  .../devicetree/bindings/iio/adc/aspeed,ast2600-adc.yaml    | 7 -------
>  1 file changed, 7 deletions(-)
> 

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

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

* Re: [PATCH 2/2] dt-bindings: iio: adc: Remove the property "aspeed,trim-data-valid"
@ 2022-11-02 16:07     ` Rob Herring
  0 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2022-11-02 16:07 UTC (permalink / raw)
  To: Billy Tsai
  Cc: joel, devicetree, linux-aspeed, linux-arm-kernel, colin.king,
	robh+dt, andrew, linux-kernel, BMC-SW, jic23, lars, linux-iio


On Mon, 31 Oct 2022 19:32:08 +0800, Billy Tsai wrote:
> The valid of the trimming data will use the otp default value as a
> criterion.
> 
> Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
> ---
>  .../devicetree/bindings/iio/adc/aspeed,ast2600-adc.yaml    | 7 -------
>  1 file changed, 7 deletions(-)
> 

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/2] iio: adc: aspeed: Remove the trim valid dts property.
  2022-10-31 11:32 ` Billy Tsai
@ 2022-11-06 14:49   ` Jonathan Cameron
  -1 siblings, 0 replies; 10+ messages in thread
From: Jonathan Cameron @ 2022-11-06 14:49 UTC (permalink / raw)
  To: Billy Tsai
  Cc: lars, robh+dt, joel, andrew, colin.king, linux-iio, devicetree,
	linux-arm-kernel, linux-aspeed, linux-kernel, BMC-SW

On Mon, 31 Oct 2022 19:32:07 +0800
Billy Tsai <billy_tsai@aspeedtech.com> wrote:

> The dts property "aspeed,trim-data-valid" is used to determin whether to
> read the OTP register. If the image with the aspeed,trim-data-vali
> install to the chip without valid trimming data the adc controller will
> become confused. This patch use the default otp value 0 as a criterion
> for determining whether trimming data is valid instead of the dts
> property. The chip with actually trimming value is 0 should be filter out.

Hi Billy,

I'm not sure I correctly follow the patch description.  Would the following
be an accurate description?

The dts property "aspeed,trim-data-valid" is currently used to determine
whether to read trimming data from the OTP register. If this is set on
a device without valid trimming data in the OTP the ADC will not function
correctly. This patch drops he use of this property and instead uses the
default (unprogrammed) OTP value of 0 to detect when a fallback value of
0x8 should be used rather then the value read from the OTP.

Also, is this a bug fix we need to backport?  If so please provide a fixes
tag.

Thanks,

Jonathan

> 
> Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
> ---
>  drivers/iio/adc/aspeed_adc.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/adc/aspeed_adc.c b/drivers/iio/adc/aspeed_adc.c
> index ffae64f39221..0f065f0bb8e7 100644
> --- a/drivers/iio/adc/aspeed_adc.c
> +++ b/drivers/iio/adc/aspeed_adc.c
> @@ -201,6 +201,8 @@ static int aspeed_adc_set_trim_data(struct iio_dev *indio_dev)
>  				((scu_otp) &
>  				 (data->model_data->trim_locate->field)) >>
>  				__ffs(data->model_data->trim_locate->field);
> +			if (!trimming_val)
> +				trimming_val = 0x8;
>  		}
>  		dev_dbg(data->dev,
>  			"trimming val = %d, offset = %08x, fields = %08x\n",
> @@ -562,12 +564,9 @@ static int aspeed_adc_probe(struct platform_device *pdev)
>  	if (ret)
>  		return ret;
>  
> -	if (of_find_property(data->dev->of_node, "aspeed,trim-data-valid",
> -			     NULL)) {
> -		ret = aspeed_adc_set_trim_data(indio_dev);
> -		if (ret)
> -			return ret;
> -	}
> +	ret = aspeed_adc_set_trim_data(indio_dev);
> +	if (ret)
> +		return ret;
>  
>  	if (of_find_property(data->dev->of_node, "aspeed,battery-sensing",
>  			     NULL)) {


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

* Re: [PATCH 1/2] iio: adc: aspeed: Remove the trim valid dts property.
@ 2022-11-06 14:49   ` Jonathan Cameron
  0 siblings, 0 replies; 10+ messages in thread
From: Jonathan Cameron @ 2022-11-06 14:49 UTC (permalink / raw)
  To: Billy Tsai
  Cc: lars, robh+dt, joel, andrew, colin.king, linux-iio, devicetree,
	linux-arm-kernel, linux-aspeed, linux-kernel, BMC-SW

On Mon, 31 Oct 2022 19:32:07 +0800
Billy Tsai <billy_tsai@aspeedtech.com> wrote:

> The dts property "aspeed,trim-data-valid" is used to determin whether to
> read the OTP register. If the image with the aspeed,trim-data-vali
> install to the chip without valid trimming data the adc controller will
> become confused. This patch use the default otp value 0 as a criterion
> for determining whether trimming data is valid instead of the dts
> property. The chip with actually trimming value is 0 should be filter out.

Hi Billy,

I'm not sure I correctly follow the patch description.  Would the following
be an accurate description?

The dts property "aspeed,trim-data-valid" is currently used to determine
whether to read trimming data from the OTP register. If this is set on
a device without valid trimming data in the OTP the ADC will not function
correctly. This patch drops he use of this property and instead uses the
default (unprogrammed) OTP value of 0 to detect when a fallback value of
0x8 should be used rather then the value read from the OTP.

Also, is this a bug fix we need to backport?  If so please provide a fixes
tag.

Thanks,

Jonathan

> 
> Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
> ---
>  drivers/iio/adc/aspeed_adc.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/adc/aspeed_adc.c b/drivers/iio/adc/aspeed_adc.c
> index ffae64f39221..0f065f0bb8e7 100644
> --- a/drivers/iio/adc/aspeed_adc.c
> +++ b/drivers/iio/adc/aspeed_adc.c
> @@ -201,6 +201,8 @@ static int aspeed_adc_set_trim_data(struct iio_dev *indio_dev)
>  				((scu_otp) &
>  				 (data->model_data->trim_locate->field)) >>
>  				__ffs(data->model_data->trim_locate->field);
> +			if (!trimming_val)
> +				trimming_val = 0x8;
>  		}
>  		dev_dbg(data->dev,
>  			"trimming val = %d, offset = %08x, fields = %08x\n",
> @@ -562,12 +564,9 @@ static int aspeed_adc_probe(struct platform_device *pdev)
>  	if (ret)
>  		return ret;
>  
> -	if (of_find_property(data->dev->of_node, "aspeed,trim-data-valid",
> -			     NULL)) {
> -		ret = aspeed_adc_set_trim_data(indio_dev);
> -		if (ret)
> -			return ret;
> -	}
> +	ret = aspeed_adc_set_trim_data(indio_dev);
> +	if (ret)
> +		return ret;
>  
>  	if (of_find_property(data->dev->of_node, "aspeed,battery-sensing",
>  			     NULL)) {


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/2] iio: adc: aspeed: Remove the trim valid dts property.
  2022-11-06 14:49   ` Jonathan Cameron
@ 2022-11-07  2:34     ` Billy Tsai
  -1 siblings, 0 replies; 10+ messages in thread
From: Billy Tsai @ 2022-11-07  2:34 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: lars, robh+dt, joel, andrew, colin.king, linux-iio, devicetree,
	linux-arm-kernel, linux-aspeed, linux-kernel, BMC-SW

On 2022/11/6, 10:50 PM, "Jonathan Cameron" <jic23@kernel.org> wrote:

    On Mon, 31 Oct 2022 19:32:07 +0800
    Billy Tsai <billy_tsai@aspeedtech.com> wrote:

    > > The dts property "aspeed,trim-data-valid" is used to determin whether to
    > > read the OTP register. If the image with the aspeed,trim-data-vali
    > > install to the chip without valid trimming data the adc controller will
    > > become confused. This patch use the default otp value 0 as a criterion
    > > for determining whether trimming data is valid instead of the dts
    > > property. The chip with actually trimming value is 0 should be filter out.

    > Hi Billy,

    > I'm not sure I correctly follow the patch description.  Would the following
    > be an accurate description?

    > The dts property "aspeed,trim-data-valid" is currently used to determine
    > whether to read trimming data from the OTP register. If this is set on
    > a device without valid trimming data in the OTP the ADC will not function
    > correctly. This patch drops he use of this property and instead uses the
    > default (unprogrammed) OTP value of 0 to detect when a fallback value of
    > 0x8 should be used rather then the value read from the OTP.
Hi Jonathan,

Yes, it's correct.

    > Also, is this a bug fix we need to backport?  If so please provide a fixes
    > tag.

I will provide the fixes tag in next version of patch.

Thanks

Best Regards,
Billy Tsai


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

* Re: [PATCH 1/2] iio: adc: aspeed: Remove the trim valid dts property.
@ 2022-11-07  2:34     ` Billy Tsai
  0 siblings, 0 replies; 10+ messages in thread
From: Billy Tsai @ 2022-11-07  2:34 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: lars, robh+dt, joel, andrew, colin.king, linux-iio, devicetree,
	linux-arm-kernel, linux-aspeed, linux-kernel, BMC-SW

On 2022/11/6, 10:50 PM, "Jonathan Cameron" <jic23@kernel.org> wrote:

    On Mon, 31 Oct 2022 19:32:07 +0800
    Billy Tsai <billy_tsai@aspeedtech.com> wrote:

    > > The dts property "aspeed,trim-data-valid" is used to determin whether to
    > > read the OTP register. If the image with the aspeed,trim-data-vali
    > > install to the chip without valid trimming data the adc controller will
    > > become confused. This patch use the default otp value 0 as a criterion
    > > for determining whether trimming data is valid instead of the dts
    > > property. The chip with actually trimming value is 0 should be filter out.

    > Hi Billy,

    > I'm not sure I correctly follow the patch description.  Would the following
    > be an accurate description?

    > The dts property "aspeed,trim-data-valid" is currently used to determine
    > whether to read trimming data from the OTP register. If this is set on
    > a device without valid trimming data in the OTP the ADC will not function
    > correctly. This patch drops he use of this property and instead uses the
    > default (unprogrammed) OTP value of 0 to detect when a fallback value of
    > 0x8 should be used rather then the value read from the OTP.
Hi Jonathan,

Yes, it's correct.

    > Also, is this a bug fix we need to backport?  If so please provide a fixes
    > tag.

I will provide the fixes tag in next version of patch.

Thanks

Best Regards,
Billy Tsai

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-11-07 12:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-31 11:32 [PATCH 1/2] iio: adc: aspeed: Remove the trim valid dts property Billy Tsai
2022-10-31 11:32 ` Billy Tsai
2022-10-31 11:32 ` [PATCH 2/2] dt-bindings: iio: adc: Remove the property "aspeed,trim-data-valid" Billy Tsai
2022-10-31 11:32   ` Billy Tsai
2022-11-02 16:07   ` Rob Herring
2022-11-02 16:07     ` Rob Herring
2022-11-06 14:49 ` [PATCH 1/2] iio: adc: aspeed: Remove the trim valid dts property Jonathan Cameron
2022-11-06 14:49   ` Jonathan Cameron
2022-11-07  2:34   ` Billy Tsai
2022-11-07  2:34     ` Billy Tsai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.