Blame view

include/sound/hda_chmap.h 2.6 KB
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  /* SPDX-License-Identifier: GPL-2.0 */
67b90cb84   Subhransu S. Prusty   ALSA: hda - Creat...
2
3
4
5
6
7
  /*
   * For multichannel support
   */
  
  #ifndef __SOUND_HDA_CHMAP_H
  #define __SOUND_HDA_CHMAP_H
2f6e8a851   Subhransu S. Prusty   ALSA: hda - Move ...
8
  #include <sound/pcm.h>
67b90cb84   Subhransu S. Prusty   ALSA: hda - Creat...
9
  #include <sound/hdaudio.h>
828cb4edd   Subhransu S. Prusty   ALSA: hda - chmap...
10
11
  
  #define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80
f302240da   Subhransu S. Prusty   ALSA: hda - Use h...
12
  struct hdac_cea_channel_speaker_allocation {
67b90cb84   Subhransu S. Prusty   ALSA: hda - Creat...
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  	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,
f302240da   Subhransu S. Prusty   ALSA: hda - Use h...
28
  		struct hdac_cea_channel_speaker_allocation *cap, int channels);
828cb4edd   Subhransu S. Prusty   ALSA: hda - chmap...
29
30
  	void (*cea_alloc_to_tlv_chmap)(struct hdac_chmap *hchmap,
  		struct hdac_cea_channel_speaker_allocation *cap,
67b90cb84   Subhransu S. Prusty   ALSA: hda - Creat...
31
32
33
  		unsigned int *chmap, int channels);
  
  	/* check that the user-given chmap is supported */
828cb4edd   Subhransu S. Prusty   ALSA: hda - chmap...
34
35
  	int (*chmap_validate)(struct hdac_chmap *hchmap, int ca,
  			int channels, unsigned char *chmap);
9b3dc8aa3   Subhransu S. Prusty   ALSA: hda - Regis...
36

44fde3b89   Subhransu S. Prusty   ALSA: hda - Updat...
37
  	int (*get_spk_alloc)(struct hdac_device *hdac, int pcm_idx);
9b3dc8aa3   Subhransu S. Prusty   ALSA: hda - Regis...
38
39
40
41
42
  	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);
739ffee97   Subhransu S. Prusty   ALSA: hda - Add h...
43
44
45
46
47
48
49
50
  
  	/* 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);
67b90cb84   Subhransu S. Prusty   ALSA: hda - Creat...
51
52
53
54
55
56
57
  };
  
  struct hdac_chmap {
  	unsigned int channels_max; /* max over all cvts */
  	struct hdac_chmap_ops ops;
  	struct hdac_device *hdac;
  };
739ffee97   Subhransu S. Prusty   ALSA: hda - Add h...
58
59
  void snd_hdac_register_chmap_ops(struct hdac_device *hdac,
  				struct hdac_chmap *chmap);
bb63f726f   Subhransu S. Prusty   ALSA: hda - Use s...
60
  int snd_hdac_channel_allocation(struct hdac_device *hdac, int spk_alloc,
2f6e8a851   Subhransu S. Prusty   ALSA: hda - Move ...
61
62
  			int channels, bool chmap_set,
  			bool non_pcm, unsigned char *map);
bb63f726f   Subhransu S. Prusty   ALSA: hda - Use s...
63
64
  int snd_hdac_get_active_channels(int ca);
  void snd_hdac_setup_channel_mapping(struct hdac_chmap *chmap,
2f6e8a851   Subhransu S. Prusty   ALSA: hda - Move ...
65
66
67
  		       hda_nid_t pin_nid, bool non_pcm, int ca,
  		       int channels, unsigned char *map,
  		       bool chmap_set);
bb63f726f   Subhransu S. Prusty   ALSA: hda - Use s...
68
69
70
71
  void snd_hdac_print_channel_allocation(int spk_alloc, char *buf, int buflen);
  struct hdac_cea_channel_speaker_allocation *snd_hdac_get_ch_alloc_from_ca(int ca);
  int snd_hdac_chmap_to_spk_mask(unsigned char c);
  int snd_hdac_spk_to_chmap(int spk);
2f6e8a851   Subhransu S. Prusty   ALSA: hda - Move ...
72
73
  int snd_hdac_add_chmap_ctls(struct snd_pcm *pcm, int pcm_idx,
  				struct hdac_chmap *chmap);
67b90cb84   Subhransu S. Prusty   ALSA: hda - Creat...
74
  #endif /* __SOUND_HDA_CHMAP_H */