History

ALSA: hda - Use snd_hdac namespace prefix for chmap exported APIs

Subhransu S. Prusty committed 10 years ago

Commit bb63f721 parent 2f6e8a84 files · +35 −35Browse files

Unified · Split

4 files
  1. include/sound/hda_chmap.h +7 −7
  2. sound/hda/hdmi_chmap.c +19 −19
  3. sound/pci/hda/hda_eld.c +2 −2
  4. sound/pci/hda/patch_hdmi.c +7 −7
include/sound/hda_chmap.h+7−7
@@ -59,18 +59,18 @@ struct hdac_chmap { · 58 unmodified lines
59 59
60void snd_hdac_register_chmap_ops(struct hdac_device *hdac,60void snd_hdac_register_chmap_ops(struct hdac_device *hdac,
61 struct hdac_chmap *chmap);61 struct hdac_chmap *chmap);
62int hdmi_channel_allocation(struct hdac_device *hdac, int spk_alloc,62int snd_hdac_channel_allocation(struct hdac_device *hdac, int spk_alloc,
63 int channels, bool chmap_set,63 int channels, bool chmap_set,
64 bool non_pcm, unsigned char *map);64 bool non_pcm, unsigned char *map);
65int hdmi_get_active_channels(int ca);65int snd_hdac_get_active_channels(int ca);
66void hdmi_setup_channel_mapping(struct hdac_chmap *chmap,66void snd_hdac_setup_channel_mapping(struct hdac_chmap *chmap,
67 hda_nid_t pin_nid, bool non_pcm, int ca,67 hda_nid_t pin_nid, bool non_pcm, int ca,
68 int channels, unsigned char *map,68 int channels, unsigned char *map,
69 bool chmap_set);69 bool chmap_set);
70void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen);70void snd_hdac_print_channel_allocation(int spk_alloc, char *buf, int buflen);
71struct hdac_cea_channel_speaker_allocation *hdmi_get_ch_alloc_from_ca(int ca);71struct hdac_cea_channel_speaker_allocation *snd_hdac_get_ch_alloc_from_ca(int ca);
72int to_spk_mask(unsigned char c);72int snd_hdac_chmap_to_spk_mask(unsigned char c);
73int spk_to_chmap(int spk);73int snd_hdac_spk_to_chmap(int spk);
74int snd_hdac_add_chmap_ctls(struct snd_pcm *pcm, int pcm_idx,74int snd_hdac_add_chmap_ctls(struct snd_pcm *pcm, int pcm_idx,
75 struct hdac_chmap *chmap);75 struct hdac_chmap *chmap);
76#endif /* __SOUND_HDA_CHMAP_H */76#endif /* __SOUND_HDA_CHMAP_H */
sound/hda/hdmi_chmap.c+19−19
@@ -243,7 +243,7 @@ static int get_channel_allocation_order(int ca) · 242 unmodified lines
243 return i;243 return i;
244}244}
245 245
246void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen)246void snd_hdac_print_channel_allocation(int spk_alloc, char *buf, int buflen)
247{247{
248 int i, j;248 int i, j;
249 249
@@ -254,7 +254,7 @@ void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen) · 4 unmodified lines
254 }254 }
255 buf[j] = '\0'; /* necessary when j == 0 */255 buf[j] = '\0'; /* necessary when j == 0 */
256}256}
257EXPORT_SYMBOL_GPL(snd_print_channel_allocation);257EXPORT_SYMBOL_GPL(snd_hdac_print_channel_allocation);
258 258
259/*259/*
260 * The transformation takes two steps:260 * The transformation takes two steps:
@@ -312,7 +312,7 @@ static int hdmi_channel_allocation_spk_alloc_blk(struct hdac_device *codec, · 51 unmodified lines
312 }312 }
313 }313 }
314 314
315 snd_print_channel_allocation(spk_alloc, buf, sizeof(buf));315 snd_hdac_print_channel_allocation(spk_alloc, buf, sizeof(buf));
316 dev_dbg(&codec->dev, "HDMI: select CA 0x%x for %d-channel allocation: %s\n",316 dev_dbg(&codec->dev, "HDMI: select CA 0x%x for %d-channel allocation: %s\n",
317 ca, channels, buf);317 ca, channels, buf);
318 318
@@ -412,7 +412,7 @@ static struct channel_map_table map_tables[] = { · 93 unmodified lines
412};412};
413 413
414/* from ALSA API channel position to speaker bit mask */414/* from ALSA API channel position to speaker bit mask */
415int to_spk_mask(unsigned char c)415int snd_hdac_chmap_to_spk_mask(unsigned char c)
416{416{
417 struct channel_map_table *t = map_tables;417 struct channel_map_table *t = map_tables;
418 418
@@ -422,12 +422,12 @@ int to_spk_mask(unsigned char c) · 3 unmodified lines
422 }422 }
423 return 0;423 return 0;
424}424}
425EXPORT_SYMBOL_GPL(to_spk_mask);425EXPORT_SYMBOL_GPL(snd_hdac_chmap_to_spk_mask);
426 426
427/* from ALSA API channel position to CEA slot */427/* from ALSA API channel position to CEA slot */
428static int to_cea_slot(int ordered_ca, unsigned char pos)428static int to_cea_slot(int ordered_ca, unsigned char pos)
429{429{
430 int mask = to_spk_mask(pos);430 int mask = snd_hdac_chmap_to_spk_mask(pos);
431 int i;431 int i;
432 432
433 if (mask) {433 if (mask) {
@@ -441,7 +441,7 @@ static int to_cea_slot(int ordered_ca, unsigned char pos) · 7 unmodified lines
441}441}
442 442
443/* from speaker bit mask to ALSA API channel position */443/* from speaker bit mask to ALSA API channel position */
444int spk_to_chmap(int spk)444int snd_hdac_spk_to_chmap(int spk)
445{445{
446 struct channel_map_table *t = map_tables;446 struct channel_map_table *t = map_tables;
447 447
@@ -451,14 +451,14 @@ int spk_to_chmap(int spk) · 3 unmodified lines
451 }451 }
452 return 0;452 return 0;
453}453}
454EXPORT_SYMBOL_GPL(spk_to_chmap);454EXPORT_SYMBOL_GPL(snd_hdac_spk_to_chmap);
455 455
456/* from CEA slot to ALSA API channel position */456/* from CEA slot to ALSA API channel position */
457static int from_cea_slot(int ordered_ca, unsigned char slot)457static int from_cea_slot(int ordered_ca, unsigned char slot)
458{458{
459 int mask = channel_allocations[ordered_ca].speakers[7 - slot];459 int mask = channel_allocations[ordered_ca].speakers[7 - slot];
460 460
461 return spk_to_chmap(mask);461 return snd_hdac_spk_to_chmap(mask);
462}462}
463 463
464/* get the CA index corresponding to the given ALSA API channel map */464/* get the CA index corresponding to the given ALSA API channel map */
@@ -467,7 +467,7 @@ static int hdmi_manual_channel_allocation(int chs, unsigned char *map) · 2 unmodified lines
467 int i, spks = 0, spk_mask = 0;467 int i, spks = 0, spk_mask = 0;
468 468
469 for (i = 0; i < chs; i++) {469 for (i = 0; i < chs; i++) {
470 int mask = to_spk_mask(map[i]);470 int mask = snd_hdac_chmap_to_spk_mask(map[i]);
471 471
472 if (mask) {472 if (mask) {
473 spk_mask |= mask;473 spk_mask |= mask;
@@ -530,7 +530,7 @@ static void hdmi_setup_fake_chmap(unsigned char *map, int ca) · 56 unmodified lines
530 }530 }
531}531}
532 532
533void hdmi_setup_channel_mapping(struct hdac_chmap *chmap,533void snd_hdac_setup_channel_mapping(struct hdac_chmap *chmap,
534 hda_nid_t pin_nid, bool non_pcm, int ca,534 hda_nid_t pin_nid, bool non_pcm, int ca,
535 int channels, unsigned char *map,535 int channels, unsigned char *map,
536 bool chmap_set)536 bool chmap_set)
@@ -545,23 +545,23 @@ void hdmi_setup_channel_mapping(struct hdac_chmap *chmap, · 8 unmodified lines
545 545
546 hdmi_debug_channel_mapping(chmap, pin_nid);546 hdmi_debug_channel_mapping(chmap, pin_nid);
547}547}
548EXPORT_SYMBOL_GPL(hdmi_setup_channel_mapping);548EXPORT_SYMBOL_GPL(snd_hdac_setup_channel_mapping);
549 549
550int hdmi_get_active_channels(int ca)550int snd_hdac_get_active_channels(int ca)
551{551{
552 int ordered_ca = get_channel_allocation_order(ca);552 int ordered_ca = get_channel_allocation_order(ca);
553 553
554 return channel_allocations[ordered_ca].channels;554 return channel_allocations[ordered_ca].channels;
555}555}
556EXPORT_SYMBOL_GPL(hdmi_get_active_channels);556EXPORT_SYMBOL_GPL(snd_hdac_get_active_channels);
557 557
558struct hdac_cea_channel_speaker_allocation *hdmi_get_ch_alloc_from_ca(int ca)558struct hdac_cea_channel_speaker_allocation *snd_hdac_get_ch_alloc_from_ca(int ca)
559{559{
560 return &channel_allocations[get_channel_allocation_order(ca)];560 return &channel_allocations[get_channel_allocation_order(ca)];
561}561}
562EXPORT_SYMBOL_GPL(hdmi_get_ch_alloc_from_ca);562EXPORT_SYMBOL_GPL(snd_hdac_get_ch_alloc_from_ca);
563 563
564int hdmi_channel_allocation(struct hdac_device *hdac, int spk_alloc,564int snd_hdac_channel_allocation(struct hdac_device *hdac, int spk_alloc,
565 int channels, bool chmap_set, bool non_pcm, unsigned char *map)565 int channels, bool chmap_set, bool non_pcm, unsigned char *map)
566{566{
567 int ca;567 int ca;
@@ -577,7 +577,7 @@ int hdmi_channel_allocation(struct hdac_device *hdac, int spk_alloc, · 9 unmodified lines
577 577
578 return ca;578 return ca;
579}579}
580EXPORT_SYMBOL_GPL(hdmi_channel_allocation);580EXPORT_SYMBOL_GPL(snd_hdac_channel_allocation);
581 581
582/*582/*
583 * ALSA API channel-map control callbacks583 * ALSA API channel-map control callbacks
@@ -619,7 +619,7 @@ static void hdmi_cea_alloc_to_tlv_chmap(struct hdac_chmap *hchmap, · 35 unmodified lines
619 if (!spk)619 if (!spk)
620 continue;620 continue;
621 621
622 chmap[count++] = spk_to_chmap(spk);622 chmap[count++] = snd_hdac_spk_to_chmap(spk);
623 }623 }
624 624
625 WARN_ON(count != channels);625 WARN_ON(count != channels);
sound/pci/hda/hda_eld.c+2−2
@@ -416,7 +416,7 @@ void snd_hdmi_show_eld(struct hda_codec *codec, struct parsed_hdmi_eld *e) · 415 unmodified lines
416 416
417 if (e->spk_alloc) {417 if (e->spk_alloc) {
418 char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE];418 char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE];
419 snd_print_channel_allocation(e->spk_alloc, buf, sizeof(buf));419 snd_hdac_print_channel_allocation(e->spk_alloc, buf, sizeof(buf));
420 codec_dbg(codec, "HDMI: available speakers:%s\n", buf);420 codec_dbg(codec, "HDMI: available speakers:%s\n", buf);
421 }421 }
422 422
@@ -491,7 +491,7 @@ void snd_hdmi_print_eld_info(struct hdmi_eld *eld, · 68 unmodified lines
491 snd_iprintf(buffer, "support_ai\t\t%d\n", e->support_ai);491 snd_iprintf(buffer, "support_ai\t\t%d\n", e->support_ai);
492 snd_iprintf(buffer, "audio_sync_delay\t%d\n", e->aud_synch_delay);492 snd_iprintf(buffer, "audio_sync_delay\t%d\n", e->aud_synch_delay);
493 493
494 snd_print_channel_allocation(e->spk_alloc, buf, sizeof(buf));494 snd_hdac_print_channel_allocation(e->spk_alloc, buf, sizeof(buf));
495 snd_iprintf(buffer, "speakers\t\t[0x%x]%s\n", e->spk_alloc, buf);495 snd_iprintf(buffer, "speakers\t\t[0x%x]%s\n", e->spk_alloc, buf);
496 496
497 snd_iprintf(buffer, "sad_count\t\t%d\n", e->sad_count);497 snd_iprintf(buffer, "sad_count\t\t%d\n", e->sad_count);
sound/pci/hda/patch_hdmi.c+7−7
@@ -687,11 +687,11 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, · 686 unmodified lines
687 687
688 eld = &per_pin->sink_eld;688 eld = &per_pin->sink_eld;
689 689
690 ca = hdmi_channel_allocation(&codec->core,690 ca = snd_hdac_channel_allocation(&codec->core,
691 eld->info.spk_alloc, channels,691 eld->info.spk_alloc, channels,
692 per_pin->chmap_set, non_pcm, per_pin->chmap);692 per_pin->chmap_set, non_pcm, per_pin->chmap);
693 693
694 active_channels = hdmi_get_active_channels(ca);694 active_channels = snd_hdac_get_active_channels(ca);
695 695
696 chmap->ops.set_channel_count(&codec->core, per_pin->cvt_nid,696 chmap->ops.set_channel_count(&codec->core, per_pin->cvt_nid,
697 active_channels);697 active_channels);
@@ -700,7 +700,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, · 2 unmodified lines
700 * always configure channel mapping, it may have been changed by the700 * always configure channel mapping, it may have been changed by the
701 * user in the meantime701 * user in the meantime
702 */702 */
703 hdmi_setup_channel_mapping(&spec->chmap,703 snd_hdac_setup_channel_mapping(&spec->chmap,
704 pin_nid, non_pcm, ca, channels,704 pin_nid, non_pcm, ca, channels,
705 per_pin->chmap, per_pin->chmap_set);705 per_pin->chmap, per_pin->chmap_set);
706 706
@@ -3115,9 +3115,9 @@ static int atihdmi_paired_chmap_validate(struct hdac_chmap *chmap, · 2408 unmodified lines
3115 3115
3116 /* check that only channel pairs need to be remapped on old pre-rev3 ATI/AMD */3116 /* check that only channel pairs need to be remapped on old pre-rev3 ATI/AMD */
3117 3117
3118 cap = hdmi_get_ch_alloc_from_ca(ca);3118 cap = snd_hdac_get_ch_alloc_from_ca(ca);
3119 for (i = 0; i < chs; ++i) {3119 for (i = 0; i < chs; ++i) {
3120 int mask = to_spk_mask(map[i]);3120 int mask = snd_hdac_chmap_to_spk_mask(map[i]);
3121 bool ok = false;3121 bool ok = false;
3122 bool companion_ok = false;3122 bool companion_ok = false;
3123 3123
@@ -3133,7 +3133,7 @@ static int atihdmi_paired_chmap_validate(struct hdac_chmap *chmap, · 9 unmodified lines
3133 if (i % 2 == 0 && i + 1 < chs) {3133 if (i % 2 == 0 && i + 1 < chs) {
3134 /* even channel, check the odd companion */3134 /* even channel, check the odd companion */
3135 int comp_chan_idx = 7 - atihdmi_paired_swap_fc_lfe(j + 1);3135 int comp_chan_idx = 7 - atihdmi_paired_swap_fc_lfe(j + 1);
3136 int comp_mask_req = to_spk_mask(map[i+1]);3136 int comp_mask_req = snd_hdac_chmap_to_spk_mask(map[i+1]);
3137 int comp_mask_act = cap->speakers[comp_chan_idx];3137 int comp_mask_act = cap->speakers[comp_chan_idx];
3138 3138
3139 if (comp_mask_req == comp_mask_act)3139 if (comp_mask_req == comp_mask_act)
@@ -3270,7 +3270,7 @@ static void atihdmi_paired_cea_alloc_to_tlv_chmap(struct hdac_chmap *hchmap, · 130 unmodified lines
3270 continue;3270 continue;
3271 }3271 }
3272 3272
3273 chmap[count++] = spk_to_chmap(spk);3273 chmap[count++] = snd_hdac_spk_to_chmap(spk);
3274 }3274 }
3275 3275
3276 WARN_ON(count != channels);3276 WARN_ON(count != channels);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t