platform/kernel/linux-starfive.git
5 years agoASoC: SOF: IPC: add ipc dump function
Pan Xiuli [Tue, 30 Apr 2019 23:09:32 +0000 (18:09 -0500)]
ASoC: SOF: IPC: add ipc dump function

Dump IPC status when IPC timed out. IPC status is platform specific and
need bind to plaform.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: intel: hda: add hw_params_upon_resume flag for hda stream
Ranjani Sridharan [Tue, 30 Apr 2019 23:09:31 +0000 (18:09 -0500)]
ASoC: SOF: intel: hda: add hw_params_upon_resume flag for hda stream

The prepare() ioctl for BE dai link gets called both
when the stream is started and when it is resumed from
suspend. SOF uses this ioctl to set the hw params
again only if the stream has been suspended.

When the stream is started, the hw_params ioctl gets called
before prepare() and hw_params is set for the BE dai link.
So the prepare call does not need to do anything further.

When the stream resumes after system suspend, SOF requires
that the hw_params be set again for the BE dai. In order
to determine which streams should set the hw params
during prepare(), an internal flag called "hw_params_upon_resume"
is introduced in struct sof_intel_hda_stream. The flag is set
for hda streams when the sof device suspends and is
cleared after hw_params is set.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: hda-stream: handle real stream interrupts only
Keyon Jie [Tue, 30 Apr 2019 23:09:30 +0000 (18:09 -0500)]
ASoC: SOF: Intel: hda-stream: handle real stream interrupts only

The stream and IPC share the same interrupt. The stream interrupt
handler mistakenly uses the ipc interrupt and return IRQ_HANDLED,
causing the ipc interrupt to be missed.

Make sure the stream interrupt handler only deals with stream-related
interrupts.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: hda-stream: store stream capabilities
Keyon Jie [Tue, 30 Apr 2019 23:09:29 +0000 (18:09 -0500)]
ASoC: SOF: Intel: hda-stream: store stream capabilities

Add stream_max into struct sof_intel_hda_dev to store the total hda
stream number that the platform can support, and initialize it at
stream_init.

This can be used later e.g. for stream bitmask.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: hda-ipc: simplify handling of IPC IRQ
Keyon Jie [Tue, 30 Apr 2019 23:09:28 +0000 (18:09 -0500)]
ASoC: SOF: Intel: hda-ipc: simplify handling of IPC IRQ

When using a shared IRQ between IPC interrupt and stream IOC interrupt,
the interrupt handlers need to check the interrupt source before
scheduling their respective IRQ threads. In the case of IPC handler, it
should check if it is an IPC interrupt before waking up the IPC IRQ
thread.

The IPC IRQ thread, once scheduled, does not need to check the IRQ
source again. So, remove the superfluous check in the thread. Remove the
irq_status field from snd_sof_dev struct also as it is no longer needed.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: ipc: use snd_sof_pcm_period_elapsed
Keyon Jie [Tue, 30 Apr 2019 23:09:27 +0000 (18:09 -0500)]
ASoC: SOF: ipc: use snd_sof_pcm_period_elapsed

Switch to a wrapper function which schedules the actual call of
snd_pcm_period_elapsed after the current IPC is completed.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: use snd_sof_pcm_period_elapsed
Keyon Jie [Tue, 30 Apr 2019 23:09:26 +0000 (18:09 -0500)]
ASoC: SOF: Intel: use snd_sof_pcm_period_elapsed

Switch to a wrapper function which schedules the actual call of
snd_pcm_period_elapsed after the current IPC is completed.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: PCM: add period_elapsed work to fix race condition in interrupt context
Keyon Jie [Tue, 30 Apr 2019 23:09:25 +0000 (18:09 -0500)]
ASoC: SOF: PCM: add period_elapsed work to fix race condition in interrupt context

The IPC implementation in SOF requires sending IPCs serially: we should
not send a new IPC command to the firmware before we get an ACK (or time
out) from firmware, and the IRQ processing is complete.

snd_pcm_period_elapsed() can be called in interrupt context before
IRQ_HANDLED is returned. When the PCM is done draining, a STOP
IPC will then be sent, which breaks the expectation that IPCs are
handled serially and leads to IPC timeouts.

This patch adds a workqueue to defer the call to snd_pcm_elapsed() after
the IRQ is handled.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: hda-pcm: remove useless dependency on hdac_ext
Pierre-Louis Bossart [Tue, 30 Apr 2019 23:09:24 +0000 (18:09 -0500)]
ASoC: SOF: Intel: hda-pcm: remove useless dependency on hdac_ext

Nothing depends on definitions in hdaudio_ext.h, don't include it

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: hda: set bus->idx as 0
Zhu Yingjiang [Tue, 30 Apr 2019 23:09:23 +0000 (18:09 -0500)]
ASoC: SOF: Intel: hda: set bus->idx as 0

Setting the bus->idx as 0, for we only have one HDA
bus atm. This need to be fixed when there are more
than one HDA bus.

Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: hda: set I2S slave before enabling DSP
Zhu Yingjiang [Tue, 30 Apr 2019 23:09:22 +0000 (18:09 -0500)]
ASoC: SOF: Intel: hda: set I2S slave before enabling DSP

By default, the I2S ports are configured in master mode during
DSP powerup sequences, the FS and BCLK lines will be driven on
startup, even when the topology file explicitly requires the
SSP to be slave.

This may be problematic for external components configured in
master mode who don't expect the Intel SOC/PCH to drive. Fix by
configuring the SSP as slave before the SSP outputs are enabled
to avoid this transient behavior.

When the topology file configures the SSP as clock master, the
initial slave configuration will be overridden.

Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: hda: add SSP info to the chip info struct
Zhu Yingjiang [Tue, 30 Apr 2019 23:09:21 +0000 (18:09 -0500)]
ASoC: SOF: Intel: hda: add SSP info to the chip info struct

add SSP info of APL and CNL, to the sof_intel_dsp_desc
structure. The max SSP count the platform support and
the SSP base address.

Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: hda: add the SSP Host Device memory space
Zhu Yingjiang [Tue, 30 Apr 2019 23:09:20 +0000 (18:09 -0500)]
ASoC: SOF: Intel: hda: add the SSP Host Device memory space

The DSP SSP device memory can be conditionally accessed by
the host(depending on access policy).

Add the SSP base memory offset of APL and CNL.

Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: cnl: add pointer ops to use DPIB position
Keyon Jie [Tue, 30 Apr 2019 23:09:19 +0000 (18:09 -0500)]
ASoC: SOF: Intel: cnl: add pointer ops to use DPIB position

Add .pcm_pointer ops for cannonlake to read DPIB/posbuf and get pointer
for ALSA, to align with apollolake.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: topology: add support for stricter ABI checks
Pierre-Louis Bossart [Tue, 30 Apr 2019 23:09:18 +0000 (18:09 -0500)]
ASoC: SOF: topology: add support for stricter ABI checks

Fail early if topology is more recent than kernel and Kconfig is
selected.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASOC: SOF: ipc: add support for stricter ABI checks
Pierre-Louis Bossart [Tue, 30 Apr 2019 23:09:17 +0000 (18:09 -0500)]
ASOC: SOF: ipc: add support for stricter ABI checks

Fail early if firmware is more recent than kernel and Kconfig is
selected.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: add Kconfig option for strict ABI checks
Pierre-Louis Bossart [Tue, 30 Apr 2019 23:09:16 +0000 (18:09 -0500)]
ASoC: SOF: add Kconfig option for strict ABI checks

When the kernel is more recent than firmware files, it will always
behave in backwards-compatible ways.

Add optional behavior to check if the kernel is older than the
firmware files, so that the kernel fails early instead of attempting
to use new functionality it does not support.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: avoid Oops if DMA setup fails
Ross Zwisler [Mon, 29 Apr 2019 18:25:17 +0000 (12:25 -0600)]
ASoC: Intel: avoid Oops if DMA setup fails

Currently in sst_dsp_new() if we get an error return from sst_dma_new()
we just print an error message and then still complete the function
successfully.  This means that we are trying to run without sst->dma
properly set up, which will result in NULL pointer dereference when
sst->dma is later used.  This was happening for me in
sst_dsp_dma_get_channel():

        struct sst_dma *dma = dsp->dma;
...
        dma->ch = dma_request_channel(mask, dma_chan_filter, dsp);

This resulted in:

   BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
   IP: sst_dsp_dma_get_channel+0x4f/0x125 [snd_soc_sst_firmware]

Fix this by adding proper error handling for the case where we fail to
set up DMA.

This change only affects Haswell and Broadwell systems.  Baytrail
systems explicilty opt-out of DMA via sst->pdata->resindex_dma_base
being set to -1.

Signed-off-by: Ross Zwisler <zwisler@google.com>
Cc: stable@vger.kernel.org
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: hdmi-codec: stream is already locked in hw_params
Jerome Brunet [Mon, 29 Apr 2019 13:29:40 +0000 (15:29 +0200)]
ASoC: hdmi-codec: stream is already locked in hw_params

startup() should have run before hw_params() is called, so the
current_substream pointer should already be properly set. There
is no reason to call hdmi_codec_new_stream() again in the
hw_params() callback

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: remove redundant null checks of dai
Colin Ian King [Thu, 2 May 2019 11:33:40 +0000 (12:33 +0100)]
ASoC: SOF: remove redundant null checks of dai

Currently there are two null checks of pointer dai in function
sof_connect_dai_widget and yet there is no null check of dai
at the end of the function when checking !dai->name.  The latter
would be a null pointer deference if dai is null (as picked up
by static analysis), however the function is only ever called
when dai is successfully allocated, so the null checks are
redundant. Clean up the code by removing the null checks.

Addresses-Coverity: ("Dereference after null check")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: da7219: Use clk_round_rate to handle enabled bclk/wclk case
Adam Thomson [Mon, 29 Apr 2019 10:57:33 +0000 (11:57 +0100)]
ASoC: da7219: Use clk_round_rate to handle enabled bclk/wclk case

For some platforms where DA7219 is the DAI clock master, BCLK/WCLK
will be set and enabled prior to the codec's hw_params() function
being called. It is possible the platform requires a different
BCLK configuration than would be chosen by hw_params(), for
example S16_LE format needed with a 64-bit frame to satisfy certain
devices using the clocks.

To handle those kinds of scenarios, the use of clk_round_rate() is
now employed as part of hw_params(). If BCLK is already enabled
then this function will just return the currently set rate, if it
is valid for the desired frame size, so the subsequent call to
clk_set_rate() will succeed and nothing changes with regards to
clocking. In addition the specific BCLK & WCLK recalc_rate()
implementations needed updating to always give back a real value,
as those functions are called as part of the clk init code and a
real value is needed for the clk_round_rate() call to work as
expected.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: rt5645: Headphone Jack sense inverts on the LattePanda board
Hui Wang [Mon, 29 Apr 2019 03:44:07 +0000 (11:44 +0800)]
ASoC: rt5645: Headphone Jack sense inverts on the LattePanda board

The LattePanda board has a sound card chtrt5645, when there is nothing
plugged in the headphone jack, the system thinks the headphone is
plugged in, while we plug a headphone in the jack, the system thinks
the headphone is unplugged.

If adding quirk=0x21 in the module parameter, the headphone jack can
work well. So let us fix it via platform_data.

https://bugs.launchpad.net/bugs/182459
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsl_esai: Fix missing break in switch statement
S.j. Wang [Sun, 28 Apr 2019 02:24:27 +0000 (02:24 +0000)]
ASoC: fsl_esai: Fix missing break in switch statement

case ESAI_HCKT_EXTAL and case ESAI_HCKR_EXTAL should be
independent of each other, so replace fall-through with break.

Fixes: 43d24e76b698 ("ASoC: fsl_esai: Add ESAI CPU DAI driver")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: wm_adsp: Correct region base typo in wm_halo_setup_algs
Charles Keepax [Wed, 1 May 2019 10:13:31 +0000 (11:13 +0100)]
ASoC: wm_adsp: Correct region base typo in wm_halo_setup_algs

Due to a typo the wrong base is being supplied for the primary algorithm
on Halo firmwares, which will cause the controls to not function.

Fixes: 170b1e123f38 ("ASoC: wm_adsp: Add support for new Halo core DSPs")
Reported-by: Stuart Henderson <stuarth@opensource.cirrus.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: fix spelling mistake "incompatble" -> "incompatible"
Colin Ian King [Wed, 1 May 2019 10:23:08 +0000 (11:23 +0100)]
ASoC: SOF: Intel: fix spelling mistake "incompatble" -> "incompatible"

There is a spelling mistake in a hda_dsp_rom_msg message, fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: wm_adsp: Use DSP ops pointers to stop watchdog in error handlers
Charles Keepax [Wed, 1 May 2019 10:13:32 +0000 (11:13 +0100)]
ASoC: wm_adsp: Use DSP ops pointers to stop watchdog in error handlers

Whilst this isn't strictly necessary as the code is already DSP specific
better to use the pointers to avoid potential issues in the future if
one core ends up having multiple methods of stopping the watchdog.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: sprd: Fix to use list_for_each_entry_safe() when delete items
Wei Yongjun [Mon, 29 Apr 2019 12:37:13 +0000 (12:37 +0000)]
ASoC: sprd: Fix to use list_for_each_entry_safe() when delete items

Since we will remove items off the list using list_del() we need
to use a safe version of the list_for_each_entry() macro aptly named
list_for_each_entry_safe().

Fixes: d7bff893e04f ("ASoC: sprd: Add Spreadtrum multi-channel data transfer support")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: sprd: Fix return value check in sprd_mcdt_probe()
Wei Yongjun [Mon, 29 Apr 2019 12:25:12 +0000 (12:25 +0000)]
ASoC: sprd: Fix return value check in sprd_mcdt_probe()

In case of error, the function devm_ioremap_resource() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Fixes: d7bff893e04f ("ASoC: sprd: Add Spreadtrum multi-channel data transfer support")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsl_audmix: cache pdev->dev pointer
Viorel Suman [Wed, 10 Apr 2019 11:06:39 +0000 (11:06 +0000)]
ASoC: fsl_audmix: cache pdev->dev pointer

There should be no trouble to understand dev = pdev->dev.
This can save some space to have more print info or save
some wrapped lines.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Suggested-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tlv320aic32x4: Fix potential uninitialized variable
Annaliese McDermond [Tue, 9 Apr 2019 04:41:59 +0000 (21:41 -0700)]
ASoC: tlv320aic32x4: Fix potential uninitialized variable

Fix compiler warning about uninitialized variable reported by
Stephen Rothwell <sfr@canb.auug.org.au>.

Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Mediatek: MT8183: add I2S2 control path from UL2 and UL3
Shunli Wang [Tue, 9 Apr 2019 09:13:37 +0000 (17:13 +0800)]
ASoC: Mediatek: MT8183: add I2S2 control path from UL2 and UL3

This patch add the control path from UL2 or UL3 to I2S2.
The patch is based on broonie tree "for-next" branch.

Signed-off-by: Shunli Wang <shunli.wang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Mediatek: MT8183: change supported formats of DL2 and UL1
Tzung-Bi Shih [Mon, 8 Apr 2019 10:47:28 +0000 (18:47 +0800)]
ASoC: Mediatek: MT8183: change supported formats of DL2 and UL1

DL2 and UL1 are for BTSCO.  They should only provide 16-bit, mono,
8kHz and 16kHz to userspace.  Change the formats accordingly.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsl_audmix: remove "model" attribute
Viorel Suman [Wed, 10 Apr 2019 11:06:36 +0000 (11:06 +0000)]
ASoC: fsl_audmix: remove "model" attribute

Use "of_device_id.data" to specify the machine driver
instead of "model" DTS attribute.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsl_audmix: remove "model" attribute from DT document
Viorel Suman [Wed, 10 Apr 2019 11:06:37 +0000 (11:06 +0000)]
ASoC: fsl_audmix: remove "model" attribute from DT document

Remove "model" attribute from fsl_audmix DT document.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: imx-audmix: fix object reference leaks in probe
Viorel Suman [Wed, 10 Apr 2019 11:06:38 +0000 (11:06 +0000)]
ASoC: imx-audmix: fix object reference leaks in probe

Release the reference to the underlying device taken
by of_find_device_by_node() call.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reported-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: cs43130: fix a NULL pointer dereference
Kangjie Lu [Fri, 15 Mar 2019 03:51:20 +0000 (22:51 -0500)]
ASoC: cs43130: fix a NULL pointer dereference

In case create_singlethread_workqueue fails, the fix returns
-ENOMEM to avoid potential NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: rt5645: fix a NULL pointer dereference
Kangjie Lu [Fri, 15 Mar 2019 03:48:32 +0000 (22:48 -0500)]
ASoC: rt5645: fix a NULL pointer dereference

devm_kcalloc() may fail and return NULL. The fix returns ENOMEM
in case it fails to avoid NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: common: add Geminilake Realtek+Maxim machine driver entry
Yong Zhi [Wed, 10 Apr 2019 17:27:31 +0000 (12:27 -0500)]
ASoC: Intel: common: add Geminilake Realtek+Maxim machine driver entry

This patch adds glk_rt5682_max98357a_i2s machine driver entry into
machine table. Both Skylake and SOF platform drivers can use this
machine drivers.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Naveen Manohar <naveen.m@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: Make boards more available for compile test
Mark Brown [Wed, 10 Apr 2019 16:38:00 +0000 (17:38 +0100)]
ASoC: Intel: Make boards more available for compile test

The Intel boards have very strict dependencies which make them less
available for compile test than is desirable, with requirements for
specific drivers that are only needed at runtime but not at build time.
Relax this a bit if COMPILE_TEST is enabled to improve build coverage
for these drivers.

Signed-off-by: Mark Brown <broonie@kernel.org>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: rsnd: Document r8a77470 bindings
Cao Van Dong [Thu, 11 Apr 2019 07:54:18 +0000 (16:54 +0900)]
ASoC: rsnd: Document r8a77470 bindings

Document SoC specific bindings for R-Car RZ/G1C(r8a77470) SoC.

Signed-off-by: Cao Van Dong <cv-dong@jinso.co.jp>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: mpc5200_dma: Fix invalid license ID
Andra Danciu [Sun, 14 Apr 2019 19:14:49 +0000 (22:14 +0300)]
ASoC: mpc5200_dma: Fix invalid license ID

As the file had no other license notice/reference, it falls under the
project license and therefore the proper SPDX id is: GPL-2.0-only

Cc: Daniel Baluta <daniel.baluta@nxp.com>
Fixes: 1edfc2485d8dc ("ASoC: mpc5200_dma: Switch to SPDX identifier")
Reported-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andra Danciu <andradanciu1997@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: mpc5200_psc_i2s: Fix invalid license ID
Andra Danciu [Sun, 14 Apr 2019 19:14:50 +0000 (22:14 +0300)]
ASoC: mpc5200_psc_i2s: Fix invalid license ID

As the file had no other license notice/reference, it falls under the
project license and therefore the proper SPDX id is: GPL-2.0-only

Cc: Daniel Baluta <daniel.baluta@nxp.com>
Fixes: 864a8472c4412 ("ASoC: mpc5200_psc_i2s: Switch to SPDX identifier")
Reported-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andra Danciu <andradanciu1997@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: atmel: tse850: Make some functions static
YueHaibing [Tue, 16 Apr 2019 14:47:18 +0000 (22:47 +0800)]
ASoC: atmel: tse850: Make some functions static

Fix sparse warnings:

sound/soc/atmel/tse850-pcm5142.c:120:5: warning: symbol 'tse850_get_mix' was not declared. Should it be static?
sound/soc/atmel/tse850-pcm5142.c:132:5: warning: symbol 'tse850_put_mix' was not declared. Should it be static?
sound/soc/atmel/tse850-pcm5142.c:154:5: warning: symbol 'tse850_get_ana' was not declared. Should it be static?
sound/soc/atmel/tse850-pcm5142.c:187:5: warning: symbol 'tse850_put_ana' was not declared. Should it be static?

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: imx: fix fiq dependencies
Arnd Bergmann [Tue, 16 Apr 2019 13:12:23 +0000 (15:12 +0200)]
ASoC: imx: fix fiq dependencies

During randconfig builds, I occasionally run into an invalid configuration
of the freescale FIQ sound support:

WARNING: unmet direct dependencies detected for SND_SOC_IMX_PCM_FIQ
  Depends on [m]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SND_IMX_SOC [=m]
  Selected by [y]:
  - SND_SOC_FSL_SPDIF [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SND_IMX_SOC [=m]!=n && (MXC_TZIC [=n] || MXC_AVIC [=y])

sound/soc/fsl/imx-ssi.o: In function `imx_ssi_remove':
imx-ssi.c:(.text+0x28): undefined reference to `imx_pcm_fiq_exit'
sound/soc/fsl/imx-ssi.o: In function `imx_ssi_probe':
imx-ssi.c:(.text+0xa64): undefined reference to `imx_pcm_fiq_init'

The Kconfig warning is a result of the symbol being defined inside of
the "if SND_IMX_SOC" block, and is otherwise harmless. The link error
is more tricky and happens with SND_SOC_IMX_SSI=y, which may or may not
imply FIQ support. However, if SND_SOC_FSL_SSI is set to =m at the same
time, that selects SND_SOC_IMX_PCM_FIQ as a loadable module dependency,
which then causes a link failure from imx-ssi.

The solution here is to make SND_SOC_IMX_PCM_FIQ built-in whenever
one of its potential users is built-in.

Fixes: ff40260f79dc ("ASoC: fsl: refine DMA/FIQ dependencies")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: amd: acp3x: Make acp3x_dai_i2s_ops static
YueHaibing [Tue, 16 Apr 2019 14:52:51 +0000 (22:52 +0800)]
ASoC: amd: acp3x: Make acp3x_dai_i2s_ops static

Fix sparse warning:

sound/soc/amd/raven/acp3x-pcm-dma.c:561:24: warning:
 symbol 'acp3x_dai_i2s_ops' was not declared. Should it be static?

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tlv320aic32x4: Remove set but not used variable 'mclk_rate'
YueHaibing [Wed, 17 Apr 2019 15:01:57 +0000 (23:01 +0800)]
ASoC: tlv320aic32x4: Remove set but not used variable 'mclk_rate'

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

sound/soc/codecs/tlv320aic32x4.c: In function 'aic32x4_setup_clocks':
sound/soc/codecs/tlv320aic32x4.c:669:16: warning: variable 'mclk_rate' set but not used [-Wunused-but-set-variable]

It is not used since introduction in
commit 96c3bb00239d ("ASoC: tlv320aic32x4: Dynamically Determine Clocking")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsl_micfil: Remove set but not used variable 'osr'
YueHaibing [Wed, 17 Apr 2019 15:09:15 +0000 (23:09 +0800)]
ASoC: fsl_micfil: Remove set but not used variable 'osr'

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

sound/soc/fsl/fsl_micfil.c: In function 'get_clk_div':
sound/soc/fsl/fsl_micfil.c:154:6: warning: variable 'osr' set but not used [-Wunused-but-set-variable]

It is never used since introduction in
commit 47a70e6fc9a8 ("ASoC: Add MICFIL SoC Digital Audio Interface driver.")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: pcm3168a: Enable TDM support for DSP_A/B modes
Peter Ujfalusi [Wed, 17 Apr 2019 11:31:40 +0000 (14:31 +0300)]
ASoC: pcm3168a: Enable TDM support for DSP_A/B modes

The 24-bit TDM mode also applies to DSP_A and DSP_B modes.
Most dais on the SoC side can not interpret I2S/Left_j with other than 2
channels of audio.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: AMD: Configure wclk and bclk of master codec
Agrawal, Akshu [Wed, 17 Apr 2019 10:05:13 +0000 (10:05 +0000)]
ASoC: AMD: Configure wclk and bclk of master codec

With CCF support in da7219, we can now set the correct rate of
wclk and bclk.

Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Mediatek: MT8183: Fix build err while CONFIG_I2C set to module
YueHaibing [Wed, 17 Apr 2019 15:29:32 +0000 (23:29 +0800)]
ASoC: Mediatek: MT8183: Fix build err while CONFIG_I2C set to module

During randconfig builds, I occasionally run into an invalid configuration

WARNING: unmet direct dependencies detected for SND_SOC_TS3A227E
  Depends on [m]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && I2C [=m]
  Selected by [y]:
  - SND_SOC_MT8183_MT6358_TS3A227E_MAX98357A [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SND_SOC_MT8183 [=y]

sound/soc/codecs/ts3a227e.o: In function `ts3a227e_i2c_probe':
ts3a227e.c:(.text+0x684): undefined reference to `__devm_regmap_init_i2c'
sound/soc/codecs/ts3a227e.o: In function `ts3a227e_driver_init':
ts3a227e.c:(.init.text+0x18): undefined reference to `i2c_register_driver'
sound/soc/codecs/ts3a227e.o: In function `ts3a227e_driver_exit':
ts3a227e.c:(.exit.text+0x14): undefined reference to `i2c_del_driver'

This patch add I2C dependency to fix this.

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: ebbddc75bbe8 ("ASoC: Mediatek: MT8183: Add machine driver with DA7219")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: hdmi-codec: fix spelling mistake "plalform" -> "platform"
Colin Ian King [Wed, 17 Apr 2019 16:26:28 +0000 (17:26 +0100)]
ASoC: hdmi-codec: fix spelling mistake "plalform" -> "platform"

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: Intel: select relevant machine drivers for SOF
Pierre-Louis Bossart [Fri, 12 Apr 2019 16:09:04 +0000 (11:09 -0500)]
ASoC: Intel: select relevant machine drivers for SOF

SOF can only support specific machine drivers, handle dependencies

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: Make sure BDW based machine drivers build for SOF
Liam Girdwood [Fri, 12 Apr 2019 16:09:03 +0000 (11:09 -0500)]
ASoC: Intel: Make sure BDW based machine drivers build for SOF

BDW uses hard coded IPC calls to set SSP, not needed in SOF as SSP is
configured via topology.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Add Build support for SOF core and Intel drivers
Liam Girdwood [Fri, 12 Apr 2019 16:09:02 +0000 (11:09 -0500)]
ASoC: SOF: Add Build support for SOF core and Intel drivers

Build SOF core and Intel-specific drivers.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: Kconfig: expose common option between SST and SOF drivers
Pierre-Louis Bossart [Fri, 12 Apr 2019 16:09:01 +0000 (11:09 -0500)]
ASoC: Intel: Kconfig: expose common option between SST and SOF drivers

Both drivers rely on the same module, expose it for both configurations

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: Add platform differentiation for APL and CNL
Liam Girdwood [Fri, 12 Apr 2019 16:08:58 +0000 (11:08 -0500)]
ASoC: SOF: Intel: Add platform differentiation for APL and CNL

Add platform differentiation operations for different Intel HDA DSP
platforms.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: add SKL+ platform DAIs
Keyon Jie [Fri, 12 Apr 2019 16:08:57 +0000 (11:08 -0500)]
ASoC: SOF: Intel: add SKL+ platform DAIs

Add declarations for DAIs and utilities for link DMA management

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: Add support for HDAudio codecs
Pierre-Louis Bossart [Fri, 12 Apr 2019 16:08:56 +0000 (11:08 -0500)]
ASoC: SOF: Intel: Add support for HDAudio codecs

Add probe, init and cleanup routines for HDaudio.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: Add Intel specific HDA trace operations
Liam Girdwood [Fri, 12 Apr 2019 16:08:55 +0000 (11:08 -0500)]
ASoC: SOF: Intel: Add Intel specific HDA trace operations

Add trace operations for Intel based HDA DSPs

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: Add Intel specific HDA stream operations
Liam Girdwood [Fri, 12 Apr 2019 16:08:54 +0000 (11:08 -0500)]
ASoC: SOF: Intel: Add Intel specific HDA stream operations

Add support or HDA DSP stream operations for Intel HDA DSPs.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: Add hda-bus support and initialization
Keyon Jie [Fri, 12 Apr 2019 16:08:53 +0000 (11:08 -0500)]
ASoC: SOF: Intel: Add hda-bus support and initialization

Use hdac_io_ops and configure all required spin_locks/mutex to use
hdac_hda_ext library. Keep the code conditional so that the HDA link
and audio codec support can be removed.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: Add Intel specific HDA PCM operations
Liam Girdwood [Fri, 12 Apr 2019 16:08:52 +0000 (11:08 -0500)]
ASoC: SOF: Intel: Add Intel specific HDA PCM operations

Add PCM operations for Intel HDA based DSPs.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: Add Intel specific HDA firmware loader
Liam Girdwood [Fri, 12 Apr 2019 16:08:51 +0000 (11:08 -0500)]
ASoC: SOF: Intel: Add Intel specific HDA firmware loader

Add support for loading DSP firmware on Intel HDA based platforms.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Add PCI device support
Liam Girdwood [Fri, 12 Apr 2019 16:09:00 +0000 (11:09 -0500)]
ASoC: SOF: Add PCI device support

Add support for PCI based DSP devices.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Add ACPI device support
Liam Girdwood [Fri, 12 Apr 2019 16:08:59 +0000 (11:08 -0500)]
ASoC: SOF: Add ACPI device support

Add support ACPI based SOF DSP devices.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: Add Intel specific HDA IPC mechanisms.
Liam Girdwood [Fri, 12 Apr 2019 16:08:50 +0000 (11:08 -0500)]
ASoC: SOF: Intel: Add Intel specific HDA IPC mechanisms.

Add HDA specific IPC mechanism for Intel DSP HW.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: Add Intel specific HDA DSP HW operations
Liam Girdwood [Fri, 12 Apr 2019 16:08:49 +0000 (11:08 -0500)]
ASoC: SOF: Intel: Add Intel specific HDA DSP HW operations

Add support for various PM and core reset/run state transitions.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: Add HDA controller for Intel DSP
Liam Girdwood [Fri, 12 Apr 2019 16:08:48 +0000 (11:08 -0500)]
ASoC: SOF: Intel: Add HDA controller for Intel DSP

Support HDA controller operations for DSP and provide space for future
DSP HDA FW integration.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: Add APL/CNL HW DSP support
Liam Girdwood [Fri, 12 Apr 2019 16:08:47 +0000 (11:08 -0500)]
ASoC: SOF: Intel: Add APL/CNL HW DSP support

Add SOF hardware DSP support for Intel Apollolake and Cannonlake based
devices.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: Add legacy IPC support
Guennadi Liakhovetski [Fri, 12 Apr 2019 16:08:46 +0000 (11:08 -0500)]
ASoC: SOF: Intel: Add legacy IPC support

Add IPC support required for devices introduced before Skylake
(Merrifield, baytrail, CherryTrail, Haswell, Broadwell)

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: Add BDW HW DSP support
Liam Girdwood [Fri, 12 Apr 2019 16:08:45 +0000 (11:08 -0500)]
ASoC: SOF: Intel: Add BDW HW DSP support

Add SOF support for Intel Broadwell based devices.

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: Add BYT, CHT and BSW DSP HW support.
Liam Girdwood [Fri, 12 Apr 2019 16:08:44 +0000 (11:08 -0500)]
ASoC: SOF: Intel: Add BYT, CHT and BSW DSP HW support.

Add support for the audio DSP hardware found on Intel Baytrail,
Cherrytrail and Braswell based devices.

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Add utils
Pierre-Louis Bossart [Fri, 12 Apr 2019 16:05:19 +0000 (11:05 -0500)]
ASoC: SOF: Add utils

Helpers to set-up back-ends, create platform devices and common
IO/block read/write operations

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Add xtensa support
Pierre-Louis Bossart [Fri, 12 Apr 2019 16:05:18 +0000 (11:05 -0500)]
ASoC: SOF: Add xtensa support

Add common directory for xtensa architecture

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Add Nocodec machine driver support
Liam Girdwood [Fri, 12 Apr 2019 16:05:17 +0000 (11:05 -0500)]
ASoC: SOF: Add Nocodec machine driver support

Add a simple "fallback" machine driver that can be used to enable SOF
on boards with no codec device. This machine driver can also be forced
for debug/development.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Add PM support
Liam Girdwood [Fri, 12 Apr 2019 16:05:16 +0000 (11:05 -0500)]
ASoC: SOF: Add PM support

Add support for saving and restoring DSP context in D3 to host DDR.

The suspend callback includes: suspend all pcm's stream that are running,
send CTX_SAVE ipc, drop all ipc's, release trace dma and then
power off the DSP.

And the resume callback performs the following steps: load FW, run FW,
re-initialize trace, restore pipeline, restore the kcontrol values
and finally send the ctx restore ipc to the dsp.

The streams that are suspended are resumed by the ALSA resume trigger.
If the streams are paused during system suspend, they are marked
explicitly so they can be restored during PAUSE_RELEASE.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Add userspace ABI support
Liam Girdwood [Fri, 12 Apr 2019 16:05:15 +0000 (11:05 -0500)]
ASoC: SOF: Add userspace ABI support

Add userspace ABI for audio userspace application IO outside of regular
ALSA PCM and kcontrols. This is intended to be used to format
coefficients and data for custom processing components.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Add firmware loader support
Liam Girdwood [Fri, 12 Apr 2019 16:05:14 +0000 (11:05 -0500)]
ASoC: SOF: Add firmware loader support

The firmware loader exports APIs that can be called by core to load and
process multiple different file formats.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Add DSP HW abstraction operations
Liam Girdwood [Fri, 12 Apr 2019 16:05:13 +0000 (11:05 -0500)]
ASoC: SOF: Add DSP HW abstraction operations

Add operation pointers that can be called by core to control a wide
variety of DSP targets. The DSP HW drivers will fill in these
operations.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Add DSP firmware logger support
Liam Girdwood [Fri, 12 Apr 2019 16:05:12 +0000 (11:05 -0500)]
ASoC: SOF: Add DSP firmware logger support

This patch adds support for real-time DSP logging (timestamped events
and bespoke binary data) for firmware debug. The current solution
relies on DMA transfers to system memory that is then accessed by
userspace tools such as sof-logger. For Intel platforms, two types of
DMAs are currently used (GP-DMA for Baytrail/CherryTrail and HDaudio
DMA for SKL+)

Due to historical reasons, the driver code follows the DSP firmware
conventions and refers to 'traces', but it is currently unrelated to
the Linux trace subsystem. Future solutions will include support for
more advanced hardware (e.g. MIPI Sys-T), additional formats and the
ability to enable/disable specific traces dynamically.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Add support for loading topologies
Liam Girdwood [Fri, 12 Apr 2019 16:05:11 +0000 (11:05 -0500)]
ASoC: SOF: Add support for loading topologies

SOF uses topology to define the DAPM graphs and widgets, DAIs, PCMs and set
parameters for init and run time usage. This patch loads topology and
maps it to IPC commands that are build the topology on the DSP.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Add PCM operations support
Liam Girdwood [Fri, 12 Apr 2019 16:05:10 +0000 (11:05 -0500)]
ASoC: SOF: Add PCM operations support

Add support for exposing PCMs to userspace. PCMs are defined by topology
and the operations in this patch map to SOF IPC calls.

The .get_module_upon_open field is set to allow for module load/unload
tests. There is no risk of the sof-pci/acpi-dev module being removed
while the platform components are in use. This may need to be
revisited when DT platforms are supported.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Add support for IPC IO between DSP and Host
Liam Girdwood [Fri, 12 Apr 2019 16:05:09 +0000 (11:05 -0500)]
ASoC: SOF: Add support for IPC IO between DSP and Host

Define an IPC ABI for all host <--> DSP communication. This ABI should
be transport agnostic. i.e. it should work on MMIO and SPI/I2C style
interfaces.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Add driver debug support.
Liam Girdwood [Fri, 12 Apr 2019 16:05:08 +0000 (11:05 -0500)]
ASoC: SOF: Add driver debug support.

Add debugFS files that can be used to expose DSP memories and
and peripherals to userspace to assist with firmware debugging.

Since we cannot rely on debugFS, errors are logged but don't stop
execution.

When a resource cannot be read in D3, it is optionally cached on
suspend. Copying memories from IO will increase the suspend latency,
this should only used in engineering builds w/ debug options. This
part will have to be enhanced when support for D0ix states is
provided, currently only D0 and D3 are supported.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Add Sound Open Firmware KControl support
Liam Girdwood [Fri, 12 Apr 2019 16:05:07 +0000 (11:05 -0500)]
ASoC: SOF: Add Sound Open Firmware KControl support

SOF exposes regular ALSA Kcontrols that are defined by topology. This
patch converts the Kcontrol IO to DSP IPC.

The current implementation is aligned with previous Intel solutions,
but is not optimal and can be improved:
a) for every get/put the host wakes up the DSP and generates an
IPC. The kernel should cache the values and generate an IPC only when
strictly necessary.
b) the firmware can be implemented to only instantiate the pipelines
and related control-related parts that are needed at a given time, and
power-gate the relevant SRAM blocks.

The development tasks for these two improvements has started, once
validated they will be provided in an update.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Add Sound Open Firmware driver core
Liam Girdwood [Fri, 12 Apr 2019 16:05:06 +0000 (11:05 -0500)]
ASoC: SOF: Add Sound Open Firmware driver core

The Sound Open Firmware driver core is a generic architecture
independent layer that allows SOF to be used on many different
architectures and platforms. It abstracts DSP operations and IO
methods so that the target DSP can be an internal memory mapped or
external SPI or I2C based device. This abstraction also allows SOF to
be run on many different VMs on the same physical HW.

SOF also requires some data in ASoC PCM runtime data for looking up
SOF data during ASoC PCM operations.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: stm32: sai: simplify dai driver initialisation
Arnaud Pouliquen [Tue, 23 Apr 2019 15:58:08 +0000 (17:58 +0200)]
ASoC: stm32: sai: simplify dai driver initialisation

Suppress the useless dynamic allocation of the dai driver structure.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoMerge branch 'asoc-5.1' into asoc-5.2
Mark Brown [Fri, 26 Apr 2019 10:02:03 +0000 (11:02 +0100)]
Merge branch 'asoc-5.1' into asoc-5.2

5 years agoASoC: simple-card: Read pin switches conf from devicetree
Paul Cercueil [Fri, 26 Apr 2019 02:25:50 +0000 (04:25 +0200)]
ASoC: simple-card: Read pin switches conf from devicetree

When the routing path between a widget (e.g. "Speaker") and the codec
goes through an external amplifier, having a pin switch for this widget
allows the amplifier to be disabled when the widget is not to be used
(e.g. when using headphones).

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsl_sai: Add missing return 0 in remove()
Nicolin Chen [Fri, 26 Apr 2019 03:20:50 +0000 (20:20 -0700)]
ASoC: fsl_sai: Add missing return 0 in remove()

Build warning being reported:
    sound/soc/fsl/fsl_sai.c: In function 'fsl_sai_remove':
    sound/soc/fsl/fsl_sai.c:921:1: warning: no return statement in
    function returning non-void [-Wreturn-type]

So this patch just adds a "return 0" to fix it.

Fixes: 812ad463e089 ("ASoC: fsl_sai: Add support for runtime pm")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: simple-card-utils: add asoc_simple_parse_pin_switches()
Paul Cercueil [Fri, 26 Apr 2019 02:25:49 +0000 (04:25 +0200)]
ASoC: simple-card-utils: add asoc_simple_parse_pin_switches()

This function is a helper that permits to create pin switch controls for
a list of widgets whose names are listed in the PREFIX "pin-switches"
devicetree property.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: mediatek: btcvsd fix irq mask
KaiChieh Chuang [Fri, 26 Apr 2019 02:09:43 +0000 (10:09 +0800)]
ASoC: mediatek: btcvsd fix irq mask

disable = 1
enable = 0
prevent AP wake up, when not AP BTSCO scenario

Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: bytcr_rt5651: align quirk override handling
Pierre-Louis Bossart [Fri, 19 Apr 2019 20:12:18 +0000 (15:12 -0500)]
ASoC: Intel: bytcr_rt5651: align quirk override handling

As discussed on alsa-devel, a zero value is useful to get rid of all
quirks. Set default to -1 and align types as done in other machine
drivers.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: bytcr_rt5640: align quirk override handling
Pierre-Louis Bossart [Fri, 19 Apr 2019 20:12:17 +0000 (15:12 -0500)]
ASoC: Intel: bytcr_rt5640: align quirk override handling

As discussed on alsa-devel, a zero value is useful to get rid of all
quirks. Set default to -1 and align types as done in other machine
drivers.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: bytcht_es8316: fix compilation warning
Pierre-Louis Bossart [Fri, 19 Apr 2019 20:12:16 +0000 (15:12 -0500)]
ASoC: Intel: bytcht_es8316: fix compilation warning

Remove warning below, align with other machine drivers.

bytcht_es8316.c:508:11: warning: cast from pointer to integer of
different size [-Wpointer-to-int-cast]

   quirk = (int)dmi_id->driver_data;
           ^
Fixes: a8d218f4fe811 ('ASoC: Intel: bytcht_es8316: Add quirk for the Teclast X98+ II')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsl_sai: Add support for runtime pm
Daniel Baluta [Sun, 21 Apr 2019 19:39:09 +0000 (19:39 +0000)]
ASoC: fsl_sai: Add support for runtime pm

Basically the same actions as for system PM, so make use
of pm_runtime_force_suspend/pm_runtime_force_resume.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsl_sai: Update is_slave_mode with correct value
Daniel Baluta [Sun, 21 Apr 2019 19:39:08 +0000 (19:39 +0000)]
ASoC: fsl_sai: Update is_slave_mode with correct value

is_slave_mode defaults to false because sai structure
that contains it is kzalloc'ed.

Anyhow, if we decide to set the following configuration
SAI slave -> SAI master, is_slave_mode will remain set on true
although SAI being master it should be set to false.

Fix this by updating is_slave_mode for each call of
fsl_sai_set_dai_fmt.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: doc: simple-card: Add pin-switches property
Paul Cercueil [Sat, 20 Apr 2019 10:45:51 +0000 (12:45 +0200)]
ASoC: doc: simple-card: Add pin-switches property

The simple-audio-card,pin-switches property can contain the list of
widget names for which pin switches must be created.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: sprd: Add Spreadtrum multi-channel data transfer support
Baolin Wang [Tue, 23 Apr 2019 02:26:22 +0000 (10:26 +0800)]
ASoC: sprd: Add Spreadtrum multi-channel data transfer support

On Spreadtrum platform, the audio subsystem will use the multi-channel
data transfer controller to transfer sound stream between audio subsystem
and other AP/CP subsystem.

It can support 10 DAC channel and 10 ADC channel, and each channel has
512 bytes depth data fifo. Moreover each channel can be used DMA mode
or interrupt mode to transfer data.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agodt-bindings: ASoC: Add Spreadtrum multi-channel data transfer support
Baolin Wang [Tue, 23 Apr 2019 02:26:21 +0000 (10:26 +0800)]
dt-bindings: ASoC: Add Spreadtrum multi-channel data transfer support

On Spreadtrum platform, the audio subsystem will use the multi-channel
data transfer controller to transfer sound stream between audio subsystem
and other AP/CP subsystem.

It can support 10 DAC channel and 10 ADC channel, and each channel has
512 bytes depth data fifo. Moreover each channel can be used DMA mode
or interrupt mode to transfer data.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>