Touching Touchkeys

Consentually, of course.

5 Dec 2025

Alright! Only been a couple of days since my last blog post in my quest to get my old Android phone running mainline Linux, and now I got touchkeys working with the help of AI (Claude). It’s honestly very useful to speed up this type of work. I think that open source projects will generally benefit from this compared more than proprietary software, as AI has been trained on it.

The Patch

Here’s the preliminary patch!

Before I used Claude, I was persistently trying to get touchkeys working. Looking at the working patch above and comparing it to the non-working patches that I tried, the main missing piece was the touchkey_enable. I didn’t know there was a GPIO pin that needed to be set to enable the peripheral!

Luckily Claude caught it, and editted it into the driver. I originally thought I would have to create a new tm2-touchkey variant, but after a bit of clean up, it didn’t seem like I needed to. I could reuse an existing variant. Ideally I should create a new variant so that future changes don’t break my stuff, but a git bisect/report upstream should suffice for now.

This GPIO enable function wasn’t described in the board file and must’ve been described within the driver itself. Since I didn’t know that I was missing an enable GPIO and assumed that all resources were described in the board file itself, I didn’t know to also look in the driver for these ugly types of hacks.

Ugh, at least AI can parse the downstream spaghetti code faster that I can. All I have to do is verify and clean it up.

What’s Working

What’s Left

This list will potentially grow later as I find more things