[alsa-devel] [PATCH] ALSA: ASoC: cs4270: move power management hooks to snd_soc_codec_device

Mark Brown broonie at opensource.wolfsonmicro.com
Wed Aug 5 20:37:00 CEST 2009

On Wed, Aug 05, 2009 at 08:30:36PM +0200, Daniel Mack wrote:
> Power management for the cs4270 codec is currently implemented as part
> of the i2c_driver struct. The disadvantage of doing it this way is that
> the callbacks registered in the snd_soc_card struct are called _before_
> the codec's callbacks.

> That doesn't work, because the snd_soc_card callbacks will most likely
> switch down the codec's power domains or pull the reset GPIOs, and
> hence make the i2c communication bail out.

> Fix this by binding the suspend and resume code to the
> snd_soc_codec_device driver model.

You should leave the suspend and resume functions for I2C but have them
call the snd_soc_suspend_device() and snd_soc_resume_device() callbacks
in the core (which do nothing but will in future ensure that the entire
card goes down when one of the components goes down to make sure we are
always able to communicate with all the card components).   The actual
suspend and resume actions should be moved as you have done.

More information about the Alsa-devel mailing list