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: Sriram Periyasamy <sriramx.periyasamy@intel.com>
Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Sriram Periyasamy 2017-11-07 16:16:22 +05:30 committed by Mark Brown
parent 960115b842
commit 22ebd6666e
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0

View file

@ -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,
struct skl_module_pin *m_pin,
int pin_index, u32 value)
static int skl_tplg_get_uuid(struct device *dev, u8 *guid,
struct snd_soc_tplg_vendor_uuid_elem *uuid_tkn)
{
switch (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)
{
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;