summaryrefslogtreecommitdiff
path: root/include/sound/hda_chmap.h
blob: f7fd752fc817be0124a5d1b56abbda90af31e791 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
 * For multichannel support
 */

#ifndef __SOUND_HDA_CHMAP_H
#define __SOUND_HDA_CHMAP_H

#include <sound/hdaudio.h>


#define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80

struct hdac_cea_channel_speaker_allocation {
	int ca_index;
	int speakers[8];

	/* derived values, just for convenience */
	int channels;
	int spk_mask;
};
struct hdac_chmap;

struct hdac_chmap_ops {
	/*
	 * Helpers for producing the channel map TLVs. These can be overridden
	 * for devices that have non-standard mapping requirements.
	 */
	int (*chmap_cea_alloc_validate_get_type)(struct hdac_chmap *chmap,
		struct hdac_cea_channel_speaker_allocation *cap, int channels);
	void (*cea_alloc_to_tlv_chmap)(struct hdac_chmap *hchmap,
		struct hdac_cea_channel_speaker_allocation *cap,
		unsigned int *chmap, int channels);

	/* check that the user-given chmap is supported */
	int (*chmap_validate)(struct hdac_chmap *hchmap, int ca,
			int channels, unsigned char *chmap);

	void (*get_chmap)(struct hdac_device *hdac, int pcm_idx,
					unsigned char *chmap);
	void (*set_chmap)(struct hdac_device *hdac, int pcm_idx,
			unsigned char *chmap, int prepared);
	bool (*is_pcm_attached)(struct hdac_device *hdac, int pcm_idx);

	/* get and set channel assigned to each HDMI ASP (audio sample packet) slot */
	int (*pin_get_slot_channel)(struct hdac_device *codec,
			hda_nid_t pin_nid, int asp_slot);
	int (*pin_set_slot_channel)(struct hdac_device *codec,
			hda_nid_t pin_nid, int asp_slot, int channel);
	void (*set_channel_count)(struct hdac_device *codec,
				hda_nid_t cvt_nid, int chs);
};

struct hdac_chmap {
	unsigned int channels_max; /* max over all cvts */
	struct hdac_chmap_ops ops;
	struct hdac_device *hdac;
};

void snd_hdac_register_chmap_ops(struct hdac_device *hdac,
				struct hdac_chmap *chmap);
#endif /* __SOUND_HDA_CHMAP_H */