linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MAX7301 GPIO fix portconfig
@ 2009-09-18 12:56 Jan Weitzel
  0 siblings, 0 replies; only message in thread
From: Jan Weitzel @ 2009-09-18 12:56 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: jbe-bIcnvbaLZ9MEGnE8C9+IrQ

Fix wrong setting of portconfig register. 
mask size is 2bits, so shift must be twice offset
direction input value is 2

Signed-off-by: Jan Weitzel <J.Weitzel-guT5V/WYfQezQB+pC5nmwQ@public.gmane.org>
---
Index: linux-2.6.28/drivers/gpio/max7301.c
===================================================================
--- linux-2.6.28.orig/drivers/gpio/max7301.c
+++ linux-2.6.28/drivers/gpio/max7301.c
@@ -123,7 +123,7 @@ static int max7301_direction_input(struc
 
 	/* Standard GPIO API doesn't support pull-ups, has to be extended.
 	 * Hard-coding no pollup for now. */
-	*config = (*config & ~(3 << (offset & 3))) | (1 << (offset & 3));
+	*config = (*config & ~(3 << (2*(offset & 3)))) | (2 << (2*(offset & 3)));
 
 	ret = max7301_write(ts->spi, 0x08 + (offset >> 2), *config);
 
@@ -157,7 +157,7 @@ static int max7301_direction_output(stru
 
 	mutex_lock(&ts->lock);
 
-	*config = (*config & ~(3 << (offset & 3))) | (1 << (offset & 3));
+	*config = (*config & ~(3 << (2*(offset & 3)))) | (1 << (2*(offset & 3)));
 
 	ret = __max7301_set(ts, offset, value);
 

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-09-18 12:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-18 12:56 [PATCH] MAX7301 GPIO fix portconfig Jan Weitzel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).