platform/kernel/linux-starfive.git
4 years agoASoC: Intel: catpt: PCM operations
Cezary Rojewski [Tue, 29 Sep 2020 14:12:39 +0000 (16:12 +0200)]
ASoC: Intel: catpt: PCM operations

DSP designed for Lynxpoint and Wildcat Point offers no dynamic topology
i.e. all pipelines are already defined within firmware and host is
relegated to allocing stream for predefined pins. This is represented by
'catpt_topology' member.

Implementation covers all available pin types:
- system playback and capture
- two offload streams
- loopback (reference)
- bluetooth playback and capture

PCM DAI operations differentiate between those pins as some (mainly
offload) are to be handled differently - DSP expects wp updates on each
notify_position notification.

System playback has no volume control capability as it is routed to
mixer stream directly. Other primary streams - capture and two offloads
- offer individual volume controls.

Compared to sound/soc/intel/haswell this configures SSP device format
automatically on pcm creation.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-7-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: catpt: Firmware loading and context restore
Cezary Rojewski [Tue, 29 Sep 2020 14:12:38 +0000 (16:12 +0200)]
ASoC: Intel: catpt: Firmware loading and context restore

For Lynxpoint and Wildcat Point solution, is it host's responsibility to
allocate SRAM regions and ensure those already taken are not overwritten
with other data until released. Blocks are transferred to SRAM - either
IRAM or DRAM - via DW DMA controller. Once basefw is booted, ownership
of DMA transfer is lost in favour of DSP.

Hosts reponsibilities don't end on initial block allocation and binary
transfer. During Dx transitions host must store FW runtime context from
DRAM before putting AudioDSP subsystem into lower power state. Said
context gets flashed after D0 entry to bring DSP right where it was just
before suspending.

Load and restore procedures are finalized with SRAM power gating and
adequate clock level selection. This power gates unused EBBs and clock
speed effectively reducing power consumption.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-6-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: catpt: Define DSP operations
Cezary Rojewski [Tue, 29 Sep 2020 14:12:37 +0000 (16:12 +0200)]
ASoC: Intel: catpt: Define DSP operations

Implement dsp lifecycle functions such as core RESET and STALL,
SRAM power control and LP clock selection. This also adds functions for
handling transport over DW DMA controller.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-5-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: catpt: Add IPC message handlers
Cezary Rojewski [Tue, 29 Sep 2020 14:12:36 +0000 (16:12 +0200)]
ASoC: Intel: catpt: Add IPC message handlers

Declare global and stream IPC message handlers for all known message
types.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-4-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: catpt: Implement IPC protocol
Cezary Rojewski [Tue, 29 Sep 2020 14:12:35 +0000 (16:12 +0200)]
ASoC: Intel: catpt: Implement IPC protocol

Implement IRQ handlers for immediate and delayed replies and
notifications. Communication is synchronous and allows for serialization
of maximum one message at a time.

DSP may respond with ADSP_PENDING status for a request - known as
delayed reply - and when situation occurs, framework keeps the lock and
awaits upcoming response through IPCD channel which is handled in
bottom-half. Immediate replies spawn no BH at all as their processing is
very short.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: Add catpt base members
Cezary Rojewski [Tue, 29 Sep 2020 14:12:34 +0000 (16:12 +0200)]
ASoC: Intel: Add catpt base members

Declare base structures, registers and extension routines for the catpt
solution.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agospi: pxa2xx: Add SSC2 and SSPSP2 SSP registers
Cezary Rojewski [Tue, 25 Aug 2020 20:17:43 +0000 (22:17 +0200)]
spi: pxa2xx: Add SSC2 and SSPSP2 SSP registers

Update list of SSP registers with SSC2 and SSPSP2. These registers are
utilized by LPT/WPT AudioDSP architecture.

While SSC2 shares the same offset (0x40) as SSACDD, description of this
register for SSP device present on mentioned AudioDSP is different so
define separate constant to avoid any ambiguity.

Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200825201743.4926-1-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: fsl_spdif: Fix unnecessary check in fsl_spdif_probe()
Tang Bin [Wed, 26 Aug 2020 15:09:18 +0000 (23:09 +0800)]
ASoC: fsl_spdif: Fix unnecessary check in fsl_spdif_probe()

The function fsl_spdif_probe() is only called with an openfirmware
platform device. Therefore there is no need to check that the passed
in device is NULL.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Link: https://lore.kernel.org/r/20200826150918.16116-1-tangbin@cmss.chinamobile.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Remove unused 'linux,hdmi-audio'
Rob Herring [Wed, 26 Aug 2020 18:48:49 +0000 (12:48 -0600)]
ASoC: Remove unused 'linux,hdmi-audio'

The binding was added in 2013 and has had no driver since 2015.

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20200826184851.3431531-1-robh@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-pcm: add missing ret=0 at soc_pcm_open()
Kuninori Morimoto [Thu, 1 Oct 2020 05:07:41 +0000 (14:07 +0900)]
ASoC: soc-pcm: add missing ret=0 at soc_pcm_open()

commit 140a4532cdb8c ("ASoC: soc-pcm: add soc_pcm_clean() and call it
from soc_pcm_open/close()") switched to use soc_pcm_clean() at
soc_pcm_open().

But it removed "return 0", and missing "ret = 0",
because of it, it always return -EINVAL eventhough no error.
This patch adds missing "ret = 0" for success case.

Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/87ft6ya65z.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-pcm: ignore un-needed mutex_unlock() case on soc_pcm_open()
Kuninori Morimoto [Thu, 1 Oct 2020 01:32:48 +0000 (10:32 +0900)]
ASoC: soc-pcm: ignore un-needed mutex_unlock() case on soc_pcm_open()

commit 140a4532cdb8c ("ASoC: soc-pcm: add soc_pcm_clean() and call it
from soc_pcm_open/close()") switch to call soc_pcm_clean() on
soc_pcm_open() when rollback case.

But, it uses "goto err" (A) *before* mutex_lock() (B) when error of
snd_soc_pcm_component_pm_runtime_get().
The mutex_unlock() (C) is not needed in such case. This patch fix it.

static int soc_pcm_open(...)
{
...
ret = snd_soc_pcm_component_pm_runtime_get(rtd, substream);
if (ret < 0)
(A) goto err;

(B) mutex_lock_nested(...);
...
err:
(C) mutex_unlock(..);
...
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k0waag44.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tegra: trimslice.c: use devm_snd_soc_register_card()
Qinglang Miao [Tue, 29 Sep 2020 11:29:39 +0000 (19:29 +0800)]
ASoC: tegra: trimslice.c: use devm_snd_soc_register_card()

Using devm_snd_soc_register_card() can make the code
shorter and cleaner.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20200929112939.47661-1-miaoqinglang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: fsl: mx27vis-aic32x4: use devm_snd_soc_register_card()
Qinglang Miao [Tue, 29 Sep 2020 11:29:32 +0000 (19:29 +0800)]
ASoC: fsl: mx27vis-aic32x4: use devm_snd_soc_register_card()

Using devm_snd_soc_register_card() can make the code
shorter and cleaner.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20200929112932.46926-1-miaoqinglang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tegra: tegra_rt5640: use devm_snd_soc_register_card()
Qinglang Miao [Tue, 29 Sep 2020 11:29:36 +0000 (19:29 +0800)]
ASoC: tegra: tegra_rt5640: use devm_snd_soc_register_card()

Using devm_snd_soc_register_card() can make the code
shorter and cleaner.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20200929112936.47441-1-miaoqinglang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: ti: omap-mcbsp: use devm_platform_ioremap_resource_byname
Zhang Qilong [Tue, 22 Sep 2020 01:51:23 +0000 (09:51 +0800)]
ASoC: ti: omap-mcbsp: use devm_platform_ioremap_resource_byname

Use the devm_platform_ioremap_resource_byname() helper instead of
calling platform_get_resource_byname() and devm_ioremap_resource()
separately.

Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20200922015123.117489-1-zhangqilong3@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tegra: tegra_wm8753: use devm_snd_soc_register_card()
Qinglang Miao [Tue, 29 Sep 2020 11:29:38 +0000 (19:29 +0800)]
ASoC: tegra: tegra_wm8753: use devm_snd_soc_register_card()

Using devm_snd_soc_register_card() can make the code
shorter and cleaner.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20200929112938.47599-1-miaoqinglang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tegra: tegra_max98090: use devm_snd_soc_register_card()
Qinglang Miao [Tue, 29 Sep 2020 11:29:35 +0000 (19:29 +0800)]
ASoC: tegra: tegra_max98090: use devm_snd_soc_register_card()

Using devm_snd_soc_register_card() can make the code
shorter and cleaner.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20200929112935.47035-1-miaoqinglang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: fsl: imx-mc13783: use devm_snd_soc_register_card()
Qinglang Miao [Tue, 29 Sep 2020 11:29:30 +0000 (19:29 +0800)]
ASoC: fsl: imx-mc13783: use devm_snd_soc_register_card()

Using devm_snd_soc_register_card() can make the code
shorter and cleaner.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20200929112930.46848-1-miaoqinglang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: atmel-pcm: remove unnecessary include
Alexandre Belloni [Wed, 30 Sep 2020 14:53:30 +0000 (16:53 +0200)]
ASoC: atmel-pcm: remove unnecessary include

Since commit 95e0e07e710e ("ASoC: atmel-pcm: use generic dmaengine
framework"), the driver is using dmaengine and is not using any definition
from include/linux/platform_data/dma-atmel.h, stop including it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20200930145330.3043528-1-alexandre.belloni@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agospi: atmel: remove unnecessary include
Alexandre Belloni [Wed, 30 Sep 2020 14:53:52 +0000 (16:53 +0200)]
spi: atmel: remove unnecessary include

Since commit d5fab59cab18 ("spi: atmel: trivial: remove unused fields in
DMA structure"), the driver is not using any definitions from
linux/platform_data/dma-atmel.h, stop including it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20200930145353.3043699-1-alexandre.belloni@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-core: use devm_snd_soc_register_card()
Qinglang Miao [Tue, 29 Sep 2020 11:29:33 +0000 (19:29 +0800)]
ASoC: soc-core: use devm_snd_soc_register_card()

Using devm_snd_soc_register_card() can make the code
shorter and cleaner.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20200929112933.46977-1-miaoqinglang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoMerge series "ASoC: merge soc_pcm_open() rollback and soc_pcm_close()" from Kuninori...
Mark Brown [Mon, 28 Sep 2020 19:53:10 +0000 (20:53 +0100)]
Merge series "ASoC: merge soc_pcm_open() rollback and soc_pcm_close()" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

Hi Mark

1 month past and nothing happened.
This is resend of v2 patch-set.

soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().

static int soc_pcm_open(xxx)
{
...
if (ret < 0)
goto xxx_err;
...
return 0;

 ^ config_err:
 | ...
 | rtd_startup_err:
(A) ...
 | component_err:
 | ...
 v return ret;
}

This kind of duplicated code can be a hotbed of bugs,
thus, this patch-set share soc_pcm_close() and rollback.

v1 -> v2
- indicate more detail background/logic on git-log

Link: https://lore.kernel.org/r/87wo2oku0m.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87wo1kvozz.wl-kuninori.morimoto.gx@renesas.com
Kuninori Morimoto (7):
  ASoC: soc-dai: add mark for snd_soc_dai_startup/shutdown()
  ASoC: soc-link: add mark for snd_soc_link_startup/shutdown()
  ASoC: soc-component: add mark for soc_pcm_components_open/close()
  ASoC: soc-component: add mark for
    snd_soc_pcm_component_pm_runtime_get/put()
  ASoC: soc-pcm: add soc_pcm_clean() and call it from
    soc_pcm_open/close()
  ASoC: soc-pcm: remove unneeded dev_err() for snd_soc_dai_startup()
  ASoC: soc-pcm: remove unneeded dev_err() for
    snd_soc_component_module/open()

 include/sound/soc-component.h |  28 +++++---
 include/sound/soc-dai.h       |   5 +-
 include/sound/soc-link.h      |   3 +-
 include/sound/soc.h           |   3 +
 sound/soc/soc-component.c     |  73 ++++++++++++++++++++-
 sound/soc/soc-compress.c      |  30 +++------
 sound/soc/soc-dai.c           |  21 +++++-
 sound/soc/soc-dapm.c          |   4 +-
 sound/soc/soc-link.c          |  21 +++++-
 sound/soc/soc-pcm.c           | 120 ++++++++++++----------------------
 10 files changed, 190 insertions(+), 118 deletions(-)

--
2.25.1

4 years agoASoC: lpass-platform: use devm_regmap_field_bulk_alloc
Srinivas Kandagatla [Fri, 25 Sep 2020 16:48:56 +0000 (17:48 +0100)]
ASoC: lpass-platform: use devm_regmap_field_bulk_alloc

use new devm_regmap_field_bulk_alloc to allocate fields as
it make the code more readable!

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
Link: https://lore.kernel.org/r/20200925164856.10315-3-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoMerge tag 'regmap-field-bulk-api' of https://git.kernel.org/pub/scm/linux/kernel...
Mark Brown [Mon, 28 Sep 2020 19:51:29 +0000 (20:51 +0100)]
Merge tag 'regmap-field-bulk-api' of https://git./linux/kernel/git/broonie/regmap into asoc-5.10

regmap: Add a bulk field API

Useful for devices with many fields.

4 years agoregmap: add support to regmap_field_bulk_alloc/free apis
Srinivas Kandagatla [Fri, 25 Sep 2020 16:48:55 +0000 (17:48 +0100)]
regmap: add support to regmap_field_bulk_alloc/free apis

Usage of regmap_field_alloc becomes much overhead when number of fields
exceed more than 3.
QCOM LPASS driver has extensively converted to use regmap_fields.

Using new bulk api to allocate fields makes it much more cleaner code to read!

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
Link: https://lore.kernel.org/r/20200925164856.10315-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: cs4234: Add support for Cirrus Logic CS4234 codec
Lucas Tanure [Mon, 28 Sep 2020 11:18:21 +0000 (12:18 +0100)]
ASoC: cs4234: Add support for Cirrus Logic CS4234 codec

The CS4234 is a highly versatile CODEC that combines 4 channels of
high performance analog to digital conversion, 4 channels of high
performance digital to analog conversion for audio, and 1 channel of
digital to analog conversion to provide a nondelayed audio reference
signal to an external Class H tracking power supply.

DAC5 is only supported as a 5th audio channel. Tracking Power Supply
mode is not currently supported by the driver.

In DSP_A mode the slots for DAC1-4 and optionally DAC5 can be set.
The codec always claims 4 slots for DAC1-4 and these must be in the
same nibble of the mask. The codec has a fixed mapping for ADC slots.

In I2S/LJ modes the codec has a fixed mapping for DAC1-4 and ADC1-4.
DAC5 is not available in these modes.

The MCLK source must be preset to a valid frequency before probe()
because it must be running all the time the codec is out of reset.

The VA_SEL bit will be set automatically to 3.3v or 5v during probe()
based on the reported voltage of the regulator supplying VA.

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200928111821.26967-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: cs4234: Add dtschema binding document
Charles Keepax [Mon, 28 Sep 2020 11:18:20 +0000 (12:18 +0100)]
ASoC: cs4234: Add dtschema binding document

Document the bindings for the CS4234 ASoC codec driver.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200928111821.26967-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rt5682: Enable the power of "MICBIAS" and "Vref2" for the DMIC clock
Oder Chiou [Mon, 28 Sep 2020 05:39:12 +0000 (13:39 +0800)]
ASoC: rt5682: Enable the power of "MICBIAS" and "Vref2" for the DMIC clock

The power of "MICBIAS" and "Vref2" was needed while the DMIC clcok was from
the PLL output.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Link: https://lore.kernel.org/r/20200928053912.16664-1-oder_chiou@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: ti: j721e-evm: Fix compiler warning when CONFIG_OF=n
Peter Ujfalusi [Mon, 28 Sep 2020 07:43:30 +0000 (10:43 +0300)]
ASoC: ti: j721e-evm: Fix compiler warning when CONFIG_OF=n

Remove the use of of_match_ptr() macro for of_match_table to fix compiler
warning when CONFIG_OF=n:

sound/soc/ti/j721e-evm.c:528:34: warning: unused variable 'j721e_audio_of_match' [-Wunused-const-variable]

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20200928074330.13029-1-peter.ujfalusi@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rt715: Add power-up delay to fix dmic pop sound issue.
Jack Yu [Fri, 25 Sep 2020 21:05:09 +0000 (16:05 -0500)]
ASoC: rt715: Add power-up delay to fix dmic pop sound issue.

Add 400ms power-up delay recommended to fix pop noise on capture.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Jack Yu <jack.yu@realtek.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200925210509.83353-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: dt-bindings: sgtl5000: Add common clock properties
Krzysztof Kozlowski [Fri, 25 Sep 2020 21:27:19 +0000 (23:27 +0200)]
ASoC: dt-bindings: sgtl5000: Add common clock properties

Add common properties appearing in DTSes (assigned-clocks and similar)
to fix dtbs_check warnings like:

  arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dt.yaml: audio-codec@a:
    'assigned-clock-parents', 'assigned-clock-rates', 'assigned-clocks' do not match any of the regexes: 'pinctrl-[0-9]+'

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20200925212719.23286-1-krzk@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-pcm: remove unneeded dev_err() for snd_soc_component_module/open()
Kuninori Morimoto [Mon, 28 Sep 2020 00:01:36 +0000 (09:01 +0900)]
ASoC: soc-pcm: remove unneeded dev_err() for snd_soc_component_module/open()

snd_soc_component_module_get(), snd_soc_component_open() itself will
indicate error message, thus, soc_pcm_components_open() don't need to
handle it.
This patch removes these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87d026bwms.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-pcm: remove unneeded dev_err() for snd_soc_dai_startup()
Kuninori Morimoto [Mon, 28 Sep 2020 00:01:29 +0000 (09:01 +0900)]
ASoC: soc-pcm: remove unneeded dev_err() for snd_soc_dai_startup()

snd_soc_dai_startup() itself will indicate error message,
thus, soc_pcm_open() don't need to handle it.
This patch removes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87eemmbwmy.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-pcm: add soc_pcm_clean() and call it from soc_pcm_open/close()
Kuninori Morimoto [Mon, 28 Sep 2020 00:01:24 +0000 (09:01 +0900)]
ASoC: soc-pcm: add soc_pcm_clean() and call it from soc_pcm_open/close()

soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().

static int soc_pcm_open(xxx)
{
...
if (ret < 0)
goto xxx_err;
...
return 0;

 ^ config_err:
 | ...
 | rtd_startup_err:
(A) ...
 | component_err:
 | ...
 v return ret;
}

The difference is
soc_pcm_close() is for all dai/component/substream,
rollback        is for succeeded part only.

This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_close() and rollback.

Now, soc_pcm_open/close() are handling
1) snd_soc_dai_startup/shutdown()
2) snd_soc_link_startup/shutdown()
3) snd_soc_component_module_get/put()
4) snd_soc_component_open/close()
5) pm_runtime_put/get()

Now, 1) to 5) are handled.
This patch adds new soc_pcm_clean() and call it from
soc_pcm_open() as rollback, and from soc_pcm_close() as
normal close handler.

One note here is that it don't need to call snd_soc_runtime_deactivate()
when rollback case, because it will be called without
snd_soc_runtime_activate().
It also don't need to call snd_soc_dapm_stream_stop() when rollback case.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ft72bwn4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-component: add mark for snd_soc_pcm_component_pm_runtime_get/put()
Kuninori Morimoto [Mon, 28 Sep 2020 00:01:17 +0000 (09:01 +0900)]
ASoC: soc-component: add mark for snd_soc_pcm_component_pm_runtime_get/put()

soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().

static int soc_pcm_open(xxx)
{
...
if (ret < 0)
goto xxx_err;
...
return 0;

 ^ config_err:
 | ...
 | rtd_startup_err:
(A) ...
 | component_err:
 | ...
 v return ret;
}

The difference is
soc_pcm_close() is for all dai/component/substream,
rollback        is for succeeded part only.

This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_close() and rollback.

Now, soc_pcm_open/close() are handling
1) snd_soc_dai_startup/shutdown()
2) snd_soc_link_startup/shutdown()
3) snd_soc_component_module_get/put()
4) snd_soc_component_open/close()
=> 5) pm_runtime_put/get()

This patch is for 5) pm_runtime_put/get().

The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.

To avoid such case, this patch marks substream pointer when get() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.

One note here is that it cares *current* get() only now.
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h7ribwnb.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-component: add mark for soc_pcm_components_open/close()
Kuninori Morimoto [Mon, 28 Sep 2020 00:01:04 +0000 (09:01 +0900)]
ASoC: soc-component: add mark for soc_pcm_components_open/close()

soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().

static int soc_pcm_open(xxx)
{
...
if (ret < 0)
goto xxx_err;
...
return 0;

 ^ config_err:
 | ...
 | rtd_startup_err:
(A) ...
 | component_err:
 | ...
 v return ret;
}

The difference is
soc_pcm_close() is for all dai/component/substream,
rollback        is for succeeded part only.

This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_close() and rollback.

Now, soc_pcm_open/close() are handling
1) snd_soc_dai_startup/shutdown()
2) snd_soc_link_startup/shutdown()
=> 3) snd_soc_component_module_get/put()
=> 4) snd_soc_component_open/close()
5) pm_runtime_put/get()

This patch is for 3) snd_soc_component_module_get/put()
4) snd_soc_component_open/close().

The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.

To avoid such case, this patch marks substream pointer when open() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.

One note here is that it cares *current* open() only now.
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imbybwno.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-link: add mark for snd_soc_link_startup/shutdown()
Kuninori Morimoto [Mon, 28 Sep 2020 00:00:57 +0000 (09:00 +0900)]
ASoC: soc-link: add mark for snd_soc_link_startup/shutdown()

soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().

static int soc_pcm_open(xxx)
{
...
if (ret < 0)
goto xxx_err;
...
return 0;

 ^ config_err:
 | ...
 | rtd_startup_err:
(A) ...
 | component_err:
 | ...
 v return ret;
}

The difference is
soc_pcm_close() is for all dai/component/substream,
rollback        is for succeeded part only.

This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_close() and rollback.

Now, soc_pcm_open/close() are handling
1) snd_soc_dai_startup/shutdown()
=> 2) snd_soc_link_startup/shutdown()
3) snd_soc_component_module_get/put()
4) snd_soc_component_open/close()
5) pm_runtime_put/get()

This patch is for 2) snd_soc_link_startup/shutdown().

The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.

To avoid such case, this patch marks substream pointer when startup() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.

One note here is that it cares *current* startup() only now.
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k0webwnv.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-dai: add mark for snd_soc_dai_startup/shutdown()
Kuninori Morimoto [Mon, 28 Sep 2020 00:00:40 +0000 (09:00 +0900)]
ASoC: soc-dai: add mark for snd_soc_dai_startup/shutdown()

soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().

static int soc_pcm_open(xxx)
{
...
if (ret < 0)
goto xxx_err;
...
return 0;

 ^ config_err:
 | ...
 | rtd_startup_err:
(A) ...
 | component_err:
 | ...
 v return ret;
}

The difference is
soc_pcm_close() is for all dai/component/substream,
rollback        is for succeeded part only.

This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_close() and rollback.

Now, soc_pcm_open/close() are handling
=> 1) snd_soc_dai_startup/shutdown()
2) snd_soc_link_startup/shutdown()
3) snd_soc_component_module_get/put()
4) snd_soc_component_open/close()
5) pm_runtime_put/get()

This patch is for 1) snd_soc_dai_startup/shutdown().

The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.

To avoid such case, this patch marks substream pointer when startup() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.

One note here is that it cares *current* startup() only now.
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87lfgubwoc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: q6afe-clocks: Fix typo in SPDX Licence
Srinivas Kandagatla [Sat, 26 Sep 2020 17:18:44 +0000 (18:18 +0100)]
ASoC: q6afe-clocks: Fix typo in SPDX Licence

Looks like there was a major typo in SPDX Licence version,
Not sure how it was missed.
This patch is to fix it.

Reported-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20200926171844.7792-1-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoMerge series "Enable runtime PM for SOF device" from Daniel Baluta <daniel.baluta...
Mark Brown [Fri, 25 Sep 2020 19:58:05 +0000 (20:58 +0100)]
Merge series "Enable runtime PM for SOF device" from Daniel Baluta <daniel.baluta@oss.nxp.com>
Daniel Baluta <daniel.baluta@nxp.com>:

From: Daniel Baluta <daniel.baluta@nxp.com>

This enables runtime PM for SOF device. Next patchseries will
provide PM suspend/resume handlers for i.MX8 specific devices.

Daniel Baluta (2):
  ASoC: SOF: Activate runtime PM with SOF OF device
  ASoC: SOF: Add .prepare/.complete callbacks

 sound/soc/sof/sof-of-dev.c | 6 ++++++
 1 file changed, 6 insertions(+)

--
2.17.1

4 years agoMerge series "ASoC: qdsp6: fix some warnings when build without CONFIG_OF" from Srini...
Mark Brown [Fri, 25 Sep 2020 19:50:41 +0000 (20:50 +0100)]
Merge series "ASoC: qdsp6: fix some warnings when build without CONFIG_OF" from Srinivas Kandagatla <srinivas.kandagatla@linaro.org>:

Here are fixes for two warnings types discovered while building qdsp6 drivers
without CONFIG_OF and with W=1

One of them was reported by Intel kernel test robot on q6afe-clocks patch, which
equally applies to rest of the qdsp6 drivers.

changes since v1:
- added ifdef CONFIG_OF instead of removing of_match_ptr

Srinivas Kandagatla (2):
  ASoC: qdsp6: add ifdef CONFIG_OF around of_device_id
  ASoC: q6asm: fix kernel doc warnings

 sound/soc/qcom/qdsp6/q6adm.c        | 2 ++
 sound/soc/qcom/qdsp6/q6afe-clocks.c | 2 ++
 sound/soc/qcom/qdsp6/q6afe-dai.c    | 2 ++
 sound/soc/qcom/qdsp6/q6afe.c        | 2 ++
 sound/soc/qcom/qdsp6/q6asm-dai.c    | 2 ++
 sound/soc/qcom/qdsp6/q6asm.c        | 6 ++++++
 sound/soc/qcom/qdsp6/q6core.c       | 2 ++
 sound/soc/qcom/qdsp6/q6routing.c    | 2 ++
 8 files changed, 20 insertions(+)

--
2.21.0

4 years agoASoC: qcom: lpass-cpu: Enable MI2S BCLK and LRCLK together
V Sujith Kumar Reddy [Fri, 18 Sep 2020 16:54:33 +0000 (22:24 +0530)]
ASoC: qcom: lpass-cpu: Enable MI2S BCLK and LRCLK together

Update lpass-cpu.c to enable I2S BCLK and LRCLK together.
Remove BCLK enable in lpass_cpu_daiops_startup and
add in lpass_cpu_daiops_trigger API.

Signed-off-by: V Sujith Kumar Reddy <vsujithk@codeaurora.org>
Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
Link: https://lore.kernel.org/r/1600448073-6709-1-git-send-email-srivasam@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: fsl: imx-audmix: Use devm_kcalloc() instead of devm_kzalloc()
Xu Wang [Mon, 21 Sep 2020 01:59:18 +0000 (01:59 +0000)]
ASoC: fsl: imx-audmix: Use devm_kcalloc() instead of devm_kzalloc()

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "devm_kcalloc".

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
Link: https://lore.kernel.org/r/20200921015918.24157-1-vulab@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agodt-bindings: tas2770: Mark ti,asi-format to deprecated
Dan Murphy [Thu, 24 Sep 2020 14:26:41 +0000 (09:26 -0500)]
dt-bindings: tas2770: Mark ti,asi-format to deprecated

Mark the property ti,asi-format to deprecated as it is no longer
supported.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200924142641.12355-1-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Add .prepare/.complete callbacks
Daniel Baluta [Thu, 24 Sep 2020 15:15:18 +0000 (18:15 +0300)]
ASoC: SOF: Add .prepare/.complete callbacks

Use SOF defined callbacks (snd_sof_prepare/snd_sof_complete)
in order to update internal SOF system suspend target.

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20200924151518.15841-3-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Activate runtime PM with SOF OF device
Daniel Baluta [Thu, 24 Sep 2020 15:15:17 +0000 (18:15 +0300)]
ASoC: SOF: Activate runtime PM with SOF OF device

SOF boots the DSP at probe and keeps it up all the time.
With this change, after booting if no one is using the DSP
the SOF core will turn off the DSP to save power.

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20200924151518.15841-2-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: q6asm: fix kernel doc warnings
Srinivas Kandagatla [Fri, 25 Sep 2020 16:35:52 +0000 (17:35 +0100)]
ASoC: q6asm: fix kernel doc warnings

This patch fixes below kernel doc warnings on not describing all the parmeters

sound/soc/qcom/qdsp6/q6asm.c:927: warning: Function parameter or member
 'stream_id' not described in 'q6asm_open_write'
sound/soc/qcom/qdsp6/q6asm.c:927: warning: Function parameter or member
 'is_gapless' not described in 'q6asm_open_write'
sound/soc/qcom/qdsp6/q6asm.c:1053: warning: Function parameter or member
 'stream_id' not described in 'q6asm_run'

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20200925163552.20717-3-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: qdsp6: add ifdef CONFIG_OF around of_device_id
Srinivas Kandagatla [Fri, 25 Sep 2020 16:35:51 +0000 (17:35 +0100)]
ASoC: qdsp6: add ifdef CONFIG_OF around of_device_id

Add ifdef CONFIG_OF around of_device_id table to fix below
W=1 compile test warning with !CONFIG_OF:

sound/soc/qcom/qdsp6/q6afe-clocks.c:254:34: warning: unused variable
 'q6afe_clock_device_id' [-Wunused-const-variable]

Fix this warning for across all qdsp6 drivers.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20200925163552.20717-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoMerge series "ASoC: Intel: sdw machine driver updates for 5.10" from Kai Vehmanen...
Mark Brown [Wed, 23 Sep 2020 17:48:04 +0000 (18:48 +0100)]
Merge series "ASoC: Intel: sdw machine driver updates for 5.10" from Kai Vehmanen <kai.vehmanen@linux.intel.com>:

Series including fixes and improvements for Intel SoundWire
machine drivers.

Bard Liao (1):
  ASoC: Intel: add support for new SoundWire hardware layout on TGL

Pierre-Louis Bossart (4):
  ASoC: Intel: sof_sdw: remove ternary operator
  ASoC: Intel: add codec name prefix to ACPI machine description
  ASoC: Intel: sof_sdw: remove hard-coded codec_conf table
  ASoC: Intel: sof_sdw_rt700: add codec prefix

Rander Wang (1):
  ASOC: Intel: sof_sdw: restore playback functionality with max98373
    amps

 include/sound/soc-acpi.h                      |   2 +
 sound/soc/intel/boards/sof_sdw.c              | 170 +++++++++---------
 sound/soc/intel/boards/sof_sdw_common.h       |   3 +
 sound/soc/intel/boards/sof_sdw_max98373.c     |  36 +++-
 sound/soc/intel/boards/sof_sdw_rt700.c        |   6 +-
 .../intel/common/soc-acpi-intel-cml-match.c   |  10 ++
 .../intel/common/soc-acpi-intel-cnl-match.c   |   1 +
 .../intel/common/soc-acpi-intel-icl-match.c   |   6 +
 .../intel/common/soc-acpi-intel-tgl-match.c   |  67 +++++++
 9 files changed, 216 insertions(+), 85 deletions(-)

--
2.27.0

4 years agoASoC: tas2770: Remove unused variables
Dan Murphy [Wed, 23 Sep 2020 13:26:00 +0000 (08:26 -0500)]
ASoC: tas2770: Remove unused variables

Remove unused variables in the private struct and the code as these
variables are initially set and then there is no additional code
utilizing these variables.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200923132600.10652-6-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tas2770: Remove ti,asi-format code
Dan Murphy [Wed, 23 Sep 2020 13:25:59 +0000 (08:25 -0500)]
ASoC: tas2770: Remove ti,asi-format code

Remove the code to support the asi-format binding property. The code
does nothing except read the property and set a variable. No additional
action is taken except to reset the variable. The property is supposed
to set the rising or falling RX edge detection of the SBCLK but this
edge detection is done by checking the DAI_FMT_INV_MASK.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200923132600.10652-5-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tas2770: Set regcache when shutting down and waking device
Dan Murphy [Wed, 23 Sep 2020 13:25:57 +0000 (08:25 -0500)]
ASoC: tas2770: Set regcache when shutting down and waking device

Set the regcache to cache data and mark cache as dirty when the device
is shutdown when suspend is called. When the device is woken up then
sync the cache and set to not caching the data.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200923132600.10652-3-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tas2770: Add shutdown capability via a GPIO
Dan Murphy [Wed, 23 Sep 2020 13:25:56 +0000 (08:25 -0500)]
ASoC: tas2770: Add shutdown capability via a GPIO

Add the hardware shutdown mechanism to shutdown and wake up the device
via a GPIO.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200923132600.10652-2-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agodt-bindings: tas2770: Add shutdown gpio property
Dan Murphy [Wed, 23 Sep 2020 13:25:55 +0000 (08:25 -0500)]
dt-bindings: tas2770: Add shutdown gpio property

Add the shutdown-gpios property to the yaml to define the GPIO that can
be used to place the device in shutdown mode or wake the device up.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200923132600.10652-1-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: hda_dsp_common: use static function in conditional block
Pierre-Louis Bossart [Wed, 23 Sep 2020 07:29:39 +0000 (10:29 +0300)]
ASoC: Intel: hda_dsp_common: use static function in conditional block

cppcheck reports the following warning:

sound/soc/intel/boards/hda_dsp_common.c:17:0: style: The function
'hda_dsp_hdmi_pcm_handle' is never used. [unusedFunction]

Fix by moving to static inside compilation block.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Jaska Uimonen <jaska.uimonen@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200923072939.3100468-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASOC: Intel: sof_sdw: restore playback functionality with max98373 amps
Rander Wang [Wed, 23 Sep 2020 08:05:09 +0000 (11:05 +0300)]
ASOC: Intel: sof_sdw: restore playback functionality with max98373 amps

The Max98373 amplifier provides I/V feedback information, which keeps
a DAPM path active even when there is no playback happening. This
prevents entry in low-power mode. Rather than adding new controls and
require UCM/user interaction, the method previously applied is to
enable/disable the Speaker pin during the dailink trigger operations.

Recent changes in the SoundWire stream management moved the stream
trigger to the dailink trigger. This change removed the Maxim-specific
pin handling and resulted in a regression. This patch restores
functionality by combining the SoundWire stream trigger with the pin
enable/disable.

Fixes: ae3a3918edf57 ('ASoC: Intel: sof_sdw: add dailink .trigger callback')
Fixes: 06998d49bcac8 ('ASoC: Intel: sof_sdw: add dailink .prepare and .hw_free callback')
Signed-off-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200923080514.3242858-2-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: add support for new SoundWire hardware layout on TGL
Bard Liao [Wed, 23 Sep 2020 08:05:14 +0000 (11:05 +0300)]
ASoC: Intel: add support for new SoundWire hardware layout on TGL

The creativity of hardware folks is endless, with a complete
permutation of rt711 (was link0 now link1), rt1308 (was link1 now
link2) and rt715 (was link3 now link0).

Someday we will get all this information from platform firmware, for
now let's add the mapping table.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200923080514.3242858-7-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: sof_sdw_rt700: add codec prefix
Pierre-Louis Bossart [Wed, 23 Sep 2020 08:05:13 +0000 (11:05 +0300)]
ASoC: Intel: sof_sdw_rt700: add codec prefix

Somehow for this codec we never used any prefix for the controls,
likely because the test platform has a single SoundWire device.

Follow the convention and use the codec prefix across the board to
avoid possible conflicts.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200923080514.3242858-6-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: sof_sdw: remove hard-coded codec_conf table
Pierre-Louis Bossart [Wed, 23 Sep 2020 08:05:12 +0000 (11:05 +0300)]
ASoC: Intel: sof_sdw: remove hard-coded codec_conf table

Now that the ACPI machine params provide all the information needed,
allocate the card codec_conf dynamically and set .dlc and
.prefix_name.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200923080514.3242858-5-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: add codec name prefix to ACPI machine description
Pierre-Louis Bossart [Wed, 23 Sep 2020 08:05:11 +0000 (11:05 +0300)]
ASoC: Intel: add codec name prefix to ACPI machine description

The current SOF machine driver adds a name prefix for each codec,
mainly to differentiate ALSA controls for left and right amplifiers.

This is a good idea, but the machine driver duplicates some of the
information that already exists in ACPI descriptors, so add those
prefixes there. Follow-up patches will make use of the information
encoded in these tables and remove duplication.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200923080514.3242858-4-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: sof_sdw: remove ternary operator
Pierre-Louis Bossart [Wed, 23 Sep 2020 08:05:10 +0000 (11:05 +0300)]
ASoC: Intel: sof_sdw: remove ternary operator

cppcheck reports the following warning:

sound/soc/intel/boards/sof_sdw.c:866:46: style: Clarify calculation
precedence for '&' and '?'. [clarifyCalculation]
 hdmi_num = sof_sdw_quirk & SOF_SDW_TGL_HDMI ?
                                             ^

There's no reason to use the ternary operator here, we might as well
use a regular if-else construct.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Jaska Uimonen <jaska.uimonen@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200923080514.3242858-3-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: cros_ec_codec: fix kconfig dependency warning for SND_SOC_CROS_EC_CODEC
Necip Fazil Yildiran [Thu, 17 Sep 2020 14:18:04 +0000 (17:18 +0300)]
ASoC: cros_ec_codec: fix kconfig dependency warning for SND_SOC_CROS_EC_CODEC

When SND_SOC_CROS_EC_CODEC is enabled and CRYPTO is disabled, it results
in the following Kbuild warning:

WARNING: unmet direct dependencies detected for CRYPTO_LIB_SHA256
  Depends on [n]: CRYPTO [=n]
  Selected by [y]:
  - SND_SOC_CROS_EC_CODEC [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && CROS_EC [=y]

The reason is that SND_SOC_CROS_EC_CODEC selects CRYPTO_LIB_SHA256 without
depending on or selecting CRYPTO while CRYPTO_LIB_SHA256 is subordinate to
CRYPTO.

Honor the kconfig menu hierarchy to remove kconfig dependency warnings.

Fixes: 93fa0af4790a ("ASoC: cros_ec_codec: switch to library API for SHA-256")
Signed-off-by: Necip Fazil Yildiran <fazilyildiran@gmail.com>
Link: https://lore.kernel.org/r/20200917141803.92889-1-fazilyildiran@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tas2562: Remove duplicate code for I/V sense
Dan Murphy [Tue, 22 Sep 2020 14:24:11 +0000 (09:24 -0500)]
ASoC: tas2562: Remove duplicate code for I/V sense

Remove duplicate code for programming the I/V sense the call to update
the register was duplicated in commit 09ed395b05feb ("ASoC: tas2562:
Add voltage sense slot configuration").

Fixes: 09ed395b05feb ("ASoC: tas2562: Add voltage sense slot configuration")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200922142411.10364-1-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: hdmi-codec: Use set_jack ops to set jack
Cheng-Yi Chiang [Tue, 22 Sep 2020 06:23:16 +0000 (14:23 +0800)]
ASoC: hdmi-codec: Use set_jack ops to set jack

Use set_jack ops to set jack so machine drivers do not need to include
hdmi-codec.h explicitly.

Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20200922062316.1172935-1-cychiang@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoMerge series "ASoC: SOF: fix kcontrol size checks" from Kai Vehmanen <kai.vehmanen...
Mark Brown [Mon, 21 Sep 2020 22:57:25 +0000 (23:57 +0100)]
Merge series "ASoC: SOF: fix kcontrol size checks" from Kai Vehmanen <kai.vehmanen@linux.intel.com>:

Series that fixes checks for 'size' in kcontrol get/put ext_bytes methods
for SOF. The gaps in these checks were discovered via cppcheck warnings
on unused variable values.

Pierre-Louis Bossart (5):
  ASoC: SOF: control: fix size checks for ext_bytes control .get()
  ASoC: SOF: control: fix size checks for volatile ext_bytes control
    .get()
  ASoC: SOF: control: add size checks for ext_bytes control .put()
  ASoC: SOF: control: remove const in sizeof()
  ASoC: SOF: topology: remove const in sizeof()

 sound/soc/sof/control.c  | 53 +++++++++++++++++++++++++++++++---------
 sound/soc/sof/topology.c |  2 +-
 2 files changed, 43 insertions(+), 12 deletions(-)

--
2.27.0

4 years agoASoC: hdac: make SOF HDA codec driver probe deterministic
Kai Vehmanen [Mon, 21 Sep 2020 10:08:41 +0000 (13:08 +0300)]
ASoC: hdac: make SOF HDA codec driver probe deterministic

To provide backward compatibility to older systems, the SOF HDA driver
allows user to specify which HDMI codec driver to use at runtime via
kernel parameter. This mechanism has a subtle flaw in that it assumes
the codec drivers not to be loaded when the SOF PCI driver is loaded.

The problem is rooted in use of the hdev->type field.
snd_hdac_ext_bus_device_init() initializes this field to HDA_DEV_ASOC.
This signals the HDA core that ASoC drivers should be considered in
driver matching (hda_bus_match()). The SOF and SST drivers continue by
overriding this field to HDA_DEV_LEGACY and proceeding to load driver
modules with request_module(). Correct drivers will get loaded and
attached.

If however the codec drivers are already loaded when
snd_hdac_ext_bus_device_init() is called, the matching will not work as
expected as device type is still set to HDA_DEV_ASOC. Specifically if
hdac-hdmi is attached when machine driver is configured to use hdac-hda,
this leads to out-of-bounds memory access in
hda_dsp_hdmi_build_controls().

Fix the issue by adding codec type as a parameter to
snd_hdac_ext_bus_device_init() and ensuring type is set correctly from
the start.

Fixes: 139c7febad1a ("ASoC: SOF: Intel: add support for snd-hda-codec-hdmi")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200921100841.2882662-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tas2770: Refactor sample rate function
Dan Murphy [Fri, 18 Sep 2020 19:05:48 +0000 (14:05 -0500)]
ASoC: tas2770: Refactor sample rate function

Refactor the tas2770_set_samplerate to simplify the code and access the
I2C bus only once per rate request. The ramp rate and sample rate bits
are contained in the same register so a single call to the
snd_soc_update_bits function is all that is needed

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-9-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tas2770: Fix the spacing and new lines
Dan Murphy [Fri, 18 Sep 2020 19:05:47 +0000 (14:05 -0500)]
ASoC: tas2770: Fix the spacing and new lines

Fix up the spacing for argument alignment and add new lines to separate
code. Eliminate unneccessary goto statements when the error code could
just be returned.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-8-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tas2770: Convert bit mask to GENMASK in header
Dan Murphy [Fri, 18 Sep 2020 19:05:45 +0000 (14:05 -0500)]
ASoC: tas2770: Convert bit mask to GENMASK in header

Update the hardcoded masks with the GENMASK macro. Also update some of
the hardcoded bits with the BIT macro

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-6-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tas2770: Fix unbalanced calls to pm_runtime
Dan Murphy [Fri, 18 Sep 2020 19:05:44 +0000 (14:05 -0500)]
ASoC: tas2770: Fix unbalanced calls to pm_runtime

Fix the unbalanced call to the pm_runtime_disable when removing the
module.  pm_runtime_enable is not called nor is the pm_runtime setup in
the code.  Remove the i2c_remove function and the pm_runtime_disable.

Fixes: 1a476abc723e6 ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-5-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agodt-bindings: tas2770: Fix I2C addresses for the TAS2770
Dan Murphy [Fri, 18 Sep 2020 19:05:42 +0000 (14:05 -0500)]
dt-bindings: tas2770: Fix I2C addresses for the TAS2770

The I2C addresses listed in the yaml are not correct. The addresses can
range from 0x41 through 0x48 based on register configurations. Fix the
example and the description.

Fixes: 4b7151dadfd4 ("dt-bindings: ASoC: Add tas2770 smart PA dt bindings")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-3-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tas2562: Add the TAS2110 class-D amplifier
Dan Murphy [Mon, 21 Sep 2020 15:38:20 +0000 (10:38 -0500)]
ASoC: tas2562: Add the TAS2110 class-D amplifier

Add the TAS2110 amplifier to the TAS2562 driver. The TAS2110 is register
and bitmap compatible. The chips differ in that the TAS2110 does not
have the I/V Sense feedback path. Since these features do not exist the
device needs to be registered without these controls.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200921153820.18357-2-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agodt-bindings: tas2562: Add the TAS2110 amplifier
Dan Murphy [Mon, 21 Sep 2020 15:38:19 +0000 (10:38 -0500)]
dt-bindings: tas2562: Add the TAS2110 amplifier

Add the TAS2110 amplifier compatible.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200921153820.18357-1-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: control: add size checks for ext_bytes control .put()
Pierre-Louis Bossart [Mon, 21 Sep 2020 11:08:12 +0000 (14:08 +0300)]
ASoC: SOF: control: add size checks for ext_bytes control .put()

Make sure the TLV header and size are consistent before copying from
userspace.

Fixes: c3078f5397046 ('ASoC: SOF: Add Sound Open Firmware KControl support')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200921110814.2910477-4-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: control: fix size checks for volatile ext_bytes control .get()
Pierre-Louis Bossart [Mon, 21 Sep 2020 11:08:11 +0000 (14:08 +0300)]
ASoC: SOF: control: fix size checks for volatile ext_bytes control .get()

Mirror addition of checks for regular ext_bytes controls.

Fixes: 783560d02dd61 ('ASoC: SOF: Implement snd_sof_bytes_ext_volatile_get kcontrol IO')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200921110814.2910477-3-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: control: fix size checks for ext_bytes control .get()
Pierre-Louis Bossart [Mon, 21 Sep 2020 11:08:10 +0000 (14:08 +0300)]
ASoC: SOF: control: fix size checks for ext_bytes control .get()

cppcheck complains twice:

sound/soc/sof/control.c:436:2: style: Assignment of function parameter
has no effect outside the function. [uselessAssignmentArg]
 size -= sizeof(const struct snd_ctl_tlv);
 ^

sound/soc/sof/control.c:436:7: style: Variable 'size' is assigned a
value that is never used. [unreadVariable]
 size -= sizeof(const struct snd_ctl_tlv);

Somehow we dropped the checks for the size argument when upstreaming
the code, somewhere between v5 and v6.

Re-add a size check to avoid providing userspace with more data that
it asked for.

Also fix all error codes, we should return -ENOSPC instead of -EINVAL.

Fixes: c3078f5397046 ('ASoC: SOF: Add Sound Open Firmware KControl support')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200921110814.2910477-2-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoMerge branch 'asoc-5.9' into asoc-5.10
Mark Brown [Mon, 21 Sep 2020 21:37:14 +0000 (22:37 +0100)]
Merge branch 'asoc-5.9' into asoc-5.10

4 years agoASoC: tlv320aic32x4: Enable fast charge
Miquel Raynal [Fri, 11 Sep 2020 17:31:40 +0000 (19:31 +0200)]
ASoC: tlv320aic32x4: Enable fast charge

At power-up the analog circuits may take up to one full second before
being charged with the default configuration. Using the analog blocks
before they are ready generates a *very* crappy sound.

Enable the fast charge feature, which will require a bit more power
than normal charge but will definitely speed up the starting operation
by shrinking this delay to up to 40 ms.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20200911173140.29984-4-miquel.raynal@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tlv320aic32x4: Fix bdiv clock rate derivation
Miquel Raynal [Fri, 11 Sep 2020 17:31:39 +0000 (19:31 +0200)]
ASoC: tlv320aic32x4: Fix bdiv clock rate derivation

Current code expects a single channel to be always used. Fix this
situation by forwarding the number of channels used. Then fix the
derivation of the bdiv clock rate.

Fixes: 96c3bb00239d ("ASoC: tlv320aic32x4: Dynamically Determine Clocking")
Suggested-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20200911173140.29984-3-miquel.raynal@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tlv320aic32x4: Ensure a minimum delay before clock stabilization
Miquel Raynal [Fri, 11 Sep 2020 17:31:38 +0000 (19:31 +0200)]
ASoC: tlv320aic32x4: Ensure a minimum delay before clock stabilization

As indicated in the datasheet, a 10ms delay must be observed after
programming the divisors.

The lack of delay prevents the codec to work properly and the playback
appears extremely slow and totally un-audible on a custom sama5 based
board.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20200911173140.29984-2-miquel.raynal@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rt711: wait for the delayed work to finish when the system suspends
Shuming Fan [Mon, 21 Sep 2020 09:43:08 +0000 (17:43 +0800)]
ASoC: rt711: wait for the delayed work to finish when the system suspends

To avoid the IO error, we need to cancel the delayed work and wait for it to finish.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200921094308.31921-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tas2770: Fix error handling with update_bits
Dan Murphy [Fri, 18 Sep 2020 19:05:46 +0000 (14:05 -0500)]
ASoC: tas2770: Fix error handling with update_bits

snd_soc_update_bits returns a 1 when the bit was successfully updated,
returns a 0 is no update was needed and a negative if the call failed.
The code is currently failing the case of a successful update by just
checking for a non-zero number. Modify these checks and return the error
code only if there is a negative.

Fixes: 1a476abc723e6 ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-7-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tas2770: Fix required DT properties in the code
Dan Murphy [Fri, 18 Sep 2020 19:05:43 +0000 (14:05 -0500)]
ASoC: tas2770: Fix required DT properties in the code

The devicetree binding indicates that the ti,asi-format, ti,imon-slot-no
and ti,vmon-slot-no are not required but the driver requires them or it
fails to probe. Honor the binding and allow these entries to be optional
and set the corresponding values to the default values for each as defined
in the data sheet.

Fixes: 1a476abc723e6 ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-4-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tas2770: Add missing bias level power states
Dan Murphy [Fri, 18 Sep 2020 19:05:41 +0000 (14:05 -0500)]
ASoC: tas2770: Add missing bias level power states

Add the BIAS_STANDBY and BIAS_PREPARE to the set_bias_level or else the
driver will return -EINVAL which is not correct as they are valid
states.

Fixes: 1a476abc723e6 ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-2-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tas2770: Fix calling reset in probe
Dan Murphy [Fri, 18 Sep 2020 19:05:40 +0000 (14:05 -0500)]
ASoC: tas2770: Fix calling reset in probe

tas2770_reset is called during i2c probe. The reset calls the
snd_soc_component_write which depends on the tas2770->component being
available. The component pointer is not set until codec_probe so move
the reset to the codec_probe after the pointer is set.

Fixes: 1a476abc723e6 ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-1-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rt700: wait for the delayed work to finish when the system suspends
Shuming Fan [Mon, 21 Sep 2020 09:42:44 +0000 (17:42 +0800)]
ASoC: rt700: wait for the delayed work to finish when the system suspends

To avoid the IO error, we need to cancel the delayed work and wait for it to finish.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200921094244.31869-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tas2562: Add the TAS2564 compatible
Dan Murphy [Fri, 18 Sep 2020 15:01:30 +0000 (10:01 -0500)]
ASoC: tas2562: Add the TAS2564 compatible

Add the TAS2564 as a supported amplifier.  This amplifier is register,
bitmap and feature compatible to the TAS2562.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918150130.21015-2-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agodt-bindings: tas2562: Add TAS2564 to binding
Dan Murphy [Fri, 18 Sep 2020 15:01:29 +0000 (10:01 -0500)]
dt-bindings: tas2562: Add TAS2564 to binding

Add the TAS2564 compatible and data sheet link to the binding.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918150130.21015-1-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: imx: add missing MODULE_LICENSE() for imx-common
Kai Vehmanen [Mon, 21 Sep 2020 10:47:46 +0000 (13:47 +0300)]
ASoC: SOF: imx: add missing MODULE_LICENSE() for imx-common

Fix build warning:
WARNING: modpost: missing MODULE_LICENSE() in sound/soc/sof/imx/imx-common.o

Fixes: 18ebffe4d043 ("ASoC: SOF: imx: Add debug support for imx platforms")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200921104746.2903507-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: pm: Fix prepare callback behavior for OF usecase
Daniel Baluta [Mon, 21 Sep 2020 10:50:38 +0000 (13:50 +0300)]
ASoC: SOF: pm: Fix prepare callback behavior for OF usecase

On i.MX platforms PM is not managed via ACPI although CONFIG_ACPI
can be set. So, in order to correctly set the system target state
we introduce a flag for platforms that require to use acpi target
states.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200921105038.2909899-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: cs42l51: add additional ADC volume controls
Guillermo Rodríguez [Fri, 18 Sep 2020 13:43:16 +0000 (15:43 +0200)]
ASoC: cs42l51: add additional ADC volume controls

Add volume controls for:
- Analog programmable gain amplifier (PGA) (-3 .. +12 dB)
- ADC attenuator (0 .. -96 dB)

Signed-off-by: Guillermo Rodríguez <guille.rodriguez@gmail.com>
Acked-by: David Rhodes <David.rhodes@cirrus.com>
Link: https://lore.kernel.org/r/20200918134317.22574-1-guille.rodriguez@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: topology: fix the process being scheduled on core0 always
Keyon Jie [Mon, 21 Sep 2020 10:45:44 +0000 (13:45 +0300)]
ASoC: SOF: topology: fix the process being scheduled on core0 always

In commit 783898ce68de ("ASoC: SOF: append extended data to
sof_ipc_comp_process") the process components are set to run on the
fixed core 0, this break us from scheduling components on any other DSP
core.

Since we can get the DSP core index from swidget->core, it is duplicated
to pass the extra 'core' argument for those sof_widget_load_xx()
functions.

Here removes the duplicate 'core' argument and get component core from
swidget->core directly to fix the issue mentioned above.

Fixes: 783898ce68de ("ASoC: SOF: append extended data to sof_ipc_comp_process")
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Reviewed-by: Jaska Uimonen <jaska.uimonen@intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200921104544.2897112-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tlv320adcx140: Add support for configuring GPIO pin
Camel Guo [Fri, 18 Sep 2020 11:40:25 +0000 (13:40 +0200)]
ASoC: tlv320adcx140: Add support for configuring GPIO pin

Add support to configure the GPIO pin to the specific configuration.
The GPIO pin can be configured as GPO, IRQ, SDOUT2, PDMCLK, MICBASE_EN,
GPI, MCLK, SDIN, PDMDIN1, PDMDIN2, PDMDIN3 or PDMDIN4 and the output
drive can be configured with various configuration.

Signed-off-by: Camel Guo <camelg@axis.com>
Link: https://lore.kernel.org/r/20200918114025.18205-2-camel.guo@axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agodt-bindings: tlv320adcx140: Add GPIO config and drive config
Camel Guo [Fri, 18 Sep 2020 11:40:24 +0000 (13:40 +0200)]
dt-bindings: tlv320adcx140: Add GPIO config and drive config

Add properties for configuring the General Purpose Input Output (GPIO).
There are 2 settings for GPIO, configuration and the output drive type.

Signed-off-by: Camel Guo <camelg@axis.com>
Acked-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918114025.18205-1-camel.guo@axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoMerge series "ASoC: fsl_sai: update the register list" from Shengjiu Wang <shengjiu...
Mark Brown [Thu, 17 Sep 2020 16:40:16 +0000 (17:40 +0100)]
Merge series "ASoC: fsl_sai: update the register list" from Shengjiu Wang <shengjiu.wang@nxp.com>:

As sai ip is upgraded, so update sai register list.

Shengjiu Wang (3):
  ASoC: fsl_sai: Add new added registers and new bit definition
  ASoC: fsl_sai: Add fsl_sai_check_version function
  ASoC: fsl_sai: Set MCLK input or output direction

changes in v2:
- update commit message for first commit
- Add acked-by Nicolin

 sound/soc/fsl/fsl_sai.c | 77 ++++++++++++++++++++++++++++++++++++
 sound/soc/fsl/fsl_sai.h | 87 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 164 insertions(+)

--
2.27.0

4 years agoMerge series "ASoC: SOF: small fixes for 5.10" from Kai Vehmanen <kai.vehmanen@linux...
Mark Brown [Thu, 17 Sep 2020 16:40:15 +0000 (17:40 +0100)]
Merge series "ASoC: SOF: small fixes for 5.10" from Kai Vehmanen <kai.vehmanen@linux.intel.com>:

Series that adds debug support for IMX platforms, more details to
FW version information, adds missing -EACCESS handling to
pm_runtime_get_sync() calls and a set of minor cosmetic, trace
verbosity and coding style issues.

Guennadi Liakhovetski (3):
  ASoC: SOF: (cosmetic) remove redundant "ret" variable uses
  ASoC: SOF: remove several superfluous type-casts
  ASoC: SOF: fix range checks

Iulian Olaru (1):
  ASoC: SOF: imx: Add debug support for imx platforms

Karol Trzcinski (1):
  ASoC: SOF: Add `src_hash` to `sof_ipc_fw_version` structure

Pierre-Louis Bossart (3):
  ASoC: SOF: debug: update test for pm_runtime_get_sync()
  ASoC: SOF: control: update test for pm_runtime_get_sync()
  ASoC: SOF: Intel: hda: reduce verbosity of boot error logs

 include/sound/sof/info.h         |  4 +-
 sound/soc/sof/control.c          | 62 +++++++++++++--------------
 sound/soc/sof/debug.c            |  2 +-
 sound/soc/sof/imx/Kconfig        |  8 ++++
 sound/soc/sof/imx/Makefile       |  3 ++
 sound/soc/sof/imx/imx-common.c   | 72 ++++++++++++++++++++++++++++++++
 sound/soc/sof/imx/imx-common.h   | 16 +++++++
 sound/soc/sof/imx/imx8.c         | 23 +++++++++-
 sound/soc/sof/imx/imx8m.c        | 17 +++++++-
 sound/soc/sof/intel/hda-loader.c | 16 +++----
 sound/soc/sof/intel/hda.c        | 12 ++++--
 sound/soc/sof/intel/hda.h        |  2 +
 sound/soc/sof/sof-audio.c        |  6 +--
 sound/soc/sof/sof-priv.h         |  8 ++++
 sound/soc/sof/topology.c         | 44 ++++++++++---------
 15 files changed, 226 insertions(+), 69 deletions(-)
 create mode 100644 sound/soc/sof/imx/imx-common.c
 create mode 100644 sound/soc/sof/imx/imx-common.h

--
2.27.0

4 years agoMerge series "ASoC: q6afe: add clocks support" from Srinivas Kandagatla <srinivas...
Mark Brown [Thu, 17 Sep 2020 16:40:14 +0000 (17:40 +0100)]
Merge series "ASoC: q6afe: add clocks support" from Srinivas Kandagatla <srinivas.kandagatla@linaro.org>:

q6afe already exposes clocks using apis, but not as proper
clock controller driver. This patch puts those clocks
in to a proper clock controller so that other drivers that
depend on those clocks can be properly expressed.

Srinivas Kandagatla (2):
  ASoC: q6afe: dt-bindings: add q6afe clock bindings
  ASoC: q6afe-clocks: add q6afe clock controller

 .../devicetree/bindings/sound/qcom,q6afe.txt  |  23 ++
 include/dt-bindings/sound/qcom,q6afe.h        |  74 ++++-
 sound/soc/qcom/Kconfig                        |   4 +
 sound/soc/qcom/qdsp6/Makefile                 |   1 +
 sound/soc/qcom/qdsp6/q6afe-clocks.c           | 270 ++++++++++++++++++
 5 files changed, 371 insertions(+), 1 deletion(-)
 create mode 100644 sound/soc/qcom/qdsp6/q6afe-clocks.c

--
2.21.0

4 years agoASoC: ak4458: Add DSD support for ak4458 and ak4497
Shengjiu Wang [Tue, 15 Sep 2020 13:57:00 +0000 (21:57 +0800)]
ASoC: ak4458: Add DSD support for ak4458 and ak4497

Ak4458 can't support DSD512 format, but ak4497 can, so add
a new enum variable (enum ak4458_type) in ak4458_drvdata to
distinguish these two platforms.

Ak4497 has two kinds of DSD input pin, it can be selected by
the dsd-path property from DT.

In hw_params(), bit clock is calculated according to different
DSD format (DSD64, DSD128, DSD256, DSD512), then registers
are configured.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1600178220-28973-2-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: dt-bindings: ak4458: Add dsd-path property
Shengjiu Wang [Tue, 15 Sep 2020 13:56:59 +0000 (21:56 +0800)]
ASoC: dt-bindings: ak4458: Add dsd-path property

Add "dsd-path" property, which is used for ak4497 codec
to select the DSD input pin.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1600178220-28973-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tlv320adcx140: Add ASI Tx drive
Dan Murphy [Tue, 15 Sep 2020 19:06:03 +0000 (14:06 -0500)]
ASoC: tlv320adcx140: Add ASI Tx drive

Add a property to indicate if the device is to go into a High-z state on
the Tx ASI output pins when the device is idle.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200915190606.1744-3-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>