diff options
| author | Val Packett <val@packett.cool> | 2026-05-29 17:05:14 -0300 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-06-10 00:09:11 +0100 |
| commit | 9b2929eed4d2d30f1aebe45bd2a8973eaab2428c (patch) | |
| tree | 39f77ff549a25e33c9cf12382cd3e1e70e7090a4 /sound/soc/codecs/aw88261.h | |
| parent | 79c053a1ff9d3ab31cefbc791e8d7816ba830491 (diff) | |
| download | linux-next-9b2929eed4d2d30f1aebe45bd2a8973eaab2428c.tar.gz linux-next-9b2929eed4d2d30f1aebe45bd2a8973eaab2428c.zip | |
ASoC: codecs: aw88261: make volume control usable
- Invert the value to match userspace expectations (in the hardware,
positive numbers represent negative dB attenuation)
- Provide TLV metadata for the dB scale (and divide the raw values by 2
as the excessive precision used by HW is not representable in TLV)
- Do not unnecessarily reset the volume while switching profiles
- Simplify aw88261_dev_set_volume using regmap_update_bits
- Do not add the initial volume from the profile to the requested volume
as that would throw off the dB mapping (if a lower max limit is
desired, it can be set in the UCM profile in userspace)
With this change, it's actually possible to use this hardware volume
control as PlaybackVolume in an ALSA UCM profile.
Fixes: 028a2ae25691 ("ASoC: codecs: Add aw88261 amplifier driver")
Signed-off-by: Val Packett <val@packett.cool>
Link: https://patch.msgid.link/20260529200550.529719-8-val@packett.cool
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/aw88261.h')
| -rw-r--r-- | sound/soc/codecs/aw88261.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/soc/codecs/aw88261.h b/sound/soc/codecs/aw88261.h index 4be6ac02123e..270ccf375f36 100644 --- a/sound/soc/codecs/aw88261.h +++ b/sound/soc/codecs/aw88261.h @@ -262,7 +262,8 @@ #define AW88261_VOL_MASK \ (~(((1<<AW88261_VOL_BITS_LEN)-1) << AW88261_VOL_START_BIT)) -#define AW88261_VOL_DEFAULT_VALUE (0) +#define AW88261_CTL_MAX_VOL (AW88261_MUTE_VOL / 2) +#define AW88261_CTL_DEFAULT_VOL (AW88261_CTL_MAX_VOL / 2) #define AW88261_I2STXEN_START_BIT (6) #define AW88261_I2STXEN_BITS_LEN (1) @@ -538,7 +539,6 @@ #define AW88261_DEV_SYSST_CHECK_MAX (10) #define AW88261_SOFT_RESET_VALUE (0x55aa) #define AW88261_REG_TO_DB (0x3f) -#define AW88261_VOL_START_MASK (0xfc00) #define AW88261_INIT_PROFILE (0) #define REG_VAL_TO_DB(value) ((((value) >> AW88261_VOL_6DB_START) * \ |
