ALSA: hda - Set patch_ops before calling auto-parser
[linux-2.6-microblaze.git] / sound / pci / hda / patch_via.c
index 31a95cc..2c6c672 100644 (file)
@@ -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;
 }