diff options
author | Charles Keepax <ckeepax@opensource.cirrus.com> | 2018-04-24 11:39:02 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-04-26 07:24:43 -0400 |
commit | ef050bece1b5564b2c7135ceadc0d5ffdcf152f7 (patch) | |
tree | 43cf51aa080a649bfa710a0b59676292624a94ba | |
parent | c0c0be9d12bb5983569f796954f4734734c0aaac (diff) |
ASoC: Remove platform code now everything is componentised
As all drivers have been moved over to the new generic component
code remove the now unused platform specific code.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | include/sound/soc.h | 103 | ||||
-rw-r--r-- | sound/soc/soc-compress.c | 227 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 214 | ||||
-rw-r--r-- | sound/soc/soc-devres.c | 35 | ||||
-rw-r--r-- | sound/soc/soc-io.c | 21 | ||||
-rw-r--r-- | sound/soc/soc-pcm.c | 119 |
6 files changed, 12 insertions, 707 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index ad266d7e9553..9ea99e5d3c8e 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -401,9 +401,7 @@ struct snd_soc_ops; | |||
401 | struct snd_soc_pcm_runtime; | 401 | struct snd_soc_pcm_runtime; |
402 | struct snd_soc_dai; | 402 | struct snd_soc_dai; |
403 | struct snd_soc_dai_driver; | 403 | struct snd_soc_dai_driver; |
404 | struct snd_soc_platform; | ||
405 | struct snd_soc_dai_link; | 404 | struct snd_soc_dai_link; |
406 | struct snd_soc_platform_driver; | ||
407 | struct snd_soc_codec; | 405 | struct snd_soc_codec; |
408 | struct snd_soc_codec_driver; | 406 | struct snd_soc_codec_driver; |
409 | struct snd_soc_component; | 407 | struct snd_soc_component; |
@@ -455,15 +453,6 @@ static inline int snd_soc_resume(struct device *dev) | |||
455 | } | 453 | } |
456 | #endif | 454 | #endif |
457 | int snd_soc_poweroff(struct device *dev); | 455 | int snd_soc_poweroff(struct device *dev); |
458 | int snd_soc_register_platform(struct device *dev, | ||
459 | const struct snd_soc_platform_driver *platform_drv); | ||
460 | int devm_snd_soc_register_platform(struct device *dev, | ||
461 | const struct snd_soc_platform_driver *platform_drv); | ||
462 | void snd_soc_unregister_platform(struct device *dev); | ||
463 | int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform, | ||
464 | const struct snd_soc_platform_driver *platform_drv); | ||
465 | void snd_soc_remove_platform(struct snd_soc_platform *platform); | ||
466 | struct snd_soc_platform *snd_soc_lookup_platform(struct device *dev); | ||
467 | int snd_soc_register_codec(struct device *dev, | 456 | int snd_soc_register_codec(struct device *dev, |
468 | const struct snd_soc_codec_driver *codec_drv, | 457 | const struct snd_soc_codec_driver *codec_drv, |
469 | struct snd_soc_dai_driver *dai_drv, int num_dai); | 458 | struct snd_soc_dai_driver *dai_drv, int num_dai); |
@@ -485,10 +474,6 @@ struct snd_soc_component *snd_soc_lookup_component(struct device *dev, | |||
485 | int snd_soc_cache_init(struct snd_soc_codec *codec); | 474 | int snd_soc_cache_init(struct snd_soc_codec *codec); |
486 | int snd_soc_cache_exit(struct snd_soc_codec *codec); | 475 | int snd_soc_cache_exit(struct snd_soc_codec *codec); |
487 | 476 | ||
488 | int snd_soc_platform_read(struct snd_soc_platform *platform, | ||
489 | unsigned int reg); | ||
490 | int snd_soc_platform_write(struct snd_soc_platform *platform, | ||
491 | unsigned int reg, unsigned int val); | ||
492 | int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num); | 477 | int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num); |
493 | #ifdef CONFIG_SND_SOC_COMPRESS | 478 | #ifdef CONFIG_SND_SOC_COMPRESS |
494 | int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num); | 479 | int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num); |
@@ -628,8 +613,6 @@ int snd_soc_add_component_controls(struct snd_soc_component *component, | |||
628 | const struct snd_kcontrol_new *controls, unsigned int num_controls); | 613 | const struct snd_kcontrol_new *controls, unsigned int num_controls); |
629 | int snd_soc_add_codec_controls(struct snd_soc_codec *codec, | 614 | int snd_soc_add_codec_controls(struct snd_soc_codec *codec, |
630 | const struct snd_kcontrol_new *controls, unsigned int num_controls); | 615 | const struct snd_kcontrol_new *controls, unsigned int num_controls); |
631 | int snd_soc_add_platform_controls(struct snd_soc_platform *platform, | ||
632 | const struct snd_kcontrol_new *controls, unsigned int num_controls); | ||
633 | int snd_soc_add_card_controls(struct snd_soc_card *soc_card, | 616 | int snd_soc_add_card_controls(struct snd_soc_card *soc_card, |
634 | const struct snd_kcontrol_new *controls, int num_controls); | 617 | const struct snd_kcontrol_new *controls, int num_controls); |
635 | int snd_soc_add_dai_controls(struct snd_soc_dai *dai, | 618 | int snd_soc_add_dai_controls(struct snd_soc_dai *dai, |
@@ -996,39 +979,12 @@ struct snd_soc_codec_driver { | |||
996 | bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */ | 979 | bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */ |
997 | }; | 980 | }; |
998 | 981 | ||
999 | /* SoC platform interface */ | ||
1000 | struct snd_soc_platform_driver { | ||
1001 | |||
1002 | int (*probe)(struct snd_soc_platform *); | ||
1003 | int (*remove)(struct snd_soc_platform *); | ||
1004 | struct snd_soc_component_driver component_driver; | ||
1005 | |||
1006 | /* pcm creation and destruction */ | ||
1007 | int (*pcm_new)(struct snd_soc_pcm_runtime *); | ||
1008 | void (*pcm_free)(struct snd_pcm *); | ||
1009 | |||
1010 | /* platform stream pcm ops */ | ||
1011 | const struct snd_pcm_ops *ops; | ||
1012 | |||
1013 | /* platform stream compress ops */ | ||
1014 | const struct snd_compr_ops *compr_ops; | ||
1015 | }; | ||
1016 | |||
1017 | struct snd_soc_dai_link_component { | 982 | struct snd_soc_dai_link_component { |
1018 | const char *name; | 983 | const char *name; |
1019 | struct device_node *of_node; | 984 | struct device_node *of_node; |
1020 | const char *dai_name; | 985 | const char *dai_name; |
1021 | }; | 986 | }; |
1022 | 987 | ||
1023 | struct snd_soc_platform { | ||
1024 | struct device *dev; | ||
1025 | const struct snd_soc_platform_driver *driver; | ||
1026 | |||
1027 | struct list_head list; | ||
1028 | |||
1029 | struct snd_soc_component component; | ||
1030 | }; | ||
1031 | |||
1032 | struct snd_soc_dai_link { | 988 | struct snd_soc_dai_link { |
1033 | /* config - must be set by machine driver */ | 989 | /* config - must be set by machine driver */ |
1034 | const char *name; /* Codec name */ | 990 | const char *name; /* Codec name */ |
@@ -1277,7 +1233,6 @@ struct snd_soc_pcm_runtime { | |||
1277 | struct snd_pcm *pcm; | 1233 | struct snd_pcm *pcm; |
1278 | struct snd_compr *compr; | 1234 | struct snd_compr *compr; |
1279 | struct snd_soc_codec *codec; | 1235 | struct snd_soc_codec *codec; |
1280 | struct snd_soc_platform *platform; /* will be removed */ | ||
1281 | struct snd_soc_dai *codec_dai; | 1236 | struct snd_soc_dai *codec_dai; |
1282 | struct snd_soc_dai *cpu_dai; | 1237 | struct snd_soc_dai *cpu_dai; |
1283 | 1238 | ||
@@ -1359,19 +1314,6 @@ static inline struct snd_soc_codec *snd_soc_component_to_codec( | |||
1359 | } | 1314 | } |
1360 | 1315 | ||
1361 | /** | 1316 | /** |
1362 | * snd_soc_component_to_platform() - Casts a component to the platform it is embedded in | ||
1363 | * @component: The component to cast to a platform | ||
1364 | * | ||
1365 | * This function must only be used on components that are known to be platforms. | ||
1366 | * Otherwise the behavior is undefined. | ||
1367 | */ | ||
1368 | static inline struct snd_soc_platform *snd_soc_component_to_platform( | ||
1369 | struct snd_soc_component *component) | ||
1370 | { | ||
1371 | return container_of(component, struct snd_soc_platform, component); | ||
1372 | } | ||
1373 | |||
1374 | /** | ||
1375 | * snd_soc_dapm_to_component() - Casts a DAPM context to the component it is | 1317 | * snd_soc_dapm_to_component() - Casts a DAPM context to the component it is |
1376 | * embedded in | 1318 | * embedded in |
1377 | * @dapm: The DAPM context to cast to the component | 1319 | * @dapm: The DAPM context to cast to the component |
@@ -1400,20 +1342,6 @@ static inline struct snd_soc_codec *snd_soc_dapm_to_codec( | |||
1400 | } | 1342 | } |
1401 | 1343 | ||
1402 | /** | 1344 | /** |
1403 | * snd_soc_dapm_to_platform() - Casts a DAPM context to the platform it is | ||
1404 | * embedded in | ||
1405 | * @dapm: The DAPM context to cast to the platform. | ||
1406 | * | ||
1407 | * This function must only be used on DAPM contexts that are known to be part of | ||
1408 | * a platform (e.g. in a platform driver). Otherwise the behavior is undefined. | ||
1409 | */ | ||
1410 | static inline struct snd_soc_platform *snd_soc_dapm_to_platform( | ||
1411 | struct snd_soc_dapm_context *dapm) | ||
1412 | { | ||
1413 | return snd_soc_component_to_platform(snd_soc_dapm_to_component(dapm)); | ||
1414 | } | ||
1415 | |||
1416 | /** | ||
1417 | * snd_soc_component_get_dapm() - Returns the DAPM context associated with a | 1345 | * snd_soc_component_get_dapm() - Returns the DAPM context associated with a |
1418 | * component | 1346 | * component |
1419 | * @component: The component for which to get the DAPM context | 1347 | * @component: The component for which to get the DAPM context |
@@ -1673,17 +1601,6 @@ static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec) | |||
1673 | return snd_soc_component_get_drvdata(&codec->component); | 1601 | return snd_soc_component_get_drvdata(&codec->component); |
1674 | } | 1602 | } |
1675 | 1603 | ||
1676 | static inline void snd_soc_platform_set_drvdata(struct snd_soc_platform *platform, | ||
1677 | void *data) | ||
1678 | { | ||
1679 | snd_soc_component_set_drvdata(&platform->component, data); | ||
1680 | } | ||
1681 | |||
1682 | static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platform) | ||
1683 | { | ||
1684 | return snd_soc_component_get_drvdata(&platform->component); | ||
1685 | } | ||
1686 | |||
1687 | static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) | 1604 | static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) |
1688 | { | 1605 | { |
1689 | INIT_LIST_HEAD(&card->widgets); | 1606 | INIT_LIST_HEAD(&card->widgets); |
@@ -1746,9 +1663,9 @@ static inline bool snd_soc_codec_is_active(struct snd_soc_codec *codec) | |||
1746 | * @kcontrol: The control for which to get the component | 1663 | * @kcontrol: The control for which to get the component |
1747 | * | 1664 | * |
1748 | * Note: This function will work correctly if the control has been registered | 1665 | * Note: This function will work correctly if the control has been registered |
1749 | * for a component. Either with snd_soc_add_codec_controls() or | 1666 | * for a component. With snd_soc_add_codec_controls() or via table based |
1750 | * snd_soc_add_platform_controls() or via table based setup for either a | 1667 | * setup for either a CODEC or component driver. Otherwise the behavior is |
1751 | * CODEC, a platform or component driver. Otherwise the behavior is undefined. | 1668 | * undefined. |
1752 | */ | 1669 | */ |
1753 | static inline struct snd_soc_component *snd_soc_kcontrol_component( | 1670 | static inline struct snd_soc_component *snd_soc_kcontrol_component( |
1754 | struct snd_kcontrol *kcontrol) | 1671 | struct snd_kcontrol *kcontrol) |
@@ -1770,20 +1687,6 @@ static inline struct snd_soc_codec *snd_soc_kcontrol_codec( | |||
1770 | return snd_soc_component_to_codec(snd_soc_kcontrol_component(kcontrol)); | 1687 | return snd_soc_component_to_codec(snd_soc_kcontrol_component(kcontrol)); |
1771 | } | 1688 | } |
1772 | 1689 | ||
1773 | /** | ||
1774 | * snd_soc_kcontrol_platform() - Returns the platform that registered the control | ||
1775 | * @kcontrol: The control for which to get the platform | ||
1776 | * | ||
1777 | * Note: This function will only work correctly if the control has been | ||
1778 | * registered with snd_soc_add_platform_controls() or via table based setup of | ||
1779 | * a snd_soc_platform_driver. Otherwise the behavior is undefined. | ||
1780 | */ | ||
1781 | static inline struct snd_soc_platform *snd_soc_kcontrol_platform( | ||
1782 | struct snd_kcontrol *kcontrol) | ||
1783 | { | ||
1784 | return snd_soc_component_to_platform(snd_soc_kcontrol_component(kcontrol)); | ||
1785 | } | ||
1786 | |||
1787 | int snd_soc_util_init(void); | 1690 | int snd_soc_util_init(void); |
1788 | void snd_soc_util_exit(void); | 1691 | void snd_soc_util_exit(void); |
1789 | 1692 | ||
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 948505f74229..abc00c6cc2d7 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c | |||
@@ -29,7 +29,6 @@ | |||
29 | static int soc_compr_open(struct snd_compr_stream *cstream) | 29 | static int soc_compr_open(struct snd_compr_stream *cstream) |
30 | { | 30 | { |
31 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; | 31 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; |
32 | struct snd_soc_platform *platform = rtd->platform; | ||
33 | struct snd_soc_component *component; | 32 | struct snd_soc_component *component; |
34 | struct snd_soc_rtdcom_list *rtdcom; | 33 | struct snd_soc_rtdcom_list *rtdcom; |
35 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 34 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
@@ -47,23 +46,9 @@ static int soc_compr_open(struct snd_compr_stream *cstream) | |||
47 | } | 46 | } |
48 | } | 47 | } |
49 | 48 | ||
50 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->open) { | ||
51 | ret = platform->driver->compr_ops->open(cstream); | ||
52 | if (ret < 0) { | ||
53 | dev_err(platform->dev, | ||
54 | "Compress ASoC: can't open platform %s: %d\n", | ||
55 | platform->component.name, ret); | ||
56 | goto plat_err; | ||
57 | } | ||
58 | } | ||
59 | |||
60 | for_each_rtdcom(rtd, rtdcom) { | 49 | for_each_rtdcom(rtd, rtdcom) { |
61 | component = rtdcom->component; | 50 | component = rtdcom->component; |
62 | 51 | ||
63 | /* ignore duplication for now */ | ||
64 | if (platform && (component == &platform->component)) | ||
65 | continue; | ||
66 | |||
67 | if (!component->driver->compr_ops || | 52 | if (!component->driver->compr_ops || |
68 | !component->driver->compr_ops->open) | 53 | !component->driver->compr_ops->open) |
69 | continue; | 54 | continue; |
@@ -101,10 +86,6 @@ machine_err: | |||
101 | if (err_comp == component) | 86 | if (err_comp == component) |
102 | break; | 87 | break; |
103 | 88 | ||
104 | /* ignore duplication for now */ | ||
105 | if (platform && (err_comp == &platform->component)) | ||
106 | continue; | ||
107 | |||
108 | if (!err_comp->driver->compr_ops || | 89 | if (!err_comp->driver->compr_ops || |
109 | !err_comp->driver->compr_ops->free) | 90 | !err_comp->driver->compr_ops->free) |
110 | continue; | 91 | continue; |
@@ -112,9 +93,6 @@ machine_err: | |||
112 | err_comp->driver->compr_ops->free(cstream); | 93 | err_comp->driver->compr_ops->free(cstream); |
113 | } | 94 | } |
114 | 95 | ||
115 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->free) | ||
116 | platform->driver->compr_ops->free(cstream); | ||
117 | plat_err: | ||
118 | if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown) | 96 | if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown) |
119 | cpu_dai->driver->cops->shutdown(cstream, cpu_dai); | 97 | cpu_dai->driver->cops->shutdown(cstream, cpu_dai); |
120 | out: | 98 | out: |
@@ -127,7 +105,6 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream) | |||
127 | struct snd_soc_pcm_runtime *fe = cstream->private_data; | 105 | struct snd_soc_pcm_runtime *fe = cstream->private_data; |
128 | struct snd_pcm_substream *fe_substream = | 106 | struct snd_pcm_substream *fe_substream = |
129 | fe->pcm->streams[cstream->direction].substream; | 107 | fe->pcm->streams[cstream->direction].substream; |
130 | struct snd_soc_platform *platform = fe->platform; | ||
131 | struct snd_soc_component *component; | 108 | struct snd_soc_component *component; |
132 | struct snd_soc_rtdcom_list *rtdcom; | 109 | struct snd_soc_rtdcom_list *rtdcom; |
133 | struct snd_soc_dai *cpu_dai = fe->cpu_dai; | 110 | struct snd_soc_dai *cpu_dai = fe->cpu_dai; |
@@ -153,23 +130,9 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream) | |||
153 | } | 130 | } |
154 | } | 131 | } |
155 | 132 | ||
156 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->open) { | ||
157 | ret = platform->driver->compr_ops->open(cstream); | ||
158 | if (ret < 0) { | ||
159 | dev_err(platform->dev, | ||
160 | "Compress ASoC: can't open platform %s: %d\n", | ||
161 | platform->component.name, ret); | ||
162 | goto plat_err; | ||
163 | } | ||
164 | } | ||
165 | |||
166 | for_each_rtdcom(fe, rtdcom) { | 133 | for_each_rtdcom(fe, rtdcom) { |
167 | component = rtdcom->component; | 134 | component = rtdcom->component; |
168 | 135 | ||
169 | /* ignore duplication for now */ | ||
170 | if (platform && (component == &platform->component)) | ||
171 | continue; | ||
172 | |||
173 | if (!component->driver->compr_ops || | 136 | if (!component->driver->compr_ops || |
174 | !component->driver->compr_ops->open) | 137 | !component->driver->compr_ops->open) |
175 | continue; | 138 | continue; |
@@ -242,10 +205,6 @@ machine_err: | |||
242 | if (err_comp == component) | 205 | if (err_comp == component) |
243 | break; | 206 | break; |
244 | 207 | ||
245 | /* ignore duplication for now */ | ||
246 | if (platform && (err_comp == &platform->component)) | ||
247 | continue; | ||
248 | |||
249 | if (!err_comp->driver->compr_ops || | 208 | if (!err_comp->driver->compr_ops || |
250 | !err_comp->driver->compr_ops->free) | 209 | !err_comp->driver->compr_ops->free) |
251 | continue; | 210 | continue; |
@@ -253,9 +212,6 @@ machine_err: | |||
253 | err_comp->driver->compr_ops->free(cstream); | 212 | err_comp->driver->compr_ops->free(cstream); |
254 | } | 213 | } |
255 | 214 | ||
256 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->free) | ||
257 | platform->driver->compr_ops->free(cstream); | ||
258 | plat_err: | ||
259 | if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown) | 215 | if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown) |
260 | cpu_dai->driver->cops->shutdown(cstream, cpu_dai); | 216 | cpu_dai->driver->cops->shutdown(cstream, cpu_dai); |
261 | out: | 217 | out: |
@@ -296,7 +252,6 @@ static void close_delayed_work(struct work_struct *work) | |||
296 | static int soc_compr_free(struct snd_compr_stream *cstream) | 252 | static int soc_compr_free(struct snd_compr_stream *cstream) |
297 | { | 253 | { |
298 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; | 254 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; |
299 | struct snd_soc_platform *platform = rtd->platform; | ||
300 | struct snd_soc_component *component; | 255 | struct snd_soc_component *component; |
301 | struct snd_soc_rtdcom_list *rtdcom; | 256 | struct snd_soc_rtdcom_list *rtdcom; |
302 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 257 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
@@ -326,10 +281,6 @@ static int soc_compr_free(struct snd_compr_stream *cstream) | |||
326 | for_each_rtdcom(rtd, rtdcom) { | 281 | for_each_rtdcom(rtd, rtdcom) { |
327 | component = rtdcom->component; | 282 | component = rtdcom->component; |
328 | 283 | ||
329 | /* ignore duplication for now */ | ||
330 | if (platform && (component == &platform->component)) | ||
331 | continue; | ||
332 | |||
333 | if (!component->driver->compr_ops || | 284 | if (!component->driver->compr_ops || |
334 | !component->driver->compr_ops->free) | 285 | !component->driver->compr_ops->free) |
335 | continue; | 286 | continue; |
@@ -337,9 +288,6 @@ static int soc_compr_free(struct snd_compr_stream *cstream) | |||
337 | component->driver->compr_ops->free(cstream); | 288 | component->driver->compr_ops->free(cstream); |
338 | } | 289 | } |
339 | 290 | ||
340 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->free) | ||
341 | platform->driver->compr_ops->free(cstream); | ||
342 | |||
343 | if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown) | 291 | if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown) |
344 | cpu_dai->driver->cops->shutdown(cstream, cpu_dai); | 292 | cpu_dai->driver->cops->shutdown(cstream, cpu_dai); |
345 | 293 | ||
@@ -368,7 +316,6 @@ static int soc_compr_free(struct snd_compr_stream *cstream) | |||
368 | static int soc_compr_free_fe(struct snd_compr_stream *cstream) | 316 | static int soc_compr_free_fe(struct snd_compr_stream *cstream) |
369 | { | 317 | { |
370 | struct snd_soc_pcm_runtime *fe = cstream->private_data; | 318 | struct snd_soc_pcm_runtime *fe = cstream->private_data; |
371 | struct snd_soc_platform *platform = fe->platform; | ||
372 | struct snd_soc_component *component; | 319 | struct snd_soc_component *component; |
373 | struct snd_soc_rtdcom_list *rtdcom; | 320 | struct snd_soc_rtdcom_list *rtdcom; |
374 | struct snd_soc_dai *cpu_dai = fe->cpu_dai; | 321 | struct snd_soc_dai *cpu_dai = fe->cpu_dai; |
@@ -408,16 +355,9 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream) | |||
408 | if (fe->dai_link->compr_ops && fe->dai_link->compr_ops->shutdown) | 355 | if (fe->dai_link->compr_ops && fe->dai_link->compr_ops->shutdown) |
409 | fe->dai_link->compr_ops->shutdown(cstream); | 356 | fe->dai_link->compr_ops->shutdown(cstream); |
410 | 357 | ||
411 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->free) | ||
412 | platform->driver->compr_ops->free(cstream); | ||
413 | |||
414 | for_each_rtdcom(fe, rtdcom) { | 358 | for_each_rtdcom(fe, rtdcom) { |
415 | component = rtdcom->component; | 359 | component = rtdcom->component; |
416 | 360 | ||
417 | /* ignore duplication for now */ | ||
418 | if (platform && (component == &platform->component)) | ||
419 | continue; | ||
420 | |||
421 | if (!component->driver->compr_ops || | 361 | if (!component->driver->compr_ops || |
422 | !component->driver->compr_ops->free) | 362 | !component->driver->compr_ops->free) |
423 | continue; | 363 | continue; |
@@ -436,7 +376,6 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd) | |||
436 | { | 376 | { |
437 | 377 | ||
438 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; | 378 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; |
439 | struct snd_soc_platform *platform = rtd->platform; | ||
440 | struct snd_soc_component *component; | 379 | struct snd_soc_component *component; |
441 | struct snd_soc_rtdcom_list *rtdcom; | 380 | struct snd_soc_rtdcom_list *rtdcom; |
442 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | 381 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
@@ -445,19 +384,9 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd) | |||
445 | 384 | ||
446 | mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); | 385 | mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); |
447 | 386 | ||
448 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->trigger) { | ||
449 | ret = platform->driver->compr_ops->trigger(cstream, cmd); | ||
450 | if (ret < 0) | ||
451 | goto out; | ||
452 | } | ||
453 | |||
454 | for_each_rtdcom(rtd, rtdcom) { | 387 | for_each_rtdcom(rtd, rtdcom) { |
455 | component = rtdcom->component; | 388 | component = rtdcom->component; |
456 | 389 | ||
457 | /* ignore duplication for now */ | ||
458 | if (platform && (component == &platform->component)) | ||
459 | continue; | ||
460 | |||
461 | if (!component->driver->compr_ops || | 390 | if (!component->driver->compr_ops || |
462 | !component->driver->compr_ops->trigger) | 391 | !component->driver->compr_ops->trigger) |
463 | continue; | 392 | continue; |
@@ -489,7 +418,6 @@ out: | |||
489 | static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd) | 418 | static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd) |
490 | { | 419 | { |
491 | struct snd_soc_pcm_runtime *fe = cstream->private_data; | 420 | struct snd_soc_pcm_runtime *fe = cstream->private_data; |
492 | struct snd_soc_platform *platform = fe->platform; | ||
493 | struct snd_soc_component *component; | 421 | struct snd_soc_component *component; |
494 | struct snd_soc_rtdcom_list *rtdcom; | 422 | struct snd_soc_rtdcom_list *rtdcom; |
495 | struct snd_soc_dai *cpu_dai = fe->cpu_dai; | 423 | struct snd_soc_dai *cpu_dai = fe->cpu_dai; |
@@ -498,19 +426,9 @@ static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd) | |||
498 | if (cmd == SND_COMPR_TRIGGER_PARTIAL_DRAIN || | 426 | if (cmd == SND_COMPR_TRIGGER_PARTIAL_DRAIN || |
499 | cmd == SND_COMPR_TRIGGER_DRAIN) { | 427 | cmd == SND_COMPR_TRIGGER_DRAIN) { |
500 | 428 | ||
501 | if (platform && | ||
502 | platform->driver->compr_ops && | ||
503 | platform->driver->compr_ops->trigger) | ||
504 | return platform->driver->compr_ops->trigger(cstream, | ||
505 | cmd); | ||
506 | |||
507 | for_each_rtdcom(fe, rtdcom) { | 429 | for_each_rtdcom(fe, rtdcom) { |
508 | component = rtdcom->component; | 430 | component = rtdcom->component; |
509 | 431 | ||
510 | /* ignore duplication for now */ | ||
511 | if (platform && (component == &platform->component)) | ||
512 | continue; | ||
513 | |||
514 | if (!component->driver->compr_ops || | 432 | if (!component->driver->compr_ops || |
515 | !component->driver->compr_ops->trigger) | 433 | !component->driver->compr_ops->trigger) |
516 | continue; | 434 | continue; |
@@ -536,19 +454,9 @@ static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd) | |||
536 | goto out; | 454 | goto out; |
537 | } | 455 | } |
538 | 456 | ||
539 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->trigger) { | ||
540 | ret = platform->driver->compr_ops->trigger(cstream, cmd); | ||
541 | if (ret < 0) | ||
542 | goto out; | ||
543 | } | ||
544 | |||
545 | for_each_rtdcom(fe, rtdcom) { | 457 | for_each_rtdcom(fe, rtdcom) { |
546 | component = rtdcom->component; | 458 | component = rtdcom->component; |
547 | 459 | ||
548 | /* ignore duplication for now */ | ||
549 | if (platform && (component == &platform->component)) | ||
550 | continue; | ||
551 | |||
552 | if (!component->driver->compr_ops || | 460 | if (!component->driver->compr_ops || |
553 | !component->driver->compr_ops->trigger) | 461 | !component->driver->compr_ops->trigger) |
554 | continue; | 462 | continue; |
@@ -589,7 +497,6 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream, | |||
589 | struct snd_compr_params *params) | 497 | struct snd_compr_params *params) |
590 | { | 498 | { |
591 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; | 499 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; |
592 | struct snd_soc_platform *platform = rtd->platform; | ||
593 | struct snd_soc_component *component; | 500 | struct snd_soc_component *component; |
594 | struct snd_soc_rtdcom_list *rtdcom; | 501 | struct snd_soc_rtdcom_list *rtdcom; |
595 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 502 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
@@ -597,11 +504,12 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream, | |||
597 | 504 | ||
598 | mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); | 505 | mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); |
599 | 506 | ||
600 | /* first we call set_params for the platform driver | 507 | /* |
601 | * this should configure the soc side | 508 | * First we call set_params for the CPU DAI, then the component |
602 | * if the machine has compressed ops then we call that as well | 509 | * driver this should configure the SoC side. If the machine has |
603 | * expectation is that platform and machine will configure everything | 510 | * compressed ops then we call that as well. The expectation is |
604 | * for this compress path, like configuring pcm port for codec | 511 | * that these callbacks will configure everything for this compress |
512 | * path, like configuring a PCM port for a CODEC. | ||
605 | */ | 513 | */ |
606 | if (cpu_dai->driver->cops && cpu_dai->driver->cops->set_params) { | 514 | if (cpu_dai->driver->cops && cpu_dai->driver->cops->set_params) { |
607 | ret = cpu_dai->driver->cops->set_params(cstream, params, cpu_dai); | 515 | ret = cpu_dai->driver->cops->set_params(cstream, params, cpu_dai); |
@@ -609,19 +517,9 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream, | |||
609 | goto err; | 517 | goto err; |
610 | } | 518 | } |
611 | 519 | ||
612 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->set_params) { | ||
613 | ret = platform->driver->compr_ops->set_params(cstream, params); | ||
614 | if (ret < 0) | ||
615 | goto err; | ||
616 | } | ||
617 | |||
618 | for_each_rtdcom(rtd, rtdcom) { | 520 | for_each_rtdcom(rtd, rtdcom) { |
619 | component = rtdcom->component; | 521 | component = rtdcom->component; |
620 | 522 | ||
621 | /* ignore duplication for now */ | ||
622 | if (platform && (component == &platform->component)) | ||
623 | continue; | ||
624 | |||
625 | if (!component->driver->compr_ops || | 523 | if (!component->driver->compr_ops || |
626 | !component->driver->compr_ops->set_params) | 524 | !component->driver->compr_ops->set_params) |
627 | continue; | 525 | continue; |
@@ -665,7 +563,6 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream, | |||
665 | struct snd_soc_pcm_runtime *fe = cstream->private_data; | 563 | struct snd_soc_pcm_runtime *fe = cstream->private_data; |
666 | struct snd_pcm_substream *fe_substream = | 564 | struct snd_pcm_substream *fe_substream = |
667 | fe->pcm->streams[cstream->direction].substream; | 565 | fe->pcm->streams[cstream->direction].substream; |
668 | struct snd_soc_platform *platform = fe->platform; | ||
669 | struct snd_soc_component *component; | 566 | struct snd_soc_component *component; |
670 | struct snd_soc_rtdcom_list *rtdcom; | 567 | struct snd_soc_rtdcom_list *rtdcom; |
671 | struct snd_soc_dai *cpu_dai = fe->cpu_dai; | 568 | struct snd_soc_dai *cpu_dai = fe->cpu_dai; |
@@ -684,19 +581,9 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream, | |||
684 | goto out; | 581 | goto out; |
685 | } | 582 | } |
686 | 583 | ||
687 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->set_params) { | ||
688 | ret = platform->driver->compr_ops->set_params(cstream, params); | ||
689 | if (ret < 0) | ||
690 | goto out; | ||
691 | } | ||
692 | |||
693 | for_each_rtdcom(fe, rtdcom) { | 584 | for_each_rtdcom(fe, rtdcom) { |
694 | component = rtdcom->component; | 585 | component = rtdcom->component; |
695 | 586 | ||
696 | /* ignore duplication for now */ | ||
697 | if (platform && (component == &platform->component)) | ||
698 | continue; | ||
699 | |||
700 | if (!component->driver->compr_ops || | 587 | if (!component->driver->compr_ops || |
701 | !component->driver->compr_ops->set_params) | 588 | !component->driver->compr_ops->set_params) |
702 | continue; | 589 | continue; |
@@ -745,7 +632,6 @@ static int soc_compr_get_params(struct snd_compr_stream *cstream, | |||
745 | struct snd_codec *params) | 632 | struct snd_codec *params) |
746 | { | 633 | { |
747 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; | 634 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; |
748 | struct snd_soc_platform *platform = rtd->platform; | ||
749 | struct snd_soc_component *component; | 635 | struct snd_soc_component *component; |
750 | struct snd_soc_rtdcom_list *rtdcom; | 636 | struct snd_soc_rtdcom_list *rtdcom; |
751 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 637 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
@@ -759,19 +645,9 @@ static int soc_compr_get_params(struct snd_compr_stream *cstream, | |||
759 | goto err; | 645 | goto err; |
760 | } | 646 | } |
761 | 647 | ||
762 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->get_params) { | ||
763 | ret = platform->driver->compr_ops->get_params(cstream, params); | ||
764 | if (ret < 0) | ||
765 | goto err; | ||
766 | } | ||
767 | |||
768 | for_each_rtdcom(rtd, rtdcom) { | 648 | for_each_rtdcom(rtd, rtdcom) { |
769 | component = rtdcom->component; | 649 | component = rtdcom->component; |
770 | 650 | ||
771 | /* ignore duplication for now */ | ||
772 | if (platform && (component == &platform->component)) | ||
773 | continue; | ||
774 | |||
775 | if (!component->driver->compr_ops || | 651 | if (!component->driver->compr_ops || |
776 | !component->driver->compr_ops->get_params) | 652 | !component->driver->compr_ops->get_params) |
777 | continue; | 653 | continue; |
@@ -790,26 +666,15 @@ static int soc_compr_get_caps(struct snd_compr_stream *cstream, | |||
790 | struct snd_compr_caps *caps) | 666 | struct snd_compr_caps *caps) |
791 | { | 667 | { |
792 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; | 668 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; |
793 | struct snd_soc_platform *platform = rtd->platform; | ||
794 | struct snd_soc_component *component; | 669 | struct snd_soc_component *component; |
795 | struct snd_soc_rtdcom_list *rtdcom; | 670 | struct snd_soc_rtdcom_list *rtdcom; |
796 | int ret = 0, __ret; | 671 | int ret = 0, __ret; |
797 | 672 | ||
798 | mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); | 673 | mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); |
799 | 674 | ||
800 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->get_caps) { | ||
801 | ret = platform->driver->compr_ops->get_caps(cstream, caps); | ||
802 | if (ret < 0) | ||
803 | goto err; | ||
804 | } | ||
805 | |||
806 | for_each_rtdcom(rtd, rtdcom) { | 675 | for_each_rtdcom(rtd, rtdcom) { |
807 | component = rtdcom->component; | 676 | component = rtdcom->component; |
808 | 677 | ||
809 | /* ignore duplication for now */ | ||
810 | if (platform && (component == &platform->component)) | ||
811 | continue; | ||
812 | |||
813 | if (!component->driver->compr_ops || | 678 | if (!component->driver->compr_ops || |
814 | !component->driver->compr_ops->get_caps) | 679 | !component->driver->compr_ops->get_caps) |
815 | continue; | 680 | continue; |
@@ -819,7 +684,6 @@ static int soc_compr_get_caps(struct snd_compr_stream *cstream, | |||
819 | ret = __ret; | 684 | ret = __ret; |
820 | } | 685 | } |
821 | 686 | ||
822 | err: | ||
823 | mutex_unlock(&rtd->pcm_mutex); | 687 | mutex_unlock(&rtd->pcm_mutex); |
824 | return ret; | 688 | return ret; |
825 | } | 689 | } |
@@ -828,26 +692,15 @@ static int soc_compr_get_codec_caps(struct snd_compr_stream *cstream, | |||
828 | struct snd_compr_codec_caps *codec) | 692 | struct snd_compr_codec_caps *codec) |
829 | { | 693 | { |
830 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; | 694 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; |
831 | struct snd_soc_platform *platform = rtd->platform; | ||
832 | struct snd_soc_component *component; | 695 | struct snd_soc_component *component; |
833 | struct snd_soc_rtdcom_list *rtdcom; | 696 | struct snd_soc_rtdcom_list *rtdcom; |
834 | int ret = 0, __ret; | 697 | int ret = 0, __ret; |
835 | 698 | ||
836 | mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); | 699 | mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); |
837 | 700 | ||
838 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->get_codec_caps) { | ||
839 | ret = platform->driver->compr_ops->get_codec_caps(cstream, codec); | ||
840 | if (ret < 0) | ||
841 | goto err; | ||
842 | } | ||
843 | |||
844 | for_each_rtdcom(rtd, rtdcom) { | 701 | for_each_rtdcom(rtd, rtdcom) { |
845 | component = rtdcom->component; | 702 | component = rtdcom->component; |
846 | 703 | ||
847 | /* ignore duplication for now */ | ||
848 | if (platform && (component == &platform->component)) | ||
849 | continue; | ||
850 | |||
851 | if (!component->driver->compr_ops || | 704 | if (!component->driver->compr_ops || |
852 | !component->driver->compr_ops->get_codec_caps) | 705 | !component->driver->compr_ops->get_codec_caps) |
853 | continue; | 706 | continue; |
@@ -857,7 +710,6 @@ static int soc_compr_get_codec_caps(struct snd_compr_stream *cstream, | |||
857 | ret = __ret; | 710 | ret = __ret; |
858 | } | 711 | } |
859 | 712 | ||
860 | err: | ||
861 | mutex_unlock(&rtd->pcm_mutex); | 713 | mutex_unlock(&rtd->pcm_mutex); |
862 | return ret; | 714 | return ret; |
863 | } | 715 | } |
@@ -865,7 +717,6 @@ err: | |||
865 | static int soc_compr_ack(struct snd_compr_stream *cstream, size_t bytes) | 717 | static int soc_compr_ack(struct snd_compr_stream *cstream, size_t bytes) |
866 | { | 718 | { |
867 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; | 719 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; |
868 | struct snd_soc_platform *platform = rtd->platform; | ||
869 | struct snd_soc_component *component; | 720 | struct snd_soc_component *component; |
870 | struct snd_soc_rtdcom_list *rtdcom; | 721 | struct snd_soc_rtdcom_list *rtdcom; |
871 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 722 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
@@ -879,19 +730,9 @@ static int soc_compr_ack(struct snd_compr_stream *cstream, size_t bytes) | |||
879 | goto err; | 730 | goto err; |
880 | } | 731 | } |
881 | 732 | ||
882 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->ack) { | ||
883 | ret = platform->driver->compr_ops->ack(cstream, bytes); | ||
884 | if (ret < 0) | ||
885 | goto err; | ||
886 | } | ||
887 | |||
888 | for_each_rtdcom(rtd, rtdcom) { | 733 | for_each_rtdcom(rtd, rtdcom) { |
889 | component = rtdcom->component; | 734 | component = rtdcom->component; |
890 | 735 | ||
891 | /* ignore duplication for now */ | ||
892 | if (platform && (component == &platform->component)) | ||
893 | continue; | ||
894 | |||
895 | if (!component->driver->compr_ops || | 736 | if (!component->driver->compr_ops || |
896 | !component->driver->compr_ops->ack) | 737 | !component->driver->compr_ops->ack) |
897 | continue; | 738 | continue; |
@@ -910,7 +751,6 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream, | |||
910 | struct snd_compr_tstamp *tstamp) | 751 | struct snd_compr_tstamp *tstamp) |
911 | { | 752 | { |
912 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; | 753 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; |
913 | struct snd_soc_platform *platform = rtd->platform; | ||
914 | struct snd_soc_component *component; | 754 | struct snd_soc_component *component; |
915 | struct snd_soc_rtdcom_list *rtdcom; | 755 | struct snd_soc_rtdcom_list *rtdcom; |
916 | int ret = 0, __ret; | 756 | int ret = 0, __ret; |
@@ -921,19 +761,9 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream, | |||
921 | if (cpu_dai->driver->cops && cpu_dai->driver->cops->pointer) | 761 | if (cpu_dai->driver->cops && cpu_dai->driver->cops->pointer) |
922 | cpu_dai->driver->cops->pointer(cstream, tstamp, cpu_dai); | 762 | cpu_dai->driver->cops->pointer(cstream, tstamp, cpu_dai); |
923 | 763 | ||
924 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->pointer) { | ||
925 | ret = platform->driver->compr_ops->pointer(cstream, tstamp); | ||
926 | if (ret < 0) | ||
927 | goto err; | ||
928 | } | ||
929 | |||
930 | for_each_rtdcom(rtd, rtdcom) { | 764 | for_each_rtdcom(rtd, rtdcom) { |
931 | component = rtdcom->component; | 765 | component = rtdcom->component; |
932 | 766 | ||
933 | /* ignore duplication for now */ | ||
934 | if (platform && (component == &platform->component)) | ||
935 | continue; | ||
936 | |||
937 | if (!component->driver->compr_ops || | 767 | if (!component->driver->compr_ops || |
938 | !component->driver->compr_ops->pointer) | 768 | !component->driver->compr_ops->pointer) |
939 | continue; | 769 | continue; |
@@ -943,7 +773,6 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream, | |||
943 | ret = __ret; | 773 | ret = __ret; |
944 | } | 774 | } |
945 | 775 | ||
946 | err: | ||
947 | mutex_unlock(&rtd->pcm_mutex); | 776 | mutex_unlock(&rtd->pcm_mutex); |
948 | return ret; | 777 | return ret; |
949 | } | 778 | } |
@@ -952,26 +781,15 @@ static int soc_compr_copy(struct snd_compr_stream *cstream, | |||
952 | char __user *buf, size_t count) | 781 | char __user *buf, size_t count) |
953 | { | 782 | { |
954 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; | 783 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; |
955 | struct snd_soc_platform *platform = rtd->platform; | ||
956 | struct snd_soc_component *component; | 784 | struct snd_soc_component *component; |
957 | struct snd_soc_rtdcom_list *rtdcom; | 785 | struct snd_soc_rtdcom_list *rtdcom; |
958 | int ret = 0; | 786 | int ret = 0; |
959 | 787 | ||
960 | mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); | 788 | mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); |
961 | 789 | ||
962 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->copy) { | ||
963 | ret = platform->driver->compr_ops->copy(cstream, buf, count); | ||
964 | if (ret < 0) | ||
965 | goto err; | ||
966 | } | ||
967 | |||
968 | for_each_rtdcom(rtd, rtdcom) { | 790 | for_each_rtdcom(rtd, rtdcom) { |
969 | component = rtdcom->component; | 791 | component = rtdcom->component; |
970 | 792 | ||
971 | /* ignore duplication for now */ | ||
972 | if (platform && (component == &platform->component)) | ||
973 | continue; | ||
974 | |||
975 | if (!component->driver->compr_ops || | 793 | if (!component->driver->compr_ops || |
976 | !component->driver->compr_ops->copy) | 794 | !component->driver->compr_ops->copy) |
977 | continue; | 795 | continue; |
@@ -980,7 +798,6 @@ static int soc_compr_copy(struct snd_compr_stream *cstream, | |||
980 | break; | 798 | break; |
981 | } | 799 | } |
982 | 800 | ||
983 | err: | ||
984 | mutex_unlock(&rtd->pcm_mutex); | 801 | mutex_unlock(&rtd->pcm_mutex); |
985 | return ret; | 802 | return ret; |
986 | } | 803 | } |
@@ -989,7 +806,6 @@ static int soc_compr_set_metadata(struct snd_compr_stream *cstream, | |||
989 | struct snd_compr_metadata *metadata) | 806 | struct snd_compr_metadata *metadata) |
990 | { | 807 | { |
991 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; | 808 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; |
992 | struct snd_soc_platform *platform = rtd->platform; | ||
993 | struct snd_soc_component *component; | 809 | struct snd_soc_component *component; |
994 | struct snd_soc_rtdcom_list *rtdcom; | 810 | struct snd_soc_rtdcom_list *rtdcom; |
995 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 811 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
@@ -1001,19 +817,9 @@ static int soc_compr_set_metadata(struct snd_compr_stream *cstream, | |||
1001 | return ret; | 817 | return ret; |
1002 | } | 818 | } |
1003 | 819 | ||
1004 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->set_metadata) { | ||
1005 | ret = platform->driver->compr_ops->set_metadata(cstream, metadata); | ||
1006 | if (ret < 0) | ||
1007 | return ret; | ||
1008 | } | ||
1009 | |||
1010 | for_each_rtdcom(rtd, rtdcom) { | 820 | for_each_rtdcom(rtd, rtdcom) { |
1011 | component = rtdcom->component; | 821 | component = rtdcom->component; |
1012 | 822 | ||
1013 | /* ignore duplication for now */ | ||
1014 | if (platform && (component == &platform->component)) | ||
1015 | continue; | ||
1016 | |||
1017 | if (!component->driver->compr_ops || | 823 | if (!component->driver->compr_ops || |
1018 | !component->driver->compr_ops->set_metadata) | 824 | !component->driver->compr_ops->set_metadata) |
1019 | continue; | 825 | continue; |
@@ -1030,7 +836,6 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream, | |||
1030 | struct snd_compr_metadata *metadata) | 836 | struct snd_compr_metadata *metadata) |
1031 | { | 837 | { |
1032 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; | 838 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; |
1033 | struct snd_soc_platform *platform = rtd->platform; | ||
1034 | struct snd_soc_component *component; | 839 | struct snd_soc_component *component; |
1035 | struct snd_soc_rtdcom_list *rtdcom; | 840 | struct snd_soc_rtdcom_list *rtdcom; |
1036 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 841 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
@@ -1042,19 +847,9 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream, | |||
1042 | return ret; | 847 | return ret; |
1043 | } | 848 | } |
1044 | 849 | ||
1045 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->get_metadata) { | ||
1046 | ret = platform->driver->compr_ops->get_metadata(cstream, metadata); | ||
1047 | if (ret < 0) | ||
1048 | return ret; | ||
1049 | } | ||
1050 | |||
1051 | for_each_rtdcom(rtd, rtdcom) { | 850 | for_each_rtdcom(rtd, rtdcom) { |
1052 | component = rtdcom->component; | 851 | component = rtdcom->component; |
1053 | 852 | ||
1054 | /* ignore duplication for now */ | ||
1055 | if (platform && (component == &platform->component)) | ||
1056 | continue; | ||
1057 | |||
1058 | if (!component->driver->compr_ops || | 853 | if (!component->driver->compr_ops || |
1059 | !component->driver->compr_ops->get_metadata) | 854 | !component->driver->compr_ops->get_metadata) |
1060 | continue; | 855 | continue; |
@@ -1107,7 +902,6 @@ static struct snd_compr_ops soc_compr_dyn_ops = { | |||
1107 | */ | 902 | */ |
1108 | int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) | 903 | int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) |
1109 | { | 904 | { |
1110 | struct snd_soc_platform *platform = rtd->platform; | ||
1111 | struct snd_soc_component *component; | 905 | struct snd_soc_component *component; |
1112 | struct snd_soc_rtdcom_list *rtdcom; | 906 | struct snd_soc_rtdcom_list *rtdcom; |
1113 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | 907 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
@@ -1188,18 +982,9 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) | |||
1188 | memcpy(compr->ops, &soc_compr_ops, sizeof(soc_compr_ops)); | 982 | memcpy(compr->ops, &soc_compr_ops, sizeof(soc_compr_ops)); |
1189 | } | 983 | } |
1190 | 984 | ||
1191 | |||
1192 | /* Add copy callback for not memory mapped DSPs */ | ||
1193 | if (platform && platform->driver->compr_ops && platform->driver->compr_ops->copy) | ||
1194 | compr->ops->copy = soc_compr_copy; | ||
1195 | |||
1196 | for_each_rtdcom(rtd, rtdcom) { | 985 | for_each_rtdcom(rtd, rtdcom) { |
1197 | component = rtdcom->component; | 986 | component = rtdcom->component; |
1198 | 987 | ||
1199 | /* ignore duplication for now */ | ||
1200 | if (platform && (component == &platform->component)) | ||
1201 | continue; | ||
1202 | |||
1203 | if (!component->driver->compr_ops || | 988 | if (!component->driver->compr_ops || |
1204 | !component->driver->compr_ops->copy) | 989 | !component->driver->compr_ops->copy) |
1205 | continue; | 990 | continue; |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index bf7ca32ab31f..052089f16ea0 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -56,7 +56,6 @@ EXPORT_SYMBOL_GPL(snd_soc_debugfs_root); | |||
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | static DEFINE_MUTEX(client_mutex); | 58 | static DEFINE_MUTEX(client_mutex); |
59 | static LIST_HEAD(platform_list); | ||
60 | static LIST_HEAD(codec_list); | 59 | static LIST_HEAD(codec_list); |
61 | static LIST_HEAD(component_list); | 60 | static LIST_HEAD(component_list); |
62 | 61 | ||
@@ -381,21 +380,6 @@ static int dai_list_show(struct seq_file *m, void *v) | |||
381 | } | 380 | } |
382 | DEFINE_SHOW_ATTRIBUTE(dai_list); | 381 | DEFINE_SHOW_ATTRIBUTE(dai_list); |
383 | 382 | ||
384 | static int platform_list_show(struct seq_file *m, void *v) | ||
385 | { | ||
386 | struct snd_soc_platform *platform; | ||
387 | |||
388 | mutex_lock(&client_mutex); | ||
389 | |||
390 | list_for_each_entry(platform, &platform_list, list) | ||
391 | seq_printf(m, "%s\n", platform->component.name); | ||
392 | |||
393 | mutex_unlock(&client_mutex); | ||
394 | |||
395 | return 0; | ||
396 | } | ||
397 | DEFINE_SHOW_ATTRIBUTE(platform_list); | ||
398 | |||
399 | static void soc_init_card_debugfs(struct snd_soc_card *card) | 383 | static void soc_init_card_debugfs(struct snd_soc_card *card) |
400 | { | 384 | { |
401 | if (!snd_soc_debugfs_root) | 385 | if (!snd_soc_debugfs_root) |
@@ -438,10 +422,6 @@ static void snd_soc_debugfs_init(void) | |||
438 | if (!debugfs_create_file("dais", 0444, snd_soc_debugfs_root, NULL, | 422 | if (!debugfs_create_file("dais", 0444, snd_soc_debugfs_root, NULL, |
439 | &dai_list_fops)) | 423 | &dai_list_fops)) |
440 | pr_warn("ASoC: Failed to create DAI list debugfs file\n"); | 424 | pr_warn("ASoC: Failed to create DAI list debugfs file\n"); |
441 | |||
442 | if (!debugfs_create_file("platforms", 0444, snd_soc_debugfs_root, NULL, | ||
443 | &platform_list_fops)) | ||
444 | pr_warn("ASoC: Failed to create platform list debugfs file\n"); | ||
445 | } | 425 | } |
446 | 426 | ||
447 | static void snd_soc_debugfs_exit(void) | 427 | static void snd_soc_debugfs_exit(void) |
@@ -1045,7 +1025,6 @@ static int soc_bind_dai_link(struct snd_soc_card *card, | |||
1045 | struct snd_soc_dai_link_component cpu_dai_component; | 1025 | struct snd_soc_dai_link_component cpu_dai_component; |
1046 | struct snd_soc_component *component; | 1026 | struct snd_soc_component *component; |
1047 | struct snd_soc_dai **codec_dais; | 1027 | struct snd_soc_dai **codec_dais; |
1048 | struct snd_soc_platform *platform; | ||
1049 | struct device_node *platform_of_node; | 1028 | struct device_node *platform_of_node; |
1050 | const char *platform_name; | 1029 | const char *platform_name; |
1051 | int i; | 1030 | int i; |
@@ -1113,23 +1092,6 @@ static int soc_bind_dai_link(struct snd_soc_card *card, | |||
1113 | snd_soc_rtdcom_add(rtd, component); | 1092 | snd_soc_rtdcom_add(rtd, component); |
1114 | } | 1093 | } |
1115 | 1094 | ||
1116 | /* find one from the set of registered platforms */ | ||
1117 | list_for_each_entry(platform, &platform_list, list) { | ||
1118 | platform_of_node = platform->dev->of_node; | ||
1119 | if (!platform_of_node && platform->dev->parent->of_node) | ||
1120 | platform_of_node = platform->dev->parent->of_node; | ||
1121 | |||
1122 | if (dai_link->platform_of_node) { | ||
1123 | if (platform_of_node != dai_link->platform_of_node) | ||
1124 | continue; | ||
1125 | } else { | ||
1126 | if (strcmp(platform->component.name, platform_name)) | ||
1127 | continue; | ||
1128 | } | ||
1129 | |||
1130 | rtd->platform = platform; | ||
1131 | } | ||
1132 | |||
1133 | soc_add_pcm_runtime(card, rtd); | 1095 | soc_add_pcm_runtime(card, rtd); |
1134 | return 0; | 1096 | return 0; |
1135 | 1097 | ||
@@ -2513,24 +2475,6 @@ int snd_soc_add_codec_controls(struct snd_soc_codec *codec, | |||
2513 | EXPORT_SYMBOL_GPL(snd_soc_add_codec_controls); | 2475 | EXPORT_SYMBOL_GPL(snd_soc_add_codec_controls); |
2514 | 2476 | ||
2515 | /** | 2477 | /** |
2516 | * snd_soc_add_platform_controls - add an array of controls to a platform. | ||
2517 | * Convenience function to add a list of controls. | ||
2518 | * | ||
2519 | * @platform: platform to add controls to | ||
2520 | * @controls: array of controls to add | ||
2521 | * @num_controls: number of elements in the array | ||
2522 | * | ||
2523 | * Return 0 for success, else error. | ||
2524 | */ | ||
2525 | int snd_soc_add_platform_controls(struct snd_soc_platform *platform, | ||
2526 | const struct snd_kcontrol_new *controls, unsigned int num_controls) | ||
2527 | { | ||
2528 | return snd_soc_add_component_controls(&platform->component, controls, | ||
2529 | num_controls); | ||
2530 | } | ||
2531 | EXPORT_SYMBOL_GPL(snd_soc_add_platform_controls); | ||
2532 | |||
2533 | /** | ||
2534 | * snd_soc_add_card_controls - add an array of controls to a SoC card. | 2478 | * snd_soc_add_card_controls - add an array of controls to a SoC card. |
2535 | * Convenience function to add a list of controls. | 2479 | * Convenience function to add a list of controls. |
2536 | * | 2480 | * |
@@ -3503,164 +3447,6 @@ struct snd_soc_component *snd_soc_lookup_component(struct device *dev, | |||
3503 | } | 3447 | } |
3504 | EXPORT_SYMBOL_GPL(snd_soc_lookup_component); | 3448 | EXPORT_SYMBOL_GPL(snd_soc_lookup_component); |
3505 | 3449 | ||
3506 | static int snd_soc_platform_drv_probe(struct snd_soc_component *component) | ||
3507 | { | ||
3508 | struct snd_soc_platform *platform = snd_soc_component_to_platform(component); | ||
3509 | |||
3510 | return platform->driver->probe(platform); | ||
3511 | } | ||
3512 | |||
3513 | static void snd_soc_platform_drv_remove(struct snd_soc_component *component) | ||
3514 | { | ||
3515 | struct snd_soc_platform *platform = snd_soc_component_to_platform(component); | ||
3516 | |||
3517 | platform->driver->remove(platform); | ||
3518 | } | ||
3519 | |||
3520 | static int snd_soc_platform_drv_pcm_new(struct snd_soc_component *component, | ||
3521 | struct snd_soc_pcm_runtime *rtd) | ||
3522 | { | ||
3523 | struct snd_soc_platform *platform = snd_soc_component_to_platform(component); | ||
3524 | |||
3525 | if (platform->driver->pcm_new) | ||
3526 | return platform->driver->pcm_new(rtd); | ||
3527 | |||
3528 | return 0; | ||
3529 | } | ||
3530 | |||
3531 | static void snd_soc_platform_drv_pcm_free(struct snd_soc_component *component, | ||
3532 | struct snd_pcm *pcm) | ||
3533 | { | ||
3534 | struct snd_soc_platform *platform = snd_soc_component_to_platform(component); | ||
3535 | |||
3536 | if (platform->driver->pcm_free) | ||
3537 | platform->driver->pcm_free(pcm); | ||
3538 | } | ||
3539 | |||
3540 | /** | ||
3541 | * snd_soc_add_platform - Add a platform to the ASoC core | ||
3542 | * @dev: The parent device for the platform | ||
3543 | * @platform: The platform to add | ||
3544 | * @platform_drv: The driver for the platform | ||
3545 | */ | ||
3546 | int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform, | ||
3547 | const struct snd_soc_platform_driver *platform_drv) | ||
3548 | { | ||
3549 | int ret; | ||
3550 | |||
3551 | ret = snd_soc_component_initialize(&platform->component, | ||
3552 | &platform_drv->component_driver, dev); | ||
3553 | if (ret) | ||
3554 | return ret; | ||
3555 | |||
3556 | platform->dev = dev; | ||
3557 | platform->driver = platform_drv; | ||
3558 | |||
3559 | if (platform_drv->probe) | ||
3560 | platform->component.probe = snd_soc_platform_drv_probe; | ||
3561 | if (platform_drv->remove) | ||
3562 | platform->component.remove = snd_soc_platform_drv_remove; | ||
3563 | if (platform_drv->pcm_new) | ||
3564 | platform->component.pcm_new = snd_soc_platform_drv_pcm_new; | ||
3565 | if (platform_drv->pcm_free) | ||
3566 | platform->component.pcm_free = snd_soc_platform_drv_pcm_free; | ||
3567 | |||
3568 | #ifdef CONFIG_DEBUG_FS | ||
3569 | platform->component.debugfs_prefix = "platform"; | ||
3570 | #endif | ||
3571 | |||
3572 | mutex_lock(&client_mutex); | ||
3573 | snd_soc_component_add_unlocked(&platform->component); | ||
3574 | list_add(&platform->list, &platform_list); | ||
3575 | mutex_unlock(&client_mutex); | ||
3576 | |||
3577 | dev_dbg(dev, "ASoC: Registered platform '%s'\n", | ||
3578 | platform->component.name); | ||
3579 | |||
3580 | return 0; | ||
3581 | } | ||
3582 | EXPORT_SYMBOL_GPL(snd_soc_add_platform); | ||
3583 | |||
3584 | /** | ||
3585 | * snd_soc_register_platform - Register a platform with the ASoC core | ||
3586 | * | ||
3587 | * @dev: The device for the platform | ||
3588 | * @platform_drv: The driver for the platform | ||
3589 | */ | ||
3590 | int snd_soc_register_platform(struct device *dev, | ||
3591 | const struct snd_soc_platform_driver *platform_drv) | ||
3592 | { | ||
3593 | struct snd_soc_platform *platform; | ||
3594 | int ret; | ||
3595 | |||
3596 | dev_dbg(dev, "ASoC: platform register %s\n", dev_name(dev)); | ||
3597 | |||
3598 | platform = kzalloc(sizeof(struct snd_soc_platform), GFP_KERNEL); | ||
3599 | if (platform == NULL) | ||
3600 | return -ENOMEM; | ||
3601 | |||
3602 | ret = snd_soc_add_platform(dev, platform, platform_drv); | ||
3603 | if (ret) | ||
3604 | kfree(platform); | ||
3605 | |||
3606 | return ret; | ||
3607 | } | ||
3608 | EXPORT_SYMBOL_GPL(snd_soc_register_platform); | ||
3609 | |||
3610 | /** | ||
3611 | * snd_soc_remove_platform - Remove a platform from the ASoC core | ||
3612 | * @platform: the platform to remove | ||
3613 | */ | ||
3614 | void snd_soc_remove_platform(struct snd_soc_platform *platform) | ||
3615 | { | ||
3616 | |||
3617 | mutex_lock(&client_mutex); | ||
3618 | list_del(&platform->list); | ||
3619 | snd_soc_component_del_unlocked(&platform->component); | ||
3620 | mutex_unlock(&client_mutex); | ||
3621 | |||
3622 | dev_dbg(platform->dev, "ASoC: Unregistered platform '%s'\n", | ||
3623 | platform->component.name); | ||
3624 | |||
3625 | snd_soc_component_cleanup(&platform->component); | ||
3626 | } | ||
3627 | EXPORT_SYMBOL_GPL(snd_soc_remove_platform); | ||
3628 | |||
3629 | struct snd_soc_platform *snd_soc_lookup_platform(struct device *dev) | ||
3630 | { | ||
3631 | struct snd_soc_platform *platform; | ||
3632 | |||
3633 | mutex_lock(&client_mutex); | ||
3634 | list_for_each_entry(platform, &platform_list, list) { | ||
3635 | if (dev == platform->dev) { | ||
3636 | mutex_unlock(&client_mutex); | ||
3637 | return platform; | ||
3638 | } | ||
3639 | } | ||
3640 | mutex_unlock(&client_mutex); | ||
3641 | |||
3642 | return NULL; | ||
3643 | } | ||
3644 | EXPORT_SYMBOL_GPL(snd_soc_lookup_platform); | ||
3645 | |||
3646 | /** | ||
3647 | * snd_soc_unregister_platform - Unregister a platform from the ASoC core | ||
3648 | * | ||
3649 | * @dev: platform to unregister | ||
3650 | */ | ||
3651 | void snd_soc_unregister_platform(struct device *dev) | ||
3652 | { | ||
3653 | struct snd_soc_platform *platform; | ||
3654 | |||
3655 | platform = snd_soc_lookup_platform(dev); | ||
3656 | if (!platform) | ||
3657 | return; | ||
3658 | |||
3659 | snd_soc_remove_platform(platform); | ||
3660 | kfree(platform); | ||
3661 | } | ||
3662 | EXPORT_SYMBOL_GPL(snd_soc_unregister_platform); | ||
3663 | |||
3664 | static int snd_soc_codec_drv_probe(struct snd_soc_component *component) | 3450 | static int snd_soc_codec_drv_probe(struct snd_soc_component *component) |
3665 | { | 3451 | { |
3666 | struct snd_soc_codec *codec = snd_soc_component_to_codec(component); | 3452 | struct snd_soc_codec *codec = snd_soc_component_to_codec(component); |
diff --git a/sound/soc/soc-devres.c b/sound/soc/soc-devres.c index a57921eeee81..7ac745df1412 100644 --- a/sound/soc/soc-devres.c +++ b/sound/soc/soc-devres.c | |||
@@ -52,41 +52,6 @@ int devm_snd_soc_register_component(struct device *dev, | |||
52 | } | 52 | } |
53 | EXPORT_SYMBOL_GPL(devm_snd_soc_register_component); | 53 | EXPORT_SYMBOL_GPL(devm_snd_soc_register_component); |
54 | 54 | ||
55 | static void devm_platform_release(struct device *dev, void *res) | ||
56 | { | ||
57 | snd_soc_unregister_platform(*(struct device **)res); | ||
58 | } | ||
59 | |||
60 | /** | ||
61 | * devm_snd_soc_register_platform - resource managed platform registration | ||
62 | * @dev: Device used to manage platform | ||
63 | * @platform_drv: platform to register | ||
64 | * | ||
65 | * Register a platform driver with automatic unregistration when the device is | ||
66 | * unregistered. | ||
67 | */ | ||
68 | int devm_snd_soc_register_platform(struct device *dev, | ||
69 | const struct snd_soc_platform_driver *platform_drv) | ||
70 | { | ||
71 | struct device **ptr; | ||
72 | int ret; | ||
73 | |||
74 | ptr = devres_alloc(devm_platform_release, sizeof(*ptr), GFP_KERNEL); | ||
75 | if (!ptr) | ||
76 | return -ENOMEM; | ||
77 | |||
78 | ret = snd_soc_register_platform(dev, platform_drv); | ||
79 | if (ret == 0) { | ||
80 | *ptr = dev; | ||
81 | devres_add(dev, ptr); | ||
82 | } else { | ||
83 | devres_free(ptr); | ||
84 | } | ||
85 | |||
86 | return ret; | ||
87 | } | ||
88 | EXPORT_SYMBOL_GPL(devm_snd_soc_register_platform); | ||
89 | |||
90 | static void devm_card_release(struct device *dev, void *res) | 55 | static void devm_card_release(struct device *dev, void *res) |
91 | { | 56 | { |
92 | snd_soc_unregister_card(*(struct snd_soc_card **)res); | 57 | snd_soc_unregister_card(*(struct snd_soc_card **)res); |
diff --git a/sound/soc/soc-io.c b/sound/soc/soc-io.c index d36a192fbece..c92a04bac3c5 100644 --- a/sound/soc/soc-io.c +++ b/sound/soc/soc-io.c | |||
@@ -267,24 +267,3 @@ int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned int reg, | |||
267 | return snd_soc_component_test_bits(&codec->component, reg, mask, value); | 267 | return snd_soc_component_test_bits(&codec->component, reg, mask, value); |
268 | } | 268 | } |
269 | EXPORT_SYMBOL_GPL(snd_soc_test_bits); | 269 | EXPORT_SYMBOL_GPL(snd_soc_test_bits); |
270 | |||
271 | int snd_soc_platform_read(struct snd_soc_platform *platform, | ||
272 | unsigned int reg) | ||
273 | { | ||
274 | unsigned int val; | ||
275 | int ret; | ||
276 | |||
277 | ret = snd_soc_component_read(&platform->component, reg, &val); | ||
278 | if (ret < 0) | ||
279 | return -1; | ||
280 | |||
281 | return val; | ||
282 | } | ||
283 | EXPORT_SYMBOL_GPL(snd_soc_platform_read); | ||
284 | |||
285 | int snd_soc_platform_write(struct snd_soc_platform *platform, | ||
286 | unsigned int reg, unsigned int val) | ||
287 | { | ||
288 | return snd_soc_component_write(&platform->component, reg, val); | ||
289 | } | ||
290 | EXPORT_SYMBOL_GPL(snd_soc_platform_write); | ||
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 68d9dc930096..da5a2dcb6520 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
@@ -456,13 +456,12 @@ static void soc_pcm_init_runtime_hw(struct snd_pcm_substream *substream) | |||
456 | /* | 456 | /* |
457 | * Called by ALSA when a PCM substream is opened, the runtime->hw record is | 457 | * Called by ALSA when a PCM substream is opened, the runtime->hw record is |
458 | * then initialized and any private data can be allocated. This also calls | 458 | * then initialized and any private data can be allocated. This also calls |
459 | * startup for the cpu DAI, platform, machine and codec DAI. | 459 | * startup for the cpu DAI, component, machine and codec DAI. |
460 | */ | 460 | */ |
461 | static int soc_pcm_open(struct snd_pcm_substream *substream) | 461 | static int soc_pcm_open(struct snd_pcm_substream *substream) |
462 | { | 462 | { |
463 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 463 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
464 | struct snd_pcm_runtime *runtime = substream->runtime; | 464 | struct snd_pcm_runtime *runtime = substream->runtime; |
465 | struct snd_soc_platform *platform = rtd->platform; | ||
466 | struct snd_soc_component *component; | 465 | struct snd_soc_component *component; |
467 | struct snd_soc_rtdcom_list *rtdcom; | 466 | struct snd_soc_rtdcom_list *rtdcom; |
468 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 467 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
@@ -492,23 +491,10 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) | |||
492 | } | 491 | } |
493 | } | 492 | } |
494 | 493 | ||
495 | if (platform && platform->driver->ops && platform->driver->ops->open) { | ||
496 | ret = platform->driver->ops->open(substream); | ||
497 | if (ret < 0) { | ||
498 | dev_err(platform->dev, "ASoC: can't open platform" | ||
499 | " %s: %d\n", platform->component.name, ret); | ||
500 | goto platform_err; | ||
501 | } | ||
502 | } | ||
503 | |||
504 | ret = 0; | 494 | ret = 0; |
505 | for_each_rtdcom(rtd, rtdcom) { | 495 | for_each_rtdcom(rtd, rtdcom) { |
506 | component = rtdcom->component; | 496 | component = rtdcom->component; |
507 | 497 | ||
508 | /* ignore duplication for now */ | ||
509 | if (platform && (component == &platform->component)) | ||
510 | continue; | ||
511 | |||
512 | if (!component->driver->ops || | 498 | if (!component->driver->ops || |
513 | !component->driver->ops->open) | 499 | !component->driver->ops->open) |
514 | continue; | 500 | continue; |
@@ -634,10 +620,6 @@ component_err: | |||
634 | for_each_rtdcom(rtd, rtdcom) { | 620 | for_each_rtdcom(rtd, rtdcom) { |
635 | component = rtdcom->component; | 621 | component = rtdcom->component; |
636 | 622 | ||
637 | /* ignore duplication for now */ | ||
638 | if (platform && (component == &platform->component)) | ||
639 | continue; | ||
640 | |||
641 | if (!component->driver->ops || | 623 | if (!component->driver->ops || |
642 | !component->driver->ops->close) | 624 | !component->driver->ops->close) |
643 | continue; | 625 | continue; |
@@ -645,10 +627,6 @@ component_err: | |||
645 | component->driver->ops->close(substream); | 627 | component->driver->ops->close(substream); |
646 | } | 628 | } |
647 | 629 | ||
648 | if (platform && platform->driver->ops && platform->driver->ops->close) | ||
649 | platform->driver->ops->close(substream); | ||
650 | |||
651 | platform_err: | ||
652 | if (cpu_dai->driver->ops->shutdown) | 630 | if (cpu_dai->driver->ops->shutdown) |
653 | cpu_dai->driver->ops->shutdown(substream, cpu_dai); | 631 | cpu_dai->driver->ops->shutdown(substream, cpu_dai); |
654 | out: | 632 | out: |
@@ -701,13 +679,12 @@ static void close_delayed_work(struct work_struct *work) | |||
701 | 679 | ||
702 | /* | 680 | /* |
703 | * Called by ALSA when a PCM substream is closed. Private data can be | 681 | * Called by ALSA when a PCM substream is closed. Private data can be |
704 | * freed here. The cpu DAI, codec DAI, machine and platform are also | 682 | * freed here. The cpu DAI, codec DAI, machine and components are also |
705 | * shutdown. | 683 | * shutdown. |
706 | */ | 684 | */ |
707 | static int soc_pcm_close(struct snd_pcm_substream *substream) | 685 | static int soc_pcm_close(struct snd_pcm_substream *substream) |
708 | { | 686 | { |
709 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 687 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
710 | struct snd_soc_platform *platform = rtd->platform; | ||
711 | struct snd_soc_component *component; | 688 | struct snd_soc_component *component; |
712 | struct snd_soc_rtdcom_list *rtdcom; | 689 | struct snd_soc_rtdcom_list *rtdcom; |
713 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 690 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
@@ -742,16 +719,9 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) | |||
742 | if (rtd->dai_link->ops->shutdown) | 719 | if (rtd->dai_link->ops->shutdown) |
743 | rtd->dai_link->ops->shutdown(substream); | 720 | rtd->dai_link->ops->shutdown(substream); |
744 | 721 | ||
745 | if (platform && platform->driver->ops && platform->driver->ops->close) | ||
746 | platform->driver->ops->close(substream); | ||
747 | |||
748 | for_each_rtdcom(rtd, rtdcom) { | 722 | for_each_rtdcom(rtd, rtdcom) { |
749 | component = rtdcom->component; | 723 | component = rtdcom->component; |
750 | 724 | ||
751 | /* ignore duplication for now */ | ||
752 | if (platform && (component == &platform->component)) | ||
753 | continue; | ||
754 | |||
755 | if (!component->driver->ops || | 725 | if (!component->driver->ops || |
756 | !component->driver->ops->close) | 726 | !component->driver->ops->close) |
757 | continue; | 727 | continue; |
@@ -805,7 +775,6 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) | |||
805 | static int soc_pcm_prepare(struct snd_pcm_substream *substream) | 775 | static int soc_pcm_prepare(struct snd_pcm_substream *substream) |
806 | { | 776 | { |
807 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 777 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
808 | struct snd_soc_platform *platform = rtd->platform; | ||
809 | struct snd_soc_component *component; | 778 | struct snd_soc_component *component; |
810 | struct snd_soc_rtdcom_list *rtdcom; | 779 | struct snd_soc_rtdcom_list *rtdcom; |
811 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 780 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
@@ -823,22 +792,9 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) | |||
823 | } | 792 | } |
824 | } | 793 | } |
825 | 794 | ||
826 | if (platform && platform->driver->ops && platform->driver->ops->prepare) { | ||
827 | ret = platform->driver->ops->prepare(substream); | ||
828 | if (ret < 0) { | ||
829 | dev_err(platform->dev, "ASoC: platform prepare error:" | ||
830 | " %d\n", ret); | ||
831 | goto out; | ||
832 | } | ||
833 | } | ||
834 | |||
835 | for_each_rtdcom(rtd, rtdcom) { | 795 | for_each_rtdcom(rtd, rtdcom) { |
836 | component = rtdcom->component; | 796 | component = rtdcom->component; |
837 | 797 | ||
838 | /* ignore duplication for now */ | ||
839 | if (platform && (component == &platform->component)) | ||
840 | continue; | ||
841 | |||
842 | if (!component->driver->ops || | 798 | if (!component->driver->ops || |
843 | !component->driver->ops->prepare) | 799 | !component->driver->ops->prepare) |
844 | continue; | 800 | continue; |
@@ -932,7 +888,6 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, | |||
932 | struct snd_pcm_hw_params *params) | 888 | struct snd_pcm_hw_params *params) |
933 | { | 889 | { |
934 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 890 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
935 | struct snd_soc_platform *platform = rtd->platform; | ||
936 | struct snd_soc_component *component; | 891 | struct snd_soc_component *component; |
937 | struct snd_soc_rtdcom_list *rtdcom; | 892 | struct snd_soc_rtdcom_list *rtdcom; |
938 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 893 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
@@ -994,23 +949,10 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, | |||
994 | if (ret < 0) | 949 | if (ret < 0) |
995 | goto interface_err; | 950 | goto interface_err; |
996 | 951 | ||
997 | if (platform && platform->driver->ops && platform->driver->ops->hw_params) { | ||
998 | ret = platform->driver->ops->hw_params(substream, params); | ||
999 | if (ret < 0) { | ||
1000 | dev_err(platform->dev, "ASoC: %s hw params failed: %d\n", | ||
1001 | platform->component.name, ret); | ||
1002 | goto platform_err; | ||
1003 | } | ||
1004 | } | ||
1005 | |||
1006 | ret = 0; | 952 | ret = 0; |
1007 | for_each_rtdcom(rtd, rtdcom) { | 953 | for_each_rtdcom(rtd, rtdcom) { |
1008 | component = rtdcom->component; | 954 | component = rtdcom->component; |
1009 | 955 | ||
1010 | /* ignore duplication for now */ | ||
1011 | if (platform && (component == &platform->component)) | ||
1012 | continue; | ||
1013 | |||
1014 | if (!component->driver->ops || | 956 | if (!component->driver->ops || |
1015 | !component->driver->ops->hw_params) | 957 | !component->driver->ops->hw_params) |
1016 | continue; | 958 | continue; |
@@ -1043,10 +985,6 @@ component_err: | |||
1043 | for_each_rtdcom(rtd, rtdcom) { | 985 | for_each_rtdcom(rtd, rtdcom) { |
1044 | component = rtdcom->component; | 986 | component = rtdcom->component; |
1045 | 987 | ||
1046 | /* ignore duplication */ | ||
1047 | if (platform && (component == &platform->component)) | ||
1048 | continue; | ||
1049 | |||
1050 | if (!component->driver->ops || | 988 | if (!component->driver->ops || |
1051 | !component->driver->ops->hw_free) | 989 | !component->driver->ops->hw_free) |
1052 | continue; | 990 | continue; |
@@ -1054,10 +992,6 @@ component_err: | |||
1054 | component->driver->ops->hw_free(substream); | 992 | component->driver->ops->hw_free(substream); |
1055 | } | 993 | } |
1056 | 994 | ||
1057 | if (platform && platform->driver->ops && platform->driver->ops->hw_free) | ||
1058 | platform->driver->ops->hw_free(substream); | ||
1059 | |||
1060 | platform_err: | ||
1061 | if (cpu_dai->driver->ops->hw_free) | 995 | if (cpu_dai->driver->ops->hw_free) |
1062 | cpu_dai->driver->ops->hw_free(substream, cpu_dai); | 996 | cpu_dai->driver->ops->hw_free(substream, cpu_dai); |
1063 | 997 | ||
@@ -1085,7 +1019,6 @@ codec_err: | |||
1085 | static int soc_pcm_hw_free(struct snd_pcm_substream *substream) | 1019 | static int soc_pcm_hw_free(struct snd_pcm_substream *substream) |
1086 | { | 1020 | { |
1087 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 1021 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
1088 | struct snd_soc_platform *platform = rtd->platform; | ||
1089 | struct snd_soc_component *component; | 1022 | struct snd_soc_component *component; |
1090 | struct snd_soc_rtdcom_list *rtdcom; | 1023 | struct snd_soc_rtdcom_list *rtdcom; |
1091 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 1024 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
@@ -1123,18 +1056,10 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream) | |||
1123 | if (rtd->dai_link->ops->hw_free) | 1056 | if (rtd->dai_link->ops->hw_free) |
1124 | rtd->dai_link->ops->hw_free(substream); | 1057 | rtd->dai_link->ops->hw_free(substream); |
1125 | 1058 | ||
1126 | /* free any DMA resources */ | ||
1127 | if (platform && platform->driver->ops && platform->driver->ops->hw_free) | ||
1128 | platform->driver->ops->hw_free(substream); | ||
1129 | |||
1130 | /* free any component resources */ | 1059 | /* free any component resources */ |
1131 | for_each_rtdcom(rtd, rtdcom) { | 1060 | for_each_rtdcom(rtd, rtdcom) { |
1132 | component = rtdcom->component; | 1061 | component = rtdcom->component; |
1133 | 1062 | ||
1134 | /* ignore duplication for now */ | ||
1135 | if (platform && (component == &platform->component)) | ||
1136 | continue; | ||
1137 | |||
1138 | if (!component->driver->ops || | 1063 | if (!component->driver->ops || |
1139 | !component->driver->ops->hw_free) | 1064 | !component->driver->ops->hw_free) |
1140 | continue; | 1065 | continue; |
@@ -1159,7 +1084,6 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream) | |||
1159 | static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | 1084 | static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) |
1160 | { | 1085 | { |
1161 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 1086 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
1162 | struct snd_soc_platform *platform = rtd->platform; | ||
1163 | struct snd_soc_component *component; | 1087 | struct snd_soc_component *component; |
1164 | struct snd_soc_rtdcom_list *rtdcom; | 1088 | struct snd_soc_rtdcom_list *rtdcom; |
1165 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 1089 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
@@ -1176,19 +1100,9 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
1176 | } | 1100 | } |
1177 | } | 1101 | } |
1178 | 1102 | ||
1179 | if (platform && platform->driver->ops && platform->driver->ops->trigger) { | ||
1180 | ret = platform->driver->ops->trigger(substream, cmd); | ||
1181 | if (ret < 0) | ||
1182 | return ret; | ||
1183 | } | ||
1184 | |||
1185 | for_each_rtdcom(rtd, rtdcom) { | 1103 | for_each_rtdcom(rtd, rtdcom) { |
1186 | component = rtdcom->component; | 1104 | component = rtdcom->component; |
1187 | 1105 | ||
1188 | /* ignore duplication for now */ | ||
1189 | if (platform && (component == &platform->component)) | ||
1190 | continue; | ||
1191 | |||
1192 | if (!component->driver->ops || | 1106 | if (!component->driver->ops || |
1193 | !component->driver->ops->trigger) | 1107 | !component->driver->ops->trigger) |
1194 | continue; | 1108 | continue; |
@@ -1240,13 +1154,12 @@ static int soc_pcm_bespoke_trigger(struct snd_pcm_substream *substream, | |||
1240 | } | 1154 | } |
1241 | /* | 1155 | /* |
1242 | * soc level wrapper for pointer callback | 1156 | * soc level wrapper for pointer callback |
1243 | * If cpu_dai, codec_dai, platform driver has the delay callback, than | 1157 | * If cpu_dai, codec_dai, component driver has the delay callback, then |
1244 | * the runtime->delay will be updated accordingly. | 1158 | * the runtime->delay will be updated accordingly. |
1245 | */ | 1159 | */ |
1246 | static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream) | 1160 | static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream) |
1247 | { | 1161 | { |
1248 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 1162 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
1249 | struct snd_soc_platform *platform = rtd->platform; | ||
1250 | struct snd_soc_component *component; | 1163 | struct snd_soc_component *component; |
1251 | struct snd_soc_rtdcom_list *rtdcom; | 1164 | struct snd_soc_rtdcom_list *rtdcom; |
1252 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 1165 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
@@ -1257,16 +1170,9 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream) | |||
1257 | snd_pcm_sframes_t codec_delay = 0; | 1170 | snd_pcm_sframes_t codec_delay = 0; |
1258 | int i; | 1171 | int i; |
1259 | 1172 | ||
1260 | if (platform && platform->driver->ops && platform->driver->ops->pointer) | ||
1261 | offset = platform->driver->ops->pointer(substream); | ||
1262 | |||
1263 | for_each_rtdcom(rtd, rtdcom) { | 1173 | for_each_rtdcom(rtd, rtdcom) { |
1264 | component = rtdcom->component; | 1174 | component = rtdcom->component; |
1265 | 1175 | ||
1266 | /* ignore duplication for now */ | ||
1267 | if (platform && (component == &platform->component)) | ||
1268 | continue; | ||
1269 | |||
1270 | if (!component->driver->ops || | 1176 | if (!component->driver->ops || |
1271 | !component->driver->ops->pointer) | 1177 | !component->driver->ops->pointer) |
1272 | continue; | 1178 | continue; |
@@ -2470,20 +2376,12 @@ static int soc_pcm_ioctl(struct snd_pcm_substream *substream, | |||
2470 | unsigned int cmd, void *arg) | 2376 | unsigned int cmd, void *arg) |
2471 | { | 2377 | { |
2472 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 2378 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
2473 | struct snd_soc_platform *platform = rtd->platform; | ||
2474 | struct snd_soc_component *component; | 2379 | struct snd_soc_component *component; |
2475 | struct snd_soc_rtdcom_list *rtdcom; | 2380 | struct snd_soc_rtdcom_list *rtdcom; |
2476 | 2381 | ||
2477 | if (platform && platform->driver->ops && platform->driver->ops->ioctl) | ||
2478 | return platform->driver->ops->ioctl(substream, cmd, arg); | ||
2479 | |||
2480 | for_each_rtdcom(rtd, rtdcom) { | 2382 | for_each_rtdcom(rtd, rtdcom) { |
2481 | component = rtdcom->component; | 2383 | component = rtdcom->component; |
2482 | 2384 | ||
2483 | /* ignore duplication for now */ | ||
2484 | if (platform && (component == &platform->component)) | ||
2485 | continue; | ||
2486 | |||
2487 | if (!component->driver->ops || | 2385 | if (!component->driver->ops || |
2488 | !component->driver->ops->ioctl) | 2386 | !component->driver->ops->ioctl) |
2489 | continue; | 2387 | continue; |
@@ -2987,7 +2885,6 @@ static int soc_rtdcom_mmap(struct snd_pcm_substream *substream, | |||
2987 | /* create a new pcm */ | 2885 | /* create a new pcm */ |
2988 | int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) | 2886 | int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) |
2989 | { | 2887 | { |
2990 | struct snd_soc_platform *platform = rtd->platform; | ||
2991 | struct snd_soc_dai *codec_dai; | 2888 | struct snd_soc_dai *codec_dai; |
2992 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 2889 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
2993 | struct snd_soc_component *component; | 2890 | struct snd_soc_component *component; |
@@ -3106,16 +3003,6 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) | |||
3106 | rtd->ops.mmap = soc_rtdcom_mmap; | 3003 | rtd->ops.mmap = soc_rtdcom_mmap; |
3107 | } | 3004 | } |
3108 | 3005 | ||
3109 | /* overwrite */ | ||
3110 | if (platform && platform->driver->ops) { | ||
3111 | rtd->ops.ack = platform->driver->ops->ack; | ||
3112 | rtd->ops.copy_user = platform->driver->ops->copy_user; | ||
3113 | rtd->ops.copy_kernel = platform->driver->ops->copy_kernel; | ||
3114 | rtd->ops.fill_silence = platform->driver->ops->fill_silence; | ||
3115 | rtd->ops.page = platform->driver->ops->page; | ||
3116 | rtd->ops.mmap = platform->driver->ops->mmap; | ||
3117 | } | ||
3118 | |||
3119 | if (playback) | 3006 | if (playback) |
3120 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &rtd->ops); | 3007 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &rtd->ops); |
3121 | 3008 | ||