Unverified Commit e6937b6d authored by Mark Brown's avatar Mark Brown
Browse files

Merge series "ASoC: SOF: small fixes for 5.10" from Kai Vehmanen <kai.vehmanen@linux.intel.com>:

Series that adds debug support for IMX platforms, more details to
FW version information, adds missing -EACCESS handling to
pm_runtime_get_sync() calls and a set of minor cosmetic, trace
verbosity and coding style issues.

Guennadi Liakhovetski (3):
  ASoC: SOF: (cosmetic) remove redundant "ret" variable uses
  ASoC: SOF: remove several superfluous type-casts
  ASoC: SOF: fix range checks

Iulian Olaru (1):
  ASoC: SOF: imx: Add debug support for imx platforms

Karol Trzcinski (1):
  ASoC: SOF: Add `src_hash` to `sof_ipc_fw_version` structure

Pierre-Louis Bossart (3):
  ASoC: SOF: debug: update test for pm_runtime_get_sync()
  ASoC: SOF: control: update test for pm_runtime_get_sync()
  ASoC: SOF: Intel: hda: reduce verbosity of boot error logs

 include/sound/sof/info.h         |  4 +-
 sound/soc/sof/control.c          | 62 +++++++++++++--------------
 sound/soc/sof/debug.c            |  2 +-
 sound/soc/sof/imx/Kconfig        |  8 ++++
 sound/soc/sof/imx/Makefile       |  3 ++
 sound/soc/sof/imx/imx-common.c   | 72 ++++++++++++++++++++++++++++++++
 sound/soc/sof/imx/imx-common.h   | 16 +++++++
 sound/soc/sof/imx/imx8.c         | 23 +++++++++-
 sound/soc/sof/imx/imx8m.c        | 17 +++++++-
 sound/soc/sof/intel/hda-loader.c | 16 +++----
 sound/soc/sof/intel/hda.c        | 12 ++++--
 sound/soc/sof/intel/hda.h        |  2 +
 sound/soc/sof/sof-audio.c        |  6 +--
 sound/soc/sof/sof-priv.h         |  8 ++++
 sound/soc/sof/topology.c         | 44 ++++++++++---------
 15 files changed, 226 insertions(+), 69 deletions(-)
 create mode 100644 sound/soc/sof/imx/imx-common.c
 create mode 100644 sound/soc/sof/imx/imx-common.h

--
2.27.0
parents 4c3021f0 776100a4
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -46,9 +46,11 @@ struct sof_ipc_fw_version {
	uint8_t time[10];
	uint8_t tag[6];
	uint32_t abi_version;
	/* used to check FW and ldc file compatibility, reproducible value */
	uint32_t src_hash;

	/* reserved for future use */
	uint32_t reserved[4];
	uint32_t reserved[3];
} __packed;

/* FW ready Message - sent by firmware when boot has completed */
+30 −32
Original line number Diff line number Diff line
@@ -221,7 +221,6 @@ int snd_sof_bytes_get(struct snd_kcontrol *kcontrol,
	struct sof_ipc_ctrl_data *cdata = scontrol->control_data;
	struct sof_abi_hdr *data = cdata->data;
	size_t size;
	int ret = 0;

	if (be->max > sizeof(ucontrol->value.bytes.data)) {
		dev_err_ratelimited(scomp->dev,
@@ -230,20 +229,20 @@ int snd_sof_bytes_get(struct snd_kcontrol *kcontrol,
		return -EINVAL;
	}

	size = data->size + sizeof(*data);
	if (size > be->max) {
	/* be->max has been verified to be >= sizeof(struct sof_abi_hdr) */
	if (data->size > be->max - sizeof(*data)) {
		dev_err_ratelimited(scomp->dev,
				    "error: DSP sent %zu bytes max is %d\n",
				    size, be->max);
		ret = -EINVAL;
		goto out;
				    "error: %u bytes of control data is invalid, max is %zu\n",
				    data->size, be->max - sizeof(*data));
		return -EINVAL;
	}

	size = data->size + sizeof(*data);

	/* copy back to kcontrol */
	memcpy(ucontrol->value.bytes.data, data, size);

out:
	return ret;
	return 0;
}

int snd_sof_bytes_put(struct snd_kcontrol *kcontrol,
@@ -255,7 +254,7 @@ int snd_sof_bytes_put(struct snd_kcontrol *kcontrol,
	struct snd_soc_component *scomp = scontrol->scomp;
	struct sof_ipc_ctrl_data *cdata = scontrol->control_data;
	struct sof_abi_hdr *data = cdata->data;
	size_t size = data->size + sizeof(*data);
	size_t size;

	if (be->max > sizeof(ucontrol->value.bytes.data)) {
		dev_err_ratelimited(scomp->dev,
@@ -264,13 +263,16 @@ int snd_sof_bytes_put(struct snd_kcontrol *kcontrol,
		return -EINVAL;
	}

	if (size > be->max) {
	/* be->max has been verified to be >= sizeof(struct sof_abi_hdr) */
	if (data->size > be->max - sizeof(*data)) {
		dev_err_ratelimited(scomp->dev,
				    "error: size too big %zu bytes max is %d\n",
				    size, be->max);
				    "error: data size too big %u bytes max is %zu\n",
				    data->size, be->max - sizeof(*data));
		return -EINVAL;
	}

	size = data->size + sizeof(*data);

	/* copy from kcontrol */
	memcpy(data, ucontrol->value.bytes.data, size);

@@ -337,7 +339,8 @@ int snd_sof_bytes_ext_put(struct snd_kcontrol *kcontrol,
		return -EINVAL;
	}

	if (cdata->data->size + sizeof(const struct sof_abi_hdr) > be->max) {
	/* be->max has been verified to be >= sizeof(struct sof_abi_hdr) */
	if (cdata->data->size > be->max - sizeof(const struct sof_abi_hdr)) {
		dev_err_ratelimited(scomp->dev, "error: Mismatch in ABI data size (truncated?).\n");
		return -EINVAL;
	}
@@ -367,7 +370,7 @@ int snd_sof_bytes_ext_volatile_get(struct snd_kcontrol *kcontrol, unsigned int _
	int err;

	ret = pm_runtime_get_sync(scomp->dev);
	if (ret < 0) {
	if (ret < 0 && ret != -EACCES) {
		dev_err_ratelimited(scomp->dev, "error: bytes_ext get failed to resume %d\n", ret);
		pm_runtime_put_noidle(scomp->dev);
		return ret;
@@ -423,8 +426,7 @@ int snd_sof_bytes_ext_get(struct snd_kcontrol *kcontrol,
	struct snd_ctl_tlv header;
	struct snd_ctl_tlv __user *tlvd =
		(struct snd_ctl_tlv __user *)binary_data;
	int data_size;
	int ret = 0;
	size_t data_size;

	/*
	 * Decrement the limit by ext bytes header size to
@@ -436,27 +438,23 @@ int snd_sof_bytes_ext_get(struct snd_kcontrol *kcontrol,
	cdata->data->magic = SOF_ABI_MAGIC;
	cdata->data->abi = SOF_ABI_VERSION;

	/* Prevent read of other kernel data or possibly corrupt response */
	data_size = cdata->data->size + sizeof(const struct sof_abi_hdr);

	/* check data size doesn't exceed max coming from topology */
	if (data_size > be->max) {
		dev_err_ratelimited(scomp->dev, "error: user data size %d exceeds max size %d.\n",
				    data_size, be->max);
		ret = -EINVAL;
		goto out;
	if (cdata->data->size > be->max - sizeof(const struct sof_abi_hdr)) {
		dev_err_ratelimited(scomp->dev, "error: user data size %d exceeds max size %zu.\n",
				    cdata->data->size,
				    be->max - sizeof(const struct sof_abi_hdr));
		return -EINVAL;
	}

	data_size = cdata->data->size + sizeof(const struct sof_abi_hdr);

	header.numid = scontrol->cmd;
	header.length = data_size;
	if (copy_to_user(tlvd, &header, sizeof(const struct snd_ctl_tlv))) {
		ret = -EFAULT;
		goto out;
	}
	if (copy_to_user(tlvd, &header, sizeof(const struct snd_ctl_tlv)))
		return -EFAULT;

	if (copy_to_user(tlvd->tlv, cdata->data, data_size))
		ret = -EFAULT;
		return -EFAULT;

out:
	return ret;
	return 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -405,7 +405,7 @@ static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer,
	}

	ret = pm_runtime_get_sync(sdev->dev);
	if (ret < 0) {
	if (ret < 0 && ret != -EACCES) {
		dev_err_ratelimited(sdev->dev,
				    "error: debugfs write failed to resume %d\n",
				    ret);
+8 −0
Original line number Diff line number Diff line
@@ -19,6 +19,12 @@ config SND_SOC_SOF_IMX_OF
	  This option is not user-selectable but automagically handled by
	  'select' statements at a higher level

config SND_SOC_SOF_IMX_COMMON
	tristate
	help
	  This option is not user-selectable but automagically handled by
	  'select' statements at a higher level.

config SND_SOC_SOF_IMX8_SUPPORT
	bool "SOF support for i.MX8"
	depends on IMX_SCU=y || IMX_SCU=SND_SOC_SOF_IMX_OF
@@ -30,6 +36,7 @@ config SND_SOC_SOF_IMX8_SUPPORT

config SND_SOC_SOF_IMX8
	tristate
	select SND_SOC_SOF_IMX_COMMON
	select SND_SOC_SOF_XTENSA
	help
	  This option is not user-selectable but automagically handled by
@@ -45,6 +52,7 @@ config SND_SOC_SOF_IMX8M_SUPPORT

config SND_SOC_SOF_IMX8M
	tristate
	select SND_SOC_SOF_IMX_COMMON
	select SND_SOC_SOF_XTENSA
	help
	  This option is not user-selectable but automagically handled by
+3 −0
Original line number Diff line number Diff line
@@ -2,5 +2,8 @@
snd-sof-imx8-objs := imx8.o
snd-sof-imx8m-objs := imx8m.o

snd-sof-imx-common-objs := imx-common.o

obj-$(CONFIG_SND_SOC_SOF_IMX8) += snd-sof-imx8.o
obj-$(CONFIG_SND_SOC_SOF_IMX8M) += snd-sof-imx8m.o
obj-$(CONFIG_SND_SOC_SOF_IMX_COMMON) += imx-common.o
Loading