mirror of
https://github.com/torvalds/linux.git
synced 2026-09-26 10:02:02 +02:00
ASoC: tas2562: Volume setting fixes
Mark Brown <broonie@kernel.org> says: While reviewing another fix for the tas2562 volume control I noticed a few issues with the put() operation, this series fixes them. It's also a bit weird that the volume control is defined with twice as many values as can actually be set, probably the best fix there is to regnerate the table of volume values with the intermediate values. Link: https://patch.msgid.link/20260715-asoc-tas2562-put-retval-v1-0-97bf467c924e@kernel.org
This commit is contained in:
commit
07f545657d
|
|
@ -472,10 +472,18 @@ static int tas2562_volume_control_put(struct snd_kcontrol *kcontrol,
|
|||
{
|
||||
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
|
||||
struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component);
|
||||
int ret;
|
||||
int ret, index;
|
||||
u32 reg_val;
|
||||
|
||||
reg_val = float_vol_db_lookup[ucontrol->value.integer.value[0]/2];
|
||||
if (tas2562->volume_lvl == ucontrol->value.integer.value[0])
|
||||
return 0;
|
||||
|
||||
index = ucontrol->value.integer.value[0] / 2;
|
||||
if (index < 0 || index >= ARRAY_SIZE(float_vol_db_lookup))
|
||||
return -EINVAL;
|
||||
|
||||
reg_val = float_vol_db_lookup[index];
|
||||
|
||||
/*
|
||||
* The device applies the 32-bit coefficient to the playback path on
|
||||
* the write to DVC_CFG4 (the LSB, book 0 page 2 reg 0x0F), so the
|
||||
|
|
@ -502,7 +510,7 @@ static int tas2562_volume_control_put(struct snd_kcontrol *kcontrol,
|
|||
|
||||
tas2562->volume_lvl = ucontrol->value.integer.value[0];
|
||||
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Digital Volume Control. From 0 dB to -110 dB in 1 dB steps */
|
||||
|
|
@ -740,6 +748,8 @@ static int tas2562_probe(struct i2c_client *client)
|
|||
data->client = client;
|
||||
data->dev = &client->dev;
|
||||
data->model_id = (uintptr_t)i2c_get_match_data(client);
|
||||
/* Register default is 0x40400000, this is closest */
|
||||
data->volume_lvl = (ARRAY_SIZE(float_vol_db_lookup) - 1) * 2;
|
||||
|
||||
tas2562_parse_dt(data);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user