This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to save volume set by amixer ?

platform: DM8168, DVRRDK3.5.

I recently encountered a strange problem。I used cmd  amixer  to set  the board output volume 。

root@dm816x:/opt/dvr_rdk/ti816x/bin# amixer  -c 0 cget numid=10
numid=10,iface=MIXER,name='Playback Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=255,step=0
  : values=255,255
  | dBscale-min=-127.00dB,step=0.50dB,mute=1
root@dm816x:/opt/dvr_rdk/ti816x/bin# amixer  -c 0 cset numid=10 100
numid=10,iface=MIXER,name='Playback Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=255,step=0
  : values=100,100
  | dBscale-min=-127.00dB,step=0.50dB,mute=1
root@dm816x:/opt/dvr_rdk/ti816x/bin# amixer  -c 0 cget numid=10
numid=10,iface=MIXER,name='Playback Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=255,step=0
  : values=100,100
  | dBscale-min=-127.00dB,step=0.50dB,mute=1

and now , the volume have been set to "100,100".  Then I  used program "aplay" to play a sound ,but it‘s too load.  So i check the volume again ,then I 

found the volume  was  modefied  to "255,255" again。

root@dm816x:/opt/dvr_rdk/ti816x/bin# aplay moto.wav -D default:CARD=SOUND0
Playing WAVE 'moto.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
root@dm816x:/opt/dvr_rdk/ti816x/bin# amixer  -c 0 cget numid=10
numid=10,iface=MIXER,name='Playback Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=255,step=0
  : values=255,255
  | dBscale-min=-127.00dB,step=0.50dB,mute=1

I don't how to solve this problem.  I google this issue , but have no use. 

Anyone can give me help? thanks.

  • Hi,Pavel, thank you for your reply。
    I checked this 2 pages , but i still can not solve this problem.
    I write a program: alsa_play with alsa lib. I can used amixer to set the volume to 100 successfully , but when i played the moto.wav by alsa_play or aplay, the volume was modified to 255 again. And now the problem is , how can I set the audio to the local that I do not need to re set up every time when i play an audio.
    Best regards.
  • Peng,

    I have checked this on my side (EZSDK on DM816x TI EVM) and it works fine.

    I am doing the below steps:

    1. Check which is my playback volume id:

    root@dm816x-evm:~# amixer controls
    numid=1,iface=MIXER,name='PCM Playback Volume'
    numid=22,iface=MIXER,name='Line DAC Playback Volume'
    numid=20,iface=MIXER,name='Line Line2 Bypass Volume'
    numid=21,iface=MIXER,name='Line PGA Bypass Volume'
    numid=32,iface=MIXER,name='Line Playback Switch'
    numid=25,iface=MIXER,name='Mono DAC Playback Volume'
    ..........

    Mine is numid 1

    2. Check the default settings:

    root@dm816x-evm:~# amixer cget numid=1
    numid=1,iface=MIXER,name='PCM Playback Volume'
      ; type=INTEGER,access=rw---R--,values=2,min=0,max=127,step=0
      : values=87,87
      | dBscale-min=-63.50dB,step=0.50dB,mute=0

    3. Play a wav file and hear the sound:

    root@dm816x-evm:~# aplay WaveData.wav
    Playing WAVE 'WaveData.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

    4. Set/increase the playback volume from default/87 to 110:

    root@dm816x-evm:~# amixer cset numid=1 110
    numid=1,iface=MIXER,name='PCM Playback Volume'
      ; type=INTEGER,access=rw---R--,values=2,min=0,max=127,step=0
      : values=110,110
      | dBscale-min=-63.50dB,step=0.50dB,mute=0

    5. Check the new settings:

    root@dm816x-evm:~# amixer cget numid=1
    numid=1,iface=MIXER,name='PCM Playback Volume'
      ; type=INTEGER,access=rw---R--,values=2,min=0,max=127,step=0
      : values=110,110
      | dBscale-min=-63.50dB,step=0.50dB,mute=0

    6. Play a wav file and hear the sound:

    root@dm816x-evm:~# aplay WaveData.wav
    Playing WAVE 'WaveData.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

    The sound/volume is increased.

    7. Set/decrease the playback volume from 110 to 20:

    root@dm816x-evm:~# amixer cset numid=1 20
    numid=1,iface=MIXER,name='PCM Playback Volume'
      ; type=INTEGER,access=rw---R--,values=2,min=0,max=127,step=0
      : values=20,20
      | dBscale-min=-63.50dB,step=0.50dB,mute=0

    8. Check new settings are valid:

    root@dm816x-evm:~# amixer cget numid=1
    numid=1,iface=MIXER,name='PCM Playback Volume'
      ; type=INTEGER,access=rw---R--,values=2,min=0,max=127,step=0
      : values=20,20
      | dBscale-min=-63.50dB,step=0.50dB,mute=0

    9. Play a wav file and hear the sound:

    root@dm816x-evm:~# aplay WaveData.wav
    Playing WAVE 'WaveData.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

    The sound/volume is decreased.

     

    Can you try that flow on your side?

    BR
    Pavel

  • Hi Pavel, I tried as you said. The problem is still there. I consider to change a new file system to try again.
  • Peng,

    Try also with the latest DM816x DVR RDK linux kernel code base, available at the below location:
    http://arago-project.org/git/projects/?p=linux-dvr-rdk-dm81xx.git;a=shortlog;h=refs/heads/dvrrdk_kernel_int_branch

    Regarding rootfs, the one I use is from DM816x EZSDK:
    ti-ezsdk_dm816x-evm_5_05_02_00/filesystem/ezsdk-dm816x-evm-rootfs.tar.gz

    You can explore this filesystem for a reference.

    BR
    Pavel

  • Hi Pavel, I have solved this problem.

    There is something wrong  configure in my kernel code /kernel/sound/soc/codec/wm8960.c file . I changed it , and now it workd fine.

    I delete the two below code in function: "wm8960_hw_params(****)";

    	snd_soc_write(codec,  0x0a, 0x1ff);
    	snd_soc_write(codec,  0x0b, 0x1ff);	

    In my wm8960 datasheet,  address 0xa 0xb control the left and right  DAC volume. While some program access the alsa driver, the function will  resetup the two reg status.  So i delete this two code.

    Thanks.

  • Hi Peng,

    Thank you for sharing the solution.

    Regards,
    Pavel