hexdump0815 / imagebuilder

velvet os - simple script framework to build ubuntu 22.04 lts jammy (in older versions also 20.04 lts focal) and debian 12 bookworm (in older versions also 11 bullseye) bootable usb / sd card images for some arm and intel devices - lots of prebuilt images as well
GNU General Public License v3.0
295 stars 44 forks source link

chromebook_trogdor: status: coachz (hp chromebook x2 11) (Lenovo Duet 5) #44

Open Geofferey opened 2 years ago

Geofferey commented 2 years ago

Notes on Coachz + Homestar running 6.6.16

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) • Suspend (works on 5.16.X up) • KVM

Partial

• Touch (libinput needs quirks + reporting to freedesktop for TOUCH_CANCEL) • Orientation sensor (inverted) • Built-in audio / speakers (kernel/userland issues) • Built-in microphone (gain coachz) • H/W video decode (partial)

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.

  1. sudo apt-get install xserver-xorg-input-evdev

  2. sudo nano /usr/share/X11/xorg.conf.d/40-libinput.conf

  3. Locate MatchIsTouchscreen "on" and change Driver "libinput" to Driver "evdev"

• FOR REFERENCE:

- There is also a workaround to the issue on Xorg that I discovered accidentally while running [TouchEgg](https://github.com/JoseExposito/touchegg) to simulate right click which still functions while Xorg is failing to recognize touch. 1. Install [TouchEgg](https://github.com/JoseExposito/touchegg/releases/download/2.0.14/touchegg_2.0.14_arm64.deb) and [Touchè](https://github.com/JoseExposito/touche/releases/download/1.0.7/touche_1.0.7_arm64.deb) from the releases via `dpkg -i` & reboot 5. Open Touchè, if you can't find an icon just execute `com.github.joseexposito.touche` in terminal. 6. In `Global gestures` > `Tap` > `Tap with 3 fingers` set to `Execute a command` and add `xinput 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.

dai-link@0 { link-name = "MultiMedia0"; reg = ; cpu { sound-dai = <&lpass_cpu MI2S_PRIMARY>; }; sound_multimedia0_codec: codec { sound-dai = <&alc5682 0 /* aif1 */>; }; }; dai-link@1 { link-name = "MultiMedia1"; reg = ; cpu { sound-dai = <&lpass_cpu MI2S_SECONDARY>; }; sound_multimedia1_codec: codec { sound-dai = <&max98360a>; }; };
dai-link@1 { link-name = "MultiMedia1"; reg = ; cpu { sound-dai = <&lpass_cpu MI2S_SECONDARY>; }; sound_multimedia1_codec: codec { sound-dai = <&max98360a>; }; }; dai-link@0 { link-name = "MultiMedia0"; reg = ; 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](https://wiki.archlinux.org/title/Advanced_Linux_Sound_Architecture/Troubleshooting#HDMI_Output_does_not_work) 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....

leezu commented 2 years ago

Regarding your touchscreen issues: If you update to debian unstable, there should be no issue using Wayland with either Gnome or KDE

Geofferey commented 2 years ago

@leezu So Mate can potentially run on Wayland now?

hexdump0815 commented 2 years ago

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?

Geofferey commented 2 years ago

@hexdump0815 figured out the sound, partially. At least I have it working for me now ;)

leezu commented 2 years ago

@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.

Geofferey commented 2 years ago

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...

pulakctl commented 8 months ago

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.

hexdump0815 commented 8 months ago

@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.

pulakctl commented 8 months ago

@hexdump0815 - just I2C_HID_OF_GOODIX.

pulakctl commented 8 months ago

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

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](https://github.com/alsa-project/alsa-ucm-conf/blob/master/ucm2/Qualcomm/sc7180/rt5682-max98357a/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](https://github.com/alsa-project/alsa-ucm-conf/blob/master/ucm2/Qualcomm/sc7180/rt5682-max98357a/HiFi.conf) & 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.

hexdump0815 commented 8 months ago

@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

pulakctl commented 8 months ago

@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

DanaGoyette commented 7 months ago

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.

Geofferey commented 7 months ago

@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.

hexdump0815 commented 7 months ago

i have no idea if it helps, but in this issue - https://github.com/hexdump0815/imagebuilder/issues/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?

pulakctl commented 7 months ago

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:

pulakctl commented 7 months ago

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 } ```

Geofferey commented 6 months ago

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!

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`](https://gist.github.com/Geofferey/ee822db334ec31ecf08eed54e56366f3) 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. :)

hexdump0815 commented 6 months ago

@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

hexdump0815 commented 6 months ago

@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

pulakctl commented 6 months ago

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. ```

pulakctl commented 6 months ago

@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 :)

pulakctl commented 6 months ago

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

  1. 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
  2. Orientation sensor - This seems to be all right for me, atleast on KDE/Gnome Wayland. Screen rotates as expected once keyboard cover is detached
  3. 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.
  4. 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
  5. DPMS (display off) (coachz) - Display off seems to be working well, as does sleep and wake

That leaves:

  1. microphone gain(can't be done with UCM, most likely possible with ALSA card-specific configuration)
  2. rear & front cameras
  3. 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

hexdump0815 commented 6 months ago

@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 - https://github.com/hexdump0815/linux-mainline-and-mali-generic-stable-kernel/commit/910e937a30af0d7a115f233f550769d139ec4800

pulakctl commented 6 months ago

@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

Geofferey commented 6 months ago

@pulak1901 You're on coachz, correct? I tried exactly what you detailed with unmodified kernel and it caused more issues + sound card names differ. For homestar the best solution I've found is what I've detailed. Microphone gain is not a problem either EVERYTHING just works with the pulse config and bare minimum UCM to initialize mic. I believe there is some conflict due to dtb(s). I can get away with adding full microphone configuration in UCM but once I add speakers it all breaks. Also if playing with alsamixer I suggest using F5 to view all card mixer settings at once. Some of the settings that should be under capture etc are under playback... Maybe you will find the gain there?

@hexdump0815 I have some important info regarding 6.1.51

I immediately noticed that Xorg had extremely high cpu usage 40~60% on the performance cores at idle with nothing moving on screen. I investigated Xorg logs and it complained about missing vgem... To enable that add DRM_VGEM to kernel config. I also found some items that shouldn't be enabled for sake of performance but I'll update later once I've confirmed. For sure I remember KVM guest support isn't what one would think and is actually for running the kernel as a guest, a highly unlikely scenario, I believe. IIRC there comes a performance impact and it is noticeable. BTW I'm super late on testing the newer kernel because I refuse to upgrade unless it offers something, that something I was looking for was the hw video decoding/encoding ;)

Regarding 6.1.51... H/W video decoding works somewhat with venus, v4l2m2m2 and ffmpeg so that's a plus. I recently found out what chrome considers H/W video acceleration is actually being done with GL shaders which isn't best. Sadly the v4l2 api isn't immediately available to chromium or firefox. There appears to be a shim out there that can translate v4l2 to vaapi but I had no luck getting it to compile, it look(ed)(s) promising. In case it's of interest here's a link libva-v4l2-request. It's a bit old but I know Fedora has pacakges/patches for it.

pulakctl commented 6 months ago

@Geofferey yep, coachz here. Strange that it does not like the ucm2/Qualcomm/sc7180/rt5682-max98357a setup. Can you run aplay -l and check the full name of the sound card?

Regarding gain for coachz, the card itself doesn't report any controls at all. If I run amixer -c 0 contents I can see 5 controls, but I believe those are all related to HDMI output, not the internal mic/speaker

And regarding firefox and v4l2 decode, I think it was merged in 116, Debian 12 has esr 115

hexdump0815 commented 6 months ago

@Geofferey - thanks for the hint about DRM_VGEM, i'll have a look at it as soon as i find some more time ... if you have any kernel config options which we should consider dropping, please let me know - i'm open for it as long as they are of no real use in the context of those image ... i think of remembering that libva-v4l2-request is not really working anymore without a lot of patches on top of a lot of software, but i might be wrong - i think people have other snapdragon/venus setups working with video decoding (h264 only i think, so h64ify might be required) and newer firefox versions (116+ might be correct)

Geofferey commented 6 months ago

@pulak1901 Below is some output of aplay -l and arecord -l for homestar on unmodified 6.6.16:

``` **** List of PLAYBACK Hardware Devices **** card 0: sc7180rt5682max [sc7180-rt5682-max98357a-1mic], device 0: MultiMedia0 rt5682-aif1-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: sc7180rt5682max [sc7180-rt5682-max98357a-1mic], device 1: MultiMedia1 multicodec-1 [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: sc7180rt5682max [sc7180-rt5682-max98357a-1mic], device 2: MultiMedia2 i2s-hifi-2 [] Subdevices: 1/1 Subdevice #0: subdevice #0 **** List of CAPTURE Hardware Devices **** card 0: sc7180rt5682max [sc7180-rt5682-max98357a-1mic], device 0: MultiMedia0 rt5682-aif1-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0 ``` also the `amixer scontrols`: ``` Simple mixer control 'ADCDAT Mux',0 Simple mixer control 'CBJ Boost',0 Simple mixer control 'DAC L Mux',0 Simple mixer control 'DAC L1 Source',0 Simple mixer control 'DAC R Mux',0 Simple mixer control 'DAC R1 Source',0 Simple mixer control 'DAC1',0 Simple mixer control 'DAC1 MIXL DAC1',0 Simple mixer control 'DAC1 MIXL Stereo ADC',0 Simple mixer control 'DAC1 MIXR DAC1',0 Simple mixer control 'DAC1 MIXR Stereo ADC',0 Simple mixer control 'HPO Signal Demux',0 Simple mixer control 'HPOL',0 Simple mixer control 'HPOR',0 Simple mixer control 'IF1 01 ADC Swap Mux',0 Simple mixer control 'IF1 23 ADC Swap Mux',0 Simple mixer control 'IF1 45 ADC Swap Mux',0 Simple mixer control 'IF1 67 ADC Swap Mux',0 Simple mixer control 'IF1_ADC Mux',0 Simple mixer control 'IF2 ADC Swap Mux',0 Simple mixer control 'RECMIX1L CBJ',0 Simple mixer control 'STO1 ADC',0 Simple mixer control 'STO1 ADC Boost Gain',0 Simple mixer control 'Stereo1 ADC L Mux',0 Simple mixer control 'Stereo1 ADC L1 Mux',0 Simple mixer control 'Stereo1 ADC L2 Mux',0 Simple mixer control 'Stereo1 ADC MIXL ADC1',0 Simple mixer control 'Stereo1 ADC MIXL ADC2',0 Simple mixer control 'Stereo1 ADC MIXR ADC1',0 Simple mixer control 'Stereo1 ADC MIXR ADC2',0 Simple mixer control 'Stereo1 ADC R Mux',0 Simple mixer control 'Stereo1 ADC R1 Mux',0 Simple mixer control 'Stereo1 ADC R2 Mux',0 Simple mixer control 'Stereo1 DAC MIXL DAC L1',0 Simple mixer control 'Stereo1 DAC MIXL DAC R1',0 Simple mixer control 'Stereo1 DAC MIXR DAC L1',0 Simple mixer control 'Stereo1 DAC MIXR DAC R1',0 ``` as well as `amixer contents`: ``` numid=9,iface=CARD,name='HDMI Jack' ; type=BOOLEAN,access=r-------,values=1 : values=off numid=6,iface=CARD,name='Headphone Jack' ; type=BOOLEAN,access=r-------,values=1 : values=off numid=7,iface=CARD,name='Headset Mic Jack' ; type=BOOLEAN,access=r-------,values=1 : values=off numid=14,iface=MIXER,name='Headphone Jack Switch' ; type=BOOLEAN,access=rw------,values=1 : values=off numid=33,iface=MIXER,name='ADCDAT Mux' ; type=ENUMERATED,access=rw------,values=1,items=2 ; Item #0 'ADCDAT1' ; Item #1 'ADCDAT2' : values=0 numid=2,iface=MIXER,name='CBJ Boost Volume' ; type=INTEGER,access=rw---R--,values=1,min=0,max=8,step=0 : values=0 | dBrange- rangemin=0,,rangemax=0 | dBscale-min=0.00dB,step=0.00dB,mute=0 rangemin=1,,rangemax=1 | dBscale-min=20.00dB,step=0.00dB,mute=0 rangemin=2,,rangemax=2 | dBscale-min=24.00dB,step=0.00dB,mute=0 rangemin=3,,rangemax=5 | dBscale-min=30.00dB,step=5.00dB,mute=0 rangemin=6,,rangemax=6 | dBscale-min=44.00dB,step=0.00dB,mute=0 rangemin=7,,rangemax=7 | dBscale-min=50.00dB,step=0.00dB,mute=0 rangemin=8,,rangemax=8 | dBscale-min=52.00dB,step=0.00dB,mute=0 numid=34,iface=MIXER,name='DAC L Mux' ; type=ENUMERATED,access=rw------,values=1,items=2 ; Item #0 'IF1' ; Item #1 'SOUND' : values=0 numid=40,iface=MIXER,name='DAC L1 Source' ; type=ENUMERATED,access=rw------,values=1,items=2 ; Item #0 'Stereo1 DAC Mixer' ; Item #1 'DAC1' : values=1 numid=35,iface=MIXER,name='DAC R Mux' ; type=ENUMERATED,access=rw------,values=1,items=2 ; Item #0 'IF1' ; Item #1 'SOUND' : values=0 numid=41,iface=MIXER,name='DAC R1 Source' ; type=ENUMERATED,access=rw------,values=1,items=2 ; Item #0 'Stereo1 DAC Mixer' ; Item #1 'DAC1' : values=0 numid=37,iface=MIXER,name='DAC1 MIXL DAC1 Switch' ; type=BOOLEAN,access=rw------,values=1 : values=off numid=36,iface=MIXER,name='DAC1 MIXL Stereo ADC Switch' ; type=BOOLEAN,access=rw------,values=1 : values=off numid=39,iface=MIXER,name='DAC1 MIXR DAC1 Switch' ; type=BOOLEAN,access=rw------,values=1 : values=off numid=38,iface=MIXER,name='DAC1 MIXR Stereo ADC Switch' ; type=BOOLEAN,access=rw------,values=1 : values=off numid=1,iface=MIXER,name='DAC1 Playback Volume' ; type=INTEGER,access=rw---R--,values=2,min=0,max=87,step=0 : values=0,0 | dBscale-min=-65.25dB,step=0.75dB,mute=0 numid=48,iface=MIXER,name='HPO Signal Demux' ; type=ENUMERATED,access=rw------,values=1,items=2 ; Item #0 'Legacy' ; Item #1 'OneBit' : values=1 numid=46,iface=MIXER,name='HPOL Playback Switch' ; type=BOOLEAN,access=rw------,values=1 : values=off numid=47,iface=MIXER,name='HPOR Playback Switch' ; type=BOOLEAN,access=rw------,values=1 : values=off numid=15,iface=MIXER,name='Headset Mic Switch' ; type=BOOLEAN,access=rw------,values=1 : values=off numid=28,iface=MIXER,name='IF1 01 ADC Swap Mux' ; type=ENUMERATED,access=rw------,values=1,items=4 ; Item #0 'L/R' ; Item #1 'R/L' ; Item #2 'L/L' ; Item #3 'R/R' : values=0 numid=29,iface=MIXER,name='IF1 23 ADC Swap Mux' ; type=ENUMERATED,access=rw------,values=1,items=4 ; Item #0 'L/R' ; Item #1 'R/L' ; Item #2 'L/L' ; Item #3 'R/R' : values=0 numid=30,iface=MIXER,name='IF1 45 ADC Swap Mux' ; type=ENUMERATED,access=rw------,values=1,items=4 ; Item #0 'L/R' ; Item #1 'R/L' ; Item #2 'L/L' ; Item #3 'R/R' : values=0 numid=31,iface=MIXER,name='IF1 67 ADC Swap Mux' ; type=ENUMERATED,access=rw------,values=1,items=4 ; Item #0 'L/R' ; Item #1 'R/L' ; Item #2 'L/L' ; Item #3 'R/R' : values=0 numid=23,iface=MIXER,name='IF1_ADC Mux' ; type=ENUMERATED,access=rw------,values=1,items=4 ; Item #0 'Slot 0' ; Item #1 'Slot 2' ; Item #2 'Slot 4' ; Item #3 'Slot 6' : values=0 numid=32,iface=MIXER,name='IF2 ADC Swap Mux' ; type=ENUMERATED,access=rw------,values=1,items=4 ; Item #0 'L/R' ; Item #1 'R/L' ; Item #2 'L/L' ; Item #3 'R/R' : values=0 numid=16,iface=MIXER,name='RECMIX1L CBJ Switch' ; type=BOOLEAN,access=rw------,values=1 : values=on numid=5,iface=MIXER,name='STO1 ADC Boost Gain Volume' ; type=INTEGER,access=rw---R--,values=2,min=0,max=3,step=0 : values=1,1 | dBscale-min=0.00dB,step=12.00dB,mute=0 numid=3,iface=MIXER,name='STO1 ADC Capture Switch' ; type=BOOLEAN,access=rw------,values=2 : values=off,off numid=4,iface=MIXER,name='STO1 ADC Capture Volume' ; type=INTEGER,access=rw---R--,values=2,min=0,max=63,step=0 : values=49,49 | dBscale-min=-17.25dB,step=0.75dB,mute=0 numid=21,iface=MIXER,name='Stereo1 ADC L Mux' ; type=ENUMERATED,access=rw------,values=1,items=2 ; Item #0 'ADC1 L' ; Item #1 'ADC1 R' : values=0 numid=17,iface=MIXER,name='Stereo1 ADC L1 Mux' ; type=ENUMERATED,access=rw------,values=1,items=2 ; Item #0 'DAC MIX' ; Item #1 'ADC' : values=0 numid=19,iface=MIXER,name='Stereo1 ADC L2 Mux' ; type=ENUMERATED,access=rw------,values=1,items=2 ; Item #0 'DAC MIX' ; Item #1 'DMIC' : values=1 numid=24,iface=MIXER,name='Stereo1 ADC MIXL ADC1 Switch' ; type=BOOLEAN,access=rw------,values=1 : values=off numid=25,iface=MIXER,name='Stereo1 ADC MIXL ADC2 Switch' ; type=BOOLEAN,access=rw------,values=1 : values=on numid=26,iface=MIXER,name='Stereo1 ADC MIXR ADC1 Switch' ; type=BOOLEAN,access=rw------,values=1 : values=off numid=27,iface=MIXER,name='Stereo1 ADC MIXR ADC2 Switch' ; type=BOOLEAN,access=rw------,values=1 : values=on numid=22,iface=MIXER,name='Stereo1 ADC R Mux' ; type=ENUMERATED,access=rw------,values=1,items=2 ; Item #0 'ADC1 L' ; Item #1 'ADC1 R' : values=1 numid=18,iface=MIXER,name='Stereo1 ADC R1 Mux' ; type=ENUMERATED,access=rw------,values=1,items=2 ; Item #0 'DAC MIX' ; Item #1 'ADC' : values=0 numid=20,iface=MIXER,name='Stereo1 ADC R2 Mux' ; type=ENUMERATED,access=rw------,values=1,items=2 ; Item #0 'DAC MIX' ; Item #1 'DMIC' : values=1 numid=42,iface=MIXER,name='Stereo1 DAC MIXL DAC L1 Switch' ; type=BOOLEAN,access=rw------,values=1 : values=off numid=43,iface=MIXER,name='Stereo1 DAC MIXL DAC R1 Switch' ; type=BOOLEAN,access=rw------,values=1 : values=off numid=44,iface=MIXER,name='Stereo1 DAC MIXR DAC L1 Switch' ; type=BOOLEAN,access=rw------,values=1 : values=off numid=45,iface=MIXER,name='Stereo1 DAC MIXR DAC R1 Switch' ; type=BOOLEAN,access=rw------,values=1 : values=off numid=8,iface=PCM,name='Playback Channel Map',device=1 ; type=INTEGER,access=r----R--,values=4,min=0,max=36,step=0 : values=3,5,4,6 | container | chmap-fixed=FL,RL,FR,RR numid=13,iface=PCM,name='ELD',device=2 ; type=BYTES,access=r--v----,values=128 : values=0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 numid=12,iface=PCM,name='IEC958 Playback Default',device=2 ; type=IEC958,access=rw------,values=1 : values=[AES0=0x04 AES1=0x00 AES2=0x00 AES3=0x01] numid=11,iface=PCM,name='IEC958 Playback Mask',device=2 ; type=IEC958,access=r-------,values=1 : values=[AES0=0xff AES1=0xff AES2=0xff AES3=0xff] numid=10,iface=PCM,name='Playback Channel Map',device=2 ; type=INTEGER,access=r----R--,values=8,min=0,max=36,step=0 : values=0,0,0,0,0,0,0,0 | container | chmap-fixed=FL,FR ```

EDIT: FOR NOW EXCUSE ME I HAVE TO LEAVE UNFINISHED... WILL BE BACK...EDITS WILL COME

I don't know if you've seen the trashy kernel .patch I made but it flips the devices 0 for 1. With that, speakers just work without need for pulseaudio config or UCM... Thats for both devices afaik...

pulakctl commented 6 months ago

@Geofferey this is quite strange that it has the same card setup but behaves differently

The existing ucm2/Qualcomm/sc7180/rt5682-max98357a was based on the trogdor-lazor

Trogdor/Lazor ChromeOS UCM

Strongbad/Homestar ChromeOS UCM

$ diff HiFi-lazor.conf HiFi-homestar.conf 
45d44
<       DependentPCM "hw:sc7180rt5682max,1"
66c65
<       IntrinsicSensitivity "-3360"
---
>       IntrinsicSensitivity "-2900"

So for Lazor the Headphone device is dependent on the Speaker PCM(I think it's the same as ConflictingDevice) and the mic sensitivity is different, but I'm not sure why Homestar behaves so differently.

itsfarseen commented 5 months ago

Hi, I have a coachz (HP x2 11 without LTE).

I tried building 5.17.19, 6.6.9 using the guide in the repo, and I also tried the prebuilt 6.1.1-sbt-cbq image from https://github.com/hexdump0815/linux-mainline-and-mali-generic-stable-kernel.

Here's my findings:

I'm not able to get WiFi to work at all in any of these.

I was able to get touch working in 6.6.9, but not in the others.

In 6.6.9, I had some issue with gdm frequently crashing when trying to load gnome, and after I tried installing one of vulkan-freedreno or xf86-video-freedreno, gdm completely stopped loading.

I also tried compiling 6.7.10 using the .config file for 6.6.9 (https://github.com/hexdump0815/linux-mainline-and-mali-generic-stable-kernel/blob/master/config.exy-6.6.9-stb-exy%2B), but didn't boot (screen was black with nothing shown)


I couldn't see any trace of a wifi hardware in lsusb, lshw and dmesg. In x86, lshw used to show me "UNCLAIMED" devices. Is there any way to see a list of devices for which drivers are not loaded?

hexdump0815 commented 5 months ago

@itsfarseen - wifi should work and for others with an x2 it also worked as described above - can you please post your dmesg to some pastebin and link it here? maybe that would give a hint about where the problem is.

cabbageman8 commented 3 months ago

@hexdump0815 > 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. Any progress on this?

I am using 230922-01 Bookworm on Homestar and it seems really good (thanks for your work). Wifi works. I installed Gnome which works. The speakers work after using pulakctl's workaround and fiddling with Pulseaudio. Only catch (and its a big one) is that there is no touchscreen input at all. I really need touch to work, so I am wondering if there is a new image with the kernel option set, or if there is a way to recover the touch on my current install.

I am happy to contribute an installation how-to for Homestar once I reach a working state :)

pulakctl commented 3 months ago

@itsfarseen is this on jammy or bookworm?

I also tried compiling 6.7.10 using the .config file for 6.6.9 (https://github.com/hexdump0815/linux-mainline-and-mali-generic-stable-kernel/blob/master/config.exy-6.6.9-stb-exy%2B), but didn't boot (screen was black with nothing shown)

Also the HP X2 would be using the cbq kernels, not the exy kernel

pulakctl commented 3 months ago

@cabbageman8 only a fresh kernel with that kconfig option enabled should do the job.

If you're comfortable doing the kernel builds, you can follow these steps with one of the cbq configs in that repo (instead of using the scripts/kconfig/merge_config.sh step)

Edit: before building the kernel with the provided cmdline and flashing it, have a read through the docs here and here to make sure you don't end up with an unbootable kernel

TingyiChen commented 3 months ago

@hexdump0815 It seems that recent trogdor ubuntu release has wifi issue(no wifi at all). I tried build image, same issue. After some investigation, I found that copy qrtr-* and rmtfs binaries/services from debian release and install https://ubuntu.pkgs.org/22.04/ubuntu-universe-arm64/libqrtr-glib0_1.2.2-1_arm64.deb.html fixed this issue. Hope you can fix this in next release. Thank you for your hard work :)

hexdump0815 commented 3 months ago

@cabbageman8 - i have just uploaded a newer kernel i built some weeks ago here: https://github.com/hexdump0815/linux-mainline-and-mali-generic-stable-kernel/releases/tag/6.6.23-stb-cbq%2B - see https://github.com/hexdump0815/imagebuilder/blob/main/doc/installing-a-newer-kernel.md about how to install it - this should include touch screen support - maybe give that one a try

hexdump0815 commented 3 months ago

@TingyiChen - thanks a lot for reporting this and sharing the fix - i'll note that down for future images

cabbageman8 commented 3 months ago

@hexdump0815 That worked a treat! (currently typing on Duet 5 Gnome on screen keyboard :smile: ). Keyboard detection for tablet mode is working in Gnome, and orientation sensor is now working.

thenameisluk commented 2 months ago

@hexdump0815 quick question about the 6.6.23

does the stylus work after this patch? have anyone tested it yet?

i finally got my hands on homestar and already checked the 6.6.23 kelner does fix the touch screen

but i don't know if i should get myself a stylus or just use external graphic tablet (if stylus doesn't work) stylus aint that expensive but still don't want waste money on sth i can't use

DanaGoyette commented 2 months ago

Regarding the audio on coachz, I got some help from the PMOS people in IRC, and this UCM seemed to work. Credit to them (I still need to get around to filing a proper bug report with them so it's recorded properly):

/usr/share/alsa/ucm2/conf.d/SC7180/sc7180-adau7002-max98357a.conf

Syntax 4

SectionUseCase."HiFi" {
        Comment "HiFi quality Music."
        File "/Qualcomm/sc7180/adau7002-max98357a/HiFi.conf"
}

/usr/share/alsa/ucm2/Qualcomm/sc7180/adau7002-max98357a/HiFi.conf


SectionVerb {
        Value {
                TQ "HiFi"
        }
}

SectionDevice."Speaker" {
        Comment "Speaker"
        Value {
                PlaybackChannels 2
                PlaybackPCM "hw:${CardId},1"
                PlaybackPriority 100
                PlaybackVolume "Speaker Playback Volume"
        }
}

SectionDevice."Mic" {
        Comment "Internal Microphone"

        Value {
                CaptureChannels 2
                CapturePCM "hw:${CardId},0"
                CapturePriority 100
        }
}
hexdump0815 commented 2 months ago

@LukIsHere - can't say anything about the stylus as most of my devices have broken displays / no touchscreen as they are usually the cheapest to get used :)

@DanaGoyette - thanks a lot for the ucm info, i took a note of it and will try to test and integrate it whenever i find the time