summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2026-04-09 12:38:21 +0300
committerTakashi Iwai <tiwai@suse.de>2026-04-09 13:05:54 +0300
commitdaadb7fce1b53336acb195f34bd42d79754afa0e (patch)
tree032fc380caaaf9366600dff12d8a25c8aa1618d4
parentd35f8e8c6fc5c92c96be38e9ca94d99233ce1ddd (diff)
downloadlinux-daadb7fce1b53336acb195f34bd42d79754afa0e.tar.xz
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
-rw-r--r--sound/hda/codecs/cirrus/cs420x.c11
-rw-r--r--sound/hda/codecs/cirrus/cs421x.c11
-rw-r--r--sound/hda/codecs/cirrus/cs8409.c22
3 files changed, 12 insertions, 32 deletions
diff --git a/sound/hda/codecs/cirrus/cs420x.c b/sound/hda/codecs/cirrus/cs420x.c
index 52eda0a338ea..42559edbba05 100644
--- a/sound/hda/codecs/cirrus/cs420x.c
+++ b/sound/hda/codecs/cirrus/cs420x.c
@@ -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);
diff --git a/sound/hda/codecs/cirrus/cs421x.c b/sound/hda/codecs/cirrus/cs421x.c
index c8349a2c5a36..645b06599e5f 100644
--- a/sound/hda/codecs/cirrus/cs421x.c
+++ b/sound/hda/codecs/cirrus/cs421x.c
@@ -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);
diff --git a/sound/hda/codecs/cirrus/cs8409.c b/sound/hda/codecs/cirrus/cs8409.c
index 2d8f482e6474..c43ff3ef75b6 100644
--- a/sound/hda/codecs/cirrus/cs8409.c
+++ b/sound/hda/codecs/cirrus/cs8409.c
@@ -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);