From: Jochen Friedrich <jochen@scram.de> To: linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk, bryan.wu@canonical.com, kristoffer.ericson@gmail.com Cc: linux-kernel@vger.kernel.org, Jochen Friedrich <jochen@scram.de> Subject: [PATCH 3.2 3/4] ARM: simpad: add GPIO based device definitions. Date: Mon, 8 Aug 2011 10:49:38 +0200 [thread overview] Message-ID: <1312793379-6020-4-git-send-email-jochen@scram.de> (raw) In-Reply-To: <1312793379-6020-1-git-send-email-jochen@scram.de> Register keyboard, polled keyboard and I2C platform devices based on GPIOs. Signed-off-by: Jochen Friedrich <jochen@scram.de> --- arch/arm/mach-sa1100/simpad.c | 67 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 66 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c index c3c66b0..9f0eefd 100644 --- a/arch/arm/mach-sa1100/simpad.c +++ b/arch/arm/mach-sa1100/simpad.c @@ -29,6 +29,9 @@ #include <linux/serial_core.h> #include <linux/ioport.h> +#include <linux/input.h> +#include <linux/gpio_keys.h> +#include <linux/i2c-gpio.h> #include "generic.h" @@ -249,6 +252,65 @@ static void simpad_power_off(void) } +/* + * gpio_keys +*/ + +static struct gpio_keys_button simpad_button_table[] = { + { KEY_POWER, IRQ_GPIO_POWER_BUTTON, 1, "power button" }, +}; + +static struct gpio_keys_platform_data simpad_keys_data = { + .buttons = simpad_button_table, + .nbuttons = ARRAY_SIZE(simpad_button_table), +}; + +static struct platform_device simpad_keys = { + .name = "gpio-keys", + .dev = { + .platform_data = &simpad_keys_data, + }, +}; + +static struct gpio_keys_button simpad_polled_button_table[] = { + { KEY_PROG1, SIMPAD_UCB1X00_GPIO_PROG1, 1, "prog1 button" }, + { KEY_PROG2, SIMPAD_UCB1X00_GPIO_PROG2, 1, "prog2 button" }, + { KEY_UP, SIMPAD_UCB1X00_GPIO_UP, 1, "up button" }, + { KEY_DOWN, SIMPAD_UCB1X00_GPIO_DOWN, 1, "down button" }, + { KEY_LEFT, SIMPAD_UCB1X00_GPIO_LEFT, 1, "left button" }, + { KEY_RIGHT, SIMPAD_UCB1X00_GPIO_RIGHT, 1, "right button" }, +}; + +static struct gpio_keys_platform_data simpad_polled_keys_data = { + .buttons = simpad_polled_button_table, + .nbuttons = ARRAY_SIZE(simpad_polled_button_table), + .poll_interval = 50, +}; + +static struct platform_device simpad_polled_keys = { + .name = "gpio-keys-polled", + .dev = { + .platform_data = &simpad_polled_keys_data, + }, +}; + +/* + * i2c + */ +static struct i2c_gpio_platform_data simpad_i2c_data = { + .sda_pin = GPIO_GPIO21, + .scl_pin = GPIO_GPIO25, + .udelay = 10, + .timeout = HZ, +}; + +static struct platform_device simpad_i2c = { + .name = "i2c-gpio", + .id = 0, + .dev = { + .platform_data = &simpad_i2c_data, + }, +}; /* * MediaQ Video Device @@ -259,7 +321,10 @@ static struct platform_device simpad_mq200fb = { }; static struct platform_device *devices[] __initdata = { - &simpad_mq200fb + &simpad_keys, + &simpad_polled_keys, + &simpad_mq200fb, + &simpad_i2c, }; -- 1.7.5.4
WARNING: multiple messages have this Message-ID (diff)
From: jochen@scram.de (Jochen Friedrich) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 3.2 3/4] ARM: simpad: add GPIO based device definitions. Date: Mon, 8 Aug 2011 10:49:38 +0200 [thread overview] Message-ID: <1312793379-6020-4-git-send-email-jochen@scram.de> (raw) In-Reply-To: <1312793379-6020-1-git-send-email-jochen@scram.de> Register keyboard, polled keyboard and I2C platform devices based on GPIOs. Signed-off-by: Jochen Friedrich <jochen@scram.de> --- arch/arm/mach-sa1100/simpad.c | 67 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 66 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c index c3c66b0..9f0eefd 100644 --- a/arch/arm/mach-sa1100/simpad.c +++ b/arch/arm/mach-sa1100/simpad.c @@ -29,6 +29,9 @@ #include <linux/serial_core.h> #include <linux/ioport.h> +#include <linux/input.h> +#include <linux/gpio_keys.h> +#include <linux/i2c-gpio.h> #include "generic.h" @@ -249,6 +252,65 @@ static void simpad_power_off(void) } +/* + * gpio_keys +*/ + +static struct gpio_keys_button simpad_button_table[] = { + { KEY_POWER, IRQ_GPIO_POWER_BUTTON, 1, "power button" }, +}; + +static struct gpio_keys_platform_data simpad_keys_data = { + .buttons = simpad_button_table, + .nbuttons = ARRAY_SIZE(simpad_button_table), +}; + +static struct platform_device simpad_keys = { + .name = "gpio-keys", + .dev = { + .platform_data = &simpad_keys_data, + }, +}; + +static struct gpio_keys_button simpad_polled_button_table[] = { + { KEY_PROG1, SIMPAD_UCB1X00_GPIO_PROG1, 1, "prog1 button" }, + { KEY_PROG2, SIMPAD_UCB1X00_GPIO_PROG2, 1, "prog2 button" }, + { KEY_UP, SIMPAD_UCB1X00_GPIO_UP, 1, "up button" }, + { KEY_DOWN, SIMPAD_UCB1X00_GPIO_DOWN, 1, "down button" }, + { KEY_LEFT, SIMPAD_UCB1X00_GPIO_LEFT, 1, "left button" }, + { KEY_RIGHT, SIMPAD_UCB1X00_GPIO_RIGHT, 1, "right button" }, +}; + +static struct gpio_keys_platform_data simpad_polled_keys_data = { + .buttons = simpad_polled_button_table, + .nbuttons = ARRAY_SIZE(simpad_polled_button_table), + .poll_interval = 50, +}; + +static struct platform_device simpad_polled_keys = { + .name = "gpio-keys-polled", + .dev = { + .platform_data = &simpad_polled_keys_data, + }, +}; + +/* + * i2c + */ +static struct i2c_gpio_platform_data simpad_i2c_data = { + .sda_pin = GPIO_GPIO21, + .scl_pin = GPIO_GPIO25, + .udelay = 10, + .timeout = HZ, +}; + +static struct platform_device simpad_i2c = { + .name = "i2c-gpio", + .id = 0, + .dev = { + .platform_data = &simpad_i2c_data, + }, +}; /* * MediaQ Video Device @@ -259,7 +321,10 @@ static struct platform_device simpad_mq200fb = { }; static struct platform_device *devices[] __initdata = { - &simpad_mq200fb + &simpad_keys, + &simpad_polled_keys, + &simpad_mq200fb, + &simpad_i2c, }; -- 1.7.5.4
next prev parent reply other threads:[~2011-08-08 8:50 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-08-08 8:49 [PATCH 3.2 0/4] ARM: simpad: Add support for GPIO attached hardware Jochen Friedrich 2011-08-08 8:49 ` Jochen Friedrich 2011-08-08 8:49 ` [PATCH 3.2 1/4] ARM: simpad: Add ucb1x00 GPIO definitions and register GPIO Jochen Friedrich 2011-08-08 8:49 ` Jochen Friedrich 2011-08-08 8:49 ` [PATCH 3.2 2/4] ARM: simpad: Cleanup CS3 accessors Jochen Friedrich 2011-08-08 8:49 ` Jochen Friedrich 2011-08-08 8:49 ` Jochen Friedrich [this message] 2011-08-08 8:49 ` [PATCH 3.2 3/4] ARM: simpad: add GPIO based device definitions Jochen Friedrich 2011-08-08 8:49 ` [PATCH 3.2 4/4] ARM: simpad: replace ARM specific LED code Jochen Friedrich 2011-08-08 8:49 ` Jochen Friedrich 2011-08-11 15:24 ` [PATCH 3.2 0/4] ARM: simpad: Add support for GPIO attached hardware Jochen Friedrich 2011-08-11 15:24 ` Jochen Friedrich 2011-08-18 9:05 ` Bryan Wu 2011-08-18 9:05 ` Bryan Wu 2011-08-18 10:25 ` Russell King - ARM Linux 2011-08-18 10:25 ` Russell King - ARM Linux 2011-08-22 14:50 ` Jochen Friedrich 2011-08-22 14:50 ` Jochen Friedrich
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1312793379-6020-4-git-send-email-jochen@scram.de \ --to=jochen@scram.de \ --cc=bryan.wu@canonical.com \ --cc=kristoffer.ericson@gmail.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux@arm.linux.org.uk \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.