Message ID | 20210523234437.25077-5-digetx@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Unify NVIDIA Tegra ASoC machine drivers | expand |
Dne 24. 05. 21 v 1:44 Dmitry Osipenko napsal(a): > Specify components string for Nexus 7 using the Intel BayTrail components > format. This may allow us to create a more generic UCM for RT5640 codec. > > Signed-off-by: Dmitry Osipenko <digetx@gmail.com> > --- > sound/soc/tegra/tegra_asoc_machine.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c > index a81f2ebfc00c..87e0a47040a5 100644 > --- a/sound/soc/tegra/tegra_asoc_machine.c > +++ b/sound/soc/tegra/tegra_asoc_machine.c > @@ -671,6 +671,24 @@ static const struct tegra_asoc_data tegra_rt5640_data = { > .add_hp_jack = true, > }; > > +/* > + * Speaker: Connected to SPO L/R P/N pins, stereo. > + * Internal Microphone: Digital, connected to DMIC1_DAT IN2P/N pins. > + * Headphones: Connected to HPOL/R pins. > + * Headset Microphone: Unconnected. > + * > + * IF2_DAC/ADC are unpopulated. > + */ > +static const struct tegra_asoc_data tegra_rt5640_grouper_data = { > + .components = "codec:rt5640 cfg-spk:2 cfg-mic:dmic1 aif:1", Perhaps, it may be better to handle this string via the DT config (create new function like snd_soc_of_parse_card_name()). The "codec:rt5640" should be set in the driver (it's fixed), but the "cfg-spk:2 cfg-mic:dmic1 aif:1" part is suitable for the DT config. Jaroslav
24.05.2021 13:54, Jaroslav Kysela пишет: > Dne 24. 05. 21 v 1:44 Dmitry Osipenko napsal(a): >> Specify components string for Nexus 7 using the Intel BayTrail components >> format. This may allow us to create a more generic UCM for RT5640 codec. >> >> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> >> --- >> sound/soc/tegra/tegra_asoc_machine.c | 19 +++++++++++++++++++ >> 1 file changed, 19 insertions(+) >> >> diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c >> index a81f2ebfc00c..87e0a47040a5 100644 >> --- a/sound/soc/tegra/tegra_asoc_machine.c >> +++ b/sound/soc/tegra/tegra_asoc_machine.c >> @@ -671,6 +671,24 @@ static const struct tegra_asoc_data tegra_rt5640_data = { >> .add_hp_jack = true, >> }; >> >> +/* >> + * Speaker: Connected to SPO L/R P/N pins, stereo. >> + * Internal Microphone: Digital, connected to DMIC1_DAT IN2P/N pins. >> + * Headphones: Connected to HPOL/R pins. >> + * Headset Microphone: Unconnected. >> + * >> + * IF2_DAC/ADC are unpopulated. >> + */ >> +static const struct tegra_asoc_data tegra_rt5640_grouper_data = { >> + .components = "codec:rt5640 cfg-spk:2 cfg-mic:dmic1 aif:1", > > Perhaps, it may be better to handle this string via the DT config (create new > function like snd_soc_of_parse_card_name()). > > The "codec:rt5640" should be set in the driver (it's fixed), but the > "cfg-spk:2 cfg-mic:dmic1 aif:1" part is suitable for the DT config. Not sure that this is possible. The DT is an ABI, while components string has no specification. Any changes to the components string will require DT update. I think it's much more feasible to have a database of components within kernel driver, like Intel sound driver does it for ACPI devices.
On 24/05/2021 00:44, Dmitry Osipenko wrote: > Specify components string for Nexus 7 using the Intel BayTrail components > format. This may allow us to create a more generic UCM for RT5640 codec. > > Signed-off-by: Dmitry Osipenko <digetx@gmail.com> > --- > sound/soc/tegra/tegra_asoc_machine.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c > index a81f2ebfc00c..87e0a47040a5 100644 > --- a/sound/soc/tegra/tegra_asoc_machine.c > +++ b/sound/soc/tegra/tegra_asoc_machine.c > @@ -671,6 +671,24 @@ static const struct tegra_asoc_data tegra_rt5640_data = { > .add_hp_jack = true, > }; > > +/* > + * Speaker: Connected to SPO L/R P/N pins, stereo. > + * Internal Microphone: Digital, connected to DMIC1_DAT IN2P/N pins. > + * Headphones: Connected to HPOL/R pins. > + * Headset Microphone: Unconnected. > + * > + * IF2_DAC/ADC are unpopulated. > + */ > +static const struct tegra_asoc_data tegra_rt5640_grouper_data = { > + .components = "codec:rt5640 cfg-spk:2 cfg-mic:dmic1 aif:1", > + .mclk_rate = tegra_machine_mclk_rate_256, > + .card = &snd_soc_tegra_rt5640, > + .add_common_dapm_widgets = true, > + .add_common_controls = true, > + .add_common_snd_ops = true, > + .add_hp_jack = true, > +}; > + > /* RT5632 machine */ > > SND_SOC_DAILINK_DEFS(rt5632_hifi, > @@ -712,6 +730,7 @@ static const struct of_device_id tegra_machine_of_match[] = { > { .compatible = "nvidia,tegra-audio-wm8753", .data = &tegra_wm8753_data }, > { .compatible = "nvidia,tegra-audio-rt5677", .data = &tegra_rt5677_data }, > { .compatible = "nvidia,tegra-audio-rt5640", .data = &tegra_rt5640_data }, > + { .compatible = "nvidia,tegra-audio-rt5640-grouper", .data = &tegra_rt5640_grouper_data }, Is there any harm always populating the components data for rt5640? I did not see any existing UCM support for Tegra+rt5640 platforms in ALSA. Jon
25.05.2021 11:40, Jon Hunter пишет: > > On 24/05/2021 00:44, Dmitry Osipenko wrote: >> Specify components string for Nexus 7 using the Intel BayTrail components >> format. This may allow us to create a more generic UCM for RT5640 codec. >> >> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> >> --- >> sound/soc/tegra/tegra_asoc_machine.c | 19 +++++++++++++++++++ >> 1 file changed, 19 insertions(+) >> >> diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c >> index a81f2ebfc00c..87e0a47040a5 100644 >> --- a/sound/soc/tegra/tegra_asoc_machine.c >> +++ b/sound/soc/tegra/tegra_asoc_machine.c >> @@ -671,6 +671,24 @@ static const struct tegra_asoc_data tegra_rt5640_data = { >> .add_hp_jack = true, >> }; >> >> +/* >> + * Speaker: Connected to SPO L/R P/N pins, stereo. >> + * Internal Microphone: Digital, connected to DMIC1_DAT IN2P/N pins. >> + * Headphones: Connected to HPOL/R pins. >> + * Headset Microphone: Unconnected. >> + * >> + * IF2_DAC/ADC are unpopulated. >> + */ >> +static const struct tegra_asoc_data tegra_rt5640_grouper_data = { >> + .components = "codec:rt5640 cfg-spk:2 cfg-mic:dmic1 aif:1", >> + .mclk_rate = tegra_machine_mclk_rate_256, >> + .card = &snd_soc_tegra_rt5640, >> + .add_common_dapm_widgets = true, >> + .add_common_controls = true, >> + .add_common_snd_ops = true, >> + .add_hp_jack = true, >> +}; >> + >> /* RT5632 machine */ >> >> SND_SOC_DAILINK_DEFS(rt5632_hifi, >> @@ -712,6 +730,7 @@ static const struct of_device_id tegra_machine_of_match[] = { >> { .compatible = "nvidia,tegra-audio-wm8753", .data = &tegra_wm8753_data }, >> { .compatible = "nvidia,tegra-audio-rt5677", .data = &tegra_rt5677_data }, >> { .compatible = "nvidia,tegra-audio-rt5640", .data = &tegra_rt5640_data }, >> + { .compatible = "nvidia,tegra-audio-rt5640-grouper", .data = &tegra_rt5640_grouper_data }, > > > Is there any harm always populating the components data for rt5640? I > did not see any existing UCM support for Tegra+rt5640 platforms in ALSA. The previous patch sets components for each card, including RT5640. This patch sets individual components configuration that is unique to the Nexus 7, it overrides the default components string of the card that was set by the previous patch. Other devices may have a different h/w configuration. The universal UCM needs to know the full h/w configuration, otherwise it doesn't know how to set up mixers and switches properly. The exact bytcr-rt5640 UCM works on Tegra if couple switches that unique to BayTrail are made conditional in the UCM.
On 24. 05. 21 16:00, Dmitry Osipenko wrote: > 24.05.2021 13:54, Jaroslav Kysela пишет: >> Dne 24. 05. 21 v 1:44 Dmitry Osipenko napsal(a): >>> Specify components string for Nexus 7 using the Intel BayTrail components >>> format. This may allow us to create a more generic UCM for RT5640 codec. >>> >>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> >>> --- >>> sound/soc/tegra/tegra_asoc_machine.c | 19 +++++++++++++++++++ >>> 1 file changed, 19 insertions(+) >>> >>> diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c >>> index a81f2ebfc00c..87e0a47040a5 100644 >>> --- a/sound/soc/tegra/tegra_asoc_machine.c >>> +++ b/sound/soc/tegra/tegra_asoc_machine.c >>> @@ -671,6 +671,24 @@ static const struct tegra_asoc_data tegra_rt5640_data = { >>> .add_hp_jack = true, >>> }; >>> >>> +/* >>> + * Speaker: Connected to SPO L/R P/N pins, stereo. >>> + * Internal Microphone: Digital, connected to DMIC1_DAT IN2P/N pins. >>> + * Headphones: Connected to HPOL/R pins. >>> + * Headset Microphone: Unconnected. >>> + * >>> + * IF2_DAC/ADC are unpopulated. >>> + */ >>> +static const struct tegra_asoc_data tegra_rt5640_grouper_data = { >>> + .components = "codec:rt5640 cfg-spk:2 cfg-mic:dmic1 aif:1", >> >> Perhaps, it may be better to handle this string via the DT config (create new >> function like snd_soc_of_parse_card_name()). >> >> The "codec:rt5640" should be set in the driver (it's fixed), but the >> "cfg-spk:2 cfg-mic:dmic1 aif:1" part is suitable for the DT config. > > Not sure that this is possible. The DT is an ABI, while components > string has no specification. Any changes to the components string will > require DT update. > > I think it's much more feasible to have a database of components within > kernel driver, like Intel sound driver does it for ACPI devices. There is no other possibility for ACPI. And while the components string is part of the ALSA ABI, it should not be changed in an incompatible way. Only new information should be added. The DT solution seems more flexible to me. For example the stereo/mono speaker or the AIF number can be set without the driver modification for rt5640. Jaroslav
25.05.2021 19:24, Jaroslav Kysela пишет: > On 24. 05. 21 16:00, Dmitry Osipenko wrote: >> 24.05.2021 13:54, Jaroslav Kysela пишет: >>> Dne 24. 05. 21 v 1:44 Dmitry Osipenko napsal(a): >>>> Specify components string for Nexus 7 using the Intel BayTrail components >>>> format. This may allow us to create a more generic UCM for RT5640 codec. >>>> >>>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> >>>> --- >>>> sound/soc/tegra/tegra_asoc_machine.c | 19 +++++++++++++++++++ >>>> 1 file changed, 19 insertions(+) >>>> >>>> diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c >>>> index a81f2ebfc00c..87e0a47040a5 100644 >>>> --- a/sound/soc/tegra/tegra_asoc_machine.c >>>> +++ b/sound/soc/tegra/tegra_asoc_machine.c >>>> @@ -671,6 +671,24 @@ static const struct tegra_asoc_data tegra_rt5640_data = { >>>> .add_hp_jack = true, >>>> }; >>>> >>>> +/* >>>> + * Speaker: Connected to SPO L/R P/N pins, stereo. >>>> + * Internal Microphone: Digital, connected to DMIC1_DAT IN2P/N pins. >>>> + * Headphones: Connected to HPOL/R pins. >>>> + * Headset Microphone: Unconnected. >>>> + * >>>> + * IF2_DAC/ADC are unpopulated. >>>> + */ >>>> +static const struct tegra_asoc_data tegra_rt5640_grouper_data = { >>>> + .components = "codec:rt5640 cfg-spk:2 cfg-mic:dmic1 aif:1", >>> >>> Perhaps, it may be better to handle this string via the DT config (create new >>> function like snd_soc_of_parse_card_name()). >>> >>> The "codec:rt5640" should be set in the driver (it's fixed), but the >>> "cfg-spk:2 cfg-mic:dmic1 aif:1" part is suitable for the DT config. >> >> Not sure that this is possible. The DT is an ABI, while components >> string has no specification. Any changes to the components string will >> require DT update. >> >> I think it's much more feasible to have a database of components within >> kernel driver, like Intel sound driver does it for ACPI devices. > > There is no other possibility for ACPI. And while the components string is > part of the ALSA ABI, it should not be changed in an incompatible way. Only > new information should be added. The DT solution seems more flexible to me. > For example the stereo/mono speaker or the AIF number can be set without the > driver modification for rt5640. Everything that goes into device-tree needs a firm specification. We can't add it into device-tree since there is no specification for the components string other than something that Intel driver made up for its own needs. So either we could add the components string to the kernel driver right now or not add it. I think the best option would be to drop this patch for now.
diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c index a81f2ebfc00c..87e0a47040a5 100644 --- a/sound/soc/tegra/tegra_asoc_machine.c +++ b/sound/soc/tegra/tegra_asoc_machine.c @@ -671,6 +671,24 @@ static const struct tegra_asoc_data tegra_rt5640_data = { .add_hp_jack = true, }; +/* + * Speaker: Connected to SPO L/R P/N pins, stereo. + * Internal Microphone: Digital, connected to DMIC1_DAT IN2P/N pins. + * Headphones: Connected to HPOL/R pins. + * Headset Microphone: Unconnected. + * + * IF2_DAC/ADC are unpopulated. + */ +static const struct tegra_asoc_data tegra_rt5640_grouper_data = { + .components = "codec:rt5640 cfg-spk:2 cfg-mic:dmic1 aif:1", + .mclk_rate = tegra_machine_mclk_rate_256, + .card = &snd_soc_tegra_rt5640, + .add_common_dapm_widgets = true, + .add_common_controls = true, + .add_common_snd_ops = true, + .add_hp_jack = true, +}; + /* RT5632 machine */ SND_SOC_DAILINK_DEFS(rt5632_hifi, @@ -712,6 +730,7 @@ static const struct of_device_id tegra_machine_of_match[] = { { .compatible = "nvidia,tegra-audio-wm8753", .data = &tegra_wm8753_data }, { .compatible = "nvidia,tegra-audio-rt5677", .data = &tegra_rt5677_data }, { .compatible = "nvidia,tegra-audio-rt5640", .data = &tegra_rt5640_data }, + { .compatible = "nvidia,tegra-audio-rt5640-grouper", .data = &tegra_rt5640_grouper_data }, { .compatible = "nvidia,tegra-audio-alc5632", .data = &tegra_rt5632_data }, {}, };
Specify components string for Nexus 7 using the Intel BayTrail components format. This may allow us to create a more generic UCM for RT5640 codec. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> --- sound/soc/tegra/tegra_asoc_machine.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)