linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saravanan Sekar <sravanhome@gmail.com>
To: sre@kernel.org, lee.jones@linaro.org, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, jic23@kernel.org,
	lars@metafoo.de, andy.shevchenko@gmail.com
Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-iio@vger.kernel.org, Saravanan Sekar <sravanhome@gmail.com>
Subject: [PATCH 4/6] iio: adc: mp2629: restrict input voltage mask for mp2629
Date: Tue, 14 Jun 2022 17:17:20 +0200	[thread overview]
Message-ID: <20220614151722.2194936-4-sravanhome@gmail.com> (raw)
In-Reply-To: <20220614151722.2194936-1-sravanhome@gmail.com>

add support for mp2733 which is updated version of mp2629
with higher range of input voltage.

Signed-off-by: Saravanan Sekar <sravanhome@gmail.com>
---
 drivers/iio/adc/mp2629_adc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/mp2629_adc.c b/drivers/iio/adc/mp2629_adc.c
index e7fbfe92e884..28d048eefce3 100644
--- a/drivers/iio/adc/mp2629_adc.c
+++ b/drivers/iio/adc/mp2629_adc.c
@@ -64,6 +64,7 @@ static int mp2629_read_raw(struct iio_dev *indio_dev,
 			int *val, int *val2, long mask)
 {
 	struct mp2629_adc *info = iio_priv(indio_dev);
+	struct mp2629_data *ddata = dev_get_drvdata(info->dev);
 	unsigned int rval;
 	int ret;
 
@@ -73,8 +74,10 @@ static int mp2629_read_raw(struct iio_dev *indio_dev,
 		if (ret)
 			return ret;
 
-		if (chan->channel == MP2629_INPUT_VOLT)
+		if (chan->channel == MP2629_INPUT_VOLT &&
+		    ddata->chip_id == CHIP_ID_MP2629)
 			rval &= GENMASK(6, 0);
+
 		*val = rval;
 		return IIO_VAL_INT;
 
-- 
2.25.1


  parent reply	other threads:[~2022-06-14 15:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14 15:17 [PATCH 1/6] iio: adc: mp2629: fix wrong comparison of channel Saravanan Sekar
2022-06-14 15:17 ` [PATCH 2/6] dt-bindings: mfd: Add mp2733 compatible Saravanan Sekar
2022-06-15 22:59   ` Lee Jones
2022-06-27 13:29     ` Rob Herring
2022-06-27 14:45       ` Lee Jones
2022-06-14 15:17 ` [PATCH 3/6] mfd: mp2629: Add support for mps mp2733 battery charger Saravanan Sekar
2022-06-14 16:05   ` Andy Shevchenko
2022-06-14 18:29     ` saravanan sekar
2022-06-14 15:17 ` Saravanan Sekar [this message]
2022-06-14 16:07   ` [PATCH 4/6] iio: adc: mp2629: restrict input voltage mask for mp2629 Andy Shevchenko
2022-06-14 15:17 ` [PATCH 5/6] power: supply: Add support for mp2733 battery charger Saravanan Sekar
2022-06-14 16:12   ` Andy Shevchenko
2022-06-14 15:17 ` [PATCH 6/6] power: supply: mp2629: Add usb fast charge settings Saravanan Sekar
2022-06-14 16:13   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220614151722.2194936-4-sravanhome@gmail.com \
    --to=sravanhome@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).