diff options
author | Daniel Ribeiro <drwyrm@gmail.com> | 2009-06-07 01:49:11 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-06-08 05:53:12 -0400 |
commit | 46f5822f7841697d4aedaf4672661d7a765172cd (patch) | |
tree | 3812a50996393f069ea22329562d3ae53b78d590 /sound | |
parent | 74b8f955a73d20b1e22403fd1ef85834fbf38d98 (diff) |
ASoC: Allow 32 bit registers for DAPM
Replace the remaining unsigned shorts with unsigned ints.
Tested with pcap2 codec (25 bits registers).
Signed-off-by: Daniel Ribeiro <drwyrm@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-core.c | 28 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 16 |
2 files changed, 22 insertions, 22 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 3f44150d8e30..e1a920cd8953 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1264,10 +1264,10 @@ EXPORT_SYMBOL_GPL(snd_soc_free_ac97_codec); | |||
1264 | * Returns 1 for change else 0. | 1264 | * Returns 1 for change else 0. |
1265 | */ | 1265 | */ |
1266 | int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg, | 1266 | int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg, |
1267 | unsigned short mask, unsigned short value) | 1267 | unsigned int mask, unsigned int value) |
1268 | { | 1268 | { |
1269 | int change; | 1269 | int change; |
1270 | unsigned short old, new; | 1270 | unsigned int old, new; |
1271 | 1271 | ||
1272 | mutex_lock(&io_mutex); | 1272 | mutex_lock(&io_mutex); |
1273 | old = snd_soc_read(codec, reg); | 1273 | old = snd_soc_read(codec, reg); |
@@ -1294,10 +1294,10 @@ EXPORT_SYMBOL_GPL(snd_soc_update_bits); | |||
1294 | * Returns 1 for change else 0. | 1294 | * Returns 1 for change else 0. |
1295 | */ | 1295 | */ |
1296 | int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg, | 1296 | int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg, |
1297 | unsigned short mask, unsigned short value) | 1297 | unsigned int mask, unsigned int value) |
1298 | { | 1298 | { |
1299 | int change; | 1299 | int change; |
1300 | unsigned short old, new; | 1300 | unsigned int old, new; |
1301 | 1301 | ||
1302 | mutex_lock(&io_mutex); | 1302 | mutex_lock(&io_mutex); |
1303 | old = snd_soc_read(codec, reg); | 1303 | old = snd_soc_read(codec, reg); |
@@ -1583,7 +1583,7 @@ int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol, | |||
1583 | { | 1583 | { |
1584 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 1584 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
1585 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 1585 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
1586 | unsigned short val, bitmask; | 1586 | unsigned int val, bitmask; |
1587 | 1587 | ||
1588 | for (bitmask = 1; bitmask < e->max; bitmask <<= 1) | 1588 | for (bitmask = 1; bitmask < e->max; bitmask <<= 1) |
1589 | ; | 1589 | ; |
@@ -1612,8 +1612,8 @@ int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol, | |||
1612 | { | 1612 | { |
1613 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 1613 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
1614 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 1614 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
1615 | unsigned short val; | 1615 | unsigned int val; |
1616 | unsigned short mask, bitmask; | 1616 | unsigned int mask, bitmask; |
1617 | 1617 | ||
1618 | for (bitmask = 1; bitmask < e->max; bitmask <<= 1) | 1618 | for (bitmask = 1; bitmask < e->max; bitmask <<= 1) |
1619 | ; | 1619 | ; |
@@ -1649,7 +1649,7 @@ int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol, | |||
1649 | { | 1649 | { |
1650 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 1650 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
1651 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 1651 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
1652 | unsigned short reg_val, val, mux; | 1652 | unsigned int reg_val, val, mux; |
1653 | 1653 | ||
1654 | reg_val = snd_soc_read(codec, e->reg); | 1654 | reg_val = snd_soc_read(codec, e->reg); |
1655 | val = (reg_val >> e->shift_l) & e->mask; | 1655 | val = (reg_val >> e->shift_l) & e->mask; |
@@ -1688,8 +1688,8 @@ int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol, | |||
1688 | { | 1688 | { |
1689 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 1689 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
1690 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 1690 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
1691 | unsigned short val; | 1691 | unsigned int val; |
1692 | unsigned short mask; | 1692 | unsigned int mask; |
1693 | 1693 | ||
1694 | if (ucontrol->value.enumerated.item[0] > e->max - 1) | 1694 | if (ucontrol->value.enumerated.item[0] > e->max - 1) |
1695 | return -EINVAL; | 1695 | return -EINVAL; |
@@ -1849,7 +1849,7 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol, | |||
1849 | int max = mc->max; | 1849 | int max = mc->max; |
1850 | unsigned int mask = (1 << fls(max)) - 1; | 1850 | unsigned int mask = (1 << fls(max)) - 1; |
1851 | unsigned int invert = mc->invert; | 1851 | unsigned int invert = mc->invert; |
1852 | unsigned short val, val2, val_mask; | 1852 | unsigned int val, val2, val_mask; |
1853 | 1853 | ||
1854 | val = (ucontrol->value.integer.value[0] & mask); | 1854 | val = (ucontrol->value.integer.value[0] & mask); |
1855 | if (invert) | 1855 | if (invert) |
@@ -1915,7 +1915,7 @@ int snd_soc_get_volsw_2r(struct snd_kcontrol *kcontrol, | |||
1915 | unsigned int reg2 = mc->rreg; | 1915 | unsigned int reg2 = mc->rreg; |
1916 | unsigned int shift = mc->shift; | 1916 | unsigned int shift = mc->shift; |
1917 | int max = mc->max; | 1917 | int max = mc->max; |
1918 | unsigned int mask = (1<<fls(max))-1; | 1918 | unsigned int mask = (1 << fls(max)) - 1; |
1919 | unsigned int invert = mc->invert; | 1919 | unsigned int invert = mc->invert; |
1920 | 1920 | ||
1921 | ucontrol->value.integer.value[0] = | 1921 | ucontrol->value.integer.value[0] = |
@@ -1955,7 +1955,7 @@ int snd_soc_put_volsw_2r(struct snd_kcontrol *kcontrol, | |||
1955 | unsigned int mask = (1 << fls(max)) - 1; | 1955 | unsigned int mask = (1 << fls(max)) - 1; |
1956 | unsigned int invert = mc->invert; | 1956 | unsigned int invert = mc->invert; |
1957 | int err; | 1957 | int err; |
1958 | unsigned short val, val2, val_mask; | 1958 | unsigned int val, val2, val_mask; |
1959 | 1959 | ||
1960 | val_mask = mask << shift; | 1960 | val_mask = mask << shift; |
1961 | val = (ucontrol->value.integer.value[0] & mask); | 1961 | val = (ucontrol->value.integer.value[0] & mask); |
@@ -2047,7 +2047,7 @@ int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol, | |||
2047 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 2047 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
2048 | unsigned int reg = mc->reg; | 2048 | unsigned int reg = mc->reg; |
2049 | int min = mc->min; | 2049 | int min = mc->min; |
2050 | unsigned short val; | 2050 | unsigned int val; |
2051 | 2051 | ||
2052 | val = (ucontrol->value.integer.value[0]+min) & 0xff; | 2052 | val = (ucontrol->value.integer.value[0]+min) & 0xff; |
2053 | val |= ((ucontrol->value.integer.value[1]+min) & 0xff) << 8; | 2053 | val |= ((ucontrol->value.integer.value[1]+min) & 0xff) << 8; |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 21c69074aa17..7ad8afa8553d 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -268,7 +268,7 @@ static int dapm_connect_mixer(struct snd_soc_codec *codec, | |||
268 | static int dapm_update_bits(struct snd_soc_dapm_widget *widget) | 268 | static int dapm_update_bits(struct snd_soc_dapm_widget *widget) |
269 | { | 269 | { |
270 | int change, power; | 270 | int change, power; |
271 | unsigned short old, new; | 271 | unsigned int old, new; |
272 | struct snd_soc_codec *codec = widget->codec; | 272 | struct snd_soc_codec *codec = widget->codec; |
273 | 273 | ||
274 | /* check for valid widgets */ | 274 | /* check for valid widgets */ |
@@ -1372,7 +1372,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, | |||
1372 | int max = mc->max; | 1372 | int max = mc->max; |
1373 | unsigned int mask = (1 << fls(max)) - 1; | 1373 | unsigned int mask = (1 << fls(max)) - 1; |
1374 | unsigned int invert = mc->invert; | 1374 | unsigned int invert = mc->invert; |
1375 | unsigned short val, val2, val_mask; | 1375 | unsigned int val, val2, val_mask; |
1376 | int ret; | 1376 | int ret; |
1377 | 1377 | ||
1378 | val = (ucontrol->value.integer.value[0] & mask); | 1378 | val = (ucontrol->value.integer.value[0] & mask); |
@@ -1436,7 +1436,7 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol, | |||
1436 | { | 1436 | { |
1437 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); | 1437 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); |
1438 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 1438 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
1439 | unsigned short val, bitmask; | 1439 | unsigned int val, bitmask; |
1440 | 1440 | ||
1441 | for (bitmask = 1; bitmask < e->max; bitmask <<= 1) | 1441 | for (bitmask = 1; bitmask < e->max; bitmask <<= 1) |
1442 | ; | 1442 | ; |
@@ -1464,8 +1464,8 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, | |||
1464 | { | 1464 | { |
1465 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); | 1465 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); |
1466 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 1466 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
1467 | unsigned short val, mux; | 1467 | unsigned int val, mux; |
1468 | unsigned short mask, bitmask; | 1468 | unsigned int mask, bitmask; |
1469 | int ret = 0; | 1469 | int ret = 0; |
1470 | 1470 | ||
1471 | for (bitmask = 1; bitmask < e->max; bitmask <<= 1) | 1471 | for (bitmask = 1; bitmask < e->max; bitmask <<= 1) |
@@ -1523,7 +1523,7 @@ int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol, | |||
1523 | { | 1523 | { |
1524 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); | 1524 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); |
1525 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 1525 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
1526 | unsigned short reg_val, val, mux; | 1526 | unsigned int reg_val, val, mux; |
1527 | 1527 | ||
1528 | reg_val = snd_soc_read(widget->codec, e->reg); | 1528 | reg_val = snd_soc_read(widget->codec, e->reg); |
1529 | val = (reg_val >> e->shift_l) & e->mask; | 1529 | val = (reg_val >> e->shift_l) & e->mask; |
@@ -1563,8 +1563,8 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, | |||
1563 | { | 1563 | { |
1564 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); | 1564 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); |
1565 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 1565 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
1566 | unsigned short val, mux; | 1566 | unsigned int val, mux; |
1567 | unsigned short mask; | 1567 | unsigned int mask; |
1568 | int ret = 0; | 1568 | int ret = 0; |
1569 | 1569 | ||
1570 | if (ucontrol->value.enumerated.item[0] > e->max - 1) | 1570 | if (ucontrol->value.enumerated.item[0] > e->max - 1) |