Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 182842
b: refs/heads/master
c: 84549d2
h: refs/heads/master
v: v3
  • Loading branch information
Barry Song authored and Mark Brown committed Jan 25, 2010
1 parent e3462e8 commit e598611
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 895d4509d069f0706427ca75fcf0929ed136d0d7
refs/heads/master: 84549d239ab9bb2e3a85c6efcf0e6478a38b4260
32 changes: 32 additions & 0 deletions trunk/sound/soc/codecs/ad1836.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,36 @@ static unsigned int ad1836_read_reg_cache(struct snd_soc_codec *codec,
return reg_cache[reg];
}

#ifdef CONFIG_PM
static int ad1836_soc_suspend(struct platform_device *pdev,
pm_message_t state)
{
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
struct snd_soc_codec *codec = socdev->card->codec;

/* reset clock control mode */
u16 adc_ctrl2 = codec->read(codec, AD1836_ADC_CTRL2);
adc_ctrl2 &= ~AD1836_ADC_SERFMT_MASK;

return codec->write(codec, AD1836_ADC_CTRL2, adc_ctrl2);
}

static int ad1836_soc_resume(struct platform_device *pdev)
{
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
struct snd_soc_codec *codec = socdev->card->codec;

/* restore clock control mode */
u16 adc_ctrl2 = codec->read(codec, AD1836_ADC_CTRL2);
adc_ctrl2 |= AD1836_ADC_AUX;

return codec->write(codec, AD1836_ADC_CTRL2, adc_ctrl2);
}
#else
#define ad1836_soc_suspend NULL
#define ad1836_soc_resume NULL
#endif

static int __devinit ad1836_spi_probe(struct spi_device *spi)
{
struct snd_soc_codec *codec;
Expand Down Expand Up @@ -404,6 +434,8 @@ static int ad1836_remove(struct platform_device *pdev)
struct snd_soc_codec_device soc_codec_dev_ad1836 = {
.probe = ad1836_probe,
.remove = ad1836_remove,
.suspend = ad1836_soc_suspend,
.resume = ad1836_soc_resume,
};
EXPORT_SYMBOL_GPL(soc_codec_dev_ad1836);

Expand Down
1 change: 1 addition & 0 deletions trunk/sound/soc/codecs/ad1836.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#define AD1836_ADC_SERFMT_MASK (7 << 6)
#define AD1836_ADC_SERFMT_PCK256 (0x4 << 6)
#define AD1836_ADC_SERFMT_PCK128 (0x5 << 6)
#define AD1836_ADC_AUX (0x6 << 6)

#define AD1836_ADC_CTRL3 14

Expand Down

0 comments on commit e598611

Please sign in to comment.