diff options
-rw-r--r-- | include/sound/soc.h | 6 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 12 |
2 files changed, 16 insertions, 2 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index 9c2a6dd170f1..6f197589b6d7 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -562,6 +562,12 @@ struct snd_soc_codec_driver { | |||
562 | pm_message_t state); | 562 | pm_message_t state); |
563 | int (*resume)(struct snd_soc_codec *); | 563 | int (*resume)(struct snd_soc_codec *); |
564 | 564 | ||
565 | /* Default DAPM setup, added after probe() is run */ | ||
566 | const struct snd_soc_dapm_widget *dapm_widgets; | ||
567 | int num_dapm_widgets; | ||
568 | const struct snd_soc_dapm_route *dapm_routes; | ||
569 | int num_dapm_routes; | ||
570 | |||
565 | /* codec IO */ | 571 | /* codec IO */ |
566 | unsigned int (*read)(struct snd_soc_codec *, unsigned int); | 572 | unsigned int (*read)(struct snd_soc_codec *, unsigned int); |
567 | int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); | 573 | int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index be34f6b95386..c12f2bd23a4e 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1464,6 +1464,7 @@ static int soc_probe_codec(struct snd_soc_card *card, | |||
1464 | struct snd_soc_codec *codec) | 1464 | struct snd_soc_codec *codec) |
1465 | { | 1465 | { |
1466 | int ret = 0; | 1466 | int ret = 0; |
1467 | const struct snd_soc_codec_driver *driver = codec->driver; | ||
1467 | 1468 | ||
1468 | codec->card = card; | 1469 | codec->card = card; |
1469 | codec->dapm.card = card; | 1470 | codec->dapm.card = card; |
@@ -1472,8 +1473,8 @@ static int soc_probe_codec(struct snd_soc_card *card, | |||
1472 | if (!try_module_get(codec->dev->driver->owner)) | 1473 | if (!try_module_get(codec->dev->driver->owner)) |
1473 | return -ENODEV; | 1474 | return -ENODEV; |
1474 | 1475 | ||
1475 | if (codec->driver->probe) { | 1476 | if (driver->probe) { |
1476 | ret = codec->driver->probe(codec); | 1477 | ret = driver->probe(codec); |
1477 | if (ret < 0) { | 1478 | if (ret < 0) { |
1478 | dev_err(codec->dev, | 1479 | dev_err(codec->dev, |
1479 | "asoc: failed to probe CODEC %s: %d\n", | 1480 | "asoc: failed to probe CODEC %s: %d\n", |
@@ -1482,6 +1483,13 @@ static int soc_probe_codec(struct snd_soc_card *card, | |||
1482 | } | 1483 | } |
1483 | } | 1484 | } |
1484 | 1485 | ||
1486 | if (driver->dapm_widgets) | ||
1487 | snd_soc_dapm_new_controls(&codec->dapm, driver->dapm_widgets, | ||
1488 | driver->num_dapm_widgets); | ||
1489 | if (driver->dapm_routes) | ||
1490 | snd_soc_dapm_add_routes(&codec->dapm, driver->dapm_routes, | ||
1491 | driver->num_dapm_routes); | ||
1492 | |||
1485 | soc_init_codec_debugfs(codec); | 1493 | soc_init_codec_debugfs(codec); |
1486 | 1494 | ||
1487 | /* mark codec as probed and add to card codec list */ | 1495 | /* mark codec as probed and add to card codec list */ |