diff options
author | Lin Fuzhen <fuzhen.lin@freescale.com> | 2012-04-25 13:30:50 +0800 |
---|---|---|
committer | Frank Li <Frank.Li@freescale.com> | 2012-04-27 12:44:46 +0800 |
commit | 42f356f383630846ff43156ef43c42004b76e54b (patch) | |
tree | 0df1f067be42b08cfc05a10fde68098719a90a45 /arch | |
parent | 6f26b05f16ae90e56d24a1469975540d1486adb3 (diff) |
ENGR00178223-2 gpio-led: Add LED-GPIO control and trigger for sabresd
Add led-gpio control and trigger for sabresd
Signed-off-by: Lin Fuzhen <fuzhen.lin@freescale.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-mx6/board-mx6q_sabresd.c | 49 | ||||
-rw-r--r-- | arch/arm/mach-mx6/board-mx6q_sabresd.h | 3 |
2 files changed, 51 insertions, 1 deletions
diff --git a/arch/arm/mach-mx6/board-mx6q_sabresd.c b/arch/arm/mach-mx6/board-mx6q_sabresd.c index a4b96cdacea8..abb79eb9fe3d 100644 --- a/arch/arm/mach-mx6/board-mx6q_sabresd.c +++ b/arch/arm/mach-mx6/board-mx6q_sabresd.c @@ -191,6 +191,8 @@ #define SABRESD_EPDC_PMIC_WAKE IMX_GPIO_NR(3, 20) #define SABRESD_EPDC_PMIC_INT IMX_GPIO_NR(2, 25) #define SABRESD_EPDC_VCOM IMX_GPIO_NR(3, 17) +#define SABRESD_CHARGE_NOW IMX_GPIO_NR(1, 2) +#define SABRESD_CHARGE_DONE IMX_GPIO_NR(1, 1) static struct clk *sata_clk; static int mma8451_position = 3; @@ -1370,6 +1372,51 @@ static void gps_power_on(bool on) gpio_free(SABRESD_GPS_EN); } + +#if defined(CONFIG_LEDS_TRIGGER) || defined(CONFIG_LEDS_GPIO) + +#define GPIO_LED(gpio_led, name_led, act_low, state_suspend, trigger) \ +{ \ + .gpio = gpio_led, \ + .name = name_led, \ + .active_low = act_low, \ + .retain_state_suspended = state_suspend, \ + .default_state = 0, \ + .default_trigger = "max8903-"trigger, \ +} + +/* use to show a external power source is connected + * GPIO_LED(SABRESD_CHARGE_DONE, "chg_detect", 0, 1, "ac-online"), + */ +static struct gpio_led imx6q_gpio_leds[] = { + GPIO_LED(SABRESD_CHARGE_NOW, "chg_now_led", 0, 1, + "charger-charging"), + GPIO_LED(SABRESD_CHARGE_DONE, "chg_done_led", 0, 1, + "charger-full"), +}; + +static struct gpio_led_platform_data imx6q_gpio_leds_data = { + .leds = imx6q_gpio_leds, + .num_leds = ARRAY_SIZE(imx6q_gpio_leds), +}; + +static struct platform_device imx6q_gpio_led_device = { + .name = "leds-gpio", + .id = -1, + .num_resources = 0, + .dev = { + .platform_data = &imx6q_gpio_leds_data, + } +}; + +static void __init imx6q_add_device_gpio_leds(void) +{ + platform_device_register(&imx6q_gpio_led_device); +} +#else +static void __init imx6q_add_device_gpio_leds(void) {} +#endif + #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) #define GPIO_BUTTON(gpio_num, ev_code, act_low, descr, wake) \ { \ @@ -1555,6 +1602,8 @@ static void __init mx6_sabresd_board_init(void) strcpy(mxc_i2c0_board_info[0].type, "wm8962"); mxc_i2c0_board_info[0].platform_data = &wm8962_config_data; } + imx6q_add_device_gpio_leds(); + imx6q_add_imx_i2c(0, &mx6q_sabresd_i2c_data); imx6q_add_imx_i2c(1, &mx6q_sabresd_i2c_data); imx6q_add_imx_i2c(2, &mx6q_sabresd_i2c_data); diff --git a/arch/arm/mach-mx6/board-mx6q_sabresd.h b/arch/arm/mach-mx6/board-mx6q_sabresd.h index 8ccb3423424f..af3df8b01092 100644 --- a/arch/arm/mach-mx6/board-mx6q_sabresd.h +++ b/arch/arm/mach-mx6/board-mx6q_sabresd.h @@ -30,7 +30,8 @@ static iomux_v3_cfg_t mx6q_sabresd_pads[] = { /* CAN1 */ MX6Q_PAD_KEY_ROW2__CAN1_RXCAN, /* MX6Q_PAD_KEY_COL2__CAN1_TXCAN, */ - MX6Q_PAD_GPIO_2__GPIO_1_2, /* STNDBY */ + MX6Q_PAD_GPIO_1__GPIO_1_1, /* user defiend green led */ + MX6Q_PAD_GPIO_2__GPIO_1_2, /* user defined red led */ MX6Q_PAD_GPIO_7__GPIO_1_7, /* NERR */ /* CCM */ |