ALSA: hda - Add prefer_hp_amp flag to hda_gen_spec
[pandora-kernel.git] / sound / pci / hda / hda_generic.h
index b598899..6ba5805 100644 (file)
@@ -65,6 +65,17 @@ struct automic_entry {
        unsigned int attr;      /* pin attribute (INPUT_PIN_ATTR_*) */
 };
 
+/* active stream id */
+enum { STREAM_MULTI_OUT, STREAM_INDEP_HP };
+
+/* PCM hook action */
+enum {
+       HDA_GEN_PCM_ACT_OPEN,
+       HDA_GEN_PCM_ACT_PREPARE,
+       HDA_GEN_PCM_ACT_CLEANUP,
+       HDA_GEN_PCM_ACT_CLOSE,
+};
+
 struct hda_gen_spec {
        char stream_name_analog[32];    /* analog PCM stream */
        const struct hda_pcm_stream *stream_analog_playback;
@@ -76,6 +87,10 @@ struct hda_gen_spec {
        const struct hda_pcm_stream *stream_digital_playback;
        const struct hda_pcm_stream *stream_digital_capture;
 
+       /* PCM */
+       unsigned int active_streams;
+       struct mutex pcm_mutex;
+
        /* playback */
        struct hda_multi_out multiout;  /* playback set-up
                                         * max_channels, dacs must be set
@@ -101,10 +116,20 @@ struct hda_gen_spec {
        unsigned int cur_mux[3];
 
        /* channel model */
-       const struct hda_channel_mode *channel_mode;
-       int num_channel_mode;
-       int const_channel_count;        /* min. channel count (for speakers) */
-       int ext_channel_count;          /* current channel count for multi-io */
+       /* min_channel_count contains the minimum channel count for primary
+        * outputs.  When multi_ios is set, the channels can be configured
+        * between min_channel_count and (min_channel_count + multi_ios * 2).
+        *
+        * ext_channel_count contains the current channel count of the primary
+        * out.  This varies in the range above.
+        *
+        * Meanwhile, const_channel_count is the channel count for all outputs
+        * including headphone and speakers.  It's a constant value, and the
+        * PCM is set up as max(ext_channel_count, const_channel_count).
+        */
+       int min_channel_count;          /* min. channel count for primary out */
+       int ext_channel_count;          /* current channel count for primary */
+       int const_channel_count;        /* channel count for all */
 
        /* PCM information */
        struct hda_pcm pcm_rec[3];      /* used in build_pcms() */
@@ -124,6 +149,16 @@ struct hda_gen_spec {
        /* path list */
        struct snd_array paths;
 
+       /* path indices */
+       int out_paths[AUTO_CFG_MAX_OUTS];
+       int hp_paths[AUTO_CFG_MAX_OUTS];
+       int speaker_paths[AUTO_CFG_MAX_OUTS];
+       int aamix_out_paths[3];
+       int digout_paths[AUTO_CFG_MAX_OUTS];
+       int input_paths[HDA_MAX_NUM_INPUTS][AUTO_CFG_MAX_OUTS];
+       int loopback_paths[HDA_MAX_NUM_INPUTS];
+       int digin_path;
+
        /* auto-mic stuff */
        int am_num_entries;
        struct automic_entry am_entry[MAX_AUTO_MIC_PINS];
@@ -140,6 +175,7 @@ struct hda_gen_spec {
        unsigned int automute_speaker_possible:1; /* there are speakers and either LO or HP */
        unsigned int automute_lo_possible:1;      /* there are line outs and HP */
        unsigned int keep_vref_in_automute:1; /* Don't clear VREF in automute */
+       unsigned int suppress_auto_mic:1; /* suppress input jack auto switch */
        unsigned int line_in_auto_switch:1; /* allow line-in auto switch */
 
        /* other flags */
@@ -151,6 +187,15 @@ struct hda_gen_spec {
        unsigned int multi_cap_vol:1; /* allow multiple capture xxx volumes */
        unsigned int inv_dmic_split:1; /* inverted dmic w/a for conexant */
        unsigned int own_eapd_ctl:1; /* set EAPD by own function */
+       unsigned int vmaster_mute_enum:1; /* add vmaster mute mode enum */
+       unsigned int indep_hp:1; /* independent HP supported */
+       unsigned int indep_hp_enabled:1; /* independent HP enabled */
+       unsigned int prefer_hp_amp:1; /* enable HP amp for speaker if any */
+       unsigned int add_stereo_mix_input:1; /* add aamix as a capture src */
+       unsigned int add_out_jack_modes:1; /* add output jack mode enum ctls */
+
+       /* loopback mixing mode */
+       bool aamix_mode;
 
        /* for virtual master */
        hda_nid_t vmaster_nid;
@@ -165,28 +210,45 @@ struct hda_gen_spec {
        int multi_ios;
        struct hda_multi_io multi_io[4];
 
-       /* bind volumes */
-       struct snd_array bind_ctls;
-
        /* hooks */
        void (*init_hook)(struct hda_codec *codec);
        void (*automute_hook)(struct hda_codec *codec);
        void (*cap_sync_hook)(struct hda_codec *codec);
+
+       /* PCM playback hook */
+       void (*pcm_playback_hook)(struct hda_pcm_stream *hinfo,
+                                 struct hda_codec *codec,
+                                 struct snd_pcm_substream *substream,
+                                 int action);
+
+       /* automute / autoswitch hooks */
+       void (*hp_automute_hook)(struct hda_codec *codec,
+                                struct hda_jack_tbl *tbl);
+       void (*line_automute_hook)(struct hda_codec *codec,
+                                  struct hda_jack_tbl *tbl);
+       void (*mic_autoswitch_hook)(struct hda_codec *codec,
+                                   struct hda_jack_tbl *tbl);
+
+       /* capture switch hook (for mic-mute LED) */
+       void (*capture_switch_hook)(struct hda_codec *codec, bool enable);
 };
 
 int snd_hda_gen_spec_init(struct hda_gen_spec *spec);
 void snd_hda_gen_spec_free(struct hda_gen_spec *spec);
 
 int snd_hda_gen_init(struct hda_codec *codec);
+void snd_hda_gen_free(struct hda_codec *codec);
 
 struct nid_path *snd_hda_get_nid_path(struct hda_codec *codec,
                                      hda_nid_t from_nid, hda_nid_t to_nid);
+int snd_hda_get_path_idx(struct hda_codec *codec, struct nid_path *path);
+struct nid_path *snd_hda_get_path_from_idx(struct hda_codec *codec, int idx);
 bool snd_hda_parse_nid_path(struct hda_codec *codec, hda_nid_t from_nid,
-                           hda_nid_t to_nid, int with_aa_mix,
+                           hda_nid_t to_nid, int anchor_nid,
                            struct nid_path *path);
 struct nid_path *
 snd_hda_add_new_path(struct hda_codec *codec, hda_nid_t from_nid,
-                    hda_nid_t to_nid, int with_aa_mix);
+                    hda_nid_t to_nid, int anchor_nid);
 void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path,
                           bool enable, bool add_aamix);
 
@@ -208,4 +270,8 @@ void snd_hda_gen_mic_autoswitch(struct hda_codec *codec,
                                struct hda_jack_tbl *jack);
 void snd_hda_gen_update_outputs(struct hda_codec *codec);
 
+#ifdef CONFIG_PM
+int snd_hda_gen_check_power_status(struct hda_codec *codec, hda_nid_t nid);
+#endif
+
 #endif /* __SOUND_HDA_GENERIC_H */