* [PATCH 0/3] ASoC: remove SND_SOC_BYTES_EXT
@ 2015-11-18 13:39 Vinod Koul
2015-11-18 13:39 ` [PATCH 1/3] ASoC: Intel: Hsw: Move driver to use SND_SOC_BYTES_TLV Vinod Koul
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: Vinod Koul @ 2015-11-18 13:39 UTC (permalink / raw)
To: alsa-devel; +Cc: liam.r.girdwood, patches.audio, broonie, Vinod Koul
The SND_SOC_BYTES_TLV and SND_SOC_BYTES_EXT provide similar functionality,
with only difference that SND_SOC_BYTES_EXT have limitations of 512 bytes
as parameters whereas no such restrictions on SND_SOC_BYTES_TLV
So remove SND_SOC_BYTES_EXT and update users to use SND_SOC_BYTES_TLV
Vinod Koul (3):
ASoC: Intel: Hsw: Move driver to use SND_SOC_BYTES_TLV
ASoC: wm5102: Move driver to use SND_SOC_BYTES_TLV
ASoC: core: remove SND_SOC_BYTES_EXT
include/sound/soc.h | 6 ----
sound/soc/codecs/wm5102.c | 35 ++++++++++++++++------
sound/soc/intel/haswell/sst-haswell-pcm.c | 50 ++++++++++++++++++++++++-------
3 files changed, 66 insertions(+), 25 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/3] ASoC: Intel: Hsw: Move driver to use SND_SOC_BYTES_TLV
2015-11-18 13:39 [PATCH 0/3] ASoC: remove SND_SOC_BYTES_EXT Vinod Koul
@ 2015-11-18 13:39 ` Vinod Koul
2015-11-19 3:22 ` Keyon
2015-11-19 6:56 ` Han Lu
2015-11-18 13:39 ` [PATCH 2/3] ASoC: wm5102: " Vinod Koul
` (2 subsequent siblings)
3 siblings, 2 replies; 12+ messages in thread
From: Vinod Koul @ 2015-11-18 13:39 UTC (permalink / raw)
To: alsa-devel
Cc: patches.audio, Jie Yang, Liam Girdwood, liam.r.girdwood,
Vinod Koul, broonie
Haswell driver was using SND_SOC_BYTES_EXT. Since we want to
remove this, convert it to use SND_SOC_BYTES_TLV
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Cc: Jie Yang <yang.jie@linux.intel.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
---
sound/soc/intel/haswell/sst-haswell-pcm.c | 50 ++++++++++++++++++++++++-------
1 file changed, 40 insertions(+), 10 deletions(-)
diff --git a/sound/soc/intel/haswell/sst-haswell-pcm.c b/sound/soc/intel/haswell/sst-haswell-pcm.c
index 1aa819c7e09b..65594dff291a 100644
--- a/sound/soc/intel/haswell/sst-haswell-pcm.c
+++ b/sound/soc/intel/haswell/sst-haswell-pcm.c
@@ -368,41 +368,71 @@ static int hsw_waves_switch_put(struct snd_kcontrol *kcontrol,
}
static int hsw_waves_param_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
+ unsigned int __user *data, unsigned int size)
{
struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform);
struct sst_hsw *hsw = pdata->hsw;
+ u8 *buffer;
+ int ret;
+
+ buffer = kzalloc(size, GFP_KERNEL);
+ if (!buffer)
+ return -ENOMEM;
/* return a matching line from param buffer */
- return sst_hsw_load_param_line(hsw, ucontrol->value.bytes.data);
+ ret = sst_hsw_load_param_line(hsw, buffer);
+ if (ret)
+ goto err;
+
+ if (copy_to_user(data, buffer, size))
+ ret = -EFAULT;
+
+err:
+ kfree(buffer);
+ return ret;
}
static int hsw_waves_param_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
+ const unsigned int __user *data, unsigned int size)
{
struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform);
struct sst_hsw *hsw = pdata->hsw;
- int ret;
+ int ret = 0;
enum sst_hsw_module_id id = SST_HSW_MODULE_WAVES;
- int param_id = ucontrol->value.bytes.data[0];
+ int param_id;
int param_size = WAVES_PARAM_COUNT;
+ u8 *buffer;
+
+ buffer = kzalloc(size, GFP_KERNEL);
+ if (!buffer)
+ return -ENOMEM;
+
+ if (copy_from_user(buffer, data, size)) {
+ ret = -EFAULT;
+ goto exit;
+ }
+
+ param_id = *buffer;
/* clear param buffer and reset buffer index */
if (param_id == 0xFF) {
sst_hsw_reset_param_buf(hsw);
- return 0;
+ goto exit;
}
/* store params into buffer */
- ret = sst_hsw_store_param_line(hsw, ucontrol->value.bytes.data);
+ ret = sst_hsw_store_param_line(hsw, buffer);
if (ret < 0)
- return ret;
+ goto exit;
if (sst_hsw_is_module_active(hsw, id))
ret = sst_hsw_module_set_param(hsw, id, 0, param_id,
- param_size, ucontrol->value.bytes.data);
+ param_size, buffer);
+
+exit:
+ kfree(buffer);
return ret;
}
@@ -431,7 +461,7 @@ static const struct snd_kcontrol_new hsw_volume_controls[] = {
SOC_SINGLE_BOOL_EXT("Waves Switch", 0,
hsw_waves_switch_get, hsw_waves_switch_put),
/* set parameters to module waves */
- SND_SOC_BYTES_EXT("Waves Set Param", WAVES_PARAM_COUNT,
+ SND_SOC_BYTES_TLV("Waves Set Param", WAVES_PARAM_COUNT,
hsw_waves_param_get, hsw_waves_param_put),
};
--
1.9.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/3] ASoC: wm5102: Move driver to use SND_SOC_BYTES_TLV
2015-11-18 13:39 [PATCH 0/3] ASoC: remove SND_SOC_BYTES_EXT Vinod Koul
2015-11-18 13:39 ` [PATCH 1/3] ASoC: Intel: Hsw: Move driver to use SND_SOC_BYTES_TLV Vinod Koul
@ 2015-11-18 13:39 ` Vinod Koul
2015-11-19 14:22 ` Charles Keepax
[not found] ` <201511182144.8dDI1Wfc%fengguang.wu@intel.com>
2015-11-18 13:39 ` [PATCH 3/3] ASoC: core: remove SND_SOC_BYTES_EXT Vinod Koul
2015-11-18 13:53 ` [PATCH 0/3] ASoC: " Takashi Iwai
3 siblings, 2 replies; 12+ messages in thread
From: Vinod Koul @ 2015-11-18 13:39 UTC (permalink / raw)
To: alsa-devel
Cc: patches.audio, patches, liam.r.girdwood, Vinod Koul, broonie,
Charles Keepax
WM5102 driver was using SND_SOC_BYTES_EXT. Since we want to
remove this, convert it to use SND_SOC_BYTES_TLV
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: patches@opensource.wolfsonmicro.com
---
sound/soc/codecs/wm5102.c | 35 ++++++++++++++++++++++++++---------
1 file changed, 26 insertions(+), 9 deletions(-)
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index 64637d1cf4e5..ac96e7e32fa7 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -657,33 +657,50 @@ static int wm5102_adsp_power_ev(struct snd_soc_dapm_widget *w,
return wm_adsp2_early_event(w, kcontrol, event);
}
+#define WM5102_OUT_COMP_SZ 2
+
static int wm5102_out_comp_coeff_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
+ unsigned int __user *data, unsigned int size)
{
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
+ u16 buff;
+ int ret = 0;
+
+ if (size > WM5102_OUT_COMP_SZ)
+ return -EINVAL;
mutex_lock(&arizona->dac_comp_lock);
- put_unaligned_be16(arizona->dac_comp_coeff,
- ucontrol->value.bytes.data);
+ put_unaligned_be16(arizona->dac_comp_coeff, &buff);
+ if (copy_to_user(data, &buff, sizeof(buff)))
+ ret = -EFAULT;
+
mutex_unlock(&arizona->dac_comp_lock);
- return 0;
+ return ret;
}
static int wm5102_out_comp_coeff_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
+ const unsigned int __user *data, unsigned int size)
{
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
+ int ret = 0;
+
+ if (size > WM5102_OUT_COMP_SZ)
+ return -EINVAL;
mutex_lock(&arizona->dac_comp_lock);
- memcpy(&arizona->dac_comp_coeff, ucontrol->value.bytes.data,
- sizeof(arizona->dac_comp_coeff));
+ if (copy_from_user(&arizona->dac_comp_coeff, data, size)) {
+ ret = -EFAULT;
+ goto exit;
+ }
arizona->dac_comp_coeff = be16_to_cpu(arizona->dac_comp_coeff);
+
+exit:
mutex_unlock(&arizona->dac_comp_lock);
- return 0;
+ return ret;
}
static int wm5102_out_comp_switch_get(struct snd_kcontrol *kcontrol,
@@ -939,7 +956,7 @@ SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL,
ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv),
SOC_ENUM("Noise Gate Hold", arizona_ng_hold),
-SND_SOC_BYTES_EXT("Output Compensation Coefficient", 2,
+SND_SOC_BYTES_TLV("Output Compensation Coefficient", WM5102_OUT_COMP_SZ,
wm5102_out_comp_coeff_get, wm5102_out_comp_coeff_put),
SOC_SINGLE_EXT("Output Compensation Switch", 0, 0, 1, 0,
--
1.9.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/3] ASoC: core: remove SND_SOC_BYTES_EXT
2015-11-18 13:39 [PATCH 0/3] ASoC: remove SND_SOC_BYTES_EXT Vinod Koul
2015-11-18 13:39 ` [PATCH 1/3] ASoC: Intel: Hsw: Move driver to use SND_SOC_BYTES_TLV Vinod Koul
2015-11-18 13:39 ` [PATCH 2/3] ASoC: wm5102: " Vinod Koul
@ 2015-11-18 13:39 ` Vinod Koul
2015-11-18 13:53 ` [PATCH 0/3] ASoC: " Takashi Iwai
3 siblings, 0 replies; 12+ messages in thread
From: Vinod Koul @ 2015-11-18 13:39 UTC (permalink / raw)
To: alsa-devel; +Cc: liam.r.girdwood, patches.audio, broonie, Vinod Koul
Now all users are converted, remove the SND_SOC_BYTES_EXT
New users should use SND_SOC_BYTES_TLV
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
include/sound/soc.h | 6 ------
1 file changed, 6 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index e09673dbae1b..10607aa29b48 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -293,12 +293,6 @@
{.base = xbase, .num_regs = xregs, \
.mask = xmask }) }
-#define SND_SOC_BYTES_EXT(xname, xcount, xhandler_get, xhandler_put) \
-{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
- .info = snd_soc_bytes_info_ext, \
- .get = xhandler_get, .put = xhandler_put, \
- .private_value = (unsigned long)&(struct soc_bytes_ext) \
- {.max = xcount} }
#define SND_SOC_BYTES_TLV(xname, xcount, xhandler_get, xhandler_put) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE | \
--
1.9.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 0/3] ASoC: remove SND_SOC_BYTES_EXT
2015-11-18 13:39 [PATCH 0/3] ASoC: remove SND_SOC_BYTES_EXT Vinod Koul
` (2 preceding siblings ...)
2015-11-18 13:39 ` [PATCH 3/3] ASoC: core: remove SND_SOC_BYTES_EXT Vinod Koul
@ 2015-11-18 13:53 ` Takashi Iwai
2015-11-18 18:19 ` Vinod Koul
3 siblings, 1 reply; 12+ messages in thread
From: Takashi Iwai @ 2015-11-18 13:53 UTC (permalink / raw)
To: Vinod Koul; +Cc: liam.r.girdwood, patches.audio, alsa-devel, broonie
On Wed, 18 Nov 2015 14:39:09 +0100,
Vinod Koul wrote:
>
> The SND_SOC_BYTES_TLV and SND_SOC_BYTES_EXT provide similar functionality,
> with only difference that SND_SOC_BYTES_EXT have limitations of 512 bytes
> as parameters whereas no such restrictions on SND_SOC_BYTES_TLV
>
> So remove SND_SOC_BYTES_EXT and update users to use SND_SOC_BYTES_TLV
Hmm, won't this break user-space? Both use the difference access
methods, so I wonder how they can be kept compatible.
thanks,
Takashi
>
> Vinod Koul (3):
> ASoC: Intel: Hsw: Move driver to use SND_SOC_BYTES_TLV
> ASoC: wm5102: Move driver to use SND_SOC_BYTES_TLV
> ASoC: core: remove SND_SOC_BYTES_EXT
>
> include/sound/soc.h | 6 ----
> sound/soc/codecs/wm5102.c | 35 ++++++++++++++++------
> sound/soc/intel/haswell/sst-haswell-pcm.c | 50 ++++++++++++++++++++++++-------
> 3 files changed, 66 insertions(+), 25 deletions(-)
>
> --
> 1.9.1
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/3] ASoC: remove SND_SOC_BYTES_EXT
2015-11-18 13:53 ` [PATCH 0/3] ASoC: " Takashi Iwai
@ 2015-11-18 18:19 ` Vinod Koul
2015-11-21 14:08 ` Mark Brown
0 siblings, 1 reply; 12+ messages in thread
From: Vinod Koul @ 2015-11-18 18:19 UTC (permalink / raw)
To: Takashi Iwai; +Cc: liam.r.girdwood, patches.audio, alsa-devel, broonie
On Wed, Nov 18, 2015 at 02:53:23PM +0100, Takashi Iwai wrote:
> On Wed, 18 Nov 2015 14:39:09 +0100,
> Vinod Koul wrote:
> >
> > The SND_SOC_BYTES_TLV and SND_SOC_BYTES_EXT provide similar functionality,
> > with only difference that SND_SOC_BYTES_EXT have limitations of 512 bytes
> > as parameters whereas no such restrictions on SND_SOC_BYTES_TLV
> >
> > So remove SND_SOC_BYTES_EXT and update users to use SND_SOC_BYTES_TLV
>
> Hmm, won't this break user-space? Both use the difference access
> methods, so I wonder how they can be kept compatible.
Yes they will, so should we then keep these and mark SND_SOC_BYTES_EXT
depricated ..?
Mark what should we do with these
--
~Vinod
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] ASoC: Intel: Hsw: Move driver to use SND_SOC_BYTES_TLV
2015-11-18 13:39 ` [PATCH 1/3] ASoC: Intel: Hsw: Move driver to use SND_SOC_BYTES_TLV Vinod Koul
@ 2015-11-19 3:22 ` Keyon
2015-11-19 6:56 ` Han Lu
1 sibling, 0 replies; 12+ messages in thread
From: Keyon @ 2015-11-19 3:22 UTC (permalink / raw)
To: Vinod Koul, alsa-devel
Cc: patches.audio, liam.r.girdwood, broonie, Liam Girdwood
+ Han who is the author of this part.
On 2015年11月18日 21:39, Vinod Koul wrote:
> Haswell driver was using SND_SOC_BYTES_EXT. Since we want to
> remove this, convert it to use SND_SOC_BYTES_TLV
>
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> Cc: Jie Yang <yang.jie@linux.intel.com>
> Cc: Liam Girdwood <lgirdwood@gmail.com>
looks fine for me, but let's wait Han's confirmation about it.
thanks,
~Keyon
> ---
> sound/soc/intel/haswell/sst-haswell-pcm.c | 50 ++++++++++++++++++++++++-------
> 1 file changed, 40 insertions(+), 10 deletions(-)
>
> diff --git a/sound/soc/intel/haswell/sst-haswell-pcm.c b/sound/soc/intel/haswell/sst-haswell-pcm.c
> index 1aa819c7e09b..65594dff291a 100644
> --- a/sound/soc/intel/haswell/sst-haswell-pcm.c
> +++ b/sound/soc/intel/haswell/sst-haswell-pcm.c
> @@ -368,41 +368,71 @@ static int hsw_waves_switch_put(struct snd_kcontrol *kcontrol,
> }
>
> static int hsw_waves_param_get(struct snd_kcontrol *kcontrol,
> - struct snd_ctl_elem_value *ucontrol)
> + unsigned int __user *data, unsigned int size)
> {
> struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
> struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform);
> struct sst_hsw *hsw = pdata->hsw;
> + u8 *buffer;
> + int ret;
> +
> + buffer = kzalloc(size, GFP_KERNEL);
> + if (!buffer)
> + return -ENOMEM;
>
> /* return a matching line from param buffer */
> - return sst_hsw_load_param_line(hsw, ucontrol->value.bytes.data);
> + ret = sst_hsw_load_param_line(hsw, buffer);
> + if (ret)
> + goto err;
> +
> + if (copy_to_user(data, buffer, size))
> + ret = -EFAULT;
> +
> +err:
> + kfree(buffer);
> + return ret;
> }
>
> static int hsw_waves_param_put(struct snd_kcontrol *kcontrol,
> - struct snd_ctl_elem_value *ucontrol)
> + const unsigned int __user *data, unsigned int size)
> {
> struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
> struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform);
> struct sst_hsw *hsw = pdata->hsw;
> - int ret;
> + int ret = 0;
> enum sst_hsw_module_id id = SST_HSW_MODULE_WAVES;
> - int param_id = ucontrol->value.bytes.data[0];
> + int param_id;
> int param_size = WAVES_PARAM_COUNT;
> + u8 *buffer;
> +
> + buffer = kzalloc(size, GFP_KERNEL);
> + if (!buffer)
> + return -ENOMEM;
> +
> + if (copy_from_user(buffer, data, size)) {
> + ret = -EFAULT;
> + goto exit;
> + }
> +
> + param_id = *buffer;
>
> /* clear param buffer and reset buffer index */
> if (param_id == 0xFF) {
> sst_hsw_reset_param_buf(hsw);
> - return 0;
> + goto exit;
> }
>
> /* store params into buffer */
> - ret = sst_hsw_store_param_line(hsw, ucontrol->value.bytes.data);
> + ret = sst_hsw_store_param_line(hsw, buffer);
> if (ret < 0)
> - return ret;
> + goto exit;
>
> if (sst_hsw_is_module_active(hsw, id))
> ret = sst_hsw_module_set_param(hsw, id, 0, param_id,
> - param_size, ucontrol->value.bytes.data);
> + param_size, buffer);
> +
> +exit:
> + kfree(buffer);
> return ret;
> }
>
> @@ -431,7 +461,7 @@ static const struct snd_kcontrol_new hsw_volume_controls[] = {
> SOC_SINGLE_BOOL_EXT("Waves Switch", 0,
> hsw_waves_switch_get, hsw_waves_switch_put),
> /* set parameters to module waves */
> - SND_SOC_BYTES_EXT("Waves Set Param", WAVES_PARAM_COUNT,
> + SND_SOC_BYTES_TLV("Waves Set Param", WAVES_PARAM_COUNT,
> hsw_waves_param_get, hsw_waves_param_put),
> };
>
>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] ASoC: Intel: Hsw: Move driver to use SND_SOC_BYTES_TLV
2015-11-18 13:39 ` [PATCH 1/3] ASoC: Intel: Hsw: Move driver to use SND_SOC_BYTES_TLV Vinod Koul
2015-11-19 3:22 ` Keyon
@ 2015-11-19 6:56 ` Han Lu
1 sibling, 0 replies; 12+ messages in thread
From: Han Lu @ 2015-11-19 6:56 UTC (permalink / raw)
To: Vinod Koul, alsa-devel
Cc: patches.audio, liam.r.girdwood, broonie, Jie Yang, Liam Girdwood
There was no special reason for me to use SND_SOC_BYTES_EXT here. But
will this patch
influences user space, since the parameter list of hsw_waves_param_get()
be modified?
Regards,
Han Lu
On 11/18/2015 09:39 PM, Vinod Koul wrote:
> Haswell driver was using SND_SOC_BYTES_EXT. Since we want to
> remove this, convert it to use SND_SOC_BYTES_TLV
>
> Signed-off-by: Vinod Koul<vinod.koul@intel.com>
> Cc: Jie Yang<yang.jie@linux.intel.com>
> Cc: Liam Girdwood<lgirdwood@gmail.com>
> ---
> sound/soc/intel/haswell/sst-haswell-pcm.c | 50 ++++++++++++++++++++++++-------
> 1 file changed, 40 insertions(+), 10 deletions(-)
>
> diff --git a/sound/soc/intel/haswell/sst-haswell-pcm.c b/sound/soc/intel/haswell/sst-haswell-pcm.c
> index 1aa819c7e09b..65594dff291a 100644
> --- a/sound/soc/intel/haswell/sst-haswell-pcm.c
> +++ b/sound/soc/intel/haswell/sst-haswell-pcm.c
> @@ -368,41 +368,71 @@ static int hsw_waves_switch_put(struct snd_kcontrol *kcontrol,
> }
>
> static int hsw_waves_param_get(struct snd_kcontrol *kcontrol,
> - struct snd_ctl_elem_value *ucontrol)
> + unsigned int __user *data, unsigned int size)
> {
> struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
> struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform);
> struct sst_hsw *hsw = pdata->hsw;
> + u8 *buffer;
> + int ret;
> +
> + buffer = kzalloc(size, GFP_KERNEL);
> + if (!buffer)
> + return -ENOMEM;
>
> /* return a matching line from param buffer */
> - return sst_hsw_load_param_line(hsw, ucontrol->value.bytes.data);
> + ret = sst_hsw_load_param_line(hsw, buffer);
> + if (ret)
> + goto err;
> +
> + if (copy_to_user(data, buffer, size))
> + ret = -EFAULT;
> +
> +err:
> + kfree(buffer);
> + return ret;
> }
>
> static int hsw_waves_param_put(struct snd_kcontrol *kcontrol,
> - struct snd_ctl_elem_value *ucontrol)
> + const unsigned int __user *data, unsigned int size)
> {
> struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
> struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform);
> struct sst_hsw *hsw = pdata->hsw;
> - int ret;
> + int ret = 0;
> enum sst_hsw_module_id id = SST_HSW_MODULE_WAVES;
> - int param_id = ucontrol->value.bytes.data[0];
> + int param_id;
> int param_size = WAVES_PARAM_COUNT;
> + u8 *buffer;
> +
> + buffer = kzalloc(size, GFP_KERNEL);
> + if (!buffer)
> + return -ENOMEM;
> +
> + if (copy_from_user(buffer, data, size)) {
> + ret = -EFAULT;
> + goto exit;
> + }
> +
> + param_id = *buffer;
>
> /* clear param buffer and reset buffer index */
> if (param_id == 0xFF) {
> sst_hsw_reset_param_buf(hsw);
> - return 0;
> + goto exit;
> }
>
> /* store params into buffer */
> - ret = sst_hsw_store_param_line(hsw, ucontrol->value.bytes.data);
> + ret = sst_hsw_store_param_line(hsw, buffer);
> if (ret < 0)
> - return ret;
> + goto exit;
>
> if (sst_hsw_is_module_active(hsw, id))
> ret = sst_hsw_module_set_param(hsw, id, 0, param_id,
> - param_size, ucontrol->value.bytes.data);
> + param_size, buffer);
> +
> +exit:
> + kfree(buffer);
> return ret;
> }
>
> @@ -431,7 +461,7 @@ static const struct snd_kcontrol_new hsw_volume_controls[] = {
> SOC_SINGLE_BOOL_EXT("Waves Switch", 0,
> hsw_waves_switch_get, hsw_waves_switch_put),
> /* set parameters to module waves */
> - SND_SOC_BYTES_EXT("Waves Set Param", WAVES_PARAM_COUNT,
> + SND_SOC_BYTES_TLV("Waves Set Param", WAVES_PARAM_COUNT,
> hsw_waves_param_get, hsw_waves_param_put),
> };
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] ASoC: wm5102: Move driver to use SND_SOC_BYTES_TLV
2015-11-18 13:39 ` [PATCH 2/3] ASoC: wm5102: " Vinod Koul
@ 2015-11-19 14:22 ` Charles Keepax
[not found] ` <201511182144.8dDI1Wfc%fengguang.wu@intel.com>
1 sibling, 0 replies; 12+ messages in thread
From: Charles Keepax @ 2015-11-19 14:22 UTC (permalink / raw)
To: Vinod Koul; +Cc: patches.audio, liam.r.girdwood, alsa-devel, patches, broonie
On Wed, Nov 18, 2015 at 07:09:11PM +0530, Vinod Koul wrote:
> WM5102 driver was using SND_SOC_BYTES_EXT. Since we want to
> remove this, convert it to use SND_SOC_BYTES_TLV
>
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> Cc: patches@opensource.wolfsonmicro.com
> ---
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Looks good to me, I think the TLV byte control stuff has been
merged in tinyalsa now so no problems there.
Thanks,
Charles
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] ASoC: wm5102: Move driver to use SND_SOC_BYTES_TLV
[not found] ` <201511182144.8dDI1Wfc%fengguang.wu@intel.com>
@ 2015-11-20 17:07 ` Vinod Koul
0 siblings, 0 replies; 12+ messages in thread
From: Vinod Koul @ 2015-11-20 17:07 UTC (permalink / raw)
To: kbuild test robot
Cc: alsa-devel, patches.audio, patches, liam.r.girdwood, broonie,
kbuild-all, Charles Keepax
On Wed, Nov 18, 2015 at 09:52:17PM +0800, kbuild test robot wrote:
> Hi Vinod,
>
> [auto build test WARNING on: asoc/for-next]
> [also build test WARNING on: v4.4-rc1 next-20151118]
>
> url: https://github.com/0day-ci/linux/commits/Vinod-Koul/ASoC-remove-SND_SOC_BYTES_EXT/20151118-214039
> base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
> config: tile-allyesconfig (attached as .config)
> reproduce:
> wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=tile
>
> All warnings (new ones prefixed by >>):
These are false warns as the dependent TLV kcontrol change was merged same
day by Mark, but not picked by bot for this build.
Similar note on HSW patch too
--
~Vinod
>
> >> sound/soc/codecs/wm5102.c:959:1: warning: initialization from incompatible pointer type [enabled by default]
> sound/soc/codecs/wm5102.c:959:1: warning: (near initialization for '(anonymous).get') [enabled by default]
> >> sound/soc/codecs/wm5102.c:959:1: warning: initialization from incompatible pointer type [enabled by default]
> sound/soc/codecs/wm5102.c:959:1: warning: (near initialization for '(anonymous).put') [enabled by default]
>
> vim +959 sound/soc/codecs/wm5102.c
>
> 943
> 944 SOC_SINGLE("DRE Low Level ABS", ARIZONA_DRE_CONTROL_3,
> 945 ARIZONA_DRE_LOW_LEVEL_ABS_SHIFT, 15, 0),
> 946
> 947 SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp),
> 948 SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp),
> 949
> 950 SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT,
> 951 ARIZONA_SPK1R_MUTE_SHIFT, 1, 1),
> 952
> 953 SOC_SINGLE("Noise Gate Switch", ARIZONA_NOISE_GATE_CONTROL,
> 954 ARIZONA_NGATE_ENA_SHIFT, 1, 0),
> 955 SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL,
> 956 ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv),
> 957 SOC_ENUM("Noise Gate Hold", arizona_ng_hold),
> 958
> > 959 SND_SOC_BYTES_TLV("Output Compensation Coefficient", WM5102_OUT_COMP_SZ,
> 960 wm5102_out_comp_coeff_get, wm5102_out_comp_coeff_put),
> 961
> 962 SOC_SINGLE_EXT("Output Compensation Switch", 0, 0, 1, 0,
> 963 wm5102_out_comp_switch_get, wm5102_out_comp_switch_put),
> 964
> 965 WM5102_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L),
> 966 WM5102_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R),
> 967 WM5102_NG_SRC("HPOUT2L", ARIZONA_NOISE_GATE_SELECT_2L),
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/3] ASoC: remove SND_SOC_BYTES_EXT
2015-11-18 18:19 ` Vinod Koul
@ 2015-11-21 14:08 ` Mark Brown
2015-11-22 16:17 ` Vinod Koul
0 siblings, 1 reply; 12+ messages in thread
From: Mark Brown @ 2015-11-21 14:08 UTC (permalink / raw)
To: Vinod Koul; +Cc: Takashi Iwai, liam.r.girdwood, alsa-devel, patches.audio
[-- Attachment #1.1: Type: text/plain, Size: 426 bytes --]
On Wed, Nov 18, 2015 at 11:49:53PM +0530, Vinod Koul wrote:
> On Wed, Nov 18, 2015 at 02:53:23PM +0100, Takashi Iwai wrote:
> > Hmm, won't this break user-space? Both use the difference access
> > methods, so I wonder how they can be kept compatible.
> Yes they will, so should we then keep these and mark SND_SOC_BYTES_EXT
> depricated ..?
> Mark what should we do with these
Yes, that seems like a reasonable approach.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/3] ASoC: remove SND_SOC_BYTES_EXT
2015-11-21 14:08 ` Mark Brown
@ 2015-11-22 16:17 ` Vinod Koul
0 siblings, 0 replies; 12+ messages in thread
From: Vinod Koul @ 2015-11-22 16:17 UTC (permalink / raw)
To: Mark Brown; +Cc: Takashi Iwai, liam.r.girdwood, alsa-devel, patches.audio
[-- Attachment #1.1: Type: text/plain, Size: 620 bytes --]
On Sat, Nov 21, 2015 at 02:08:28PM +0000, Mark Brown wrote:
> On Wed, Nov 18, 2015 at 11:49:53PM +0530, Vinod Koul wrote:
> > On Wed, Nov 18, 2015 at 02:53:23PM +0100, Takashi Iwai wrote:
>
> > > Hmm, won't this break user-space? Both use the difference access
> > > methods, so I wonder how they can be kept compatible.
>
> > Yes they will, so should we then keep these and mark SND_SOC_BYTES_EXT
> > depricated ..?
>
> > Mark what should we do with these
>
> Yes, that seems like a reasonable approach.
Okay I will send a patch which add comment about this being deprecated
Thanks
--
~Vinod
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-11-22 16:13 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-18 13:39 [PATCH 0/3] ASoC: remove SND_SOC_BYTES_EXT Vinod Koul
2015-11-18 13:39 ` [PATCH 1/3] ASoC: Intel: Hsw: Move driver to use SND_SOC_BYTES_TLV Vinod Koul
2015-11-19 3:22 ` Keyon
2015-11-19 6:56 ` Han Lu
2015-11-18 13:39 ` [PATCH 2/3] ASoC: wm5102: " Vinod Koul
2015-11-19 14:22 ` Charles Keepax
[not found] ` <201511182144.8dDI1Wfc%fengguang.wu@intel.com>
2015-11-20 17:07 ` Vinod Koul
2015-11-18 13:39 ` [PATCH 3/3] ASoC: core: remove SND_SOC_BYTES_EXT Vinod Koul
2015-11-18 13:53 ` [PATCH 0/3] ASoC: " Takashi Iwai
2015-11-18 18:19 ` Vinod Koul
2015-11-21 14:08 ` Mark Brown
2015-11-22 16:17 ` Vinod Koul
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.