diff options
author | Takashi Iwai <tiwai@suse.de> | 2018-06-20 17:27:50 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2018-06-25 10:04:27 +0200 |
commit | f8bfc628f73c95c242dd49efa16d59005d8558fc (patch) | |
tree | 59cfbe23f0eec07e7b4532d0a77aae4a40d54318 /sound/pci/hda/patch_via.c | |
parent | ALSA: hda/via - Simplify control management (diff) | |
download | linux-f8bfc628f73c95c242dd49efa16d59005d8558fc.tar.xz linux-f8bfc628f73c95c242dd49efa16d59005d8558fc.zip |
ALSA: hda/via - Use standard verb containers
In this patch, the remaining static init verbs in VIA codec driver are
converted to the standard snd_hda_add_verbs() calls. The conversion
is straightforward, but one change to be noted is the place of calls:
since these verbs are supposed to be executed at the beginning of the
init / resume procedure, we need to add snd_hda_add_verbs() calls
before calling the other parsers.
This is merely a cleanup, no functional changes.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_via.c')
-rw-r--r-- | sound/pci/hda/patch_via.c | 64 |
1 files changed, 35 insertions, 29 deletions
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index dc4961f0dfd1..6b9617aee0e6 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -90,10 +90,6 @@ enum VIA_HDA_CODEC { struct via_spec { struct hda_gen_spec gen; - /* codec parameterization */ - const struct hda_verb *init_verbs[5]; - unsigned int num_iverbs; - /* HP mode source */ unsigned int dmic_enabled; enum VIA_HDA_CODEC codec_type; @@ -555,12 +551,6 @@ static int via_parse_auto_config(struct hda_codec *codec) static int via_init(struct hda_codec *codec) { - struct via_spec *spec = codec->spec; - int i; - - for (i = 0; i < spec->num_iverbs; i++) - snd_hda_sequence_write(codec, spec->init_verbs[i]); - /* init power states */ __analog_low_current_mode(codec, true); @@ -639,6 +629,10 @@ static int patch_vt1708(struct hda_codec *codec) vt1708_set_pinconfig_connect(codec, VT1708_HP_PIN_NID); vt1708_set_pinconfig_connect(codec, VT1708_CD_PIN_NID); + err = snd_hda_add_verbs(codec, vt1708_init_verbs); + if (err < 0) + goto error; + /* automatic parse from the BIOS config */ err = via_parse_auto_config(codec); if (err < 0) @@ -650,8 +644,6 @@ static int patch_vt1708(struct hda_codec *codec) goto error; } - spec->init_verbs[spec->num_iverbs++] = vt1708_init_verbs; - /* clear jackpoll_interval again; it's set dynamically */ codec->jackpoll_interval = 0; @@ -755,13 +747,15 @@ static int patch_vt1708S(struct hda_codec *codec) if (codec->core.vendor_id == 0x11064397) snd_hda_codec_set_name(codec, "VT1705"); + err = snd_hda_add_verbs(codec, vt1708S_init_verbs); + if (err < 0) + goto error; + /* automatic parse from the BIOS config */ err = via_parse_auto_config(codec); if (err < 0) goto error; - spec->init_verbs[spec->num_iverbs++] = vt1708S_init_verbs; - return 0; error: @@ -798,13 +792,15 @@ static int patch_vt1702(struct hda_codec *codec) (0x5 << AC_AMPCAP_STEP_SIZE_SHIFT) | (1 << AC_AMPCAP_MUTE_SHIFT)); + err = snd_hda_add_verbs(codec, vt1702_init_verbs); + if (err < 0) + goto error; + /* automatic parse from the BIOS config */ err = via_parse_auto_config(codec); if (err < 0) goto error; - spec->init_verbs[spec->num_iverbs++] = vt1702_init_verbs; - return 0; error: @@ -872,13 +868,15 @@ static int patch_vt1718S(struct hda_codec *codec) override_mic_boost(codec, 0x29, 0, 3, 40); add_secret_dac_path(codec); + err = snd_hda_add_verbs(codec, vt1718S_init_verbs); + if (err < 0) + goto error; + /* automatic parse from the BIOS config */ err = via_parse_auto_config(codec); if (err < 0) goto error; - spec->init_verbs[spec->num_iverbs++] = vt1718S_init_verbs; - return 0; error: @@ -966,13 +964,15 @@ static int patch_vt1716S(struct hda_codec *codec) override_mic_boost(codec, 0x1a, 0, 3, 40); override_mic_boost(codec, 0x1e, 0, 3, 40); + err = snd_hda_add_verbs(codec, vt1716S_init_verbs); + if (err < 0) + goto error; + /* automatic parse from the BIOS config */ err = via_parse_auto_config(codec); if (err < 0) goto error; - spec->init_verbs[spec->num_iverbs++] = vt1716S_init_verbs; - if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &vt1716s_dmic_mixer_vol) || !snd_hda_gen_add_kctl(&spec->gen, NULL, &vt1716s_dmic_mixer_sw) || !snd_hda_gen_add_kctl(&spec->gen, NULL, &vt1716S_mono_out_mixer)) { @@ -1079,16 +1079,18 @@ static int patch_vt2002P(struct hda_codec *codec) snd_hda_pick_fixup(codec, NULL, vt2002p_fixups, via_fixups); snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); + if (spec->codec_type == VT1802) + err = snd_hda_add_verbs(codec, vt1802_init_verbs); + else + err = snd_hda_add_verbs(codec, vt2002P_init_verbs); + if (err < 0) + goto error; + /* automatic parse from the BIOS config */ err = via_parse_auto_config(codec); if (err < 0) goto error; - if (spec->codec_type == VT1802) - spec->init_verbs[spec->num_iverbs++] = vt1802_init_verbs; - else - spec->init_verbs[spec->num_iverbs++] = vt2002P_init_verbs; - return 0; error: @@ -1122,13 +1124,15 @@ static int patch_vt1812(struct hda_codec *codec) override_mic_boost(codec, 0x29, 0, 3, 40); add_secret_dac_path(codec); + err = snd_hda_add_verbs(codec, vt1812_init_verbs); + if (err < 0) + goto error; + /* automatic parse from the BIOS config */ err = via_parse_auto_config(codec); if (err < 0) goto error; - spec->init_verbs[spec->num_iverbs++] = vt1812_init_verbs; - return 0; error: @@ -1161,13 +1165,15 @@ static int patch_vt3476(struct hda_codec *codec) spec->gen.mixer_nid = 0x3f; add_secret_dac_path(codec); + err = snd_hda_add_verbs(codec, vt3476_init_verbs); + if (err < 0) + goto error; + /* automatic parse from the BIOS config */ err = via_parse_auto_config(codec); if (err < 0) goto error; - spec->init_verbs[spec->num_iverbs++] = vt3476_init_verbs; - return 0; error: |