Keyon Jie [Fri, 25 Oct 2019 22:41:21 +0000 (17:41 -0500)]
ASoC: SOF: PM: Add support for DSP D0i3 state when entering S0ix
When system is entering into S0ix, the PCI device may transition to the
D0i3 substate instead of D3. In D0i3, some always-on functionality can
be enabled, such as acoustic event detection, voice activity detection
or hotwording. When an event is detected, the DSP firmware can wake-up
the device for a transition to D0 with an interrupt.
Keyon Jie [Fri, 25 Oct 2019 22:41:18 +0000 (17:41 -0500)]
ASoC: SOF: ignore suspend/resume for D0ix compatible streams
During system suspend, the PM framework will freeze all applications and
the ALSA/ASoC core will suspend all RUNNING PCM streams.
However, D0ix-compatible PCM streams should keep the related pipelines
active in the DSP when the system is entering S0ix. The TRIGGER_SUSPEND
event is trapped in such cases to prevent the pipelines from being
stopped. Likewise, the TRIGGER_RESUME/START events should not affect the
pipeline state.
The SOF driver also triggers some DSP Firmware pipelines based on the
DAPM widgets power events. In such cases, we also ignore PRE_PMU and
POST_PMD events to keep the pipelines active.
Keyon Jie [Fri, 25 Oct 2019 22:41:16 +0000 (17:41 -0500)]
ASoC: SOF: add a flag suspend_ignored for sof stream
Add a suspend_ignored flag to snd_sof_pcm_stream that will be used to
decide if the corresponding FW pipeline should be kept active to perform
always on tasks when the system is entering the S0ix state.
Keyon Jie [Fri, 25 Oct 2019 22:41:14 +0000 (17:41 -0500)]
ASoC: SOF: Intel: CNL: add support for sending compact IPC
For compact IPCs, we will send the IPC header/command via the HIPCIDR
register and the first 32bit payload via the HIPCIDD register, no
mailbox will be used.
Keyon Jie [Fri, 25 Oct 2019 22:41:13 +0000 (17:41 -0500)]
ASoC: SOF: PM: add helpers for setting D0 substate for ADSP
Add snd_sof_set_d0_substate() helper for setting ADSP to a specific D0
substate, it will call into the platform specific implementation, and
update the d0_substate at success.
On cAVS platforms, some IPCs are required to be sent via IPC registers
only(e.g. when in D0i3, mailbox is unaccessible), add hda-ipc.h to hold
definition of those compact IPCs.
Keyon Jie [Fri, 25 Oct 2019 22:41:04 +0000 (17:41 -0500)]
ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate
Add stream token SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3 and
SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3 to denote if the stream can be
opened at low power d0i3 status or not.
Keyon Jie [Fri, 25 Oct 2019 22:41:03 +0000 (17:41 -0500)]
ASoC: SOF: add flag to snd_sof_pcm_stream for D0i3 compatible stream
Add flag d0i3_compatible to struct snd_sof_pcm_stream to denote if the
stream can tolerate a transition to the D0i3 substate while opened (thus
seen as 'active' by pm_runtime).
Shengjiu Wang [Mon, 28 Oct 2019 09:11:05 +0000 (17:11 +0800)]
ASoC: fsl_esai: Add spin lock to protect reset, stop and start
xrun may happen at the end of stream, the
trigger->fsl_esai_trigger_stop maybe called in the middle of
fsl_esai_hw_reset, this may cause esai in wrong state
after stop, and there may be endless xrun interrupt.
This issue may also happen with trigger->fsl_esai_trigger_start.
Brent Lu [Fri, 25 Oct 2019 09:11:31 +0000 (17:11 +0800)]
ASoC: eve: implement set_bias_level function for rt5514
The first DMIC capture always fail (zero sequence data from PCM port)
after using DSP hotwording function (i.e. Google assistant).
This rt5514 codec requires to control mclk directly in the set_bias_level
function. Implement this function in machine driver to control the
ssp1_mclk clock explicitly could fix this issue.
Michael Ellerman [Fri, 25 Oct 2019 05:13:53 +0000 (16:13 +1100)]
ASoC: fsl: fsl_dma: fix build failure
Commit 4ac85de9977e ("ASoC: fsl: fsl_dma: remove snd_pcm_ops") removed
fsl_dma_ops but left a usage, leading to a build error for some
configs, eg. mpc85xx_defconfig:
sound/soc/fsl/fsl_dma.c: In function ‘fsl_soc_dma_probe’:
sound/soc/fsl/fsl_dma.c:905:18: error: ‘fsl_dma_ops’ undeclared (first use in this function)
dma->dai.ops = &fsl_dma_ops;
^~~~~~~~~~~
Currently the INFO_ flags such as PAUSE/NO_PERIOD_WAKEUP are defined
in the SOF PCM core, which doesn't scale. To account for platform
variations, these flags need to be set in DSP ops.
This patch only moves the definitions and does not change any
functionality.
Ben Dooks [Fri, 18 Oct 2019 15:48:30 +0000 (16:48 +0100)]
ASoC: tegra: disable rx_fifo after disable stream
We see odd FIFO overruns with this, we assume the best thing to do is
to disable the RX I2S frontend first, and then disable the FIFO that
is using it.
This also fixes an issue where using multi-word frames (TDM) have
partial samples stuck in the FIFO which then get read out when the
next capture is started.
Edward Cragg [Fri, 18 Oct 2019 15:48:27 +0000 (16:48 +0100)]
ASoC: tegra: add a TDM configuration callback
Add a callback to configure TDM settings for the Tegra30 I2S ASoC 'platform'
driver.
Signed-off-by: Edward Cragg <edward.cragg@codethink.co.uk>
[ben.dooks@codethink.co.uk: merge fix for power management]
[ben.dooks@codethink.co.uk: add review change for fsync of 1 clock] Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20191018154833.7560-2-ben.dooks@codethink.co.uk Signed-off-by: Mark Brown <broonie@kernel.org>
Edward Cragg [Fri, 18 Oct 2019 15:48:28 +0000 (16:48 +0100)]
ASoC: tegra: Allow 24bit and 32bit samples
The tegra3 audio can support 24 and 32 bit sample sizes so add the
option to the tegra30_i2s_hw_params to configure the S24_LE or S32_LE
formats when requested.
Signed-off-by: Edward Cragg <edward.cragg@codethink.co.uk>
[ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit]
[ben.dooks@codethink.co.uk: add pm calls around ytdm config]
[ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20191018154833.7560-3-ben.dooks@codethink.co.uk Signed-off-by: Mark Brown <broonie@kernel.org>
Curtis Malainey [Thu, 24 Oct 2019 18:40:26 +0000 (11:40 -0700)]
ASoC: rt5677-spi: fix sparse warnings
Fix bugs reported by kbuild test robot
Fixes: a0e0d135427c ("ASoC: rt5677: Add a PCM device for streaming hotword via SPI") Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Curtis Malainey <cujomalainey@chromium.org> Link: https://lore.kernel.org/r/20191024184026.183913-1-cujomalainey@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
Colin Ian King [Thu, 24 Oct 2019 12:46:10 +0000 (13:46 +0100)]
ASoC: rt5677: Add missing null check for failed allocation of rt5677_dsp
The allocation of rt5677_dsp can potentially fail and return null, so add
a null check and return -ENOMEM on a memory allocation failure.
Addresses-Coverity: ("Dereference null return") Fixes: a0e0d135427c ("ASoC: rt5677: Add a PCM device for streaming hotword via SPI") Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20191024124610.18182-1-colin.king@canonical.com Signed-off-by: Mark Brown <broonie@kernel.org>
If SND_SOC_MT8183_MT6358_TS3A227E_MAX98357A=y,
below errors can be seen:
sound/soc/codecs/cros_ec_codec.o: In function `send_ec_host_command':
cros_ec_codec.c:(.text+0x534): undefined reference to `cros_ec_cmd_xfer_status'
cros_ec_codec.c:(.text+0x101c): undefined reference to `cros_ec_get_host_event'
This is because it will select SND_SOC_CROS_EC_CODEC
after commit 2cc3cd5fdc8b ("ASoC: mediatek: mt8183: support WoV"),
but SND_SOC_CROS_EC_CODEC depends on CROS_EC.
Jiada Wang [Tue, 22 Oct 2019 18:55:18 +0000 (20:55 +0200)]
ASoC: rsnd: dma: set bus width to data width for monaural data
According to R-Car3 HW manual 40.3.3 (Data Format on Audio Local Bus),
in case of monaural data writing or reading through Audio-DMAC,
it's always in Left Justified format, so both src and dst
DMA Bus width should be equal to physical data width.
Therefore set src and dst's DMA bus width to:
- [monaural case] data width
- [non-monaural case] 32bits (as prior applying the patch)
Cc: Andrew Gabbasov <andrew_gabbasov@mentor.com> Cc: Timo Wischer <twischer@de.adit-jv.com> Signed-off-by: Jiada Wang <jiada_wang@mentor.com> Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Link: https://lore.kernel.org/r/20191022185518.12838-1-erosca@de.adit-jv.com Signed-off-by: Mark Brown <broonie@kernel.org>
This patch expands list_for_each_entry manually, and enable to get
component directly from for_each macro.
Because of it, the macro becoming difficult to read,
but macro itself becoming useful.
dpcm_prune_paths() is checking widget at 2 parts.
(A) is for CPU, (B) is for Codec.
If we focus to (A) part, continue at (a) is for (1) loop. But,
if we focus to (B) part, continue at (b) is for (2) loop, not for (1).
This is bug.
This patch fixup this issue.
Ben Zhang [Fri, 18 Oct 2019 20:04:38 +0000 (13:04 -0700)]
ASoC: rt5677: Add a PCM device for streaming hotword via SPI
This patch implements a PCM interface for streaming hotword
phrases over SPI. Userspace can open the PCM device at anytime.
The stream is blocked when no hotword is detected. The mic
audio buffer on the DSP is a ~128KByte ring buffer that holds
~4sec of audio samples recorded from the DMIC (S16_LE, mono,
16KHz). After a hotword is detected, previous 2 seconds of audio
(containing the detected hotword) is streamed first, then live
capture continues until userspace closes the PCM stream.
When transferring, copy one period at a time then call
snd_pcm_period_elapsed(). This reduces the latency of transferring
the initial ~2sec of audio after hotword detect since audio samples
are available for userspace earlier.
Tzung-Bi Shih [Sat, 19 Oct 2019 07:02:51 +0000 (15:02 +0800)]
ASoC: cros_ec_codec: support WoV
1. Get EC codec's capabilities.
2. Get and set SHM address if any.
3. Transmit language model to EC codec if needed.
4. Start to read audio data from EC codec if receives host event.
Stephan Gerhold [Sun, 20 Oct 2019 15:30:07 +0000 (17:30 +0200)]
ASoC: msm8916-wcd-analog: Add earpiece
PM8916 supports an earpiece as another (small) speaker.
The earpiece is routed through RX MIX1 similarly to
the headphones, except that RDAC2 MUX is set to RX1.
Maciej Falkowski [Thu, 26 Sep 2019 11:02:19 +0000 (13:02 +0200)]
ASoC: samsung: i2s: Document clocks macros
Document clocks macros with their description
from 'Documentation/devicetree/bindings/sound/samsung-i2s.txt'
Signed-off-by: Maciej Falkowski <m.falkowski@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Link: https://lore.kernel.org/r/20190926110219.6144-1-m.szyprowski@samsung.com Signed-off-by: Mark Brown <broonie@kernel.org>
dt-bindings: sound: Convert Samsung I2S controller to dt-schema
Convert Samsung I2S controller to newer dt-schema format.
Signed-off-by: Maciej Falkowski <m.falkowski@samsung.com>
[mszyprow: integrated fix for minor spelling issues] Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Reviewed-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20191004125914.1033-1-m.szyprowski@samsung.com Signed-off-by: Mark Brown <broonie@kernel.org>
Convert Samsung Exynos Odroid XU3/XU4 audio complex with MAX98090 codec
to newer dt-schema format.
'clocks' property is unneeded in the bindings and is left undefined in 'properties'.
'samsung,audio-widgets' and 'samsung,audio-routing' are optional from driver
perspective and they are set as unrequired.
Signed-off-by: Maciej Falkowski <m.falkowski@samsung.com>
[mszyprow: reordered non-standard properties] Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20191017100529.4183-1-m.szyprowski@samsung.com Signed-off-by: Mark Brown <broonie@kernel.org>
Tzung-Bi Shih [Mon, 14 Oct 2019 10:20:14 +0000 (18:20 +0800)]
ASoC: cros_ec_codec: refactor I2S RX
Refactor by the following items:
- reformat copyright declaration
- use more specific name "i2s rx"
- use verbose symbol names to separate namespaces
- make some short functions inline
- remove unused TDM-related code
Shuming Fan [Wed, 16 Oct 2019 08:58:45 +0000 (16:58 +0800)]
ASoC: rt1011: Read and apply r0 and temperature device property
Typically, the r0 (calibration data) and temperature were measured in the factory.
This information is written into the non-volatile area
where keeps data whether factory reset or OS update.
In Chromium OS case, the coreboot will read the info from VPD and create
the device property for each rt1011.
Shuming Fan [Wed, 16 Oct 2019 11:56:17 +0000 (19:56 +0800)]
ASoC: dt-bindings: rt1011: add r0 and temperature device property
Typically, the r0 (calibration data) and temperature were measured in the factory.
This information is written into the non-volatile area
where keeps data whether factory reset or OS update.
Peter Ujfalusi [Tue, 15 Oct 2019 09:00:37 +0000 (12:00 +0300)]
ASoC: pcm3168a: Fix serial mode dependent format support
fmt 0 is perfectly valid (PCM3168A_FMT_I2S). Remove the return in case
fmt == 0.
Fixes: ("ASoC: pcm3168a: Use fixup instead of constraint for channels and formats") Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Link: https://lore.kernel.org/r/20191015090037.23271-1-peter.ujfalusi@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
linux/include/sound/sof/header.h:125:2: error: unknown type name ‘uint32_t’uint32_t size;
linux/include/sound/sof/header.h:136:2: error: unknown type name ‘uint32_t’uint32_t size;
linux/include/sound/sof/header.h:137:2: error: unknown type name ‘uint32_t’uint32_t cmd;
...
linux/include/sound/sof/dai-imx.h:18:2: error: unknown type name ‘uint16_t’uint16_t reserved1;
linux/include/sound/sof/dai-imx.h:30:2: error: unknown type name ‘uint16_t’uint16_t tdm_slot_width;
linux/include/sound/sof/dai-imx.h:31:2: error: unknown type name ‘uint16_t’uint16_t reserved2;
YueHaibing [Mon, 14 Oct 2019 09:13:08 +0000 (17:13 +0800)]
ASoC: SOF: Fix randbuild error
When LEDS_TRIGGER_AUDIO is m and SND_SOC_SOF is y,
sound/soc/sof/control.o: In function `snd_sof_switch_put':
control.c:(.text+0x587): undefined reference to `ledtrig_audio_set'
control.c:(.text+0x593): undefined reference to `ledtrig_audio_set'
Reported-by: Hulk Robot <hulkci@huawei.com> Fixes: 5d43001ae436 ("ASoC: SOF: acpi led support for switch controls") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20191014091308.23688-1-yuehaibing@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
ASoC: SOF: topology: check errors when parsing LED tokens
sof_parse_tokens() returns a value that is checked on every call
except for LED tokens, fix with explicit test.
Detected with cppcheck warning:
sound/soc/sof/topology.c:973:6: style: Variable 'ret' is assigned a
value that is never used. [unreadVariable]
ret = sof_parse_tokens(scomp, &scontrol->led_ctl, led_tokens,
^
Olivier Moysan [Fri, 11 Oct 2019 08:48:16 +0000 (10:48 +0200)]
ASoC: stm32: spdifrx: retry synchronization in sync state
When STM32 SPDIFRX is in sync state, allow multiple
synchro attempts, instead of exiting on first unsuccessful
trial. This is useful when spdif signal is not immediately
available on input. This also allows Pulseaudio to check
iec capture device availability when no signal is present.
Jaska Uimonen [Tue, 8 Oct 2019 16:44:43 +0000 (11:44 -0500)]
ASoC: SOF: acpi led support for switch controls
Currently sof doesn't support acpi leds with mute switches. So implement
acpi leds following quite shamelessly existing HDA implementation by
Takashi Iwai.
Mute leds can be enabled in topology by adding led and direction token
in switch control private data.
One of the usages for this debug parameter to disable pm_runtime,
which can be useful for platform bringup, or keep the parent device
active while enabling pm_runtime for child devices (e.g. with
SoundWire or MFD). This can also be useful to measure suspend-resume
latencies or child devices.
One of the usages for this debug parameter to disable pm_runtime,
which can be useful for platform bringup, or keep the parent device
active while enabling pm_runtime for child devices (e.g. with
SoundWire or MFD). This can also be useful to measure suspend-resume
latencies or child devices.