* [PATCH] ASoC: cs42l51: Fix SOC_DOUBLE_R_SX_TLV shift values for ADC, PCM, and Analog kcontrols
@ 2014-03-19 15:40 Brian Austin
2014-03-19 16:38 ` Mark Brown
2014-04-17 14:26 ` Thomas Petazzoni
0 siblings, 2 replies; 8+ messages in thread
From: Brian Austin @ 2014-03-19 15:40 UTC (permalink / raw)
To: alsa-devel
Cc: thomas.petazzoni, Brian Austin, broonie, lgirdwood,
paul.handrigan
The shift values for the ADC,PCM, and Analog kcontrols were wrong causing wrong values for the SOC_DOUBLE_R_SX_TLV macros
Fixed the TLV for aout_tlv to show -102dB correctly
Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Brian Austin <brian.austin@cirrus.com>
---
sound/soc/codecs/cs42l51.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c
index 3eab460..65fc37c 100644
--- a/sound/soc/codecs/cs42l51.c
+++ b/sound/soc/codecs/cs42l51.c
@@ -106,9 +106,8 @@ static int cs42l51_set_chan_mix(struct snd_kcontrol *kcontrol,
static const DECLARE_TLV_DB_SCALE(adc_pcm_tlv, -5150, 50, 0);
static const DECLARE_TLV_DB_SCALE(tone_tlv, -1050, 150, 0);
-/* This is a lie. after -102 db, it stays at -102 */
-/* maybe a range would be better */
-static const DECLARE_TLV_DB_SCALE(aout_tlv, -11550, 50, 0);
+
+static const DECLARE_TLV_DB_SCALE(aout_tlv, -10200, 50, 0);
static const DECLARE_TLV_DB_SCALE(boost_tlv, 1600, 1600, 0);
static const char *chan_mix[] = {
@@ -123,7 +122,7 @@ static const struct soc_enum cs42l51_chan_mix =
static const struct snd_kcontrol_new cs42l51_snd_controls[] = {
SOC_DOUBLE_R_SX_TLV("PCM Playback Volume",
CS42L51_PCMA_VOL, CS42L51_PCMB_VOL,
- 6, 0x19, 0x7F, adc_pcm_tlv),
+ 0, 0x19, 0x7F, adc_pcm_tlv),
SOC_DOUBLE_R("PCM Playback Switch",
CS42L51_PCMA_VOL, CS42L51_PCMB_VOL, 7, 1, 1),
SOC_DOUBLE_R_SX_TLV("Analog Playback Volume",
@@ -131,7 +130,7 @@ static const struct snd_kcontrol_new cs42l51_snd_controls[] = {
0, 0x34, 0xE4, aout_tlv),
SOC_DOUBLE_R_SX_TLV("ADC Mixer Volume",
CS42L51_ADCA_VOL, CS42L51_ADCB_VOL,
- 6, 0x19, 0x7F, adc_pcm_tlv),
+ 0, 0x19, 0x7F, adc_pcm_tlv),
SOC_DOUBLE_R("ADC Mixer Switch",
CS42L51_ADCA_VOL, CS42L51_ADCB_VOL, 7, 1, 1),
SOC_SINGLE("Playback Deemphasis Switch", CS42L51_DAC_CTL, 3, 1, 0),
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH] ASoC: cs42l51: Fix SOC_DOUBLE_R_SX_TLV shift values for ADC, PCM, and Analog kcontrols
2014-03-19 15:40 [PATCH] ASoC: cs42l51: Fix SOC_DOUBLE_R_SX_TLV shift values for ADC, PCM, and Analog kcontrols Brian Austin
@ 2014-03-19 16:38 ` Mark Brown
2014-04-17 14:26 ` Thomas Petazzoni
1 sibling, 0 replies; 8+ messages in thread
From: Mark Brown @ 2014-03-19 16:38 UTC (permalink / raw)
To: Brian Austin; +Cc: thomas.petazzoni, alsa-devel, lgirdwood, paul.handrigan
[-- Attachment #1.1: Type: text/plain, Size: 258 bytes --]
On Wed, Mar 19, 2014 at 10:40:02AM -0500, Brian Austin wrote:
> The shift values for the ADC,PCM, and Analog kcontrols were wrong causing wrong values for the SOC_DOUBLE_R_SX_TLV macros
> Fixed the TLV for aout_tlv to show -102dB correctly
Applied, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ASoC: cs42l51: Fix SOC_DOUBLE_R_SX_TLV shift values for ADC, PCM, and Analog kcontrols
2014-03-19 15:40 [PATCH] ASoC: cs42l51: Fix SOC_DOUBLE_R_SX_TLV shift values for ADC, PCM, and Analog kcontrols Brian Austin
2014-03-19 16:38 ` Mark Brown
@ 2014-04-17 14:26 ` Thomas Petazzoni
2014-04-17 15:00 ` Brian Austin
2014-04-17 15:08 ` Brian Austin
1 sibling, 2 replies; 8+ messages in thread
From: Thomas Petazzoni @ 2014-04-17 14:26 UTC (permalink / raw)
To: Brian Austin; +Cc: alsa-devel, broonie, lgirdwood, paul.handrigan
Dear Brian Austin,
On Wed, 19 Mar 2014 10:40:02 -0500, Brian Austin wrote:
> The shift values for the ADC,PCM, and Analog kcontrols were wrong causing wrong values for the SOC_DOUBLE_R_SX_TLV macros
> Fixed the TLV for aout_tlv to show -102dB correctly
>
> Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Signed-off-by: Brian Austin <brian.austin@cirrus.com>
> ---
> sound/soc/codecs/cs42l51.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
Thanks for this patch. Unfortunately, it still doesn't solve completely
the situation. When I start alsamixer, it shows that:
* PCM is at 102 (so above the maximum 100 value)
* Both ADC Mixers are at 102
* Analog is at 174 (so way above the maximum 100 value)
Changing the value of PCM works (but of course I can then only change
it between 0 and 100, not up to 102). However, as soon as I change the
"Analog" value, even if I raise it up to 174, there isn't any sound
anymore. Probably because the alsamixer range 0-100 doesn't allow to
reach a high enough volume to be audible.
Here is the amixer output right after boot (without changing any
value) :
=================================================================
# amixer
Simple mixer control 'Bass',0
Capabilities: volume volume-joined
Playback channels: Mono
Capture channels: Mono
Limits: 0 - 15
Mono: 7 [47%] [0.00dB]
Simple mixer control 'Treble',0
Capabilities: volume volume-joined
Playback channels: Mono
Capture channels: Mono
Limits: 0 - 15
Mono: 7 [47%] [0.00dB]
Simple mixer control 'PCM',0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 102
Mono:
Front Left: Playback 103 [101%] [0.00dB] [off]
Front Right: Playback 103 [101%] [0.00dB] [off]
Simple mixer control 'PCM channel mixer',0
Capabilities: enum
Items: 'L R' 'L+R' 'R L'
Item0: 'L R'
Simple mixer control 'Mic Boost',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 1
Front Left: 0 [0%] [16.00dB]
Front Right: 0 [0%] [16.00dB]
Simple mixer control 'Playback Deemphasis',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'ADC Mixer',0
Capabilities: volume pswitch
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 102
Front Left: 103 [101%] [0.00dB] Playback [off]
Front Right: 103 [101%] [0.00dB] Playback [off]
Simple mixer control 'Analog',0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 176
Mono:
Front Left: Playback 204 [116%] [0.00dB]
Front Right: Playback 204 [116%] [0.00dB]
Simple mixer control 'Auto-Mute',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
Simple mixer control 'PGA-ADC Mux Left',0
Capabilities: enum
Items: 'AIN1 Left' 'AIN2 Left' 'MIC Left' 'MIC+preamp Left'
Item0: 'AIN1 Left'
Simple mixer control 'PGA-ADC Mux Right',0
Capabilities: enum
Items: 'AIN1 Right' 'AIN2 Right' 'MIC Right' 'MIC+preamp Right'
Item0: 'AIN1 Right'
Simple mixer control 'Soft Ramp',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
#
=================================================================
See also an alsamixer screenshot at
http://free-electrons.com/~thomas/pub/alsamixer-issue.png.
I wanted to give you the raw state of the codec registers, but for some
reason, the codec_reg file is empty here (I'm on 3.15-rc1) :
=================================================================
# cat /sys/kernel/debug/asoc/a370db/cs42l51-codec.0-004a/codec_reg
#
=================================================================
Note that if I revert back the cs42l51 code to the state before
1d99f2436d0d1c7741d6dfd9d27b5376cdbbca40 ('ASoC: core: Rework
SOC_DOUBLE_R_SX_TLV add SOC_SINGLE_SX_TLV'), then the volume control
works normally.
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] ASoC: cs42l51: Fix SOC_DOUBLE_R_SX_TLV shift values for ADC, PCM, and Analog kcontrols
2014-04-17 14:26 ` Thomas Petazzoni
@ 2014-04-17 15:00 ` Brian Austin
2014-04-17 15:08 ` Brian Austin
1 sibling, 0 replies; 8+ messages in thread
From: Brian Austin @ 2014-04-17 15:00 UTC (permalink / raw)
To: Thomas Petazzoni
Cc: Brian Austin, broonie, alsa-devel, paul.handrigan, lgirdwood
On Thu, 17 Apr 2014, Thomas Petazzoni wrote:
>
> See also an alsamixer screenshot at
> http://free-electrons.com/~thomas/pub/alsamixer-issue.png.
>
> I wanted to give you the raw state of the codec registers, but for some
> reason, the codec_reg file is empty here (I'm on 3.15-rc1) :
>
> =================================================================
> # cat /sys/kernel/debug/asoc/a370db/cs42l51-codec.0-004a/codec_reg
> #
cat /sys/kernel/debug/regmap/0-004a/registers
It uses regmap. Yes a register dump would be helpful
Thanks
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ASoC: cs42l51: Fix SOC_DOUBLE_R_SX_TLV shift values for ADC, PCM, and Analog kcontrols
2014-04-17 14:26 ` Thomas Petazzoni
2014-04-17 15:00 ` Brian Austin
@ 2014-04-17 15:08 ` Brian Austin
[not found] ` <20140418112355.4c1fe3ac@skate>
1 sibling, 1 reply; 8+ messages in thread
From: Brian Austin @ 2014-04-17 15:08 UTC (permalink / raw)
To: Thomas Petazzoni
Cc: Brian Austin, broonie, alsa-devel, paul.handrigan, lgirdwood
On Thu, 17 Apr 2014, Thomas Petazzoni wrote:
> Dear Brian Austin,
>
> On Wed, 19 Mar 2014 10:40:02 -0500, Brian Austin wrote:
>> The shift values for the ADC,PCM, and Analog kcontrols were wrong causing wrong values for the SOC_DOUBLE_R_SX_TLV macros
>> Fixed the TLV for aout_tlv to show -102dB correctly
>>
>> Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>> Signed-off-by: Brian Austin <brian.austin@cirrus.com>
>> ---
>> sound/soc/codecs/cs42l51.c | 9 ++++-----
>> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> Thanks for this patch. Unfortunately, it still doesn't solve completely
> the situation. When I start alsamixer, it shows that:
>
> * PCM is at 102 (so above the maximum 100 value)
> * Both ADC Mixers are at 102
> * Analog is at 174 (so way above the maximum 100 value)
>
> Changing the value of PCM works (but of course I can then only change
> it between 0 and 100, not up to 102). However, as soon as I change the
> "Analog" value, even if I raise it up to 174, there isn't any sound
> anymore. Probably because the alsamixer range 0-100 doesn't allow to
> reach a high enough volume to be audible.
>
> Here is the amixer output right after boot (without changing any
> value) :
>
can you try this quick check please?
static const struct snd_kcontrol_new cs42l51_snd_controls[] = {
SOC_DOUBLE_R_SX_TLV("PCM Playback Volume",
CS42L51_PCMA_VOL, CS42L51_PCMB_VOL,
- 0, 0x19, 0x7F, adc_pcm_tlv),
+ 0, 0x19, 0x80, adc_pcm_tlv),
SOC_DOUBLE_R("PCM Playback Switch",
CS42L51_PCMA_VOL, CS42L51_PCMB_VOL, 7, 1, 1),
SOC_DOUBLE_R_SX_TLV("Analog Playback Volume",
CS42L51_AOUTA_VOL, CS42L51_AOUTB_VOL,
- 0, 0x34, 0xE4, aout_tlv),
+ 0, 0x34, 0xE5, aout_tlv),
SOC_DOUBLE_R_SX_TLV("ADC Mixer Volume",
CS42L51_ADCA_VOL, CS42L51_ADCB_VOL,
- 0, 0x19, 0x7F, adc_pcm_tlv),
+ 0, 0x19, 0x80, adc_pcm_tlv),
SOC_DOUBLE_R("ADC Mixer Switch",
CS42L51_ADCA_VOL, CS42L51_ADCB_VOL, 7, 1, 1),
SOC_SINGLE("Playback Deemphasis Switch", CS42L51_DAC_CTL, 3, 1,
0),
-Brian
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-04-18 14:21 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-19 15:40 [PATCH] ASoC: cs42l51: Fix SOC_DOUBLE_R_SX_TLV shift values for ADC, PCM, and Analog kcontrols Brian Austin
2014-03-19 16:38 ` Mark Brown
2014-04-17 14:26 ` Thomas Petazzoni
2014-04-17 15:00 ` Brian Austin
2014-04-17 15:08 ` Brian Austin
[not found] ` <20140418112355.4c1fe3ac@skate>
2014-04-18 12:22 ` Austin, Brian
2014-04-18 14:00 ` Brian Austin
2014-04-18 14:21 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox