diff options
Diffstat (limited to 'sound/usb/format.c')
| -rw-r--r-- | sound/usb/format.c | 74 | 
1 files changed, 43 insertions, 31 deletions
diff --git a/sound/usb/format.c b/sound/usb/format.c index 3525231c6b9..8bcc87cf566 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -74,8 +74,8 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,  	if ((pcm_formats == 0) &&  	    (format == 0 || format == (1 << UAC_FORMAT_TYPE_I_UNDEFINED))) {  		/* some devices don't define this correctly... */ -		snd_printdd(KERN_INFO "%d:%u:%d : format type 0 is detected, processed as PCM\n", -			    chip->dev->devnum, fp->iface, fp->altsetting); +		usb_audio_info(chip, "%u:%d : format type 0 is detected, processed as PCM\n", +			fp->iface, fp->altsetting);  		format = 1 << UAC_FORMAT_TYPE_I_PCM;  	}  	if (format & (1 << UAC_FORMAT_TYPE_I_PCM)) { @@ -83,9 +83,9 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,  		    sample_width == 24 && sample_bytes == 2)  			sample_bytes = 3;  		else if (sample_width > sample_bytes * 8) { -			snd_printk(KERN_INFO "%d:%u:%d : sample bitwidth %d in over sample bytes %d\n", -				   chip->dev->devnum, fp->iface, fp->altsetting, -				   sample_width, sample_bytes); +			usb_audio_info(chip, "%u:%d : sample bitwidth %d in over sample bytes %d\n", +				 fp->iface, fp->altsetting, +				 sample_width, sample_bytes);  		}  		/* check the format byte size */  		switch (sample_bytes) { @@ -108,9 +108,10 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,  			pcm_formats |= SNDRV_PCM_FMTBIT_S32_LE;  			break;  		default: -			snd_printk(KERN_INFO "%d:%u:%d : unsupported sample bitwidth %d in %d bytes\n", -				   chip->dev->devnum, fp->iface, fp->altsetting, -				   sample_width, sample_bytes); +			usb_audio_info(chip, +				 "%u:%d : unsupported sample bitwidth %d in %d bytes\n", +				 fp->iface, fp->altsetting, +				 sample_width, sample_bytes);  			break;  		}  	} @@ -132,8 +133,9 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,  		pcm_formats |= SNDRV_PCM_FMTBIT_MU_LAW;  	}  	if (format & ~0x3f) { -		snd_printk(KERN_INFO "%d:%u:%d : unsupported format bits %#x\n", -			   chip->dev->devnum, fp->iface, fp->altsetting, format); +		usb_audio_info(chip, +			 "%u:%d : unsupported format bits %#x\n", +			 fp->iface, fp->altsetting, format);  	}  	pcm_formats |= snd_usb_interface_dsd_format_quirks(chip, fp, sample_bytes); @@ -158,8 +160,9 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof  	int nr_rates = fmt[offset];  	if (fmt[0] < offset + 1 + 3 * (nr_rates ? nr_rates : 2)) { -		snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", -				   chip->dev->devnum, fp->iface, fp->altsetting); +		usb_audio_err(chip, +			"%u:%d : invalid UAC_FORMAT_TYPE desc\n", +			fp->iface, fp->altsetting);  		return -EINVAL;  	} @@ -171,7 +174,7 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof  		fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL);  		if (fp->rate_table == NULL) { -			snd_printk(KERN_ERR "cannot malloc\n"); +			usb_audio_err(chip, "cannot malloc\n");  			return -ENOMEM;  		} @@ -189,8 +192,10 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof  			     chip->usb_id == USB_ID(0x0ccd, 0x00b1)) &&  			    fp->altsetting == 5 && fp->maxpacksize == 392)  				rate = 96000; -			/* Creative VF0470 Live Cam reports 16 kHz instead of 8kHz */ -			if (rate == 16000 && chip->usb_id == USB_ID(0x041e, 0x4068)) +			/* Creative VF0420/VF0470 Live Cams report 16 kHz instead of 8kHz */ +			if (rate == 16000 && +			    (chip->usb_id == USB_ID(0x041e, 0x4064) || +			     chip->usb_id == USB_ID(0x041e, 0x4068)))  				rate = 8000;  			fp->rate_table[fp->nr_rates] = rate; @@ -220,7 +225,8 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof   * get to know how many sample rates we have to expect.   * Then fp->rate_table can be allocated and filled.   */ -static int parse_uac2_sample_rate_range(struct audioformat *fp, int nr_triplets, +static int parse_uac2_sample_rate_range(struct snd_usb_audio *chip, +					struct audioformat *fp, int nr_triplets,  					const unsigned char *data)  {  	int i, nr_rates = 0; @@ -259,7 +265,7 @@ static int parse_uac2_sample_rate_range(struct audioformat *fp, int nr_triplets,  			nr_rates++;  			if (nr_rates >= MAX_NR_RATES) { -				snd_printk(KERN_ERR "invalid uac2 rates\n"); +				usb_audio_err(chip, "invalid uac2 rates\n");  				break;  			} @@ -285,7 +291,8 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,  	int clock = snd_usb_clock_find_source(chip, fp->clock, false);  	if (clock < 0) { -		snd_printk(KERN_ERR "%s(): unable to find clock source (clock %d)\n", +		dev_err(&dev->dev, +			"%s(): unable to find clock source (clock %d)\n",  				__func__, clock);  		goto err;  	} @@ -298,7 +305,8 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,  			      tmp, sizeof(tmp));  	if (ret < 0) { -		snd_printk(KERN_ERR "%s(): unable to retrieve number of sample rates (clock %d)\n", +		dev_err(&dev->dev, +			"%s(): unable to retrieve number of sample rates (clock %d)\n",  				__func__, clock);  		goto err;  	} @@ -319,7 +327,8 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,  			      data, data_size);  	if (ret < 0) { -		snd_printk(KERN_ERR "%s(): unable to retrieve sample rate range (clock %d)\n", +		dev_err(&dev->dev, +			"%s(): unable to retrieve sample rate range (clock %d)\n",  				__func__, clock);  		ret = -EINVAL;  		goto err_free; @@ -330,7 +339,7 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,  	 * will have to deal with. */  	kfree(fp->rate_table);  	fp->rate_table = NULL; -	fp->nr_rates = parse_uac2_sample_rate_range(fp, nr_triplets, data); +	fp->nr_rates = parse_uac2_sample_rate_range(chip, fp, nr_triplets, data);  	if (fp->nr_rates == 0) {  		/* SNDRV_PCM_RATE_CONTINUOUS */ @@ -346,7 +355,7 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,  	/* Call the triplet parser again, but this time, fp->rate_table is  	 * allocated, so the rates will be stored */ -	parse_uac2_sample_rate_range(fp, nr_triplets, data); +	parse_uac2_sample_rate_range(chip, fp, nr_triplets, data);  err_free:  	kfree(data); @@ -406,8 +415,9 @@ static int parse_audio_format_i(struct snd_usb_audio *chip,  	}  	if (fp->channels < 1) { -		snd_printk(KERN_ERR "%d:%u:%d : invalid channels %d\n", -			   chip->dev->devnum, fp->iface, fp->altsetting, fp->channels); +		usb_audio_err(chip, +			"%u:%d : invalid channels %d\n", +			fp->iface, fp->altsetting, fp->channels);  		return -EINVAL;  	} @@ -433,8 +443,9 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,  		fp->formats = SNDRV_PCM_FMTBIT_MPEG;  		break;  	default: -		snd_printd(KERN_INFO "%d:%u:%d : unknown format tag %#x is detected.  processed as MPEG.\n", -			   chip->dev->devnum, fp->iface, fp->altsetting, format); +		usb_audio_info(chip, +			 "%u:%d : unknown format tag %#x is detected.  processed as MPEG.\n", +			 fp->iface, fp->altsetting, format);  		fp->formats = SNDRV_PCM_FMTBIT_MPEG;  		break;  	} @@ -447,7 +458,7 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,  		struct uac_format_type_ii_discrete_descriptor *fmt = _fmt;  		brate = le16_to_cpu(fmt->wMaxBitRate);  		framesize = le16_to_cpu(fmt->wSamplesPerFrame); -		snd_printd(KERN_INFO "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize); +		usb_audio_info(chip, "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize);  		fp->frame_size = framesize;  		ret = parse_audio_format_rates_v1(chip, fp, _fmt, 8); /* fmt[8..] sample rates */  		break; @@ -456,7 +467,7 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,  		struct uac_format_type_ii_ext_descriptor *fmt = _fmt;  		brate = le16_to_cpu(fmt->wMaxBitRate);  		framesize = le16_to_cpu(fmt->wSamplesPerFrame); -		snd_printd(KERN_INFO "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize); +		usb_audio_info(chip, "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize);  		fp->frame_size = framesize;  		ret = parse_audio_format_rates_v2(chip, fp);  		break; @@ -482,9 +493,10 @@ int snd_usb_parse_audio_format(struct snd_usb_audio *chip,  		err = parse_audio_format_ii(chip, fp, format, fmt);  		break;  	default: -		snd_printd(KERN_INFO "%d:%u:%d : format type %d is not supported yet\n", -			   chip->dev->devnum, fp->iface, fp->altsetting, -			   fmt->bFormatType); +		usb_audio_info(chip, +			 "%u:%d : format type %d is not supported yet\n", +			 fp->iface, fp->altsetting, +			 fmt->bFormatType);  		return -ENOTSUPP;  	}  	fp->fmt_type = fmt->bFormatType;  | 
