diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-05-29 10:42:14 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-05-29 10:42:14 +0200 |
commit | 225068ab274dbd5c3a43fd80a6d553ccdf7b2c6f (patch) | |
tree | b9832b957377c6bfe5c6bce56b29a2eff03f3072 /sound/pci/hda/patch_via.c | |
parent | 984a8547052711867332eeaec4141755fc040553 (diff) |
ALSA: hda - Set patch_ops before calling auto-parser
... so that the parser code can overwrite some optional ops. For
Realtek and others, it can be set solely in the spec allocator, so it
results in a good code cleanup, too.
With this change, we can finally remove the local stream_pm setup and
rely on the generic parser's automatic setting.
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 | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 31a95cca015d..2c6c6727ca93 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -117,6 +117,8 @@ static void via_playback_pcm_hook(struct hda_pcm_stream *hinfo, struct snd_pcm_substream *substream, int action); +static const struct hda_codec_ops via_patch_ops; /* defined below */ + static struct via_spec *via_new_spec(struct hda_codec *codec) { struct via_spec *spec; @@ -137,6 +139,7 @@ static struct via_spec *via_new_spec(struct hda_codec *codec) spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; codec->power_save_node = 1; spec->gen.power_down_unused = 1; + codec->patch_ops = via_patch_ops; return spec; } @@ -472,7 +475,6 @@ static const struct hda_codec_ops via_patch_ops = { .init = via_init, .free = via_free, .unsol_event = snd_hda_jack_unsol_event, - .stream_pm = snd_hda_gen_stream_pm, #ifdef CONFIG_PM .suspend = via_suspend, .check_power_status = via_check_power_status, @@ -651,6 +653,9 @@ static int patch_vt1708(struct hda_codec *codec) if (spec == NULL) return -ENOMEM; + /* override some patch_ops */ + codec->patch_ops.build_controls = vt1708_build_controls; + codec->patch_ops.build_pcms = vt1708_build_pcms; spec->gen.mixer_nid = 0x17; /* set jackpoll_interval while parsing the codec */ @@ -679,10 +684,6 @@ static int patch_vt1708(struct hda_codec *codec) spec->init_verbs[spec->num_iverbs++] = vt1708_init_verbs; - codec->patch_ops = via_patch_ops; - codec->patch_ops.build_controls = vt1708_build_controls; - codec->patch_ops.build_pcms = vt1708_build_pcms; - /* clear jackpoll_interval again; it's set dynamically */ codec->jackpoll_interval = 0; @@ -707,8 +708,6 @@ static int patch_vt1709(struct hda_codec *codec) return err; } - codec->patch_ops = via_patch_ops; - return 0; } @@ -735,7 +734,6 @@ static int patch_vt1708B(struct hda_codec *codec) return err; } - codec->patch_ops = via_patch_ops; return 0; } @@ -800,7 +798,6 @@ static int patch_vt1708S(struct hda_codec *codec) spec->init_verbs[spec->num_iverbs++] = vt1708S_init_verbs; - codec->patch_ops = via_patch_ops; return 0; } @@ -842,7 +839,6 @@ static int patch_vt1702(struct hda_codec *codec) spec->init_verbs[spec->num_iverbs++] = vt1702_init_verbs; - codec->patch_ops = via_patch_ops; return 0; } @@ -915,7 +911,6 @@ static int patch_vt1718S(struct hda_codec *codec) spec->init_verbs[spec->num_iverbs++] = vt1718S_init_verbs; - codec->patch_ops = via_patch_ops; return 0; } @@ -1015,7 +1010,6 @@ static int patch_vt1716S(struct hda_codec *codec) spec->mixers[spec->num_mixers++] = vt1716s_dmic_mixer; spec->mixers[spec->num_mixers++] = vt1716S_mono_out_mixer; - codec->patch_ops = via_patch_ops; return 0; } @@ -1123,7 +1117,6 @@ static int patch_vt2002P(struct hda_codec *codec) else spec->init_verbs[spec->num_iverbs++] = vt2002P_init_verbs; - codec->patch_ops = via_patch_ops; return 0; } @@ -1162,7 +1155,6 @@ static int patch_vt1812(struct hda_codec *codec) spec->init_verbs[spec->num_iverbs++] = vt1812_init_verbs; - codec->patch_ops = via_patch_ops; return 0; } @@ -1200,7 +1192,6 @@ static int patch_vt3476(struct hda_codec *codec) spec->init_verbs[spec->num_iverbs++] = vt3476_init_verbs; - codec->patch_ops = via_patch_ops; return 0; } |