Commit bb63f726 authored by Subhransu S. Prusty's avatar Subhransu S. Prusty Committed by Takashi Iwai

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

Signed-off-by: default avatarSubhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 2f6e8a85
...@@ -59,18 +59,18 @@ struct hdac_chmap { ...@@ -59,18 +59,18 @@ struct hdac_chmap {
void snd_hdac_register_chmap_ops(struct hdac_device *hdac, void snd_hdac_register_chmap_ops(struct hdac_device *hdac,
struct hdac_chmap *chmap); struct hdac_chmap *chmap);
int hdmi_channel_allocation(struct hdac_device *hdac, int spk_alloc, int snd_hdac_channel_allocation(struct hdac_device *hdac, int spk_alloc,
int channels, bool chmap_set, int channels, bool chmap_set,
bool non_pcm, unsigned char *map); bool non_pcm, unsigned char *map);
int hdmi_get_active_channels(int ca); int snd_hdac_get_active_channels(int ca);
void hdmi_setup_channel_mapping(struct hdac_chmap *chmap, void snd_hdac_setup_channel_mapping(struct hdac_chmap *chmap,
hda_nid_t pin_nid, bool non_pcm, int ca, hda_nid_t pin_nid, bool non_pcm, int ca,
int channels, unsigned char *map, int channels, unsigned char *map,
bool chmap_set); bool chmap_set);
void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen); void snd_hdac_print_channel_allocation(int spk_alloc, char *buf, int buflen);
struct hdac_cea_channel_speaker_allocation *hdmi_get_ch_alloc_from_ca(int ca); struct hdac_cea_channel_speaker_allocation *snd_hdac_get_ch_alloc_from_ca(int ca);
int to_spk_mask(unsigned char c); int snd_hdac_chmap_to_spk_mask(unsigned char c);
int spk_to_chmap(int spk); int snd_hdac_spk_to_chmap(int spk);
int snd_hdac_add_chmap_ctls(struct snd_pcm *pcm, int pcm_idx, int snd_hdac_add_chmap_ctls(struct snd_pcm *pcm, int pcm_idx,
struct hdac_chmap *chmap); struct hdac_chmap *chmap);
#endif /* __SOUND_HDA_CHMAP_H */ #endif /* __SOUND_HDA_CHMAP_H */
...@@ -243,7 +243,7 @@ static int get_channel_allocation_order(int ca) ...@@ -243,7 +243,7 @@ static int get_channel_allocation_order(int ca)
return i; return i;
} }
void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen) void snd_hdac_print_channel_allocation(int spk_alloc, char *buf, int buflen)
{ {
int i, j; int i, j;
...@@ -254,7 +254,7 @@ void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen) ...@@ -254,7 +254,7 @@ void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen)
} }
buf[j] = '\0'; /* necessary when j == 0 */ buf[j] = '\0'; /* necessary when j == 0 */
} }
EXPORT_SYMBOL_GPL(snd_print_channel_allocation); EXPORT_SYMBOL_GPL(snd_hdac_print_channel_allocation);
/* /*
* The transformation takes two steps: * The transformation takes two steps:
...@@ -312,7 +312,7 @@ static int hdmi_channel_allocation_spk_alloc_blk(struct hdac_device *codec, ...@@ -312,7 +312,7 @@ static int hdmi_channel_allocation_spk_alloc_blk(struct hdac_device *codec,
} }
} }
snd_print_channel_allocation(spk_alloc, buf, sizeof(buf)); snd_hdac_print_channel_allocation(spk_alloc, buf, sizeof(buf));
dev_dbg(&codec->dev, "HDMI: select CA 0x%x for %d-channel allocation: %s\n", dev_dbg(&codec->dev, "HDMI: select CA 0x%x for %d-channel allocation: %s\n",
ca, channels, buf); ca, channels, buf);
...@@ -412,7 +412,7 @@ static struct channel_map_table map_tables[] = { ...@@ -412,7 +412,7 @@ static struct channel_map_table map_tables[] = {
}; };
/* from ALSA API channel position to speaker bit mask */ /* from ALSA API channel position to speaker bit mask */
int to_spk_mask(unsigned char c) int snd_hdac_chmap_to_spk_mask(unsigned char c)
{ {
struct channel_map_table *t = map_tables; struct channel_map_table *t = map_tables;
...@@ -422,12 +422,12 @@ int to_spk_mask(unsigned char c) ...@@ -422,12 +422,12 @@ int to_spk_mask(unsigned char c)
} }
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(to_spk_mask); EXPORT_SYMBOL_GPL(snd_hdac_chmap_to_spk_mask);
/* from ALSA API channel position to CEA slot */ /* from ALSA API channel position to CEA slot */
static int to_cea_slot(int ordered_ca, unsigned char pos) static int to_cea_slot(int ordered_ca, unsigned char pos)
{ {
int mask = to_spk_mask(pos); int mask = snd_hdac_chmap_to_spk_mask(pos);
int i; int i;
if (mask) { if (mask) {
...@@ -441,7 +441,7 @@ static int to_cea_slot(int ordered_ca, unsigned char pos) ...@@ -441,7 +441,7 @@ static int to_cea_slot(int ordered_ca, unsigned char pos)
} }
/* from speaker bit mask to ALSA API channel position */ /* from speaker bit mask to ALSA API channel position */
int spk_to_chmap(int spk) int snd_hdac_spk_to_chmap(int spk)
{ {
struct channel_map_table *t = map_tables; struct channel_map_table *t = map_tables;
...@@ -451,14 +451,14 @@ int spk_to_chmap(int spk) ...@@ -451,14 +451,14 @@ int spk_to_chmap(int spk)
} }
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(spk_to_chmap); EXPORT_SYMBOL_GPL(snd_hdac_spk_to_chmap);
/* from CEA slot to ALSA API channel position */ /* from CEA slot to ALSA API channel position */
static int from_cea_slot(int ordered_ca, unsigned char slot) static int from_cea_slot(int ordered_ca, unsigned char slot)
{ {
int mask = channel_allocations[ordered_ca].speakers[7 - slot]; int mask = channel_allocations[ordered_ca].speakers[7 - slot];
return spk_to_chmap(mask); return snd_hdac_spk_to_chmap(mask);
} }
/* get the CA index corresponding to the given ALSA API channel map */ /* 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) ...@@ -467,7 +467,7 @@ static int hdmi_manual_channel_allocation(int chs, unsigned char *map)
int i, spks = 0, spk_mask = 0; int i, spks = 0, spk_mask = 0;
for (i = 0; i < chs; i++) { for (i = 0; i < chs; i++) {
int mask = to_spk_mask(map[i]); int mask = snd_hdac_chmap_to_spk_mask(map[i]);
if (mask) { if (mask) {
spk_mask |= mask; spk_mask |= mask;
...@@ -530,7 +530,7 @@ static void hdmi_setup_fake_chmap(unsigned char *map, int ca) ...@@ -530,7 +530,7 @@ static void hdmi_setup_fake_chmap(unsigned char *map, int ca)
} }
} }
void hdmi_setup_channel_mapping(struct hdac_chmap *chmap, void snd_hdac_setup_channel_mapping(struct hdac_chmap *chmap,
hda_nid_t pin_nid, bool non_pcm, int ca, hda_nid_t pin_nid, bool non_pcm, int ca,
int channels, unsigned char *map, int channels, unsigned char *map,
bool chmap_set) bool chmap_set)
...@@ -545,23 +545,23 @@ void hdmi_setup_channel_mapping(struct hdac_chmap *chmap, ...@@ -545,23 +545,23 @@ void hdmi_setup_channel_mapping(struct hdac_chmap *chmap,
hdmi_debug_channel_mapping(chmap, pin_nid); hdmi_debug_channel_mapping(chmap, pin_nid);
} }
EXPORT_SYMBOL_GPL(hdmi_setup_channel_mapping); EXPORT_SYMBOL_GPL(snd_hdac_setup_channel_mapping);
int hdmi_get_active_channels(int ca) int snd_hdac_get_active_channels(int ca)
{ {
int ordered_ca = get_channel_allocation_order(ca); int ordered_ca = get_channel_allocation_order(ca);
return channel_allocations[ordered_ca].channels; return channel_allocations[ordered_ca].channels;
} }
EXPORT_SYMBOL_GPL(hdmi_get_active_channels); EXPORT_SYMBOL_GPL(snd_hdac_get_active_channels);
struct hdac_cea_channel_speaker_allocation *hdmi_get_ch_alloc_from_ca(int ca) struct hdac_cea_channel_speaker_allocation *snd_hdac_get_ch_alloc_from_ca(int ca)
{ {
return &channel_allocations[get_channel_allocation_order(ca)]; return &channel_allocations[get_channel_allocation_order(ca)];
} }
EXPORT_SYMBOL_GPL(hdmi_get_ch_alloc_from_ca); EXPORT_SYMBOL_GPL(snd_hdac_get_ch_alloc_from_ca);
int hdmi_channel_allocation(struct hdac_device *hdac, int spk_alloc, int snd_hdac_channel_allocation(struct hdac_device *hdac, int spk_alloc,
int channels, bool chmap_set, bool non_pcm, unsigned char *map) int channels, bool chmap_set, bool non_pcm, unsigned char *map)
{ {
int ca; int ca;
...@@ -577,7 +577,7 @@ int hdmi_channel_allocation(struct hdac_device *hdac, int spk_alloc, ...@@ -577,7 +577,7 @@ int hdmi_channel_allocation(struct hdac_device *hdac, int spk_alloc,
return ca; return ca;
} }
EXPORT_SYMBOL_GPL(hdmi_channel_allocation); EXPORT_SYMBOL_GPL(snd_hdac_channel_allocation);
/* /*
* ALSA API channel-map control callbacks * ALSA API channel-map control callbacks
...@@ -619,7 +619,7 @@ static void hdmi_cea_alloc_to_tlv_chmap(struct hdac_chmap *hchmap, ...@@ -619,7 +619,7 @@ static void hdmi_cea_alloc_to_tlv_chmap(struct hdac_chmap *hchmap,
if (!spk) if (!spk)
continue; continue;
chmap[count++] = spk_to_chmap(spk); chmap[count++] = snd_hdac_spk_to_chmap(spk);
} }
WARN_ON(count != channels); WARN_ON(count != channels);
......
...@@ -416,7 +416,7 @@ void snd_hdmi_show_eld(struct hda_codec *codec, struct parsed_hdmi_eld *e) ...@@ -416,7 +416,7 @@ void snd_hdmi_show_eld(struct hda_codec *codec, struct parsed_hdmi_eld *e)
if (e->spk_alloc) { if (e->spk_alloc) {
char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE]; char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE];
snd_print_channel_allocation(e->spk_alloc, buf, sizeof(buf)); snd_hdac_print_channel_allocation(e->spk_alloc, buf, sizeof(buf));
codec_dbg(codec, "HDMI: available speakers:%s\n", buf); codec_dbg(codec, "HDMI: available speakers:%s\n", buf);
} }
...@@ -491,7 +491,7 @@ void snd_hdmi_print_eld_info(struct hdmi_eld *eld, ...@@ -491,7 +491,7 @@ void snd_hdmi_print_eld_info(struct hdmi_eld *eld,
snd_iprintf(buffer, "support_ai\t\t%d\n", e->support_ai); snd_iprintf(buffer, "support_ai\t\t%d\n", e->support_ai);
snd_iprintf(buffer, "audio_sync_delay\t%d\n", e->aud_synch_delay); snd_iprintf(buffer, "audio_sync_delay\t%d\n", e->aud_synch_delay);
snd_print_channel_allocation(e->spk_alloc, buf, sizeof(buf)); snd_hdac_print_channel_allocation(e->spk_alloc, buf, sizeof(buf));
snd_iprintf(buffer, "speakers\t\t[0x%x]%s\n", e->spk_alloc, buf); snd_iprintf(buffer, "speakers\t\t[0x%x]%s\n", e->spk_alloc, buf);
snd_iprintf(buffer, "sad_count\t\t%d\n", e->sad_count); snd_iprintf(buffer, "sad_count\t\t%d\n", e->sad_count);
......
...@@ -687,11 +687,11 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, ...@@ -687,11 +687,11 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
eld = &per_pin->sink_eld; eld = &per_pin->sink_eld;
ca = hdmi_channel_allocation(&codec->core, ca = snd_hdac_channel_allocation(&codec->core,
eld->info.spk_alloc, channels, eld->info.spk_alloc, channels,
per_pin->chmap_set, non_pcm, per_pin->chmap); per_pin->chmap_set, non_pcm, per_pin->chmap);
active_channels = hdmi_get_active_channels(ca); active_channels = snd_hdac_get_active_channels(ca);
chmap->ops.set_channel_count(&codec->core, per_pin->cvt_nid, chmap->ops.set_channel_count(&codec->core, per_pin->cvt_nid,
active_channels); active_channels);
...@@ -700,7 +700,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, ...@@ -700,7 +700,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
* always configure channel mapping, it may have been changed by the * always configure channel mapping, it may have been changed by the
* user in the meantime * user in the meantime
*/ */
hdmi_setup_channel_mapping(&spec->chmap, snd_hdac_setup_channel_mapping(&spec->chmap,
pin_nid, non_pcm, ca, channels, pin_nid, non_pcm, ca, channels,
per_pin->chmap, per_pin->chmap_set); per_pin->chmap, per_pin->chmap_set);
...@@ -3115,9 +3115,9 @@ static int atihdmi_paired_chmap_validate(struct hdac_chmap *chmap, ...@@ -3115,9 +3115,9 @@ static int atihdmi_paired_chmap_validate(struct hdac_chmap *chmap,
/* check that only channel pairs need to be remapped on old pre-rev3 ATI/AMD */ /* check that only channel pairs need to be remapped on old pre-rev3 ATI/AMD */
cap = hdmi_get_ch_alloc_from_ca(ca); cap = snd_hdac_get_ch_alloc_from_ca(ca);
for (i = 0; i < chs; ++i) { for (i = 0; i < chs; ++i) {
int mask = to_spk_mask(map[i]); int mask = snd_hdac_chmap_to_spk_mask(map[i]);
bool ok = false; bool ok = false;
bool companion_ok = false; bool companion_ok = false;
...@@ -3133,7 +3133,7 @@ static int atihdmi_paired_chmap_validate(struct hdac_chmap *chmap, ...@@ -3133,7 +3133,7 @@ static int atihdmi_paired_chmap_validate(struct hdac_chmap *chmap,
if (i % 2 == 0 && i + 1 < chs) { if (i % 2 == 0 && i + 1 < chs) {
/* even channel, check the odd companion */ /* even channel, check the odd companion */
int comp_chan_idx = 7 - atihdmi_paired_swap_fc_lfe(j + 1); int comp_chan_idx = 7 - atihdmi_paired_swap_fc_lfe(j + 1);
int comp_mask_req = to_spk_mask(map[i+1]); int comp_mask_req = snd_hdac_chmap_to_spk_mask(map[i+1]);
int comp_mask_act = cap->speakers[comp_chan_idx]; int comp_mask_act = cap->speakers[comp_chan_idx];
if (comp_mask_req == comp_mask_act) if (comp_mask_req == comp_mask_act)
...@@ -3270,7 +3270,7 @@ static void atihdmi_paired_cea_alloc_to_tlv_chmap(struct hdac_chmap *hchmap, ...@@ -3270,7 +3270,7 @@ static void atihdmi_paired_cea_alloc_to_tlv_chmap(struct hdac_chmap *hchmap,
continue; continue;
} }
chmap[count++] = spk_to_chmap(spk); chmap[count++] = snd_hdac_spk_to_chmap(spk);
} }
WARN_ON(count != channels); WARN_ON(count != channels);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment