]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ALSA: hda/cirrus: Clean up with the new GPIO helper
authorTakashi Iwai <tiwai@suse.de>
Thu, 9 Apr 2026 09:38:21 +0000 (11:38 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 9 Apr 2026 10:05:54 +0000 (12:05 +0200)
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
sound/hda/codecs/cirrus/cs420x.c
sound/hda/codecs/cirrus/cs421x.c
sound/hda/codecs/cirrus/cs8409.c

index 52eda0a338eaa7b46ca275cd510f91319988f13c..42559edbba0553820df1e9864d60e2a45a872552 100644 (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);
index c8349a2c5a3695a4f44c3a83d718a9f0ad655a1d..645b06599e5fec5d750732909f19d66181ef68b7 100644 (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);
 
index 2d8f482e6474a08fb72de62fc5fa3132ea471170..c43ff3ef75b6e92b7122f9e2cf60223273d60d8f 100644 (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);