Skip to content

Commit fdd0d6b

Browse files
billy-tsaijic23
authored andcommitted
iio: adc: aspeed: Remove the trim valid dts property.
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 the 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. Fixes: d0a4c17 ("iio: adc: aspeed: Get and set trimming data.") Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com> Link: https://lore.kernel.org/r/20221114025057.10843-1-billy_tsai@aspeedtech.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 4ad09d9 commit fdd0d6b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/iio/adc/aspeed_adc.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ static int aspeed_adc_set_trim_data(struct iio_dev *indio_dev)
202202
((scu_otp) &
203203
(data->model_data->trim_locate->field)) >>
204204
__ffs(data->model_data->trim_locate->field);
205+
if (!trimming_val)
206+
trimming_val = 0x8;
205207
}
206208
dev_dbg(data->dev,
207209
"trimming val = %d, offset = %08x, fields = %08x\n",
@@ -563,12 +565,9 @@ static int aspeed_adc_probe(struct platform_device *pdev)
563565
if (ret)
564566
return ret;
565567

566-
if (of_find_property(data->dev->of_node, "aspeed,trim-data-valid",
567-
NULL)) {
568-
ret = aspeed_adc_set_trim_data(indio_dev);
569-
if (ret)
570-
return ret;
571-
}
568+
ret = aspeed_adc_set_trim_data(indio_dev);
569+
if (ret)
570+
return ret;
572571

573572
if (of_find_property(data->dev->of_node, "aspeed,battery-sensing",
574573
NULL)) {

0 commit comments

Comments
 (0)