提交 a36ac9b3 编写于 作者: L Lars-Peter Clausen 提交者: Mark Brown

ASoC: twl4030: Replace w->codec snd_soc_dapm_to_codec(w->dapm)

The codec field of the snd_soc_widget struct is eventually going to be
removed, use snd_soc_dapm_to_codec(w->dapm) instead.
Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 c61ac6b7
...@@ -567,12 +567,13 @@ static const struct snd_kcontrol_new twl4030_dapm_dbypassv_control = ...@@ -567,12 +567,13 @@ static const struct snd_kcontrol_new twl4030_dapm_dbypassv_control =
static int pin_name##pga_event(struct snd_soc_dapm_widget *w, \ static int pin_name##pga_event(struct snd_soc_dapm_widget *w, \
struct snd_kcontrol *kcontrol, int event) \ struct snd_kcontrol *kcontrol, int event) \
{ \ { \
struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec); \ struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); \
struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec); \
\ \
switch (event) { \ switch (event) { \
case SND_SOC_DAPM_POST_PMU: \ case SND_SOC_DAPM_POST_PMU: \
twl4030->pin_name##_enabled = 1; \ twl4030->pin_name##_enabled = 1; \
twl4030_write(w->codec, reg, twl4030_read(w->codec, reg)); \ twl4030_write(codec, reg, twl4030_read(codec, reg)); \
break; \ break; \
case SND_SOC_DAPM_POST_PMD: \ case SND_SOC_DAPM_POST_PMD: \
twl4030->pin_name##_enabled = 0; \ twl4030->pin_name##_enabled = 0; \
...@@ -621,12 +622,14 @@ static void handsfree_ramp(struct snd_soc_codec *codec, int reg, int ramp) ...@@ -621,12 +622,14 @@ static void handsfree_ramp(struct snd_soc_codec *codec, int reg, int ramp)
static int handsfreelpga_event(struct snd_soc_dapm_widget *w, static int handsfreelpga_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
switch (event) { switch (event) {
case SND_SOC_DAPM_POST_PMU: case SND_SOC_DAPM_POST_PMU:
handsfree_ramp(w->codec, TWL4030_REG_HFL_CTL, 1); handsfree_ramp(codec, TWL4030_REG_HFL_CTL, 1);
break; break;
case SND_SOC_DAPM_POST_PMD: case SND_SOC_DAPM_POST_PMD:
handsfree_ramp(w->codec, TWL4030_REG_HFL_CTL, 0); handsfree_ramp(codec, TWL4030_REG_HFL_CTL, 0);
break; break;
} }
return 0; return 0;
...@@ -635,12 +638,14 @@ static int handsfreelpga_event(struct snd_soc_dapm_widget *w, ...@@ -635,12 +638,14 @@ static int handsfreelpga_event(struct snd_soc_dapm_widget *w,
static int handsfreerpga_event(struct snd_soc_dapm_widget *w, static int handsfreerpga_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
switch (event) { switch (event) {
case SND_SOC_DAPM_POST_PMU: case SND_SOC_DAPM_POST_PMU:
handsfree_ramp(w->codec, TWL4030_REG_HFR_CTL, 1); handsfree_ramp(codec, TWL4030_REG_HFR_CTL, 1);
break; break;
case SND_SOC_DAPM_POST_PMD: case SND_SOC_DAPM_POST_PMD:
handsfree_ramp(w->codec, TWL4030_REG_HFR_CTL, 0); handsfree_ramp(codec, TWL4030_REG_HFR_CTL, 0);
break; break;
} }
return 0; return 0;
...@@ -649,19 +654,23 @@ static int handsfreerpga_event(struct snd_soc_dapm_widget *w, ...@@ -649,19 +654,23 @@ static int handsfreerpga_event(struct snd_soc_dapm_widget *w,
static int vibramux_event(struct snd_soc_dapm_widget *w, static int vibramux_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
twl4030_write(w->codec, TWL4030_REG_VIBRA_SET, 0xff); struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
twl4030_write(codec, TWL4030_REG_VIBRA_SET, 0xff);
return 0; return 0;
} }
static int apll_event(struct snd_soc_dapm_widget *w, static int apll_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
switch (event) { switch (event) {
case SND_SOC_DAPM_PRE_PMU: case SND_SOC_DAPM_PRE_PMU:
twl4030_apll_enable(w->codec, 1); twl4030_apll_enable(codec, 1);
break; break;
case SND_SOC_DAPM_POST_PMD: case SND_SOC_DAPM_POST_PMD:
twl4030_apll_enable(w->codec, 0); twl4030_apll_enable(codec, 0);
break; break;
} }
return 0; return 0;
...@@ -670,23 +679,24 @@ static int apll_event(struct snd_soc_dapm_widget *w, ...@@ -670,23 +679,24 @@ static int apll_event(struct snd_soc_dapm_widget *w,
static int aif_event(struct snd_soc_dapm_widget *w, static int aif_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
u8 audio_if; u8 audio_if;
audio_if = twl4030_read(w->codec, TWL4030_REG_AUDIO_IF); audio_if = twl4030_read(codec, TWL4030_REG_AUDIO_IF);
switch (event) { switch (event) {
case SND_SOC_DAPM_PRE_PMU: case SND_SOC_DAPM_PRE_PMU:
/* Enable AIF */ /* Enable AIF */
/* enable the PLL before we use it to clock the DAI */ /* enable the PLL before we use it to clock the DAI */
twl4030_apll_enable(w->codec, 1); twl4030_apll_enable(codec, 1);
twl4030_write(w->codec, TWL4030_REG_AUDIO_IF, twl4030_write(codec, TWL4030_REG_AUDIO_IF,
audio_if | TWL4030_AIF_EN); audio_if | TWL4030_AIF_EN);
break; break;
case SND_SOC_DAPM_POST_PMD: case SND_SOC_DAPM_POST_PMD:
/* disable the DAI before we stop it's source PLL */ /* disable the DAI before we stop it's source PLL */
twl4030_write(w->codec, TWL4030_REG_AUDIO_IF, twl4030_write(codec, TWL4030_REG_AUDIO_IF,
audio_if & ~TWL4030_AIF_EN); audio_if & ~TWL4030_AIF_EN);
twl4030_apll_enable(w->codec, 0); twl4030_apll_enable(codec, 0);
break; break;
} }
return 0; return 0;
...@@ -758,20 +768,21 @@ static void headset_ramp(struct snd_soc_codec *codec, int ramp) ...@@ -758,20 +768,21 @@ static void headset_ramp(struct snd_soc_codec *codec, int ramp)
static int headsetlpga_event(struct snd_soc_dapm_widget *w, static int headsetlpga_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec); struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
switch (event) { switch (event) {
case SND_SOC_DAPM_POST_PMU: case SND_SOC_DAPM_POST_PMU:
/* Do the ramp-up only once */ /* Do the ramp-up only once */
if (!twl4030->hsr_enabled) if (!twl4030->hsr_enabled)
headset_ramp(w->codec, 1); headset_ramp(codec, 1);
twl4030->hsl_enabled = 1; twl4030->hsl_enabled = 1;
break; break;
case SND_SOC_DAPM_POST_PMD: case SND_SOC_DAPM_POST_PMD:
/* Do the ramp-down only if both headsetL/R is disabled */ /* Do the ramp-down only if both headsetL/R is disabled */
if (!twl4030->hsr_enabled) if (!twl4030->hsr_enabled)
headset_ramp(w->codec, 0); headset_ramp(codec, 0);
twl4030->hsl_enabled = 0; twl4030->hsl_enabled = 0;
break; break;
...@@ -782,20 +793,21 @@ static int headsetlpga_event(struct snd_soc_dapm_widget *w, ...@@ -782,20 +793,21 @@ static int headsetlpga_event(struct snd_soc_dapm_widget *w,
static int headsetrpga_event(struct snd_soc_dapm_widget *w, static int headsetrpga_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec); struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
switch (event) { switch (event) {
case SND_SOC_DAPM_POST_PMU: case SND_SOC_DAPM_POST_PMU:
/* Do the ramp-up only once */ /* Do the ramp-up only once */
if (!twl4030->hsl_enabled) if (!twl4030->hsl_enabled)
headset_ramp(w->codec, 1); headset_ramp(codec, 1);
twl4030->hsr_enabled = 1; twl4030->hsr_enabled = 1;
break; break;
case SND_SOC_DAPM_POST_PMD: case SND_SOC_DAPM_POST_PMD:
/* Do the ramp-down only if both headsetL/R is disabled */ /* Do the ramp-down only if both headsetL/R is disabled */
if (!twl4030->hsl_enabled) if (!twl4030->hsl_enabled)
headset_ramp(w->codec, 0); headset_ramp(codec, 0);
twl4030->hsr_enabled = 0; twl4030->hsr_enabled = 0;
break; break;
...@@ -806,7 +818,8 @@ static int headsetrpga_event(struct snd_soc_dapm_widget *w, ...@@ -806,7 +818,8 @@ static int headsetrpga_event(struct snd_soc_dapm_widget *w,
static int digimic_event(struct snd_soc_dapm_widget *w, static int digimic_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec); struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
struct twl4030_codec_data *pdata = twl4030->pdata; struct twl4030_codec_data *pdata = twl4030->pdata;
if (pdata && pdata->digimic_delay) if (pdata && pdata->digimic_delay)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册