MMC35240 magneto fixes
cover MMC35240 magneto fixes
Found while testing with a compass Android app.
Jonathan, this is a follow up of the first patch in this series, initially sent for review before merged window was closed:
See: https://lkml.org/lkml/2015/6/21/68
Daniel Baluta (2):
iio: magnetometer: mmc35240: Fix crash in pm suspend
iio: magnetometer: mmc35240: Fix SET/RESET mask
Viorel Suman (1):
iio: magnetometer: mmc35240: fix SET/RESET sequence
drivers/iio/magnetometer/mmc35240.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/3 iio: magnetometer: mmc35240: Fix crash in pm suspend
We must set i2c client private data at probe in order to correctly retrieve it in pm suspend/resume, preventing the following crash:
[ 321.790582] PM: Syncing filesystems ... done. [ 322.364440] PM: Preparing system for mem sleep [ 322.400047] PM: Entering mem sleep [ 322.462178] BUG: unable to handle kernel NULL pointer dereference at 0000036c [ 322.469119] IP: [<80e0b3d2>] mmc35240_suspend+0x12/0x30 [ 322.474291] *pdpt = 000000002fd6f001 *pde = 0000000000000000 [ 322.479967] Oops: 0000 1 PREEMPT SMP [ 322.496516] task: a86d0df0 ti: a8766000 task.ti: a8766000 [ 322.570744] Call Trace: [ 322.573217] [<80c0d2d1>] pm_generic_suspend+0x21/0x30 [ 322.578284] [<80d042ab>] i2c_device_pm_suspend+0x1b/0x30
--- drivers/iio/magnetometer/mmc35240.c | 1 + 1 file changed, 1 insertion(+)
drivers/iio/magnetometer/mmc35240.c +1 -0
@@ -496,6 +496,7 @@ static int mmc35240_probe(struct i2c_client *client, } data =iio_priv (indio_dev); +i2c_set_clientdata (client, indio_dev); data->client = client; data->regmap = regmap; data->res =MMC35240_16_BITS_SLOW ;
Signature · 1 line
1.9.1
Re: [PATCH 1/3] iio: magnetometer: mmc35240: Fix crash in pm suspend
Quoted 16 lines · Daniel Baluta
We must set i2c client private data at probe in order to correctly retrieve it in pm suspend/resume, preventing the following crash:
[ 321.790582] PM: Syncing filesystems ... done. [ 322.364440] PM: Preparing system for mem sleep [ 322.400047] PM: Entering mem sleep [ 322.462178] BUG: unable to handle kernel NULL pointer dereference at 0000036c [ 322.469119] IP: [<80e0b3d2>] mmc35240_suspend+0x12/0x30 [ 322.474291] *pdpt = 000000002fd6f001 *pde = 0000000000000000 [ 322.479967] Oops: 0000 1 PREEMPT SMP [ 322.496516] task: a86d0df0 ti: a8766000 task.ti: a8766000 [ 322.570744] Call Trace: [ 322.573217] [<80c0d2d1>] pm_generic_suspend+0x21/0x30 [ 322.578284] [<80d042ab>] i2c_device_pm_suspend+0x1b/0x30
Quoted 1 line
Signed-off-by Daniel Baluta <[email protected]>
Applied to the fixes-togreg branch of iio.git
Thanks,
Quoted 17 lines
--- drivers/iio/magnetometer/mmc35240.c | 1 + 1 file changed, 1 insertion(+)drivers/iio/magnetometer/mmc35240.c +1
-0@@ -496,6 +496,7 @@ static int mmc35240_probe(struct i2c_client *client, } data =iio_priv (indio_dev); +i2c_set_clientdata (client, indio_dev); data->client = client; data->regmap = regmap; data->res =MMC35240_16_BITS_SLOW ;
PATCH 2/3 iio: magnetometer: mmc35240: Fix SET/RESET mask
In reply to Daniel BalutaThis fixes setting the SET/RESET bit in the REG_CTRL0 register.
--- drivers/iio/magnetometer/mmc35240.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/magnetometer/mmc35240.c +2 -2
@@ -195,8 +195,8 @@ static int mmc35240_hw_set(struct mmc35240_data *data, bool set) coil_bit =MMC35240_CTRL0_RESET_BIT ;return regmap_update_bits (data->regmap,MMC35240_REG_CTRL0 , -MMC35240_CTRL0_REFILL_BIT , - coil_bit); + coil_bit, coil_bit); + }static int mmc35240_init (struct mmc35240_data *data)
Signature · 1 line
1.9.1
Re: [PATCH 2/3] iio: magnetometer: mmc35240: Fix SET/RESET mask
Quoted 4 lines · Daniel Baluta
This fixes setting the SET/RESET bit in the
REG_CTRL0register.Signed-off-by Daniel Baluta <[email protected]>
Applied to the fixes-togreg branch of iio.git
Thanks,
Quoted 20 lines
--- drivers/iio/magnetometer/mmc35240.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/magnetometer/mmc35240.c +2
-2@@ -195,8 +195,8 @@ static int mmc35240_hw_set(struct mmc35240_data *data, bool set) coil_bit =MMC35240_CTRL0_RESET_BIT ;return regmap_update_bits (data->regmap,MMC35240_REG_CTRL0 , -MMC35240_CTRL0_REFILL_BIT , - coil_bit); + coil_bit, coil_bit); + }static int mmc35240_init (struct mmc35240_data *data)
PATCH 3/3 iio: magnetometer: mmc35240: fix SET/RESET sequence
In reply to Daniel BalutaFrom: Viorel Suman <[email protected]>
The RESET operation invoked in the last instance will align in the natural way all 3 axis and the chip top view.
--- drivers/iio/magnetometer/mmc35240.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/iio/magnetometer/mmc35240.c +4 -3
@@ -215,14 +215,15 @@ static int mmc35240_init(struct mmc35240_data *data)/* * make sure we restore sensor characteristics, by doing -* a RESET/SET sequence +* a SET/RESET sequence, the axis polarity being naturally +* aligned after RESET */ - ret =mmc35240_hw_set (data, false); + ret =mmc35240_hw_set (data, true);if (ret <0 )return ret;usleep_range (MMC53240_WAIT_SET_RESET ,MMC53240_WAIT_SET_RESET +1 ); - ret =mmc35240_hw_set (data, true); + ret =mmc35240_hw_set (data, false);if (ret <0 )return ret;
Signature · 1 line
1.9.1
Jonathan Cameron
maintainerRe: [PATCH 3/3] iio: magnetometer: mmc35240: fix SET/RESET sequence
Quoted 4 lines · Daniel Baluta
From: Viorel Suman <[email protected]>
The RESET operation invoked in the last instance will align in the natural way all 3 axis and the chip top view.
What is the result of the bug?
Just trying to assess urgency of the patch!
Quoted 32 lines
Signed-off-by Viorel Suman <[email protected]>Signed-off-by Daniel Baluta <[email protected]>---
drivers/iio/magnetometer/mmc35240.c| 7 ++++---1 file changed, 4 insertions(+), 3 deletions(-)drivers/iio/magnetometer/mmc35240.c +4
-3@@ -215,14 +215,15 @@ static int mmc35240_init(struct mmc35240_data *data)/* * make sure we restore sensor characteristics, by doing -* a RESET/SET sequence +* a SET/RESET sequence, the axis polarity being naturally +* aligned after RESET */ - ret =mmc35240_hw_set (data, false); + ret =mmc35240_hw_set (data, true);if (ret <0 )return ret;usleep_range (MMC53240_WAIT_SET_RESET ,MMC53240_WAIT_SET_RESET +1 ); - ret =mmc35240_hw_set (data, true); + ret =mmc35240_hw_set (data, false);if (ret <0 )return ret;
Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Re: [PATCH 3/3] iio: magnetometer: mmc35240: fix SET/RESET sequence
Quoted 9 lines · Jonathan Cameron
Quoted 4 lines · Daniel Baluta
From: Viorel Suman <[email protected]>
The RESET operation invoked in the last instance will align in the natural way all 3 axis and the chip top view.
What is the result of the bug?
Just trying to assess urgency of the patch!
Compass app shows North and South switched. This can be corrected from mounting matrix though.
Daniel.
Re: [PATCH 3/3] iio: magnetometer: mmc35240: fix SET/RESET sequence
Quoted 6 lines · Daniel Baluta
Quoted 5 lines · Jonathan Cameron
Quoted 2 lines · Daniel Baluta
From: Viorel Suman <[email protected]>
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
The RESET operation invoked in the last instance will align in the natural way all 3 axis and the chip top view.
What is the result of the bug?
Just trying to assess urgency of the patch!Compass app shows North and South switched. This can be corrected from mounting matrix though.
Applied.
Quoted 6 lines
Daniel.
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html