View or comment on this project log on Hackaday.io
I was able to get KonstaKANG's build of LineageOS 21 (Android 14) working on the Pipad!
It's an almost-stock image, but I had to make a few changes to the kernel:
- Backport the sn65dsi83 driver from my raspberrypi-linux kernel (which is 5.15) to my fork of the raspberry-vanilla kernel
- Copy the appropriate dtoverlays over
- Set a few things in config_user.txt:
# User specific config.txt options
dtoverlay=gpio-shutdown,gpio_pin=22,active_low=1,gpio_pull=up,debounce=10
dtoverlay=gpio-poweroff,gpiopin=25,active_low=1
dtoverlay=gpio-key,gpio=22,keycode=116,label="POWER"
dtoverlay=vc4-kms-dsi-ti-sn65dsi83
dtoverlay=pipad-touchscreen
dtparam=spi=off
Fortunately, the raspberry-vanilla kernel already comes with the Goodix touchscreen driver installed, so I didn't have to do anything to the pipad-touchscreen dtoverlay.
I've only got a few bits of hardware integration working at the moment -- just the bare minimum:
- LCD and touchscreen work.
- The power button turns off the screen. (Ideally it would pull up a power menu?)
- It does not, however, turn the screen back on. I think it's trying to, but the sn65dsi83 isn't being reinitialized properly or something.
- When the system shuts down, it toggles the correct GPIO pin to disable the boost converter which converts battery voltage to 5V.
I got stuck for a little while where it would only display the boot animation on the LCD, and never progress past this -- it seems this was due to my CM4 only having 1GB of RAM (KonstaKang says you need at least 2GB.)
I'm super excited about this! It's a much smoother experience using a proper touchscreen-oriented OS than trying to use Raspberry Pi OS. The on-screen keyboard pops up when necessary, all the tap targets are appropriately sized, etc. KonstaKang seems to have done an excellent job with e.g. hardware acceleration. Everything is super smooth, including Youtube playback in the browser.
This is my first time using LineageOS (or any custom Android image), so I still need to learn a ton. I'd like to get GApps installed (but need to be able to get into TWRP first, so I need to expose a GPIO pin on one of the buttons). I might also play around with the AOSP build, to see how that differs.
Hardware integration TODO list:
- I need some way of toggling a GPIO pin that I can use to boot into TWRP mode (for doing low-level Android recovery-mode stuff). For some reason, on this revision of the board, all the physical buttons are handled by the i2c GPIO expander except for the Volume Down button, which is connected to nRPIBOOT (so I can use usbboot without having to open up the device). I can probably just add a bodge wire from one of the remaining buttons to one of the spare GPIO pins on the CM4.
- Device trees + put drivers into the kernel for:
- RTC
- Audio codec
- I expect this will be a whole pile of fun.
- Ambient light sensor
- GPIO expander (for the other buttons)
- More gpio-key dtoverlays for all the other buttons, so that they get mapped to keyboard events
- Battery charger
- Potentially cherry-pick my kernel patch for the HDQ protocol to get battery levels
- Figure out how to control the backlight from the Android UI.
- I can control the backlight from the CLI by editing /sys/class/backlight/backlight/brightness, so I'm not sure what needs to happen in Android-land.
- Improve the behavior of the power button.
- either make it shut down (or hibernate, ideally), pull up a software menu that would let me shut down, or fix the issue with it not being able to reenable the screen.