diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-09-22 11:26:27 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-09-22 11:26:27 -0400 |
commit | ddfb43f3881edb47aa0083651ad31983cdc42c33 (patch) | |
tree | 7128cb13b599d2903a4deb05bbae37508b1c261e /sound | |
parent | 2d6d649a2e0fa0268c0d03d5b1d330ca7907d33c (diff) | |
parent | 5698bd757d55b1bb87edd1a9744ab09c142abfc2 (diff) |
Merge tag 'v3.6-rc6' into for-3.7
Linux 3.6-rc6 has all our bug fixes.
Conflicts (trivial overlap):
sound/soc/omap/am3517evm.c
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/compress_offload.c | 8 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.c | 12 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.h | 1 | ||||
-rw-r--r-- | sound/pci/hda/hda_intel.c | 2 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 6 | ||||
-rw-r--r-- | sound/pci/ice1712/prodigy_hifi.c | 3 | ||||
-rw-r--r-- | sound/soc/codecs/arizona.c | 2 | ||||
-rw-r--r-- | sound/soc/codecs/mc13783.c | 8 | ||||
-rw-r--r-- | sound/soc/codecs/wm8904.c | 2 | ||||
-rw-r--r-- | sound/soc/fsl/imx-sgtl5000.c | 2 | ||||
-rw-r--r-- | sound/soc/samsung/dma.c | 8 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 5 | ||||
-rw-r--r-- | sound/soc/spear/spear_pcm.c | 2 | ||||
-rw-r--r-- | sound/soc/tegra/tegra_alc5632.c | 1 | ||||
-rw-r--r-- | sound/soc/tegra/tegra_pcm.c | 4 | ||||
-rw-r--r-- | sound/soc/ux500/ux500_msp_i2s.c | 25 | ||||
-rw-r--r-- | sound/usb/card.c | 4 | ||||
-rw-r--r-- | sound/usb/endpoint.c | 24 | ||||
-rw-r--r-- | sound/usb/endpoint.h | 3 | ||||
-rw-r--r-- | sound/usb/pcm.c | 70 |
20 files changed, 114 insertions, 78 deletions
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index ec2118d0e27a..eb60cb8dbb8a 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c | |||
@@ -80,14 +80,12 @@ static int snd_compr_open(struct inode *inode, struct file *f) | |||
80 | int maj = imajor(inode); | 80 | int maj = imajor(inode); |
81 | int ret; | 81 | int ret; |
82 | 82 | ||
83 | if (f->f_flags & O_WRONLY) | 83 | if ((f->f_flags & O_ACCMODE) == O_WRONLY) |
84 | dirn = SND_COMPRESS_PLAYBACK; | 84 | dirn = SND_COMPRESS_PLAYBACK; |
85 | else if (f->f_flags & O_RDONLY) | 85 | else if ((f->f_flags & O_ACCMODE) == O_RDONLY) |
86 | dirn = SND_COMPRESS_CAPTURE; | 86 | dirn = SND_COMPRESS_CAPTURE; |
87 | else { | 87 | else |
88 | pr_err("invalid direction\n"); | ||
89 | return -EINVAL; | 88 | return -EINVAL; |
90 | } | ||
91 | 89 | ||
92 | if (maj == snd_major) | 90 | if (maj == snd_major) |
93 | compr = snd_lookup_minor_data(iminor(inode), | 91 | compr = snd_lookup_minor_data(iminor(inode), |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index f560051a949e..1c65cc5e3a31 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -1209,6 +1209,9 @@ static void snd_hda_codec_free(struct hda_codec *codec) | |||
1209 | kfree(codec); | 1209 | kfree(codec); |
1210 | } | 1210 | } |
1211 | 1211 | ||
1212 | static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec, | ||
1213 | hda_nid_t fg, unsigned int power_state); | ||
1214 | |||
1212 | static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, | 1215 | static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, |
1213 | unsigned int power_state); | 1216 | unsigned int power_state); |
1214 | 1217 | ||
@@ -1317,6 +1320,10 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, | |||
1317 | AC_VERB_GET_SUBSYSTEM_ID, 0); | 1320 | AC_VERB_GET_SUBSYSTEM_ID, 0); |
1318 | } | 1321 | } |
1319 | 1322 | ||
1323 | codec->epss = snd_hda_codec_get_supported_ps(codec, | ||
1324 | codec->afg ? codec->afg : codec->mfg, | ||
1325 | AC_PWRST_EPSS); | ||
1326 | |||
1320 | /* power-up all before initialization */ | 1327 | /* power-up all before initialization */ |
1321 | hda_set_power_state(codec, | 1328 | hda_set_power_state(codec, |
1322 | codec->afg ? codec->afg : codec->mfg, | 1329 | codec->afg ? codec->afg : codec->mfg, |
@@ -2346,6 +2353,7 @@ int snd_hda_codec_reset(struct hda_codec *codec) | |||
2346 | } | 2353 | } |
2347 | if (codec->patch_ops.free) | 2354 | if (codec->patch_ops.free) |
2348 | codec->patch_ops.free(codec); | 2355 | codec->patch_ops.free(codec); |
2356 | memset(&codec->patch_ops, 0, sizeof(codec->patch_ops)); | ||
2349 | snd_hda_jack_tbl_clear(codec); | 2357 | snd_hda_jack_tbl_clear(codec); |
2350 | codec->proc_widget_hook = NULL; | 2358 | codec->proc_widget_hook = NULL; |
2351 | codec->spec = NULL; | 2359 | codec->spec = NULL; |
@@ -2361,7 +2369,6 @@ int snd_hda_codec_reset(struct hda_codec *codec) | |||
2361 | codec->num_pcms = 0; | 2369 | codec->num_pcms = 0; |
2362 | codec->pcm_info = NULL; | 2370 | codec->pcm_info = NULL; |
2363 | codec->preset = NULL; | 2371 | codec->preset = NULL; |
2364 | memset(&codec->patch_ops, 0, sizeof(codec->patch_ops)); | ||
2365 | codec->slave_dig_outs = NULL; | 2372 | codec->slave_dig_outs = NULL; |
2366 | codec->spdif_status_reset = 0; | 2373 | codec->spdif_status_reset = 0; |
2367 | module_put(codec->owner); | 2374 | module_put(codec->owner); |
@@ -3543,8 +3550,7 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, | |||
3543 | /* this delay seems necessary to avoid click noise at power-down */ | 3550 | /* this delay seems necessary to avoid click noise at power-down */ |
3544 | if (power_state == AC_PWRST_D3) { | 3551 | if (power_state == AC_PWRST_D3) { |
3545 | /* transition time less than 10ms for power down */ | 3552 | /* transition time less than 10ms for power down */ |
3546 | bool epss = snd_hda_codec_get_supported_ps(codec, fg, AC_PWRST_EPSS); | 3553 | msleep(codec->epss ? 10 : 100); |
3547 | msleep(epss ? 10 : 100); | ||
3548 | } | 3554 | } |
3549 | 3555 | ||
3550 | /* repeat power states setting at most 10 times*/ | 3556 | /* repeat power states setting at most 10 times*/ |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 7fbc1bcaf1a9..e5a7e19a8071 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -862,6 +862,7 @@ struct hda_codec { | |||
862 | unsigned int ignore_misc_bit:1; /* ignore MISC_NO_PRESENCE bit */ | 862 | unsigned int ignore_misc_bit:1; /* ignore MISC_NO_PRESENCE bit */ |
863 | unsigned int no_jack_detect:1; /* Machine has no jack-detection */ | 863 | unsigned int no_jack_detect:1; /* Machine has no jack-detection */ |
864 | unsigned int pcm_format_first:1; /* PCM format must be set first */ | 864 | unsigned int pcm_format_first:1; /* PCM format must be set first */ |
865 | unsigned int epss:1; /* supporting EPSS? */ | ||
865 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 866 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
866 | unsigned int power_on :1; /* current (global) power-state */ | 867 | unsigned int power_on :1; /* current (global) power-state */ |
867 | int power_transition; /* power-state in transition */ | 868 | int power_transition; /* power-state in transition */ |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 60882c62f180..c4763c52eaf6 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -2701,6 +2701,8 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = { | |||
2701 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), | 2701 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), |
2702 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), | 2702 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), |
2703 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), | 2703 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), |
2704 | SND_PCI_QUIRK(0x1043, 0x1ac3, "ASUS X53S", POS_FIX_POSBUF), | ||
2705 | SND_PCI_QUIRK(0x1043, 0x1b43, "ASUS K53E", POS_FIX_POSBUF), | ||
2704 | SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), | 2706 | SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), |
2705 | SND_PCI_QUIRK(0x10de, 0xcb89, "Macbook Pro 7,1", POS_FIX_LPIB), | 2707 | SND_PCI_QUIRK(0x10de, 0xcb89, "Macbook Pro 7,1", POS_FIX_LPIB), |
2706 | SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB), | 2708 | SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB), |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index ea5775a1a7db..3d4722f0a1ca 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -1075,7 +1075,7 @@ static struct snd_kcontrol_new stac_smux_mixer = { | |||
1075 | 1075 | ||
1076 | static const char * const slave_pfxs[] = { | 1076 | static const char * const slave_pfxs[] = { |
1077 | "Front", "Surround", "Center", "LFE", "Side", | 1077 | "Front", "Surround", "Center", "LFE", "Side", |
1078 | "Headphone", "Speaker", "IEC958", | 1078 | "Headphone", "Speaker", "IEC958", "PCM", |
1079 | NULL | 1079 | NULL |
1080 | }; | 1080 | }; |
1081 | 1081 | ||
@@ -4543,6 +4543,9 @@ static void stac92xx_line_out_detect(struct hda_codec *codec, | |||
4543 | struct auto_pin_cfg *cfg = &spec->autocfg; | 4543 | struct auto_pin_cfg *cfg = &spec->autocfg; |
4544 | int i; | 4544 | int i; |
4545 | 4545 | ||
4546 | if (cfg->speaker_outs == 0) | ||
4547 | return; | ||
4548 | |||
4546 | for (i = 0; i < cfg->line_outs; i++) { | 4549 | for (i = 0; i < cfg->line_outs; i++) { |
4547 | if (presence) | 4550 | if (presence) |
4548 | break; | 4551 | break; |
@@ -5531,6 +5534,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) | |||
5531 | snd_hda_codec_set_pincfg(codec, 0xf, 0x2181205e); | 5534 | snd_hda_codec_set_pincfg(codec, 0xf, 0x2181205e); |
5532 | } | 5535 | } |
5533 | 5536 | ||
5537 | codec->epss = 0; /* longer delay needed for D3 */ | ||
5534 | codec->no_trigger_sense = 1; | 5538 | codec->no_trigger_sense = 1; |
5535 | codec->spec = spec; | 5539 | codec->spec = spec; |
5536 | 5540 | ||
diff --git a/sound/pci/ice1712/prodigy_hifi.c b/sound/pci/ice1712/prodigy_hifi.c index 764cc93dbca4..075d5aa1fee0 100644 --- a/sound/pci/ice1712/prodigy_hifi.c +++ b/sound/pci/ice1712/prodigy_hifi.c | |||
@@ -297,6 +297,7 @@ static int ak4396_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
297 | } | 297 | } |
298 | 298 | ||
299 | static const DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -12700, 100, 1); | 299 | static const DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -12700, 100, 1); |
300 | static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0); | ||
300 | 301 | ||
301 | static struct snd_kcontrol_new prodigy_hd2_controls[] __devinitdata = { | 302 | static struct snd_kcontrol_new prodigy_hd2_controls[] __devinitdata = { |
302 | { | 303 | { |
@@ -307,7 +308,7 @@ static struct snd_kcontrol_new prodigy_hd2_controls[] __devinitdata = { | |||
307 | .info = ak4396_dac_vol_info, | 308 | .info = ak4396_dac_vol_info, |
308 | .get = ak4396_dac_vol_get, | 309 | .get = ak4396_dac_vol_get, |
309 | .put = ak4396_dac_vol_put, | 310 | .put = ak4396_dac_vol_put, |
310 | .tlv = { .p = db_scale_wm_dac }, | 311 | .tlv = { .p = ak4396_db_scale }, |
311 | }, | 312 | }, |
312 | }; | 313 | }; |
313 | 314 | ||
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index b79578e7e10c..c167c896eaee 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
@@ -492,7 +492,7 @@ static const int arizona_44k1_bclk_rates[] = { | |||
492 | 940800, | 492 | 940800, |
493 | 1411200, | 493 | 1411200, |
494 | 1881600, | 494 | 1881600, |
495 | 2882400, | 495 | 2822400, |
496 | 3763200, | 496 | 3763200, |
497 | 5644800, | 497 | 5644800, |
498 | 7526400, | 498 | 7526400, |
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c index d89e343ff108..bc955999c8aa 100644 --- a/sound/soc/codecs/mc13783.c +++ b/sound/soc/codecs/mc13783.c | |||
@@ -661,7 +661,7 @@ static struct snd_soc_dai_driver mc13783_dai_async[] = { | |||
661 | .id = MC13783_ID_STEREO_DAC, | 661 | .id = MC13783_ID_STEREO_DAC, |
662 | .playback = { | 662 | .playback = { |
663 | .stream_name = "Playback", | 663 | .stream_name = "Playback", |
664 | .channels_min = 1, | 664 | .channels_min = 2, |
665 | .channels_max = 2, | 665 | .channels_max = 2, |
666 | .rates = SNDRV_PCM_RATE_8000_96000, | 666 | .rates = SNDRV_PCM_RATE_8000_96000, |
667 | .formats = MC13783_FORMATS, | 667 | .formats = MC13783_FORMATS, |
@@ -672,7 +672,7 @@ static struct snd_soc_dai_driver mc13783_dai_async[] = { | |||
672 | .id = MC13783_ID_STEREO_CODEC, | 672 | .id = MC13783_ID_STEREO_CODEC, |
673 | .capture = { | 673 | .capture = { |
674 | .stream_name = "Capture", | 674 | .stream_name = "Capture", |
675 | .channels_min = 1, | 675 | .channels_min = 2, |
676 | .channels_max = 2, | 676 | .channels_max = 2, |
677 | .rates = MC13783_RATES_RECORD, | 677 | .rates = MC13783_RATES_RECORD, |
678 | .formats = MC13783_FORMATS, | 678 | .formats = MC13783_FORMATS, |
@@ -694,14 +694,14 @@ static struct snd_soc_dai_driver mc13783_dai_sync[] = { | |||
694 | .id = MC13783_ID_SYNC, | 694 | .id = MC13783_ID_SYNC, |
695 | .playback = { | 695 | .playback = { |
696 | .stream_name = "Playback", | 696 | .stream_name = "Playback", |
697 | .channels_min = 1, | 697 | .channels_min = 2, |
698 | .channels_max = 2, | 698 | .channels_max = 2, |
699 | .rates = SNDRV_PCM_RATE_8000_96000, | 699 | .rates = SNDRV_PCM_RATE_8000_96000, |
700 | .formats = MC13783_FORMATS, | 700 | .formats = MC13783_FORMATS, |
701 | }, | 701 | }, |
702 | .capture = { | 702 | .capture = { |
703 | .stream_name = "Capture", | 703 | .stream_name = "Capture", |
704 | .channels_min = 1, | 704 | .channels_min = 2, |
705 | .channels_max = 2, | 705 | .channels_max = 2, |
706 | .rates = MC13783_RATES_RECORD, | 706 | .rates = MC13783_RATES_RECORD, |
707 | .formats = MC13783_FORMATS, | 707 | .formats = MC13783_FORMATS, |
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index 2b9766d55384..7c8df52a8d9d 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c | |||
@@ -100,7 +100,7 @@ static const struct reg_default wm8904_reg_defaults[] = { | |||
100 | { 14, 0x0000 }, /* R14 - Power Management 2 */ | 100 | { 14, 0x0000 }, /* R14 - Power Management 2 */ |
101 | { 15, 0x0000 }, /* R15 - Power Management 3 */ | 101 | { 15, 0x0000 }, /* R15 - Power Management 3 */ |
102 | { 18, 0x0000 }, /* R18 - Power Management 6 */ | 102 | { 18, 0x0000 }, /* R18 - Power Management 6 */ |
103 | { 19, 0x945E }, /* R20 - Clock Rates 0 */ | 103 | { 20, 0x945E }, /* R20 - Clock Rates 0 */ |
104 | { 21, 0x0C05 }, /* R21 - Clock Rates 1 */ | 104 | { 21, 0x0C05 }, /* R21 - Clock Rates 1 */ |
105 | { 22, 0x0006 }, /* R22 - Clock Rates 2 */ | 105 | { 22, 0x0006 }, /* R22 - Clock Rates 2 */ |
106 | { 24, 0x0050 }, /* R24 - Audio Interface 0 */ | 106 | { 24, 0x0050 }, /* R24 - Audio Interface 0 */ |
diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c index fb21b17f17f5..199408ec4261 100644 --- a/sound/soc/fsl/imx-sgtl5000.c +++ b/sound/soc/fsl/imx-sgtl5000.c | |||
@@ -94,7 +94,7 @@ static int __devinit imx_sgtl5000_probe(struct platform_device *pdev) | |||
94 | dev_err(&pdev->dev, "audmux internal port setup failed\n"); | 94 | dev_err(&pdev->dev, "audmux internal port setup failed\n"); |
95 | return ret; | 95 | return ret; |
96 | } | 96 | } |
97 | imx_audmux_v2_configure_port(ext_port, | 97 | ret = imx_audmux_v2_configure_port(ext_port, |
98 | IMX_AUDMUX_V2_PTCR_SYN, | 98 | IMX_AUDMUX_V2_PTCR_SYN, |
99 | IMX_AUDMUX_V2_PDCR_RXDSEL(int_port)); | 99 | IMX_AUDMUX_V2_PDCR_RXDSEL(int_port)); |
100 | if (ret) { | 100 | if (ret) { |
diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c index f3ebc38c10fe..b70964ea448c 100644 --- a/sound/soc/samsung/dma.c +++ b/sound/soc/samsung/dma.c | |||
@@ -34,9 +34,7 @@ static const struct snd_pcm_hardware dma_hardware = { | |||
34 | .info = SNDRV_PCM_INFO_INTERLEAVED | | 34 | .info = SNDRV_PCM_INFO_INTERLEAVED | |
35 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 35 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
36 | SNDRV_PCM_INFO_MMAP | | 36 | SNDRV_PCM_INFO_MMAP | |
37 | SNDRV_PCM_INFO_MMAP_VALID | | 37 | SNDRV_PCM_INFO_MMAP_VALID, |
38 | SNDRV_PCM_INFO_PAUSE | | ||
39 | SNDRV_PCM_INFO_RESUME, | ||
40 | .formats = SNDRV_PCM_FMTBIT_S16_LE | | 38 | .formats = SNDRV_PCM_FMTBIT_S16_LE | |
41 | SNDRV_PCM_FMTBIT_U16_LE | | 39 | SNDRV_PCM_FMTBIT_U16_LE | |
42 | SNDRV_PCM_FMTBIT_U8 | | 40 | SNDRV_PCM_FMTBIT_U8 | |
@@ -248,15 +246,11 @@ static int dma_trigger(struct snd_pcm_substream *substream, int cmd) | |||
248 | 246 | ||
249 | switch (cmd) { | 247 | switch (cmd) { |
250 | case SNDRV_PCM_TRIGGER_START: | 248 | case SNDRV_PCM_TRIGGER_START: |
251 | case SNDRV_PCM_TRIGGER_RESUME: | ||
252 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | ||
253 | prtd->state |= ST_RUNNING; | 249 | prtd->state |= ST_RUNNING; |
254 | prtd->params->ops->trigger(prtd->params->ch); | 250 | prtd->params->ops->trigger(prtd->params->ch); |
255 | break; | 251 | break; |
256 | 252 | ||
257 | case SNDRV_PCM_TRIGGER_STOP: | 253 | case SNDRV_PCM_TRIGGER_STOP: |
258 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
259 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | ||
260 | prtd->state &= ~ST_RUNNING; | 254 | prtd->state &= ~ST_RUNNING; |
261 | prtd->params->ops->stop(prtd->params->ch); | 255 | prtd->params->ops->stop(prtd->params->ch); |
262 | break; | 256 | break; |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index a18d115bc507..873e6e76ee87 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -313,8 +313,11 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm, | |||
313 | if (dapm->codec->driver->set_bias_level) | 313 | if (dapm->codec->driver->set_bias_level) |
314 | ret = dapm->codec->driver->set_bias_level(dapm->codec, | 314 | ret = dapm->codec->driver->set_bias_level(dapm->codec, |
315 | level); | 315 | level); |
316 | } else | 316 | else |
317 | dapm->bias_level = level; | ||
318 | } else if (!card || dapm != &card->dapm) { | ||
317 | dapm->bias_level = level; | 319 | dapm->bias_level = level; |
320 | } | ||
318 | 321 | ||
319 | if (ret != 0) | 322 | if (ret != 0) |
320 | goto out; | 323 | goto out; |
diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c index 97c2cac8e92c..8c7f23729446 100644 --- a/sound/soc/spear/spear_pcm.c +++ b/sound/soc/spear/spear_pcm.c | |||
@@ -138,7 +138,7 @@ static void spear_pcm_free(struct snd_pcm *pcm) | |||
138 | continue; | 138 | continue; |
139 | 139 | ||
140 | buf = &substream->dma_buffer; | 140 | buf = &substream->dma_buffer; |
141 | if (!buf && !buf->area) | 141 | if (!buf || !buf->area) |
142 | continue; | 142 | continue; |
143 | 143 | ||
144 | dma_free_writecombine(pcm->card->dev, buf->bytes, | 144 | dma_free_writecombine(pcm->card->dev, buf->bytes, |
diff --git a/sound/soc/tegra/tegra_alc5632.c b/sound/soc/tegra/tegra_alc5632.c index e463529b38bb..76cb1b363b71 100644 --- a/sound/soc/tegra/tegra_alc5632.c +++ b/sound/soc/tegra/tegra_alc5632.c | |||
@@ -89,7 +89,6 @@ static struct snd_soc_jack_gpio tegra_alc5632_hp_jack_gpio = { | |||
89 | .name = "Headset detection", | 89 | .name = "Headset detection", |
90 | .report = SND_JACK_HEADSET, | 90 | .report = SND_JACK_HEADSET, |
91 | .debounce_time = 150, | 91 | .debounce_time = 150, |
92 | .invert = 1, | ||
93 | }; | 92 | }; |
94 | 93 | ||
95 | static const struct snd_soc_dapm_widget tegra_alc5632_dapm_widgets[] = { | 94 | static const struct snd_soc_dapm_widget tegra_alc5632_dapm_widgets[] = { |
diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c index 5658bcec1931..8d6900c1ee47 100644 --- a/sound/soc/tegra/tegra_pcm.c +++ b/sound/soc/tegra/tegra_pcm.c | |||
@@ -334,11 +334,11 @@ static int tegra_pcm_hw_params(struct snd_pcm_substream *substream, | |||
334 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 334 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
335 | slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | 335 | slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
336 | slave_config.dst_addr = dmap->addr; | 336 | slave_config.dst_addr = dmap->addr; |
337 | slave_config.src_maxburst = 0; | 337 | slave_config.dst_maxburst = 4; |
338 | } else { | 338 | } else { |
339 | slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | 339 | slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
340 | slave_config.src_addr = dmap->addr; | 340 | slave_config.src_addr = dmap->addr; |
341 | slave_config.dst_maxburst = 0; | 341 | slave_config.src_maxburst = 4; |
342 | } | 342 | } |
343 | slave_config.slave_id = dmap->req_sel; | 343 | slave_config.slave_id = dmap->req_sel; |
344 | 344 | ||
diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index 36be11e47ad6..1b7c2f58ce13 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c | |||
@@ -663,7 +663,6 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, | |||
663 | struct ux500_msp **msp_p, | 663 | struct ux500_msp **msp_p, |
664 | struct msp_i2s_platform_data *platform_data) | 664 | struct msp_i2s_platform_data *platform_data) |
665 | { | 665 | { |
666 | int ret = 0; | ||
667 | struct resource *res = NULL; | 666 | struct resource *res = NULL; |
668 | struct i2s_controller *i2s_cont; | 667 | struct i2s_controller *i2s_cont; |
669 | struct ux500_msp *msp; | 668 | struct ux500_msp *msp; |
@@ -687,15 +686,14 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, | |||
687 | if (res == NULL) { | 686 | if (res == NULL) { |
688 | dev_err(&pdev->dev, "%s: ERROR: Unable to get resource!\n", | 687 | dev_err(&pdev->dev, "%s: ERROR: Unable to get resource!\n", |
689 | __func__); | 688 | __func__); |
690 | ret = -ENOMEM; | 689 | return -ENOMEM; |
691 | goto err_res; | ||
692 | } | 690 | } |
693 | 691 | ||
694 | msp->registers = ioremap(res->start, (res->end - res->start + 1)); | 692 | msp->registers = devm_ioremap(&pdev->dev, res->start, |
693 | resource_size(res)); | ||
695 | if (msp->registers == NULL) { | 694 | if (msp->registers == NULL) { |
696 | dev_err(&pdev->dev, "%s: ERROR: ioremap failed!\n", __func__); | 695 | dev_err(&pdev->dev, "%s: ERROR: ioremap failed!\n", __func__); |
697 | ret = -ENOMEM; | 696 | return -ENOMEM; |
698 | goto err_res; | ||
699 | } | 697 | } |
700 | 698 | ||
701 | msp->msp_state = MSP_STATE_IDLE; | 699 | msp->msp_state = MSP_STATE_IDLE; |
@@ -707,7 +705,7 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, | |||
707 | dev_err(&pdev->dev, | 705 | dev_err(&pdev->dev, |
708 | "%s: ERROR: Failed to allocate I2S-controller!\n", | 706 | "%s: ERROR: Failed to allocate I2S-controller!\n", |
709 | __func__); | 707 | __func__); |
710 | goto err_i2s_cont; | 708 | return -ENOMEM; |
711 | } | 709 | } |
712 | i2s_cont->dev.parent = &pdev->dev; | 710 | i2s_cont->dev.parent = &pdev->dev; |
713 | i2s_cont->data = (void *)msp; | 711 | i2s_cont->data = (void *)msp; |
@@ -718,14 +716,6 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, | |||
718 | msp->i2s_cont = i2s_cont; | 716 | msp->i2s_cont = i2s_cont; |
719 | 717 | ||
720 | return 0; | 718 | return 0; |
721 | |||
722 | err_i2s_cont: | ||
723 | iounmap(msp->registers); | ||
724 | |||
725 | err_res: | ||
726 | devm_kfree(&pdev->dev, msp); | ||
727 | |||
728 | return ret; | ||
729 | } | 719 | } |
730 | 720 | ||
731 | void ux500_msp_i2s_cleanup_msp(struct platform_device *pdev, | 721 | void ux500_msp_i2s_cleanup_msp(struct platform_device *pdev, |
@@ -734,11 +724,6 @@ void ux500_msp_i2s_cleanup_msp(struct platform_device *pdev, | |||
734 | dev_dbg(msp->dev, "%s: Enter (id = %d).\n", __func__, msp->id); | 724 | dev_dbg(msp->dev, "%s: Enter (id = %d).\n", __func__, msp->id); |
735 | 725 | ||
736 | device_unregister(&msp->i2s_cont->dev); | 726 | device_unregister(&msp->i2s_cont->dev); |
737 | devm_kfree(&pdev->dev, msp->i2s_cont); | ||
738 | |||
739 | iounmap(msp->registers); | ||
740 | |||
741 | devm_kfree(&pdev->dev, msp); | ||
742 | } | 727 | } |
743 | 728 | ||
744 | MODULE_LICENSE("GPL v2"); | 729 | MODULE_LICENSE("GPL v2"); |
diff --git a/sound/usb/card.c b/sound/usb/card.c index d5b5c3388e28..4a469f0cb6d4 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c | |||
@@ -553,7 +553,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, | |||
553 | struct snd_usb_audio *chip) | 553 | struct snd_usb_audio *chip) |
554 | { | 554 | { |
555 | struct snd_card *card; | 555 | struct snd_card *card; |
556 | struct list_head *p; | 556 | struct list_head *p, *n; |
557 | 557 | ||
558 | if (chip == (void *)-1L) | 558 | if (chip == (void *)-1L) |
559 | return; | 559 | return; |
@@ -570,7 +570,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, | |||
570 | snd_usb_stream_disconnect(p); | 570 | snd_usb_stream_disconnect(p); |
571 | } | 571 | } |
572 | /* release the endpoint resources */ | 572 | /* release the endpoint resources */ |
573 | list_for_each(p, &chip->ep_list) { | 573 | list_for_each_safe(p, n, &chip->ep_list) { |
574 | snd_usb_endpoint_free(p); | 574 | snd_usb_endpoint_free(p); |
575 | } | 575 | } |
576 | /* release the midi resources */ | 576 | /* release the midi resources */ |
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index c41181202688..d6e2bb49c59c 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c | |||
@@ -141,7 +141,7 @@ int snd_usb_endpoint_implict_feedback_sink(struct snd_usb_endpoint *ep) | |||
141 | * | 141 | * |
142 | * For implicit feedback, next_packet_size() is unused. | 142 | * For implicit feedback, next_packet_size() is unused. |
143 | */ | 143 | */ |
144 | static int next_packet_size(struct snd_usb_endpoint *ep) | 144 | int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep) |
145 | { | 145 | { |
146 | unsigned long flags; | 146 | unsigned long flags; |
147 | int ret; | 147 | int ret; |
@@ -177,15 +177,6 @@ static void retire_inbound_urb(struct snd_usb_endpoint *ep, | |||
177 | ep->retire_data_urb(ep->data_subs, urb); | 177 | ep->retire_data_urb(ep->data_subs, urb); |
178 | } | 178 | } |
179 | 179 | ||
180 | static void prepare_outbound_urb_sizes(struct snd_usb_endpoint *ep, | ||
181 | struct snd_urb_ctx *ctx) | ||
182 | { | ||
183 | int i; | ||
184 | |||
185 | for (i = 0; i < ctx->packets; ++i) | ||
186 | ctx->packet_size[i] = next_packet_size(ep); | ||
187 | } | ||
188 | |||
189 | /* | 180 | /* |
190 | * Prepare a PLAYBACK urb for submission to the bus. | 181 | * Prepare a PLAYBACK urb for submission to the bus. |
191 | */ | 182 | */ |
@@ -370,7 +361,6 @@ static void snd_complete_urb(struct urb *urb) | |||
370 | goto exit_clear; | 361 | goto exit_clear; |
371 | } | 362 | } |
372 | 363 | ||
373 | prepare_outbound_urb_sizes(ep, ctx); | ||
374 | prepare_outbound_urb(ep, ctx); | 364 | prepare_outbound_urb(ep, ctx); |
375 | } else { | 365 | } else { |
376 | retire_inbound_urb(ep, ctx); | 366 | retire_inbound_urb(ep, ctx); |
@@ -799,7 +789,9 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, | |||
799 | /** | 789 | /** |
800 | * snd_usb_endpoint_start: start an snd_usb_endpoint | 790 | * snd_usb_endpoint_start: start an snd_usb_endpoint |
801 | * | 791 | * |
802 | * @ep: the endpoint to start | 792 | * @ep: the endpoint to start |
793 | * @can_sleep: flag indicating whether the operation is executed in | ||
794 | * non-atomic context | ||
803 | * | 795 | * |
804 | * A call to this function will increment the use count of the endpoint. | 796 | * A call to this function will increment the use count of the endpoint. |
805 | * In case it is not already running, the URBs for this endpoint will be | 797 | * In case it is not already running, the URBs for this endpoint will be |
@@ -809,7 +801,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, | |||
809 | * | 801 | * |
810 | * Returns an error if the URB submission failed, 0 in all other cases. | 802 | * Returns an error if the URB submission failed, 0 in all other cases. |
811 | */ | 803 | */ |
812 | int snd_usb_endpoint_start(struct snd_usb_endpoint *ep) | 804 | int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, int can_sleep) |
813 | { | 805 | { |
814 | int err; | 806 | int err; |
815 | unsigned int i; | 807 | unsigned int i; |
@@ -821,6 +813,11 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep) | |||
821 | if (++ep->use_count != 1) | 813 | if (++ep->use_count != 1) |
822 | return 0; | 814 | return 0; |
823 | 815 | ||
816 | /* just to be sure */ | ||
817 | deactivate_urbs(ep, 0, can_sleep); | ||
818 | if (can_sleep) | ||
819 | wait_clear_urbs(ep); | ||
820 | |||
824 | ep->active_mask = 0; | 821 | ep->active_mask = 0; |
825 | ep->unlink_mask = 0; | 822 | ep->unlink_mask = 0; |
826 | ep->phase = 0; | 823 | ep->phase = 0; |
@@ -850,7 +847,6 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep) | |||
850 | goto __error; | 847 | goto __error; |
851 | 848 | ||
852 | if (usb_pipeout(ep->pipe)) { | 849 | if (usb_pipeout(ep->pipe)) { |
853 | prepare_outbound_urb_sizes(ep, urb->context); | ||
854 | prepare_outbound_urb(ep, urb->context); | 850 | prepare_outbound_urb(ep, urb->context); |
855 | } else { | 851 | } else { |
856 | prepare_inbound_urb(ep, urb->context); | 852 | prepare_inbound_urb(ep, urb->context); |
diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h index ee2723fb174f..cbbbdf226d66 100644 --- a/sound/usb/endpoint.h +++ b/sound/usb/endpoint.h | |||
@@ -13,7 +13,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, | |||
13 | struct audioformat *fmt, | 13 | struct audioformat *fmt, |
14 | struct snd_usb_endpoint *sync_ep); | 14 | struct snd_usb_endpoint *sync_ep); |
15 | 15 | ||
16 | int snd_usb_endpoint_start(struct snd_usb_endpoint *ep); | 16 | int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, int can_sleep); |
17 | void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, | 17 | void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, |
18 | int force, int can_sleep, int wait); | 18 | int force, int can_sleep, int wait); |
19 | int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep); | 19 | int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep); |
@@ -21,6 +21,7 @@ int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep); | |||
21 | void snd_usb_endpoint_free(struct list_head *head); | 21 | void snd_usb_endpoint_free(struct list_head *head); |
22 | 22 | ||
23 | int snd_usb_endpoint_implict_feedback_sink(struct snd_usb_endpoint *ep); | 23 | int snd_usb_endpoint_implict_feedback_sink(struct snd_usb_endpoint *ep); |
24 | int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep); | ||
24 | 25 | ||
25 | void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep, | 26 | void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep, |
26 | struct snd_usb_endpoint *sender, | 27 | struct snd_usb_endpoint *sender, |
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 62ec808ed792..f782ce19bf5a 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c | |||
@@ -212,7 +212,7 @@ int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface, | |||
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | static int start_endpoints(struct snd_usb_substream *subs) | 215 | static int start_endpoints(struct snd_usb_substream *subs, int can_sleep) |
216 | { | 216 | { |
217 | int err; | 217 | int err; |
218 | 218 | ||
@@ -225,7 +225,7 @@ static int start_endpoints(struct snd_usb_substream *subs) | |||
225 | snd_printdd(KERN_DEBUG "Starting data EP @%p\n", ep); | 225 | snd_printdd(KERN_DEBUG "Starting data EP @%p\n", ep); |
226 | 226 | ||
227 | ep->data_subs = subs; | 227 | ep->data_subs = subs; |
228 | err = snd_usb_endpoint_start(ep); | 228 | err = snd_usb_endpoint_start(ep, can_sleep); |
229 | if (err < 0) { | 229 | if (err < 0) { |
230 | clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags); | 230 | clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags); |
231 | return err; | 231 | return err; |
@@ -236,10 +236,25 @@ static int start_endpoints(struct snd_usb_substream *subs) | |||
236 | !test_and_set_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags)) { | 236 | !test_and_set_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags)) { |
237 | struct snd_usb_endpoint *ep = subs->sync_endpoint; | 237 | struct snd_usb_endpoint *ep = subs->sync_endpoint; |
238 | 238 | ||
239 | if (subs->data_endpoint->iface != subs->sync_endpoint->iface || | ||
240 | subs->data_endpoint->alt_idx != subs->sync_endpoint->alt_idx) { | ||
241 | err = usb_set_interface(subs->dev, | ||
242 | subs->sync_endpoint->iface, | ||
243 | subs->sync_endpoint->alt_idx); | ||
244 | if (err < 0) { | ||
245 | snd_printk(KERN_ERR | ||
246 | "%d:%d:%d: cannot set interface (%d)\n", | ||
247 | subs->dev->devnum, | ||
248 | subs->sync_endpoint->iface, | ||
249 | subs->sync_endpoint->alt_idx, err); | ||
250 | return -EIO; | ||
251 | } | ||
252 | } | ||
253 | |||
239 | snd_printdd(KERN_DEBUG "Starting sync EP @%p\n", ep); | 254 | snd_printdd(KERN_DEBUG "Starting sync EP @%p\n", ep); |
240 | 255 | ||
241 | ep->sync_slave = subs->data_endpoint; | 256 | ep->sync_slave = subs->data_endpoint; |
242 | err = snd_usb_endpoint_start(ep); | 257 | err = snd_usb_endpoint_start(ep, can_sleep); |
243 | if (err < 0) { | 258 | if (err < 0) { |
244 | clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags); | 259 | clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags); |
245 | return err; | 260 | return err; |
@@ -544,13 +559,10 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) | |||
544 | subs->last_frame_number = 0; | 559 | subs->last_frame_number = 0; |
545 | runtime->delay = 0; | 560 | runtime->delay = 0; |
546 | 561 | ||
547 | /* clear the pending deactivation on the target EPs */ | ||
548 | deactivate_endpoints(subs); | ||
549 | |||
550 | /* for playback, submit the URBs now; otherwise, the first hwptr_done | 562 | /* for playback, submit the URBs now; otherwise, the first hwptr_done |
551 | * updates for all URBs would happen at the same time when starting */ | 563 | * updates for all URBs would happen at the same time when starting */ |
552 | if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) | 564 | if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) |
553 | return start_endpoints(subs); | 565 | return start_endpoints(subs, 1); |
554 | 566 | ||
555 | return 0; | 567 | return 0; |
556 | } | 568 | } |
@@ -1032,6 +1044,7 @@ static void prepare_playback_urb(struct snd_usb_substream *subs, | |||
1032 | struct urb *urb) | 1044 | struct urb *urb) |
1033 | { | 1045 | { |
1034 | struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; | 1046 | struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; |
1047 | struct snd_usb_endpoint *ep = subs->data_endpoint; | ||
1035 | struct snd_urb_ctx *ctx = urb->context; | 1048 | struct snd_urb_ctx *ctx = urb->context; |
1036 | unsigned int counts, frames, bytes; | 1049 | unsigned int counts, frames, bytes; |
1037 | int i, stride, period_elapsed = 0; | 1050 | int i, stride, period_elapsed = 0; |
@@ -1043,7 +1056,11 @@ static void prepare_playback_urb(struct snd_usb_substream *subs, | |||
1043 | urb->number_of_packets = 0; | 1056 | urb->number_of_packets = 0; |
1044 | spin_lock_irqsave(&subs->lock, flags); | 1057 | spin_lock_irqsave(&subs->lock, flags); |
1045 | for (i = 0; i < ctx->packets; i++) { | 1058 | for (i = 0; i < ctx->packets; i++) { |
1046 | counts = ctx->packet_size[i]; | 1059 | if (ctx->packet_size[i]) |
1060 | counts = ctx->packet_size[i]; | ||
1061 | else | ||
1062 | counts = snd_usb_endpoint_next_packet_size(ep); | ||
1063 | |||
1047 | /* set up descriptor */ | 1064 | /* set up descriptor */ |
1048 | urb->iso_frame_desc[i].offset = frames * stride; | 1065 | urb->iso_frame_desc[i].offset = frames * stride; |
1049 | urb->iso_frame_desc[i].length = counts * stride; | 1066 | urb->iso_frame_desc[i].length = counts * stride; |
@@ -1094,7 +1111,16 @@ static void prepare_playback_urb(struct snd_usb_substream *subs, | |||
1094 | subs->hwptr_done += bytes; | 1111 | subs->hwptr_done += bytes; |
1095 | if (subs->hwptr_done >= runtime->buffer_size * stride) | 1112 | if (subs->hwptr_done >= runtime->buffer_size * stride) |
1096 | subs->hwptr_done -= runtime->buffer_size * stride; | 1113 | subs->hwptr_done -= runtime->buffer_size * stride; |
1114 | |||
1115 | /* update delay with exact number of samples queued */ | ||
1116 | runtime->delay = subs->last_delay; | ||
1097 | runtime->delay += frames; | 1117 | runtime->delay += frames; |
1118 | subs->last_delay = runtime->delay; | ||
1119 | |||
1120 | /* realign last_frame_number */ | ||
1121 | subs->last_frame_number = usb_get_current_frame_number(subs->dev); | ||
1122 | subs->last_frame_number &= 0xFF; /* keep 8 LSBs */ | ||
1123 | |||
1098 | spin_unlock_irqrestore(&subs->lock, flags); | 1124 | spin_unlock_irqrestore(&subs->lock, flags); |
1099 | urb->transfer_buffer_length = bytes; | 1125 | urb->transfer_buffer_length = bytes; |
1100 | if (period_elapsed) | 1126 | if (period_elapsed) |
@@ -1112,12 +1138,32 @@ static void retire_playback_urb(struct snd_usb_substream *subs, | |||
1112 | struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; | 1138 | struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; |
1113 | int stride = runtime->frame_bits >> 3; | 1139 | int stride = runtime->frame_bits >> 3; |
1114 | int processed = urb->transfer_buffer_length / stride; | 1140 | int processed = urb->transfer_buffer_length / stride; |
1141 | int est_delay; | ||
1142 | |||
1143 | /* ignore the delay accounting when procssed=0 is given, i.e. | ||
1144 | * silent payloads are procssed before handling the actual data | ||
1145 | */ | ||
1146 | if (!processed) | ||
1147 | return; | ||
1115 | 1148 | ||
1116 | spin_lock_irqsave(&subs->lock, flags); | 1149 | spin_lock_irqsave(&subs->lock, flags); |
1117 | if (processed > runtime->delay) | 1150 | est_delay = snd_usb_pcm_delay(subs, runtime->rate); |
1118 | runtime->delay = 0; | 1151 | /* update delay with exact number of samples played */ |
1152 | if (processed > subs->last_delay) | ||
1153 | subs->last_delay = 0; | ||
1119 | else | 1154 | else |
1120 | runtime->delay -= processed; | 1155 | subs->last_delay -= processed; |
1156 | runtime->delay = subs->last_delay; | ||
1157 | |||
1158 | /* | ||
1159 | * Report when delay estimate is off by more than 2ms. | ||
1160 | * The error should be lower than 2ms since the estimate relies | ||
1161 | * on two reads of a counter updated every ms. | ||
1162 | */ | ||
1163 | if (abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2) | ||
1164 | snd_printk(KERN_DEBUG "delay: estimated %d, actual %d\n", | ||
1165 | est_delay, subs->last_delay); | ||
1166 | |||
1121 | spin_unlock_irqrestore(&subs->lock, flags); | 1167 | spin_unlock_irqrestore(&subs->lock, flags); |
1122 | } | 1168 | } |
1123 | 1169 | ||
@@ -1175,7 +1221,7 @@ static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream | |||
1175 | 1221 | ||
1176 | switch (cmd) { | 1222 | switch (cmd) { |
1177 | case SNDRV_PCM_TRIGGER_START: | 1223 | case SNDRV_PCM_TRIGGER_START: |
1178 | err = start_endpoints(subs); | 1224 | err = start_endpoints(subs, 0); |
1179 | if (err < 0) | 1225 | if (err < 0) |
1180 | return err; | 1226 | return err; |
1181 | 1227 | ||