mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
ASoC: hdac_hdmi: Handle MST pin jack detection at boot/resume
The ELD notification can be received asynchronously from the graphics side and this may happen just at the moment the sound driver is initializing and notification will be missed. Similarly at system resume, the notification is ignored as the ELD and connection states are updated in anyway at the end of the resume. So check the jack status in boot/resume by querying the port presence based on pin caps and report the jack status. Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
fc181b04f2
commit
a9ce96bcd9
@ -1551,15 +1551,38 @@ int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int device)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(hdac_hdmi_jack_init);
|
EXPORT_SYMBOL_GPL(hdac_hdmi_jack_init);
|
||||||
|
|
||||||
|
static void hdac_hdmi_present_sense_all_pins(struct hdac_ext_device *edev,
|
||||||
|
struct hdac_hdmi_priv *hdmi, bool detect_pin_caps)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
struct hdac_hdmi_pin *pin;
|
||||||
|
|
||||||
|
list_for_each_entry(pin, &hdmi->pin_list, head) {
|
||||||
|
if (detect_pin_caps) {
|
||||||
|
|
||||||
|
if (hdac_hdmi_get_port_len(edev, pin->nid) == 0)
|
||||||
|
pin->mst_capable = false;
|
||||||
|
else
|
||||||
|
pin->mst_capable = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < pin->num_ports; i++) {
|
||||||
|
if (!pin->mst_capable && i > 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
hdac_hdmi_present_sense(pin, &pin->ports[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int hdmi_codec_probe(struct snd_soc_codec *codec)
|
static int hdmi_codec_probe(struct snd_soc_codec *codec)
|
||||||
{
|
{
|
||||||
struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec);
|
struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec);
|
||||||
struct hdac_hdmi_priv *hdmi = edev->private_data;
|
struct hdac_hdmi_priv *hdmi = edev->private_data;
|
||||||
struct snd_soc_dapm_context *dapm =
|
struct snd_soc_dapm_context *dapm =
|
||||||
snd_soc_component_get_dapm(&codec->component);
|
snd_soc_component_get_dapm(&codec->component);
|
||||||
struct hdac_hdmi_pin *pin;
|
|
||||||
struct hdac_ext_link *hlink = NULL;
|
struct hdac_ext_link *hlink = NULL;
|
||||||
int ret, i;
|
int ret;
|
||||||
|
|
||||||
edev->scodec = codec;
|
edev->scodec = codec;
|
||||||
|
|
||||||
@ -1587,10 +1610,7 @@ static int hdmi_codec_probe(struct snd_soc_codec *codec)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
list_for_each_entry(pin, &hdmi->pin_list, head)
|
hdac_hdmi_present_sense_all_pins(edev, hdmi, true);
|
||||||
for (i = 0; i < pin->num_ports; i++)
|
|
||||||
hdac_hdmi_present_sense(pin, &pin->ports[i]);
|
|
||||||
|
|
||||||
/* Imp: Store the card pointer in hda_codec */
|
/* Imp: Store the card pointer in hda_codec */
|
||||||
edev->card = dapm->card->snd_card;
|
edev->card = dapm->card->snd_card;
|
||||||
|
|
||||||
@ -1638,9 +1658,7 @@ static void hdmi_codec_complete(struct device *dev)
|
|||||||
{
|
{
|
||||||
struct hdac_ext_device *edev = to_hda_ext_device(dev);
|
struct hdac_ext_device *edev = to_hda_ext_device(dev);
|
||||||
struct hdac_hdmi_priv *hdmi = edev->private_data;
|
struct hdac_hdmi_priv *hdmi = edev->private_data;
|
||||||
struct hdac_hdmi_pin *pin;
|
|
||||||
struct hdac_device *hdac = &edev->hdac;
|
struct hdac_device *hdac = &edev->hdac;
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Power up afg */
|
/* Power up afg */
|
||||||
snd_hdac_codec_read(hdac, hdac->afg, 0, AC_VERB_SET_POWER_STATE,
|
snd_hdac_codec_read(hdac, hdac->afg, 0, AC_VERB_SET_POWER_STATE,
|
||||||
@ -1652,11 +1670,10 @@ static void hdmi_codec_complete(struct device *dev)
|
|||||||
/*
|
/*
|
||||||
* As the ELD notify callback request is not entertained while the
|
* As the ELD notify callback request is not entertained while the
|
||||||
* device is in suspend state. Need to manually check detection of
|
* device is in suspend state. Need to manually check detection of
|
||||||
* all pins here.
|
* all pins here. pin capablity change is not support, so use the
|
||||||
|
* already set pin caps.
|
||||||
*/
|
*/
|
||||||
list_for_each_entry(pin, &hdmi->pin_list, head)
|
hdac_hdmi_present_sense_all_pins(edev, hdmi, false);
|
||||||
for (i = 0; i < pin->num_ports; i++)
|
|
||||||
hdac_hdmi_present_sense(pin, &pin->ports[i]);
|
|
||||||
|
|
||||||
pm_runtime_put_sync(&edev->hdac.dev);
|
pm_runtime_put_sync(&edev->hdac.dev);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user