diff mbox

[2/2] ASoC: dapm: Add a helper to get the platform for DAPM kcontrol

Message ID 1401106136-3745-2-git-send-email-vinod.koul@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vinod Koul May 26, 2014, 12:08 p.m. UTC
From: Subhransu S. Prusty <subhransu.s.prusty@intel.com>

commit eee5d7f9 introduced helper for getting codec for DAPM kcontrol, for DSPs
we need similar stuff for platforms as well

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 include/sound/soc-dapm.h |    2 ++
 sound/soc/soc-dapm.c     |   11 +++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

Comments

Jarkko Nikula May 26, 2014, 12:44 p.m. UTC | #1
On 05/26/2014 03:08 PM, Vinod Koul wrote:
> From: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
>
> commit eee5d7f9 introduced helper for getting codec for DAPM kcontrol, for DSPs
> we need similar stuff for platforms as well
>
Please refer not only the commit id but also commit title ("ASoC: dapm: 
Add a helper to get the CODEC for DAPM kcontrol").

Makes commit log more clear and helps cases where original commit is 
backported to older tree.
Vinod Koul May 26, 2014, 12:51 p.m. UTC | #2
On Mon, May 26, 2014 at 03:44:22PM +0300, Jarkko Nikula wrote:
> On 05/26/2014 03:08 PM, Vinod Koul wrote:
> >From: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
> >
> >commit eee5d7f9 introduced helper for getting codec for DAPM kcontrol, for DSPs
> >we need similar stuff for platforms as well
> >
> Please refer not only the commit id but also commit title ("ASoC:
> dapm: Add a helper to get the CODEC for DAPM kcontrol").
> 
> Makes commit log more clear and helps cases where original commit is
> backported to older tree.
ah yes, my bad :(

Mark, do you want a patch or can edit the commit with title "ASoC: dapm: Add a
helper to get the CODEC for DAPM kcontrol" before applying, if no further
comments
Lars-Peter Clausen May 26, 2014, 1:29 p.m. UTC | #3
On 05/26/2014 02:08 PM, Vinod Koul wrote:
[...]
> + * snd_soc_dapm_kcontrol_platform() - Returns the platform associated to a kcontrol
> + * @kcontrol: The kcontrol
> + */
> +struct snd_soc_platform *snd_soc_dapm_kcontrol_platform(
> +		struct snd_kcontrol *kcontrol)
> +{
> +	return dapm_kcontrol_get_wlist(kcontrol)->widgets[0]->platform;
> +}
> +EXPORT_SYMBOL_GPL(snd_soc_dapm_kcontrol_platform);

This conflicts with the series that moves DAPM support to the component 
level [1].

- Lars

[1] http://mailman.alsa-project.org/pipermail/alsa-devel/2014-May/076718.html
Mark Brown May 26, 2014, 2:29 p.m. UTC | #4
On Mon, May 26, 2014 at 06:21:46PM +0530, Vinod Koul wrote:

> Mark, do you want a patch or can edit the commit with title "ASoC: dapm: Add a
> helper to get the CODEC for DAPM kcontrol" before applying, if no further
> comments

It's fine, I can edit.
Vinod Koul May 26, 2014, 4:23 p.m. UTC | #5
On Mon, May 26, 2014 at 03:29:03PM +0200, Lars-Peter Clausen wrote:
> On 05/26/2014 02:08 PM, Vinod Koul wrote:
> [...]
> >+ * snd_soc_dapm_kcontrol_platform() - Returns the platform associated to a kcontrol
> >+ * @kcontrol: The kcontrol
> >+ */
> >+struct snd_soc_platform *snd_soc_dapm_kcontrol_platform(
> >+		struct snd_kcontrol *kcontrol)
> >+{
> >+	return dapm_kcontrol_get_wlist(kcontrol)->widgets[0]->platform;
> >+}
> >+EXPORT_SYMBOL_GPL(snd_soc_dapm_kcontrol_platform);
> 
> This conflicts with the series that moves DAPM support to the
> component level [1].

Thanks for the pointer, has this series been merged?
Dont see it in topic/core in Mark's tree.

I will take a look but fwiw this statement is not entirely true in the cover
letter of patch:

"This will allow any component to have DAPM widgets and routes, which was
previously only possible for CODECs, and will allow any component to have DAPM
widgets with controls (i.e. Mixers and MUXs), which was previously only possible
for CODECs"

I am already running a system which models platform and has Mixers,
Muxes and works fine (tested on 3.10 and 3.14).

Few bits of code is in RFC I sent earlier and will post these in detail over
next few weeks
> 
> - Lars
> 
> [1] http://mailman.alsa-project.org/pipermail/alsa-devel/2014-May/076718.html
>
Vinod Koul May 26, 2014, 4:47 p.m. UTC | #6
On Mon, May 26, 2014 at 06:52:28PM +0200, Lars-Peter Clausen wrote:
> On 05/26/2014 06:23 PM, Vinod Koul wrote:
> >On Mon, May 26, 2014 at 03:29:03PM +0200, Lars-Peter Clausen wrote:
> >>On 05/26/2014 02:08 PM, Vinod Koul wrote:
> >>[...]
> >>>+ * snd_soc_dapm_kcontrol_platform() - Returns the platform associated to a kcontrol
> >>>+ * @kcontrol: The kcontrol
> >>>+ */
> >>>+struct snd_soc_platform *snd_soc_dapm_kcontrol_platform(
> >>>+		struct snd_kcontrol *kcontrol)
> >>>+{
> >>>+	return dapm_kcontrol_get_wlist(kcontrol)->widgets[0]->platform;
> >>>+}
> >>>+EXPORT_SYMBOL_GPL(snd_soc_dapm_kcontrol_platform);
> >>
> >>This conflicts with the series that moves DAPM support to the
> >>component level [1].
> >
> >Thanks for the pointer, has this series been merged?
> >Dont see it in topic/core in Mark's tree.
> 
> It hasn't been merged yet.
Okay, what is the state of the series? Would it merged soonish? If this is
approach going to be taken then we need to plan for intercepting this

> >
> >I will take a look but fwiw this statement is not entirely true in the cover
> >letter of patch:
> >
> >"This will allow any component to have DAPM widgets and routes, which was
> >previously only possible for CODECs, and will allow any component to have DAPM
> >widgets with controls (i.e. Mixers and MUXs), which was previously only possible
> >for CODECs"
> >
> >I am already running a system which models platform and has Mixers,
> >Muxes and works fine (tested on 3.10 and 3.14).
> 
> It works if you use custom controls. But it does not work with the
> standard SOC_DAPM_* controls.
Not sure as we are using SOC_DAPM but yes with *_E versions and our own get/put
handlers with additional dapm event handlers.
I have also tested with a version which used non _E versions and only dapm event
handlers. So not sure where you found it difficult. I was able to model a fiarly
complex DSP and able to do both playback as well as loopback tests.

We haven't wrriten our own SOC_DAPM_* controls yet.

> >Few bits of code is in RFC I sent earlier and will post these in detail over
> >next few weeks
> 
> Do you think it is necessary that these two patches get merged
> before you send the other patches? It would be good to see things in
> context. That will make it easier to properly review patch 1 of this
> series.
Actually yes, as our mixer/mux get and put handlers would need to find the
platform pointer as well as set and get the values.
Lars-Peter Clausen May 26, 2014, 4:52 p.m. UTC | #7
On 05/26/2014 06:23 PM, Vinod Koul wrote:
> On Mon, May 26, 2014 at 03:29:03PM +0200, Lars-Peter Clausen wrote:
>> On 05/26/2014 02:08 PM, Vinod Koul wrote:
>> [...]
>>> + * snd_soc_dapm_kcontrol_platform() - Returns the platform associated to a kcontrol
>>> + * @kcontrol: The kcontrol
>>> + */
>>> +struct snd_soc_platform *snd_soc_dapm_kcontrol_platform(
>>> +		struct snd_kcontrol *kcontrol)
>>> +{
>>> +	return dapm_kcontrol_get_wlist(kcontrol)->widgets[0]->platform;
>>> +}
>>> +EXPORT_SYMBOL_GPL(snd_soc_dapm_kcontrol_platform);
>>
>> This conflicts with the series that moves DAPM support to the
>> component level [1].
>
> Thanks for the pointer, has this series been merged?
> Dont see it in topic/core in Mark's tree.

It hasn't been merged yet.

>
> I will take a look but fwiw this statement is not entirely true in the cover
> letter of patch:
>
> "This will allow any component to have DAPM widgets and routes, which was
> previously only possible for CODECs, and will allow any component to have DAPM
> widgets with controls (i.e. Mixers and MUXs), which was previously only possible
> for CODECs"
>
> I am already running a system which models platform and has Mixers,
> Muxes and works fine (tested on 3.10 and 3.14).

It works if you use custom controls. But it does not work with the standard 
SOC_DAPM_* controls.

>
> Few bits of code is in RFC I sent earlier and will post these in detail over
> next few weeks

Do you think it is necessary that these two patches get merged before you 
send the other patches? It would be good to see things in context. That will 
make it easier to properly review patch 1 of this series.

- Lars
Lars-Peter Clausen May 26, 2014, 6:07 p.m. UTC | #8
On 05/26/2014 06:47 PM, Vinod Koul wrote:
> On Mon, May 26, 2014 at 06:52:28PM +0200, Lars-Peter Clausen wrote:
>> On 05/26/2014 06:23 PM, Vinod Koul wrote:
>>> On Mon, May 26, 2014 at 03:29:03PM +0200, Lars-Peter Clausen wrote:
>>>> On 05/26/2014 02:08 PM, Vinod Koul wrote:
>>>> [...]
>>>>> + * snd_soc_dapm_kcontrol_platform() - Returns the platform associated to a kcontrol
>>>>> + * @kcontrol: The kcontrol
>>>>> + */
>>>>> +struct snd_soc_platform *snd_soc_dapm_kcontrol_platform(
>>>>> +		struct snd_kcontrol *kcontrol)
>>>>> +{
>>>>> +	return dapm_kcontrol_get_wlist(kcontrol)->widgets[0]->platform;
>>>>> +}
>>>>> +EXPORT_SYMBOL_GPL(snd_soc_dapm_kcontrol_platform);
>>>>
>>>> This conflicts with the series that moves DAPM support to the
>>>> component level [1].
>>>
>>> Thanks for the pointer, has this series been merged?
>>> Dont see it in topic/core in Mark's tree.
>>
>> It hasn't been merged yet.
> Okay, what is the state of the series? Would it merged soonish?

Maybe, depends on how well the review goes. But it doesn't really matter which 
patch is merged first, we just need to be aware that the other one needs to be 
reworked and rebased on top of it.

> If this is approach going to be taken then we need to plan for intercepting this
>
>>>
>>> I will take a look but fwiw this statement is not entirely true in the cover
>>> letter of patch:
>>>
>>> "This will allow any component to have DAPM widgets and routes, which was
>>> previously only possible for CODECs, and will allow any component to have DAPM
>>> widgets with controls (i.e. Mixers and MUXs), which was previously only possible
>>> for CODECs"
>>>
>>> I am already running a system which models platform and has Mixers,
>>> Muxes and works fine (tested on 3.10 and 3.14).
>>
>> It works if you use custom controls. But it does not work with the
>> standard SOC_DAPM_* controls.
> Not sure as we are using SOC_DAPM but yes with *_E versions and our own get/put
> handlers with additional dapm event handlers.
> I have also tested with a version which used non _E versions and only dapm event
> handlers. So not sure where you found it difficult. I was able to model a fiarly
> complex DSP and able to do both playback as well as loopback tests.
>
> We haven't wrriten our own SOC_DAPM_* controls yet.

The standard DAPM get/put handlers will crash if you use them with a platform.

>
>>> Few bits of code is in RFC I sent earlier and will post these in detail over
>>> next few weeks
>>
>> Do you think it is necessary that these two patches get merged
>> before you send the other patches? It would be good to see things in
>> context. That will make it easier to properly review patch 1 of this
>> series.
> Actually yes, as our mixer/mux get and put handlers would need to find the
> platform pointer as well as set and get the values.
>

Yes, but can these two patches be sent in the same series as the first user? 
That makes review easier.
Mark Brown May 26, 2014, 6:54 p.m. UTC | #9
On Mon, May 26, 2014 at 08:07:45PM +0200, Lars-Peter Clausen wrote:
> On 05/26/2014 06:47 PM, Vinod Koul wrote:

> >>It hasn't been merged yet.
> >Okay, what is the state of the series? Would it merged soonish?

> Maybe, depends on how well the review goes. But it doesn't really matter
> which patch is merged first, we just need to be aware that the other one
> needs to be reworked and rebased on top of it.

Probably not until after the merge window now; that should open next
week and it's a bit invasive to be doing right now.
diff mbox

Patch

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 9e826e9..9f47dee 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -460,6 +460,8 @@  int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
 	struct snd_soc_dapm_widget_list **list);
 
 struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol);
+struct snd_soc_platform *snd_soc_dapm_kcontrol_platform(
+		struct snd_kcontrol *kcontrol);
 
 /* dapm widget types */
 enum snd_soc_dapm_type {
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index b7dfa1a..f37ca16 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -373,6 +373,17 @@  struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol)
 }
 EXPORT_SYMBOL_GPL(snd_soc_dapm_kcontrol_codec);
 
+/**
+ * snd_soc_dapm_kcontrol_platform() - Returns the platform associated to a kcontrol
+ * @kcontrol: The kcontrol
+ */
+struct snd_soc_platform *snd_soc_dapm_kcontrol_platform(
+		struct snd_kcontrol *kcontrol)
+{
+	return dapm_kcontrol_get_wlist(kcontrol)->widgets[0]->platform;
+}
+EXPORT_SYMBOL_GPL(snd_soc_dapm_kcontrol_platform);
+
 static void dapm_reset(struct snd_soc_card *card)
 {
 	struct snd_soc_dapm_widget *w;