Skip to contentSkip to conversation

Add support for Azoteq IQS620A(T) V3

PATCH In review Jeff LaBundy 3 participants 5 messages Jan 23, 2022 – Feb 14, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Add support for Azoteq IQS620A(T) V3

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(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 mfd: iqs62x: Provide device revision to sub-devices

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.

---
 drivers/mfd/iqs62x.c       | 6 +++---
 include/linux/mfd/iqs62x.h | 7 +++++++
 2 files changed, 10 insertions(+), 3 deletions(-)
drivers/mfd/iqs62x.c +3 -3
index 9805cf191245..575ab67e243d 100644
@@ -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;
include/linux/mfd/iqs62x.h +7 -0
index 5ced55eae11b..ffc86010af74 100644
@@ -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];
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/2 iio: temperature: iqs620at-temp: Add support for V3 silicon

In reply to 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.

---
 drivers/iio/temperature/iqs620at-temp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/temperature/iqs620at-temp.c +3 -1
index fe126e1fb783..e2f878d57af7 100644
@@ -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:
Signature · 1 line
2.25.1
Acked-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] iio: temperature: iqs620at-temp: Add support for V3 silicon

Quoted 8 lines · On Sun, 23 Jan 2022 13:01:06 -0600 Jeff LaBundy <[email protected]> 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.

Trivial comment inline but I'm fine with this either way. Assuming it will go through mfd.

Quoted 17 lines
---
 drivers/iio/temperature/iqs620at-temp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/temperature/iqs620at-temp.c +1 -0
index fe126e1fb783..e2f878d57af7 100644
@@ -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,

drivers/iio/temperature/iqs620at-temp.c static int iqs620_temp_read_raw(struct iio_dev *indio_dev, · line 46

Quoted 6 lines
drivers/iio/temperature/iqs620at-temp.c +2 -1
@@ -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;
Quoted 3 lines
drivers/iio/temperature/iqs620at-temp.c +0 -0
 		return IIO_VAL_INT;
 
 	default:
#4 lore raw
In reply to Jeff LaBundy

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(-)
Signature · 4 lines
Lee Jones [李琼斯]
Principal Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog