* [PATCH] ASoC: es8316: limit headphone mixer volume
@ 2019-08-24 21:04 ` Katsuhiro Suzuki
0 siblings, 0 replies; 8+ messages in thread
From: Katsuhiro Suzuki @ 2019-08-24 21:04 UTC (permalink / raw)
To: Mark Brown, David Yang, Daniel Drake, Hans de Goede
Cc: alsa-devel, linux-kernel, Katsuhiro Suzuki
This patch limits Headphone mixer volume to 4 from 7.
Because output sound suddenly becomes very loudly with many noise if
set volume over 4.
Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
---
sound/soc/codecs/es8316.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
index 8dfb5dbeebbf..bc4141e1eb7f 100644
--- a/sound/soc/codecs/es8316.c
+++ b/sound/soc/codecs/es8316.c
@@ -91,7 +91,7 @@ static const struct snd_kcontrol_new es8316_snd_controls[] = {
SOC_DOUBLE_TLV("Headphone Playback Volume", ES8316_CPHP_ICAL_VOL,
4, 0, 3, 1, hpout_vol_tlv),
SOC_DOUBLE_TLV("Headphone Mixer Volume", ES8316_HPMIX_VOL,
- 0, 4, 7, 0, hpmixer_gain_tlv),
+ 0, 4, 4, 0, hpmixer_gain_tlv),
SOC_ENUM("Playback Polarity", dacpol),
SOC_DOUBLE_R_TLV("DAC Playback Volume", ES8316_DAC_VOLL,
--
2.23.0.rc1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] ASoC: es8316: limit headphone mixer volume
@ 2019-08-24 21:04 ` Katsuhiro Suzuki
0 siblings, 0 replies; 8+ messages in thread
From: Katsuhiro Suzuki @ 2019-08-24 21:04 UTC (permalink / raw)
To: Mark Brown, David Yang, Daniel Drake, Hans de Goede
Cc: Katsuhiro Suzuki, alsa-devel, linux-kernel
This patch limits Headphone mixer volume to 4 from 7.
Because output sound suddenly becomes very loudly with many noise if
set volume over 4.
Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
---
sound/soc/codecs/es8316.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
index 8dfb5dbeebbf..bc4141e1eb7f 100644
--- a/sound/soc/codecs/es8316.c
+++ b/sound/soc/codecs/es8316.c
@@ -91,7 +91,7 @@ static const struct snd_kcontrol_new es8316_snd_controls[] = {
SOC_DOUBLE_TLV("Headphone Playback Volume", ES8316_CPHP_ICAL_VOL,
4, 0, 3, 1, hpout_vol_tlv),
SOC_DOUBLE_TLV("Headphone Mixer Volume", ES8316_HPMIX_VOL,
- 0, 4, 7, 0, hpmixer_gain_tlv),
+ 0, 4, 4, 0, hpmixer_gain_tlv),
SOC_ENUM("Playback Polarity", dacpol),
SOC_DOUBLE_R_TLV("DAC Playback Volume", ES8316_DAC_VOLL,
--
2.23.0.rc1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] ASoC: es8316: limit headphone mixer volume
2019-08-24 21:04 ` Katsuhiro Suzuki
(?)
@ 2019-08-25 17:38 ` Hans de Goede
2019-08-26 2:53 ` Daniel Drake
-1 siblings, 1 reply; 8+ messages in thread
From: Hans de Goede @ 2019-08-25 17:38 UTC (permalink / raw)
To: Katsuhiro Suzuki, Mark Brown, David Yang, Daniel Drake
Cc: alsa-devel, linux-kernel
Hi,
On 24-08-19 23:04, Katsuhiro Suzuki wrote:
> This patch limits Headphone mixer volume to 4 from 7.
> Because output sound suddenly becomes very loudly with many noise if
> set volume over 4.
>
> Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
Higher then 4 not working matches my experience, see this comment from
the UCM file: alsa-lib/src/conf/ucm/codecs/es8316/EnableSeq.conf :
# Set HP mixer vol to -6 dB (4/7) louder does not work
cset "name='Headphone Mixer Volume' 4"
Limiting this to the actual working range at the kernel level seems
sensible:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
> ---
> sound/soc/codecs/es8316.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
> index 8dfb5dbeebbf..bc4141e1eb7f 100644
> --- a/sound/soc/codecs/es8316.c
> +++ b/sound/soc/codecs/es8316.c
> @@ -91,7 +91,7 @@ static const struct snd_kcontrol_new es8316_snd_controls[] = {
> SOC_DOUBLE_TLV("Headphone Playback Volume", ES8316_CPHP_ICAL_VOL,
> 4, 0, 3, 1, hpout_vol_tlv),
> SOC_DOUBLE_TLV("Headphone Mixer Volume", ES8316_HPMIX_VOL,
> - 0, 4, 7, 0, hpmixer_gain_tlv),
> + 0, 4, 4, 0, hpmixer_gain_tlv),
>
> SOC_ENUM("Playback Polarity", dacpol),
> SOC_DOUBLE_R_TLV("DAC Playback Volume", ES8316_DAC_VOLL,
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ASoC: es8316: limit headphone mixer volume
2019-08-25 17:38 ` Hans de Goede
@ 2019-08-26 2:53 ` Daniel Drake
2019-08-26 8:41 ` Katsuhiro Suzuki
2019-08-26 9:09 ` Hans de Goede
0 siblings, 2 replies; 8+ messages in thread
From: Daniel Drake @ 2019-08-26 2:53 UTC (permalink / raw)
To: Hans de Goede
Cc: Katsuhiro Suzuki, Mark Brown, David Yang, alsa-devel, Linux Kernel
On Mon, Aug 26, 2019 at 1:38 AM Hans de Goede <hdegoede@redhat.com> wrote:
> On 24-08-19 23:04, Katsuhiro Suzuki wrote:
> > This patch limits Headphone mixer volume to 4 from 7.
> > Because output sound suddenly becomes very loudly with many noise if
> > set volume over 4.
That sounds like something that should be limited in UCM.
> Higher then 4 not working matches my experience, see this comment from
> the UCM file: alsa-lib/src/conf/ucm/codecs/es8316/EnableSeq.conf :
>
> # Set HP mixer vol to -6 dB (4/7) louder does not work
> cset "name='Headphone Mixer Volume' 4"
What does "does not work" mean more precisely?
I checked the spec, there is indeed something wrong in the kernel driver here.
The db scale is not a simple scale as the kernel source suggests.
Instead it is:
0000 – -12dB
0001 – -10.5dB
0010 – -9dB
0011 – -7.5dB
0100 – -6dB
1000 – -4.5dB
1001 – -3dB
1010 – -1.5dB
1011 – 0dB
So perhaps we can fix the kernel to follow this table and then use UCM
to limit the volume if its too high on a given platform?
Thanks
Daniel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ASoC: es8316: limit headphone mixer volume
2019-08-26 2:53 ` Daniel Drake
@ 2019-08-26 8:41 ` Katsuhiro Suzuki
2019-08-26 9:00 ` Katsuhiro Suzuki
2019-08-26 9:09 ` Hans de Goede
1 sibling, 1 reply; 8+ messages in thread
From: Katsuhiro Suzuki @ 2019-08-26 8:41 UTC (permalink / raw)
To: Daniel Drake, Hans de Goede
Cc: Mark Brown, David Yang, alsa-devel, Linux Kernel
Hello Daniel,
On 2019/08/26 11:53, Daniel Drake wrote:
> On Mon, Aug 26, 2019 at 1:38 AM Hans de Goede <hdegoede@redhat.com> wrote:
>> On 24-08-19 23:04, Katsuhiro Suzuki wrote:
>>> This patch limits Headphone mixer volume to 4 from 7.
>>> Because output sound suddenly becomes very loudly with many noise if
>>> set volume over 4.
>
> That sounds like something that should be limited in UCM.
>
>> Higher then 4 not working matches my experience, see this comment from
>> the UCM file: alsa-lib/src/conf/ucm/codecs/es8316/EnableSeq.conf :
>>
>> # Set HP mixer vol to -6 dB (4/7) louder does not work
>> cset "name='Headphone Mixer Volume' 4"
>
> What does "does not work" mean more precisely?
>
> I checked the spec, there is indeed something wrong in the kernel driver here.
> The db scale is not a simple scale as the kernel source suggests.
>
> Instead it is:
> 0000 – -12dB
> 0001 – -10.5dB
> 0010 – -9dB
> 0011 – -7.5dB
> 0100 – -6dB
> 1000 – -4.5dB
> 1001 – -3dB
> 1010 – -1.5dB
> 1011 – 0dB
>
> So perhaps we can fix the kernel to follow this table and then use UCM
> to limit the volume if its too high on a given platform?
>
Thank you very important information. So you mean value 5, 6, 7 are
illegal settings for ES8316. Correct codes are
static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(hpmixer_gain_tlv,
0, 4, TLV_DB_SCALE_ITEM(-1200, 150, 0),
8, 11, TLV_DB_SCALE_ITEM(-450, 150, 0),
);
and...
SOC_DOUBLE_TLV("Headphone Mixer Volume", ES8316_HPMIX_VOL,
0, 4, 15, 0, hpmixer_gain_tlv),
Is my understanding correct? If so I'll test it on my board
(RockPro64) and re-send patch.
BTW, do you know how to get ES8316 I2C registers spec?
I want to see it for understanding current code, but I cannot find...
> Thanks
> Daniel
>
>
Best Regards,
Katsuhiro Suzuki
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ASoC: es8316: limit headphone mixer volume
2019-08-26 8:41 ` Katsuhiro Suzuki
@ 2019-08-26 9:00 ` Katsuhiro Suzuki
0 siblings, 0 replies; 8+ messages in thread
From: Katsuhiro Suzuki @ 2019-08-26 9:00 UTC (permalink / raw)
To: Daniel Drake, Hans de Goede
Cc: Mark Brown, David Yang, alsa-devel, Linux Kernel
Hello,
Oops... I got mistake,
> SOC_DOUBLE_TLV("Headphone Mixer Volume", ES8316_HPMIX_VOL,
> 0, 4, 15, 0, hpmixer_gain_tlv),
is wrong,
> SOC_DOUBLE_TLV("Headphone Mixer Volume", ES8316_HPMIX_VOL,
> 0, 4, 11, 0, hpmixer_gain_tlv),
is correct.
Best Regards,
Katsuhiro Suzuki
On 2019/08/26 17:41, Katsuhiro Suzuki wrote:
> Hello Daniel,
>
> On 2019/08/26 11:53, Daniel Drake wrote:
>> On Mon, Aug 26, 2019 at 1:38 AM Hans de Goede <hdegoede@redhat.com>
>> wrote:
>>> On 24-08-19 23:04, Katsuhiro Suzuki wrote:
>>>> This patch limits Headphone mixer volume to 4 from 7.
>>>> Because output sound suddenly becomes very loudly with many noise if
>>>> set volume over 4.
>>
>> That sounds like something that should be limited in UCM.
>>
>>> Higher then 4 not working matches my experience, see this comment from
>>> the UCM file: alsa-lib/src/conf/ucm/codecs/es8316/EnableSeq.conf :
>>>
>>> # Set HP mixer vol to -6 dB (4/7) louder does not work
>>> cset "name='Headphone Mixer Volume' 4"
>>
>> What does "does not work" mean more precisely?
>>
>> I checked the spec, there is indeed something wrong in the kernel
>> driver here.
>> The db scale is not a simple scale as the kernel source suggests.
>>
>> Instead it is:
>> 0000 – -12dB
>> 0001 – -10.5dB
>> 0010 – -9dB
>> 0011 – -7.5dB
>> 0100 – -6dB
>> 1000 – -4.5dB
>> 1001 – -3dB
>> 1010 – -1.5dB
>> 1011 – 0dB
>>
> > So perhaps we can fix the kernel to follow this table and then use UCM
> > to limit the volume if its too high on a given platform?
> >
>
> Thank you very important information. So you mean value 5, 6, 7 are
> illegal settings for ES8316. Correct codes are
>
> static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(hpmixer_gain_tlv,
> 0, 4, TLV_DB_SCALE_ITEM(-1200, 150, 0),
> 8, 11, TLV_DB_SCALE_ITEM(-450, 150, 0),
> );
>
> and...
>
> SOC_DOUBLE_TLV("Headphone Mixer Volume", ES8316_HPMIX_VOL,
> 0, 4, 15, 0, hpmixer_gain_tlv),
>
> Is my understanding correct? If so I'll test it on my board
> (RockPro64) and re-send patch.
>
> BTW, do you know how to get ES8316 I2C registers spec?
> I want to see it for understanding current code, but I cannot find...
>
>
>> Thanks
>> Daniel
>>
>>
>
> Best Regards,
> Katsuhiro Suzuki
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ASoC: es8316: limit headphone mixer volume
2019-08-26 2:53 ` Daniel Drake
2019-08-26 8:41 ` Katsuhiro Suzuki
@ 2019-08-26 9:09 ` Hans de Goede
2019-08-26 15:25 ` Katsuhiro Suzuki
1 sibling, 1 reply; 8+ messages in thread
From: Hans de Goede @ 2019-08-26 9:09 UTC (permalink / raw)
To: Daniel Drake
Cc: Katsuhiro Suzuki, Mark Brown, David Yang, alsa-devel, Linux Kernel
Hi,
On 26-08-19 04:53, Daniel Drake wrote:
> On Mon, Aug 26, 2019 at 1:38 AM Hans de Goede <hdegoede@redhat.com> wrote:
>> On 24-08-19 23:04, Katsuhiro Suzuki wrote:
>>> This patch limits Headphone mixer volume to 4 from 7.
>>> Because output sound suddenly becomes very loudly with many noise if
>>> set volume over 4.
>
> That sounds like something that should be limited in UCM.
>
>> Higher then 4 not working matches my experience, see this comment from
>> the UCM file: alsa-lib/src/conf/ucm/codecs/es8316/EnableSeq.conf :
>>
>> # Set HP mixer vol to -6 dB (4/7) louder does not work
>> cset "name='Headphone Mixer Volume' 4"
>
> What does "does not work" mean more precisely?
IIRC garbled sound.
> I checked the spec, there is indeed something wrong in the kernel driver here.
> The db scale is not a simple scale as the kernel source suggests.
>
> Instead it is:
> 0000 – -12dB
> 0001 – -10.5dB
> 0010 – -9dB
> 0011 – -7.5dB
> 0100 – -6dB
> 1000 – -4.5dB
> 1001 – -3dB
> 1010 – -1.5dB
> 1011 – 0dB
>
> So perhaps we can fix the kernel to follow this table and then use UCM
> to limit the volume if its too high on a given platform?
Yes that sounds like the right thing to do. Katsuhiro can you confirm that
using this table allows using the full scale ? note that the full scale now
has 9 steps rather then 8.
Regards,
Hans
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ASoC: es8316: limit headphone mixer volume
2019-08-26 9:09 ` Hans de Goede
@ 2019-08-26 15:25 ` Katsuhiro Suzuki
0 siblings, 0 replies; 8+ messages in thread
From: Katsuhiro Suzuki @ 2019-08-26 15:25 UTC (permalink / raw)
To: Hans de Goede, Daniel Drake
Cc: Mark Brown, David Yang, alsa-devel, Linux Kernel
Hello Hans, Daniel,
Thank you for reviewing and comment.
On 2019/08/26 18:09, Hans de Goede wrote:
> Hi,
>
> On 26-08-19 04:53, Daniel Drake wrote:
>> On Mon, Aug 26, 2019 at 1:38 AM Hans de Goede <hdegoede@redhat.com>
>> wrote:
>>> On 24-08-19 23:04, Katsuhiro Suzuki wrote:
>>>> This patch limits Headphone mixer volume to 4 from 7.
>>>> Because output sound suddenly becomes very loudly with many noise if
>>>> set volume over 4.
>>
>> That sounds like something that should be limited in UCM.
>>
>>> Higher then 4 not working matches my experience, see this comment from
>>> the UCM file: alsa-lib/src/conf/ucm/codecs/es8316/EnableSeq.conf :
>>>
>>> # Set HP mixer vol to -6 dB (4/7) louder does not work
>>> cset "name='Headphone Mixer Volume' 4"
>>
>> What does "does not work" mean more precisely?
>
> IIRC garbled sound.
>
>> I checked the spec, there is indeed something wrong in the kernel
>> driver here.
>> The db scale is not a simple scale as the kernel source suggests.
>>
>> Instead it is:
>> 0000 – -12dB
>> 0001 – -10.5dB
>> 0010 – -9dB
>> 0011 – -7.5dB
>> 0100 – -6dB
>> 1000 – -4.5dB
>> 1001 – -3dB
>> 1010 – -1.5dB
>> 1011 – 0dB
>>
>> So perhaps we can fix the kernel to follow this table and then use UCM
>> to limit the volume if its too high on a given platform?
>
> Yes that sounds like the right thing to do. Katsuhiro can you confirm that
> using this table allows using the full scale ? note that the full scale now
> has 9 steps rather then 8.
>
I've finished testing this table on my board (RockPro64).
Every values work well without garbled sound.
I checked address 0x16 register via /sys/kernel/debug/regmap too.
The register values and dB (get from alsamixer) are the following if
I increase headphone volume to max from min.
reg dB
0x16 scale
------------
0x00 -12.00
0x11 -10.50
0x22 -9.00
0x33 -7.50
0x44 -6.00
0x88 -4.50
0x99 -3.00
0xaa -1.50
0xbb 0.00
And I found other problem, current code is inverted L/R volume.
It's only in Headphone "mixer" volume. It seems Headphone "master"
volume works correctly.
I'll fix these problems and send V2 patch set.
> Regards,
>
> Hans
>
>
Best Regards,
Katsuhiro Suzuki
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-08-26 15:25 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-24 21:04 [PATCH] ASoC: es8316: limit headphone mixer volume Katsuhiro Suzuki
2019-08-24 21:04 ` Katsuhiro Suzuki
2019-08-25 17:38 ` Hans de Goede
2019-08-26 2:53 ` Daniel Drake
2019-08-26 8:41 ` Katsuhiro Suzuki
2019-08-26 9:00 ` Katsuhiro Suzuki
2019-08-26 9:09 ` Hans de Goede
2019-08-26 15:25 ` Katsuhiro Suzuki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.