diff options
author | Lin Fuzhen <fuzhen.lin@freescale.com> | 2012-09-06 16:49:41 +0800 |
---|---|---|
committer | Lin Fuzhen <fuzhen.lin@freescale.com> | 2012-09-06 17:21:15 +0800 |
commit | a45bfa0fcb4f54a4ff8e4c6785f8faa6bdf1cd8c (patch) | |
tree | 1b788e38cdf386da15f510a8060aecc2cf97ce27 | |
parent | 18d57884842aff062c5654e36620942c43e4bc48 (diff) |
ENGR00221719 MX6DQ SABRESD: Add new power key for new sbaresd board
--New sabresd(RevB4 ane above) change the ONOFF key(SW1) design,
the SW1 now connect to GPIO_3_29, so map it as the power key,
and map SW5 as the volume down key which being mapped to power
key for new boards.
--Old sabresd such as RevB or older still use SW5 as the power key
--Add SOC version check to identify different board revsion. It is the
simplest way to achive this before board id/rev are defined clearly.
Signed-off-by: Lin Fuzhen <fuzhen.lin@freescale.com>
-rw-r--r-- | arch/arm/mach-mx6/board-mx6q_sabresd.c | 55 |
1 files changed, 46 insertions, 9 deletions
diff --git a/arch/arm/mach-mx6/board-mx6q_sabresd.c b/arch/arm/mach-mx6/board-mx6q_sabresd.c index 9b69f992cac1..57cdcd9b14c4 100644 --- a/arch/arm/mach-mx6/board-mx6q_sabresd.c +++ b/arch/arm/mach-mx6/board-mx6q_sabresd.c @@ -1557,28 +1557,65 @@ static void __init imx6q_add_device_gpio_leds(void) {} .debounce_interval = debounce, \ } -static struct gpio_keys_button imx6q_buttons[] = { +static struct gpio_keys_button sabresd_buttons[] = { GPIO_BUTTON(SABRESD_VOLUME_UP, KEY_VOLUMEUP, 1, "volume-up", 0, 1), GPIO_BUTTON(SABRESD_VOLUME_DN, KEY_POWER, 1, "volume-down", 1, 1), }; -static struct gpio_keys_platform_data imx6q_button_data = { - .buttons = imx6q_buttons, - .nbuttons = ARRAY_SIZE(imx6q_buttons), +static struct gpio_keys_platform_data sabresd_button_data = { + .buttons = sabresd_buttons, + .nbuttons = ARRAY_SIZE(sabresd_buttons), }; -static struct platform_device imx6q_button_device = { +static struct gpio_keys_button new_sabresd_buttons[] = { + GPIO_BUTTON(SABRESD_VOLUME_UP, KEY_VOLUMEUP, 1, "volume-up", 0, 1), + GPIO_BUTTON(SABRESD_VOLUME_DN, KEY_VOLUMEDOWN, 1, "volume-down", 1, 1), + GPIO_BUTTON(SABRESD_POWER_OFF, KEY_POWER, 1, "power-key", 1, 1), +}; + +static struct gpio_keys_platform_data new_sabresd_button_data = { + .buttons = new_sabresd_buttons, + .nbuttons = ARRAY_SIZE(new_sabresd_buttons), +}; + +static struct platform_device sabresd_button_device = { .name = "gpio-keys", .id = -1, .num_resources = 0, - .dev = { - .platform_data = &imx6q_button_data, - } }; static void __init imx6q_add_device_buttons(void) { - platform_device_register(&imx6q_button_device); + /* fix me */ + /* For new sabresd(RevB4 ane above) change the + * ONOFF key(SW1) design, the SW1 now connect + * to GPIO_3_29, it can be use as a general power + * key that Android reuired. But those old sabresd + * such as RevB or older could not support this + * change, so it needs a way to distinguish different + * boards. Before board id/rev are defined cleary, + * there is a simple way to achive this, that is using + * SOC revison to identify differnt board revison. + * + * With the new sabresd change and SW mapping the + * SW1 as power key, below function related to power + * key are OK on new sabresd board(B4 or above). + * 1 Act as power button to power on the device when device is power off + * 2 Act as power button to power on the device(need keep press SW1 >5s) + * 3 Act as power key to let device suspend/resume + * 4 Act screenshort(hold power key and volume down key for 2s) + */ + if (mx6q_revision() >= IMX_CHIP_REVISION_1_2 || + mx6dl_revision() >= IMX_CHIP_REVISION_1_1) + platform_device_add_data(&sabresd_button_device, + &new_sabresd_button_data, + sizeof(new_sabresd_button_data)); + else + platform_device_add_data(&sabresd_button_device, + &sabresd_button_data, + sizeof(sabresd_button_data)); + + platform_device_register(&sabresd_button_device); } #else static void __init imx6q_add_device_buttons(void) {} |