Skip to content

Commit 1b0e9d7

Browse files
lumagtiwai
authored andcommitted
ALSA: hda/hdmi: extract common interface for ELD handling
Other HDMI-related cards (e.g. hdmi-codec) are also using the ELD. Exrtact common set of interfaces for handling the ELD. Signed-off-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent e8d04a9 commit 1b0e9d7

File tree

6 files changed

+494
-425
lines changed

6 files changed

+494
-425
lines changed

include/sound/pcm_drm_eld.h

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,97 @@
22
#ifndef __SOUND_PCM_DRM_ELD_H
33
#define __SOUND_PCM_DRM_ELD_H
44

5+
enum eld_versions {
6+
ELD_VER_CEA_861D = 2,
7+
ELD_VER_PARTIAL = 31,
8+
};
9+
10+
enum cea_audio_coding_types {
11+
AUDIO_CODING_TYPE_REF_STREAM_HEADER = 0,
12+
AUDIO_CODING_TYPE_LPCM = 1,
13+
AUDIO_CODING_TYPE_AC3 = 2,
14+
AUDIO_CODING_TYPE_MPEG1 = 3,
15+
AUDIO_CODING_TYPE_MP3 = 4,
16+
AUDIO_CODING_TYPE_MPEG2 = 5,
17+
AUDIO_CODING_TYPE_AACLC = 6,
18+
AUDIO_CODING_TYPE_DTS = 7,
19+
AUDIO_CODING_TYPE_ATRAC = 8,
20+
AUDIO_CODING_TYPE_SACD = 9,
21+
AUDIO_CODING_TYPE_EAC3 = 10,
22+
AUDIO_CODING_TYPE_DTS_HD = 11,
23+
AUDIO_CODING_TYPE_MLP = 12,
24+
AUDIO_CODING_TYPE_DST = 13,
25+
AUDIO_CODING_TYPE_WMAPRO = 14,
26+
AUDIO_CODING_TYPE_REF_CXT = 15,
27+
/* also include valid xtypes below */
28+
AUDIO_CODING_TYPE_HE_AAC = 15,
29+
AUDIO_CODING_TYPE_HE_AAC2 = 16,
30+
AUDIO_CODING_TYPE_MPEG_SURROUND = 17,
31+
};
32+
33+
enum cea_audio_coding_xtypes {
34+
AUDIO_CODING_XTYPE_HE_REF_CT = 0,
35+
AUDIO_CODING_XTYPE_HE_AAC = 1,
36+
AUDIO_CODING_XTYPE_HE_AAC2 = 2,
37+
AUDIO_CODING_XTYPE_MPEG_SURROUND = 3,
38+
AUDIO_CODING_XTYPE_FIRST_RESERVED = 4,
39+
};
40+
41+
/*
42+
* CEA Short Audio Descriptor data
43+
*/
44+
struct snd_cea_sad {
45+
int channels;
46+
int format; /* (format == 0) indicates invalid SAD */
47+
int rates;
48+
int sample_bits; /* for LPCM */
49+
int max_bitrate; /* for AC3...ATRAC */
50+
int profile; /* for WMAPRO */
51+
};
52+
53+
#define ELD_FIXED_BYTES 20
54+
#define ELD_MAX_SIZE 256
55+
#define ELD_MAX_MNL 16
56+
#define ELD_MAX_SAD 16
57+
58+
#define ELD_PCM_BITS_8 BIT(0)
59+
#define ELD_PCM_BITS_16 BIT(1)
60+
#define ELD_PCM_BITS_20 BIT(2)
61+
#define ELD_PCM_BITS_24 BIT(3)
62+
#define ELD_PCM_BITS_32 BIT(4)
63+
64+
/*
65+
* ELD: EDID Like Data
66+
*/
67+
struct snd_parsed_hdmi_eld {
68+
/*
69+
* all fields will be cleared before updating ELD
70+
*/
71+
int baseline_len;
72+
int eld_ver;
73+
int cea_edid_ver;
74+
char monitor_name[ELD_MAX_MNL + 1];
75+
int manufacture_id;
76+
int product_id;
77+
u64 port_id;
78+
int support_hdcp;
79+
int support_ai;
80+
int conn_type;
81+
int aud_synch_delay;
82+
int spk_alloc;
83+
int sad_count;
84+
struct snd_cea_sad sad[ELD_MAX_SAD];
85+
};
86+
587
int snd_pcm_hw_constraint_eld(struct snd_pcm_runtime *runtime, void *eld);
688

89+
int snd_parse_eld(struct device *dev, struct snd_parsed_hdmi_eld *e,
90+
const unsigned char *buf, int size);
91+
void snd_show_eld(struct device *dev, struct snd_parsed_hdmi_eld *e);
92+
93+
#ifdef CONFIG_SND_PROC_FS
94+
void snd_print_eld_info(struct snd_parsed_hdmi_eld *eld,
95+
struct snd_info_buffer *buffer);
96+
#endif
97+
798
#endif

0 commit comments

Comments
 (0)