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

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
...@@ -2036,21 +2036,35 @@ static int skl_tplg_add_pipe(struct device *dev, ...@@ -2036,21 +2036,35 @@ static int skl_tplg_add_pipe(struct device *dev,
return 0; 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, 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: 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; break;
case SKL_TKN_U32_PIN_INST_ID: 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; break;
default: 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; return -EINVAL;
} }
...@@ -2083,9 +2097,7 @@ static int skl_tplg_fill_pins_info(struct device *dev, ...@@ -2083,9 +2097,7 @@ static int skl_tplg_fill_pins_info(struct device *dev,
return -EINVAL; return -EINVAL;
} }
ret = skl_tplg_fill_pin(dev, tkn_elem->token, ret = skl_tplg_fill_pin(dev, tkn_elem, m_pin, pin_count);
m_pin, pin_count, tkn_elem->value);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -2170,19 +2182,6 @@ static int skl_tplg_widget_fill_fmt(struct device *dev, ...@@ -2170,19 +2182,6 @@ static int skl_tplg_widget_fill_fmt(struct device *dev,
return skl_tplg_fill_fmt(dev, dst_fmt, tkn, val); 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( static void skl_tplg_fill_pin_dynamic_val(
struct skl_module_pin *mpin, u32 pin_count, u32 value) struct skl_module_pin *mpin, u32 pin_count, u32 value)
{ {
...@@ -2565,7 +2564,8 @@ static int skl_tplg_get_tokens(struct device *dev, ...@@ -2565,7 +2564,8 @@ static int skl_tplg_get_tokens(struct device *dev,
continue; continue;
case SND_SOC_TPLG_TUPLE_TYPE_UUID: 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) if (ret < 0)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment