|
@@ -686,29 +686,29 @@ static int wm8750_mute(struct snd_soc_codec_dai *dai, int mute)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static int wm8750_dapm_event(struct snd_soc_codec *codec, int event)
|
|
|
+static int wm8750_set_bias_level(struct snd_soc_codec *codec,
|
|
|
+ enum snd_soc_bias_level level)
|
|
|
{
|
|
|
u16 pwr_reg = wm8750_read_reg_cache(codec, WM8750_PWR1) & 0xfe3e;
|
|
|
|
|
|
- switch (event) {
|
|
|
- case SNDRV_CTL_POWER_D0: /* full On */
|
|
|
+ switch (level) {
|
|
|
+ case SND_SOC_BIAS_ON:
|
|
|
/* set vmid to 50k and unmute dac */
|
|
|
wm8750_write(codec, WM8750_PWR1, pwr_reg | 0x00c0);
|
|
|
break;
|
|
|
- case SNDRV_CTL_POWER_D1: /* partial On */
|
|
|
- case SNDRV_CTL_POWER_D2: /* partial On */
|
|
|
+ case SND_SOC_BIAS_PREPARE:
|
|
|
/* set vmid to 5k for quick power up */
|
|
|
wm8750_write(codec, WM8750_PWR1, pwr_reg | 0x01c1);
|
|
|
break;
|
|
|
- case SNDRV_CTL_POWER_D3hot: /* Off, with power */
|
|
|
+ case SND_SOC_BIAS_STANDBY:
|
|
|
/* mute dac and set vmid to 500k, enable VREF */
|
|
|
wm8750_write(codec, WM8750_PWR1, pwr_reg | 0x0141);
|
|
|
break;
|
|
|
- case SNDRV_CTL_POWER_D3cold: /* Off, without power */
|
|
|
+ case SND_SOC_BIAS_OFF:
|
|
|
wm8750_write(codec, WM8750_PWR1, 0x0001);
|
|
|
break;
|
|
|
}
|
|
|
- codec->dapm_state = event;
|
|
|
+ codec->bias_level = level;
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -748,7 +748,7 @@ static void wm8750_work(struct work_struct *work)
|
|
|
{
|
|
|
struct snd_soc_codec *codec =
|
|
|
container_of(work, struct snd_soc_codec, delayed_work.work);
|
|
|
- wm8750_dapm_event(codec, codec->dapm_state);
|
|
|
+ wm8750_set_bias_level(codec, codec->bias_level);
|
|
|
}
|
|
|
|
|
|
static int wm8750_suspend(struct platform_device *pdev, pm_message_t state)
|
|
@@ -756,7 +756,7 @@ static int wm8750_suspend(struct platform_device *pdev, pm_message_t state)
|
|
|
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
|
|
|
struct snd_soc_codec *codec = socdev->codec;
|
|
|
|
|
|
- wm8750_dapm_event(codec, SNDRV_CTL_POWER_D3cold);
|
|
|
+ wm8750_set_bias_level(codec, SND_SOC_BIAS_OFF);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -777,12 +777,12 @@ static int wm8750_resume(struct platform_device *pdev)
|
|
|
codec->hw_write(codec->control_data, data, 2);
|
|
|
}
|
|
|
|
|
|
- wm8750_dapm_event(codec, SNDRV_CTL_POWER_D3hot);
|
|
|
+ wm8750_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
|
|
|
|
|
|
/* charge wm8750 caps */
|
|
|
- if (codec->suspend_dapm_state == SNDRV_CTL_POWER_D0) {
|
|
|
- wm8750_dapm_event(codec, SNDRV_CTL_POWER_D2);
|
|
|
- codec->dapm_state = SNDRV_CTL_POWER_D0;
|
|
|
+ if (codec->suspend_bias_level == SND_SOC_BIAS_ON) {
|
|
|
+ wm8750_set_bias_level(codec, SND_SOC_BIAS_PREPARE);
|
|
|
+ codec->bias_level = SND_SOC_BIAS_ON;
|
|
|
schedule_delayed_work(&codec->delayed_work,
|
|
|
msecs_to_jiffies(1000));
|
|
|
}
|
|
@@ -803,7 +803,7 @@ static int wm8750_init(struct snd_soc_device *socdev)
|
|
|
codec->owner = THIS_MODULE;
|
|
|
codec->read = wm8750_read_reg_cache;
|
|
|
codec->write = wm8750_write;
|
|
|
- codec->dapm_event = wm8750_dapm_event;
|
|
|
+ codec->set_bias_level = wm8750_set_bias_level;
|
|
|
codec->dai = &wm8750_dai;
|
|
|
codec->num_dai = 1;
|
|
|
codec->reg_cache_size = sizeof(wm8750_reg);
|
|
@@ -821,8 +821,8 @@ static int wm8750_init(struct snd_soc_device *socdev)
|
|
|
}
|
|
|
|
|
|
/* charge output caps */
|
|
|
- wm8750_dapm_event(codec, SNDRV_CTL_POWER_D2);
|
|
|
- codec->dapm_state = SNDRV_CTL_POWER_D3hot;
|
|
|
+ wm8750_set_bias_level(codec, SND_SOC_BIAS_PREPARE);
|
|
|
+ codec->bias_level = SND_SOC_BIAS_STANDBY;
|
|
|
schedule_delayed_work(&codec->delayed_work, msecs_to_jiffies(1000));
|
|
|
|
|
|
/* set the update bits */
|
|
@@ -1021,7 +1021,7 @@ static int wm8750_remove(struct platform_device *pdev)
|
|
|
struct snd_soc_codec *codec = socdev->codec;
|
|
|
|
|
|
if (codec->control_data)
|
|
|
- wm8750_dapm_event(codec, SNDRV_CTL_POWER_D3cold);
|
|
|
+ wm8750_set_bias_level(codec, SND_SOC_BIAS_OFF);
|
|
|
run_delayed_work(&codec->delayed_work);
|
|
|
snd_soc_free_pcms(socdev);
|
|
|
snd_soc_dapm_free(socdev);
|