diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-06-06 12:12:16 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-06-25 08:51:23 -0400 |
commit | 6194b99de9f52b9953b7cf2b48ce0da9276af9c3 (patch) | |
tree | 59f288253169717f17c00d0282c9c1b626cb5a05 /sound/pci | |
parent | 79514d473b097da82f5bc0b4e41251c44e29d98c (diff) |
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 <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 35 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.h | 3 | ||||
-rw-r--r-- | sound/pci/hda/hda_controller.c | 3 | ||||
-rw-r--r-- | sound/pci/hda/hda_generic.c | 2 | ||||
-rw-r--r-- | sound/pci/hda/hda_local.h | 3 | ||||
-rw-r--r-- | sound/pci/hda/patch_ca0132.c | 6 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 2 |
7 files changed, 32 insertions, 22 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 4c20277a6835..d91cb7f5961a 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -2727,7 +2727,7 @@ int snd_hda_codec_reset(struct hda_codec *codec) | |||
2727 | return 0; | 2727 | return 0; |
2728 | } | 2728 | } |
2729 | 2729 | ||
2730 | typedef int (*map_slave_func_t)(void *, struct snd_kcontrol *); | 2730 | typedef int (*map_slave_func_t)(struct hda_codec *, void *, struct snd_kcontrol *); |
2731 | 2731 | ||
2732 | /* apply the function to all matching slave ctls in the mixer list */ | 2732 | /* apply the function to all matching slave ctls in the mixer list */ |
2733 | static int map_slaves(struct hda_codec *codec, const char * const *slaves, | 2733 | 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, | |||
2751 | name = tmpname; | 2751 | name = tmpname; |
2752 | } | 2752 | } |
2753 | if (!strcmp(sctl->id.name, name)) { | 2753 | if (!strcmp(sctl->id.name, name)) { |
2754 | err = func(data, sctl); | 2754 | err = func(codec, data, sctl); |
2755 | if (err) | 2755 | if (err) |
2756 | return err; | 2756 | return err; |
2757 | break; | 2757 | break; |
@@ -2761,13 +2761,15 @@ static int map_slaves(struct hda_codec *codec, const char * const *slaves, | |||
2761 | return 0; | 2761 | return 0; |
2762 | } | 2762 | } |
2763 | 2763 | ||
2764 | static int check_slave_present(void *data, struct snd_kcontrol *sctl) | 2764 | static int check_slave_present(struct hda_codec *codec, |
2765 | void *data, struct snd_kcontrol *sctl) | ||
2765 | { | 2766 | { |
2766 | return 1; | 2767 | return 1; |
2767 | } | 2768 | } |
2768 | 2769 | ||
2769 | /* guess the value corresponding to 0dB */ | 2770 | /* guess the value corresponding to 0dB */ |
2770 | static int get_kctl_0dB_offset(struct snd_kcontrol *kctl, int *step_to_check) | 2771 | static int get_kctl_0dB_offset(struct hda_codec *codec, |
2772 | struct snd_kcontrol *kctl, int *step_to_check) | ||
2771 | { | 2773 | { |
2772 | int _tlv[4]; | 2774 | int _tlv[4]; |
2773 | const int *tlv = NULL; | 2775 | const int *tlv = NULL; |
@@ -2788,7 +2790,7 @@ static int get_kctl_0dB_offset(struct snd_kcontrol *kctl, int *step_to_check) | |||
2788 | if (!step) | 2790 | if (!step) |
2789 | return -1; | 2791 | return -1; |
2790 | if (*step_to_check && *step_to_check != step) { | 2792 | if (*step_to_check && *step_to_check != step) { |
2791 | snd_printk(KERN_ERR "hda_codec: Mismatching dB step for vmaster slave (%d!=%d)\n", | 2793 | codec_err(codec, "Mismatching dB step for vmaster slave (%d!=%d)\n", |
2792 | - *step_to_check, step); | 2794 | - *step_to_check, step); |
2793 | return -1; | 2795 | return -1; |
2794 | } | 2796 | } |
@@ -2813,16 +2815,18 @@ static int put_kctl_with_value(struct snd_kcontrol *kctl, int val) | |||
2813 | } | 2815 | } |
2814 | 2816 | ||
2815 | /* initialize the slave volume with 0dB */ | 2817 | /* initialize the slave volume with 0dB */ |
2816 | static int init_slave_0dB(void *data, struct snd_kcontrol *slave) | 2818 | static int init_slave_0dB(struct hda_codec *codec, |
2819 | void *data, struct snd_kcontrol *slave) | ||
2817 | { | 2820 | { |
2818 | int offset = get_kctl_0dB_offset(slave, data); | 2821 | int offset = get_kctl_0dB_offset(codec, slave, data); |
2819 | if (offset > 0) | 2822 | if (offset > 0) |
2820 | put_kctl_with_value(slave, offset); | 2823 | put_kctl_with_value(slave, offset); |
2821 | return 0; | 2824 | return 0; |
2822 | } | 2825 | } |
2823 | 2826 | ||
2824 | /* unmute the slave */ | 2827 | /* unmute the slave */ |
2825 | static int init_slave_unmute(void *data, struct snd_kcontrol *slave) | 2828 | static int init_slave_unmute(struct hda_codec *codec, |
2829 | void *data, struct snd_kcontrol *slave) | ||
2826 | { | 2830 | { |
2827 | return put_kctl_with_value(slave, 1); | 2831 | return put_kctl_with_value(slave, 1); |
2828 | } | 2832 | } |
@@ -4280,6 +4284,7 @@ static struct hda_rate_tbl rate_bits[] = { | |||
4280 | 4284 | ||
4281 | /** | 4285 | /** |
4282 | * snd_hda_calc_stream_format - calculate format bitset | 4286 | * snd_hda_calc_stream_format - calculate format bitset |
4287 | * @codec: HD-audio codec | ||
4283 | * @rate: the sample rate | 4288 | * @rate: the sample rate |
4284 | * @channels: the number of channels | 4289 | * @channels: the number of channels |
4285 | * @format: the PCM format (SNDRV_PCM_FORMAT_XXX) | 4290 | * @format: the PCM format (SNDRV_PCM_FORMAT_XXX) |
@@ -4289,7 +4294,8 @@ static struct hda_rate_tbl rate_bits[] = { | |||
4289 | * | 4294 | * |
4290 | * Return zero if invalid. | 4295 | * Return zero if invalid. |
4291 | */ | 4296 | */ |
4292 | unsigned int snd_hda_calc_stream_format(unsigned int rate, | 4297 | unsigned int snd_hda_calc_stream_format(struct hda_codec *codec, |
4298 | unsigned int rate, | ||
4293 | unsigned int channels, | 4299 | unsigned int channels, |
4294 | unsigned int format, | 4300 | unsigned int format, |
4295 | unsigned int maxbps, | 4301 | unsigned int maxbps, |
@@ -4304,12 +4310,12 @@ unsigned int snd_hda_calc_stream_format(unsigned int rate, | |||
4304 | break; | 4310 | break; |
4305 | } | 4311 | } |
4306 | if (!rate_bits[i].hz) { | 4312 | if (!rate_bits[i].hz) { |
4307 | snd_printdd("invalid rate %d\n", rate); | 4313 | codec_dbg(codec, "invalid rate %d\n", rate); |
4308 | return 0; | 4314 | return 0; |
4309 | } | 4315 | } |
4310 | 4316 | ||
4311 | if (channels == 0 || channels > 8) { | 4317 | if (channels == 0 || channels > 8) { |
4312 | snd_printdd("invalid channels %d\n", channels); | 4318 | codec_dbg(codec, "invalid channels %d\n", channels); |
4313 | return 0; | 4319 | return 0; |
4314 | } | 4320 | } |
4315 | val |= channels - 1; | 4321 | val |= channels - 1; |
@@ -4332,7 +4338,7 @@ unsigned int snd_hda_calc_stream_format(unsigned int rate, | |||
4332 | val |= AC_FMT_BITS_20; | 4338 | val |= AC_FMT_BITS_20; |
4333 | break; | 4339 | break; |
4334 | default: | 4340 | default: |
4335 | snd_printdd("invalid format width %d\n", | 4341 | codec_dbg(codec, "invalid format width %d\n", |
4336 | snd_pcm_format_width(format)); | 4342 | snd_pcm_format_width(format)); |
4337 | return 0; | 4343 | return 0; |
4338 | } | 4344 | } |
@@ -5670,12 +5676,13 @@ EXPORT_SYMBOL_GPL(_snd_hda_set_pin_ctl); | |||
5670 | * suffix is appended to the label. This label index number is stored | 5676 | * suffix is appended to the label. This label index number is stored |
5671 | * to type_idx when non-NULL pointer is given. | 5677 | * to type_idx when non-NULL pointer is given. |
5672 | */ | 5678 | */ |
5673 | int snd_hda_add_imux_item(struct hda_input_mux *imux, const char *label, | 5679 | int snd_hda_add_imux_item(struct hda_codec *codec, |
5680 | struct hda_input_mux *imux, const char *label, | ||
5674 | int index, int *type_idx) | 5681 | int index, int *type_idx) |
5675 | { | 5682 | { |
5676 | int i, label_idx = 0; | 5683 | int i, label_idx = 0; |
5677 | if (imux->num_items >= HDA_MAX_NUM_INPUTS) { | 5684 | if (imux->num_items >= HDA_MAX_NUM_INPUTS) { |
5678 | snd_printd(KERN_ERR "hda_codec: Too many imux items!\n"); | 5685 | codec_err(codec, "hda_codec: Too many imux items!\n"); |
5679 | return -EINVAL; | 5686 | return -EINVAL; |
5680 | } | 5687 | } |
5681 | for (i = 0; i < imux->num_items; i++) { | 5688 | for (i = 0; i < imux->num_items; i++) { |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 5825aa17d8e3..f84a40ef42af 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -538,7 +538,8 @@ void __snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid, | |||
538 | int do_now); | 538 | int do_now); |
539 | #define snd_hda_codec_cleanup_stream(codec, nid) \ | 539 | #define snd_hda_codec_cleanup_stream(codec, nid) \ |
540 | __snd_hda_codec_cleanup_stream(codec, nid, 0) | 540 | __snd_hda_codec_cleanup_stream(codec, nid, 0) |
541 | unsigned int snd_hda_calc_stream_format(unsigned int rate, | 541 | unsigned int snd_hda_calc_stream_format(struct hda_codec *codec, |
542 | unsigned int rate, | ||
542 | unsigned int channels, | 543 | unsigned int channels, |
543 | unsigned int format, | 544 | unsigned int format, |
544 | unsigned int maxbps, | 545 | unsigned int maxbps, |
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index 480bbddbd801..875e0ebf56eb 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c | |||
@@ -481,7 +481,8 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) | |||
481 | } | 481 | } |
482 | 482 | ||
483 | azx_stream_reset(chip, azx_dev); | 483 | azx_stream_reset(chip, azx_dev); |
484 | format_val = snd_hda_calc_stream_format(runtime->rate, | 484 | format_val = snd_hda_calc_stream_format(apcm->codec, |
485 | runtime->rate, | ||
485 | runtime->channels, | 486 | runtime->channels, |
486 | runtime->format, | 487 | runtime->format, |
487 | hinfo->maxbps, | 488 | hinfo->maxbps, |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 589e47c5aeb3..a24c7b28b000 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -3054,7 +3054,7 @@ static int parse_capture_source(struct hda_codec *codec, hda_nid_t pin, | |||
3054 | if (spec->hp_mic_pin == pin) | 3054 | if (spec->hp_mic_pin == pin) |
3055 | spec->hp_mic_mux_idx = imux->num_items; | 3055 | spec->hp_mic_mux_idx = imux->num_items; |
3056 | spec->imux_pins[imux->num_items] = pin; | 3056 | spec->imux_pins[imux->num_items] = pin; |
3057 | snd_hda_add_imux_item(imux, label, cfg_idx, NULL); | 3057 | snd_hda_add_imux_item(codec, imux, label, cfg_idx, NULL); |
3058 | imux_added = true; | 3058 | imux_added = true; |
3059 | if (spec->dyn_adc_switch) | 3059 | if (spec->dyn_adc_switch) |
3060 | spec->dyn_adc_idx[imux_idx] = c; | 3060 | spec->dyn_adc_idx[imux_idx] = c; |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 08a67e4c5df3..d52cc3ef5135 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -268,7 +268,8 @@ int snd_hda_input_mux_put(struct hda_codec *codec, | |||
268 | const struct hda_input_mux *imux, | 268 | const struct hda_input_mux *imux, |
269 | struct snd_ctl_elem_value *ucontrol, hda_nid_t nid, | 269 | struct snd_ctl_elem_value *ucontrol, hda_nid_t nid, |
270 | unsigned int *cur_val); | 270 | unsigned int *cur_val); |
271 | int snd_hda_add_imux_item(struct hda_input_mux *imux, const char *label, | 271 | int snd_hda_add_imux_item(struct hda_codec *codec, |
272 | struct hda_input_mux *imux, const char *label, | ||
272 | int index, int *type_index_ret); | 273 | int index, int *type_index_ret); |
273 | 274 | ||
274 | /* | 275 | /* |
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index 092f2bd030bd..4f3aba78f720 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c | |||
@@ -2046,14 +2046,14 @@ enum dma_state { | |||
2046 | DMA_STATE_RUN = 1 | 2046 | DMA_STATE_RUN = 1 |
2047 | }; | 2047 | }; |
2048 | 2048 | ||
2049 | static int dma_convert_to_hda_format( | 2049 | static int dma_convert_to_hda_format(struct hda_codec *codec, |
2050 | unsigned int sample_rate, | 2050 | unsigned int sample_rate, |
2051 | unsigned short channels, | 2051 | unsigned short channels, |
2052 | unsigned short *hda_format) | 2052 | unsigned short *hda_format) |
2053 | { | 2053 | { |
2054 | unsigned int format_val; | 2054 | unsigned int format_val; |
2055 | 2055 | ||
2056 | format_val = snd_hda_calc_stream_format( | 2056 | format_val = snd_hda_calc_stream_format(codec, |
2057 | sample_rate, | 2057 | sample_rate, |
2058 | channels, | 2058 | channels, |
2059 | SNDRV_PCM_FORMAT_S32_LE, | 2059 | SNDRV_PCM_FORMAT_S32_LE, |
@@ -2452,7 +2452,7 @@ static int dspxfr_image(struct hda_codec *codec, | |||
2452 | } | 2452 | } |
2453 | 2453 | ||
2454 | dma_engine->codec = codec; | 2454 | dma_engine->codec = codec; |
2455 | dma_convert_to_hda_format(sample_rate, channels, &hda_format); | 2455 | dma_convert_to_hda_format(codec, sample_rate, channels, &hda_format); |
2456 | dma_engine->m_converter_format = hda_format; | 2456 | dma_engine->m_converter_format = hda_format; |
2457 | dma_engine->buf_size = (ovly ? DSP_DMA_WRITE_BUFLEN_OVLY : | 2457 | dma_engine->buf_size = (ovly ? DSP_DMA_WRITE_BUFLEN_OVLY : |
2458 | DSP_DMA_WRITE_BUFLEN_INIT) * 2; | 2458 | DSP_DMA_WRITE_BUFLEN_INIT) * 2; |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 7f40a150899c..5267ef2b1dcc 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -1011,7 +1011,7 @@ static int stac_create_spdif_mux_ctls(struct hda_codec *codec) | |||
1011 | for (i = 0; i < num_cons; i++) { | 1011 | for (i = 0; i < num_cons; i++) { |
1012 | if (snd_BUG_ON(!labels[i])) | 1012 | if (snd_BUG_ON(!labels[i])) |
1013 | return -EINVAL; | 1013 | return -EINVAL; |
1014 | snd_hda_add_imux_item(&spec->spdif_mux, labels[i], i, NULL); | 1014 | snd_hda_add_imux_item(codec, &spec->spdif_mux, labels[i], i, NULL); |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | kctl = snd_hda_gen_add_kctl(&spec->gen, NULL, &stac_smux_mixer); | 1017 | kctl = snd_hda_gen_add_kctl(&spec->gen, NULL, &stac_smux_mixer); |