Commit daadb7fc authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: hda/cirrus: Clean up with the new GPIO helper



Use the new GPIO helper function to clean up the open code.

Merely a code refactoring, and no behavior change.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20260409093826.1317626-9-tiwai@suse.de
parent d35f8e8c
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -264,14 +264,9 @@ static int cs_init(struct hda_codec *codec)

	snd_hda_gen_init(codec);

	if (spec->gpio_mask) {
		snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK,
				    spec->gpio_mask);
		snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION,
				    spec->gpio_dir);
		snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
				    spec->gpio_data);
	}
	if (spec->gpio_mask)
		snd_hda_codec_set_gpio(codec, spec->gpio_mask, spec->gpio_dir,
				       spec->gpio_data, 0);

	if (spec->vendor_nid == CS420X_VENDOR_NID) {
		init_input_coef(codec);
+3 −8
Original line number Diff line number Diff line
@@ -442,14 +442,9 @@ static int cs421x_init(struct hda_codec *codec)

	snd_hda_gen_init(codec);

	if (spec->gpio_mask) {
		snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK,
				    spec->gpio_mask);
		snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION,
				    spec->gpio_dir);
		snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
				    spec->gpio_data);
	}
	if (spec->gpio_mask)
		snd_hda_codec_set_gpio(codec, spec->gpio_mask, spec->gpio_dir,
				       spec->gpio_data, 0);

	cs4210_spdif_automute(codec, NULL);

+6 −16
Original line number Diff line number Diff line
@@ -1042,14 +1042,9 @@ static void cs8409_cs42l42_hw_init(struct hda_codec *codec)
	struct cs8409_spec *spec = codec->spec;
	struct sub_codec *cs42l42 = spec->scodecs[CS8409_CODEC0];

	if (spec->gpio_mask) {
		snd_hda_codec_write(codec, CS8409_PIN_AFG, 0, AC_VERB_SET_GPIO_MASK,
			spec->gpio_mask);
		snd_hda_codec_write(codec, CS8409_PIN_AFG, 0, AC_VERB_SET_GPIO_DIRECTION,
			spec->gpio_dir);
		snd_hda_codec_write(codec, CS8409_PIN_AFG, 0, AC_VERB_SET_GPIO_DATA,
			spec->gpio_data);
	}
	if (spec->gpio_mask)
		snd_hda_codec_set_gpio(codec, spec->gpio_mask, spec->gpio_dir,
				       spec->gpio_data, 0);

	for (; seq->nid; seq++)
		cs8409_vendor_coef_set(codec, seq->cir, seq->coeff);
@@ -1442,14 +1437,9 @@ static void dolphin_hw_init(struct hda_codec *codec)
	struct sub_codec *cs42l42;
	int i;

	if (spec->gpio_mask) {
		snd_hda_codec_write(codec, CS8409_PIN_AFG, 0, AC_VERB_SET_GPIO_MASK,
				    spec->gpio_mask);
		snd_hda_codec_write(codec, CS8409_PIN_AFG, 0, AC_VERB_SET_GPIO_DIRECTION,
				    spec->gpio_dir);
		snd_hda_codec_write(codec, CS8409_PIN_AFG, 0, AC_VERB_SET_GPIO_DATA,
				    spec->gpio_data);
	}
	if (spec->gpio_mask)
		snd_hda_codec_set_gpio(codec, spec->gpio_mask, spec->gpio_dir,
				       spec->gpio_data, 0);

	for (; seq->nid; seq++)
		cs8409_vendor_coef_set(codec, seq->cir, seq->coeff);