chromebook_trogdor: status: coachz (hp chromebook x2 11) (Lenovo Duet 5)
Geofferey opened this issue · 25 comments
Notes on Coachz + Homestar running 5.19.1
Here is list of working and non working features on the HP Chromebook X2 '11 (aka coachz - 11-da0023dx). I will update accordingly with detailed issues, logs and proposed fixes. My goal in long run is to find solutions to high priority issues such as suspend, lack of audio, touch issues and others. If we can get the right people looking at this stuff and trying things out we'll have a good chance.
In an extremely unfortunate incident I ended up dropping my X2 '11. Sadly a brand new display assembly cost nearly as much as a new device so I went out and bought featuring the SC7180 SoC (Lenovo Duet 5). Fortunately, the devices are nearly 100% identical in terms of hardware and fixes and everything here can be applied to the device.
Working
• WiFi
• Bluetooth
• Pen input
• Detachable KB/Mouse
• Internal EMMC installation (#43)
• USB C
• DisplayPort
• 3D Accelerated graphics (#41)
• H/W video decode
• Suspend (works on 5.16.X
up)
Partial
• Touch (libinput needs quirks + reporting to freedesktop)
• Orientation sensor (inverted)
• Built-in audio / speakers (kernel/userland)
• Built-in microphone (gain)
• KVM (no networking)
Broken
• Rear & front camera (they're crap anyways)
• DPMS (display off) (coachz)
Untested
• Fingerprint sensor
Touchscreen Issues
There appears to be an issue with the touch screen, Xorg and libinput
where it will stop functioning once the user creates a substantial pressure point (e.g. resting thumb) on display. Wayland does not appear to be affected in the same way, so there's a consideration.
- Luckily all we need to do is install
xserver-xorg-input-evdev
and tell our touchscreen to utilize that driver.
-
sudo apt-get install xserver-xorg-input-evdev
-
sudo nano /usr/share/X11/xorg.conf.d/40-libinput.conf
-
Locate
MatchIsTouchscreen "on"
and changeDriver "libinput"
toDriver "evdev"
• FOR REFERENCE:
- There is also a workaround to the issue on Xorg that I discovered accidentally while running TouchEgg to simulate right click which still functions while Xorg is failing to recognize touch.
-
Install TouchEgg and Touchè from the releases via
dpkg -i
& reboot -
Open Touchè, if you can't find an icon just execute
com.github.joseexposito.touche
in terminal. -
In
Global gestures
>Tap
>Tap with 3 fingers
set toExecute a command
and addxinput disable 6 && xinput enable 6
as the command to execute.
Now when touch stops responding all you will have to do is tap the screen with 3 phalanges and you'll be back in action. Another potential solution could involve using something like xbindkeys
and your imagination to achieve a similar result. Also, if you run LightDM and don't want to experience this problem on the login screen try switching to GDM3 which uses Wayland.
Sound Fixes
Turns out we can get the sound working as well. By the way this is all very confusing to me how ucm
(use case manager) works, in general I think it's broken for whatever reason and that's why I'm confused. I figured out the root cause is partially due to the ordering of sound devices in the sc7180-trogdor.dtsi
a quick modification to the file and rebuild of kernel will fix us right up.
sc7180-trogdor.dtsi
Before:
dai-link@0 {
link-name = "MultiMedia0";
reg = <MI2S_PRIMARY>;
cpu {
sound-dai = <&lpass_cpu MI2S_PRIMARY>;
};
sound_multimedia0_codec: codec {
sound-dai = <&alc5682 0 /* aif1 */>;
};
};
dai-link@1 {
link-name = "MultiMedia1";
reg = <MI2S_SECONDARY>;
cpu {
sound-dai = <&lpass_cpu MI2S_SECONDARY>;
};
sound_multimedia1_codec: codec {
sound-dai = <&max98360a>;
};
};
sc7180-trogdor.dtsi
After:
dai-link@1 {
link-name = "MultiMedia1";
reg = <MI2S_SECONDARY>;
cpu {
sound-dai = <&lpass_cpu MI2S_SECONDARY>;
};
sound_multimedia1_codec: codec {
sound-dai = <&max98360a>;
};
};
dai-link@0 {
link-name = "MultiMedia0";
reg = <MI2S_PRIMARY>;
cpu {
sound-dai = <&lpass_cpu MI2S_PRIMARY>;
};
sound_multimedia0_codec: codec {
sound-dai = <&alc5682 0 /* aif1 */>;
};
};
☝️See what I did there? 🤣 I'm still not convinced this is most appropriate solution. I have created a sc7180-trogdor.dtsi.patch
in case anyone may find it useful. It should be noted; the patch sacrifices automatic set-up of mic in favor of speakers because alsa seems inclined to configure hw:0,0
automatically.
• FOR REFERENCE (coachz
)
aplay - l
does report having HiFI-1
card 2: sc7180adau7002m [sc7180-adau7002-max98357a], device 1: MultiMedia1 HiFi-1 []
Subdevices: 1/1
Subdevice #0: subdevice #0`
Running aplay -D plughw:2,1 /home/geofferey/Downloads/piano2.wav
got me sound output. Yay!
Using info I obtained from Arch: ALSA/Troubleshooting I created /etc/asound.conf
with the following
pcm.!default {
type hw
rate 48000
card 2
device 1
}
defaults.pcm.card 2
defaults.pcm.device 1
defaults.ctl.card 2
Please keep in mind on my machine it's card 2
- device 1
because I have dummy and loopback audio drivers. Yours will likely be card 0
or card 1
; which is why the above solution may not be ideal, especially for inclusion in images. It also breaks automatic redirection to USB C headphones. More investigation is required.
Here is some more output of other commands in case anyone may be able to tell me what's going on with UCM.
cat /proc/asound/cards
reports:
0 [sc7180adau7002m]: SC7180 - sc7180-adau7002-max98357a
sc7180-adau7002-max98357a
Here is message from alsactl init
:
alsa-lib main.c:1014:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -2
Found hardware: "SC7180" "" "" "" ""
Hardware is initialized using a generic method
This is what I could find in dmesg
:
[ 5.422974] max98357a audio-codec-0: GPIO lookup for consumer sdmode
[ 5.422989] max98357a audio-codec-0: using device tree for GPIO lookup
[ 5.620411] debugfs: Directory '62d87000.lpass' with parent 'sc7180-adau7002-max98357a' already present!
[ 5.677936] input: sc7180-adau7002-max98357a HDMI Jack as /devices/platform/sound/sound/card0/input6
Lid Switch Fixes
I noticed during my time using homestar and coachz that leaving the keyboard attached and closed leads to spurious mouse input if not in sleep state. Since I do not always want to sleep when I close the lid + plug waking device it got really annoying and hazardous to my working conditions. At first I thought it was related to touch input but it was actually caused by the touchpad. Another issue with lid switch is due to how upower/XFCE handle it in order to blank screen and often results in a black screen that stays after opening the keyboard flap. Below are some workarounds and scripting wizardry.
-
sudo apt-get install acpid brightnessctl
-
set
IgnoreLid=true
in/etc/Upower/Upower.conf
-
optionally set
HandleLidSwitch=ignore
in/etc/systemd/logind.conf
-
create the following file in
/etc/acpi/events/lidswitch
# /etc/acpi/events/lidswitch
# run a script on lid open/close events
event=button/lid
action=/etc/acpi/actions/acpi-lid-switch.sh "%e"
- create the script in
/etc/acpid/actions/acpi-lid-switch.sh
#!/bin/sh
## This script is intended to be ran by ACPID daemon on lid switch events with the goal of disabling/re-enabling
# local tochpad on Chromebook trogdor + display on lid close/open. There is an issue with the touchpad that causes
# spurious input while the lid is closed and not suspeded + XFCE/upowers method of screen blanking causes issues
# with resuming session after opening the keyboard flap.
LOGFILE=/dev/null
## This is all being done so root can get display # and session cookie of the foreground users console
FG_USER=$(stat -c%U /dev/tty$(fgconsole))
FG_UID=$(id -u ${FG_USER})
FG_TTY="tty$(fgconsole)"
FG_XORG_PID=$(pgrep -xt ${FG_TTY} Xorg)
FG_XDISPLAY=:$(lsof -aUp "${FG_XORG_PID}" | sed '\|.*X11-unix/X\([0-9]\{1,\}\) .*|!d;s//\1/;q')
echo "$1" >> ${LOGFILE}
echo $(whoami) >> ${LOGFILE}
echo FG_USER=${FG_USER} >> ${LOGFILE}
echo FG_UID=${FG_UID} >> ${LOGFILE}
echo FG_TTY=${FG_TTY} >> ${LOGFILE}
echo FG_XORG_PID=${FG_XORG_PID} >> ${LOGFILE}
echo FG_XDISPLAY=${FG_XDISPLAY} >> ${LOGFILE}
export DISPLAY=$FG_XDISPLAY
## Just guessing some possible display managers to locate Xorg session cookie, not tested with other DMs
DMS="gdm lightdm"
for DM in ${DMS}; do
if [ -e /run/user/${FG_UID}/${DM}/Xauthority ]; then
export XAUTHORITY=/run/user/${FG_UID}/${DM}/Xauthority
echo DISPLAY_MANAGER=${DM} >> ${LOGFILE}
fi
done
state=$(echo "$1" | cut -d " " -f 3)
case "$state" in
close)
# Disable touchpads/screen on lid close to prevent phantom touches
echo "Disabing touch devices..." >> ${LOGFILE}
/usr/bin/synclient touchpadoff=1 >> ${LOGFILE}
/usr/bin/xinput disable "pointer:Google Inc. Hammer" >> ${LOGFILE} 2>&1
#/usr/bin/xinput disable "pointer:gt7375p 27C6:0E51" >> ${LOGFILE} 2>&1
/usr/bin/brightnessctl --save
/usr/bin/brightnessctl s 0
;;
open)
# Re-enable the touch devices after opening the lid
echo "Enabling touch devices..." >> ${LOGFILE}
/usr/bin/xinput enable "pointer:Google Inc. Hammer" >> ${LOGFILE} 2>&1
#/usr/bin/xinput enable "pointer:gt7375p 27C6:0E51" >> ${LOGFILE} 2>&1
/usr/bin/synclient touchpadoff=0 >> ${LOGFILE}
/usr/bin/brightnessctl --restore
;;
*)
# panic: not a state I know about!
echo "PANIC STATE" >> ${LOGFILE}
esac
echo "" >> ${LOGFILE}
Updating Kernel
In order to get KVM networking, waydroid, various USB peripherals and many other features working I opt'd to build mine from source following instructions from these repos. I have also written a simple script
to automate the process for myself and others. Here is a link to my current kernel configuration
. It has support for many of items mentioned above.
..... to be continued....
Regarding your touchscreen issues: If you update to debian unstable, there should be no issue using Wayland with either Gnome or KDE
i really like the idea to have such an issue per system to discuss its current state and problems - i have just renamed the title a bit so that we have an easy to find subject directly related to the system name in the framework - i hope this is ok?
@hexdump0815 figured out the sound, partially. At least I have it working for me now ;)
@leezu So Mate can potentially run on Wayland now?
Both KDE and Gnome work well with Wayland. My understanding is that touchscreen and gesture support is better on Wayland, but X11 may have improved since last time I checked.
Updated with a better solution to touch screen issues on Xorg. I had tried evdev
before but it wasn't actually installed. I guess Xorg was falling back to libinput
in its absence and giving me wrong impressions. Touchscreen works perfect on X now, better than Wayland.... Some issue in gnome when moving icons...
On 230922-01 Bookworm, touchscreen and pen input were not working out of the box. Enabling the Goodix hid-i2c driver in kernel config made it work out of the box, at least on GNOME Wayland.
@pulak1901 - thanks a lot for the report - which kernel config options exactly did you have to enable to get it working? i would like to add them for future kernels then.
@hexdump0815 - just I2C_HID_OF_GOODIX.
Regarding audio output, it seems the kernel alsa drivers are working fine, but as there is no UCM, pulseaudio is automatically configuring the default device (0) internal mic.
The other devices are
- (1) internal speakers
- (2) it's got i2s in the name when you run
aplay -l
, so digital output/hdmi?
The only UCM config available for SC7180 is sc7180-rt5682-max98357a, but as coachz does not have rt5682, it is not matched. I tried forcing it to use the same config but that did not go well, I think rt5682 exposes a lot of configurations that are set with cset but adau7002 does not appear to have anything similar.
Workaround for just speakers, no mic
Note that simply creating /etc/asound.conf
with defaults.pcm.device 1
(thanks to the notes in @Geofferey 's initial post) will set the default device to the speaker and on subsequent reboots, pulseaudio will auto-configure the speakers instead of the mic.
Device Details
To verify the order of devices, we can use aplay & arecord:
$ aplay -L
...
hw:CARD=sc7180adau7002m,DEV=1
sc7180-adau7002-max98357a,
Direct hardware device without any conversions
hw:CARD=sc7180adau7002m,DEV=2
sc7180-adau7002-max98357a,
Direct hardware device without any conversions
...
$ arecord -L
...
hw:CARD=sc7180adau7002m,DEV=0
sc7180-adau7002-max98357a,
Direct hardware device without any conversions
...
To have both internal mic & internal speakers working, I figured out how to create a very basic UCM config that will point alsa/pulseaudio to the correct devices.
UCM
First make a directory for the new UCM config
# cd /usr/share/alsa/ucm2/Qualcomm/sc7180/
# mkdir adau7002-max98357a && cd adau7002-max98357a
Inside this new directory, we'll have two files. One for the actual use case configuration, and another which acts as a loader. The loader will be named sc7180-adau7002-max98357a-1mic.conf
, and it'll contain the following: (based on sc7180-rt5682-max98357a-1mic.conf
Comment "SC7180 ADAU7002 MAX98357A single microphone sound card"
Syntax 4
SectionUseCase."HiFi" {
File "/Qualcomm/sc7180/adau7002-max98357a/HiFi.conf"
Comment "Default"
}
Include.card-init.File "/lib/card-init.conf"
Include.ctl-remap.File "/lib/ctl-remap.conf"
The other file will be named HiFi.conf, containing the following
SectionDevice."Speaker".0 {
Value {
PlaybackPCM "hw:CARD=${CardId},DEV=1"
PlaybackChannels 2
PlaybackRate 48000
PlaybackPriority 100
PlaybackMixerElem "Speaker"
PlaybackVolume "Speaker Playback Volume"
}
}
SectionDevice."Internal Mic".0 {
Value {
CapturePCM "hw:CARD=${CardId},DEV=0"
CapturePriority 100
CaptureMixerElem "Internal Mic"
CaptureVolume "Internal Mic Capture Volume"
}
}
#SectionDevice."HDMI".0 {
# Value {
# PlaybackPCM "hw:CARD=${CardId},DEV=2"
# }
#}
As I do not have any way to test the HDMI output, I've commented it out from the UCM config because it will conflict with the rest of the configuration.
Also note that only the PlaybackPCM and CapturePCM values are required, the rest should be automatically configured. I've taken the other values from sc7180-rt5682-max98357a & added PlaybackRate based on the output of pulseaudio -vvv
.
Now we just need to add this to the ucm configurations list, so:
cd /usr/share/alsa/ucm2/conf.d/SC7180
ln -s ../../Qualcomm/sc7180/adau7002-max98357a/sc7180-adau7002-max98357a-1mic.conf sc7180-adau7002-max98357a.conf
And we're done! On rebooting (or restarting pulseaudio), both speaker and internal mic should be working.
@pulak1901 - for the audio setup it is usually a good idea to start from the chromeos ucm files and go from there - they usually will not work out of the box, but can give some direction - see also: https://github.com/hexdump0815/imagebuilder/blob/main/doc/alsa-ucm-pulseaudio-hacking.txt ... also be careful to always keep the volume low and try to avoid feedback within the internal mixer to keep the speakers and your ears well - also never put headphones fully on the head when trying to get audio working ... good luck
update: there also some audio notes in the issue description as well
@hexdump0815 the UCM config is indeed based on chrome os' [UCM] (https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+/refs/heads/main/overlay-strongbad/chromeos-base/chromeos-bsp-strongbad/files/coachz/audio/ucm-config/sc7180-adau7002-max98357a/HiFi.conf) (doesn't work directly) and the audio-related notes from @Geofferey helped me quite a bit
Additionally, I went through the postmarketOS wiki on UCM, plus the alsa configuration docs to figure out how the config files are loaded and how to debug the config
I think if we finish up the UCM (mic gain is too low, and the hdmi output), we'll have a complete Debian setup on coachz out of the box(ignoring fingerprint reader and webcams), so I'm trying to clear out any of the deal breakers that I come across :)
For instance, the touchscreen was not working out of the box, so I checked the device tree and it's a goodix touchscreen. I checked with the postmarketOS build and realized that it was only the driver that was missing, no other configuration is required
Edit: thanks for the volume warning :D, its really a "once bitten, twice shy" situation for me because I've already experienced that with Arch Linux a decade ago :P
Edit 2: I think with https://github.com/hexdump0815/imagebuilder/blob/main/doc/alsa-ucm-pulseaudio-hacking.txt I'll be able to figure out the microphone gain and the rest of the UCM config
With PostmarketOS, and maybe with these images (I haven't tried in a while), the touchpad is another issue: it's like the pressure threshold is too high. If I use the tip of my finger lightly, the cursor doesn't move, even though libinput debug-gui
shows the finger's presence. It's only when I use the flat of my finger that the cursor starts moving and the debug-gui starts drawing lines. But then if I press a little bit harder, it goes back to ignoring the finger, as if it's exceeding a palm-detect threshold or something.
@DanaGoyette Yeah that's the dreaded touch cancel
event. It happens on both the touchscreen and touchpad. Something called quirks
may help address the issue, I'm not sure if it's a kernel event that libinput can't ignore or what. I wish I could just disable that event somehow or adjust the threshold.
i have no idea if it helps, but in this issue - #53 - a lot of things were tried/done to significantly improve the touch functionality on kukui krane (so completely different chromeos device) - maybe reading through it helps and/or is good for some inspiration?
Thankfully libinput provides a whole host of tools to debug input issues. By mostly following the official docs I was able to figure out that the touchpad down pressure is 60 (light touches, like the tip of your finger, would register at around 30-40 from what I can see) and palm threshold is at 160.
You can then set your desired values in the following quirks configuration to /etc/libinput/local-overrides.quirks
or to /usr/share/libinput/
(50-system-google.quirks
has configurations for other Chromebooks)
[HP Chromebook X2 11"]
MatchUdevType=touchpad
MatchName=Google Inc. Hammer
MatchDeviceTree=*coachz*
ModelChromebook=1
AttrPressureRange=25:10
AttrPalmPressureThreshold=180
Notes:
- AttrPressureRange=X:Y means X is the minimum pressure required for a touchpad down(touch) event. Y is the same for the "up" event and must be less than X
- AttrPalmPressureThreshold seemed to work well enough at both 180 and 200 for me
Instead of boosting the gain in Pulseaudio (as mentioned here), I have been trying to figure out if I could have a boosted alsa pcm stream as the default for the mic. Unfortunately I couldn't get it to work by adding a card-specific configuration at /usr/share/alsa/cards, and it looked like pulse will grab the hardware stream anyways, so I'm leaving the mic gain situation for now.
Here's the softvol alsa config if anyone is interested.
Alsa softvol configuration
Put this in your .asoundrc or asound.conf and arecord -L
should show "boosted". On opening this stream for the first time, alsamixer should also show a "Boost" control.
pcm.boosted
{
type softvol
slave {
pcm "hw:CARD=sc7180adau7002m,DEV=0"
}
control {
name "Boost Capture Volume"
card 0
device 0
}
max_dB 40.0
min_dB -10.0
}
Updated with a workaround for some issues with touchpad mouse / lidswitch on XFCE/Xorg...
@pulak1901 I have yet to implement your sound fixes but I did want to say how much I appreciate your input on the matter, as soon as I can I'll let you know how it goes :) Thank you for sharing!
- Potential solution for
homestar
below:
UPDATE:
Welp I tried it out. There are some differences between homestar
and coachz
when it comes to sound. Homestar is using sc7180rt5682max
. I was able to get pulseaudio
to successfully detect both of my devices with and without ucm2
buuuut absolutely no input from mic. The same goes for testing with arecord
, nada. When I was playing with coachz
at least I was able to hear the faintest of sound from it. Since then I've learned more tricks with pulseaudio default.pa
that probably would've had it working.... I wonder if this issue with mic on homestar
is lower level at this point. If anyone was playing with mic on homestar and able to record anything please lemme know 🙏
UPDATE 2:
I screwed around until I found out and now I have working microphone.... Turns out a lil tinkering with alsamixer
did the trick. I'm still not 100% sure on exact combination of things that need to be done but I have part of it for sure...
amixer -c 2 cset numid=22,iface=MIXER,name='Stereo1 ADC MIXL ADC2 Switch' 0
amixer -c 2 cset numid=22,iface=MIXER,name='Stereo1 ADC MIXL ADC2 Switch' 1
I ended up nuking the ucm2 configs for the card and removing /var/lib/asound.state
, afterwards I used alsamixer
to toggle on a bunch of muted crap + capture. The lines above are being ran on login for time being to toggle that required mix. Otherwise I just hear static if I attempt to utilize mic after reboot, relying solely on asound.state
. As it appears only an extremely simple UCM init configuration will be needed to get mic.
I'm attaching my current asound.state
in hopes of it helping....
UPDATE 3:
After further investigation I'm pretty sure I've nailed down the appropriate combination of alsamixer settings to enable stereo microphone input on homestar!!! This should lead up to an appropriate init .conf
sequence for UCM once I've mapped everything out. Still, I believe something is fundamentally off with UCM2... So far I have only been able to get microphone to load correctly in HiFi.conf
and after dicking around with it FOR HOURS I decided it just doesn't work. Maybe some issue with UDEV rules, audio device naming or something. Anyways it seems to cause more conflicts than anything, even being stripped down to what @pulak1901 detailed. I've since neutered it to only initialize amixer
settings for the microphone.
- Here are the commands you can run to test.
/usr/bin/amixer -c 2 cset numid=22,iface=MIXER,name='Stereo1 ADC MIXL ADC2 Switch' 0
/usr/bin/amixer -c 2 cset numid=22,iface=MIXER,name='Stereo1 ADC MIXL ADC2 Switch' 1
/usr/bin/amixer -c 2 cset numid=24,iface=MIXER,name='Stereo1 ADC MIXR ADC2 Switch' 0
/usr/bin/amixer -c 2 cset numid=24,iface=MIXER,name='Stereo1 ADC MIXR ADC2 Switch' 1
/usr/bin/amixer -c 2 cset numid=25,iface=MIXER,name='IF1 01 ADC Swap Mux' 0
/usr/bin/amixer -c 2 cset numid=16,iface=MIXER,name='Stereo1 ADC L2 Mux' 1
/usr/bin/amixer -c 2 cset numid=17,iface=MIXER,name='Stereo1 ADC R2 Mux' 1
- Updates to
/usr/share/alsa/ucm2/Qualcomm/sc7180/rt5682-max98357a/sc7180-rt5682-max98357a-1mic.conf
:
#Comment "SC7180 RT5682 MAX98357A single microphone sound card"
Syntax 4
Include.card-init.File "/lib/card-init.conf"
Include.ctl-remap.File "/lib/ctl-remap.conf"
Include.init.File "/Qualcomm/sc7180/rt5682-max98357a/init.conf"
- Updates to
/usr/share/alsa/ucm2/Qualcomm/sc7180/rt5682-max98357a/init.conf
:
BootSequence [
# Internal mic on ALC5682
cset "name='IF1 01 ADC Swap Mux' 0"
cset "name='Stereo1 ADC L2 Mux' 1"
cset "name='Stereo1 ADC R2 Mux' 1"
cset "name='Stereo1 ADC MIXL ADC2 Switch' 0"
cset "name='Stereo1 ADC MIXL ADC2 Switch' 1"
cset "name='Stereo1 ADC MIXR ADC2 Switch' 0"
cset "name='Stereo1 ADC MIXR ADC2 Switch' 1"
]
- Creation of
/etc/pulse/default.pa.d/sc7180rt5682max.pa
## Manually adding speaker sink for sc7180rt5682max since /usr/share/alsa/ucm2/Qualcomm/sc7180/rt5682-max98357a/HiFi.conf
# doesn't seem to be entirely respected, I can get it to break things but not work, init sequence seems to work fine
.nofail
## Loading sink module for speakers with default sc7180-trogdor.dtsi, uneeded if dtsi is patched
load-module module-alsa-sink device=plughw:sc7180rt5682max,1
## If kernel is patched to re-order speakers as first device, comment above, uncommment below and set to 1 to enable mic
load-module module-alsa-source device=plughw:sc7180rt5682max,0
.fail
- After edits run (init settings do not apply on boot):
sudo alsactl init && pulseaudio -k
, everything should be working now.
Now I just gotta figure out those pesky little cameras, if at all possible. I have some ideas involving Waydroid. It may be possible to utilize the camera blobs from CROS's android implementation. This would likely isolate cameras to Waydroids container but it would still be awesome.
@hexdump0815 I just wanted to take one more moment to say how much I truly appreciate this project! I have a one of a kind device in large part to you and everyone that has contributed. On top of it all I have learned LOADS!!! Thanks again my friend. :)
@Geofferey - thanks a lot for your nice and positive feedback - i'm very happy to hear that as this was and is my intention with this project: to make it easier to get started with linux on some usually not so well supported platforms, to maybe encourage people to try to improve some of the still missing details around those images and to maybe build a little community across the github issues which brings the whole thing a bit forward in small steps at the benefit of others as well ... thanks once more
@Geofferey - oh and before i forget: thanks a lot for your contributions - writing things down as detailed as you did gives a very good starting point for others to use and/or extend the information
Since I finally got my hands on a usb hdmi adapter, here's a status update on my attempts to get it working with UCM out-of-the-box:
SectionDevice."HDMI".0 {
Comment "HDMI"
Value {
PlaybackPCM "hw:${CardId},2"
JackControl "HDMI Jack"
}
}
Note: you can get the jack kcontrol name with amixer -c 0 contents
With this it is working, but only if pulseaudio is able to open the PCM stream. i.e. the HDMI is plugged in while restarting the device (or pulseaudio). If HDMI is not plugged in, pulseaudio will fail to create a card profile with output similar to
Pulseaudio output
I: [pulseaudio] module-udev-detect.c: Card /devices/platform/sound/sound/card0 (alsa_card.platform-sound) failed to load module.
D: [pulseaudio] module-udev-detect.c: /dev/snd/controlC0 is accessible: yes
D: [pulseaudio] module-udev-detect.c: /devices/platform/sound/sound/card0 is busy: no
D: [pulseaudio] module-udev-detect.c: Loading module-alsa-card with arguments 'device_id="0" name="platform-sound" card_name="alsa_card.platform-sound" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_properties="module-udev-detect.discovered=1"'
D: [pulseaudio] reserve-wrap.c: Successfully acquired reservation lock on device 'Audio0'
I: [pulseaudio] alsa-ucm.c: UCM available for card hw:0
D: [pulseaudio] alsa-ucm.c: UCM _alibpref=_ucm0005.
I: [pulseaudio] alsa-ucm.c: Set UCM verb to HiFi
D: [pulseaudio] alsa-ucm.c: Got CapturePCM for device Mic: _ucm0005.hw:sc7180adau7002m,0
D: [pulseaudio] alsa-ucm.c: Got PlaybackCTL for device Mic: _ucm0005.hw:sc7180adau7002m
D: [pulseaudio] alsa-ucm.c: Got CaptureCTL for device Mic: _ucm0005.hw:sc7180adau7002m
D: [pulseaudio] alsa-ucm.c: Got CapturePriority for device Mic: 100
I: [pulseaudio] alsa-ucm.c: UCM file does not specify 'CaptureChannels' for device Mic, assuming stereo.
D: [pulseaudio] alsa-ucm.c: No _conflictingdevs for device Mic
D: [pulseaudio] alsa-ucm.c: No _supporteddevs for device Mic
D: [pulseaudio] alsa-ucm.c: Got PlaybackPCM for device Speaker: _ucm0005.hw:sc7180adau7002m,1
D: [pulseaudio] alsa-ucm.c: Got PlaybackCTL for device Speaker: _ucm0005.hw:sc7180adau7002m
D: [pulseaudio] alsa-ucm.c: Got PlaybackPriority for device Speaker: 100
D: [pulseaudio] alsa-ucm.c: Got PlaybackRate for device Speaker: 48000
D: [pulseaudio] alsa-ucm.c: Got PlaybackChannels for device Speaker: 2
D: [pulseaudio] alsa-ucm.c: Got CaptureCTL for device Speaker: _ucm0005.hw:sc7180adau7002m
D: [pulseaudio] alsa-ucm.c: UCM playback device Speaker rate 48000
D: [pulseaudio] alsa-ucm.c: No _conflictingdevs for device Speaker
D: [pulseaudio] alsa-ucm.c: No _supporteddevs for device Speaker
D: [pulseaudio] alsa-ucm.c: Got PlaybackPCM for device HDMI: _ucm0005.hw:sc7180adau7002m,2
D: [pulseaudio] alsa-ucm.c: Got PlaybackCTL for device HDMI: _ucm0005.hw:sc7180adau7002m
D: [pulseaudio] alsa-ucm.c: Got CaptureCTL for device HDMI: _ucm0005.hw:sc7180adau7002m
D: [pulseaudio] alsa-ucm.c: Got JackControl for device HDMI: HDMI Jack
I: [pulseaudio] alsa-ucm.c: UCM file does not specify 'PlaybackChannels' for device HDMI, assuming stereo.
D: [pulseaudio] alsa-ucm.c: No _conflictingdevs for device HDMI
D: [pulseaudio] alsa-ucm.c: No _supporteddevs for device HDMI
I: [pulseaudio] module-alsa-card.c: Found UCM profiles
D: [pulseaudio] alsa-ucm.c: UCM mapping: HiFi: hw:sc7180adau7002m,0: source dev Mic
D: [pulseaudio] alsa-ucm.c: UCM mapping: HiFi: hw:sc7180adau7002m,1: sink dev Speaker
D: [pulseaudio] alsa-ucm.c: UCM mapping: HiFi: hw:sc7180adau7002m,2: sink dev HDMI
D: [pulseaudio] alsa-mixer.c: Profile HiFi (Default), input=(null), output=(null) priority=8000, supported=yes n_input_mappings=1, n_output_mappings=2
D: [pulseaudio] alsa-mixer.c: Input HiFi: hw:sc7180adau7002m,0: source
D: [pulseaudio] alsa-mixer.c: Output HiFi: hw:sc7180adau7002m,1: sink
D: [pulseaudio] alsa-mixer.c: Output HiFi: hw:sc7180adau7002m,2: sink
I: [pulseaudio] alsa-ucm.c: Set ucm verb to HiFi
D: [pulseaudio] alsa-util.c: Trying _ucm0005.hw:sc7180adau7002m,1 with SND_PCM_NO_AUTO_FORMAT ...
D: [pulseaudio] alsa-util.c: Managed to open _ucm0005.hw:sc7180adau7002m,1
D: [pulseaudio] alsa-util.c: Maximum hw buffer size is 256 ms
D: [pulseaudio] alsa-util.c: Set buffer size first (to 4797 samples), period size second (to 1199 samples).
I: [pulseaudio] alsa-util.c: Device hw:sc7180adau7002m,1 doesn't support 44100 Hz, changed to 48000 Hz.
D: [pulseaudio] alsa-util.c: Trying _ucm0005.hw:sc7180adau7002m,2 with SND_PCM_NO_AUTO_FORMAT ...
D: [pulseaudio] alsa-util.c: Managed to open _ucm0005.hw:sc7180adau7002m,2
D: [pulseaudio] alsa-util.c: snd_pcm_hw_params_set_format(Signed 16 bit Little Endian) failed: Invalid argument
D: [pulseaudio] alsa-util.c: snd_pcm_hw_params_set_format(Signed 16 bit Big Endian) failed: Invalid argument
D: [pulseaudio] alsa-util.c: snd_pcm_hw_params_set_format(Float 32 bit Little Endian) failed: Invalid argument
D: [pulseaudio] alsa-util.c: snd_pcm_hw_params_set_format(Float 32 bit Big Endian) failed: Invalid argument
D: [pulseaudio] alsa-util.c: snd_pcm_hw_params_set_format(Signed 32 bit Little Endian) failed: Invalid argument
D: [pulseaudio] alsa-util.c: snd_pcm_hw_params_set_format(Signed 32 bit Big Endian) failed: Invalid argument
D: [pulseaudio] alsa-util.c: Maximum hw buffer size is 128 ms
I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-22)
I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-22)
I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-22)
I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-22)
D: [pulseaudio] alsa-util.c: Set neither period nor buffer size.
I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-22)
I: [pulseaudio] alsa-util.c: snd_pcm_hw_params failed: Invalid argument
D: [pulseaudio] alsa-util.c: Trying _ucm0005.hw:sc7180adau7002m,2 without SND_PCM_NO_AUTO_FORMAT ...
D: [pulseaudio] alsa-util.c: Managed to open _ucm0005.hw:sc7180adau7002m,2
D: [pulseaudio] alsa-util.c: snd_pcm_hw_params_set_format(Signed 16 bit Little Endian) failed: Invalid argument
D: [pulseaudio] alsa-util.c: snd_pcm_hw_params_set_format(Signed 16 bit Big Endian) failed: Invalid argument
D: [pulseaudio] alsa-util.c: snd_pcm_hw_params_set_format(Float 32 bit Little Endian) failed: Invalid argument
D: [pulseaudio] alsa-util.c: snd_pcm_hw_params_set_format(Float 32 bit Big Endian) failed: Invalid argument
D: [pulseaudio] alsa-util.c: snd_pcm_hw_params_set_format(Signed 32 bit Little Endian) failed: Invalid argument
D: [pulseaudio] alsa-util.c: snd_pcm_hw_params_set_format(Signed 32 bit Big Endian) failed: Invalid argument
D: [pulseaudio] alsa-util.c: Maximum hw buffer size is 128 ms
I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-22)
I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-22)
I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-22)
I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-22)
D: [pulseaudio] alsa-util.c: Set neither period nor buffer size.
I: [pulseaudio] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_HW_PARAMS failed (-22)
I: [pulseaudio] alsa-util.c: snd_pcm_hw_params failed: Invalid argument
D: [pulseaudio] alsa-util.c: Trying plug:SLAVE='_ucm0005.hw:sc7180adau7002m,2' with SND_PCM_NO_AUTO_FORMAT ...
I: [pulseaudio] (alsa-lib)pcm.c: Unknown PCM _ucm0005.hw:sc7180adau7002m,2
I: [pulseaudio] alsa-util.c: Error opening PCM device plug:SLAVE='_ucm0005.hw:sc7180adau7002m,2': No such file or directory
D: [pulseaudio] alsa-mixer.c: Profile set 0xaaaad8f23f90, auto_profiles=no, probed=yes, n_mappings=0, n_profiles=0, n_decibel_fixes=0
E: [pulseaudio] module-alsa-card.c: Failed to find a working profile.
E: [pulseaudio] module.c: Failed to load module "module-alsa-card" (argument: "device_id="0" name="platform-sound" card_name="alsa_card.platform-sound" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_properties="module-udev-detect.discovered=1""): initialization failed.
I: [pulseaudio] module-udev-detect.c: Card /devices/platform/sound/sound/card0 (alsa_card.platform-sound) failed to load module.
@Geofferey from what I can see of sc7180-rt5682-max98357a ucm config, most of the changes you detailed are present in the config.
Speaker is already set to hw:X,1, mic to hw:X,2
which the same as
## Loading sink module for speakers with default sc7180-trogdor.dtsi, uneeded if dtsi is patched
load-module module-alsa-sink device=plughw:sc7180rt5682max,1
## If kernel is patched to re-order speakers as first device, comment above, uncommment below and set to 1 to enable mic
load-module module-alsa-source device=plughw:sc7180rt5682max,0
Similarly,
cset "name='IF1 01 ADC Swap Mux' 0"
cset "name='Stereo1 ADC L2 Mux' 1"
cset "name='Stereo1 ADC R2 Mux' 1"
cset "name='Stereo1 ADC MIXL ADC2 Switch' 0"
cset "name='Stereo1 ADC MIXL ADC2 Switch' 1"
cset "name='Stereo1 ADC MIXR ADC2 Switch' 0"
cset "name='Stereo1 ADC MIXR ADC2 Switch' 1"
is already present in init and Hifi configurations. the init conf is setting all the 0s, the Hifi conf has all the 1s under EnableSequence. If you want to manually trigger the Enable/DisableSequence sections, alsactl can do it with _enadev and _disadev
I'd suggest starting with a fresh usb stick, check the output of arecord -L & aplay -L (make sure hwX:0 is mic, hwX:1 is speakers), check pacmd list-cards (if dummy output, ucm is bad), and then try commenting out everything other than Speaker and Mic sections in the existing config.
Ideally, you would want it to work without any asound config, dtsi patching, and also without any modifications to pulseaudio config. UCM alone should be able to handle this and that way it'll be ready for pipewire too :)
On another note @Geofferey @hexdump0815. With 230922-01, here's what i can tell about the Partial/Broken issues mentioned at the beginning of this issue
- Touch - Needed Goodix driver to work out-of-the-box, and touchpad should be much better with this libinput quirks config, if anyone feels something is off let me know and i'll try to get the quirks configured better
- Orientation sensor - This seems to be all right for me, atleast on KDE/Gnome Wayland. Screen rotates as expected once keyboard cover is detached
- Built-in audio / speakers (kernel/userland) - Atleast speakers + mic is working with the ucm config from here, HDMI should work but I think there might be a pulseaudio bug or worse, a driver bug at play here.
- KVM (no networking) - This seemed to be allright for me. I tested with GNOME Boxes and Haiku OS, was able to download a package just fine
- DPMS (display off) (coachz) - Display off seems to be working well, as does sleep and wake
That leaves:
- microphone gain(can't be done with UCM, most likely possible with ALSA card-specific configuration)
- rear & front cameras
- fingerprint sensor.
I think we've already reached pretty much complete usability out-of-the-box if we finalize and add the quirks and ucm configurations to the base image :D
@pulak1901 - thanks a lot for the updates ... i'm very open to include any such improvements into the next round of images which i plan to roll in the next months based on a v6.6 lts kernel - lets see if they can be polished in a way so that we can ship them via files in extra-files or additions to postinstall* or rc-local-additions ... we should keep in mind that the image is shared among all trogdor devices, so they should not break the other devices and the changes should be as generic as possible (i.e. not only focussed on gnome, kde etc.) but its also fine if they just help on any of those use-cases (lets say working in gnome and kde, but not making sense in xfce) as long as they do not break the other use-cases ... the goodix touchscreen support is already in the kernel part - hexdump0815/linux-mainline-and-mali-generic-stable-kernel@910e937
@hexdump0815 i'll send prs to ship the improvements in extra-files most likely, i just haven't gotten around to playing with imagebuilder itself. Will definitely test out a combination of DEs & Xorg/Wayland/Pipewire/Pulseaudio during that time. I think most of the changes are in libinput and alsa ucm, so it should work with xorg as long as it is using the libinput drivers, and since pipewire-pulse should be the same as pulseaudio, i think that will be fine as well