Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1456093rwb; Mon, 7 Nov 2022 01:42:06 -0800 (PST) X-Google-Smtp-Source: AMsMyM5uki2a7WgVLVrocuDBnJZSNi9AIPv3AhlLLPU64uKK9+4/QR1xZoKdhV7AQgywg4Uk+HWC X-Received: by 2002:a17:906:68c5:b0:7ae:2b65:4697 with SMTP id y5-20020a17090668c500b007ae2b654697mr17419033ejr.622.1667814126115; Mon, 07 Nov 2022 01:42:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667814126; cv=none; d=google.com; s=arc-20160816; b=fvbzqATrztnNr7+BlkPdVVViE6hTKDjEkAZq0QiFzvicHVGe9CExuPTvj0+CqsGUdy n0QOdxqzxqP5IkYCvUhb/UFLDC3lMRGLz5k08eLxTCP5pZltbs6DYskFO4Vx9onoTU2R Fuyi8fwGgotIErFRy2GqZ1sRv8PbOHydW7nuAsZadqkgC8t6aDdsPWYl6A0Bb6AUfEb5 i9VS4QAgfnjVMwvVezbRp9DeEicuF9t66wVhp2xqW6feVSy35EOj5DERPYWzTRNmc45f jG0uTNVPNaFNZAxsMpvcLSwEM8Bw8qimslrKLOQYJRE/Dg67u+m9cq5cwECPKogAdXs9 oBYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=xowJH2WBdr3VQKrjfNeSPsv+Fx5T0qRYck2Ox+SsO4w=; b=HIn6UH9hkHVfi+slaIvfbIp/Hfm0XObdkadt0Rk5EbOLzBoSh0T8nEq1VSKjNwNUFF tSDw3V6pZSTDTS7+Fx/qOSaQylaByGRHdQyFgTtvD7zZUd8l3LQiBD2oI1ZMHbn9pfhe FkHZAsLE6q1IbmkZmWbdqQRgtidkZVLBlQOdP5xfZsoh8apYHbueH2OxL9yaEtDtlbvr mkVnkBydCVCNpDVTjojXW0QL+6ar7BGf+3S0ueubie5hX0+V4t4sLiyB4vYVi3kpvTfA 6NrM/Rtri31Lrg5PuB9njFhPt1eSwGhO5KWPJI3YTBeq3CTEZFz/h2MKkksEOKdfUbm1 s/EQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd16-20020a1709069b9000b0073d8e26e78bsi559382ejc.960.2022.11.07.01.41.43; Mon, 07 Nov 2022 01:42:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231705AbiKGJPs (ORCPT + 95 others); Mon, 7 Nov 2022 04:15:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231703AbiKGJPi (ORCPT ); Mon, 7 Nov 2022 04:15:38 -0500 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2154E15827; Mon, 7 Nov 2022 01:15:37 -0800 (PST) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 2A78nWxo095132; Mon, 7 Nov 2022 16:49:32 +0800 (GMT-8) (envelope-from billy_tsai@aspeedtech.com) Received: from BillyTsai-pc.aspeed.com (192.168.2.149) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 7 Nov 2022 17:13:02 +0800 From: Billy Tsai To: , , , , , , , , , , , , Subject: [v2 1/2] iio: adc: aspeed: Remove the trim valid dts property. Date: Mon, 7 Nov 2022 17:15:05 +0800 Message-ID: <20221107091506.28630-1-billy_tsai@aspeedtech.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [192.168.2.149] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 2A78nWxo095132 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: d0a4c17b4073 ("iio: adc: aspeed: Get and set trimming data.") Signed-off-by: Billy Tsai --- 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 9341e0e0eb55..998e8bcc06e1 100644 --- a/drivers/iio/adc/aspeed_adc.c +++ b/drivers/iio/adc/aspeed_adc.c @@ -202,6 +202,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", @@ -563,12 +565,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