#include <linux/mfd/wm831x/pdata.h>
#include <linux/mfd/wm831x/core.h>
#include <linux/mfd/wm831x/gpio.h>
+#include <linux/mfd/wm8994/pdata.h>
+#include <linux/mfd/wm8994/registers.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
};
#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
.type = "wm8994",
.addr = 0x1A,
.flags = 0,
+ .platform_data = &wm8994_platdata,
},
#endif
#if defined (CONFIG_BATTERY_STC3100)
.io_resume_leakage_bug = spi_io_resume_leakage_bug,
};
-
/*****************************************************************************************
* xpt2046 touch panel
* author: hhb@rock-chips.com
* management.
*/
static const char *wm8994_main_supplies[] = {
- // "DBVDD",
- // "DCVDD",
- // "AVDD1",
- // "AVDD2",
- // "CPVDD",
- // "SPKVDD1",
- // "SPKVDD2",
+ "DBVDD",
+ "DCVDD",
+ "AVDD1",
+ "AVDD2",
+ "CPVDD",
+ "SPKVDD1",
+ "SPKVDD2",
};
#ifdef CONFIG_PM
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)
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);
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) {
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':
}
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;
}
/* 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)
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);
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;
}
};
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" },