openwrt/staging/blogic.git
5 years agoASoC: qcom: Fix of-node refcount unbalance in apq8016_sbc_parse_of()
Takashi Iwai [Tue, 19 Feb 2019 15:46:50 +0000 (16:46 +0100)]
ASoC: qcom: Fix of-node refcount unbalance in apq8016_sbc_parse_of()

The apq8016 driver leaves the of-node refcount at aborting from the
loop of for_each_child_of_node() in the error path.  Not only the
iterator node of for_each_child_of_node(), the children nodes referred
from it for codec and cpu have to be properly unreferenced.

Fixes: bdb052e81f62 ("ASoC: qcom: add apq8016 sound card support")
Cc: Patrick Lai <plai@codeaurora.org>
Cc: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: odroid: Fix of_node refcount unbalance
Sylwester Nawrocki [Wed, 20 Feb 2019 11:06:07 +0000 (12:06 +0100)]
ASoC: samsung: odroid: Fix of_node refcount unbalance

In odroid_audio_probe() some OF nodes are left without reference count
decrease after use. Fix it by ensuring required of_node_calls() are done
before exiting probe.

Reported-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: simple-card: Fix of-node refcount unbalance in DAI-link parser
Takashi Iwai [Tue, 19 Feb 2019 15:46:49 +0000 (16:46 +0100)]
ASoC: simple-card: Fix of-node refcount unbalance in DAI-link parser

The function simple_for_each_link() has a few missing places that
forgot unrefereing of-nodes after the use.  The main do-while loop
may abort when loop=0, and this leaves the node object still
referenced.  A similar leak is found in the error handling of NULL
codec that aborts the loop as well.  Last but not least, the inner
for_each_child_of_node() loop may abort in the middle, and this leaks
the refcount of the iterator node.

This patch addresses these missing refcount issues.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: simple-card: Fix missing of_node_put() at simple_dai_link_of()
Takashi Iwai [Tue, 19 Feb 2019 15:46:48 +0000 (16:46 +0100)]
ASoC: simple-card: Fix missing of_node_put() at simple_dai_link_of()

We forgot to unreference the platform node object obtained from
of_get_child_by_name().  This leads to the unbalance of node
refcount.

Fixes: e0ae225b7e96 ("ASoC: simple-card: support platform in dts parse")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsl: Fix of-node refcount unbalance in fsl_ssi_probe_from_dt()
Takashi Iwai [Tue, 19 Feb 2019 15:46:47 +0000 (16:46 +0100)]
ASoC: fsl: Fix of-node refcount unbalance in fsl_ssi_probe_from_dt()

The node obtained from of_find_node_by_path() has to be unreferenced
after the use, but we forgot it for the root node.

Fixes: f0fba2ad1b6b ("ASoC: multi-component - ASoC Multi-Component Support")
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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: wm_adsp: Allow compressed buffers in any memory region
Andrew Ford [Tue, 19 Feb 2019 17:31:56 +0000 (17:31 +0000)]
ASoC: wm_adsp: Allow compressed buffers in any memory region

Currently, compressed buffers can only be specified in the XM memory
region. There is no reason to have such a restriction with the newer
meta-data based way of specifying the buffers, so remove it.

Signed-off-by: Andrew Ford <aford@opensource.cirrus.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoMerge branch 'for-5.0' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie...
Mark Brown [Tue, 19 Feb 2019 15:52:41 +0000 (15:52 +0000)]
Merge branch 'for-5.0' of https://git./linux/kernel/git/broonie/sound into asoc-5.1

5 years agoASoC: samsung: i2s: Fix multiple "IIS multi" devices initialization
Sylwester Nawrocki [Tue, 19 Feb 2019 15:19:41 +0000 (16:19 +0100)]
ASoC: samsung: i2s: Fix multiple "IIS multi" devices initialization

On some SoCs (e.g. Exynos5433) there are multiple "IIS multi audio
interfaces" and the driver will try to register there multiple times
same platform device for the secondary FIFO, which of course fails
miserably.  To fix this we derive the secondary platform device name
from the primary device name. The secondary device name will now
be <primary_dev_name>-sec instead of fixed "samsung-i2s-sec".

The fixed platform_device_id table entry is removed as the secondary
device name is now dynamic and device/driver matching is done through
driver_override.

Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Suggested-by: Marek Szyprowski <m.szyprowski@samsung.com>
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: i2s: Fix secondary platform device unregistration
Sylwester Nawrocki [Tue, 19 Feb 2019 15:19:40 +0000 (16:19 +0100)]
ASoC: samsung: i2s: Fix secondary platform device unregistration

This fixes unregistration of the secondary platform device so all
resources are properly released.  Additionally the removal sequence
is corrected so it is in reverse order comparing to probe sequence.
The test against NULL priv->pdev_sec is removed as it is not necessary.

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: Intel: glk: Add DAI links for Multi-Playback
Yong Zhi [Wed, 13 Feb 2019 23:08:53 +0000 (17:08 -0600)]
ASoC: Intel: glk: Add DAI links for Multi-Playback

Add FE DAI link to support parallel playback on 2 ports
simultaneously.

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Naveen Manohar <naveen.m@intel.com>
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: Add Geminilake Dialog Maxim machine driver
Yong Zhi [Wed, 13 Feb 2019 23:08:52 +0000 (17:08 -0600)]
ASoC: Intel: Add Geminilake Dialog Maxim machine driver

This patch enables support for GeminiLake with the DA7219 codec and
MAX98357A amplifier. To avoid duplicating code, the existing machine
driver for ApolloLake is reused with only changes in hardware
connectivity (SSP2 for DA7219 and SSP1 for MAX98357A).

The dailinks are directly modified in this patch. Using a helper would
be nicer, but it'll be done in a follow-up step with validation done
across multiple machine drivers.

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Naveen Manohar <naveen.m@intel.com>
Signed-off-by: Harsha Priya <harshapriya.n@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: Headset button support in broxton machine driver
Yong Zhi [Wed, 13 Feb 2019 23:08:51 +0000 (17:08 -0600)]
ASoC: Intel: Headset button support in broxton machine driver

Map the 4 headset buttons to KEY_PAUSE, KEY_VOLUMEUP, KEY_VOLUMEDOWN and
KEY_VOICECOMMAND.

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Naveen Manohar <naveen.m@intel.com>
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: sunxi: sun50i-codec-analog: Rename hpvcc regulator supply to cpvdd
Chen-Yu Tsai [Wed, 13 Feb 2019 07:04:56 +0000 (15:04 +0800)]
ASoC: sunxi: sun50i-codec-analog: Rename hpvcc regulator supply to cpvdd

The A64 datasheet lists the supply rail for the headphone amp's charge
pump as "CPVDD". cpvdd-supply is the name of the property for this power
rail specified in the device tree bindings. "HPVCC" was the name used in
the A33 datasheet for the same function.

Rename the supply so it matches the datasheet, bindings, and the subject
from the original commit.

Fixes: ca0412a05756 ("ASoC: sunxi: sun50i-codec-analog: Add support for cpvdd regulator supply")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: adau1977: Add support for setting MICBIAS via DT
Bogdan Togorean [Tue, 19 Feb 2019 14:11:39 +0000 (16:11 +0200)]
ASoC: adau1977: Add support for setting MICBIAS via DT

If platform_data is NULL add reading of optional adi,micbias
property from DT. If adi,micbias is not set keep the default
value for micbias.

Signed-off-by: Bogdan Togorean <bogdan.togorean@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: adau1977: Add MICBIAS example in DT bindings
Bogdan Togorean [Tue, 19 Feb 2019 14:11:38 +0000 (16:11 +0200)]
ASoC: adau1977: Add MICBIAS example in DT bindings

Add MICBIAS property to the optional devicetree bindings.

Signed-off-by: Bogdan Togorean <bogdan.togorean@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: dapm: Potential small memory leak in dapm_cnew_widget()
Dan Carpenter [Tue, 19 Feb 2019 12:04:27 +0000 (15:04 +0300)]
ASoC: dapm: Potential small memory leak in dapm_cnew_widget()

We should free "w" on the error path.

Fixes: 199ed3e81c49 ("ASoC: dapm: fix use-after-free issue with dailink sname")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: odroid: Add missing DAPM routes
Sylwester Nawrocki [Fri, 15 Feb 2019 12:04:22 +0000 (13:04 +0100)]
ASoC: samsung: odroid: Add missing DAPM routes

With old DTS there will be missing DAPM routes linking BE with CODECs.
Add those routes in the card driver so sound works properly on Odroid
XU3/4 also without DTS updates enabling the secondary PCM.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: wm8741: Make function 'wm8741_mute' static
Wei Yongjun [Sat, 16 Feb 2019 01:35:56 +0000 (01:35 +0000)]
ASoC: wm8741: Make function 'wm8741_mute' static

Fixes the following sparse warning:

sound/soc/codecs/wm8741.c:371:5: warning:
 symbol 'wm8741_mute' was not declared. Should it be static?

Fixes: 36b1599340b5 ("ASoC: wm8741: Add digital mute callback")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsl_esai: fix register setting issue in RIGHT_J mode
S.j. Wang [Mon, 18 Feb 2019 08:29:11 +0000 (08:29 +0000)]
ASoC: fsl_esai: fix register setting issue in RIGHT_J mode

The ESAI_xCR_xWA is xCR's bit, not the xCCR's bit, driver set it to
wrong register, correct it.

Fixes 43d24e76b698 ("ASoC: fsl_esai: Add ESAI CPU DAI driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Ackedy-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: adau1977: Fix reset-gpios typo
Bogdan Togorean [Fri, 15 Feb 2019 10:26:33 +0000 (12:26 +0200)]
ASoC: adau1977: Fix reset-gpios typo

This change fixes a typo in the dt-binding examples (reset_gpio ->
reset-gpios).
Even though 'reset-gpio' is a valid construct for gpiolib the naming
'reset-gpios' is more suited for dt-bindings documentation.

Signed-off-by: Bogdan Togorean <bogdan.togorean@analog.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoSoC: imx-sgtl5000: add missing put_device()
Wen Yang [Mon, 18 Feb 2019 15:13:47 +0000 (15:13 +0000)]
SoC: imx-sgtl5000: add missing put_device()

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

Detected by coccinelle with the following warnings:
./sound/soc/fsl/imx-sgtl5000.c:169:1-7: ERROR: missing put_device;
call of_find_device_by_node on line 105, but without a corresponding
object release within this function.
./sound/soc/fsl/imx-sgtl5000.c:177:1-7: ERROR: missing put_device;
call of_find_device_by_node on line 105, but without a corresponding
object release within this function.

Signed-off-by: Wen Yang <yellowriver2010@hotmail.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: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: alsa-devel@alsa-project.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoMerge branch 'for-5.0' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie...
Mark Brown [Mon, 18 Feb 2019 18:51:48 +0000 (18:51 +0000)]
Merge branch 'for-5.0' of https://git./linux/kernel/git/broonie/sound into asoc-5.1 for refcount fix

5 years agoASoC: simple-card: fixup refcount_t underflow
Kuninori Morimoto [Fri, 15 Feb 2019 06:31:29 +0000 (15:31 +0900)]
ASoC: simple-card: fixup refcount_t underflow

commit da215354eb55c ("ASoC: simple-card: merge simple-scu-card")
merged simple-card and simple-scu-card. Then it had refcount
underflow bug. This patch fixup it.
We will get below error without this patch.

OF: ERROR: Bad of_node_put() on /sound
CPU: 3 PID: 237 Comm: kworker/3:1 Not tainted 5.0.0-rc6+ #1514
Hardware name: Renesas H3ULCB Kingfisher board based on r8a7795 ES2.0+ (DT)
Workqueue: events deferred_probe_work_func
Call trace:
 dump_backtrace+0x0/0x150
 show_stack+0x24/0x30
 dump_stack+0xb0/0xec
 of_node_release+0xd0/0xd8
 kobject_put+0x74/0xe8
 of_node_put+0x24/0x30
 __of_get_next_child+0x50/0x70
 of_get_next_child+0x40/0x68
 asoc_simple_card_probe+0x604/0x730
 platform_drv_probe+0x58/0xa8
 ...
Reported-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: simple-card: Fix refcount underflow
Daniel Baluta [Sat, 16 Feb 2019 10:09:42 +0000 (10:09 +0000)]
ASoC: simple-card: Fix refcount underflow

of_get_child_by_name() takes a reference we'll need to drop
later so when we substitute in top we need to take a reference
as well as just assigning.

Without this patch we hit the following error:

[    1.246852] OF: ERROR: Bad of_node_put() on /sound-wm8524
[    1.262261] Hardware name: NXP i.MX8MQ EVK (DT)
[    1.266807] Workqueue: events deferred_probe_work_func
[    1.271950] Call trace:
[    1.274406]  dump_backtrace+0x0/0x158
[    1.278074]  show_stack+0x14/0x20
[    1.281396]  dump_stack+0xa8/0xcc
[    1.284717]  of_node_release+0xb0/0xc8
[    1.288474]  kobject_put+0x74/0xf0
[    1.291879]  of_node_put+0x14/0x28
[    1.295286]  __of_get_next_child+0x44/0x70
[    1.299387]  of_get_next_child+0x3c/0x60
[    1.303315]  simple_for_each_link+0x1dc/0x230
[    1.307676]  simple_probe+0x80/0x540
[    1.311256]  platform_drv_probe+0x50/0xa0

This patch is based on an earlier version posted by Kuninori Morimoto
and commit message includes explanations from Mark Brown.

https://patchwork.kernel.org/patch/10814255/

Reported-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: odroid: Ensure proper sample rate on pri/sec PCM
Sylwester Nawrocki [Thu, 14 Feb 2019 16:00:11 +0000 (17:00 +0100)]
ASoC: samsung: odroid: Ensure proper sample rate on pri/sec PCM

Currently when playing sound with different sample rates actual
sample rate will be determined by audio stream which starts first
on either primary or secondary PCM. The audio root clock will be
configured appropriately only for the first stream. As the hardware
is limited to same sample rate on both interfaces we need to disallow
streams with different sample rates. It is done by this patch by
returning error in FE hw_params if there is already active stream
running with different sample rate.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: stm32: sai: remove set but not used variables 'mask, cr1'
YueHaibing [Mon, 18 Feb 2019 14:50:26 +0000 (14:50 +0000)]
ASoC: stm32: sai: remove set but not used variables 'mask, cr1'

Fixes gcc '-Wunused-but-set-variable' warning:

sound/soc/stm/stm32_sai_sub.c: In function 'stm32_sai_configure_clock':
sound/soc/stm/stm32_sai_sub.c:902:11: warning:
 variable 'mask' set but not used [-Wunused-but-set-variable]
sound/soc/stm/stm32_sai_sub.c:902:6: warning:
 variable 'cr1' set but not used [-Wunused-but-set-variable]

It's not used any more after 8307b2afd386 ("ASoC: stm32: sai: set sai as
mclk clock provider")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: topology: free created components in tplg load error
Bard liao [Sun, 17 Feb 2019 13:23:47 +0000 (21:23 +0800)]
ASoC: topology: free created components in tplg load error

Topology resources are no longer needed if any element failed to load.

Signed-off-by: Bard liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: cs35l36: Make some symbols static
Wei Yongjun [Mon, 18 Feb 2019 07:46:53 +0000 (07:46 +0000)]
ASoC: cs35l36: Make some symbols static

Fixes the following sparse warnings:

sound/soc/codecs/cs35l36.c:135:20: warning:
 symbol 'cs35l36_reg' was not declared. Should it be static?
sound/soc/codecs/cs35l36.c:248:6: warning:
 symbol 'cs35l36_readable_reg' was not declared. Should it be static?
sound/soc/codecs/cs35l36.c:398:6: warning:
 symbol 'cs35l36_precious_reg' was not declared. Should it be static?
sound/soc/codecs/cs35l36.c:410:6: warning:
 symbol 'cs35l36_volatile_reg' was not declared. Should it be static?

Fixes: 6ba9dd6c893b ("ASoC: cs35l36: Add support for Cirrus CS35L36 Amplifier")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: James Schulman <james.schulman@cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: qcom: Kconfig: select dmic for sdm845
Cheng-Yi Chiang [Mon, 18 Feb 2019 04:18:19 +0000 (12:18 +0800)]
ASoC: qcom: Kconfig: select dmic for sdm845

sdm845 uses dmic on EC so it should select CROS_EC_CODEC.

Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsl_spdif: fix sysclk_df type
Viorel Suman [Mon, 18 Feb 2019 15:25:00 +0000 (15:25 +0000)]
ASoC: fsl_spdif: fix sysclk_df type

According to RM SPDIF STC SYSCLK_DF field is 9-bit wide, values
being in 0..511 range. Use a proper type to handle sysclk_df.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsl_spdif: fix TXCLK_DF mask
Viorel Suman [Mon, 18 Feb 2019 14:12:17 +0000 (14:12 +0000)]
ASoC: fsl_spdif: fix TXCLK_DF mask

According to RM SPDIF TXCLK_DF mask is 7-bit wide.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: codecs: ad193x: Add support to disable on-chip PLL
Codrin Ciubotariu [Mon, 18 Feb 2019 16:10:36 +0000 (16:10 +0000)]
ASoC: codecs: ad193x: Add support to disable on-chip PLL

The on-chip PLL can be disabled if on the MCLKI pin we have an external
clock at 512 x fs. This clock can be used as direct internal clock for
ADCs or DACs.
To support this, we add an extra clock id that can be configured
using the set_sysclk() callback.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: codecs: ad193x: Add runtime support for DSP_A and I2S modes
Codrin Ciubotariu [Mon, 18 Feb 2019 16:10:34 +0000 (16:10 +0000)]
ASoC: codecs: ad193x: Add runtime support for DSP_A and I2S modes

The driver only supports DPS_A for DAC, which is configured at probe.
This patch adds support for DSP_A and I2S modes by using the set_fmt()
callback.

A trivial break is also removed from a case's default branch.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: codecs: ad193x: Fix frame polarity for DSP_A format
Codrin Ciubotariu [Mon, 18 Feb 2019 16:10:32 +0000 (16:10 +0000)]
ASoC: codecs: ad193x: Fix frame polarity for DSP_A format

By default, the codec starts to interpret the left (first) channel on
the falling edge (low polarity) of LRCLK. However, for DSP_A, the left
channel needs to start on the rising edge of LRCLK. This patch fixes
this channel swap by toggling the bit which selects the LRCLK polarity.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: codecs: ad193x: Set constraint to always have 32 sample bits
Codrin Ciubotariu [Mon, 18 Feb 2019 16:10:30 +0000 (16:10 +0000)]
ASoC: codecs: ad193x: Set constraint to always have 32 sample bits

DACs and ADCs on ad193x codecs require a 32 bit slot size. We should
assure that no other size is used.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: codecs: ad193x: Remove capture support for codecs without ADC
Codrin Ciubotariu [Mon, 18 Feb 2019 16:10:28 +0000 (16:10 +0000)]
ASoC: codecs: ad193x: Remove capture support for codecs without ADC

Some ad193x codecs don't have ADCs, so they have no capture capabilities.
This way, we can use this driver in multicodec cards.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsi: fix spelling mistake "doens't" -> "doesn't"
Colin Ian King [Sun, 17 Feb 2019 22:48:30 +0000 (22:48 +0000)]
ASoC: fsi: fix spelling mistake "doens't" -> "doesn't"

There is a spelling mistake in a dev_err message. Fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Prevent potential NULL platform data dereference
Sylwester Nawrocki [Thu, 14 Feb 2019 15:58:40 +0000 (16:58 +0100)]
ASoC: samsung: i2s: Prevent potential NULL platform data dereference

When np is NULL i2s_pdata could also be NULL but i2s_pdata is now being
dereferenced without proper check. Fix this and shorten the error message
so we don't exceed 80 characters limit.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: dmaengine: Remove unused SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag
Sylwester Nawrocki [Thu, 14 Feb 2019 15:45:55 +0000 (16:45 +0100)]
ASoC: dmaengine: Remove unused SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag

There is now no users of this flag so remove it together with
related code.  The chan_name field of snd_dmaengine_dai_dma_data
data structure is not removed as it is still in use by the PXA
platform.

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: da7219: Update TDM usage to be more flexible
Adam Thomson [Thu, 14 Feb 2019 10:13:30 +0000 (10:13 +0000)]
ASoC: da7219: Update TDM usage to be more flexible

The previous implementatation was restrictive with regards to
BCLK rates for slave mode where the driver would not allow rates
the codec couldn't provide itself as clock master. The codec
is able to automatically determine and handle whatever rate is
provided so this restriction isn't necessary for slave mode. The
code was also flawed with regards to setting of the frame offset
as using rx_mask to explicitly set the offset has the knock on
effect of impacting the min and max channels for the codec, in
soc_pcm_hw_params() through the call to
soc_pcm_codec_params_fixup().

With this update, the driver now only limits frame size if codec
is clock master, and dynamically determines the BCLK offset
relating to WCLK using the tx_mask for slot offset along with the
slot width provided.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: da7219: Add support for master mode BCLK rate adjustment
Adam Thomson [Thu, 14 Feb 2019 10:13:29 +0000 (10:13 +0000)]
ASoC: da7219: Add support for master mode BCLK rate adjustment

Previously the driver would default the BCLK periods per WCLK to
64, to cover all possible non-TDM scenarios when the codec was
DAI clock master. However some devices require a lower BCLK rate
to operate correctly so with this in mind, this commit updates
the code to be more dynamic, with BCLK rate now based on SR and
word length provided to hw_params().

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Convert to SPDX License Indentifier
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:47 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Convert to SPDX License Indentifier

Replace GPL v2.0 license statements with SPDX license identifier.

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: i2s: Comments clean up
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:46 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Comments clean up

Spelling error fixes, upper/lower case letter changes.

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: i2s: Change indentation in SAMSUNG_I2S_FMTS definition
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:45 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Change indentation in SAMSUNG_I2S_FMTS definition

Change indentation so this macro definition spans 2 rows and looks
more consistent with surrounding code.

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: i2s: Simplify pri_dai, sec_dai pointers usage
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:44 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Simplify pri_dai, sec_dai pointers usage

If the probe call is on the primary DAI we can use 'other' in place of
i2s->sec_dai, if the probe call is on the secondary DAI we can use 'i2s'
in place of other->sec_dai.

While at it fix one whitespace issue.

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: stm32: sai: add missing put_device()
Wen Yang [Sat, 9 Feb 2019 10:41:09 +0000 (10:41 +0000)]
ASoC: stm32: sai: add missing put_device()

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

Fixes: 7dd0d835582f ("ASoC: stm32: sai: simplify sync modes management")
Signed-off-by: Wen Yang <yellowriver2010@hotmail.com>
Acked-by: Olivier Moysan <olivier.moysan@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: Specify DMA channel names through custom DMA config
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:41 +0000 (10:37 +0100)]
ASoC: samsung: Specify DMA channel names through custom DMA config

This is a part of conversion of Samsung platforms to use the custom DMA
config for specifying DMA channel names, in addition to passing custom
DMA device for the secondary CPU DAI's "PCM" component for some variants
of the I2S controller.

We also don't set the SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME any more
as setting it wouldn't allow to specify DMA channels through the custom
DMA config.

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: odroid: Add support for secondary CPU DAI
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:40 +0000 (10:37 +0100)]
ASoC: samsung: odroid: Add support for secondary CPU DAI

This patch adds DPCM links in order to support the secondary I2S interface.
For the secondary PCM interface to be actually available one more entry
should be added to the sound-dai property in sound/cpu node in DT.
The changes in driver are done in a way so we are backwards compatible
with existing DTS/DTB, i.e. if the cpu sound-dai property contains only
one entry only one PCM will be registered.

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: i2s: Get rid of a static spinlock
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:39 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Get rid of a static spinlock

This patch makes the spinlock serializing access to the primary/secondary
PCM a per I2S controller lock, rather than a global one. There is no need
to have a global lock across multiple I2S controllers in the SoC.

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: i2s: Move quirks data to common driver data structure
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:38 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Move quirks data to common driver data structure

The quirk flags are common for the primary and the secondary DAI
so move respective field from struct i2s_dai to common driver data
structure.

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: i2s: Move IP variant data to common driver data structure
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:37 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Move IP variant data to common driver data structure

The IP variant data is another thing common for both DAIs, move it
to the driver's common data structure.

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: i2s: Drop spinlock pointer from i2s_dai data structure
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:36 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Drop spinlock pointer from i2s_dai data structure

As we now have the 'priv' pointer in most of the places we can use
priv->lock directly, dropping extra indirection in the SFR region
spinlock access.

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: i2s: Move SFR pointer to common driver data structure
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:35 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Move SFR pointer to common driver data structure

The SFR region is common for both DAIs so move related data structure
field from struct i2s_dai to the common driver data structure.

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: cros_ec_codec: Make symbol 'cros_ec_dai' static
Wei Yongjun [Wed, 13 Feb 2019 06:29:56 +0000 (06:29 +0000)]
ASoC: cros_ec_codec: Make symbol 'cros_ec_dai' static

Fixes the following sparse warning:

sound/soc/codecs/cros_ec_codec.c:209:27: warning:
 symbol 'cros_ec_dai' was not declared. Should it be static?

Fixes: b291f42a3718 ("ASoC: cros_ec_codec: Add codec driver for Cros EC")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: mediatek: mt8183: make some functions static
Wei Yongjun [Wed, 13 Feb 2019 06:29:44 +0000 (06:29 +0000)]
ASoC: mediatek: mt8183: make some functions static

Fixes the following sparse warnings:

sound/soc/mediatek/mt8183/mt8183-dai-i2s.c:966:5: warning:
 symbol 'mt8183_dai_i2s_get_share' was not declared. Should it be static?
sound/soc/mediatek/mt8183/mt8183-dai-i2s.c:986:5: warning:
 symbol 'mt8183_dai_i2s_set_priv' was not declared. Should it be static?

Fixes: a94aec035a12 ("ASoC: mediatek: mt8183: add platform driver")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: cs35l36: Remove unused including <linux/version.h>
YueHaibing [Wed, 13 Feb 2019 01:43:32 +0000 (01:43 +0000)]
ASoC: cs35l36: Remove unused including <linux/version.h>

Remove including <linux/version.h> that don't need it.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Move registers cache to common driver data structure
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:27 +0000 (19:03 +0100)]
ASoC: samsung: i2s: Move registers cache to common driver data structure

There is no need to keep the PM suspend/resume register cache separate
for each DAI as those registers are common, move related i2s_dai data
structure to the driver's common data structure.  This will allow us
to simplify the code a little eventually and to make it easier to follow.

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: i2s: Move opclk data to common driver data structure
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:26 +0000 (19:03 +0100)]
ASoC: samsung: i2s: Move opclk data to common driver data structure

The clock for generating I2S signals is also common for both CPU DAIs
so move it to the driver's common data structure.

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: i2s: Move core clk to the driver common data structure
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:25 +0000 (19:03 +0100)]
ASoC: samsung: i2s: Move core clk to the driver common data structure

The core clock is also common for both CPU DAIs so move it to
the driver's private data structure.

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: i2s: Add widgets and routes for DPCM support
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:24 +0000 (19:03 +0100)]
ASoC: samsung: i2s: Add widgets and routes for DPCM support

This patch adds DAPM widgets required to model the internal mixer
of the I2S controller merging audio streams from the primary and
from the secondary PCM interface.

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: i2s: Move clk supplier data to common driver data structure
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:23 +0000 (19:03 +0100)]
ASoC: samsung: i2s: Move clk supplier data to common driver data structure

Having the clocks provider data in struct samsung_i2s_priv, i.e. per the I2S
controller instance, rather than per CPU DAI better models the hardware and
simplifies the code a little. The clock provider is common for both DAIs.

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 agoMerge branch 'for-5.0' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie...
Mark Brown [Wed, 13 Feb 2019 11:45:08 +0000 (11:45 +0000)]
Merge branch 'for-5.0' of https://git./linux/kernel/git/broonie/sound into asoc-5.1

5 years agoASoC: samsung: i2s: Restore support for the secondary PCM
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:22 +0000 (19:03 +0100)]
ASoC: samsung: i2s: Restore support for the secondary PCM

This patch introduces again registration of additional platform device as
we still need it for registering the secondary dmaengine PCM component.

This patch in most part is a revert of changes done in commit
be2c92eb64023e ("ASoC: samsung: i2s: Remove virtual device for secondary 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: soc-acpi: remove new_mach_data field
Pierre-Louis Bossart [Fri, 8 Feb 2019 23:45:57 +0000 (17:45 -0600)]
ASoC: soc-acpi: remove new_mach_data field

We never used this field (or in older SOF implementations), let's
remove it

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-acpi: remove asoc_plat_name field
Pierre-Louis Bossart [Fri, 8 Feb 2019 23:45:56 +0000 (17:45 -0600)]
ASoC: soc-acpi: remove asoc_plat_name field

This field was never used, let's remove it

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: soc-acpi: cnl-match.c: remove asoc_plat_name field
Pierre-Louis Bossart [Fri, 8 Feb 2019 23:45:55 +0000 (17:45 -0600)]
ASoC: Intel: soc-acpi: cnl-match.c: remove asoc_plat_name field

This field was never used, let's remove it

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: soc-acpi: icl-match: remove asoc_plat_name field
Pierre-Louis Bossart [Fri, 8 Feb 2019 23:45:54 +0000 (17:45 -0600)]
ASoC: Intel: soc-acpi: icl-match: remove asoc_plat_name field

This field was never used, let's remove it

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: soc-acpi: hsw-bdw-match: remove asoc_plat_name field
Pierre-Louis Bossart [Fri, 8 Feb 2019 23:45:53 +0000 (17:45 -0600)]
ASoC: Intel: soc-acpi: hsw-bdw-match: remove asoc_plat_name field

This field was never used, let's remove it

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: soc-acpi: glk-match: remove asoc_plat_name field
Pierre-Louis Bossart [Fri, 8 Feb 2019 23:45:52 +0000 (17:45 -0600)]
ASoC: Intel: soc-acpi: glk-match: remove asoc_plat_name field

This field was never used, let's remove it

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

This field was never used, let's remove it

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

This field was never used, let's remove it

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

This field was never used, let's remove it

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: icl-match: remove prefix for SOF files
Pierre-Louis Bossart [Fri, 8 Feb 2019 23:45:48 +0000 (17:45 -0600)]
ASoC: Intel: icl-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: hsw-bdw-match: remove prefix for SOF files
Pierre-Louis Bossart [Fri, 8 Feb 2019 23:45:47 +0000 (17:45 -0600)]
ASoC: Intel: hsw-bdw-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: hda-match: remove prefix for SOF files
Pierre-Louis Bossart [Fri, 8 Feb 2019 23:45:46 +0000 (17:45 -0600)]
ASoC: Intel: hda-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: glk-match: remove prefix for SOF files
Pierre-Louis Bossart [Fri, 8 Feb 2019 23:45:45 +0000 (17:45 -0600)]
ASoC: Intel: glk-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: 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: samsung: i2s: Fix prescaler setting for the secondary DAI
Sylwester Nawrocki [Thu, 7 Feb 2019 17:00:12 +0000 (18:00 +0100)]
ASoC: samsung: i2s: Fix prescaler setting for the secondary DAI

Make sure i2s->rclk_srcrate is properly initialized also during
playback through the secondary 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: 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>