diff options
| -rw-r--r-- | sound/pci/hda/patch_hdmi.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 98e1c411c56a..8a49415aebac 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
| 34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
| 35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
| 36 | #include <linux/pm_runtime.h> | ||
| 36 | #include <sound/core.h> | 37 | #include <sound/core.h> |
| 37 | #include <sound/jack.h> | 38 | #include <sound/jack.h> |
| 38 | #include <sound/asoundef.h> | 39 | #include <sound/asoundef.h> |
| @@ -764,8 +765,10 @@ static void check_presence_and_report(struct hda_codec *codec, hda_nid_t nid, | |||
| 764 | 765 | ||
| 765 | if (pin_idx < 0) | 766 | if (pin_idx < 0) |
| 766 | return; | 767 | return; |
| 768 | mutex_lock(&spec->pcm_lock); | ||
| 767 | if (hdmi_present_sense(get_pin(spec, pin_idx), 1)) | 769 | if (hdmi_present_sense(get_pin(spec, pin_idx), 1)) |
| 768 | snd_hda_jack_report_sync(codec); | 770 | snd_hda_jack_report_sync(codec); |
| 771 | mutex_unlock(&spec->pcm_lock); | ||
| 769 | } | 772 | } |
| 770 | 773 | ||
| 771 | static void jack_callback(struct hda_codec *codec, | 774 | static void jack_callback(struct hda_codec *codec, |
| @@ -1628,21 +1631,23 @@ static void sync_eld_via_acomp(struct hda_codec *codec, | |||
| 1628 | static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) | 1631 | static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) |
| 1629 | { | 1632 | { |
| 1630 | struct hda_codec *codec = per_pin->codec; | 1633 | struct hda_codec *codec = per_pin->codec; |
| 1631 | struct hdmi_spec *spec = codec->spec; | ||
| 1632 | int ret; | 1634 | int ret; |
| 1633 | 1635 | ||
| 1634 | /* no temporary power up/down needed for component notifier */ | 1636 | /* no temporary power up/down needed for component notifier */ |
| 1635 | if (!codec_has_acomp(codec)) | 1637 | if (!codec_has_acomp(codec)) { |
| 1636 | snd_hda_power_up_pm(codec); | 1638 | ret = snd_hda_power_up_pm(codec); |
| 1639 | if (ret < 0 && pm_runtime_suspended(hda_codec_dev(codec))) { | ||
| 1640 | snd_hda_power_down_pm(codec); | ||
| 1641 | return false; | ||
| 1642 | } | ||
| 1643 | } | ||
| 1637 | 1644 | ||
| 1638 | mutex_lock(&spec->pcm_lock); | ||
| 1639 | if (codec_has_acomp(codec)) { | 1645 | if (codec_has_acomp(codec)) { |
| 1640 | sync_eld_via_acomp(codec, per_pin); | 1646 | sync_eld_via_acomp(codec, per_pin); |
| 1641 | ret = false; /* don't call snd_hda_jack_report_sync() */ | 1647 | ret = false; /* don't call snd_hda_jack_report_sync() */ |
| 1642 | } else { | 1648 | } else { |
| 1643 | ret = hdmi_present_sense_via_verbs(per_pin, repoll); | 1649 | ret = hdmi_present_sense_via_verbs(per_pin, repoll); |
| 1644 | } | 1650 | } |
| 1645 | mutex_unlock(&spec->pcm_lock); | ||
| 1646 | 1651 | ||
| 1647 | if (!codec_has_acomp(codec)) | 1652 | if (!codec_has_acomp(codec)) |
| 1648 | snd_hda_power_down_pm(codec); | 1653 | snd_hda_power_down_pm(codec); |
| @@ -1654,12 +1659,16 @@ static void hdmi_repoll_eld(struct work_struct *work) | |||
| 1654 | { | 1659 | { |
| 1655 | struct hdmi_spec_per_pin *per_pin = | 1660 | struct hdmi_spec_per_pin *per_pin = |
| 1656 | container_of(to_delayed_work(work), struct hdmi_spec_per_pin, work); | 1661 | container_of(to_delayed_work(work), struct hdmi_spec_per_pin, work); |
| 1662 | struct hda_codec *codec = per_pin->codec; | ||
| 1663 | struct hdmi_spec *spec = codec->spec; | ||
| 1657 | 1664 | ||
| 1658 | if (per_pin->repoll_count++ > 6) | 1665 | if (per_pin->repoll_count++ > 6) |
| 1659 | per_pin->repoll_count = 0; | 1666 | per_pin->repoll_count = 0; |
| 1660 | 1667 | ||
| 1668 | mutex_lock(&spec->pcm_lock); | ||
| 1661 | if (hdmi_present_sense(per_pin, per_pin->repoll_count)) | 1669 | if (hdmi_present_sense(per_pin, per_pin->repoll_count)) |
| 1662 | snd_hda_jack_report_sync(per_pin->codec); | 1670 | snd_hda_jack_report_sync(per_pin->codec); |
| 1671 | mutex_unlock(&spec->pcm_lock); | ||
| 1663 | } | 1672 | } |
| 1664 | 1673 | ||
| 1665 | static void intel_haswell_fixup_connect_list(struct hda_codec *codec, | 1674 | static void intel_haswell_fixup_connect_list(struct hda_codec *codec, |
