Subhransu S. Prusty | 67b90cb | 2016-03-04 19:59:46 +0530 | [diff] [blame] | 1 | /* |
| 2 | * For multichannel support |
| 3 | */ |
| 4 | |
| 5 | #ifndef __SOUND_HDA_CHMAP_H |
| 6 | #define __SOUND_HDA_CHMAP_H |
| 7 | |
| 8 | #include <sound/hdaudio.h> |
| 9 | |
Subhransu S. Prusty | f302240 | 2016-03-04 19:59:48 +0530 | [diff] [blame] | 10 | struct hdac_cea_channel_speaker_allocation { |
Subhransu S. Prusty | 67b90cb | 2016-03-04 19:59:46 +0530 | [diff] [blame] | 11 | int ca_index; |
| 12 | int speakers[8]; |
| 13 | |
| 14 | /* derived values, just for convenience */ |
| 15 | int channels; |
| 16 | int spk_mask; |
| 17 | }; |
| 18 | struct hdac_chmap; |
| 19 | |
| 20 | struct hdac_chmap_ops { |
| 21 | /* |
| 22 | * Helpers for producing the channel map TLVs. These can be overridden |
| 23 | * for devices that have non-standard mapping requirements. |
| 24 | */ |
| 25 | int (*chmap_cea_alloc_validate_get_type)(struct hdac_chmap *chmap, |
Subhransu S. Prusty | f302240 | 2016-03-04 19:59:48 +0530 | [diff] [blame] | 26 | struct hdac_cea_channel_speaker_allocation *cap, int channels); |
Subhransu S. Prusty | 67b90cb | 2016-03-04 19:59:46 +0530 | [diff] [blame] | 27 | void (*cea_alloc_to_tlv_chmap) |
Subhransu S. Prusty | f302240 | 2016-03-04 19:59:48 +0530 | [diff] [blame] | 28 | (struct hdac_cea_channel_speaker_allocation *cap, |
Subhransu S. Prusty | 67b90cb | 2016-03-04 19:59:46 +0530 | [diff] [blame] | 29 | unsigned int *chmap, int channels); |
| 30 | |
| 31 | /* check that the user-given chmap is supported */ |
| 32 | int (*chmap_validate)(int ca, int channels, unsigned char *chmap); |
Subhransu S. Prusty | 9b3dc8a | 2016-03-04 19:59:47 +0530 | [diff] [blame] | 33 | |
| 34 | void (*get_chmap)(struct hdac_device *hdac, int pcm_idx, |
| 35 | unsigned char *chmap); |
| 36 | void (*set_chmap)(struct hdac_device *hdac, int pcm_idx, |
| 37 | unsigned char *chmap, int prepared); |
| 38 | bool (*is_pcm_attached)(struct hdac_device *hdac, int pcm_idx); |
Subhransu S. Prusty | 739ffee | 2016-03-04 19:59:49 +0530 | [diff] [blame^] | 39 | |
| 40 | /* get and set channel assigned to each HDMI ASP (audio sample packet) slot */ |
| 41 | int (*pin_get_slot_channel)(struct hdac_device *codec, |
| 42 | hda_nid_t pin_nid, int asp_slot); |
| 43 | int (*pin_set_slot_channel)(struct hdac_device *codec, |
| 44 | hda_nid_t pin_nid, int asp_slot, int channel); |
| 45 | void (*set_channel_count)(struct hdac_device *codec, |
| 46 | hda_nid_t cvt_nid, int chs); |
Subhransu S. Prusty | 67b90cb | 2016-03-04 19:59:46 +0530 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | struct hdac_chmap { |
| 50 | unsigned int channels_max; /* max over all cvts */ |
| 51 | struct hdac_chmap_ops ops; |
| 52 | struct hdac_device *hdac; |
| 53 | }; |
| 54 | |
Subhransu S. Prusty | 739ffee | 2016-03-04 19:59:49 +0530 | [diff] [blame^] | 55 | void snd_hdac_register_chmap_ops(struct hdac_device *hdac, |
| 56 | struct hdac_chmap *chmap); |
Subhransu S. Prusty | 67b90cb | 2016-03-04 19:59:46 +0530 | [diff] [blame] | 57 | #endif /* __SOUND_HDA_CHMAP_H */ |