Re: [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders

Previous thread: [PATCH v2 3/4] da850-evm: extract defines for SEL{A,B,C} pins in UI expander by Ben Gardiner on Tuesday, November 16, 2010 - 12:39 pm. (3 messages)

Next thread: [PATCH] ipc: explicitly clear stack memory for shminfo by Kees Cook on Tuesday, November 16, 2010 - 12:58 pm. (4 messages)
From: Ben Gardiner
Date: Tuesday, November 16, 2010 - 12:39 pm

The da850-evm baseboard (BB) and its UI board both have tca6416 IO expanders.
They are bootstrapped to different I2C addresses so they can be used
concurrently.

The expander on the UI board is currently used to enable/disable the
peripherals that are available on the UI board. In addition to this
functionality the expander is also connected to 8 pushbuttons. The expander
on the baseboard is not currently used; it is connected to deep sleep enable,
sw reset, a push button, some switches and LEDs.

This proposed patch series enables the push buttons and switches on the UI and
BB expanders using the gpio-keys polling mode patch by Alexander Clouter. Some
work was performed to test irq-based gpio-keys support on the expanders (a WIP
patch can be posted on request) but I believe that it is not possible to use 
irq-based gpio-keys on IO expanders for arm systems at this time. 

The attempt started when I noticed the patch of Alek Du and Alan Cox [1] which 
was recently committed [2]; a stab at integrating irq-based gpio-keys support
based on that patch was attempted. I found that I either got a warning that the
irq could not be mapped for the given gpio ; or, when N_IRQ was increased, a
system freeze.

From what I have read (particularly the message by Grant Likely [3]) IRQs on
IO expanders are not ready in ARM yet. I _think_ that the sparse IRQ rework by
Thomas Gleixner [4] will resolve the blocker to irq-based gpio-keys support. 

In the meantime we have buttons and switches that we would like to excersise
in our prototyping development. The patch to convert this series to irq-based
gpio-keys will be straighforward once the support in arch/arm is there.

There is an existing tca6416-keypad driver with polling support which I did not
employ because it isn't possible to keep the gpio's used for peripheral
enable/disable on the UI board or the LEDs on the baseboard registered while
simultaneously registering the pushbuttons or switches as a tca6416-keypad 
instance.

I tested ...
From: Ben Gardiner
Date: Friday, November 19, 2010 - 2:37 pm

The da850-evm baseboard (BB) and its UI board both have tca6416 IO expanders.
They are bootstrapped to different I2C addresses so they can be used
concurrently.

The expander on the UI board is currently used to enable/disable the
peripherals that are available on the UI board. In addition to this
functionality the expander is also connected to 8 pushbuttons. The expander
on the baseboard is not currently used; it is connected to deep sleep enable,
sw reset, a push button, some switches and LEDs.

This proposed patch series enables the push buttons and switches on the UI and
BB expanders using the gpio-keys polling mode patch by Alexander Clouter. Some
work was performed to test irq-based gpio-keys support on the expanders (a WIP
patch can be posted on request) but I believe that it is not possible to use 
irq-based gpio-keys on IO expanders for arm systems at this time. 

The attempt started when I noticed the patch of Alek Du and Alan Cox [1] which 
was recently committed [2]; a stab at integrating irq-based gpio-keys support
based on that patch was attempted. I found that I either got a warning that the
irq could not be mapped for the given gpio ; or, when N_IRQ was increased, a
system freeze.

From what I have read (particularly the message by Grant Likely [3]) IRQs on
IO expanders are not ready in ARM yet. I _think_ that the sparse IRQ rework by
Thomas Gleixner [4] will resolve the blocker to irq-based gpio-keys support. 

In the meantime we have buttons and switches that we would like to excersise
in our prototyping development. The patch to convert this series to irq-based
gpio-keys will be straighforward once the support in arch/arm is there.

There is an existing tca6416-keypad driver with polling support which I did not
employ because it isn't possible to keep the gpio's used for peripheral
enable/disable on the UI board or the LEDs on the baseboard registered while
simultaneously registering the pushbuttons or switches as a tca6416-keypad 
instance.

I tested ...
From: Ben Gardiner
Date: Friday, November 19, 2010 - 2:37 pm

This patch adds EV_KEYs for each of the 8 pushbuttons on the UI board via a
gpio-key device.

The expander is a tca6416; it controls the SEL_{A,B,C} lines which enable and
disable the peripherals found on the UI board in addition to the 8 pushbuttons
mentioned above. The reason the existing tca6416-keypad driver is not employed
is because there was no aparent way to keep the gpio lines used as
SEL_{A,B,C} registered while simultaneously registering the pushbuttons as a
tca6416-keypad instance.

Some experimentation with the polling interval was performed; we were searching
for the largest polling interval that did not affect the feel of the
responsiveness of the buttons. It is very subjective but 200ms seems to be a
good value that accepts firm pushes but rejects very light ones. The key values
assigned to the buttons were arbitrarily chosen to be F1-F8.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Reviewed-by: Chris Cordahi <christophercordahi@nanometrics.ca>
CC: Govindarajan, Sriramakrishnan <srk@ti.com>
Reviewed-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>

---

Changes since v2:
 * rebased to 083eae3e28643e0eefc5243719f8b1572cf98299 of
   git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git
 * remove the "TODO : populate at runtime using" in this patch instead of 4/4
   (Nori, Sekhar)
 * integrated the static array initialization patch of Sekhar Nori
 * use static array initialization ranges
 * rename DA850_PB_POLL_MS to DA850_GPIO_KEYS_POLL_MS
 * use shorter names prefixed with da850_evm

Changes since v1:
 * set INPUT_POLLDEV default for DA850_EVM machine, but don't select it
   unconditionally
 * adding note to description about why tca6416-keypad was not used
 * adding Govindarajan, Sriramakrishnan, the author of the tca6416-keypad
   driver

---
 arch/arm/mach-davinci/Kconfig           |    3 +
 arch/arm/mach-davinci/board-da850-evm.c |   98 ++++++++++++++++++++++++++++++-
 2 files changed, 100 ...
From: Ben Gardiner
Date: Friday, November 19, 2010 - 2:37 pm

The setup and teardown methods of the UI expander reference the SEL_{A,B,C}
pins by 'magic number' in each function. This uses the common enum for their offsets
in the expander setup and teardown functions.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Reviewed-by: Chris Cordahi <christophercordahi@nanometrics.ca>
Reviewed-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>

---

Changes since v2:
 * rebased to 083eae3e28643e0eefc5243719f8b1572cf98299 of
   git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git
 * integrated the static array initialization patch provided by Sekhar Nori

Changes since v1:
 * No changes since v1

---
 arch/arm/mach-davinci/board-da850-evm.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index b0763f7..c689e7e 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -361,23 +361,23 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
 {
 	int sel_a, sel_b, sel_c, ret;
 
-	sel_a = gpio + 7;
-	sel_b = gpio + 6;
-	sel_c = gpio + 5;
+	sel_a = gpio + DA850_EVM_UI_EXP_SEL_A;
+	sel_b = gpio + DA850_EVM_UI_EXP_SEL_B;
+	sel_c = gpio + DA850_EVM_UI_EXP_SEL_C;
 
-	ret = gpio_request(sel_a, "sel_a");
+	ret = gpio_request(sel_a, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_A]);
 	if (ret) {
 		pr_warning("Cannot open UI expander pin %d\n", sel_a);
 		goto exp_setup_sela_fail;
 	}
 
-	ret = gpio_request(sel_b, "sel_b");
+	ret = gpio_request(sel_b, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_B]);
 	if (ret) {
 		pr_warning("Cannot open UI expander pin %d\n", sel_b);
 		goto exp_setup_selb_fail;
 	}
 
-	ret = gpio_request(sel_c, "sel_c");
+	ret = gpio_request(sel_c, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_C]);
 	if (ret) {
 		pr_warning("Cannot open UI expander pin %d\n", sel_c);
 		goto ...
From: Victor Rodriguez
Date: Friday, November 19, 2010 - 2:41 pm

On Fri, Nov 19, 2010 at 3:37 PM, Ben Gardiner

I think that ther must be just one   --- , This is extra

Regards

--

From: Ben Gardiner
Date: Friday, November 19, 2010 - 3:25 pm

Hi Victor,

On Fri, Nov 19, 2010 at 4:41 PM, Victor Rodriguez <vm.rod25@gmail.com> wrote:

Sorry, that is my bad habit. I believe that the patch should still be
usable as-is.

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca
--

From: Ben Gardiner
Date: Friday, November 19, 2010 - 2:37 pm

This patch adds a pca953x platform device for the tca6416 found on the evm
baseboard. The tca6416 is a GPIO expander, also found on the UI board at a
separate I2C address. The pins of the baseboard IO expander are connected to
software reset, deep sleep enable, test points, a push button, DIP switches and
LEDs.

Add support for the push button, DIP switches and LEDs and test points (as
free GPIOs). The reset and deep sleep enable connections are reserved by the
setup routine so that userspace can't toggle those lines.

The existing tca6416-keypad driver was not employed because there was no
apararent way to register the LEDs connected to gpio's on the tca6416 while
simultaneously registering the tca6416-keypad instance.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Reviewed-by: Chris Cordahi <christophercordahi@nanometrics.ca>
CC: Govindarajan, Sriramakrishnan <srk@ti.com>
Reviewed-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

---

Changes since v2:
 * rebased to 083eae3e28643e0eefc5243719f8b1572cf98299 of
  git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git
 * remove the "TODO : populate at runtime using" in 1/4 instead of this patch
  (Nori, Sekhar)
 * ui_expander_names was renamed to da850_evm_ui_exp
 * DA850_SW_POLL_MS definition moved to this patch from 3/4
 * use indexed array initialization pattern introduced by Sekhar Nori in 3/4
 * shorter names prefixed with da850_evm
 * static array range intializers
 * using only a single gpio-keys instance for the pushbutton and switches on
   baseboard since there is no advantage to separate device instances with 
   different polling intervals (Dmitry Torokhov)

Changes since v1:
 * adding note about why the tca6416-keypad driver was not used.
 * adding Govindarajan, Sriramakrishnan, the author of the tca6416-keypad
   driver

---
 arch/arm/mach-davinci/board-da850-evm.c |  225 +++++++++++++++++++++++++++++++
 1 files changed, 225 ...
From: Ben Gardiner
Date: Friday, November 19, 2010 - 2:37 pm

From: Alexander Clouter <alex@digriz.org.uk>

This implements an optional polling mode for the gpio_keys driver,
necessary for GPIOs that are not able to generate IRQs.

gpio_keys_platform_data has been extended with poll_interval
which specifies the polling interval in ms, this is passed onto
input-polldev.

This work is a rebase of the patch by Alex Clouter [1] which was
based on the patch [2] originally conceived by Paul Mundt.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Alexander Clouter <alex@digriz.org.uk>
Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Reviewed-by: Chris Cordahi <christophercordahi@nanometrics.ca>
CC: Paul Mundt <lethal@linux-sh.org>

[1] http://article.gmane.org/gmane.linux.kernel.input/13919
[2] http://article.gmane.org/gmane.linux.kernel.input/5814

---

Changes since v2:
 * rebased to 083eae3e28643e0eefc5243719f8b1572cf98299 of
  git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git

Changes since v1:
 * use locally defined functions that are no-ops/error checkers when
  INPUT_POLLDEV is not defined.
 * disable polling mode support when input-polldev is a module and gpio_keys
  is builtin

Changes since [1]:
 * rebased to 0b1c3ef1072f2b97c86351d3736d2b2d00293a11 of
  git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git
 * use _cansleep variant of gpio_get_value in the polling task
  to avoid WARN_ON when using I2C GPIO expanders
 * prevent unitialized access to 'input' in gpio_keys_close()

Changes since [2]:
 * absolute dependency on INPUT_POLLDEV removed

Tested with CONFIG_INPUT_POLLDEV={n,m,y} (gpio_keys as module for 'm').

---
 drivers/input/keyboard/gpio_keys.c |  120 ++++++++++++++++++++++++++++++------
 include/linux/gpio_keys.h          |    1 +
 2 files changed, 103 insertions(+), 18 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 6069abe..d2f23d9 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ ...
From: Ben Gardiner
Date: Tuesday, November 23, 2010 - 12:40 pm

The da850-evm baseboard (BB) and its UI board both have tca6416 IO expanders.
They are bootstrapped to different I2C addresses so they can be used
concurrently.

The expander on the UI board is currently used to enable/disable the
peripherals that are available on the UI board. In addition to this
functionality the expander is also connected to 8 pushbuttons. The expander
on the baseboard is not currently used; it is connected to deep sleep enable,
sw reset, a push button, some switches and LEDs.

This proposed patch series enables the push buttons and switches on the UI and
BB expanders using the gpio-keys polling mode patch by Alexander Clouter. Some
work was performed to test irq-based gpio-keys support on the expanders (a WIP
patch can be posted on request) but I believe that it is not possible to use 
irq-based gpio-keys on IO expanders for arm systems at this time. 

The attempt started when I noticed the patch of Alek Du and Alan Cox [1] which 
was recently committed [2]; a stab at integrating irq-based gpio-keys support
based on that patch was attempted. I found that I either got a warning that the
irq could not be mapped for the given gpio ; or, when N_IRQ was increased, a
system freeze.

From what I have read (particularly the message by Grant Likely [3]) IRQs on
IO expanders are not ready in ARM yet. I _think_ that the sparse IRQ rework by
Thomas Gleixner [4] will resolve the blocker to irq-based gpio-keys support. 

In the meantime we have buttons and switches that we would like to excersise
in our prototyping development. The patch to convert this series to irq-based
gpio-keys will be straighforward once the support in arch/arm is there.

There is an existing tca6416-keypad driver with polling support which I did not
employ because it isn't possible to keep the gpio's used for peripheral
enable/disable on the UI board or the LEDs on the baseboard registered while
simultaneously registering the pushbuttons or switches as a tca6416-keypad 
instance.

I tested ...
From: Ben Gardiner
Date: Tuesday, November 23, 2010 - 12:40 pm

This patch adds EV_KEYs for each of the 8 pushbuttons on the UI board via a
gpio-key device.

The expander is a tca6416; it controls the SEL_{A,B,C} lines which enable and
disable the peripherals found on the UI board in addition to the 8 pushbuttons
mentioned above. The reason the existing tca6416-keypad driver is not employed
is because there was no aparent way to keep the gpio lines used as
SEL_{A,B,C} registered while simultaneously registering the pushbuttons as a
tca6416-keypad instance.

Some experimentation with the polling interval was performed; we were searching
for the largest polling interval that did not affect the feel of the
responsiveness of the buttons. It is very subjective but 200ms seems to be a
good value that accepts firm pushes but rejects very light ones. The key values
assigned to the buttons were arbitrarily chosen to be F1-F8.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Reviewed-by: Chris Cordahi <christophercordahi@nanometrics.ca>
CC: Govindarajan, Sriramakrishnan <srk@ti.com>
Reviewed-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
CC: Kevin Hilman <khilman@deeprootsystems.com>

---

Changes since v3:
 * extracted Kconfig changes to patch 5/5
 * fixed leading whitespace problem

Changes since v2:
 * rebased to 083eae3e28643e0eefc5243719f8b1572cf98299 of
   git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git
 * remove the "TODO : populate at runtime using" in this patch instead of 4/4
   (Nori, Sekhar)
 * integrated the static array initialization patch of Sekhar Nori
 * use static array initialization ranges
 * rename DA850_PB_POLL_MS to DA850_GPIO_KEYS_POLL_MS
 * use shorter names prefixed with da850_evm

Changes since v1:
 * set INPUT_POLLDEV default for DA850_EVM machine, but don't select it
   unconditionally
 * adding note to description about why tca6416-keypad was not used
 * adding Govindarajan, Sriramakrishnan, the author of the tca6416-keypad
   driver

---
 ...
From: Nori, Sekhar
Date: Wednesday, November 24, 2010 - 6:16 am

Hi Ben,

I have some minor comments on this patch. You could
wait for other pending items to get resolved before
posting a re-spin.


No need of zero/NULL initialization in structures above

Line-breaking an error message is not preferred since it becomes
difficult to grep in code. Looking at this message, you could drop

Random white space change?

Thanks,
Sekhar

--

From: Ben Gardiner
Date: Wednesday, November 24, 2010 - 10:16 am

Hi Sekhar,



It my opinion -- please tell me if it is wrong :) -- that explicit
initialization of platform data members is better than implicit
initialization; future developers and browsers of the code can see
that wakeup events are disabled as are auto-repeats.

I also included the .desc = NULL explicitly to indicate that it would
be populated at runtime so that future developers who grep the code
would know to look for a runtime initialization.

The .id = 0 is there since the bb keys get .id = 1.

As I said please tell me if you would still like me to remove this

Interesting point. Thank you, I really apreciate all the knowledge you
are imparting to me throughout this process. I will remove the "

Oops, yes -- I am relying to heavily on checkpatch.pl to tell me about
my mistakes. I should be reviewing my patches more closely. Thank you
again.

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca
--

From: Ben Gardiner
Date: Tuesday, November 23, 2010 - 12:40 pm

From: Alexander Clouter <alex@digriz.org.uk>

This implements an optional polling mode for the gpio_keys driver,
necessary for GPIOs that are not able to generate IRQs.

gpio_keys_platform_data has been extended with poll_interval
which specifies the polling interval in ms, this is passed onto
input-polldev.

This work is a rebase of the patch by Alex Clouter [1] which was
based on the patch [2] originally conceived by Paul Mundt.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Alexander Clouter <alex@digriz.org.uk>
Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Reviewed-by: Chris Cordahi <christophercordahi@nanometrics.ca>
CC: Paul Mundt <lethal@linux-sh.org>

[1] http://article.gmane.org/gmane.linux.kernel.input/13919
[2] http://article.gmane.org/gmane.linux.kernel.input/5814

---

Changes since v3:
 * no changes to this patch in the series

Changes since v2:
 * rebased to 083eae3e28643e0eefc5243719f8b1572cf98299 of
  git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git

Changes since v1:
 * use locally defined functions that are no-ops/error checkers when
  INPUT_POLLDEV is not defined.
 * disable polling mode support when input-polldev is a module and gpio_keys
  is builtin

Changes since [1]:
 * rebased to 0b1c3ef1072f2b97c86351d3736d2b2d00293a11 of
  git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git
 * use _cansleep variant of gpio_get_value in the polling task
  to avoid WARN_ON when using I2C GPIO expanders
 * prevent unitialized access to 'input' in gpio_keys_close()

Changes since [2]:
 * absolute dependency on INPUT_POLLDEV removed

Tested with CONFIG_INPUT_POLLDEV={n,m,y} (gpio_keys as module for 'm').

---
 drivers/input/keyboard/gpio_keys.c |  120 ++++++++++++++++++++++++++++++------
 include/linux/gpio_keys.h          |    1 +
 2 files changed, 103 insertions(+), 18 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index ...
From: Ben Gardiner
Date: Tuesday, November 23, 2010 - 12:41 pm

Use the mach-davinci/Kconfig to enable gpio-keys as default when da850-evm
machine is enabled and to also select INPUT_POLLDEV when gpio-keys is enabled.

INPUT_POLLDEV needs to be enabled for gpio-keys devices to function properly
on da850-evm.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Kevin Hilman <khilman@deeprootsystems.com>
CC: "Nori, Sekhar" <nsekhar@ti.com>

---

Changes since v3:
 * no changes in this patch of the series / this patch was introduced in v4 of
   the series

---
 arch/arm/mach-davinci/Kconfig |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index 84066e8..70d1758 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -180,6 +180,10 @@ endchoice
 config GPIO_PCA953X
 	default MACH_DAVINCI_DA850_EVM
 
+config KEYBOARD_GPIO
+	default MACH_DAVINCI_DA850_EVM
+	select INPUT_POLLDEV if MACH_DAVINCI_DA850_EVM
+
 config MACH_TNETV107X
 	bool "TI TNETV107X Reference Platform"
 	default ARCH_DAVINCI_TNETV107X
-- 
1.7.0.4

--

From: Ben Gardiner
Date: Tuesday, November 23, 2010 - 12:40 pm

This patch adds a pca953x platform device for the tca6416 found on the evm
baseboard. The tca6416 is a GPIO expander, also found on the UI board at a
separate I2C address. The pins of the baseboard IO expander are connected to
software reset, deep sleep enable, test points, a push button, DIP switches and
LEDs.

Add support for the push button, DIP switches and LEDs and test points (as
free GPIOs). The reset and deep sleep enable connections are reserved by the
setup routine so that userspace can't toggle those lines.

The existing tca6416-keypad driver was not employed because there was no
apararent way to register the LEDs connected to gpio's on the tca6416 while
simultaneously registering the tca6416-keypad instance.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Reviewed-by: Chris Cordahi <christophercordahi@nanometrics.ca>
CC: Govindarajan, Sriramakrishnan <srk@ti.com>
Reviewed-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

---

Changes since v3:
 * don't request sw_rst and deep_sleep_en gpio pins -- let clients use them
   freely

Changes since v2:
 * rebased to 083eae3e28643e0eefc5243719f8b1572cf98299 of
   git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git
 * remove the "TODO : populate at runtime using" in 1/4 instead of this patch
  (Nori, Sekhar)
 * ui_expander_names was renamed to da850_evm_ui_exp
 * DA850_SW_POLL_MS definition moved to this patch from 3/4
 * use indexed array initialization pattern introduced by Sekhar Nori in 3/4
 * shorter names prefixed with da850_evm
 * static array range intializers
 * using only a single gpio-keys instance for the pushbutton and switches on
   baseboard since there is no advantage to separate device instances with
   different polling intervals (Dmitry Torokhov)

Changes since v1:
 * adding note about why the tca6416-keypad driver was not used.
 * adding Govindarajan, Sriramakrishnan, the author of the tca6416-keypad
   driver

---
 ...
From: Ben Gardiner
Date: Tuesday, November 23, 2010 - 12:40 pm

The setup and teardown methods of the UI expander reference the SEL_{A,B,C}
pins by 'magic number' in each function. This uses the common enum for their offsets
in the expander setup and teardown functions.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Reviewed-by: Chris Cordahi <christophercordahi@nanometrics.ca>
Reviewed-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
CC: Victor Rodriguez <vm.rod25@gmail.com>

---

Changes since v3:
 * no changes in this patch of the series

Changes since v2:
 * rebased to 083eae3e28643e0eefc5243719f8b1572cf98299 of
   git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git
 * integrated the static array initialization patch provided by Sekhar Nori

Changes since v1:
 * No changes since v1

---
 arch/arm/mach-davinci/board-da850-evm.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 51f5ffa..420b628 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -361,23 +361,23 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
 {
 	int sel_a, sel_b, sel_c, ret;
 
-	sel_a = gpio + 7;
-	sel_b = gpio + 6;
-	sel_c = gpio + 5;
+	sel_a = gpio + DA850_EVM_UI_EXP_SEL_A;
+	sel_b = gpio + DA850_EVM_UI_EXP_SEL_B;
+	sel_c = gpio + DA850_EVM_UI_EXP_SEL_C;
 
-	ret = gpio_request(sel_a, "sel_a");
+	ret = gpio_request(sel_a, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_A]);
 	if (ret) {
 		pr_warning("Cannot open UI expander pin %d\n", sel_a);
 		goto exp_setup_sela_fail;
 	}
 
-	ret = gpio_request(sel_b, "sel_b");
+	ret = gpio_request(sel_b, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_B]);
 	if (ret) {
 		pr_warning("Cannot open UI expander pin %d\n", sel_b);
 		goto exp_setup_selb_fail;
 	}
 
-	ret = gpio_request(sel_c, "sel_c");
+	ret = gpio_request(sel_c, ...
From: Ben Gardiner
Date: Wednesday, November 24, 2010 - 2:59 pm

Note: I must regrettably move on to other projects for awhile and will thus
be unavailable to continue this integration effort. I am posting the most
recent version of the series with a modified version of Gabor Juho's driver
in the hopes that it will make the integration effort easier for whoever picks
up the task when the time is right -- whether or not that is me.

My apologies for the patchbomb. I will do my best to make time for reviews 
and testing of any future versions of the series.

Best Regards,
Ben Gardiner

---

The da850-evm baseboard (BB) and its UI board both have tca6416 IO expanders.
They are bootstrapped to different I2C addresses so they can be used
concurrently.

The expander on the UI board is currently used to enable/disable the
peripherals that are available on the UI board. In addition to this
functionality the expander is also connected to 8 pushbuttons. The expander
on the baseboard is not currently used; it is connected to deep sleep enable,
sw reset, a push button, some switches and LEDs.

This proposed patch series enables the push buttons and switches on the UI and
BB expanders using the gpio-keys polling mode patch by Gabor Juhos. Some
work was performed to test irq-based gpio-keys support on the expanders (a WIP
patch can be posted on request) but I believe that it is not possible to use 
irq-based gpio-keys on IO expanders for arm systems at this time. 

The attempt started when I noticed the patch of Alek Du and Alan Cox [1] which 
was recently committed [2]; a stab at integrating irq-based gpio-keys support
based on that patch was attempted. I found that I either got a warning that the
irq could not be mapped for the given gpio ; or, when N_IRQ was increased, a
system freeze.

From what I have read (particularly the message by Grant Likely [3]) IRQs on
IO expanders are not ready in ARM yet. I _think_ that the sparse IRQ rework by
Thomas Gleixner [4] will resolve the blocker to irq-based gpio-keys support. 

In the meantime we have ...
From: Ben Gardiner
Date: Wednesday, November 24, 2010 - 2:59 pm

From: Gabor Juhos <juhosg@openwrt.org>

The existing gpio-keys driver can be usable only for GPIO lines with
interrupt support. Several devices have buttons connected to a GPIO
line which is not capable to generate interrupts. This patch adds a
new input driver using the generic GPIO layer and the input-polldev
to support such buttons.

(WIP: this version has incorporated into it the changes I suggested in review
of the original patch by Gabor Junos. I am posting it as part of the da850-evm
series in the hopes that the final version produced by Gabor can be
substituted in its place when the time is right. I don't mean to imply that
this version of the patch should be integrated in the final series)

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: linux-input@vger.kernel.org
Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
---
 drivers/input/keyboard/Kconfig            |   16 ++
 drivers/input/keyboard/Makefile           |    2 +
 drivers/input/keyboard/gpio_keys_polled.c |  240 +++++++++++++++++++++++++++++
 include/linux/gpio_keys_polled.h          |   26 +++
 4 files changed, 284 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/keyboard/gpio_keys_polled.c
 create mode 100644 include/linux/gpio_keys_polled.h

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index b8c51b9..9648ff4 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -485,4 +485,20 @@ config KEYBOARD_W90P910
 	  To compile this driver as a module, choose M here: the
 	  module will be called w90p910_keypad.
 
+config KEYBOARD_GPIO_POLLED
+	tristate "Polled GPIO buttons"
+	depends on GENERIC_GPIO
+	select INPUT_POLLDEV
+	help
+	  This driver implements support for buttons connected
+	  to GPIO pins of various CPUs (and some other chips).
+
+	  Say Y here if your device has buttons connected
+	  directly to such GPIO pins.  Your ...
From: Ben Gardiner
Date: Wednesday, November 24, 2010 - 2:59 pm

The setup and teardown methods of the UI expander reference the SEL_{A,B,C}
pins by 'magic number' in each function. This uses the common enum for their offsets
in the expander setup and teardown functions.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Reviewed-by: Chris Cordahi <christophercordahi@nanometrics.ca>
Reviewed-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
CC: Victor Rodriguez <vm.rod25@gmail.com>

---

Changes since v4:
 * no changes in this patch of the series

Changes since v3:
 * no changes in this patch of the series

Changes since v2:
 * rebased to 083eae3e28643e0eefc5243719f8b1572cf98299 of
   git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git
 * integrated the static array initialization patch provided by Sekhar Nori

Changes since v1:
 * No changes since v1
---
 arch/arm/mach-davinci/board-da850-evm.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index f6490f8..8f7a605 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -360,23 +360,23 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
 {
 	int sel_a, sel_b, sel_c, ret;
 
-	sel_a = gpio + 7;
-	sel_b = gpio + 6;
-	sel_c = gpio + 5;
+	sel_a = gpio + DA850_EVM_UI_EXP_SEL_A;
+	sel_b = gpio + DA850_EVM_UI_EXP_SEL_B;
+	sel_c = gpio + DA850_EVM_UI_EXP_SEL_C;
 
-	ret = gpio_request(sel_a, "sel_a");
+	ret = gpio_request(sel_a, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_A]);
 	if (ret) {
 		pr_warning("Cannot open UI expander pin %d\n", sel_a);
 		goto exp_setup_sela_fail;
 	}
 
-	ret = gpio_request(sel_b, "sel_b");
+	ret = gpio_request(sel_b, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_B]);
 	if (ret) {
 		pr_warning("Cannot open UI expander pin %d\n", sel_b);
 		goto exp_setup_selb_fail;
 	}
 
-	ret = gpio_request(sel_c, ...
From: Ben Gardiner
Date: Wednesday, November 24, 2010 - 2:59 pm

Use the mach-davinci/Kconfig to enable gpio-keys-polled as default when
da850-evm machine is enabled.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Kevin Hilman <khilman@deeprootsystems.com>
CC: "Nori, Sekhar" <nsekhar@ti.com>
CC: Gabor Juhos <juhosg@openwrt.org>

---

Changes since v4:
 * integrated the use of Gabor Juhos' polled gpio buttons driver

Changes since v3:
 * no changes in this patch of the series / this patch was introduced in v4 of
   the series
---
 arch/arm/mach-davinci/Kconfig |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index 84066e8..b93c327 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -180,6 +180,9 @@ endchoice
 config GPIO_PCA953X
 	default MACH_DAVINCI_DA850_EVM
 
+config KEYBOARD_GPIO_POLLED
+	default MACH_DAVINCI_DA850_EVM
+
 config MACH_TNETV107X
 	bool "TI TNETV107X Reference Platform"
 	default ARCH_DAVINCI_TNETV107X
-- 
1.7.0.4

--

From: Ben Gardiner
Date: Wednesday, November 24, 2010 - 2:59 pm

This patch adds a pca953x platform device for the tca6416 found on the evm
baseboard. The tca6416 is a GPIO expander, also found on the UI board at a
separate I2C address. The pins of the baseboard IO expander are connected to
software reset, deep sleep enable, test points, a push button, DIP switches and
LEDs.

Add support for the push button, DIP switches and LEDs and test points (as
free GPIOs). The reset and deep sleep enable connections are reserved by the
setup routine so that userspace can't toggle those lines.

The existing tca6416-keypad driver was not employed because there was no
apararent way to register the LEDs connected to gpio's on the tca6416 while
simultaneously registering the tca6416-keypad instance.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Reviewed-by: Chris Cordahi <christophercordahi@nanometrics.ca>
CC: Govindarajan, Sriramakrishnan <srk@ti.com>
Reviewed-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
CC: Gabor Juhos <juhosg@openwrt.org>

---

Changes since v4:
 * integrated the use of Gabor Juhos' polled gpio buttons driver
 * removed extra indent (Sekhar Nori)
 * don't line-break error messages (Sekhar Nori)
 * left-in the explicit static initialization of structure members

Changes since v3:
 * don't request sw_rst and deep_sleep_en gpio pins -- let clients use them
   freely

Changes since v2:
 * rebased to 083eae3e28643e0eefc5243719f8b1572cf98299 of
   git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git
 * remove the "TODO : populate at runtime using" in 1/4 instead of this patch
  (Nori, Sekhar)
 * ui_expander_names was renamed to da850_evm_ui_exp
 * DA850_SW_POLL_MS definition moved to this patch from 3/4
 * use indexed array initialization pattern introduced by Sekhar Nori in 3/4
 * shorter names prefixed with da850_evm
 * static array range intializers
 * using only a single gpio-keys instance for the pushbutton and switches on
   baseboard since there is ...
From: Ben Gardiner
Date: Wednesday, November 24, 2010 - 2:59 pm

This patch adds EV_KEYs for each of the 8 pushbuttons on the UI board via a
gpio-key device.

The expander is a tca6416; it controls the SEL_{A,B,C} lines which enable and
disable the peripherals found on the UI board in addition to the 8 pushbuttons
mentioned above. The reason the existing tca6416-keypad driver is not employed
is because there was no aparent way to keep the gpio lines used as
SEL_{A,B,C} registered while simultaneously registering the pushbuttons as a
tca6416-keypad instance.

Some experimentation with the polling interval was performed; we were searching
for the largest polling interval that did not affect the feel of the
responsiveness of the buttons. It is very subjective but 200ms seems to be a
good value that accepts firm pushes but rejects very light ones. The key values
assigned to the buttons were arbitrarily chosen to be F1-F8.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Reviewed-by: Chris Cordahi <christophercordahi@nanometrics.ca>
CC: Govindarajan, Sriramakrishnan <srk@ti.com>
Reviewed-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
CC: Kevin Hilman <khilman@deeprootsystems.com>
CC: Gabor Juhos <juhosg@openwrt.org>

---

Changes since v4:
 * integrated the use of Gabor Juhos' polled gpio buttons driver
 * removed spurious whitespace change (Sekhar Nori)
 * don't linebreak error messages (Sekhar Nori)
 * kept the explicit static initialization of structure members in-place

Changes since v3:
 * extracted Kconfig changes to patch 5/5
 * fixed leading whitespace problem

Changes since v2:
 * rebased to 083eae3e28643e0eefc5243719f8b1572cf98299 of
   git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git
 * remove the "TODO : populate at runtime using" in this patch instead of 4/4
   (Nori, Sekhar)
 * integrated the static array initialization patch of Sekhar Nori
 * use static array initialization ranges
 * rename DA850_PB_POLL_MS to DA850_GPIO_KEYS_POLL_MS
 * use shorter names ...
From: Ben Gardiner
Date: Thursday, December 9, 2010 - 2:51 pm

The da850-evm baseboard (BB) and its UI board both have tca6416 IO expanders.
They are bootstrapped to different I2C addresses so they can be used
concurrently.

The expander on the UI board is currently used to enable/disable the
peripherals that are available on the UI board. In addition to this
functionality the expander is also connected to 8 pushbuttons. The expander
on the baseboard is not currently used; it is connected to deep sleep enable,
sw reset, a push button, some switches and LEDs.

This proposed patch series enables the push buttons and switches on the UI and
BB expanders using the gpio-keys polling mode patch by Gabor Juhos. Some
work was performed to test irq-based gpio-keys support on the expanders (a WIP
patch can be posted on request) but I believe that it is not possible to use 
irq-based gpio-keys on IO expanders for arm systems at this time. 

The attempt started when I noticed the patch of Alek Du and Alan Cox [1] which 
was recently committed [2]; a stab at integrating irq-based gpio-keys support
based on that patch was attempted. I found that I either got a warning that the
irq could not be mapped for the given gpio ; or, when N_IRQ was increased, a
system freeze.

From what I have read (particularly the message by Grant Likely [3]) IRQs on
IO expanders are not ready in ARM yet. I _think_ that the sparse IRQ rework by
Thomas Gleixner [4] will resolve the blocker to irq-based gpio-keys support. 

In the meantime we have buttons and switches that we would like to excersise
in our prototyping development. The patch to convert this series to irq-based
gpio-keys will be straighforward once the support in arch/arm is there.

There is an existing tca6416-keypad driver with polling support which I did not
employ because it isn't possible to keep the gpio's used for peripheral
enable/disable on the UI board or the LEDs on the baseboard registered while
simultaneously registering the pushbuttons or switches as a tca6416-keypad 
instance.

I tested this ...
From: Ben Gardiner
Date: Thursday, December 9, 2010 - 2:51 pm

From: Gabor Juhos <juhosg@openwrt.org>

The existing gpio-keys driver can be usable only for GPIO lines with
interrupt support. Several devices have buttons connected to a GPIO
line which is not capable to generate interrupts. This patch adds a
new input driver using the generic GPIO layer and the input-polldev
to support such buttons.

[Ben Gardiner <bengardiner@nanometrics.ca: fold code to use more
 of the original gpio_keys infrastructure; cleanups and other
 improvements.]

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Tested-by: Ben Gardiner <bengardiner@nanometrics.ca>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
(cherry picked from commit 0e7d0c860a0dee49dacb7bbb248d1eba637075ad)

---

This a copy of the commit -- I included in the patch series since
linux-davinci/master does not currently have it; but 2.6.37-rc5 does.

---
 drivers/input/keyboard/Kconfig            |   16 ++
 drivers/input/keyboard/Makefile           |    1 +
 drivers/input/keyboard/gpio_keys_polled.c |  261 +++++++++++++++++++++++++++++
 include/linux/gpio_keys.h                 |    2 +
 4 files changed, 280 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/keyboard/gpio_keys_polled.c

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index b8c51b9..3a87f3b 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -179,6 +179,22 @@ config KEYBOARD_GPIO
 	  To compile this driver as a module, choose M here: the
 	  module will be called gpio_keys.
 
+config KEYBOARD_GPIO_POLLED
+	tristate "Polled GPIO buttons"
+	depends on GENERIC_GPIO
+	select INPUT_POLLDEV
+	help
+	  This driver implements support for buttons connected
+	  to GPIO pins that are not capable of generating interrupts.
+
+	  Say Y here if your device has buttons connected
+	  directly to such GPIO pins.  Your board-specific
+	  setup logic must also provide a platform device,
+	  with ...
From: Kevin Hilman
Date: Friday, December 10, 2010 - 8:50 am

I'll be updating davinci master to .37-rc5 today, so will drop this
patch.

Kevin

--

From: Ben Gardiner
Date: Thursday, December 9, 2010 - 2:51 pm

The setup and teardown methods of the UI expander reference the SEL_{A,B,C}
pins by 'magic number' in each function. This uses the common enum for their offsets
in the expander setup and teardown functions.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Reviewed-by: Chris Cordahi <christophercordahi@nanometrics.ca>
Reviewed-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
CC: Victor Rodriguez <vm.rod25@gmail.com>

---

Changes since v5:
 * no changes in this patch of the series

Changes since v4:
 * no changes in this patch of the series

Changes since v3:
 * no changes in this patch of the series

Changes since v2:
 * rebased to 083eae3e28643e0eefc5243719f8b1572cf98299 of
   git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git
 * integrated the static array initialization patch provided by Sekhar Nori

Changes since v1:
 * No changes since v1
---
 arch/arm/mach-davinci/board-da850-evm.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 4377679..dede268 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -360,23 +360,23 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
 {
 	int sel_a, sel_b, sel_c, ret;
 
-	sel_a = gpio + 7;
-	sel_b = gpio + 6;
-	sel_c = gpio + 5;
+	sel_a = gpio + DA850_EVM_UI_EXP_SEL_A;
+	sel_b = gpio + DA850_EVM_UI_EXP_SEL_B;
+	sel_c = gpio + DA850_EVM_UI_EXP_SEL_C;
 
-	ret = gpio_request(sel_a, "sel_a");
+	ret = gpio_request(sel_a, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_A]);
 	if (ret) {
 		pr_warning("Cannot open UI expander pin %d\n", sel_a);
 		goto exp_setup_sela_fail;
 	}
 
-	ret = gpio_request(sel_b, "sel_b");
+	ret = gpio_request(sel_b, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_B]);
 	if (ret) {
 		pr_warning("Cannot open UI expander pin %d\n", sel_b);
 ...
From: Ben Gardiner
Date: Thursday, December 9, 2010 - 2:51 pm

This patch adds a pca953x platform device for the tca6416 found on the evm
baseboard. The tca6416 is a GPIO expander, also found on the UI board at a
separate I2C address. The pins of the baseboard IO expander are connected to
software reset, deep sleep enable, test points, a push button, DIP switches and
LEDs.

Add support for the push button, DIP switches and LEDs and test points (as
free GPIOs). The reset and deep sleep enable connections are reserved by the
setup routine so that userspace can't toggle those lines.

The existing tca6416-keypad driver was not employed because there was no
apararent way to register the LEDs connected to gpio's on the tca6416 while
simultaneously registering the tca6416-keypad instance.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Reviewed-by: Chris Cordahi <christophercordahi@nanometrics.ca>
CC: Govindarajan, Sriramakrishnan <srk@ti.com>
Reviewed-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
CC: Gabor Juhos <juhosg@openwrt.org>

---

Changes since v5:
 * use platform_data type from final polled gpio keys driver

Changes since v4:
 * integrated the use of Gabor Juhos' polled gpio buttons driver
 * removed extra indent (Sekhar Nori)
 * don't line-break error messages (Sekhar Nori)
 * left-in the explicit static initialization of structure members

Changes since v3:
 * don't request sw_rst and deep_sleep_en gpio pins -- let clients use them
   freely

Changes since v2:
 * rebased to 083eae3e28643e0eefc5243719f8b1572cf98299 of
   git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git
 * remove the "TODO : populate at runtime using" in 1/4 instead of this patch
  (Nori, Sekhar)
 * ui_expander_names was renamed to da850_evm_ui_exp
 * DA850_SW_POLL_MS definition moved to this patch from 3/4
 * use indexed array initialization pattern introduced by Sekhar Nori in 3/4
 * shorter names prefixed with da850_evm
 * static array range intializers
 * using only a single ...
From: Ben Gardiner
Date: Thursday, December 9, 2010 - 2:51 pm

This patch adds EV_KEYs for each of the 8 pushbuttons on the UI board via a
gpio-key device.

The expander is a tca6416; it controls the SEL_{A,B,C} lines which enable and
disable the peripherals found on the UI board in addition to the 8 pushbuttons
mentioned above. The reason the existing tca6416-keypad driver is not employed
is because there was no aparent way to keep the gpio lines used as
SEL_{A,B,C} registered while simultaneously registering the pushbuttons as a
tca6416-keypad instance.

Some experimentation with the polling interval was performed; we were searching
for the largest polling interval that did not affect the feel of the
responsiveness of the buttons. It is very subjective but 200ms seems to be a
good value that accepts firm pushes but rejects very light ones. The key values
assigned to the buttons were arbitrarily chosen to be F1-F8.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Reviewed-by: Chris Cordahi <christophercordahi@nanometrics.ca>
CC: Govindarajan, Sriramakrishnan <srk@ti.com>
Reviewed-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
CC: Kevin Hilman <khilman@deeprootsystems.com>
CC: Gabor Juhos <juhosg@openwrt.org>

---
Changes since v5:
 * use header and platform_data type from final polled gpio keys driver

Changes since v4:
 * integrated the use of Gabor Juhos' polled gpio buttons driver
 * removed spurious whitespace change (Sekhar Nori)
 * don't linebreak error messages (Sekhar Nori)
 * kept the explicit static initialization of structure members in-place

Changes since v3:
 * extracted Kconfig changes to patch 5/5
 * fixed leading whitespace problem

Changes since v2:
 * rebased to 083eae3e28643e0eefc5243719f8b1572cf98299 of
   git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git
 * remove the "TODO : populate at runtime using" in this patch instead of 4/4
   (Nori, Sekhar)
 * integrated the static array initialization patch of Sekhar Nori
 * use static array ...
From: Ben Gardiner
Date: Thursday, December 9, 2010 - 2:51 pm

Use the mach-davinci/Kconfig to enable gpio-keys-polled as default when
da850-evm machine is enabled.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Kevin Hilman <khilman@deeprootsystems.com>
CC: "Nori, Sekhar" <nsekhar@ti.com>
CC: Gabor Juhos <juhosg@openwrt.org>

---

Changes since v5:
 * no changes in this patch of the series

Changes since v4:
 * integrated the use of Gabor Juhos' polled gpio buttons driver

Changes since v3:
 * no changes in this patch of the series / this patch was introduced in v4 of
   the series
---
 arch/arm/mach-davinci/Kconfig |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index 84066e8..b93c327 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -180,6 +180,9 @@ endchoice
 config GPIO_PCA953X
 	default MACH_DAVINCI_DA850_EVM
 
+config KEYBOARD_GPIO_POLLED
+	default MACH_DAVINCI_DA850_EVM
+
 config MACH_TNETV107X
 	bool "TI TNETV107X Reference Platform"
 	default ARCH_DAVINCI_TNETV107X
-- 
1.7.0.4

--

From: Kevin Hilman
Date: Friday, December 10, 2010 - 9:16 am

Hi Ben,


Thanks for your patience and persistence on this series, and thanks for
working closely with the input folks to get the issues worked through.

This series looks good to me, so I'll be queuing it in davinci-next for
2.6.38.  It should show up in davinci git shortly.  Please validate
things are working as expected there.  Were there any changes needed to
the defaults in da8xx_omapl_defconfig to enable these features by
default?  or does the Kconfig change in PATCH 5/5 cover it?

Also, I really appreciate the thorough patch descriptions and history
information.   This greatly eases the work of maintainers.  Thanks!

One minor question: the series has a couple of Signed-off-by tags from
Sekhar Nori.  The s-o-b tag is for folks on the delivery path, and based
on what I saw, these should probably be Acked-by tags from Sekhar, since
he certainly helped on the review/test/validate side, but AFAICT, was
not an author or on the delivery path.  If I'm wrong on this (e.g., if
Sekhar actually did author some of those patches) let me know, otherwise
I'll change the s-o-b to Acked-by for Sekhar.

Thanks,

Kevin
--

From: Ben Gardiner
Date: Friday, December 10, 2010 - 9:33 am

Hi Kevin,

On Fri, Dec 10, 2010 at 11:16 AM, Kevin Hilman


Thank you very much, Kevin.

I will check linux-davinci/master on monday.

Yes, the 5/5 covers the necessary Kconfig changes; it makes the polled


The s-o-b 's for Sehkar are because I folded-in suggested changes
submitted in review by Sehkar in the form of a patch. I 'think' this
qualifies as authorship. I'll leave it to your good judgement.

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca
--

From: Kevin Hilman
Date: Friday, December 10, 2010 - 5:04 pm

Hi Ben, 
Ben Gardiner <bengardiner@nanometrics.ca> writes:


OK, thanks for clarification.   I'll leave the s-o-b tags as is.

Kevin

--

From: Ben Gardiner
Date: Monday, December 13, 2010 - 10:02 am

Hi Kevin,

On Fri, Dec 10, 2010 at 11:33 AM, Ben Gardiner

I looked at git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git#davinci-next
; HEAD at the time was

  commit 3004ce0d3a44525de63e18b01f7734bc8d64f2c5
  Author: Ben Gardiner <bengardiner@nanometrics.ca>
  Date:   Thu Dec 9 16:51:07 2010 -0500

      da850-evm: KEYBOARD_GPIO_POLLED Kconfig conditional

      Use the mach-davinci/Kconfig to enable gpio-keys-polled as default when
      da850-evm machine is enabled.

      Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
      CC: Kevin Hilman <khilman@deeprootsystems.com>
      CC: "Nori, Sekhar" <nsekhar@ti.com>
      CC: Gabor Juhos <juhosg@openwrt.org>
      Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>

Everything seems to be in order there; I tested the resulting kernel
with evtest and the expected output was observed. Note that
davinci-next still contains the cherry-pick of the upstream commit of
the polled gpio keys driver:

  commit 03b79201321d53acc56b43cdd9d43e869f62021c
  Author: Gabor Juhos <juhosg@openwrt.org>
  Date:   Thu Dec 9 16:51:03 2010 -0500

      Input: add input driver for polled GPIO buttons

      The existing gpio-keys driver can be usable only for GPIO lines with
      interrupt support. Several devices have buttons connected to a GPIO
      line which is not capable to generate interrupts. This patch adds a
      new input driver using the generic GPIO layer and the input-polldev
      to support such buttons.

      [Ben Gardiner <bengardiner@nanometrics.ca: fold code to use more
       of the original gpio_keys infrastructure; cleanups and other
       improvements.]

      Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
      Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
      Tested-by: Ben Gardiner <bengardiner@nanometrics.ca>
      Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
      (cherry picked from commit 0e7d0c860a0dee49dacb7bbb248d1eba637075ad)
      Signed-off-by: ...
From: Kevin Hilman
Date: Monday, December 13, 2010 - 2:53 pm

oops... I've now removed that, since it is part of v2.6.36-rc5 already.
Thanks for checking.

[...]

Yes, there will be double commits in master, because of the way I manage
master using 'git merge -ours'.  But there shouldn't be double commits
between my "rebuild from braches" merges.  It can be confusing, but if
you look at the history with a graphical tool like 'gitk', it might shed
some light on what is going on.

I know it's confusing, but the davinci-next branch is the only important
branch in this tree for upstream purposes.


Yeah, that came from davinc-next.  Now that it's removed from there, it
should be ok.

I just pushed an updated davinci-next and master branch.  It sometimes
takes a bit to propagate to all the kernel.org mirrors, but the update
should be there shortly.

Thanks,

Kevin
--

From: Ben Gardiner
Date: Monday, December 13, 2010 - 9:31 pm

On Mon, Dec 13, 2010 at 4:53 PM, Kevin Hilman

Ok. I'll consider a graphical investigation. Thanks for confirming the

Understood. Thanks for the clarification.

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca
--

From: Ben Gardiner
Date: Tuesday, December 14, 2010 - 9:17 am

On Mon, Dec 13, 2010 at 4:53 PM, Kevin Hilman

Oops on my part...

I looked at git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git#davinci-next
again ; HEAD at the time was:

  commit 5682cfebad5e68736f4c54a268b5b371698f5262
  Author: Ben Gardiner <bengardiner@nanometrics.ca>
  Date:   Thu Dec 9 16:51:07 2010 -0500

      da850-evm: KEYBOARD_GPIO_POLLED Kconfig conditional

      Use the mach-davinci/Kconfig to enable gpio-keys-polled as default when
      da850-evm machine is enabled.

      Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
      CC: Kevin Hilman <khilman@deeprootsystems.com>
      CC: "Nori, Sekhar" <nsekhar@ti.com>
      CC: Gabor Juhos <juhosg@openwrt.org>
      Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>

and I was unable to build a kernel from da8xx_omapl_defconfig b/c:

  arch/arm/mach-davinci/board-da850-evm.c:333: error: unknown field
'poll_interval' specified in initializer

It appears that dropping the cherry-pick caused the build failure.

The commit that introduces the polled gpio keys driver (which was
included in the series as a cherry pick) is commit
0e7d0c860a0dee49dacb7bbb248d1eba637075ad which is in
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git#master
_after_ the tag v2.6.37-rc5.

That's my fault. I incorrectly thought that commit
0e7d0c860a0dee49dacb7bbb248d1eba637075ad was _in_ 2.6.37-rc5 and
stated this is previous emails. I'm sorry for the confusion; I think I
jumped the gun there due to my excitement at getting this prerequisite
driver committed.

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca
--

From: Kevin Hilman
Date: Tuesday, December 14, 2010 - 10:10 am

OK, while waiting for it to arrive upstream, I've added it to my
'davinci-backports' branch, which is also merged into the master branch
of davinci git (but not in davinci-next, since it will go upstream via
another subsystem.)

Just pushed an updated version, and this time, I actually build tested for
davinci_all_defconfig and da8xx_omapl_defconfig. :)

Sorry for the churn,

Kevin

--

From: Ben Gardiner
Date: Friday, December 17, 2010 - 8:15 am

Hi Kevin,

On Tue, Dec 14, 2010 at 12:10 PM, Kevin Hilman

I tested linux-davinci master; HEAD was
c63d0f1df0284f2fcb28c0943b17848500d01515. Everything is working as
expected.

Thanks again for taking up this series along with the complications
introduced by the cherry pick.

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca
--

Previous thread: [PATCH v2 3/4] da850-evm: extract defines for SEL{A,B,C} pins in UI expander by Ben Gardiner on Tuesday, November 16, 2010 - 12:39 pm. (3 messages)

Next thread: [PATCH] ipc: explicitly clear stack memory for shminfo by Kees Cook on Tuesday, November 16, 2010 - 12:58 pm. (4 messages)