Commit graph

1136121 commits

Author SHA1 Message Date
Kuninori Morimoto
f3779b1619
ASoC: soc-dapm.h: cleanup white space
soc-dapm.h defines many things, but it is using
randam white space and tag.
This patch do nothing, but cleanup its white space.
This patch cleanup also 100 char in 1 line.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/87y1tcsl6u.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-19 13:05:32 +01:00
Kuninori Morimoto
1f5ac87e83
ASoC: soc-dapm.c: numerical order for dapm_up_seq
dapm_up_seq is arranged in numerical order, but _dai_link
is out of order. 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>
Link: https://lore.kernel.org/r/87zgdssl70.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-19 13:05:32 +01:00
Kuninori Morimoto
5a7c2e962e
ASoC: soc-dapm.c: cleanup snd_soc_dapm_new_dai()
snd_soc_dapm_new_dai() setups local variable "template" at (X) and (Y),
which is used at (Z). But these are difficult to read.

	static struct snd_soc_dapm_widget * snd_soc_dapm_new_dai()
	{
		...

 ^		template.reg = ...
 |		template.id = ...
(X)		template.name = ...
 |		template.event = ...
 |		template.event_flags = ...
 v		template.kcontrol_news = ...

		if (rtd->dai_link->num_params > 1) {
			...
 ^			template.num_kcontrols = ...
(Y)			template.kcontrol_news = ...
 v			...
		}

		...
(Z)		w = snd_soc_dapm_new_control_unlocked(..., &template);

	}

And this function has error message, but not for all cases.
This patch (1) setups "template" in one place, and indicate error message
for all cases. This patch cleanup the code, but nothing changed for
meaning.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/871qr4tzro.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-19 13:05:31 +01:00
Kuninori Morimoto
9941ba4bae
ASoC: soc-dapm.c: merge dapm_power_one_widget() and dapm_widget_set_power()
dapm_widget_set_power() (= X) is called only from
dapm_power_one_widget() (= Y), and total purpose of these functions are
calling dapm_seq_insert() (= a) accordingly for each widget.

(X)	static void dapm_widget_set_power(...)
	{
		...
		if (power)
(a)			dapm_seq_insert(w, up_list, true);
		else
(a)			dapm_seq_insert(w, down_list, false);
	}

(Y)	static void dapm_power_one_widget(...)
	{
		..

		switch (w->id) {
		case snd_soc_dapm_pre:
(a)			dapm_seq_insert(w, down_list, false);
			break;
		case snd_soc_dapm_post:
(a)			dapm_seq_insert(w, up_list, true);
			break;

		default:
			power = dapm_widget_power_check(w);

(X)			dapm_widget_set_power(w, power, up_list, down_list);
			break;
		}
	}

It should be more simple, but the code is unnecessarily complicated,
and difficult to read/understand. This patch merge these into one.

Link: https://lore.kernel.org/all/87tu42owdd.wl-kuninori.morimoto.gx@renesas.com/
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/8735bktzrx.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-19 13:05:30 +01:00
Kuninori Morimoto
2e3fafbb14
ASoC: soc-dapm.c: cleanup dapm_widget_set_power()
This patch cleanup dapm_widget_set_power() comment, parenthesis,
and 100 chars. It has no meaning, nothing will be changed.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/874jw0tzsh.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-19 13:05:29 +01:00
Kuninori Morimoto
c196b41231
ASoC: soc-dapm.c: ignore parameter NULL at snd_soc_dapm_free_widget()
Currently snd_soc_dapm_free_widget() is assuming input parameter is
non NULL. Thus, caller need to care about it.
This patch care it at snd_soc_dapm_free_widget().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/875yggtzsq.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-19 13:05:28 +01:00
Kuninori Morimoto
943402b54e
ASoC: soc-dapm.c: remove no meaning variable from snd_soc_dapm_add_path()
snd_soc_dapm_add_path() is using local variable "widgets[]", but it is
same as path->node[].
This is no meaning and duplicate operation. This patch removes "widgets[]".

	path->node[SND_SOC_DAPM_DIR_IN] = wsource;
	path->node[SND_SOC_DAPM_DIR_OUT] = wsink;
	widgets[SND_SOC_DAPM_DIR_IN] = wsource;
	widgets[SND_SOC_DAPM_DIR_OUT] = wsink;

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/877d0wtzsx.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-19 13:05:27 +01:00
Kuninori Morimoto
f19a2ec7a3
ASoC: soc-dapm.c: tidyup error handling on snd_soc_dapm_add_route()
Current error handling on snd_soc_dapm_add_route() has some wastes.
It indicates *own* error message *only* for sink or source,
and return error directly at (A). OTOH, it has similar error message at
(B) which indicates *both* sink/source.

And more, (A) is using dev_err(), (B) is using dev_warn().
(B) is caring prefix, but (A) is not.

(X)	int snd_soc_dapm_add_route(...)
	{
		...
		if (wsource == NULL) {
(A)			dev_err(...);
			return -ENODEV;
		}
		if (wsink == NULL) {
(A)			dev_err(...);
			return -ENODEV;
		}

		...

		ret = snd_soc_dapm_add_path(...);
		if (ret)
(B)			goto err;

		return 0;
	err:
(B)		dev_warn(...);
		return ret;
	}

Above snd_soc_dapm_add_route() (= X) is called from
snd_soc_dapm_add_routes() (= Y).
(X) will indicate error message by itself, but (Y) will indicate
own error message at (C). (C) is duplicated.

(Y)	int snd_soc_dapm_add_routes(...)
	{
		...
		for (...) {
(X)			int r = snd_soc_dapm_add_route(...);
			if (r < 0) {
(C)				dev_err(...);
				ret = r;
			}
			...
		}
		...
	}

This patch (1) merges these error message (= A,B) into one,
(2) use dev_err(), (3) remove duplicate error message (= C) from
snd_soc_dapm_add_routes().

By this patch, it will indicate error message like this.

	- error message with prefix
	- not found widget will have "(*)" mark
	- it indicates [control] if exists.

ex)
[if no sink with control]

	ASoC: Failed to add route SOURCE -> [CTRL] -> SINK(*)

[if no source without control]

	ASoC: Failed to add route SOURCE(*) -> SINK

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/878rlctzt5.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-19 13:05:26 +01:00
Kuninori Morimoto
86b94c396b
ASoC: soc-dapm.c: replace snd_soc_dapm_wcache to snd_soc_dapm_widget
Current ASoC has snd_soc_dapm_wcache, but its member is only
snd_soc_dapm_widget.

	struct snd_soc_dapm_wcache {
		struct snd_soc_dapm_widget *widget;
	};

It is no meaning for now, and makes code unreadable.
This patch replace snd_soc_dapm_wcache to snd_soc_dapm_widget directly.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/87a65stztf.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-19 13:05:25 +01:00
Shaomin Deng
4306fc8f83
ASoC: meson: axg-pdm: Fix double word in comments
Delete the doubled word "for" in comments.

Signed-off-by: Shaomin Deng <dengshaomin@cdjrlc.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20221017141812.6867-1-dengshaomin@cdjrlc.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-19 12:04:28 +01:00
Mark Brown
af7b5657e3
ASoC: soc-dapm.c random cleanups
Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

These are random cleanup for soc-dpam.c/h.
Basically, these are just cleanup, nothing changed.
2022-10-19 12:03:40 +01:00
Mark Brown
fd65e09923
ASoC: Intel/SOF: simplify S3 resume flows
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

All Intel drivers for cAVS platforms contain a sequence for S3 resume
which doesn't seem justified nor necessary. Forensic Git investigation
in internal repositories did not provide any rationale for the
implementation, and tests show no impact when those sequences are
removed.

This sequence was identified as problematic during a large HDaudio
cleanup where all programming sequences were revisited before
extensions are added.
2022-10-19 12:03:33 +01:00
Kai Vehmanen
af6514f2f3
ASoC: SOF: ipc4-mtrace: protect per-core nodes against multiple open
Add protection against multiple open of the mtrace/coreN debugfs
nodes. This is not supported in the implementation, and this will
show up as unexpected behaviour of the interface, and potential
use of already freed memory.

Fixes: f4ea22f7aa ("ASoC: SOF: ipc4: Add support for mtrace log extraction")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@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/20221018121332.20802-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 21:17:21 +01:00
Yong Zhi
b4dd2e3758
ASoC: Intel: sof_rt5682: Add quirk for Rex board
Add mtl_mx98357_rt5682 driver data for Chrome Rex board support.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20221017205728.210813-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 21:17:20 +01:00
Colin Ian King
67860d2a8e
ASoC: twl4030: make read-only array ramp_base static const
Don't populate the read-only array ramp_base on the stack but
instead make it static const. Also makes the object code a
little smaller.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20221018152928.942186-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 19:16:49 +01:00
Venkata Prasad Potturu
bdde278a77
ASoC: amd: acp: Add TDM slots setting support for ACP I2S controller
Modify set tdm slot function to set ACP I2S controller slots
in tdm mode based on number of slots.

Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com>
Link: https://lore.kernel.org/r/20221018122711.2559452-1-venkataprasad.potturu@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 19:16:48 +01:00
Peter Ujfalusi
73e4981f12
ASoC: SOF: ipc3: Log the tx message before sending it
It makes more sense to log the message before it is sent to the DSP.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20221018133843.16958-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 19:16:47 +01:00
Peter Ujfalusi
010c050fe9
ASoC: SOF: Intel: ipc4: Ack a received reply or notification separately
By acking a received message we tell the DSP that we have processed the
message (reply or notification) and we are open to receive a new one.

The original implementation did this in a common code after the received
message got handled as reply or notification.

With right timing this opens up a small window when we have processed the
reply and let the other thread proceed to send a new message to the DSP,
which is allowed as the DSP is free to receive message.
But when the message is received and processed by the DSP and it wants to
send a reply it will still see that the previous message has not been
acked, so it fails to send a reply. Later the first reply got acked by the
kernel, but it is too late and the in-flight message got a timeout due to
firmware not responding (which it tried, but could not).

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>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20221018124008.6846-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 19:16:45 +01:00
Peter Ujfalusi
483e4cdfb5
ASoC: SOF: Intel: ipc4: Wait for channel to be free before sending a message
Before attempting to send a message to the DSP we need to check if the
downstream BUSY flag has been cleared by the firmware to avoid lost IPC
messages by the firmware.

This is required by a firmware which only acks the received message after
it has sent a reply to the host.
With a bad luck, the host would send a message before the firmware gets to
the clearing the flag and thus losing a message.

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>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20221018124008.6846-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 19:16:44 +01:00
Peter Ujfalusi
c8ed7ce242
ASoC: SOF: Intel: ipc4: Read the interrupt reason registers at the same time
Read both registers as the first step in the interrupt handler to make
sure that we are handling the event which triggered the interrupt.

The delayed reading of the target request register might reflect incorrect
information about the reason why the interrupt was risen.

Note also that the IPC3 interrupt handler is implemented in this way also.

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>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20221018124008.6846-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 19:16:43 +01:00
Peter Ujfalusi
2d91d5715f
ASoC: SOF: ipc4: Log the tx message before sending it
It makes more sense to log the message before it is sent to the DSP.

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>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20221018124008.6846-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 19:16:42 +01:00
Kuninori Morimoto
0135ae74b4
ASoC: soc-dapm.c: cleanup dapm_widget_set_power()
This patch cleanup dapm_widget_set_power() comment, parenthesis,
and 100 chars. It has no meaning, nothing will be changed.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87v8oiowdk.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 19:16:40 +01:00
Kuninori Morimoto
1c9096f32a
ASoC: soc-dapm.c: ignore parameter NULL at snd_soc_dapm_free_widget()
Currently snd_soc_dapm_free_widget() is assuming input parameter is
non NULL. Thus, caller need to care about it.
This patch care it at snd_soc_dapm_free_widget().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87wn8yowdr.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 19:16:38 +01:00
Kuninori Morimoto
c1329a0f3b
ASoC: soc-dapm.c: remove no meaning variable from snd_soc_dapm_add_path()
snd_soc_dapm_add_path() is using local variable "widgets[]", but it is
same as path->node[].
This is no meaning and duplicate operation. This patch removes "widgets[]".

	path->node[SND_SOC_DAPM_DIR_IN] = wsource;
	path->node[SND_SOC_DAPM_DIR_OUT] = wsink;
	widgets[SND_SOC_DAPM_DIR_IN] = wsource;
	widgets[SND_SOC_DAPM_DIR_OUT] = wsink;

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87y1teowdx.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 19:16:37 +01:00
Kuninori Morimoto
b913e9f4b3
ASoC: soc-dapm.c: tidyup error handling on snd_soc_dapm_add_route()
Current error handling on snd_soc_dapm_add_route() has some wastes.
It indicates *own* error message *only* for sink or source,
and return error directly at (A). OTOH, it has similar error message at
(B) which indicates *both* sink/source.

And more, (A) is using dev_err(), (B) is using dev_warn().
(B) is caring prefix, but (A) is not.

(X)	int snd_soc_dapm_add_route(...)
	{
		...
		if (wsource == NULL) {
(A)			dev_err(...);
			return -ENODEV;
		}
		if (wsink == NULL) {
(A)			dev_err(...);
			return -ENODEV;
		}

		...

		ret = snd_soc_dapm_add_path(...);
		if (ret)
(B)			goto err;

		return 0;
	err:
(B)		dev_warn(...);
		return ret;
	}

Above snd_soc_dapm_add_route() (= X) is called from
snd_soc_dapm_add_routes() (= Y).
(X) will indicate error message by itself, but (Y) will indicate
own error message at (C). (C) is duplicated.

(Y)	int snd_soc_dapm_add_routes(...)
	{
		...
		for (...) {
(X)			int r = snd_soc_dapm_add_route(...);
			if (r < 0) {
(C)				dev_err(...);
				ret = r;
			}
			...
		}
		...
	}

This patch (1) merges these error message (= A,B) into one,
(2) use dev_err(), (3) remove duplicate error message (= C) from
snd_soc_dapm_add_routes().

By this patch, it will indicate error message like this.

	- error message with prefix
	- not found widget will have "(*)" mark
	- it indicates [control] if exists.

ex)
[if no sink with control]

	ASoC: Failed to add route SOURCE -> [CTRL] -> SINK(*)

[if no source without control]

	ASoC: Failed to add route SOURCE(*) -> SINK

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87zgduowe5.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 19:16:36 +01:00
Kuninori Morimoto
03e13efbb2
ASoC: soc-dapm.c: replace snd_soc_dapm_wcache to snd_soc_dapm_widget
Current ASoC has snd_soc_dapm_wcache, but its member is only
snd_soc_dapm_widget.

	struct snd_soc_dapm_wcache {
		struct snd_soc_dapm_widget *widget;
	};

It is no meaning for now, and makes code unreadable.
This patch replace snd_soc_dapm_wcache to snd_soc_dapm_widget directly.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/871qr6qayt.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 19:16:35 +01:00
Pierre-Louis Bossart
9f68d6e64f
ASoC: SOF: Intel: hda-dsp: simplify S3 resume flows
The flow contains surprising parts that seem to have been inspired by
the Skylake driver.

During a resume from S3, the state of the links prior to suspend
should not matter. One would have to assume that the links are powered
down anyways prior to suspend, and there is also no specific code that
turns links on unconditionally on resume.

Likewise, the snd_hdac_init_chip() routine will start the cmd_io
handling, and it's not clear why we should care about the state of the
DMA prior to suspend.

This patch removes these two sequences to simplify the flow.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221017204946.207986-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 19:16:33 +01:00
Pierre-Louis Bossart
8e1ae6f62c
ASoC: Intel: avs: simplify S3 resume flows
The same code was directly copied from the skylake driver where it was
already questionable. Remove and simplify the flow.

Tested-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221017204946.207986-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 19:16:32 +01:00
Pierre-Louis Bossart
fac33cb5c1
ASoC: Intel: Skylake: simplify S3 resume flows
Commit cce6c149eb ("ASoC: Intel: Skylake: add link management")
added a perfectly logical/symmetrical link handling for
'suspend_active' aka S0ix

However that commit also added a less obvious part, where during S3
resume the code will "turn off the links which are off before suspend"
as well as stop the cmd_io which is not started.

This sequence looks completely unnecessary and possibly wrong, remove it.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221017204946.207986-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 19:16:31 +01:00
Pierre-Louis Bossart
73189c064e
ASoC: SOF: Intel: pci-mtl: fix firmware name
Initial IPC4 tests used the same conventions as previous reference
closed-source firmware, but for MeteorLake the convention is the same
as previous SOF releases (sof-<platform>.ri). Only the prefix changes
to avoid confusions between IPC types.

This change has no impact on users since the firmware has not yet been
released.

Fixes: 064520e8ae ("ASoC: SOF: Intel: Add support for MeteorLake (MTL)")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221017204004.207446-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 19:16:22 +01:00
Pierre-Louis Bossart
41deb2db64
ASoC: Intel: sof_sdw: add quirk variant for LAPBC710 NUC15
Some NUC15 LAPBC710 devices don't expose the same DMI information as
the Intel reference, add additional entry in the match table.

BugLink: https://github.com/thesofproject/linux/issues/3885
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20221017204054.207512-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 19:16:20 +01:00
Mark Brown
a474dce8aa
ASoC: add devicetree support for WM8961 codec
Merge series from Doug Brown <doug@schmorgal.com>:

This series adds devicetree support for the Wolfson WM8961 codec. The
first patch adds a schema, the second patch hooks it up in the code, and
the third patch allows it to be selected in Kconfig.
2022-10-18 13:01:34 +01:00
Mark Brown
46234fbefe
ASoC: Intel: avs: Fixes and new boards support
Merge series from Cezary Rojewski <cezary.rojewski@intel.com>:

Two fixes are leading the way - one addresses the incorrect DMA mask
assignment (typo) at driver probe. The other, fixes a potential buffer
overflow when copying data received from firmware to kernel buffer.
However unlikely, the fix should still be there.

Then a range of patches providing the support for:
- AML with rt286 (machine board)
- KBL-R for rt298 (codec)
- KBL-R with rt298 (machine board)
- APL/KBL with da7219 (machine board)
- Addition of all the missing SKL-based PCI ids to core.c

Of the remaining changes, only one stands out - special case is provided
for "unsupported" IPCs. The driver supports a range of platforms,
however, on some generations given IPC may not be supported. Such call
shall not be treated as "invalid" - those are two different scenarios.

Everything else in the patchset is mostly a readability improvement:
spelling fixes and log messages issues, code simplification.
2022-10-18 13:01:27 +01:00
Mark Brown
a2ddd19fe7
Create a new sound card to access MICFIL based on rpmsg channel
Merge series from Chancel Liu <chancel.liu@nxp.com>:

At a previous time, we have successfully created a virtual sound card
based on rpmsg. The sound card works under this mechanism Cortex-A core
tells the Cortex-M core the format, rate, channel, .etc configuration
of the PCM parameters and Cortex-M controls real hardware devices such
as SAI and DMA. From the view of Linux side, the sound card is bound to
a rpmsg channel through which it can access SAI.

Here these patches are introduced to create a new virtual sound card to
access MICFIL based on a new created rpmsg channel. It's easy to create
a new rpmsg channel for MICFIL through rpmsg name service announcment.
Also the other ASoC components bound to this rpmsg MICFIL sound card
will be registered with these patches.

If other sound cards using different hardware devices needs to be
created over rpmsg in the future, these patches can be referred.
2022-10-18 12:14:52 +01:00
Mark Brown
c39e299a34
ASoC: codecs: jz4725b: Various improvements and fixes
Merge series from Siarhei Volkau <lis8215@gmail.com>:

The patchset fixes:
 - Line In path stays powered off during capturing or
   bypass to mixer.
 - incorrectly represented dB values in alsamixer, et al.
 - incorrect represented Capture input selector in alsamixer
   in Playback tab.
 - wrong control selected as Capture Master

The patchset improves:
 - Exposes output stage (post mixer) gain control and makes it new
   Master playback gain, DAC gain was the previous master.
   However, no Master mute now.
 - Exposes all mixer inputs (both Mics, LineIn and DAC) with their
   gain controls.
 - Exposes microphones widgets: single/differential input, boost.

Known issues:
 - Bypass path enablement isn't applied immediately, for make
   things going bit clock needs to be triggered for a bit,
   e.g. by aplay dummy.wav
   It might be a hardware bug, since the bit clock isn't
   declared as required for codec operation.

Tested on:
 - Ritmix RZX-27 (jz4725b).
 - Ritmix RZX-50 (jz4755).
2022-10-18 12:14:45 +01:00
Mark Brown
67ad4edf2b
ASoC: Use DIV_ROUND_UP() instead of open-coding it
Merge series from Shang XiaoJing <shangxiaojing@huawei.com>:

Use DIV_ROUND_UP() instead of open-coding it, which intents and makes
it more clear what is going on for the casual reviewer.
2022-10-18 12:14:39 +01:00
Mark Brown
974ada314f
ASoC: Intel: avs: Add support for max98927 codec
Merge series from Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>:

This series adds machine board for max98927 codec present on some
Chromebook devices.
2022-10-18 12:14:33 +01:00
Randy Dunlap
9a7f2c9e7a
ASoC: qcom: SND_SOC_SC7180 optionally depends on SOUNDWIRE
If SOUNDWIRE is enabled, then SND_SOC_SC7180 should depend on
SOUNDWIRE to prevent SOUNDWIRE=m and SND_SOC_SC7180=y, which causes
build errors:

s390-linux-ld: sound/soc/qcom/common.o: in function `qcom_snd_sdw_prepare':
common.c:(.text+0x140): undefined reference to `sdw_disable_stream'
s390-linux-ld: common.c:(.text+0x14a): undefined reference to `sdw_deprepare_stream'
s390-linux-ld: common.c:(.text+0x158): undefined reference to `sdw_prepare_stream'
s390-linux-ld: common.c:(.text+0x16a): undefined reference to `sdw_enable_stream'
s390-linux-ld: common.c:(.text+0x17c): undefined reference to `sdw_deprepare_stream'
s390-linux-ld: sound/soc/qcom/common.o: in function `qcom_snd_sdw_hw_free':
common.c:(.text+0x344): undefined reference to `sdw_disable_stream'
s390-linux-ld: common.c:(.text+0x34e): undefined reference to `sdw_deprepare_stream'

Fixes: 3bd975f3ae ("ASoC: qcom: sm8250: move some code to common")
Fixes: 9e3ecb5b16 ("ASoC: qcom: sc7180: Add machine driver for sound card registration")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Banajit Goswami <bgoswami@quicinc.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Ajit Pandey <ajitp@codeaurora.org>
Cc: Cheng-Yi Chiang <cychiang@chromium.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: stable@vger.kernel.org
Cc: alsa-devel@alsa-project.org
Link: https://lore.kernel.org/r/20221015001228.18990-1-rdunlap@infradead.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 12:01:49 +01:00
Geert Uytterhoeven
4e8ff35878
ASoC: codecs: tlv320adc3xxx: Wrap adc3xxx_i2c_remove() in __exit_p()
If CONFIG_SND_SOC_TLV320ADC3XXX=y:

    `.exit.text' referenced in section `.data' of sound/soc/codecs/tlv320adc3xxx.o: defined in discarded section `.exit.text' of sound/soc/codecs/tlv320adc3xxx.o

Fix this by wrapping the adc3xxx_i2c_remove() pointer in __exit_p().

Fixes: e9a3b57efd ("ASoC: codec: tlv320adc3xxx: New codec driver")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/3225ba4cfe558d9380155e75385954dd21d4e7eb.1665909132.git.geert@linux-m68k.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-18 12:01:48 +01:00
Siarhei Volkau
4b192aa09b
ASoC: codecs: jz4725b: add missed microphone widgets
Microphone input can be single ended or differential, although
known SoCs with that codec expose MIC1P only.

Also there is 20dB mic boost in the Mic1 path.

Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
Link: https://lore.kernel.org/r/20221016132648.3011729-8-lis8215@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-17 12:50:31 +01:00
Siarhei Volkau
616c291820
ASoC: codecs: jz4725b: add missed Mixer inputs
The Mixer couples analog input from 4 sources (DAC, Line In, Mic 1,
 Mic 2) each input has its own gain & mute controls.

At the moment only DAC is implemented fully and Line In path can be
switched on/off. The patch implements Mic 1 and Mic 2 paths and fully
implements Line In path.

Manual states that these controls (16.6.3.3 Programmable attenuation:
GOi) gain varies from -22.5dB to +6.0dB with 1.5dB step. Also there's
extra values below the minimum, but they behave the same as the minimum
value.

Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
Link: https://lore.kernel.org/r/20221016132648.3011729-7-lis8215@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-17 12:50:30 +01:00
Siarhei Volkau
e6233ee250
ASoC: codecs: jz4725b: use right control for Master Playback
At the moment DAC control is used as Master Playback control, this is
incorrect as DAC's output goes to a Mixer.

The Mixer couples analog input from 4 sources (DAC, Line In, Mic 1,
 Mic 2) each input has its own gain & mute controls.

Output of the Mixer goes to Output Stage control which is the best suite
for the new Playback Master. However, it doesn't have mute capability.

The patch implements Output Stage control as a new master and renames
old Master to DAC. Rest of mixer inputs will be implemented in the next
patch in the series.

Manual states that Output stage control (16.6.3.5 Programmable output
amplifier: PGAT) gain varies from -33.5dB to +4.5dB, gain step isn't
fixed and has 3 opts.

Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
Link: https://lore.kernel.org/r/20221016132648.3011729-6-lis8215@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-17 12:50:29 +01:00
Siarhei Volkau
80852f8268
ASoC: codecs: jz4725b: fix capture selector naming
At the moment Capture source selector appears on Playback
tab in the alsamixer and has a senseless name.

Let's fix that.

Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
Link: https://lore.kernel.org/r/20221016132648.3011729-5-lis8215@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-17 12:50:28 +01:00
Siarhei Volkau
1538e2c8c9
ASoC: codecs: jz4725b: use right control for Capture Volume
Line In Bypass control is used as Master Capture at the moment
this is completely incorrect.

Current control routed to Mixer instead of ADC, thus can't affect
Capture path. ADC control shall be used instead.

ADC volume control parameters are different, so the patch fixes that
as well. Manual says (16.6.3.2 Programmable input attenuation amplifier:
PGATM) that gain varies in range 0dB..22.5dB with 1.5dB step.

Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
Link: https://lore.kernel.org/r/20221016132648.3011729-4-lis8215@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-17 12:50:27 +01:00
Siarhei Volkau
088777bf65
ASoC: codecs: jz4725b: fix reported volume for Master ctl
DAC volume control is the Master Playback Volume at the moment
and it reports wrong levels in alsamixer and other alsa apps.

The patch fixes that, as stated in manual on the jz4725b SoC
(16.6.3.4 Programmable attenuation: GOD) the ctl range varies
from -22.5dB to 0dB with 1.5dB step.

Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
Link: https://lore.kernel.org/r/20221016132648.3011729-3-lis8215@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-17 12:50:27 +01:00
Siarhei Volkau
1013999b43
ASoC: codecs: jz4725b: add missed Line In power control bit
Line In path stayed powered off during capturing or
bypass to mixer.

Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
Link: https://lore.kernel.org/r/20221016132648.3011729-2-lis8215@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-17 12:50:26 +01:00
Cezary Rojewski
62d0cee4e6
ASoC: codecs: hda: Fix spelling error in log message
To improve readability.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221010121955.718168-16-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-17 12:50:17 +01:00
Cezary Rojewski
bfced33e1e
ASoC: Intel: avs: Simplify log control for SKL
Loop only till the actual number of AudioDSP cores, not the value of
mask made from said number.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221010121955.718168-15-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-17 12:50:16 +01:00
Cezary Rojewski
263e3e2dfe
ASoC: Intel: avs: Simplify ignore_fw_version description
Reword the parameter description to drop any confusion regarding its
purpose.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221010121955.718168-14-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-17 12:50:15 +01:00
Cezary Rojewski
65edda6015
ASoC: Intel: avs: Do not print IPC error message twice
ENABLE_LOGS and SYSTEM_TIME IPCs call LARGE_CONFIG_SET internally which
dumps an error message in case of an error. There is no need to repeat
the process in the top level handler.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221010121955.718168-13-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-17 12:50:14 +01:00