Commit graph

25820 commits

Author SHA1 Message Date
Mark Brown
43b64af535 Merge remote-tracking branch 'asoc/topic/rcar' into asoc-next 2016-12-12 15:52:47 +00:00
Mark Brown
52708d05ba Merge remote-tracking branch 'asoc/topic/intel' into asoc-next 2016-12-12 15:52:46 +00:00
Mark Brown
14eec47753 Merge remote-tracking branch 'asoc/topic/dmaengine' into asoc-next 2016-12-12 15:52:46 +00:00
Mark Brown
e6c6fd896b Merge remote-tracking branch 'asoc/topic/dapm-pin' into asoc-next 2016-12-12 15:52:45 +00:00
Mark Brown
c0f2302a6a Merge remote-tracking branch 'asoc/topic/dapm' into asoc-next 2016-12-12 15:52:44 +00:00
Mark Brown
3f1b86139e Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2016-12-12 15:52:43 +00:00
Mark Brown
66f89906f0 Merge remote-tracking branch 'asoc/topic/component' into asoc-next 2016-12-12 15:52:43 +00:00
Mark Brown
1e570a83ad Merge remote-tracking branches 'asoc/fix/da7219-pops' and 'asoc/fix/qcom' into asoc-linus 2016-12-12 15:52:37 +00:00
Mark Brown
2e8239e792 Merge remote-tracking branch 'asoc/fix/intel' into asoc-linus 2016-12-12 15:52:34 +00:00
Kuninori Morimoto
b99258a315 ASoC: rsnd: setup BRGCKR/BRRA/BRRB when starting
Current rsnd driver setups BRGCKR/BRRA/BRRB when .probe timing.
But it breaks sound after Suspend/Resume. These should be setups
every start timing.
This patch is tested on R-Car Gen3 Salvator-X board

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-07 15:47:45 +00:00
Kuninori Morimoto
c2d3171847 ASoC: rsnd: enable/disable ADG when suspend/resume timing
Current rsnd driver enables ADG clock when .probe timing,
but it breaks sound after Suspend/Resume. These should be setups
every suspend/resume timing too.
This patch is tested on R-Car Gen3 Salvator-X board

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-07 15:47:45 +00:00
Kuninori Morimoto
6bf66b1c35 ASoC: rsnd: tidyup ssi->usrcnt counter check in hw_params
ssi->usrcnt will be updated on snd_soc_dai_ops::trigger,
but snd_pcm_ops::hw_params will be called *before* it.
Thus, ssi->usrcnt is still 0 when 1st call.
rsnd_ssi_hw_params() needs to check its called count, this means
trigger should be if (ssi->usrcnt) instead of if (ssi->usrcnt > 1).

Reported-by: Nguyen Viet Dung <nv-dung@jinso.co.jp>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-07 15:47:44 +00:00
Dan Carpenter
163117e8d4 dbri: move dereference after check for NULL
We accidentally introduced a dereference before the NULL check in
xmit_descs() as part of silencing a GCC warning.

Fixes: 16f46050e7 ("dbri: Fix compiler warning")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-06 12:18:22 -05:00
Sathyanarayana Nujella
c1aee1d828 ASoC: Intel: update bxt_da7219_max98357a to support quad ch dmic capture
This patch updates FE channel constraints & BE fixup to support
quad channel DMIC capture.
DMIC pin's BE fixup is configured based on channel input, i.e.
either stereo or quad.

Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.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>
2016-12-06 15:13:11 +00:00
Sebastien Guiriec
c7da1e9d26 ASoC: Intel: atom: save FW version
After the boot of the SST FW the firmware version is send back
to the driver. This patch is saving the FW version inside the
driver.

Signed-off-by: Sebastien Guiriec <sebastien.guiriec@intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-05 17:22:25 +00:00
Sebastien Guiriec
fade74dfab ASoC: Intel: atom: Add sysfs entry in order to store FW version
This patch is adding a sysfs entry in order to be able to get
access to SST FW version.

Signed-off-by: Sebastien Guiriec <sebastien.guiriec@intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-05 17:22:24 +00:00
Kuninori Morimoto
3ce2959d16 ASoC: rsnd: rsnd_get_dalign() needs to care SSIU, not SSI
SSIU was controlled by SSI before, but
commit c7f69ab53("ASoC: rsnd: use mod base common method on SSIU")
separated it into ssiu.c

But, it didn't care about rsnd_get_dalign() for judging SSI_BUSIF_DALIGN
register value which changes the stream data order.
This function will be called from cmd/src/ssiu now, but current code
still cares ssi, not ssiu.
This patch fix it up

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-05 11:36:43 +00:00
Mark Brown
5203a3ca09 Merge branch 'topic/component' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-intel 2016-12-01 21:47:57 +00:00
Kuninori Morimoto
9178feb453 ASoC: add Component level suspend/resume
In current ALSA SoC, Codec only has suspend/resume feature,
but it should be supported on Component level. This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-01 20:09:58 +00:00
Kuninori Morimoto
1a653aa447 ASoC: core: replace aux_comp_list to component_dev_list
Now, Card has component_dev_list, we can replace aux_comp_list
to component_dev_list with new auxiliary flags

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-01 20:09:50 +00:00
Kuninori Morimoto
d9fc40639d ASoC: core: replace codec_dev_list to component_dev_list on Card
Current Card has Codec list (= codec_dev_list), but Codec will be
removed in the future. Because of this reason, this patch adds
new Component list in Card, and replace Codec list.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-01 20:09:34 +00:00
Takashi Iwai
fee3244cd1 ASoC: cht_bsw_rt5672: Use HID translation unit
Instead of hard-coded "i2c-10EC5670:00", use the translation helper to
avoid the mismatch between i2c-codec and ACPI strings just like what
we've done for bytcr_rt5640.  This gives more robust binding on funky
devices like Dell Wyse 3040.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-30 18:00:59 +00:00
Takashi Iwai
2fc995a87f ASoC: intel: Fix crash at suspend/resume without card registration
When ASoC Intel SST Medfield driver is probed but without codec / card
assigned, it causes an Oops and freezes the kernel at suspend/resume,

 PM: Suspending system (freeze)
 Suspending console(s) (use no_console_suspend to debug)
 BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
 IP: [<ffffffffc09d9409>] sst_soc_prepare+0x19/0xa0 [snd_soc_sst_mfld_platform]
 Oops: 0000 [#1] PREEMPT SMP
 CPU: 0 PID: 1552 Comm: systemd-sleep Tainted: G W 4.9.0-rc6-1.g5f5c2ad-default #1
 Call Trace:
  [<ffffffffb45318f9>] dpm_prepare+0x209/0x460
  [<ffffffffb4531b61>] dpm_suspend_start+0x11/0x60
  [<ffffffffb40d3cc2>] suspend_devices_and_enter+0xb2/0x710
  [<ffffffffb40d462e>] pm_suspend+0x30e/0x390
  [<ffffffffb40d2eba>] state_store+0x8a/0x90
  [<ffffffffb43c670f>] kobj_attr_store+0xf/0x20
  [<ffffffffb42b0d97>] sysfs_kf_write+0x37/0x40
  [<ffffffffb42b02bc>] kernfs_fop_write+0x11c/0x1b0
  [<ffffffffb422be68>] __vfs_write+0x28/0x140
  [<ffffffffb43728a8>] ? apparmor_file_permission+0x18/0x20
  [<ffffffffb433b2ab>] ? security_file_permission+0x3b/0xc0
  [<ffffffffb422d095>] vfs_write+0xb5/0x1a0
  [<ffffffffb422e3d6>] SyS_write+0x46/0xa0
  [<ffffffffb4719fbb>] entry_SYSCALL_64_fastpath+0x1e/0xad

Add proper NULL checks in the PM code of mdfld driver.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org>
2016-11-30 17:58:53 +00:00
Takashi Iwai
786e1c3719 ASoC: intel: Replace kthread with work
The usage pattern of kthread worker in Intel SST drivers can be
replaced gracefully with the normal workqueue, which is more light-
weight and easier to manage in general.  Let's do it.

While in the replacement, move the schedule_work() call inside the
spinlock for excluding the race, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Tested-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-30 17:41:13 +00:00
Richard Fitzgerald
1b4d9c2219 ASoC: core: Add component pin control functions
It's often the case that a codec driver will need to control its
own pins. However, if a name_prefix has been applied to this codec it
must be included in the name passed to any of the snd_soc_dapm_x_pin()
functions.

The behaviour of the existing pin control functions is reasonable, since
you may want to search for a fully-specified name within the scope of an
entire card. This means that we can't apply the prefix in these functions
because it will break card-scope searches.

Constructing a prefixed string "manually" in codec drivers leads to a lot
of repetition of the same code.

To make this tidier in codec drivers this patch adds a new set of
equivalent functions that take a struct snd_soc_component instead of a
dapm context and automatically add the component's name_prefix to the
given name. This makes it a simple change in codec drivers to be
prefix-safe.

The new functions are not quite trivial enough to be inlines and the
compiler won't be able to compile-away any part of them.

Although it looks somewhat inefficient to have to allocate a temporary
buffer and combine strings, the current design of the widget list
doesn't lend itself to a more optimized implementation - it's a single
list of all widgets on a card and is searched linearly for a matching
string. As pin state changes are generally low-frequency events it's
unlikely to be a significant issue - at least not enough to rewrite the
widget list handling just for this.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-30 17:16:09 +00:00
Takashi Iwai
6648eb8666 ASoC: Intel: Add missing 10EC5672 ACPI ID matching for Cherry Trail
Add the missing ACPI ID 10EC5672 for Cherry Trail, which bounds with
cht-bsw-rt5672 driver.  This combination was found on Dell Wyse 3040.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-30 16:23:28 +00:00
Takashi Iwai
91197a9230 ASoC: Intel: atom: Make some messages to debug level
Intel sst driver spews lots of kernel messages in INFO level;
typically, it gives a kernel message at each time it allocates or
frees a stream, or at each time when a stream is started or stopped.
This will piles up quickly, and it's almost useless for normal users,
so let's hide them to KERN_DEBUG level.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-29 11:34:13 +00:00
Linus Torvalds
96e52d3ac8 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
Pull sparc fixes from David Miller:
 "Two ugly build warning fixes"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc:
  dbri: Fix compiler warning
  qlogicpti: Fix compiler warnings
2016-11-28 13:53:19 -08:00
Tushar Dave
16f46050e7 dbri: Fix compiler warning
dbri uses 'u32' for dma handle while invoking kernel DMA APIs,
instead of using dma_addr_t. This hasn't caused any 'incompatible
pointer type' warning on SPARC because until now dma_addr_t is of
type u32. However, recent changes in SPARC ATU (iommu) enabled 64bit
DMA and therefore dma_addr_t became of type u64. This makes
'incompatible pointer type' warnings inevitable.

e.g.
sound/sparc/dbri.c: In function ‘snd_dbri_create’:
sound/sparc/dbri.c:2538: warning: passing argument 3 of ‘dma_zalloc_coherent’ from incompatible pointer type
./include/linux/dma-mapping.h:608: note: expected ‘dma_addr_t *’ but argument is of type ‘u32 *’

For the record, dbri(sbus) driver never executes on sun4v. Therefore
even though 64bit DMA is enabled on SPARC, dbri continues to use
legacy iommu that guarantees DMA address is always in 32bit range.

This patch resolves above compiler warning.

Signed-off-by: Tushar Dave <tushar.n.dave@oracle.com>
Reviewed-by: thomas tai <thomas.tai@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-11-28 15:51:31 -05:00
GuruprasadX Pawse
48458cc891 ASoC: Intel: Skylake: Removed the unused I2S blob structure
Now that I2S conflig blob structure is no longer in use, remove it.

Signed-off-by: GuruprasadX Pawse <guruprasadx.pawse@intel.com>
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-25 13:08:48 +00:00
GuruprasadX Pawse
c186fe7401 ASoC: Intel: Skylake: Don't use dma I2S config structure in kernel
I2S blob config structure can change between DSP copier module versions.
We are not modifying these structures anyway and NHLT blobs specify them
properly, so use the blob directly to send the dma_control ipc instead
of using the predefined I2S blob config structure.

Signed-off-by: GuruprasadX Pawse <guruprasadx.pawse@intel.com>
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-25 13:08:35 +00:00
Kuninori Morimoto
4821d914fe ASoC: rsnd: use dma_sync_single_for_xxx() for IOMMU
IOMMU needs DMA mapping function to use it. One solution is that
we can use DMA mapped dev on snd_pcm_lib_preallocate_pages_for_all()
for SNDRV_DMA_TYPE_DEV. But pcm_new and dma map timing are mismatched.
Thus, this patch uses SNDRV_DMA_TYPE_CONTINUOUS for pcm_new,
and use dma_sync_single_for_xxx() for each transfer.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-22 17:25:52 +00:00
Kuninori Morimoto
edce5c496c ASoC: rsnd: Request/Release DMA channel each time
Current Renesas Sound driver requests DMA channel when .probe timing,
and release it when .remove timing. And use DMA on .start/.stop
But, Audio DMAC power ON was handled when request timing (= .probe),
and power OFF was when release timing (= .remove).
This means Audio DMAC power is always ON during driver was enabled.
The best choice to solve this issue is that DMAEngine side handle
this. But current DMAEngine API design can't solve atmic/non-atmic
context issue for power ON/OFF. So next better choice is sound
driver request/release DMA channel each time. This patch do it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-22 17:25:52 +00:00
Takashi Iwai
a823a17981 ASoC: cht_bsw_rt5645: Fix leftover kmalloc
cht_bsw_rt5645 driver allocates the own codec_id string but doesn't
release it.  For simplicity, put the string in cht_mc_private; then
the string is allocated in a shot and released altogether.

Fixes: c8560b7c91 ("ASoC: cht_bsw_rt5645: Fix writing to string literal")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-22 17:22:38 +00:00
Linus Torvalds
c1717701be sound fixes for 4.9-rc6
Three trivial fixes: a regression fix for ASRock mobo, a
 use-after-free fix at hot-unplug of USB-audio, and a quirk for new
 Thinkpad models.
 -----BEGIN PGP SIGNATURE-----
 
 iQIrBAABCAAVBQJYLsqoDhx0aXdhaUBzdXNlLmRlAAoJEGwxgFQ9KSmkF+gQAIyL
 IJROXA6MWSHMaUUa0zToCBYscF+Z1CXavqLkBVGpaMGLM9m4CLkWavmxIIJkfr/1
 XDTDgu6fvDQ0mRBSp3VnxKZGGf0V9fvdODWD7ueCZNHgdNMxMCMwAPaZwTJVk41L
 1W/OfJG/w059L7zY0ZQ05zNphF9noav8Qdb685QdXY5brD92KbGs4TYNHl/D4bw7
 rkT/dcLAxKfSg3Bnwi0Dong5MmXSH+IqvaapHVlhoBkHala5iHZS4URZKS2JgdUl
 nbHFY1kDK5DBN4hHixrRMWqf6MP+ASA/zdEFUeQzoZ9mo/oYjbHURr63+chYkj5I
 Y3yzn4YOEL9O+SdShRYdr6YCHpIJzuvwZCwIPLUlnXrqHoeJPkBnb4J8JiMmqm7O
 F/REdLJoUldqEp3UhBePSSg53UI9qceB1QMYk8YIQy0yyom20uBuQ4GbXnyKQrLl
 MpRb8sfh1GATaTfEshqH+52t7taRPv9VPtGAmDHOLYpcmWhfrJ7Kc6Mh60yTJJbd
 91V4lNib8fV3eqWsW5+l25xzMku8FSIQHgUtG4zW2uOVD3lQiuYS6L8jYiBBApas
 Tgvuowh3Y0toDDH5VTAtorUzYEKF203uqOytey3SgVyTz4lErrzdp+JyaeobGhHv
 BIZKgV1Q00r+FNi7LC4thS9K6yvXLtXPc2mI4OMu
 =aKgB
 -----END PGP SIGNATURE-----

Merge tag 'sound-4.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "Three trivial fixes:

  A regression fix for ASRock mobo, a use-after-free fix at hot-unplug
  of USB-audio, and a quirk for new Thinkpad models"

* tag 'sound-4.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: usb-audio: Fix use-after-free of usb_device at disconnect
  ALSA: hda - Fix mic regression by ASRock mobo fixup
  ALSA: hda - add a new condition to check if it is thinkpad
2016-11-18 08:56:47 -08:00
Lars-Peter Clausen
266c618d67 ASoC: intel: mfld: Make static string arrays 'const 'char * const []'
const char * const [] is the preferred type for static string arrays since
this states explicitly that the individual entries are not going to be
changed. Due to limitations in the ASoC API it was not possible to use it
for enum text arrays. Commit 87023ff74b ("ASoC: Declare const properly
for enum texts") changed this, but most drivers still use 'const char
* []' as the type for their enum text arrays.

Change these occurrences of 'static * const char * []' to 'static const
char * const []'.

The conversion was done automatically using the following coccinelle
semantic patch:
// <smpl>
@disable optional_qualifier@
identifier s;
@@
 static
-const char *
+const char * const
 s[] = ...;
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-16 10:08:59 +00:00
Takashi Iwai
6ff1a25318 ALSA: usb-audio: Fix use-after-free of usb_device at disconnect
The usb-audio driver implements the deferred device disconnection for
the device in use.  In this mode, the disconnection callback returns
immediately while the actual ALSA card object removal happens later
when all files get closed.  As Shuah reported, this code flow,
however, leads to a use-after-free, detected by KASAN:

 BUG: KASAN: use-after-free in snd_usb_audio_free+0x134/0x160 [snd_usb_audio] at addr ffff8801c863ce10
 Write of size 8 by task pulseaudio/2244
 Call Trace:
  [<ffffffff81b31473>] dump_stack+0x67/0x94
  [<ffffffff81564ef1>] kasan_object_err+0x21/0x70
  [<ffffffff8156518a>] kasan_report_error+0x1fa/0x4e0
  [<ffffffff81564ad7>] ? kasan_slab_free+0x87/0xb0
  [<ffffffff81565733>] __asan_report_store8_noabort+0x43/0x50
  [<ffffffffa0fc0f54>] ? snd_usb_audio_free+0x134/0x160 [snd_usb_audio]
  [<ffffffffa0fc0f54>] snd_usb_audio_free+0x134/0x160 [snd_usb_audio]
  [<ffffffffa0fc0fb1>] snd_usb_audio_dev_free+0x31/0x40 [snd_usb_audio]
  [<ffffffff8243c78a>] __snd_device_free+0x12a/0x210
  [<ffffffff8243d1f5>] snd_device_free_all+0x85/0xd0
  [<ffffffff8242cae4>] release_card_device+0x34/0x130
  [<ffffffff81ef1846>] device_release+0x76/0x1e0
  [<ffffffff81b37ad7>] kobject_release+0x107/0x370
  .....
 Object at ffff8801c863cc80, in cache kmalloc-2048 size: 2048
 Allocated:
  [<ffffffff810804eb>] save_stack_trace+0x2b/0x50
  [<ffffffff81564296>] save_stack+0x46/0xd0
  [<ffffffff8156450d>] kasan_kmalloc+0xad/0xe0
  [<ffffffff81560d1a>] kmem_cache_alloc_trace+0xfa/0x240
  [<ffffffff8214ea47>] usb_alloc_dev+0x57/0xc90
  [<ffffffff8216349d>] hub_event+0xf1d/0x35f0
  ....
 Freed:
  [<ffffffff810804eb>] save_stack_trace+0x2b/0x50
  [<ffffffff81564296>] save_stack+0x46/0xd0
  [<ffffffff81564ac1>] kasan_slab_free+0x71/0xb0
  [<ffffffff81560929>] kfree+0xd9/0x280
  [<ffffffff8214de6e>] usb_release_dev+0xde/0x110
  [<ffffffff81ef1846>] device_release+0x76/0x1e0
  ....

It's the code trying to clear drvdata of the assigned usb_device where
the usb_device itself was already released in usb_release_dev() after
the disconnect callback.

This patch fixes it by checking whether the code path is via the
disconnect callback, i.e. chip->shutdown flag is set.

Fixes: 79289e2419 ('ALSA: usb-audio: Refer to chip->usb_id for quirks...')
Reported-and-tested-by: Shuah Khan <shuahkh@osg.samsung.com>
Cc: <stable@vger.kernel.org> # v4.6+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-11-14 22:05:04 +01:00
Linus Torvalds
ee2bd216e1 ASoC: lpass-platform: fix uninitialized variable
In commit 022d00ee0b ("ASoC: lpass-platform: Fix broken pcm data
usage") the stream specific information initialization was broken, with
the dma channel information not being initialized if there was no
alloc_dma_channel() helper function.

Before that, the DMA channel number was implicitly initialized to zero
because the backing store was allocated with devm_kzalloc().  When the
init code was rewritten, that implicit initialization was lost, and gcc
rightfully complains about an uninitialized variable being used.

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-11-14 09:46:08 -08:00
Pierre-Louis Bossart
bf46241bee ASoC: Intel: bytct_rt5640: change default capture settings
Most Baytrail-CR devices use analog differential microphones,
modify capture default to avoid DMI quirks. Keep digital mics
for all other configurations.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-13 09:19:58 +00:00
Pierre-Louis Bossart
64e84305cb ASoC: Intel: detect audio routing with CHAN package
Baytrail-CR devices usually expose information in the DSDT
which can be used to auto-detect AIF1/AIF2 connections.
The CHAN package contains two integers, the first one describes
the AIF number (1: AIF1, 2: AIF2) and the second the MCLK
value (ignored in this patch)

For example the following information is found in Lenovo 100s:

Device (RTEK) {
[...]
    Name (CHAN, Package (0x02)
    {
        One,
        0x017D7840
    })

While on Asus T100TAF the package values are:

    Name (CHAN, Package (0x02)
    {
        0x02,
        0x017D7840
    })

This patch relies on the new common routine to extract
a package exposed by a device indexed with the HID value.
The CHAN package contents are queried from the machine driver
and stored in a structure.

If this auto-detection fails (missing or bad package in the
BIOS), the routing falls back to SSP0-AIF2.

Note that quirks may still be needed to support mono speakers
or microphone, but this should reduce the number of issues with
Baytrail significantly.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-13 09:19:54 +00:00
Pierre-Louis Bossart
3421894765 ASoC: Intel: common: add ACPI package extraction utility
Add a new common routine to extract a package exposed by a
device indexed with the HID value. The functionality is
implemented without assumptions on the package type or
structure to allow for reuse. The caller is responsible for
defining the name and allocating structures to store the
results, ACPICA will complain in case of type mismatches
or buffer size issues.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-13 09:19:51 +00:00
Takashi Iwai
9a2541910d ALSA: hda - Fix mic regression by ASRock mobo fixup
The commit [1a3f099101: ALSA: hda - Fix surround output pins for
ASRock B150M mobo] introduced a fixup of pin configs for ASRock
mobos to fix the surround outputs.  However, this overrides the pin
configs of the mic pins as if they are outputs-only, effectively
disabling the mic inputs.  Of course, it's a regression wrt mic
functionality.

Actually the pins 0x18 and 0x1a don't need to be changed; we just need
to disable the bogus pins 0x14 and 0x15.  Then the auto-parser will
pick up mic pins as switchable and assign the surround outputs there.

This patch removes the incorrect pin overrides of NID 0x18 and 0x1a
from the ASRock fixup.

Fixes: 1a3f099101 ('ALSA: hda - Fix surround output pins for ASRock...')
Reported-and-tested-by: Vitor Antunes <vitor.hda@gmail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=187431
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-11-11 12:33:20 +01:00
Hui Wang
2ecb704a12 ALSA: hda - add a new condition to check if it is thinkpad
Latest Thinkpad laptops use the HKEY_HID LEN0268 instead of the
LEN0068, as a result neither audio mute led nor mic mute led can work
any more.

After adding the new HKEY_HID into the is_thinkpad(), both of them
works well as before.

Cc: <stable@vger.kernel.org>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-11-10 09:32:55 +01:00
Jayachandran B
8b4a133c61 ASoC: Intel: Skylake: Flush pending D0i3 request on suspend
While going to suspend, if we have any pending D0i3 work scheduled,
flush that and force the DSP to goto D0i3 mode before going to suspend.

Signed-off-by: Jayachandran B <jayachandran.b@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-09 15:22:48 +00:00
Jayachandran B
68d03a3aa2 ASoC: Intel: Skylake: remove pci device enabling calls on suspend
We were invoking pci_disable_device() while going to suspend-to-idle and
pci_enable_device() while coming back to active state.

Turns out that we do not need these calls as we only need system to be
wake capable when in suspend-to-idle state. The wake capability is
already done by enable_irq_wake() calls, so remove these unwanted calls
in driver.

Signed-off-by: Jayachandran B <jayachandran.b@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-09 15:22:48 +00:00
Charles Keepax
06859fca43 ASoC: core: If a platform doesn't have an of_node use parent's node
Support was added to allow location of both CPU and CODEC components
of a DAI link from their parent's of_node if they did not have an
of_node themselves in this commit:

commit 3e0aa8d83b ("ASoC: core: If component doesn't have of_node
                      use parent's node instead")

However this leaves platforms as something of a special case as the
major DAI component that doesn't do this. Since this is useful for MFD
devices which often utilise a single device tree entry for the whole
device, add support for looking up platforms from the parent's of_node
as well.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-09 14:01:54 +00:00
Arnd Bergmann
3b89e4b77e ASoC: lpass-platform: initialize dma channel number
A bugfix accidentally removed the implicit initialization of the
dma channel number, causing undefined behavior when
v->alloc_dma_channel is NULL:

sound/soc/qcom/lpass-platform.c: In function ‘lpass_platform_pcmops_open’:
sound/soc/qcom/lpass-platform.c:83:29: error: ‘dma_ch’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

This adds back an explicit initialization to zero, restoring the
previous behavior for that case.

Fixes: 022d00ee0b ("ASoC: lpass-platform: Fix broken pcm data usage")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-09 13:24:57 +00:00
Takashi Iwai
6809cd682b ALSA: info: Return error for invalid read/write
Currently the ALSA proc handler allows read or write even if the proc
file were write-only or read-only.  It's mostly harmless, does thing
but allocating memory and ignores the input/output.  But it doesn't
tell user about the invalid use, and it's confusing and inconsistent
in comparison with other proc files.

This patch adds some sanity checks and let the proc handler returning
an -EIO error when the invalid read/write is performed.

Cc: <stable@vger.kernel.org> # v4.2+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-11-08 14:37:26 +01:00
Takashi Iwai
027a9fe683 ALSA: info: Limit the proc text input size
The ALSA proc handler allows currently the write in the unlimited size
until kmalloc() fails.  But basically the write is supposed to be only
for small inputs, mostly for one line inputs, and we don't have to
handle too large sizes at all.  Since the kmalloc error results in the
kernel warning, it's better to limit the size beforehand.

This patch adds the limit of 16kB, which must be large enough for the
currently existing code.

Cc: stable@vger.kernel.org # v4.2+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-11-08 13:16:40 +01:00
Mark Brown
3dfd2b682b Merge remote-tracking branches 'asoc/fix/rt5663', 'asoc/fix/samsung', 'asoc/fix/sti', 'asoc/fix/sti-codec', 'asoc/fix/sunxi' and 'asoc/fix/tas571x' into asoc-linus 2016-11-04 12:33:56 -06:00