Skip to content

PEND: boards: ti: fix CC35x1 user button polarity - #261

Open
wizath wants to merge 1 commit into
TexasInstruments:v4.4.0-ti-nextfrom
wizath:fix/ti/buttons
Open

wizath wants to merge 1 commit into
TexasInstruments:v4.4.0-ti-nextfrom
wizath:fix/ti/buttons

Conversation

@wizath

@wizath wizath commented Dec 3, 2026

Copy link
Copy Markdown

No description provided.

@wizath
wizath requested a review from a team December 3, 2026 11:39
@qodo-code-review

qodo-code-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

boards: ti: fix CC35x1 user button polarity

🐞 Bug fix ⚙️ Configuration changes 🕐 Less than 10 minutes

Grey Divider

AI Description

• Switches both CC35x1 user buttons from active-low to active-high with pull-down.
• Enables polling-mode on the gpio-keys buttons node.
• Changes are limited to one devicetree include shared by the lp_em_cc35x1 board.
Merge Risk 🟢 Low

Blast radius 🟢 Low 💥 1 capability

  • 1 affected end-to-end capability after fault-specific containment; implementation boundaries do not widen its functional scope.
  • Both declarations are input surfaces of the same bounded LaunchPad user-input feature and are exposed through one gpio-keys device with two key codes.
Sources

boards/ti/lp_em_cc35x1/lp_em_cc35x1_common.dtsi[61-70]

		user_switch_1: user_sw_1 {
			gpios = <&gpios 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
			label = "User SW1";
			zephyr,code = <INPUT_KEY_0>;
		};

		user_switch_2: user_sw_2 {
			gpios = <&gpios 36 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
			label = "User SW2";
			zephyr,code = <INPUT_KEY_1>;
Behavioral complexity 🟢 Low 🧩 Straightforward

  • Before, both switches were declared active-low without an explicit bias; after, both are declared active-high with pull-downs.
  • The changed condition is matching GPIO polarity and bias to the physical wiring, while gpio-keys processing remains unchanged.
Sources

boards/ti/lp_em_cc35x1/lp_em_cc35x1_common.dtsi[61-70]

		user_switch_1: user_sw_1 {
			gpios = <&gpios 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
			label = "User SW1";
			zephyr,code = <INPUT_KEY_0>;
		};

		user_switch_2: user_sw_2 {
			gpios = <&gpios 36 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
			label = "User SW2";
			zephyr,code = <INPUT_KEY_1>;
Potential damage 🟡 Medium 🩹 Temporary loss

  • If the physical switch wiring does not match the new polarity or bias, one or both switch events can be inverted, stuck, or absent.
  • No persistent state or external side effect is established in this PR.
  • Reverting the device-tree declarations restores the prior interpretation and stops new incorrect input reports; any consumer action already taken would require that consumer's own recovery.
Sources

boards/ti/lp_em_cc35x1/lp_em_cc35x1_common.dtsi[61-70]

		user_switch_1: user_sw_1 {
			gpios = <&gpios 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
			label = "User SW1";
			zephyr,code = <INPUT_KEY_0>;
		};

		user_switch_2: user_sw_2 {
			gpios = <&gpios 36 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
			label = "User SW2";
			zephyr,code = <INPUT_KEY_1>;
Assessed commit 683fa3e
Diagram

graph TD
  SW1["User SW1 (GPIO 2)"] --> KEYS["gpio-keys buttons node"] --> INPUT["Input subsystem (INPUT_KEY_0/1)"]
  SW2["User SW2 (GPIO 36)"] --> KEYS
Loading
High-Level Assessment

Correcting GPIO polarity in the devicetree is the right fix, because the flags should describe the physical button wiring. The added polling-mode is not explained in the commit message. Reviewers should confirm polling is needed, since it trades interrupt-driven input for periodic scanning. If the button pins support interrupts, dropping polling-mode would be the cleaner fix.

Files changed (1) +3 / -2

Bug fix (1) +3 / -2
lp_em_cc35x1_common.dtsiInvert user button polarity and enable polling on gpio-keys +3/-2

Invert user button polarity and enable polling on gpio-keys

• Changes both user button GPIO specifiers from GPIO_ACTIVE_LOW to GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN for SW1 (GPIO 2) and SW2 (GPIO 36). Adds polling-mode to the buttons gpio-keys node. Labels and key codes are unchanged.

boards/ti/lp_em_cc35x1/lp_em_cc35x1_common.dtsi

@qodo-code-review

qodo-code-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Code Review by Qodo


View medium (1)
Remediation recommended
1. Buttons may read as stuck pressed 🐞
Description
The user_sw_1 and user_sw_2 nodes change from GPIO_ACTIVE_LOW with no bias flag to
GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN, which inverts the logical meaning of both pins and relies on an
internal pull-down. If the board wires these buttons with an external pull-up, that pull-up
overrides the weak internal pull-down, so the pins idle high and the buttons report as pressed or
invert their presses.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The CC35x1 LaunchPad user buttons (`user_sw_1` on gpio 2 and `user_sw_2` on gpio 36) were changed from GPIO_ACTIVE_LOW to GPIO_ACTIVE_HIGH with an internal GPIO_PULL_DOWN. The PR gives no hardware justification, and an external pull-up on the board would override the internal pull-down so the buttons could read as always pressed.

## Fix Focus Areas
- boards/ti/lp_em_cc35x1/lp_em_cc35x1_common.dtsi[61-70]

## Recommended Fix
Check the LaunchPad CC35x1 schematic for the S1/S2 pull resistor and button-to-ground wiring. If the buttons are pulled up externally and pressed to GND, restore `GPIO_ACTIVE_LOW` and drop the pull-down flag. Keep ACTIVE_HIGH with pull-down only if the schematic shows an external pull-down or no pull resistor. Record the verified wiring in the commit message and check on hardware that press events fire on press and not on release.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


Comment thread drivers/gpio/gpio_cc35xx.c Resolved
Comment thread drivers/gpio/gpio_cc35xx.c Resolved
SW1 and SW2 pull GPIO2 and GPIO36 high when pressed, as in the SDK
board file. Mark them active high with an internal pull-down.

Signed-off-by: Jakub Jarosinski <jakub.jarosinski@conclusive.pl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants