0001
0002
0003
0004
0005
0006 #ifndef __SOUND_HDA_CHMAP_H
0007 #define __SOUND_HDA_CHMAP_H
0008
0009 #include <sound/pcm.h>
0010 #include <sound/hdaudio.h>
0011
0012
0013 #define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80
0014
0015 struct hdac_cea_channel_speaker_allocation {
0016 int ca_index;
0017 int speakers[8];
0018
0019
0020 int channels;
0021 int spk_mask;
0022 };
0023 struct hdac_chmap;
0024
0025 struct hdac_chmap_ops {
0026
0027
0028
0029
0030 int (*chmap_cea_alloc_validate_get_type)(struct hdac_chmap *chmap,
0031 struct hdac_cea_channel_speaker_allocation *cap, int channels);
0032 void (*cea_alloc_to_tlv_chmap)(struct hdac_chmap *hchmap,
0033 struct hdac_cea_channel_speaker_allocation *cap,
0034 unsigned int *chmap, int channels);
0035
0036
0037 int (*chmap_validate)(struct hdac_chmap *hchmap, int ca,
0038 int channels, unsigned char *chmap);
0039
0040 int (*get_spk_alloc)(struct hdac_device *hdac, int pcm_idx);
0041
0042 void (*get_chmap)(struct hdac_device *hdac, int pcm_idx,
0043 unsigned char *chmap);
0044 void (*set_chmap)(struct hdac_device *hdac, int pcm_idx,
0045 unsigned char *chmap, int prepared);
0046 bool (*is_pcm_attached)(struct hdac_device *hdac, int pcm_idx);
0047
0048
0049 int (*pin_get_slot_channel)(struct hdac_device *codec,
0050 hda_nid_t pin_nid, int asp_slot);
0051 int (*pin_set_slot_channel)(struct hdac_device *codec,
0052 hda_nid_t pin_nid, int asp_slot, int channel);
0053 void (*set_channel_count)(struct hdac_device *codec,
0054 hda_nid_t cvt_nid, int chs);
0055 };
0056
0057 struct hdac_chmap {
0058 unsigned int channels_max;
0059 struct hdac_chmap_ops ops;
0060 struct hdac_device *hdac;
0061 };
0062
0063 void snd_hdac_register_chmap_ops(struct hdac_device *hdac,
0064 struct hdac_chmap *chmap);
0065 int snd_hdac_channel_allocation(struct hdac_device *hdac, int spk_alloc,
0066 int channels, bool chmap_set,
0067 bool non_pcm, unsigned char *map);
0068 int snd_hdac_get_active_channels(int ca);
0069 void snd_hdac_setup_channel_mapping(struct hdac_chmap *chmap,
0070 hda_nid_t pin_nid, bool non_pcm, int ca,
0071 int channels, unsigned char *map,
0072 bool chmap_set);
0073 void snd_hdac_print_channel_allocation(int spk_alloc, char *buf, int buflen);
0074 struct hdac_cea_channel_speaker_allocation *snd_hdac_get_ch_alloc_from_ca(int ca);
0075 int snd_hdac_chmap_to_spk_mask(unsigned char c);
0076 int snd_hdac_spk_to_chmap(int spk);
0077 int snd_hdac_add_chmap_ctls(struct snd_pcm *pcm, int pcm_idx,
0078 struct hdac_chmap *chmap);
0079 #endif