Closed loverto closed 2 years ago
The core step to fix this problem on Linux is to customize the sound card initialization and shutdown callback functions. Is there a place to do the same in applealc @vit9696
I started using dump_coeff on my computer to dump the coeff on the mac, but it doesn't work? Help.
RtHDDump.txt dump_coef.txt
@narcyzzo
Failed to find ALCUserClientProvider services.
Failed to find ALCUserClientProvider services.
Do you have alcverbs=1 bootarg?
Instructions updated @ https://github.com/acidanthera/AppleALC/wiki/Dumping-processing-coefficients :
alc-verb
(available in AppleALC releases) must be installed on your path, and must also be enabled inconfig.plist
(either write a non-zero value to thealc-verb
property in DeviceProperties for your card, or addalcverbs=1
toboot-args
).
It has been turned on, and now coefs is the same, but there is still noise when sleeping and waking up, continue to check the Linux source code, sound/pci/hda/patch_realtek.c
Now it can be confirmed that this code is the same for linux and mac.
Fix the noise after suspend and resume on ALC282 codec When the power state of ALC283 codec goes to D3 or return back to D0, it gives a noise via headphone output. To follow the depop procedure, it will be better.
// init
static void alc282_init(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
hda_nid_t hp_pin = alc_get_hp_pin(spec);
bool hp_pin_sense;
int coef78;
alc282_restore_default_value(codec);
if (!hp_pin)
return;
// detect jack
hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
coef78 = alc_read_coef_idx(codec, 0x78);
/* Index 0x78 Direct Drive HP AMP LPM Control 1 */
/* Headphone capless set to high power mode */
alc_write_coef_idx(codec, 0x78, 0x9004);
if (hp_pin_sense)
msleep(2);
snd_hda_codec_write(codec, hp_pin, 0,
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
if (hp_pin_sense)
msleep(85);
snd_hda_codec_write(codec, hp_pin, 0,
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
if (hp_pin_sense)
msleep(100);
/* Headphone capless set to normal mode */
alc_write_coef_idx(codec, 0x78, coef78);
}
//
static void alc282_shutup(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
hda_nid_t hp_pin = alc_get_hp_pin(spec);
bool hp_pin_sense;
int coef78;
if (!hp_pin) {
alc269_shutup(codec);
return;
}
//
hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
coef78 = alc_read_coef_idx(codec, 0x78);
alc_write_coef_idx(codec, 0x78, 0x9004);
if (hp_pin_sense)
msleep(2);
snd_hda_codec_write(codec, hp_pin, 0,
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
if (hp_pin_sense)
msleep(85);
if (!spec->no_shutup_pins)
snd_hda_codec_write(codec, hp_pin, 0,
AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
if (hp_pin_sense)
msleep(100);
alc_auto_setup_eapd(codec, false);
alc_shutup_pins(codec);
alc_write_coef_idx(codec, 0x78, coef78);
}
// Like this code how to fix it in applealc?
// detect jack
hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
coef78 = alc_read_coef_idx(codec, 0x78);
/* Index 0x78 Direct Drive HP AMP LPM Control 1 */
/* Headphone capless set to high power mode */
alc_write_coef_idx(codec, 0x78, 0x9004);
if (hp_pin_sense)
msleep(2);
snd_hda_codec_write(codec, hp_pin, 0,
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
if (hp_pin_sense)
msleep(85);
snd_hda_codec_write(codec, hp_pin, 0,
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
if (hp_pin_sense)
msleep(100);
/* Headphone capless set to normal mode */
alc_write_coef_idx(codec, 0x78, coef78);
@vit9696 @Core-i99 @mikebeaton
Thanks for the cc. It seems to me this is an issue specific to the startup of the given card and layout: with research, you should be able to add/alter the verbs sent to the card to avoid the pops. I believe you can just change the config for your specific card in AppleALC, and if you fix it, make a PR. It is not clear that any change to the main code of AppleALC is needed.
This is not a problem with a single sound card, but a series. On linux, there will be hooks for startup and shutdown to handle this. I looked at the source code of applealc, but I didn't find where it can be operated. Maybe I need an example, I Try to modify the source code of applealc this week.
I've tried putting the command directly into configdata, but that doesn't work
Maybe applealc also needs to open two hooks for initialization and shutdown
This is not a problem with a single sound card, but a series. On linux, there will be hooks for startup and shutdown to handle this. I looked at the source code of applealc, but I didn't find where it can be operated. Maybe I need an example, I Try to modify the source code of applealc this week.
Applealc can send verbs on startup. But not on shutdown, alcplugfix swift can do that.
Applealc uses resources for this, no need for code changes.
I also have the same issue with my MSI B760M-P motherboard's ALC897. The most noticeable manifestation occurs at the beginning of boot at stage two, where the audio device emits 5~6 consecutive loud pop sounds. Is there a universal solution to this problem? Not long ago, my computer suddenly couldn't find the audio device, and after that restart, the motherboard became unresponsive and couldn't boot anymore. As a result, I had to send my motherboard for repairs. I'm not sure if it's related to this issue.@loverto