本帖最后由 Quintus 于 2016-12-12 17:25 编辑
此法须要使用 alsa-tools 内的 hda-verb
在 Debian / Ubuntu, 可以用 sudo apt-get install alsa-tools 安装。
This fix requires the alsa command line tool: hda-verb
You could install the tool in Debian/Ubuntu by sudo apt-get install alas-tools.
方法如下:
Steps:
1.
新增 /etc/modprobe.d/snd-hda-intel.conf 以改变 Intel HDA 各 codec 之次序。
改变 ALC662 为首个 card, 即 /dev/snd/hwC0D0
Add a modprobe conf /etc/modprobe.d/snd-hda-intel.conf for telling snd_hda_intel to set the ALC662 card as the first one.
# -- X62 Intel HDA order ------ options snd-hda-intel model=auto index=1,0
2.
在 /usr/local/bin/ 增加一个脚本 /usr/local/bin/x62-speaker-fix 以 hda-verb 指令设定 Realtek ALC662 之 GPIO 控制功放芯片PAM8403。
Add a script /usr/local/bin/x62-speaker-fix for changing the ALC662 GPIO to turn on the external amplifier PAM8403.
#!/bin/sh # # -- X62 ALC662 GPIO fix ------ ( /usr/bin/hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_MASK 0x01 /usr/bin/hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DIRECTION 0x01 /usr/bin/hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0x00 ) > /dev/null 2>&1
将之设为可执行
Make it executable.chmod a+x /usr/local/bin/x62-speaker-fix
3.
在 /etc/rc.local 加入命令在开机时设定 ALC662 的 GPIO。
Modify /etc/rc.local to include the script so that the ALC662 GPIO is set during boot up. # -- X62 ALC662 GPIO fix ------ /usr/local/bin/x62-speaker-fix
4a.
适合用于 pm-utils
For pm-utils
在 /etc/pm/sleep.d 增加一个脚本 /etc/pm/sleep.d/80-x62-alsa
Add a resume script /etc/pm/sleep.d/80-x62-alsa to fix the GPIO when the machine resumes from suspend.
#!/bin/bash case $1 in thaw|resume) echo "set ALC662 GPIO, 2 seconds after resume..." sleep 2 # Set ALC662 GPIO /usr/local/bin/x62-speaker-fix ;; *) echo "do nothing." ;; esac
将之设为可执行
Make it executable.
chmod a+x /etc/pm/sleep.d/80-x62-alsa
4b.
适合用于 systemd
For systemd
在 /lib/systemd/system-sleep 增加一个脚本 /lib/systemd/system-sleep/x62-alsa
Add a resume script /lib/systemd/system-sleep/x62-alsa to fix the GPIO when the machine resumes from suspend.
#!/bin/sh
case $1 in post) sleep 2 # Set ALC662 GPIO /usr/local/bin/x62-speaker-fix ;; esac
将之设为可执行
Make it executable.chmod a+x /lib/systemd/system-sleep/x62-alsa
5.
再重新开机。重新开机后或许要以 alsamixer 取消扬声器静音。
After adding the scripts and configs, a reboot is needed. You may need to unmute the speaker by using alsamixer after reboot.
更新:
Update:
我发觉休眠后须要重新设定 ALC662 的 GPIO.
The GPIO has to be changed again after resume from suspend.
更新 2016-12-12:
Update 2016-12-12:
更新内文加入休眠后重设 GPIO 的脚本
Added scripts for changing GPIO after resume.
增加英文翻译
Added English translations.
|