ASoC: remove SND_SOC_BYTES_EXT
Subsystems (4)
cover ASoC: remove SND_SOC_BYTES_EXT
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(-)
Signature · 1 line
1.9.1
PATCH 1/3 ASoC: Intel: Hsw: Move driver to use SND_SOC_BYTES_TLV
Haswell driver was using SND_SOC_BYTES_EXT. Since we want to remove this, convert it to use SND_SOC_BYTES_TLV
--- sound/soc/intel/haswell/sst-haswell-pcm.c | 50 ++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 10 deletions(-)
sound/soc/intel/haswell/sst-haswell-pcm.c +40 -10
@@ -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), };
Signature · 1 line
1.9.1
Re: [PATCH 1/3] ASoC: Intel: Hsw: Move driver to use SND_SOC_BYTES_TLV
+ Han who is the author of this part.
Quoted 6 lines · Vinod Koul
Haswell driver was using
SND_SOC_BYTES_EXT. Since we want to remove this, convert it to useSND_SOC_BYTES_TLVSigned-off-by Vinod Koul <[email protected]>Cc Jie Yang <[email protected]>Cc Liam Girdwood <[email protected]>
looks fine for me, but let's wait Han's confirmation about it.
thanks,
~Keyon
Quoted 91 lines
--- sound/soc/intel/haswell/sst-haswell-pcm.c | 50 ++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 10 deletions(-)sound/soc/intel/haswell/sst-haswell-pcm.c +39
-9@@ -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; }
sound/soc/intel/haswell/sst-haswell-pcm.c static const struct snd_kcontrol_new hsw_volume_controls[] = { · line 467
Quoted 8 lines
sound/soc/intel/haswell/sst-haswell-pcm.c +1
-1@@ -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
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 1/3] ASoC: Intel: Hsw: Move driver to use SND_SOC_BYTES_TLV
In reply to Vinod KoulThere 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
Quoted 104 lines · Vinod Koul
Haswell driver was using
SND_SOC_BYTES_EXT. Since we want to remove this, convert it to useSND_SOC_BYTES_TLVSigned-off-by Vinod Koul<[email protected]>Cc Jie Yang<[email protected]>Cc Liam Girdwood<[email protected]>--- sound/soc/intel/haswell/sst-haswell-pcm.c | 50 ++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 10 deletions(-)sound/soc/intel/haswell/sst-haswell-pcm.c +40
-10@@ -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), };
PATCH 2/3 ASoC: wm5102: Move driver to use SND_SOC_BYTES_TLV
In reply to Vinod KoulWM5102 driver was using SND_SOC_BYTES_EXT. Since we want to remove this, convert it to use SND_SOC_BYTES_TLV
--- sound/soc/codecs/wm5102.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-)
sound/soc/codecs/wm5102.c +26 -9
@@ -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,
Signature · 1 line
1.9.1
Re: [PATCH 2/3] ASoC: wm5102: Move driver to use SND_SOC_BYTES_TLV
Quoted 7 lines · Vinod Koul
WM5102 driver was using
SND_SOC_BYTES_EXT. Since we want to remove this, convert it to useSND_SOC_BYTES_TLVSigned-off-by Vinod Koul <[email protected]>Cc Charles Keepax <[email protected]>---
Looks good to me, I think the TLV byte control stuff has been merged in tinyalsa now so no problems there.
Thanks,
Charles
A message that is not in the archive (sent off-list or not yet received): 201511182144.8dDI1Wfc%[email protected]
Re: [PATCH 2/3] ASoC: wm5102: Move driver to use SND_SOC_BYTES_TLV
Quoted 8 lines · kbuild test robot
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)
Quoted 7 lines
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=tileAll 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
Signature · 1 line
~Vinod
Quoted 37 lines
Quoted 2 lines
Quoted 2 lines
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]Quoted 1 line
Quoted 1 line
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.c943 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), 958Quoted 1 line
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,
963wm5102_out_comp_switch_get,wm5102_out_comp_switch_put),
964
965WM5102_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L),
966WM5102_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R),
967WM5102_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
PATCH 3/3 ASoC: core: remove SND_SOC_BYTES_EXT
In reply to Vinod KoulNow all users are converted, remove the SND_SOC_BYTES_EXT New users should use SND_SOC_BYTES_TLV
--- include/sound/soc.h | 6 ------ 1 file changed, 6 deletions(-)
include/sound/soc.h +0 -6
@@ -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 | \
Signature · 1 line
1.9.1
Quoted 6 lines · Vinod Koul
The
SND_SOC_BYTES_TLVandSND_SOC_BYTES_EXTprovide similar functionality, with only difference thatSND_SOC_BYTES_EXThave limitations of 512 bytes as parameters whereas no such restrictions onSND_SOC_BYTES_TLVSo remove
SND_SOC_BYTES_EXTand update users to useSND_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
Quoted 19 lines
Vinod Koul (3):
ASoC: Intel: Hsw: Move driver to useSND_SOC_BYTES_TLV
ASoC: wm5102: Move driver to useSND_SOC_BYTES_TLV
ASoC: core: removeSND_SOC_BYTES_EXTinclude/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(-)Signature · 6 lines
1.9.1 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 11 lines · Takashi Iwai
Quoted 6 lines · Vinod Koul
The
SND_SOC_BYTES_TLVandSND_SOC_BYTES_EXTprovide similar functionality, with only difference thatSND_SOC_BYTES_EXThave limitations of 512 bytes as parameters whereas no such restrictions onSND_SOC_BYTES_TLVSo remove
SND_SOC_BYTES_EXTand update users to useSND_SOC_BYTES_TLVHmm, 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
Signature · 1 line
~Vinod
Mark Brown
maintainerQuoted 9 lines · Vinod Koul
Quoted 2 lines · Takashi Iwai
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_EXTdepricated ..?Mark what should we do with these
Yes, that seems like a reasonable approach.
Quoted 6 lines · Mark Brown
Quoted 4 lines · Vinod Koul
Quoted 2 lines · Takashi Iwai
Hmm, won't this break user-space? Both use the difference access methods, so I wonder how they can be kept compatible.
Quoted 6 lines
Quoted 4 lines
Yes they will, so should we then keep these and mark
SND_SOC_BYTES_EXTdepricated ..?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
Signature · 1 line
~Vinod