ALSA: hda - Minor code refactoring for Intel HDMI codec parsers
No functional change, just a slight reduction of lines. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
fcc88d91cd
commit
43f6c8d97b
|
@ -2503,19 +2503,41 @@ static void i915_pin_cvt_fixup(struct hda_codec *codec,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* precondition and allocation for Intel codecs */
|
||||||
|
static int alloc_intel_hdmi(struct hda_codec *codec)
|
||||||
|
{
|
||||||
|
/* requires i915 binding */
|
||||||
|
if (!codec->bus->core.audio_component) {
|
||||||
|
codec_info(codec, "No i915 binding for Intel HDMI/DP codec\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
return alloc_generic_hdmi(codec);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* parse and post-process for Intel codecs */
|
||||||
|
static int parse_intel_hdmi(struct hda_codec *codec)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = hdmi_parse_codec(codec);
|
||||||
|
if (err < 0) {
|
||||||
|
generic_spec_free(codec);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
generic_hdmi_init_per_pins(codec);
|
||||||
|
register_i915_notifier(codec);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Intel Haswell and onwards; audio component with eld notifier */
|
/* Intel Haswell and onwards; audio component with eld notifier */
|
||||||
static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid)
|
static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid)
|
||||||
{
|
{
|
||||||
struct hdmi_spec *spec;
|
struct hdmi_spec *spec;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/* HSW+ requires i915 binding */
|
err = alloc_intel_hdmi(codec);
|
||||||
if (!codec->bus->core.audio_component) {
|
|
||||||
codec_info(codec, "No i915 binding for Intel HDMI/DP codec\n");
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = alloc_generic_hdmi(codec);
|
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
spec = codec->spec;
|
spec = codec->spec;
|
||||||
|
@ -2539,15 +2561,7 @@ static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid)
|
||||||
spec->ops.setup_stream = i915_hsw_setup_stream;
|
spec->ops.setup_stream = i915_hsw_setup_stream;
|
||||||
spec->ops.pin_cvt_fixup = i915_pin_cvt_fixup;
|
spec->ops.pin_cvt_fixup = i915_pin_cvt_fixup;
|
||||||
|
|
||||||
err = hdmi_parse_codec(codec);
|
return parse_intel_hdmi(codec);
|
||||||
if (err < 0) {
|
|
||||||
generic_spec_free(codec);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
generic_hdmi_init_per_pins(codec);
|
|
||||||
register_i915_notifier(codec);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int patch_i915_hsw_hdmi(struct hda_codec *codec)
|
static int patch_i915_hsw_hdmi(struct hda_codec *codec)
|
||||||
|
@ -2566,13 +2580,7 @@ static int patch_i915_byt_hdmi(struct hda_codec *codec)
|
||||||
struct hdmi_spec *spec;
|
struct hdmi_spec *spec;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/* requires i915 binding */
|
err = alloc_intel_hdmi(codec);
|
||||||
if (!codec->bus->core.audio_component) {
|
|
||||||
codec_info(codec, "No i915 binding for Intel HDMI/DP codec\n");
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = alloc_generic_hdmi(codec);
|
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
spec = codec->spec;
|
spec = codec->spec;
|
||||||
|
@ -2587,45 +2595,18 @@ static int patch_i915_byt_hdmi(struct hda_codec *codec)
|
||||||
|
|
||||||
spec->ops.pin_cvt_fixup = i915_pin_cvt_fixup;
|
spec->ops.pin_cvt_fixup = i915_pin_cvt_fixup;
|
||||||
|
|
||||||
err = hdmi_parse_codec(codec);
|
return parse_intel_hdmi(codec);
|
||||||
if (err < 0) {
|
|
||||||
generic_spec_free(codec);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
generic_hdmi_init_per_pins(codec);
|
|
||||||
register_i915_notifier(codec);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Intel IronLake, SandyBridge and IvyBridge; with eld notifier */
|
/* Intel IronLake, SandyBridge and IvyBridge; with eld notifier */
|
||||||
static int patch_i915_cpt_hdmi(struct hda_codec *codec)
|
static int patch_i915_cpt_hdmi(struct hda_codec *codec)
|
||||||
{
|
{
|
||||||
struct hdmi_spec *spec;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/* requires i915 binding */
|
err = alloc_intel_hdmi(codec);
|
||||||
if (!codec->bus->core.audio_component) {
|
|
||||||
codec_info(codec, "No i915 binding for Intel HDMI/DP codec\n");
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = alloc_generic_hdmi(codec);
|
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
spec = codec->spec;
|
return parse_intel_hdmi(codec);
|
||||||
|
|
||||||
err = hdmi_parse_codec(codec);
|
|
||||||
if (err < 0)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
generic_hdmi_init_per_pins(codec);
|
|
||||||
register_i915_notifier(codec);
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
error:
|
|
||||||
generic_spec_free(codec);
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue