Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Subhransu S. Prusty and committed by
Takashi Iwai
bb63f726 2f6e8a85

+35 -35
+7 -7
include/sound/hda_chmap.h
··· 59 59 60 60 void snd_hdac_register_chmap_ops(struct hdac_device *hdac, 61 61 struct hdac_chmap *chmap); 62 - int hdmi_channel_allocation(struct hdac_device *hdac, int spk_alloc, 62 + int snd_hdac_channel_allocation(struct hdac_device *hdac, int spk_alloc, 63 63 int channels, bool chmap_set, 64 64 bool non_pcm, unsigned char *map); 65 - int hdmi_get_active_channels(int ca); 66 - void hdmi_setup_channel_mapping(struct hdac_chmap *chmap, 65 + int snd_hdac_get_active_channels(int ca); 66 + void snd_hdac_setup_channel_mapping(struct hdac_chmap *chmap, 67 67 hda_nid_t pin_nid, bool non_pcm, int ca, 68 68 int channels, unsigned char *map, 69 69 bool chmap_set); 70 - void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen); 71 - struct hdac_cea_channel_speaker_allocation *hdmi_get_ch_alloc_from_ca(int ca); 72 - int to_spk_mask(unsigned char c); 73 - int spk_to_chmap(int spk); 70 + void snd_hdac_print_channel_allocation(int spk_alloc, char *buf, int buflen); 71 + struct hdac_cea_channel_speaker_allocation *snd_hdac_get_ch_alloc_from_ca(int ca); 72 + int snd_hdac_chmap_to_spk_mask(unsigned char c); 73 + int snd_hdac_spk_to_chmap(int spk); 74 74 int snd_hdac_add_chmap_ctls(struct snd_pcm *pcm, int pcm_idx, 75 75 struct hdac_chmap *chmap); 76 76 #endif /* __SOUND_HDA_CHMAP_H */
+19 -19
sound/hda/hdmi_chmap.c
··· 243 243 return i; 244 244 } 245 245 246 - void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen) 246 + void snd_hdac_print_channel_allocation(int spk_alloc, char *buf, int buflen) 247 247 { 248 248 int i, j; 249 249 ··· 254 254 } 255 255 buf[j] = '\0'; /* necessary when j == 0 */ 256 256 } 257 - EXPORT_SYMBOL_GPL(snd_print_channel_allocation); 257 + EXPORT_SYMBOL_GPL(snd_hdac_print_channel_allocation); 258 258 259 259 /* 260 260 * The transformation takes two steps: ··· 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 316 dev_dbg(&codec->dev, "HDMI: select CA 0x%x for %d-channel allocation: %s\n", 317 317 ca, channels, buf); 318 318 ··· 412 412 }; 413 413 414 414 /* from ALSA API channel position to speaker bit mask */ 415 - int to_spk_mask(unsigned char c) 415 + int snd_hdac_chmap_to_spk_mask(unsigned char c) 416 416 { 417 417 struct channel_map_table *t = map_tables; 418 418 ··· 422 422 } 423 423 return 0; 424 424 } 425 - EXPORT_SYMBOL_GPL(to_spk_mask); 425 + EXPORT_SYMBOL_GPL(snd_hdac_chmap_to_spk_mask); 426 426 427 427 /* from ALSA API channel position to CEA slot */ 428 428 static 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 431 int i; 432 432 433 433 if (mask) { ··· 441 441 } 442 442 443 443 /* from speaker bit mask to ALSA API channel position */ 444 - int spk_to_chmap(int spk) 444 + int snd_hdac_spk_to_chmap(int spk) 445 445 { 446 446 struct channel_map_table *t = map_tables; 447 447 ··· 451 451 } 452 452 return 0; 453 453 } 454 - EXPORT_SYMBOL_GPL(spk_to_chmap); 454 + EXPORT_SYMBOL_GPL(snd_hdac_spk_to_chmap); 455 455 456 456 /* from CEA slot to ALSA API channel position */ 457 457 static int from_cea_slot(int ordered_ca, unsigned char slot) 458 458 { 459 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 464 /* get the CA index corresponding to the given ALSA API channel map */ ··· 467 467 int i, spks = 0, spk_mask = 0; 468 468 469 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 472 if (mask) { 473 473 spk_mask |= mask; ··· 530 530 } 531 531 } 532 532 533 - void hdmi_setup_channel_mapping(struct hdac_chmap *chmap, 533 + void snd_hdac_setup_channel_mapping(struct hdac_chmap *chmap, 534 534 hda_nid_t pin_nid, bool non_pcm, int ca, 535 535 int channels, unsigned char *map, 536 536 bool chmap_set) ··· 545 545 546 546 hdmi_debug_channel_mapping(chmap, pin_nid); 547 547 } 548 - EXPORT_SYMBOL_GPL(hdmi_setup_channel_mapping); 548 + EXPORT_SYMBOL_GPL(snd_hdac_setup_channel_mapping); 549 549 550 - int hdmi_get_active_channels(int ca) 550 + int snd_hdac_get_active_channels(int ca) 551 551 { 552 552 int ordered_ca = get_channel_allocation_order(ca); 553 553 554 554 return channel_allocations[ordered_ca].channels; 555 555 } 556 - EXPORT_SYMBOL_GPL(hdmi_get_active_channels); 556 + EXPORT_SYMBOL_GPL(snd_hdac_get_active_channels); 557 557 558 - struct hdac_cea_channel_speaker_allocation *hdmi_get_ch_alloc_from_ca(int ca) 558 + struct hdac_cea_channel_speaker_allocation *snd_hdac_get_ch_alloc_from_ca(int ca) 559 559 { 560 560 return &channel_allocations[get_channel_allocation_order(ca)]; 561 561 } 562 - EXPORT_SYMBOL_GPL(hdmi_get_ch_alloc_from_ca); 562 + EXPORT_SYMBOL_GPL(snd_hdac_get_ch_alloc_from_ca); 563 563 564 - int hdmi_channel_allocation(struct hdac_device *hdac, int spk_alloc, 564 + int snd_hdac_channel_allocation(struct hdac_device *hdac, int spk_alloc, 565 565 int channels, bool chmap_set, bool non_pcm, unsigned char *map) 566 566 { 567 567 int ca; ··· 577 577 578 578 return ca; 579 579 } 580 - EXPORT_SYMBOL_GPL(hdmi_channel_allocation); 580 + EXPORT_SYMBOL_GPL(snd_hdac_channel_allocation); 581 581 582 582 /* 583 583 * ALSA API channel-map control callbacks ··· 619 619 if (!spk) 620 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 625 WARN_ON(count != channels);
+2 -2
sound/pci/hda/hda_eld.c
··· 416 416 417 417 if (e->spk_alloc) { 418 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 420 codec_dbg(codec, "HDMI: available speakers:%s\n", buf); 421 421 } 422 422 ··· 491 491 snd_iprintf(buffer, "support_ai\t\t%d\n", e->support_ai); 492 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 495 snd_iprintf(buffer, "speakers\t\t[0x%x]%s\n", e->spk_alloc, buf); 496 496 497 497 snd_iprintf(buffer, "sad_count\t\t%d\n", e->sad_count);
+7 -7
sound/pci/hda/patch_hdmi.c
··· 687 687 688 688 eld = &per_pin->sink_eld; 689 689 690 - ca = hdmi_channel_allocation(&codec->core, 690 + ca = snd_hdac_channel_allocation(&codec->core, 691 691 eld->info.spk_alloc, channels, 692 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 696 chmap->ops.set_channel_count(&codec->core, per_pin->cvt_nid, 697 697 active_channels); ··· 700 700 * always configure channel mapping, it may have been changed by the 701 701 * user in the meantime 702 702 */ 703 - hdmi_setup_channel_mapping(&spec->chmap, 703 + snd_hdac_setup_channel_mapping(&spec->chmap, 704 704 pin_nid, non_pcm, ca, channels, 705 705 per_pin->chmap, per_pin->chmap_set); 706 706 ··· 3115 3115 3116 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 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 3121 bool ok = false; 3122 3122 bool companion_ok = false; 3123 3123 ··· 3133 3133 if (i % 2 == 0 && i + 1 < chs) { 3134 3134 /* even channel, check the odd companion */ 3135 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 3137 int comp_mask_act = cap->speakers[comp_chan_idx]; 3138 3138 3139 3139 if (comp_mask_req == comp_mask_act) ··· 3270 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 3276 WARN_ON(count != channels);