a22/td8801: update board for wm8994
author邱建斌 <qjb@rock-chips.com>
Thu, 1 Dec 2011 08:38:40 +0000 (16:38 +0800)
committer邱建斌 <qjb@rock-chips.com>
Thu, 1 Dec 2011 08:38:40 +0000 (16:38 +0800)
arch/arm/mach-rk29/board-rk29-a22.c
arch/arm/mach-rk29/board-rk29-td8801_v2.c

index 36d1fe2f5fae5a4eb4e8d0ce4ac772d2f32bd4d0..69c3e2c03d071db2f9f70d4f9064f6bb13c7315d 100755 (executable)
@@ -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)
index d3570147882ce73c7e4e152356cc0ce535dd991b..6febb46caadfb87463e49614db8a98fbb398f9a0 100755 (executable)
@@ -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)