The profile "Off" is selected instead of a profile with a valid output device on it
@tanuk introduced a patch before:
alsa-card: improve the profile availability logic When a new card shows up (during pulseaudio startup or hotplugged), pulseaudio needs to pick the initial profile for the card. Unavailable profiles shouldn't be picked, but module-alsa-card sometimes marked unavailable profiles as available, causing bad initial profile choices. This patch changes module-alsa-card so that it marks all profiles unavailable whose all output ports or all input ports are unavailable. Previously only those profiles were marked as unavailable whose all ports were unavailable. For example, if a profile contains one sink and one source, and the sink is unavailable and the source is available, previously such profile was marked as available, but now it's marked as unavailable. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=102902
With this patch, we found a weird situation on the machine of Lenovo P520, this machine has dual analogue codecs, and to drive both codecs, this machine uses ucm2, with the ucm2, there is only one profile HiFi (of course the PA will build a Off profile), on the HiFi profile, there are output devices like internal speaker, headphone and input devices like linein, because there is no internal mic on it, during the initial process of PA, the HiFi profile is set to available_no because all input devices are available_no (because of the above patch), as a result, the profile Off is selected to be the active_profile.
But we expect the HiFi is the active_profile instead of Off, since there is an internal speaker on this machine, so the profile HiFi always has a valid output device (always available_yes or available_unknown).
I tried to find a solution for this issue, but I haven't got one, this is something i could figure out so far: do a bit change on the above patch,
If a profile has only input devices and at least one of them is not available_no, add a temporary priority bonus to this profile If a profile has only output devices and at least one of them is not available_no, add a temporary priority bonus to this profile If a profile has both input devices and output devices, and both input and output devices have at least one available_yes/unknown device each, add a temporary priority bonus to this profile
If a profile has both input devices and output devices, and only input devices or output devices has available_yes/unknown device, don't change the availability and priority on this profile
Otherwise if all devices on a profile are available_no, set this profile's availability to no.
With this change, the HiFi will not be available_no and has higher priority than Off profile.