aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSriram Periyasamy <sriramx.periyasamy@intel.com>2017-11-07 05:46:22 -0500
committerMark Brown <broonie@kernel.org>2017-11-08 13:58:12 -0500
commit22ebd6666efd8663a06715a052f74b6a7e904dc3 (patch)
tree413d79e8ec039512df5e8da21df60fa69eb72cb4
parent960115b842886999a64a87d8baadb81dce4293b4 (diff)
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>
-rw-r--r--sound/soc/intel/skylake/skl-topology.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index 1200b7c6af56..90f8c839bcef 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -2036,21 +2036,35 @@ static int skl_tplg_add_pipe(struct device *dev,
2036 return 0; 2036 return 0;
2037} 2037}
2038 2038
2039static int skl_tplg_fill_pin(struct device *dev, u32 tkn, 2039static int skl_tplg_get_uuid(struct device *dev, u8 *guid,
2040 struct snd_soc_tplg_vendor_uuid_elem *uuid_tkn)
2041{
2042 if (uuid_tkn->token == SKL_TKN_UUID) {
2043 memcpy(guid, &uuid_tkn->uuid, 16);
2044 return 0;
2045 }
2046
2047 dev_err(dev, "Not an UUID token %d\n", uuid_tkn->token);
2048
2049 return -EINVAL;
2050}
2051
2052static int skl_tplg_fill_pin(struct device *dev,
2053 struct snd_soc_tplg_vendor_value_elem *tkn_elem,
2040 struct skl_module_pin *m_pin, 2054 struct skl_module_pin *m_pin,
2041 int pin_index, u32 value) 2055 int pin_index)
2042{ 2056{
2043 switch (tkn) { 2057 switch (tkn_elem->token) {
2044 case SKL_TKN_U32_PIN_MOD_ID: 2058 case SKL_TKN_U32_PIN_MOD_ID:
2045 m_pin[pin_index].id.module_id = value; 2059 m_pin[pin_index].id.module_id = tkn_elem->value;
2046 break; 2060 break;
2047 2061
2048 case SKL_TKN_U32_PIN_INST_ID: 2062 case SKL_TKN_U32_PIN_INST_ID:
2049 m_pin[pin_index].id.instance_id = value; 2063 m_pin[pin_index].id.instance_id = tkn_elem->value;
2050 break; 2064 break;
2051 2065
2052 default: 2066 default:
2053 dev_err(dev, "%d Not a pin token\n", value); 2067 dev_err(dev, "%d Not a pin token\n", tkn_elem->token);
2054 return -EINVAL; 2068 return -EINVAL;
2055 } 2069 }
2056 2070
@@ -2083,9 +2097,7 @@ static int skl_tplg_fill_pins_info(struct device *dev,
2083 return -EINVAL; 2097 return -EINVAL;
2084 } 2098 }
2085 2099
2086 ret = skl_tplg_fill_pin(dev, tkn_elem->token, 2100 ret = skl_tplg_fill_pin(dev, tkn_elem, m_pin, pin_count);
2087 m_pin, pin_count, tkn_elem->value);
2088
2089 if (ret < 0) 2101 if (ret < 0)
2090 return ret; 2102 return ret;
2091 2103
@@ -2170,19 +2182,6 @@ static int skl_tplg_widget_fill_fmt(struct device *dev,
2170 return skl_tplg_fill_fmt(dev, dst_fmt, tkn, val); 2182 return skl_tplg_fill_fmt(dev, dst_fmt, tkn, val);
2171} 2183}
2172 2184
2173static int skl_tplg_get_uuid(struct device *dev, struct skl_module_cfg *mconfig,
2174 struct snd_soc_tplg_vendor_uuid_elem *uuid_tkn)
2175{
2176 if (uuid_tkn->token == SKL_TKN_UUID)
2177 memcpy(&mconfig->guid, &uuid_tkn->uuid, 16);
2178 else {
2179 dev_err(dev, "Not an UUID token tkn %d\n", uuid_tkn->token);
2180 return -EINVAL;
2181 }
2182
2183 return 0;
2184}
2185
2186static void skl_tplg_fill_pin_dynamic_val( 2185static void skl_tplg_fill_pin_dynamic_val(
2187 struct skl_module_pin *mpin, u32 pin_count, u32 value) 2186 struct skl_module_pin *mpin, u32 pin_count, u32 value)
2188{ 2187{
@@ -2565,7 +2564,8 @@ static int skl_tplg_get_tokens(struct device *dev,
2565 continue; 2564 continue;
2566 2565
2567 case SND_SOC_TPLG_TUPLE_TYPE_UUID: 2566 case SND_SOC_TPLG_TUPLE_TYPE_UUID:
2568 ret = skl_tplg_get_uuid(dev, mconfig, array->uuid); 2567 ret = skl_tplg_get_uuid(dev, mconfig->guid,
2568 array->uuid);
2569 if (ret < 0) 2569 if (ret < 0)
2570 return ret; 2570 return ret;
2571 2571