Unverified Commit 22ebd666 authored by Sriram Periyasamy's avatar Sriram Periyasamy Committed by Mark Brown
Browse files

ASoC: Intel: Skylake: Optimize UUID handling to fill pin info



Modify skl_tplg_get_uuid() to copy just UUID rather than only
for module UUID and skl_tplg_fill_pin() to fill the pin info
which can include UUID token also.

Signed-off-by: default avatarSriram Periyasamy <sriramx.periyasamy@intel.com>
Signed-off-by: default avatarGuneshwor Singh <guneshwor.o.singh@intel.com>
Acked-By: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 960115b8
Loading
Loading
Loading
Loading
+23 −23
Original line number Diff line number Diff line
@@ -2036,21 +2036,35 @@ static int skl_tplg_add_pipe(struct device *dev,
	return 0;
}

static int skl_tplg_fill_pin(struct device *dev, u32 tkn,
static int skl_tplg_get_uuid(struct device *dev, u8 *guid,
	      struct snd_soc_tplg_vendor_uuid_elem *uuid_tkn)
{
	if (uuid_tkn->token == SKL_TKN_UUID) {
		memcpy(guid, &uuid_tkn->uuid, 16);
		return 0;
	}

	dev_err(dev, "Not an UUID token %d\n", uuid_tkn->token);

	return -EINVAL;
}

static int skl_tplg_fill_pin(struct device *dev,
			struct snd_soc_tplg_vendor_value_elem *tkn_elem,
			struct skl_module_pin *m_pin,
			int pin_index, u32 value)
			int pin_index)
{
	switch (tkn) {
	switch (tkn_elem->token) {
	case SKL_TKN_U32_PIN_MOD_ID:
		m_pin[pin_index].id.module_id = value;
		m_pin[pin_index].id.module_id = tkn_elem->value;
		break;

	case SKL_TKN_U32_PIN_INST_ID:
		m_pin[pin_index].id.instance_id = value;
		m_pin[pin_index].id.instance_id = tkn_elem->value;
		break;

	default:
		dev_err(dev, "%d Not a pin token\n", value);
		dev_err(dev, "%d Not a pin token\n", tkn_elem->token);
		return -EINVAL;
	}

@@ -2083,9 +2097,7 @@ static int skl_tplg_fill_pins_info(struct device *dev,
		return -EINVAL;
	}

	ret = skl_tplg_fill_pin(dev, tkn_elem->token,
			m_pin, pin_count, tkn_elem->value);

	ret = skl_tplg_fill_pin(dev, tkn_elem, m_pin, pin_count);
	if (ret < 0)
		return ret;

@@ -2170,19 +2182,6 @@ static int skl_tplg_widget_fill_fmt(struct device *dev,
	return skl_tplg_fill_fmt(dev, dst_fmt, tkn, val);
}

static int skl_tplg_get_uuid(struct device *dev, struct skl_module_cfg *mconfig,
	      struct snd_soc_tplg_vendor_uuid_elem *uuid_tkn)
{
	if (uuid_tkn->token == SKL_TKN_UUID)
		memcpy(&mconfig->guid, &uuid_tkn->uuid, 16);
	else {
		dev_err(dev, "Not an UUID token tkn %d\n", uuid_tkn->token);
		return -EINVAL;
	}

	return 0;
}

static void skl_tplg_fill_pin_dynamic_val(
		struct skl_module_pin *mpin, u32 pin_count, u32 value)
{
@@ -2565,7 +2564,8 @@ static int skl_tplg_get_tokens(struct device *dev,
			continue;

		case SND_SOC_TPLG_TUPLE_TYPE_UUID:
			ret = skl_tplg_get_uuid(dev, mconfig, array->uuid);
			ret = skl_tplg_get_uuid(dev, mconfig->guid,
					array->uuid);
			if (ret < 0)
				return ret;