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