public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: core: Pass kcontrol pointer to bytes tlv callbacks
@ 2015-06-02 22:24 Ben Zhang
  2015-06-03 11:59 ` Mark Brown
  2015-06-12  7:30 ` Vinod Koul
  0 siblings, 2 replies; 5+ messages in thread
From: Ben Zhang @ 2015-06-02 22:24 UTC (permalink / raw)
  To: Mark Brown
  Cc: Omair Mohammed Abdullah, Vinod Koul, Dylan Reid, Ben Zhang,
	alsa-devel, linux-kernel

The get/put callbacks need the kcontrol pointer to get context
information like snd_soc_codec and drvdata.

Signed-off-by: Ben Zhang <benzh@chromium.org>
---
 include/sound/soc.h | 6 ++++--
 sound/soc/soc-ops.c | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index fcb312b..404265d 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1169,8 +1169,10 @@ struct soc_bytes {
 struct soc_bytes_ext {
 	int max;
 	/* used for TLV byte control */
-	int (*get)(unsigned int __user *bytes, unsigned int size);
-	int (*put)(const unsigned int __user *bytes, unsigned int size);
+	int (*get)(struct snd_kcontrol *kcontrol,
+		   unsigned int __user *bytes, unsigned int size);
+	int (*put)(struct snd_kcontrol *kcontrol,
+		   const unsigned int __user *bytes, unsigned int size);
 };
 
 /* multi register control */
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index 100d92b..7f53da9 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -751,11 +751,11 @@ int snd_soc_bytes_tlv_callback(struct snd_kcontrol *kcontrol, int op_flag,
 	switch (op_flag) {
 	case SNDRV_CTL_TLV_OP_READ:
 		if (params->get)
-			ret = params->get(tlv, count);
+			ret = params->get(kcontrol, tlv, count);
 		break;
 	case SNDRV_CTL_TLV_OP_WRITE:
 		if (params->put)
-			ret = params->put(tlv, count);
+			ret = params->put(kcontrol, tlv, count);
 		break;
 	}
 	return ret;
-- 
2.2.0.rc0.207.ga3a616c


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: core: Pass kcontrol pointer to bytes tlv callbacks
  2015-06-02 22:24 [PATCH] ASoC: core: Pass kcontrol pointer to bytes tlv callbacks Ben Zhang
@ 2015-06-03 11:59 ` Mark Brown
  2015-06-03 21:10   ` Ben Zhang
  2015-06-12  7:30 ` Vinod Koul
  1 sibling, 1 reply; 5+ messages in thread
From: Mark Brown @ 2015-06-03 11:59 UTC (permalink / raw)
  To: Ben Zhang
  Cc: Omair Mohammed Abdullah, Vinod Koul, Dylan Reid, alsa-devel,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 482 bytes --]

On Tue, Jun 02, 2015 at 03:24:03PM -0700, Ben Zhang wrote:

> -	int (*get)(unsigned int __user *bytes, unsigned int size);
> -	int (*put)(const unsigned int __user *bytes, unsigned int size);
> +	int (*get)(struct snd_kcontrol *kcontrol,
> +		   unsigned int __user *bytes, unsigned int size);
> +	int (*put)(struct snd_kcontrol *kcontrol,
> +		   const unsigned int __user *bytes, unsigned int size);

This doesn't update any users and we do have some like the Haswell PCM
driver.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: core: Pass kcontrol pointer to bytes tlv callbacks
  2015-06-03 11:59 ` Mark Brown
@ 2015-06-03 21:10   ` Ben Zhang
  2015-06-12 11:22     ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Zhang @ 2015-06-03 21:10 UTC (permalink / raw)
  To: Mark Brown
  Cc: Omair Mohammed Abdullah, Vinod Koul, Dylan Reid, alsa-devel,
	Linux Kernel Mailing List

On Wed, Jun 3, 2015 at 4:59 AM, Mark Brown <broonie@kernel.org> wrote:
> On Tue, Jun 02, 2015 at 03:24:03PM -0700, Ben Zhang wrote:
>
>> -     int (*get)(unsigned int __user *bytes, unsigned int size);
>> -     int (*put)(const unsigned int __user *bytes, unsigned int size);
>> +     int (*get)(struct snd_kcontrol *kcontrol,
>> +                unsigned int __user *bytes, unsigned int size);
>> +     int (*put)(struct snd_kcontrol *kcontrol,
>> +                const unsigned int __user *bytes, unsigned int size);
>
> This doesn't update any users and we do have some like the Haswell PCM
> driver.

Hi Mark,

I couldn't find any existing users of the callbacks. It looks like the
modified callbacks are used by SND_SOC_BYTES_TLV only, and there is no
reference to SND_SOC_BYTES_TLV in the kernel.

The Haswell PCM driver uses SND_SOC_BYTES_EXT which doesn't use the
callbacks in struct soc_bytes_ext. The xhandler_get/put are assigned
to snd_kcontrol_new.get/put instead.

Ben

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: core: Pass kcontrol pointer to bytes tlv callbacks
  2015-06-02 22:24 [PATCH] ASoC: core: Pass kcontrol pointer to bytes tlv callbacks Ben Zhang
  2015-06-03 11:59 ` Mark Brown
@ 2015-06-12  7:30 ` Vinod Koul
  1 sibling, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2015-06-12  7:30 UTC (permalink / raw)
  To: Ben Zhang
  Cc: Mark Brown, Omair Mohammed Abdullah, Dylan Reid, alsa-devel,
	linux-kernel, patches.audio

On Tue, Jun 02, 2015 at 03:24:03PM -0700, Ben Zhang wrote:
> The get/put callbacks need the kcontrol pointer to get context
> information like snd_soc_codec and drvdata.
> 
> Signed-off-by: Ben Zhang <benzh@chromium.org>
I did have this change in my internal tree as well and is required, thanks
for sending, I need this is SKL driver..

Reviewed-by: Vinod Koul <vinod.koul@intel.com>

-- 
~Vinod

> ---
>  include/sound/soc.h | 6 ++++--
>  sound/soc/soc-ops.c | 4 ++--
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/include/sound/soc.h b/include/sound/soc.h
> index fcb312b..404265d 100644
> --- a/include/sound/soc.h
> +++ b/include/sound/soc.h
> @@ -1169,8 +1169,10 @@ struct soc_bytes {
>  struct soc_bytes_ext {
>  	int max;
>  	/* used for TLV byte control */
> -	int (*get)(unsigned int __user *bytes, unsigned int size);
> -	int (*put)(const unsigned int __user *bytes, unsigned int size);
> +	int (*get)(struct snd_kcontrol *kcontrol,
> +		   unsigned int __user *bytes, unsigned int size);
> +	int (*put)(struct snd_kcontrol *kcontrol,
> +		   const unsigned int __user *bytes, unsigned int size);
>  };
>  
>  /* multi register control */
> diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
> index 100d92b..7f53da9 100644
> --- a/sound/soc/soc-ops.c
> +++ b/sound/soc/soc-ops.c
> @@ -751,11 +751,11 @@ int snd_soc_bytes_tlv_callback(struct snd_kcontrol *kcontrol, int op_flag,
>  	switch (op_flag) {
>  	case SNDRV_CTL_TLV_OP_READ:
>  		if (params->get)
> -			ret = params->get(tlv, count);
> +			ret = params->get(kcontrol, tlv, count);
>  		break;
>  	case SNDRV_CTL_TLV_OP_WRITE:
>  		if (params->put)
> -			ret = params->put(tlv, count);
> +			ret = params->put(kcontrol, tlv, count);
>  		break;
>  	}
>  	return ret;
> -- 
> 2.2.0.rc0.207.ga3a616c
> 

-- 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: core: Pass kcontrol pointer to bytes tlv callbacks
  2015-06-03 21:10   ` Ben Zhang
@ 2015-06-12 11:22     ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2015-06-12 11:22 UTC (permalink / raw)
  To: Ben Zhang
  Cc: Omair Mohammed Abdullah, Vinod Koul, Dylan Reid, alsa-devel,
	Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 1327 bytes --]

On Wed, Jun 03, 2015 at 02:10:28PM -0700, Ben Zhang wrote:
> On Wed, Jun 3, 2015 at 4:59 AM, Mark Brown <broonie@kernel.org> wrote:
> > On Tue, Jun 02, 2015 at 03:24:03PM -0700, Ben Zhang wrote:

> >> -     int (*get)(unsigned int __user *bytes, unsigned int size);
> >> -     int (*put)(const unsigned int __user *bytes, unsigned int size);
> >> +     int (*get)(struct snd_kcontrol *kcontrol,
> >> +                unsigned int __user *bytes, unsigned int size);
> >> +     int (*put)(struct snd_kcontrol *kcontrol,
> >> +                const unsigned int __user *bytes, unsigned int size);

> > This doesn't update any users and we do have some like the Haswell PCM
> > driver.

> I couldn't find any existing users of the callbacks. It looks like the
> modified callbacks are used by SND_SOC_BYTES_TLV only, and there is no
> reference to SND_SOC_BYTES_TLV in the kernel.

> The Haswell PCM driver uses SND_SOC_BYTES_EXT which doesn't use the
> callbacks in struct soc_bytes_ext. The xhandler_get/put are assigned
> to snd_kcontrol_new.get/put instead.

This then begs the question why the fix isn't for the TLV version to use
the same callbacks we're currently using?  It's not obvious looking at
the definitions of the controls why we would want them to be using
separate ones and TLV would normally not affect the I/O.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-06-12 11:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-02 22:24 [PATCH] ASoC: core: Pass kcontrol pointer to bytes tlv callbacks Ben Zhang
2015-06-03 11:59 ` Mark Brown
2015-06-03 21:10   ` Ben Zhang
2015-06-12 11:22     ` Mark Brown
2015-06-12  7:30 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox