Skip to content

rtc: s5m: fix S2MPG10 alarm pending readback - #149

Draft
Gr-linkk wants to merge 1 commit into
derekross:omamobilefrom
Gr-linkk:codex/rtc-s2mpg10-alarm-status
Draft

Gr-linkk wants to merge 1 commit into
derekross:omamobilefrom
Gr-linkk:codex/rtc-s2mpg10-alarm-status

Conversation

@Gr-linkk

@Gr-linkk Gr-linkk commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

The S2MPG10 alarm callback reads offset 0x08, an interrupt mask on this PMIC, instead of STATUS2 at 0x0d. It can therefore report the mask bit as the alarm-pending state. Read STATUS2 bit 2 for S2MPG10 and return a read error before using the value; the other PMIC paths are unchanged.

Google's GPL S2MPG10 register header and RTC header define the address and alarm bit.

The actual callback passes 1,550 host cases covering register values, read errors and unsupported devices. A separate 3,840-case comparison checks the other PMIC paths and opposing S2MPG10 mask/status values. These tests model register and IRQ activity. ARM64 W=1, strict checkpatch, merge and repository policy checks pass.

Exact-head hardware evidence: on November 7, the kernel built from c59065d8ba824d2bb559adea2d99cd381ee89b6e booted on a Pixel 6 in a separately qualified rescue image and passed the 90-second boot check, firmware-memory coverage, guarded storage enumeration and metadata-preservation checks. The original images and native desktop were restored and verified afterward. This used a local device-tree/rescue packaging adaptation; it does not qualify the public device tree as a standalone phone installation. No PMIC/RTC provider or alarm operation was performed in that run.

This remains a draft pending the requested awake alarm set/read/cancel test. The exact-branch test helper is prepared offline, including independent timeout supervision and cancellation after failure. Live execution is blocked on qualification of cancellation-only recovery after an uncertain alarm operation: a reset alone does not establish that the PMIC alarm is disabled.

/proc/driver/rtc will supply the requested armed-alarm smoke evidence, but its alarm fields are cached by the RTC core. Independent hardware verification is required for the final disabled state. Alarm expiry/IRQ delivery, a live pending bit, suspend/wake and the unchanged S2MPG12 path have not been tested on this branch. Results from the broader integration kernel are not attributed to this exact-head test.

The S2MPG10 alarm callback reads S2MPS14_REG_ST2 at offset 0x08.
On S2MPG10 that offset is an interrupt mask register; alarm 0's
pending bit is bit 2 of STATUS2 at offset 0x0d. The callback can
therefore report the mask bit as the pending alarm state.

Read S2MPG10_PMIC_STATUS2 for S2MPG10 and check the read result
before using the value. Leave the other PMIC paths unchanged.

Fixes: e64180846e7e ("rtc: s5m: add support for S2MPG10 RTC")
Link: https://android.googlesource.com/kernel/google-modules/soc/gs/+/204078758737776959ecc85c527a00fd2cabb62f/drivers/rtc/rtc-s2mpg10.c
Link: https://android.googlesource.com/kernel/google-modules/soc/gs/+/204078758737776959ecc85c527a00fd2cabb62f/include/linux/mfd/samsung/rtc-s2mpg10.h
Assisted-by: LLM
Signed-off-by: Gr-linkk <280405187+Gr-linkk@users.noreply.github.com>
@Gr-linkk
Gr-linkk marked this pull request as draft October 31, 2026 02:59
@derekross

Copy link
Copy Markdown
Owner

Thank you, verified against Google's register header (PM_STATUS2 = 0xD) and driver, and it mirrors the S2MPG12 case; the 7 Pro (S2MPG12) is unchanged. The gate passes on today's base. When you take it out of draft, one boot of this branch with an alarm set (/proc/driver/rtc) would be welcome, and then I'll merge.

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