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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1679C433EF for ; Sun, 26 Sep 2021 11:28:02 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A589C61038 for ; Sun, 26 Sep 2021 11:28:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A589C61038 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=BaP3f40pWnVEnk1domtjzFaxkttSom2WjjVQb+NAxJA=; b=h4QABq/EjYKvpB y+cLpmgpTqwhUSddF+CteWeEsDenioMzE9/5K184BfnADrej1niDFyullrsC1jQG1KUDCUW1Cf4xH 342JcBhHcWNZJ12b/5Nha0yvai7wPVimMK7gmeW/O221//aAjAwgw2vcTACHG2QRoKcfAm4mBjMi8 WDW0nrSaAhs9ZtAh4FNv+cAq29L/fGzWeq0daw5ZandASoo3o6iDNXslptv0W1xpG6/bODgptMoWv zcJ5sXjVq8ZqJBoVlqnZ/q3jkt3cS+Ea/lsQvtNagKDJe9uNsC+UcljYk5LVRqcKLs4LHNWRaoSrx GA8uMqeg309bspDINBNA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUSIr-000RaL-55; Sun, 26 Sep 2021 11:26:41 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUSIn-000RZr-RE; Sun, 26 Sep 2021 11:26:39 +0000 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 101466008E; Sun, 26 Sep 2021 11:26:32 +0000 (UTC) Date: Sun, 26 Sep 2021 12:30:22 +0100 From: Jonathan Cameron To: Hui-Liu Liu Cc: , , , , , , , , , , , , , , , Subject: Re: [PATCH v4 1/1] iio: mtk-auxadc: fix case IIO_CHAN_INFO_PROCESSED Message-ID: <20210926123022.1b76eaae@jic23-huawei> In-Reply-To: <20210926073028.11045-2-hui.liu@mediatek.com> References: <20210926073028.11045-1-hui.liu@mediatek.com> <20210926073028.11045-2-hui.liu@mediatek.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; 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-20210926_042637_935303_C5439359 X-CRM114-Status: GOOD ( 19.76 ) 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 Sun, 26 Sep 2021 15:30:28 +0800 Hui-Liu Liu wrote: > From: Hui Liu > > The previous driver does't apply the necessary scaling to take the > voltage range into account. > We change readback value from raw data to input voltage to fix case > IIO_CHAN_INFO_PROCESSED. > > Fixes: ace4cdfe67be ("iio: adc: mt2701: Add Mediatek auxadc driver for mt2701.") > Signed-off-by: Hui Liu Hi Hui Liu, Thanks for the updated description. Applied to the fixes-togreg branch of iio.git and marked for stable. Thanks, Jonathan > --- > drivers/iio/adc/mt6577_auxadc.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c > index 79c1dd68b909..d4fccd52ef08 100644 > --- a/drivers/iio/adc/mt6577_auxadc.c > +++ b/drivers/iio/adc/mt6577_auxadc.c > @@ -82,6 +82,10 @@ static const struct iio_chan_spec mt6577_auxadc_iio_channels[] = { > MT6577_AUXADC_CHANNEL(15), > }; > > +/* For Voltage calculation */ > +#define VOLTAGE_FULL_RANGE 1500 /* VA voltage */ > +#define AUXADC_PRECISE 4096 /* 12 bits */ > + > static int mt_auxadc_get_cali_data(int rawdata, bool enable_cali) > { > return rawdata; > @@ -191,6 +195,10 @@ static int mt6577_auxadc_read_raw(struct iio_dev *indio_dev, > } > if (adc_dev->dev_comp->sample_data_cali) > *val = mt_auxadc_get_cali_data(*val, true); > + > + /* Convert adc raw data to voltage: 0 - 1500 mV */ > + *val = *val * VOLTAGE_FULL_RANGE / AUXADC_PRECISE; > + > return IIO_VAL_INT; > > default: _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel