* [PATCH v4 1/5] input: gpio_keys: polling mode support
2010-11-23 19:40 ` [PATCH v4 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
@ 2010-11-23 19:40 ` Ben Gardiner
2010-11-23 19:40 ` [PATCH v4 2/5] da850-evm: add UI Expander pushbuttons Ben Gardiner
` (4 subsequent siblings)
5 siblings, 0 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-11-23 19:40 UTC (permalink / raw)
To: Kevin Hilman, davinci-linux-open-source, linux-input, Dmitry Torokhov
Cc: linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori, Alexander Clouter
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 6069abe..d2f23d9 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -1,7 +1,9 @@
/*
- * Driver for keys on GPIO lines capable of generating interrupts.
+ * Driver for keys on GPIO lines, either IRQ-driven or polled.
*
* Copyright 2005 Phil Blundell
+ * Copyright 2008 Paul Mundt
+ * Copyright 2010 Alexander Clouter <alex@digriz.org.uk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -25,6 +27,7 @@
#include <linux/gpio_keys.h>
#include <linux/workqueue.h>
#include <linux/gpio.h>
+#include <linux/input-polldev.h>
struct gpio_button_data {
struct gpio_keys_button *button;
@@ -37,6 +40,7 @@ struct gpio_button_data {
struct gpio_keys_drvdata {
struct input_dev *input;
+ struct input_polled_dev *poll_dev;
struct mutex disable_lock;
unsigned int n_buttons;
int (*enable)(struct device *dev);
@@ -44,6 +48,30 @@ struct gpio_keys_drvdata {
struct gpio_button_data data[0];
};
+#if (!defined(CONFIG_INPUT_POLLDEV) && !defined(CONFIG_INPUT_POLLDEV_MODULE)) \
+ || (defined(CONFIG_INPUT_POLLDEV_MODULE) \
+ && !defined(CONFIG_KEYBOARD_GPIO_MODULE))
+
+static inline struct input_polled_dev *allocate_polled_device(
+ const struct device *dev)
+{
+ dev_err(dev, "device needs polling (enable INPUT_POLLDEV)\n");
+ return NULL;
+}
+
+#define free_polled_device(x) do { } while (0)
+#define register_polled_device(x) (-ENXIO)
+#define unregister_polled_device(x) do { } while (0)
+
+#else
+
+#define allocate_polled_device(x) input_allocate_polled_device()
+#define free_polled_device(x) input_free_polled_device(x)
+#define register_polled_device(x) input_register_polled_device(x)
+#define unregister_polled_device(x) input_unregister_polled_device(x)
+
+#endif
+
/*
* SYSFS interface for enabling/disabling keys and switches:
*
@@ -322,7 +350,8 @@ static void gpio_keys_report_event(struct gpio_button_data *bdata)
struct gpio_keys_button *button = bdata->button;
struct input_dev *input = bdata->input;
unsigned int type = button->type ?: EV_KEY;
- int state = (gpio_get_value(button->gpio) ? 1 : 0) ^ button->active_low;
+ int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0)
+ ^ button->active_low;
input_event(input, type, button->code, !!state);
input_sync(input);
@@ -343,6 +372,16 @@ static void gpio_keys_timer(unsigned long _data)
schedule_work(&data->work);
}
+static void gpio_handle_button_event(struct gpio_keys_button *button,
+ struct gpio_button_data *bdata)
+{
+ if (bdata->timer_debounce)
+ mod_timer(&bdata->timer,
+ jiffies + msecs_to_jiffies(bdata->timer_debounce));
+ else
+ gpio_keys_report_event(bdata);
+}
+
static irqreturn_t gpio_keys_isr(int irq, void *dev_id)
{
struct gpio_button_data *bdata = dev_id;
@@ -350,15 +389,24 @@ static irqreturn_t gpio_keys_isr(int irq, void *dev_id)
BUG_ON(irq != gpio_to_irq(button->gpio));
- if (bdata->timer_debounce)
- mod_timer(&bdata->timer,
- jiffies + msecs_to_jiffies(bdata->timer_debounce));
- else
- schedule_work(&bdata->work);
+ gpio_handle_button_event(button, bdata);
return IRQ_HANDLED;
}
+static void gpio_keys_poll(struct input_polled_dev *dev)
+{
+ struct gpio_keys_drvdata *ddata = dev->private;
+ int i;
+
+ for (i = 0; i < ddata->n_buttons; i++) {
+ struct gpio_button_data *bdata = &ddata->data[i];
+ struct gpio_keys_button *button = bdata->button;
+
+ gpio_handle_button_event(button, bdata);
+ }
+}
+
static int __devinit gpio_keys_setup_key(struct platform_device *pdev,
struct gpio_button_data *bdata,
struct gpio_keys_button *button)
@@ -446,20 +494,28 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
struct gpio_keys_drvdata *ddata;
struct device *dev = &pdev->dev;
struct input_dev *input;
+ struct input_polled_dev *poll_dev;
int i, error;
int wakeup = 0;
ddata = kzalloc(sizeof(struct gpio_keys_drvdata) +
pdata->nbuttons * sizeof(struct gpio_button_data),
GFP_KERNEL);
- input = input_allocate_device();
+ if (pdata->poll_interval) {
+ poll_dev = allocate_polled_device(dev);
+ input = poll_dev ? poll_dev->input : 0;
+ } else
+ input = input_allocate_device();
if (!ddata || !input) {
dev_err(dev, "failed to allocate state\n");
error = -ENOMEM;
goto fail1;
}
- ddata->input = input;
+ if (pdata->poll_interval)
+ ddata->poll_dev = poll_dev;
+ else
+ ddata->input = input;
ddata->n_buttons = pdata->nbuttons;
ddata->enable = pdata->enable;
ddata->disable = pdata->disable;
@@ -468,6 +524,12 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ddata);
input_set_drvdata(input, ddata);
+ if (pdata->poll_interval) {
+ poll_dev->private = ddata;
+ poll_dev->poll = gpio_keys_poll;
+ poll_dev->poll_interval = pdata->poll_interval;
+ }
+
input->name = pdev->name;
input->phys = "gpio-keys/input0";
input->dev.parent = &pdev->dev;
@@ -491,14 +553,17 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
bdata->input = input;
bdata->button = button;
+ input_set_capability(input, type, button->code);
+
+ if (pdata->poll_interval)
+ continue;
+
error = gpio_keys_setup_key(pdev, bdata, button);
if (error)
goto fail2;
if (button->wakeup)
wakeup = 1;
-
- input_set_capability(input, type, button->code);
}
error = sysfs_create_group(&pdev->dev.kobj, &gpio_keys_attr_group);
@@ -508,7 +573,10 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
goto fail2;
}
- error = input_register_device(input);
+ if (pdata->poll_interval)
+ error = register_polled_device(poll_dev);
+ else
+ error = input_register_device(input);
if (error) {
dev_err(dev, "Unable to register input device, error: %d\n",
error);
@@ -528,7 +596,9 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group);
fail2:
while (--i >= 0) {
- free_irq(gpio_to_irq(pdata->buttons[i].gpio), &ddata->data[i]);
+ if (!pdata->poll_interval)
+ free_irq(gpio_to_irq(pdata->buttons[i].gpio),
+ &ddata->data[i]);
if (ddata->data[i].timer_debounce)
del_timer_sync(&ddata->data[i].timer);
cancel_work_sync(&ddata->data[i].work);
@@ -537,7 +607,10 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, NULL);
fail1:
- input_free_device(input);
+ if (pdata->poll_interval)
+ free_polled_device(poll_dev);
+ else
+ input_free_device(input);
kfree(ddata);
return error;
@@ -547,7 +620,8 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev)
{
struct gpio_keys_platform_data *pdata = pdev->dev.platform_data;
struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev);
- struct input_dev *input = ddata->input;
+ struct input_dev *input;
+ struct input_polled_dev *poll_dev;
int i;
sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group);
@@ -555,15 +629,25 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev)
device_init_wakeup(&pdev->dev, 0);
for (i = 0; i < pdata->nbuttons; i++) {
- int irq = gpio_to_irq(pdata->buttons[i].gpio);
- free_irq(irq, &ddata->data[i]);
+ if (!pdata->poll_interval) {
+ int irq = gpio_to_irq(pdata->buttons[i].gpio);
+ free_irq(irq, &ddata->data[i]);
+ }
if (ddata->data[i].timer_debounce)
del_timer_sync(&ddata->data[i].timer);
cancel_work_sync(&ddata->data[i].work);
gpio_free(pdata->buttons[i].gpio);
}
- input_unregister_device(input);
+ if (pdata->poll_interval) {
+ poll_dev = ddata->poll_dev;
+ unregister_polled_device(poll_dev);
+ free_polled_device(poll_dev);
+ } else {
+ input = ddata->input;
+ input_unregister_device(input);
+ input_free_device(input);
+ }
return 0;
}
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index ce73a30..5fdd495 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -19,6 +19,7 @@ struct gpio_keys_platform_data {
unsigned int rep:1; /* enable input subsystem auto repeat */
int (*enable)(struct device *dev);
void (*disable)(struct device *dev);
+ unsigned int poll_interval; /* polling interval in ms */
};
#endif
--
1.7.0.4
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH v4 2/5] da850-evm: add UI Expander pushbuttons
2010-11-23 19:40 ` [PATCH v4 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
2010-11-23 19:40 ` [PATCH v4 1/5] input: gpio_keys: polling mode support Ben Gardiner
@ 2010-11-23 19:40 ` Ben Gardiner
2010-11-24 13:16 ` Nori, Sekhar
2010-11-23 19:40 ` [PATCH v4 3/5] da850-evm: extract defines for SEL{A,B,C} pins in UI expander Ben Gardiner
` (3 subsequent siblings)
5 siblings, 1 reply; 62+ messages in thread
From: Ben Gardiner @ 2010-11-23 19:40 UTC (permalink / raw)
To: Kevin Hilman, davinci-linux-open-source, linux-input, Dmitry Torokhov
Cc: linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Govindarajan, Sriramakrishnan, Kevin Hilman
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
---
arch/arm/mach-davinci/board-da850-evm.c | 98 ++++++++++++++++++++++++++++++-
1 files changed, 97 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index f89b0b7..51f5ffa 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -17,8 +17,10 @@
#include <linux/i2c.h>
#include <linux/i2c/at24.h>
#include <linux/i2c/pca953x.h>
+#include <linux/input.h>
#include <linux/mfd/tps6507x.h>
#include <linux/gpio.h>
+#include <linux/gpio_keys.h>
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
@@ -272,6 +274,88 @@ static inline void da850_evm_setup_emac_rmii(int rmii_sel)
static inline void da850_evm_setup_emac_rmii(int rmii_sel) { }
#endif
+
+#define DA850_KEYS_DEBOUNCE_MS 10
+/*
+ * At 200ms polling interval it is possible to miss an
+ * event by tapping very lightly on the push button but most
+ * pushes do result in an event; longer intervals require the
+ * user to hold the button whereas shorter intervals require
+ * more CPU time for polling.
+ */
+#define DA850_GPIO_KEYS_POLL_MS 200
+
+enum da850_evm_ui_exp_pins {
+ DA850_EVM_UI_EXP_SEL_C = 5,
+ DA850_EVM_UI_EXP_SEL_B,
+ DA850_EVM_UI_EXP_SEL_A,
+ DA850_EVM_UI_EXP_PB8,
+ DA850_EVM_UI_EXP_PB7,
+ DA850_EVM_UI_EXP_PB6,
+ DA850_EVM_UI_EXP_PB5,
+ DA850_EVM_UI_EXP_PB4,
+ DA850_EVM_UI_EXP_PB3,
+ DA850_EVM_UI_EXP_PB2,
+ DA850_EVM_UI_EXP_PB1,
+};
+
+static const char const *da850_evm_ui_exp[] = {
+ [DA850_EVM_UI_EXP_SEL_C] = "sel_c",
+ [DA850_EVM_UI_EXP_SEL_B] = "sel_b",
+ [DA850_EVM_UI_EXP_SEL_A] = "sel_a",
+ [DA850_EVM_UI_EXP_PB8] = "pb8",
+ [DA850_EVM_UI_EXP_PB7] = "pb7",
+ [DA850_EVM_UI_EXP_PB6] = "pb6",
+ [DA850_EVM_UI_EXP_PB5] = "pb5",
+ [DA850_EVM_UI_EXP_PB4] = "pb4",
+ [DA850_EVM_UI_EXP_PB3] = "pb3",
+ [DA850_EVM_UI_EXP_PB2] = "pb2",
+ [DA850_EVM_UI_EXP_PB1] = "pb1",
+};
+
+#define DA850_N_UI_PB 8
+
+static struct gpio_keys_button da850_evm_ui_keys[] = {
+ [0 ... DA850_N_UI_PB - 1] = {
+ .type = EV_KEY,
+ .active_low = 1,
+ .wakeup = 0,
+ .debounce_interval = DA850_KEYS_DEBOUNCE_MS,
+ .code = -1, /* assigned at runtime */
+ .gpio = -1, /* assigned at runtime */
+ .desc = NULL, /* assigned at runtime */
+ },
+};
+
+static struct gpio_keys_platform_data da850_evm_ui_keys_pdata = {
+ .buttons = da850_evm_ui_keys,
+ .nbuttons = ARRAY_SIZE(da850_evm_ui_keys),
+ .rep = 0, /* disable auto-repeat */
+ .poll_interval = DA850_GPIO_KEYS_POLL_MS,
+};
+
+static struct platform_device da850_evm_ui_keys_device = {
+ .name = "gpio-keys",
+ .id = 0,
+ .dev = {
+ .platform_data = &da850_evm_ui_keys_pdata
+ },
+};
+
+static void da850_evm_ui_keys_init(unsigned gpio)
+{
+ int i;
+ struct gpio_keys_button *button;
+
+ for (i = 0; i < DA850_N_UI_PB; i++) {
+ button = &da850_evm_ui_keys[i];
+ button->code = KEY_F8 - i;
+ button->desc = (char *)
+ da850_evm_ui_exp[DA850_EVM_UI_EXP_PB8 + i];
+ button->gpio = gpio + DA850_EVM_UI_EXP_PB8 + i;
+ }
+}
+
static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
unsigned ngpio, void *c)
{
@@ -304,15 +388,24 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
gpio_direction_output(sel_b, 1);
gpio_direction_output(sel_c, 1);
+ da850_evm_ui_keys_init(gpio);
+ ret = platform_device_register(&da850_evm_ui_keys_device);
+ if (ret) {
+ pr_warning("Could not register UI GPIO expander push-buttons"
+ " device\n");
+ goto exp_setup_keys_fail;
+ }
+
ui_card_detected = 1;
pr_info("DA850/OMAP-L138 EVM UI card detected\n");
da850_evm_setup_nor_nand();
-
da850_evm_setup_emac_rmii(sel_a);
return 0;
+exp_setup_keys_fail:
+ gpio_free(sel_c);
exp_setup_selc_fail:
gpio_free(sel_b);
exp_setup_selb_fail:
@@ -324,6 +417,8 @@ exp_setup_sela_fail:
static int da850_evm_ui_expander_teardown(struct i2c_client *client,
unsigned gpio, unsigned ngpio, void *c)
{
+ platform_device_unregister(&da850_evm_ui_keys_device);
+
/* deselect all functionalities */
gpio_set_value_cansleep(gpio + 5, 1);
gpio_set_value_cansleep(gpio + 6, 1);
@@ -340,6 +435,7 @@ static struct pca953x_platform_data da850_evm_ui_expander_info = {
.gpio_base = DAVINCI_N_GPIO,
.setup = da850_evm_ui_expander_setup,
.teardown = da850_evm_ui_expander_teardown,
+ .names = da850_evm_ui_exp,
};
static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 62+ messages in thread
* RE: [PATCH v4 2/5] da850-evm: add UI Expander pushbuttons
2010-11-23 19:40 ` [PATCH v4 2/5] da850-evm: add UI Expander pushbuttons Ben Gardiner
@ 2010-11-24 13:16 ` Nori, Sekhar
2010-11-24 17:16 ` Ben Gardiner
0 siblings, 1 reply; 62+ messages in thread
From: Nori, Sekhar @ 2010-11-24 13:16 UTC (permalink / raw)
To: Ben Gardiner, Kevin Hilman, davinci-linux-open-source,
linux-input, Dmitry Torokhov
Cc: linux-kernel, Chris Cordahi, Paul Mundt, Govindarajan,
Sriramakrishnan, Kevin Hilman
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.
On Wed, Nov 24, 2010 at 01:10:57, Ben Gardiner wrote:
> arch/arm/mach-davinci/board-da850-evm.c | 98 ++++++++++++++++++++++++++++++-
> 1 files changed, 97 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> +static struct gpio_keys_button da850_evm_ui_keys[] = {
> + [0 ... DA850_N_UI_PB - 1] = {
> + .type = EV_KEY,
> + .active_low = 1,
> + .wakeup = 0,
> + .debounce_interval = DA850_KEYS_DEBOUNCE_MS,
> + .code = -1, /* assigned at runtime */
> + .gpio = -1, /* assigned at runtime */
> + .desc = NULL, /* assigned at runtime */
> + },
> +};
> +
> +static struct gpio_keys_platform_data da850_evm_ui_keys_pdata = {
> + .buttons = da850_evm_ui_keys,
> + .nbuttons = ARRAY_SIZE(da850_evm_ui_keys),
> + .rep = 0, /* disable auto-repeat */
> + .poll_interval = DA850_GPIO_KEYS_POLL_MS,
> +};
> +
> +static struct platform_device da850_evm_ui_keys_device = {
> + .name = "gpio-keys",
> + .id = 0,
> + .dev = {
> + .platform_data = &da850_evm_ui_keys_pdata
> + },
> +};
No need of zero/NULL initialization in structures above
since they are static.
> @@ -304,15 +388,24 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
> gpio_direction_output(sel_b, 1);
> gpio_direction_output(sel_c, 1);
>
> + da850_evm_ui_keys_init(gpio);
> + ret = platform_device_register(&da850_evm_ui_keys_device);
> + if (ret) {
> + pr_warning("Could not register UI GPIO expander push-buttons"
> + " device\n");
Line-breaking an error message is not preferred since it becomes
difficult to grep in code. Looking at this message, you could drop
" device" altogether.
> + goto exp_setup_keys_fail;
> + }
> +
> ui_card_detected = 1;
> pr_info("DA850/OMAP-L138 EVM UI card detected\n");
>
> da850_evm_setup_nor_nand();
> -
Random white space change?
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH v4 2/5] da850-evm: add UI Expander pushbuttons
2010-11-24 13:16 ` Nori, Sekhar
@ 2010-11-24 17:16 ` Ben Gardiner
0 siblings, 0 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-11-24 17:16 UTC (permalink / raw)
To: Nori, Sekhar
Cc: Kevin Hilman, davinci-linux-open-source, linux-input,
Dmitry Torokhov, linux-kernel, Chris Cordahi, Paul Mundt,
Govindarajan, Sriramakrishnan
Hi Sekhar,
On Wed, Nov 24, 2010 at 8:16 AM, Nori, Sekhar <nsekhar@ti.com> wrote:
> 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.
Thank you for your continued interest and input.
> On Wed, Nov 24, 2010 at 01:10:57, Ben Gardiner wrote:
>
>> arch/arm/mach-davinci/board-da850-evm.c | 98 ++++++++++++++++++++++++++++++-
>> 1 files changed, 97 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
>
>> +static struct gpio_keys_button da850_evm_ui_keys[] = {
>> + [0 ... DA850_N_UI_PB - 1] = {
>> + .type = EV_KEY,
>> + .active_low = 1,
>> + .wakeup = 0,
>> + .debounce_interval = DA850_KEYS_DEBOUNCE_MS,
>> + .code = -1, /* assigned at runtime */
>> + .gpio = -1, /* assigned at runtime */
>> + .desc = NULL, /* assigned at runtime */
>> + },
>> +};
>> +
>> +static struct gpio_keys_platform_data da850_evm_ui_keys_pdata = {
>> + .buttons = da850_evm_ui_keys,
>> + .nbuttons = ARRAY_SIZE(da850_evm_ui_keys),
>> + .rep = 0, /* disable auto-repeat */
>> + .poll_interval = DA850_GPIO_KEYS_POLL_MS,
>> +};
>> +
>> +static struct platform_device da850_evm_ui_keys_device = {
>> + .name = "gpio-keys",
>> + .id = 0,
>> + .dev = {
>> + .platform_data = &da850_evm_ui_keys_pdata
>> + },
>> +};
>
> No need of zero/NULL initialization in structures above
> since they are static.
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
expliciti initializations -- I would prefer to leave them as-is.
>> @@ -304,15 +388,24 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
>> gpio_direction_output(sel_b, 1);
>> gpio_direction_output(sel_c, 1);
>>
>> + da850_evm_ui_keys_init(gpio);
>> + ret = platform_device_register(&da850_evm_ui_keys_device);
>> + if (ret) {
>> + pr_warning("Could not register UI GPIO expander push-buttons"
>> + " device\n");
>
> Line-breaking an error message is not preferred since it becomes
> difficult to grep in code. Looking at this message, you could drop
> " device" altogether.
Interesting point. Thank you, I really apreciate all the knowledge you
are imparting to me throughout this process. I will remove the "
device" string from the error message entirely.
>> + goto exp_setup_keys_fail;
>> + }
>> +
>> ui_card_detected = 1;
>> pr_info("DA850/OMAP-L138 EVM UI card detected\n");
>>
>> da850_evm_setup_nor_nand();
>> -
>
> Random white space change?
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
^ permalink raw reply [flat|nested] 62+ messages in thread
* [PATCH v4 3/5] da850-evm: extract defines for SEL{A,B,C} pins in UI expander
2010-11-23 19:40 ` [PATCH v4 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
2010-11-23 19:40 ` [PATCH v4 1/5] input: gpio_keys: polling mode support Ben Gardiner
2010-11-23 19:40 ` [PATCH v4 2/5] da850-evm: add UI Expander pushbuttons Ben Gardiner
@ 2010-11-23 19:40 ` Ben Gardiner
2010-11-23 19:40 ` [PATCH v4 4/5] da850-evm: add baseboard GPIO expander buttons, switches and LEDs Ben Gardiner
` (2 subsequent siblings)
5 siblings, 0 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-11-23 19:40 UTC (permalink / raw)
To: Kevin Hilman, davinci-linux-open-source, linux-input, Dmitry Torokhov
Cc: linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori, Victor Rodriguez
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, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_C]);
if (ret) {
pr_warning("Cannot open UI expander pin %d\n", sel_c);
goto exp_setup_selc_fail;
@@ -420,13 +420,13 @@ static int da850_evm_ui_expander_teardown(struct i2c_client *client,
platform_device_unregister(&da850_evm_ui_keys_device);
/* deselect all functionalities */
- gpio_set_value_cansleep(gpio + 5, 1);
- gpio_set_value_cansleep(gpio + 6, 1);
- gpio_set_value_cansleep(gpio + 7, 1);
+ gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_C, 1);
+ gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_B, 1);
+ gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_A, 1);
- gpio_free(gpio + 5);
- gpio_free(gpio + 6);
- gpio_free(gpio + 7);
+ gpio_free(gpio + DA850_EVM_UI_EXP_SEL_C);
+ gpio_free(gpio + DA850_EVM_UI_EXP_SEL_B);
+ gpio_free(gpio + DA850_EVM_UI_EXP_SEL_A);
return 0;
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH v4 4/5] da850-evm: add baseboard GPIO expander buttons, switches and LEDs
2010-11-23 19:40 ` [PATCH v4 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
` (2 preceding siblings ...)
2010-11-23 19:40 ` [PATCH v4 3/5] da850-evm: extract defines for SEL{A,B,C} pins in UI expander Ben Gardiner
@ 2010-11-23 19:40 ` Ben Gardiner
2010-11-23 19:41 ` [PATCH v4 5/5] da850-evm: KEYBOARD_GPIO and INPUT_POLLDEV Kconfig conditionals Ben Gardiner
2010-11-24 21:59 ` [PATCH v5 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
5 siblings, 0 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-11-23 19:40 UTC (permalink / raw)
To: Kevin Hilman, davinci-linux-open-source, linux-input, Dmitry Torokhov
Cc: linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Govindarajan, Sriramakrishnan
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
---
arch/arm/mach-davinci/board-da850-evm.c | 190 +++++++++++++++++++++++++++++++
1 files changed, 190 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 420b628..3cff221 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -431,6 +431,185 @@ static int da850_evm_ui_expander_teardown(struct i2c_client *client,
return 0;
}
+/* assign the baseboard expander's GPIOs after the UI board's */
+#define DA850_UI_EXPANDER_N_GPIOS ARRAY_SIZE(da850_evm_ui_exp)
+#define DA850_BB_EXPANDER_GPIO_BASE (DAVINCI_N_GPIO + DA850_UI_EXPANDER_N_GPIOS)
+
+enum da850_evm_bb_exp_pins {
+ DA850_EVM_BB_EXP_DEEP_SLEEP_EN = 0,
+ DA850_EVM_BB_EXP_SW_RST,
+ DA850_EVM_BB_EXP_TP_23,
+ DA850_EVM_BB_EXP_TP_22,
+ DA850_EVM_BB_EXP_TP_21,
+ DA850_EVM_BB_EXP_USER_PB1,
+ DA850_EVM_BB_EXP_USER_LED2,
+ DA850_EVM_BB_EXP_USER_LED1,
+ DA850_EVM_BB_EXP_USER_SW1,
+ DA850_EVM_BB_EXP_USER_SW2,
+ DA850_EVM_BB_EXP_USER_SW3,
+ DA850_EVM_BB_EXP_USER_SW4,
+ DA850_EVM_BB_EXP_USER_SW5,
+ DA850_EVM_BB_EXP_USER_SW6,
+ DA850_EVM_BB_EXP_USER_SW7,
+ DA850_EVM_BB_EXP_USER_SW8
+};
+
+static const char const *da850_evm_bb_exp[] = {
+ [DA850_EVM_BB_EXP_DEEP_SLEEP_EN] = "deep_sleep_en",
+ [DA850_EVM_BB_EXP_SW_RST] = "sw_rst",
+ [DA850_EVM_BB_EXP_TP_23] = "tp_23",
+ [DA850_EVM_BB_EXP_TP_22] = "tp_22",
+ [DA850_EVM_BB_EXP_TP_21] = "tp_21",
+ [DA850_EVM_BB_EXP_USER_PB1] = "user_pb1",
+ [DA850_EVM_BB_EXP_USER_LED2] = "user_led2",
+ [DA850_EVM_BB_EXP_USER_LED1] = "user_led1",
+ [DA850_EVM_BB_EXP_USER_SW1] = "user_sw1",
+ [DA850_EVM_BB_EXP_USER_SW2] = "user_sw2",
+ [DA850_EVM_BB_EXP_USER_SW3] = "user_sw3",
+ [DA850_EVM_BB_EXP_USER_SW4] = "user_sw4",
+ [DA850_EVM_BB_EXP_USER_SW5] = "user_sw5",
+ [DA850_EVM_BB_EXP_USER_SW6] = "user_sw6",
+ [DA850_EVM_BB_EXP_USER_SW7] = "user_sw7",
+ [DA850_EVM_BB_EXP_USER_SW8] = "user_sw8",
+};
+
+#define DA850_N_BB_USER_SW 8
+
+static struct gpio_keys_button da850_evm_bb_keys[] = {
+ [0] = {
+ .type = EV_KEY,
+ .active_low = 1,
+ .wakeup = 0,
+ .debounce_interval = DA850_KEYS_DEBOUNCE_MS,
+ .code = KEY_PROG1,
+ .desc = NULL, /* assigned at runtime */
+ .gpio = -1, /* assigned at runtime */
+ },
+ [1 ... DA850_N_BB_USER_SW] = {
+ .type = EV_SW,
+ .active_low = 1,
+ .wakeup = 0,
+ .debounce_interval = DA850_KEYS_DEBOUNCE_MS,
+ .code = -1, /* assigned at runtime */
+ .desc = NULL, /* assigned at runtime */
+ .gpio = -1, /* assigned at runtime */
+ },
+};
+
+static struct gpio_keys_platform_data da850_evm_bb_keys_pdata = {
+ .buttons = da850_evm_bb_keys,
+ .nbuttons = ARRAY_SIZE(da850_evm_bb_keys),
+ .rep = 0, /* disable auto-repeat */
+ .poll_interval = DA850_GPIO_KEYS_POLL_MS,
+};
+
+static struct platform_device da850_evm_bb_keys_device = {
+ .name = "gpio-keys",
+ .id = 1,
+ .dev = {
+ .platform_data = &da850_evm_bb_keys_pdata
+ },
+};
+
+static void da850_evm_bb_keys_init(unsigned gpio)
+{
+ int i;
+ struct gpio_keys_button *button;
+
+ button = &da850_evm_bb_keys[0];
+ button->desc = (char *)
+ da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_PB1];
+ button->gpio = gpio + DA850_EVM_BB_EXP_USER_PB1;
+
+ for (i = 0; i < DA850_N_BB_USER_SW; i++) {
+ button = &da850_evm_bb_keys[i + 1];
+ button->code = SW_LID + i;
+ button->desc = (char *)
+ da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_SW1 + i];
+ button->gpio = gpio + DA850_EVM_BB_EXP_USER_SW1 + i;
+ }
+}
+
+#define DA850_N_BB_USER_LED 2
+
+static struct gpio_led da850_evm_bb_leds[] = {
+ [0 ... DA850_N_BB_USER_LED - 1] = {
+ .active_low = 1,
+ .gpio = -1, /* assigned at runtime */
+ .name = NULL, /* assigned at runtime */
+ },
+};
+
+static struct gpio_led_platform_data da850_evm_bb_leds_pdata = {
+ .leds = da850_evm_bb_leds,
+ .num_leds = ARRAY_SIZE(da850_evm_bb_leds),
+};
+
+static struct platform_device da850_evm_bb_leds_device = {
+ .name = "leds-gpio",
+ .id = -1,
+ .dev = {
+ .platform_data = &da850_evm_bb_leds_pdata
+ }
+};
+
+static void da850_evm_bb_leds_init(unsigned gpio)
+{
+ int i;
+ struct gpio_led *led;
+
+ for (i = 0; i < DA850_N_BB_USER_LED; i++) {
+ led = &da850_evm_bb_leds[i];
+
+ led->gpio = gpio + DA850_EVM_BB_EXP_USER_LED2 + i;
+ led->name =
+ da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_LED2 + i];
+ }
+}
+
+static int da850_evm_bb_expander_setup(struct i2c_client *client,
+ unsigned gpio, unsigned ngpio,
+ void *c)
+{
+ int ret;
+
+ /*
+ * Register the switches and pushbutton on the baseboard as a gpio-keys
+ * device.
+ */
+ da850_evm_bb_keys_init(gpio);
+ ret = platform_device_register(&da850_evm_bb_keys_device);
+ if (ret) {
+ pr_warning("Could not register baseboard GPIO expander switches"
+ " device\n");
+ goto io_exp_setup_sw_fail;
+ }
+
+ da850_evm_bb_leds_init(gpio);
+ ret = platform_device_register(&da850_evm_bb_leds_device);
+ if (ret) {
+ pr_warning("Could not register baseboard GPIO expander LEDS "
+ "device\n");
+ goto io_exp_setup_leds_fail;
+ }
+
+ return 0;
+
+io_exp_setup_leds_fail:
+ platform_device_unregister(&da850_evm_bb_keys_device);
+io_exp_setup_sw_fail:
+ return ret;
+}
+
+static int da850_evm_bb_expander_teardown(struct i2c_client *client,
+ unsigned gpio, unsigned ngpio, void *c)
+{
+ platform_device_unregister(&da850_evm_bb_leds_device);
+ platform_device_unregister(&da850_evm_bb_keys_device);
+
+ return 0;
+}
+
static struct pca953x_platform_data da850_evm_ui_expander_info = {
.gpio_base = DAVINCI_N_GPIO,
.setup = da850_evm_ui_expander_setup,
@@ -438,6 +617,13 @@ static struct pca953x_platform_data da850_evm_ui_expander_info = {
.names = da850_evm_ui_exp,
};
+static struct pca953x_platform_data da850_evm_bb_expander_info = {
+ .gpio_base = DA850_BB_EXPANDER_GPIO_BASE,
+ .setup = da850_evm_bb_expander_setup,
+ .teardown = da850_evm_bb_expander_teardown,
+ .names = da850_evm_bb_exp,
+};
+
static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {
{
I2C_BOARD_INFO("tlv320aic3x", 0x18),
@@ -446,6 +632,10 @@ static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {
I2C_BOARD_INFO("tca6416", 0x20),
.platform_data = &da850_evm_ui_expander_info,
},
+ {
+ I2C_BOARD_INFO("tca6416", 0x21),
+ .platform_data = &da850_evm_bb_expander_info,
+ },
};
static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH v4 5/5] da850-evm: KEYBOARD_GPIO and INPUT_POLLDEV Kconfig conditionals
2010-11-23 19:40 ` [PATCH v4 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
` (3 preceding siblings ...)
2010-11-23 19:40 ` [PATCH v4 4/5] da850-evm: add baseboard GPIO expander buttons, switches and LEDs Ben Gardiner
@ 2010-11-23 19:41 ` Ben Gardiner
2010-11-24 21:59 ` [PATCH v5 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
5 siblings, 0 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-11-23 19:41 UTC (permalink / raw)
To: Kevin Hilman, davinci-linux-open-source, linux-input, Dmitry Torokhov
Cc: linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori, Kevin Hilman
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
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH v5 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders
2010-11-23 19:40 ` [PATCH v4 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
` (4 preceding siblings ...)
2010-11-23 19:41 ` [PATCH v4 5/5] da850-evm: KEYBOARD_GPIO and INPUT_POLLDEV Kconfig conditionals Ben Gardiner
@ 2010-11-24 21:59 ` Ben Gardiner
2010-11-24 21:59 ` [PATCH v5 1/5] [WIP] input: add input driver for polled GPIO buttons Ben Gardiner
` (5 more replies)
5 siblings, 6 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-11-24 21:59 UTC (permalink / raw)
To: Kevin Hilman, davinci-linux-open-source, linux-input, Dmitry Torokhov
Cc: linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori, Gabor Juhos
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 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 patch series using evtest on the resulting /dev/input/eventN
devices and also on the event node of a non-polling gpio-keys instance to
ensure that irq-based input handling is not broken by the introduction of the
polling-mode gpio-keys patch. The non-polling instance creation and
registration is not included in this series since it uses one of the boot-mode
DIP switches and woult not (I think) be suitable for mainline.
Disclaimer:
I'm not an expert in irq's or gpio-keys; this is, in fact, my first proposed
feature. Please feel free to correct me -- I welcome the chance to learn from
your expertise.
Ben Gardiner (4):
da850-evm: add UI Expander pushbuttons
da850-evm: extract defines for SEL{A,B,C} pins in UI expander
da850-evm: add baseboard GPIO expander buttons, switches and LEDs
da850-evm: KEYBOARD_GPIO_POLLED Kconfig conditional
Gabor Juhos (1):
[WIP] input: add input driver for polled GPIO buttons
arch/arm/mach-davinci/Kconfig | 3 +
arch/arm/mach-davinci/board-da850-evm.c | 306 +++++++++++++++++++++++++++--
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 +++
6 files changed, 581 insertions(+), 12 deletions(-)
create mode 100644 drivers/input/keyboard/gpio_keys_polled.c
create mode 100644 include/linux/gpio_keys_polled.h
---
Changes since v4:
* integrated Gabor Juhos' polling gpio button driver in place of the
gpio-keys patch of Paul Mundt and Alex Clouter
* dont' line break error messages (Sekhar Nori)
* whitespace cleanup (Sekhar Nori)
Changes since v3:
* introduced patch 5 in the series by extracting the Kconfig changes proposed
in patch 2 of v3.
* not gpio_request()'ing the sw_rst and deep_sleep_en lines as requested
(Sekhar Nori)
Changes since v2:
* register a single input device for switches and keys on the baseboard since
there is no benefit to separate devices with different polling intervals
(Dmitry Torokhov)
* use static array intialization and range intialization for platform data
structure to minimize the amount of runtime intialization needed:
(Sekhar Nori)
* Use the da850_evm variable name prefix for static symbols in
board-da850-evm.c
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
* 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
^ permalink raw reply [flat|nested] 62+ messages in thread
* [PATCH v5 1/5] [WIP] input: add input driver for polled GPIO buttons
2010-11-24 21:59 ` [PATCH v5 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
@ 2010-11-24 21:59 ` Ben Gardiner
2010-11-24 21:59 ` [PATCH v5 2/5] da850-evm: add UI Expander pushbuttons Ben Gardiner
` (4 subsequent siblings)
5 siblings, 0 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-11-24 21:59 UTC (permalink / raw)
To: Kevin Hilman, davinci-linux-open-source, linux-input, Dmitry Torokhov
Cc: linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos, Dmitry Torokhov, Mike Frysinger
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 board-specific
+ setup logic must also provide a platform device,
+ with configuration data saying which GPIOs are used.
+
+ To compile this driver as a module, choose M here: the
+ module will be called gpio-buttons.
+
endif
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index a34452e..e6da817 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -44,3 +44,5 @@ obj-$(CONFIG_KEYBOARD_TNETV107X) += tnetv107x-keypad.o
obj-$(CONFIG_KEYBOARD_TWL4030) += twl4030_keypad.o
obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o
obj-$(CONFIG_KEYBOARD_W90P910) += w90p910_keypad.o
+obj-$(CONFIG_KEYBOARD_GPIO_POLLED) += gpio_keys_polled.o
+
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
new file mode 100644
index 0000000..390ed93
--- /dev/null
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -0,0 +1,240 @@
+/*
+ * Driver for buttons on GPIO lines not capable of generating interrupts
+ *
+ * Copyright (C) 2007-2010 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (C) 2010 Nuno Goncalves <nunojpg@gmail.com>
+ *
+ * This file was based on: /drivers/input/misc/cobalt_btns.c
+ * Copyright (C) 2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
+ *
+ * also was based on: /drivers/input/keyboard/gpio_keys.c
+ * Copyright 2005 Phil Blundell
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/input.h>
+#include <linux/input-polldev.h>
+#include <linux/ioport.h>
+#include <linux/platform_device.h>
+#include <linux/gpio.h>
+#include <linux/gpio_keys_polled.h>
+
+#define DRV_NAME "gpio-keys-polled"
+
+struct gpio_keys_button_data {
+ int last_state;
+ int count;
+ int can_sleep;
+};
+
+struct gpio_keys_polled_dev {
+ struct input_polled_dev *poll_dev;
+ struct gpio_keys_polled_platform_data *pdata;
+ struct gpio_keys_button_data *data;
+};
+
+static void gpio_keys_polled_check_state(struct input_dev *input,
+ struct gpio_keys_button *button,
+ struct gpio_keys_button_data *bdata)
+{
+ int state;
+
+ if (bdata->can_sleep)
+ state = !!gpio_get_value_cansleep(button->gpio);
+ else
+ state = !!gpio_get_value(button->gpio);
+
+ if (state != bdata->last_state) {
+ unsigned int type = button->type ?: EV_KEY;
+
+ input_event(input, type, button->code,
+ !!(state ^ button->active_low));
+ input_sync(input);
+ bdata->count = 0;
+ bdata->last_state = state;
+ }
+}
+
+static void gpio_keys_polled_poll(struct input_polled_dev *dev)
+{
+ struct gpio_keys_polled_dev *bdev = dev->private;
+ struct gpio_keys_polled_platform_data *pdata = bdev->pdata;
+ struct input_dev *input = dev->input;
+ int i, threshold;
+
+ for (i = 0; i < bdev->pdata->nbuttons; i++) {
+ struct gpio_keys_button *button = &pdata->buttons[i];
+ struct gpio_keys_button_data *bdata = &bdev->data[i];
+
+ threshold = round_up(button->debounce_interval,
+ pdata->poll_interval) /
+ pdata->poll_interval;
+ if (bdata->count < threshold)
+ bdata->count++;
+ else
+ gpio_keys_polled_check_state(input, button, bdata);
+
+ }
+}
+
+static int __devinit gpio_keys_polled_probe(struct platform_device *pdev)
+{
+ struct gpio_keys_polled_platform_data *pdata = pdev->dev.platform_data;
+ struct device *dev = &pdev->dev;
+ struct gpio_keys_polled_dev *bdev;
+ struct input_polled_dev *poll_dev;
+ struct input_dev *input;
+ int error;
+ int i;
+
+ if (!pdata)
+ return -ENXIO;
+
+ bdev = kzalloc(sizeof(struct gpio_keys_polled_dev) +
+ pdata->nbuttons * sizeof(struct gpio_keys_button_data),
+ GFP_KERNEL);
+ if (!bdev) {
+ dev_err(dev, "no memory for private data\n");
+ return -ENOMEM;
+ }
+
+ bdev->data = (struct gpio_keys_button_data *) &bdev[1];
+
+ poll_dev = input_allocate_polled_device();
+ if (!poll_dev) {
+ dev_err(dev, "no memory for polled device\n");
+ error = -ENOMEM;
+ goto err_free_bdev;
+ }
+
+ poll_dev->private = bdev;
+ poll_dev->poll = gpio_keys_polled_poll;
+ poll_dev->poll_interval = pdata->poll_interval;
+
+ input = poll_dev->input;
+
+ input->evbit[0] = BIT(EV_KEY);
+ input->name = pdev->name;
+ input->phys = DRV_NAME"/input0";
+ input->dev.parent = &pdev->dev;
+
+ input->id.bustype = BUS_HOST;
+ input->id.vendor = 0x0001;
+ input->id.product = 0x0001;
+ input->id.version = 0x0100;
+
+ for (i = 0; i < pdata->nbuttons; i++) {
+ struct gpio_keys_button *button = &pdata->buttons[i];
+ unsigned int gpio = button->gpio;
+ unsigned int type = button->type ?: EV_KEY;
+
+ if (button->wakeup) {
+ dev_err(dev, DRV_NAME " does not support wakeup\n");
+ goto err_free_gpio;
+ }
+
+ error = gpio_request(gpio,
+ button->desc ? button->desc : DRV_NAME);
+ if (error) {
+ dev_err(dev, "unable to claim gpio %u, err=%d\n",
+ gpio, error);
+ goto err_free_gpio;
+ }
+
+ error = gpio_direction_input(gpio);
+ if (error) {
+ dev_err(dev,
+ "unable to set direction on gpio %u, err=%d\n",
+ gpio, error);
+ goto err_free_gpio;
+ }
+
+ bdev->data[i].can_sleep = gpio_cansleep(gpio);
+ bdev->data[i].last_state = -1;
+
+ input_set_capability(input, type, button->code);
+ }
+
+ bdev->poll_dev = poll_dev;
+ bdev->pdata = pdata;
+ platform_set_drvdata(pdev, bdev);
+
+ error = input_register_polled_device(poll_dev);
+ if (error) {
+ dev_err(dev, "unable to register polled device, err=%d\n",
+ error);
+ goto err_free_gpio;
+ }
+
+ /* report initial state of the buttons */
+ for (i = 0; i < pdata->nbuttons; i++)
+ gpio_keys_polled_check_state(input, &pdata->buttons[i],
+ &bdev->data[i]);
+
+ return 0;
+
+err_free_gpio:
+ for (i = i - 1; i >= 0; i--)
+ gpio_free(pdata->buttons[i].gpio);
+
+ input_free_polled_device(poll_dev);
+
+err_free_bdev:
+ kfree(bdev);
+
+ platform_set_drvdata(pdev, NULL);
+ return error;
+}
+
+static int __devexit gpio_keys_polled_remove(struct platform_device *pdev)
+{
+ struct gpio_keys_polled_dev *bdev = platform_get_drvdata(pdev);
+ struct gpio_keys_polled_platform_data *pdata = bdev->pdata;
+ int i;
+
+ input_unregister_polled_device(bdev->poll_dev);
+
+ for (i = 0; i < pdata->nbuttons; i++)
+ gpio_free(pdata->buttons[i].gpio);
+
+ input_free_polled_device(bdev->poll_dev);
+
+ kfree(bdev);
+ platform_set_drvdata(pdev, NULL);
+
+ return 0;
+}
+
+static struct platform_driver gpio_keys_polled_driver = {
+ .probe = gpio_keys_polled_probe,
+ .remove = __devexit_p(gpio_keys_polled_remove),
+ .driver = {
+ .name = DRV_NAME,
+ .owner = THIS_MODULE,
+ },
+};
+
+static int __init gpio_keys_polled_init(void)
+{
+ return platform_driver_register(&gpio_keys_polled_driver);
+}
+
+static void __exit gpio_keys_polled_exit(void)
+{
+ platform_driver_unregister(&gpio_keys_polled_driver);
+}
+
+module_init(gpio_keys_polled_init);
+module_exit(gpio_keys_polled_exit);
+
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
+MODULE_DESCRIPTION("Polled GPIO Buttons driver");
diff --git a/include/linux/gpio_keys_polled.h b/include/linux/gpio_keys_polled.h
new file mode 100644
index 0000000..bf7f94a
--- /dev/null
+++ b/include/linux/gpio_keys_polled.h
@@ -0,0 +1,26 @@
+/*
+ * Definitions for the GPIO buttons interface driver
+ *
+ * Copyright (C) 2007-2010 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This file was based on: /include/linux/gpio_keys.h
+ * The original gpio_keys.h seems not to have a license.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#ifndef _GPIO_BUTTONS_H_
+#define _GPIO_BUTTONS_H_
+
+#include <linux/gpio_keys.h>
+
+struct gpio_keys_polled_platform_data {
+ struct gpio_keys_button *buttons;
+ int nbuttons; /* number of buttons */
+ int poll_interval; /* polling interval in msecs*/
+};
+
+#endif /* _GPIO_BUTTONS_H_ */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH v5 2/5] da850-evm: add UI Expander pushbuttons
2010-11-24 21:59 ` [PATCH v5 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
2010-11-24 21:59 ` [PATCH v5 1/5] [WIP] input: add input driver for polled GPIO buttons Ben Gardiner
@ 2010-11-24 21:59 ` Ben Gardiner
2010-11-24 21:59 ` [PATCH v5 3/5] da850-evm: extract defines for SEL{A,B,C} pins in UI expander Ben Gardiner
` (3 subsequent siblings)
5 siblings, 0 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-11-24 21:59 UTC (permalink / raw)
To: Kevin Hilman, davinci-linux-open-source, linux-input, Dmitry Torokhov
Cc: linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos, Govindarajan, Sriramakrishnan, Kevin Hilman
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 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/board-da850-evm.c | 95 +++++++++++++++++++++++++++++++
1 files changed, 95 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index f89b0b7..f6490f8 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -17,8 +17,10 @@
#include <linux/i2c.h>
#include <linux/i2c/at24.h>
#include <linux/i2c/pca953x.h>
+#include <linux/input.h>
#include <linux/mfd/tps6507x.h>
#include <linux/gpio.h>
+#include <linux/gpio_keys_polled.h>
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
@@ -272,6 +274,87 @@ static inline void da850_evm_setup_emac_rmii(int rmii_sel)
static inline void da850_evm_setup_emac_rmii(int rmii_sel) { }
#endif
+
+#define DA850_KEYS_DEBOUNCE_MS 10
+/*
+ * At 200ms polling interval it is possible to miss an
+ * event by tapping very lightly on the push button but most
+ * pushes do result in an event; longer intervals require the
+ * user to hold the button whereas shorter intervals require
+ * more CPU time for polling.
+ */
+#define DA850_GPIO_KEYS_POLL_MS 200
+
+enum da850_evm_ui_exp_pins {
+ DA850_EVM_UI_EXP_SEL_C = 5,
+ DA850_EVM_UI_EXP_SEL_B,
+ DA850_EVM_UI_EXP_SEL_A,
+ DA850_EVM_UI_EXP_PB8,
+ DA850_EVM_UI_EXP_PB7,
+ DA850_EVM_UI_EXP_PB6,
+ DA850_EVM_UI_EXP_PB5,
+ DA850_EVM_UI_EXP_PB4,
+ DA850_EVM_UI_EXP_PB3,
+ DA850_EVM_UI_EXP_PB2,
+ DA850_EVM_UI_EXP_PB1,
+};
+
+static const char const *da850_evm_ui_exp[] = {
+ [DA850_EVM_UI_EXP_SEL_C] = "sel_c",
+ [DA850_EVM_UI_EXP_SEL_B] = "sel_b",
+ [DA850_EVM_UI_EXP_SEL_A] = "sel_a",
+ [DA850_EVM_UI_EXP_PB8] = "pb8",
+ [DA850_EVM_UI_EXP_PB7] = "pb7",
+ [DA850_EVM_UI_EXP_PB6] = "pb6",
+ [DA850_EVM_UI_EXP_PB5] = "pb5",
+ [DA850_EVM_UI_EXP_PB4] = "pb4",
+ [DA850_EVM_UI_EXP_PB3] = "pb3",
+ [DA850_EVM_UI_EXP_PB2] = "pb2",
+ [DA850_EVM_UI_EXP_PB1] = "pb1",
+};
+
+#define DA850_N_UI_PB 8
+
+static struct gpio_keys_button da850_evm_ui_keys[] = {
+ [0 ... DA850_N_UI_PB - 1] = {
+ .type = EV_KEY,
+ .active_low = 1,
+ .wakeup = 0,
+ .debounce_interval = DA850_KEYS_DEBOUNCE_MS,
+ .code = -1, /* assigned at runtime */
+ .gpio = -1, /* assigned at runtime */
+ .desc = NULL, /* assigned at runtime */
+ },
+};
+
+static struct gpio_keys_polled_platform_data da850_evm_ui_keys_pdata = {
+ .buttons = da850_evm_ui_keys,
+ .nbuttons = ARRAY_SIZE(da850_evm_ui_keys),
+ .poll_interval = DA850_GPIO_KEYS_POLL_MS,
+};
+
+static struct platform_device da850_evm_ui_keys_device = {
+ .name = "gpio-keys-polled",
+ .id = 0,
+ .dev = {
+ .platform_data = &da850_evm_ui_keys_pdata
+ },
+};
+
+static void da850_evm_ui_keys_init(unsigned gpio)
+{
+ int i;
+ struct gpio_keys_button *button;
+
+ for (i = 0; i < DA850_N_UI_PB; i++) {
+ button = &da850_evm_ui_keys[i];
+ button->code = KEY_F8 - i;
+ button->desc = (char *)
+ da850_evm_ui_exp[DA850_EVM_UI_EXP_PB8 + i];
+ button->gpio = gpio + DA850_EVM_UI_EXP_PB8 + i;
+ }
+}
+
static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
unsigned ngpio, void *c)
{
@@ -304,6 +387,13 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
gpio_direction_output(sel_b, 1);
gpio_direction_output(sel_c, 1);
+ da850_evm_ui_keys_init(gpio);
+ ret = platform_device_register(&da850_evm_ui_keys_device);
+ if (ret) {
+ pr_warning("Could not register UI GPIO expander push-buttons");
+ goto exp_setup_keys_fail;
+ }
+
ui_card_detected = 1;
pr_info("DA850/OMAP-L138 EVM UI card detected\n");
@@ -313,6 +403,8 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
return 0;
+exp_setup_keys_fail:
+ gpio_free(sel_c);
exp_setup_selc_fail:
gpio_free(sel_b);
exp_setup_selb_fail:
@@ -324,6 +416,8 @@ exp_setup_sela_fail:
static int da850_evm_ui_expander_teardown(struct i2c_client *client,
unsigned gpio, unsigned ngpio, void *c)
{
+ platform_device_unregister(&da850_evm_ui_keys_device);
+
/* deselect all functionalities */
gpio_set_value_cansleep(gpio + 5, 1);
gpio_set_value_cansleep(gpio + 6, 1);
@@ -340,6 +434,7 @@ static struct pca953x_platform_data da850_evm_ui_expander_info = {
.gpio_base = DAVINCI_N_GPIO,
.setup = da850_evm_ui_expander_setup,
.teardown = da850_evm_ui_expander_teardown,
+ .names = da850_evm_ui_exp,
};
static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH v5 3/5] da850-evm: extract defines for SEL{A,B,C} pins in UI expander
2010-11-24 21:59 ` [PATCH v5 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
2010-11-24 21:59 ` [PATCH v5 1/5] [WIP] input: add input driver for polled GPIO buttons Ben Gardiner
2010-11-24 21:59 ` [PATCH v5 2/5] da850-evm: add UI Expander pushbuttons Ben Gardiner
@ 2010-11-24 21:59 ` Ben Gardiner
2010-11-24 21:59 ` [PATCH v5 4/5] da850-evm: add baseboard GPIO expander buttons, switches and LEDs Ben Gardiner
` (2 subsequent siblings)
5 siblings, 0 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-11-24 21:59 UTC (permalink / raw)
To: Kevin Hilman, davinci-linux-open-source, linux-input, Dmitry Torokhov
Cc: linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos, Victor Rodriguez
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, "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 exp_setup_selc_fail;
@@ -419,13 +419,13 @@ static int da850_evm_ui_expander_teardown(struct i2c_client *client,
platform_device_unregister(&da850_evm_ui_keys_device);
/* deselect all functionalities */
- gpio_set_value_cansleep(gpio + 5, 1);
- gpio_set_value_cansleep(gpio + 6, 1);
- gpio_set_value_cansleep(gpio + 7, 1);
+ gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_C, 1);
+ gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_B, 1);
+ gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_A, 1);
- gpio_free(gpio + 5);
- gpio_free(gpio + 6);
- gpio_free(gpio + 7);
+ gpio_free(gpio + DA850_EVM_UI_EXP_SEL_C);
+ gpio_free(gpio + DA850_EVM_UI_EXP_SEL_B);
+ gpio_free(gpio + DA850_EVM_UI_EXP_SEL_A);
return 0;
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH v5 4/5] da850-evm: add baseboard GPIO expander buttons, switches and LEDs
2010-11-24 21:59 ` [PATCH v5 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
` (2 preceding siblings ...)
2010-11-24 21:59 ` [PATCH v5 3/5] da850-evm: extract defines for SEL{A,B,C} pins in UI expander Ben Gardiner
@ 2010-11-24 21:59 ` Ben Gardiner
2010-11-24 21:59 ` [PATCH v5 5/5] da850-evm: KEYBOARD_GPIO_POLLED Kconfig conditional Ben Gardiner
2010-12-09 21:51 ` [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
5 siblings, 0 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-11-24 21:59 UTC (permalink / raw)
To: Kevin Hilman, davinci-linux-open-source, linux-input, Dmitry Torokhov
Cc: linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos, Govindarajan, Sriramakrishnan
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 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 | 187 +++++++++++++++++++++++++++++++
1 files changed, 187 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 8f7a605..14d3381 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -430,6 +430,182 @@ static int da850_evm_ui_expander_teardown(struct i2c_client *client,
return 0;
}
+/* assign the baseboard expander's GPIOs after the UI board's */
+#define DA850_UI_EXPANDER_N_GPIOS ARRAY_SIZE(da850_evm_ui_exp)
+#define DA850_BB_EXPANDER_GPIO_BASE (DAVINCI_N_GPIO + DA850_UI_EXPANDER_N_GPIOS)
+
+enum da850_evm_bb_exp_pins {
+ DA850_EVM_BB_EXP_DEEP_SLEEP_EN = 0,
+ DA850_EVM_BB_EXP_SW_RST,
+ DA850_EVM_BB_EXP_TP_23,
+ DA850_EVM_BB_EXP_TP_22,
+ DA850_EVM_BB_EXP_TP_21,
+ DA850_EVM_BB_EXP_USER_PB1,
+ DA850_EVM_BB_EXP_USER_LED2,
+ DA850_EVM_BB_EXP_USER_LED1,
+ DA850_EVM_BB_EXP_USER_SW1,
+ DA850_EVM_BB_EXP_USER_SW2,
+ DA850_EVM_BB_EXP_USER_SW3,
+ DA850_EVM_BB_EXP_USER_SW4,
+ DA850_EVM_BB_EXP_USER_SW5,
+ DA850_EVM_BB_EXP_USER_SW6,
+ DA850_EVM_BB_EXP_USER_SW7,
+ DA850_EVM_BB_EXP_USER_SW8
+};
+
+static const char const *da850_evm_bb_exp[] = {
+ [DA850_EVM_BB_EXP_DEEP_SLEEP_EN] = "deep_sleep_en",
+ [DA850_EVM_BB_EXP_SW_RST] = "sw_rst",
+ [DA850_EVM_BB_EXP_TP_23] = "tp_23",
+ [DA850_EVM_BB_EXP_TP_22] = "tp_22",
+ [DA850_EVM_BB_EXP_TP_21] = "tp_21",
+ [DA850_EVM_BB_EXP_USER_PB1] = "user_pb1",
+ [DA850_EVM_BB_EXP_USER_LED2] = "user_led2",
+ [DA850_EVM_BB_EXP_USER_LED1] = "user_led1",
+ [DA850_EVM_BB_EXP_USER_SW1] = "user_sw1",
+ [DA850_EVM_BB_EXP_USER_SW2] = "user_sw2",
+ [DA850_EVM_BB_EXP_USER_SW3] = "user_sw3",
+ [DA850_EVM_BB_EXP_USER_SW4] = "user_sw4",
+ [DA850_EVM_BB_EXP_USER_SW5] = "user_sw5",
+ [DA850_EVM_BB_EXP_USER_SW6] = "user_sw6",
+ [DA850_EVM_BB_EXP_USER_SW7] = "user_sw7",
+ [DA850_EVM_BB_EXP_USER_SW8] = "user_sw8",
+};
+
+#define DA850_N_BB_USER_SW 8
+
+static struct gpio_keys_button da850_evm_bb_keys[] = {
+ [0] = {
+ .type = EV_KEY,
+ .active_low = 1,
+ .wakeup = 0,
+ .debounce_interval = DA850_KEYS_DEBOUNCE_MS,
+ .code = KEY_PROG1,
+ .desc = NULL, /* assigned at runtime */
+ .gpio = -1, /* assigned at runtime */
+ },
+ [1 ... DA850_N_BB_USER_SW] = {
+ .type = EV_SW,
+ .active_low = 1,
+ .wakeup = 0,
+ .debounce_interval = DA850_KEYS_DEBOUNCE_MS,
+ .code = -1, /* assigned at runtime */
+ .desc = NULL, /* assigned at runtime */
+ .gpio = -1, /* assigned at runtime */
+ },
+};
+
+static struct gpio_keys_polled_platform_data da850_evm_bb_keys_pdata = {
+ .buttons = da850_evm_bb_keys,
+ .nbuttons = ARRAY_SIZE(da850_evm_bb_keys),
+ .poll_interval = DA850_GPIO_KEYS_POLL_MS,
+};
+
+static struct platform_device da850_evm_bb_keys_device = {
+ .name = "gpio-keys-polled",
+ .id = 1,
+ .dev = {
+ .platform_data = &da850_evm_bb_keys_pdata
+ },
+};
+
+static void da850_evm_bb_keys_init(unsigned gpio)
+{
+ int i;
+ struct gpio_keys_button *button;
+
+ button = &da850_evm_bb_keys[0];
+ button->desc = (char *)
+ da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_PB1];
+ button->gpio = gpio + DA850_EVM_BB_EXP_USER_PB1;
+
+ for (i = 0; i < DA850_N_BB_USER_SW; i++) {
+ button = &da850_evm_bb_keys[i + 1];
+ button->code = SW_LID + i;
+ button->desc = (char *)
+ da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_SW1 + i];
+ button->gpio = gpio + DA850_EVM_BB_EXP_USER_SW1 + i;
+ }
+}
+
+#define DA850_N_BB_USER_LED 2
+
+static struct gpio_led da850_evm_bb_leds[] = {
+ [0 ... DA850_N_BB_USER_LED - 1] = {
+ .active_low = 1,
+ .gpio = -1, /* assigned at runtime */
+ .name = NULL, /* assigned at runtime */
+ },
+};
+
+static struct gpio_led_platform_data da850_evm_bb_leds_pdata = {
+ .leds = da850_evm_bb_leds,
+ .num_leds = ARRAY_SIZE(da850_evm_bb_leds),
+};
+
+static struct platform_device da850_evm_bb_leds_device = {
+ .name = "leds-gpio",
+ .id = -1,
+ .dev = {
+ .platform_data = &da850_evm_bb_leds_pdata
+ }
+};
+
+static void da850_evm_bb_leds_init(unsigned gpio)
+{
+ int i;
+ struct gpio_led *led;
+
+ for (i = 0; i < DA850_N_BB_USER_LED; i++) {
+ led = &da850_evm_bb_leds[i];
+
+ led->gpio = gpio + DA850_EVM_BB_EXP_USER_LED2 + i;
+ led->name =
+ da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_LED2 + i];
+ }
+}
+
+static int da850_evm_bb_expander_setup(struct i2c_client *client,
+ unsigned gpio, unsigned ngpio,
+ void *c)
+{
+ int ret;
+
+ /*
+ * Register the switches and pushbutton on the baseboard as a gpio-keys
+ * device.
+ */
+ da850_evm_bb_keys_init(gpio);
+ ret = platform_device_register(&da850_evm_bb_keys_device);
+ if (ret) {
+ pr_warning("Could not register baseboard GPIO expander keys");
+ goto io_exp_setup_sw_fail;
+ }
+
+ da850_evm_bb_leds_init(gpio);
+ ret = platform_device_register(&da850_evm_bb_leds_device);
+ if (ret) {
+ pr_warning("Could not register baseboard GPIO expander LEDS");
+ goto io_exp_setup_leds_fail;
+ }
+
+ return 0;
+
+io_exp_setup_leds_fail:
+ platform_device_unregister(&da850_evm_bb_keys_device);
+io_exp_setup_sw_fail:
+ return ret;
+}
+
+static int da850_evm_bb_expander_teardown(struct i2c_client *client,
+ unsigned gpio, unsigned ngpio, void *c)
+{
+ platform_device_unregister(&da850_evm_bb_leds_device);
+ platform_device_unregister(&da850_evm_bb_keys_device);
+
+ return 0;
+}
+
static struct pca953x_platform_data da850_evm_ui_expander_info = {
.gpio_base = DAVINCI_N_GPIO,
.setup = da850_evm_ui_expander_setup,
@@ -437,6 +613,13 @@ static struct pca953x_platform_data da850_evm_ui_expander_info = {
.names = da850_evm_ui_exp,
};
+static struct pca953x_platform_data da850_evm_bb_expander_info = {
+ .gpio_base = DA850_BB_EXPANDER_GPIO_BASE,
+ .setup = da850_evm_bb_expander_setup,
+ .teardown = da850_evm_bb_expander_teardown,
+ .names = da850_evm_bb_exp,
+};
+
static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {
{
I2C_BOARD_INFO("tlv320aic3x", 0x18),
@@ -445,6 +628,10 @@ static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {
I2C_BOARD_INFO("tca6416", 0x20),
.platform_data = &da850_evm_ui_expander_info,
},
+ {
+ I2C_BOARD_INFO("tca6416", 0x21),
+ .platform_data = &da850_evm_bb_expander_info,
+ },
};
static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH v5 5/5] da850-evm: KEYBOARD_GPIO_POLLED Kconfig conditional
2010-11-24 21:59 ` [PATCH v5 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
` (3 preceding siblings ...)
2010-11-24 21:59 ` [PATCH v5 4/5] da850-evm: add baseboard GPIO expander buttons, switches and LEDs Ben Gardiner
@ 2010-11-24 21:59 ` Ben Gardiner
2010-12-09 21:51 ` [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
5 siblings, 0 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-11-24 21:59 UTC (permalink / raw)
To: Kevin Hilman, davinci-linux-open-source, linux-input, Dmitry Torokhov
Cc: linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos, Kevin Hilman
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
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders
2010-11-24 21:59 ` [PATCH v5 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
` (4 preceding siblings ...)
2010-11-24 21:59 ` [PATCH v5 5/5] da850-evm: KEYBOARD_GPIO_POLLED Kconfig conditional Ben Gardiner
@ 2010-12-09 21:51 ` Ben Gardiner
2010-12-09 21:51 ` [PATCH v6 1/5] Input: add input driver for polled GPIO buttons Ben Gardiner
` (5 more replies)
5 siblings, 6 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-12-09 21:51 UTC (permalink / raw)
To: Kevin Hilman, davinci-linux-open-source, linux-input, Dmitry Torokhov
Cc: linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori, Gabor Juhos
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 patch series using evtest on the resulting /dev/input/eventN
devices and also on the event node of a non-polling gpio-keys instance to
ensure that irq-based input handling is not broken by the introduction of the
polling-mode gpio-keys patch. The non-polling instance creation and
registration is not included in this series since it uses one of the boot-mode
DIP switches and woult not (I think) be suitable for mainline.
Disclaimer:
I'm not an expert in irq's or gpio-keys; this is, in fact, my first proposed
feature. Please feel free to correct me -- I welcome the chance to learn from
your expertise.
Ben Gardiner (4):
da850-evm: add UI Expander pushbuttons
da850-evm: extract defines for SEL{A,B,C} pins in UI expander
da850-evm: add baseboard GPIO expander buttons, switches and LEDs
da850-evm: KEYBOARD_GPIO_POLLED Kconfig conditional
Gabor Juhos (1):
Input: add input driver for polled GPIO buttons
arch/arm/mach-davinci/Kconfig | 3 +
arch/arm/mach-davinci/board-da850-evm.c | 306 +++++++++++++++++++++++++++--
drivers/input/keyboard/Kconfig | 16 ++
drivers/input/keyboard/Makefile | 1 +
drivers/input/keyboard/gpio_keys_polled.c | 261 ++++++++++++++++++++++++
include/linux/gpio_keys.h | 2 +
6 files changed, 577 insertions(+), 12 deletions(-)
create mode 100644 drivers/input/keyboard/gpio_keys_polled.c
---
Changes since v5:
* included the final polled gpio keys driver which is now in 2.6.37-rc5
at 0e7d0c860a0dee49dacb7bbb248d1eba637075ad
* small changes to includes and structure names due to driver changes
Changes since v4:
* integrated Gabor Juhos' polling gpio button driver in place of the
gpio-keys patch of Paul Mundt and Alex Clouter
* dont' line break error messages (Sekhar Nori)
* whitespace cleanup (Sekhar Nori)
Changes since v3:
* introduced patch 5 in the series by extracting the Kconfig changes proposed
in patch 2 of v3.
* not gpio_request()'ing the sw_rst and deep_sleep_en lines as requested
(Sekhar Nori)
Changes since v2:
* register a single input device for switches and keys on the baseboard since
there is no benefit to separate devices with different polling intervals
(Dmitry Torokhov)
* use static array intialization and range intialization for platform data
structure to minimize the amount of runtime intialization needed:
(Sekhar Nori)
* Use the da850_evm variable name prefix for static symbols in
board-da850-evm.c
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
* 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
^ permalink raw reply [flat|nested] 62+ messages in thread
* [PATCH v6 1/5] Input: add input driver for polled GPIO buttons
2010-12-09 21:51 ` [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
@ 2010-12-09 21:51 ` Ben Gardiner
2010-12-10 15:50 ` Kevin Hilman
2010-12-09 21:51 ` [PATCH v6 2/5] da850-evm: add UI Expander pushbuttons Ben Gardiner
` (4 subsequent siblings)
5 siblings, 1 reply; 62+ messages in thread
From: Ben Gardiner @ 2010-12-09 21:51 UTC (permalink / raw)
To: Kevin Hilman, davinci-linux-open-source, linux-input, Dmitry Torokhov
Cc: linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos, Dmitry Torokhov
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 configuration data saying which GPIOs are used.
+
+ To compile this driver as a module, choose M here: the
+ module will be called gpio_keys_polled.
+
config KEYBOARD_TCA6416
tristate "TCA6416 Keypad Support"
depends on I2C
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index a34452e..622de73 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o
obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o
obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o
obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o
+obj-$(CONFIG_KEYBOARD_GPIO_POLLED) += gpio_keys_polled.o
obj-$(CONFIG_KEYBOARD_TCA6416) += tca6416-keypad.o
obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o
obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
new file mode 100644
index 0000000..4c17aff
--- /dev/null
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -0,0 +1,261 @@
+/*
+ * Driver for buttons on GPIO lines not capable of generating interrupts
+ *
+ * Copyright (C) 2007-2010 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (C) 2010 Nuno Goncalves <nunojpg@gmail.com>
+ *
+ * This file was based on: /drivers/input/misc/cobalt_btns.c
+ * Copyright (C) 2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
+ *
+ * also was based on: /drivers/input/keyboard/gpio_keys.c
+ * Copyright 2005 Phil Blundell
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/input.h>
+#include <linux/input-polldev.h>
+#include <linux/ioport.h>
+#include <linux/platform_device.h>
+#include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+
+#define DRV_NAME "gpio-keys-polled"
+
+struct gpio_keys_button_data {
+ int last_state;
+ int count;
+ int threshold;
+ int can_sleep;
+};
+
+struct gpio_keys_polled_dev {
+ struct input_polled_dev *poll_dev;
+ struct device *dev;
+ struct gpio_keys_platform_data *pdata;
+ struct gpio_keys_button_data data[0];
+};
+
+static void gpio_keys_polled_check_state(struct input_dev *input,
+ struct gpio_keys_button *button,
+ struct gpio_keys_button_data *bdata)
+{
+ int state;
+
+ if (bdata->can_sleep)
+ state = !!gpio_get_value_cansleep(button->gpio);
+ else
+ state = !!gpio_get_value(button->gpio);
+
+ if (state != bdata->last_state) {
+ unsigned int type = button->type ?: EV_KEY;
+
+ input_event(input, type, button->code,
+ !!(state ^ button->active_low));
+ input_sync(input);
+ bdata->count = 0;
+ bdata->last_state = state;
+ }
+}
+
+static void gpio_keys_polled_poll(struct input_polled_dev *dev)
+{
+ struct gpio_keys_polled_dev *bdev = dev->private;
+ struct gpio_keys_platform_data *pdata = bdev->pdata;
+ struct input_dev *input = dev->input;
+ int i;
+
+ for (i = 0; i < bdev->pdata->nbuttons; i++) {
+ struct gpio_keys_button_data *bdata = &bdev->data[i];
+
+ if (bdata->count < bdata->threshold)
+ bdata->count++;
+ else
+ gpio_keys_polled_check_state(input, &pdata->buttons[i],
+ bdata);
+ }
+}
+
+static void gpio_keys_polled_open(struct input_polled_dev *dev)
+{
+ struct gpio_keys_polled_dev *bdev = dev->private;
+ struct gpio_keys_platform_data *pdata = bdev->pdata;
+
+ if (pdata->enable)
+ pdata->enable(bdev->dev);
+}
+
+static void gpio_keys_polled_close(struct input_polled_dev *dev)
+{
+ struct gpio_keys_polled_dev *bdev = dev->private;
+ struct gpio_keys_platform_data *pdata = bdev->pdata;
+
+ if (pdata->disable)
+ pdata->disable(bdev->dev);
+}
+
+static int __devinit gpio_keys_polled_probe(struct platform_device *pdev)
+{
+ struct gpio_keys_platform_data *pdata = pdev->dev.platform_data;
+ struct device *dev = &pdev->dev;
+ struct gpio_keys_polled_dev *bdev;
+ struct input_polled_dev *poll_dev;
+ struct input_dev *input;
+ int error;
+ int i;
+
+ if (!pdata || !pdata->poll_interval)
+ return -EINVAL;
+
+ bdev = kzalloc(sizeof(struct gpio_keys_polled_dev) +
+ pdata->nbuttons * sizeof(struct gpio_keys_button_data),
+ GFP_KERNEL);
+ if (!bdev) {
+ dev_err(dev, "no memory for private data\n");
+ return -ENOMEM;
+ }
+
+ poll_dev = input_allocate_polled_device();
+ if (!poll_dev) {
+ dev_err(dev, "no memory for polled device\n");
+ error = -ENOMEM;
+ goto err_free_bdev;
+ }
+
+ poll_dev->private = bdev;
+ poll_dev->poll = gpio_keys_polled_poll;
+ poll_dev->poll_interval = pdata->poll_interval;
+ poll_dev->open = gpio_keys_polled_open;
+ poll_dev->close = gpio_keys_polled_close;
+
+ input = poll_dev->input;
+
+ input->evbit[0] = BIT(EV_KEY);
+ input->name = pdev->name;
+ input->phys = DRV_NAME"/input0";
+ input->dev.parent = &pdev->dev;
+
+ input->id.bustype = BUS_HOST;
+ input->id.vendor = 0x0001;
+ input->id.product = 0x0001;
+ input->id.version = 0x0100;
+
+ for (i = 0; i < pdata->nbuttons; i++) {
+ struct gpio_keys_button *button = &pdata->buttons[i];
+ struct gpio_keys_button_data *bdata = &bdev->data[i];
+ unsigned int gpio = button->gpio;
+ unsigned int type = button->type ?: EV_KEY;
+
+ if (button->wakeup) {
+ dev_err(dev, DRV_NAME " does not support wakeup\n");
+ error = -EINVAL;
+ goto err_free_gpio;
+ }
+
+ error = gpio_request(gpio,
+ button->desc ? button->desc : DRV_NAME);
+ if (error) {
+ dev_err(dev, "unable to claim gpio %u, err=%d\n",
+ gpio, error);
+ goto err_free_gpio;
+ }
+
+ error = gpio_direction_input(gpio);
+ if (error) {
+ dev_err(dev,
+ "unable to set direction on gpio %u, err=%d\n",
+ gpio, error);
+ goto err_free_gpio;
+ }
+
+ bdata->can_sleep = gpio_cansleep(gpio);
+ bdata->last_state = -1;
+ bdata->threshold = DIV_ROUND_UP(button->debounce_interval,
+ pdata->poll_interval);
+
+ input_set_capability(input, type, button->code);
+ }
+
+ bdev->poll_dev = poll_dev;
+ bdev->dev = dev;
+ bdev->pdata = pdata;
+ platform_set_drvdata(pdev, bdev);
+
+ error = input_register_polled_device(poll_dev);
+ if (error) {
+ dev_err(dev, "unable to register polled device, err=%d\n",
+ error);
+ goto err_free_gpio;
+ }
+
+ /* report initial state of the buttons */
+ for (i = 0; i < pdata->nbuttons; i++)
+ gpio_keys_polled_check_state(input, &pdata->buttons[i],
+ &bdev->data[i]);
+
+ return 0;
+
+err_free_gpio:
+ while (--i >= 0)
+ gpio_free(pdata->buttons[i].gpio);
+
+ input_free_polled_device(poll_dev);
+
+err_free_bdev:
+ kfree(bdev);
+
+ platform_set_drvdata(pdev, NULL);
+ return error;
+}
+
+static int __devexit gpio_keys_polled_remove(struct platform_device *pdev)
+{
+ struct gpio_keys_polled_dev *bdev = platform_get_drvdata(pdev);
+ struct gpio_keys_platform_data *pdata = bdev->pdata;
+ int i;
+
+ input_unregister_polled_device(bdev->poll_dev);
+
+ for (i = 0; i < pdata->nbuttons; i++)
+ gpio_free(pdata->buttons[i].gpio);
+
+ input_free_polled_device(bdev->poll_dev);
+
+ kfree(bdev);
+ platform_set_drvdata(pdev, NULL);
+
+ return 0;
+}
+
+static struct platform_driver gpio_keys_polled_driver = {
+ .probe = gpio_keys_polled_probe,
+ .remove = __devexit_p(gpio_keys_polled_remove),
+ .driver = {
+ .name = DRV_NAME,
+ .owner = THIS_MODULE,
+ },
+};
+
+static int __init gpio_keys_polled_init(void)
+{
+ return platform_driver_register(&gpio_keys_polled_driver);
+}
+
+static void __exit gpio_keys_polled_exit(void)
+{
+ platform_driver_unregister(&gpio_keys_polled_driver);
+}
+
+module_init(gpio_keys_polled_init);
+module_exit(gpio_keys_polled_exit);
+
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
+MODULE_DESCRIPTION("Polled GPIO Buttons driver");
+MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index ce73a30..dd1a56f 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -16,6 +16,8 @@ struct gpio_keys_button {
struct gpio_keys_platform_data {
struct gpio_keys_button *buttons;
int nbuttons;
+ unsigned int poll_interval; /* polling interval in msecs -
+ for polling driver only */
unsigned int rep:1; /* enable input subsystem auto repeat */
int (*enable)(struct device *dev);
void (*disable)(struct device *dev);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 62+ messages in thread
* Re: [PATCH v6 1/5] Input: add input driver for polled GPIO buttons
2010-12-09 21:51 ` [PATCH v6 1/5] Input: add input driver for polled GPIO buttons Ben Gardiner
@ 2010-12-10 15:50 ` Kevin Hilman
0 siblings, 0 replies; 62+ messages in thread
From: Kevin Hilman @ 2010-12-10 15:50 UTC (permalink / raw)
To: Ben Gardiner
Cc: davinci-linux-open-source, linux-input, Dmitry Torokhov,
linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos, Dmitry Torokhov
Ben Gardiner <bengardiner@nanometrics.ca> writes:
> 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.
I'll be updating davinci master to .37-rc5 today, so will drop this
patch.
Kevin
^ permalink raw reply [flat|nested] 62+ messages in thread
* [PATCH v6 2/5] da850-evm: add UI Expander pushbuttons
2010-12-09 21:51 ` [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
2010-12-09 21:51 ` [PATCH v6 1/5] Input: add input driver for polled GPIO buttons Ben Gardiner
@ 2010-12-09 21:51 ` Ben Gardiner
2010-12-09 21:51 ` [PATCH v6 3/5] da850-evm: extract defines for SEL{A,B,C} pins in UI expander Ben Gardiner
` (3 subsequent siblings)
5 siblings, 0 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-12-09 21:51 UTC (permalink / raw)
To: Kevin Hilman, davinci-linux-open-source, linux-input, Dmitry Torokhov
Cc: linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos, Govindarajan, Sriramakrishnan, Kevin Hilman
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 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/board-da850-evm.c | 95 +++++++++++++++++++++++++++++++
1 files changed, 95 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index f89b0b7..4377679 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -17,8 +17,10 @@
#include <linux/i2c.h>
#include <linux/i2c/at24.h>
#include <linux/i2c/pca953x.h>
+#include <linux/input.h>
#include <linux/mfd/tps6507x.h>
#include <linux/gpio.h>
+#include <linux/gpio_keys.h>
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
@@ -272,6 +274,87 @@ static inline void da850_evm_setup_emac_rmii(int rmii_sel)
static inline void da850_evm_setup_emac_rmii(int rmii_sel) { }
#endif
+
+#define DA850_KEYS_DEBOUNCE_MS 10
+/*
+ * At 200ms polling interval it is possible to miss an
+ * event by tapping very lightly on the push button but most
+ * pushes do result in an event; longer intervals require the
+ * user to hold the button whereas shorter intervals require
+ * more CPU time for polling.
+ */
+#define DA850_GPIO_KEYS_POLL_MS 200
+
+enum da850_evm_ui_exp_pins {
+ DA850_EVM_UI_EXP_SEL_C = 5,
+ DA850_EVM_UI_EXP_SEL_B,
+ DA850_EVM_UI_EXP_SEL_A,
+ DA850_EVM_UI_EXP_PB8,
+ DA850_EVM_UI_EXP_PB7,
+ DA850_EVM_UI_EXP_PB6,
+ DA850_EVM_UI_EXP_PB5,
+ DA850_EVM_UI_EXP_PB4,
+ DA850_EVM_UI_EXP_PB3,
+ DA850_EVM_UI_EXP_PB2,
+ DA850_EVM_UI_EXP_PB1,
+};
+
+static const char const *da850_evm_ui_exp[] = {
+ [DA850_EVM_UI_EXP_SEL_C] = "sel_c",
+ [DA850_EVM_UI_EXP_SEL_B] = "sel_b",
+ [DA850_EVM_UI_EXP_SEL_A] = "sel_a",
+ [DA850_EVM_UI_EXP_PB8] = "pb8",
+ [DA850_EVM_UI_EXP_PB7] = "pb7",
+ [DA850_EVM_UI_EXP_PB6] = "pb6",
+ [DA850_EVM_UI_EXP_PB5] = "pb5",
+ [DA850_EVM_UI_EXP_PB4] = "pb4",
+ [DA850_EVM_UI_EXP_PB3] = "pb3",
+ [DA850_EVM_UI_EXP_PB2] = "pb2",
+ [DA850_EVM_UI_EXP_PB1] = "pb1",
+};
+
+#define DA850_N_UI_PB 8
+
+static struct gpio_keys_button da850_evm_ui_keys[] = {
+ [0 ... DA850_N_UI_PB - 1] = {
+ .type = EV_KEY,
+ .active_low = 1,
+ .wakeup = 0,
+ .debounce_interval = DA850_KEYS_DEBOUNCE_MS,
+ .code = -1, /* assigned at runtime */
+ .gpio = -1, /* assigned at runtime */
+ .desc = NULL, /* assigned at runtime */
+ },
+};
+
+static struct gpio_keys_platform_data da850_evm_ui_keys_pdata = {
+ .buttons = da850_evm_ui_keys,
+ .nbuttons = ARRAY_SIZE(da850_evm_ui_keys),
+ .poll_interval = DA850_GPIO_KEYS_POLL_MS,
+};
+
+static struct platform_device da850_evm_ui_keys_device = {
+ .name = "gpio-keys-polled",
+ .id = 0,
+ .dev = {
+ .platform_data = &da850_evm_ui_keys_pdata
+ },
+};
+
+static void da850_evm_ui_keys_init(unsigned gpio)
+{
+ int i;
+ struct gpio_keys_button *button;
+
+ for (i = 0; i < DA850_N_UI_PB; i++) {
+ button = &da850_evm_ui_keys[i];
+ button->code = KEY_F8 - i;
+ button->desc = (char *)
+ da850_evm_ui_exp[DA850_EVM_UI_EXP_PB8 + i];
+ button->gpio = gpio + DA850_EVM_UI_EXP_PB8 + i;
+ }
+}
+
static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
unsigned ngpio, void *c)
{
@@ -304,6 +387,13 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
gpio_direction_output(sel_b, 1);
gpio_direction_output(sel_c, 1);
+ da850_evm_ui_keys_init(gpio);
+ ret = platform_device_register(&da850_evm_ui_keys_device);
+ if (ret) {
+ pr_warning("Could not register UI GPIO expander push-buttons");
+ goto exp_setup_keys_fail;
+ }
+
ui_card_detected = 1;
pr_info("DA850/OMAP-L138 EVM UI card detected\n");
@@ -313,6 +403,8 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
return 0;
+exp_setup_keys_fail:
+ gpio_free(sel_c);
exp_setup_selc_fail:
gpio_free(sel_b);
exp_setup_selb_fail:
@@ -324,6 +416,8 @@ exp_setup_sela_fail:
static int da850_evm_ui_expander_teardown(struct i2c_client *client,
unsigned gpio, unsigned ngpio, void *c)
{
+ platform_device_unregister(&da850_evm_ui_keys_device);
+
/* deselect all functionalities */
gpio_set_value_cansleep(gpio + 5, 1);
gpio_set_value_cansleep(gpio + 6, 1);
@@ -340,6 +434,7 @@ static struct pca953x_platform_data da850_evm_ui_expander_info = {
.gpio_base = DAVINCI_N_GPIO,
.setup = da850_evm_ui_expander_setup,
.teardown = da850_evm_ui_expander_teardown,
+ .names = da850_evm_ui_exp,
};
static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH v6 3/5] da850-evm: extract defines for SEL{A,B,C} pins in UI expander
2010-12-09 21:51 ` [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
2010-12-09 21:51 ` [PATCH v6 1/5] Input: add input driver for polled GPIO buttons Ben Gardiner
2010-12-09 21:51 ` [PATCH v6 2/5] da850-evm: add UI Expander pushbuttons Ben Gardiner
@ 2010-12-09 21:51 ` Ben Gardiner
2010-12-09 21:51 ` [PATCH v6 4/5] da850-evm: add baseboard GPIO expander buttons, switches and LEDs Ben Gardiner
` (2 subsequent siblings)
5 siblings, 0 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-12-09 21:51 UTC (permalink / raw)
To: Kevin Hilman, davinci-linux-open-source, linux-input, Dmitry Torokhov
Cc: linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos, Victor Rodriguez
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);
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 exp_setup_selc_fail;
@@ -419,13 +419,13 @@ static int da850_evm_ui_expander_teardown(struct i2c_client *client,
platform_device_unregister(&da850_evm_ui_keys_device);
/* deselect all functionalities */
- gpio_set_value_cansleep(gpio + 5, 1);
- gpio_set_value_cansleep(gpio + 6, 1);
- gpio_set_value_cansleep(gpio + 7, 1);
+ gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_C, 1);
+ gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_B, 1);
+ gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_A, 1);
- gpio_free(gpio + 5);
- gpio_free(gpio + 6);
- gpio_free(gpio + 7);
+ gpio_free(gpio + DA850_EVM_UI_EXP_SEL_C);
+ gpio_free(gpio + DA850_EVM_UI_EXP_SEL_B);
+ gpio_free(gpio + DA850_EVM_UI_EXP_SEL_A);
return 0;
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH v6 4/5] da850-evm: add baseboard GPIO expander buttons, switches and LEDs
2010-12-09 21:51 ` [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
` (2 preceding siblings ...)
2010-12-09 21:51 ` [PATCH v6 3/5] da850-evm: extract defines for SEL{A,B,C} pins in UI expander Ben Gardiner
@ 2010-12-09 21:51 ` Ben Gardiner
2010-12-09 21:51 ` [PATCH v6 5/5] da850-evm: KEYBOARD_GPIO_POLLED Kconfig conditional Ben Gardiner
2010-12-10 16:16 ` [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Kevin Hilman
5 siblings, 0 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-12-09 21:51 UTC (permalink / raw)
To: Kevin Hilman, davinci-linux-open-source, linux-input, Dmitry Torokhov
Cc: linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos, Govindarajan, Sriramakrishnan
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 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 | 187 +++++++++++++++++++++++++++++++
1 files changed, 187 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index dede268..0de789b 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -430,6 +430,182 @@ static int da850_evm_ui_expander_teardown(struct i2c_client *client,
return 0;
}
+/* assign the baseboard expander's GPIOs after the UI board's */
+#define DA850_UI_EXPANDER_N_GPIOS ARRAY_SIZE(da850_evm_ui_exp)
+#define DA850_BB_EXPANDER_GPIO_BASE (DAVINCI_N_GPIO + DA850_UI_EXPANDER_N_GPIOS)
+
+enum da850_evm_bb_exp_pins {
+ DA850_EVM_BB_EXP_DEEP_SLEEP_EN = 0,
+ DA850_EVM_BB_EXP_SW_RST,
+ DA850_EVM_BB_EXP_TP_23,
+ DA850_EVM_BB_EXP_TP_22,
+ DA850_EVM_BB_EXP_TP_21,
+ DA850_EVM_BB_EXP_USER_PB1,
+ DA850_EVM_BB_EXP_USER_LED2,
+ DA850_EVM_BB_EXP_USER_LED1,
+ DA850_EVM_BB_EXP_USER_SW1,
+ DA850_EVM_BB_EXP_USER_SW2,
+ DA850_EVM_BB_EXP_USER_SW3,
+ DA850_EVM_BB_EXP_USER_SW4,
+ DA850_EVM_BB_EXP_USER_SW5,
+ DA850_EVM_BB_EXP_USER_SW6,
+ DA850_EVM_BB_EXP_USER_SW7,
+ DA850_EVM_BB_EXP_USER_SW8
+};
+
+static const char const *da850_evm_bb_exp[] = {
+ [DA850_EVM_BB_EXP_DEEP_SLEEP_EN] = "deep_sleep_en",
+ [DA850_EVM_BB_EXP_SW_RST] = "sw_rst",
+ [DA850_EVM_BB_EXP_TP_23] = "tp_23",
+ [DA850_EVM_BB_EXP_TP_22] = "tp_22",
+ [DA850_EVM_BB_EXP_TP_21] = "tp_21",
+ [DA850_EVM_BB_EXP_USER_PB1] = "user_pb1",
+ [DA850_EVM_BB_EXP_USER_LED2] = "user_led2",
+ [DA850_EVM_BB_EXP_USER_LED1] = "user_led1",
+ [DA850_EVM_BB_EXP_USER_SW1] = "user_sw1",
+ [DA850_EVM_BB_EXP_USER_SW2] = "user_sw2",
+ [DA850_EVM_BB_EXP_USER_SW3] = "user_sw3",
+ [DA850_EVM_BB_EXP_USER_SW4] = "user_sw4",
+ [DA850_EVM_BB_EXP_USER_SW5] = "user_sw5",
+ [DA850_EVM_BB_EXP_USER_SW6] = "user_sw6",
+ [DA850_EVM_BB_EXP_USER_SW7] = "user_sw7",
+ [DA850_EVM_BB_EXP_USER_SW8] = "user_sw8",
+};
+
+#define DA850_N_BB_USER_SW 8
+
+static struct gpio_keys_button da850_evm_bb_keys[] = {
+ [0] = {
+ .type = EV_KEY,
+ .active_low = 1,
+ .wakeup = 0,
+ .debounce_interval = DA850_KEYS_DEBOUNCE_MS,
+ .code = KEY_PROG1,
+ .desc = NULL, /* assigned at runtime */
+ .gpio = -1, /* assigned at runtime */
+ },
+ [1 ... DA850_N_BB_USER_SW] = {
+ .type = EV_SW,
+ .active_low = 1,
+ .wakeup = 0,
+ .debounce_interval = DA850_KEYS_DEBOUNCE_MS,
+ .code = -1, /* assigned at runtime */
+ .desc = NULL, /* assigned at runtime */
+ .gpio = -1, /* assigned at runtime */
+ },
+};
+
+static struct gpio_keys_platform_data da850_evm_bb_keys_pdata = {
+ .buttons = da850_evm_bb_keys,
+ .nbuttons = ARRAY_SIZE(da850_evm_bb_keys),
+ .poll_interval = DA850_GPIO_KEYS_POLL_MS,
+};
+
+static struct platform_device da850_evm_bb_keys_device = {
+ .name = "gpio-keys-polled",
+ .id = 1,
+ .dev = {
+ .platform_data = &da850_evm_bb_keys_pdata
+ },
+};
+
+static void da850_evm_bb_keys_init(unsigned gpio)
+{
+ int i;
+ struct gpio_keys_button *button;
+
+ button = &da850_evm_bb_keys[0];
+ button->desc = (char *)
+ da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_PB1];
+ button->gpio = gpio + DA850_EVM_BB_EXP_USER_PB1;
+
+ for (i = 0; i < DA850_N_BB_USER_SW; i++) {
+ button = &da850_evm_bb_keys[i + 1];
+ button->code = SW_LID + i;
+ button->desc = (char *)
+ da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_SW1 + i];
+ button->gpio = gpio + DA850_EVM_BB_EXP_USER_SW1 + i;
+ }
+}
+
+#define DA850_N_BB_USER_LED 2
+
+static struct gpio_led da850_evm_bb_leds[] = {
+ [0 ... DA850_N_BB_USER_LED - 1] = {
+ .active_low = 1,
+ .gpio = -1, /* assigned at runtime */
+ .name = NULL, /* assigned at runtime */
+ },
+};
+
+static struct gpio_led_platform_data da850_evm_bb_leds_pdata = {
+ .leds = da850_evm_bb_leds,
+ .num_leds = ARRAY_SIZE(da850_evm_bb_leds),
+};
+
+static struct platform_device da850_evm_bb_leds_device = {
+ .name = "leds-gpio",
+ .id = -1,
+ .dev = {
+ .platform_data = &da850_evm_bb_leds_pdata
+ }
+};
+
+static void da850_evm_bb_leds_init(unsigned gpio)
+{
+ int i;
+ struct gpio_led *led;
+
+ for (i = 0; i < DA850_N_BB_USER_LED; i++) {
+ led = &da850_evm_bb_leds[i];
+
+ led->gpio = gpio + DA850_EVM_BB_EXP_USER_LED2 + i;
+ led->name =
+ da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_LED2 + i];
+ }
+}
+
+static int da850_evm_bb_expander_setup(struct i2c_client *client,
+ unsigned gpio, unsigned ngpio,
+ void *c)
+{
+ int ret;
+
+ /*
+ * Register the switches and pushbutton on the baseboard as a gpio-keys
+ * device.
+ */
+ da850_evm_bb_keys_init(gpio);
+ ret = platform_device_register(&da850_evm_bb_keys_device);
+ if (ret) {
+ pr_warning("Could not register baseboard GPIO expander keys");
+ goto io_exp_setup_sw_fail;
+ }
+
+ da850_evm_bb_leds_init(gpio);
+ ret = platform_device_register(&da850_evm_bb_leds_device);
+ if (ret) {
+ pr_warning("Could not register baseboard GPIO expander LEDS");
+ goto io_exp_setup_leds_fail;
+ }
+
+ return 0;
+
+io_exp_setup_leds_fail:
+ platform_device_unregister(&da850_evm_bb_keys_device);
+io_exp_setup_sw_fail:
+ return ret;
+}
+
+static int da850_evm_bb_expander_teardown(struct i2c_client *client,
+ unsigned gpio, unsigned ngpio, void *c)
+{
+ platform_device_unregister(&da850_evm_bb_leds_device);
+ platform_device_unregister(&da850_evm_bb_keys_device);
+
+ return 0;
+}
+
static struct pca953x_platform_data da850_evm_ui_expander_info = {
.gpio_base = DAVINCI_N_GPIO,
.setup = da850_evm_ui_expander_setup,
@@ -437,6 +613,13 @@ static struct pca953x_platform_data da850_evm_ui_expander_info = {
.names = da850_evm_ui_exp,
};
+static struct pca953x_platform_data da850_evm_bb_expander_info = {
+ .gpio_base = DA850_BB_EXPANDER_GPIO_BASE,
+ .setup = da850_evm_bb_expander_setup,
+ .teardown = da850_evm_bb_expander_teardown,
+ .names = da850_evm_bb_exp,
+};
+
static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {
{
I2C_BOARD_INFO("tlv320aic3x", 0x18),
@@ -445,6 +628,10 @@ static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {
I2C_BOARD_INFO("tca6416", 0x20),
.platform_data = &da850_evm_ui_expander_info,
},
+ {
+ I2C_BOARD_INFO("tca6416", 0x21),
+ .platform_data = &da850_evm_bb_expander_info,
+ },
};
static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH v6 5/5] da850-evm: KEYBOARD_GPIO_POLLED Kconfig conditional
2010-12-09 21:51 ` [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
` (3 preceding siblings ...)
2010-12-09 21:51 ` [PATCH v6 4/5] da850-evm: add baseboard GPIO expander buttons, switches and LEDs Ben Gardiner
@ 2010-12-09 21:51 ` Ben Gardiner
2010-12-10 16:16 ` [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Kevin Hilman
5 siblings, 0 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-12-09 21:51 UTC (permalink / raw)
To: Kevin Hilman, davinci-linux-open-source, linux-input, Dmitry Torokhov
Cc: linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos, Kevin Hilman
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
^ permalink raw reply related [flat|nested] 62+ messages in thread
* Re: [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders
2010-12-09 21:51 ` [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
` (4 preceding siblings ...)
2010-12-09 21:51 ` [PATCH v6 5/5] da850-evm: KEYBOARD_GPIO_POLLED Kconfig conditional Ben Gardiner
@ 2010-12-10 16:16 ` Kevin Hilman
2010-12-10 16:33 ` Ben Gardiner
5 siblings, 1 reply; 62+ messages in thread
From: Kevin Hilman @ 2010-12-10 16:16 UTC (permalink / raw)
To: Ben Gardiner
Cc: davinci-linux-open-source, linux-input, Dmitry Torokhov,
linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos
Hi Ben,
Ben Gardiner <bengardiner@nanometrics.ca> writes:
> 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.
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
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders
2010-12-10 16:16 ` [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Kevin Hilman
@ 2010-12-10 16:33 ` Ben Gardiner
2010-12-11 0:04 ` Kevin Hilman
2010-12-13 17:02 ` Ben Gardiner
0 siblings, 2 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-12-10 16:33 UTC (permalink / raw)
To: Kevin Hilman
Cc: davinci-linux-open-source, linux-input, Dmitry Torokhov,
linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos
Hi Kevin,
On Fri, Dec 10, 2010 at 11:16 AM, Kevin Hilman
<khilman@deeprootsystems.com> wrote:
> Hi Ben,
>
> Ben Gardiner <bengardiner@nanometrics.ca> writes:
>
>> 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.
>
> Thanks for your patience and persistence on this series, and thanks for
> working closely with the input folks to get the issues worked through.
It is my pleasure.
> 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?
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
gpio keys default-on for da850evm.
> Also, I really appreciate the thorough patch descriptions and history
> information. This greatly eases the work of maintainers. Thanks!
Again, you are most welcome.
> 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.
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
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders
2010-12-10 16:33 ` Ben Gardiner
@ 2010-12-11 0:04 ` Kevin Hilman
2010-12-13 17:02 ` Ben Gardiner
1 sibling, 0 replies; 62+ messages in thread
From: Kevin Hilman @ 2010-12-11 0:04 UTC (permalink / raw)
To: Ben Gardiner
Cc: davinci-linux-open-source, linux-input, Dmitry Torokhov,
linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos
Hi Ben,
Ben Gardiner <bengardiner@nanometrics.ca> writes:
[...]
>> 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.
>
> 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.
OK, thanks for clarification. I'll leave the s-o-b tags as is.
Kevin
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders
2010-12-10 16:33 ` Ben Gardiner
2010-12-11 0:04 ` Kevin Hilman
@ 2010-12-13 17:02 ` Ben Gardiner
2010-12-13 21:53 ` Kevin Hilman
1 sibling, 1 reply; 62+ messages in thread
From: Ben Gardiner @ 2010-12-13 17:02 UTC (permalink / raw)
To: Kevin Hilman
Cc: davinci-linux-open-source, linux-input, Dmitry Torokhov,
linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos
Hi Kevin,
On Fri, Dec 10, 2010 at 11:33 AM, Ben Gardiner
<bengardiner@nanometrics.ca> wrote:
> On Fri, Dec 10, 2010 at 11:16 AM, Kevin Hilman
>> [...]
>> 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. [...]
>
> Thank you very much, Kevin.
>
> I will check linux-davinci/master on monday.
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: Kevin Hilman <khilman@deeprootsystems.com>
I also looked at
git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git#master
; HEAD at the time was
commit 4bfbdddc0655a284a98304bc343c6bcaf81b8e4d
Merge: 771215c 7507fd3
Author: Kevin Hilman <khilman@deeprootsystems.com>
Date: Fri Dec 10 16:25:27 2010 -0800
rebuild linux-davinci from branches
There appears to be some double commits of the patch series. I tested
it with evtest anyways and also observed the expected output.
The following command and its output hopefully demonstrate what I am
seeing as double commits.
$git log --format="%s -- %Cgreen%an <%aE> %Cred%ai %Creset%h" khilman/master
rebuild linux-davinci from branches -- Kevin Hilman
<khilman@deeprootsystems.com> 2010-12-10 16:25:27 -0800 4bfbddd
Merge branch 'davinci-orphaned' into davinci-reset -- Kevin Hilman
<khilman@deeprootsystems.com> 2010-12-10 16:25:22 -0800 771215c
da850-evm: KEYBOARD_GPIO_POLLED Kconfig conditional -- Ben Gardiner
<bengardiner@nanometrics.ca> 2010-12-09 16:51:07 -0500 3004ce0
da850-evm: add baseboard GPIO expander buttons, switches and LEDs --
Ben Gardiner <bengardiner@nanometrics.ca> 2010-12-09 16:51:06 -0500
61eaa3a
da850-evm: extract defines for SEL{A,B,C} pins in UI expander -- Ben
Gardiner <bengardiner@nanometrics.ca> 2010-12-09 16:51:05 -0500
e594a12
da850-evm: add UI Expander pushbuttons -- Ben Gardiner
<bengardiner@nanometrics.ca> 2010-12-09 16:51:04 -0500 260660f
davinci: am18x/da850/omap-l138 evm: add support for higher speed
grades -- Sekhar Nori <nsekhar@ti.com> 2010-12-09 14:11:34 +0530
3c812e7
davinci: am18x/da850/omap-l138: add support for higher speed grades
-- Sekhar Nori <nsekhar@ti.com> 2010-12-09 14:11:33 +0530 d2e9976
rebuild linux-davinci from branches -- Kevin Hilman
<khilman@deeprootsystems.com> 2010-12-10 08:13:18 -0800 7507fd3
Merge branch 'davinci-orphaned' into davinci-reset -- Kevin Hilman
<khilman@deeprootsystems.com> 2010-12-10 08:13:13 -0800 66a897a
da850-evm: KEYBOARD_GPIO_POLLED Kconfig conditional -- Ben Gardiner
<bengardiner@nanometrics.ca> 2010-12-09 16:51:07 -0500 bc1c63f
da850-evm: add baseboard GPIO expander buttons, switches and LEDs --
Ben Gardiner <bengardiner@nanometrics.ca> 2010-12-09 16:51:06 -0500
c6c519c
da850-evm: extract defines for SEL{A,B,C} pins in UI expander -- Ben
Gardiner <bengardiner@nanometrics.ca> 2010-12-09 16:51:05 -0500
22693bc
da850-evm: add UI Expander pushbuttons -- Ben Gardiner
<bengardiner@nanometrics.ca> 2010-12-09 16:51:04 -0500 b481719
Input: add input driver for polled GPIO buttons -- Gabor Juhos
<juhosg@openwrt.org> 2010-12-09 16:51:03 -0500 03b7920
ARM: Add writethrough dcache support for ARM926EJS processor -- Mark
A. Greer <mgreer@mvista.com> 2009-05-11 15:36:54 -0700 ecc2acc
fb: davinci: DMx driver -- Kevin Hilman
<khilman@deeprootsystems.com> 2009-10-12 14:05:30 -0700 577b52a
ASoC: davinci: SFFSDR board updates -- Kevin Hilman
<khilman@deeprootsystems.com> 2009-10-12 14:03:47 -0700 cdbc657
davinci: dm365evm_keys driver -- David Brownell
<dbrownell@users.sourceforge.net> 2009-06-25 17:03:21 -0700 cf4e892
davinci: kconfig: select at24 eeprom for selected boards -- Kevin
Hilman <khilman@deeprootsystems.com> 2010-11-19 07:25:30 -0800 22ca466
da850-evm, trivial: use da850_evm prefix for consistency -- Ben
Gardiner <bengardiner@nanometrics.ca> 2010-11-19 16:43:04 -0500
3506f27
da850-evm: allow pca953x module build -- Ben Gardiner
<bengardiner@nanometrics.ca> 2010-11-19 09:17:35 -0500 d5539ca
davinci: da850-evm: UI expander gpio_set_value can sleep, use
_cansleep -- Ben Gardiner <bengardiner@nanometrics.ca> 2010-11-15
09:42:52 -0500 47e7cb1
davinci: aemif: signedness bug in davinci_aemif_setup_timing() --
Nicolas Kaiser <nikai@nikai.net> 2010-11-15 19:40:28 +0100 12cdd3d
davinci: psc: simplify if-statement -- Nicolas Kaiser
<nikai@nikai.net> 2010-10-25 14:41:18 +0200 1a07bfb
davinci: minor tnetv107x clock tree fixes -- Cyril Chemparathy
<cyril@ti.com> 2010-10-20 17:49:57 -0400 ced9862
davinci: use divide ratio limits from pll_data -- Cyril Chemparathy
<cyril@ti.com> 2010-10-20 17:49:56 -0400 b1d05be
davinci: Implement sched_clock() -- Andreas Gaeer
<Andreas.Gaer@baslerweb.com> 2010-10-06 10:38:55 +0200 6d1c57c
Linux 2.6.37-rc5 -- Linus Torvalds <torvalds@linux-foundation.org>
2010-12-06 20:09:04 -0800 cf7d7e5
[...]
Note that the cherry pick of the upstream commit of the polled gpio
keys driver is here in 'master' also.
Best Regards,
Ben Gardiner
---
Nanometrics Inc.
http://www.nanometrics.ca
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders
2010-12-13 17:02 ` Ben Gardiner
@ 2010-12-13 21:53 ` Kevin Hilman
2010-12-14 4:31 ` Ben Gardiner
2010-12-14 16:17 ` Ben Gardiner
0 siblings, 2 replies; 62+ messages in thread
From: Kevin Hilman @ 2010-12-13 21:53 UTC (permalink / raw)
To: Ben Gardiner
Cc: davinci-linux-open-source, linux-input, Dmitry Torokhov,
linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos
Ben Gardiner <bengardiner@nanometrics.ca> writes:
> Hi Kevin,
>
> On Fri, Dec 10, 2010 at 11:33 AM, Ben Gardiner
> <bengardiner@nanometrics.ca> wrote:
>> On Fri, Dec 10, 2010 at 11:16 AM, Kevin Hilman
>>> [...]
>>> 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. [...]
>>
>> Thank you very much, Kevin.
>>
>> I will check linux-davinci/master on monday.
>
> 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:
oops... I've now removed that, since it is part of v2.6.36-rc5 already.
Thanks for checking.
[...]
> I also looked at
> git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git#master
> ; HEAD at the time was
>
> commit 4bfbdddc0655a284a98304bc343c6bcaf81b8e4d
> Merge: 771215c 7507fd3
> Author: Kevin Hilman <khilman@deeprootsystems.com>
> Date: Fri Dec 10 16:25:27 2010 -0800
>
> rebuild linux-davinci from branches
>
> There appears to be some double commits of the patch series. I tested
> it with evtest anyways and also observed the expected output.
>
> The following command and its output hopefully demonstrate what I am
> seeing as double commits.
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.
[...]
> Note that the cherry pick of the upstream commit of the polled gpio
> keys driver is here in 'master' also.
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
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders
2010-12-13 21:53 ` Kevin Hilman
@ 2010-12-14 4:31 ` Ben Gardiner
2010-12-14 16:17 ` Ben Gardiner
1 sibling, 0 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-12-14 4:31 UTC (permalink / raw)
To: Kevin Hilman
Cc: davinci-linux-open-source, linux-input, Dmitry Torokhov,
linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos
On Mon, Dec 13, 2010 at 4:53 PM, Kevin Hilman
<khilman@deeprootsystems.com> wrote:
> Ben Gardiner <bengardiner@nanometrics.ca> writes:
> [...]
> 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.
Ok. I'll consider a graphical investigation. Thanks for confirming the
state of master is as-designed.
> I know it's confusing, but the davinci-next branch is the only important
> branch in this tree for upstream purposes.
Understood. Thanks for the clarification.
Best Regards,
Ben Gardiner
---
Nanometrics Inc.
http://www.nanometrics.ca
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders
2010-12-13 21:53 ` Kevin Hilman
2010-12-14 4:31 ` Ben Gardiner
@ 2010-12-14 16:17 ` Ben Gardiner
2010-12-14 17:10 ` Kevin Hilman
1 sibling, 1 reply; 62+ messages in thread
From: Ben Gardiner @ 2010-12-14 16:17 UTC (permalink / raw)
To: Kevin Hilman
Cc: davinci-linux-open-source, linux-input, Dmitry Torokhov,
linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos
On Mon, Dec 13, 2010 at 4:53 PM, Kevin Hilman
<khilman@deeprootsystems.com> wrote:
> Ben Gardiner <bengardiner@nanometrics.ca> writes:
>> [...]
>> 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:
>
> oops... I've now removed that, since it is part of v2.6.36-rc5 already.
> Thanks for checking.
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
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders
2010-12-14 16:17 ` Ben Gardiner
@ 2010-12-14 17:10 ` Kevin Hilman
2010-12-17 15:15 ` Ben Gardiner
0 siblings, 1 reply; 62+ messages in thread
From: Kevin Hilman @ 2010-12-14 17:10 UTC (permalink / raw)
To: Ben Gardiner
Cc: davinci-linux-open-source, linux-input, Dmitry Torokhov,
linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos
Ben Gardiner <bengardiner@nanometrics.ca> writes:
> On Mon, Dec 13, 2010 at 4:53 PM, Kevin Hilman
> <khilman@deeprootsystems.com> wrote:
>> Ben Gardiner <bengardiner@nanometrics.ca> writes:
>>> [...]
>>> 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:
>>
>> oops... I've now removed that, since it is part of v2.6.36-rc5 already.
>> Thanks for checking.
>
> Oops on my part...
>
[...]
> 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.
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
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders
2010-12-14 17:10 ` Kevin Hilman
@ 2010-12-17 15:15 ` Ben Gardiner
0 siblings, 0 replies; 62+ messages in thread
From: Ben Gardiner @ 2010-12-17 15:15 UTC (permalink / raw)
To: Kevin Hilman
Cc: davinci-linux-open-source, linux-input, Dmitry Torokhov,
linux-kernel, Chris Cordahi, Paul Mundt, Sekhar Nori,
Gabor Juhos
Hi Kevin,
On Tue, Dec 14, 2010 at 12:10 PM, Kevin Hilman
<khilman@deeprootsystems.com> wrote:
> Just pushed an updated version, and this time, I actually build tested for
> davinci_all_defconfig and da8xx_omapl_defconfig. :)
>
> Sorry for the churn,
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
^ permalink raw reply [flat|nested] 62+ messages in thread