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: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20260409093826.1317626-9-tiwai@suse.de
This commit is contained in:
Takashi Iwai 2026-04-09 11:38:21 +02:00
parent d35f8e8c6f
commit daadb7fce1
3 changed files with 12 additions and 32 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);