mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-16 22:10:24 +00:00
ASoC: Implement suspend and resume operations for WM9705
Without this the WM9705 driver fails badly when resuming. Tested-by: Russell King <linux@arm.linux.org.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
4ac5c61f0f
commit
0a11b16853
@ -317,6 +317,41 @@ static int wm9705_reset(struct snd_soc_codec *codec)
|
|||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_PM
|
||||||
|
static int wm9705_soc_suspend(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
|
||||||
|
struct snd_soc_codec *codec = socdev->card->codec;
|
||||||
|
|
||||||
|
soc_ac97_ops.write(codec->ac97, AC97_POWERDOWN, 0xffff);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int wm9705_soc_resume(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
|
||||||
|
struct snd_soc_codec *codec = socdev->card->codec;
|
||||||
|
int i, ret;
|
||||||
|
u16 *cache = codec->reg_cache;
|
||||||
|
|
||||||
|
ret = wm9705_reset(codec);
|
||||||
|
if (ret < 0) {
|
||||||
|
printk(KERN_ERR "could not reset AC97 codec\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 2; i < ARRAY_SIZE(wm9705_reg) << 1; i += 2) {
|
||||||
|
soc_ac97_ops.write(codec->ac97, i, cache[i>>1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define wm9705_soc_suspend NULL
|
||||||
|
#define wm9705_soc_resume NULL
|
||||||
|
#endif
|
||||||
|
|
||||||
static int wm9705_soc_probe(struct platform_device *pdev)
|
static int wm9705_soc_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
|
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
|
||||||
@ -407,6 +442,8 @@ static int wm9705_soc_remove(struct platform_device *pdev)
|
|||||||
struct snd_soc_codec_device soc_codec_dev_wm9705 = {
|
struct snd_soc_codec_device soc_codec_dev_wm9705 = {
|
||||||
.probe = wm9705_soc_probe,
|
.probe = wm9705_soc_probe,
|
||||||
.remove = wm9705_soc_remove,
|
.remove = wm9705_soc_remove,
|
||||||
|
.suspend = wm9705_soc_suspend,
|
||||||
|
.resume = wm9705_soc_resume,
|
||||||
};
|
};
|
||||||
EXPORT_SYMBOL_GPL(soc_codec_dev_wm9705);
|
EXPORT_SYMBOL_GPL(soc_codec_dev_wm9705);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user