]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
ASoC: SOF: Handle control change notification from firmware
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Fri, 3 Sep 2021 11:40:18 +0000 (14:40 +0300)
committerMark Brown <broonie@kernel.org>
Mon, 13 Sep 2021 00:59:18 +0000 (01:59 +0100)
commit756bbe4205bc63a84ab032a1b76970afe55e2d9d
tree7a1820b5c1947479391bf74422cb2a59749d96c3
parent2b9b42c847b83823527a497c323e74d2efced721
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>
sound/soc/sof/control.c
sound/soc/sof/ipc.c
sound/soc/sof/sof-audio.h