Linux 4.8.3
[linux/fpc-iii.git] / include / sound / hda_chmap.h
blobbabd445c75051fbaa9c18b337d897c75d676e237
1 /*
2 * For multichannel support
3 */
5 #ifndef __SOUND_HDA_CHMAP_H
6 #define __SOUND_HDA_CHMAP_H
8 #include <sound/pcm.h>
9 #include <sound/hdaudio.h>
12 #define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80
14 struct hdac_cea_channel_speaker_allocation {
15 int ca_index;
16 int speakers[8];
18 /* derived values, just for convenience */
19 int channels;
20 int spk_mask;
22 struct hdac_chmap;
24 struct hdac_chmap_ops {
26 * Helpers for producing the channel map TLVs. These can be overridden
27 * for devices that have non-standard mapping requirements.
29 int (*chmap_cea_alloc_validate_get_type)(struct hdac_chmap *chmap,
30 struct hdac_cea_channel_speaker_allocation *cap, int channels);
31 void (*cea_alloc_to_tlv_chmap)(struct hdac_chmap *hchmap,
32 struct hdac_cea_channel_speaker_allocation *cap,
33 unsigned int *chmap, int channels);
35 /* check that the user-given chmap is supported */
36 int (*chmap_validate)(struct hdac_chmap *hchmap, int ca,
37 int channels, unsigned char *chmap);
39 int (*get_spk_alloc)(struct hdac_device *hdac, int pcm_idx);
41 void (*get_chmap)(struct hdac_device *hdac, int pcm_idx,
42 unsigned char *chmap);
43 void (*set_chmap)(struct hdac_device *hdac, int pcm_idx,
44 unsigned char *chmap, int prepared);
45 bool (*is_pcm_attached)(struct hdac_device *hdac, int pcm_idx);
47 /* get and set channel assigned to each HDMI ASP (audio sample packet) slot */
48 int (*pin_get_slot_channel)(struct hdac_device *codec,
49 hda_nid_t pin_nid, int asp_slot);
50 int (*pin_set_slot_channel)(struct hdac_device *codec,
51 hda_nid_t pin_nid, int asp_slot, int channel);
52 void (*set_channel_count)(struct hdac_device *codec,
53 hda_nid_t cvt_nid, int chs);
56 struct hdac_chmap {
57 unsigned int channels_max; /* max over all cvts */
58 struct hdac_chmap_ops ops;
59 struct hdac_device *hdac;
62 void snd_hdac_register_chmap_ops(struct hdac_device *hdac,
63 struct hdac_chmap *chmap);
64 int snd_hdac_channel_allocation(struct hdac_device *hdac, int spk_alloc,
65 int channels, bool chmap_set,
66 bool non_pcm, unsigned char *map);
67 int snd_hdac_get_active_channels(int ca);
68 void snd_hdac_setup_channel_mapping(struct hdac_chmap *chmap,
69 hda_nid_t pin_nid, bool non_pcm, int ca,
70 int channels, unsigned char *map,
71 bool chmap_set);
72 void snd_hdac_print_channel_allocation(int spk_alloc, char *buf, int buflen);
73 struct hdac_cea_channel_speaker_allocation *snd_hdac_get_ch_alloc_from_ca(int ca);
74 int snd_hdac_chmap_to_spk_mask(unsigned char c);
75 int snd_hdac_spk_to_chmap(int spk);
76 int snd_hdac_add_chmap_ctls(struct snd_pcm *pcm, int pcm_idx,
77 struct hdac_chmap *chmap);
78 #endif /* __SOUND_HDA_CHMAP_H */