From patchwork Mon Nov 7 09:15:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Billy Tsai X-Patchwork-Id: 13034304 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7649AC433FE for ; Mon, 7 Nov 2022 12:29:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=rydTmy4wm1qA6+542Itq4m0TMM9DbKRiBiMPwsW1S3g=; b=oWsbjpbHLl92/j UfADte/D0TCrREZAoJ1YRuEpS2mXRKgulVtdipAyoZQ1rqI3tnbZKBS5/oEJ47abXQP4V0KjDMyH7 LU4DVat+3UyKn2rE3MTmQhZydmBEJvEZUNjySbW8pwlZ8dTQ+OA9sV/SWtOfMoGhFkB63bMz8C5pm QTDLtCV2R1TUwu95NahOWaet2vMP5jbB3Oj2r9cHjyOSAfxgP54SIzMUKC9zLkzFm/7oaRlSIn7zD i2LzJ3NiieQ3zYzmFtgDRzDzzL+tXS60+8PaYsZJm/2g2pDSYx2D/b/WigJVF0wOIacSDNF/pJY8t JAeLqZuc+0l3rKgNk1Hw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1os1Eb-00ESo0-DW; Mon, 07 Nov 2022 12:28:13 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1os1EW-00ESmB-LP for linux-arm-kernel@bombadil.infradead.org; Mon, 07 Nov 2022 12:28:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-ID: Content-Description:In-Reply-To:References; bh=xowJH2WBdr3VQKrjfNeSPsv+Fx5T0qRYck2Ox+SsO4w=; b=RZGOOPrexlVt/GnqP+t3jDxHra eseHi2fWEsz4/D1Ur1HGAXfw23RTVjx9bCnS6euIwtNYHaU7wdWqSKN64zoDfQC5e98Ke0YnMykUC 7ih1kvFk1QD/11zh8vKb//il2b0Eplw2eTkOQe1//oYfROi3NmdahBBT9L3I+BgprvrweTnsosTn3 7OXACN0sqtcsi7/+sqPliRWJTrv96UAS1uKSwpHBY3h2cpCUJ8O/WuqnWu1xWTe/g0+/b8Xc9amwY De7If3UUK5OdpDnhEmGtFIOwdPI+vBWuK7OKN2GGBfvYwNEHhVSAVvuPjoSbiknQv3F7dXkQThWQz tt+kDtwQ==; Received: from twspam01.aspeedtech.com ([211.20.114.71]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1orzM8-009iiQ-PT for linux-arm-kernel@lists.infradead.org; Mon, 07 Nov 2022 10:27:56 +0000 Received: from twspam01.aspeedtech.com (localhost [127.0.0.2] (may be forged)) by twspam01.aspeedtech.com with ESMTP id 2A78pD9G095429 for ; Mon, 7 Nov 2022 16:51:13 +0800 (GMT-8) (envelope-from billy_tsai@aspeedtech.com) 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221107_102753_754914_1752A92F X-CRM114-Status: GOOD ( 14.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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)) {