Discussion:
[PATCH v2] ASoC: rt5677: make volume TLV closer to reality
Dylan Reid
2014-10-09 22:11:27 UTC
Permalink
The volume blocks have an step of 0.375dB, but TLV uses 0.01dB for
units. Switch to use TLV_DB_MINMAX as this allows the minimum to be
off by only 0.005dB. This is an improvement from the ~500dB is was
misreported by before.

Signed-off-by: Dylan Reid <***@chromium.org>
---
sound/soc/codecs/rt5677.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index 16aa4d9..a4c71f9 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -538,9 +538,9 @@ static bool rt5677_readable_register(struct device *dev, unsigned int reg)
}

static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0);
-static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -65625, 375, 0);
+static const DECLARE_TLV_DB_MINMAX(dac_vol_tlv, -6562, 0);
static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0);
-static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -17625, 375, 0);
+static const DECLARE_TLV_DB_MINMAX(adc_vol_tlv, -1762, 0);
static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0);
static const DECLARE_TLV_DB_SCALE(st_vol_tlv, -4650, 150, 0);
--
2.1.2.330.g565301e
Mark Brown
2014-10-09 23:10:42 UTC
Permalink
Post by Dylan Reid
The volume blocks have an step of 0.375dB, but TLV uses 0.01dB for
units. Switch to use TLV_DB_MINMAX as this allows the minimum to be
off by only 0.005dB. This is an improvement from the ~500dB is was
misreported by before.
The usual thing to do with these is just to halve the resolution of the
control by ignoring the low bit so that you get exact values, though for
this device that does result in a relatively large step (step sizes like
0.125dB are more common). I dunno, doesn't make much difference either
way from my point of view.
Dylan Reid
2014-10-10 02:27:40 UTC
Permalink
Post by Mark Brown
Post by Dylan Reid
The volume blocks have an step of 0.375dB, but TLV uses 0.01dB for
units. Switch to use TLV_DB_MINMAX as this allows the minimum to be
off by only 0.005dB. This is an improvement from the ~500dB is was
misreported by before.
The usual thing to do with these is just to halve the resolution of the
control by ignoring the low bit so that you get exact values, though for
this device that does result in a relatively large step (step sizes like
0.125dB are more common). I dunno, doesn't make much difference either
way from my point of view.
I can easily add a flag to the UCM config to hint userspace to divide by 10, so
I'm not strongly tied to making this change if it isn't bothering anyone else.
Mark Brown
2014-10-13 08:01:10 UTC
Permalink
Post by Dylan Reid
I can easily add a flag to the UCM config to hint userspace to divide by 10, so
I'm not strongly tied to making this change if it isn't bothering anyone else.
I was thinking about just doing this in the driver rather than working
around it in userspace.

Loading...