aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.h
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/hda_codec.h')
-rw-r--r--sound/pci/hda/hda_codec.h93
1 files changed, 76 insertions, 17 deletions
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 8665540e55aa..23ca1722aff1 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -551,9 +551,6 @@ enum {
551 AC_JACK_PORT_BOTH, 551 AC_JACK_PORT_BOTH,
552}; 552};
553 553
554/* max. connections to a widget */
555#define HDA_MAX_CONNECTIONS 32
556
557/* max. codec address */ 554/* max. codec address */
558#define HDA_MAX_CODEC_ADDRESS 0x0f 555#define HDA_MAX_CODEC_ADDRESS 0x0f
559 556
@@ -618,6 +615,17 @@ struct hda_bus_ops {
618 /* notify power-up/down from codec to controller */ 615 /* notify power-up/down from codec to controller */
619 void (*pm_notify)(struct hda_bus *bus, bool power_up); 616 void (*pm_notify)(struct hda_bus *bus, bool power_up);
620#endif 617#endif
618#ifdef CONFIG_SND_HDA_DSP_LOADER
619 /* prepare DSP transfer */
620 int (*load_dsp_prepare)(struct hda_bus *bus, unsigned int format,
621 unsigned int byte_size,
622 struct snd_dma_buffer *bufp);
623 /* start/stop DSP transfer */
624 void (*load_dsp_trigger)(struct hda_bus *bus, bool start);
625 /* clean up DSP transfer */
626 void (*load_dsp_cleanup)(struct hda_bus *bus,
627 struct snd_dma_buffer *dmab);
628#endif
621}; 629};
622 630
623/* template to pass to the bus constructor */ 631/* template to pass to the bus constructor */
@@ -671,6 +679,8 @@ struct hda_bus {
671 unsigned int response_reset:1; /* controller was reset */ 679 unsigned int response_reset:1; /* controller was reset */
672 unsigned int in_reset:1; /* during reset operation */ 680 unsigned int in_reset:1; /* during reset operation */
673 unsigned int power_keep_link_on:1; /* don't power off HDA link */ 681 unsigned int power_keep_link_on:1; /* don't power off HDA link */
682
683 int primary_dig_out_type; /* primary digital out PCM type */
674}; 684};
675 685
676/* 686/*
@@ -719,9 +729,10 @@ struct hda_codec_ops {
719 729
720/* record for amp information cache */ 730/* record for amp information cache */
721struct hda_cache_head { 731struct hda_cache_head {
722 u32 key; /* hash key */ 732 u32 key:31; /* hash key */
733 u32 dirty:1;
723 u16 val; /* assigned value */ 734 u16 val; /* assigned value */
724 u16 next; /* next link; -1 = terminal */ 735 u16 next;
725}; 736};
726 737
727struct hda_amp_info { 738struct hda_amp_info {
@@ -830,20 +841,20 @@ struct hda_codec {
830 struct hda_cache_rec amp_cache; /* cache for amp access */ 841 struct hda_cache_rec amp_cache; /* cache for amp access */
831 struct hda_cache_rec cmd_cache; /* cache for other commands */ 842 struct hda_cache_rec cmd_cache; /* cache for other commands */
832 843
833 struct snd_array conn_lists; /* connection-list array */ 844 struct list_head conn_list; /* linked-list of connection-list */
834 845
835 struct mutex spdif_mutex; 846 struct mutex spdif_mutex;
836 struct mutex control_mutex; 847 struct mutex control_mutex;
837 struct mutex hash_mutex; 848 struct mutex hash_mutex;
838 struct snd_array spdif_out; 849 struct snd_array spdif_out;
839 unsigned int spdif_in_enable; /* SPDIF input enable? */ 850 unsigned int spdif_in_enable; /* SPDIF input enable? */
840 int primary_dig_out_type; /* primary digital out PCM type */
841 const hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */ 851 const hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */
842 struct snd_array init_pins; /* initial (BIOS) pin configurations */ 852 struct snd_array init_pins; /* initial (BIOS) pin configurations */
843 struct snd_array driver_pins; /* pin configs set by codec parser */ 853 struct snd_array driver_pins; /* pin configs set by codec parser */
844 struct snd_array cvt_setups; /* audio convert setups */ 854 struct snd_array cvt_setups; /* audio convert setups */
845 855
846#ifdef CONFIG_SND_HDA_HWDEP 856#ifdef CONFIG_SND_HDA_HWDEP
857 struct mutex user_mutex;
847 struct snd_hwdep *hwdep; /* assigned hwdep device */ 858 struct snd_hwdep *hwdep; /* assigned hwdep device */
848 struct snd_array init_verbs; /* additional init verbs */ 859 struct snd_array init_verbs; /* additional init verbs */
849 struct snd_array hints; /* additional hints */ 860 struct snd_array hints; /* additional hints */
@@ -865,8 +876,11 @@ struct hda_codec {
865 unsigned int pins_shutup:1; /* pins are shut up */ 876 unsigned int pins_shutup:1; /* pins are shut up */
866 unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */ 877 unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */
867 unsigned int no_jack_detect:1; /* Machine has no jack-detection */ 878 unsigned int no_jack_detect:1; /* Machine has no jack-detection */
879 unsigned int inv_eapd:1; /* broken h/w: inverted EAPD control */
880 unsigned int inv_jack_detect:1; /* broken h/w: inverted detection bit */
868 unsigned int pcm_format_first:1; /* PCM format must be set first */ 881 unsigned int pcm_format_first:1; /* PCM format must be set first */
869 unsigned int epss:1; /* supporting EPSS? */ 882 unsigned int epss:1; /* supporting EPSS? */
883 unsigned int cached_write:1; /* write only to caches */
870#ifdef CONFIG_PM 884#ifdef CONFIG_PM
871 unsigned int power_on :1; /* current (global) power-state */ 885 unsigned int power_on :1; /* current (global) power-state */
872 unsigned int d3_stop_clk:1; /* support D3 operation without BCLK */ 886 unsigned int d3_stop_clk:1; /* support D3 operation without BCLK */
@@ -881,6 +895,10 @@ struct hda_codec {
881 spinlock_t power_lock; 895 spinlock_t power_lock;
882#endif 896#endif
883 897
898 /* filter the requested power state per nid */
899 unsigned int (*power_filter)(struct hda_codec *codec, hda_nid_t nid,
900 unsigned int power_state);
901
884 /* codec-specific additional proc output */ 902 /* codec-specific additional proc output */
885 void (*proc_widget_hook)(struct snd_info_buffer *buffer, 903 void (*proc_widget_hook)(struct snd_info_buffer *buffer,
886 struct hda_codec *codec, hda_nid_t nid); 904 struct hda_codec *codec, hda_nid_t nid);
@@ -894,6 +912,14 @@ struct hda_codec {
894 /* jack detection */ 912 /* jack detection */
895 struct snd_array jacks; 913 struct snd_array jacks;
896#endif 914#endif
915
916 /* fix-up list */
917 int fixup_id;
918 const struct hda_fixup *fixup_list;
919 const char *fixup_name;
920
921 /* additional init verbs */
922 struct snd_array verbs;
897}; 923};
898 924
899/* direction */ 925/* direction */
@@ -910,6 +936,7 @@ int snd_hda_bus_new(struct snd_card *card, const struct hda_bus_template *temp,
910int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, 936int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
911 struct hda_codec **codecp); 937 struct hda_codec **codecp);
912int snd_hda_codec_configure(struct hda_codec *codec); 938int snd_hda_codec_configure(struct hda_codec *codec);
939int snd_hda_codec_update_widgets(struct hda_codec *codec);
913 940
914/* 941/*
915 * low level functions 942 * low level functions
@@ -930,8 +957,11 @@ snd_hda_get_num_conns(struct hda_codec *codec, hda_nid_t nid)
930{ 957{
931 return snd_hda_get_connections(codec, nid, NULL, 0); 958 return snd_hda_get_connections(codec, nid, NULL, 0);
932} 959}
960int snd_hda_get_num_raw_conns(struct hda_codec *codec, hda_nid_t nid);
933int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid, 961int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid,
934 hda_nid_t *conn_list, int max_conns); 962 hda_nid_t *conn_list, int max_conns);
963int snd_hda_get_conn_list(struct hda_codec *codec, hda_nid_t nid,
964 const hda_nid_t **listp);
935int snd_hda_override_conn_list(struct hda_codec *codec, hda_nid_t nid, int nums, 965int snd_hda_override_conn_list(struct hda_codec *codec, hda_nid_t nid, int nums,
936 const hda_nid_t *list); 966 const hda_nid_t *list);
937int snd_hda_get_conn_index(struct hda_codec *codec, hda_nid_t mux, 967int snd_hda_get_conn_index(struct hda_codec *codec, hda_nid_t mux,
@@ -952,7 +982,6 @@ void snd_hda_sequence_write(struct hda_codec *codec,
952int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex); 982int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex);
953 983
954/* cached write */ 984/* cached write */
955#ifdef CONFIG_PM
956int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid, 985int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid,
957 int direct, unsigned int verb, unsigned int parm); 986 int direct, unsigned int verb, unsigned int parm);
958void snd_hda_sequence_write_cache(struct hda_codec *codec, 987void snd_hda_sequence_write_cache(struct hda_codec *codec,
@@ -960,17 +989,14 @@ void snd_hda_sequence_write_cache(struct hda_codec *codec,
960int snd_hda_codec_update_cache(struct hda_codec *codec, hda_nid_t nid, 989int snd_hda_codec_update_cache(struct hda_codec *codec, hda_nid_t nid,
961 int direct, unsigned int verb, unsigned int parm); 990 int direct, unsigned int verb, unsigned int parm);
962void snd_hda_codec_resume_cache(struct hda_codec *codec); 991void snd_hda_codec_resume_cache(struct hda_codec *codec);
963#else 992/* both for cmd & amp caches */
964#define snd_hda_codec_write_cache snd_hda_codec_write 993void snd_hda_codec_flush_cache(struct hda_codec *codec);
965#define snd_hda_codec_update_cache snd_hda_codec_write
966#define snd_hda_sequence_write_cache snd_hda_sequence_write
967#endif
968 994
969/* the struct for codec->pin_configs */ 995/* the struct for codec->pin_configs */
970struct hda_pincfg { 996struct hda_pincfg {
971 hda_nid_t nid; 997 hda_nid_t nid;
972 unsigned char ctrl; /* current pin control value */ 998 unsigned char ctrl; /* original pin control value */
973 unsigned char pad; /* reserved */ 999 unsigned char target; /* target pin control value */
974 unsigned int cfg; /* default configuration */ 1000 unsigned int cfg; /* default configuration */
975}; 1001};
976 1002
@@ -1036,8 +1062,7 @@ extern const struct snd_pcm_chmap_elem snd_pcm_2_1_chmaps[];
1036void snd_hda_get_codec_name(struct hda_codec *codec, char *name, int namelen); 1062void snd_hda_get_codec_name(struct hda_codec *codec, char *name, int namelen);
1037void snd_hda_bus_reboot_notify(struct hda_bus *bus); 1063void snd_hda_bus_reboot_notify(struct hda_bus *bus);
1038void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg, 1064void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg,
1039 unsigned int power_state, 1065 unsigned int power_state);
1040 bool eapd_workaround);
1041 1066
1042int snd_hda_lock_devices(struct hda_bus *bus); 1067int snd_hda_lock_devices(struct hda_bus *bus);
1043void snd_hda_unlock_devices(struct hda_bus *bus); 1068void snd_hda_unlock_devices(struct hda_bus *bus);
@@ -1136,6 +1161,40 @@ static inline void snd_hda_power_sync(struct hda_codec *codec)
1136int snd_hda_load_patch(struct hda_bus *bus, size_t size, const void *buf); 1161int snd_hda_load_patch(struct hda_bus *bus, size_t size, const void *buf);
1137#endif 1162#endif
1138 1163
1164#ifdef CONFIG_SND_HDA_DSP_LOADER
1165static inline int
1166snd_hda_codec_load_dsp_prepare(struct hda_codec *codec, unsigned int format,
1167 unsigned int size,
1168 struct snd_dma_buffer *bufp)
1169{
1170 return codec->bus->ops.load_dsp_prepare(codec->bus, format, size, bufp);
1171}
1172static inline void
1173snd_hda_codec_load_dsp_trigger(struct hda_codec *codec, bool start)
1174{
1175 return codec->bus->ops.load_dsp_trigger(codec->bus, start);
1176}
1177static inline void
1178snd_hda_codec_load_dsp_cleanup(struct hda_codec *codec,
1179 struct snd_dma_buffer *dmab)
1180{
1181 return codec->bus->ops.load_dsp_cleanup(codec->bus, dmab);
1182}
1183#else
1184static inline int
1185snd_hda_codec_load_dsp_prepare(struct hda_codec *codec, unsigned int format,
1186 unsigned int size,
1187 struct snd_dma_buffer *bufp)
1188{
1189 return -ENOSYS;
1190}
1191static inline void
1192snd_hda_codec_load_dsp_trigger(struct hda_codec *codec, bool start) {}
1193static inline void
1194snd_hda_codec_load_dsp_cleanup(struct hda_codec *codec,
1195 struct snd_dma_buffer *dmab) {}
1196#endif
1197
1139/* 1198/*
1140 * Codec modularization 1199 * Codec modularization
1141 */ 1200 */