[SOLVED] Volumio 2.118 Odroid C2 volume problem

Hi All,

I downloaded and tested new version of Volumio 2.118 for Odroid C2.
The volumio is something problem.

The alsa command “amixer -c 1 sset Digital 201” for the volume level has sound distortion.
The volume is very very loud compared with Volumio 2.030.

There is any change in the sound card driver?
What is the recommended value for the “amixer -c 1 Digital” and what is the value for the 100% volume level ?

We are still waiting for Hardkernel to fix this, there is nothing the team can do at the moment.
Mixer settings have no real effect, it gets overruled as soon as you touch amixer through the Volumio UI.
100% would be 255 and that is exactly the problem. This gives +24 instead of 0dB

I think something changed in driver source code from version 2.030.
Could you share the change information for the driver source code?
I want to check the source code anyway. :slight_smile:

https://github.com/hardkernel/linux/blob/odroidc2-3.14.y/sound/soc/codecs/pcm512x.c
I experimented with line 234 and used different values instead of 255.

static const struct snd_kcontrol_new pcm512x_controls[] = { SOC_DOUBLE_R_TLV("Digital Playback Volume", PCM512x_DIGITAL_VOLUME_2, PCM512x_DIGITAL_VOLUME_3, 0, 255, 1, digital_tlv),

I’m now testing with this patch, it is similar to what @barturblits pointed me to for Hifiberry.

[code]diff --git a/sound/soc/aml/m8/odroid_dac2.c b/sound/soc/aml/m8/odroid_dac2.c
index fb8c153…72edb3c 100644
— a/sound/soc/aml/m8/odroid_dac2.c
+++ b/sound/soc/aml/m8/odroid_dac2.c
@@ -50,6 +50,24 @@

#define DRV_NAME “odroid_dac2”

+static bool digital_gain_0db_limit = true;
+
+static int odroid_dac2_init(struct snd_soc_pcm_runtime *rtd)
+{

  •   if (digital_gain_0db_limit)
    
  •   {
    
  •           int ret;
    
  •           struct snd_soc_card *card = rtd->card;
    
  •           struct snd_soc_codec *codec = rtd->codec;
    
  •           ret = snd_soc_limit_volume(codec, "Digital Playback Volume", 207);
    
  •           if (ret < 0)
    
  •                   dev_warn(card->dev, "Failed to set volume limit: %d\n", ret);
    
  •   }
    
  •   return 0;
    

+}
+
static int dac2_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
@@ -104,6 +122,7 @@ static struct snd_soc_dai_link dac2_dai_link[] = {
.codec_name = “pcm512x.1-004c”,
.codec_dai_name = “pcm512x-hifi”,
.ops = &odroid_ops,

  •           .init = odroid_dac2_init,
      },
    

};
[/code]

Bingo!!!
Problem eliminated :smiley: :smiley: :smiley:

This is what I get now

volumio@volumio:~$ amixer sget Digital -c 1 Simple mixer control 'Digital',0 Capabilities: pvolume pswitch Playback channels: Front Left - Front Right Limits: Playback 0 - 207 Mono: Front Left: Playback 207 [100%] [0.00dB] [on] Front Right: Playback 207 [100%] [0.00dB] [on]
No clipping anymore

I compiled the kernel for a test version, based on Volumio 2.118
click here for downloading version Volumio-patched-dac2-2017-03-09-odroidc2.img.zip

An official Volumio C2 image (and of course C1) will be made available as soon as I have positive feedback.
I will make sure the patch goes to Hardkernel afterwards. Edit: done…

– Gé –

Yes you did it! Wow! Works great!
Mucho gracias!

Yep, but very grateful for your Hifiberry pointer.
I looked at various dac drivers for the pcm512x codec, both legacy and mainline et voilà.
So, mucho gracias too!

;-D

O btw, did you change the /opt/odroiddac.sh script for the shield 2?
Looking at the code now and see Digital is set to 102, is that old or new?
Would this not be better new defaults:

amixer -c 1 sset Analogue 1
amixer -c 1 sset Deemphasis on

Removal of Digital, don’t think it has any function now. I guess volumio sets amixer to the user specified value (volume button) during playback. After reboot that value probably will be used but when volumio starts, it will be set to the default startup volume set in the volumio settings.
Would setting analogue to 1 be an idea? As I read 1 is default (no modification of the audio) and 0 is lowering volume.
Don’t now what Deemphasis does yet.

No, I didn’t, yet. Anyway, the setting is overruled by volumio anyway. They have no effect in our case…

Great news!!!
Thank you :laughing: