platform/kernel/linux-rpi.git
13 months agoASoC: Intel: soc-acpi-intel-mtl-match: add rt712 ID
Bard Liao [Fri, 2 Jun 2023 20:22:09 +0000 (15:22 -0500)]
ASoC: Intel: soc-acpi-intel-mtl-match: add rt712 ID

Add rt712 ID for MTL.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: Intel: soc-acpi-intel-tgl-match: add rt712 ID
Bard Liao [Fri, 2 Jun 2023 20:22:08 +0000 (15:22 -0500)]
ASoC: Intel: soc-acpi-intel-tgl-match: add rt712 ID

Add rt712 ID for TGL.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: Intel: sof_sdw: add rt712 support
Bard Liao [Fri, 2 Jun 2023 20:22:07 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: add rt712 support

Rt712 is a multi function codec which shpports headset, amp, and dmic
functions. Rt712 has two sdw interfaces and codec drivers, one for jack
and amp, the other for dmic. part id 0x712 is for jack and amp, and 0x1712
is for dmic.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: Intel: sof_sdw: make rt711_sdca be generic
Bard Liao [Fri, 2 Jun 2023 20:22:06 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: make rt711_sdca be generic

Let rename rt711_sdca to rt_sdca_jack and let it be used for all
Realtek sdca jacks.
The commit uses component->name_prefix to construct card->components,
and determine which codec it is. So, we have to set name_prefix
properly.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: Intel: sof_sdw: rename SOF_RT711_JDSRC to SOF_JACK_JDSRC
Bard Liao [Fri, 2 Jun 2023 20:22:05 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: rename SOF_RT711_JDSRC to SOF_JACK_JDSRC

Jack Detection source can be applied to all jacks, not only rt711.
No function changes.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: Intel: sof_sdw_rt_sdca_jack_common: test SOF_JACK_JDSRC in _exit
Bard Liao [Fri, 2 Jun 2023 20:22:04 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw_rt_sdca_jack_common: test SOF_JACK_JDSRC in _exit

if (!SOF_RT711_JDSRC(sof_sdw_quirk)) is tested in rt711_sdca_add_codec_
device_props(), and we don't add software node to the device if jack
source is not set. We need to do the same test in
sof_sdw_rt711_sdca_exit(), and avoid removing software node if jack
source is not set.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: Intel: sof_sdw: add multi dailink support for a codec
Bard Liao [Fri, 2 Jun 2023 20:22:03 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: add multi dailink support for a codec

A codec may support multiple dais for different purpose. For example,
the rt712 codec supports jack and amp on different dais and machine
driver needs to create different dailink for those dais.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: Intel: sdw_sof: append dai_type and remove codec_type
Bard Liao [Fri, 2 Jun 2023 20:22:02 +0000 (15:22 -0500)]
ASoC: Intel: sdw_sof: append dai_type and remove codec_type

We append codec type to dailink name to distinguish different dailink
on the same sdw link and direction. But we could create multi dailinks
for a codec and the dailink name will be duplicated if we append codec
type to the dailink name.
Appending dai type instead of codec type can solve the issue.
For example, if a codec supports JACK on dai 0 and AMP on dai 1, the
existing code will create dailinks
SDW0-Playback-SimpleJack or SDW0-Playback-SmartAmp for both dailinks,
and it will be SDW0-Playback-SimpleJack for dailink 0 and
SDW0-Playback-SmartAmp for dailink 1 after this change.
Then codec type is not used any more and can be removed.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: Intel: sof_sdw: add codec_info pointer
Bard Liao [Fri, 2 Jun 2023 20:22:01 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: add codec_info pointer

codec_info_list[codec_index] is used multiple times in the
create_sdw_dailink() function. Adding a codec_info pointer to shorten
the code. This is a preparation for the following up patches.
No function changed.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: Intel: sof_sdw: use predefine dailink id
Bard Liao [Fri, 2 Jun 2023 20:22:00 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: use predefine dailink id

Currently, we assign dailink ids in order, and shift with codec type.
The purpose is to have consistent dailink ids for topologies.
This can be simplified if we have a predefined dailink id in
sof_sdw_dai_info.
We reuse the existing ids as the predefine ids. So the dailink ids will
not be changed by this commit.
With this change, we no longer need to check the adr order described in a
snd_soc_acpi_link_adr array.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: Intel: sof_sdw: add dai info
Bard Liao [Fri, 2 Jun 2023 20:21:59 +0000 (15:21 -0500)]
ASoC: Intel: sof_sdw: add dai info

The existing code create a dailink for a codec. However, we may need
multi dailinks for a codec. This commit adds a new struct in
sof_sdw_codec_info{} to store the dai info of a codec.
The initial assumption if that we will create at most 3 dailink types
for a codec, since this is the max known with upcoming SDCA devices. We
may need to increase this number as new SDCA 'functions' become available.

One strong assumption is that all dailinks exposed are independent, as per
SDCA directions.

This commit just moves some items into the new sof_sdw_dai_info struct.
There is no function changed. Multi dais supported will be added in the
follow up commits.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: Intel: sof_sdw: add missing exit callback
Bard Liao [Fri, 2 Jun 2023 20:21:58 +0000 (15:21 -0500)]
ASoC: Intel: sof_sdw: add missing exit callback

Somehow .exit = sof_sdw_rt_amp_exit was missing in rt1318 codec info.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoAdd NAU8825C support
Mark Brown [Mon, 5 Jun 2023 12:11:17 +0000 (13:11 +0100)]
Add NAU8825C support

Merge series from David Lin <CTLIN0@nuvoton.com>:

This series adds nau8825c support. The driver can be used on
NAU8825B and NAU8825C.

13 months agoASoC: amd: vangogh: select CONFIG_SND_AMD_ACP_CONFIG
Arnd Bergmann [Fri, 2 Jun 2023 12:44:39 +0000 (14:44 +0200)]
ASoC: amd: vangogh: select CONFIG_SND_AMD_ACP_CONFIG

The vangogh driver just gained a link time dependency that now causes
randconfig builds to fail:

x86_64-linux-ld: sound/soc/amd/vangogh/pci-acp5x.o: in function `snd_acp5x_probe':
pci-acp5x.c:(.text+0xbb): undefined reference to `snd_amd_acp_find_config'

Fixes: e89f45edb747e ("ASoC: amd: vangogh: Add check for acp config flags in vangogh platform")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20230602124447.863476-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: nau8825: Update output control for NAU8825C
David Lin [Fri, 2 Jun 2023 04:09:24 +0000 (12:09 +0800)]
ASoC: nau8825: Update output control for NAU8825C

Update the output control for NAU8825C.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Link: https://lore.kernel.org/r/20230602040924.188913-4-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: nau8825: Update the calculation of FLL for NAU8825C
David Lin [Fri, 2 Jun 2023 04:09:23 +0000 (12:09 +0800)]
ASoC: nau8825: Update the calculation of FLL for NAU8825C

The FLL is updated to 24 bit with lower power consumption.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Link: https://lore.kernel.org/r/20230602040924.188913-3-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: nau8825: Add registers patch for NAU8825C
David Lin [Fri, 2 Jun 2023 04:09:22 +0000 (12:09 +0800)]
ASoC: nau8825: Add registers patch for NAU8825C

The patch is to update default regmap and register a set of registers
for NAU8825C.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Link: https://lore.kernel.org/r/20230602040924.188913-2-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoAdd TDM audio on StarFive JH7110
Mark Brown [Thu, 1 Jun 2023 15:43:46 +0000 (16:43 +0100)]
Add TDM audio on StarFive JH7110

Merge series from Walker Chen <walker.chen@starfivetech.com>:

This patchset adds TDM audio driver for the StarFive JH7110 SoC. The
first patch adds device tree binding for TDM module. The second patch
adds tdm driver support for JH7110 SoC. The last patch adds device tree
node and pins configuration of tdm to JH7110 dts.

The series has been tested on the VisionFive 2 board by plugging an
audio expansion board.

For more information of audio expansion board, you can take a look
at the following webpage:
https://wiki.seeedstudio.com/ReSpeaker_2_Mics_Pi_HAT/

13 months agoASoC: SOF: mediatek: add adsp debug dump
Trevor Wu [Thu, 1 Jun 2023 03:49:39 +0000 (11:49 +0800)]
ASoC: SOF: mediatek: add adsp debug dump

Add mt8188 and mt8186 .dbg_dump callback to print some information when
DSP panic occurs.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20230601034939.15802-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agofirmware: cs_dsp: Log that a bin file was loaded
Richard Fitzgerald [Wed, 31 May 2023 17:01:58 +0000 (18:01 +0100)]
firmware: cs_dsp: Log that a bin file was loaded

Change the message at the start of bin file loading from
cs_dsp_dbg() to cs_dsp_info() so that there is confirmation
in the kernel log that a bin file was loaded, and the name
of the file.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230531170158.2744700-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: starfive: Add JH7110 TDM driver
Walker Chen [Fri, 26 May 2023 14:54:01 +0000 (22:54 +0800)]
ASoC: starfive: Add JH7110 TDM driver

Add tdm driver support for the StarFive JH7110 SoC.

Signed-off-by: Walker Chen <walker.chen@starfivetech.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20230526145402.450-3-walker.chen@starfivetech.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: dt-bindings: Add TDM controller bindings for StarFive JH7110
Walker Chen [Fri, 26 May 2023 14:54:00 +0000 (22:54 +0800)]
ASoC: dt-bindings: Add TDM controller bindings for StarFive JH7110

Add bindings for TDM driver which supports multi-channel audio playback
and capture on JH7110 platform.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Walker Chen <walker.chen@starfivetech.com>
Link: https://lore.kernel.org/r/20230526145402.450-2-walker.chen@starfivetech.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: minor cleanup for soc_get_playback_capture()
Mark Brown [Wed, 31 May 2023 15:37:39 +0000 (16:37 +0100)]
ASoC: minor cleanup for soc_get_playback_capture()

Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

This is minor cleanup patches for soc_get_playback_capture().

13 months agoASoC: nau8825: Add the management of headset detection for power saving
David Lin [Wed, 31 May 2023 07:53:35 +0000 (15:53 +0800)]
ASoC: nau8825: Add the management of headset detection for power saving

The patch is to manage HSD feature for power saving. The detail is to
disable HSD feature after the headset detection is done. When the jack
is inserted, the HSD feature will be enabled again.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Link: https://lore.kernel.org/r/20230531075334.168637-1-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: soc-pcm.c: tidyup playback/capture_only at soc_get_playback_capture()
Kuninori Morimoto [Tue, 30 May 2023 00:50:08 +0000 (00:50 +0000)]
ASoC: soc-pcm.c: tidyup playback/capture_only at soc_get_playback_capture()

soc_get_playback_capture() (A) returns number of substreams for
playback/capture, and then, we can use playback/capture_only flag (X)(Y).

(A)     static int soc_get_playback_capture(...)
{
...
(X) if (dai_link->playback_only) {
(*) *playback = 1;
*capture = 0;
}

(Y) if (dai_link->capture_only) {
*playback = 0;
(*) *capture = 1;
}
...
}

But this flag should not have effect to opposite side stream (*).
This patch tidyup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87sfbezlq8.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: soc-pcm.c: use temporary variable at soc_get_playback_capture()
Kuninori Morimoto [Tue, 30 May 2023 00:50:01 +0000 (00:50 +0000)]
ASoC: soc-pcm.c: use temporary variable at soc_get_playback_capture()

soc_get_playback_capture() (A) returns number of substreams for
playback/capture (B).

(A) static int soc_get_playback_capture(...,
(B) int *playback, int *capture)
{
...
for_each_xxx(...) {
if (xxx)
return -EINVAL;
=> *playback = 1;
...
=> *capture = 1;
...
}
...
}

But, it is directly updating playback/capture which is the result of this
function even though it might be error. It should be updated in case of
succeed only. This patch updates it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87ttvuzlqe.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: soc-pcm.c: cleanup soc_get_playback_capture() error
Kuninori Morimoto [Tue, 30 May 2023 00:49:56 +0000 (00:49 +0000)]
ASoC: soc-pcm.c: cleanup soc_get_playback_capture() error

soc_get_playback_capture() (A) checks dai_link status, and indicate error
if it was not matching (B).

(A) static int soc_get_playback_capture(...)
{
...
 ^ if (dai_link->dynamic && dai_link->num_cpus > 1) {
 | dev_err(rtd->dev,
(B) "DPCM doesn't support Multi CPU for Front-Ends yet\n");
 | return -EINVAL;
 v }
...
}

We can use 100 char for 1 line today. This patch cleanup error code line.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87v8gazlqk.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: soc-pcm.c: use dai_link on soc_get_playback_capture()
Kuninori Morimoto [Tue, 30 May 2023 00:49:50 +0000 (00:49 +0000)]
ASoC: soc-pcm.c: use dai_link on soc_get_playback_capture()

soc_get_playback_capture() (A) is using rtd->dai_link->xxx everywhere.
Because of that, 1 line is unnecessarily long and not readable.

(A) static int soc_get_playback_capture(...)
{
if (rtd->dai_link->dynamic ...) {
    ^^^^^^^^^^^^^
...
} else {
int cpu_capture = rtd->dai_link->c2c_params ?
  ^^^^^^^^^^^^^
...
}

if (rtd->dai_link->playback_only) {
    ^^^^^^^^^^^^^
...
}
...
}

This patch uses variable "dai_link" to be clear code.
Nothing changes the meanings.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87wn0qzlqp.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: soc-pcm.c: indicate error if stream has no playback no capture
Kuninori Morimoto [Tue, 30 May 2023 00:49:43 +0000 (00:49 +0000)]
ASoC: soc-pcm.c: indicate error if stream has no playback no capture

soc_get_playback_capture() (A) returns number of substreams for
playback/capture (B).
ASoC will probe the Sound Card and mapps CPU<->Codec pair.

(A) static int soc_get_playback_capture(...,
(B)     int *playback, int *capture)
{
...
if (rtd->dai_link->playback_only) {
*playback = 1;
*capture = 0;
}

if (rtd->dai_link->capture_only) {
*playback = 0;
*capture = 1;
}
(C)
return 0;
}

But it might be no playback no capture if it returns playback=0, capture=0.
It is very difficult to notice about it. This patch indicates error at (C)
then.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87y1l6zlqx.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoES8316 audio codec fixes on Rock5B
Mark Brown [Tue, 30 May 2023 19:41:29 +0000 (20:41 +0100)]
ES8316 audio codec fixes on Rock5B

Merge series from Cristian Ciocaltea <cristian.ciocaltea@collabora.com>:

This patch series handles a few issues related to the ES8316 audio
codec, discovered while doing some testing on the Rock 5B board.

13 months agoASoC: es8316: Do not set rate constraints for unsupported MCLKs
Cristian Ciocaltea [Tue, 30 May 2023 18:11:39 +0000 (21:11 +0300)]
ASoC: es8316: Do not set rate constraints for unsupported MCLKs

When using the codec through the generic audio graph card, there are at
least two calls of es8316_set_dai_sysclk(), with the effect of limiting
the allowed sample rates according to the MCLK/LRCK ratios supported by
the codec:

1. During audio card setup, to set the initial MCLK - see
   asoc_simple_init_dai().

2. Before opening a stream, to update MCLK, according to the stream
   sample rate and the multiplication factor - see
   asoc_simple_hw_params().

In some cases the initial MCLK might be set to a frequency that doesn't
match any of the supported ratios, e.g. 12287999 instead of 12288000,
which is only 1 Hz below the supported clock, as that is what the
hardware reports. This creates an empty list of rate constraints, which
is further passed to snd_pcm_hw_constraint_list() via
es8316_pcm_startup(), and causes the following error on the very first
access of the sound card:

  $ speaker-test -D hw:Analog,0 -F S16_LE -c 2 -t wav
  Broken configuration for playback: no configurations available: Invalid argument
  Setting of hwparams failed: Invalid argument

Note that all subsequent retries succeed thanks to the updated MCLK set
at point 2 above, which uses a computed frequency value instead of a
reading from the hardware registers. Normally this would have mitigated
the issue, but es8316_pcm_startup() executes before the 2nd call to
es8316_set_dai_sysclk(), hence it cannot make use of the updated
constraints.

Since es8316_pcm_hw_params() performs anyway a final validation of MCLK
against the stream sample rate and the supported MCLK/LRCK ratios, fix
the issue by ensuring that sysclk_constraints list is only set when at
least one supported sample rate is autodetected by the codec.

Fixes: b8b88b70875a ("ASoC: add es8316 codec driver")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Link: https://lore.kernel.org/r/20230530181140.483936-3-cristian.ciocaltea@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: es8316: Increment max value for ALC Capture Target Volume control
Cristian Ciocaltea [Tue, 30 May 2023 18:11:38 +0000 (21:11 +0300)]
ASoC: es8316: Increment max value for ALC Capture Target Volume control

The following error occurs when trying to restore a previously saved
ALSA mixer state (tested on a Rock 5B board):

  $ alsactl --no-ucm -f /tmp/asound.state store hw:Analog
  $ alsactl --no-ucm -I -f /tmp/asound.state restore hw:Analog
  alsactl: set_control:1475: Cannot write control '2:0:0:ALC Capture Target Volume:0' : Invalid argument

According to ES8316 datasheet, the register at address 0x2B, which is
related to the above mixer control, contains by default the value 0xB0.
Considering the corresponding ALC target bits (ALCLVL) are 7:4, the
control is initialized with 11, which is one step above the maximum
value allowed by the driver:

 ALCLVL | dB gain
 -------+--------
  0000  |  -16.5
  0001  |  -15.0
  0010  |  -13.5
  ....  |  .....
  0111  |   -6.0
  1000  |   -4.5
  1001  |   -3.0
  1010  |   -1.5
  ....  |  .....
  1111  |   -1.5

The tests performed using the VU meter feature (--vumeter=TYPE) of
arecord/aplay confirm the specs are correct and there is no measured
gain if the 1011-1111 range would have been mapped to 0 dB:

 dB gain | VU meter %
 --------+-----------
   -6.0  |  30-31
   -4.5  |  35-36
   -3.0  |  42-43
   -1.5  |  50-51
    0.0  |  50-51

Increment the max value allowed for ALC Capture Target Volume control,
so that it matches the hardware default.  Additionally, update the
related TLV to prevent an artificial extension of the dB gain range.

Fixes: b8b88b70875a ("ASoC: add es8316 codec driver")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Link: https://lore.kernel.org/r/20230530181140.483936-2-cristian.ciocaltea@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: topology: allow for partial dailink stream_name
Mark Brown [Tue, 30 May 2023 16:43:11 +0000 (17:43 +0100)]
ASoC: topology: allow for partial dailink stream_name

Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

The topology file and the machine driver rely on common definitions
for the dailink stream_name.  To avoid any backwards-compatibility
problems, the machine driver stream names are set in stone and cannot
be modified.

This is problematic when we try to name some of the topology widgets
after the stream_name, since the widget name is limited to 44
characters

tools/include/uapi/sound/asound.h:#define SNDRV_CTL_ELEM_ID_NAME_MAXLEN 44

Existing examples include "Analog Playback and Capture" for HDaudio
dailinks, which leaves less than 20 chars to identify widgets/controls
with a meaningful name.

Since the 44-char limit is part of the UAPI definitions, we assumed
there is no way to increase it.

This patchset suggests instead a partial match which allows topology
files to use a shorter stream_name, which in turn allows for
self-explanatory widget names that comply with the 44-char limit.

This should not break any existing setup but with the introduction of
a partial match new dailinks should be named carefully to avoid
confusions between e.g. 'link1' and 'link10'. The last patch fixes
such an issue in the 'nocodec' test topology used by Intel.

13 months agoASoC: SOF: add mt8188 audio support
Mark Brown [Tue, 30 May 2023 16:43:05 +0000 (17:43 +0100)]
ASoC: SOF: add mt8188 audio support

Merge series from Trevor Wu <trevor.wu@mediatek.com>:

This adds mt8188 audio support.

13 months agoASoC: SOF: Intel: HDA: Limit the number of dai drivers for nocodec mode
Ranjani Sridharan [Fri, 26 May 2023 20:41:49 +0000 (15:41 -0500)]
ASoC: SOF: Intel: HDA: Limit the number of dai drivers for nocodec mode

With a common kernel config for nocodec and codec modes, the number of DAI
drivers will be set to 15 for nocodec as well. So adjust this when set
the machine params for the nocodec mode if the debug flag is set.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230526204149.456068-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: SOF: topology: Use partial match for connecting DAI link and DAI widget
Ranjani Sridharan [Fri, 26 May 2023 20:41:48 +0000 (15:41 -0500)]
ASoC: SOF: topology: Use partial match for connecting DAI link and DAI widget

This allows setting shorter names for the widget stream names in
topology. For example, in the case of HDA Analog DAI link, the stream
name is "Analog Playback and Capture". But it is enough to match "Analog"
in the DAI link stream name with a widget's stream name. This is needed
to set more meaningful names for the DAI widgets using the stream name
in topology.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230526204149.456068-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: topology: Allow partial matching when finding DAI link
Ranjani Sridharan [Fri, 26 May 2023 20:41:47 +0000 (15:41 -0500)]
ASoC: topology: Allow partial matching when finding DAI link

This allows for setting shorter link names in topology. For example,
for the HDA Analog DAI link, just "Analog" would suffice instead of
"Analog Playback and Capture"

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230526204149.456068-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: ti: davinci-mcasp: Use pcm_for_each_format() macro
Min-Hua Chen [Fri, 19 May 2023 21:16:36 +0000 (05:16 +0800)]
ASoC: ti: davinci-mcasp: Use pcm_for_each_format() macro

Use pcm_for_each_format for the PCM format iteration and fix the
following sparse warnings.

sound/soc/ti/davinci-mcasp.c:1336:26: sparse: warning: restricted snd_pcm_format_t degrades to integer
sound/soc/ti/davinci-mcasp.c:1358:26: sparse: warning: restricted snd_pcm_format_t degrades to integer
sound/soc/ti/davinci-mcasp.c:1438:26: sparse: warning: restricted snd_pcm_format_t degrades to integer

No functional changes.

Signed-off-by: Min-Hua Chen <minhuadotchen@gmail.com>
Link: https://lore.kernel.org/r/20230519211636.3699-1-minhuadotchen@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: amd: vangogh: Add check for acp config flags in vangogh platform
Venkata Prasad Potturu [Tue, 30 May 2023 11:07:58 +0000 (16:37 +0530)]
ASoC: amd: vangogh: Add check for acp config flags in vangogh platform

We have SOF and generic ACP support enabled for Vangogh platform
on some machines. Since we have same PCI id used for probing,
add check for machine configuration flag to avoid conflict with
newer pci drivers. Such machine flag has been initialized via
dmi match on few Vangogh based machines. If no flag is
specified probe and register older platform device.

Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com>
Link: https://lore.kernel.org/r/20230530110802.674939-1-venkataprasad.potturu@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: SOF: mediatek: add mt8188 audio support
Trevor Wu [Tue, 23 May 2023 02:59:32 +0000 (10:59 +0800)]
ASoC: SOF: mediatek: add mt8188 audio support

Add mt8188 dai driver and specify of_machine to support mt8188 audio.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230523025933.30494-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: cs42l42: Add PLL ratio table values
Vitaly Rodionov [Wed, 24 May 2023 12:52:36 +0000 (13:52 +0100)]
ASoC: cs42l42: Add PLL ratio table values

Add 4.8Mhz 9.6Mhz and 19.2MHz SCLK values
for MCLK 12MHz and 12.288MHz requested by Intel.

Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230524125236.57149-1-vitalyr@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: cs35l45: Relicense to GPL only
Charles Keepax [Wed, 10 May 2023 09:25:34 +0000 (10:25 +0100)]
ASoC: cs35l45: Relicense to GPL only

Cirrus never intended to upstream dual licensed code, convert to
GPL only.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Vlad Karpovich <vkarpovi@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230510092534.3919120-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: da7219: Add jack insertion detection polarity
Mark Brown [Tue, 23 May 2023 22:11:42 +0000 (23:11 +0100)]
ASoC: da7219: Add jack insertion detection polarity

Merge series from David Rau <David.Rau.opensource@dm.renesas.com>:

This patchset adds the support of DA7219 Jack insertion detection
polarity selection.

The first patch replaces the old txt binding with a new schema binding.

The second patch adds `dlg,jack-ins-det-pty` property for Jack
insertion detection polarity selection.

The last patch adds the driver support for this topic.

The series has been verified on the DA7219 development kit.

13 months agoImprove support for sof_ipc{3|4}_bytes_ext_put
Mark Brown [Tue, 23 May 2023 21:42:57 +0000 (22:42 +0100)]
Improve support for sof_ipc{3|4}_bytes_ext_put

Merge series from Daniel Baluta <daniel.baluta@oss.nxp.com>:

This patch series provides better handling of cases where sending
a data blob to FW results in a validation error.

In this case we restore to the last good known value instead of keeping
the data that firwmare rejected.

13 months agoASoC: mt6359: kselftest fix and driver extension
Mark Brown [Tue, 23 May 2023 21:42:50 +0000 (22:42 +0100)]
ASoC: mt6359: kselftest fix and driver extension

Merge series from Trevor Wu <trevor.wu@mediatek.com>:

The patch series includes a kselftest fix and changes for extending
driver capability to support more use cases.

13 months agoASoC: dt-bindings: rt1016: Convert to dtschema
Anup Sharma [Fri, 5 May 2023 13:30:42 +0000 (19:00 +0530)]
ASoC: dt-bindings: rt1016: Convert to dtschema

Convert the RT1016 Stereo Audio Amplifier bindings to DT schema

Signed-off-by: Anup Sharma <anupnewsmail@gmail.com>
Link: https://lore.kernel.org/r/ZFUFAmBJXvkQAG7m@yoga
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: do not include runtime_pm.h if not needed
Mark Brown [Tue, 23 May 2023 19:49:28 +0000 (20:49 +0100)]
ASoC: do not include runtime_pm.h if not needed

Merge series from Claudiu Beznea <claudiu.beznea@microchip.com>:

Series removes the pm_runtime.h inclusion in files where
APIs exported though pm_runtime.h are not used. In case
of files that make use of pm.h which comes form pm_runtime.h
added patch 2/2.

13 months agoASoC: SOF: Intel: mtl: Enable multicore support
Mark Brown [Tue, 23 May 2023 19:49:22 +0000 (20:49 +0100)]
ASoC: SOF: Intel: mtl: Enable multicore support

Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:

The following series will enable multicore support on MTL platforms similarly
to other Intel platforms.

The TGL patch is included to simplify the core_put implementation.

Multicore support can be enabled by updated topologies, with current set of
tplg files this series is not introducing any runtime change.

13 months agoASoC: mediatek: mt6359: update route for lineout mux
Trevor Wu [Mon, 8 May 2023 07:15:32 +0000 (15:15 +0800)]
ASoC: mediatek: mt6359: update route for lineout mux

Originally, lineout playback source can only be DAC_3RD. Some SoC
masters only support stereo MTKAIF outputs, so lineout path can't be
used in such case.

MTKAIF connections are as follows.
MOSI0 -> DAC_L
MOSI1 -> DAC_R
MOSI2 -> DAC_3rd

In the patch, lineout playback source can be chosen between DAC_L and
DAC_3rd, so sound can be outputted via lineout even though SoC only
supports stereo MTKAIF outputs.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20230508071532.21665-5-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: mediatek: mt6359: add mtkaif gpio setting
Trevor Wu [Mon, 8 May 2023 07:15:31 +0000 (15:15 +0800)]
ASoC: mediatek: mt6359: add mtkaif gpio setting

Add mtkaif gpio driving to increase signal strength and smt setting to
prevent from overshooting.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20230508071532.21665-4-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: mediatek: mt6359: fix kselftest error of playback gain
Trevor Wu [Mon, 8 May 2023 07:15:30 +0000 (15:15 +0800)]
ASoC: mediatek: mt6359: fix kselftest error of playback gain

kselftest tries to read/write the default value. The default register
value of playback gain is 0x1F(mute), but max gain we specified is 0x12.
The range of the control is 0x0~0x12 and mute(0x1F) is only used in the
driver internally. To solve the problem, implement a new callback
mt6359_get_playback_volsw to report user configured volume instead of
the register value.

In addition, update max of "Headset Volume" to 0x12, so it can match the
maximum seen on latest data sheet.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20230508071532.21665-3-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: mediatek: mt6359: add supply for MTKAIF
Trevor Wu [Mon, 8 May 2023 07:15:29 +0000 (15:15 +0800)]
ASoC: mediatek: mt6359: add supply for MTKAIF

There are three output data pins MISO0, MISO1 and MISO2 for mt6359.
UL_SRC should be enabled when MISO0 or MISO1 is used, and UL_SRC_34
should be enabled when MISO2 is used.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20230508071532.21665-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: sof: Improve sof_ipc4_bytes_ext_put function
Paul Olaru [Wed, 3 May 2023 08:10:49 +0000 (11:10 +0300)]
ASoC: sof: Improve sof_ipc4_bytes_ext_put function

The function is improved in the way that if the firmware returns a
validation error on the newly sent bytes, then the kernel will
automatically restore to the old bytes value for a given kcontrol.

This way, if the firmware rejects a data blob then the kernel will also
reject it, instead of saving it for the next suspend/resume cycle. The
old behaviour is that the kernel would save it anyway and on next
firmware boot it would apply the previously-rejected configuration,
leading to errors during playback.

Additionally, the function also saves previously validated
configurations, so that if the firmware does end up rejecting a new
bytes value the kernel can send an old, previously-valid configuration.

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20230503081049.73847-3-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: sof: Improve sof_ipc3_bytes_ext_put function
Paul Olaru [Wed, 3 May 2023 08:10:48 +0000 (11:10 +0300)]
ASoC: sof: Improve sof_ipc3_bytes_ext_put function

The function is improved in the way that if the firmware returns a
validation error on the newly sent bytes, then the kernel will
automatically restore to the old bytes value for a given kcontrol.

This way, if the firmware rejects a data blob then the kernel will also
reject it, instead of saving it for the next suspend/resume cycle. The
old behaviour is that the kernel would save it anyway and on next
firmware boot it would apply the previously-rejected configuration,
leading to errors during playback.

Additionally, the function also saves previously validated
configurations, so that if the firmware does end up rejecting a new
bytes value the kernel can send an old, previously-valid configuration.

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20230503081049.73847-2-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: da7219: Add Jack insertion detection polarity
David Rau [Tue, 23 May 2023 16:18:21 +0000 (16:18 +0000)]
ASoC: da7219: Add Jack insertion detection polarity

Add support of selecting insertion detection polarity
- Default polarity (Low)
- Inverted polarity (High)

Correct the keywords of parsing `dlg,jack-det-rate`
bases on the new DT binding.

Signed-off-by: David Rau <David.Rau.opensource@dm.renesas.com>
Link: https://lore.kernel.org/r/20230523161821.4260-4-David.Rau.opensource@dm.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: dt-bindings: da7219: Add jack-ins-det-pty property
David Rau [Tue, 23 May 2023 16:18:20 +0000 (16:18 +0000)]
ASoC: dt-bindings: da7219: Add jack-ins-det-pty property

Add `dlg,jack-ins-det-pty` property for Jack insertion detection
polarity selection.

Signed-off-by: David Rau <David.Rau.opensource@dm.renesas.com>
Link: https://lore.kernel.org/r/20230523161821.4260-3-David.Rau.opensource@dm.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: dt-bindings: dialog,da7219: convert to dtschema
David Rau [Tue, 23 May 2023 16:18:19 +0000 (16:18 +0000)]
ASoC: dt-bindings: dialog,da7219: convert to dtschema

- Convert Dialog DA7219 bindings to DT schema format.
- Remove unused `dlg,ldo-lvl` property.

Signed-off-by: David Rau <David.Rau.opensource@dm.renesas.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20230523161821.4260-2-David.Rau.opensource@dm.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: SOF: Intel: hda-dai: Fix locking in hda_ipc4_pre_trigger()
Harshit Mogalapalli [Fri, 19 May 2023 06:44:01 +0000 (23:44 -0700)]
ASoC: SOF: Intel: hda-dai: Fix locking in hda_ipc4_pre_trigger()

hda_ipc4_pre_trigger() has two issues:
 1. In the default case, we are returning without unlocking the mutex.
 2. In case SNDRV_PCM_TRIGGER_STOP: when ret is less than zero it goes
    to out, unlocks but returns zero instead of a negative value.

Fix this by changing the final return value to 'ret' instead of zero,
and initialize 'ret' to zero in the start of the function.

Fixes: 225f37b578a9 ("ASoC: SOF: ipc4-pcm: reset all pipelines during FE DAI hw_free")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20230519064404.1659637-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: SOF: ipc4-topology: Fix an unsigned comparison which can never be negative
Yang Li [Tue, 16 May 2023 08:11:16 +0000 (16:11 +0800)]
ASoC: SOF: ipc4-topology: Fix an unsigned comparison which can never be negative

The return value from the call to sof_ipc4_get_valid_bits() is int.
However, the return value is being assigned to an unsigned
int variable 'out_ref_valid_bits', so making it an int.

Eliminate the following warning:
./sound/soc/sof/ipc4-topology.c:1537:6-24: WARNING: Unsigned expression compared with zero: out_ref_valid_bits < 0

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4985
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20230516081116.71370-1-yang.lee@linux.alibaba.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: SOF: Intel: tgl: unify core_put on IPC3 & IPC4 path
Rander Wang [Tue, 23 May 2023 10:32:17 +0000 (13:32 +0300)]
ASoC: SOF: Intel: tgl: unify core_put on IPC3 & IPC4 path

Firmware may do context saving before powering off primary core, so driver
needs to send ipc msg by set_core_state. In IPC4 path, firmware needs to
save current context to IMR before powering off primary core. Firmware
does nothing for set_core_state message in IPC3 path. So IPC4 and IPC3
can share the same operation sequence.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230523103217.20412-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: SOF: Intel: mtl: add core_get & put support on MeterLake platforms
Rander Wang [Tue, 23 May 2023 10:32:16 +0000 (13:32 +0300)]
ASoC: SOF: Intel: mtl: add core_get & put support on MeterLake platforms

In core_get case, driver can power up primary core and don't need to send
ipc message to fw. Non-primary core should be powered up by fw with ipc
message.

In core_put case, driver should first send ipc message to fw to disable dsp
core then power down primary core if the target is primary core.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230523103217.20412-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: use pm.h instead of runtime_pm.h
Claudiu Beznea [Wed, 17 May 2023 09:49:03 +0000 (12:49 +0300)]
ASoC: use pm.h instead of runtime_pm.h

Do not include pm_runtime.h header in files where runtime PM support is
not implemented. Use pm.h instead as suspend to RAM specific
implementation is available.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20230517094903.2895238-3-claudiu.beznea@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: do not include pm_runtime.h if not used
Claudiu Beznea [Wed, 17 May 2023 09:49:02 +0000 (12:49 +0300)]
ASoC: do not include pm_runtime.h if not used

Do not include pm_runtime.h header in files where APIs exported by
pm_runtime.h are not used.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com> # for omap-mcbsp-st.c
Link: https://lore.kernel.org/r/20230517094903.2895238-2-claudiu.beznea@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: nau8825: Add pre-charge actions for input
David Lin [Tue, 23 May 2023 08:33:04 +0000 (16:33 +0800)]
ASoC: nau8825: Add pre-charge actions for input

Adding pre-charge actions to make FEPGA power stable faster. It
improve the recording quality at the beginning. Thus, it is also
meaningfully to decrease the final adc delay time.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Link: https://lore.kernel.org/r/20230523083303.98436-1-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: SOF: amd: Add pci revision id check
Venkata Prasad Potturu [Tue, 23 May 2023 07:20:01 +0000 (12:50 +0530)]
ASoC: SOF: amd: Add pci revision id check

Add pci revision id check for renoir and rembrandt platforms.

Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com>
Link: https://lore.kernel.org/r/20230523072009.2379198-1-venkataprasad.potturu@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: topology: Clean up error messages handling
Mark Brown [Mon, 22 May 2023 15:32:40 +0000 (16:32 +0100)]
ASoC: topology: Clean up error messages handling

Merge series from Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>:

Series of patches cleaning up error messages when loading topology. In
few places instead of logging in place of failure message is logged in
caller. Additionally there are places where both caller and failing
function log error, leading to unnecessary logs. Clean all of the above
up.

13 months agoASoC: SOF: ipc4: Querry CPC value from firmware's
Mark Brown [Mon, 22 May 2023 14:48:54 +0000 (15:48 +0100)]
ASoC: SOF: ipc4: Querry CPC value from firmware's

Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:

The MOD_INIT_INSTANCE message contains a CPC (Cycles Per Chunk/processing unit)
parameter.
This CPC value is used by the firmware to calculate the total cycles needed by
the enabled module instances and based on this it can decide to set the
frequency of the DSP core(s).

The manifest section of the firmware image contains a module configuration
section, where a per module table of configurations are listed with measured
CPC values as triplet of IBS/IBS/CPC (Input/Output buffer size - corresponding
to the selected audio format).

In case the CPC value is 0 (missing from the manifest or the
configuration cannot be matched) the firmware will force the DSP cores
to maximum speed to avoid audio glitches due to starvation.  In these
cases the kernel will print a warning message to let the SOF developers
know about the gap and provide information to correct it with a firmware
update.

13 months agoASoC: rt5682s: Use the devm_clk_get_optional() helper
Christophe JAILLET [Sat, 20 May 2023 14:58:24 +0000 (16:58 +0200)]
ASoC: rt5682s: Use the devm_clk_get_optional() helper

Use devm_clk_get_optional() instead of hand writing it.
This saves some LoC and improves the semantic.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/f538c24ad7b1926478347a03b5b7f0432e195e3b.1684594691.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: cs53l30: Use the devm_clk_get_optional() helper
Christophe JAILLET [Sat, 20 May 2023 14:54:06 +0000 (16:54 +0200)]
ASoC: cs53l30: Use the devm_clk_get_optional() helper

Use devm_clk_get_optional() instead of hand writing it.
This saves some LoC and improves the semantic.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/3219effee5c7f190530bdb1ef8ec35cb142e3611.1684594433.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: stm32: sai: Use the devm_clk_get_optional() helper
Christophe JAILLET [Sat, 20 May 2023 15:00:50 +0000 (17:00 +0200)]
ASoC: stm32: sai: Use the devm_clk_get_optional() helper

Use devm_clk_get_optional() instead of hand writing it.
This saves some LoC and improves the semantic.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/f7987f18dadf77bfa09969fd4c82d5a0f4e4e3b7.1684594838.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: rt5659: Use the devm_clk_get_optional() helper
Christophe JAILLET [Sat, 20 May 2023 14:56:00 +0000 (16:56 +0200)]
ASoC: rt5659: Use the devm_clk_get_optional() helper

Use devm_clk_get_optional() instead of hand writing it.
This saves some LoC and improves the semantic.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/5b44b2fddd8973e949e4ae2132971b147cfd1ec1.1684594544.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: cs42l51: Use the devm_clk_get_optional() helper
Christophe JAILLET [Sat, 20 May 2023 14:50:54 +0000 (16:50 +0200)]
ASoC: cs42l51: Use the devm_clk_get_optional() helper

Use devm_clk_get_optional() instead of hand writing it.
This saves some LoC and improves the semantic.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/3debf3bb7ea504ee9ca2d8eb0f948a426681cbdd.1684594240.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: atmel: sam9g20_wm8731: Remove the unneeded include <linux/i2c.h>
Christophe JAILLET [Sat, 20 May 2023 10:21:58 +0000 (12:21 +0200)]
ASoC: atmel: sam9g20_wm8731: Remove the unneeded include <linux/i2c.h>

This driver does not use i2c, so there is no point in including
<linux/i2c.h>

Remove it.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/9b39a59f5829d200d7d1fac4e993dbf8ce05836d.1684578051.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: adau1761: Use the devm_clk_get_optional() helper
Christophe JAILLET [Sat, 20 May 2023 14:48:19 +0000 (16:48 +0200)]
ASoC: adau1761: Use the devm_clk_get_optional() helper

Use devm_clk_get_optional() instead of hand writing it.
This saves some LoC and improves the semantic.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/ab0fe7e7ecf965df84b9516ba65428af9b3805c1.1684594081.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: topology: Remove redundant log
Amadeusz Sławiński [Fri, 19 May 2023 19:56:11 +0000 (21:56 +0200)]
ASoC: topology: Remove redundant log

soc_tplg_valid_header() logs all the failures in detail already.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230519195611.4068853-6-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: topology: Remove redundant log
Amadeusz Sławiński [Fri, 19 May 2023 19:56:10 +0000 (21:56 +0200)]
ASoC: topology: Remove redundant log

soc_tplg_dapm_complete() logs all the failures in detail already.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230519195611.4068853-5-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: topology: Do not split message string on multiple lines
Amadeusz Sławiński [Fri, 19 May 2023 19:56:09 +0000 (21:56 +0200)]
ASoC: topology: Do not split message string on multiple lines

Kernel coding guidelines recommend to not split string unnecessarily.
While at it adapt the other print present in the function to 100
characters line limit.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230519195611.4068853-4-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: topology: Remove redundant logs
Amadeusz Sławiński [Fri, 19 May 2023 19:56:08 +0000 (21:56 +0200)]
ASoC: topology: Remove redundant logs

soc_tplg_add_kcontrol() logs all the failures in detail already.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230519195611.4068853-3-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: topology: Log control load errors in soc_tplg_control_load()
Amadeusz Sławiński [Fri, 19 May 2023 19:56:07 +0000 (21:56 +0200)]
ASoC: topology: Log control load errors in soc_tplg_control_load()

Simplify code by logging any errors in function that does the actual
work instead of doing so in its callers.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230519195611.4068853-2-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: SOF: ipc4-loader/topology: Query the CPC value from manifest
Peter Ujfalusi [Mon, 22 May 2023 10:13:13 +0000 (13:13 +0300)]
ASoC: SOF: ipc4-loader/topology: Query the CPC value from manifest

The manifest's firmware module configuration section contains the measured
CPC values along with a matching IBS/OBS values.

The CPC can be looked up by looking for a matching IBS/OBS entry.
In case of multiple matches we will use the highest CPC value.

If there is no mod_cfg or no CPC value (all 0) or no match was found then
print warning message and use 0 as CPC value.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20230522101313.12519-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: SOF: ipc4-topology: Do not use the CPC value from topology
Peter Ujfalusi [Mon, 22 May 2023 10:13:12 +0000 (13:13 +0300)]
ASoC: SOF: ipc4-topology: Do not use the CPC value from topology

Stop parsing the CPC value from topology to module_base_cfg.
The CPC value is only set for few modules in topology which makes the CPC
handling inconsistent.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20230522101313.12519-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: SOF: ipc4-topology: Rename sof_ipc4_update_pipeline_mem_usage() to be generic
Peter Ujfalusi [Mon, 22 May 2023 10:13:11 +0000 (13:13 +0300)]
ASoC: SOF: ipc4-topology: Rename sof_ipc4_update_pipeline_mem_usage() to be generic

Rename sof_ipc4_update_pipeline_mem_usage() to
sof_ipc4_update_resource_usage() in order to be re-usable for generic
resource storage, calculation of a module, like CPC adjustment.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20230522101313.12519-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: SOF: ipc4-loader: Save a pointer to fm_config in sof_ipc4_fw_module
Peter Ujfalusi [Mon, 22 May 2023 10:13:10 +0000 (13:13 +0300)]
ASoC: SOF: ipc4-loader: Save a pointer to fm_config in sof_ipc4_fw_module

Save a pointer to the firmware module configuration area in
sof_ipc4_fw_module struct for later use.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20230522101313.12519-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoASoC: SOF: ipc4-loader: Drop unused bss_size from struct sof_ipc4_fw_module
Peter Ujfalusi [Mon, 22 May 2023 10:13:09 +0000 (13:13 +0300)]
ASoC: SOF: ipc4-loader: Drop unused bss_size from struct sof_ipc4_fw_module

The bss_size is only set, but not used by the code, remove it.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20230522101313.12519-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
13 months agoLinux 6.4-rc3
Linus Torvalds [Sun, 21 May 2023 21:05:48 +0000 (14:05 -0700)]
Linux 6.4-rc3

13 months agoMerge tag 'uml-for-linus-6.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 21 May 2023 21:03:22 +0000 (14:03 -0700)]
Merge tag 'uml-for-linus-6.4-rc3' of git://git./linux/kernel/git/uml/linux

Pull UML fix from Richard Weinberger:

 - Fix modular build for UML watchdog

* tag 'uml-for-linus-6.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux:
  um: harddog: fix modular build

13 months agoMerge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Linus Torvalds [Sun, 21 May 2023 20:58:37 +0000 (13:58 -0700)]
Merge tag 'for-linus' of git://git./virt/kvm/kvm

Pull kvm fixes from Paolo Bonzini:
 "ARM:

   - Plug a race in the stage-2 mapping code where the IPA and the PA
     would end up being out of sync

   - Make better use of the bitmap API (bitmap_zero, bitmap_zalloc...)

   - FP/SVE/SME documentation update, in the hope that this field
     becomes clearer...

   - Add workaround for Apple SEIS brokenness to a new SoC

   - Random comment fixes

  x86:

   - add MSR_IA32_TSX_CTRL into msrs_to_save

   - fixes for XCR0 handling in SGX enclaves

  Generic:

   - Fix vcpu_array[0] races

   - Fix race between starting a VM and 'reboot -f'"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: VMX: add MSR_IA32_TSX_CTRL into msrs_to_save
  KVM: x86: Don't adjust guest's CPUID.0x12.1 (allowed SGX enclave XFRM)
  KVM: VMX: Don't rely _only_ on CPUID to enforce XCR0 restrictions for ECREATE
  KVM: Fix vcpu_array[0] races
  KVM: VMX: Fix header file dependency of asm/vmx.h
  KVM: Don't enable hardware after a restart/shutdown is initiated
  KVM: Use syscore_ops instead of reboot_notifier to hook restart/shutdown
  KVM: arm64: vgic: Add Apple M2 PRO/MAX cpus to the list of broken SEIS implementations
  KVM: arm64: Clarify host SME state management
  KVM: arm64: Restructure check for SVE support in FP trap handler
  KVM: arm64: Document check for TIF_FOREIGN_FPSTATE
  KVM: arm64: Fix repeated words in comments
  KVM: arm64: Constify start/end/phys fields of the pgtable walker data
  KVM: arm64: Infer PA offset from VA in hyp map walker
  KVM: arm64: Infer the PA offset from IPA in stage-2 map walker
  KVM: arm64: Use the bitmap API to allocate bitmaps
  KVM: arm64: Slightly optimize flush_context()

13 months agoMerge tag 'perf-tools-fixes-for-v6.4-1-2023-05-20' of git://git.kernel.org/pub/scm...
Linus Torvalds [Sun, 21 May 2023 20:24:59 +0000 (13:24 -0700)]
Merge tag 'perf-tools-fixes-for-v6.4-1-2023-05-20' of git://git./linux/kernel/git/acme/linux

Pull perf tools fixes from Arnaldo Carvalho de Melo:

 - Fail graciously if BUILD_BPF_SKEL=1 is specified and clang isn't
   available

 - Add empty 'struct rq' to 'perf lock contention' to satisfy libbpf
   'runqueue' type verification. This feature is built only with
   BUILD_BPF_SKEL=1

 - Make vmlinux.h use bpf.h and perf_event.h in source directory, not
   system ones that may be old and not have things like 'union
   perf_sample_weight'

 - Add system include paths to BPF builds to pick things missing in the
   headers included by clang -target bpf

 - Update various header copies with the kernel sources

 - Change divide by zero and not supported events behavior to show
   'nan'/'not counted' in 'perf stat' output.

   This happens when using things like 'perf stat -M TopdownL2 true',
   involving JSON metrics

 - Update no event/metric expectations affected by using JSON metrics in
   'perf stat -ddd' perf test

 - Avoid segv with 'perf stat --topdown' for metrics without a group

 - Do not assume which events may have a PMU name, allowing the logic to
   keep an AUX event group together. Makes this usecase work again:

     $ perf record --no-bpf-event -c 10 -e '{intel_pt//,tlb_flush.stlb_any/aux-sample-size=8192/pp}:u' -- sleep 0.1
     [ perf record: Woken up 1 times to write data ]
     [ perf record: Captured and wrote 0.078 MB perf.data ]
     $ perf script -F-dso,+addr | grep -C5 tlb_flush.stlb_any | head -11
     sleep 20444 [003]  7939.510243:  1  branches:uH:  7f5350cc82a2 dl_main+0x9a2 => 7f5350cb38f0 _dl_add_to_namespace_list+0x0
     sleep 20444 [003]  7939.510243:  1  branches:uH:  7f5350cb3908 _dl_add_to_namespace_list+0x18 => 7f5350cbb080 rtld_mutex_dummy+0x0
     sleep 20444 [003]  7939.510243:  1  branches:uH:  7f5350cc8350 dl_main+0xa50 => 0 [unknown]
     sleep 20444 [003]  7939.510244:  1  branches:uH:  7f5350cc83ca dl_main+0xaca => 7f5350caeb60 _dl_process_pt_gnu_property+0x0
     sleep 20444 [003]  7939.510245:  1  branches:uH:  7f5350caeb60 _dl_process_pt_gnu_property+0x0 => 0 [unknown]
     sleep 20444  7939.510245:       10 tlb_flush.stlb_any/aux-sample-size=8192/pp: 0 7f5350caeb60 _dl_process_pt_gnu_property+0x0
     sleep 20444 [003]  7939.510254:  1  branches:uH:  7f5350cc87fe dl_main+0xefe => 7f5350ccd240 strcmp+0x0
     sleep 20444 [003]  7939.510254:  1  branches:uH:  7f5350cc8862 dl_main+0xf62 => 0 [unknown]

 - Add a check for the above use case in 'perf test test_intel_pt'

 - Fix build with refcount checking on arm64, it was still accessing
   fields that need to be wrapped so that the refcounted struct gets
   checked

 - Fix contextid validation in ARM's CS-ETM, so that older kernels
   without that field can still be supported

 - Skip unsupported aggregation for stat events found in perf.data files
   in 'perf script'

 - Add stat test for record and script to check the previous problem

 - Remove needless debuginfod queries from 'perf test java symbol', this
   was just making the test take a long time to complete

 - Address python SafeConfigParser() deprecation warning in 'perf test
   attr'

 - Fix __NR_execve undeclared on i386 'perf bench syscall' build error

* tag 'perf-tools-fixes-for-v6.4-1-2023-05-20' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: (33 commits)
  perf bench syscall: Fix __NR_execve undeclared build error
  perf test attr: Fix python SafeConfigParser() deprecation warning
  perf test attr: Update no event/metric expectations
  tools headers disabled-features: Sync with the kernel sources
  tools headers UAPI: Sync arch prctl headers with the kernel sources
  tools headers: Update the copy of x86's mem{cpy,set}_64.S used in 'perf bench'
  tools headers x86 cpufeatures: Sync with the kernel sources
  tools headers UAPI: Sync s390 syscall table file that wires up the memfd_secret syscall
  tools headers UAPI: Sync linux/prctl.h with the kernel sources
  perf metrics: Avoid segv with --topdown for metrics without a group
  perf lock contention: Add empty 'struct rq' to satisfy libbpf 'runqueue' type verification
  perf cs-etm: Fix contextid validation
  perf arm64: Fix build with refcount checking
  perf test: Add stat test for record and script
  perf script: Skip aggregation for stat events
  perf build: Add system include paths to BPF builds
  perf bpf skels: Make vmlinux.h use bpf.h and perf_event.h in source directory
  perf parse-events: Do not break up AUX event group
  perf test test_intel_pt.sh: Test sample mode with event with PMU name
  perf evsel: Modify group pmu name for software events
  ...

13 months agoMerge tag 'powerpc-6.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
Linus Torvalds [Sun, 21 May 2023 18:53:52 +0000 (11:53 -0700)]
Merge tag 'powerpc-6.4-2' of git://git./linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:

 - Fix broken soft dirty tracking when using the Radix MMU (>= P9)

 - Fix ISA mapping when "ranges" property is not present, for PASemi
   Nemo boards

 - Fix a possible WARN_ON_ONCE hitting in BPF extable handling

 - Fix incorrect DMA address handling when using 2MB TCEs

 - Fix a bug in IOMMU table handling for SR-IOV devices

 - Fix the recent rework of IOMMU handling which left arch code calling
   clean up routines that are handled by the IOMMU core

 - A few assorted build fixes

Thanks to Christian Zigotzky, Dan Horák, Gaurav Batra, Hari Bathini,
Jason Gunthorpe, Nathan Chancellor, Naveen N. Rao, Nicholas Piggin, Pali
Rohár, Randy Dunlap, and Rob Herring.

* tag 'powerpc-6.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  powerpc/iommu: Incorrect DDW Table is referenced for SR-IOV device
  powerpc/iommu: DMA address offset is incorrectly calculated with 2MB TCEs
  powerpc/iommu: Remove iommu_del_device()
  powerpc/crypto: Fix aes-gcm-p10 build when VSX=n
  powerpc/bpf: populate extable entries only during the last pass
  powerpc/boot: Disable power10 features after BOOTAFLAGS assignment
  powerpc/64s/radix: Fix soft dirty tracking
  powerpc/fsl_uli1575: fix kconfig warnings and build errors
  powerpc/isa-bridge: Fix ISA mapping when "ranges" is not present

13 months agoMerge tag 'ata-6.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal...
Linus Torvalds [Sun, 21 May 2023 18:46:23 +0000 (11:46 -0700)]
Merge tag 'ata-6.4-rc3' of git://git./linux/kernel/git/dlemoal/libata

Pull ata fix from Damien Le Moal:

 - Fix DT binding for the ahci-ceva driver to fully describe all iommus,
   from Michal

* tag 'ata-6.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata:
  dt-bindings: ata: ahci-ceva: Cover all 4 iommus entries

13 months agoMerge tag 'fbdev-for-6.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
Linus Torvalds [Sun, 21 May 2023 18:13:23 +0000 (11:13 -0700)]
Merge tag 'fbdev-for-6.4-rc3' of git://git./linux/kernel/git/deller/linux-fbdev

Pull fbdev fixes from Helge Deller:
 "A few small unspectacular fbdev fixes:

   - Fix for USB endpoint check in udlfb (found by syzbot fuzzer)

   - Small fix in error code path in omapfb

   - compiler warning fixes in fbmem & i810

   - code removal and whitespace cleanups in stifb and atyfb"

* tag 'fbdev-for-6.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev:
  fbdev: stifb: Whitespace cleanups
  fbdev: udlfb: Use usb_control_msg_send()
  fbdev: udlfb: Fix endpoint check
  fbdev: atyfb: Remove unused clock determination
  fbdev: i810: include i810_main.h in i810_dvt.c
  fbdev: fbmem: mark get_fb_unmapped_area() static
  fbdev: omapfb: panel-tpo-td043mtea1: fix error code in probe()

13 months agoMerge tag '6.4-rc2-ksmbd-server-fixes' of git://git.samba.org/ksmbd
Linus Torvalds [Sun, 21 May 2023 17:55:31 +0000 (10:55 -0700)]
Merge tag '6.4-rc2-ksmbd-server-fixes' of git://git.samba.org/ksmbd

Pull ksmbd server fixes from Steve French:

 - two fixes for incorrect SMB3 message validation (one for client which
   uses 8 byte padding, and one for empty bcc)

 - two fixes for out of bounds bugs: one for username offset checks (in
   session setup) and the other for create context name length checks in
   open requests

* tag '6.4-rc2-ksmbd-server-fixes' of git://git.samba.org/ksmbd:
  ksmbd: smb2: Allow messages padded to 8byte boundary
  ksmbd: allocate one more byte for implied bcc[0]
  ksmbd: fix wrong UserName check in session_user
  ksmbd: fix global-out-of-bounds in smb2_find_context_vals

13 months agoMerge tag '6.4-rc2-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6
Linus Torvalds [Sun, 21 May 2023 17:20:58 +0000 (10:20 -0700)]
Merge tag '6.4-rc2-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull cifs client fixes from Steve French:
 "Two smb3 client fixes, both related to deferred close, and also for
  stable:

   - send close for deferred handles before not after lease break
     response to avoid possible sharing violations

   - check all opens on an inode (looking for deferred handles) when
     lease break is returned not just the handle the lease break came in
     on"

* tag '6.4-rc2-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
  SMB3: drop reference to cfile before sending oplock break
  SMB3: Close all deferred handles of inode in case of handle lease break

13 months agoKVM: VMX: add MSR_IA32_TSX_CTRL into msrs_to_save
Mingwei Zhang [Tue, 9 May 2023 03:23:48 +0000 (03:23 +0000)]
KVM: VMX: add MSR_IA32_TSX_CTRL into msrs_to_save

Add MSR_IA32_TSX_CTRL into msrs_to_save[] to explicitly tell userspace to
save/restore the register value during migration. Missing this may cause
userspace that relies on KVM ioctl(KVM_GET_MSR_INDEX_LIST) fail to port the
value to the target VM.

In addition, there is no need to add MSR_IA32_TSX_CTRL when
ARCH_CAP_TSX_CTRL_MSR is not supported in kvm_get_arch_capabilities(). So
add the checking in kvm_probe_msr_to_save().

Fixes: c11f83e0626b ("KVM: vmx: implement MSR_IA32_TSX_CTRL disable RTM functionality")
Reported-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Mingwei Zhang <mizhang@google.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
Message-Id: <20230509032348.1153070-1-mizhang@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
13 months agoKVM: x86: Don't adjust guest's CPUID.0x12.1 (allowed SGX enclave XFRM)
Sean Christopherson [Wed, 3 May 2023 16:08:37 +0000 (09:08 -0700)]
KVM: x86: Don't adjust guest's CPUID.0x12.1 (allowed SGX enclave XFRM)

Drop KVM's manipulation of guest's CPUID.0x12.1 ECX and EDX, i.e. the
allowed XFRM of SGX enclaves, now that KVM explicitly checks the guest's
allowed XCR0 when emulating ECREATE.

Note, this could theoretically break a setup where userspace advertises
a "bad" XFRM and relies on KVM to provide a sane CPUID model, but QEMU
is the only known user of KVM SGX, and QEMU explicitly sets the SGX CPUID
XFRM subleaf based on the guest's XCR0.

Reviewed-by: Kai Huang <kai.huang@intel.com>
Tested-by: Kai Huang <kai.huang@intel.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20230503160838.3412617-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
13 months agoKVM: VMX: Don't rely _only_ on CPUID to enforce XCR0 restrictions for ECREATE
Sean Christopherson [Wed, 3 May 2023 16:08:36 +0000 (09:08 -0700)]
KVM: VMX: Don't rely _only_ on CPUID to enforce XCR0 restrictions for ECREATE

Explicitly check the vCPU's supported XCR0 when determining whether or not
the XFRM for ECREATE is valid.  Checking CPUID works because KVM updates
guest CPUID.0x12.1 to restrict the leaf to a subset of the guest's allowed
XCR0, but that is rather subtle and KVM should not modify guest CPUID
except for modeling true runtime behavior (allowed XFRM is most definitely
not "runtime" behavior).

Reviewed-by: Kai Huang <kai.huang@intel.com>
Tested-by: Kai Huang <kai.huang@intel.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20230503160838.3412617-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
13 months agofbdev: stifb: Whitespace cleanups
Helge Deller [Sat, 20 May 2023 20:43:35 +0000 (22:43 +0200)]
fbdev: stifb: Whitespace cleanups

Missed whitespace cleanups in stifb.

Fixes: 8000425739dc ("fbdev: stifb: Remove trailing whitespaces")
Signed-off-by: Helge Deller <deller@gmx.de>
13 months agofbdev: udlfb: Use usb_control_msg_send()
Helge Deller [Fri, 19 May 2023 21:11:51 +0000 (23:11 +0200)]
fbdev: udlfb: Use usb_control_msg_send()

Use the newly introduced usb_control_msg_send() instead of usb_control_msg()
when selecting the channel.

Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Helge Deller <deller@gmx.de>
13 months agoMerge tag 'tty-6.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Linus Torvalds [Sat, 20 May 2023 17:33:57 +0000 (10:33 -0700)]
Merge tag 'tty-6.4-rc3' of git://git./linux/kernel/git/gregkh/tty

Pull tty / serial fixes from Greg KH:
 "Here are some small tty and serial driver fixes for 6.4-rc3 to resolve
  some reported problems, and add some new device ids. These include:

   - termios documentation updates

   - vc_screen use-after-free fix

   - memory leak fix in arc_uart driver

   - new 8250 driver ids

   - other small serial driver fixes

  All of these have been in linux-next for a while with no reported
  problems"

* tag 'tty-6.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  vc_screen: reload load of struct vc_data pointer in vcs_write() to avoid UAF
  serial: qcom-geni: fix enabling deactivated interrupt
  serial: 8250_bcm7271: fix leak in `brcmuart_probe`
  serial: 8250_bcm7271: balance clk_enable calls
  serial: arc_uart: fix of_iomap leak in `arc_serial_probe`
  serial: 8250: Document termios parameter of serial8250_em485_config()
  serial: Add support for Advantech PCI-1611U card
  serial: 8250_exar: Add support for USR298x PCI Modems

13 months agoMerge tag 'usb-6.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Linus Torvalds [Sat, 20 May 2023 17:16:38 +0000 (10:16 -0700)]
Merge tag 'usb-6.4-rc3' of git://git./linux/kernel/git/gregkh/usb

Pull USB / Thunderbolt fixes from Greg KH:
 "Here are some USB fixes for 6.4-rc3, as well as a driver core fix that
  resolves a memory leak that shows up in USB devices easier than other
  subsystems.

  Included in here are:

   - driver core memory leak as reported and tested by syzbot and
     developers

   - dwc3 driver fixes for reported problems

   - xhci driver fixes for reported problems

   - USB gadget driver reverts to resolve regressions

   - usbtmc driver fix for syzbot reported problem

   - thunderbolt driver fixes for reported issues

   - other small USB fixes

  All of these, except for the driver core fix, have been in linux-next
  with no reported problems. The driver core fix was tested and verified
  to solve the issue by syzbot and the original reporter"

* tag 'usb-6.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  driver core: class: properly reference count class_dev_iter()
  xhci: Fix incorrect tracking of free space on transfer rings
  xhci-pci: Only run d3cold avoidance quirk for s2idle
  usb-storage: fix deadlock when a scsi command timeouts more than once
  usb: dwc3: fix a test for error in dwc3_core_init()
  usb: typec: tps6598x: Fix fault at module removal
  usb: gadget: u_ether: Fix host MAC address case
  usb: typec: altmodes/displayport: fix pin_assignment_show
  Revert "usb: gadget: udc: core: Invoke usb_gadget_connect only when started"
  Revert "usb: gadget: udc: core: Prevent redundant calls to pullup"
  usb: gadget: drop superfluous ':' in doc string
  usb: dwc3: debugfs: Resume dwc3 before accessing registers
  USB: UHCI: adjust zhaoxin UHCI controllers OverCurrent bit value
  usb: dwc3: fix gadget mode suspend interrupt handler issue
  usb: dwc3: gadget: Improve dwc3_gadget_suspend() and dwc3_gadget_resume()
  USB: usbtmc: Fix direction for 0-length ioctl control messages
  thunderbolt: Clear registers properly when auto clear isn't in use