summaryrefslogtreecommitdiffstats
path: root/sound/usb/format.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-01 15:38:47 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-01 15:38:47 -0700
commitc70929147a10fa4538886cb23b934b509c4c0e49 (patch)
treebd7c25f679b271fc81f2cedc7a70ef059586c353 /sound/usb/format.c
parent4b1779c2cf030c68aefe939d946475e4136c1895 (diff)
parent69dd89fd2b9406603d218cab8996cfb232d5b8b9 (diff)
downloadop-kernel-dev-c70929147a10fa4538886cb23b934b509c4c0e49.zip
op-kernel-dev-c70929147a10fa4538886cb23b934b509c4c0e49.tar.gz
Merge tag 'sound-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound updates from Takashi Iwai: "There have been lots of changes in ALSA core, HD-audio and ASoC, also most of PCI drivers touched by conversions of printks. All these resulted in a high volume and wide ranged patch sets in this release. Many changes are fairly trivial, but also lots of nice cleanups and refactors. There are a few new drivers, most notably, the Intel Haswell and Baytrail ASoC driver. Core changes: - A bit modernization; embed the device struct into snd_card struct, so that it may be referred from the beginning. A new snd_card_new() function is introduced for that, and all drivers have been converted. - Simplification in the device management code in ALSA core; now managed by a simple priority list instead - Converted many kernel messages to use the standard dev_err() & co; this would be the pretty visible difference, especially for HD-audio. HD-audio: - Conexant codecs use the auto-parser as default now; the old static code still remains in case of regressions. Some old quirks have been rewritten with the fixups for auto-parser. - C-Media codecs also use the auto-parser as default now, too. - A device struct is assigned to each HD-audio codec, and the formerly hwdep attributes are accessible over the codec sysfs, too. hwdep attributes still remain for compatibility. - Split the PCI-specific stuff for HD-audio controller into a separate module, ane make a helper module for the generic controller driver. This is a preliminary change for supporting Tegra HDMI controller in near future, which slipped from 3.15 merge. - Device-specific fixes: mute LED support for Lenovo Ideapad, mic LED fix for HP laptops, more ASUS subwoofer quirks, yet more Dell laptop headset quirks - Make the HD-audio codec response a bit more robust - A few improvements on Realtek ALC282 / 283 about the pop noises - A couple of Intel HDMI fixes ASoC: - Lots of cleanups for enumerations; refactored lots of error prone original codes to use more modern APIs - Elimination of the ASoC level wrappers for I2C and SPI moving us closer to converting to regmap completely and avoiding some randconfig hassle - Provide both manually and transparently locked DAPM APIs rather than a mix of the two fixing some concurrency issues - Start converting CODEC drivers to use separate bus interface drivers rather than having them all in one file helping avoid dependency issues - DPCM support for Intel Haswell and Bay Trail platforms, lots of fixes - Lots of work on improvements for simple-card, DaVinci and the Renesas rcar drivers. - New drivers for Analog Devices ADAU1977, TI PCM512x and parts of the CSR SiRF SoC, TLV320AIC31XXX, Armada 370 DB, Cirrus cs42xx8 - Fixes for the simple-card DAI format DT mess - DT support for a couple more devices. - Use of the tdm_slot mapping in a few drivers Others: - Support of reset_resume callback for improved S4 in USB-audio driver; the device with boot quirks have been little tested, which we need to watch out in this development cycle - Add PM support for ICE1712 driver (finally!); it's still pretty partial support, only for M-Audio devices" * tag 'sound-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (610 commits) ALSA: ice1712: Add suspend support for M-Audio ICE1712-based cards ALSA: ice1712: add suspend support for ICE1712 chip ALSA: hda - Enable beep for ASUS 1015E ALSA: asihpi: fix some indenting in snd_card_asihpi_pcm_new() ALSA: hda - add headset mic detect quirks for three Dell laptops ASoC: tegra: move AC97 clock handling to the machine driver ASoC: simple-card: Handle many DAI links ASoC: simple-card: Add DT documentation for multi-DAI links ASoC: simple-card: dynamically allocate the DAI link and properties ASoC: imx-ssi: Add .xlate_tdm_slot_mask() support. ASoC: fsl-esai: Add .xlate_tdm_slot_mask() support. ASoC: fsl-utils: Add fsl_asoc_xlate_tdm_slot_mask() support. ASoC: core: remove the 'of_' prefix of of_xlate_tdm_slot_mask. ASoC: rcar: subnode tidyup for renesas,rsnd.txt ASoC: Remove name_prefix unset during DAI link init hack ALSA: hda - Inform the unexpectedly ignored pins by auto-parser ASoC: rcar: bugfix: it cares about the non-src case ARM: bockw: fixup SND_SOC_DAIFMT_CBx_CFx flags ASoC: pcm: Drop incorrect double/extra frees ASoC: mfld_machine: Fix compile error ...
Diffstat (limited to 'sound/usb/format.c')
-rw-r--r--sound/usb/format.c68
1 files changed, 39 insertions, 29 deletions
diff --git a/sound/usb/format.c b/sound/usb/format.c
index d244fd3..8bcc87c 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;
}
@@ -222,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;
@@ -261,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;
}
@@ -287,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;
}
@@ -300,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;
}
@@ -321,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;
@@ -332,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 */
@@ -348,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);
@@ -408,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;
}
@@ -435,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;
}
@@ -449,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;
@@ -458,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;
@@ -484,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;
OpenPOWER on IntegriCloud