Commit Graph

723903 Commits

Author SHA1 Message Date
Takashi Iwai 9dd55cb419 Merge branch 'for-linus' into for-next
Back-merge to continue fixing the OSS emulation code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-01-09 08:49:53 +01:00
Takashi Iwai 900498a34a ALSA: pcm: Allow aborting mutex lock at OSS read/write loops
PCM OSS read/write loops keep taking the mutex lock for the whole
read/write, and this might take very long when the exceptionally high
amount of data is given.  Also, since it invokes with mutex_lock(),
the concurrent read/write becomes unbreakable.

This patch tries to address these issues by replacing mutex_lock()
with mutex_lock_interruptible(), and also splits / re-takes the lock
at each read/write period chunk, so that it can switch the context
more finely if requested.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-01-08 16:40:26 +01:00
Takashi Iwai 29159a4ed7 ALSA: pcm: Abort properly at pending signal in OSS read/write loops
The loops for read and write in PCM OSS emulation have no proper check
of pending signals, and they keep processing even after user tries to
break.  This results in a very long delay, often seen as RCU stall
when a huge unprocessed bytes remain queued.  The bug could be easily
triggered by syzkaller.

As a simple workaround, this patch adds the proper check of pending
signals and aborts the loop appropriately.

Reported-by: syzbot+993cb4cfcbbff3947c21@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-01-08 15:16:52 +01:00
Kailang Yang da911b1f5e ALSA: hda/realtek - update ALC225 depop optimize
Add ALC225 its own depop functions for alc_init and alc_shutup.
Add depop optimize step for headset mode functions.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-01-08 10:42:13 +01:00
Takashi Iwai 2c82e8ea94 ASoC: Updates for v4.16
Quite a big update here, mostly in new device support and some big
 updates for older drivers too.  The main core work continues to be
 Morimoto-san's efforts on modernising drivers to use the component
 layer.
 
  - Lots more updates from Morimoto-san to move more things into the
    component level.
  - Large cleanups of some of the TI CODEC drivers from Andrew F. Davis.
  - Even more quirks and cleanups of quirks for x86 systems.
  - Refactoring of the Freescale SSI driver from Nicolin Chen in
    preparation for some more substantive improvements which are
    currently in review.
  - New drivers for Allwinner A83T, Maxim MAX89373, SocioNext UiniPhier
    EVEA Tempo Semiconductor TSCS42xx and TI PCM816x, TAS5722 and TAS6424
    devices.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlpPs5ETHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0ML7B/oDInL0FboyUorNxANa9SPWVby29OIh
 umWCG0Yq6683aOpjHJaCQeQ8VePlV+ABN/cP979PFxjEaJSZ+uaTOQs6oPgDwiHM
 Piaw5+6S6hz2W/E1smpW5rReBfw3MBLSl938eoauQOAU10tDNBqK7z6H41/cBWsu
 o1VAebcuTcIJyHhBYch17IxXX/H+NzumX/WK8YZH+fYBjnJfRbaYyXlFTl2jmdrO
 LOq6JAl8pTtJL0foZZSCeFHoZnVw47y6zkZQaMViaW70RIVMVBVtO+onRSI8bIpj
 vGtwJWvOg+Mrjk2eizQjZsWqsPYsClv+eOoY4Qtwg3mIFs7GN6WqUWPP
 =aUw7
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v4.16' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next

ASoC: Updates for v4.16

Quite a big update here, mostly in new device support and some big
updates for older drivers too.  The main core work continues to be
Morimoto-san's efforts on modernising drivers to use the component
layer.

 - Lots more updates from Morimoto-san to move more things into the
   component level.
 - Large cleanups of some of the TI CODEC drivers from Andrew F. Davis.
 - Even more quirks and cleanups of quirks for x86 systems.
 - Refactoring of the Freescale SSI driver from Nicolin Chen in
   preparation for some more substantive improvements which are
   currently in review.
 - New drivers for Allwinner A83T, Maxim MAX89373, SocioNext UiniPhier
   EVEA Tempo Semiconductor TSCS42xx and TI PCM816x, TAS5722 and TAS6424
   devices.
2018-01-05 18:52:19 +01:00
Takashi Iwai 898dfe4687 ALSA: aloop: Fix racy hw constraints adjustment
The aloop driver tries to update the hw constraints of the connected
target on the cable of the opened PCM substream.  This is done by
adding the extra hw constraints rules referring to the substream
runtime->hw fields, while the other substream may update the runtime
hw of another side on the fly.

This is, however, racy and may result in the inconsistent values when
both PCM streams perform the prepare concurrently.  One of the reason
is that it overwrites the other's runtime->hw field; which is not only
racy but also broken when it's called before the open of another side
finishes.  And, since the reference to runtime->hw isn't protected,
the concurrent write may give the partial value update and become
inconsistent.

This patch is an attempt to fix and clean up:
- The prepare doesn't change the runtime->hw of other side any longer,
  but only update the cable->hw that is referred commonly.
- The extra rules refer to the loopback_pcm object instead of the
  runtime->hw.  The actual hw is deduced from cable->hw.
- The extra rules take the cable_lock to protect against the race.

Fixes: b1c73fc8e6 ("ALSA: snd-aloop: Fix hw_params restrictions and checking")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-01-05 16:44:16 +01:00
Takashi Iwai b088b53e20 ALSA: aloop: Fix inconsistent format due to incomplete rule
The extra hw constraint rule for the formats the aloop driver
introduced has a slight flaw, where it doesn't return a positive value
when the mask got changed.  It came from the fact that it's basically
a copy&paste from snd_hw_constraint_mask64().  The original code is
supposed to be a single-shot and it modifies the mask bits only once
and never after, while what we need for aloop is the dynamic hw rule
that limits the mask bits.

This difference results in the inconsistent state, as the hw_refine
doesn't apply the dependencies fully.  The worse and surprisingly
result is that it causes a crash in OSS emulation when multiple
full-duplex reads/writes are performed concurrently (I leave why it
triggers Oops to readers as a homework).

For fixing this, replace a few open-codes with the standard
snd_mask_*() macros.

Reported-by: syzbot+3902b5220e8ca27889ca@syzkaller.appspotmail.com
Fixes: b1c73fc8e6 ("ALSA: snd-aloop: Fix hw_params restrictions and checking")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-01-05 16:40:16 +01:00
Takashi Iwai 9685347aa0 ALSA: aloop: Release cable upon open error path
The aloop runtime object and its assignment in the cable are left even
when opening a substream fails.  This doesn't mean any memory leak,
but it still keeps the invalid pointer that may be referred by the
another side of the cable spontaneously, which is a potential Oops
cause.

Clean up the cable assignment and the empty cable upon the error path
properly.

Fixes: 597603d615 ("ALSA: introduce the snd-aloop module for the PCM loopback")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-01-05 16:22:20 +01:00
Takashi Iwai fb51f1cd06 ALSA: pcm: Workaround for weird PulseAudio behavior on rewind error
The commit 9027c4639e ("ALSA: pcm: Call ack() whenever appl_ptr is
updated") introduced the possible error code returned from the PCM
rewind ioctl.  Basically the change was for handling the indirect PCM
more correctly, but ironically, it caused rather a side-effect:
PulseAudio gets pissed off when receiving an error from rewind, throws
everything away and stops processing further, resulting in the
silence.

It's clearly a failure in the application side, so the best would be
to fix that bug in PA.  OTOH, PA is mostly the only user of the rewind
feature, so it's not good to slap the sole customer.

This patch tries to mitigate the situation: instead of returning an
error, now the rewind ioctl returns zero when the driver can't rewind.
It indicates that no rewind was performed, so the behavior is
consistent, at least.

Fixes: 9027c4639e ("ALSA: pcm: Call ack() whenever appl_ptr is updated")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-01-05 16:07:50 +01:00
Mark Brown b762408d59
Merge remote-tracking branches 'asoc/topic/wm8997' and 'asoc/topic/wm8998' into asoc-next 2018-01-05 12:44:23 +00:00
Mark Brown 144f4ab5ae
Merge remote-tracking branches 'asoc/topic/wm5110', 'asoc/topic/wm8350', 'asoc/topic/wm8400', 'asoc/topic/wm8903' and 'asoc/topic/wm8994' into asoc-next 2018-01-05 12:44:20 +00:00
Mark Brown 60f142ed58
Merge remote-tracking branches 'asoc/topic/uniphier', 'asoc/topic/utils', 'asoc/topic/wm0010', 'asoc/topic/wm2000' and 'asoc/topic/wm5102' into asoc-next 2018-01-05 12:44:16 +00:00
Mark Brown 04df320d46
Merge remote-tracking branches 'asoc/topic/ts3a227e', 'asoc/topic/tsc42xx', 'asoc/topic/twl4030', 'asoc/topic/twl6040' and 'asoc/topic/uda1380' into asoc-next 2018-01-05 12:44:13 +00:00
Mark Brown 6ce6d181f9
Merge remote-tracking branches 'asoc/topic/tfa9879', 'asoc/topic/tlv320aic31xx', 'asoc/topic/tlv320aic32x4', 'asoc/topic/tlv320aic3x' and 'asoc/topic/tlv320dac33' into asoc-next 2018-01-05 12:44:09 +00:00
Mark Brown 7f4b875032
Merge remote-tracking branches 'asoc/topic/sun4i-i2s', 'asoc/topic/sunxi', 'asoc/topic/symmetry', 'asoc/topic/tas5720' and 'asoc/topic/tas6424' into asoc-next 2018-01-05 12:44:06 +00:00
Mark Brown 6486cae87f
Merge remote-tracking branches 'asoc/topic/samsung', 'asoc/topic/si476x', 'asoc/topic/simple', 'asoc/topic/spdif' and 'asoc/topic/stm32' into asoc-next 2018-01-05 12:44:03 +00:00
Mark Brown 8c7014c66b
Merge remote-tracking branches 'asoc/topic/rl6231', 'asoc/topic/rt5514' and 'asoc/topic/rt5645' into asoc-next 2018-01-05 12:44:00 +00:00
Mark Brown 5d718e631a
Merge remote-tracking branches 'asoc/topic/nau8824', 'asoc/topic/nau8825' and 'asoc/topic/nuc900' into asoc-next 2018-01-05 12:43:57 +00:00
Mark Brown 3116e748a6
Merge remote-tracking branches 'asoc/topic/mc13783', 'asoc/topic/msm8916', 'asoc/topic/mt8173', 'asoc/topic/mtk' and 'asoc/topic/nau8540' into asoc-next 2018-01-05 12:43:53 +00:00
Mark Brown 87c90ac06a
Merge remote-tracking branches 'asoc/topic/hisilicon', 'asoc/topic/max98373', 'asoc/topic/max98926' and 'asoc/topic/max98927' into asoc-next 2018-01-05 12:43:50 +00:00
Mark Brown 2f1eceda4d
Merge remote-tracking branches 'asoc/topic/fsl', 'asoc/topic/fsl-ssi', 'asoc/topic/fsl_asrc' and 'asoc/topic/hdac_hdmi' into asoc-next 2018-01-05 12:43:47 +00:00
Mark Brown 747c908427
Merge remote-tracking branches 'asoc/topic/dai-drv', 'asoc/topic/davinci', 'asoc/topic/disconnect', 'asoc/topic/ep93xx' and 'asoc/topic/eukrea-tlv320' into asoc-next 2018-01-05 12:43:44 +00:00
Mark Brown 7ed42b4e7d
Merge remote-tracking branches 'asoc/topic/cs42l73', 'asoc/topic/cs47l24', 'asoc/topic/cx20442', 'asoc/topic/da7213' and 'asoc/topic/da7218' into asoc-next 2018-01-05 12:43:41 +00:00
Mark Brown 67084aca82
Merge remote-tracking branches 'asoc/topic/cq93vc', 'asoc/topic/cs35l32', 'asoc/topic/cs35l34', 'asoc/topic/cs42l52' and 'asoc/topic/cs42l56' into asoc-next 2018-01-05 12:43:38 +00:00
Mark Brown 49c68b914b
Merge remote-tracking branches 'asoc/topic/88pm860x', 'asoc/topic/amd', 'asoc/topic/atmel' and 'asoc/topic/compress' into asoc-next 2018-01-05 12:43:35 +00:00
Mark Brown 7c29e706b6
Merge remote-tracking branch 'asoc/topic/rcar' into asoc-next 2018-01-05 12:43:33 +00:00
Mark Brown f827f9a929
Merge remote-tracking branch 'asoc/topic/qcom' into asoc-next 2018-01-05 12:43:32 +00:00
Mark Brown 6508322da3
Merge remote-tracking branch 'asoc/topic/pcm512x' into asoc-next 2018-01-05 12:43:30 +00:00
Mark Brown 7b2daeaec6
Merge remote-tracking branch 'asoc/topic/pcm186x' into asoc-next 2018-01-05 12:43:29 +00:00
Mark Brown 7e9a8a8785
Merge remote-tracking branch 'asoc/topic/intel' into asoc-next 2018-01-05 12:43:27 +00:00
Mark Brown d33f102017
Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2018-01-05 12:43:26 +00:00
Mark Brown 8c2ab73f2a
Merge remote-tracking branch 'asoc/fix/mtk' into asoc-linus 2018-01-05 12:43:23 +00:00
Mark Brown 642839b6de
Merge remote-tracking branch 'asoc/fix/intel' into asoc-linus 2018-01-05 12:43:22 +00:00
Steven Eckhoff ba6c295925
ASoC: TSCS42xx: Add support for Tempo Semiconductor's TSCS42xx audio CODEC
Currently there is no support for TSCS42xx audio CODECs.

Add support for TSCS42xx audio CODECs.

Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Steven Eckhoff <steven.eckhoff.opensource@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-05 12:37:41 +00:00
Peter Ujfalusi d43c17daf2
ASoC: davinci-mcasp: Add rule to constrain the minimum period size
The minimum period size (in frames) must be not lower than the FIFO size
of McASP and in general too small period size would easily result underrun
in applications as eDMA - the most common DMA servicing McASP have support
for limited number of periods.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-05 11:48:51 +00:00
Fabio Estevam ef42e3557f
ASoC: simple-card: Pass 'reg' property in the examples
Since unit addresses are passed to simple-audio-card,dai-link a
corresponding 'reg' property is needed, otherwise dtc complains
(when building with W=1) in case someone copies the bindings example
into a real dts file:

Warning (unit_address_vs_reg): Node /sound-digital/simple-audio-card,dai-link@0 has a unit name, but no reg property

Improve the example by passing the correct 'reg' properties.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-04 17:39:00 +00:00
Ryan Lee 2f3d24a135
ASoC: max98373: Added Amplifier Driver
Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-04 17:17:06 +00:00
Ryan Lee bab4a10f0d
ASoC: Added device tree binding for max98373 amplifier
Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-04 17:17:01 +00:00
Takashi Iwai 6708913750 ALSA: pcm: Add missing error checks in OSS emulation plugin builder
In the OSS emulation plugin builder where the frame size is parsed in
the plugin chain, some places miss the possible errors returned from
the plugin src_ or dst_frames callback.

This patch papers over such places.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-01-04 16:39:27 +01:00
Ryder Lee 7f12a56367
ASoC: mediatek: update MT2701 AFE documentation to adapt mfd device
As the new MFD parent is in place, modify MT2701 AFE documentation to
adapt it. Also add three core clocks in example.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-04 14:25:57 +00:00
Ryder Lee dfa3cbb83e
ASoC: mediatek: modify MT2701 AFE driver to adapt mfd device
As the new MFD parent is in place, modify MT2701 AFE driver to adapt it.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-04 14:25:56 +00:00
Ryder Lee 96365d9fdb
ASoC: mediatek: add some core clocks for MT2701 AFE
Add three core clocks for MT2701 AFE.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-04 14:25:55 +00:00
Bard Liao e61f3f31e5
ASoC: rt5645: add micbias power control select.
We need to set a corresponding control bit before powering micbias up.

Signed-off-by: Bard Liao <bardliao@realtek.com>
[hdegoede@redhat.com: Remove 2 unused variable declarations]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-04 12:09:12 +00:00
Bard Liao bd70b19e9e
ASoC: rt5645: change micbias widget type to supply.
Register "micbias1" and "micbias2" to supply widgets as modern drivers do.

This should not cause any (new) issues for existing users of the codec,
since micbias support is broken anyways. Micbias support needs the
RT5645_MICBIAS?_POW_CTRL_SEL bits in the RT5645_GEN_CTRL2 register to be
updated when enabled/disabled which we currently do not do.

The updating of these bits will be fixed in a follow-up commit.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-04 12:08:49 +00:00
Kuninori Morimoto 2ca69d73bc
ASoC: rcar: tidyup simple-card example for CPU node
commit a5702e1cb3 ("ASoC: rsnd: Drop unit-addresses without reg
properties") modifies simple-card multi CPU nodes.
But, naming of "cpu-x" breaks probing.
Let's add reg = <x>; instead of renaming node.

Reported-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
CC: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-03 16:58:46 +00:00
Ryder Lee 0739fdfc06
ASoC: mediatek: update clock related properties of MT2701 AFE
Add 'assigned-clocks*' properties which are used to initialize default
domain sources of audio system. we could configure different sets of
input clocks through DTS now. Hence driver no longer cares about that.

Also we change some 'clock-names' to make them more generic so that
other chips can reuse gracefully.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-03 16:28:51 +00:00
Takashi Iwai 20a1ea2222
ASoC: skl: Fix kernel warning due to zero NHTL entry
I got the following kernel warning when loading snd-soc-skl module on
Dell Latitude 7270 laptop:
 memremap attempted on mixed range 0x0000000000000000 size: 0x0
 WARNING: CPU: 0 PID: 484 at kernel/memremap.c:98 memremap+0x8a/0x180
 Call Trace:
  skl_nhlt_init+0x82/0xf0 [snd_soc_skl]
  skl_probe+0x2ee/0x7c0 [snd_soc_skl]
  ....

It seems that the machine doesn't support the SKL DSP gives the empty
NHLT entry, and it triggers the warning.  For avoiding it, let do the
zero check before calling memremap().

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-03 15:42:20 +00:00
Ryder Lee 600b2fd4f0
ASoC: mediatek: cleanup audio driver for MT2701
Cleanup unused code such as 'i2s_num' guard, headers, indentation
and some defines.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-03 15:15:25 +00:00
Ryder Lee d8d99d8ed6
ASoC: mediatek: rework clock functions for MT2701
Reworks clock part to make it more reasonable. The current changes are:

- Replace regmap operations by CCF APIs. Doing so, we just need to handle
  the element clocks and can also get accurate information via CCF.

- Rename clocks to make them more generic so that the future revisions
  of the IP can adapt gracefully.

- Regroup 'aud_clks[]' by usage - the basic needs and I2S parts:

  The new code just keep the common clocks in array and let SoC self decide
  I2S numbers - If future chips have different sets of channels we will
  add a little more abstract here.

  Moreover, this patch moves I2S clocks to the struct mt2701_i2s_data
  so that we can easily manage them when calls .prepare() and .shutdown().

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Tested-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-03 15:15:24 +00:00
Banajit Goswami b9f902b7fd
ASoC: change mask in snd_soc_get/put_volsw_sx to unsigned int
If the result of (min + max) is negative in functions
snd_soc_get_volsw_sx() or snd_soc_put_volsw_sx(), there
will be an overflow for the variable 'mask'.
   UBSAN: Undefined behaviour in sound/soc/soc-ops.c:382:6
   signed integer overflow:
   -2147483648 - 1 cannot be represented in type 'int'

Fix this by updating the variable type of 'mask' to unsigned int.

Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-03 12:32:04 +00:00