aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-07-17 16:01:07 -0400
committerMark Brown <broonie@linaro.org>2014-07-22 18:15:57 -0400
commit00200107a296cad3a950049a5ad7134a0d962b8d (patch)
tree73ccc523f1a46f0f8b7deab226a1df0cf6d057ed
parent093c4e5c3cc6dd320f6cfec54c5490d1567fb05c (diff)
ASoC: Move card field form platform/codec to component
Both the snd_soc_codec and snd_soc_platform struct do have a pointer to the parent card and both handle this pointer in mostly the same way. This patch moves the card field to the component level which will allow further code consolidation between platforms and CODECS. Since there are only a handful of users of the snd_soc_codec struct's card field (and none of the snd_soc_platform's) these are update in this patch as well, which allows it to be removed from the snd_soc_codec struct. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--include/sound/soc.h3
-rw-r--r--sound/soc/codecs/ac97.c4
-rw-r--r--sound/soc/codecs/cx20442.c6
-rw-r--r--sound/soc/codecs/uda134x.c2
-rw-r--r--sound/soc/codecs/wm8960.c2
-rw-r--r--sound/soc/codecs/wm_adsp.c4
-rw-r--r--sound/soc/omap/ams-delta.c2
-rw-r--r--sound/soc/soc-core.c19
-rw-r--r--sound/soc/soc-dapm.c2
-rw-r--r--sound/soc/soc-jack.c4
10 files changed, 24 insertions, 24 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 1f5b4901415e..5ee6ddde4831 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -691,6 +691,7 @@ struct snd_soc_component {
691 int id; 691 int id;
692 const char *name_prefix; 692 const char *name_prefix;
693 struct device *dev; 693 struct device *dev;
694 struct snd_soc_card *card;
694 695
695 unsigned int active; 696 unsigned int active;
696 697
@@ -725,7 +726,6 @@ struct snd_soc_codec {
725 const struct snd_soc_codec_driver *driver; 726 const struct snd_soc_codec_driver *driver;
726 727
727 struct mutex mutex; 728 struct mutex mutex;
728 struct snd_soc_card *card;
729 struct list_head list; 729 struct list_head list;
730 struct list_head card_list; 730 struct list_head card_list;
731 731
@@ -863,7 +863,6 @@ struct snd_soc_platform {
863 unsigned int suspended:1; /* platform is suspended */ 863 unsigned int suspended:1; /* platform is suspended */
864 unsigned int probed:1; 864 unsigned int probed:1;
865 865
866 struct snd_soc_card *card;
867 struct list_head list; 866 struct list_head list;
868 867
869 struct snd_soc_component component; 868 struct snd_soc_component component;
diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c
index 8d9ba4ba4bfe..e889e1b84192 100644
--- a/sound/soc/codecs/ac97.c
+++ b/sound/soc/codecs/ac97.c
@@ -89,8 +89,8 @@ static int ac97_soc_probe(struct snd_soc_codec *codec)
89 int ret; 89 int ret;
90 90
91 /* add codec as bus device for standard ac97 */ 91 /* add codec as bus device for standard ac97 */
92 ret = snd_ac97_bus(codec->card->snd_card, 0, soc_ac97_ops, NULL, 92 ret = snd_ac97_bus(codec->component.card->snd_card, 0, soc_ac97_ops,
93 &ac97_bus); 93 NULL, &ac97_bus);
94 if (ret < 0) 94 if (ret < 0)
95 return ret; 95 return ret;
96 96
diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c
index d5fd00a64748..4ba60eb2cde1 100644
--- a/sound/soc/codecs/cx20442.c
+++ b/sound/soc/codecs/cx20442.c
@@ -253,7 +253,7 @@ static void v253_close(struct tty_struct *tty)
253 /* Prevent the codec driver from further accessing the modem */ 253 /* Prevent the codec driver from further accessing the modem */
254 codec->hw_write = NULL; 254 codec->hw_write = NULL;
255 cx20442->control_data = NULL; 255 cx20442->control_data = NULL;
256 codec->card->pop_time = 0; 256 codec->component.card->pop_time = 0;
257} 257}
258 258
259/* Line discipline .hangup() */ 259/* Line discipline .hangup() */
@@ -281,7 +281,7 @@ static void v253_receive(struct tty_struct *tty,
281 /* Set up codec driver access to modem controls */ 281 /* Set up codec driver access to modem controls */
282 cx20442->control_data = tty; 282 cx20442->control_data = tty;
283 codec->hw_write = (hw_write_t)tty->ops->write; 283 codec->hw_write = (hw_write_t)tty->ops->write;
284 codec->card->pop_time = 1; 284 codec->component.card->pop_time = 1;
285 } 285 }
286} 286}
287 287
@@ -372,7 +372,7 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec)
372 372
373 snd_soc_codec_set_drvdata(codec, cx20442); 373 snd_soc_codec_set_drvdata(codec, cx20442);
374 codec->hw_write = NULL; 374 codec->hw_write = NULL;
375 codec->card->pop_time = 0; 375 codec->component.card->pop_time = 0;
376 376
377 return 0; 377 return 0;
378} 378}
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c
index edf27acc1d77..12fc0aed7503 100644
--- a/sound/soc/codecs/uda134x.c
+++ b/sound/soc/codecs/uda134x.c
@@ -479,7 +479,7 @@ static struct snd_soc_dai_driver uda134x_dai = {
479static int uda134x_soc_probe(struct snd_soc_codec *codec) 479static int uda134x_soc_probe(struct snd_soc_codec *codec)
480{ 480{
481 struct uda134x_priv *uda134x; 481 struct uda134x_priv *uda134x;
482 struct uda134x_platform_data *pd = codec->card->dev->platform_data; 482 struct uda134x_platform_data *pd = codec->component.card->dev->platform_data;
483 const struct snd_soc_dapm_widget *widgets; 483 const struct snd_soc_dapm_widget *widgets;
484 unsigned num_widgets; 484 unsigned num_widgets;
485 485
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index a145d0431b63..e96349b04ba6 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -472,7 +472,7 @@ static int wm8960_add_widgets(struct snd_soc_codec *codec)
472 * list each time to find the desired power state do so now 472 * list each time to find the desired power state do so now
473 * and save the result. 473 * and save the result.
474 */ 474 */
475 list_for_each_entry(w, &codec->card->widgets, list) { 475 list_for_each_entry(w, &codec->component.card->widgets, list) {
476 if (w->dapm != &codec->dapm) 476 if (w->dapm != &codec->dapm)
477 continue; 477 continue;
478 if (strcmp(w->name, "LOUT1 PGA") == 0) 478 if (strcmp(w->name, "LOUT1 PGA") == 0)
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 060027182dcb..fb86f072fa67 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -1382,7 +1382,7 @@ int wm_adsp1_event(struct snd_soc_dapm_widget *w,
1382 int ret; 1382 int ret;
1383 int val; 1383 int val;
1384 1384
1385 dsp->card = codec->card; 1385 dsp->card = codec->component.card;
1386 1386
1387 switch (event) { 1387 switch (event) {
1388 case SND_SOC_DAPM_POST_PMU: 1388 case SND_SOC_DAPM_POST_PMU:
@@ -1617,7 +1617,7 @@ int wm_adsp2_early_event(struct snd_soc_dapm_widget *w,
1617 struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec); 1617 struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec);
1618 struct wm_adsp *dsp = &dsps[w->shift]; 1618 struct wm_adsp *dsp = &dsps[w->shift];
1619 1619
1620 dsp->card = codec->card; 1620 dsp->card = codec->component.card;
1621 1621
1622 switch (event) { 1622 switch (event) {
1623 case SND_SOC_DAPM_PRE_PMU: 1623 case SND_SOC_DAPM_PRE_PMU:
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index 0cc41f94de4e..8c9cc64a9dfb 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -301,7 +301,7 @@ static int cx81801_open(struct tty_struct *tty)
301static void cx81801_close(struct tty_struct *tty) 301static void cx81801_close(struct tty_struct *tty)
302{ 302{
303 struct snd_soc_codec *codec = tty->disc_data; 303 struct snd_soc_codec *codec = tty->disc_data;
304 struct snd_soc_dapm_context *dapm = &codec->card->dapm; 304 struct snd_soc_dapm_context *dapm = &codec->component.card->dapm;
305 305
306 del_timer_sync(&cx81801_timer); 306 del_timer_sync(&cx81801_timer);
307 307
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index a5edb31ddfff..a0ae3d2263d1 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -292,7 +292,7 @@ static struct dentry *soc_debugfs_create_dir(struct dentry *parent,
292 292
293static void soc_init_codec_debugfs(struct snd_soc_codec *codec) 293static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
294{ 294{
295 struct dentry *debugfs_card_root = codec->card->debugfs_card_root; 295 struct dentry *debugfs_card_root = codec->component.card->debugfs_card_root;
296 296
297 codec->debugfs_codec_root = soc_debugfs_create_dir(debugfs_card_root, 297 codec->debugfs_codec_root = soc_debugfs_create_dir(debugfs_card_root,
298 "codec:%s", 298 "codec:%s",
@@ -325,7 +325,7 @@ static void soc_cleanup_codec_debugfs(struct snd_soc_codec *codec)
325 325
326static void soc_init_platform_debugfs(struct snd_soc_platform *platform) 326static void soc_init_platform_debugfs(struct snd_soc_platform *platform)
327{ 327{
328 struct dentry *debugfs_card_root = platform->card->debugfs_card_root; 328 struct dentry *debugfs_card_root = platform->component.card->debugfs_card_root;
329 329
330 platform->debugfs_platform_root = soc_debugfs_create_dir(debugfs_card_root, 330 platform->debugfs_platform_root = soc_debugfs_create_dir(debugfs_card_root,
331 "platform:%s", 331 "platform:%s",
@@ -546,11 +546,12 @@ static int soc_ac97_dev_register(struct snd_soc_codec *codec)
546 int err; 546 int err;
547 547
548 codec->ac97->dev.bus = &ac97_bus_type; 548 codec->ac97->dev.bus = &ac97_bus_type;
549 codec->ac97->dev.parent = codec->card->dev; 549 codec->ac97->dev.parent = codec->component.card->dev;
550 codec->ac97->dev.release = soc_ac97_device_release; 550 codec->ac97->dev.release = soc_ac97_device_release;
551 551
552 dev_set_name(&codec->ac97->dev, "%d-%d:%s", 552 dev_set_name(&codec->ac97->dev, "%d-%d:%s",
553 codec->card->snd_card->number, 0, codec->component.name); 553 codec->component.card->snd_card->number, 0,
554 codec->component.name);
554 err = device_register(&codec->ac97->dev); 555 err = device_register(&codec->ac97->dev);
555 if (err < 0) { 556 if (err < 0) {
556 dev_err(codec->dev, "ASoC: Can't register ac97 bus\n"); 557 dev_err(codec->dev, "ASoC: Can't register ac97 bus\n");
@@ -1179,7 +1180,7 @@ static int soc_probe_codec(struct snd_soc_card *card,
1179 const struct snd_soc_codec_driver *driver = codec->driver; 1180 const struct snd_soc_codec_driver *driver = codec->driver;
1180 struct snd_soc_dai *dai; 1181 struct snd_soc_dai *dai;
1181 1182
1182 codec->card = card; 1183 codec->component.card = card;
1183 codec->dapm.card = card; 1184 codec->dapm.card = card;
1184 soc_set_name_prefix(card, &codec->component); 1185 soc_set_name_prefix(card, &codec->component);
1185 1186
@@ -1255,7 +1256,7 @@ static int soc_probe_platform(struct snd_soc_card *card,
1255 struct snd_soc_component *component; 1256 struct snd_soc_component *component;
1256 struct snd_soc_dai *dai; 1257 struct snd_soc_dai *dai;
1257 1258
1258 platform->card = card; 1259 platform->component.card = card;
1259 platform->component.dapm.card = card; 1260 platform->component.dapm.card = card;
1260 1261
1261 if (!try_module_get(platform->dev->driver->owner)) 1262 if (!try_module_get(platform->dev->driver->owner))
@@ -2406,7 +2407,7 @@ EXPORT_SYMBOL_GPL(snd_soc_card_get_kcontrol);
2406int snd_soc_add_codec_controls(struct snd_soc_codec *codec, 2407int snd_soc_add_codec_controls(struct snd_soc_codec *codec,
2407 const struct snd_kcontrol_new *controls, int num_controls) 2408 const struct snd_kcontrol_new *controls, int num_controls)
2408{ 2409{
2409 struct snd_card *card = codec->card->snd_card; 2410 struct snd_card *card = codec->component.card->snd_card;
2410 2411
2411 return snd_soc_add_controls(card, codec->dev, controls, num_controls, 2412 return snd_soc_add_controls(card, codec->dev, controls, num_controls,
2412 codec->component.name_prefix, &codec->component); 2413 codec->component.name_prefix, &codec->component);
@@ -2426,7 +2427,7 @@ EXPORT_SYMBOL_GPL(snd_soc_add_codec_controls);
2426int snd_soc_add_platform_controls(struct snd_soc_platform *platform, 2427int snd_soc_add_platform_controls(struct snd_soc_platform *platform,
2427 const struct snd_kcontrol_new *controls, int num_controls) 2428 const struct snd_kcontrol_new *controls, int num_controls)
2428{ 2429{
2429 struct snd_card *card = platform->card->snd_card; 2430 struct snd_card *card = platform->component.card->snd_card;
2430 2431
2431 return snd_soc_add_controls(card, platform->dev, controls, num_controls, 2432 return snd_soc_add_controls(card, platform->dev, controls, num_controls,
2432 NULL, &platform->component); 2433 NULL, &platform->component);
@@ -3101,7 +3102,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_range);
3101int snd_soc_limit_volume(struct snd_soc_codec *codec, 3102int snd_soc_limit_volume(struct snd_soc_codec *codec,
3102 const char *name, int max) 3103 const char *name, int max)
3103{ 3104{
3104 struct snd_card *card = codec->card->snd_card; 3105 struct snd_card *card = codec->component.card->snd_card;
3105 struct snd_kcontrol *kctl; 3106 struct snd_kcontrol *kctl;
3106 struct soc_mixer_control *mc; 3107 struct soc_mixer_control *mc;
3107 int found = 0; 3108 int found = 0;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 8cb68a38ad19..8348352dc2c6 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2090,7 +2090,7 @@ static ssize_t dapm_widget_show_codec(struct snd_soc_codec *codec, char *buf)
2090 int count = 0; 2090 int count = 0;
2091 char *state = "not set"; 2091 char *state = "not set";
2092 2092
2093 list_for_each_entry(w, &codec->card->widgets, list) { 2093 list_for_each_entry(w, &codec->component.card->widgets, list) {
2094 if (w->dapm != &codec->dapm) 2094 if (w->dapm != &codec->dapm)
2095 continue; 2095 continue;
2096 2096
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
index d0d98810af91..ab47fea997a3 100644
--- a/sound/soc/soc-jack.c
+++ b/sound/soc/soc-jack.c
@@ -43,7 +43,7 @@ int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type,
43 INIT_LIST_HEAD(&jack->jack_zones); 43 INIT_LIST_HEAD(&jack->jack_zones);
44 BLOCKING_INIT_NOTIFIER_HEAD(&jack->notifier); 44 BLOCKING_INIT_NOTIFIER_HEAD(&jack->notifier);
45 45
46 return snd_jack_new(codec->card->snd_card, id, type, &jack->jack); 46 return snd_jack_new(codec->component.card->snd_card, id, type, &jack->jack);
47} 47}
48EXPORT_SYMBOL_GPL(snd_soc_jack_new); 48EXPORT_SYMBOL_GPL(snd_soc_jack_new);
49 49
@@ -260,7 +260,7 @@ static void snd_soc_jack_gpio_detect(struct snd_soc_jack_gpio *gpio)
260static irqreturn_t gpio_handler(int irq, void *data) 260static irqreturn_t gpio_handler(int irq, void *data)
261{ 261{
262 struct snd_soc_jack_gpio *gpio = data; 262 struct snd_soc_jack_gpio *gpio = data;
263 struct device *dev = gpio->jack->codec->card->dev; 263 struct device *dev = gpio->jack->codec->component.card->dev;
264 264
265 trace_snd_soc_jack_irq(gpio->name); 265 trace_snd_soc_jack_irq(gpio->name);
266 266