aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8753.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/wm8753.c')
-rw-r--r--sound/soc/codecs/wm8753.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index fb41826c4c4c..9032b0c07c86 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -1274,29 +1274,29 @@ static int wm8753_mute(struct snd_soc_codec_dai *dai, int mute)
1274 return 0; 1274 return 0;
1275} 1275}
1276 1276
1277static int wm8753_dapm_event(struct snd_soc_codec *codec, int event) 1277static int wm8753_set_bias_level(struct snd_soc_codec *codec,
1278 enum snd_soc_bias_level level)
1278{ 1279{
1279 u16 pwr_reg = wm8753_read_reg_cache(codec, WM8753_PWR1) & 0xfe3e; 1280 u16 pwr_reg = wm8753_read_reg_cache(codec, WM8753_PWR1) & 0xfe3e;
1280 1281
1281 switch (event) { 1282 switch (level) {
1282 case SNDRV_CTL_POWER_D0: /* full On */ 1283 case SND_SOC_BIAS_ON:
1283 /* set vmid to 50k and unmute dac */ 1284 /* set vmid to 50k and unmute dac */
1284 wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x00c0); 1285 wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x00c0);
1285 break; 1286 break;
1286 case SNDRV_CTL_POWER_D1: /* partial On */ 1287 case SND_SOC_BIAS_PREPARE:
1287 case SNDRV_CTL_POWER_D2: /* partial On */
1288 /* set vmid to 5k for quick power up */ 1288 /* set vmid to 5k for quick power up */
1289 wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x01c1); 1289 wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x01c1);
1290 break; 1290 break;
1291 case SNDRV_CTL_POWER_D3hot: /* Off, with power */ 1291 case SND_SOC_BIAS_STANDBY:
1292 /* mute dac and set vmid to 500k, enable VREF */ 1292 /* mute dac and set vmid to 500k, enable VREF */
1293 wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x0141); 1293 wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x0141);
1294 break; 1294 break;
1295 case SNDRV_CTL_POWER_D3cold: /* Off, without power */ 1295 case SND_SOC_BIAS_OFF:
1296 wm8753_write(codec, WM8753_PWR1, 0x0001); 1296 wm8753_write(codec, WM8753_PWR1, 0x0001);
1297 break; 1297 break;
1298 } 1298 }
1299 codec->dapm_state = event; 1299 codec->bias_level = level;
1300 return 0; 1300 return 0;
1301} 1301}
1302 1302
@@ -1500,7 +1500,7 @@ static void wm8753_work(struct work_struct *work)
1500{ 1500{
1501 struct snd_soc_codec *codec = 1501 struct snd_soc_codec *codec =
1502 container_of(work, struct snd_soc_codec, delayed_work.work); 1502 container_of(work, struct snd_soc_codec, delayed_work.work);
1503 wm8753_dapm_event(codec, codec->dapm_state); 1503 wm8753_set_bias_level(codec, codec->bias_level);
1504} 1504}
1505 1505
1506static int wm8753_suspend(struct platform_device *pdev, pm_message_t state) 1506static int wm8753_suspend(struct platform_device *pdev, pm_message_t state)
@@ -1512,7 +1512,7 @@ static int wm8753_suspend(struct platform_device *pdev, pm_message_t state)
1512 if (!codec->card) 1512 if (!codec->card)
1513 return 0; 1513 return 0;
1514 1514
1515 wm8753_dapm_event(codec, SNDRV_CTL_POWER_D3cold); 1515 wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF);
1516 return 0; 1516 return 0;
1517} 1517}
1518 1518
@@ -1537,12 +1537,12 @@ static int wm8753_resume(struct platform_device *pdev)
1537 codec->hw_write(codec->control_data, data, 2); 1537 codec->hw_write(codec->control_data, data, 2);
1538 } 1538 }
1539 1539
1540 wm8753_dapm_event(codec, SNDRV_CTL_POWER_D3hot); 1540 wm8753_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1541 1541
1542 /* charge wm8753 caps */ 1542 /* charge wm8753 caps */
1543 if (codec->suspend_dapm_state == SNDRV_CTL_POWER_D0) { 1543 if (codec->suspend_bias_level == SND_SOC_BIAS_ON) {
1544 wm8753_dapm_event(codec, SNDRV_CTL_POWER_D2); 1544 wm8753_set_bias_level(codec, SND_SOC_BIAS_PREPARE);
1545 codec->dapm_state = SNDRV_CTL_POWER_D0; 1545 codec->bias_level = SND_SOC_BIAS_ON;
1546 schedule_delayed_work(&codec->delayed_work, 1546 schedule_delayed_work(&codec->delayed_work,
1547 msecs_to_jiffies(caps_charge)); 1547 msecs_to_jiffies(caps_charge));
1548 } 1548 }
@@ -1563,7 +1563,7 @@ static int wm8753_init(struct snd_soc_device *socdev)
1563 codec->owner = THIS_MODULE; 1563 codec->owner = THIS_MODULE;
1564 codec->read = wm8753_read_reg_cache; 1564 codec->read = wm8753_read_reg_cache;
1565 codec->write = wm8753_write; 1565 codec->write = wm8753_write;
1566 codec->dapm_event = wm8753_dapm_event; 1566 codec->set_bias_level = wm8753_set_bias_level;
1567 codec->dai = wm8753_dai; 1567 codec->dai = wm8753_dai;
1568 codec->num_dai = 2; 1568 codec->num_dai = 2;
1569 codec->reg_cache_size = sizeof(wm8753_reg); 1569 codec->reg_cache_size = sizeof(wm8753_reg);
@@ -1584,8 +1584,8 @@ static int wm8753_init(struct snd_soc_device *socdev)
1584 } 1584 }
1585 1585
1586 /* charge output caps */ 1586 /* charge output caps */
1587 wm8753_dapm_event(codec, SNDRV_CTL_POWER_D2); 1587 wm8753_set_bias_level(codec, SND_SOC_BIAS_PREPARE);
1588 codec->dapm_state = SNDRV_CTL_POWER_D3hot; 1588 codec->bias_level = SND_SOC_BIAS_STANDBY;
1589 schedule_delayed_work(&codec->delayed_work, 1589 schedule_delayed_work(&codec->delayed_work,
1590 msecs_to_jiffies(caps_charge)); 1590 msecs_to_jiffies(caps_charge));
1591 1591
@@ -1792,7 +1792,7 @@ static int wm8753_remove(struct platform_device *pdev)
1792 struct snd_soc_codec *codec = socdev->codec; 1792 struct snd_soc_codec *codec = socdev->codec;
1793 1793
1794 if (codec->control_data) 1794 if (codec->control_data)
1795 wm8753_dapm_event(codec, SNDRV_CTL_POWER_D3cold); 1795 wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF);
1796 run_delayed_work(&codec->delayed_work); 1796 run_delayed_work(&codec->delayed_work);
1797 snd_soc_free_pcms(socdev); 1797 snd_soc_free_pcms(socdev);
1798 snd_soc_dapm_free(socdev); 1798 snd_soc_dapm_free(socdev);