Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 225068ab authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: hda - Set patch_ops before calling auto-parser



... so that the parser code can overwrite some optional ops.  For
Realtek and others, it can be set solely in the spec allocator, so it
results in a good code cleanup, too.

With this change, we can finally remove the local stream_pm setup and
rely on the generic parser's automatic setting.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 984a8547
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -205,8 +205,6 @@ static int ad198x_parse_auto_config(struct hda_codec *codec, bool indep_hp)
	if (err < 0)
		return err;

	codec->patch_ops = ad198x_auto_patch_ops;

	return 0;
}

@@ -223,6 +221,7 @@ static int alloc_ad_spec(struct hda_codec *codec)
		return -ENOMEM;
	codec->spec = spec;
	snd_hda_gen_spec_init(&spec->gen);
	codec->patch_ops = ad198x_auto_patch_ops;
	return 0;
}

+1 −2
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ static int patch_ca0110(struct hda_codec *codec)
		return -ENOMEM;
	snd_hda_gen_spec_init(spec);
	codec->spec = spec;
	codec->patch_ops = ca0110_patch_ops;

	spec->multi_cap_vol = 1;
	codec->bus->needs_damn_long_delay = 1;
@@ -71,8 +72,6 @@ static int patch_ca0110(struct hda_codec *codec)
	if (err < 0)
		goto error;

	codec->patch_ops = ca0110_patch_ops;

	return 0;

 error:
+4 −4
Original line number Diff line number Diff line
@@ -4709,6 +4709,10 @@ static int patch_ca0132(struct hda_codec *codec)
	codec->spec = spec;
	spec->codec = codec;

	codec->patch_ops = ca0132_patch_ops;
	codec->pcm_format_first = 1;
	codec->no_sticky_stream = 1;

	/* Detect codec quirk */
	quirk = snd_pci_quirk_lookup(codec->bus->pci, ca0132_quirks);
	if (quirk)
@@ -4737,10 +4741,6 @@ static int patch_ca0132(struct hda_codec *codec)
	if (err < 0)
		return err;

	codec->patch_ops = ca0132_patch_ops;
	codec->pcm_format_first = 1;
	codec->no_sticky_stream = 1;

	return 0;
}

+5 −7
Original line number Diff line number Diff line
@@ -584,6 +584,7 @@ static int patch_cs420x(struct hda_codec *codec)
	if (!spec)
		return -ENOMEM;

	codec->patch_ops = cs_patch_ops;
	spec->gen.automute_hook = cs_automute;
	codec->single_adc_amp = 1;

@@ -595,8 +596,6 @@ static int patch_cs420x(struct hda_codec *codec)
	if (err < 0)
		goto error;

	codec->patch_ops = cs_patch_ops;

	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);

	return 0;
@@ -738,6 +737,7 @@ static int patch_cs4208(struct hda_codec *codec)
	if (!spec)
		return -ENOMEM;

	codec->patch_ops = cs_patch_ops;
	spec->gen.automute_hook = cs_automute;
	/* exclude NID 0x10 (HP) from output volumes due to different steps */
	spec->gen.out_vol_mask = 1ULL << 0x10;
@@ -756,8 +756,6 @@ static int patch_cs4208(struct hda_codec *codec)
	if (err < 0)
		goto error;

	codec->patch_ops = cs_patch_ops;

	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);

	return 0;
@@ -1150,6 +1148,7 @@ static int patch_cs4210(struct hda_codec *codec)
	if (!spec)
		return -ENOMEM;

	codec->patch_ops = cs421x_patch_ops;
	spec->gen.automute_hook = cs_automute;

	snd_hda_pick_fixup(codec, cs421x_models, cs421x_fixup_tbl,
@@ -1167,8 +1166,6 @@ static int patch_cs4210(struct hda_codec *codec)
	if (err < 0)
		goto error;

	codec->patch_ops = cs421x_patch_ops;

	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);

	return 0;
@@ -1187,11 +1184,12 @@ static int patch_cs4213(struct hda_codec *codec)
	if (!spec)
		return -ENOMEM;

	codec->patch_ops = cs421x_patch_ops;

	err = cs421x_parse_auto_config(codec);
	if (err < 0)
		goto error;

	codec->patch_ops = cs421x_patch_ops;
	return 0;

 error:
+2 −2
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ static int patch_cmi9880(struct hda_codec *codec)
		return -ENOMEM;

	codec->spec = spec;
	codec->patch_ops = cmi_auto_patch_ops;
	cfg = &spec->gen.autocfg;
	snd_hda_gen_spec_init(&spec->gen);

@@ -67,7 +68,6 @@ static int patch_cmi9880(struct hda_codec *codec)
	if (err < 0)
		goto error;

	codec->patch_ops = cmi_auto_patch_ops;
	return 0;

 error:
@@ -86,6 +86,7 @@ static int patch_cmi8888(struct hda_codec *codec)
		return -ENOMEM;

	codec->spec = spec;
	codec->patch_ops = cmi_auto_patch_ops;
	cfg = &spec->gen.autocfg;
	snd_hda_gen_spec_init(&spec->gen);

@@ -112,7 +113,6 @@ static int patch_cmi8888(struct hda_codec *codec)
		}
	}

	codec->patch_ops = cmi_auto_patch_ops;
	return 0;

 error:
Loading