All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] gpio: add gpio_set_direction
@ 2010-02-26 23:26 Ben Gardner
  2010-02-26 23:26 ` [PATCH 1/3] gpiolib: add gpio_set_direction() Ben Gardner
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Ben Gardner @ 2010-02-26 23:26 UTC (permalink / raw)
  To: linux-kernel, Andres Salomon, Andrew Morton; +Cc: Ben Gardner

The OLPC uses a GPIO output to enable/disable the MIC input.
The code uses gpio_get_value() to retrive the current MIC enabled status.
Due to a recent fix to cs5535-gpio, that function returns the input value.
Since the input is not enabled, the input value does not match the output.
gpiolib doesn't currently have the ability to enable both input and output. 
Nor does gpiolib have the ability to retrieve the current output value.

There are several ways to fix this MIC problem.
1) keep track of the output value in the audio driver and do not use
gpio_get_value().

2) add a new gpiolib function to retrieve the output value.                  

3) add a way to set the GPIO bidirectional, so the read retrieves the real
value that the MIC circuitry would see.

Since the CS5535 GPIO pins has independant control of the input and output,
I went with the last option.

This patchset merges the gpio_direction_input() and gpio_direction_output()
function into gpio_set_direction().                                 
The direction parameter is a bit field, so the direction can be one of
none, in, out, inout.
The cs5535-gpio driver is updated to support set_direction() and 
cs5535audio_olpc is updated to set the GPIO in bidirectional mode.

Ben Gardner (3):
  gpiolib: add gpio_set_direction()
  cs5535-gpio: Use set_direction
  OLPC: ALSA: fix cs5535audio's MIC GPIO to enable input

 drivers/gpio/cs5535-gpio.c               |   34 ++++-----
 drivers/gpio/gpiolib.c                   |  123 +++++++++++++++---------------
 include/asm-generic/gpio.h               |    6 ++
 include/linux/gpio.h                     |    5 +
 sound/pci/cs5535audio/cs5535audio_olpc.c |    2 +-
 5 files changed, 89 insertions(+), 81 deletions(-)


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

end of thread, other threads:[~2010-03-01 10:35 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-26 23:26 [PATCH 0/3] gpio: add gpio_set_direction Ben Gardner
2010-02-26 23:26 ` [PATCH 1/3] gpiolib: add gpio_set_direction() Ben Gardner
2010-02-26 23:39   ` Andres Salomon
2010-02-27  5:11     ` Ben Gardner
2010-02-27  7:02   ` David Brownell
2010-02-27 10:26     ` Mark Brown
2010-02-27 16:24       ` David Brownell
2010-02-27 17:20         ` Mark Brown
2010-02-27 17:51           ` David Brownell
2010-03-01 10:35             ` Mark Brown
2010-02-27 18:36     ` Ben Gardner
2010-02-27 19:23       ` David Brownell
2010-02-27 18:36   ` [PATCH] cs5535-gpio: change input/output enable to match gpiolib expectations Ben Gardner
2010-02-27 18:40     ` Ben Gardner
2010-02-27 18:56   ` [PATCH v2] " Ben Gardner
2010-02-27 19:18     ` David Brownell
2010-02-26 23:26 ` [PATCH 2/3] cs5535-gpio: Use set_direction Ben Gardner
2010-02-27  7:04   ` David Brownell
2010-02-27 18:18     ` Ben Gardner
2010-02-26 23:26 ` [PATCH 3/3] OLPC: ALSA: fix cs5535audio's MIC GPIO to enable input Ben Gardner
2010-02-27  7:14   ` David Brownell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.