Add support for AK09918
Subsystems (2)
v3 cover Add support for AK09918
Add support for AK09918 which is register and scaling compatible with AK09912.
It was tested in Xiaomi Redmi 5 Plus (vince).
magnetometer@c {
compatible = "asahi-kasei,ak09918", "asahi-kasei,ak09912"; reg = <0x0c>;
vdd-supply = <&pm8953_l6>;
mount-matrix = "1", "0", "0",
"0", "1", "0",
"0", "0", "1";
};Add a fix for data reading according to datasheet [1] (9.4.3.2.) ST2 register have to be read out after read measurment data as third step because ST2 will realasing the lock on the measurment data. Without it the next reading will fail.
---
Changes in v3:
- Relax failure on unknown device id
for support more register compatible variants.
- Change to fallback compatible.
- Make ST2 to be always read after measuremnt read.
- Reword fix commit with more explanation.
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Remove unnecessary ak09918 compatbile.
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Barnabás Czémán (2):
iio: magnetometer: ak8975: Relax failure on unknown id
iio: magnetometer: ak8975: Fix reading for ak099xx sensors
Danila Tikhonov (2):
dt-bindings: iio: imu: magnetometer: Add ak09118
iio: magnetometer: ak8975: Add AK09118 support
.../iio/magnetometer/asahi-kasei,ak8975.yaml | 3 + drivers/iio/magnetometer/Kconfig | 2 +- drivers/iio/magnetometer/ak8975.c | 73 ++++++++++++++++------ 3 files changed, 57 insertions(+), 21 deletions(-)
---
base-commit: 61c01d2e181adfba02fe09764f9fca1de2be0dbe
change-id: 20240805-ak09918-4a6cfef91c32
Best regards,
Signature · 1 line
Barnabás Czémán <[email protected]>
PATCH v3 1/4 iio: magnetometer: ak8975: Relax failure on unknown id
Relax failure when driver gets an unknown device id for allow probe for register compatible devices.
--- drivers/iio/magnetometer/ak8975.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/magnetometer/ak8975.c +3 -3
@@ -484,10 +484,10 @@ static int ak8975_who_i_am(struct i2c_client *client,if (wia_val[1 ] ==AK09916_DEVICE_ID )return 0 ;break ; -default : -dev_err (&client->dev,"Type %d unknown\n" , type); } -return -ENODEV ; + +dev_info (&client->dev,"Device ID %x is unknown.\n" , wia_val[1 ]); +return 0 ; }/*
Signature · 1 line
2.46.0
PATCH v3 2/4 iio: magnetometer: ak8975: Fix reading for ak099xx sensors
In reply to Barnabás CzémánMove ST2 reading with overflow handling after measurement data reading.
ST2 register read have to be read after read measurment data, because it means end of the reading and realease the lock on the data. Remove ST2 read skip on interrupt based waiting because ST2 required to be read out at and of the axis read.
--- drivers/iio/magnetometer/ak8975.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)
drivers/iio/magnetometer/ak8975.c +16 -17
@@ -692,22 +692,7 @@ static int ak8975_start_read_axis(struct ak8975_data *data,if (ret <0 )return ret; -/* This will be executed only for non-interrupt based waiting case */ -if (ret & data->def->ctrl_masks[ST1_DRDY ]) { - ret =i2c_smbus_read_byte_data (client, - data->def->ctrl_regs[ST2 ]); -if (ret <0 ) { -dev_err (&client->dev,"Error in reading ST2\n" ); -return ret; - } -if (ret & (data->def->ctrl_masks[ST2_DERR ] | - data->def->ctrl_masks[ST2_HOFL ])) { -dev_err (&client->dev,"ST2 status error 0x%x\n" , ret); -return -EINVAL ; - } - } - -return 0 ; +return !data->def->ctrl_regs[ST1_DRDY ]; }/* Retrieve raw flux value for one of the x, y, or z axis. */
@@ -734,6 +719,20 @@ static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val)if (ret <0 ) goto exit; +/* Read out ST2 for release lock */ + ret =i2c_smbus_read_byte_data (client, data->def->ctrl_regs[ST2 ]); +if (ret <0 ) { +dev_err (&client->dev,"Error in reading ST2\n" ); + goto exit; + } + +if (ret & (data->def->ctrl_masks[ST2_DERR ] | + data->def->ctrl_masks[ST2_HOFL ])) { +dev_err (&client->dev,"ST2 status error 0x%x\n" , ret); + ret = -EINVAL ; + goto exit; + } +mutex_unlock (&data->lock);pm_runtime_mark_last_busy (&data->client->dev);
@@ -746,7 +745,7 @@ static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val) exit:mutex_unlock (&data->lock); -dev_err (&client->dev,"Error in reading axis\n" ); +dev_err (&client->dev,"Error in reading axis %d\n" , ret);return ret; }
Signature · 1 line
2.46.0
Jonathan Cameron
maintainerRe: [PATCH v3 2/4] iio: magnetometer: ak8975: Fix reading for ak099xx sensors
Quoted 8 lines · On Fri, 09 Aug 2024 22:25:40 +0200 Barnabás Czémán…
Move ST2 reading with overflow handling after measurement data reading.
ST2 register read have to be read after read measurment data, because it means end of the reading and realease the lock on the data. Remove ST2 read skip on interrupt based waiting because ST2 required to be read out at and of the axis read.Signed-off-by Barnabás Czémán <[email protected]>
This still needs a fixes tag to tell us when the bug was first introduced into the driver so that we know how far to back port it.
One other comment inline.
Thanks,
Jonathan
Quoted 54 lines
--- drivers/iio/magnetometer/ak8975.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)drivers/iio/magnetometer/ak8975.c +15
-16@@ -692,22 +692,7 @@ static int ak8975_start_read_axis(struct ak8975_data *data,if (ret <0 )return ret; -/* This will be executed only for non-interrupt based waiting case */ -if (ret & data->def->ctrl_masks[ST1_DRDY ]) { - ret =i2c_smbus_read_byte_data (client, - data->def->ctrl_regs[ST2 ]); -if (ret <0 ) { -dev_err (&client->dev,"Error in reading ST2\n" ); -return ret; - } -if (ret & (data->def->ctrl_masks[ST2_DERR ] | - data->def->ctrl_masks[ST2_HOFL ])) { -dev_err (&client->dev,"ST2 status error 0x%x\n" , ret); -return -EINVAL ; - } - } - -return 0 ; +return !data->def->ctrl_regs[ST1_DRDY ]; }/* Retrieve raw flux value for one of the x, y, or z axis. */ @@ -734,6 +719,20 @@ static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val)if (ret <0 ) goto exit; +/* Read out ST2 for release lock */ + ret =i2c_smbus_read_byte_data (client, data->def->ctrl_regs[ST2 ]); +if (ret <0 ) { +dev_err (&client->dev,"Error in reading ST2\n" ); + goto exit; + } + +if (ret & (data->def->ctrl_masks[ST2_DERR ] | + data->def->ctrl_masks[ST2_HOFL ])) { +dev_err (&client->dev,"ST2 status error 0x%x\n" , ret); + ret = -EINVAL ; + goto exit; + } +mutex_unlock (&data->lock);pm_runtime_mark_last_busy (&data->client->dev);
drivers/iio/magnetometer/ak8975.c static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val) · line 748
Quoted 5 lines
drivers/iio/magnetometer/ak8975.c +1
-1@@ -746,7 +745,7 @@ static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val) exit:mutex_unlock (&data->lock); -dev_err (&client->dev,"Error in reading axis\n" ); +dev_err (&client->dev,"Error in reading axis %d\n" , ret);
In most of the paths above there is already a detailed print. I'd not bother adding the return value to this one. It just adds noise to the patch.
Quoted 4 lines
drivers/iio/magnetometer/ak8975.c +0
-0return ret; }
Re: [PATCH v3 2/4] iio: magnetometer: ak8975: Fix reading for ak099xx sensors
Quoted 10 lines · Jonathan Cameron
Quoted 7 lines · On Fri, 09 Aug 2024 22:25:40 +0200 Barnabás Czémán…
Move ST2 reading with overflow handling after measurement data reading.
ST2 register read have to be read after read measurment data, because it means end of the reading and realease the lock on the data. Remove ST2 read skip on interrupt based waiting because ST2 required to be read out at and of the axis read.
Quoted 3 lines
Quoted 1 line
Signed-off-by Barnabás Czémán <[email protected]>This still needs a fixes tag to tell us when the bug was first introduced into the driver so that we know how far to back port it.
I have got some test results from a device with ak09916 and that was working without the fix so it seems only ak09918 is strict about ST2.
In theory all ak099xx should work like this so:
Quoted 79 lines
One other comment inline.
Thanks,
Jonathan
Quoted 58 lines
--- drivers/iio/magnetometer/ak8975.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)drivers/iio/magnetometer/ak8975.c +1
-16@@ -692,22 +692,7 @@ static int ak8975_start_read_axis(structak8975_data *data, if (ret < 0) return ret; -/* This will be executed only for non-interrupt based waiting case */ -if (ret & data->def->ctrl_masks[ST1_DRDY ]) { - ret =i2c_smbus_read_byte_data (client, - data->def->ctrl_regs[ST2 ]); -if (ret <0 ) { -dev_err (&client->dev,"Error in reading ST2\n" ); -return ret; - } -if (ret & (data->def->ctrl_masks[ST2_DERR ] | - data->def->ctrl_masks[ST2_HOFL ])) { -dev_err (&client->dev,"ST2 status error 0x%x\n" , ret); -return -EINVAL ; - } - } - -return 0 ; +return !data->def->ctrl_regs[ST1_DRDY ]; }/* Retrieve raw flux value for one of the x, y, or z axis. */
drivers/iio/magnetometer/ak8975.c +14
-0@@ -734,6 +719,20 @@ static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val)if (ret <0 ) goto exit; +/* Read out ST2 for release lock */ + ret =i2c_smbus_read_byte_data (client, data->def->ctrl_regs[ST2 ]); +if (ret <0 ) { +dev_err (&client->dev,"Error in reading ST2\n" ); + goto exit; + } + +if (ret & (data->def->ctrl_masks[ST2_DERR ] | + data->def->ctrl_masks[ST2_HOFL ])) { +dev_err (&client->dev,"ST2 status error 0x%x\n" , ret); + ret = -EINVAL ; + goto exit; + } +mutex_unlock (&data->lock);drivers/iio/magnetometer/ak8975.c +0
-0pm_runtime_mark_last_busy (&data->client->dev);drivers/iio/magnetometer/ak8975.c static int ak8975_read_axis(struct iio_dev · line 749
Quoted 6 lines
drivers/iio/magnetometer/ak8975.c +1
-1@@ -746,7 +745,7 @@ static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val) exit:mutex_unlock (&data->lock); -dev_err (&client->dev,"Error in reading axis\n" ); +dev_err (&client->dev,"Error in reading axis %d\n" , ret);In most of the paths above there is already a detailed print. I'd not bother adding the return value to this one. It just adds noise to the patch.
Quoted 4 lines
drivers/iio/magnetometer/ak8975.c +0
-0return ret; }
PATCH v3 3/4 dt-bindings: iio: imu: magnetometer: Add ak09118
In reply to Barnabás CzémánFrom: Danila Tikhonov <[email protected]>
Document asahi-kasei,ak09918 compatible.
--- .../devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml +3 -0
@@ -18,6 +18,9 @@ properties: - asahi-kasei,ak09911 - asahi-kasei,ak09912 - asahi-kasei,ak09916 + - items: + - const: asahi-kasei,ak09918 + - const: asahi-kasei,ak09912 - enum: - ak8975 - ak8963
Signature · 1 line
2.46.0
Re: [PATCH v3 3/4] dt-bindings: iio: imu: magnetometer: Add ak09118
Quoted 3 lines · Barnabás Czémán
From: Danila Tikhonov <[email protected]>
Document asahi-kasei,ak09918 compatible.
Not much improved here.
<form letter>
This is a friendly reminder during the review process.
It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.
Thank you.
</form letter>
Quoted 12 lines
Signed-off-by Danila Tikhonov <[email protected]>Signed-off-by Barnabás Czémán <[email protected]>--- .../devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml | 3 +++ 1 file changed, 3 insertions(+)Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml +0
-0
Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml properties: · line 23
Quoted 6 lines
Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml +3
-0@@ -18,6 +18,9 @@ properties: - asahi-kasei,ak09911 - asahi-kasei,ak09912 - asahi-kasei,ak09916 + - items: + - const: asahi-kasei,ak09918 + - const: asahi-kasei,ak09912
Why? Your driver suggests it might not be compatible... Can device bind using ak09912 and operate up to ak09912 extend?
Best regards,
Krzysztof
Re: [PATCH v3 3/4] dt-bindings: iio: imu: magnetometer: Add ak09118
Quoted 6 lines · Krzysztof Kozlowski
Quoted 3 lines · Barnabás Czémán
From: Danila Tikhonov <[email protected]>
Document asahi-kasei,ak09918 compatible.
Not much improved here.
I have removed Reviewed-by because fallback compatible is a different approach and I would not mind second look.
Quoted 20 lines
<form letter>
This is a friendly reminder during the review process.It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.
Thank you.
</form letter>Quoted 8 lines
Signed-off-by Danila Tikhonov <[email protected]>Signed-off-by Barnabás Czémán <[email protected]>---
.../devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml| 3 +++1 file changed, 3 insertions(+)
Quoted 16 lines
Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml properties: · line 23
Quoted 13 lines
Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml +0
-1---
a/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml
+++b/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yamlDocumentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml +3
-0@@ -18,6 +18,9 @@ properties: - asahi-kasei,ak09911 - asahi-kasei,ak09912 - asahi-kasei,ak09916 + - items: + - const: asahi-kasei,ak09918 + - const: asahi-kasei,ak09912Why? Your driver suggests it might not be compatible... Can device bind using ak09912 and operate up to ak09912 extend?
It is register compatible and it can bind on 09112, as I understand fallback compatible was a request from Connor and Jonathan in the previous round.
Quoted 3 lines
Best regards,
Krzysztof
Re: [PATCH v3 3/4] dt-bindings: iio: imu: magnetometer: Add ak09118
Quoted 10 lines · On 11/08/2024 20:28, [email protected] wrote:
Quoted 6 lines · Krzysztof Kozlowski
Quoted 3 lines · Barnabás Czémán
From: Danila Tikhonov <[email protected]>
Document asahi-kasei,ak09918 compatible.
Not much improved here.
I have removed Reviewed-by because fallback compatible is a different approach
and I would not mind second look.
You received specific comments. You ignored them, so I replied that you ignored them. And your excuse is that you ask for review? This does not work like this. Read CAREFULLY form letter below.
Quoted 38 lines
Quoted 30 lines
<form letter>
This is a friendly reminder during the review process.It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.
Thank you.
</form letter>Quoted 18 lines
Signed-off-by Danila Tikhonov <[email protected]>Signed-off-by Barnabás Czémán <[email protected]>---
.../devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml| 3 +++1 file changed, 3 insertions(+)(quoted diff) +0
-0
a/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yamlb/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yamlindex9790f75fc669..ff93a935363f100644
---a/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml
+++b/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yamlDocumentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml +0
-0@@ -18,6 +18,9 @@ properties: - asahi-kasei,ak09911Quoted 8 lines
Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml properties: · line 23
Quoted 5 lines
Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml +3
-0- asahi-kasei,ak09912 - asahi-kasei,ak09916 + - items: + - const: asahi-kasei,ak09918 + - const: asahi-kasei,ak09912Why? Your driver suggests it might not be compatible... Can device bind using ak09912 and operate up to ak09912 extend?
Quoted 2 lines
It is register compatible and it can bind on 09112, as I understand fallback compatible
ok
Quoted 1 line
was a request from Connor and Jonathan in the previous round.
Not entirely, you should read comments more carefully.
Best regards,
Krzysztof
Jonathan Cameron
maintainerRe: [PATCH v3 3/4] dt-bindings: iio: imu: magnetometer: Add ak09118
Quoted 54 lines · On Mon, 12 Aug 2024 08:17:52 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 10 lines · On 11/08/2024 20:28, [email protected] wrote:
Quoted 6 lines · Krzysztof Kozlowski
Quoted 3 lines · Barnabás Czémán
From: Danila Tikhonov <[email protected]>
Document asahi-kasei,ak09918 compatible.
Not much improved here.
I have removed Reviewed-by because fallback compatible is a different approach
and I would not mind second look.You received specific comments. You ignored them, so I replied that you ignored them. And your excuse is that you ask for review? This does not work like this. Read CAREFULLY form letter below.
Quoted 38 lines
Quoted 38 lines
<form letter>
This is a friendly reminder during the review process.It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.
Thank you.
</form letter>Quoted 17 lines
Signed-off-by Danila Tikhonov <[email protected]>Signed-off-by Barnabás Czémán <[email protected]>---
.../devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml| 3 +++1 file changed, 3 insertions(+)(quoted diff) +0
-0
a/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yamlb/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yamlindex9790f75fc669..ff93a935363f100644
---a/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml
+++b/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yamlDocumentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml properties: · line 23
Quoted 6 lines
Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml +3
-0@@ -18,6 +18,9 @@ properties: - asahi-kasei,ak09911 - asahi-kasei,ak09912 - asahi-kasei,ak09916 + - items: + - const: asahi-kasei,ak09918 + - const: asahi-kasei,ak09912Why? Your driver suggests it might not be compatible... Can device bind using ak09912 and operate up to ak09912 extend?
Quoted 8 lines
Quoted 2 lines
It is register compatible and it can bind on 09112, as I understand fallback compatible
ok
Quoted 1 line
was a request from Connor and Jonathan in the previous round.
Not entirely, you should read comments more carefully.
Given the device specific data is only different in terms of the ID register value, a fallback seems fine, but you should add to this patch description something to say that this device is register compatible etc.
Quoted 4 lines
Best regards,
Krzysztof
Jonathan Cameron
maintainerRe: [PATCH v3 3/4] dt-bindings: iio: imu: magnetometer: Add ak09118
In reply to Barnabás CzémánQuoted 6 lines · On Fri, 09 Aug 2024 22:25:41 +0200 Barnabás Czémán…
From: Danila Tikhonov <[email protected]>
Document asahi-kasei,ak09918 compatible.
Signed-off-by Danila Tikhonov <[email protected]>Signed-off-by Barnabás Czémán <[email protected]>
Patch title should not contain imu as this isn't one.
Quoted 19 lines
--- .../devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml | 3 +++ 1 file changed, 3 insertions(+)Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml +3
-0@@ -18,6 +18,9 @@ properties: - asahi-kasei,ak09911 - asahi-kasei,ak09912 - asahi-kasei,ak09916 + - items: + - const: asahi-kasei,ak09918 + - const: asahi-kasei,ak09912 - enum: - ak8975 - ak8963
PATCH v3 4/4 iio: magnetometer: ak8975: Add AK09118 support
In reply to Barnabás CzémánFrom: Danila Tikhonov <[email protected]>
Add additional AK09118 to the magnetometer driver which has the same register mapping and scaling as the AK09112 device.
--- drivers/iio/magnetometer/Kconfig | 2 +- drivers/iio/magnetometer/ak8975.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-)
drivers/iio/magnetometer/Kconfig +1 -1
@@ -39,7 +39,7 @@ config AK8975 select IIO_TRIGGERED_BUFFER help Say yes here to build support for Asahi Kasei AK8975, AK8963, - AK09911, AK09912 or AK09916 3-Axis Magnetometer. + AK09911, AK09912, AK09916 or AK09918 3-Axis Magnetometer. To compile this driver as a module, choose M here: the module will be called ak8975.
drivers/iio/magnetometer/ak8975.c +34 -0
@@ -78,6 +78,7 @@*/ #define AK09912_REG_WIA1 0x00#define AK09912_REG_WIA2 0x01 +#define AK09918_DEVICE_ID 0x0C#define AK09916_DEVICE_ID 0x09#define AK09912_DEVICE_ID 0x04#define AK09911_DEVICE_ID 0x05
@@ -209,6 +210,7 @@ enum asahi_compass_chipset {AK09911 ,AK09912 ,AK09916 , + AK09918, }; enum ak_ctrl_reg_addr {
@@ -371,6 +373,31 @@ static const struct ak_def ak_def_array[] = { AK09912_REG_HXL,AK09912_REG_HYL , AK09912_REG_HZL}, + }, + [AK09918 ] = { + .type =AK09918 , + .raw_to_gauss = ak09912_raw_to_gauss, + .range =32752 , + .ctrl_regs = { +AK09912_REG_ST1 , +AK09912_REG_ST2 , +AK09912_REG_CNTL2 , +AK09912_REG_ASAX , +AK09912_MAX_REGS }, + .ctrl_masks = { +AK09912_REG_ST1_DRDY_MASK , +AK09912_REG_ST2_HOFL_MASK , +0 , +AK09912_REG_CNTL2_MODE_MASK }, + .ctrl_modes = { +AK09912_REG_CNTL_MODE_POWER_DOWN , +AK09912_REG_CNTL_MODE_ONCE , +AK09912_REG_CNTL_MODE_SELF_TEST , +AK09912_REG_CNTL_MODE_FUSE_ROM }, + .data_regs = { +AK09912_REG_HXL , +AK09912_REG_HYL , +AK09912_REG_HZL }, } };
@@ -452,6 +479,7 @@ static int ak8975_who_i_am(struct i2c_client *client,/* * Signature for each device: * Device | WIA1 | WIA2 +* AK09918 | DEVICE_ID_| AK09918_DEVICE_ID * AK09916 | DEVICE_ID_| AK09916_DEVICE_ID * AK09912 | DEVICE_ID | AK09912_DEVICE_ID * AK09911 | DEVICE_ID | AK09911_DEVICE_ID
@@ -484,6 +512,10 @@ static int ak8975_who_i_am(struct i2c_client *client,if (wia_val[1 ] ==AK09916_DEVICE_ID )return 0 ;break ; +case AK09918 : +if (wia_val[1 ] ==AK09918_DEVICE_ID ) +return 0 ; +break ; }dev_info (&client->dev,"Device ID %x is unknown.\n" , wia_val[1 ]);
@@ -1066,6 +1098,7 @@ static const struct i2c_device_id ak8975_id[] = { {"ak09911", (kernel_ulong_t)&ak_def_array[AK09911] }, {"ak09912", (kernel_ulong_t)&ak_def_array[AK09912] }, {"ak09916", (kernel_ulong_t)&ak_def_array[AK09916] }, + {"ak09918", (kernel_ulong_t)&ak_def_array[AK09918] }, {} };MODULE_DEVICE_TABLE (i2c, ak8975_id);
@@ -1081,6 +1114,7 @@ static const struct of_device_id ak8975_of_match[] = { { .compatible = "ak09912", .data = &ak_def_array[AK09912] }, { .compatible = "asahi-kasei,ak09916", .data = &ak_def_array[AK09916] }, { .compatible = "ak09916", .data = &ak_def_array[AK09916] }, + { .compatible = "asahi-kasei,ak09918", .data = &ak_def_array[AK09918] }, {} };MODULE_DEVICE_TABLE (of, ak8975_of_match);
Signature · 1 line
2.46.0