ASoC: Allow 32bits registers
PATCH 1/1 ASoC: Allow 32bits registers
Replace the remaining unsigned shorts with unsigned ints. Tested with pcap2 codec (25 bits registers).
--- include/sound/soc.h | 4 ++-- sound/soc/soc-core.c | 28 ++++++++++++++-------------- sound/soc/soc-dapm.c | 16 ++++++++-------- 3 files changed, 24 insertions(+), 24 deletions(-)
include/sound/soc.h +2 -2
@@ -212,9 +212,9 @@ void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,/* codec register bit access */ int snd_soc_update_bits (struct snd_soc_codec *codec,unsigned short reg, -unsigned short mask,unsigned short value); +unsigned int mask,unsigned int value);int snd_soc_test_bits (struct snd_soc_codec *codec,unsigned short reg, -unsigned short mask,unsigned short value); +unsigned int mask,unsigned int value);int snd_soc_new_ac97_codec (struct snd_soc_codec *codec,struct snd_ac97_bus_ops *ops,int num);
sound/soc/soc-core.c +14 -14
@@ -1262,10 +1262,10 @@ EXPORT_SYMBOL_GPL(snd_soc_free_ac97_codec);* Returns 1 for change else 0. */ int snd_soc_update_bits (struct snd_soc_codec *codec,unsigned short reg, -unsigned short mask,unsigned short value) +unsigned int mask,unsigned int value) {int change; -unsigned short old, new; +unsigned int old, new;mutex_lock (&io_mutex); old =snd_soc_read (codec, reg);
@@ -1292,10 +1292,10 @@ EXPORT_SYMBOL_GPL(snd_soc_update_bits);* Returns 1 for change else 0. */ int snd_soc_test_bits (struct snd_soc_codec *codec,unsigned short reg, -unsigned short mask,unsigned short value) +unsigned int mask,unsigned int value) {int change; -unsigned short old, new; +unsigned int old, new;mutex_lock (&io_mutex); old =snd_soc_read (codec, reg);
@@ -1580,7 +1580,7 @@ int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol, {struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol);struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; -unsigned short val, bitmask; +unsigned int val, bitmask;for (bitmask =1 ; bitmask < e->max; bitmask <<=1 ) ;
@@ -1609,8 +1609,8 @@ int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol, {struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol);struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; -unsigned short val; -unsigned short mask, bitmask; +unsigned int val; +unsigned int mask, bitmask;for (bitmask =1 ; bitmask < e->max; bitmask <<=1 ) ;
@@ -1646,7 +1646,7 @@ int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol, {struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol);struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; -unsigned short reg_val, val, mux; +unsigned int reg_val, val, mux; reg_val =snd_soc_read (codec, e->reg); val = (reg_val >> e->shift_l) & e->mask;
@@ -1685,8 +1685,8 @@ int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol, {struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol);struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; -unsigned short val; -unsigned short mask; +unsigned int val; +unsigned int mask;if (ucontrol->value.enumerated.item[0 ] > e->max -1 )return -EINVAL ;
@@ -1846,7 +1846,7 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,int max = mc->max;unsigned int mask = (1 <<fls (max)) -1 ;unsigned int invert = mc->invert; -unsigned short val, val2, val_mask; +unsigned int val, val2, val_mask; val = (ucontrol->value.integer.value[0 ] & mask);if (invert)
@@ -1912,7 +1912,7 @@ int snd_soc_get_volsw_2r(struct snd_kcontrol *kcontrol,unsigned int reg2 = mc->rreg;unsigned int shift = mc->shift;int max = mc->max; -unsigned int mask = (1 <<fls (max))-1 ; +unsigned int mask = (1 <<fls (max)) -1 ;unsigned int invert = mc->invert; ucontrol->value.integer.value[0] =
@@ -1952,7 +1952,7 @@ int snd_soc_put_volsw_2r(struct snd_kcontrol *kcontrol,unsigned int mask = (1 <<fls (max)) -1 ;unsigned int invert = mc->invert;int err; -unsigned short val, val2, val_mask; +unsigned int val, val2, val_mask; val_mask = mask << shift; val = (ucontrol->value.integer.value[0 ] & mask);
@@ -2044,7 +2044,7 @@ int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol);unsigned int reg = mc->reg;int min = mc->min; -unsigned short val; +unsigned int val; val = (ucontrol->value.integer.value[0 ]+min) &0xff ; val |= ((ucontrol->value.integer.value[1 ]+min) &0xff ) <<8 ;
sound/soc/soc-dapm.c +8 -8
@@ -227,7 +227,7 @@ static int dapm_connect_mixer(struct snd_soc_codec *codec,static int dapm_update_bits (struct snd_soc_dapm_widget *widget) {int change, power; -unsigned short old, new; +unsigned int old, new;struct snd_soc_codec *codec = widget->codec;/* check for valid widgets */
@@ -1205,7 +1205,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,int max = mc->max;unsigned int mask = (1 <<fls (max)) -1 ;unsigned int invert = mc->invert; -unsigned short val, val2, val_mask; +unsigned int val, val2, val_mask;int ret; val = (ucontrol->value.integer.value[0 ] & mask);
@@ -1269,7 +1269,7 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol, {struct snd_soc_dapm_widget *widget =snd_kcontrol_chip (kcontrol);struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; -unsigned short val, bitmask; +unsigned int val, bitmask;for (bitmask =1 ; bitmask < e->max; bitmask <<=1 ) ;
@@ -1297,8 +1297,8 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, {struct snd_soc_dapm_widget *widget =snd_kcontrol_chip (kcontrol);struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; -unsigned short val, mux; -unsigned short mask, bitmask; +unsigned int val, mux; +unsigned int mask, bitmask;int ret =0 ;for (bitmask =1 ; bitmask < e->max; bitmask <<=1 )
@@ -1356,7 +1356,7 @@ int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol, {struct snd_soc_dapm_widget *widget =snd_kcontrol_chip (kcontrol);struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; -unsigned short reg_val, val, mux; +unsigned int reg_val, val, mux; reg_val =snd_soc_read (widget->codec, e->reg); val = (reg_val >> e->shift_l) & e->mask;
@@ -1396,8 +1396,8 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, {struct snd_soc_dapm_widget *widget =snd_kcontrol_chip (kcontrol);struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; -unsigned short val, mux; -unsigned short mask; +unsigned int val, mux; +unsigned int mask;int ret =0 ;if (ucontrol->value.enumerated.item[0 ] > e->max -1 )
Signature · 4 lines
tg: (81ee1ba..) asoc/allow-32bits-registers (depends on: master) -- Daniel Ribeiro
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 4 lines · Daniel Ribeiro
Replace the remaining unsigned shorts with unsigned ints. Tested with pcap2 codec (25 bits registers).
Signed-off-by Daniel Ribeiro <[email protected]>
Thanks, I've applied this. Given that the merge window is *very* close and this is a fairly high risk change (in that it could affect a lot of drivers) I've created a for-2.6.32 branch and applied it there. I think the change is perfectly safe but I'd rather be cautious.
BTW, there was one unrelated coding style change in there.
Em Seg, 2009-06-08 às 10:50 +0100, Mark Brown escreveu:
Quoted 10 lines · Daniel Ribeiro
Quoted 4 lines
Replace the remaining unsigned shorts with unsigned ints. Tested with pcap2 codec (25 bits registers).
Signed-off-by Daniel Ribeiro <[email protected]>Thanks, I've applied this. Given that the merge window is *very* close and this is a fairly high risk change (in that it could affect a lot of drivers) I've created a for-2.6.32 branch and applied it there. I think the change is perfectly safe but I'd rather be cautious.
ACK. And no driver on mainline needs >16bits at the moment...
Quoted 1 line
BTW, there was one unrelated coding style change in there.
Oops, sorry. My 'vim' highlights most coding style mistakes, I changed it without noticing.
Signature · 1 line
Daniel Ribeiro
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel