Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1183757 > unrolled thread

[PATCH 0/3] MMC35240 magneto fixes

Started byDaniel Baluta <daniel.baluta@intel.com>
First post2015-07-14 17:00 +0200
Last post2015-07-19 13:00 +0200
Articles 8 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/3] MMC35240 magneto fixes Daniel Baluta <daniel.baluta@intel.com> - 2015-07-14 17:00 +0200
    [PATCH 3/3] iio: magnetometer: mmc35240: fix SET/RESET sequence Daniel Baluta <daniel.baluta@intel.com> - 2015-07-14 17:00 +0200
      Re: [PATCH 3/3] iio: magnetometer: mmc35240: fix SET/RESET sequence Jonathan Cameron <jic23@kernel.org> - 2015-07-14 22:10 +0200
        Re: [PATCH 3/3] iio: magnetometer: mmc35240: fix SET/RESET sequence Jonathan Cameron <jic23@kernel.org> - 2015-07-19 13:00 +0200
    [PATCH 1/3] iio: magnetometer: mmc35240: Fix crash in pm suspend Daniel Baluta <daniel.baluta@intel.com> - 2015-07-14 17:00 +0200
      Re: [PATCH 1/3] iio: magnetometer: mmc35240: Fix crash in pm suspend Jonathan Cameron <jic23@kernel.org> - 2015-07-19 12:50 +0200
    [PATCH 2/3] iio: magnetometer: mmc35240: Fix SET/RESET mask Daniel Baluta <daniel.baluta@intel.com> - 2015-07-14 17:00 +0200
      Re: [PATCH 2/3] iio: magnetometer: mmc35240: Fix SET/RESET mask Jonathan Cameron <jic23@kernel.org> - 2015-07-19 13:00 +0200

#1183757 — [PATCH 0/3] MMC35240 magneto fixes

FromDaniel Baluta <daniel.baluta@intel.com>
Date2015-07-14 17:00 +0200
Subject[PATCH 0/3] MMC35240 magneto fixes
Message-ID<pM9QC-3qE-1@gated-at.bofh.it>
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(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1183759 — [PATCH 3/3] iio: magnetometer: mmc35240: fix SET/RESET sequence

FromDaniel Baluta <daniel.baluta@intel.com>
Date2015-07-14 17:00 +0200
Subject[PATCH 3/3] iio: magnetometer: mmc35240: fix SET/RESET sequence
Message-ID<pM9QC-3qE-5@gated-at.bofh.it>
In reply to#1183757
From: Viorel Suman <viorel.suman@intel.com>

The RESET operation invoked in the last instance will align
in the natural way all 3 axis and the chip top view.

Signed-off-by: Viorel Suman <viorel.suman@intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
---
 drivers/iio/magnetometer/mmc35240.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c
index f4d7495..a53efd2 100644
--- a/drivers/iio/magnetometer/mmc35240.c
+++ b/drivers/iio/magnetometer/mmc35240.c
@@ -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;
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1183952 — Re: [PATCH 3/3] iio: magnetometer: mmc35240: fix SET/RESET sequence

FromJonathan Cameron <jic23@kernel.org>
Date2015-07-14 22:10 +0200
SubjectRe: [PATCH 3/3] iio: magnetometer: mmc35240: fix SET/RESET sequence
Message-ID<pMeGC-2db-17@gated-at.bofh.it>
In reply to#1183759

On 14 July 2015 15:56:54 BST, Daniel Baluta <daniel.baluta@intel.com> wrote:
>From: Viorel Suman <viorel.suman@intel.com>
>
>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!
>
>Signed-off-by: Viorel Suman <viorel.suman@intel.com>
>Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
>---
> drivers/iio/magnetometer/mmc35240.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/iio/magnetometer/mmc35240.c
>b/drivers/iio/magnetometer/mmc35240.c
>index f4d7495..a53efd2 100644
>--- a/drivers/iio/magnetometer/mmc35240.c
>+++ b/drivers/iio/magnetometer/mmc35240.c
>@@ -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;
> 

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1187561 — Re: [PATCH 3/3] iio: magnetometer: mmc35240: fix SET/RESET sequence

FromJonathan Cameron <jic23@kernel.org>
Date2015-07-19 13:00 +0200
SubjectRe: [PATCH 3/3] iio: magnetometer: mmc35240: fix SET/RESET sequence
Message-ID<pNUu6-sz-11@gated-at.bofh.it>
In reply to#1183952
On 16/07/15 14:30, Daniel Baluta wrote:
> On Tue, Jul 14, 2015 at 11:04 PM, Jonathan Cameron <jic23@kernel.org> wrote:
>>
>>
>> On 14 July 2015 15:56:54 BST, Daniel Baluta <daniel.baluta@intel.com> wrote:
>>> From: Viorel Suman <viorel.suman@intel.com>
>>>
>>> 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.
> Daniel.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1183760 — [PATCH 1/3] iio: magnetometer: mmc35240: Fix crash in pm suspend

FromDaniel Baluta <daniel.baluta@intel.com>
Date2015-07-14 17:00 +0200
Subject[PATCH 1/3] iio: magnetometer: mmc35240: Fix crash in pm suspend
Message-ID<pM9QC-3qE-7@gated-at.bofh.it>
In reply to#1183757
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

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
---
 drivers/iio/magnetometer/mmc35240.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c
index 7a2ea71..e89b059 100644
--- a/drivers/iio/magnetometer/mmc35240.c
+++ b/drivers/iio/magnetometer/mmc35240.c
@@ -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;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1187556 — Re: [PATCH 1/3] iio: magnetometer: mmc35240: Fix crash in pm suspend

FromJonathan Cameron <jic23@kernel.org>
Date2015-07-19 12:50 +0200
SubjectRe: [PATCH 1/3] iio: magnetometer: mmc35240: Fix crash in pm suspend
Message-ID<pNUkq-gZ-9@gated-at.bofh.it>
In reply to#1183760
On 14/07/15 15:56, Daniel Baluta wrote:
> 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
> 
> Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Applied to the fixes-togreg branch of iio.git

Thanks,
> ---
>  drivers/iio/magnetometer/mmc35240.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c
> index 7a2ea71..e89b059 100644
> --- a/drivers/iio/magnetometer/mmc35240.c
> +++ b/drivers/iio/magnetometer/mmc35240.c
> @@ -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;
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1183763 — [PATCH 2/3] iio: magnetometer: mmc35240: Fix SET/RESET mask

FromDaniel Baluta <daniel.baluta@intel.com>
Date2015-07-14 17:00 +0200
Subject[PATCH 2/3] iio: magnetometer: mmc35240: Fix SET/RESET mask
Message-ID<pM9QC-3qE-17@gated-at.bofh.it>
In reply to#1183757
This fixes setting the SET/RESET bit in the REG_CTRL0
register.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
---
 drivers/iio/magnetometer/mmc35240.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c
index e89b059..f4d7495 100644
--- a/drivers/iio/magnetometer/mmc35240.c
+++ b/drivers/iio/magnetometer/mmc35240.c
@@ -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)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1187558 — Re: [PATCH 2/3] iio: magnetometer: mmc35240: Fix SET/RESET mask

FromJonathan Cameron <jic23@kernel.org>
Date2015-07-19 13:00 +0200
SubjectRe: [PATCH 2/3] iio: magnetometer: mmc35240: Fix SET/RESET mask
Message-ID<pNUu6-sz-1@gated-at.bofh.it>
In reply to#1183763
On 14/07/15 15:56, Daniel Baluta wrote:
> This fixes setting the SET/RESET bit in the REG_CTRL0
> register.
> 
> Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Applied to the fixes-togreg branch of iio.git

Thanks,
> ---
>  drivers/iio/magnetometer/mmc35240.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c
> index e89b059..f4d7495 100644
> --- a/drivers/iio/magnetometer/mmc35240.c
> +++ b/drivers/iio/magnetometer/mmc35240.c
> @@ -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)
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web