Skip to content

Commit e85015a

Browse files
committed
ALSA: hda - Use eld notifier for Intel SandyBridge and IvyBridge HDMI/DP
Intel SandyBridge and IvyBridge (CougarPoint and PantherPoint platforms) have also the same digital port vs audio widget mapping (from port B = NID 0x05 to port D = NID 0x07) as Haswell & co. So, we can reuse the existing functions for HSW+ for these platforms without changing there, but just by re-adding the on-demand i915 binding in HDMI codec driver. Signed-off-by: Takashi Iwai <[email protected]>
1 parent 4846a67 commit e85015a

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

sound/pci/hda/patch_hdmi.c

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ struct hdmi_spec {
157157
/* i915/powerwell (Haswell+/Valleyview+) specific */
158158
bool use_acomp_notifier; /* use i915 eld_notify callback for hotplug */
159159
struct i915_audio_component_audio_ops i915_audio_ops;
160+
bool i915_bound; /* was i915 bound in this driver? */
160161

161162
struct hdac_chmap chmap;
162163
};
@@ -2077,6 +2078,8 @@ static void generic_spec_free(struct hda_codec *codec)
20772078
struct hdmi_spec *spec = codec->spec;
20782079

20792080
if (spec) {
2081+
if (spec->i915_bound)
2082+
snd_hdac_i915_exit(&codec->bus->core);
20802083
hdmi_array_free(spec);
20812084
kfree(spec);
20822085
codec->spec = NULL;
@@ -2409,6 +2412,40 @@ static int patch_i915_byt_hdmi(struct hda_codec *codec)
24092412
return 0;
24102413
}
24112414

2415+
/* Intel SandyBridge and IvyBridge; with i915 eld notifier */
2416+
static int patch_i915_cpt_hdmi(struct hda_codec *codec)
2417+
{
2418+
struct hdmi_spec *spec;
2419+
int err;
2420+
2421+
/* no i915 component should have been bound before this */
2422+
if (WARN_ON(codec->bus->core.audio_component))
2423+
return -EBUSY;
2424+
2425+
err = alloc_generic_hdmi(codec);
2426+
if (err < 0)
2427+
return err;
2428+
spec = codec->spec;
2429+
2430+
/* Try to bind with i915 now */
2431+
err = snd_hdac_i915_init(&codec->bus->core);
2432+
if (err < 0)
2433+
goto error;
2434+
spec->i915_bound = true;
2435+
2436+
err = hdmi_parse_codec(codec);
2437+
if (err < 0)
2438+
goto error;
2439+
2440+
generic_hdmi_init_per_pins(codec);
2441+
register_i915_notifier(codec);
2442+
return 0;
2443+
2444+
error:
2445+
generic_spec_free(codec);
2446+
return err;
2447+
}
2448+
24122449
/*
24132450
* Shared non-generic implementations
24142451
*/
@@ -3582,8 +3619,8 @@ HDA_CODEC_ENTRY(0x80862801, "Bearlake HDMI", patch_generic_hdmi),
35823619
HDA_CODEC_ENTRY(0x80862802, "Cantiga HDMI", patch_generic_hdmi),
35833620
HDA_CODEC_ENTRY(0x80862803, "Eaglelake HDMI", patch_generic_hdmi),
35843621
HDA_CODEC_ENTRY(0x80862804, "IbexPeak HDMI", patch_generic_hdmi),
3585-
HDA_CODEC_ENTRY(0x80862805, "CougarPoint HDMI", patch_generic_hdmi),
3586-
HDA_CODEC_ENTRY(0x80862806, "PantherPoint HDMI", patch_generic_hdmi),
3622+
HDA_CODEC_ENTRY(0x80862805, "CougarPoint HDMI", patch_i915_cpt_hdmi),
3623+
HDA_CODEC_ENTRY(0x80862806, "PantherPoint HDMI", patch_i915_cpt_hdmi),
35873624
HDA_CODEC_ENTRY(0x80862807, "Haswell HDMI", patch_i915_hsw_hdmi),
35883625
HDA_CODEC_ENTRY(0x80862808, "Broadwell HDMI", patch_i915_hsw_hdmi),
35893626
HDA_CODEC_ENTRY(0x80862809, "Skylake HDMI", patch_i915_hsw_hdmi),

0 commit comments

Comments
 (0)