Skip to content

Odin 2 stick LEDs are dead, and the sn3112 driver has a misaligned-atomic bug #74

Description

@loki666

Upstream: ROCKNIX/distribution@4609c50

Two independent faults, one commit's worth of change.

1. The DTS never enables the nodes

Both sn3112 controllers ship disabled, so the stick LEDs cannot light no matter what the driver does:

  • kernel/dts/qcom/qcs8550-ayn-odin2.dts:194 pwm_rgb_left: sn3112@54status = "disabled" (:200)
  • kernel/dts/qcom/qcs8550-ayn-odin2.dts:241 pwm_rgb_right: sn3112@54status = "disabled" (:247)

2. set_bit() on a u8 array is a misaligned 64-bit atomic

kernel/patches/0034_sn3112-pwm-driver.patch:132:

set_bit(bit, (ulong *)&priv->pwm_en_reg[reg]);

pwm_en_reg is a u8 array. Casting an arbitrary byte offset to unsigned long * and handing it
to the bitops is not just a strict-aliasing problem — on arm64 the atomic bitops require natural
alignment, and the addressed word also runs past the intended byte into its neighbours. The fix is a
plain |= BIT(bit); nothing here is concurrent, so the atomic bought nothing to begin with.

Scope

Only the Odin 2 declares sn3112 nodes, so no other board changes. Cost is a two-line DTS edit plus a
re-roll of one hunk in patch 0034.

hw-gate: needs an Odin 2 to confirm the LEDs actually light and that probe does not crash. Both
halves want checking together — enabling the nodes is what first makes the buggy write execute.

Verified against main @ a53ba1b, 2026-08-29.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Should fix -- correctness, fragility, or missing validationarea/hardwareSubsystem: hardwarearea/kernelSubsystem: kernelbugSomething isn't workinghw-gateCannot be closed without evidence from a real device

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions