ALSA: hda - Kill snd_printd*() in HDMI debug / info prints
PATCH 1/2 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 Takashi Iwai <[email protected]>
--- sound/pci/hda/hda_eld.c | 46 ++++++++++++++++++++++------------------------ sound/pci/hda/hda_local.h | 4 ++-- sound/pci/hda/patch_hdmi.c | 11 ++++++----- 3 files changed, 30 insertions(+), 31 deletions(-)
sound/pci/hda/hda_eld.c +22 -24
@@ -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 ); \ }) -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) {int i;
@@ -188,8 +189,7 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a, a->format =GRAB_BITS (buf,0 ,3 ,4 );switch (a->format) {case AUDIO_CODING_TYPE_REF_STREAM_HEADER : -snd_printd (KERN_INFO -"HDMI: audio coding type 0 not expected\n" ); +codec_info (codec,"HDMI: audio coding type 0 not expected\n" );break ;case AUDIO_CODING_TYPE_LPCM :
@@ -233,9 +233,9 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a, a->format =GRAB_BITS (buf,2 ,3 ,5 );if (a->format ==AUDIO_CODING_XTYPE_HE_REF_CT || a->format >=AUDIO_CODING_XTYPE_FIRST_RESERVED ) { -snd_printd (KERN_INFO -"HDMI: audio coding xtype %d not expected\n" , - a->format); +codec_info (codec, +"HDMI: audio coding xtype %d not expected\n" , + a->format); a->format =0 ; }else a->format += AUDIO_CODING_TYPE_HE_AAC -
@@ -247,7 +247,7 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a,/* * 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) {int mnl;
@@ -256,8 +256,7 @@ int snd_hdmi_parse_eld(struct parsed_hdmi_eld *e, e->eld_ver =GRAB_BITS (buf,0 ,3 ,5 );if (e->eld_ver !=ELD_VER_CEA_861D && e->eld_ver !=ELD_VER_PARTIAL ) { -snd_printd (KERN_INFO "HDMI: Unknown ELD version %d\n" , - e->eld_ver); +codec_info (codec,"HDMI: Unknown ELD version %d\n" , e->eld_ver); goto out_fail; }
@@ -280,20 +279,20 @@ int snd_hdmi_parse_eld(struct parsed_hdmi_eld *e, e->product_id =get_unaligned_le16 (buf +18 );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; }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; }else strlcpy (e->monitor_name, buf +ELD_FIXED_BYTES , mnl +1 );for (i =0 ; i < e->sad_count; i++) {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; } -hdmi_update_short_audio_desc (e->sad + i, +hdmi_update_short_audio_desc (codec, e->sad + i, buf +ELD_FIXED_BYTES + mnl +3 * i); }
@@ -394,7 +393,8 @@ static void hdmi_print_pcm_rates(int pcm, char *buf, int buflen)#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 buf2[8 +SND_PRINT_BITS_ADVISED_BUFSIZE ] =", bits =" ;
@@ -412,12 +412,10 @@ static void hdmi_show_short_audio_desc(struct cea_sad *a)else buf2[0 ] ='\0' ; -_snd_printd (SND_PR_VERBOSE ,"HDMI: supports coding type %s:" -" channels = %d, rates =%s%s\n" , - cea_audio_coding_type_names[a->format], - a->channels, - buf, - buf2); +codec_dbg (codec, +"HDMI: supports coding type %s: channels = %d, rates =%s%s\n" , + cea_audio_coding_type_names[a->format], + a->channels, buf, buf2); }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 */ } -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; -_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, eld_connection_type_names[e->conn_type]);if (e->spk_alloc) {char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE ];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++) -hdmi_show_short_audio_desc (e->sad + i); +hdmi_show_short_audio_desc (codec, e->sad + i); }#ifdef CONFIG_PROC_FS
sound/pci/hda/hda_local.h +2 -2
@@ -738,9 +738,9 @@ struct hdmi_eld {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,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); -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,struct hda_pcm_stream *hinfo);
sound/pci/hda/patch_hdmi.c +6 -5
@@ -648,7 +648,8 @@ static int get_channel_allocation_order(int ca)* * 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 ca =0 ;
@@ -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_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);return ca;
@@ -1135,7 +1136,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,if (!non_pcm && per_pin->chmap_set) ca =hdmi_manual_channel_allocation (channels, per_pin->chmap);else - ca =hdmi_channel_allocation (eld, channels); + ca =hdmi_channel_allocation (codec, eld, channels);if (ca <0 ) ca =0 ;
@@ -1561,13 +1562,13 @@ static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) eld->eld_valid = false; else {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_valid = false; }if (eld->eld_valid) { -snd_hdmi_show_eld (&eld->info); +snd_hdmi_show_eld (codec, &eld->info); update_eld = true; }else if (repoll) {
Signature · 1 line
1.9.3
PATCH 2/2 ALSA: hda - Kill the rest of snd_print*() usages
Pass the codec object so that we can replace all the rest of snd_print*() usages with the proper device-specific print helpers.
Signed-off-by Takashi Iwai <[email protected]>
--- sound/pci/hda/hda_codec.c | 35 +++++++++++++++++++++-------------- sound/pci/hda/hda_codec.h | 3 ++- sound/pci/hda/hda_controller.c | 3 ++- sound/pci/hda/hda_generic.c | 2 +- sound/pci/hda/hda_local.h | 3 ++- sound/pci/hda/patch_ca0132.c | 6 +++--- sound/pci/hda/patch_sigmatel.c | 2 +- 7 files changed, 32 insertions(+), 22 deletions(-)
sound/pci/hda/hda_codec.c +21 -14
@@ -2727,7 +2727,7 @@ int snd_hda_codec_reset(struct hda_codec *codec)return 0 ; } -typedef int (*map_slave_func_t )(void *,struct snd_kcontrol *); +typedef int (*map_slave_func_t )(struct hda_codec *,void *,struct snd_kcontrol *);/* apply the function to all matching slave ctls in the mixer list */ static int map_slaves(struct hda_codec *codec, const char * const *slaves,
@@ -2751,7 +2751,7 @@ static int map_slaves(struct hda_codec *codec, const char * const *slaves, name = tmpname; }if (!strcmp (sctl->id.name, name)) { - err =func (data, sctl); + err =func (codec, data, sctl);if (err)return err;break ;
@@ -2761,13 +2761,15 @@ static int map_slaves(struct hda_codec *codec, const char * const *slaves,return 0 ; } -static int check_slave_present (void *data,struct snd_kcontrol *sctl) +static int check_slave_present (struct hda_codec *codec, +void *data,struct snd_kcontrol *sctl) {return 1 ; }/* guess the value corresponding to 0dB */ -static int get_kctl_0dB_offset (struct snd_kcontrol *kctl,int *step_to_check) +static int get_kctl_0dB_offset (struct hda_codec *codec, +struct snd_kcontrol *kctl,int *step_to_check) {int _tlv[4 ];const int *tlv =NULL ;
@@ -2788,7 +2790,7 @@ static int get_kctl_0dB_offset(struct snd_kcontrol *kctl, int *step_to_check)if (!step)return -1 ;if (*step_to_check && *step_to_check != step) { -snd_printk (KERN_ERR "hda_codec: Mismatching dB step for vmaster slave (%d!=%d)\n" , +codec_err (codec,"Mismatching dB step for vmaster slave (%d!=%d)\n" , - *step_to_check, step);return -1 ; }
@@ -2813,16 +2815,18 @@ static int put_kctl_with_value(struct snd_kcontrol *kctl, int val) }/* initialize the slave volume with 0dB */ -static int init_slave_0dB (void *data,struct snd_kcontrol *slave) +static int init_slave_0dB (struct hda_codec *codec, +void *data,struct snd_kcontrol *slave) { -int offset =get_kctl_0dB_offset (slave, data); +int offset =get_kctl_0dB_offset (codec, slave, data);if (offset >0 )put_kctl_with_value (slave, offset);return 0 ; }/* unmute the slave */ -static int init_slave_unmute (void *data,struct snd_kcontrol *slave) +static int init_slave_unmute (struct hda_codec *codec, +void *data,struct snd_kcontrol *slave) {return put_kctl_with_value (slave,1 ); }
@@ -4280,6 +4284,7 @@ static struct hda_rate_tbl rate_bits[] = {/** * snd_hda_calc_stream_format - calculate format bitset +* @codec: HD-audio codec * @rate: the sample rate * @channels: the number of channels * @format: the PCM format (SNDRV_PCM_FORMAT_XXX)
@@ -4289,7 +4294,8 @@ static struct hda_rate_tbl rate_bits[] = {* * Return zero if invalid. */ -unsigned int snd_hda_calc_stream_format(unsigned int rate, +unsigned int snd_hda_calc_stream_format(struct hda_codec *codec, + unsigned int rate, unsigned int channels, unsigned int format, unsigned int maxbps,
@@ -4304,12 +4310,12 @@ unsigned int snd_hda_calc_stream_format(unsigned int rate,break ; }if (!rate_bits[i].hz) { -snd_printdd ("invalid rate %d\n" , rate); +codec_dbg (codec,"invalid rate %d\n" , rate);return 0 ; }if (channels ==0 || channels >8 ) { -snd_printdd ("invalid channels %d\n" , channels); +codec_dbg (codec,"invalid channels %d\n" , channels);return 0 ; } val |= channels -1 ;
@@ -4332,7 +4338,7 @@ unsigned int snd_hda_calc_stream_format(unsigned int rate, val |=AC_FMT_BITS_20 ;break ;default : -snd_printdd ("invalid format width %d\n" , +codec_dbg (codec,"invalid format width %d\n" ,snd_pcm_format_width (format));return 0 ; }
@@ -5670,12 +5676,13 @@ EXPORT_SYMBOL_GPL(_snd_hda_set_pin_ctl);* suffix is appended to the label. This label index number is stored * to type_idx when non-NULL pointer is given. */ -int snd_hda_add_imux_item (struct hda_input_mux *imux,const char *label, +int snd_hda_add_imux_item (struct hda_codec *codec, +struct hda_input_mux *imux,const char *label,int index,int *type_idx) {int i, label_idx =0 ;if (imux->num_items >=HDA_MAX_NUM_INPUTS ) { -snd_printd (KERN_ERR "hda_codec: Too many imux items!\n" ); +codec_err (codec,"hda_codec: Too many imux items!\n" );return -EINVAL ; }for (i =0 ; i < imux->num_items; i++) {
sound/pci/hda/hda_codec.h +2 -1
@@ -537,7 +537,8 @@ void __snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid, int do_now);#define snd_hda_codec_cleanup_stream (codec, nid) \ __snd_hda_codec_cleanup_stream(codec, nid, 0) -unsigned int snd_hda_calc_stream_format(unsigned int rate, +unsigned int snd_hda_calc_stream_format(struct hda_codec *codec, + unsigned int rate, unsigned int channels, unsigned int format, unsigned int maxbps,
sound/pci/hda/hda_controller.c +2 -1
@@ -481,7 +481,8 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) }azx_stream_reset (chip, azx_dev); - format_val = snd_hda_calc_stream_format(runtime->rate, + format_val = snd_hda_calc_stream_format(apcm->codec, + runtime->rate, runtime->channels, runtime->format, hinfo->maxbps,
sound/pci/hda/hda_generic.c +1 -1
@@ -3054,7 +3054,7 @@ static int parse_capture_source(struct hda_codec *codec, hda_nid_t pin,if (spec->hp_mic_pin == pin) spec->hp_mic_mux_idx = imux->num_items; spec->imux_pins[imux->num_items] = pin; -snd_hda_add_imux_item (imux, label, cfg_idx,NULL ); +snd_hda_add_imux_item (codec, imux, label, cfg_idx,NULL ); imux_added = true;if (spec->dyn_adc_switch) spec->dyn_adc_idx[imux_idx] = c;
sound/pci/hda/hda_local.h +2 -1
@@ -268,7 +268,8 @@ int snd_hda_input_mux_put(struct hda_codec *codec,const struct hda_input_mux *imux, struct snd_ctl_elem_value *ucontrol, hda_nid_t nid, unsigned int *cur_val); -int snd_hda_add_imux_item (struct hda_input_mux *imux,const char *label, +int snd_hda_add_imux_item (struct hda_codec *codec, +struct hda_input_mux *imux,const char *label,int index,int *type_index_ret);/*
sound/pci/hda/patch_ca0132.c +3 -3
@@ -2046,14 +2046,14 @@ enum dma_state {DMA_STATE_RUN =1 }; -static int dma_convert_to_hda_format ( +static int dma_convert_to_hda_format (struct hda_codec *codec,unsigned int sample_rate,unsigned short channels,unsigned short *hda_format) {unsigned int format_val; - format_val = snd_hda_calc_stream_format( + format_val = snd_hda_calc_stream_format(codec, sample_rate, channels, SNDRV_PCM_FORMAT_S32_LE,
@@ -2452,7 +2452,7 @@ static int dspxfr_image(struct hda_codec *codec, } dma_engine->codec = codec; -dma_convert_to_hda_format (sample_rate, channels, &hda_format); +dma_convert_to_hda_format (codec, sample_rate, channels, &hda_format); dma_engine->m_converter_format = hda_format; dma_engine->buf_size = (ovly ?DSP_DMA_WRITE_BUFLEN_OVLY :DSP_DMA_WRITE_BUFLEN_INIT ) *2 ;
sound/pci/hda/patch_sigmatel.c +1 -1
@@ -1011,7 +1011,7 @@ static int stac_create_spdif_mux_ctls(struct hda_codec *codec)for (i =0 ; i < num_cons; i++) {if (snd_BUG_ON (!labels[i]))return -EINVAL ; -snd_hda_add_imux_item (&spec->spdif_mux, labels[i], i,NULL ); +snd_hda_add_imux_item (codec, &spec->spdif_mux, labels[i], i,NULL ); } kctl =snd_hda_gen_add_kctl (&spec->gen,NULL , &stac_smux_mixer);
Signature · 1 line
1.9.3