diff options
author | Takashi Iwai <tiwai@suse.de> | 2013-11-18 06:07:29 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-11-26 07:42:38 -0500 |
commit | f0639272d6c8e4706ea6d1b0dbc6eb83eaaff412 (patch) | |
tree | 1936f0d332ef3f0f0fc1f596e332ff795d2a7691 | |
parent | b21bdd0d343c8b2496690283211e27c9af598ed3 (diff) |
ALSA: hda - Bind with HDMI codec parser automatically
If a codec contains only the digital outputs, it's very likely a
HDMI/DP codec, which isn't supported by the generic parser but via
HDMI codec parser code. Detect such a case and bind with the proper
parser object if available.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/hda_codec.c | 27 | ||||
-rw-r--r-- | sound/pci/hda/hda_local.h | 1 | ||||
-rw-r--r-- | sound/pci/hda/patch_hdmi.c | 9 |
3 files changed, 37 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 4d3f46329eb5..bada677df8a7 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -1557,6 +1557,31 @@ int snd_hda_codec_update_widgets(struct hda_codec *codec) | |||
1557 | EXPORT_SYMBOL_HDA(snd_hda_codec_update_widgets); | 1557 | EXPORT_SYMBOL_HDA(snd_hda_codec_update_widgets); |
1558 | 1558 | ||
1559 | 1559 | ||
1560 | #ifdef CONFIG_SND_HDA_CODEC_HDMI | ||
1561 | /* if all audio out widgets are digital, let's assume the codec as a HDMI/DP */ | ||
1562 | static bool is_likely_hdmi_codec(struct hda_codec *codec) | ||
1563 | { | ||
1564 | hda_nid_t nid = codec->start_nid; | ||
1565 | int i; | ||
1566 | |||
1567 | for (i = 0; i < codec->num_nodes; i++, nid++) { | ||
1568 | unsigned int wcaps = get_wcaps(codec, nid); | ||
1569 | switch (get_wcaps_type(wcaps)) { | ||
1570 | case AC_WID_AUD_IN: | ||
1571 | return false; /* HDMI parser supports only HDMI out */ | ||
1572 | case AC_WID_AUD_OUT: | ||
1573 | if (!(wcaps & AC_WCAP_DIGITAL)) | ||
1574 | return false; | ||
1575 | break; | ||
1576 | } | ||
1577 | } | ||
1578 | return true; | ||
1579 | } | ||
1580 | #else | ||
1581 | /* no HDMI codec parser support */ | ||
1582 | #define is_likely_hdmi_codec(codec) false | ||
1583 | #endif /* CONFIG_SND_HDA_CODEC_HDMI */ | ||
1584 | |||
1560 | /** | 1585 | /** |
1561 | * snd_hda_codec_configure - (Re-)configure the HD-audio codec | 1586 | * snd_hda_codec_configure - (Re-)configure the HD-audio codec |
1562 | * @codec: the HDA codec | 1587 | * @codec: the HDA codec |
@@ -1582,6 +1607,8 @@ int snd_hda_codec_configure(struct hda_codec *codec) | |||
1582 | patch = codec->preset->patch; | 1607 | patch = codec->preset->patch; |
1583 | if (!patch) { | 1608 | if (!patch) { |
1584 | unload_parser(codec); /* to be sure */ | 1609 | unload_parser(codec); /* to be sure */ |
1610 | if (is_likely_hdmi_codec(codec)) | ||
1611 | patch = load_parser(codec, snd_hda_parse_hdmi_codec); | ||
1585 | #ifdef CONFIG_SND_HDA_GENERIC | 1612 | #ifdef CONFIG_SND_HDA_GENERIC |
1586 | if (!patch) | 1613 | if (!patch) |
1587 | patch = load_parser(codec, snd_hda_parse_generic_codec); | 1614 | patch = load_parser(codec, snd_hda_parse_generic_codec); |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 4d571a6d9230..da80c5bd7fd4 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -353,6 +353,7 @@ int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec, | |||
353 | * generic codec parser | 353 | * generic codec parser |
354 | */ | 354 | */ |
355 | int snd_hda_parse_generic_codec(struct hda_codec *codec); | 355 | int snd_hda_parse_generic_codec(struct hda_codec *codec); |
356 | int snd_hda_parse_hdmi_codec(struct hda_codec *codec); | ||
356 | 357 | ||
357 | /* | 358 | /* |
358 | * generic proc interface | 359 | * generic proc interface |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 08407bed093e..a6081ed34b88 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -3214,6 +3214,15 @@ static int patch_via_hdmi(struct hda_codec *codec) | |||
3214 | } | 3214 | } |
3215 | 3215 | ||
3216 | /* | 3216 | /* |
3217 | * called from hda_codec.c for generic HDMI support | ||
3218 | */ | ||
3219 | int snd_hda_parse_hdmi_codec(struct hda_codec *codec) | ||
3220 | { | ||
3221 | return patch_generic_hdmi(codec); | ||
3222 | } | ||
3223 | EXPORT_SYMBOL_HDA(snd_hda_parse_hdmi_codec); | ||
3224 | |||
3225 | /* | ||
3217 | * patch entries | 3226 | * patch entries |
3218 | */ | 3227 | */ |
3219 | static const struct hda_codec_preset snd_hda_preset_hdmi[] = { | 3228 | static const struct hda_codec_preset snd_hda_preset_hdmi[] = { |