diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-01-13 05:24:08 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-01-28 16:30:12 -0500 |
commit | 1293617cddc40971917150e3f5bf66b7306e2e7e (patch) | |
tree | 857f6dd1c0c278f290963f7a3739f89d1652d98d | |
parent | a850ef8afd3cd1eecd2e136f8dca0c06599eade8 (diff) |
ALSA: ak411x: Add PM helper functions
Define snd_ak4114_suspend() and snd_ak4114_resume() functions to
handle PM properly, stopping and restarting the work at PM.
Currently only ice1712/juli.c deals with the PM and ak4114, so fix the
calls there appropriately.
The same PM functions are defined in ak4113.c, too, although they
aren't currently called yet (ice1712/quartet.c may be enhanced to
support PM later).
Acked-by: Jaroslav Kysela <perex@perex.cz>
Tested-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | include/sound/ak4113.h | 8 | ||||
-rw-r--r-- | include/sound/ak4114.h | 8 | ||||
-rw-r--r-- | sound/i2c/other/ak4113.c | 16 | ||||
-rw-r--r-- | sound/i2c/other/ak4114.c | 16 | ||||
-rw-r--r-- | sound/pci/ice1712/juli.c | 4 |
5 files changed, 51 insertions, 1 deletions
diff --git a/include/sound/ak4113.h b/include/sound/ak4113.h index 3a34f6edc2d1..f4fbf6888e78 100644 --- a/include/sound/ak4113.h +++ b/include/sound/ak4113.h | |||
@@ -317,5 +317,13 @@ int snd_ak4113_build(struct ak4113 *ak4113, | |||
317 | int snd_ak4113_external_rate(struct ak4113 *ak4113); | 317 | int snd_ak4113_external_rate(struct ak4113 *ak4113); |
318 | int snd_ak4113_check_rate_and_errors(struct ak4113 *ak4113, unsigned int flags); | 318 | int snd_ak4113_check_rate_and_errors(struct ak4113 *ak4113, unsigned int flags); |
319 | 319 | ||
320 | #ifdef CONFIG_PM | ||
321 | void snd_ak4113_suspend(struct ak4113 *chip); | ||
322 | void snd_ak4113_resume(struct ak4113 *chip); | ||
323 | #else | ||
324 | static inline void snd_ak4113_suspend(struct ak4113 *chip) {} | ||
325 | static inline void snd_ak4113_resume(struct ak4113 *chip) {} | ||
326 | #endif | ||
327 | |||
320 | #endif /* __SOUND_AK4113_H */ | 328 | #endif /* __SOUND_AK4113_H */ |
321 | 329 | ||
diff --git a/include/sound/ak4114.h b/include/sound/ak4114.h index 069299a88915..e681df2c95e1 100644 --- a/include/sound/ak4114.h +++ b/include/sound/ak4114.h | |||
@@ -199,5 +199,13 @@ int snd_ak4114_build(struct ak4114 *ak4114, | |||
199 | int snd_ak4114_external_rate(struct ak4114 *ak4114); | 199 | int snd_ak4114_external_rate(struct ak4114 *ak4114); |
200 | int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags); | 200 | int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags); |
201 | 201 | ||
202 | #ifdef CONFIG_PM | ||
203 | void snd_ak4114_suspend(struct ak4114 *chip); | ||
204 | void snd_ak4114_resume(struct ak4114 *chip); | ||
205 | #else | ||
206 | static inline void snd_ak4114_suspend(struct ak4114 *chip) {} | ||
207 | static inline void snd_ak4114_resume(struct ak4114 *chip) {} | ||
208 | #endif | ||
209 | |||
202 | #endif /* __SOUND_AK4114_H */ | 210 | #endif /* __SOUND_AK4114_H */ |
203 | 211 | ||
diff --git a/sound/i2c/other/ak4113.c b/sound/i2c/other/ak4113.c index c6bba99a90b2..c2b14d981fa1 100644 --- a/sound/i2c/other/ak4113.c +++ b/sound/i2c/other/ak4113.c | |||
@@ -636,3 +636,19 @@ static void ak4113_stats(struct work_struct *work) | |||
636 | if (atomic_dec_and_test(&chip->wq_processing)) | 636 | if (atomic_dec_and_test(&chip->wq_processing)) |
637 | schedule_delayed_work(&chip->work, HZ / 10); | 637 | schedule_delayed_work(&chip->work, HZ / 10); |
638 | } | 638 | } |
639 | |||
640 | #ifdef CONFIG_PM | ||
641 | void snd_ak4113_suspend(struct ak4113 *chip) | ||
642 | { | ||
643 | atomic_inc(&chip->wq_processing); /* don't schedule new work */ | ||
644 | cancel_delayed_work_sync(&chip->work); | ||
645 | } | ||
646 | EXPORT_SYMBOL(snd_ak4113_suspend); | ||
647 | |||
648 | void snd_ak4113_resume(struct ak4113 *chip) | ||
649 | { | ||
650 | atomic_dec(&chip->wq_processing); | ||
651 | snd_ak4113_reinit(chip); | ||
652 | } | ||
653 | EXPORT_SYMBOL(snd_ak4113_resume); | ||
654 | #endif | ||
diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c index f6ee1e7a9bbd..ee639f57b664 100644 --- a/sound/i2c/other/ak4114.c +++ b/sound/i2c/other/ak4114.c | |||
@@ -621,3 +621,19 @@ static void ak4114_stats(struct work_struct *work) | |||
621 | if (atomic_dec_and_test(&chip->wq_processing)) | 621 | if (atomic_dec_and_test(&chip->wq_processing)) |
622 | schedule_delayed_work(&chip->work, HZ / 10); | 622 | schedule_delayed_work(&chip->work, HZ / 10); |
623 | } | 623 | } |
624 | |||
625 | #ifdef CONFIG_PM | ||
626 | void snd_ak4114_suspend(struct ak4114 *chip) | ||
627 | { | ||
628 | atomic_inc(&chip->wq_processing); /* don't schedule new work */ | ||
629 | cancel_delayed_work_sync(&chip->work); | ||
630 | } | ||
631 | EXPORT_SYMBOL(snd_ak4114_suspend); | ||
632 | |||
633 | void snd_ak4114_resume(struct ak4114 *chip) | ||
634 | { | ||
635 | atomic_dec(&chip->wq_processing); | ||
636 | snd_ak4114_reinit(chip); | ||
637 | } | ||
638 | EXPORT_SYMBOL(snd_ak4114_resume); | ||
639 | #endif | ||
diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c index a1536c1a7ed4..4f0213427152 100644 --- a/sound/pci/ice1712/juli.c +++ b/sound/pci/ice1712/juli.c | |||
@@ -491,15 +491,17 @@ static int juli_resume(struct snd_ice1712 *ice) | |||
491 | /* akm4358 un-reset, un-mute */ | 491 | /* akm4358 un-reset, un-mute */ |
492 | snd_akm4xxx_reset(ak, 0); | 492 | snd_akm4xxx_reset(ak, 0); |
493 | /* reinit ak4114 */ | 493 | /* reinit ak4114 */ |
494 | snd_ak4114_reinit(spec->ak4114); | 494 | snd_ak4114_resume(spec->ak4114); |
495 | return 0; | 495 | return 0; |
496 | } | 496 | } |
497 | 497 | ||
498 | static int juli_suspend(struct snd_ice1712 *ice) | 498 | static int juli_suspend(struct snd_ice1712 *ice) |
499 | { | 499 | { |
500 | struct snd_akm4xxx *ak = ice->akm; | 500 | struct snd_akm4xxx *ak = ice->akm; |
501 | struct juli_spec *spec = ice->spec; | ||
501 | /* akm4358 reset and soft-mute */ | 502 | /* akm4358 reset and soft-mute */ |
502 | snd_akm4xxx_reset(ak, 1); | 503 | snd_akm4xxx_reset(ak, 1); |
504 | snd_ak4114_suspend(spec->ak4114); | ||
503 | return 0; | 505 | return 0; |
504 | } | 506 | } |
505 | #endif | 507 | #endif |