All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff LaBundy <jeff@labundy.com>
To: lee.jones@linaro.org, jic23@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
	Jeff LaBundy <jeff@labundy.com>
Subject: [PATCH 2/2] iio: temperature: iqs620at-temp: Add support for V3 silicon
Date: Sun, 23 Jan 2022 13:01:06 -0600	[thread overview]
Message-ID: <20220123190106.80591-3-jeff@labundy.com> (raw)
In-Reply-To: <20220123190106.80591-1-jeff@labundy.com>

The vendor introduced an updated revision of IQS620A(T) silicon
which is backwards-compatible with previous revisions, the only
exception being the offset used to derive temperature.

Enable this new revision by returning the appropriate offset as
a function of the hardware number provided by the parent MFD.

Signed-off-by: Jeff LaBundy <jeff@labundy.com>
---
 drivers/iio/temperature/iqs620at-temp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/temperature/iqs620at-temp.c b/drivers/iio/temperature/iqs620at-temp.c
index fe126e1fb783..e2f878d57af7 100644
--- a/drivers/iio/temperature/iqs620at-temp.c
+++ b/drivers/iio/temperature/iqs620at-temp.c
@@ -17,6 +17,7 @@
 
 #define IQS620_TEMP_SCALE			1000
 #define IQS620_TEMP_OFFSET			(-100)
+#define IQS620_TEMP_OFFSET_V3			(-40)
 
 static int iqs620_temp_read_raw(struct iio_dev *indio_dev,
 				struct iio_chan_spec const *chan,
@@ -41,7 +42,8 @@ static int iqs620_temp_read_raw(struct iio_dev *indio_dev,
 		return IIO_VAL_INT;
 
 	case IIO_CHAN_INFO_OFFSET:
-		*val = IQS620_TEMP_OFFSET;
+		*val = iqs62x->hw_num < IQS620_HW_NUM_V3 ? IQS620_TEMP_OFFSET
+							 : IQS620_TEMP_OFFSET_V3;
 		return IIO_VAL_INT;
 
 	default:
-- 
2.25.1


  parent reply	other threads:[~2022-01-23 19:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-23 19:01 [PATCH 0/2] Add support for Azoteq IQS620A(T) V3 Jeff LaBundy
2022-01-23 19:01 ` [PATCH 1/2] mfd: iqs62x: Provide device revision to sub-devices Jeff LaBundy
2022-01-23 19:01 ` Jeff LaBundy [this message]
2022-01-24 17:34   ` [PATCH 2/2] iio: temperature: iqs620at-temp: Add support for V3 silicon Jonathan Cameron
2022-02-14 13:15 ` [PATCH 0/2] Add support for Azoteq IQS620A(T) V3 Lee Jones

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=20220123190106.80591-3-jeff@labundy.com \
    --to=jeff@labundy.com \
    --cc=jic23@kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.