Loading sound/pci/hda/hda_codec.c +21 −2 Original line number Diff line number Diff line Loading @@ -1266,6 +1266,7 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, snd_array_init(&codec->spdif_out, sizeof(struct hda_spdif_out), 16); #ifdef CONFIG_SND_HDA_POWER_SAVE spin_lock_init(&codec->power_lock); INIT_DELAYED_WORK(&codec->power_work, hda_power_work); /* snd_hda_codec_new() marks the codec as power-up, and leave it as is. * the caller has to power down appropriatley after initialization Loading Loading @@ -4292,12 +4293,16 @@ static void hda_power_work(struct work_struct *work) container_of(work, struct hda_codec, power_work.work); struct hda_bus *bus = codec->bus; spin_lock(&codec->power_lock); if (!codec->power_on || codec->power_count) { codec->power_transition = 0; spin_unlock(&codec->power_lock); return; } trace_hda_power_down(codec); spin_unlock(&codec->power_lock); hda_call_codec_suspend(codec); if (bus->ops.pm_notify) bus->ops.pm_notify(bus); Loading @@ -4305,9 +4310,11 @@ static void hda_power_work(struct work_struct *work) static void hda_keep_power_on(struct hda_codec *codec) { spin_lock(&codec->power_lock); codec->power_count++; codec->power_on = 1; codec->power_jiffies = jiffies; spin_unlock(&codec->power_lock); } /* update the power on/off account with the current jiffies */ Loading @@ -4332,20 +4339,28 @@ void snd_hda_power_up(struct hda_codec *codec) { struct hda_bus *bus = codec->bus; spin_lock(&codec->power_lock); codec->power_count++; if (codec->power_on || codec->power_transition) if (codec->power_on || codec->power_transition) { spin_unlock(&codec->power_lock); return; } trace_hda_power_up(codec); snd_hda_update_power_acct(codec); codec->power_on = 1; codec->power_jiffies = jiffies; codec->power_transition = 1; /* avoid reentrance */ spin_unlock(&codec->power_lock); if (bus->ops.pm_notify) bus->ops.pm_notify(bus); hda_call_codec_resume(codec); spin_lock(&codec->power_lock); cancel_delayed_work(&codec->power_work); codec->power_transition = 0; spin_unlock(&codec->power_lock); } EXPORT_SYMBOL_HDA(snd_hda_power_up); Loading @@ -4361,14 +4376,18 @@ EXPORT_SYMBOL_HDA(snd_hda_power_up); */ void snd_hda_power_down(struct hda_codec *codec) { spin_lock(&codec->power_lock); --codec->power_count; if (!codec->power_on || codec->power_count || codec->power_transition) if (!codec->power_on || codec->power_count || codec->power_transition) { spin_unlock(&codec->power_lock); return; } if (power_save(codec)) { codec->power_transition = 1; /* avoid reentrance */ queue_delayed_work(codec->bus->workq, &codec->power_work, msecs_to_jiffies(power_save(codec) * 1000)); } spin_unlock(&codec->power_lock); } EXPORT_SYMBOL_HDA(snd_hda_power_down); Loading sound/pci/hda/hda_codec.h +1 −0 Original line number Diff line number Diff line Loading @@ -867,6 +867,7 @@ struct hda_codec { unsigned long power_on_acct; unsigned long power_off_acct; unsigned long power_jiffies; spinlock_t power_lock; #endif /* codec-specific additional proc output */ Loading Loading
sound/pci/hda/hda_codec.c +21 −2 Original line number Diff line number Diff line Loading @@ -1266,6 +1266,7 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, snd_array_init(&codec->spdif_out, sizeof(struct hda_spdif_out), 16); #ifdef CONFIG_SND_HDA_POWER_SAVE spin_lock_init(&codec->power_lock); INIT_DELAYED_WORK(&codec->power_work, hda_power_work); /* snd_hda_codec_new() marks the codec as power-up, and leave it as is. * the caller has to power down appropriatley after initialization Loading Loading @@ -4292,12 +4293,16 @@ static void hda_power_work(struct work_struct *work) container_of(work, struct hda_codec, power_work.work); struct hda_bus *bus = codec->bus; spin_lock(&codec->power_lock); if (!codec->power_on || codec->power_count) { codec->power_transition = 0; spin_unlock(&codec->power_lock); return; } trace_hda_power_down(codec); spin_unlock(&codec->power_lock); hda_call_codec_suspend(codec); if (bus->ops.pm_notify) bus->ops.pm_notify(bus); Loading @@ -4305,9 +4310,11 @@ static void hda_power_work(struct work_struct *work) static void hda_keep_power_on(struct hda_codec *codec) { spin_lock(&codec->power_lock); codec->power_count++; codec->power_on = 1; codec->power_jiffies = jiffies; spin_unlock(&codec->power_lock); } /* update the power on/off account with the current jiffies */ Loading @@ -4332,20 +4339,28 @@ void snd_hda_power_up(struct hda_codec *codec) { struct hda_bus *bus = codec->bus; spin_lock(&codec->power_lock); codec->power_count++; if (codec->power_on || codec->power_transition) if (codec->power_on || codec->power_transition) { spin_unlock(&codec->power_lock); return; } trace_hda_power_up(codec); snd_hda_update_power_acct(codec); codec->power_on = 1; codec->power_jiffies = jiffies; codec->power_transition = 1; /* avoid reentrance */ spin_unlock(&codec->power_lock); if (bus->ops.pm_notify) bus->ops.pm_notify(bus); hda_call_codec_resume(codec); spin_lock(&codec->power_lock); cancel_delayed_work(&codec->power_work); codec->power_transition = 0; spin_unlock(&codec->power_lock); } EXPORT_SYMBOL_HDA(snd_hda_power_up); Loading @@ -4361,14 +4376,18 @@ EXPORT_SYMBOL_HDA(snd_hda_power_up); */ void snd_hda_power_down(struct hda_codec *codec) { spin_lock(&codec->power_lock); --codec->power_count; if (!codec->power_on || codec->power_count || codec->power_transition) if (!codec->power_on || codec->power_count || codec->power_transition) { spin_unlock(&codec->power_lock); return; } if (power_save(codec)) { codec->power_transition = 1; /* avoid reentrance */ queue_delayed_work(codec->bus->workq, &codec->power_work, msecs_to_jiffies(power_save(codec) * 1000)); } spin_unlock(&codec->power_lock); } EXPORT_SYMBOL_HDA(snd_hda_power_down); Loading
sound/pci/hda/hda_codec.h +1 −0 Original line number Diff line number Diff line Loading @@ -867,6 +867,7 @@ struct hda_codec { unsigned long power_on_acct; unsigned long power_off_acct; unsigned long power_jiffies; spinlock_t power_lock; #endif /* codec-specific additional proc output */ Loading