public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MFD: AB8500 mask off irrelevant bits from the SPI message
@ 2010-05-28  0:59 Linus Walleij
  2010-06-17 16:46 ` Linus Walleij
  2010-06-18 21:19 ` Samuel Ortiz
  0 siblings, 2 replies; 4+ messages in thread
From: Linus Walleij @ 2010-05-28  0:59 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, Srinidhi Kasagar, Linus Walleij

The registers on the AB8500 are only 8 bits wide, so the content
of the remaining bits is undefined. Let's mask off the undefined
stuff when returning a register in an SPI read.

Acked-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
---
 drivers/mfd/ab8500-spi.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/mfd/ab8500-spi.c b/drivers/mfd/ab8500-spi.c
index b81d4f7..e1c8b62 100644
--- a/drivers/mfd/ab8500-spi.c
+++ b/drivers/mfd/ab8500-spi.c
@@ -68,7 +68,12 @@ static int ab8500_spi_read(struct ab8500 *ab8500, u16 addr)
 
 	ret = spi_sync(spi, &msg);
 	if (!ret)
-		ret = ab8500->rx_buf[0];
+		/*
+		 * Only the 8 lowermost bytes are
+		 * defined with value, the rest may
+		 * vary depending on chip/board noise.
+		 */
+		ret = ab8500->rx_buf[0] & 0xFFU;
 
 	return ret;
 }
-- 
1.6.3.3


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

* Re: [PATCH] MFD: AB8500 mask off irrelevant bits from the SPI message
  2010-05-28  0:59 [PATCH] MFD: AB8500 mask off irrelevant bits from the SPI message Linus Walleij
@ 2010-06-17 16:46 ` Linus Walleij
  2010-06-17 19:18   ` Samuel Ortiz
  2010-06-18 21:19 ` Samuel Ortiz
  1 sibling, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2010-06-17 16:46 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, Srinidhi Kasagar, Linus Walleij

2010/5/28 Linus Walleij <linus.walleij@stericsson.com>:

> The registers on the AB8500 are only 8 bits wide, so the content
> of the remaining bits is undefined. Let's mask off the undefined
> stuff when returning a register in an SPI read.

Are you picking this one up Samuel?

Yours,
Linus Walleij

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

* Re: [PATCH] MFD: AB8500 mask off irrelevant bits from the SPI message
  2010-06-17 16:46 ` Linus Walleij
@ 2010-06-17 19:18   ` Samuel Ortiz
  0 siblings, 0 replies; 4+ messages in thread
From: Samuel Ortiz @ 2010-06-17 19:18 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-kernel, Srinidhi Kasagar

Hi Linus,

On Thu, Jun 17, 2010 at 06:46:42PM +0200, Linus Walleij wrote:
> 2010/5/28 Linus Walleij <linus.walleij@stericsson.com>:
> 
> > The registers on the AB8500 are only 8 bits wide, so the content
> > of the remaining bits is undefined. Let's mask off the undefined
> > stuff when returning a register in an SPI read.
> 
> Are you picking this one up Samuel?
Yes, sorry for the delay, I've been quite busy with other projects but will go
through my MFD backlog in a day or 2.

Cheers,
Samuel.


> Yours,
> Linus Walleij

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

* Re: [PATCH] MFD: AB8500 mask off irrelevant bits from the SPI message
  2010-05-28  0:59 [PATCH] MFD: AB8500 mask off irrelevant bits from the SPI message Linus Walleij
  2010-06-17 16:46 ` Linus Walleij
@ 2010-06-18 21:19 ` Samuel Ortiz
  1 sibling, 0 replies; 4+ messages in thread
From: Samuel Ortiz @ 2010-06-18 21:19 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-kernel, Srinidhi Kasagar

Hi Linus,

On Fri, May 28, 2010 at 02:59:44AM +0200, Linus Walleij wrote:
> The registers on the AB8500 are only 8 bits wide, so the content
> of the remaining bits is undefined. Let's mask off the undefined
> stuff when returning a register in an SPI read.
Patch applied, sorry for the delay.

Cheers,
Samuel.


> Acked-by: Rabin Vincent <rabin.vincent@stericsson.com>
> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
> ---
>  drivers/mfd/ab8500-spi.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mfd/ab8500-spi.c b/drivers/mfd/ab8500-spi.c
> index b81d4f7..e1c8b62 100644
> --- a/drivers/mfd/ab8500-spi.c
> +++ b/drivers/mfd/ab8500-spi.c
> @@ -68,7 +68,12 @@ static int ab8500_spi_read(struct ab8500 *ab8500, u16 addr)
>  
>  	ret = spi_sync(spi, &msg);
>  	if (!ret)
> -		ret = ab8500->rx_buf[0];
> +		/*
> +		 * Only the 8 lowermost bytes are
> +		 * defined with value, the rest may
> +		 * vary depending on chip/board noise.
> +		 */
> +		ret = ab8500->rx_buf[0] & 0xFFU;
>  
>  	return ret;
>  }
> -- 
> 1.6.3.3
> 

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

end of thread, other threads:[~2010-06-18 21:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-28  0:59 [PATCH] MFD: AB8500 mask off irrelevant bits from the SPI message Linus Walleij
2010-06-17 16:46 ` Linus Walleij
2010-06-17 19:18   ` Samuel Ortiz
2010-06-18 21:19 ` Samuel Ortiz

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