Takashi Iwai tiwai@suse.de writes:
Thanks for the patch. But this looks suboptimal, unfortunately, since it keeps the amp always on, and more badly, it would block the power save of the widget root node.
Thanks very much for your feedback; I wasn't sure precisely how this code worked and tried to make a change that was as close as I could manage to existing examples.
Can just using gpio_mute_led_mask=0x18 and gpio_led=0 (also drop AC_VERB_SET_GPIO_DATA in gpio_init[]) work instead? If GPIO4 is the the amp, we can associate it with the master mute control together with the mute LED. The only concern would be the possible click noise, but it doesn't happen on most machines.
It's not quite that simple; the GPIO4 value is inverted from the mute LED value (the amp is powered up when GPIO4 is set).
What I've done is to make the amp powered only when a headphone is plugged in, and then removed the code which was disabling power saving, which lets everything (including the amp) get turned back off when the device goes idle.
Here's a second version of the patch.