pcm_drm_eld.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * PCM DRM helpers
  4. */
  5. #include <linux/bitfield.h>
  6. #include <linux/export.h>
  7. #include <linux/hdmi.h>
  8. #include <linux/unaligned.h>
  9. #include <drm/drm_edid.h>
  10. #include <drm/drm_eld.h>
  11. #include <sound/info.h>
  12. #include <sound/pcm.h>
  13. #include <sound/pcm_drm_eld.h>
  14. #define SAD0_CHANNELS_MASK GENMASK(2, 0) /* max number of channels - 1 */
  15. #define SAD0_FORMAT_MASK GENMASK(6, 3) /* audio format */
  16. #define SAD1_RATE_MASK GENMASK(6, 0) /* bitfield of supported rates */
  17. #define SAD1_RATE_32000_MASK BIT(0)
  18. #define SAD1_RATE_44100_MASK BIT(1)
  19. #define SAD1_RATE_48000_MASK BIT(2)
  20. #define SAD1_RATE_88200_MASK BIT(3)
  21. #define SAD1_RATE_96000_MASK BIT(4)
  22. #define SAD1_RATE_176400_MASK BIT(5)
  23. #define SAD1_RATE_192000_MASK BIT(6)
  24. static const unsigned int eld_rates[] = {
  25. 32000,
  26. 44100,
  27. 48000,
  28. 88200,
  29. 96000,
  30. 176400,
  31. 192000,
  32. };
  33. static unsigned int map_rate_families(const u8 *sad,
  34. unsigned int mask_32000,
  35. unsigned int mask_44100,
  36. unsigned int mask_48000)
  37. {
  38. unsigned int rate_mask = 0;
  39. if (sad[1] & SAD1_RATE_32000_MASK)
  40. rate_mask |= mask_32000;
  41. if (sad[1] & (SAD1_RATE_44100_MASK | SAD1_RATE_88200_MASK | SAD1_RATE_176400_MASK))
  42. rate_mask |= mask_44100;
  43. if (sad[1] & (SAD1_RATE_48000_MASK | SAD1_RATE_96000_MASK | SAD1_RATE_192000_MASK))
  44. rate_mask |= mask_48000;
  45. return rate_mask;
  46. }
  47. static unsigned int sad_rate_mask(const u8 *sad)
  48. {
  49. switch (FIELD_GET(SAD0_FORMAT_MASK, sad[0])) {
  50. case HDMI_AUDIO_CODING_TYPE_PCM:
  51. return sad[1] & SAD1_RATE_MASK;
  52. case HDMI_AUDIO_CODING_TYPE_AC3:
  53. case HDMI_AUDIO_CODING_TYPE_DTS:
  54. return map_rate_families(sad,
  55. SAD1_RATE_32000_MASK,
  56. SAD1_RATE_44100_MASK,
  57. SAD1_RATE_48000_MASK);
  58. case HDMI_AUDIO_CODING_TYPE_EAC3:
  59. case HDMI_AUDIO_CODING_TYPE_DTS_HD:
  60. case HDMI_AUDIO_CODING_TYPE_MLP:
  61. return map_rate_families(sad,
  62. 0,
  63. SAD1_RATE_176400_MASK,
  64. SAD1_RATE_192000_MASK);
  65. default:
  66. /* TODO adjust for other compressed formats as well */
  67. return sad[1] & SAD1_RATE_MASK;
  68. }
  69. }
  70. static unsigned int sad_max_channels(const u8 *sad)
  71. {
  72. switch (FIELD_GET(SAD0_FORMAT_MASK, sad[0])) {
  73. case HDMI_AUDIO_CODING_TYPE_PCM:
  74. return 1 + FIELD_GET(SAD0_CHANNELS_MASK, sad[0]);
  75. case HDMI_AUDIO_CODING_TYPE_AC3:
  76. case HDMI_AUDIO_CODING_TYPE_DTS:
  77. case HDMI_AUDIO_CODING_TYPE_EAC3:
  78. return 2;
  79. case HDMI_AUDIO_CODING_TYPE_DTS_HD:
  80. case HDMI_AUDIO_CODING_TYPE_MLP:
  81. return 8;
  82. default:
  83. /* TODO adjust for other compressed formats as well */
  84. return 1 + FIELD_GET(SAD0_CHANNELS_MASK, sad[0]);
  85. }
  86. }
  87. static int eld_limit_rates(struct snd_pcm_hw_params *params,
  88. struct snd_pcm_hw_rule *rule)
  89. {
  90. struct snd_interval *r = hw_param_interval(params, rule->var);
  91. const struct snd_interval *c;
  92. unsigned int rate_mask = 7, i;
  93. const u8 *sad, *eld = rule->private;
  94. sad = drm_eld_sad(eld);
  95. if (sad) {
  96. c = hw_param_interval_c(params, SNDRV_PCM_HW_PARAM_CHANNELS);
  97. for (i = drm_eld_sad_count(eld); i > 0; i--, sad += 3) {
  98. unsigned max_channels = sad_max_channels(sad);
  99. /*
  100. * Exclude SADs which do not include the
  101. * requested number of channels.
  102. */
  103. if (c->min <= max_channels)
  104. rate_mask |= sad_rate_mask(sad);
  105. }
  106. }
  107. return snd_interval_list(r, ARRAY_SIZE(eld_rates), eld_rates,
  108. rate_mask);
  109. }
  110. static int eld_limit_channels(struct snd_pcm_hw_params *params,
  111. struct snd_pcm_hw_rule *rule)
  112. {
  113. struct snd_interval *c = hw_param_interval(params, rule->var);
  114. const struct snd_interval *r;
  115. struct snd_interval t = { .min = 1, .max = 2, .integer = 1, };
  116. unsigned int i;
  117. const u8 *sad, *eld = rule->private;
  118. sad = drm_eld_sad(eld);
  119. if (sad) {
  120. unsigned int rate_mask = 0;
  121. /* Convert the rate interval to a mask */
  122. r = hw_param_interval_c(params, SNDRV_PCM_HW_PARAM_RATE);
  123. for (i = 0; i < ARRAY_SIZE(eld_rates); i++)
  124. if (r->min <= eld_rates[i] && r->max >= eld_rates[i])
  125. rate_mask |= BIT(i);
  126. for (i = drm_eld_sad_count(eld); i > 0; i--, sad += 3)
  127. if (rate_mask & sad_rate_mask(sad))
  128. t.max = max(t.max, sad_max_channels(sad));
  129. }
  130. return snd_interval_refine(c, &t);
  131. }
  132. int snd_pcm_hw_constraint_eld(struct snd_pcm_runtime *runtime, void *eld)
  133. {
  134. int ret;
  135. ret = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
  136. eld_limit_rates, eld,
  137. SNDRV_PCM_HW_PARAM_CHANNELS, -1);
  138. if (ret < 0)
  139. return ret;
  140. ret = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
  141. eld_limit_channels, eld,
  142. SNDRV_PCM_HW_PARAM_RATE, -1);
  143. return ret;
  144. }
  145. EXPORT_SYMBOL_GPL(snd_pcm_hw_constraint_eld);
  146. #define SND_PRINT_RATES_ADVISED_BUFSIZE 80
  147. #define SND_PRINT_BITS_ADVISED_BUFSIZE 16
  148. #define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80
  149. static const char * const eld_connection_type_names[4] = {
  150. "HDMI",
  151. "DisplayPort",
  152. "2-reserved",
  153. "3-reserved"
  154. };
  155. static const char * const cea_audio_coding_type_names[] = {
  156. /* 0 */ "undefined",
  157. /* 1 */ "LPCM",
  158. /* 2 */ "AC-3",
  159. /* 3 */ "MPEG1",
  160. /* 4 */ "MP3",
  161. /* 5 */ "MPEG2",
  162. /* 6 */ "AAC-LC",
  163. /* 7 */ "DTS",
  164. /* 8 */ "ATRAC",
  165. /* 9 */ "DSD (One Bit Audio)",
  166. /* 10 */ "E-AC-3/DD+ (Dolby Digital Plus)",
  167. /* 11 */ "DTS-HD",
  168. /* 12 */ "MLP (Dolby TrueHD)",
  169. /* 13 */ "DST",
  170. /* 14 */ "WMAPro",
  171. /* 15 */ "HE-AAC",
  172. /* 16 */ "HE-AACv2",
  173. /* 17 */ "MPEG Surround",
  174. };
  175. static const char * const cea_speaker_allocation_names[] = {
  176. /* 0 */ "FL/FR",
  177. /* 1 */ "LFE",
  178. /* 2 */ "FC",
  179. /* 3 */ "RL/RR",
  180. /* 4 */ "RC",
  181. /* 5 */ "FLC/FRC",
  182. /* 6 */ "RLC/RRC",
  183. /* 7 */ "FLW/FRW",
  184. /* 8 */ "FLH/FRH",
  185. /* 9 */ "TC",
  186. /* 10 */ "FCH",
  187. };
  188. /*
  189. * SS1:SS0 index => sample size
  190. */
  191. static const int cea_sample_sizes[4] = {
  192. 0, /* 0: Refer to Stream Header */
  193. ELD_PCM_BITS_16, /* 1: 16 bits */
  194. ELD_PCM_BITS_20, /* 2: 20 bits */
  195. ELD_PCM_BITS_24, /* 3: 24 bits */
  196. };
  197. /*
  198. * SF2:SF1:SF0 index => sampling frequency
  199. */
  200. static const int cea_sampling_frequencies[8] = {
  201. 0, /* 0: Refer to Stream Header */
  202. SNDRV_PCM_RATE_32000, /* 1: 32000Hz */
  203. SNDRV_PCM_RATE_44100, /* 2: 44100Hz */
  204. SNDRV_PCM_RATE_48000, /* 3: 48000Hz */
  205. SNDRV_PCM_RATE_88200, /* 4: 88200Hz */
  206. SNDRV_PCM_RATE_96000, /* 5: 96000Hz */
  207. SNDRV_PCM_RATE_176400, /* 6: 176400Hz */
  208. SNDRV_PCM_RATE_192000, /* 7: 192000Hz */
  209. };
  210. #define GRAB_BITS(buf, byte, lowbit, bits) \
  211. ({ \
  212. BUILD_BUG_ON(lowbit > 7); \
  213. BUILD_BUG_ON(bits > 8); \
  214. BUILD_BUG_ON(bits <= 0); \
  215. \
  216. (buf[byte] >> (lowbit)) & ((1 << (bits)) - 1); \
  217. })
  218. static void hdmi_update_short_audio_desc(struct device *dev,
  219. struct snd_cea_sad *a,
  220. const unsigned char *buf)
  221. {
  222. int i;
  223. int val;
  224. val = GRAB_BITS(buf, 1, 0, 7);
  225. a->rates = 0;
  226. for (i = 0; i < 7; i++)
  227. if (val & (1 << i))
  228. a->rates |= cea_sampling_frequencies[i + 1];
  229. a->channels = GRAB_BITS(buf, 0, 0, 3);
  230. a->channels++;
  231. a->sample_bits = 0;
  232. a->max_bitrate = 0;
  233. a->format = GRAB_BITS(buf, 0, 3, 4);
  234. switch (a->format) {
  235. case AUDIO_CODING_TYPE_REF_STREAM_HEADER:
  236. dev_info(dev, "HDMI: audio coding type 0 not expected\n");
  237. break;
  238. case AUDIO_CODING_TYPE_LPCM:
  239. val = GRAB_BITS(buf, 2, 0, 3);
  240. for (i = 0; i < 3; i++)
  241. if (val & (1 << i))
  242. a->sample_bits |= cea_sample_sizes[i + 1];
  243. break;
  244. case AUDIO_CODING_TYPE_AC3:
  245. case AUDIO_CODING_TYPE_MPEG1:
  246. case AUDIO_CODING_TYPE_MP3:
  247. case AUDIO_CODING_TYPE_MPEG2:
  248. case AUDIO_CODING_TYPE_AACLC:
  249. case AUDIO_CODING_TYPE_DTS:
  250. case AUDIO_CODING_TYPE_ATRAC:
  251. a->max_bitrate = GRAB_BITS(buf, 2, 0, 8);
  252. a->max_bitrate *= 8000;
  253. break;
  254. case AUDIO_CODING_TYPE_SACD:
  255. break;
  256. case AUDIO_CODING_TYPE_EAC3:
  257. break;
  258. case AUDIO_CODING_TYPE_DTS_HD:
  259. break;
  260. case AUDIO_CODING_TYPE_MLP:
  261. break;
  262. case AUDIO_CODING_TYPE_DST:
  263. break;
  264. case AUDIO_CODING_TYPE_WMAPRO:
  265. a->profile = GRAB_BITS(buf, 2, 0, 3);
  266. break;
  267. case AUDIO_CODING_TYPE_REF_CXT:
  268. a->format = GRAB_BITS(buf, 2, 3, 5);
  269. if (a->format == AUDIO_CODING_XTYPE_HE_REF_CT ||
  270. a->format >= AUDIO_CODING_XTYPE_FIRST_RESERVED) {
  271. dev_info(dev,
  272. "HDMI: audio coding xtype %d not expected\n",
  273. a->format);
  274. a->format = 0;
  275. } else
  276. a->format += AUDIO_CODING_TYPE_HE_AAC -
  277. AUDIO_CODING_XTYPE_HE_AAC;
  278. break;
  279. }
  280. }
  281. /*
  282. * Be careful, ELD buf could be totally rubbish!
  283. */
  284. int snd_parse_eld(struct device *dev, struct snd_parsed_hdmi_eld *e,
  285. const unsigned char *buf, int size)
  286. {
  287. int mnl;
  288. int i;
  289. memset(e, 0, sizeof(*e));
  290. e->eld_ver = GRAB_BITS(buf, 0, 3, 5);
  291. if (e->eld_ver != ELD_VER_CEA_861D &&
  292. e->eld_ver != ELD_VER_PARTIAL) {
  293. dev_info(dev, "HDMI: Unknown ELD version %d\n", e->eld_ver);
  294. goto out_fail;
  295. }
  296. e->baseline_len = GRAB_BITS(buf, 2, 0, 8);
  297. mnl = GRAB_BITS(buf, 4, 0, 5);
  298. e->cea_edid_ver = GRAB_BITS(buf, 4, 5, 3);
  299. e->support_hdcp = GRAB_BITS(buf, 5, 0, 1);
  300. e->support_ai = GRAB_BITS(buf, 5, 1, 1);
  301. e->conn_type = GRAB_BITS(buf, 5, 2, 2);
  302. e->sad_count = GRAB_BITS(buf, 5, 4, 4);
  303. e->aud_synch_delay = GRAB_BITS(buf, 6, 0, 8) * 2;
  304. e->spk_alloc = GRAB_BITS(buf, 7, 0, 7);
  305. e->port_id = get_unaligned_le64(buf + 8);
  306. /* not specified, but the spec's tendency is little endian */
  307. e->manufacture_id = get_unaligned_le16(buf + 16);
  308. e->product_id = get_unaligned_le16(buf + 18);
  309. if (mnl > ELD_MAX_MNL) {
  310. dev_info(dev, "HDMI: MNL is reserved value %d\n", mnl);
  311. goto out_fail;
  312. } else if (ELD_FIXED_BYTES + mnl > size) {
  313. dev_info(dev, "HDMI: out of range MNL %d\n", mnl);
  314. goto out_fail;
  315. } else
  316. strscpy(e->monitor_name, buf + ELD_FIXED_BYTES, mnl + 1);
  317. for (i = 0; i < e->sad_count; i++) {
  318. if (ELD_FIXED_BYTES + mnl + 3 * (i + 1) > size) {
  319. dev_info(dev, "HDMI: out of range SAD %d\n", i);
  320. goto out_fail;
  321. }
  322. hdmi_update_short_audio_desc(dev, e->sad + i,
  323. buf + ELD_FIXED_BYTES + mnl + 3 * i);
  324. }
  325. /*
  326. * HDMI sink's ELD info cannot always be retrieved for now, e.g.
  327. * in console or for audio devices. Assume the highest speakers
  328. * configuration, to _not_ prohibit multi-channel audio playback.
  329. */
  330. if (!e->spk_alloc && e->sad_count)
  331. e->spk_alloc = 0xffff;
  332. return 0;
  333. out_fail:
  334. return -EINVAL;
  335. }
  336. EXPORT_SYMBOL_GPL(snd_parse_eld);
  337. /*
  338. * SNDRV_PCM_RATE_* and AC_PAR_PCM values don't match, print correct rates with
  339. * hdmi-specific routine.
  340. */
  341. static void hdmi_print_pcm_rates(int pcm, char *buf, int buflen)
  342. {
  343. static const unsigned int alsa_rates[] = {
  344. 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000,
  345. 88200, 96000, 176400, 192000, 384000
  346. };
  347. int i, j;
  348. for (i = 0, j = 0; i < ARRAY_SIZE(alsa_rates); i++)
  349. if (pcm & (1 << i))
  350. j += scnprintf(buf + j, buflen - j, " %d",
  351. alsa_rates[i]);
  352. buf[j] = '\0'; /* necessary when j == 0 */
  353. }
  354. static void eld_print_pcm_bits(int pcm, char *buf, int buflen)
  355. {
  356. static const unsigned int bits[] = { 8, 16, 20, 24, 32 };
  357. int i, j;
  358. for (i = 0, j = 0; i < ARRAY_SIZE(bits); i++)
  359. if (pcm & (ELD_PCM_BITS_8 << i))
  360. j += scnprintf(buf + j, buflen - j, " %d", bits[i]);
  361. buf[j] = '\0'; /* necessary when j == 0 */
  362. }
  363. static void hdmi_show_short_audio_desc(struct device *dev,
  364. struct snd_cea_sad *a)
  365. {
  366. char buf[SND_PRINT_RATES_ADVISED_BUFSIZE];
  367. char buf2[8 + SND_PRINT_BITS_ADVISED_BUFSIZE] = ", bits =";
  368. if (!a->format)
  369. return;
  370. hdmi_print_pcm_rates(a->rates, buf, sizeof(buf));
  371. if (a->format == AUDIO_CODING_TYPE_LPCM)
  372. eld_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2) - 8);
  373. else if (a->max_bitrate)
  374. snprintf(buf2, sizeof(buf2),
  375. ", max bitrate = %d", a->max_bitrate);
  376. else
  377. buf2[0] = '\0';
  378. dev_dbg(dev,
  379. "HDMI: supports coding type %s: channels = %d, rates =%s%s\n",
  380. cea_audio_coding_type_names[a->format],
  381. a->channels, buf, buf2);
  382. }
  383. static void snd_eld_print_channel_allocation(int spk_alloc, char *buf, int buflen)
  384. {
  385. int i, j;
  386. for (i = 0, j = 0; i < ARRAY_SIZE(cea_speaker_allocation_names); i++) {
  387. if (spk_alloc & (1 << i))
  388. j += scnprintf(buf + j, buflen - j, " %s",
  389. cea_speaker_allocation_names[i]);
  390. }
  391. buf[j] = '\0'; /* necessary when j == 0 */
  392. }
  393. void snd_show_eld(struct device *dev, struct snd_parsed_hdmi_eld *e)
  394. {
  395. int i;
  396. dev_dbg(dev, "HDMI: detected monitor %s at connection type %s\n",
  397. e->monitor_name,
  398. eld_connection_type_names[e->conn_type]);
  399. if (e->spk_alloc) {
  400. char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE];
  401. snd_eld_print_channel_allocation(e->spk_alloc, buf, sizeof(buf));
  402. dev_dbg(dev, "HDMI: available speakers:%s\n", buf);
  403. }
  404. for (i = 0; i < e->sad_count; i++)
  405. hdmi_show_short_audio_desc(dev, e->sad + i);
  406. }
  407. EXPORT_SYMBOL_GPL(snd_show_eld);
  408. #ifdef CONFIG_SND_PROC_FS
  409. static void hdmi_print_sad_info(int i, struct snd_cea_sad *a,
  410. struct snd_info_buffer *buffer)
  411. {
  412. char buf[SND_PRINT_RATES_ADVISED_BUFSIZE];
  413. snd_iprintf(buffer, "sad%d_coding_type\t[0x%x] %s\n",
  414. i, a->format, cea_audio_coding_type_names[a->format]);
  415. snd_iprintf(buffer, "sad%d_channels\t\t%d\n", i, a->channels);
  416. hdmi_print_pcm_rates(a->rates, buf, sizeof(buf));
  417. snd_iprintf(buffer, "sad%d_rates\t\t[0x%x]%s\n", i, a->rates, buf);
  418. if (a->format == AUDIO_CODING_TYPE_LPCM) {
  419. eld_print_pcm_bits(a->sample_bits, buf, sizeof(buf));
  420. snd_iprintf(buffer, "sad%d_bits\t\t[0x%x]%s\n",
  421. i, a->sample_bits, buf);
  422. }
  423. if (a->max_bitrate)
  424. snd_iprintf(buffer, "sad%d_max_bitrate\t%d\n",
  425. i, a->max_bitrate);
  426. if (a->profile)
  427. snd_iprintf(buffer, "sad%d_profile\t\t%d\n", i, a->profile);
  428. }
  429. void snd_print_eld_info(struct snd_parsed_hdmi_eld *e,
  430. struct snd_info_buffer *buffer)
  431. {
  432. char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE];
  433. int i;
  434. static const char * const eld_version_names[32] = {
  435. "reserved",
  436. "reserved",
  437. "CEA-861D or below",
  438. [3 ... 30] = "reserved",
  439. [31] = "partial"
  440. };
  441. static const char * const cea_edid_version_names[8] = {
  442. "no CEA EDID Timing Extension block present",
  443. "CEA-861",
  444. "CEA-861-A",
  445. "CEA-861-B, C or D",
  446. [4 ... 7] = "reserved"
  447. };
  448. snd_iprintf(buffer, "monitor_name\t\t%s\n", e->monitor_name);
  449. snd_iprintf(buffer, "connection_type\t\t%s\n",
  450. eld_connection_type_names[e->conn_type]);
  451. snd_iprintf(buffer, "eld_version\t\t[0x%x] %s\n", e->eld_ver,
  452. eld_version_names[e->eld_ver]);
  453. snd_iprintf(buffer, "edid_version\t\t[0x%x] %s\n", e->cea_edid_ver,
  454. cea_edid_version_names[e->cea_edid_ver]);
  455. snd_iprintf(buffer, "manufacture_id\t\t0x%x\n", e->manufacture_id);
  456. snd_iprintf(buffer, "product_id\t\t0x%x\n", e->product_id);
  457. snd_iprintf(buffer, "port_id\t\t\t0x%llx\n", (long long)e->port_id);
  458. snd_iprintf(buffer, "support_hdcp\t\t%d\n", e->support_hdcp);
  459. snd_iprintf(buffer, "support_ai\t\t%d\n", e->support_ai);
  460. snd_iprintf(buffer, "audio_sync_delay\t%d\n", e->aud_synch_delay);
  461. snd_eld_print_channel_allocation(e->spk_alloc, buf, sizeof(buf));
  462. snd_iprintf(buffer, "speakers\t\t[0x%x]%s\n", e->spk_alloc, buf);
  463. snd_iprintf(buffer, "sad_count\t\t%d\n", e->sad_count);
  464. for (i = 0; i < e->sad_count; i++)
  465. hdmi_print_sad_info(i, e->sad + i, buffer);
  466. }
  467. EXPORT_SYMBOL_GPL(snd_print_eld_info);
  468. #endif /* CONFIG_SND_PROC_FS */