aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-12-17 18:22:27 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-12-17 18:22:27 -0500
commit376bddd34433065aeb9b9a140870537feecf90ef (patch)
treea40e2b84ad89f4b3ba968de65a4bf7ff6ccae835 /sound/pci/hda/hda_codec.c
parentd526e85f60fce9aa2a1432cbd06e3cf20c1644c8 (diff)
parent667b504a2c411e4d5915a6e2260a3857ba9f797a (diff)
Merge remote-tracking branch 'agust/next' into next
Brings some 52xx updates. Also manually merged tools/perf/perf.h. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 70d4848b5cd0..d010de12335e 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -95,6 +95,7 @@ int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset)
95EXPORT_SYMBOL_HDA(snd_hda_delete_codec_preset); 95EXPORT_SYMBOL_HDA(snd_hda_delete_codec_preset);
96 96
97#ifdef CONFIG_PM 97#ifdef CONFIG_PM
98#define codec_in_pm(codec) ((codec)->in_pm)
98static void hda_power_work(struct work_struct *work); 99static void hda_power_work(struct work_struct *work);
99static void hda_keep_power_on(struct hda_codec *codec); 100static void hda_keep_power_on(struct hda_codec *codec);
100#define hda_codec_is_power_on(codec) ((codec)->power_on) 101#define hda_codec_is_power_on(codec) ((codec)->power_on)
@@ -104,6 +105,7 @@ static inline void hda_call_pm_notify(struct hda_bus *bus, bool power_up)
104 bus->ops.pm_notify(bus, power_up); 105 bus->ops.pm_notify(bus, power_up);
105} 106}
106#else 107#else
108#define codec_in_pm(codec) 0
107static inline void hda_keep_power_on(struct hda_codec *codec) {} 109static inline void hda_keep_power_on(struct hda_codec *codec) {}
108#define hda_codec_is_power_on(codec) 1 110#define hda_codec_is_power_on(codec) 1
109#define hda_call_pm_notify(bus, state) {} 111#define hda_call_pm_notify(bus, state) {}
@@ -228,7 +230,7 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd,
228 } 230 }
229 mutex_unlock(&bus->cmd_mutex); 231 mutex_unlock(&bus->cmd_mutex);
230 snd_hda_power_down(codec); 232 snd_hda_power_down(codec);
231 if (res && *res == -1 && bus->rirb_error) { 233 if (!codec_in_pm(codec) && res && *res == -1 && bus->rirb_error) {
232 if (bus->response_reset) { 234 if (bus->response_reset) {
233 snd_printd("hda_codec: resetting BUS due to " 235 snd_printd("hda_codec: resetting BUS due to "
234 "fatal communication error\n"); 236 "fatal communication error\n");
@@ -238,7 +240,7 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd,
238 goto again; 240 goto again;
239 } 241 }
240 /* clear reset-flag when the communication gets recovered */ 242 /* clear reset-flag when the communication gets recovered */
241 if (!err) 243 if (!err || codec_in_pm(codec))
242 bus->response_reset = 0; 244 bus->response_reset = 0;
243 return err; 245 return err;
244} 246}
@@ -3616,6 +3618,8 @@ static unsigned int hda_call_codec_suspend(struct hda_codec *codec, bool in_wq)
3616{ 3618{
3617 unsigned int state; 3619 unsigned int state;
3618 3620
3621 codec->in_pm = 1;
3622
3619 if (codec->patch_ops.suspend) 3623 if (codec->patch_ops.suspend)
3620 codec->patch_ops.suspend(codec); 3624 codec->patch_ops.suspend(codec);
3621 hda_cleanup_all_streams(codec); 3625 hda_cleanup_all_streams(codec);
@@ -3630,6 +3634,7 @@ static unsigned int hda_call_codec_suspend(struct hda_codec *codec, bool in_wq)
3630 codec->power_transition = 0; 3634 codec->power_transition = 0;
3631 codec->power_jiffies = jiffies; 3635 codec->power_jiffies = jiffies;
3632 spin_unlock(&codec->power_lock); 3636 spin_unlock(&codec->power_lock);
3637 codec->in_pm = 0;
3633 return state; 3638 return state;
3634} 3639}
3635 3640
@@ -3638,6 +3643,8 @@ static unsigned int hda_call_codec_suspend(struct hda_codec *codec, bool in_wq)
3638 */ 3643 */
3639static void hda_call_codec_resume(struct hda_codec *codec) 3644static void hda_call_codec_resume(struct hda_codec *codec)
3640{ 3645{
3646 codec->in_pm = 1;
3647
3641 /* set as if powered on for avoiding re-entering the resume 3648 /* set as if powered on for avoiding re-entering the resume
3642 * in the resume / power-save sequence 3649 * in the resume / power-save sequence
3643 */ 3650 */
@@ -3656,6 +3663,8 @@ static void hda_call_codec_resume(struct hda_codec *codec)
3656 snd_hda_codec_resume_cache(codec); 3663 snd_hda_codec_resume_cache(codec);
3657 } 3664 }
3658 snd_hda_jack_report_sync(codec); 3665 snd_hda_jack_report_sync(codec);
3666
3667 codec->in_pm = 0;
3659 snd_hda_power_down(codec); /* flag down before returning */ 3668 snd_hda_power_down(codec); /* flag down before returning */
3660} 3669}
3661#endif /* CONFIG_PM */ 3670#endif /* CONFIG_PM */