Skip to content

lk2nd: hw: gpio: pm8921: Add devicetree flag for GPIO polarity inversion#720

Open
ejona86 wants to merge 1 commit into
msm8916-mainline:mainfrom
ejona86:gpio-inversion
Open

lk2nd: hw: gpio: pm8921: Add devicetree flag for GPIO polarity inversion#720
ejona86 wants to merge 1 commit into
msm8916-mainline:mainfrom
ejona86:gpio-inversion

Conversation

@ejona86

@ejona86 ejona86 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Allow configuring PMIC GPIO interrupt/input polarity inversion dynamically via a custom devicetree flag GPIO_PMIC_INVERTED.

On the Asus Nexus 7 (flo), the primary bootloader configures the volume keys with inversion enabled and Linux does not seem to reconfigure this. When lk2nd configured the buttons, it cleared the inversion causing Linux to believe the buttons were pressed.


I'm not beholden to this particular strategy, but it was simple, shows what I'm trying to achieve, and won't break other devices. I played with trying to preserve the inversion flag, and wasn't happy with it. I don't know if we think this is just a linux bug and it should be fixed there instead. I've only seen upstream linux break; I haven't tried with android. I can try out things like that if it helps.

Allow configuring PMIC GPIO interrupt/input polarity inversion dynamically
via a custom devicetree flag `GPIO_PMIC_INVERTED`.

On the Asus Nexus 7 (flo), the primary bootloader configures the volume
keys with inversion enabled and Linux does not seem to reconfigure this.
When lk2nd configured the buttons, it cleared the inversion causing
Linux to believe the buttons were pressed.
@TravMurav

Copy link
Copy Markdown
Member

I'm generally a bit concerned with this since you seem to say that linux is broken as it doens't properly initialize the hardware (or properly interpret the signal), yet instead of fixing linux, we're trying to hack stuff into lk2nd...

I think it's worth spending a bit more time here to make sure everything is aligned and linux can stand on it's own.

First of all, do you have access to schematics to know how the keys are wired? I.e. I'd assume they are in fact pulled up switches to ground, where active_low flag would make most sense.

Given (I assume) lk2nd currently handles keys properly, maybe the right solution would be changing linux to reset the inversion flag and then fixing the DT to use correct polarity for gpios? Otherwise it sounds like mainline DT for flo is broken as the flag ACTIVE HIGH contradicts what happens IRL where key line is low when the key is pressed...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants