public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Add support for Azoteq IQS620A(T) V3
@ 2022-01-23 19:01 Jeff LaBundy
  2022-01-23 19:01 ` [PATCH 1/2] mfd: iqs62x: Provide device revision to sub-devices Jeff LaBundy
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jeff LaBundy @ 2022-01-23 19:01 UTC (permalink / raw)
  To: lee.jones, jic23; +Cc: linux-kernel, linux-iio, Jeff LaBundy

This is a tiny series that adds support for an updated revision of
IQS620A(T) silicon, which calls for a change to the offset reported
by the IIO temperature driver.

The product change notice is shown in [1]. The updated IIO driver
selects the correct offset based on revision, and a small change to
the MFD driver allows it to share the revision with its children.

In the absence of any objection, I would like to propose that Lee
takes the series through his tree, provided Jonathan approves the
IIO change.

[1] https://www.azoteq.com/images/stories/pdf/WT-02_PCN%20_IQS620A.pdf

Jeff LaBundy (2):
  mfd: iqs62x: Provide device revision to sub-devices
  iio: temperature: iqs620at-temp: Add support for V3 silicon

 drivers/iio/temperature/iqs620at-temp.c | 4 +++-
 drivers/mfd/iqs62x.c                    | 6 +++---
 include/linux/mfd/iqs62x.h              | 7 +++++++
 3 files changed, 13 insertions(+), 4 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] mfd: iqs62x: Provide device revision to sub-devices
  2022-01-23 19:01 [PATCH 0/2] Add support for Azoteq IQS620A(T) V3 Jeff LaBundy
@ 2022-01-23 19:01 ` Jeff LaBundy
  2022-01-23 19:01 ` [PATCH 2/2] iio: temperature: iqs620at-temp: Add support for V3 silicon Jeff LaBundy
  2022-02-14 13:15 ` [PATCH 0/2] Add support for Azoteq IQS620A(T) V3 Lee Jones
  2 siblings, 0 replies; 5+ messages in thread
From: Jeff LaBundy @ 2022-01-23 19:01 UTC (permalink / raw)
  To: lee.jones, jic23; +Cc: linux-kernel, linux-iio, Jeff LaBundy

Individual sub-devices may elect to make decisions based on the
specific revision of silicon encountered at probe. This data is
already read from the device, but is not retained.

Pass this data on to the sub-devices by adding the software and
hardware numbers (registers 0x01 and 0x02, respectively) to the
iqs62x_core struct.

Signed-off-by: Jeff LaBundy <jeff@labundy.com>
---
 drivers/mfd/iqs62x.c       | 6 +++---
 include/linux/mfd/iqs62x.h | 7 +++++++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/iqs62x.c b/drivers/mfd/iqs62x.c
index 9805cf191245..575ab67e243d 100644
--- a/drivers/mfd/iqs62x.c
+++ b/drivers/mfd/iqs62x.c
@@ -898,7 +898,6 @@ static int iqs62x_probe(struct i2c_client *client)
 	struct iqs62x_info info;
 	unsigned int val;
 	int ret, i, j;
-	u8 sw_num = 0;
 	const char *fw_name = NULL;
 
 	iqs62x = devm_kzalloc(&client->dev, sizeof(*iqs62x), GFP_KERNEL);
@@ -949,7 +948,8 @@ static int iqs62x_probe(struct i2c_client *client)
 		if (info.sw_num < iqs62x->dev_desc->sw_num)
 			continue;
 
-		sw_num = info.sw_num;
+		iqs62x->sw_num = info.sw_num;
+		iqs62x->hw_num = info.hw_num;
 
 		/*
 		 * Read each of the device's designated calibration registers,
@@ -985,7 +985,7 @@ static int iqs62x_probe(struct i2c_client *client)
 		return -EINVAL;
 	}
 
-	if (!sw_num) {
+	if (!iqs62x->sw_num) {
 		dev_err(&client->dev, "Unrecognized software number: 0x%02X\n",
 			info.sw_num);
 		return -EINVAL;
diff --git a/include/linux/mfd/iqs62x.h b/include/linux/mfd/iqs62x.h
index 5ced55eae11b..ffc86010af74 100644
--- a/include/linux/mfd/iqs62x.h
+++ b/include/linux/mfd/iqs62x.h
@@ -14,6 +14,11 @@
 #define IQS624_PROD_NUM				0x43
 #define IQS625_PROD_NUM				0x4E
 
+#define IQS620_HW_NUM_V0			0x82
+#define IQS620_HW_NUM_V1			IQS620_HW_NUM_V0
+#define IQS620_HW_NUM_V2			IQS620_HW_NUM_V0
+#define IQS620_HW_NUM_V3			0x92
+
 #define IQS621_ALS_FLAGS			0x16
 #define IQS622_ALS_FLAGS			0x14
 
@@ -129,6 +134,8 @@ struct iqs62x_core {
 	struct completion fw_done;
 	enum iqs62x_ui_sel ui_sel;
 	unsigned long event_cache;
+	u8 sw_num;
+	u8 hw_num;
 };
 
 extern const struct iqs62x_event_desc iqs62x_events[IQS62X_NUM_EVENTS];
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] iio: temperature: iqs620at-temp: Add support for V3 silicon
  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
  2022-01-24 17:34   ` Jonathan Cameron
  2022-02-14 13:15 ` [PATCH 0/2] Add support for Azoteq IQS620A(T) V3 Lee Jones
  2 siblings, 1 reply; 5+ messages in thread
From: Jeff LaBundy @ 2022-01-23 19:01 UTC (permalink / raw)
  To: lee.jones, jic23; +Cc: linux-kernel, linux-iio, Jeff LaBundy

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] iio: temperature: iqs620at-temp: Add support for V3 silicon
  2022-01-23 19:01 ` [PATCH 2/2] iio: temperature: iqs620at-temp: Add support for V3 silicon Jeff LaBundy
@ 2022-01-24 17:34   ` Jonathan Cameron
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2022-01-24 17:34 UTC (permalink / raw)
  To: Jeff LaBundy; +Cc: lee.jones, jic23, linux-kernel, linux-iio

On Sun, 23 Jan 2022 13:01:06 -0600
Jeff LaBundy <jeff@labundy.com> wrote:

> 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>
Trivial comment inline but I'm fine with this either way.
Assuming it will go through mfd.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.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;

Line is a bit long, so maybe it would be better to just use an if / else

		if (iqs6x->hw_num < IQS620_HW_NUM_V3)
			*val = IQS620_TEMP_OFFSET;
		else
			*val = IQS620_TEMP_OFFSET_V3;


>  		return IIO_VAL_INT;
>  
>  	default:


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] Add support for Azoteq IQS620A(T) V3
  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 ` [PATCH 2/2] iio: temperature: iqs620at-temp: Add support for V3 silicon Jeff LaBundy
@ 2022-02-14 13:15 ` Lee Jones
  2 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2022-02-14 13:15 UTC (permalink / raw)
  To: Jeff LaBundy; +Cc: jic23, linux-kernel, linux-iio

Enjoy!

The following changes since commit e783362eb54cd99b2cac8b3a9aeac942e6f6ac07:

  Linux 5.17-rc1 (2022-01-23 10:12:53 +0200)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git tags/ib-mfd-iio-v5.18

for you to fetch changes up to 9e444dbf278c604110762b25d8e0b4e9f1d27dbc:

  iio: temperature: iqs620at-temp: Add support for V3 silicon (2022-02-14 13:07:33 +0000)

----------------------------------------------------------------
Immutable branch between MFD and IIO due for the v5.18 merge window

----------------------------------------------------------------
Jeff LaBundy (2):
      mfd: iqs62x: Provide device revision to sub-devices
      iio: temperature: iqs620at-temp: Add support for V3 silicon

 drivers/iio/temperature/iqs620at-temp.c | 4 +++-
 drivers/mfd/iqs62x.c                    | 6 +++---
 include/linux/mfd/iqs62x.h              | 7 +++++++
 3 files changed, 13 insertions(+), 4 deletions(-)

-- 
Lee Jones [李琼斯]
Principal Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-14 13:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 2/2] iio: temperature: iqs620at-temp: Add support for V3 silicon Jeff LaBundy
2022-01-24 17:34   ` Jonathan Cameron
2022-02-14 13:15 ` [PATCH 0/2] Add support for Azoteq IQS620A(T) V3 Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox