Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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