GitHub/moto-9609/android_kernel_motorola_exynos9610.git
7 years agoALSA: usb-audio: Fix memory leak and corruption in mixer_us16x08.c
Takashi Iwai [Wed, 22 Feb 2017 07:00:25 +0000 (08:00 +0100)]
ALSA: usb-audio: Fix memory leak and corruption in mixer_us16x08.c

There are a few places leaking memory and doing double-free in
mixer_us16x08.c.

The driver allocates a usb_mixer_elem_info object at each
add_new_ctl() call.  This has to be freed via kctl->private_free, but
currently this is done properly only for some controls.

Also, the driver allocates three external objects (comp_store,
eq_store, meter_store), and these are referred in elem->private_data
(it's not kctl->private_data).  And these have to be released, but
there are none doing it.  Moreover, these extra objects have to be
released only once.  Thus the release should be done only by the first
kctl element that refers to it.

For fixing these, we call either snd_usb_mixer_elem_free() (only for
kctl->private_data) or elem_private_free() (for both
kctl->private_data and elem->private_data) via kctl->private_free
appropriately.

Last but not least, snd_us16x08_controls_create() may return in the
middle without releasing the allocated *_store objects due to an
error.  For fixing this, we shuffle the allocation code so that it's
called just before its reference.

Fixes: d2bb390a2081 ("ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk")
Reported-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: usb-audio: purge needless variable length array
Takashi Sakamoto [Tue, 21 Feb 2017 22:54:47 +0000 (07:54 +0900)]
ALSA: usb-audio: purge needless variable length array

Variable length array is used in 'snd_us16x08_meter_get()', while there
is no need. It's better to purge it because variable length array has
overhead for stack handling.

This commit replaces the array with static length. Sparse generated below
warning.

sound/usb/mixer_us16x08.c:714:18: warning: Variable length array is used.

Fixes: d2bb390a2081 ("ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: hdmi: select CONFIG_SND_PCM
Arnd Bergmann [Tue, 21 Feb 2017 22:02:37 +0000 (23:02 +0100)]
ALSA: x86: hdmi: select CONFIG_SND_PCM

The newly added driver uses the PCM helpers and fails to link if they are disabled:

sound/built-in.o: In function `hdmi_lpe_audio_runtime_suspend':
intel_hdmi_audio.c:(.text+0x15906): undefined reference to `snd_pcm_suspend'
sound/built-in.o: In function `had_pcm_hw_params':
intel_hdmi_audio.c:(.text+0x15ac7): undefined reference to `snd_pcm_lib_malloc_pages'
sound/built-in.o: In function `had_pcm_open':
intel_hdmi_audio.c:(.text+0x15d49): undefined reference to `snd_pcm_hw_constraint_integer'

This uses a Kconfig 'select' statement to make sure they are enabled.

Fixes: 5dab11d89777 ("ALSA: x86: hdmi: Add audio support for BYT and CHT")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Don't enable runtime PM as default
Takashi Iwai [Tue, 21 Feb 2017 21:18:57 +0000 (22:18 +0100)]
ALSA: x86: Don't enable runtime PM as default

Unlike HSW and newer, BYT/CHT devices have no fine control of audio
power domain in i915 side.  Since there is little gain by runtime PM
on BYT/CHT, so far, this commit removes the pm_runtime_enable() call
as default.

User who still wants the runtime PM may adjust the corresponding
sysfs files (power/control and power/autosuspend_delay_ms)
appropriately, of course.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Use runtime PM autosuspend
Takashi Iwai [Mon, 13 Feb 2017 08:52:44 +0000 (09:52 +0100)]
ALSA: x86: Use runtime PM autosuspend

This patch adds a few lines to the driver to use autosuspend for the
runtime PM.  It'll become useful with the combination of the keep-link
feature.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: usb-audio: localize function without external linkage
Takashi Sakamoto [Mon, 20 Feb 2017 20:09:19 +0000 (05:09 +0900)]
ALSA: usb-audio: localize function without external linkage

When accessed inner a file, functions should have static qualifier for
local-linkage.

This commit fixes the bug. Sparse generated below warning.

sound/usb/mixer_us16x08.c:1043:32: warning: symbol 'snd_us16x08_create_meter_store' was not declared. Should it be static?

Fixes: d2bb390a2081 ("ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: usb-audio: localize one-referrer variable
Takashi Sakamoto [Mon, 20 Feb 2017 20:09:17 +0000 (05:09 +0900)]
ALSA: usb-audio: localize one-referrer variable

When accessed by one referrer inner a file, variables should have static
qualifier to declare local-linkage.

This commit fixes the bug. Sparse generated below warnings.
sound/usb/mixer_us16x08.c:156:13: warning: duplicate const
sound/usb/mixer_us16x08.c:156:18: warning: symbol 'route_names' was not declared. Should it be static?

Fixes: d2bb390a2081 ("ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoMerge tag 'asoc-v4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound...
Takashi Iwai [Mon, 20 Feb 2017 20:43:40 +0000 (21:43 +0100)]
Merge tag 'asoc-v4.11' of git://git./linux/kernel/git/broonie/sound into for-linus

ASoC: Updates for v4.11

Another release that's mainly focused on drivers rather than core
changes, highlights include:

 - A huge batch of updates to the Intel drivers, mainly around
   DisplayPort and HDMI with some additional board support too.
 - Channel mapping support for HDMI.
 - Support for AllWinner A31 and A33, Everest Semiconductor ES8328,
   Nuvoton NAU8540.

7 years agoALSA: usb-audio: Tascam US-16x08 DSP mixer quirk
Detlef Urban [Mon, 20 Feb 2017 08:47:59 +0000 (09:47 +0100)]
ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk

Add mixer quirk for Tascam US-16x08 usb interface.
Even that this is an usb compliant device,
the input channels and DSP functions (EQ/Compressor) aren't accessible
by default.

Signed-off-by: Detlef Urban <onkel@paraair.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoMerge branch 'for-next' into for-linus
Takashi Iwai [Mon, 20 Feb 2017 07:52:50 +0000 (08:52 +0100)]
Merge branch 'for-next' into for-linus

7 years agoALSA: emu10k1: constify snd_emux_operators structure
Bhumika Goyal [Sun, 19 Feb 2017 10:21:30 +0000 (15:51 +0530)]
ALSA: emu10k1: constify snd_emux_operators structure

Declare snd_emux_operators structure as const as it is only copied into
another structure. So, snd_emux_operators structures having this property
can be made const.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoMerge remote-tracking branches 'asoc/topic/wm8753' and 'asoc/topic/zte' into asoc...
Mark Brown [Sun, 19 Feb 2017 16:37:07 +0000 (16:37 +0000)]
Merge remote-tracking branches 'asoc/topic/wm8753' and 'asoc/topic/zte' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/tlv320aic3x', 'asoc/topic/topology', ...
Mark Brown [Sun, 19 Feb 2017 16:37:01 +0000 (16:37 +0000)]
Merge remote-tracking branches 'asoc/topic/tlv320aic3x', 'asoc/topic/topology', 'asoc/topic/wm0010', 'asoc/topic/wm8731' and 'asoc/topic/wm8741' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/rt5665', 'asoc/topic/rt5677', 'asoc/topic...
Mark Brown [Sun, 19 Feb 2017 16:36:54 +0000 (16:36 +0000)]
Merge remote-tracking branches 'asoc/topic/rt5665', 'asoc/topic/rt5677', 'asoc/topic/samsung', 'asoc/topic/simple' and 'asoc/topic/sunxi' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/rt5514', 'asoc/topic/rt5640', 'asoc/topic...
Mark Brown [Sun, 19 Feb 2017 16:36:48 +0000 (16:36 +0000)]
Merge remote-tracking branches 'asoc/topic/rt5514', 'asoc/topic/rt5640', 'asoc/topic/rt5645', 'asoc/topic/rt5659' and 'asoc/topic/rt5660' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/pxa', 'asoc/topic/qcom' and 'asoc/topic...
Mark Brown [Sun, 19 Feb 2017 16:36:44 +0000 (16:36 +0000)]
Merge remote-tracking branches 'asoc/topic/pxa', 'asoc/topic/qcom' and 'asoc/topic/rockchip' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/max9867', 'asoc/topic/mtk', 'asoc/topic...
Mark Brown [Sun, 19 Feb 2017 16:36:35 +0000 (16:36 +0000)]
Merge remote-tracking branches 'asoc/topic/max9867', 'asoc/topic/mtk', 'asoc/topic/nau8540', 'asoc/topic/nau8825' and 'asoc/topic/omap' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/img' and 'asoc/topic/max98090' into asoc...
Mark Brown [Sun, 19 Feb 2017 16:36:32 +0000 (16:36 +0000)]
Merge remote-tracking branches 'asoc/topic/img' and 'asoc/topic/max98090' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/dwc', 'asoc/topic/es8328', 'asoc/topic...
Mark Brown [Sun, 19 Feb 2017 16:36:23 +0000 (16:36 +0000)]
Merge remote-tracking branches 'asoc/topic/dwc', 'asoc/topic/es8328', 'asoc/topic/fsl', 'asoc/topic/fsl-sai' and 'asoc/topic/graph' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/davinci', 'asoc/topic/debugfs' and 'asoc...
Mark Brown [Sun, 19 Feb 2017 16:36:18 +0000 (16:36 +0000)]
Merge remote-tracking branches 'asoc/topic/davinci', 'asoc/topic/debugfs' and 'asoc/topic/doc' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/atmel', 'asoc/topic/chmap', 'asoc/topic...
Mark Brown [Sun, 19 Feb 2017 16:36:13 +0000 (16:36 +0000)]
Merge remote-tracking branches 'asoc/topic/atmel', 'asoc/topic/chmap', 'asoc/topic/cq93vc' and 'asoc/topic/da7218' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/adau17x1', 'asoc/topic/adsp', 'asoc/topic...
Mark Brown [Sun, 19 Feb 2017 16:35:51 +0000 (16:35 +0000)]
Merge remote-tracking branches 'asoc/topic/adau17x1', 'asoc/topic/adsp', 'asoc/topic/ak4642', 'asoc/topic/amd' and 'asoc/topic/arizona' into asoc-next

7 years agoMerge remote-tracking branch 'asoc/topic/rcar' into asoc-next
Mark Brown [Sun, 19 Feb 2017 16:35:48 +0000 (16:35 +0000)]
Merge remote-tracking branch 'asoc/topic/rcar' into asoc-next

7 years agoMerge remote-tracking branch 'asoc/topic/pcm3168a' into asoc-next
Mark Brown [Sun, 19 Feb 2017 16:35:47 +0000 (16:35 +0000)]
Merge remote-tracking branch 'asoc/topic/pcm3168a' into asoc-next

7 years agoMerge remote-tracking branch 'asoc/topic/intel' into asoc-next
Mark Brown [Sun, 19 Feb 2017 16:35:45 +0000 (16:35 +0000)]
Merge remote-tracking branch 'asoc/topic/intel' into asoc-next

7 years agoMerge remote-tracking branch 'asoc/topic/dmaengine' into asoc-next
Mark Brown [Sun, 19 Feb 2017 16:35:44 +0000 (16:35 +0000)]
Merge remote-tracking branch 'asoc/topic/dmaengine' into asoc-next

7 years agoMerge remote-tracking branch 'asoc/topic/component' into asoc-next
Mark Brown [Sun, 19 Feb 2017 16:35:41 +0000 (16:35 +0000)]
Merge remote-tracking branch 'asoc/topic/component' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/fix/fsl-mxs-saif' and 'asoc/fix/sunxi' into...
Mark Brown [Sun, 19 Feb 2017 16:35:37 +0000 (16:35 +0000)]
Merge remote-tracking branches 'asoc/fix/fsl-mxs-saif' and 'asoc/fix/sunxi' into asoc-linus

7 years agoMerge remote-tracking branch 'asoc/fix/rcar' into asoc-linus
Mark Brown [Sun, 19 Feb 2017 16:35:36 +0000 (16:35 +0000)]
Merge remote-tracking branch 'asoc/fix/rcar' into asoc-linus

7 years agoMerge remote-tracking branch 'asoc/fix/intel' into asoc-linus
Mark Brown [Sun, 19 Feb 2017 16:35:34 +0000 (16:35 +0000)]
Merge remote-tracking branch 'asoc/fix/intel' into asoc-linus

7 years agoMerge remote-tracking branch 'asoc/fix/dapm' into asoc-linus
Mark Brown [Sun, 19 Feb 2017 16:35:33 +0000 (16:35 +0000)]
Merge remote-tracking branch 'asoc/fix/dapm' into asoc-linus

7 years agoMerge tag 'asoc-fix-v4.10-rc3' into asoc-linus
Mark Brown [Sun, 19 Feb 2017 16:35:15 +0000 (16:35 +0000)]
Merge tag 'asoc-fix-v4.10-rc3' into asoc-linus

ASoC: Fixes for v4.10

As well as the usual smattering of driver specific fixes collected since
the merge window this has one particularly important fix to the core for
handling of aux_devs which was broken during the merge window by some of
the componentization refactoring.

# gpg: Signature made Wed 11 Jan 2017 17:26:37 GMT
# gpg:                using RSA key ADE668AA675718B59FE29FEA24D68B725D5487D0
# gpg:                issuer "broonie@kernel.org"
# gpg: key 0D9EACE2CD7BEEBC: no public key for trusted key - skipped
# gpg: key 0D9EACE2CD7BEEBC marked as ultimately trusted
# gpg: key CCB0A420AF88CD16: no public key for trusted key - skipped
# gpg: key CCB0A420AF88CD16 marked as ultimately trusted
# gpg: key 162614E316005C11: no public key for trusted key - skipped
# gpg: key 162614E316005C11 marked as ultimately trusted
# gpg: key A730C53A5621E907: no public key for trusted key - skipped
# gpg: key A730C53A5621E907 marked as ultimately trusted
# gpg: key 276568D75C6153AD: no public key for trusted key - skipped
# gpg: key 276568D75C6153AD marked as ultimately trusted
# gpg: Good signature from "Mark Brown <broonie@sirena.org.uk>" [ultimate]
# gpg:                 aka "Mark Brown <broonie@debian.org>" [ultimate]
# gpg:                 aka "Mark Brown <broonie@kernel.org>" [ultimate]
# gpg:                 aka "Mark Brown <broonie@tardis.ed.ac.uk>" [ultimate]
# gpg:                 aka "Mark Brown <broonie@linaro.org>" [ultimate]
# gpg:                 aka "Mark Brown <Mark.Brown@linaro.org>" [ultimate]

7 years agoASoC: sun4i-spdif: drop unnessary snd_soc_unregister_component()
Wei Yongjun [Mon, 6 Feb 2017 15:22:24 +0000 (15:22 +0000)]
ASoC: sun4i-spdif: drop unnessary snd_soc_unregister_component()

It's not necessary to unregister a component registered
with devm_snd_soc_register_component(). Also removed
pointness clk_disable_unprepare() from error path and
snd_soc_unregister_platform() from the remove.

Fixes: f8260afa444b ("ASoC: sunxi: Add support for the SPDIF block")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: Intel: bxt: Add jack port initialize in bxt_rt298 machine
Jeeja KP [Fri, 17 Feb 2017 09:34:46 +0000 (15:04 +0530)]
ASoC: Intel: bxt: Add jack port initialize in bxt_rt298 machine

After the pcm jack is created, create and initialize the pin switch
widget for each port. Pin switch is to enable/disable the pin when
monitor is connected/disconnected.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: nau8825: automatic BCLK and LRC divde in master mode
John Hsu [Fri, 17 Feb 2017 01:55:33 +0000 (09:55 +0800)]
ASoC: nau8825: automatic BCLK and LRC divde in master mode

configurable LRC and BCLK divide. The driver
will make configurations of LRC and BCLK automatically according to
BCLK and FS information in master mode.

Signed-off-by: John Hsu <KCHSU0@nuvoton.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: hdac_hdmi: Add device id for Geminilake
Vinod Koul [Thu, 9 Feb 2017 11:14:04 +0000 (16:44 +0530)]
ASoC: hdac_hdmi: Add device id for Geminilake

Geminilake is new Intel SoC, so add codec entry for HDMI

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Senthilnathan Veppur <senthilnathanx.veppur@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: Intel: Skylake: Add Geminlake IDs
Vinod Koul [Thu, 9 Feb 2017 11:14:03 +0000 (16:44 +0530)]
ASoC: Intel: Skylake: Add Geminlake IDs

Geminilake is next gen SoC, so add the IDs for Geminilake.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rt298: Add DMI match for Geminilake reference platform
Vinod Koul [Thu, 9 Feb 2017 11:14:02 +0000 (16:44 +0530)]
ASoC: rt298: Add DMI match for Geminilake reference platform

Geminilake reference platform also uses combo jack for audio connector
so we need to set codec pdata to use this based on DMI match for this
board.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: Intel: Skylake: Check device type to get endpoint configuration
Senthilnathan Veppur [Thu, 9 Feb 2017 11:14:01 +0000 (16:44 +0530)]
ASoC: Intel: Skylake: Check device type to get endpoint configuration

Geminilake has two different devices connected to the same SSP, so use
device_type check to get correct device configuration.

Signed-off-by: Senthilnathan Veppur <senthilnathanx.veppur@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: Intel: bxt: Add jack port initialize in da7219_max98357a machine
Jeeja KP [Tue, 7 Feb 2017 13:40:00 +0000 (19:10 +0530)]
ASoC: Intel: bxt: Add jack port initialize in da7219_max98357a machine

After the pcm jack is created, create and initialize the pin switch
widget for each port. Pin switch is to enable/disable the pin when
monitor is connected/disconnected.

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>
7 years agoASoC: Intel: Skylake: Add jack port initialize in nau88l25_ssm4567 machine
Jeeja KP [Tue, 7 Feb 2017 13:39:58 +0000 (19:09 +0530)]
ASoC: Intel: Skylake: Add jack port initialize in nau88l25_ssm4567 machine

After the pcm jack is created, create and initialize the pin switch
widget for each port. Pin switch is to enable/disable the pin when
monitor is connected/disconnected.

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>
7 years agoASoC: Intel: Skylake: Add jack port initialize in nau88l25_max98357a machine
Jeeja KP [Tue, 7 Feb 2017 13:39:57 +0000 (19:09 +0530)]
ASoC: Intel: Skylake: Add jack port initialize in nau88l25_max98357a machine

After the pcm jack is created, create and initialize the pin switch
widget for each port. Pin switch is to enable/disable the pin when
monitor is connected/disconnected.

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>
7 years agoASoC: Intel: Skylake: Add jack port initialize in rt286 machine
Jeeja KP [Tue, 7 Feb 2017 13:39:56 +0000 (19:09 +0530)]
ASoC: Intel: Skylake: Add jack port initialize in rt286 machine

After the pcm jack is created, create and initialize the pin switch
widget for each port. Pin switch is to enable/disable the pin when
monitor is connected/disconnected.

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>
7 years agoASoC: hdac_hdmi: Add machine pin widget for each port
Jeeja KP [Tue, 7 Feb 2017 13:39:55 +0000 (19:09 +0530)]
ASoC: hdac_hdmi: Add machine pin widget for each port

Represent each port as machine DAPM pin widget. This helps in
enable/disable pin when monitor is connected/disconnected in case pcm
is rendered to multiple ports.

Create machine pin widgets  and pin switch kcontrol for each port and
report based on the pin status

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>
7 years agoASoC: Intel: bxt: Create ASoC jack for hdmi in bxt_da7219_max98357 machine
Jeeja KP [Tue, 7 Feb 2017 13:39:54 +0000 (19:09 +0530)]
ASoC: Intel: bxt: Create ASoC jack for hdmi in bxt_da7219_max98357 machine

Creates ASoC jack for HDMI PCM and calls hdmi codec API to initialize
jack in bxt_da7219_max98357 machine

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>
7 years agoASoC: Intel: bxt: Create ASoC jack for hdmi in bxt_rt298 machine
Jeeja KP [Tue, 7 Feb 2017 13:39:53 +0000 (19:09 +0530)]
ASoC: Intel: bxt: Create ASoC jack for hdmi in bxt_rt298 machine

Creates ASoC jack for HDMI PCM and calls hdmi codec API to initialize
jack in bxt_rt298.c machine

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>
7 years agoASoC: Intel: Skylake: Create ASoC jack for hdmi in nau88l25_ssm4567 machine
Jeeja KP [Tue, 7 Feb 2017 13:39:52 +0000 (19:09 +0530)]
ASoC: Intel: Skylake: Create ASoC jack for hdmi in nau88l25_ssm4567 machine

Creates ASoC jack for HDMI PCM and calls hdmi codec API to initialize
jack in skl_nau88l25_ssm4567 machine

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>
7 years agoASoC: Intel: Skylake: Create ASoC jack for hdmi in skl_nau88l25_max98357a machine
Jeeja KP [Tue, 7 Feb 2017 13:39:51 +0000 (19:09 +0530)]
ASoC: Intel: Skylake: Create ASoC jack for hdmi in skl_nau88l25_max98357a machine

Creates ASoC jack for HDMI PCM and calls hdmi codec API to initialize
jack in skl_nau88l25_max98357a machine

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>
7 years agoASoC: Intel: Skylake: Create ASoC jack for hdmi in rt286 machine
Jeeja KP [Tue, 7 Feb 2017 13:39:50 +0000 (19:09 +0530)]
ASoC: Intel: Skylake: Create ASoC jack for hdmi in rt286 machine

Creates ASoC jack for HDMI pcm and calls hdmi codec API to initialize
jack in skl_rt268 machine

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>
7 years agoASoC: hdac_hdmi: Use ASoC jack instead of snd_jack
Jeeja KP [Tue, 7 Feb 2017 13:39:49 +0000 (19:09 +0530)]
ASoC: hdac_hdmi: Use ASoC jack instead of snd_jack

Use snd_soc_jack instead of snd_jack and create the jack in machine
driver and pass the jack pointer to hdac_hdmi driver for jack
reporting.

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>
7 years agoASoC: hdac_hdmi: Add support for multiple ports to a PCM
Jeeja KP [Tue, 7 Feb 2017 13:39:48 +0000 (19:09 +0530)]
ASoC: hdac_hdmi: Add support for multiple ports to a PCM

Since we have the MST feature enabled and Pin-Port mux for user to
select the converter routing, multiple port mapping to same converter
needs to be supported.

To support multiple port mapped to same converter following changes are
done for this:.
o Add port list to pcm, so that multiple ports can be mapped to a PCM.
o Jack reporting in case where multiple port are attached to same PCM.
o Change hdac_hdmi_get_port_from_cvt(), channel_map, remove functions
to parse through all ports mapped to same the PCM.

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>
7 years agoASoc: hdac_hdmi: Configure pin verbs for MST
Jeeja KP [Tue, 7 Feb 2017 13:39:47 +0000 (19:09 +0530)]
ASoc: hdac_hdmi: Configure pin verbs for MST

To enable stream on a specific port of a MST capable pin, the port
needs to be selected before we configure the pin widget verb.

When port is selected, all the pin widget verb controlling the sink
device operation will be directed to selected port. So add port
selection before configuring the pin widget verb.

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>
7 years agoASoC: hdac_hdmi: Handle MST pin jack detection at boot/resume
Jeeja KP [Tue, 7 Feb 2017 13:39:46 +0000 (19:09 +0530)]
ASoC: hdac_hdmi: Handle MST pin jack detection at boot/resume

The ELD notification can be received asynchronously from the graphics
side and this may happen just at the moment the sound driver is
initializing and notification will be missed. Similarly at system
resume, the notification is ignored as the  ELD and connection states
are updated in anyway at the end of the resume.
So check the jack status in boot/resume by querying the port presence
based on pin caps and report the jack status.

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>
7 years agoASoC: hdac_hdmi: Add MST verb support
Jeeja KP [Tue, 7 Feb 2017 13:39:45 +0000 (19:09 +0530)]
ASoC: hdac_hdmi: Add MST verb support

To support DP MST audio, new pin verbs/params are added. This patch
adds helper functions to do following:
o To set a specific port
o To get the currently selected port
o To get the length of port.

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>
7 years agoASoC: mediatek: add power-domains for mt2701-afe-pcm.txt
Garlic Tseng [Thu, 16 Feb 2017 05:27:16 +0000 (13:27 +0800)]
ASoC: mediatek: add power-domains for mt2701-afe-pcm.txt

This add power-domains for mt2701-afe-pcm

Signed-off-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: mediatek: add power-domain get/put ctrl for mt2701
Garlic Tseng [Thu, 16 Feb 2017 05:27:15 +0000 (13:27 +0800)]
ASoC: mediatek: add power-domain get/put ctrl for mt2701

add power-domain ctrl for audio driver

Signed-off-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoALSA: x86: Don't bail out from PCM ops when disconnected
Takashi Iwai [Wed, 15 Feb 2017 21:11:13 +0000 (22:11 +0100)]
ALSA: x86: Don't bail out from PCM ops when disconnected

Currently the driver returns -ENODEV when the monitor is disconnected.
But PA alsa module doesn't like this and it starts playing Juliet,
kills itself as if it were a fatal tragedy.

Since we protect the whole read/write at disconnection, just allow the
PCM accesses even during disconnection.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Minor code rearrangement
Takashi Iwai [Wed, 15 Feb 2017 21:08:21 +0000 (22:08 +0100)]
ALSA: x86: Minor code rearrangement

Put the stuff in the right order; notification should be at the end of
the action.

Also dropped a superfluous debug print and incorrect comments.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Stop the stream when buffer is processed after disconnection
Takashi Iwai [Wed, 15 Feb 2017 21:05:34 +0000 (22:05 +0100)]
ALSA: x86: Stop the stream when buffer is processed after disconnection

This shouldn't happen, but just to be sure...

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Avoid register accesses during disconnection
Takashi Iwai [Wed, 15 Feb 2017 21:02:10 +0000 (22:02 +0100)]
ALSA: x86: Avoid register accesses during disconnection

It seems that accessing registers during disconnection often leads to
the GPU pipe error.  The original driver had a similar check in the
past, but it was lost through refactoring.  Now put a connection check
in the register access functions.

One exception is the irq handler: it still needs to access the raw
register even while disconnected, because it has to read and write to
ACK the irq mask.  Although the irq shouldn't be raised while
disconnected (the stream should have been disabled), let's make it
safer for now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Don't return an error from chmap ctl at disconnected
Takashi Iwai [Wed, 15 Feb 2017 20:45:06 +0000 (21:45 +0100)]
ALSA: x86: Don't return an error from chmap ctl at disconnected

It's not wise to return an error at info/get callback when
disconnected, which happens at any time.
The chmap ctl is supposed to fill zero for such a case, instead.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Fix memory leak in had_build_channel_allocation_map()
Takashi Iwai [Wed, 15 Feb 2017 20:42:20 +0000 (21:42 +0100)]
ALSA: x86: Fix memory leak in had_build_channel_allocation_map()

The previously allocated chmap has to be released before setting the
new one.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Use snd_pcm_stop_xrun() for connection / disconnection paths
Takashi Iwai [Wed, 15 Feb 2017 20:36:38 +0000 (21:36 +0100)]
ALSA: x86: Use snd_pcm_stop_xrun() for connection / disconnection paths

This seems more friendly to user-space, as it's notified at least as
an error, instead of forcibly moving the PCM state to SETUP out of
sudden.

Moreover, snd_pcm_stop() needs an extra PCM spinlock I forgot, while
snd_pcm_stop_xrun() takes the spinlock by itself.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Implement jack control
Takashi Iwai [Tue, 14 Feb 2017 11:29:38 +0000 (12:29 +0100)]
ALSA: x86: Implement jack control

This patch implements a jack interface for notifying HDMI/DP
connection.  PA listens to this, so it can handle the monitor
connection more gracefully.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: hda/realtek - Cannot adjust speaker's volume on a Dell AIO
Kai-Heng Feng [Thu, 16 Feb 2017 07:26:54 +0000 (15:26 +0800)]
ALSA: hda/realtek - Cannot adjust speaker's volume on a Dell AIO

The issue is the same as "dd9aa335c880 ALSA: hda/realtek - Can't adjust
speaker's volume on a Dell AIO", the output requires to connect to a node
with Amp-out capability.

Applying the same fixup "ALC298_FIXUP_SPK_VOLUME" can fix the issue.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: hda - add sanity check to force the separate stream tags
Jaroslav Kysela [Wed, 15 Feb 2017 16:09:43 +0000 (17:09 +0100)]
ALSA: hda - add sanity check to force the separate stream tags

It seems that newer Intel chipsets have more than 15 I/O streams (total).
This patch forces the separate stream tags, when this hardware is detected
to avoid SDxCTL.STRM field overflow and an unexpected behaviour.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: hda - fix Lewisburg audio issue
Jaroslav Kysela [Wed, 15 Feb 2017 16:09:42 +0000 (17:09 +0100)]
ALSA: hda - fix Lewisburg audio issue

Like for Sunrise Point, the total stream number of Lewisburg's
input and output stream exceeds 15 (GCAP is 0x9701), which will
cause some streams do not work because of the overflow on
SDxCTL.STRM field if using the legacy stream tag allocation method.

Fixes: 5cf92c8b3dc5 ("ALSA: hda - Add Intel Lewisburg device IDs Audio")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: hda/patch_sigmatel: Add AmigaOne X1000 pinconfigs
Darren Stevens [Mon, 13 Feb 2017 21:11:03 +0000 (21:11 +0000)]
ALSA: hda/patch_sigmatel: Add AmigaOne X1000 pinconfigs

The AmigaOne X1000 has a Sigmatel STAC92HD700 attached to the HD Audio
on an ATI SB600. Add the required settings to enable sound.

Signed-off-by: Darren Stevens <darren@stevens-zone.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoASoC: sun4i-i2s: Update binding documentation to include A31
Mylène Josserand [Fri, 10 Feb 2017 10:00:46 +0000 (11:00 +0100)]
ASoC: sun4i-i2s: Update binding documentation to include A31

Add a new compatible for sun4i-i2s driver to handle some
SoCs that have a reset line that must be asserted/deasserted.

This new compatible, "allwinner,sun6i-a31-i2s", requires the
property "resets" which should be a phandle to the reset line.
Except these differences, the compatible is identical to previous one
which will not handle a reset line.

Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: fsl_sai: support more than 2 channels
Alexandre Belloni [Fri, 10 Feb 2017 18:42:43 +0000 (19:42 +0100)]
ASoC: fsl_sai: support more than 2 channels

The FSL SAI can support up to 32 channels using TDM. Report that value so
they can actually be used.

Tested using 8 channels.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoALSA: x86: Drop unused stream.running field
Takashi Iwai [Sun, 12 Feb 2017 10:35:44 +0000 (11:35 +0100)]
ALSA: x86: Drop unused stream.running field

The pcm_stream_info.running field is only set in the PCM trigger
callback but never referred, thus it can be safely removed.

Also, properly cover the spinlock in both the trigger START and STOP
to protect had_enable_audio() calls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Handle reset at prepare callback
Takashi Iwai [Sat, 11 Feb 2017 07:21:56 +0000 (08:21 +0100)]
ALSA: x86: Handle reset at prepare callback

Currently the driver handles some reset procedure at the trigger STOP
and the underrun functions, where both are executed in the interrupt
context.  Especially the underrun function has a sync-loop to clear
the UNDERRUN status bit, and this is supposed to be one of plausible
causes of GPU hangup.

Since the job to be done in the interrupt handler should be minimum,
we move the reset function out of trigger and underrun, and push it
into the prepare (and hw_free) callbacks instead.  Here a new flag,
need_reset, is introduced to indicate the requirement of the reset
procedure.  This is for avoiding the multiple resets when PCM prepare
is called sequentially.

Also in the UNDERRUN bit-clear sync loop, take a longer pause to be in
the safer side.  Taking a longer delay is no longer a problem now
because we're running in the normal context.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Support S16 format
Takashi Iwai [Tue, 7 Feb 2017 12:53:42 +0000 (13:53 +0100)]
ALSA: x86: Support S16 format

Now we support S16 PCM format in addition.  For this, we need to set
packet_mode=1 in AUD_CONFIG register.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Support S32 format
Takashi Iwai [Tue, 7 Feb 2017 12:33:17 +0000 (13:33 +0100)]
ALSA: x86: Support S32 format

The hardware has the support for the left-aligned 24bit format in
32bit packet.  This corresponds to S32 format in ALSA.  We need to set
the msbits restriction as well to inform user-space that only MSB
24bit are available.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Allow no-period-wakeup setup
Takashi Iwai [Tue, 7 Feb 2017 07:09:12 +0000 (08:09 +0100)]
ALSA: x86: Allow no-period-wakeup setup

In the current implementation, the driver may update the BDs even at
PCM pointer callback.  This allows us to skip the period interrupt
effectively.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Allow single period PCM operation
Takashi Iwai [Tue, 7 Feb 2017 07:05:46 +0000 (08:05 +0100)]
ALSA: x86: Allow single period PCM operation

This is an implementation of PCM streaming with only 1 period.
Since the hardware requires the refresh of BDs after each BD
processing finishes, we'd need at least two BDs.  The trick is that
both BDs point to the same content: the address of the PCM buffer
head, and the whole buffer size.  Then it loops over to the whole
buffer again after it finished once.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Don't pass SNDRV_PCM_INFO_BATCH flag
Takashi Iwai [Thu, 2 Feb 2017 20:33:54 +0000 (21:33 +0100)]
ALSA: x86: Don't pass SNDRV_PCM_INFO_BATCH flag

The PCM engine on LPE audio isn't like a batch-style process any
longer, but rather it deals with the standard ring buffer.  Remove the
BATCH info flag so that PA can handle the buffer in timer-sched mode.

Similarly, the DOUBLE flag is also superfluous.  Drop both bits.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoASoC: zx-i2s: introduce pclk for zx2967 family
Baoyou Xie [Thu, 9 Feb 2017 03:12:58 +0000 (11:12 +0800)]
ASoC: zx-i2s: introduce pclk for zx2967 family

The pclk is necessary for zx2967 I2S controller. the driver
currently doesn't handle it. This is something we need to fix.

In turn, the driver supports zx296718's I2S controller.

By the way, this patch also change the clock name from tx to wclk
to make it clear.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Reviewed-by: Shawn Guo <shawnguo@kernel.org>
Reviewed-by: Jun Nie <jun.nie@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: zx-i2s: Add the info of pclk to the binding document for zx2967 family
Baoyou Xie [Thu, 9 Feb 2017 03:12:57 +0000 (11:12 +0800)]
ASoC: zx-i2s: Add the info of pclk to the binding document for zx2967 family

ZTE's zx2967 I2S controller driver introduces pclk, this
patch documents this fact.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoALSA: hda - adding a new NV HDMI/DP codec ID in the driver
Hui Wang [Thu, 9 Feb 2017 01:20:54 +0000 (09:20 +0800)]
ALSA: hda - adding a new NV HDMI/DP codec ID in the driver

Without this change, the HDMI/DP codec will be recognised as a
generic codec, and there is no sound when playing through this codec.

As suggested by NVidia side, after adding the new ID in the driver,
the sound playing works well.

Cc: <stable@vger.kernel.org>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoASoC: hdmi-codec: remove HDMI device unregister
Vincent Abriou [Wed, 8 Feb 2017 09:47:01 +0000 (10:47 +0100)]
ASoC: hdmi-codec: remove HDMI device unregister

While unregistering the hdmi-codec, the hdmi device list must be
cleaned up. It avoid kernel page fault when registering again the
hdmi-codec.

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: sunxi: allow the analog codec driver to be built on ARM64
Icenowy Zheng [Tue, 7 Feb 2017 18:30:40 +0000 (02:30 +0800)]
ASoC: sunxi: allow the analog codec driver to be built on ARM64

As the 64-bit Allwinner H5 SoC has the same analog codec part (also the
same digital part) as H3, enable the driver to be built on ARM64
Allwinner platform, so that it can be used on H5.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: hdac_hdmi: Add support to handle MST capable pin
Jeeja KP [Mon, 6 Feb 2017 06:39:18 +0000 (12:09 +0530)]
ASoC: hdac_hdmi: Add support to handle MST capable pin

To handle jack event and configuration of the pin widget for MST
capable pin, this patch adds:
o Flag to identify the pin is MST capable.
o In notify callback(), based on the pipe and port information marks if
the port is mst_capable. In case of non MST, port is defaulted to zero.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: Intel: Skylake: Add route change to nau88l25_ssm4567 machine
Jeeja KP [Mon, 6 Feb 2017 06:39:16 +0000 (12:09 +0530)]
ASoC: Intel: Skylake: Add route change to nau88l25_ssm4567 machine

To support MST moved pin to port, this changes the routes based on
port. So change the route in nau88l25_ssm4567 machine.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: Intel: Skylake: Add route change to nau88l25_max98357a machine
Jeeja KP [Mon, 6 Feb 2017 06:39:15 +0000 (12:09 +0530)]
ASoC: Intel: Skylake: Add route change to nau88l25_max98357a machine

To support MST moved pin to port, this changes the routes based on
port. So change the route in nau88l25_max98357a machine.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: Intel: bxt: Add route change to rt298 machine
Jeeja KP [Mon, 6 Feb 2017 06:39:17 +0000 (12:09 +0530)]
ASoC: Intel: bxt: Add route change to rt298 machine

To support MST moved pin to port, this changes the routes based on
port. So change the route in bxt_rt298 machine.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: hdac_hdmi: Begin to add support for DP Multi-stream audio
Jeeja KP [Mon, 6 Feb 2017 06:39:14 +0000 (12:09 +0530)]
ASoC: hdac_hdmi: Begin to add support for DP Multi-stream audio

With MST each pin contains several ports to which device can be
connected.

As a preparatory work to support DP MST this patch adds below changes:
1. Defines the port structure and moves all stream related information
   like ELD, converter list, chmap to port.
2. Creates ports for each pin based on the max_ports support.
3. Based on Pin-Port combination creates DAPM Mux widget instead of Pin
   to allow user to select a converter.
4. Port zero is the default port when pin does not support MST.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoALSA: seq: Fix race at creating a queue
Takashi Iwai [Wed, 8 Feb 2017 11:35:39 +0000 (12:35 +0100)]
ALSA: seq: Fix race at creating a queue

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.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Cache AUD_CONFIG register value
Takashi Iwai [Tue, 7 Feb 2017 15:17:06 +0000 (16:17 +0100)]
ALSA: x86: Cache AUD_CONFIG register value

At enabling the audio, we modify AUD_CONFIG register bit 0.  So far,
it does read-modify-write procedure with a special hack for the
channel bits due to the silicon bug.  But we can optimize it by
remembering the AUD_CONFIG register value privately.  This simplifies
the things a lot.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Rearrange defines
Takashi Iwai [Tue, 7 Feb 2017 11:17:23 +0000 (12:17 +0100)]
ALSA: x86: Rearrange defines

We have two header files and everything is mixed up chaotically.
Move the chip-specific definitions like the hardware registers to
intel_hdmi_lpe_audio.h, and the rest, the implementation specific
stuff into intel_hdmi_audio.h.

In addition, put some more comments to the register fields, and fix
the incorrect name prefix for AUD_HDMI_STATUS bits, too.

The whole changes are merely a code shuffling, and there is no
functional change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: mark hdmi suspend/resume functions as __maybe_unused
Arnd Bergmann [Tue, 7 Feb 2017 13:38:51 +0000 (14:38 +0100)]
ALSA: x86: mark hdmi suspend/resume functions as __maybe_unused

The two functions are unused when CONFIG_PM_SLEEP is disabled:

sound/x86/intel_hdmi_audio.c:1633:12: error: 'hdmi_lpe_audio_resume' defined but not used [-Werror=unused-function]
sound/x86/intel_hdmi_audio.c:1622:12: error: 'hdmi_lpe_audio_suspend' defined but not used [-Werror=unused-function]

Marking them as __maybe_unused avoids the warning without introducing an
ugly #ifdef.

Fixes: 182cdf23dbf6 ("ALSA: x86: Implement runtime PM")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Fix driver name string overflow
Takashi Iwai [Tue, 7 Feb 2017 11:14:04 +0000 (12:14 +0100)]
ALSA: x86: Fix driver name string overflow

The driver sets card->driver name string over its size (16 bytes).
Shorten the name string to fit with it.

Also, set more verbose string to card->shortname and ->longname.
This doesn't have to be identical with card->driver at all.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Rename had_enable_audio_int() to had_ack_irqs()
Takashi Iwai [Tue, 7 Feb 2017 06:55:27 +0000 (07:55 +0100)]
ALSA: x86: Rename had_enable_audio_int() to had_ack_irqs()

had_enable_audio_int() came from the LPE audio shell set_caps
callback with ENABLE_INT and DISABLE_INT caps.  I interpreted as these
correspond to enabling / disabling the audio interface, but the actual
implementation is only to clear (send ACK) to both BUFFER_DONE and
BUFFER_UNDERRUN interrupts unconditionally.  And, there is no
counterpart, DISABLE_INT, code at all.

For avoiding the further misunderstanding, rename the function to the
more fitting one, had_ack_irqs(), and drop the calls with enable=false
in allover places.  There is no functional changes at all.

After this patch, there is only one caller at the PCM trigger start.
Then it's doubtful whether this call is still really needed or not; I
bet it not, but let's stay in the safer side for now and keep it as
was.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Drop suspicious U24 format support
Takashi Iwai [Tue, 7 Feb 2017 07:13:50 +0000 (08:13 +0100)]
ALSA: x86: Drop suspicious U24 format support

U24 format is declared to be supported by the driver, but this looks
really doubtful, as there is no corresponding code.  Better to drop
it.  This format is very uncommon, so there should be practically no
impact by this change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: line6: Always setup isochronous transfer properties
Andrej Krutak [Mon, 6 Feb 2017 19:34:58 +0000 (20:34 +0100)]
ALSA: line6: Always setup isochronous transfer properties

While not all line6 devices currently support PCM, it causes no
harm to 'have it prepared'.

This also fixes toneport, which only has PCM - in which case
we previously skipped the USB transfer properties detection completely.

Signed-off-by: Andrej Krutak <dev@andree.sk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoMerge branch 'for-linus' into for-next
Takashi Iwai [Tue, 7 Feb 2017 08:38:44 +0000 (09:38 +0100)]
Merge branch 'for-linus' into for-next

7 years agoRevert "ALSA: line6: Only determine control port properties if needed"
Takashi Iwai [Tue, 7 Feb 2017 08:32:30 +0000 (09:32 +0100)]
Revert "ALSA: line6: Only determine control port properties if needed"

This reverts commit f6a0dd107ad0c8b59d1c9735eea4b8cb9f460949.

The commit caused a regression on LINE6 Transport that has no control
caps.  Although reverting the commit may result back in a spurious
error message for some device again, it's the simplest regression fix,
hence it's taken as is at first.  The further code fix will follow
later.

Fixes: f6a0dd107ad0 ("ALSA: line6: Only determine control port properties if needed")
Reported-by: Igor Zinovev <zinigor@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoASoC: fix ES8328_I2C/SPI dependencies
Arnd Bergmann [Mon, 6 Feb 2017 12:27:11 +0000 (13:27 +0100)]
ASoC: fix ES8328_I2C/SPI dependencies

The two front-ends to the codec can now be selected individually, but fail to
build when the bus support is missing:

sound/built-in.o: In function `es8328_spi_probe':
es8328-spi.c:(.text+0x125854): undefined reference to `__devm_regmap_init_spi'
sound/built-in.o: In function `es8328_spi_driver_init':
es8328-spi.c:(.init.text+0x3589): undefined reference to `__spi_register_driver'

Related to this, the added dependency on SND_SOC_ES8328 breaks:

warning: (SND_SOC_ALL_CODECS) selects SND_SOC_ES8328_I2C which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && SND_SOC_ES8328 && I2C)

This adds the respective Kconfig dependencies and changes SND_SOC_ES8328 to a hidden
symbol that is selected implicitly by the two more specific options, as we do for
some other codecs. We have to remove the 'depends on' for SND_SOC_IMX_ES8328 in the
same step to avoid a recursive dependency.

Fixes: aa00f2c8aff7 ("ASoC: Allow to select ES8328_I2C and ES8328_SPI directly")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoALSA: seq: Don't handle loop timeout at snd_seq_pool_done()
Takashi Iwai [Mon, 6 Feb 2017 14:09:48 +0000 (15:09 +0100)]
ALSA: seq: Don't handle loop timeout at snd_seq_pool_done()

snd_seq_pool_done() syncs with closing of all opened threads, but it
aborts the wait loop with a timeout, and proceeds to the release
resource even if not all threads have been closed.  The timeout was 5
seconds, and if you run a crazy stuff, it can exceed easily, and may
result in the access of the invalid memory address -- this is what
syzkaller detected in a bug report.

As a fix, let the code graduate from naiveness, simply remove the loop
timeout.

BugLink: http://lkml.kernel.org/r/CACT4Y+YdhDV2H5LLzDTJDVF-qiYHUHhtRaW4rbb4gUhTCQB81w@mail.gmail.com
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: x86: Refactor PCM process engine
Takashi Iwai [Thu, 2 Feb 2017 23:01:18 +0000 (00:01 +0100)]
ALSA: x86: Refactor PCM process engine

This is again a big rewrite of the driver; now it touches the code to
process PCM stream transfers.

The most fundamental change is that the driver may support more than
four periods.  Instead of keeping the same index between both the ring
buffer (with the fixed four buffer descriptors) and the PCM buffer
periods, we keep difference indices for both (bd_head and pcm_head
fields).  In addition, when the periods are more than four, we need to
track both head and next indices.  That is, we now have three indices:
bd_head, pcm_head and pcm_filled.

Also, the driver works better for periods < 4, too: the remaining BDs
out of four are marked as invalid, so that the hardware skips those
BDs in its loop.

By this flexibility, we can use even ALSA-lib dmix plugin, which
requires 16 periods as default.

The buffer size could be up to 20bit, so the max buffer size was
increased accordingly.  However, the buffer pre-allocation is kept as
the old value (600kB) as default.  The reason is the limited number of
BDs: since it doesn't suffice for the useful SG page management that
can fit with the usual page allocator like some other drivers, we have
to still allocate continuous pages, hence we shouldn't take too big
memories there.

Signed-off-by: Takashi Iwai <tiwai@suse.de>