From mboxrd@z Thu Jan 1 00:00:00 1970 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 64C43C4332F for ; Sun, 6 Nov 2022 14:51:30 +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:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=n9V6UJqfurc8NWxjI5RkSYY12PsJt+4sfverUgtkN0Q=; b=ylHs0ivUSh1+BT HtJ5lIS018PdTKmAIWItbuWIJqSmhXYStFYeZu9QsIH/FU71+am9o14IjOTtZHM0AeyP7M8mUJKP5 rHocjb/lGVktrXDlpyiAELmcNr8fpb9Ukw9l/+3QWnbC/oHrH0dfFm4I2U6j67emJJAkgbcyJoZB7 +g1thWAPCMZ2ocMRBCeiPYj/VLQQFxYDdOxBWYnxAeogqiKALpScJfDrpnoE4rh//Ao+ZzPrOh5h0 EOz+rOQ8yUQ+OTSbFyoW4r79bwjYF2vhWzXeC6mPR3P3HT5Sr/WiJKlF+gyYF8WWrhhd5z9m977BZ hdIdgcqteQCGNF01Q2dQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1orgyL-008Ucq-Ky; Sun, 06 Nov 2022 14:50:05 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1orgyI-008UbJ-5r for linux-arm-kernel@lists.infradead.org; Sun, 06 Nov 2022 14:50:03 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CDDF060C74; Sun, 6 Nov 2022 14:50:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C498C433C1; Sun, 6 Nov 2022 14:49:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667746200; bh=2/Oq4fxqMnhCc+bd62Y6vkjiu/snPGpLW2GdYhAJ9HU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=fpWE9GoPqgrBzQAb4xjS4heDU/dsZ/tb4Y/CLLkxeGtErwgiuNOxgN9V+oXU3pXCC T8k6EaBqF/0CDMbv9o41CJARmcb0/crudR0amV23awx5EgcMJIIfzos1UerGsssueC vXvcl7qYQiBMs25bSzytt7B42BGIxJ+Pkzf2zjnG1NywY37oKYh065nq0httUG3kzR pJMfyLr6S7KGe2N0m6goNmdAbPlhodCnNX6HaGKVwjaSvqTRtJvQGasOyUVnHWzDJ/ 9LM5bejQ31Mnvc85KiO3j7bLget74NesW47z4YjApltZhYxnCe86fd55/uuQr5lpQ8 jRtMSaCTWCyyw== Date: Sun, 6 Nov 2022 14:49:49 +0000 From: Jonathan Cameron To: Billy Tsai Cc: , , , , , , , , , , Subject: Re: [PATCH 1/2] iio: adc: aspeed: Remove the trim valid dts property. Message-ID: <20221106144949.61731d8e@jic23-huawei> In-Reply-To: <20221031113208.19194-1-billy_tsai@aspeedtech.com> References: <20221031113208.19194-1-billy_tsai@aspeedtech.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221106_065002_345635_6B788C1A X-CRM114-Status: GOOD ( 26.49 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 31 Oct 2022 19:32:07 +0800 Billy Tsai 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 > --- > 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