From 12fb7e5d88e19adad1ad4d05ed53c4e23025295a Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=82=B1=E5=BB=BA=E6=96=8C?= Date: Thu, 1 Dec 2011 16:38:40 +0800 Subject: [PATCH] a22/td8801: update board for wm8994 --- arch/arm/mach-rk29/board-rk29-a22.c | 138 ++++++++++++++++++---- arch/arm/mach-rk29/board-rk29-td8801_v2.c | 120 ++++++++++++++++++- 2 files changed, 232 insertions(+), 26 deletions(-) diff --git a/arch/arm/mach-rk29/board-rk29-a22.c b/arch/arm/mach-rk29/board-rk29-a22.c index 36d1fe2f5fae..69c3e2c03d07 100755 --- a/arch/arm/mach-rk29/board-rk29-a22.c +++ b/arch/arm/mach-rk29/board-rk29-a22.c @@ -1627,31 +1627,119 @@ struct platform_device rk29_device_gps = { * wm8994 codec * author: qjb@rock-chips.com *****************************************************************************************/ -#if defined (CONFIG_SND_SOC_WM8994) -struct wm8994_pdata wm8994_platdata = { - .BB_input_diff = 0, - .BB_class = NO_PCM_BB, - - .no_earpiece = 0, - .sp_hp_same_channel = 0, +#if defined(CONFIG_MFD_WM8994) +static struct regulator_consumer_supply wm8994_fixed_voltage0_supplies[] = { + REGULATOR_SUPPLY("DBVDD", "5-001a"), + REGULATOR_SUPPLY("AVDD2", "5-001a"), + REGULATOR_SUPPLY("CPVDD", "5-001a"), +}; - .PA_control_pin = RK29_PIN6_PD3, - .Power_EN_Pin = RK29_PIN5_PA1, - - .speaker_incall_vol = 0, - .speaker_incall_mic_vol = -9, - .speaker_normal_vol = -10, - .earpiece_incall_vol = 0, - .headset_incall_vol = 6, - .headset_incall_mic_vol = -6, - .headset_normal_vol = -6, - .BT_incall_vol = 0, - .BT_incall_mic_vol = 0, - .recorder_vol = 30, - +static struct regulator_consumer_supply wm8994_fixed_voltage1_supplies[] = { + REGULATOR_SUPPLY("SPKVDD1", "5-001a"), + REGULATOR_SUPPLY("SPKVDD2", "5-001a"), +}; + +static struct regulator_init_data wm8994_fixed_voltage0_init_data = { + .constraints = { + .always_on = 1, + }, + .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage0_supplies), + .consumer_supplies = wm8994_fixed_voltage0_supplies, }; -#endif +static struct regulator_init_data wm8994_fixed_voltage1_init_data = { + .constraints = { + .always_on = 1, + }, + .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage1_supplies), + .consumer_supplies = wm8994_fixed_voltage1_supplies, +}; + +static struct fixed_voltage_config wm8994_fixed_voltage0_config = { + .supply_name = "VCC_1.8V_PDA", + .microvolts = 1800000, + .gpio = -EINVAL, + .init_data = &wm8994_fixed_voltage0_init_data, +}; + +static struct fixed_voltage_config wm8994_fixed_voltage1_config = { + .supply_name = "V_BAT", + .microvolts = 3700000, + .gpio = -EINVAL, + .init_data = &wm8994_fixed_voltage1_init_data, +}; + +static struct platform_device wm8994_fixed_voltage0 = { + .name = "reg-fixed-voltage", + .id = 0, + .dev = { + .platform_data = &wm8994_fixed_voltage0_config, + }, +}; + +static struct platform_device wm8994_fixed_voltage1 = { + .name = "reg-fixed-voltage", + .id = 1, + .dev = { + .platform_data = &wm8994_fixed_voltage1_config, + }, +}; + +static struct regulator_consumer_supply wm8994_avdd1_supply = + REGULATOR_SUPPLY("AVDD1", "5-001a"); + +static struct regulator_consumer_supply wm8994_dcvdd_supply = + REGULATOR_SUPPLY("DCVDD", "5-001a"); + + + +static struct regulator_init_data wm8994_ldo1_data = { + .constraints = { + .name = "AVDD1_3.0V", + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = 1, + .consumer_supplies = &wm8994_avdd1_supply, +}; + +static struct regulator_init_data wm8994_ldo2_data = { + .constraints = { + .name = "DCVDD_1.0V", + }, + .num_consumer_supplies = 1, + .consumer_supplies = &wm8994_dcvdd_supply, +}; + +static struct wm8994_pdata wm8994_platform_data = { +#if defined (CONFIG_GPIO_WM8994) + .gpio_base = WM8994_GPIO_EXPANDER_BASE, + //Fill value to initialize the GPIO + .gpio_defaults ={}, +#endif + /* configure gpio1 function: 0x0001(Logic level input/output) */ +// .gpio_defaults[0] = 0x0001, + /* configure gpio3/4/5/7 function for AIF2 voice */ +// .gpio_defaults[2] = 0x8100, +// .gpio_defaults[3] = 0x8100, +// .gpio_defaults[4] = 0x8100, +// .gpio_defaults[6] = 0x0100, + /* configure gpio8/9/10/11 function for AIF3 BT */ +// .gpio_defaults[7] = 0x8100, +// .gpio_defaults[8] = 0x0100, +// .gpio_defaults[9] = 0x0100, +// .gpio_defaults[10] = 0x0100, + .ldo[0] = { RK29_PIN5_PA1, NULL, &wm8994_ldo1_data }, /* XM0FRNB_2 */ + .ldo[1] = { 0, NULL, &wm8994_ldo2_data }, + + .micdet_irq = 0, + .irq_base = 0, + +// .BB_input_diff = 0, +// .BB_class = NO_PCM_BB, + +// .PA_control_pin = RK29_PIN6_PD3, +}; +#endif #ifdef CONFIG_RK_HEADSET_DET struct rk_headset_pdata rk_headset_info = { @@ -1871,9 +1959,9 @@ static struct i2c_board_info __initdata board_i2c0_devices[] = { .type = "wm8994", .addr = 0x1a, .flags = 0, -// #if defined(CONFIG_MFD_WM8994) - .platform_data = &wm8994_platdata, -// #endif + #if defined(CONFIG_MFD_WM8994) + .platform_data = &wm8994_platform_data, + #endif }, #endif #if defined (CONFIG_FM580X) diff --git a/arch/arm/mach-rk29/board-rk29-td8801_v2.c b/arch/arm/mach-rk29/board-rk29-td8801_v2.c index d3570147882c..6febb46caadf 100755 --- a/arch/arm/mach-rk29/board-rk29-td8801_v2.c +++ b/arch/arm/mach-rk29/board-rk29-td8801_v2.c @@ -1581,12 +1581,127 @@ struct platform_device rk29_device_gps = { }; #endif +/***************************************************************************************** + * wm8994 codec + * author: qjb@rock-chips.com + *****************************************************************************************/ +#if defined(CONFIG_MFD_WM8994) +static struct regulator_consumer_supply wm8994_fixed_voltage0_supplies[] = { + REGULATOR_SUPPLY("DBVDD", "5-001a"), + REGULATOR_SUPPLY("AVDD2", "5-001a"), + REGULATOR_SUPPLY("CPVDD", "5-001a"), +}; + +static struct regulator_consumer_supply wm8994_fixed_voltage1_supplies[] = { + REGULATOR_SUPPLY("SPKVDD1", "5-001a"), + REGULATOR_SUPPLY("SPKVDD2", "5-001a"), +}; + +static struct regulator_init_data wm8994_fixed_voltage0_init_data = { + .constraints = { + .always_on = 1, + }, + .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage0_supplies), + .consumer_supplies = wm8994_fixed_voltage0_supplies, +}; + +static struct regulator_init_data wm8994_fixed_voltage1_init_data = { + .constraints = { + .always_on = 1, + }, + .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage1_supplies), + .consumer_supplies = wm8994_fixed_voltage1_supplies, +}; + +static struct fixed_voltage_config wm8994_fixed_voltage0_config = { + .supply_name = "VCC_1.8V_PDA", + .microvolts = 1800000, + .gpio = -EINVAL, + .init_data = &wm8994_fixed_voltage0_init_data, +}; + +static struct fixed_voltage_config wm8994_fixed_voltage1_config = { + .supply_name = "V_BAT", + .microvolts = 3700000, + .gpio = -EINVAL, + .init_data = &wm8994_fixed_voltage1_init_data, +}; + +static struct platform_device wm8994_fixed_voltage0 = { + .name = "reg-fixed-voltage", + .id = 0, + .dev = { + .platform_data = &wm8994_fixed_voltage0_config, + }, +}; + +static struct platform_device wm8994_fixed_voltage1 = { + .name = "reg-fixed-voltage", + .id = 1, + .dev = { + .platform_data = &wm8994_fixed_voltage1_config, + }, +}; + +static struct regulator_consumer_supply wm8994_avdd1_supply = + REGULATOR_SUPPLY("AVDD1", "5-001a"); + +static struct regulator_consumer_supply wm8994_dcvdd_supply = + REGULATOR_SUPPLY("DCVDD", "5-001a"); + + + +static struct regulator_init_data wm8994_ldo1_data = { + .constraints = { + .name = "AVDD1_3.0V", + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = 1, + .consumer_supplies = &wm8994_avdd1_supply, +}; + +static struct regulator_init_data wm8994_ldo2_data = { + .constraints = { + .name = "DCVDD_1.0V", + }, + .num_consumer_supplies = 1, + .consumer_supplies = &wm8994_dcvdd_supply, +}; + +static struct wm8994_pdata wm8994_platform_data = { +#if defined (CONFIG_GPIO_WM8994) + .gpio_base = WM8994_GPIO_EXPANDER_BASE, + //Fill value to initialize the GPIO + .gpio_defaults ={}, +#endif + /* configure gpio1 function: 0x0001(Logic level input/output) */ +// .gpio_defaults[0] = 0x0001, + /* configure gpio3/4/5/7 function for AIF2 voice */ +// .gpio_defaults[2] = 0x8100, +// .gpio_defaults[3] = 0x8100, +// .gpio_defaults[4] = 0x8100, +// .gpio_defaults[6] = 0x0100, + /* configure gpio8/9/10/11 function for AIF3 BT */ +// .gpio_defaults[7] = 0x8100, +// .gpio_defaults[8] = 0x0100, +// .gpio_defaults[9] = 0x0100, +// .gpio_defaults[10] = 0x0100, + .ldo[0] = { RK29_PIN5_PA1, NULL, &wm8994_ldo1_data }, /* XM0FRNB_2 */ + .ldo[1] = { 0, NULL, &wm8994_ldo2_data }, + + .micdet_irq = 0, + .irq_base = 0, + +// .BB_input_diff = 1, +}; +#endif + #ifdef CONFIG_RK_HEADSET_DET #define HEADSET_GPIO RK29_PIN4_PD2 struct rk_headset_pdata rk_headset_info = { .Headset_gpio = RK29_PIN4_PD2, .headset_in_type= HEADSET_IN_HIGH, - .Hook_gpio = RK29_PIN6_PB6,//Detection Headset--Must be set + .Hook_gpio = 0,//Detection Headset--Must be set .hook_key_code = KEY_MEDIA, }; @@ -1785,6 +1900,9 @@ static struct i2c_board_info __initdata board_i2c0_devices[] = { .type = "wm8994", .addr = 0x1a, .flags = 0, + #if defined(CONFIG_MFD_WM8994) + .platform_data = &wm8994_platform_data, + #endif }, #endif #if defined (CONFIG_BATTERY_STC3100) -- 2.34.1