Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: remove component->id

Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

snd_soc_component has "id", but no one is using it except Qcom. It is
initialized at snd_soc_component_initialize(), but Qcom overwrites it.

According to Srinivas, unfortunately, current Qcom lpass is broken.
But we can update it and then, avoid to use component->id.
Let's do it, and remove it.

+26 -16
-1
include/sound/soc-component.h
··· 206 206 207 207 struct snd_soc_component { 208 208 const char *name; 209 - int id; 210 209 const char *name_prefix; 211 210 struct device *dev; 212 211 struct snd_soc_card *card;
+17 -10
sound/soc/qcom/lpass-platform.c
··· 202 202 struct regmap *map; 203 203 unsigned int dai_id = cpu_dai->driver->id; 204 204 205 - component->id = dai_id; 206 205 data = kzalloc(sizeof(*data), GFP_KERNEL); 207 206 if (!data) 208 207 return -ENOMEM; ··· 1189 1190 { 1190 1191 struct lpass_data *drvdata = snd_soc_component_get_drvdata(component); 1191 1192 struct regmap *map; 1192 - unsigned int dai_id = component->id; 1193 1193 1194 - if (dai_id == LPASS_DP_RX) 1194 + if (drvdata->hdmi_port_enable) { 1195 1195 map = drvdata->hdmiif_map; 1196 - else 1197 - map = drvdata->lpaif_map; 1196 + regcache_cache_only(map, true); 1197 + regcache_mark_dirty(map); 1198 + } 1198 1199 1200 + map = drvdata->lpaif_map; 1199 1201 regcache_cache_only(map, true); 1200 1202 regcache_mark_dirty(map); 1201 1203 ··· 1207 1207 { 1208 1208 struct lpass_data *drvdata = snd_soc_component_get_drvdata(component); 1209 1209 struct regmap *map; 1210 - unsigned int dai_id = component->id; 1210 + int ret; 1211 1211 1212 - if (dai_id == LPASS_DP_RX) 1212 + if (drvdata->hdmi_port_enable) { 1213 1213 map = drvdata->hdmiif_map; 1214 - else 1215 - map = drvdata->lpaif_map; 1214 + regcache_cache_only(map, false); 1215 + ret = regcache_sync(map); 1216 + if (ret) 1217 + return ret; 1218 + } 1216 1219 1220 + map = drvdata->lpaif_map; 1217 1221 regcache_cache_only(map, false); 1222 + 1218 1223 return regcache_sync(map); 1219 1224 } 1220 1225 ··· 1229 1224 unsigned long bytes) 1230 1225 { 1231 1226 struct snd_pcm_runtime *rt = substream->runtime; 1232 - unsigned int dai_id = component->id; 1227 + struct snd_soc_pcm_runtime *soc_runtime = snd_soc_substream_to_rtd(substream); 1228 + struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(soc_runtime, 0); 1229 + unsigned int dai_id = cpu_dai->driver->id; 1233 1230 int ret = 0; 1234 1231 1235 1232 void __iomem *dma_buf = (void __iomem *) (rt->dma_area + pos +
+9 -5
sound/soc/soc-core.c
··· 2604 2604 const char *devname = dev_name(dev); 2605 2605 char *found, *name; 2606 2606 unsigned int id1, id2; 2607 + int __id; 2607 2608 2608 2609 if (devname == NULL) 2609 2610 return NULL; ··· 2617 2616 found = strstr(name, dev->driver->name); 2618 2617 if (found) { 2619 2618 /* get ID */ 2620 - if (sscanf(&found[strlen(dev->driver->name)], ".%d", id) == 1) { 2619 + if (sscanf(&found[strlen(dev->driver->name)], ".%d", &__id) == 1) { 2621 2620 2622 2621 /* discard ID from name if ID == -1 */ 2623 - if (*id == -1) 2622 + if (__id == -1) 2624 2623 found[strlen(dev->driver->name)] = '\0'; 2625 2624 } 2626 2625 ··· 2628 2627 } else if (sscanf(name, "%x-%x", &id1, &id2) == 2) { 2629 2628 2630 2629 /* create unique ID number from I2C addr and bus */ 2631 - *id = ((id1 & 0xffff) << 16) + id2; 2630 + __id = ((id1 & 0xffff) << 16) + id2; 2632 2631 2633 2632 devm_kfree(dev, name); 2634 2633 2635 2634 /* sanitize component name for DAI link creation */ 2636 2635 name = devm_kasprintf(dev, GFP_KERNEL, "%s.%s", dev->driver->name, devname); 2637 2636 } else { 2638 - *id = 0; 2637 + __id = 0; 2639 2638 } 2639 + 2640 + if (id) 2641 + *id = __id; 2640 2642 2641 2643 return name; 2642 2644 } ··· 2835 2831 mutex_init(&component->io_mutex); 2836 2832 2837 2833 if (!component->name) { 2838 - component->name = fmt_single_name(dev, &component->id); 2834 + component->name = fmt_single_name(dev, NULL); 2839 2835 if (!component->name) { 2840 2836 dev_err(dev, "ASoC: Failed to allocate name\n"); 2841 2837 return -ENOMEM;