Commit 79514d47 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Kill snd_printd*() in HDMI debug / info prints

Pass codec instance to each function that still prints info and debug
outputs via snd_printd*().
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent a53613a6
...@@ -167,7 +167,8 @@ static unsigned int hdmi_get_eld_data(struct hda_codec *codec, hda_nid_t nid, ...@@ -167,7 +167,8 @@ static unsigned int hdmi_get_eld_data(struct hda_codec *codec, hda_nid_t nid,
(buf[byte] >> (lowbit)) & ((1 << (bits)) - 1); \ (buf[byte] >> (lowbit)) & ((1 << (bits)) - 1); \
}) })
static void hdmi_update_short_audio_desc(struct cea_sad *a, static void hdmi_update_short_audio_desc(struct hda_codec *codec,
struct cea_sad *a,
const unsigned char *buf) const unsigned char *buf)
{ {
int i; int i;
...@@ -188,8 +189,7 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a, ...@@ -188,8 +189,7 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a,
a->format = GRAB_BITS(buf, 0, 3, 4); a->format = GRAB_BITS(buf, 0, 3, 4);
switch (a->format) { switch (a->format) {
case AUDIO_CODING_TYPE_REF_STREAM_HEADER: case AUDIO_CODING_TYPE_REF_STREAM_HEADER:
snd_printd(KERN_INFO codec_info(codec, "HDMI: audio coding type 0 not expected\n");
"HDMI: audio coding type 0 not expected\n");
break; break;
case AUDIO_CODING_TYPE_LPCM: case AUDIO_CODING_TYPE_LPCM:
...@@ -233,9 +233,9 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a, ...@@ -233,9 +233,9 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a,
a->format = GRAB_BITS(buf, 2, 3, 5); a->format = GRAB_BITS(buf, 2, 3, 5);
if (a->format == AUDIO_CODING_XTYPE_HE_REF_CT || if (a->format == AUDIO_CODING_XTYPE_HE_REF_CT ||
a->format >= AUDIO_CODING_XTYPE_FIRST_RESERVED) { a->format >= AUDIO_CODING_XTYPE_FIRST_RESERVED) {
snd_printd(KERN_INFO codec_info(codec,
"HDMI: audio coding xtype %d not expected\n", "HDMI: audio coding xtype %d not expected\n",
a->format); a->format);
a->format = 0; a->format = 0;
} else } else
a->format += AUDIO_CODING_TYPE_HE_AAC - a->format += AUDIO_CODING_TYPE_HE_AAC -
...@@ -247,7 +247,7 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a, ...@@ -247,7 +247,7 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a,
/* /*
* Be careful, ELD buf could be totally rubbish! * Be careful, ELD buf could be totally rubbish!
*/ */
int snd_hdmi_parse_eld(struct parsed_hdmi_eld *e, int snd_hdmi_parse_eld(struct hda_codec *codec, struct parsed_hdmi_eld *e,
const unsigned char *buf, int size) const unsigned char *buf, int size)
{ {
int mnl; int mnl;
...@@ -256,8 +256,7 @@ int snd_hdmi_parse_eld(struct parsed_hdmi_eld *e, ...@@ -256,8 +256,7 @@ int snd_hdmi_parse_eld(struct parsed_hdmi_eld *e,
e->eld_ver = GRAB_BITS(buf, 0, 3, 5); e->eld_ver = GRAB_BITS(buf, 0, 3, 5);
if (e->eld_ver != ELD_VER_CEA_861D && if (e->eld_ver != ELD_VER_CEA_861D &&
e->eld_ver != ELD_VER_PARTIAL) { e->eld_ver != ELD_VER_PARTIAL) {
snd_printd(KERN_INFO "HDMI: Unknown ELD version %d\n", codec_info(codec, "HDMI: Unknown ELD version %d\n", e->eld_ver);
e->eld_ver);
goto out_fail; goto out_fail;
} }
...@@ -280,20 +279,20 @@ int snd_hdmi_parse_eld(struct parsed_hdmi_eld *e, ...@@ -280,20 +279,20 @@ int snd_hdmi_parse_eld(struct parsed_hdmi_eld *e,
e->product_id = get_unaligned_le16(buf + 18); e->product_id = get_unaligned_le16(buf + 18);
if (mnl > ELD_MAX_MNL) { if (mnl > ELD_MAX_MNL) {
snd_printd(KERN_INFO "HDMI: MNL is reserved value %d\n", mnl); codec_info(codec, "HDMI: MNL is reserved value %d\n", mnl);
goto out_fail; goto out_fail;
} else if (ELD_FIXED_BYTES + mnl > size) { } else if (ELD_FIXED_BYTES + mnl > size) {
snd_printd(KERN_INFO "HDMI: out of range MNL %d\n", mnl); codec_info(codec, "HDMI: out of range MNL %d\n", mnl);
goto out_fail; goto out_fail;
} else } else
strlcpy(e->monitor_name, buf + ELD_FIXED_BYTES, mnl + 1); strlcpy(e->monitor_name, buf + ELD_FIXED_BYTES, mnl + 1);
for (i = 0; i < e->sad_count; i++) { for (i = 0; i < e->sad_count; i++) {
if (ELD_FIXED_BYTES + mnl + 3 * (i + 1) > size) { if (ELD_FIXED_BYTES + mnl + 3 * (i + 1) > size) {
snd_printd(KERN_INFO "HDMI: out of range SAD %d\n", i); codec_info(codec, "HDMI: out of range SAD %d\n", i);
goto out_fail; goto out_fail;
} }
hdmi_update_short_audio_desc(e->sad + i, hdmi_update_short_audio_desc(codec, e->sad + i,
buf + ELD_FIXED_BYTES + mnl + 3 * i); buf + ELD_FIXED_BYTES + mnl + 3 * i);
} }
...@@ -394,7 +393,8 @@ static void hdmi_print_pcm_rates(int pcm, char *buf, int buflen) ...@@ -394,7 +393,8 @@ static void hdmi_print_pcm_rates(int pcm, char *buf, int buflen)
#define SND_PRINT_RATES_ADVISED_BUFSIZE 80 #define SND_PRINT_RATES_ADVISED_BUFSIZE 80
static void hdmi_show_short_audio_desc(struct cea_sad *a) static void hdmi_show_short_audio_desc(struct hda_codec *codec,
struct cea_sad *a)
{ {
char buf[SND_PRINT_RATES_ADVISED_BUFSIZE]; char buf[SND_PRINT_RATES_ADVISED_BUFSIZE];
char buf2[8 + SND_PRINT_BITS_ADVISED_BUFSIZE] = ", bits ="; char buf2[8 + SND_PRINT_BITS_ADVISED_BUFSIZE] = ", bits =";
...@@ -412,12 +412,10 @@ static void hdmi_show_short_audio_desc(struct cea_sad *a) ...@@ -412,12 +412,10 @@ static void hdmi_show_short_audio_desc(struct cea_sad *a)
else else
buf2[0] = '\0'; buf2[0] = '\0';
_snd_printd(SND_PR_VERBOSE, "HDMI: supports coding type %s:" codec_dbg(codec,
" channels = %d, rates =%s%s\n", "HDMI: supports coding type %s: channels = %d, rates =%s%s\n",
cea_audio_coding_type_names[a->format], cea_audio_coding_type_names[a->format],
a->channels, a->channels, buf, buf2);
buf,
buf2);
} }
void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen) void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen)
...@@ -432,22 +430,22 @@ void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen) ...@@ -432,22 +430,22 @@ 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 */
} }
void snd_hdmi_show_eld(struct parsed_hdmi_eld *e) void snd_hdmi_show_eld(struct hda_codec *codec, struct parsed_hdmi_eld *e)
{ {
int i; int i;
_snd_printd(SND_PR_VERBOSE, "HDMI: detected monitor %s at connection type %s\n", codec_dbg(codec, "HDMI: detected monitor %s at connection type %s\n",
e->monitor_name, e->monitor_name,
eld_connection_type_names[e->conn_type]); eld_connection_type_names[e->conn_type]);
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_print_channel_allocation(e->spk_alloc, buf, sizeof(buf));
_snd_printd(SND_PR_VERBOSE, "HDMI: available speakers:%s\n", buf); codec_dbg(codec, "HDMI: available speakers:%s\n", buf);
} }
for (i = 0; i < e->sad_count; i++) for (i = 0; i < e->sad_count; i++)
hdmi_show_short_audio_desc(e->sad + i); hdmi_show_short_audio_desc(codec, e->sad + i);
} }
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
......
...@@ -752,9 +752,9 @@ struct hdmi_eld { ...@@ -752,9 +752,9 @@ struct hdmi_eld {
int snd_hdmi_get_eld_size(struct hda_codec *codec, hda_nid_t nid); int snd_hdmi_get_eld_size(struct hda_codec *codec, hda_nid_t nid);
int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid, int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid,
unsigned char *buf, int *eld_size); unsigned char *buf, int *eld_size);
int snd_hdmi_parse_eld(struct parsed_hdmi_eld *e, int snd_hdmi_parse_eld(struct hda_codec *codec, struct parsed_hdmi_eld *e,
const unsigned char *buf, int size); const unsigned char *buf, int size);
void snd_hdmi_show_eld(struct parsed_hdmi_eld *e); void snd_hdmi_show_eld(struct hda_codec *codec, struct parsed_hdmi_eld *e);
void snd_hdmi_eld_update_pcm_info(struct parsed_hdmi_eld *e, void snd_hdmi_eld_update_pcm_info(struct parsed_hdmi_eld *e,
struct hda_pcm_stream *hinfo); struct hda_pcm_stream *hinfo);
......
...@@ -648,7 +648,8 @@ static int get_channel_allocation_order(int ca) ...@@ -648,7 +648,8 @@ static int get_channel_allocation_order(int ca)
* *
* TODO: it could select the wrong CA from multiple candidates. * TODO: it could select the wrong CA from multiple candidates.
*/ */
static int hdmi_channel_allocation(struct hdmi_eld *eld, int channels) static int hdmi_channel_allocation(struct hda_codec *codec,
struct hdmi_eld *eld, int channels)
{ {
int i; int i;
int ca = 0; int ca = 0;
...@@ -694,7 +695,7 @@ static int hdmi_channel_allocation(struct hdmi_eld *eld, int channels) ...@@ -694,7 +695,7 @@ static int hdmi_channel_allocation(struct hdmi_eld *eld, int channels)
} }
snd_print_channel_allocation(eld->info.spk_alloc, buf, sizeof(buf)); snd_print_channel_allocation(eld->info.spk_alloc, buf, sizeof(buf));
snd_printdd("HDMI: select CA 0x%x for %d-channel allocation: %s\n", codec_dbg(codec, "HDMI: select CA 0x%x for %d-channel allocation: %s\n",
ca, channels, buf); ca, channels, buf);
return ca; return ca;
...@@ -1131,7 +1132,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, ...@@ -1131,7 +1132,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
if (!non_pcm && per_pin->chmap_set) if (!non_pcm && per_pin->chmap_set)
ca = hdmi_manual_channel_allocation(channels, per_pin->chmap); ca = hdmi_manual_channel_allocation(channels, per_pin->chmap);
else else
ca = hdmi_channel_allocation(eld, channels); ca = hdmi_channel_allocation(codec, eld, channels);
if (ca < 0) if (ca < 0)
ca = 0; ca = 0;
...@@ -1557,13 +1558,13 @@ static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) ...@@ -1557,13 +1558,13 @@ static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
eld->eld_valid = false; eld->eld_valid = false;
else { else {
memset(&eld->info, 0, sizeof(struct parsed_hdmi_eld)); memset(&eld->info, 0, sizeof(struct parsed_hdmi_eld));
if (snd_hdmi_parse_eld(&eld->info, eld->eld_buffer, if (snd_hdmi_parse_eld(codec, &eld->info, eld->eld_buffer,
eld->eld_size) < 0) eld->eld_size) < 0)
eld->eld_valid = false; eld->eld_valid = false;
} }
if (eld->eld_valid) { if (eld->eld_valid) {
snd_hdmi_show_eld(&eld->info); snd_hdmi_show_eld(codec, &eld->info);
update_eld = true; update_eld = true;
} }
else if (repoll) { else if (repoll) {
......
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