Mark Brown [Thu, 2 Jun 2022 10:30:29 +0000 (12:30 +0200)]
ASoC: hdmi-codec: Update to modern DAI terminology
As part of retiring the old defines used to specify DAI formats update the
hdmi_codec driver to use the modern names, including the variables in the
struct hdmi_codec_daifmt exported to the DRM drivers.
In updating this I did note that the only use of this information in DRM
drivers is to reject clock provider settings, thinking about what this
hardware is doing I rather suspect that there might not be any hardware
out there which needs the configuration so it may be worth considering
just having hdmi-codec support only clock consumer.
Mark Brown [Fri, 10 Jun 2022 17:28:20 +0000 (18:28 +0100)]
ASoC: SOF: Add support ctx_save with IPC4
Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:
The context save functionality with IPC4 is triggered by sending a message to
the firmware about the pending power down of the primary core by the host.
In order to have this functionality implemented in a clean way we need to
introduce a new IPC level PM ops for core state management and use that instead
of open coding IPC messages here and there.
The first patch updates the ctx store/ctx_restore documentation to clarify that
they are optional.
Mark Brown [Fri, 10 Jun 2022 16:21:29 +0000 (17:21 +0100)]
ASoC: SOF: ipc3-dtrace: Handle race during initialization
Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:
This series handles the race which can result missing the first position update
after the trace is enabled.
In short: the firmware might send the position update (if we have enough
trace data generated) after the dma-trace is enabled by the TRACE_DMA_PARAMS_EXT
message. Depending on scheduling, load, preemption on Linux side we have seen
that occasionally this first position update got missed and we missed reading it
out.
A new state and more strict handling of host_offset can overcome this issue,
making the dtrace more reliable.
Mark Brown [Fri, 10 Jun 2022 15:57:37 +0000 (16:57 +0100)]
ASoC: codecs: qualcomm move gain to S8_TLV
Merge series from Srinivas Kandagatla <srinivas.kandagatla@linaro.org>:
Move all the digital and IIR gains form using SX_TLV to S8_TLV,
these gains are actually 8 bit gains with 7th signed bit and
ranges from -84dB to +40dB
Mark Brown [Fri, 10 Jun 2022 15:57:35 +0000 (16:57 +0100)]
ASoC: codecs: Series of fixes for realtek codecs used on RVPs
Merge series from Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>:
Our tests platforms do use realtek codecs, while implementing avs driver
and machine boards for it, we identified quite a lot of problems with
those codec drivers.
Peter Ujfalusi [Fri, 10 Jun 2022 08:04:21 +0000 (11:04 +0300)]
ASoC: SOF: debug: Clarify the IPC timeout handling path
The dmesg log message of "Firmware exception" causes lots of confusion as
the snd_sof_handle_fw_exception() is only called in case of an IPC tx
timeout, where such a message does not make much sense.
To not limit the snd_sof_handle_fw_exception() handler to just one error
case, add a parameter to allow the caller to specify a meaningful message
to be printed.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Yaochun Hung <yc.hung@mediatek.com> Link: https://lore.kernel.org/r/20220610080421.31453-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Martin Povišer [Mon, 6 Jun 2022 19:19:09 +0000 (21:19 +0200)]
ASoC: Introduce 'fixup_controls' card method
The new method is called just before the card is registered, providing
an opportune time for machine-level drivers to do some final controls
amending: deactivating individual controls or obtaining control
references for later use.
Some controls can be created by DAPM after 'late_probe' has been called,
hence the need for this new method.
Peter Ujfalusi [Fri, 10 Jun 2022 08:01:17 +0000 (11:01 +0300)]
ASoC: SOF: ipc3-dtrace: Introduce SOF_DTRACE_INITIALIZING state
With the new state we can make sure we are not missing the first
host_offset update.
In case the dtrace is small, the DMA copy will be fast and depending on
the moonphase it might be done before we set the sdev->dtrace_state to
SOF_DTRACE_ENABLED.
The DMA will start the copy as soon as the host starts the DMA. Set the
dtrace to enabled before we let the DMA to run in order to avoid missing
the position update.
The new state is needed to cover architectures where the host side
snd_sof_dma_trace_trigger() is a NOP and the dtrace in the firmware is
ready as soon as the IPC message has been processed.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20220610080119.30880-2-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Peter Ujfalusi [Fri, 10 Jun 2022 08:35:48 +0000 (11:35 +0300)]
ASoC: SOF: Intel: Switch to use the generic pm_ops.set_core_state
Instead of craft and send an IPC(3) message in hda_dsp_core_get(),
tgl_dsp_core_get() and tgl_dsp_core_put(), use the generic ops for handling
the IPC dependent implementation of core power on/off.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220610083549.16773-6-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
IPC4 uses the SET_DX message to enable/disable cores managed by the DSP.
The dx_state.core_mask indicates which core is going to change state,
the dx_state.dx_mask is to power on (1) or off (0) the core.
In the dx_mask only those bits (cores) checked which bit is set in the
core_mask, other bits (cores) ignored.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220610083549.16773-5-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
IPC3 uses sof_ipc_pm_core_config message
(SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_CORE_ENABLE) to enable/disable cores
managed by the DSP.
The core state is set via a single bitfield, if the bit is 1 the core
should be on, if it is 0 then it is off.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220610083549.16773-4-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Peter Ujfalusi [Fri, 10 Jun 2022 08:35:45 +0000 (11:35 +0300)]
ASoC: SOF: sof_ipc_pm_ops: Add support for DSP core power management
Add a new ops for handling DSP core power state which can be used to tell
the DSP to turn on/off a core (or to inform it that a core is going to be
turned on/off if the core is host managed).
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220610083549.16773-3-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Mark Brown [Thu, 9 Jun 2022 10:26:00 +0000 (11:26 +0100)]
Specify clock provider directly to CPU DAIs
Merge series from Charles Keepax <ckeepax@opensource.cirrus.com>:
Currently the set_fmt callback always passes clock provider/consumer
with respect to the CODEC. This made sense when the framework was
directly broken down into platforms and CODECs. However, as things
are now broken down into components which can be connected as either
the CPU or CODEC side of a DAI link it simplifies things if each
side of the link is just told if it is provider or consumer of the
clocks. Making this change allows us to remove one of the last parts
of the ASoC core that needs to know if a driver is a CODEC driver,
where it flips the clock format specifier if a CODEC driver is used on
the CPU side of a DAI link, as well as just being conceptually more
consistent with componentisation.
The basic idea of this patch chain is to change the set_fmt callback
from specifying if the CODEC is provider/consumer into directly
specifying if the component is provider/consumer. To do this we add
some new defines, and then to preserve bisectability, the migration is
done by adding a new callback, converting over all existing CPU side
drivers, converting the core, and then finally reverting back to the
old callback.
Converting the platform drivers makes sense as the existing defines
are from the perspective of the CODEC and there are more CODEC drivers
than platform drivers.
Obviously a fair amount of this patch chain I was only able to build
test, so any testing that can be done would be greatly appreciated.
Shengjiu Wang [Thu, 19 May 2022 12:36:48 +0000 (20:36 +0800)]
ASoC: fsl_sai: Enable MCTL_MCLK_EN bit for master mode
On i.MX8MM, the MCTL_MCLK_EN bit it is not only the gate
for MCLK output to PAD, but also the gate bit between
root clock and SAI module, So it is need to be enabled
for master mode, otherwise there is no bclk generated.
Miaoqian Lin [Fri, 3 Jun 2022 12:42:41 +0000 (16:42 +0400)]
ASoC: mediatek: mt8173-rt5650: Fix refcount leak in mt8173_rt5650_dev_probe
of_parse_phandle() returns a node pointer with refcount
incremented, we should use of_node_put() on it when not need anymore.
Fix refcount leak in some error paths.
ASoC: simple-card-utils: Make asoc_simple_clean_reference() return void
asoc_simple_clean_reference() returns zero unconditionally. Letting it
return void instead makes it easier to see in the caller that there is no
error to handle.
This is a preparation for making platform remove callbacks return void.
ASoC: Intel: broadwell: Make broadwell_disable_jack() return void
broadwell_disable_jack() returns zero unconditionally. Letting it
return void instead makes it easier to see in the callers that there is no
error to handle.
This is a preparation for making platform remove callbacks return void.
Mark Brown [Tue, 7 Jun 2022 10:54:01 +0000 (11:54 +0100)]
ASoC: Drop some i2c noop remove callbacks
Merge series from Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Uwe Kleine-König <uwe@kleine-koenig.org>:
From: Uwe Kleine-König <uwe@kleine-koenig.org>
Hello,
I intended to send this after -rc1 was cut, but found a few spare
minutes to prepare this series. All four patches were sent already
before based on v5.18, but there were some conflicting changes added in
the merge window. This series contains the four patches on top of
current linus/master and so bases on a tree including the conflicting
changes. Expecting no more sound changes in this merge window, this
should apply cleanly on top of -rc1.
Best regards
Uwe
Uwe Kleine-König (4):
ASoC: ak4642: Drop no-op remove function
ASoC: da7219: Drop no-op remove function
ASoC: lm49453: Drop no-op remove function
ASoC: da732x: Drop no-op remove function
Mark Brown [Tue, 7 Jun 2022 10:53:44 +0000 (11:53 +0100)]
Switch to use internal PLL for iMCLK
Merge series from Hui Wang <hui.wang@canonical.com>:
Taking your advice and try to enable internal PLL to get a more
accurate sample rate. And I also changed the fsl-asoc-card.c to support
the nau8822 codec, now the sound quality is pretty good on my imx6sx
EVB.
Mark Brown [Tue, 7 Jun 2022 10:52:12 +0000 (11:52 +0100)]
ASoC: trivial changes for cppcheck warnings
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:
This can probably wait for the next merge window, I found a number of
cppcheck warnings that I didn't see in my last checks. The irony is
that the only really important issue found by cppcheck was on one of
my previous DPCM changes (submitted separately as a fix).
Mark Brown [Tue, 7 Jun 2022 10:52:10 +0000 (11:52 +0100)]
OPE support on Tegra210 and later
Merge series from Sameer Pujar <spujar@nvidia.com>:
This series adds support for Output Prcoessing Module (OPE) module on
Tegra210 and later generations of SoCs. OPE is a client of AHUB and
it has sub blocks of PEQ (Parametric Equalizer) and MBDRC (Multi Band
Dynamic Range Compressor) for data processing.
An ASoC component is registered for OPE, which includes PEQ and MBDRC
functions as well. This can be plugged in audio path using ALSA mixer
controls. The series adds necessary binding documentaion, driver and
DT binding patches to enable OPE module on Jetson platforms.
Mark Brown [Tue, 7 Jun 2022 10:52:09 +0000 (11:52 +0100)]
ASoC: Intel: avs: Machine boards and HDA codec support
Merge series from Cezary Rojewski <cezary.rojewski@intel.com>
From there on is a range of boards appended. All of them follow the same:
This series focuses on populating boards/ subdirectory with supported
configurations by the avs-driver. Note: it is independent of recently
provided "Driver code and PCM operations" series [1], that is, code
found here should not collide with it.
Series starts with a small change that adds a helper to sound pcm
header, allowing for retrieving string naming a direction without the
need of substream pointer. Said helper is used by codec driver code that
follows it but I believe it's generic and helpful enough that it can be
called an independent addition to the sound core.
Code for generic HD-Audio codec driver follows. It is a ASoC wrapper for
existing HD-Audio codec code found in sound/pci/hda/. There is basically
no custom logic involved up to the point that driver follows
HDA_DEV_LEGACY convention, rather than the HDA_DEV_ASOC one. Commit
message for the given patch iterates on this and explains crucial parts
of the implementation.
From there on is a range of boards appended. All of them follow the same
scheme:
- define avs_create_dai_link() so DAI-LINKs can be created dynamically,
based on the link_mask (I2S) or the number of entries in the
->pcm_list_head list (HDA)
- define avs_create_dapm_routes() so DAPM routes can be created
dynamically, same rules as above apply
- define probe() function that creates new ASoC card, assign all
required operations and resources along with calling the two above
Changes in v2:
- 'link_mask' usage replaced with 'i2s_link_mask' as requested by
Pierre
- 'ssp_test' board renamed to 'i2s_test' to match naming convention used
for other i2s machine boards
- enriched commit message and Kconfig for the 'HD-Audio codec driver'
patch as requested by Kai
Mark Brown [Tue, 7 Jun 2022 10:52:06 +0000 (11:52 +0100)]
ALSA: hda: cirrus: Add initial DSP support and firmware loading
Merge series from Vitaly Rodionov <vitalyr@opensource.cirrus.com>:
The CS35L41 Amplifier contains a DSP, capable of running firmware.
The firmware can run algorithms such as Speaker Protection, to ensure
that playback at high gains do not harm the speakers. This exports some
interfaces to allow more use of this DSP by the HDA version of the driver.
During suspend flow, sof_suspend will be called and the pm_ops->ctx_save
callback notifies DSP of the upcoming power down.
Upon receipt of the ctx_save IPC, the DSP will start the D3 transition.
Before the DSP enter idle, an interrupt is generated to notify the host of
the power state change.
Since the host and DSP are two different processors, there could be a
race condition, which can be avoided by polling with 1s timeout and 500us
intervals
For tests, it's rather common to disable the HDaudio links and codecs
in the build. Since we already get a codec_mask parameter indicating
that there are no codecs detected, it's straightforward to skip the
HDMI dailink creation and create a card.
Note that when disabling HDMI, a modified topology without HDMI
pipelines needs to be provided as well.
Jiaxin Yu [Mon, 23 May 2022 13:28:39 +0000 (21:28 +0800)]
ASoC: mediatek: mt6366: support for mt6366 codec
Mt6366 is a new version of mt6358, and they are same about audio part.
So we can reuse the driver of mt6358 that add a new compatible string
inside of the mt6358 driver.
Charles Keepax [Thu, 2 Jun 2022 16:21:19 +0000 (17:21 +0100)]
ASoC: cs42l51: Correct minimum value for SX volume control
The minimum value for the PGA Volume is given as 0x1A, however the
values from there to 0x19 are all the same volume and this is not
represented in the TLV structure. The number of volumes given is correct
so this leads to all the volumes being shifted. Move the minimum value
up to 0x19 to fix this.
Charles Keepax [Thu, 2 Jun 2022 16:21:18 +0000 (17:21 +0100)]
ASoC: cs42l56: Correct typo in minimum level for SX volume controls
A couple of the SX volume controls specify 0x84 as the lowest volume
value, however the correct value from the datasheet is 0x44. The
datasheet don't include spaces in the value it displays as binary so
this was almost certainly just a typo reading 1000100.
The default mapping of ASPRX1 (DAC source) is slot 0. Change the slot
mapping of right amplifiers (WR and TR) to slot 1 to receive right
channel data. Also update the ACPI instance ID mapping according to HW
configuration.
Signed-off-by: xliu <xiang.liu@cirrus.com> Signed-off-by: Brent Lu <brent.lu@intel.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220602051922.1232457-1-brent.lu@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
ASoC: qcom: lpass-platform: Update VMA access permissions in mmap callback
Replace page protection permissions from noncashed to writecombine,
in lpass codec DMA path mmp callabck, to support 64 bit chromeOS.
Avoid SIGBUS error in userspace caused by noncached permissions in
64 bit chromeOS.
Hui Wang [Mon, 30 May 2022 04:01:50 +0000 (12:01 +0800)]
ASoC: nau8822: Add operation for internal PLL off and on
We tried to enable the audio on an imx6sx EVB with the codec nau8822,
after setting the internal PLL fractional parameters, the audio still
couldn't work and the there was no sdma irq at all.
After checking with the section "8.1.1 Phase Locked Loop (PLL) Design
Example" of "NAU88C22 Datasheet Rev 0.6", we found we need to
turn off the PLL before programming fractional parameters and turn on
the PLL after programming.
After this change, the audio driver could record and play sound and
the sdma's irq is triggered when playing or recording.
Mark Brown [Fri, 3 Jun 2022 11:50:03 +0000 (13:50 +0200)]
ASoC: wm_adsp: Fix event generation for wm_adsp_fw_put()
Currently wm_adsp_fw_put() returns 0 rather than 1 when updating the value
of the control, meaning that no event is generated to userspace. Fix this
by setting the default return value to 1, the code already exits early with
a return value of 0 if the value is unchanged.
Jiasheng Jiang [Tue, 31 May 2022 09:47:12 +0000 (17:47 +0800)]
ASoC: codecs: da7210: add check for i2c_add_driver
As i2c_add_driver could return error if fails, it should be
better to check the return value.
However, if the CONFIG_I2C and CONFIG_SPI_MASTER are both true,
the return value of i2c_add_driver will be covered by
spi_register_driver.
Therefore, it is necessary to add check and return error if fails.
Miaoqian Lin [Fri, 3 Jun 2022 08:34:15 +0000 (12:34 +0400)]
ASoC: mt6797-mt6351: Fix refcount leak in mt6797_mt6351_dev_probe
of_parse_phandle() returns a node pointer with refcount
incremented, we should use of_node_put() on it when not need anymore.
Add missing of_node_put() to avoid refcount leak.
ASoC: qcom: soundwire: Add support for controlling audio CGCR from HLOS
Add support for controlling soundwire audio CGCR interface using clock
framework to make hclk ungating with software. As per new hardware
changes, software has to always ungate hclk if soundwire is operational
and keep it running. This requirement is for latest LPASS chipsets for
RX, TX and WSA path to work.