* Question about soc_bind_aux_dev()
@ 2019-05-22 8:30 Kuninori Morimoto
2019-05-22 10:54 ` Takashi Iwai
0 siblings, 1 reply; 5+ messages in thread
From: Kuninori Morimoto @ 2019-05-22 8:30 UTC (permalink / raw)
To: Linux-ALSA
Hi ALSA ML
Do you know why snd_soc_aux_dev has both name and codec_name ??
struct snd_soc_aux_dev {
=> const char *name; /* Codec name */
...
=> const char *codec_name;
...
};
For example, samsung's speyside.c has both name and codec_name
static struct snd_soc_aux_dev speyside_aux_dev[] = {
{
=> .name = "wm9081",
=> .codec_name = "wm9081.1-006c",
...
},
};
In my research, there is no driver which is using .name only.
All drivers are having codec_of_node, or .codec_name
Now, in the soc_bind_aux_dev(), it checks .codec_name or codec_of_node first.
This means, there is zero chance to use .name ?
static int soc_bind_aux_dev(struct snd_soc_card *card, int num)
{
...
=> if (aux_dev->codec_of_node || aux_dev->codec_name) {
...
component = soc_find_component(...);
...
=> } else if (aux_dev->name) {
...
component = soc_find_component(...);
...
}
...
}
Why .name is needed ??
Thank you for your help !!
Best regards
---
Kuninori Morimoto
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question about soc_bind_aux_dev()
2019-05-22 8:30 Question about soc_bind_aux_dev() Kuninori Morimoto
@ 2019-05-22 10:54 ` Takashi Iwai
2019-05-23 0:35 ` Kuninori Morimoto
2019-05-23 1:01 ` Kuninori Morimoto
0 siblings, 2 replies; 5+ messages in thread
From: Takashi Iwai @ 2019-05-22 10:54 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: Linux-ALSA
On Wed, 22 May 2019 10:30:51 +0200,
Kuninori Morimoto wrote:
>
>
> Hi ALSA ML
>
> Do you know why snd_soc_aux_dev has both name and codec_name ??
>
> struct snd_soc_aux_dev {
> => const char *name; /* Codec name */
> ...
> => const char *codec_name;
> ...
> };
>
> For example, samsung's speyside.c has both name and codec_name
>
> static struct snd_soc_aux_dev speyside_aux_dev[] = {
> {
> => .name = "wm9081",
> => .codec_name = "wm9081.1-006c",
> ...
> },
> };
>
> In my research, there is no driver which is using .name only.
> All drivers are having codec_of_node, or .codec_name
>
> Now, in the soc_bind_aux_dev(), it checks .codec_name or codec_of_node first.
> This means, there is zero chance to use .name ?
>
> static int soc_bind_aux_dev(struct snd_soc_card *card, int num)
> {
> ...
> => if (aux_dev->codec_of_node || aux_dev->codec_name) {
> ...
> component = soc_find_component(...);
> ...
> => } else if (aux_dev->name) {
> ...
> component = soc_find_component(...);
> ...
> }
> ...
> }
>
> Why .name is needed ??
AFAIK, the binding with aux_dev->name was introduced later as a
fallback in case of no codec. Through a quick glance at git log, the
commit f2ed6b07645e brought the behavior. Other than that, the field
was used merely for some label, e.g. passed to
snd_soc_post_component_init().
Takashi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question about soc_bind_aux_dev()
2019-05-22 10:54 ` Takashi Iwai
@ 2019-05-23 0:35 ` Kuninori Morimoto
2019-05-23 1:01 ` Kuninori Morimoto
1 sibling, 0 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2019-05-23 0:35 UTC (permalink / raw)
To: Takashi Iwai; +Cc: Linux-ALSA
Hi Takashi
Thank you for your feedback
> > Why .name is needed ??
>
> AFAIK, the binding with aux_dev->name was introduced later as a
> fallback in case of no codec. Through a quick glance at git log, the
> commit f2ed6b07645e brought the behavior. Other than that, the field
> was used merely for some label, e.g. passed to
> snd_soc_post_component_init().
Ahh, OK. for non codec...
Then, the reason was "main" is for search for codec,
and it is using "codec_xxx" variable name.
Then, using .name and .codec_name/.codec_of_node in the same time is strange.
Anyway, the purpose of these are for finding component.
I think this complicated code can be simple if we could replace it to
snd_soc_dai_link_component which exist for this purpose ?
struct snd_soc_aux_dev {
- const char *name; /* Codec name */
/*
* specify multi-codec either by device name, or by
* DT/OF node, but not both.
*/
- const char *codec_name;
- struct device_node *codec_of_node;
+ struct snd_soc_dai_link_component dlc;
+
/* codec/machine specific init - e.g. add machine controls */
int (*init)(struct snd_soc_component *component);
};
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question about soc_bind_aux_dev()
2019-05-22 10:54 ` Takashi Iwai
2019-05-23 0:35 ` Kuninori Morimoto
@ 2019-05-23 1:01 ` Kuninori Morimoto
2019-05-23 6:39 ` Takashi Iwai
1 sibling, 1 reply; 5+ messages in thread
From: Kuninori Morimoto @ 2019-05-23 1:01 UTC (permalink / raw)
To: Takashi Iwai; +Cc: Linux-ALSA
Hi Takashi, again
> AFAIK, the binding with aux_dev->name was introduced later as a
> fallback in case of no codec. Through a quick glance at git log, the
> commit f2ed6b07645e brought the behavior. Other than that, the field
> was used merely for some label, e.g. passed to
> snd_soc_post_component_init().
soc_post_component_init() is using dai_link->name, not aux_dev->name.
But, am I misunderstanding ?
Thank you for your help !!
Best regards
---
Kuninori Morimoto
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question about soc_bind_aux_dev()
2019-05-23 1:01 ` Kuninori Morimoto
@ 2019-05-23 6:39 ` Takashi Iwai
0 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2019-05-23 6:39 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: Linux-ALSA, Mengdong Lin
On Thu, 23 May 2019 03:01:10 +0200,
Kuninori Morimoto wrote:
>
>
> Hi Takashi, again
>
> > AFAIK, the binding with aux_dev->name was introduced later as a
> > fallback in case of no codec. Through a quick glance at git log, the
> > commit f2ed6b07645e brought the behavior. Other than that, the field
> > was used merely for some label, e.g. passed to
> > snd_soc_post_component_init().
>
> soc_post_component_init() is using dai_link->name, not aux_dev->name.
> But, am I misunderstanding ?
It used to be called, but was removed by the commit above.
The author of the patch, Mengdong, should be able to give a better
answer about the use case of aux_dev->name.
thanks,
Takashi
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-05-23 6:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22 8:30 Question about soc_bind_aux_dev() Kuninori Morimoto
2019-05-22 10:54 ` Takashi Iwai
2019-05-23 0:35 ` Kuninori Morimoto
2019-05-23 1:01 ` Kuninori Morimoto
2019-05-23 6:39 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.