mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 07:50:51 +07:00
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>
This commit is contained in:
parent
74b8f955a7
commit
46f5822f78
@ -216,9 +216,9 @@ void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
|
|||||||
|
|
||||||
/* codec register bit access */
|
/* codec register bit access */
|
||||||
int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg,
|
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,
|
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,
|
int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
|
||||||
struct snd_ac97_bus_ops *ops, int num);
|
struct snd_ac97_bus_ops *ops, int num);
|
||||||
|
@ -1264,10 +1264,10 @@ EXPORT_SYMBOL_GPL(snd_soc_free_ac97_codec);
|
|||||||
* Returns 1 for change else 0.
|
* Returns 1 for change else 0.
|
||||||
*/
|
*/
|
||||||
int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg,
|
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;
|
int change;
|
||||||
unsigned short old, new;
|
unsigned int old, new;
|
||||||
|
|
||||||
mutex_lock(&io_mutex);
|
mutex_lock(&io_mutex);
|
||||||
old = snd_soc_read(codec, reg);
|
old = snd_soc_read(codec, reg);
|
||||||
@ -1294,10 +1294,10 @@ EXPORT_SYMBOL_GPL(snd_soc_update_bits);
|
|||||||
* Returns 1 for change else 0.
|
* Returns 1 for change else 0.
|
||||||
*/
|
*/
|
||||||
int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg,
|
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;
|
int change;
|
||||||
unsigned short old, new;
|
unsigned int old, new;
|
||||||
|
|
||||||
mutex_lock(&io_mutex);
|
mutex_lock(&io_mutex);
|
||||||
old = snd_soc_read(codec, reg);
|
old = snd_soc_read(codec, reg);
|
||||||
@ -1583,7 +1583,7 @@ int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
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)
|
for (bitmask = 1; bitmask < e->max; bitmask <<= 1)
|
||||||
;
|
;
|
||||||
@ -1612,8 +1612,8 @@ int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||||
unsigned short val;
|
unsigned int val;
|
||||||
unsigned short mask, bitmask;
|
unsigned int mask, bitmask;
|
||||||
|
|
||||||
for (bitmask = 1; bitmask < e->max; bitmask <<= 1)
|
for (bitmask = 1; bitmask < e->max; bitmask <<= 1)
|
||||||
;
|
;
|
||||||
@ -1649,7 +1649,7 @@ int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
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);
|
reg_val = snd_soc_read(codec, e->reg);
|
||||||
val = (reg_val >> e->shift_l) & e->mask;
|
val = (reg_val >> e->shift_l) & e->mask;
|
||||||
@ -1688,8 +1688,8 @@ int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||||
unsigned short val;
|
unsigned int val;
|
||||||
unsigned short mask;
|
unsigned int mask;
|
||||||
|
|
||||||
if (ucontrol->value.enumerated.item[0] > e->max - 1)
|
if (ucontrol->value.enumerated.item[0] > e->max - 1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -1849,7 +1849,7 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
|
|||||||
int max = mc->max;
|
int max = mc->max;
|
||||||
unsigned int mask = (1 << fls(max)) - 1;
|
unsigned int mask = (1 << fls(max)) - 1;
|
||||||
unsigned int invert = mc->invert;
|
unsigned int invert = mc->invert;
|
||||||
unsigned short val, val2, val_mask;
|
unsigned int val, val2, val_mask;
|
||||||
|
|
||||||
val = (ucontrol->value.integer.value[0] & mask);
|
val = (ucontrol->value.integer.value[0] & mask);
|
||||||
if (invert)
|
if (invert)
|
||||||
@ -1915,7 +1915,7 @@ int snd_soc_get_volsw_2r(struct snd_kcontrol *kcontrol,
|
|||||||
unsigned int reg2 = mc->rreg;
|
unsigned int reg2 = mc->rreg;
|
||||||
unsigned int shift = mc->shift;
|
unsigned int shift = mc->shift;
|
||||||
int max = mc->max;
|
int max = mc->max;
|
||||||
unsigned int mask = (1<<fls(max))-1;
|
unsigned int mask = (1 << fls(max)) - 1;
|
||||||
unsigned int invert = mc->invert;
|
unsigned int invert = mc->invert;
|
||||||
|
|
||||||
ucontrol->value.integer.value[0] =
|
ucontrol->value.integer.value[0] =
|
||||||
@ -1955,7 +1955,7 @@ int snd_soc_put_volsw_2r(struct snd_kcontrol *kcontrol,
|
|||||||
unsigned int mask = (1 << fls(max)) - 1;
|
unsigned int mask = (1 << fls(max)) - 1;
|
||||||
unsigned int invert = mc->invert;
|
unsigned int invert = mc->invert;
|
||||||
int err;
|
int err;
|
||||||
unsigned short val, val2, val_mask;
|
unsigned int val, val2, val_mask;
|
||||||
|
|
||||||
val_mask = mask << shift;
|
val_mask = mask << shift;
|
||||||
val = (ucontrol->value.integer.value[0] & mask);
|
val = (ucontrol->value.integer.value[0] & mask);
|
||||||
@ -2047,7 +2047,7 @@ int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
|
|||||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||||
unsigned int reg = mc->reg;
|
unsigned int reg = mc->reg;
|
||||||
int min = mc->min;
|
int min = mc->min;
|
||||||
unsigned short val;
|
unsigned int val;
|
||||||
|
|
||||||
val = (ucontrol->value.integer.value[0]+min) & 0xff;
|
val = (ucontrol->value.integer.value[0]+min) & 0xff;
|
||||||
val |= ((ucontrol->value.integer.value[1]+min) & 0xff) << 8;
|
val |= ((ucontrol->value.integer.value[1]+min) & 0xff) << 8;
|
||||||
|
@ -268,7 +268,7 @@ static int dapm_connect_mixer(struct snd_soc_codec *codec,
|
|||||||
static int dapm_update_bits(struct snd_soc_dapm_widget *widget)
|
static int dapm_update_bits(struct snd_soc_dapm_widget *widget)
|
||||||
{
|
{
|
||||||
int change, power;
|
int change, power;
|
||||||
unsigned short old, new;
|
unsigned int old, new;
|
||||||
struct snd_soc_codec *codec = widget->codec;
|
struct snd_soc_codec *codec = widget->codec;
|
||||||
|
|
||||||
/* check for valid widgets */
|
/* check for valid widgets */
|
||||||
@ -1372,7 +1372,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
|
|||||||
int max = mc->max;
|
int max = mc->max;
|
||||||
unsigned int mask = (1 << fls(max)) - 1;
|
unsigned int mask = (1 << fls(max)) - 1;
|
||||||
unsigned int invert = mc->invert;
|
unsigned int invert = mc->invert;
|
||||||
unsigned short val, val2, val_mask;
|
unsigned int val, val2, val_mask;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
val = (ucontrol->value.integer.value[0] & mask);
|
val = (ucontrol->value.integer.value[0] & mask);
|
||||||
@ -1436,7 +1436,7 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
|
||||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
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)
|
for (bitmask = 1; bitmask < e->max; bitmask <<= 1)
|
||||||
;
|
;
|
||||||
@ -1464,8 +1464,8 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
|
||||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||||
unsigned short val, mux;
|
unsigned int val, mux;
|
||||||
unsigned short mask, bitmask;
|
unsigned int mask, bitmask;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
for (bitmask = 1; bitmask < e->max; bitmask <<= 1)
|
for (bitmask = 1; bitmask < e->max; bitmask <<= 1)
|
||||||
@ -1523,7 +1523,7 @@ int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
|
||||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
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);
|
reg_val = snd_soc_read(widget->codec, e->reg);
|
||||||
val = (reg_val >> e->shift_l) & e->mask;
|
val = (reg_val >> e->shift_l) & e->mask;
|
||||||
@ -1563,8 +1563,8 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
|
||||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||||
unsigned short val, mux;
|
unsigned int val, mux;
|
||||||
unsigned short mask;
|
unsigned int mask;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (ucontrol->value.enumerated.item[0] > e->max - 1)
|
if (ucontrol->value.enumerated.item[0] > e->max - 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user