diff options
-rw-r--r-- | arch/arm/plat-mxc/include/mach/iomux-mvf.h | 28 | ||||
-rw-r--r-- | drivers/leds/leds-gpio.c | 1 | ||||
-rw-r--r-- | drivers/leds/ledtrig-gpio.c | 12 | ||||
-rw-r--r-- | include/linux/leds.h | 3 |
4 files changed, 44 insertions, 0 deletions
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mvf.h b/arch/arm/plat-mxc/include/mach/iomux-mvf.h index 6b3c12171480..8f5b98b89e53 100644 --- a/arch/arm/plat-mxc/include/mach/iomux-mvf.h +++ b/arch/arm/plat-mxc/include/mach/iomux-mvf.h @@ -64,6 +64,10 @@ typedef enum iomux_config { #define MVF600_DCU_PAD_CTRL (MVF600_HIGH_DRV | PAD_CTL_OBE_ENABLE) +#define MVF600_LED_PAD_CTRL (PAD_CTL_PUS_47K_UP | PAD_CTL_OBE_ENABLE) + +#define MVF600_BTN_PAD_CTRL (PAD_CTL_PUS_47K_UP | PAD_CTL_IBE_ENABLE) + #define MVF600_UART_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \ PAD_CTL_DSE_25ohm) @@ -329,6 +333,30 @@ typedef enum iomux_config { IOMUX_PAD(0x0210, 0x0210, 1, 0x0000, 0, MVF600_DCU_PAD_CTRL) #define MVF600_PAD133_PTE28_DCU0_B7 \ IOMUX_PAD(0x0214, 0x0214, 1, 0x0000, 0, MVF600_DCU_PAD_CTRL) +/*LED1*/ +#define MVF600_PAD35_PTB13_GPIO_LED1 \ + IOMUX_PAD(0x008C, 0x008C, 0, 0x0000, 0, MVF600_LED_PAD_CTRL) +/*LED2*/ +#define MVF600_PAD40_PTB18_GPIO_LED2 \ + IOMUX_PAD(0x00A0, 0x00A0, 0, 0x0000, 0, MVF600_LED_PAD_CTRL) +/*LED3*/ +#define MVF600_PAD96_PTB26_GPIO_LED3 \ + IOMUX_PAD(0x0180, 0x0180, 0, 0x0000, 0, MVF600_LED_PAD_CTRL) +/*LED4*/ +#define MVF600_PAD102_PTC29_GPIO_LED4 \ + IOMUX_PAD(0x0198, 0x0198 ,0, 0x0000, 0, MVF600_LED_PAD_CTRL) +/*BTN1*/ +#define MVF600_PAD25_PTB3_GPIO_BTN1 \ + IOMUX_PAD(0x0064, 0x0064, 0, 0x0000, 0, MVF600_BTN_PAD_CTRL) +/*BTN2*/ +#define MVF600_PAD30_PTB8_GPIO_BTN2 \ + IOMUX_PAD(0x0078, 0x0078, 0, 0x0000, 0, MVF600_BTN_PAD_CTRL) +/*BTN3*/ +#define MVF600_PAD31_PTB9_GPIO_BTN3 \ + IOMUX_PAD(0x007C, 0x007C, 0, 0x0000, 0, MVF600_BTN_PAD_CTRL) +/*BTN4*/ +#define MVF600_PAD34_PTB12_GPIO_BTN4 \ + IOMUX_PAD(0x0088, 0x0088, 0, 0x0000, 0, MVF600_BTN_PAD_CTRL) /*UART1*/ #define MVF600_PAD26_PTB4_UART1_TX \ diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index b0480c8fbcbf..688a06e80db3 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -111,6 +111,7 @@ static int __devinit create_gpio_led(const struct gpio_led *template, led_dat->cdev.name = template->name; led_dat->cdev.default_trigger = template->default_trigger; + led_dat->cdev.trigger_gpio = template->trigger_gpio; led_dat->gpio = template->gpio; led_dat->can_sleep = gpio_cansleep(template->gpio); led_dat->active_low = template->active_low; diff --git a/drivers/leds/ledtrig-gpio.c b/drivers/leds/ledtrig-gpio.c index ecc4bf3f37a9..91460309d006 100644 --- a/drivers/leds/ledtrig-gpio.c +++ b/drivers/leds/ledtrig-gpio.c @@ -164,6 +164,7 @@ static ssize_t gpio_trig_gpio_store(struct device *dev, ret = request_irq(gpio_to_irq(gpio), gpio_trig_irq, IRQF_SHARED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "ledtrig-gpio", led); + if (ret) { dev_err(dev, "request_irq failed with error %d\n", ret); } else { @@ -198,6 +199,17 @@ static void gpio_trig_activate(struct led_classdev *led) goto err_brightness; gpio_data->led = led; + + if(led->trigger_gpio) + { + gpio_data->gpio = led->trigger_gpio; + ret = request_irq(gpio_to_irq(gpio_data->gpio), gpio_trig_irq, + IRQF_SHARED | IRQF_TRIGGER_RISING + | IRQF_TRIGGER_FALLING, "ledtrig-gpio", led); + } + if (ret) + dev_err(led->dev, "request_irq failed with error %d\n", ret); + led->trigger_data = gpio_data; INIT_WORK(&gpio_data->work, gpio_trig_work); diff --git a/include/linux/leds.h b/include/linux/leds.h index 5884def15a24..f68d26f326ad 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -61,6 +61,7 @@ struct led_classdev { struct device *dev; struct list_head node; /* LED Device list */ const char *default_trigger; /* Trigger to use */ + unsigned trigger_gpio; unsigned long blink_delay_on, blink_delay_off; struct timer_list blink_timer; @@ -173,6 +174,7 @@ extern void ledtrig_ide_activity(void); struct led_info { const char *name; const char *default_trigger; + unsigned trigger_gpio; int flags; }; @@ -185,6 +187,7 @@ struct led_platform_data { struct gpio_led { const char *name; const char *default_trigger; + unsigned trigger_gpio; unsigned gpio; unsigned active_low : 1; unsigned retain_state_suspended : 1; |