static int sysclk_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
---- struct snd_soc_codec *codec = w->codec;
++++ struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
switch (event) {
static int out_pga_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
---- struct snd_soc_codec *codec = w->codec;
++++ struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
int reg, val;
int dcs_mask;
{ "Right Capture PGA", NULL, "Right Capture Mux" },
{ "Right Capture PGA", NULL, "Right Capture Inverting Mux" },
---- { "AIFOUTL", "Left", "ADCL" },
---- { "AIFOUTL", "Right", "ADCR" },
---- { "AIFOUTR", "Left", "ADCL" },
---- { "AIFOUTR", "Right", "ADCR" },
++++ { "AIFOUTL Mux", "Left", "ADCL" },
++++ { "AIFOUTL Mux", "Right", "ADCR" },
++++ { "AIFOUTR Mux", "Left", "ADCL" },
++++ { "AIFOUTR Mux", "Right", "ADCR" },
++++
++++ { "AIFOUTL", NULL, "AIFOUTL Mux" },
++++ { "AIFOUTR", NULL, "AIFOUTR Mux" },
{ "ADCL", NULL, "CLK_DSP" },
{ "ADCL", NULL, "Left Capture PGA" },
};
static const struct snd_soc_dapm_route dac_intercon[] = {
---- { "DACL", "Right", "AIFINR" },
---- { "DACL", "Left", "AIFINL" },
++++ { "DACL Mux", "Left", "AIFINL" },
++++ { "DACL Mux", "Right", "AIFINR" },
++++
++++ { "DACR Mux", "Left", "AIFINL" },
++++ { "DACR Mux", "Right", "AIFINR" },
++++
++++ { "DACL", NULL, "DACL Mux" },
{ "DACL", NULL, "CLK_DSP" },
---- { "DACR", "Right", "AIFINR" },
---- { "DACR", "Left", "AIFINL" },
++++ { "DACR", NULL, "DACR Mux" },
{ "DACR", NULL, "CLK_DSP" },
{ "Charge pump", NULL, "SYSCLK" },
.num_reg_defaults = ARRAY_SIZE(wm8904_reg_defaults),
};
++++ #ifdef CONFIG_OF
++++ static enum wm8904_type wm8904_data = WM8904;
++++ static enum wm8904_type wm8912_data = WM8912;
++++
++++ static const struct of_device_id wm8904_of_match[] = {
++++ {
++++ .compatible = "wlf,wm8904",
++++ .data = &wm8904_data,
++++ }, {
++++ .compatible = "wlf,wm8912",
++++ .data = &wm8912_data,
++++ }, {
++++ /* sentinel */
++++ }
++++ };
++++ MODULE_DEVICE_TABLE(of, wm8904_of_match);
++++ #endif
++++
static int wm8904_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
return ret;
}
---- wm8904->devtype = id->driver_data;
++++ if (i2c->dev.of_node) {
++++ const struct of_device_id *match;
++++
++++ match = of_match_node(wm8904_of_match, i2c->dev.of_node);
++++ if (match == NULL)
++++ return -EINVAL;
++++ wm8904->devtype = *((enum wm8904_type *)match->data);
++++ } else {
++++ wm8904->devtype = id->driver_data;
++++ }
++++
i2c_set_clientdata(i2c, wm8904);
wm8904->pdata = i2c->dev.platform_data;
.driver = {
.name = "wm8904",
.owner = THIS_MODULE,
++++ .of_match_table = of_match_ptr(wm8904_of_match),
},
.probe = wm8904_i2c_probe,
.remove = wm8904_i2c_remove,
"MICVDD"
};
--- -static struct reg_default wm8995_reg_defaults[] = {
+++ +static const struct reg_default wm8995_reg_defaults[] = {
{ 0, 0x8995 },
{ 5, 0x0100 },
{ 16, 0x000b },
static int check_clk_sys(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink)
{
++++ struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
unsigned int reg;
const char *clk;
---- reg = snd_soc_read(source->codec, WM8995_CLOCKING_1);
++++ reg = snd_soc_read(codec, WM8995_CLOCKING_1);
/* Check what we're currently using for CLK_SYS */
if (reg & WM8995_SYSCLK_SRC)
clk = "AIF2CLK";
static int hp_supply_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
---- struct snd_soc_codec *codec;
----
---- codec = w->codec;
++++ struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
static int hp_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
---- struct snd_soc_codec *codec;
++++ struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
unsigned int reg;
---- codec = w->codec;
reg = snd_soc_read(codec, WM8995_ANALOGUE_HP_1);
switch (event) {
static int clk_sys_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
---- struct snd_soc_codec *codec;
----
---- codec = w->codec;
++++ struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
int i;
wm8995 = snd_soc_codec_get_drvdata(codec);
- wm8995_set_bias_level(codec, SND_SOC_BIAS_OFF);
for (i = 0; i < ARRAY_SIZE(wm8995->supplies); ++i)
regulator_unregister_notifier(wm8995->supplies[i].consumer,
goto err_reg_enable;
}
- wm8995_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
-
/* Latch volume updates (right only; we always do left then right). */
snd_soc_update_bits(codec, WM8995_AIF1_DAC1_RIGHT_VOLUME,
WM8995_AIF1DAC1_VU_MASK, WM8995_AIF1DAC1_VU);
wm8995_update_class_w(codec);
- snd_soc_add_codec_controls(codec, wm8995_snd_controls,
- ARRAY_SIZE(wm8995_snd_controls));
- snd_soc_dapm_new_controls(&codec->dapm, wm8995_dapm_widgets,
- ARRAY_SIZE(wm8995_dapm_widgets));
- snd_soc_dapm_add_routes(&codec->dapm, wm8995_intercon,
- ARRAY_SIZE(wm8995_intercon));
-
return 0;
err_reg_enable:
}
};
--- -static struct snd_soc_codec_driver soc_codec_dev_wm8995 = {
+++ +static const struct snd_soc_codec_driver soc_codec_dev_wm8995 = {
.probe = wm8995_probe,
.remove = wm8995_remove,
.set_bias_level = wm8995_set_bias_level,
.idle_bias_off = true,
+
+ .controls = wm8995_snd_controls,
+ .num_controls = ARRAY_SIZE(wm8995_snd_controls),
+ .dapm_widgets = wm8995_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(wm8995_dapm_widgets),
+ .dapm_routes = wm8995_intercon,
+ .num_dapm_routes = ARRAY_SIZE(wm8995_intercon),
};
--- -static struct regmap_config wm8995_regmap = {
+++ +static const struct regmap_config wm8995_regmap = {
.reg_bits = 16,
.val_bits = 16,