Commit 6106d129 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Mark Brown

ASoC: Add component pointer to the DAI struct

Keep track of which component registered a DAI. We'll need this as
componentization progresses.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 5c898e74
...@@ -270,6 +270,7 @@ struct snd_soc_dai { ...@@ -270,6 +270,7 @@ struct snd_soc_dai {
/* parent platform/codec */ /* parent platform/codec */
struct snd_soc_platform *platform; struct snd_soc_platform *platform;
struct snd_soc_codec *codec; struct snd_soc_codec *codec;
struct snd_soc_component *component;
struct snd_soc_card *card; struct snd_soc_card *card;
......
...@@ -3884,11 +3884,13 @@ static inline char *fmt_multiple_name(struct device *dev, ...@@ -3884,11 +3884,13 @@ static inline char *fmt_multiple_name(struct device *dev,
/** /**
* snd_soc_register_dai - Register a DAI with the ASoC core * snd_soc_register_dai - Register a DAI with the ASoC core
* *
* @dai: DAI to register * @component: The component the DAIs are registered for
* @dai_drv: DAI driver to use for the DAIs
*/ */
static int snd_soc_register_dai(struct device *dev, static int snd_soc_register_dai(struct snd_soc_component *component,
struct snd_soc_dai_driver *dai_drv) struct snd_soc_dai_driver *dai_drv)
{ {
struct device *dev = component->dev;
struct snd_soc_codec *codec; struct snd_soc_codec *codec;
struct snd_soc_dai *dai; struct snd_soc_dai *dai;
...@@ -3905,6 +3907,7 @@ static int snd_soc_register_dai(struct device *dev, ...@@ -3905,6 +3907,7 @@ static int snd_soc_register_dai(struct device *dev,
return -ENOMEM; return -ENOMEM;
} }
dai->component = component;
dai->dev = dev; dai->dev = dev;
dai->driver = dai_drv; dai->driver = dai_drv;
dai->dapm.dev = dev; dai->dapm.dev = dev;
...@@ -3962,12 +3965,14 @@ static void snd_soc_unregister_dai(struct device *dev) ...@@ -3962,12 +3965,14 @@ static void snd_soc_unregister_dai(struct device *dev)
/** /**
* snd_soc_register_dais - Register multiple DAIs with the ASoC core * snd_soc_register_dais - Register multiple DAIs with the ASoC core
* *
* @dai: Array of DAIs to register * @component: The component the DAIs are registered for
* @dai_drv: DAI driver to use for the DAIs
* @count: Number of DAIs * @count: Number of DAIs
*/ */
static int snd_soc_register_dais(struct device *dev, static int snd_soc_register_dais(struct snd_soc_component *component,
struct snd_soc_dai_driver *dai_drv, size_t count) struct snd_soc_dai_driver *dai_drv, size_t count)
{ {
struct device *dev = component->dev;
struct snd_soc_codec *codec; struct snd_soc_codec *codec;
struct snd_soc_dai *dai; struct snd_soc_dai *dai;
int i, ret = 0; int i, ret = 0;
...@@ -3990,6 +3995,7 @@ static int snd_soc_register_dais(struct device *dev, ...@@ -3990,6 +3995,7 @@ static int snd_soc_register_dais(struct device *dev,
goto err; goto err;
} }
dai->component = component;
dai->dev = dev; dai->dev = dev;
dai->driver = &dai_drv[i]; dai->driver = &dai_drv[i];
if (dai->driver->id) if (dai->driver->id)
...@@ -4086,9 +4092,9 @@ __snd_soc_register_component(struct device *dev, ...@@ -4086,9 +4092,9 @@ __snd_soc_register_component(struct device *dev,
* since it had been used snd_soc_register_dais(), * since it had been used snd_soc_register_dais(),
*/ */
if ((1 == num_dai) && allow_single_dai) if ((1 == num_dai) && allow_single_dai)
ret = snd_soc_register_dai(dev, dai_drv); ret = snd_soc_register_dai(cmpnt, dai_drv);
else else
ret = snd_soc_register_dais(dev, dai_drv, num_dai); ret = snd_soc_register_dais(cmpnt, dai_drv, num_dai);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "ASoC: Failed to regster DAIs: %d\n", ret); dev_err(dev, "ASoC: Failed to regster DAIs: %d\n", ret);
goto error_component_name; goto error_component_name;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment