From patchwork Mon Oct 31 11:32:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Billy Tsai X-Patchwork-Id: 13026512 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 E32A4ECAAA1 for ; Mon, 31 Oct 2022 23:38:21 +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=+WWJAXE8xsGNAZjOPScKhLUf7s4F+zHYnVaGqQ/58P4=; b=PgB4dVnQxkneMD wQPDeMRxfPVE4b9EbVuGsqcl2k8nqz1miWgkXr4vxRoTVQ+89EbKJHYQ8Jt4oiTRIvkK0yzzBtKDo kjJm4WYXUx2aIFFDJQCpoZAr+ZmxDDw7NA6eaz+TQxd2V3Z5hOZyq4m6qYBuj9Z1Iks7hWGmwxPSg tZoFWJJFBX21gghFGdhKJ8NAtUyrdU8jtM7gvNRa/oBeM9J2yvG1GCWZha4TQx5T/41TbCHB/dSQ6 iBLnKJTVPfziL8xpu6Lhfe+mZo8ssHj+ITuwrGGrsgmpTvItsrtmMk3EUJCNrMU7sHBGucmleZWC7 /Vf1a83v5YvcaeyAqDHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1opeLG-00GgEJ-FQ; Mon, 31 Oct 2022 23:37:18 +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 1opeCd-00GcN2-Ge for linux-arm-kernel@bombadil.infradead.org; Mon, 31 Oct 2022 23:28:23 +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=WhkvwDY8l+K2R8SVWQEMlCb5Ppu2j2EDEEjR8vUOliI=; b=eTs9uHajac453ALwBpCuhNbtUO 7T4M8PI2ocArjqlM7jeGNtM9n/KCKl2fR3x45pMQbiLEtd7/u1KvxJ9BFAkqaUhE9VbB9DhpTlszX aZzgTtkR951QyKw+hc1lY5X9XTodZL4fn8mTWJWVpVzwN5DFec0CEoowxzIXuBMM1YcG0lPhnMh81 QonN3Q5e3EsRX3oFcJ691ZM6KmPF36x7zXYaJVal7Xw3Z1+HpEAA5HF+yw8kArXPFuF3OAkHgN8Ip fMJhgxDeBYo9ptKM28npuH0F1zLdmEjoDrphGwsr3E1VD0C+q1m1IcOdRZp7ZLAI74SSYUTcHZyZy DKofuDFA==; Received: from twspam01.aspeedtech.com ([211.20.114.71]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1opT0u-007rJC-Ap for linux-arm-kernel@lists.infradead.org; Mon, 31 Oct 2022 11:32:13 +0000 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 29VB7WjM080106; Mon, 31 Oct 2022 19:07: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, 31 Oct 2022 19:30:39 +0800 From: Billy Tsai To: , , , , , , , , , , , , Subject: [PATCH 1/2] iio: adc: aspeed: Remove the trim valid dts property. Date: Mon, 31 Oct 2022 19:32:07 +0800 Message-ID: <20221031113208.19194-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 29VB7WjM080106 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221031_113133_011970_DFCF1D72 X-CRM114-Status: GOOD ( 11.41 ) 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 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 --- 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)) {