summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Robinson Jr <rrobinson@phytec.com>2013-09-11 14:49:51 -0700
committerAnthony Felice <tony.felice@timesys.com>2013-09-17 14:22:19 -0400
commit1db1b0a3fcd7b4fc5912af128f400f1d84f5c4da (patch)
tree4f9e3b70a391857b7981c6d7b27ca58864a54545
parent2c073ea51c603a56a6bc26114a8c24af7a4ac04b (diff)
pcl052: add user button and led support
The buttons are initially defined in arch/arm/mach-mvf/board-pcl052 and each LED is set to trigger by a corresponding button press. This is supported with a modified leds-gpio and trigger driver that enables assinging default gpio triggers values in kernel space. Signed-off-by: Johnathan Feuerstein <jfeuerstein@phytec.com> Signed-off-by: Russell Robinson Jr <rrobinson@phytec.com>
-rw-r--r--arch/arm/configs/pcl052_defconfig38
-rw-r--r--arch/arm/mach-mvf/board-pcl052.c92
2 files changed, 129 insertions, 1 deletions
diff --git a/arch/arm/configs/pcl052_defconfig b/arch/arm/configs/pcl052_defconfig
index de1202058a91..ec76e89a349c 100644
--- a/arch/arm/configs/pcl052_defconfig
+++ b/arch/arm/configs/pcl052_defconfig
@@ -863,6 +863,7 @@ CONFIG_KEYBOARD_ATKBD=y
CONFIG_KEYBOARD_GPIO=y
# CONFIG_KEYBOARD_TCA6416 is not set
# CONFIG_KEYBOARD_MATRIX is not set
+# CONFIG_KEYBOARD_LM8323 is not set
# CONFIG_KEYBOARD_MAX7359 is not set
# CONFIG_KEYBOARD_MCS is not set
# CONFIG_KEYBOARD_MPR121 is not set
@@ -1454,7 +1455,42 @@ CONFIG_MMC_SDHCI_ESDHC_IMX=y
# CONFIG_MMC_VUB300 is not set
# CONFIG_MMC_USHC is not set
# CONFIG_MEMSTICK is not set
-# CONFIG_NEW_LEDS is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+
+#
+# LED drivers
+#
+# CONFIG_LEDS_LM3530 is not set
+# CONFIG_LEDS_PCA9532 is not set
+CONFIG_LEDS_GPIO=y
+CONFIG_LEDS_GPIO_PLATFORM=y
+# CONFIG_LEDS_LP3944 is not set
+# CONFIG_LEDS_LP5521 is not set
+# CONFIG_LEDS_LP5523 is not set
+# CONFIG_LEDS_PCA955X is not set
+# CONFIG_LEDS_DAC124S085 is not set
+# CONFIG_LEDS_PWM is not set
+# CONFIG_LEDS_BD2802 is not set
+# CONFIG_LEDS_LT3593 is not set
+CONFIG_LEDS_TRIGGERS=y
+
+#
+# LED Triggers
+#
+CONFIG_LEDS_TRIGGER_TIMER=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+CONFIG_LEDS_TRIGGER_BACKLIGHT=y
+CONFIG_LEDS_TRIGGER_GPIO=y
+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
+
+#
+# iptables trigger is under Netfilter config (LED target)
+#
+
+#
+# LED Triggers
+#
# CONFIG_NFC_DEVICES is not set
# CONFIG_ACCESSIBILITY is not set
CONFIG_RTC_LIB=y
diff --git a/arch/arm/mach-mvf/board-pcl052.c b/arch/arm/mach-mvf/board-pcl052.c
index 3f6f58ff9226..f2a4c605c1a7 100644
--- a/arch/arm/mach-mvf/board-pcl052.c
+++ b/arch/arm/mach-mvf/board-pcl052.c
@@ -23,6 +23,7 @@
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/init.h>
+#include <linux/gpio_keys.h>
#include <linux/input.h>
#include <linux/nodemask.h>
#include <linux/clk.h>
@@ -93,6 +94,16 @@
#define KSZ8051_PHY_CTRL2 0x1F
#define KSZ8051_50MHZ_CLK_MODE (1 << 7)
+/* GPIO definitions */
+#define GPIO_LED_1 35
+#define GPIO_LED_2 40
+#define GPIO_LED_3 96
+#define GPIO_LED_4 102
+
+#define GPIO_BTN_1 25
+#define GPIO_BTN_2 30
+#define GPIO_BTN_3 31
+#define GPIO_BTN_4 34
static iomux_v3_cfg_t pcl052_pads[] = {
/*SDHC1*/
@@ -184,6 +195,19 @@ static iomux_v3_cfg_t pcl052_pads[] = {
IOMUX_PAD(0x0080, 0x0080, 6, 0x0000, 0, \
MVF600_SAI_PAD_CTRL | PAD_CTL_IBE_ENABLE),
+
+ /*LEDs*/
+ MVF600_PAD35_PTB13_GPIO_LED1,
+ MVF600_PAD40_PTB18_GPIO_LED2,
+ MVF600_PAD96_PTB26_GPIO_LED3,
+ MVF600_PAD102_PTC29_GPIO_LED4,
+
+ /*BTNs*/
+ MVF600_PAD25_PTB3_GPIO_BTN1,
+ MVF600_PAD30_PTB8_GPIO_BTN2,
+ MVF600_PAD31_PTB9_GPIO_BTN3,
+ MVF600_PAD34_PTB12_GPIO_BTN4,
+
/*UART1*/
MVF600_PAD26_PTB4_UART1_TX,
MVF600_PAD27_PTB5_UART1_RX,
@@ -313,6 +337,62 @@ static struct imxi2c_platform_data pcl052_i2c_data = {
.bitrate = 100000,
};
+static struct gpio_keys_button pcl052_gpio_keys[] = {
+ {
+ .desc = "User Button 1",
+ .gpio = GPIO_BTN_1,
+ },
+ {
+ .desc = "User Button 2",
+ .gpio = GPIO_BTN_2,
+ },
+ {
+ .desc = "User Button 3",
+ .gpio = GPIO_BTN_3,
+ },
+ {
+ .desc = "User Button 4",
+ .gpio = GPIO_BTN_4,
+ },
+};
+
+static struct gpio_led pcl052_gpio_leds[] = {
+{
+ .name = "LED1",
+ .gpio = GPIO_LED_1,
+ .default_trigger = "gpio",
+ .trigger_gpio = GPIO_BTN_1,
+ },
+ {
+ .name = "LED2",
+ .gpio = GPIO_LED_2,
+ .default_trigger = "gpio",
+ .trigger_gpio = GPIO_BTN_2,
+ },
+ {
+ .name = "LED3",
+ .gpio = GPIO_LED_3,
+ .default_trigger = "gpio",
+ .trigger_gpio = GPIO_BTN_3,
+ },
+ {
+ .name = "LED4",
+ .gpio = GPIO_LED_4,
+ .default_trigger = "gpio",
+ .trigger_gpio = GPIO_BTN_4,
+ },
+};
+
+static struct gpio_led_platform_data pcl052_led_data = {
+ .leds = pcl052_gpio_leds,
+ .num_leds = ARRAY_SIZE(pcl052_gpio_leds),
+};
+
+static struct gpio_keys_platform_data pcl052_gpio_keys_data = {
+ .buttons = pcl052_gpio_keys,
+ .nbuttons = ARRAY_SIZE(pcl052_gpio_keys),
+};
+
static struct i2c_board_info pcl052_i2c2_board_info[] __initdata = {
{
I2C_BOARD_INFO("tda998x", 0x70),
@@ -341,6 +421,17 @@ static void __init pcl052_init_usb(void)
#endif
}
+/*
+ * Add GPIO's to platform devices
+ */
+static inline void pcl052_init_gpio(void)
+{
+ imx_add_platform_device("leds-gpio", -1, NULL,
+ 0, &pcl052_led_data, sizeof(pcl052_led_data));
+ imx_add_platform_device("gpio-keys", -1, NULL,
+ 0, &pcl052_gpio_keys_data, sizeof(pcl052_gpio_keys_data));
+}
+
/*!
* Board specific initialization.
*/
@@ -353,6 +444,7 @@ static void __init pcl052_board_init(void)
#ifdef CONFIG_FEC
mvf_init_fec(fec_data);
#endif
+ pcl052_init_gpio();
mvf_add_snvs_rtc();