History log of /linux-master/sound/soc/sof/control.c
Revision Date Author Comments
# cfa12c36 20-Dec-2022 Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

ASoC: SOF: control: Extend the optionality of IPC ops to IPC as well

The IPC ops are optional, but they require that the ops struct is to be
allocated with all callbacks set to NULL.

Update the code to extend the optionality to:
sdev->ipc == NULL
sdev->ipc->ops == NULL
sdev->ipc->ops->[tplg] == NULL
sdev->ipc->ops->[tplg]->control == NULL
sdev->ipc->ops->[tplg]->control->ops == NULL (treated optional currently)

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>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20221221102328.9635-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# bf0736e5 26-Apr-2022 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: SOF: control: use pm_runtime_resume_and_get()

Use pm_runtime_resume_and_get() to replace the pm_runtime_get_sync() and
pm_runtime_put_noidle() pattern.

No functional changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220426184106.102636-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9b014266 29-Mar-2022 Jaroslav Kysela <perex@perex.cz>

ASoC: SOF: topology: use new sound control LED layer

Use the new sound control LED layer instead the direct ledtrig_audio_set()
call - see 22d8de62f11b ("ALSA: control - add generic LED trigger module
as the new control layer").

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Cc: Bard Liao <yung-chuan.liao@linux.intel.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220329120039.2394138-1-perex@perex.cz
Signed-off-by: Mark Brown <broonie@kernel.org>


# 67ec2a09 17-Mar-2022 Ranjani Sridharan <ranjani.sridharan@linux.intel.com>

ASoC: SOF: Add bytes_ext control IPC ops for IPC3

Define and set the get/put/volatile_get control IPC ops for byte
controls for IPC3.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220317175044.1752400-11-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 544ac885 17-Mar-2022 Ranjani Sridharan <ranjani.sridharan@linux.intel.com>

ASoC: SOF: Add bytes_get/put control IPC ops for IPC3

Define and set the bytes_get/put IPC control ops for IPC3.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220317175044.1752400-10-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 049307aa 17-Mar-2022 Ranjani Sridharan <ranjani.sridharan@linux.intel.com>

ASoC: SOF: Add enum_get/put control ops for IPC3

Define and set the enum_get/put control IPC ops for IPC3.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220317175044.1752400-9-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# a6668746 17-Mar-2022 Ranjani Sridharan <ranjani.sridharan@linux.intel.com>

ASoC: SOF: Add switch get/put IPC3 ops

Add the switch_get/put control IPC ops for IPC3.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220317175044.1752400-8-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 838d04f3 17-Mar-2022 Ranjani Sridharan <ranjani.sridharan@linux.intel.com>

ASoC: SOF: Add volume_get/put IPC3 ops

Define and set the volume_get/put control IPC ops for IPC3.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220317175044.1752400-7-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 10f461d7 17-Mar-2022 Ranjani Sridharan <ranjani.sridharan@linux.intel.com>

ASoC: SOF: Add IPC3 topology control ops

Define the topology control IPC ops for IPC3, implement the
control_notify op and use it.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220317175044.1752400-6-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# b5cee8fe 14-Mar-2022 Ranjani Sridharan <ranjani.sridharan@linux.intel.com>

ASoC: SOF: topology: Make control parsing IPC agnostic

Make the control parser in topology IPC agnostic by introducing 2 new
topology IPC ops, control_setup and control_free. These ops handle
setting up/freeing the control data in the IPC format based on the IPC
version.

Along with this, modify the struct snd_sof_control to remove the
IPC-specific field, control_data and replace it with the void pointer to
ipc_control_data. Also, add a few new fields to store all the
information parsed from topology.

Finally, define and set the control setup/free ops for IPC3.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220314200520.1233427-18-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 47d7328f 15-Dec-2021 Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

ASoC: SOF: Drop ctrl_type parameter for snd_sof_ipc_set_get_comp_data()

The SOF_CTRL_TYPE_VALUE_COMP_* type is not used by the firmware nor in the
kernel side.
It is also not clear what action should be taken for such type.

With this in mind:
The correct ipc_cmd can be selected based on the `ctrl_cmd` and the `set`
parameters:
if the ctrl_cmd is SOF_CTRL_CMD_BINARY then SOF_CTRL_TYPE_DATA_*
otherwise SOF_CTRL_TYPE_VALUE_CHAN_*.

The SET or GET direction can be selected with the use of `set` parameter.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-8-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 68be4f0e 15-Dec-2021 Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

ASoC: SOF: control: Do not handle control notification with component type

The component type is not used in firmware nor in the kernel currently and
it is not even clear how it should be handled.

Do not even try to handle it to avoid errors.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-7-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# dd2fef98 15-Dec-2021 Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

ASoC: SOF: sof-audio: Drop the `cmd` member from struct snd_sof_control

There is no need to use two variables to store and check the same
information, the scontrol->cmd is the same as scontrol->control_data->cmd.

Drop the former one and when it is needed, access the cmd from the
control_data.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-6-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9182f3c4 15-Dec-2021 Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

ASoC: SOF: Drop ctrl_cmd parameter for snd_sof_ipc_set_get_comp_data()

The scontrol->control_data->cmd has been configured during initialization
to the correct sof_ipc_ctrl_cmd.

No need to pass duplicated information, let's use the already available
one via scontrol.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-5-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# d4a06c43 15-Dec-2021 Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

ASoC: SOF: Drop ipc_cmd parameter for snd_sof_ipc_set_get_comp_data()

The correct ipc_cmd can be selected based on the `ctrl_cmd` and the `set`
parameters:
if the ctrl_cmd is SOF_CTRL_CMD_BINARY then SOF_IPC_COMP_*_DATA
otherwise SOF_IPC_COMP_*_VALUE.

The SET or GET direction can be selected with the use of `set` parameter.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-3-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# d9835eaa 03-Nov-2021 Peter Ujfalusi <peter.ujfalusi@gmail.com>

ASoC: SOF:control: Fix variable type in snd_sof_refresh_control()

The second parameter for snd_sof_ipc_set_get_comp_data() is ipc_cmd, not
ipc_ctrl_type and the type is u32.

Fixes: 756bbe4205bc6 ("ASoC: SOF: Handle control change notification from firmware")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Acked-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211103082710.17165-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 756bbe42 03-Sep-2021 Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

ASoC: SOF: Handle control change notification from firmware

If the value/data associated with a control changes in SOF it will send a
notification (SOF_IPC_GLB_COMP_MSG with SOF_IPC_COMP_GET_VALUE/DATA).

We have support for binary volatile control type, but we might have
features where enum/switch/volume changes. Re-implementing everything as
volatile as well would be not much of a gain for several reasons:
- volatile controls would do an IPC all the time, regardless if there is a
need or not.
- We still don't have notification which forces userspace to continuously
poll.

When such notification arrives we use snd_ctl_notify_one() to signal
userspace about the change.

The kernel is prepared for two types of notification:
- the notification carries the new data for the control (num_elems != 0)
The new value/data is copied to the control's local data

- blank message about a change
The new flag for the scontrol (comp_data_dirty) is set and when next
time user space reads the value via the kcontrol's get callback we will
refresh the control's local data from the firmware.

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: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Tested-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Link: https://lore.kernel.org/r/20210903114018.2962-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 57672718 02-Sep-2021 Rander Wang <rander.wang@intel.com>

ASoC: SOF: control: fix a typo in put operations for kcontrol

SOF_CTRL_TYPE_VALUE_CHAN_SET should be used for put operations
for consistency. The current use of _GET is obviously incorrect
but _GET and _SET result in the same action so there is no
functional change introduced by this patch.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210902114744.27237-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# fca18e62 11-Nov-2020 Jaska Uimonen <jaska.uimonen@linux.intel.com>

ASoC: SOF: control: override volume info callback

ASoC dapm controls currently don't support more than 2 channels. This is
a problem for SOF-based devices where individual volume control cannot
be provided on the 4 DMIC input path.

If we want to provide controls for more than 2 channels, this patch
suggests a simple solution based on an override of the info callback.
For example, in the case with 4 channel DMIC PGAs, a sof_info callback
would be used. Mono and stereo cases will keep using the existing dapm
info callback.

A longer-term solution would be to remove the limits to 2 channels in
ASoC/DAPM/topology. This is a topic Intel is currently looking into,
e.g. by removing the use of 'reg' and 'rreg' fields and use arrays
instead. Such changes will be rather intrusive and touch multiple codec
and platform drivers. Removing restrictions is the right thing to do,
but this will need to be done in steps with lots of validation.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20201111173105.1927466-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5027fe36 30-Sep-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: SOF: control: remove const in sizeof()

We should only use the type, the const attribute makes no sense in
sizeof().

Reported-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.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: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Tested-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20200930152026.3902186-2-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2ca21011 21-Sep-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: SOF: control: add size checks for ext_bytes control .put()

Make sure the TLV header and size are consistent before copying from
userspace.

Fixes: c3078f5397046 ('ASoC: SOF: Add Sound Open Firmware KControl support')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200921110814.2910477-4-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# ec5a9762 21-Sep-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: SOF: control: fix size checks for volatile ext_bytes control .get()

Mirror addition of checks for regular ext_bytes controls.

Fixes: 783560d02dd61 ('ASoC: SOF: Implement snd_sof_bytes_ext_volatile_get kcontrol IO')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200921110814.2910477-3-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3331bcd6 21-Sep-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: SOF: control: fix size checks for ext_bytes control .get()

cppcheck complains twice:

sound/soc/sof/control.c:436:2: style: Assignment of function parameter
has no effect outside the function. [uselessAssignmentArg]
size -= sizeof(const struct snd_ctl_tlv);
^

sound/soc/sof/control.c:436:7: style: Variable 'size' is assigned a
value that is never used. [unreadVariable]
size -= sizeof(const struct snd_ctl_tlv);

Somehow we dropped the checks for the size argument when upstreaming
the code, somewhere between v5 and v6.

Re-add a size check to avoid providing userspace with more data that
it asked for.

Also fix all error codes, we should return -ENOSPC instead of -EINVAL.

Fixes: c3078f5397046 ('ASoC: SOF: Add Sound Open Firmware KControl support')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200921110814.2910477-2-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0e4ea878 17-Sep-2020 Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>

ASoC: SOF: fix range checks

On multiple locations checks are performed of untrusted values after adding
a constant to them. This is wrong, because the addition might overflow and
the result can then pass the check, although the original value is invalid.
Fix multiple such issues by checking the actual value and not a sum of it
and a constant.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200917105633.2579047-8-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# b9f8e138 17-Sep-2020 Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>

ASoC: SOF: (cosmetic) remove redundant "ret" variable uses

In some cases no "ret" variable is even needed, those functions always
return 0 anyway, in other cases "ret" initialisation is redundant.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200917105633.2579047-6-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 99ceec5c 17-Sep-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: SOF: control: update test for pm_runtime_get_sync()

We need to avoid reporting an error for -EACCESS when pm_runtime is
not enabled.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200917105633.2579047-5-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 783560d0 07-Sep-2020 Dharageswari R <dharageswari.r@intel.com>

ASoC: SOF: Implement snd_sof_bytes_ext_volatile_get kcontrol IO

This patch implements the snd_sof_bytes_ext_volatile_get() to read the
actual parameters from DSP by sending the SOF_IPC_COMP_GET_DATA IPC
for the kcontrol of type SOF_TPLG_KCTL_BYTES_VOLATILE_RO.

Signed-off-by: Dharageswari R <dharageswari.r@intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200908092825.1813847-2-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# e149ca29 01-May-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only

Remove the ambiguity with GPL-2.0 and use an explicit GPL-2.0-only
tag.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20200501145850.15178-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 49c22696 30-Apr-2020 Kai-Heng Feng <kai.heng.feng@canonical.com>

ASoC: SOF: Update correct LED status at the first time usage of update_mute_led()

At the first time update_mute_led() gets called, if channels are already
muted, the temp value equals to led_value as 0, skipping the following
LED setting.

So set led_value to -1 as an uninitialized state, to update the correct
LED status at first time usage.

Fixes: 5d43001ae436 ("ASoC: SOF: acpi led support for switch controls")
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Acked-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200430091139.7003-1-kai.heng.feng@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# ee1e79b7 04-Dec-2019 Ranjani Sridharan <ranjani.sridharan@linux.intel.com>

ASoC: SOF: partition audio-related parts from SOF core

Move all the audio-specific code in the core,
audio-specific logic in the top-level PM callbacks
and the core header files into a separate file
(sof-audio.*) in preparation for adding an
audio client device.

In the process of moving all structure definitions
for widget, routes, pcm's etc, the snd_sof_dev
member in all these structs is replaced with
the snd_soc_component member. Also, use the component
device instead of the snd_sof_dev device wherever
possible in the PCM component driver,
control IO functions and the topology parser as the
component device will be moved over to the client
device later on.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191204211556.12671-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 95a32c98 18-Oct-2019 Dragos Tarcatu <dragos_tarcatu@mentor.com>

ASoC: SOF: control: return true when kcontrol values change

All the kcontrol put() functions are currently returning 0 when
successful. This does not go well with alsamixer as it does
not seem to get notified on SND_CTL_EVENT_MASK_VALUE callbacks
when values change for (some of) the sof kcontrols.
This patch fixes that by returning true for volume, switch
and enum type kcontrols when values do change in put().

Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191018123806.18063-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9899a7a8 14-Oct-2019 YueHaibing <yuehaibing@huawei.com>

ASoC: SOF: Fix randbuild error

When LEDS_TRIGGER_AUDIO is m and SND_SOC_SOF is y,

sound/soc/sof/control.o: In function `snd_sof_switch_put':
control.c:(.text+0x587): undefined reference to `ledtrig_audio_set'
control.c:(.text+0x593): undefined reference to `ledtrig_audio_set'

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: 5d43001ae436 ("ASoC: SOF: acpi led support for switch controls")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191014091308.23688-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5d43001a 08-Oct-2019 Jaska Uimonen <jaska.uimonen@linux.intel.com>

ASoC: SOF: acpi led support for switch controls

Currently sof doesn't support acpi leds with mute switches. So implement
acpi leds following quite shamelessly existing HDA implementation by
Takashi Iwai.

Mute leds can be enabled in topology by adding led and direction token
in switch control private data.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191008164443.1358-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0c888bab 11-Jun-2019 Bard Liao <yung-chuan.liao@linux.intel.com>

ASoC: SOF: dont wake dsp up in kcontrol IO

Always get kcontrol value from cache, set kcontrol value to DSP
when DSP is active. Kcontrol values will be restored when DSP boot up.
We will set the default value of kcontrol in sof_complete to make sure
the value is align with firmware.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5661ad94 24-May-2019 Keyon Jie <yang.jie@linux.intel.com>

ASoC: SOF: control: correct the copy size for bytes kcontrol put

The size for the bytes kcontrol should include the abi header, that is,
data->size + sizeof(*data), it is also aligned with get method after
this change.

Fixes: c3078f53970 ("ASoC: SOF: Add Sound Open Firmware KControl support")
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c3078f53 12-Apr-2019 Liam Girdwood <liam.r.girdwood@linux.intel.com>

ASoC: SOF: Add Sound Open Firmware KControl support

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

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

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

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>