Commit graph

27959 commits

Author SHA1 Message Date
Takashi Sakamoto fb8027ebfd ALSA: control: delegate TLV eventing to each driver
In a design of ALSA control core, a set of elements is represented by
'struct snd_kcontrol' to share common attributes. The set of elements
shares TLV (Type-Length-Value) data, too.

On the other hand, in ALSA control interface/protocol for applications,
a TLV operation is committed to an element. Totally, the operation can
have sub-effect to the other elements in the set. For example, TLV_WRITE
operation is expected to change TLV data, which returns to applications.
Applications attempt to change the TLV data per element, but in the above
design, they can effect to elements in the same set.

As a default, ALSA control core has no implementation except for TLV_READ
operation. Thus, the above design looks to have no issue. However, in
kernel APIs of ALSA control component, developers can program a handler
for any request of the TLV operation. Therefore, for elements in a set
which has the handler, applications can commit TLV_WRITE and TLV_COMMAND
requests.

For the above scenario, ALSA control core assist notification. When the
handler returns positive value, the core queueing an event for a requested
element. However, this includes design defects that the event is not
queued for the other element in a set. Actually, developers can program
the handlers to keep per-element TLV data, but it depends on each driver.

As of v4.13-rc6, there's no driver in tree to utilize the notification,
except for user-defined element set. This commit delegates the notification
into each driver to prevent developers from the design defects.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-24 09:15:13 +02:00
Arvind Yadav 5d3806eea2 ALSA: nm256: constify snd_ac97_res_table
snd_ac97_res_table are not supposed to change at runtime. All functions
working with snd_ac97_res_table provided by <sound/ac97_codec.h> work with
const snd_ac97_res_table. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-24 09:13:43 +02:00
Subhransu S. Prusty 9149916f1e ASoC: Intel: Skylake: Fix uninitialized return
On failure to get dsp_ops, dsp_init returns error without assigning ret. ret
is assigned in code path which will never be executed. Fix it.

Fixes: f77d443c4c ("ASoC: Intel: Skylake: Fix to free resources for dsp_init failure"
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-23 16:50:21 +01:00
Bhumika Goyal cd6d6477f1 ASoC: rt5645: make rt5645_platform_data const
Make these const as they are only used during a copy operation.
Done using Coccinelle.

@match disable optional_qualifier@
identifier s;
@@
static struct rt5645_platform_data s = {...};

@ref@
position p;
identifier match.s;
@@
s@p

@good1@
position ref.p;
identifier match.s,f,c;
expression e;
@@
(
e = s@p
|
e = s@p.f
|
c(...,s@p.f,...)
|
c(...,s@p,...)
)

@bad depends on  !good1@
position ref.p;
identifier match.s;
@@
s@p

@depends on forall !bad disable optional_qualifier@
identifier match.s;
@@
static
+ const
struct rt5645_platform_data s;

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-23 16:50:00 +01:00
Bhumika Goyal faa119099e ALSA: ctxfi: make hw structures const
Make these const as they are only used in a copy operation.
Done using Coccinelle:

@match disable optional_qualifier@
identifier s;
@@
static struct hw s = {...};

@ref@
position p;
identifier match.s;
@@
s@p

@good1@
position ref.p;
identifier match.s,f,c;
expression e;
@@
(
e = s@p
|
e = s@p.f
|
c(...,s@p.f,...)
|
c(...,s@p,...)
)

@bad depends on  !good1@
position ref.p;
identifier match.s;
@@
s@p

@depends on forall !bad disable optional_qualifier@
identifier match.s;
@@
static
+ const
struct hw s;

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-23 15:55:18 +02:00
Arvind Yadav 668d06165c ALSA: intel8x0: constify ac97_pcm structures
ac97_pcm are not supposed to change at runtime. All functions
working with ac97_pcm provided by <sound/ac97_codec.h> work with
const ac97_pcm. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-23 15:53:40 +02:00
Arvind Yadav 9715f0bdb6 ALSA: atiixp: constify ac97_pcm structures
ac97_pcm are not supposed to change at runtime. All functions
working with ac97_pcm provided by <sound/ac97_codec.h> work with
const ac97_pcm. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-23 15:53:39 +02:00
Arvind Yadav 3ca8590be8 ALSA: ac97c: constify ac97_pcm structures
ac97_pcm are not supposed to change at runtime. All functions
working with ac97_pcm provided by <sound/ac97_codec.h> work with
const ac97_pcm. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-23 15:53:38 +02:00
Arvind Yadav 9b419cd41b ALSA: aaci: constify ac97_pcm structures
ac97_pcm are not supposed to change at runtime. All functions
working with ac97_pcm provided by <sound/ac97_codec.h> work with
const ac97_pcm. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-23 15:53:37 +02:00
Markus Elfring af43173c80 ALSA: fireface: Use common error handling code in pcm_open()
Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-23 15:52:44 +02:00
Pierre-Louis Bossart c26d8389be ASoC: codecs: rt5670: add jack detection quirk for Dell Venue 5585
Jack is not detected by default, using jdmode=3 works fine

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-23 12:20:58 +01:00
Pierre-Louis Bossart cb0236eca7 ASoC: codecs: rt5645: add quirks for Asus T100HA
Fix jack detection and dmic setup

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-23 12:20:31 +01:00
Subhransu S. Prusty 7b992c24de ASoC: Intel: Skylake: Fix DSP core ref count for init failure
During dsp init failure, the ref count is not incremented and dsp is
powered down. But as the skl driver calls put_core for the init failure it
decrements the dsp core ref count and ref count becomes unbalanced.

This results in dsp core powered up in further runtime suspend/resume
cycles and never powered down.

So increment the ref count before dsp core powerup and for any failure,
decrement in put_core will be balanced.

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-23 11:55:18 +01:00
Subhransu S. Prusty c360e0c3ab ASoC: Intel: Skylake: Fix to free correct dev id in free_irq
The dev_id passed by the driver in request_threaded_irq is an ebus pointer,
whereas to free_irq it is hdac_bus. Fix by passing correct dev_id to
free_irq.

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-23 11:55:14 +01:00
Subhransu S. Prusty f77d443c4c ASoC: Intel: Skylake: Fix to free resources for dsp_init failure
unmap mmio and free memory resources if dsp_init fails.

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-23 11:55:11 +01:00
Subhransu S. Prusty 3b3011adad ASoC: Intel: Skylake: Fix to free dsp resource on ipc_init failure
For some dsp init error path, irq and few more resources are not freed.
This results in oops. So, fix it by freeing up the resources on ipc_init
failure.

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-23 11:55:07 +01:00
Markus Elfring 731209cc04 ALSA: usb-midi: Use common error handling code in __snd_usbmidi_create()
Add jump targets so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-23 12:53:57 +02:00
Kuninori Morimoto 0995fb7c98 ASoC: audio-graph-scu-card: Add pm callbacks to platform driver
Set snd_soc_pm_ops for the pm ops to make sure that the ASoC level of PM
operations are going to happen. This is needed to get suspend/resume
working correctly when the audio is using audio-graph-scu-card.

Reported-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-23 11:19:02 +01:00
Kuninori Morimoto 7b828a35ff ASoC: audio-graph-card: Add pm callbacks to platform driver
Set snd_soc_pm_ops for the pm ops to make sure that the ASoC level of PM
operations are going to happen. This is needed to get suspend/resume
working correctly when the audio is using audio-graph-card.

Reported-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-23 11:18:59 +01:00
Kuninori Morimoto b4e0180306 ASoC: simple-scu-card: Add pm callbacks to platform driver
Set snd_soc_pm_ops for the pm ops to make sure that the ASoC level of PM
operations are going to happen. This is needed to get suspend/resume
working correctly when the audio is using simple-scu-card.

Reported-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-23 11:18:56 +01:00
Kuninori Morimoto 6cbcad079e ASoC: wm8524: remove unnecessary snd_soc_unregister_platform()
wm8524 doesn't register platform, unregister platform is not needed

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-23 11:12:17 +01:00
Takashi Iwai f3f7df7635 ASoC: tegra: Fix unused variable warning
Fixes: 2a8bd83af3 ("ASoC: tegra: Remove superfluous snd_soc_jack_free_gpios() call")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-23 10:52:10 +01:00
Markus Elfring 1ae0e4ce55 ALSA: timer: Use common error handling code in alsa_timer_init()
Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-23 10:39:09 +02:00
Markus Elfring dd1f7ab8a8 ALSA: timer: Adjust a condition check in snd_timer_resolution()
The script "checkpatch.pl" pointed information out like the following.

ERROR: do not use assignment in if condition

Thus fix the affected source code place.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-23 10:37:15 +02:00
Markus Elfring c8da9be4a7 ALSA: pcm: Adjust nine function calls together with a variable assignment
The script "checkpatch.pl" pointed information out like the following.

ERROR: do not use assignment in if condition

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-23 10:36:18 +02:00
Markus Elfring 97d15a141f ALSA: pcm: Use common error handling code in _snd_pcm_new()
Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-23 10:35:50 +02:00
Takashi Iwai bbba6f9d3d ALSA: hda - Add stereo mic quirk for Lenovo G50-70 (17aa:3978)
Lenovo G50-70 (17aa:3978) with Conexant codec chip requires the
similar workaround for the inverted stereo dmic like other Lenovo
models.

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1020657
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-23 09:30:17 +02:00
Markus Elfring e17a85eccf ALSA: cmipci: Use common error handling code in snd_cmipci_probe()
Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-22 20:06:10 +02:00
Takashi Iwai 62a9394771 ALSA: hda - Implement mic-mute LED mode enum
Dell laptops have another LED for mic-mute in addition to the master
mute.  The former is tied with the capture switch (in a reverse way)
while the latter is tied with the master playback switch.  We already
have an enum control to change the behavior for the master mute LED in
different ways, e.g. keeping always off or turning off at mute.  But,
the mic-mute LED has no such management but its behavior is
hard-coded.

This patch implements an enum control to change the mic-mute LED
behavior like what we have for the master mute LED.  The ctl provides
four modes: keep-on, keep-off, follow-capture and follow-mute.  The
default mode is the last one, follow-mute, which follows the capture
mute, i.e. LED turning on when the capture is off, and turning off
when the capture is active.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-22 19:44:04 +02:00
Markus Elfring cbb7eb20bb ALSA: ctxfi: Use common error handling code in two functions
Add jump targets so that a bit of exception handling can be better reused
at the end of these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-22 19:43:29 +02:00
Jeffy Chen f628c4ed3d ASoC: rockchip: Correct 'dmic-delay' property name
The 'dmic-delay' property name is different with the dt-binding.

So correct it with 'dmic-wakeup-delay-ms'.

Fixes: 3a6f9dce61 (ASoC: rk3399_gru_sound: fix recording pop at first attempt)
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-22 17:20:32 +01:00
Markus Elfring 2cded8c891 ALSA: pcsp: Use common error handling code in snd_card_pcsp_probe()
Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-22 17:49:21 +02:00
Kuninori Morimoto c16293560a ASoC: rsnd: remove unused rsnd_xxx_to_dma()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-22 16:30:57 +01:00
Takashi Iwai e8a91ae18b ALSA: ice1712: Add support for STAudio ADCIII
STAudio ADCIII has the same SSID as Hoontech STDSP24, but requires a
slightly different configuration.  This patch allows user to choose
this model via model=staudio option to set the proper configuration
for the board.

Bugzilla: http://bugzilla.suse.com/show_bug.cgi?id=1048934
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-22 16:58:59 +02:00
Helge Deller c8dbaa2261 parisc/harmony: Fix section mismatches
Signed-off-by: Helge Deller <deller@gmx.de>
2017-08-22 16:34:35 +02:00
Takashi Sakamoto 782fbec745 ALSA: firewire: add const qualifier to identifiers for read-only symbols
Drivers in ALSA firewire stack still includes some symbols which can be
moved to a section for read-only symbols.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-22 16:08:00 +02:00
Takashi Iwai 241bc82e62 Merge branch 'for-linus' into for-next
Conflicts:
	sound/core/control.c
2017-08-22 15:44:45 +02:00
Takashi Iwai 88c54cdf61 ALSA: core: Fix unexpected error at replacing user TLV
When user tries to replace the user-defined control TLV, the kernel
checks the change of its content via memcmp().  The problem is that
the kernel passes the return value from memcmp() as is.  memcmp()
gives a non-zero negative value depending on the comparison result,
and this shall be recognized as an error code.

The patch covers that corner-case, return 1 properly for the changed
TLV.

Fixes: 8aa9b586e4 ("[ALSA] Control API - more robust TLV implementation")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-22 15:43:40 +02:00
Takashi Iwai 804e73adf5 ASoC: rt5670: Fix GPIO headset detection regression
RT5670 codec driver and its machine driver for Intel CHT assume the
implicit GPIO mapping on the index 0 while BIOS on most devices don't
provide it.  The recent commit f10e4bf663 ("gpio: acpi: Even more
tighten up ACPI GPIO lookups") restricts such cases and it resulted in
a regression where the headset jack setup fails like:

  rt5670 i2c-10EC5672:00: ASoC: Cannot get gpio at index 0: -2
  rt5670 i2c-10EC5672:00: Adding jack GPIO failed

For fixing this, we need to provide the GPIO mapping explicitly in the
machine driver.  Also this patch corrects the string to be passed to
gpiolib to match with the pre-given mapping, too.

Fixes: f10e4bf663 ("gpio: acpi: Even more tighten up ACPI GPIO lookups")
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=115531
Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-22 13:48:34 +01:00
Jeffy Chen 4958471b0d ASoC: soc-core: Allow searching dai driver name in snd_soc_find_dai
Currently we are searching dai name in snd_soc_find_dai, which could
either be dai driver name or component device name(for legacy naming).

Allow searching dai driver name in snd_soc_find_dai too, so that we can
use dai driver name to find legacy naming dais.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-22 13:45:55 +01:00
Takashi Iwai 2a8bd83af3 ASoC: tegra: Remove superfluous snd_soc_jack_free_gpios() call
Since jack gpios are managed via devres, we don't have to call
snd_jack_free_gpios() at release any longer.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-22 13:39:07 +01:00
Takashi Iwai 790b82898d ASoC: samsung: Remove superfluous snd_soc_jack_free_gpios() call
Since jack gpios are managed via devres, we don't have to call
snd_jack_free_gpios() at release any longer.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-22 13:39:02 +01:00
Takashi Iwai 7676b40606 ASoC: pxa: Remove superfluous snd_soc_jack_free_gpios() call
Since jack gpios are managed via devres, we don't have to call
snd_jack_free_gpios() at release any longer.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-22 13:38:57 +01:00
Takashi Iwai 90c265c65a ASoC: omap: Remove superfluous snd_soc_jack_free_gpios() call
Since jack gpios are managed via devres, we don't have to call
snd_jack_free_gpios() at release any longer.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-22 13:38:53 +01:00
Takashi Iwai 51f25e7f92 ASoC: intel: Remove superfluous snd_soc_jack_free_gpios() call
Since jack gpios are managed via devres, we don't have to call
snd_jack_free_gpios() at release any longer.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-22 13:38:47 +01:00
Takashi Iwai 2661112fcc ASoC: simple-card: Remove superfluous snd_soc_jack_free_gpios() call
Since jack gpios are managed via devres, we don't have to call
snd_jack_free_gpios() at release any longer.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-22 13:38:43 +01:00
Takashi Iwai 8244fd7e48 ASoC: fsl: Remove superfluous snd_soc_jack_free_gpios() call
Since jack gpios are managed via devres, we don't have to call
snd_jack_free_gpios() at release any longer.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-22 13:38:39 +01:00
Takashi Iwai bd29ae9690 ASoC: jack: Manage gpios via devres
Let's be lazy -- this patch adds the devres code to
snd_soc_jack_add_gpios() for releasing the gpio resources at device
removal automagically.  After this patch, you don't have to call
snd_soc_jack_free_gpios() manually as long as it's managed from the
machine driver.

What about the gpios assigned in other levels?  Well, you might still
need to free the resources manually, depending on how the component
unbind works.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-22 13:38:35 +01:00
Harsha Priya N 80b6490392 ASoC: Intel: Headset button support in kabylake machine driver
This patch adds headset button support for kabylake machine driver
(kbl_rt5663_rt5514_max98927).

Signed-off-by: Hsin-yu Chao <hychao@google.com>
Signed-off-by: Harsha Priya <harshapriya.n@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-22 12:09:42 +01:00
Joakim Tjernlund 07b3b5e9ed ALSA: usb-audio: Add delay quirk for H650e/Jabra 550a USB headsets
These headsets reports a lot of: cannot set freq 44100 to ep 0x81
and need a small delay between sample rate settings, just like
Zoom R16/24. Add both headsets to the Zoom R16/24 quirk for
a 1 ms delay between control msgs.

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-22 11:15:15 +02:00
Mark Brown bf9790bcdc Merge branch 'topic/const' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-blackfin 2017-08-21 21:50:23 +01:00
Mark Brown f13db334bf Merge branch 'topic/msm8916' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-const 2017-08-21 21:48:37 +01:00
Srinivas Kandagatla b47b91c850 ASoC: qcom: apq8016-sbc: Add support to Headset JACK
This patch adds support to Headset JACK, also provides board specific
vref ranges for mbhc buttons to be detected.

This headset supports both 3 pole and 4 pole headset type and 5 buttons.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 19:33:03 +01:00
Srinivas Kandagatla de66b34550 ASoC: codecs: msm8916-wcd-analog: add MBHC support
MBHC (MultiButton Headset Control) support is available in pm8921 in two
blocks, one to detect mechanical headset insertion and removal and other
block to support headset type detection and 5 button detection and othe
features like impedance calculation.

This patch adds support to:
1> Support to NC and NO type of headset Jacks.
2> Mechanical insertion and detection of headset jack.
3> Detect a 3 pole Headphone and a 4 pole Headset.
4> Detect 5 buttons.

Tested it on DB410c with Audio Mezz board with 4 pole and 3 pole
headset/headphones.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 19:33:02 +01:00
Srinivas Kandagatla e269998d58 ASoC: codecs: msm8916-wcd-analog: get micbias voltage from dt
This patch adds bindings in DT to provide required micbias voltage which
could be specific to board. With this new binding, now the mic bias
voltage is left at hardware default value if the device tree does not
specify any mic bias voltage value. Correct micbias value is required
for mbhc buttons to work.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 19:33:02 +01:00
Mark Brown 6329b1bb4e Linux 4.13-rc6
-----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJZmfubAAoJEHm+PkMAQRiGXb8H/jwRZuCz1qo/JNklzrMl33yE
 zU7QCdDDO0I9Uic6DKcOifo2w/cn1fOCWCqAyJyrFddBLvWFsfBoh+7AOoOy5oV5
 xnVwenhIMWiz+/4EUxWdNgXEREG4Gfk7FymiKyqA4XwJuBYoEd51CoaUTBbLQTMR
 g8ZnqgJQrSuqMp4HBLQEXGjYvCJmz0VoTKbZ0U1s++sQxv8g4q7PlU2Y5z55lRXp
 1P/juRoOTccpZcijhs/Y6g9GbuIi/rgcZR8ZpcSsN3zPJtAwx+LxOXgBnTcwhDbi
 O/o2mQ4hZUMMKVOA6K1lHKsCPVacfwcouL7SU/SgBxvYXVTPjWWt9kMlTZxzohE=
 =Wkg4
 -----END PGP SIGNATURE-----

Merge tag 'v4.13-rc6' into asoc-msm8916

Linux 4.13-rc6
2017-08-21 19:32:58 +01:00
Mark Brown 702992387b Merge branches 'topic/dmic' and 'topic/qcom' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-msm8916 2017-08-21 19:31:51 +01:00
Donglin Peng c996b52df4 ASoC: ux500: Remove unnecessary function call
First of all,the address of pdev->dev is assigned to mop500_card.dev,
then the function platform_set_drvdata copies the value the variable
card to pdev->dev.driver_data,but when calling snd_soc_register_card,
the function dev_set_drvdata(card->dev, card) will also do the same
copy operation,so i think that the former copy operation can be removed.

Signed-off-by: Peng Donglin <dolinux.peng@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 18:16:06 +01:00
Donglin Peng e4eabf75ad ASoC: tegra: Remove unnecessary function call
First of all,the address of pdev->dev is assigned to card->dev,then
the function platform_set_drvdata copies the value the variable card
to pdev->dev.driver_data, but when calling snd_soc_register_card,the
function dev_set_drvdata(card->dev, card) will also do the same copy
operation,so i think that the former copy operation can be removed.

Signed-off-by: Peng Donglin <dolinux.peng@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 18:15:57 +01:00
Donglin Peng b286401752 ASoC: mediatek: Remove unnecessary function call
First of all,the address of pdev->dev is assigned to card->dev,then
the function platform_set_drvdata copies the value the variable card
to pdev->dev.driver_data, but when calling snd_soc_register_card,the
function dev_set_drvdata(card->dev, card) will also do the same copy
operation,so i think that the former copy operation can be removed.

Signed-off-by: Peng Donglin <dolinux.peng@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 18:14:58 +01:00
Lucas Stach e5d619e9b9 ASoC: fsl-asoc-card: don't print EPROBE_DEFER as error
Probe deferral is to be expected during normal operation, so avoid
printing an error when it is encountered.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 17:25:06 +01:00
Marcus Cooper 7d2993811a ASoC: sun4i-i2s: Add support for H3
The sun8i-h3 introduces a lot of changes to the i2s block such
as different register locations, extended clock division and
more operational modes. As we have to consider the earlier
implementation then these changes need to be isolated.

None of the new functionality has been implemented yet, the
driver has just been expanded to allow it work on the H3 SoC.

Signed-off-by: Marcus Cooper <codekipper@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 17:16:14 +01:00
Marcus Cooper 043b8daa57 ASoC: sun4i-i2s: Update global enable with bitmask
The default value of the config register is different on newer
SoCs and therefore enabling/disabling with a register write
will clear bits used to set the direction of the clock and frame
pins.

Signed-off-by: Marcus Cooper <codekipper@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 17:16:10 +01:00
Marcus Cooper d03d2737e2 ASoC: sun4i-i2s: Check for slave select bit
The newer SoCs do not have this setting. Instead they set the pin
direction. Add a check to see if the bit is valid and if so set
it accordingly.

Signed-off-by: Marcus Cooper <codekipper@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 17:16:05 +01:00
Marcus Cooper dfd2293c86 ASoC: sun4i-i2s: Add regmap field to set DAI format
On the newer SoCs the bits to configure the operational mode are
located in a different register. Add a regmap field so that this
location can be configured.

Signed-off-by: Marcus Cooper <codekipper@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 17:16:02 +01:00
Marcus Cooper 5f93b06396 ASoC: sun4i-i2s: Add mclk enable regmap field
The location of the mclk output enable bit is different on newer
SoCs. Use a regmap field to enable it.

Signed-off-by: Marcus Cooper <codekipper@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 17:15:59 +01:00
Marcus Cooper 296935213f ASoC: sun4i-i2s: bclk and lrclk polarity tidyup
On newer SoCs the bit fields for the blck and lrclk polarity are in
a different locations. Use regmap fields to set the polarity bits
as intended.

Signed-off-by: Marcus Cooper <codekipper@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 17:15:53 +01:00
Marcus Cooper 7716471591 ASoC: sun4i-i2s: Add regfields for word size select and sample resolution
On newer SoCs the location of the slot width select and sample
resolution are different and also there is a bigger range of
support.

For the current supported rates then an offset is required.

Signed-off-by: Marcus Cooper <codekipper@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 17:15:50 +01:00
Marcus Cooper 6eb4f27419 ASoC: sun4i-i2s: Add regmap fields for channels
On the original i2s block the channel mapping and selection were
configured for stereo audio by default: This is not the case with
the newer SoCs and they are also located at different offsets.

To support the newer SoC then regmap fields have been added to the
quirks and these are initialised to their correct settings during
probing.

Signed-off-by: Marcus Cooper <codekipper@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 17:15:44 +01:00
Donglin Peng 827807549e ASoC: sun4i-codec: Remove unnecessary function call
First of all,the address of pdev->dev is assigned to card->dev in
create_card,then the function platform_set_drvdata copies the value
the variable card to pdev->dev.driver_data, but when calling
snd_soc_register_card,the function dev_set_drvdata(card->dev, card)
will also do the same copy operation,so i think that the former copy
operation can be removed.

Signed-off-by: Peng Donglin <dolinux.peng@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 17:14:57 +01:00
Donglin Peng 3bb2991c1d ASoC: qcom: Remove unnecessary function call
First of all,the address of pdev->dev is assigned to card->dev,then
the function platform_set_drvdata copies the value the variable card
to pdev->dev.driver_data, but when calling snd_soc_register_card,the
function dev_set_drvdata(card->dev, card) will also do the same copy
operation,so i think that the former copy operation can be removed.

Signed-off-by: Peng Donglin <dolinux.peng@gmail.com>
Acked-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 17:14:00 +01:00
Donglin Peng 70024ebc51 ASoC: qcom: Remove useless function call
The function platform_set_drvdata(pdev, data) copies the value of
the variable data to pdev->dev.driver_data,but when calling
snd_soc_register_card,the function dev_set_drvdata(card->dev, card)
will override it, so i think that the former copy operation is
useless and can be removed.

Signed-off-by: Peng Donglin <dolinux.peng@gmail.com>
Acked-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 17:13:45 +01:00
Donglin Peng 4c316783ee ASoC: mxs-sgtl5000: Remove unnecessary function call
First of all,the address of pdev->dev is assigned to card->dev,then
the function platform_set_drvdata copies the value the variable card
to pdev->dev.driver_data, but when calling snd_soc_register_card,the
function dev_set_drvdata(card->dev, card) will also do the same copy
operation,so i think that the former copy operation can be removed.

Signed-off-by: Peng Donglin <dolinux.peng@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 17:13:30 +01:00
Donglin Peng dc94d245a5 ASoC: rockchip: Remove unnecessary function call
First of all,the address of pdev->dev is assigned to card->dev,then
the function platform_set_drvdata copies the value the variable card
to pdev->dev.driver_data, but when calling snd_soc_register_card,the
function dev_set_drvdata(card->dev, card) will also do the same copy
operation,so i think that the former copy operation can be removed.

Signed-off-by: Peng Donglin <dolinux.peng@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 17:13:20 +01:00
Donglin Peng acd617a461 ASoC: atmel: Remove unnecessary function call
The function platform_set_drvdata copies the value the variable
card to card->dev->driver_data, then the address of &pdev->dev is
assigned to card->dev in atmel_pdmic_asoc_card_init, but when
calling snd_soc_register_card,the function
dev_set_drvdata(card->dev, card) will do the same copy operation,
so i think that the former copy operation can be removed.

Signed-off-by: Peng Donglin <dolinux.peng@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 17:12:19 +01:00
Donglin Peng 5c23bc7cb6 ASoC: atmel: Remove unnecessary function call
The function platform_set_drvdata copies the value the variable
card to card->dev->driver_data, then the address of &pdev->dev is
assigned to card->dev in atmel_classd_asoc_card_init, but when
calling snd_soc_register_card,the function
dev_set_drvdata(card->dev, card) will do the same copy operation,
so i think that the former copy operation can be removed.

Signed-off-by: Peng Donglin <dolinux.peng@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 17:12:05 +01:00
Donglin Peng 1107a293b7 ASoC: s3c24xx_uda134x: Remove unnecessary function call
First of all,the address of pdev->dev is assigned to card->dev,then
the function platform_set_drvdata copies the value the variable card
to pdev->dev.driver_data, but when calling snd_soc_register_card,the
function dev_set_drvdata(card->dev, card) will also do the same copy
operation,so i think that the former copy operation can be removed.

Signed-off-by: Peng Donglin <dolinux.peng@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 17:10:53 +01:00
Kuninori Morimoto b65cb7a590 ASoC: rsnd: tidyup comments position/space/tab
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 16:58:16 +01:00
Takashi Sakamoto 3a93d082ba ALSA: firewire-motu: add support for MOTU Audio Express
MOTU Audio Express is one of third generation in MOTU FireWire
series, produced in 2011. This model consists of three chips:
 * TI TSB41AB2 (Physical layer for IEEE 1394 bus)
 * Microchip USB3300 (Hi-Speed USB Device with ULPI interface)
 * Xilinx Spartan-3A FPGA, XC3S400A (Link layer for IEEE 1394 bus, packet
   processing and data block processing layer)

This commit adds support for this model. As I expected, it works with
current implementaion of protocol version 3. On the other hand, the unit
has a quirk to request subaction originated by any driver.

11:45:51.287643 firewire_ohci 0000:03:00.0: AT spd 2 tl 1f, ffc1 -> ffc0, -reserved-, QW req, fffff0000b14 = 02000200
11:45:51.289193 firewire_ohci 0000:03:00.0: AR spd 2 tl 1f, ffc0 -> ffc1, ack_complete, W resp
11:45:51.289381 fireire_core 0000:03:00.0: unsolicited response (source ffc0, tlabel 1f)
11:45:51.313071 firewire_ohci 0000:03:00.0: AT spd 2 tl 20, ffc1 -> ffc0, ack_pending , QW req, fffff0000b14 = 02000200
11:45:51.314539 firewire_ohci 0000:03:00.0: AR spd 2 tl 20, ffc0 -> ffc1, ack_complete, W resp

In 1394 OHCI (rev.1.1), after OUTPUT_LAST* descriptors is processed,
'xferStaus' field is filled with 'ContextControl[0:15]' (see clause 7.1.3).
5 bits in LSB side of the field has ack code in acknowledge from the unit
(see clause 7.2.2). A list of the code is shown in Table 3-2.

As long as I investigated, in a case of the '-reserved-' acknowledge
message from the unit, the field has 0x10. On the table, this value is
'Reserved for definition by future 1394 standards'. As long as I know,
any specifications of IEEE 1394 has no such extensions, thus the unit is
out of specification. Besides, I note that the unit does not always
acknowledge with the invalid code. I guess this is a bug of firmware. I
confirmed the bug in firmware version 1.04 and this is the latest one.

$ cd linux-firewire-utils
$ python2 ./src/crpp < /sys/bus/firewire/devices/fw1/config_rom
               ROM header and bus information block
               -----------------------------------------------------------------
400  0410a756  bus_info_length 4, crc_length 16, crc 42838
404  31333934  bus_name "1394"
408  20ff7000  irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 255, max_rec 7 (256)
40c  0001f200  company_id 0001f2     |
410  000a8a7b  device_id 00000a8a7b  | EUI-64 0001f200000a8a7b

               root directory
               -----------------------------------------------------------------
414  0004ef04  directory_length 4, crc 61188
418  030001f2  vendor
41c  0c0083c0  node capabilities per IEEE 1394
420  d1000002  --> unit directory at 428
424  8d000005  --> eui-64 leaf at 438

               unit directory at 428
               -----------------------------------------------------------------
428  00031680  directory_length 3, crc 5760
42c  120001f2  specifier id
430  13000033  version
434  17104800  model

               eui-64 leaf at 438
               -----------------------------------------------------------------
438  00025ef3  leaf_length 2, crc 24307
43c  0001f200  company_id 0001f2     |
440  000a8a7b  device_id 00000a8a7b  | EUI-64 0001f200000a8a7b

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-21 12:24:23 +02:00
Takashi Sakamoto 8b460c76bd ALSA: firewire-motu: add specification flag for position of flag for MIDI messages
In protocols of MOTU FireWire series, when transferring MIDI messages,
transmitter set existence flag to one byte on first several quadlets. The
position differs depending on protocols and models, however two cases are
confirmed; in 5th byte and 8th byte from MSB side.

This commit adds a series of specification flag to describe them. When
the existence flag is in the 5th byte, SND_MOTU_SPEC_[R|T]X_MIDI_2ND_Q is
used. Else, another set of the flag is used. Here, '_Q' means quadlet.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-21 12:24:00 +02:00
Takashi Sakamoto dbd7396b4f ALSA: firewire-motu: destroy stream data surely at failure of card initialization
When failing sound card registration after initializing stream data, this
module leaves allocated data in stream data. This commit fixes the bug.

Fixes: 9b2bb4f2f4 ('ALSA: firewire-motu: add stream management functionality')
Cc: <stable@vger.kernel.org> # v4.12+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-20 09:40:45 +02:00
Takashi Sakamoto 0c264af7be ALSA: firewire: fix NULL pointer dereference when releasing uninitialized data of iso-resource
When calling 'iso_resource_free()' for uninitialized data, this function
causes NULL pointer dereference due to its 'unit' member. This occurs when
unplugging audio and music units on IEEE 1394 bus at failure of card
registration.

This commit fixes the bug. The bug exists since kernel v4.5.

Fixes: 324540c4e0 ('ALSA: fireface: postpone sound card registration') at v4.12
Fixes: 8865a31e0f ('ALSA: firewire-motu: postpone sound card registration') at v4.12
Fixes: b610386c8a ('ALSA: firewire-tascam: deleyed registration of sound card') at v4.7
Fixes: 86c8dd7f4d ('ALSA: firewire-digi00x: delayed registration of sound card') at v4.7
Fixes: 6c29230e2a ('ALSA: oxfw: delayed registration of sound card') at v4.7
Fixes: 7d3c1d5901 ('ALSA: fireworks: delayed registration of sound card') at v4.7
Fixes: 04a2c73c97 ('ALSA: bebob: delayed registration of sound card') at v4.7
Fixes: b59fb1900b ('ALSA: dice: postpone card registration') at v4.5
Cc: <stable@vger.kernel.org> # v4.5+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-20 09:40:32 +02:00
Takashi Sakamoto 5bbb1ab5bd ALSA: control: use counting semaphore as write lock for ELEM_WRITE operation
In ALSA control interface, applications can execute two types of request
for value of members on each element; ELEM_READ and ELEM_WRITE. In ALSA
control core, these two requests are handled within read lock of a
counting semaphore, therefore several processes can run to execute these
two requests at the same time. This has an issue because ELEM_WRITE
requests have an effect to change state of the target element. Concurrent
access should be controlled for each of ELEM_READ/ELEM_WRITE case.

This commit uses the counting semaphore as write lock for ELEM_WRITE
requests, while use it as read lock for ELEM_READ requests. The state of
a target element is maintained exclusively between ELEM_WRITE/ELEM_READ
operations.

There's a concern. If the counting semaphore is acquired for read lock
in implementations of 'struct snd_kcontrol.put()' in each driver, this
commit shall cause dead lock. As of v4.13-rc5, 'snd-mixer-oss.ko',
'snd-emu10k1.ko' and 'snd-soc-sst-atom-hifi2-platform.ko' includes codes
for read locks, but these are not in a call graph from
'struct snd_kcontrol.put(). Therefore, this commit is safe.

In current implementation, the same solution is applied for the other
operations to element; e.g. ELEM_LOCK and ELEM_UNLOCK. There's another
discussion about an overhead to maintain concurrent access to an element
during operating the other elements on the same card instance, because the
lock primitive is originally implemented to maintain a list of elements on
the card instance. There's a substantial difference between
per-element-list lock and per-element lock.

Here, let me investigate another idea to add per-element lock to maintain
the concurrent accesses with inquiry/change requests to an element. It's
not so frequent for applications to operate members on elements, while
adding a new lock primitive to structure increases memory footprint for
all of element sets somehow. Experimentally, inquiry operation is more
frequent than change operation and usage of counting semaphore for the
inquiry operation brings no blocking to the other inquiry operations. Thus
the overhead is not so critical for usual applications. For the above
reasons, in this commit, the per-element lock is not introduced.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-20 09:39:55 +02:00
Takashi Sakamoto becf9e5d55 ALSA: control: code refactoring for ELEM_READ/ELEM_WRITE operations
ALSA control core handles ELEM_READ/ELEM_WRITE requests within lock
acquisition of a counting semaphore. The lock is acquired in helper
functions in the end of call path before calling implementations of each
driver.

ioctl(2) with SNDRV_CTL_ELEM_READ
...
->snd_ctl_ioctl()
  ->snd_ctl_elem_read_user()
    ->snd_ctl_elem_read()
      ->down_read(controls_rwsem)
      ->snd_ctl_find_id()
      ->struct snd_kcontrol.get()
      ->up_read(controls_rwsem)

ioctl(2) with SNDRV_CTL_ELEM_WRITE
...
->snd_ctl_ioctl()
  ->snd_ctl_elem_write_user()
    ->snd_ctl_elem_write()
      ->down_read(controls_rwsem)
      ->snd_ctl_find_id()
      ->struct snd_kcontrol.put()
      ->up_read(controls_rwsem)

This commit moves the lock acquisition to middle of the call graph to
simplify the helper functions. As a result:

ioctl(2) with SNDRV_CTL_ELEM_READ
...
->snd_ctl_ioctl()
  ->snd_ctl_elem_read_user()
    ->down_read(controls_rwsem)
    ->snd_ctl_elem_read()
      ->snd_ctl_find_id()
      ->struct snd_kcontrol.get()
    ->up_read(controls_rwsem)

ioctl(2) with SNDRV_CTL_ELEM_WRITE
...
->snd_ctl_ioctl()
  ->snd_ctl_elem_write_user()
    ->down_read(controls_rwsem)
    ->snd_ctl_elem_write()
      ->snd_ctl_find_id()
      ->struct snd_kcontrol.put()
    ->up_read(controls_rwsem)

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-20 09:39:54 +02:00
Takashi Sakamoto 7b42cfafdc ALSA: control: queue events within locking of controls_rwsem for ELEM_WRITE operation
Any control event is queued by a call of snd_ctl_notify(). This function
adds the event to each queue of opened file data corresponding to ALSA
control character devices. This function acquired two types of lock; a
counting semaphore for a list of the opened file data and a spinlock for
card data opened by the file. Typically, this function is called after
acquiring a counting semaphore for a list of elements in the card data.

In current implementation of a handler for ELEM_WRITE request, the
function is called after releasing the semaphore for a list of elements
in the card data. This release is not necessarily needed.

This commit removes the release to call the function within the critical
section so that later commits are simple.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-20 09:39:53 +02:00
Arvind Yadav 31cb1fb41d ALSA: usb: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-19 11:02:27 +02:00
Arvind Yadav 7a205f5db5 ALSA: spi: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-19 11:02:26 +02:00
Arvind Yadav 544d6272c8 ALSA: sparc: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-19 11:02:24 +02:00
Arvind Yadav 46a085a3e7 ALSA: sh: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-19 11:02:23 +02:00
Arvind Yadav 3179a3ea71 ALSA: ppc: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-19 11:02:22 +02:00
Arvind Yadav e0c24d8b27 ALSA: pcmcia: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-19 11:02:21 +02:00
Arvind Yadav c2992b19a7 ALSA: parisc: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-19 11:02:19 +02:00
Arvind Yadav 915a38d324 ALSA: mips: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-19 11:02:18 +02:00
Arvind Yadav b2165f3889 ALSA: firewire: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-19 11:02:17 +02:00
Arvind Yadav f95925829b ALSA: drivers: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-19 11:02:15 +02:00
Arvind Yadav 1086373713 ALSA: atmel: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-19 11:02:14 +02:00
Arvind Yadav 28f054802a ALSA: arm: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-19 11:02:13 +02:00
Arvind Yadav 18f6dda9f8 ALSA: aoa: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-19 11:02:12 +02:00
Arvind Yadav ab566fd523 ASoC: ux500: constify snd_soc_dai_ops structures
snd_soc_dai_ops are not supposed to change at runtime. All functions
working with snd_soc_dai_ops provided by <sound/soc-dai.h> work with
const snd_soc_dai_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-18 13:24:11 +01:00
Arvind Yadav eb59d73cb5 ASoC: codecs: constify snd_soc_dai_ops structures
snd_soc_dai_ops are not supposed to change at runtime. All functions
working with snd_soc_dai_ops provided by <sound/soc-dai.h> work with
const snd_soc_dai_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-18 13:17:48 +01:00
Arvind Yadav 728c4a87f3 ASoC: codecs: constify snd_soc_dai_ops structures
snd_soc_dai_ops are not supposed to change at runtime. All functions
working with snd_soc_dai_ops provided by <sound/soc-dai.h> work with
const snd_soc_dai_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-18 13:16:44 +01:00
Ryder Lee f6c1626e28 ASoC: mediatek: switch to use platform_get_irq_byname()
Switch to use platform_get_irq_byname() so that binding can be agnostic
of the IRQ order.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
CC: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-18 12:35:42 +01:00
Paul Kocialkowski 3bcfe80f1c ASoC: tegra: Remove SoC-specific Kconfig depends and selects
This removes the SoC-specific dependencies on the platform drivers,
as well as SoC-specific selections of platform drivers for the
machine drivers. The rationale behind this change is that the
dependencies are not actual build dependencies but run-time ones.

The previously listed SoCs were also incomplete: for instance, tegra124
uses the tegra30 platform drivers, which could not be built without
ARCH_TEGRA_3x_SOC set.

Descriptions of the tristates are also added to allow these options
to be set via defconfig/menuconfig.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-18 12:14:58 +01:00
Takashi Iwai 0b36f2bd28 ALSA: emu10k1: Fix forgotten user-copy conversion in init code
The commit d42fe63d58 ("ALSA: emu10k1: Get rid of set_fs() usage")
converted the user-space copy hack with set_fs() to the direct
memcpy(), but one place was forgotten.  This resulted in the error
from snd_emu10k1_init_efx(), eventually failed to load the driver.
Fix the missing piece.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196687
Fixes: d42fe63d58 ("ALSA: emu10k1: Get rid of set_fs() usage")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-18 10:59:02 +02:00
Jussi Laako ed993c6fdf ALSA: usb-audio: add DSD support for new Amanero PID
Add DSD support for new Amanero Combo384 firmware version with a new
PID. This firmware uses DSD_U32_BE.

Fixes: 3eff682d76 ("ALSA: usb-audio: Support both DSD LE/BE Amanero firmware versions")
Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-18 10:13:21 +02:00
Stephen Barber 5a9a8eca79 ALSA: usb-audio: don't retry snd_usb_ctl_msg after timeout
A few calls to snd_usb_ctl_msg wrap the function in a retry loop. In
the worst case, the timeout for snd_usb_ctl_msg is 5 seconds, which when
retried 10 times (for example, if a device is removed) could cause a
probe to hang for ~50 seconds.

Example stack trace from 3.14 which triggered a hung task timeout:
Call Trace:
 [<ffffffffa2c1f720>] ? inet6_set_link_af.part.35+0x12/0x12
 [<ffffffffa2c20309>] schedule+0x6e/0x70
 [<ffffffffa2c1f81c>] schedule_timeout+0xfc/0x13c
 [<ffffffffa2667bbc>] ? rcu_read_unlock_sched_notrace+0x17/0x17
 [<ffffffffa2c20d68>] __wait_for_common+0x153/0x190
 [<ffffffffa2c20d68>] ? __wait_for_common+0x153/0x190
 [<ffffffffa26890e5>] ? wake_up_state+0x12/0x12
 [<ffffffffa2c20e0e>] wait_for_completion_timeout+0x1d/0x1f
 [<ffffffffa2a07c70>] usb_start_wait_urb+0x93/0xf1
 [<ffffffffa2a07daf>] usb_control_msg+0xe1/0x11d
 [<ffffffffc02cd254>] snd_usb_ctl_msg+0x9c/0xf1 [snd_usb_audio]
 [<ffffffffc02ce191>] snd_usb_mixer_set_ctl_value+0x124/0xab1 [snd_usb_audio]
 [<ffffffffc02ce230>] snd_usb_mixer_set_ctl_value+0x1c3/0xab1 [snd_usb_audio]
 [<ffffffffc02ce58e>] snd_usb_mixer_set_ctl_value+0x521/0xab1 [snd_usb_audio]
 [<ffffffffc02cee88>] snd_usb_mixer_add_control+0x36a/0x1264 [snd_usb_audio]
 [<ffffffffc02cf323>] snd_usb_mixer_add_control+0x805/0x1264 [snd_usb_audio]
 [<ffffffffa2a06e11>] ? usb_free_urb+0x1a/0x1c
 [<ffffffffc02cfcf7>] snd_usb_mixer_add_control+0x11d9/0x1264 [snd_usb_audio]
 [<ffffffffc02d000f>] snd_usb_create_mixer+0xbc/0x286 [snd_usb_audio]
 [<ffffffffc02cac18>] 0xffffffffc02cac17
 [<ffffffffa2a0aaf1>] usb_probe_interface+0x17c/0x21c
 [<ffffffffa29a65bc>] driver_probe_device+0xae/0x1fa
 [<ffffffffa29a6767>] __device_attach_driver+0x5f/0x66
 [<ffffffffa29a6708>] ? driver_probe_device+0x1fa/0x1fa
 [<ffffffffa29a4a60>] bus_for_each_drv+0x87/0xaa
 [<ffffffffa29a688a>] __device_attach+0x9d/0x101
 [<ffffffffa29a6913>] device_initial_probe+0x13/0x15
 [<ffffffffa29a5ae6>] bus_probe_device+0x33/0x96
 [<ffffffffa29a3d19>] device_add+0x328/0x547
 [<ffffffffa2a09355>] usb_set_configuration+0x624/0x674
 [<ffffffffa2a11949>] generic_probe+0x45/0x77
 [<ffffffffa2a0a962>] usb_probe_device+0x2d/0x40
 [<ffffffffa29a65bc>] driver_probe_device+0xae/0x1fa
 [<ffffffffa29a6767>] __device_attach_driver+0x5f/0x66
 [<ffffffffa29a6708>] ? driver_probe_device+0x1fa/0x1fa
 [<ffffffffa29a4a60>] bus_for_each_drv+0x87/0xaa
 [<ffffffffa29a688a>] __device_attach+0x9d/0x101
 [<ffffffffa29a6913>] device_initial_probe+0x13/0x15
 [<ffffffffa29a5ae6>] bus_probe_device+0x33/0x96
 [<ffffffffa29a3d19>] device_add+0x328/0x547
 [<ffffffffa29030bc>] ? add_device_randomness+0x111/0x130
 [<ffffffffa2a00967>] usb_new_device+0x2a2/0x3c0
 [<ffffffffa2a02ddc>] hub_thread+0xa3d/0xeed
 [<ffffffffa2c2010d>] ? __schedule+0x41e/0x5ac
 [<ffffffffa26957ce>] ? finish_wait+0x62/0x62
 [<ffffffffa2a0239f>] ? usb_reset_device+0x16a/0x16a
 [<ffffffffa267b255>] kthread+0x108/0x110
 [<ffffffffa267b14d>] ? __kthread_parkme+0x67/0x67
 [<ffffffffa2c23b2c>] ret_from_fork+0x7c/0xb0
 [<ffffffffa267b14d>] ? __kthread_parkme+0x67/0x67

Signed-off-by: Stephen Barber <smbarber@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-18 10:09:28 +02:00
Mark Brown a46f1cfaab Merge branch 'topic/const' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-dmic 2017-08-17 18:15:39 +01:00
Bhumika Goyal 6e37f933ed ASoC: codecs: make snd_soc_dai_driver and snd_soc_component_driver const
Make these two structure variables const as they are either used in a
copy operation or passed to devm_snd_soc_register_component having the
corresponding argument as const.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-17 18:10:34 +01:00
Bhumika Goyal cc6e25631d ASoC: bcm: make snd_soc_dai_driver const
Make this const as it is only used during a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-17 18:10:17 +01:00
Bhumika Goyal a46d0592d1 ASoC: sh: make snd_soc_ops const
Make this const as it is only stored in the ops field of a
snd_soc_dai_link structure, which is const.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-17 18:09:48 +01:00
Bhumika Goyal 2af236391f ASoC: samsung: make snd_soc_ops const
Make these const as they are only stored in the ops field of a
snd_soc_dai_link structure, which is const.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-17 18:09:39 +01:00
Bhumika Goyal c12a4a40b4 ASoC: rockchip: make snd_soc_ops const
Make this const as it is only stored in the ops field of a
snd_soc_dai_link structure, which is const.
Done using Coccinelle

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-17 18:09:21 +01:00
Bhumika Goyal e23d834876 ASoC: generic: make snd_soc_ops const
Make these const as they are only stored in the ops field of a
snd_soc_dai_link structure, which is const.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-17 18:08:12 +01:00
Bhumika Goyal 7f8159acec ASoC: cirrus: make snd_soc_ops const
Make these const as they are only stored in the ops field of a
snd_soc_dai_link structure, which is const.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-17 18:07:47 +01:00
Bhumika Goyal 052fba77f5 ASoC: aux1x: make snd_soc_ops const
Make this const as it is only stored in the ops field of a
snd_soc_dai_link structure, which is const.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-17 18:07:36 +01:00
Harsha Priya N d46b182840 ASoC: Intel: kbl: Enabling ASRC for RT5663 codec on kabylake platform
Patch fixes cracking noise in rt5663 headphones for kbl platform by
calling rt5663_sel_asrc_clk_src() for RT5663_AD_STEREO_FILTER to set
ASRC.

The ASRC function is for asynchronous MCLK and LRCLK. For RT5663 ASRC
should be enabled to support pcm format with 100fs.
ASRC function will track i2s clock and generate corresponding
system clock for codec. Calling this func helps select clock source
for both RT5663_AD_STEREO_FILTER and RT5663_DA_STEREO_FILTER filters
which fixes the crackling sound.

Signed-off-by: Harsha Priya <harshapriya.n@intel.com>
Signed-off-by: Shruthi Sudhakar <shruthi.sudhakar@intel.com>
Signed-off-by: Naveen M <naveen.m@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-17 18:05:04 +01:00
huang lin 23c7159a79 ASoC: codec: use enable pin to control dmic start and stop
on some board use enable pin to control dmic start and stop,
so add this feature in dmic driver.

Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-17 18:03:15 +01:00
Bhumika Goyal 8df397ff0e ASoC: Intel: Skylake: make snd_pcm_hardware const
Make this const as it is only passed as the 2nd argument to the
function snd_soc_set_runtime_hwparams, which is const.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-17 17:58:17 +01:00
Bhumika Goyal a7468e478a ASoC: Intel: Atom: make snd_pcm_hardware const
Make this const as it is only used in a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-17 17:58:14 +01:00
Bhumika Goyal 193e25e1fe ASoC: qcom: make snd_pcm_hardware const
Make this const as it is either passed as the 2nd argument
to the function snd_soc_set_runtime_hwparams, which is const or used
in a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-17 17:57:55 +01:00
Bhumika Goyal 5c2e035e69 ASoC: sh: make snd_pcm_hardware const
Make these const as they are only passed as the 2nd argument to the
function snd_soc_set_runtime_hwparams, which is const.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-17 17:57:21 +01:00
Bhumika Goyal 636d7e289c ASoC: kirkwood: make snd_pcm_hardware const
Make this const as it is either passed as the 2nd argument
to the function snd_soc_set_runtime_hwparams, which is const or used in
a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-17 17:57:09 +01:00
Bhumika Goyal f77bb3b778 ASoC: fsl: make snd_pcm_hardware const
Make these const as they are only passed as the 2nd argument to the
function snd_soc_set_runtime_hwparams, which is const.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-17 17:56:52 +01:00
Takashi Iwai 0f174b3525 ALSA: usb-audio: Add mute TLV for playback volumes on C-Media devices
C-Media devices (at least some models) mute the playback stream when
volumes are set to the minimum value.  But this isn't informed via TLV
and the user-space, typically PulseAudio, gets confused as if it's
still played in a low volume.

This patch adds the new flag, min_mute, to struct usb_mixer_elem_info
for indicating that the mixer element is with the minimum-mute volume.
This flag is set for known C-Media devices in
snd_usb_mixer_fu_apply_quirk() in turn.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196669
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 17:52:16 +02:00
Harsha Priya N 393a829bb2 ASoC: Intel: kbl_rt5663_rt5514_max98927: Add rt5514 spi dailink
This patch adds a dai to rt5514-spi driver for wake on voice functionality.

Signed-off-by: Hsin-yu Chao <hychao@google.com>
Signed-off-by: Harsha Priya <harshapriya.n@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-17 15:25:08 +01:00
Bhumika Goyal a977d0452f ALSA: parisc: make snd_pcm_hardware const
Make these const as they are only used in a copy operation.
Done using Coccinelle

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:44:24 +02:00
Bhumika Goyal aaffbf7824 ALSA: usb: make snd_pcm_hardware const
Make this const as it is only used in a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:44:23 +02:00
Bhumika Goyal 688ed206e1 ALSA: sparc: make snd_pcm_hardware const
Make these const as they are only used in a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:44:21 +02:00
Bhumika Goyal cd196fe2d6 ALSA: sh: make snd_pcm_hardware const
Make these const as they are only used in a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:44:19 +02:00
Bhumika Goyal 21bf6cf556 ALSA: ppc: make snd_pcm_hardware const
Make these const as they are only used in a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:44:18 +02:00
Bhumika Goyal d9b1b34fed ALSA: pcmcia: make snd_pcm_hardware const
Make this const as it is only used in a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:44:17 +02:00
Bhumika Goyal aa38e71d05 ALSA: pci: make snd_pcm_hardware const
Make these const as they are only used in a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:44:16 +02:00
Bhumika Goyal 3068116f53 ALSA: mips: make snd_pcm_hardware const
Make these const as they are only used in a copy operation.
Done using Coccinelle

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:44:14 +02:00
Bhumika Goyal aec5465485 ALSA: isa: make snd_pcm_hardware const
Make these const as they are only used in a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:44:11 +02:00
Bhumika Goyal b6c0b71561 ALSA: drivers: make snd_pcm_hardware const
Make these const as they are only used in a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:44:09 +02:00
Bhumika Goyal 85ab373843 ALSA: atmel: make snd_pcm_hardware const
Make this const as it is only used in a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:44:08 +02:00
Bhumika Goyal db566fb981 ALSA: arm: make snd_pcm_hardware const
Make this const as it is only used in a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:44:07 +02:00
Arvind Yadav 60f6f0d3f7 ALSA: wavefront: constify pnp_card_device_id
pnp_card_device_id are not supposed to change at runtime. All functions
working with pnp_card_device_id provided by <linux/pnp.h> work with
const pnp_card_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:42:32 +02:00
Arvind Yadav 05e20b265c ALSA: sscape: constify pnp_card_device_id
pnp_card_device_id are not supposed to change at runtime. All functions
working with pnp_card_device_id provided by <linux/pnp.h> work with
const pnp_card_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:42:31 +02:00
Arvind Yadav e6a76e2fda ALSA: sb16: constify pnp_card_device_id
pnp_card_device_id are not supposed to change at runtime. All functions
working with pnp_card_device_id provided by <linux/pnp.h> work with
const pnp_card_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:42:29 +02:00
Arvind Yadav 529d257611 ALSA: opti9xx: constify pnp_card_device_id
pnp_card_device_id are not supposed to change at runtime. All functions
working with pnp_card_device_id provided by <linux/pnp.h> work with
const pnp_card_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:42:28 +02:00
Arvind Yadav 1ef428bf9b ALSA: msnd: constify pnp_card_device_id
pnp_card_device_id are not supposed to change at runtime. All functions
working with pnp_card_device_id provided by <linux/pnp.h> work with
const pnp_card_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:42:27 +02:00
Arvind Yadav 45fbe60734 ALSA: gus: constify pnp_card_device_id
pnp_card_device_id are not supposed to change at runtime. All functions
working with pnp_card_device_id provided by <linux/pnp.h> work with
const pnp_card_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:42:25 +02:00
Arvind Yadav 4f624a1cb7 ALSA: es1688: constify pnp_card_device_id
pnp_card_device_id are not supposed to change at runtime. All functions
working with pnp_card_device_id provided by <linux/pnp.h> work with
const pnp_card_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:42:24 +02:00
Arvind Yadav 3f41b75cb1 ALSA: cs4236: constify pnp_card_device_id
pnp_card_device_id are not supposed to change at runtime. All functions
working with pnp_card_device_id provided by <linux/pnp.h> work with
const pnp_card_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:42:23 +02:00
Arvind Yadav 06891ec6e0 ALSA: cmi8330: constify pnp_card_device_id
pnp_card_device_id are not supposed to change at runtime. All functions
working with pnp_card_device_id provided by <linux/pnp.h> work with
const pnp_card_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:42:22 +02:00
Arvind Yadav 1d906e8548 ALSA: azt2320: constify pnp_card_device_id
pnp_card_device_id are not supposed to change at runtime. All functions
working with pnp_card_device_id provided by <linux/pnp.h> work with
const pnp_card_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:42:21 +02:00
Arvind Yadav 815cfec76a ALSA: als100: constify pnp_card_device_id
pnp_card_device_id are not supposed to change at runtime. All functions
working with pnp_card_device_id provided by <linux/pnp.h> work with
const pnp_card_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:42:19 +02:00
Arvind Yadav 287b546c70 ALSA: ad1816a: constify pnp_card_device_id
pnp_card_device_id are not supposed to change at runtime. All functions
working with pnp_card_device_id provided by <linux/pnp.h> work with
const pnp_card_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:42:18 +02:00
Arvind Yadav 607b5d7f7a ALSA: opl3sa2: constify pnp_device_id and pnp_card_device_id
*_device_id are not supposed to change at runtime. All functions
working with *_device_id provided by <linux/pnp.h> work with
const *_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:42:16 +02:00
Arvind Yadav 05cb183e87 ALSA: es18xx: constify pnp_device_id and pnp_card_device_id
*_device_id are not supposed to change at runtime. All functions
working with *_device_id provided by <linux/pnp.h> work with
const *_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:42:15 +02:00
Arvind Yadav 1491c68a22 ALSA: drivers: mpu401: constify pnp_device_id
pnp_device_id are not supposed to change at runtime. All functions
working with pnp_device_id provided by <linux/pnp.h> work with
const pnp_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-17 12:42:14 +02:00
Peng Donglin aeb6fa0f15 ASoC: compress: Set reasonable compress id string
For dynamic compress rtd, the codec_dai may not have any actual
meaning(like snd-soc-dummy-dai), so compress id can just use the
value of dai_link->stream_name. But for others, its codec_dai
has actual meaning, so compress id can include codec_dai name.

Signed-off-by: Peng Donglin <dolinux.peng@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-16 15:52:58 +01:00
Bhumika Goyal fdbf048804 ALSA: hda: make snd_kcontrol_new const
Make these const as they are only passed as the 3rd argument to the
function snd_hda_gen_add_kctl, which is of type const.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-16 14:29:08 +02:00
Bhumika Goyal 7df3859bf7 ALSA: pcxhr: make snd_kcontrol_new const
Make these const as they are only used during a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-16 14:29:07 +02:00
Bhumika Goyal bb1c928df7 ALSA: aoa: make snd_kcontrol_new const
Make these const as they are only used during a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-16 14:29:06 +02:00
Kuninori Morimoto 2eccea8cde ASoC: soc-core: snd_soc_unregister_component() unregister all component
Current snd_soc_unregister_component() unregisters first found
component only which was specified by dev.
This style can't specify concrete component if system registered some
component with same dev. And system need to call this function many
times.
This patch unregister all related component by 1 call.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-16 13:05:14 +01:00
Bhumika Goyal 4dbcc5ff25 ASoC: codecs: make snd_compr_ops const
Make these const as they are only stored in the compr_ops field of a
snd_soc_platform_driver structure, which is of type const.
Done using Coccinelle

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-16 13:01:45 +01:00
Markus Elfring 92ec46da6e ASoC: Medfield: Delete an error message for a failed memory allocation in snd_mfld_mc_probe()
Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-16 13:00:55 +01:00
Julia Lawall 70bad123ea ASoC: Intel: constify snd_compr_codec_caps structures
These snd_compr_codec_caps structures are only copied into other
structures, so they can be const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-16 12:01:23 +01:00
Bhumika Goyal 2788808a1b ASoC: Intel: Skylake: make skl_dsp_fw_ops const
Make these const as they are only used during a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-16 12:01:15 +01:00
Bhumika Goyal 2d5f848781 ASoC: Intel: kbl: make snd_pcm_hw_constraint_list const
Make these const as they are only passed to the function
snd_pcm_hw_constraint_list having the corresponding argument as const.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-16 12:01:03 +01:00
Daniel Baluta d0148eb4a4 ASoC: simple-scu-card: Parse off codec widgets
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-16 12:00:18 +01:00
Laurent Pinchart d20fa5a06d drm: omapdrm: hdmi: Pass HDMI core version as integer to HDMI audio
The HDMI audio driver only needs to know which generation of HDMI
transmitter it deals with, not the detailed SoC model. Pass the version
number as an integer to prepare for removal of the OMAP SoC version from
the omapdrm driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2017-08-16 12:52:41 +03:00
Anton Vasilyev 7b814a7d4e ASoC: samsung: i2s: Null pointer dereference on samsung_i2s_remove
If (quirks & QUIRK_SEC_DAI == 0) then samsung_i2s_probe() doesn't allocate
sec_dai and pri_dai->sec_dai remains Null, but samsung_i2s_remove()
performs pri_dai->sec_dai dereference in any case.

The patch removes useless reinitialization of sec_dai at
samsung_i2s_remove(), because resources are under devm control.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-15 18:48:55 +01:00
Lori Hikichi 8937ea0f3c ASoC: cygnus: Add support for 384kHz frame rates
Allow the audio ports to operate at 384kHz.

Signed-off-by: Lori Hikichi <lori.hikichi@broadcom.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-15 18:14:40 +01:00
Julia Lawall a1150d40b2 ASoC: spear: constify snd_soc_dai_ops structures
These snd_soc_dai_ops structures are only stored in the ops field of
a snd_soc_dai_driver structure, which is const.  Thus, the
snd_soc_dai_ops structures can be const too.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-15 18:11:42 +01:00
Julia Lawall 66f41da341 ASoC: codecs: zx_aud96p22: constify snd_soc_dai_ops structures
These snd_soc_dai_ops structures are only stored in the ops field of
a snd_soc_dai_driver structure, which is const.  Thus, the
snd_soc_dai_ops structures can be const too.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-15 18:11:34 +01:00
Julia Lawall a6a67da3da ASoC: codecs: es8316: constify snd_soc_dai_ops structures
These snd_soc_dai_ops structures are only stored in the ops field of
a snd_soc_dai_driver structure, which is const.  Thus, the
snd_soc_dai_ops structures can be const too.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-15 18:11:21 +01:00
Julia Lawall 0966a25887 ASoC: rockchip: constify snd_soc_dai_ops structures
These snd_soc_dai_ops structures are only stored in the ops field of
a snd_soc_dai_driver structure, which is const.  Thus, the
snd_soc_dai_ops structures can be const too.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-15 18:11:10 +01:00
Julia Lawall a4fe6f3726 ASoC: blackfin: constify snd_soc_dai_ops structures
These snd_soc_dai_ops structures are only stored in the ops field of
a snd_soc_dai_driver structure, which is const.  Thus, the
snd_soc_dai_ops structures can be const too.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-15 18:10:53 +01:00
Julia Lawall eb2c183094 ALSA: firewire-motu: constify snd_rawmidi_ops structures
These snd_rawmidi_ops structures are only passed as the third
argument of snd_rawmidi_set_ops.  This argument is const, so the
snd_rawmidi_ops structures can be const too.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-15 14:05:16 +02:00
Markus Elfring 443be77e4b ASoC: Freescale: Delete an error message for a failed memory allocation in three functions
Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-15 12:54:02 +01:00
Takashi Iwai a8e800fe0f ALSA: usb-audio: Apply sample rate quirk to Sennheiser headset
A Senheisser headset requires the typical sample-rate quirk for
avoiding spurious errors from inquiring the current sample rate like:
 usb 1-1: 2:1: cannot get freq at ep 0x4
 usb 1-1: 3:1: cannot get freq at ep 0x83

The USB ID 1395:740a has to be added to the entries in
snd_usb_get_sample_rate_quirk().

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1052580
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-15 09:11:23 +02:00
Julia Lawall c9480d055e sound: emu8000: constify emu8000_ops
The structure emu8000_ops is only copied into another structure, so
it can be const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-15 08:21:51 +02:00
Markus Elfring 2675be5a00 ALSA: rme9652: Use common error handling code in two functions
Add a jump target so that a bit of exception handling can be better reused
in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-15 08:21:39 +02:00
Daniel Mentz 7e1d90f60a ALSA: seq: 2nd attempt at fixing race creating a queue
commit 4842e98f26 ("ALSA: seq: Fix race at
creating a queue") attempted to fix a race reported by syzkaller. That
fix has been described as follows:

"
When a sequencer queue is created in snd_seq_queue_alloc(),it adds the
new queue element to the public list before referencing it.  Thus the
queue might be deleted before the call of snd_seq_queue_use(), and it
results in the use-after-free error, as spotted by syzkaller.

The fix is to reference the queue object at the right time.
"

Even with that fix in place, syzkaller reported a use-after-free error.
It specifically pointed to the last instruction "return q->queue" in
snd_seq_queue_alloc(). The pointer q is being used after kfree() has
been called on it.

It turned out that there is still a small window where a race can
happen. The window opens at
snd_seq_ioctl_create_queue()->snd_seq_queue_alloc()->queue_list_add()
and closes at
snd_seq_ioctl_create_queue()->queueptr()->snd_use_lock_use(). Between
these two calls, a different thread could delete the queue and possibly
re-create a different queue in the same location in queue_list.

This change prevents this situation by calling snd_use_lock_use() from
snd_seq_queue_alloc() prior to calling queue_list_add(). It is then the
caller's responsibility to call snd_use_lock_free(&q->use_lock).

Fixes: 4842e98f26 ("ALSA: seq: Fix race at creating a queue")
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Daniel Mentz <danielmentz@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-15 08:02:35 +02:00
Mark Brown ce25f0d6e7 Merge branch 'topic/sh' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-rcar 2017-08-14 17:53:16 +01:00
Colin Ian King 3013c75fad ASoC: hdmi-codec: make a function and two arrays static
The function hdmi_codec_eld_chmap and arrays hdmi_codec_stereo_chmaps
and hdmi_codec_8ch_chmaps are local to the source and do not need to
be in global scope, so make them static.

Cleans up sparse warnings:
symbol 'hdmi_codec_eld_chmap' was not declared. Should it be static?
symbol 'hdmi_codec_stereo_chmaps' was not declared. Should it be static?
symbol 'hdmi_codec_8ch_chmaps' was not declared. Should it be static?

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:41:32 +01:00
Markus Elfring dc09233908 ASoC: DaVinci: Delete an error message for a failed memory allocation in two functions
Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:40:13 +01:00
Markus Elfring b48b271091 ASoC: rockchip: Delete an error message for a failed memory allocation in rockchip_i2s_probe()
Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:37:55 +01:00
Markus Elfring dd80627d06 ASoC: fsi: Delete an error message for a failed memory allocation in fsi_probe()
Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:37:44 +01:00
Markus Elfring c7591edc2a ASoC: kirkwood: Delete an error message for a failed memory allocation in kirkwood_i2s_dev_probe()
Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:37:20 +01:00
Markus Elfring b88845484d ASoC: dwc: Delete an error message for a failed memory allocation in dw_i2s_probe()
Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:28:51 +01:00
Markus Elfring 11f25bbaaa ASoC: blackfin: Add some spaces for better code readability
Use space characters at some source code places according to
the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:28:22 +01:00
Markus Elfring 11fca34b27 ASoC: blackfin: Use common error handling code in sport_create()
Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:28:18 +01:00
Markus Elfring 60ea0394a6 ASoC: blackfin: Delete an error message for a failed memory allocation in sport_create()
Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:28:14 +01:00
Marcus Cooper 3509476e52 ASoC: sun4i-i2s: Add TX FIFO offset to quirks
It has been seen that the newer SoCs have a different TX FIFO
address. Add this to the quirks structure.

Signed-off-by: Marcus Cooper <codekipper@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:24:44 +01:00
Marcus Cooper cd1c63df5f ASoC: sun4i-i2s: Add regmap config to quirks
The newer SoCs have a larger range than the original SoC that this
driver was developed for. By adding the regmap config to the quirks
then the driver can initialise the managed register map correctly.

Signed-off-by: Marcus Cooper <codekipper@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:24:39 +01:00
Marcus Cooper 0aef27cab8 ASoC: sun4i-i2s: Add clkdiv offsets to quirks
The BCLKDIV and MCLKDIV found on newer SoCs start from an offset of 1.
Add the functionality to adjust the division values according to the
needs to the device being used.

Signed-off-by: Marcus Cooper <codekipper@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:24:34 +01:00
Arvind Yadav b23bd34c40 ASoC: sh: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/soc.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:23:43 +01:00
Arvind Yadav f70eab3aad ASoC: nuc900: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/soc.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:23:23 +01:00
Arvind Yadav f2c402ba55 ASoC: intel: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/soc.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:23:08 +01:00
Bhumika Goyal 80cc4df8b4 ASoC: Intel: make snd_soc_platform_driver const
Make these const as they are only passed as the 2nd argument to the
function snd_soc_register_platform, which is of type const.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:22:29 +01:00
Bhumika Goyal 0ed6f15701 ASoC: codecs: make snd_soc_platform_driver const
Make these const as they are either passed as the 2nd argument to the
function devm_snd_soc_register_platform or snd_soc_register_platform,
and the arguments are of type const.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:22:07 +01:00
Bhumika Goyal c9f3d34413 ASoC: soc-utils: make snd_soc_platform_driver const
Make this const as it is only passed as the 2nd argument to the function
snd_soc_register_platform, which is of type const.
Done using Coccinelle

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:21:41 +01:00
Arvind Yadav 5144468efb ASoC: txx9: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/soc.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:21:25 +01:00
Bhumika Goyal 42271d951c ASoC: txx9: make snd_soc_platform_driver const
Make this const as it is only passed as the 2nd argument to the function
devm_snd_soc_register_platform, which is of type const.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:21:24 +01:00
Bhumika Goyal 5177255451 ASoC: sh: make snd_soc_platform_driver const
Make these const as they are either passed as the 2nd argument to
the function devm_snd_soc_register_platform or snd_soc_register_platform,
and the arguments are of type const.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:21:02 +01:00
Bhumika Goyal 50d50c33d2 ASoC: qcom: make snd_soc_platform_driver const
Make this const as it is only passed as the 2nd argument to the
function devm_snd_soc_register_platform, which is of type const.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14 17:20:22 +01:00