From 3ea57218fde5fe6c2ff449d4c30fc69ac6976096 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Sat, 28 Mar 2009 22:15:07 +0800 Subject: [PATCH] Blackfin arch: Privide BF537-STAMP platform data of ADP5520 Multifunction driver ADP5520 Multifunction LCD Backlight and Keypad Input Device Driver Signed-off-by: Michael Hennerich Signed-off-by: Bryan Wu --- arch/blackfin/mach-bf537/boards/stamp.c | 142 ++++++++++++++++++++++++ 1 file changed, 142 insertions(+) diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c index 0afe9bd6dbc9..f32b7477dcb0 100644 --- a/arch/blackfin/mach-bf537/boards/stamp.c +++ b/arch/blackfin/mach-bf537/boards/stamp.c @@ -1073,6 +1073,141 @@ static struct adp5588_kpad_platform_data adp5588_kpad_data = { }; #endif +#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE) +#include + + /* + * ADP5520/5501 Backlight Data + */ + +static struct adp5520_backlight_platfrom_data adp5520_backlight_data = { + .fade_in = FADE_T_1200ms, + .fade_out = FADE_T_1200ms, + .fade_led_law = BL_LAW_LINEAR, + .en_ambl_sens = 1, + .abml_filt = BL_AMBL_FILT_640ms, + .l1_daylight_max = BL_CUR_mA(15), + .l1_daylight_dim = BL_CUR_mA(0), + .l2_office_max = BL_CUR_mA(7), + .l2_office_dim = BL_CUR_mA(0), + .l3_dark_max = BL_CUR_mA(3), + .l3_dark_dim = BL_CUR_mA(0), + .l2_trip = L2_COMP_CURR_uA(700), + .l2_hyst = L2_COMP_CURR_uA(50), + .l3_trip = L3_COMP_CURR_uA(80), + .l3_hyst = L3_COMP_CURR_uA(20), +}; + + /* + * ADP5520/5501 LEDs Data + */ + +#include + +static struct led_info adp5520_leds[] = { + { + .name = "adp5520-led1", + .default_trigger = "none", + .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | LED_OFFT_600ms, + }, +#ifdef ADP5520_EN_ALL_LEDS + { + .name = "adp5520-led2", + .default_trigger = "none", + .flags = FLAG_ID_ADP5520_LED2_ADP5501_LED1, + }, + { + .name = "adp5520-led3", + .default_trigger = "none", + .flags = FLAG_ID_ADP5520_LED3_ADP5501_LED2, + }, +#endif +}; + +static struct adp5520_leds_platfrom_data adp5520_leds_data = { + .num_leds = ARRAY_SIZE(adp5520_leds), + .leds = adp5520_leds, + .fade_in = FADE_T_600ms, + .fade_out = FADE_T_600ms, + .led_on_time = LED_ONT_600ms, +}; + + /* + * ADP5520 GPIO Data + */ + +static struct adp5520_gpio_platfrom_data adp5520_gpio_data = { + .gpio_start = 50, + .gpio_en_mask = GPIO_C1 | GPIO_C2 | GPIO_R2, + .gpio_pullup_mask = GPIO_C1 | GPIO_C2 | GPIO_R2, +}; + + /* + * ADP5520 Keypad Data + */ + +#include +static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = { + [KEY(0, 0)] = KEY_GRAVE, + [KEY(0, 1)] = KEY_1, + [KEY(0, 2)] = KEY_2, + [KEY(0, 3)] = KEY_3, + [KEY(1, 0)] = KEY_4, + [KEY(1, 1)] = KEY_5, + [KEY(1, 2)] = KEY_6, + [KEY(1, 3)] = KEY_7, + [KEY(2, 0)] = KEY_8, + [KEY(2, 1)] = KEY_9, + [KEY(2, 2)] = KEY_0, + [KEY(2, 3)] = KEY_MINUS, + [KEY(3, 0)] = KEY_EQUAL, + [KEY(3, 1)] = KEY_BACKSLASH, + [KEY(3, 2)] = KEY_BACKSPACE, + [KEY(3, 3)] = KEY_ENTER, +}; + +static struct adp5520_keys_platfrom_data adp5520_keys_data = { + .rows_en_mask = ROW_R3 | ROW_R2 | ROW_R1 | ROW_R0, + .cols_en_mask = COL_C3 | COL_C2 | COL_C1 | COL_C0, + .keymap = adp5520_keymap, + .keymapsize = ARRAY_SIZE(adp5520_keymap), + .repeat = 0, +}; + + /* + * ADP5520/5501 Multifuction Device Init Data + */ + +static struct adp5520_subdev_info adp5520_subdevs[] = { + { + .name = "adp5520-backlight", + .id = ID_ADP5520, + .platform_data = &adp5520_backlight_data, + }, + { + .name = "adp5520-led", + .id = ID_ADP5520, + .platform_data = &adp5520_leds_data, + }, + { + .name = "adp5520-gpio", + .id = ID_ADP5520, + .platform_data = &adp5520_gpio_data, + }, + { + .name = "adp5520-keys", + .id = ID_ADP5520, + .platform_data = &adp5520_keys_data, + }, +}; + +static struct adp5520_platform_data adp5520_pdev_data = { + .num_subdevs = ARRAY_SIZE(adp5520_subdevs), + .subdevs = adp5520_subdevs, +}; + +#endif + static struct i2c_board_info __initdata bfin_i2c_board_info[] = { #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE) { @@ -1105,6 +1240,13 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = { .platform_data = (void *)&adp5588_kpad_data, }, #endif +#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE) + { + I2C_BOARD_INFO("pmic-adp5520", 0x32), + .irq = IRQ_PF7, + .platform_data = (void *)&adp5520_pdev_data, + }, +#endif }; #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) -- 2.30.2