]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - sound/pci/hda/hda_local.h
Merge branches 'release', 'bugzilla-6217', 'bugzilla-6629', 'bugzilla-6933', 'bugzill...
[mirror_ubuntu-bionic-kernel.git] / sound / pci / hda / hda_local.h
index 12428a67eb2a6e172bf90dfe2a11d20e4cd2d023..ad0014ab71f9e0388ead79f283a7867ca4542c39 100644 (file)
@@ -84,6 +84,23 @@ int snd_hda_codec_amp_read(struct hda_codec *codec, hda_nid_t nid, int ch,
                           int direction, int index);
 int snd_hda_codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch,
                             int direction, int idx, int mask, int val);
+int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid,
+                            int dir, int idx, int mask, int val);
+#ifdef SND_HDA_NEEDS_RESUME
+void snd_hda_codec_resume_amp(struct hda_codec *codec);
+#endif
+
+void snd_hda_set_vmaster_tlv(struct hda_codec *codec, hda_nid_t nid, int dir,
+                            unsigned int *tlv);
+struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec,
+                                           const char *name);
+int snd_hda_add_vmaster(struct hda_codec *codec, char *name,
+                       unsigned int *tlv, const char **slaves);
+
+/* amp value bits */
+#define HDA_AMP_MUTE   0x80
+#define HDA_AMP_UNMUTE 0x00
+#define HDA_AMP_VOLMASK        0x7f
 
 /* mono switch binding multiple inputs */
 #define HDA_BIND_MUTE_MONO(xname, nid, channel, indices, direction) \
@@ -102,6 +119,53 @@ int snd_hda_mixer_bind_switch_get(struct snd_kcontrol *kcontrol,
 int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol,
                                  struct snd_ctl_elem_value *ucontrol);
 
+/* more generic bound controls */
+struct hda_ctl_ops {
+       snd_kcontrol_info_t *info;
+       snd_kcontrol_get_t *get;
+       snd_kcontrol_put_t *put;
+       snd_kcontrol_tlv_rw_t *tlv;
+};
+
+extern struct hda_ctl_ops snd_hda_bind_vol;    /* for bind-volume with TLV */
+extern struct hda_ctl_ops snd_hda_bind_sw;     /* for bind-switch */
+
+struct hda_bind_ctls {
+       struct hda_ctl_ops *ops;
+       long values[];
+};
+
+int snd_hda_mixer_bind_ctls_info(struct snd_kcontrol *kcontrol,
+                                struct snd_ctl_elem_info *uinfo);
+int snd_hda_mixer_bind_ctls_get(struct snd_kcontrol *kcontrol,
+                               struct snd_ctl_elem_value *ucontrol);
+int snd_hda_mixer_bind_ctls_put(struct snd_kcontrol *kcontrol,
+                               struct snd_ctl_elem_value *ucontrol);
+int snd_hda_mixer_bind_tlv(struct snd_kcontrol *kcontrol, int op_flag,
+                          unsigned int size, unsigned int __user *tlv);
+
+#define HDA_BIND_VOL(xname, bindrec) \
+       { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
+         .name = xname, \
+         .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |\
+                         SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
+                         SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK,\
+         .info = snd_hda_mixer_bind_ctls_info,\
+         .get =  snd_hda_mixer_bind_ctls_get,\
+         .put = snd_hda_mixer_bind_ctls_put,\
+         .tlv = { .c = snd_hda_mixer_bind_tlv },\
+         .private_value = (long) (bindrec) }
+#define HDA_BIND_SW(xname, bindrec) \
+       { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,\
+         .name = xname, \
+         .info = snd_hda_mixer_bind_ctls_info,\
+         .get =  snd_hda_mixer_bind_ctls_get,\
+         .put = snd_hda_mixer_bind_ctls_put,\
+         .private_value = (long) (bindrec) }
+
+/*
+ * SPDIF I/O
+ */
 int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, hda_nid_t nid);
 int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid);
 
@@ -163,6 +227,7 @@ struct hda_multi_out {
        hda_nid_t dig_out_nid;  /* digital out audio widget */
        int max_channels;       /* currently supported analog channels */
        int dig_out_used;       /* current usage of digital out (HDA_DIG_XXX) */
+       int no_share_stream;    /* don't share a stream with multiple pins */
 };
 
 int snd_hda_multi_out_dig_open(struct hda_codec *codec,
@@ -188,7 +253,14 @@ int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec,
 /*
  * generic codec parser
  */
+#ifdef CONFIG_SND_HDA_GENERIC
 int snd_hda_parse_generic_codec(struct hda_codec *codec);
+#else
+static inline int snd_hda_parse_generic_codec(struct hda_codec *codec)
+{
+       return -ENODEV;
+}
+#endif
 
 /*
  * generic proc interface
@@ -208,15 +280,6 @@ int snd_hda_check_board_config(struct hda_codec *codec, int num_configs,
 int snd_hda_add_new_ctls(struct hda_codec *codec,
                         struct snd_kcontrol_new *knew);
 
-/*
- * power management
- */
-#ifdef CONFIG_PM
-int snd_hda_resume_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew);
-int snd_hda_resume_spdif_out(struct hda_codec *codec);
-int snd_hda_resume_spdif_in(struct hda_codec *codec);
-#endif
-
 /*
  * unsolicited event handler
  */
@@ -255,19 +318,21 @@ enum {
 
 extern const char *auto_pin_cfg_labels[AUTO_PIN_LAST];
 
+#define AUTO_CFG_MAX_OUTS      5
+
 struct auto_pin_cfg {
        int line_outs;
-       hda_nid_t line_out_pins[5]; /* sorted in the order of
-                                    * Front/Surr/CLFE/Side
-                                    */
+       /* sorted in the order of Front/Surr/CLFE/Side */
+       hda_nid_t line_out_pins[AUTO_CFG_MAX_OUTS];
        int speaker_outs;
-       hda_nid_t speaker_pins[5];
+       hda_nid_t speaker_pins[AUTO_CFG_MAX_OUTS];
        int hp_outs;
        int line_out_type;      /* AUTO_PIN_XXX_OUT */
-       hda_nid_t hp_pins[5];
+       hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS];
        hda_nid_t input_pins[AUTO_PIN_LAST];
        hda_nid_t dig_out_pin;
        hda_nid_t dig_in_pin;
+       hda_nid_t mono_out_pin;
 };
 
 #define get_defcfg_connect(cfg) \
@@ -306,10 +371,11 @@ static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid)
 {
        if (nid < codec->start_nid ||
            nid >= codec->start_nid + codec->num_nodes)
-               return snd_hda_param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP);
+               return 0;
        return codec->wcaps[nid - codec->start_nid];
 }
 
+u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction);
 int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
                              unsigned int caps);
 
@@ -318,4 +384,34 @@ int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
  */
 int snd_hda_create_hwdep(struct hda_codec *codec);
 
+/*
+ * power-management
+ */
+
+#ifdef CONFIG_SND_HDA_POWER_SAVE
+void snd_hda_schedule_power_save(struct hda_codec *codec);
+
+struct hda_amp_list {
+       hda_nid_t nid;
+       unsigned char dir;
+       unsigned char idx;
+};
+
+struct hda_loopback_check {
+       struct hda_amp_list *amplist;
+       int power_on;
+};
+
+int snd_hda_check_amp_list_power(struct hda_codec *codec,
+                                struct hda_loopback_check *check,
+                                hda_nid_t nid);
+#endif /* CONFIG_SND_HDA_POWER_SAVE */
+
+/*
+ * virtual master control
+ */
+struct snd_kcontrol *snd_ctl_make_virtual_master(char *name,
+                                                const unsigned int *tlv);
+int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave);
+                     
 #endif /* __SOUND_HDA_LOCAL_H */