From: 邱建斌 Date: Thu, 24 Mar 2011 08:43:09 +0000 (+0800) Subject: wm8994:fill wm8994 platform data on the board-rk29-phonesdk.c X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e130f81f1f4281d1a641b3a9d5715bc736c9b64c;p=firefly-linux-kernel-4.4.55.git wm8994:fill wm8994 platform data on the board-rk29-phonesdk.c --- diff --git a/arch/arm/mach-rk29/board-rk29-phonesdk.c b/arch/arm/mach-rk29/board-rk29-phonesdk.c index a96d20b91465..c2c3206e3180 100755 --- a/arch/arm/mach-rk29/board-rk29-phonesdk.c +++ b/arch/arm/mach-rk29/board-rk29-phonesdk.c @@ -49,6 +49,8 @@ #include #include #include +#include +#include #include #include @@ -1273,6 +1275,116 @@ struct platform_device rk29_device_gps = { }; #endif +/***************************************************************************************** + * wm8994 codec + * author: qjb@rock-chips.com + *****************************************************************************************/ +#if defined(CONFIG_MFD_WM8994) +#if defined (CONFIG_REGULATOR_WM8994) +static struct regulator_consumer_supply wm8994_ldo1_consumers[] = { + { + .supply = "DBVDD", + }, + { + .supply = "AVDD1", + }, + { + .supply = "CPVDD", + }, + { + .supply = "SPKVDD1", + } +}; +static struct regulator_consumer_supply wm8994_ldo2_consumers[] = { + { + .supply = "DCVDD", + }, + { + .supply = "AVDD2", + }, + { + .supply = "SPKVDD2", + } +}; +struct regulator_init_data regulator_init_data_ldo1 = { + .constraints = { + .name = "wm8994-ldo1", + .min_uA = 00000, + .max_uA = 18000, + .always_on = true, + .apply_uV = true, + .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_CURRENT, + }, + .num_consumer_supplies = ARRAY_SIZE(wm8994_ldo1_consumers), + .consumer_supplies = wm8994_ldo1_consumers, +}; +struct regulator_init_data regulator_init_data_ldo2 = { + .constraints = { + .name = "wm8994-ldo2", + .min_uA = 00000, + .max_uA = 18000, + .always_on = true, + .apply_uV = true, + .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_CURRENT, + }, + .num_consumer_supplies = ARRAY_SIZE(wm8994_ldo2_consumers), + .consumer_supplies = wm8994_ldo2_consumers, +}; +#endif +struct wm8994_drc_cfg wm8994_drc_cfg_pdata = { + .name = "wm8994_DRC", + .regs = {0,0,0,0,0}, +}; + +struct wm8994_retune_mobile_cfg wm8994_retune_mobile_cfg_pdata = { + .name = "wm8994_EQ", + .rate = 0, + .regs = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}, +}; + +struct wm8994_pdata wm8994_platdata = { +#if defined (CONFIG_GPIO_WM8994) + .gpio_base = WM8994_GPIO_EXPANDER_BASE, + //Fill value to initialize the GPIO + .gpio_defaults ={}, +#endif + //enable=0 disable ldo +#if defined (CONFIG_REGULATOR_WM8994) + .ldo = { + { + .enable = 0, + //TCA6424_P11 + .supply = "wm8994-ldo1", + .init_data = ®ulator_init_data_ldo1, + }, + { + .enable = 0, + .supply = "wm8994-ldo2", + .init_data = ®ulator_init_data_ldo2, + } + }, +#endif + //DRC 0--use default + .num_drc_cfgs = 0, + .drc_cfgs = &wm8994_drc_cfg_pdata, + //EQ 0--use default + .num_retune_mobile_cfgs = 0, + .retune_mobile_cfgs = &wm8994_retune_mobile_cfg_pdata, + + .lineout1_diff = 1, + .lineout2_diff = 1, + + .lineout1fb = 1, + .lineout2fb = 1, + + .micbias1_lvl = 1, + .micbias2_lvl = 1, + + .jd_scthr = 0, + .jd_thr = 0, +}; +#endif + /***************************************************************************************** * i2c devices * author: kfx@rock-chips.com @@ -1368,6 +1480,7 @@ static struct i2c_board_info __initdata board_i2c0_devices[] = { .type = "wm8994", .addr = 0x1A, .flags = 0, + .platform_data = &wm8994_platdata, }, #endif #if defined (CONFIG_BATTERY_STC3100) @@ -2627,7 +2740,6 @@ struct rk29xx_spi_platform_data rk29xx_spi1_platdata = { .io_resume_leakage_bug = spi_io_resume_leakage_bug, }; - /***************************************************************************************** * xpt2046 touch panel * author: hhb@rock-chips.com diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 3d48497ccedf..cc524df10aa1 100755 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c @@ -184,13 +184,13 @@ static struct mfd_cell wm8994_devs[] = { * management. */ static const char *wm8994_main_supplies[] = { - // "DBVDD", - // "DCVDD", - // "AVDD1", - // "AVDD2", - // "CPVDD", - // "SPKVDD1", - // "SPKVDD2", + "DBVDD", + "DCVDD", + "AVDD1", + "AVDD2", + "CPVDD", + "SPKVDD1", + "SPKVDD2", }; #ifdef CONFIG_PM diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index f6715122c1d0..a7d5548296f8 100755 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -3639,7 +3639,7 @@ static void wm8994_handle_pdata(struct wm8994_priv *wm8994) pdata->jd_thr, pdata->micbias1_lvl, pdata->micbias2_lvl); - pdata->num_drc_cfgs = 0;//add + DBG_INFO(codec->dev, "%d DRC configurations\n", pdata->num_drc_cfgs); if (pdata->num_drc_cfgs) @@ -3679,7 +3679,7 @@ static void wm8994_handle_pdata(struct wm8994_priv *wm8994) for (i = 0; i < WM8994_NUM_DRC; i++) wm8994_set_drc(codec, i); } - pdata->num_retune_mobile_cfgs = 0;//add + DBG_INFO(codec->dev, "%d ReTune Mobile configurations\n", pdata->num_retune_mobile_cfgs); @@ -3718,9 +3718,9 @@ static int wm8994_probe(struct platform_device *pdev) ARRAY_SIZE(wm8994_snd_controls)); snd_soc_dapm_new_controls(codec, wm8994_dapm_widgets, ARRAY_SIZE(wm8994_dapm_widgets)); - wm_hubs_add_analogue_routes(codec, 0, 0); + wm_hubs_add_analogue_routes(codec, 1, 0); snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); - snd_soc_dapm_new_widgets(codec); //and +// snd_soc_dapm_new_widgets(codec); //add ret = snd_soc_init_card(socdev); if (ret < 0) { @@ -3844,7 +3844,7 @@ static ssize_t wm8994_proc_write(struct file *file, const char __user *buffer, else { DBG("Error Read reg debug.\n"); - DBG("For example: r:22,23,24,25\n"); + DBG("For example: echo 'r:22,23,24,25'>wm8994_ts\n"); } break; case 'w': @@ -3871,7 +3871,10 @@ static ssize_t wm8994_proc_write(struct file *file, const char __user *buffer, } break; default: - printk("Please press 'l'!\n"); + DBG("Help for wm8994_ts .\n-->The Cmd list: \n"); + DBG("-->'d&&D' Open or Off the debug\n"); + DBG("-->'r&&R' Read reg debug,Example: echo 'r:22,23,24,25'>wm8994_ts\n"); + DBG("-->'w&&W' Write reg debug,Example: echo 'w:22=0,23=0,24=0,25=0'>wm8994_ts\n"); break; } diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index 019ac214ced7..8d05a852686c 100755 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c @@ -73,13 +73,13 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op) /* Trigger the command */ snd_soc_write(codec, WM8993_DC_SERVO_0, val); - dev_info(codec->dev, "Waiting for DC servo...\n"); + dev_vdbg(codec->dev, "Waiting for DC servo...\n"); do { count++; msleep(10); reg = snd_soc_read(codec, WM8993_DC_SERVO_0); - dev_info(codec->dev, "DC servo: %x\n", reg); + dev_vdbg(codec->dev, "DC servo: %x\n", reg); } while (reg & op && count < 400); if (reg & op) @@ -380,7 +380,7 @@ static int hp_event(struct snd_soc_dapm_widget *w, snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_1, WM8993_HPOUT1L_ENA | WM8993_HPOUT1R_ENA, WM8993_HPOUT1L_ENA | WM8993_HPOUT1R_ENA); - + // printk("hp_event power1 up: 0x%04x",snd_soc_read(codec,WM8993_POWER_MANAGEMENT_1)); reg |= WM8993_HPOUT1L_DLY | WM8993_HPOUT1R_DLY; snd_soc_write(codec, WM8993_ANALOGUE_HP_0, reg); @@ -409,6 +409,7 @@ static int hp_event(struct snd_soc_dapm_widget *w, snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_1, WM8993_HPOUT1L_ENA | WM8993_HPOUT1R_ENA, 0); + // printk("hp_event power1 down: 0x%04x",snd_soc_read(codec,WM8993_POWER_MANAGEMENT_1)); break; } @@ -639,6 +640,13 @@ SND_SOC_DAPM_OUTPUT("LINEOUT2N"), }; static const struct snd_soc_dapm_route analogue_routes[] = { + { "IN1L PGA", NULL , "MICBIAS2" }, + { "IN1R PGA", NULL , "MICBIAS1" }, + { "MICBIAS2", NULL , "IN1LP"}, + { "MICBIAS2", NULL , "IN1LN"}, + { "MICBIAS1", NULL , "IN1RP"}, + { "MICBIAS1", NULL , "IN1RN"}, + { "IN1L PGA", "IN1LP Switch", "IN1LP" }, { "IN1L PGA", "IN1LN Switch", "IN1LN" },