Commit Graph

534518 Commits

Author SHA1 Message Date
Takashi Sakamoto 22c103cd3d ALSA: fireworks/bebob/dice/oxfw: fix substreams counting at vmalloc failure
In PCM core, when hw_params() in each driver returns error, the state of
PCM substream is kept as 'open'. In this case, current drivers for sound
units on IEEE 1394 bus doesn't decrement substream counter in hw_free()
correctly. This causes these drivers to keep streams even if not
required.

This commit fixes this bug. When snd_pcm_lib_alloc_vmalloc_buffer()
fails, hw_params function in each driver returns without incrementing the
counter.

Reported-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-29 09:14:41 +02:00
Yao-Wen Mao 6aa6925cad ALSA: usb-audio: correct the value cache check.
The check of cval->cached should be zero-based (including master channel).

Signed-off-by: Yao-Wen Mao <yaowen@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-28 10:38:25 +02:00
Takashi Iwai 0662292aec ALSA: usb-audio: Handle normal and auto-suspend equally
In theory, the device may get suspended even at runtime PM suspend.
Currently we don't save the mixer state for autopm, and it may bring
inconsistency.

This patch removes the special handling for autosuspend.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-26 16:12:25 +02:00
Takashi Iwai a6da499b76 ALSA: usb-audio: Replace probing flag with active refcount
We can use active refcount for preventing autopm during probe.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-26 15:40:18 +02:00
Takashi Iwai 47ab154593 ALSA: usb-audio: Avoid nested autoresume calls
After the recent fix of runtime PM for USB-audio driver, we got a
lockdep warning like:

  =============================================
  [ INFO: possible recursive locking detected ]
  4.2.0-rc8+ #61 Not tainted
  ---------------------------------------------
  pulseaudio/980 is trying to acquire lock:
   (&chip->shutdown_rwsem){.+.+.+}, at: [<ffffffffa0355dac>] snd_usb_autoresume+0x1d/0x52 [snd_usb_audio]
  but task is already holding lock:
   (&chip->shutdown_rwsem){.+.+.+}, at: [<ffffffffa0355dac>] snd_usb_autoresume+0x1d/0x52 [snd_usb_audio]

This comes from snd_usb_autoresume() invoking down_read() and it's
used in a nested way.  Although it's basically safe, per se (as these
are read locks), it's better to reduce such spurious warnings.

The read lock is needed to guarantee the execution of "shutdown"
(cleanup at disconnection) task after all concurrent tasks are
finished.  This can be implemented in another better way.

Also, the current check of chip->in_pm isn't good enough for
protecting the racy execution of multiple auto-resumes.

This patch rewrites the logic of snd_usb_autoresume() & co; namely,
- The recursive call of autopm is avoided by the new refcount,
  chip->active.  The chip->in_pm flag is removed accordingly.
- Instead of rwsem, another refcount, chip->usage_count, is introduced
  for tracking the period to delay the shutdown procedure.  At
  the last clear of this refcount, wake_up() to the shutdown waiter is
  called.
- The shutdown flag is replaced with shutdown atomic count; this is
  for reducing the lock.
- Two new helpers are introduced to simplify the management of these
  refcounts; snd_usb_lock_shutdown() increases the usage_count, checks
  the shutdown state, and does autoresume.  snd_usb_unlock_shutdown()
  does the opposite.  Most of mixer and other codes just need this,
  and simply returns an error if it receives an error from lock.

Fixes: 9003ebb13f ('ALSA: usb-audio: Fix runtime PM unbalance')
Reported-and-tested-by: Alexnader Kuleshov <kuleshovmail@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-26 15:38:25 +02:00
Takashi Iwai b25cf30a01 ALSA: hda - Remove superfluous pcm NULL check
The variable pcm can be never NULL since it was rewritten with
list_for_each_entry().

Suggested-by: Markus Osterhoff <linux-kernel@k-raum.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-26 14:21:14 +02:00
Takashi Iwai a92d5ee866 ALSA: hda - Fix widget sysfs tree corruption after refresh
When snd_hdac_refresh_widget_sysfs() is called before the first
hda_widget_sysfs_init(), the next call overrides and eventually
fails.  This results in unexpected Oops, something like:
  BUG: unable to handle kernel NULL pointer dereference at 00000000000000c8
  IP: [<ffffffff8180e2a3>] hdmi_chmap_ctl_info+0x23/0x40

The fix is to add a check of the existing sysfs tree.  Also, for more
safety, this patch adds the checks of device_is_registered() in
snd-hdac_refresh_wdiget_sysfs(), too.

Fixes: fa4f18b4f4 ('ALSA: hda - Refresh widgets sysfs at probing Haswell+ HDMI codecs')
Bugizlla: https://bugzilla.kernel.org/show_bug.cgi?id=103431
Reported-by: Andreas Reis <andreas.reis@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-26 07:43:47 +02:00
Takashi Iwai 654e2751c9 ALSA: ppc: Add missing inclusion of linux/module.h
Otherwise it triggers a compile warning like:
 sound/ppc/keywest.c:104:1: warning: data definition has no type or storage class
 sound/ppc/keywest.c:104:1: error: type defaults to 'int' in declaration of 'MODULE_DEVICE_TABLE' [-Werror=implicit-int]

Fixes: a2bc2af66a ('ALSA: ppc: keywest: Export I2C module alias information')
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-25 14:13:36 +02:00
Javier Martinez Canillas a2bc2af66a ALSA: ppc: keywest: Export I2C module alias information
The I2C core always reports the MODALIAS uevent as "i2c:<client name"
regardless if the driver was matched using the I2C id_table or the
of_match_table. So the driver needs to export the I2C table and this
be built into the module or udev won't have the necessary information
to auto load the correct module when the device is added.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-25 12:19:33 +02:00
Takashi Iwai 9dcc144b1f ALSA: hda - Refresh sysfs at snd_hda_codec_update_widgets()
In the commit [fa4f18b4f402: ALSA: hda - Refresh widgets sysfs at
probing Haswell+ HDMI codecs], snd_hdac_refresh_widget_sysfs() is
explicitly called in the codec driver.  But this results in refreshing
twice, as snd_hdac_refresh_widget_sysfs() itself calls
snd_hdac_refresh_widgets() function.

Instead, we can replace the call in snd_hda_codec_update_widgets()
with snd_hdac_refresh_widget_sysfs().  This also fixes the missing
sysfs update for ca0132, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-25 08:52:55 +02:00
Takashi Iwai c4a91e173a Merge branch 'for-linus' into for-next 2015-08-25 08:01:41 +02:00
Takashi Iwai c7cd0ef66a ALSA: hda - Fix path power activation
The widget power-saving code tries to turn up/down the power of each
widget in the I/O paths that are modified at each jack plug/unplug.
The recent report revealed that the power activation leaves some
widgets unpowered after plugging.  This is because
snd_hda_activate_path() turns on path->active flag at the end of the
function while the path power management is done before that.  Then
it's regarded as if nothing is active, and the driver turns off the
power.

The fix is simply to set the flag at the beginning of the function,
before trying to power up.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=102521
Cc: <stable@vger.kernel.org> [v4.1+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-25 07:59:02 +02:00
Takashi Iwai 9d2b48f730 ALSA: hda - Check all inputs for is_active_nid_for_any()
The is_active_nid_for_any() function in the generic parser is supposed
to check all connections from/to the given widget, but the current
code checks only the first input connection (index = 0).

This patch corrects the code to check all inputs by passing -1 to
index argument.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=102521
Cc: <stable@vger.kernel.org> [v4.1+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-25 07:59:01 +02:00
Markus Osterhoff c7e69ae6b4 ALSA: hda: fix possible NULL dereference
After a for-loop was replaced by list_for_each_entry, see
Commit bbbc7e8502 ("ALSA: hda - Allocate hda_pcm objects dynamically"),
Commit 751e221689 ("ALSA: hda: fix possible null dereference"),
a possible NULL pointer dereference has been introduced; this patch adds
the NULL check on pcm->pcm, while leaving a potentially superfluous
check on pcm itself untouched.

Signed-off-by: Markus Osterhoff <linux-kernel@k-raum.org>
Cc: <stable@vger.kernel.org> #v4.1+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-24 15:02:03 +02:00
Jeeja KP 4308c9b083 ALSA: hdac: Add snd_hdac_get_hdac_stream()
Add a helper to find the stream using stream tag and direction.
This is useful for drivers to query stream based on stream tag
and direction, fox example while downloading FW thru DSP loader
code

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-23 09:43:27 +02:00
Vinod Koul 54d1d2f5f0 ALSA: hdac: fix the spbmaxfifo API
spbmaxfifo API is actually a query function not a set function so
name it snd_hdac_ext_stream_get_spbmaxfifo()

Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-23 09:43:26 +02:00
Vinod Koul e57690b1ae ALSA: hdac: Fix size allocation for ext device allocation
While creating hdac_ext_device, we used hdev for sizeof insteadof
edev, which resulted in eventual crash of the system Fix the size
here

Fixes: a512f56116 ('ALSA: hdac: add hdac extended device')
Reported-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-23 09:43:25 +02:00
Dan Carpenter a3b3a9db5d ALSA: hdsp: silence a sprinft() overflow warning
card->shortname is a 32 char string so the sprintf() can theoretically
overflow.  snd_rawmidi_new() can accept strings up to 64 bytes long.

I have made the temporay buf[] array 40 bytes long and changed the
sprintf() to snprintf().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-22 11:36:26 +02:00
Jeeja KP f09d4f26f6 ALSA: hdac: Remove the usage of key for host stream
hdac_ext_stream assign doesn't require key mapping as in case of
hdac_stream. So for host stream, the key to device mapping needs
to be removed.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21 19:28:21 +02:00
Jeeja KP ee8bc4df1b ALSA: hdac: Add support to enable SPIB for hdac ext stream
The drivers need to set the spib and maxfifios values, so add
these new APIs snd_hdac_ext_stream_set_spib() and
snd_hdac_ext_stream_set_spbmaxfifo() APIs

For these APIs we also need to have spib and fifos pointer, so
add these to hdac_ext_stream and initialize them at stream init

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21 19:28:20 +02:00
Jeeja KP c5b0c09b8f ALSA: hdac: Add snd_hdac_ext_bus_link_power_down_all()
New HDA controllers like Skylake sport multiple HDA links, so we need a
helper to turn off all the links in one go while suspending the device so
add snd_hdac_ext_bus_link_power_down_all() API

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21 19:28:18 +02:00
Jeeja KP a7e3dd85ca ALSA: hdac: Fix to read the correct offset of spcap/link register
SPCAP and Mutilink register offset were incorrect as offset needs
to be based on capability offset. So correct the offset for
read/write of spcap/link register.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21 19:28:16 +02:00
Lars-Peter Clausen 9bc07dfbcd ALSA: ac97: Switch to dev_pm_ops
Convert the ac97_bus from legacy suspend/resume callbacks to dev_pm_ops.

Since there isn't anything special to do at the bus level the bus driver
does not have to implement any callbacks. The device driver core will
automatically pick up and execute the device's PM ops.

As there is only a single AC'97 driver implementing suspend and resume,
update both the core and driver at the same time to avoid unnecessary code
churn.

While we are at it also drop the ifdefs around the suspend/resume functions
to increase compile test coverage.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21 19:27:23 +02:00
Takashi Iwai 00833d70ca Merge branch 'for-linus' into for-next 2015-08-21 19:26:48 +02:00
Takashi Iwai fa4f18b4f4 ALSA: hda - Refresh widgets sysfs at probing Haswell+ HDMI codecs
Intel Haswell (and later) codec refreshes the widgets tree to expose
the whole widget nodes at probing.  However, this refresh was missing
for sysfs tree.

This patch adds the missing piece, as we have now a proper API.

Reported-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21 15:11:52 +02:00
Dan Carpenter 9e46aedab3 ALSA: hdsp: silence and underflow warning
I believe this probably cannot happen, as the code suggests.  There
would have to be an kcontrol->index.id which was zero, otherwise this
would be prevented in snd_ctl_find_id().  But snd_BUG_ON() is just a
WARN() or a no-op so static checkers complain that we keep on going with
a negative offset.  Let's just handle the error as well as printing
a warning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21 14:12:45 +02:00
Vinod Koul 18dfd79d92 ALSA: hdac: add snd_hdac_refresh_widget_sysfs()
Some codecs like Intel HDMI by default do not show up all the pins, they
have to be manually enabled, so we need to refresh the codec widgets and
then recreate the sysfs tree. So add new API snd_hdac_refresh_widget_sysfs()
to do this. It should be be used by codec driver after sending magic verbs
to codec

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21 12:34:50 +02:00
Vinod Koul d51783c15f ALSA: hdac: add extended device driver registration
This adds new extended driver objects and API for registering the
extended devices.

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21 12:34:02 +02:00
Vinod Koul a512f56116 ALSA: hdac: add hdac extended device
This adds based hdac extended device object which will be used by
ASoC HDAC codecs

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21 12:34:01 +02:00
Vinod Koul ee2d51b3d4 ALSA: hdac: Add API for removing hdac extended device
The HDAC extended device objects are created by HDAC extended bus on probe.
When controller is removed they should be removed as well, so add API
snd_hdac_ext_bus_device_remove for this

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21 12:34:00 +02:00
David Henningsson f6b28e4ded ALSA: hda - Shutdown CX20722 on reboot/free to avoid spurious noises
On shutdown/reboot of CX20722, first shut down all EAPDs, then
shut down the afg node to D3.

Failure to do so can lead to spurious noises from the internal speaker
directly after reboot (and before the codec is reinitialized again, i e
in BIOS setup or GRUB menus).

BugLink: https://bugs.launchpad.net/bugs/1487345
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21 10:28:00 +02:00
Jurgen Kramer 9544f8b6e2 ALSA: usb: Add native DSD support for Gustard DAC-X20U
This patch adds native DSD support for the Gustard DAC-X20U.

Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-21 10:27:35 +02:00
Takashi Iwai e24b6c03a1 ASoC: Disable topology support for v4.2
The topology code merged in the v4.2 merge window introduced a new ABI
 which was believed to be suitable for use but subsequently additional
 work by the developers of this feature have revealed some problems that
 need to be addressed.  In order to allow this to be done without having
 to support the initial ABI add Kconfig to disable the build and also add
 some #error statements to the UAPI header so users can't use them.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJV1K6xAAoJECTWi3JdVIfQl60H/Aiq3smUvb+npgLI402pdzZ8
 eaGVSw1oGO7NFylBDu8FeiJLBvl4ZQmSfMbaLBJ50JPKqY1nFjOXFk0nWatQ8TPY
 0aB1NKCIGNNCWXTO3ABZ8zeT5AH218n3t8tTUxWzOS1RhpZMwePVuS83+cdwfxAZ
 He29rX2xfKFaGo92NMB707vU6aobYC0jc4pIaVoYLN7E49leTSzgGKKNVW2JyEog
 d44Zd7jEXPY1lj166sEEF4axAzGc2ZkwsbmOmymbszEBkYtDVs1Q1omFf+CNi31Y
 16bLwOVzTXVM7PeheRF2Tp6qtcyDpQhLicfBjakkJ1X5MtW3OzoutGli/isIh2g=
 =Gj9l
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v4.2-disable-topology' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Disable topology support for v4.2

The topology code merged in the v4.2 merge window introduced a new ABI
which was believed to be suitable for use but subsequently additional
work by the developers of this feature have revealed some problems that
need to be addressed.  In order to allow this to be done without having
to support the initial ABI add Kconfig to disable the build and also add
some #error statements to the UAPI header so users can't use them.
2015-08-19 18:31:54 +02:00
Julian Scheel 9430e54789 ALSA: usb-audio: Recurse before saving terminal properties
The input terminal parser recurses into the referenced clock entity to verify
it is existant and thus the terminal descriptor is valid. The actual property
values of the term instance which is initially parsed must not be overriden by
the recursion. For this to work the term properties have to be assigned after
recursing into the referenced clock entity descriptors.

Signed-off-by: Julian Scheel <julian@jusst.de>
Acked-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-19 18:05:13 +02:00
Rick Sherman 59a51a6b4b ALSA: hda - Add dock support for Thinkpad W541 (17aa:2211)
Tested with W541 and Ultra Dock 170w

Signed-off-by: Rick Sherman <rick@shermdog.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-19 14:59:39 +02:00
Takashi Iwai 9003ebb13f ALSA: usb-audio: Fix runtime PM unbalance
The fix for deadlock in PM in commit [1ee23fe07ee8: ALSA: usb-audio:
Fix deadlocks at resuming] introduced a new check of in_pm flag.
However, the brainless patch author evaluated it in a wrong way
(logical AND instead of logical OR), thus usb_autopm_get_interface()
is wrongly called at probing, leading to unbalance of runtime PM
refcount.

This patch fixes it by correcting the logic.

Reported-by: Hans Yang <hansy@nvidia.com>
Fixes: 1ee23fe07e ('ALSA: usb-audio: Fix deadlocks at resuming')
Cc: <stable@vger.kernel.org> [v3.15+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-19 14:57:51 +02:00
Mark Brown 8c90503bf2 ASoC: topology: Disable use from userspace
Since the topology API is still in sufficient flux for changes to be
identified disable the use of the userspace ABI by adding #error
statements to the code, ensuring that nobody relies on the headers as
currently defined.  It is expected that this change will be reverted for
v4.3.

Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-18 09:33:21 -07:00
Mark Brown 78b50f3914 ASoC: topology: Add Kconfig option for topology
Allow the topology code to be compiled out so that users who don't need
topology don't need to havve the code compiled in, saving them some
memory.

Some more configuration could be added to remove some of the hooks into
the core data structures but that is probably best done with some
refactoring to use functions to do the updates of the data structures
rather than ifdefing in the code as we'd need to do at the minute.

Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-17 22:45:47 -07:00
Takashi Iwai d5cf00c7ac ALSA: hda/eld - Add const to possible places
Similar like the previous fix to hda_proc.c, adding const prefix will
save our world (a little bit).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-17 15:12:14 +02:00
Takashi Iwai 1d260d7b3b ALSA: hda/proc - Fix racy string access for power states
The power states in a proc file are printed in a racy manner on a
single static string buffer.  Fix it by calling snd_iprintf() directly
for each state instead of processing on a temporary buffer.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-17 15:12:04 +02:00
Takashi Iwai cc75cdfe1d ALSA: hda/proc - Add const to possible places
Many arrays in hda_proc.c are string arrays that should be covered by
const prefix for increasing the safety and reducing the size.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-17 15:11:31 +02:00
Takashi Iwai d2c6b63df5 ALSA: hda - Make some helper functions local
A few helper functions to convert the pin information to strings have
been exported with assumption that they were used by other drivers.
But they are referred only in the proc interface in the end.

Let's make them local so that we can get rid of a few exports.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-17 15:10:15 +02:00
Pierre-Louis Bossart 395ae54bd8 ALSA: usb: handle descriptor with SYNC_NONE illegal value
The M-Audio Transit exposes an interface with a SYNC_NONE attribute.
This is not a valid value according to the USB audio classspec. However
there is a sync endpoint associated to this record. Changing the logic to
try to use this sync endpoint allows for seamless transitions between
altset 2 and altset 3. If any errors happen, the behavior remains the same.

$ more /proc/asound/card1/stream0
M-Audio Transit USB at usb-0000:00:14.0-2, full speed : USB Audio

Playback:
  Status: Stop
  Interface 1
    Altset 1
    Format: S24_3LE
    Channels: 2
    Endpoint: 3 OUT (ADAPTIVE)
    Rates: 48001 - 96000 (continuous)
  Interface 1
    Altset 2
    Format: S24_3LE
    Channels: 2
    Endpoint: 3 OUT (NONE)
    Rates: 8000 - 48000 (continuous)
  Interface 1
    Altset 3
    Format: S16_LE
    Channels: 2
    Endpoint: 3 OUT (ASYNC)
    Rates: 8000 - 48000 (continuous)

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-16 08:48:47 +02:00
Pierre-Louis Bossart 630184477e ALSA: usb: fix corrupted pointers due to interface setting change
When a transition occurs between alternate settings that do not use the
same synchronization method, the substream pointers were not reset.
This prevents audio from being played during the second transition.

Identified and tested with M-Audio Transit device
(0763:2006 Midiman M-Audio Transit)

Details of the issue:

First playback to adaptive endpoint:
$ aplay -Dhw:1,0 ~/24_96.wav
Playing WAVE '/home/plb/24_96.wav' : Signed 24 bit Little Endian in 3bytes,
Rate 96000 Hz, Stereo

[ 3169.297556] usb 1-2: setting usb interface 1:1
[ 3169.297568] usb 1-2: Creating new playback data endpoint #3
[ 3169.298563] usb 1-2: Setting params for ep #3 (type 0, 3 urbs), ret=0
[ 3169.298574] usb 1-2: Starting data EP @ffff880035fc8000

first playback to asynchronous endpoint:
$ aplay -Dhw:1,0 ~/16_48.wav
Playing WAVE '/home/plb/16_48.wav' : Signed 16 bit Little Endian,
Rate 48000 Hz, Stereo

[ 3204.520251] usb 1-2: setting usb interface 1:3
[ 3204.520264] usb 1-2: Creating new playback data endpoint #3
[ 3204.520272] usb 1-2: Creating new capture sync endpoint #83
[ 3204.521162] usb 1-2: Setting params for ep #3 (type 0, 4 urbs), ret=0
[ 3204.521177] usb 1-2: Setting params for ep #83 (type 1, 4 urbs), ret=0
[ 3204.521182] usb 1-2: Starting data EP @ffff880035fce000
[ 3204.521204] usb 1-2: Starting sync EP @ffff8800bd616000

second playback to adaptive endpoint: no audio and error on terminal:
$ aplay -Dhw:1,0 ~/24_96.wav
Playing WAVE '/home/plb/24_96.wav' : Signed 24 bit Little Endian in 3bytes,
Rate 96000 Hz, Stereo
aplay: pcm_write:1939: write error: Input/output error

[ 3239.483589] usb 1-2: setting usb interface 1:1
[ 3239.483601] usb 1-2: Re-using EP 3 in iface 1,1 @ffff880035fc8000
[ 3239.484590] usb 1-2: Setting params for ep #3 (type 0, 4 urbs), ret=0
[ 3239.484606] usb 1-2: Setting params for ep #83 (type 1, 4 urbs), ret=0

This last line shows that a sync endpoint is used when it shouldn't.
The sync endpoint is no longer valid and the pointers are corrupted

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-16 08:48:35 +02:00
Julian Scheel bc18e31c30 ALSA: usb-audio: Fix parameter block size for UAC2 control requests
USB Audio Class version 2.0 supports three different parameter block sizes for
CUR requests, which are 1 byte (5.2.3.1 Layout 1 Parameter Block), 2 bytes
(5.2.3.2 Layout 2 Parameter Block) and 4 bytes (5.2.3.3 Layout 3 Parameter
Block). Use the correct size according to the specific control as it was
already done for UACv1. The allocated block size for control requests is
increased to support the 4 byte worst case.

Signed-off-by: Julian Scheel <julian@jusst.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-14 16:26:50 +02:00
Woodrow Shen 7ccb0a9917 ALSA: hda - Fix the white noise on Dell laptop
Dell laptop causes the white noise by login screen and headphone,
and the fixup function ALC292_FIXUP_DISABLE_AAMIX can eliminate this
noise.

Codec: Realtek ALC3235
Vendor Id: 0x10ec0293
Subsystem Id: 0x102806db

Cc: <stable@vger.kernel.org>
BugLink: https://bugs.launchpad.net/bugs/1484334
Signed-off-by: Woodrow Shen <woodrow.shen@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-13 07:56:44 +02:00
Takashi Iwai 41450b1b5b Merge branch 'for-linus' into for-next 2015-08-11 09:40:16 +02:00
Takashi Iwai fe14f39e88 ALSA: hda - Fix pin config and mapping on Alienware 15
Alienware 15 has CA0132 codec for its onboard sound, but the pin
config and mapping seem quite different from other Creative boards.
This patch corrects them, at least, for providing the right headphone
and mic jack notification, as well as removing the non-existing SPDIF
pins.

Even with this fix, not all stuff works perfectly yet, mainly because
of the badly written ca0132 driver code -- it has too many implicit
assumptions of pin configs and maps.  Nevertheless, this is a small
good step forward.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=101981
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-10 16:53:32 +02:00
Mark Brown 3f6175ece9 ALSA: echoaudio: Use standard C definitions of true and false
The echoaudio locally defines TRUE and FALSE.  Not only is this
redundant given that C now has a boolean type it results in lots of
warnings as other headers also define these macros, causing duplicate
definitions.  Fix this by removing the local defines and converting all
local users to use the standard C true and false instead, simply
removing the macros is less safe due to implicit inclusion of the other
definitons.

[fixed overlooked replacement of FALSE by tiwai]

Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-10 14:27:16 +02:00
Andrzej Hajda 96bab82f6b ALSA: firewire: use kmemdup rather than duplicating its implementation
The patch was generated using fixed coccinelle semantic patch
scripts/coccinelle/api/memdup.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2014320

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-07 14:52:07 +02:00