struct snd_soc_component_driver {
const char *name;
+ /* Default control and setup, added after probe() is run */
+ const struct snd_kcontrol_new *controls;
+ unsigned int num_controls;
+ const struct snd_soc_dapm_widget *dapm_widgets;
+ unsigned int num_dapm_widgets;
+ const struct snd_soc_dapm_route *dapm_routes;
+ unsigned int num_dapm_routes;
+
+ int (*probe)(struct snd_soc_component *);
+ void (*remove)(struct snd_soc_component *);
+
/* DT */
int (*of_xlate_dai_name)(struct snd_soc_component *component,
struct of_phandle_args *args,
struct snd_soc_pcm_runtime *rtd = &card->rtd[num];
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_platform *platform = rtd->platform;
- struct snd_soc_codec *codec;
+ struct snd_soc_component *component;
int i;
/* remove the platform */
/* remove the CODEC-side CODEC */
for (i = 0; i < rtd->num_codecs; i++) {
- codec = rtd->codec_dais[i]->codec;
- if (codec && codec->component.probed &&
- codec->component.driver->remove_order == order)
- soc_remove_component(&codec->component);
+ component = rtd->codec_dais[i]->component;
+ if (component->probed &&
+ component->driver->remove_order == order)
+ soc_remove_component(component);
}
/* remove any CPU-side CODEC */
if (cpu_dai) {
- codec = cpu_dai->codec;
- if (codec && codec->component.probed &&
- codec->component.driver->remove_order == order)
- soc_remove_component(&codec->component);
+ if (cpu_dai->component->probed &&
+ cpu_dai->component->driver->remove_order == order)
+ soc_remove_component(cpu_dai->component);
}
}
int i, ret;
/* probe the CPU-side component, if it is a CODEC */
- if (rtd->cpu_dai->codec) {
- component = &rtd->cpu_dai->codec->component;
- if (!component->probed &&
- component->driver->probe_order == order) {
- ret = soc_probe_component(card, component);
- if (ret < 0)
- return ret;
- }
+ component = rtd->cpu_dai->component;
+ if (!component->probed &&
+ component->driver->probe_order == order) {
+ ret = soc_probe_component(card, component);
+ if (ret < 0)
+ return ret;
}
/* probe the CODEC-side components */
for (i = 0; i < rtd->num_codecs; i++) {
- component = &rtd->codec_dais[i]->codec->component;
+ component = rtd->codec_dais[i]->component;
if (!component->probed &&
component->driver->probe_order == order) {
ret = soc_probe_component(card, component);
component->dev = dev;
component->driver = driver;
+ component->probe = component->driver->probe;
+ component->remove = component->driver->remove;
if (!component->dapm_ptr)
component->dapm_ptr = &component->dapm;
if (driver->stream_event)
dapm->stream_event = snd_soc_component_stream_event;
+ component->controls = driver->controls;
+ component->num_controls = driver->num_controls;
+ component->dapm_widgets = driver->dapm_widgets;
+ component->num_dapm_widgets = driver->num_dapm_widgets;
+ component->dapm_routes = driver->dapm_routes;
+ component->num_dapm_routes = driver->num_dapm_routes;
+
INIT_LIST_HEAD(&component->dai_list);
mutex_init(&component->io_mutex);