Comment 345 for bug 1801540

Revision history for this message
In , haro41 (haro41-linux-kernel-bugs) wrote :

(In reply to Frédéric Pierret from comment #5)
> Hi,
>
> I also had the same problem with my ASROCK X370 Gaming K4 (ALC1220):
>
> 1st case: Booting FIRST Linux: Sound with noise/crackling.
> 2nd case: Booting FIRST Windows and SECOND Linux: Sound is perfect.
>
> I suceed in solving the problem by comparing the Coeff values in both cases
> and assign the values of the second case in a script at boot time. How to:
>
> - Install alsa-tools.
> - In both cases, you have to: echo 1 >
> /sys/module/snd_hda_codec/parameters/dump_coefs
> - Then, in the first case, alsa-info --no-upload --output infos_bad
> - Then, in the second case, alsa-info --no-upload --output infos_good
> - Finally, you compare the coef values: diff infos_bad infos_good | grep
> Coeff
>
> For changing the value of each different Coeff, you need to proceed as
> follow: for example, changing Coeff 0x67 to value 0x3000
>
> hda-verb /dev/snd/hwC0D0 0x20 SET_COEF_INDEX 0x67
> hda-verb /dev/snd/hwC0D0 0x20 SET_PROC_COEF 0x3000
>
> You have to do this in the growing order of Coeff. Remark that hwC0D0 refers
> to your sound card. In case of HDMI output like me, my sound card if hwC1D0.
>
> Here is a quick script:
>
> ------------------------------------------------------------------------
> #!/bin/bash
>
> coeffs=($(echo 0x{16,43,44,5d,5e,63,67}))
> values=($(echo 0x{8020,3405,fa10,0606,0000,e430,3000}))
>
> for i in `seq 0 $(( ${#coeffs[@]} - 1 ))`
> do
> hda-verb /dev/snd/hwC1D0 0x20 SET_COEF_INDEX ${coeffs[$i]} && hda-verb
> /dev/snd/hwC1D0 0x20 SET_PROC_COEF ${values[$i]}
> done
> ------------------------------------------------------------------------
>
> Just change the coeffs to change in the array 'coeffs' and the new values in
> array 'values' and exec this script. A remark, while I do not shutdown the
> power supply, my audio chipset keeps the values. This is why you need to do
> the FIRST case (first...) and then the second. Then, you could test if it
> works only when you shutdown the power supply of your mobo and then booting
> into Linux directly.
>
> I'm preparing a patch for the kernel but for those who have the problem,
> could you post your coeff/values which need to be change please.
>
> Hope this helps.

Hi Frederic,
thank you for sharing your approach and script.
It helped me to solve a problem with my ALC3234 (Dell Optiplex 3040 Micro). The analog output format was limited to 44.1kHz/48kHz after direct linux boot. With a previous Windows boot, additional 96kHz/192kHz are available.

I will attach the adapted script, that works for me. May be it helps someone.