openwrt/staging/blogic.git
5 years agoASoC: Intel: cnl-match: remove prefix for SOF files
Pierre-Louis Bossart [Fri, 8 Feb 2019 23:45:44 +0000 (17:45 -0600)]
ASoC: Intel: cnl-match: remove prefix for SOF files

Prefix is now handled in the code. This allows for default and
alternate paths, and more flexibility for OEMs and distros

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: cht-match: remove prefix for SOF files
Pierre-Louis Bossart [Fri, 8 Feb 2019 23:45:43 +0000 (17:45 -0600)]
ASoC: Intel: cht-match: remove prefix for SOF files

Prefix is now handled in the code. This allows for default and
alternate paths, and more flexibility for OEMs and distros

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: byt-match.c: remove prefix for SOF files
Pierre-Louis Bossart [Fri, 8 Feb 2019 23:45:42 +0000 (17:45 -0600)]
ASoC: Intel: byt-match.c: remove prefix for SOF files

Prefix is now handled in the code. This allows for default and
alternate paths, and more flexibility for OEMs and distros

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: bxt-match: remove prefix for SOF files
Pierre-Louis Bossart [Fri, 8 Feb 2019 23:45:41 +0000 (17:45 -0600)]
ASoC: Intel: bxt-match: remove prefix for SOF files

Prefix is now handled in the code. This allows for default and
alternate paths, and more flexibility for OEMs and distros

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Convert to single component with multiple DAIs
Sylwester Nawrocki [Thu, 7 Feb 2019 17:00:13 +0000 (18:00 +0100)]
ASoC: samsung: i2s: Convert to single component with multiple DAIs

This patch includes minimal changes as a prerequisite for adding support
for the Exynos secondary I2S interface as second DAI of the I2S component.
Doing it that way allows to avoid problems as indicated in commmit
6b01e0365b1689 ("ASoC: samsung: i2s: disable secondary DAI until it gets fixed")

The samsung_i2s_get_pri_dai() helper added in this patch is temporary and
will be removed in one of subsequent patches.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: dmaengine: Allow to specify custom DMA device
Sylwester Nawrocki [Thu, 7 Feb 2019 17:00:11 +0000 (18:00 +0100)]
ASoC: samsung: dmaengine: Allow to specify custom DMA device

The additional function argument will allow to select proper DMA device
for requesting DMA channel for the secondary CPU DAI.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: dmaengine: Extend use of chan_names provided in custom DMA config
Sylwester Nawrocki [Thu, 7 Feb 2019 17:00:10 +0000 (18:00 +0100)]
ASoC: dmaengine: Extend use of chan_names provided in custom DMA config

There are currently two ways to specify custom DMA channel names:
 - through the SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag and
   snd_dmaengine_dai_dma_data data structure,
 - through chan_names field of struct snd_dmaengine_pcm_config.

In order to replace the DAI DMA data method with the custom DMA config
one on non-DT platforms the dmaengine_pcm_new() function is extended
to also consider channel names specified in the custom DMA config.
If both config->chan_names and dma_data->chan_name are provided
the former will be used.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: dmaengine: Improve of_node test in dmaengine_pcm_request_chan_of()
Sylwester Nawrocki [Thu, 7 Feb 2019 17:00:09 +0000 (18:00 +0100)]
ASoC: dmaengine: Improve of_node test in dmaengine_pcm_request_chan_of()

Currently when of_node of the "PCM" device is null
dmaengine_pcm_request_chan_of() function will bail out, including cases
when custom DMA device is intended to be used.  To have the channels
properly requested when custom DMA device is provided extend the of_node
test to also consider dma_dev->of_node.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Use __printf markup to silence compiler
Mathieu Malaterre [Wed, 23 Jan 2019 19:41:30 +0000 (20:41 +0100)]
ASoC: Use __printf markup to silence compiler

Silence warnings (triggered at W=1) by adding relevant __printf
attributes.

  sound/soc/soc-dapm.c:149:2: warning: function 'pop_dbg' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]

Signed-off-by: Mathieu Malaterre <malat@debian.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agotlv320aic32x4: delay i2c access by 1 ms after hardware reset
Peter Seiderer [Mon, 11 Feb 2019 21:06:30 +0000 (22:06 +0100)]
tlv320aic32x4: delay i2c access by 1 ms after hardware reset

As stated in 'TLV320AIC3254 Application Reference Guide' ([1]):

  3.2 Device Startup Lockout Times
    After the TLV320AIC3254 initializes through hardware reset at power-up
    or software reset, the internal registers initialize to default values.
    This initialization takes place within 1ms after pulling the RESET
    signal high. During this initialization phase, no register-read or
    register-write operation should be performed on ADC or DAC coefficient
    buffers. Also, no block within the codec should be powered up during
    the initialization phase.

[1] http://www.ti.com/lit/an/slaa408a/slaa408a.pdf

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: mediatek: btcvsd fix rx stream assign
KaiChieh Chuang [Tue, 12 Feb 2019 07:18:47 +0000 (15:18 +0800)]
ASoC: mediatek: btcvsd fix rx stream assign

fix tx/rx stream assign wrong direction

Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: wm8741: Set OSR mode in hw_params()
Sergej Sawazki [Sun, 10 Feb 2019 15:29:29 +0000 (16:29 +0100)]
ASoC: wm8741: Set OSR mode in hw_params()

For correct operation of the digital filtering and other processing on the
WM8741, the user must ensure the correct value of OSR[1:0] is set at all
times.[1] Hence, depending the selected sampling rate, set the OSR (over-
sampling rate) mode in hw_params().

References:
[1] "WM8741 Data Sheet"

Signed-off-by: Sergej Sawazki <sergej@taudac.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: wm8741: Add digital mute callback
Sergej Sawazki [Sun, 10 Feb 2019 15:28:04 +0000 (16:28 +0100)]
ASoC: wm8741: Add digital mute callback

Signed-off-by: Sergej Sawazki <sergej@taudac.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: hdac_hdmi: use devm_kzalloc for all structures
Pierre-Louis Bossart [Fri, 8 Feb 2019 23:26:53 +0000 (17:26 -0600)]
ASoC: hdac_hdmi: use devm_kzalloc for all structures

Loading/unloading modules exposes issues with memory allocation, which
is a mix of devm_kzalloc and manual kzalloc. Move to devm_k routines
everywhere to simplify all this.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: mediatek: use %pOFn instead of device_node.name
KaiChieh Chuang [Mon, 11 Feb 2019 03:04:41 +0000 (11:04 +0800)]
ASoC: mediatek: use %pOFn instead of device_node.name

In preparation to remove the node name pointer from struct device_node,
convert printf users to use the %pOFn format specifier.

Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: pcm3060: Add clock select
Kirill Marinushkin [Mon, 11 Feb 2019 06:08:39 +0000 (07:08 +0100)]
ASoC: pcm3060: Add clock select

ADC and DAC can be clocked from separate or same sources CLK1 and CLK2.
By default, ADC is clocked from CLK1, and DAC - from CLK2.

This commits allows sound cards to selest a proper clock source during
`hw_params()` via `snd_soc_dai_set_sysclk()`. It makes possible to have a
single clock source for both ADC and DAC.

Signed-off-by: Kirill Marinushkin <kmarinushkin@birdec.tech>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: pcm3060: Add soft reset on probe
Kirill Marinushkin [Mon, 11 Feb 2019 06:08:38 +0000 (07:08 +0100)]
ASoC: pcm3060: Add soft reset on probe

Softly reset registers values on module probe

Signed-off-by: Kirill Marinushkin <kmarinushkin@birdec.tech>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: Skylake: set .ignore_module_refcount field in component
Pierre-Louis Bossart [Fri, 1 Feb 2019 17:22:24 +0000 (11:22 -0600)]
ASoC: Intel: Skylake: set .ignore_module_refcount field in component

There is no risk of the module being removed while the platform
components are in use. This solves the problem of the snd_soc_skl
module not being removable with rmmod

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: core: don't increase component module refcount unconditionally
Pierre-Louis Bossart [Fri, 1 Feb 2019 17:22:23 +0000 (11:22 -0600)]
ASoC: core: don't increase component module refcount unconditionally

The ASoC core has for the longest time increased the module reference
counts, even before the transition to the component model. This is
probably fine on most platforms, but it introduces a deadlock case on
Intel devices with the Skylake and SOF drivers which cannot be removed
due to their reference counts being modified by the core.

In these 2 cases, the PCI or ACPI driver .probe creates a platform
device to let the machine driver .probe register the audio
card. Conversely the PCI or ACPI driver .remove will unregister the
platform device which results in the card being removed by the machine
driver .remove.

With ascii art, this can be represented as

modprobe
snd_soc_skl/
soc-pci-dev/sof-acpci-dev  ----------> pci/acpi probe
       ^                                    |
       |                     ---------------|
       |                    |               |
       |                    V               V
    increase            register        register machine
    refcount            component       platform_device
       ^                                    |
       |                                    |
       |                                    V
    component <----   register card  <---- probe
    probe

The issue is that by playing with the component's module reference
counts during the card registration, it's no longer possible to remove
the module which controls the component. This can be shown, e.g. with
the following error:

root@plb-XPS-13-9350:~# lsmod | grep snd_soc_skl
snd_soc_skl           110592  1

root@plb-XPS-13-9350:~# rmmod snd_soc_skl
rmmod: ERROR: Module snd_soc_skl is in use

Increasing the reference count during the component probe is not
useful. If the PCI/ACPI module is removed, the card will be removed
anyway.

To avoid breaking existing platforms and allowing Intel platforms to
safely deal with module load/unload cases, this patch introduces a
flag which needs to be set during the component initialization. This
is a strictly opt-in capability that should only be used when the
handling of the component module does not require a reference count
increase to prevent removal during use.

Note that this solution is not directly applicable to the legacy
Atom/SST driver, which uses a different device hierarchy. There are
however additional refcount issues which prevent the ACPI driver from
being removed. This is a different issue which would need a different
patch.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agogpiolib: acpi: Introduce ACPI_GPIO_QUIRK_ONLY_GPIOIO
Andy Shevchenko [Wed, 6 Feb 2019 20:49:46 +0000 (22:49 +0200)]
gpiolib: acpi: Introduce ACPI_GPIO_QUIRK_ONLY_GPIOIO

New quirk enforces search for GPIO based on its type,
i.e. iterate over GpioIo resources only.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: msm8916-wcd-digital: convert license header to SPDX
Johan Hovold [Fri, 8 Feb 2019 15:16:56 +0000 (16:16 +0100)]
ASoC: msm8916-wcd-digital: convert license header to SPDX

Convert the GPLv2-only license header to SPDX.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: msm8916-wcd-analog: add missing license information
Johan Hovold [Fri, 8 Feb 2019 15:16:55 +0000 (16:16 +0100)]
ASoC: msm8916-wcd-analog: add missing license information

Add the missing license and copyright information which never made it
into the analog driver when the original driver was split in two as part
of the review process.

Link: https://lkml.kernel.org/r/1465582725-30183-3-git-send-email-srinivas.kandagatla@linaro.org
Fixes: 585e881e5b9e ("ASoC: codecs: Add msm8916-wcd analog codec")
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: regulator notifier registration should be managed
Guennadi Liakhovetski [Fri, 8 Feb 2019 13:45:20 +0000 (14:45 +0100)]
ASoC: regulator notifier registration should be managed

Regulator notifiers, that were registered during codec driver probing,
must be unregistered during driver release, or device managed versions
have to be used. This patch fixes codec drivers, that weren't explicitly
unregistering notifiers and simplifies those, that did that manually.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agodt-bindings: sound: msm8916-wcd-analog: fix example regulator names
Johan Hovold [Thu, 7 Feb 2019 16:57:55 +0000 (17:57 +0100)]
dt-bindings: sound: msm8916-wcd-analog: fix example regulator names

Fix upper-case regulator names in the binding example which do not match
the corresponding required properties.

While at it, add a blank line after the required-properties section to
improve readability.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoSoC: stm32: i2s: manage clock power
Olivier Moysan [Fri, 8 Feb 2019 10:49:54 +0000 (11:49 +0100)]
SoC: stm32: i2s: manage clock power

Kernel clock management:
Enable/disable I2S kernel clock on audio stream startup/shutdown.

Peripheral clock management:
Manage I2S peripheral clock power through regmap services.

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: stm32: i2s: add power management
Olivier Moysan [Fri, 8 Feb 2019 10:49:53 +0000 (11:49 +0100)]
ASoC: stm32: i2s: add power management

Add suspend and resume sleep callbacks,
to support system low power modes.

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: codecs: jz4725b: Remove unnecessary const qualifier
Nathan Chancellor [Fri, 8 Feb 2019 04:59:18 +0000 (21:59 -0700)]
ASoC: codecs: jz4725b: Remove unnecessary const qualifier

Clang warns:

sound/soc/codecs/jz4725b.c:177:14: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
static const SOC_VALUE_ENUM_SINGLE_DECL(jz4725b_codec_adc_src_enum,
             ^
include/sound/soc.h:356:2: note: expanded from macro 'SOC_VALUE_ENUM_SINGLE_DECL'
        SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues)
        ^
include/sound/soc.h:353:2: note: expanded from macro 'SOC_VALUE_ENUM_DOUBLE_DECL'
        const struct soc_enum name = SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, \
        ^

As it points out, SOC_VALUE_ENUM_DOUBLE_DECL has the const attribute in
its definition so remove it here.

Fixes: e9d97b05a80f ("ASoC: codecs: Add jz4725b-codec driver")
Link: https://github.com/ClangBuiltLinux/linux/issues/354
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: cs35l36: Add device tree documentation for CS35L36
James Schulman [Thu, 7 Feb 2019 18:12:19 +0000 (12:12 -0600)]
ASoC: cs35l36: Add device tree documentation for CS35L36

Add device tree documentation for Cirrus Logic CS35L36
speaker amplifier

Signed-off-by: James Schulman <james.schulman@cirrus.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Brian Austin <brian.austin@cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: cs35l36: Add support for Cirrus CS35L36 Amplifier
James Schulman [Thu, 7 Feb 2019 18:12:15 +0000 (12:12 -0600)]
ASoC: cs35l36: Add support for Cirrus CS35L36 Amplifier

Add driver support for Cirrus Logic CS35L36 boosted
speaker amplifier

Signed-off-by: James Schulman <james.schulman@cirrus.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Brian Austin <brian.austin@cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: doc: Fix typos in dpcm.rst
Sylwester Nawrocki [Thu, 7 Feb 2019 17:22:56 +0000 (18:22 +0100)]
ASoC: doc: Fix typos in dpcm.rst

This patch fixes a few typos in the DPCM documentation.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: codecs: jz4725b: Use C++ style comments in header
Paul Cercueil [Thu, 7 Feb 2019 13:31:43 +0000 (10:31 -0300)]
ASoC: codecs: jz4725b: Use C++ style comments in header

Change the header comment to use C++ style, so that it looks more
consistent with the rest of ASoC.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: codecs: Kconfig: Show knob, and depend on MIPS || COMPILE_TEST
Paul Cercueil [Thu, 7 Feb 2019 13:31:42 +0000 (10:31 -0300)]
ASoC: codecs: Kconfig: Show knob, and depend on MIPS || COMPILE_TEST

Show the knob to enable or disable the jz4740-codec driver, add a
proper description, and add a dependency on MIPS || COMPILE_TEST, as
this driver is only useful on MIPS.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: codecs: jz4740: Add support for devicetree
Paul Cercueil [Thu, 7 Feb 2019 13:31:41 +0000 (10:31 -0300)]
ASoC: codecs: jz4740: Add support for devicetree

Add support for probing the driver from devicetree.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: codecs: jz4740: Use SPDX license notifier
Paul Cercueil [Thu, 7 Feb 2019 13:31:40 +0000 (10:31 -0300)]
ASoC: codecs: jz4740: Use SPDX license notifier

Add license information as a standard SPDX license notifier instead of
custom text.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agodt-bindings: sound: Document jz4725b-codec bindings
Paul Cercueil [Thu, 7 Feb 2019 13:31:39 +0000 (10:31 -0300)]
dt-bindings: sound: Document jz4725b-codec bindings

Add documentation about how to probe the jz4725b-codec driver from
devicetree.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agodt-bindings: sound: Document jz4740-codec bindings
Paul Cercueil [Thu, 7 Feb 2019 13:31:38 +0000 (10:31 -0300)]
dt-bindings: sound: Document jz4740-codec bindings

Add documentation about how to probe the jz4740-codec driver from
devicetree.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: sun4i-codec: Add Line Playback Volume, Line Boost Volume, Line Right, Line...
Danny Milosavljevic [Wed, 30 Jan 2019 10:39:44 +0000 (11:39 +0100)]
ASoC: sun4i-codec: Add Line Playback Volume, Line Boost Volume, Line Right, Line Left, Line Playback Switch

Add Line Playback Volume for Allwinner A10 and Allwinner A20.
Add Line Boost Volume for Allwinner A10 and Allwinner A20.
Add Line Right, Line Left, Line Playback Switch for Allwinner A10 and
Allwinner A20.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: sun4i-codec: Add FM Playback Volume, FM Left, FM Right, FM Playback Switch
Danny Milosavljevic [Wed, 30 Jan 2019 10:39:43 +0000 (11:39 +0100)]
ASoC: sun4i-codec: Add FM Playback Volume, FM Left, FM Right, FM Playback Switch

Add FM Playback Volume for Allwinner A10 and Allwinner A20.
Add FM Left, FM Right, FM Playback Switch for Allwinner A10 and
Allwinner A20.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: sun4i-codec: Add Mic1 Playback Switch, Mic2 Playback Switch
Danny Milosavljevic [Wed, 30 Jan 2019 10:39:42 +0000 (11:39 +0100)]
ASoC: sun4i-codec: Add Mic1 Playback Switch, Mic2 Playback Switch

Add Mic1 Playback Switch and Mic2 Playback Switch for Allwinner A10 and
Allwinner A20.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: sun4i-codec: Merge sun4i_codec_left_mixer_controls and sun4i_codec_right_mixer_...
Danny Milosavljevic [Wed, 30 Jan 2019 10:39:41 +0000 (11:39 +0100)]
ASoC: sun4i-codec: Merge sun4i_codec_left_mixer_controls and sun4i_codec_right_mixer_controls into sun4i_codec_mixer_controls

Since it's now possible to have a DAPM mixer control with multiple
channels, use it to cut down the total number of controls.

Keep "Left Mixer Left DAC Playback Switch" and "Right Mixer Right DAC
Playback Switch" name & layout the same as before for compatibility.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: sun4i-codec: Add Mic1 Boost Volume, Mic2 Boost Volume
Danny Milosavljevic [Wed, 30 Jan 2019 10:39:40 +0000 (11:39 +0100)]
ASoC: sun4i-codec: Add Mic1 Boost Volume, Mic2 Boost Volume

Add Mic1 Boost Volume and Mic2 Boost Volume for Allwinner A10 and for
Allwinner A20.

Those controls are in different registers per chip model, so put the
Allwinner A10 controls and the Allwinner A20 controls into the newly
split sun4i_codec_controls and sun7i_codec_controls, respectively.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: sun4i-codec: Add sun7i_codec_controls, sun7i_codec_codec
Danny Milosavljevic [Wed, 30 Jan 2019 10:39:39 +0000 (11:39 +0100)]
ASoC: sun4i-codec: Add sun7i_codec_controls, sun7i_codec_codec

Introduce sun7i_codec_controls because some of the controls are different
on Allwinner A20 compared to Allwinner A10.

Also introduce sun7i_codec_codec in order to use sun7i_codec_controls and
make sun7i_codec_quirks use sun7i_codec_codec.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: sun4i-codec: Add Mic Playback Volume
Danny Milosavljevic [Wed, 30 Jan 2019 10:39:38 +0000 (11:39 +0100)]
ASoC: sun4i-codec: Add Mic Playback Volume

Add a control "Mic Playback Volume" that allows the user to control the
MIC gain stage (common for Mic1 and Mic2) leading to the output mixer.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: sun4i-codec: Add MIC2 Pre-Amplifier, Mic2 input
Danny Milosavljevic [Wed, 30 Jan 2019 10:39:37 +0000 (11:39 +0100)]
ASoC: sun4i-codec: Add MIC2 Pre-Amplifier, Mic2 input

Add MIC2 Pre-Amplifier, Mic2 input for Allwinner A10 and Allwinner A20.

Previously, there only the Mic1 input and MIC1 Pre-Amplifier was exposed.
This exposes the Mic2 input and MIC2 Pre-Amplifier.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: codecs: jz4725b: fix spelling mistake "Deemphatize" -> "Deemphasize"
Colin Ian King [Thu, 7 Feb 2019 09:26:42 +0000 (09:26 +0000)]
ASoC: codecs: jz4725b: fix spelling mistake "Deemphatize" -> "Deemphasize"

There is a spelling mistake in the SOC_SINGLE control name. Fix this.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: wcd9335: fix semicolon.cocci warnings
kbuild test robot [Mon, 4 Feb 2019 21:33:25 +0000 (05:33 +0800)]
ASoC: wcd9335: fix semicolon.cocci warnings

sound/soc/codecs/wcd-clsh-v2.c:545:2-3: Unneeded semicolon
sound/soc/codecs/wcd-clsh-v2.c:211:2-3: Unneeded semicolon
sound/soc/codecs/wcd-clsh-v2.c:250:2-3: Unneeded semicolon

 Remove unneeded semicolon.

Generated by: scripts/coccinelle/misc/semicolon.cocci

Fixes: cc2e324d39b2 ("ASoC: wcd9335: add CLASS-H Controller support")
CC: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: codecs: Add jz4725b-codec driver
Paul Cercueil [Tue, 5 Feb 2019 03:11:08 +0000 (00:11 -0300)]
ASoC: codecs: Add jz4725b-codec driver

Add jz4725b-codec driver to support the internal CODEC found in the
JZ4725B SoC from Ingenic.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: dapm: harden use of lookup tables
Pierre-Louis Bossart [Tue, 5 Feb 2019 16:22:28 +0000 (10:22 -0600)]
ASoC: dapm: harden use of lookup tables

To detect potential errors, let's add:

a) build-time warnings when the table size isn't aligned with the enum
list
b) run-time warnings when the values are not initialized. This
requires an increase by one of all values to avoid the default 0.

Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoMerge branch 'asoc-5.0' into asoc-5.1 for dapm table
Mark Brown [Wed, 6 Feb 2019 17:31:39 +0000 (17:31 +0000)]
Merge branch 'asoc-5.0' into asoc-5.1 for dapm table

5 years agoASoC: dapm: fix out-of-bounds accesses to DAPM lookup tables
Pierre-Louis Bossart [Tue, 5 Feb 2019 16:22:27 +0000 (10:22 -0600)]
ASoC: dapm: fix out-of-bounds accesses to DAPM lookup tables

KASAN reports and additional traces point to out-of-bounds accesses to
the dapm_up_seq and dapm_down_seq lookup tables. The indices used are
larger than the array definition.

Fix by adding missing entries for the new widget types in these two
lookup tables, and align them with PGA values.

Also the sequences for the following widgets were not defined. Since
their values defaulted to zero, assign them explicitly

 snd_soc_dapm_input
 snd_soc_dapm_output
 snd_soc_dapm_vmid
 snd_soc_dapm_siggen
 snd_soc_dapm_sink

Fixes: 8a70b4544ef4 ('ASoC: dapm: Add new widget type for constructing DAPM graphs on DSPs.').
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: ssm2602: switch to SPDX identifier
Marco Felsch [Wed, 6 Feb 2019 17:00:03 +0000 (18:00 +0100)]
ASoC: ssm2602: switch to SPDX identifier

Drop old license header and switch to SPDX-License-Identifier.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: compress: Add helper functions for component trigger/set_params
Charles Keepax [Tue, 5 Feb 2019 11:18:13 +0000 (11:18 +0000)]
ASoC: compress: Add helper functions for component trigger/set_params

The trigger and set_params callbacks are called from 3 and 2 separate
loops respectively, tidy up the code a little by factoring these out
into helper functions.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: compress: Clarify the intent of current compressed ops handling
Charles Keepax [Tue, 5 Feb 2019 11:18:12 +0000 (11:18 +0000)]
ASoC: compress: Clarify the intent of current compressed ops handling

For callbacks configuring the state of the components (trigger,
set_params, ack and set_metadata) simplify the code a little and make
intention clearer by aborting as soon as an error is encountered. The
operation has already failed and there is nothing to be gained from
processing the callbacks on additional components. The operations
currently abort after the callbacks, so this simply shortens the
error path.

For callbacks returning information from the driver (copy,
get_metadata, pointer, get_codec_caps, get_caps and get_params)
only look for the first callback provided, currently the code will
call every callback only returning the information provided by the
last. Since we can only return one set of data, it makes no sense to
request the data from every component. Again this just makes the
currently supported feature set a little more clear.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: wcd9335: remove some unnecessary NULL checks
Dan Carpenter [Tue, 5 Feb 2019 09:09:27 +0000 (12:09 +0300)]
ASoC: wcd9335: remove some unnecessary NULL checks

These are arrays, not pointers, and they can't be NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: ssm2602: Fix ADC powerup sequencing
Philipp Zabel [Wed, 6 Feb 2019 15:29:47 +0000 (16:29 +0100)]
ASoC: ssm2602: Fix ADC powerup sequencing

According to the ssm2603 data sheet (control register sequencing), the
digital core should be activated only after all necessary bits in the
power register are enabled, and a delay determined by the decoupling
capacitor on the VMID pin has passed. If the digital core is activated
too early, or even before the ADC is powered up, audible artifacts
appear at the beginning of the recorded signal.

The digital core is also needed for playback, so when recording starts
it may already be enabled. This means we cannot get the power sequence
correct when we want to be able to start recording after playback.

As a workaround put the MIC mute switch into the DAPM routes. This
way we can keep the recording disabled until the MIC Bias has settled
and thus get rid of audible artifacts.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
m.felsch@pengutronix.de: adapt commit message
m.felsch@pengutronix.de: drop of configuration as mentioned by Mark:
 https://patchwork.kernel.org/patch/10407449/
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: dapm: Check for NULL widget in dapm_update_dai_unlocked
Charles Keepax [Wed, 6 Feb 2019 11:13:59 +0000 (11:13 +0000)]
ASoC: dapm: Check for NULL widget in dapm_update_dai_unlocked

DAIs linked to the dummy will not have an associated playback/capture
widget, so we need to skip the update in that case.

Fixes: 078a85f2806f ("ASoC: dapm: Only power up active channels from a DAI")
Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Tested-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Tested-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: ak4118: fix missing header
Clément Péron [Mon, 4 Feb 2019 15:35:38 +0000 (16:35 +0100)]
ASoC: ak4118: fix missing header

This driver use the gpio consumer interface.
Add the header as it's needed.

Signed-off-by: Clément Péron <peron.clem@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: mediatek: btcvsd: fix spelling mistake "offest" -> "offset"
Colin Ian King [Mon, 4 Feb 2019 15:31:05 +0000 (15:31 +0000)]
ASoC: mediatek: btcvsd: fix spelling mistake "offest" -> "offset"

There is a spelling mistake in a dev_warn message. Fix this.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: topology: unload physical dai link in remove
Bard liao [Fri, 1 Feb 2019 17:07:40 +0000 (11:07 -0600)]
ASoC: topology: unload physical dai link in remove

soc_tplg_link_config() will find the physical dai link and call
soc_tplg_dai_link_load() to load the BE dai link. Currently remove_link()
is only used to remove the FE dai link which is created by the topology.
The BE dai link cannot however be unloaded in snd_soc_tplg_component
_remove(), which is problematic if anything needs to be released or
reinitialized.

This patch aligns the definitions of dynamic types with the existing
UAPI and adds a new remove_backend_link() routine to unload the the BE
dai link when snd_soc_tplg_component_remove() is invoked.

Signed-off-by: Bard liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: clear platform pointers on error
Curtis Malainey [Tue, 29 Jan 2019 21:47:09 +0000 (13:47 -0800)]
ASoC: soc-core: clear platform pointers on error

Originally snd_soc_init_platform was not cleaning up its pointers, this
was fixed to always reallocate dynamic memory but created a memory leak
when snd_soc_init_platform was called multiple times during the same
probe attempt and also threw away any changes made to the struct between
calls. In order to avoid reallocating memory that is still valid, the
behaviour will be changed to clear the dynamically set pointers on a
probe error and a unregister event and snd_soc_init_platform will go
back to its original behaviour of only allocating null pointers so it will
stop throwing away valid changes.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsl-asoc-card: fix object reference leaks in fsl_asoc_card_probe
wen yang [Sat, 2 Feb 2019 14:53:16 +0000 (14:53 +0000)]
ASoC: fsl-asoc-card: fix object reference leaks in fsl_asoc_card_probe

The of_find_device_by_node() takes a reference to the underlying device
structure, we should release that reference.

Signed-off-by: Wen Yang <yellowriver2010@hotmil.com>
Cc: Timur Tabi <timur@kernel.org>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: dapm: Add warnings for widget overwrite when adding route
Zhiwei Jiang [Thu, 31 Jan 2019 11:30:05 +0000 (19:30 +0800)]
ASoC: dapm: Add warnings for widget overwrite when adding route

Currently, in some complex cases, more than one widgets have same
name and registed from differnt dapm context, and route add from
another context too. When snd_soc_dapm_add_route, the previous
registered widget will overwritten by the latest same name widget,
will cause unexpect error. For Asoc framework we cant avoid this
situation and we cant decide which widget that wanted with route.
At least we can give users a notice.

Signed-off-by: Zhiwei Jiang <qq282012236@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: dapm: Only power up active channels from a DAI
Charles Keepax [Thu, 31 Jan 2019 13:30:18 +0000 (13:30 +0000)]
ASoC: dapm: Only power up active channels from a DAI

Currently all widgets attached to a DAI link will be powered
up when the DAI is active, however this may include routes
that are not actually in use if there are unused channels
available on the DAI.

The macros for creating AIF widgets already include an entry for
slot, it is proposed to change that to channel. The effective
difference here being respresenting the logical channel index
rather than the physical slot index. The CODECs currently
using the slot entry on the DAPM_AIF macros are using it in
a manner consistent with this, the CODECs not using it just
have the field set to zero.

A variable is added to snd_soc_dapm_widget to represent
this channel index and then for each AIF widget attached to
a DAI this is compared against the number of channels on
the stream. Enabling the links for those which will be in
use. This has the nice property that the CODECs which haven't
used the slot/channel entry in the macro will function exactly
as before due to all the AIF widgets having a channel of zero
and a stream by definition having at least one channel.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: topology: fix oops/use-after-free case with dai driver
Guennadi Liakhovetski [Fri, 1 Feb 2019 17:05:13 +0000 (11:05 -0600)]
ASoC: topology: fix oops/use-after-free case with dai driver

rmmod/modprobe tests expose a kernel oops when accessing the dai
driver pointer. This comes from the topology design which operates in
multiple passes. Each object removal happens at a specific iteration,
and the code checks for the iteration (order) number after the memory
containing the order was freed.

Fix this be clearing a reference to the dai driver and check its
validity to avoid dereferences.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: dapm: fix use-after-free issue with dailink sname
Pierre-Louis Bossart [Fri, 1 Feb 2019 17:05:12 +0000 (11:05 -0600)]
ASoC: dapm: fix use-after-free issue with dailink sname

Commit 7620fe9161ce ("ASoC: topology: fix memory leak in
soc_tplg_dapm_widget_create") fixed a memory leak issue, but
additional tests and KASAN reports show a use-after-free in soc-dapm.

The widgets are created with a kmemdup operating on a template. The
"name" string is also duplicated, but the "sname" string is not. As a
result, when the template is freed after widget creation, its sname
string is still used.

Fix by explicitly duplicating the "sname" string, and freeing it when
required.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: mediatek: add btcvsd driver
KaiChieh Chuang [Wed, 30 Jan 2019 06:47:10 +0000 (14:47 +0800)]
ASoC: mediatek: add btcvsd driver

The driver function for transferring/receiving
BT encoded data to/from BT firmware.

Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: mediatek: add documents for btcvsd driver
KaiChieh Chuang [Wed, 30 Jan 2019 06:47:11 +0000 (14:47 +0800)]
ASoC: mediatek: add documents for btcvsd driver

document for btcvsd driver

Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: arizona: Add channel numbers to AIFs
Charles Keepax [Thu, 31 Jan 2019 13:30:19 +0000 (13:30 +0000)]
ASoC: arizona: Add channel numbers to AIFs

Set the channel number on each AIF widget to allow unused channels not
to be powered up across AIFs.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: rsnd: fixup TDM Split mode check for CTU
Kuninori Morimoto [Fri, 1 Feb 2019 07:47:25 +0000 (16:47 +0900)]
ASoC: rsnd: fixup TDM Split mode check for CTU

Renesas sound card need to judge that whether it is using
"TDM Split mode". To judge it and for other purpose, it has
rsnd_parse_connect_simple() and rsnd_parse_connect_graph(),
but these are using different judgement policy for
TDM Split mode.
It is pointless and confusable.
This patch add new rsnd_parse_tdm_split_mode() and use common
judgement policy for simple-card/audio-graph.

Without this patch, CTU will be judged as TDM Split mode
on audio-graph card.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: rsnd: synchronize connection check for simple-card/audio-graph
Kuninori Morimoto [Fri, 1 Feb 2019 07:46:27 +0000 (16:46 +0900)]
ASoC: rsnd: synchronize connection check for simple-card/audio-graph

Current rsnd driver has below function to check connection
rsnd_parse_connect_simple()
rsnd_parse_connect_graph()
But these have different parameters. This patch synchronize these
for cleanup.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: rsnd: fixup MIX kctrl registration
Kuninori Morimoto [Fri, 1 Feb 2019 07:49:30 +0000 (16:49 +0900)]
ASoC: rsnd: fixup MIX kctrl registration

Renesas sound device has many IPs and many situations.
If platform/board uses MIXer, situation will be more complex.
To avoid duplicate DVC kctrl registration when MIXer was used,
it had original flags.
But it was issue when sound card was re-binded, because
no one can't cleanup this flags then.

To solve this issue, commit 9c698e8481a15237a ("ASoC: rsnd: tidyup
registering method for rsnd_kctrl_new()") checks registered
card->controls, because if card was re-binded, these were cleanuped
automatically. This patch could solve re-binding issue.
But, it start to avoid MIX kctrl.

To solve these issues, we need below.
To avoid card re-binding issue: check registered card->controls
To avoid duplicate DVC registration: check registered rsnd_kctrl_cfg
To allow multiple MIX registration: check registered rsnd_kctrl_cfg
This patch do it.

Fixes: 9c698e8481a15237a ("ASoC: rsnd: tidyup registering method for rsnd_kctrl_new()")
Reported-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-By: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: sprd: Add Spreadtrum audio DMA platfrom driver
Baolin Wang [Tue, 29 Jan 2019 08:04:45 +0000 (16:04 +0800)]
ASoC: sprd: Add Spreadtrum audio DMA platfrom driver

The Spreadtrum DMA engine uses the link-list mode to support audio playback
or capture, thus this patch adds audio DMA platform support for CPU DAI to
trigger DMA link-list transfer.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agodt-bindings: ASoC: Add Spreadtrum DMA platform documentation
Baolin Wang [Tue, 29 Jan 2019 08:04:44 +0000 (16:04 +0800)]
dt-bindings: ASoC: Add Spreadtrum DMA platform documentation

Add documentation for Spreadtrum DMA platform driver.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: topology: modify dapm route loading routine and add dapm route unloading
Ranjani Sridharan [Fri, 25 Jan 2019 20:06:47 +0000 (14:06 -0600)]
ASoC: topology: modify dapm route loading routine and add dapm route unloading

struct snd_soc_dapm_route has been modified to be a dynamic
object so that it can be used to save driver specific
data while parsing topology and clean up
driver-specific data during driver unloading.

This patch makes the following changes to accomplish the above:
1. Set the dobj member of snd_soc_dapm_route during the
SOC_TPLG_PASS_GRAPH pass of topology parsing.
2. Add the remove_route() routine that will be called while
removing all dynamic objects from the component driver.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: topology: add SND_SOC_DOBJ_GRAPH type for dapm routes
Ranjani Sridharan [Fri, 25 Jan 2019 20:06:46 +0000 (14:06 -0600)]
ASoC: topology: add SND_SOC_DOBJ_GRAPH type for dapm routes

Add a new dobj type SND_SOC_DOBJ_GRAPH for dapm routes
and add snd_soc_dobj member to struct snd_soc_dapm_route.
This enables device drivers to save driver specific
data pertaining to dapm routes and also be able
to clean up the data when the driver module is unloaded.

Also, reorder the snd_soc_dobj_type types to align with
matching topology header types.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: topology: fix memory leak in soc_tplg_dapm_widget_create
Bard liao [Fri, 25 Jan 2019 20:06:45 +0000 (14:06 -0600)]
ASoC: topology: fix memory leak in soc_tplg_dapm_widget_create

template.sname and template.name are only freed when an error occur.
They should be freed in the success return case, too.

Signed-off-by: Bard liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: topology: Fix memory leak from soc_tplg_denum_create_texts
Amadeusz Sławiński [Fri, 25 Jan 2019 20:06:44 +0000 (14:06 -0600)]
ASoC: topology: Fix memory leak from soc_tplg_denum_create_texts

dtexts is two dimensional array, so we also need to free it after
freeing its fields.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: topology: Remove widgets from dobj list
Amadeusz Sławiński [Fri, 25 Jan 2019 20:06:43 +0000 (14:06 -0600)]
ASoC: topology: Remove widgets from dobj list

Currently when we unload and reload machine driver few times we end with
corrupted list and try to cleanup no longer existing objects. Fix this
by removing dobj from the list.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: topology: Reduce number of dereferences when accessing dobj
Amadeusz Sławiński [Fri, 25 Jan 2019 20:06:42 +0000 (14:06 -0600)]
ASoC: topology: Reduce number of dereferences when accessing dobj

We already have passed dobj, there is no reason to access it through
containing structs.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: cht_bsw_rt5672: remove useless test
Pierre-Louis Bossart [Tue, 29 Jan 2019 15:42:20 +0000 (09:42 -0600)]
ASoC: Intel: cht_bsw_rt5672: remove useless test

For some reason we test if the machine is passed as a parameter before
fixing up the codec name. This is unnecessary, generates false
positives in static analysis tools and done only in this machine
driver, remove and adjust indentation.

Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: cros_ec_codec: Add codec driver for Cros EC
Cheng-Yi Chiang [Sat, 19 Jan 2019 11:33:33 +0000 (19:33 +0800)]
ASoC: cros_ec_codec: Add codec driver for Cros EC

Add a codec driver to control ChromeOS EC codec.

Use EC Host command to enable/disable I2S recording and control other
configurations.

Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Documentation: Add google, cros-ec-codec
Cheng-Yi Chiang [Sat, 19 Jan 2019 11:33:31 +0000 (19:33 +0800)]
ASoC: Documentation: Add google, cros-ec-codec

Add documentation for Chrome EC codec driver.

Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoMerge tag 'v5.0-rc4' into asoc-5.1
Mark Brown [Tue, 29 Jan 2019 12:04:54 +0000 (12:04 +0000)]
Merge tag 'v5.0-rc4' into asoc-5.1

Linux 5.0-rc4

5 years agoASoC: wcd9335: Fix missing slimbus dependency
Mark Brown [Tue, 29 Jan 2019 12:02:29 +0000 (12:02 +0000)]
ASoC: wcd9335: Fix missing slimbus dependency

Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: apq8096: add slim support
Srinivas Kandagatla [Mon, 28 Jan 2019 14:27:53 +0000 (14:27 +0000)]
ASoC: apq8096: add slim support

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: wcd9335: add audio routings
Srinivas Kandagatla [Mon, 28 Jan 2019 14:27:52 +0000 (14:27 +0000)]
ASoC: wcd9335: add audio routings

This patch adds audio routing for both playback and capture.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: wcd9335: add capture dapm widgets
Srinivas Kandagatla [Mon, 28 Jan 2019 14:27:51 +0000 (14:27 +0000)]
ASoC: wcd9335: add capture dapm widgets

This patch adds required dapm widgets for capture path.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: wcd9335: add playback dapm widgets
Srinivas Kandagatla [Mon, 28 Jan 2019 14:27:50 +0000 (14:27 +0000)]
ASoC: wcd9335: add playback dapm widgets

This patch adds required dapm widgets for playback.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: wcd9335: add basic controls
Srinivas Kandagatla [Mon, 28 Jan 2019 14:27:49 +0000 (14:27 +0000)]
ASoC: wcd9335: add basic controls

This patch adds basic controls found in wcd9335 codec.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: wcd9335: add CLASS-H Controller support
Srinivas Kandagatla [Mon, 28 Jan 2019 14:27:48 +0000 (14:27 +0000)]
ASoC: wcd9335: add CLASS-H Controller support

CLASS-H controller/Amplifier is common accorss Qualcomm WCD codec series.
This patchset adds basic CLASS-H controller apis for WCD codecs after
wcd9335 to use.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: wcd9335: add support to wcd9335 codec
Srinivas Kandagatla [Mon, 28 Jan 2019 14:27:47 +0000 (14:27 +0000)]
ASoC: wcd9335: add support to wcd9335 codec

Qualcomm WCD9335 Codec is a standalone Hi-Fi audio codec IC,
It supports both I2S/I2C and SLIMbus audio interfaces.
On slimbus interface it supports two data lanes; 16 Tx ports
and 8 Rx ports. It has Seven DACs and nine dedicated interpolators,
Seven (six audio ADCs, and one VBAT ADC), Multibutton headset
control (MBHC), Active noise cancellation and Sidetone paths
and processing.

This patchset adds very basic support for playback and capture
via the 9 interpolators and ADC respectively.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: dt-bindings: update wcd9335 bindings.
Srinivas Kandagatla [Mon, 28 Jan 2019 14:27:46 +0000 (14:27 +0000)]
ASoC: dt-bindings: update wcd9335 bindings.

This patch updates wcd9335 bindings with recommended properties.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: glk_rt5682_max98357a: platform name fixup support
Pierre-Louis Bossart [Fri, 25 Jan 2019 20:35:09 +0000 (14:35 -0600)]
ASoC: Intel: glk_rt5682_max98357a: platform name fixup support

Add helper to override dailink platform name, if passed as parameter

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: bxt_rt298: platform name fixup support
Pierre-Louis Bossart [Fri, 25 Jan 2019 20:35:08 +0000 (14:35 -0600)]
ASoC: Intel: bxt_rt298: platform name fixup support

Add helper to override dailink platform name, if passed as parameter

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: bxt_da7219_max98357a: platform name fixup support
Pierre-Louis Bossart [Fri, 25 Jan 2019 20:35:07 +0000 (14:35 -0600)]
ASoC: Intel: bxt_da7219_max98357a: platform name fixup support

Add helper to override dailink platform name, if passed as parameter

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: cht_bsw_rt5672: platform name fixup support
Pierre-Louis Bossart [Fri, 25 Jan 2019 20:35:06 +0000 (14:35 -0600)]
ASoC: Intel: cht_bsw_rt5672: platform name fixup support

Add helper to override dailink platform name, if passed as parameter

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: cht_bsw_rt5645: platform name fixup support
Pierre-Louis Bossart [Fri, 25 Jan 2019 20:35:05 +0000 (14:35 -0600)]
ASoC: Intel: cht_bsw_rt5645: platform name fixup support

Add helper to override dailink platform name, if passed as parameter

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: cht_bsw_nau8824: platform name fixup support
Pierre-Louis Bossart [Fri, 25 Jan 2019 20:35:04 +0000 (14:35 -0600)]
ASoC: Intel: cht_bsw_nau8824: platform name fixup support

Add helper to override dailink platform name, if passed as parameter

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: cht_bsw_max98090_ti: platform name fixup support
Pierre-Louis Bossart [Fri, 25 Jan 2019 20:35:03 +0000 (14:35 -0600)]
ASoC: Intel: cht_bsw_max98090_ti: platform name fixup support

Add helper to override dailink platform name, if passed as parameter

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: bytcht_es8316: platform name fixup support
Pierre-Louis Bossart [Fri, 25 Jan 2019 20:35:02 +0000 (14:35 -0600)]
ASoC: Intel: bytcht_es8316: platform name fixup support

Add helper to override dailink platform name, if passed as parameter

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>