Repository navigation
mfd: sec: s2mpg14: Add the PMIC interrupt and the RTC alarm - #55
Conversation
|
Thanks for this. It's a clean follow-on to the RTC work, and it reuses the A few things before I merge:
Smaller things, no need to block on them:
Thanks again. The alarm test with the interrupt count is exactly the kind |
f8f67ea to
40e3397
Compare
|
Thanks for checking the bits against Google's driver. Reworked on top of the updated #54 (so the
checkpatch --strict shows two warnings on the driver commit: the The boot of this head on the 9a waits for the palmtop, which needs a power-key restart this morning. Then I'll post the |
|
Booted this head's interrupt code on the palmtop, same kernel as in my #54 comment ( The wakealarm from Linux. GIC 106 is SPI 74: The 9a suspends now (s2idle), so I tested the wake too. The two nodes I booted with, from our integration board file: phone-smoke passes every required check, as on #54. |
|
Thanks, all three points are in. I checked the masks against Google's What's left is the 9a boot of this head, as for #54: Once that's posted I'll land them. Either #54 first and this one rebased to its two commits, or all four commits from here in one go with #54 closed as landed through this PR; I'll pick whichever is less work for you at the time. |
|
The 9a results for this head, with one caveat about which kernel ran them. What didn't work: I built this head on its own ( What ran: the integration kernel the palmtop runs, The PMIC's interrupt (GIC SPI 74, 106 in The nodes it booted with (from the DTB the palmtop booted): If you'd rather have a boot of exactly this head, it needs a base with the clocks and UFS in it. I can build one on #87's stack (which has #80's tree) plus these four commits, if that counts for you. |
|
Thank you for both reports. I'm sorry I asked twice: your 27 October boot crossed my comment. The results are what this PR should give. The PMIC's line (SPI 74) fires on the alarm, You don't need to build a kernel of exactly this head. Your integration tree is fine, as long as I can see that it carries this PR's code. Its release is One thing I found while checking the merge order, and it matters before this lands. The board stack (#80 up to #96, and #122 on top) describes Two ways to fix it; either is fine with me:
When it's in, I'll rebase-merge this PR's four commits and close #54 as landed through it, so you don't need to rebase. The checks pass on today's |
The S2MPG14's RTC block sits at ACPM access type 0x02 and has the same register layout as the S2MPG10's (CTRL at 0x00 through OSC_CTRL at 0x1b, two nonces to 0x2b, five scratch registers to 0x30), per Google's GPL rtc-s2mpg14.h. Describe it as an uncached "rtc" regmap over the ACPM bus, let the PMIC regmap read STATUS2 (the alarm flag, bit 2 as on S2MPG12), and add the s2mpg14-rtc cell. No interrupt line is described yet, so the cell carries no alarm resource. The regmap reads up to OSC_CTRL and writes only what rtc-s5m writes: CTRL, UPDATE, the time and alarm 0. SMPL, WTSR, CAP_SEL and OSC_CTRL (the power-loss and watchdog-reset protections and the oscillator tuning) and the nonces stay read-only. Link: https://android.googlesource.com/kernel/google-modules/soc/gs/+/refs/heads/android-gs-tegu-6.1-android16/include/linux/mfd/samsung/rtc-s2mpg14.h Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
The S2MPG14 (Pixel 9a main PMIC) keeps its RTC in the S2MPG10 layout, reached through the "rtc" regmap the sec-acpm driver now provides, so it takes the S2MPG10 register table. Its alarm flag is STATUS2 bit 2 in the PMIC regmap, as on the S2MPG12. Without a PMIC interrupt line the device comes up with the alarm feature cleared, as a time-only clock. On the Pixel 9a the RTC registers as rtc0 and the system clock is set from it at boot: s5m-rtc s2mpg14-rtc: registered as rtc0 s5m-rtc s2mpg14-rtc: setting system clock to 2026-10-26T13:28:26 UTC Tested on the Pixel 9a: rtc0 registers at boot, hwclock reads and sets the time, systemd-timesyncd writes the synchronized time back, and the time survives reboots and a power-key reset. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
The S2MPG14 reports its PMIC events in-band, and the Tensor G4's VGPIO2AP block raises them as one level interrupt that stays pending until written back, the same arrangement the S2MPG12 binding describes. Add the interrupt, the phandle to the VGPIO2AP system registers and wakeup-source, and say how the interrupt reaches the host. Unlike on the S2MPG12, the interrupt stays optional. The PMIC's rails (the touchscreen and eUSB2 supplies) work without it, and the Pixel 9a and Pixel 8 Pro device trees describe the PMIC without one; a board that leaves it out only loses the PMIC's events, the RTC alarm among them. The interrupt can't be acknowledged without the sysreg, so it depends on the phandle, and wakeup-source, which means nothing without the interrupt, depends on the interrupt. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
The S2MPG14 (Pixel 9a main PMIC) has the S2MPG12's five PMIC interrupt registers, INT1-INT5 at 0x00-0x04 clearing on read with their masks at 0x05-0x09, routed in-band through IBIM1 and latched by the SoC's VGPIO2AP block, which the AP sees as GIC SPI 74. Google's GPL driver gives the bit layout (s2mpg14-irq.c, with the order of the sources in s2mpg14-register.h). Add the interrupt chip after the S2MPG12's: mask every source first (all eight bits of INT1M-INT5M, as Google's driver does, since regmap-irq only masks the bits it knows), then request the line, acknowledge the VGPIO2AP latch before each status read and unmask only the PMIC source in IBIM1 (nothing handles the power meter, and its regmap is not exposed). The ACPM regmaps grow the interrupt block, with INT1-INT5 precious, and IBIM1, the only common register the driver writes and so the only writable one. The RTC cell gets its alarm resource, so the rtc-s5m driver enables the alarm it was built with. The interrupt stays optional, as the binding allows: the Pixel 9a and Pixel 8 Pro device trees describe the PMIC without it, and the PMIC's regulators supply the eUSB2 PHY and the touchscreen, so failing the probe would take USB down with it. Without an interrupt the driver writes none of the interrupt registers and registers the RTC without the alarm resource (there is no IRQ domain to map it into), as before this change. The other PMICs keep their paths. Tested on the Pixel 9a: /proc/interrupts lists the s2mpg14-pmic chip behind GIC SPI 74, a 15 s wakealarm on rtc0 fires (the interrupt count advances by one and the alarm clears), the line stays at zero otherwise, and the LDOs and the clock behave as before. Link: https://android.googlesource.com/kernel/google-modules/soc/gs/+/204078758737776959ecc85c527a00fd2cabb62f/drivers/mfd/s2mpg14-irq.c Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
40e3397 to
6907464
Compare
|
Thanks for catching the merge-order problem. I went with your second option (head 6907464, rebased onto today's The S2MPG14 now takes its interrupt with The boot of this head on the palmtop,
The two reworked commits (the binding and the driver) carry my sign-off again; the first two are unchanged. |
|
Thank you, @W4HO-ham. Making the interrupt optional is a good way to do it, and thank you for the boot of this exact head with no What I checked on
I'll rebase-merge the four commits and close #54 as landed through this one, as I said. For later, not for this PR: the 9a gets its RTC alarm and PMIC wake once its device tree has the VGPIO2AP |
|
Merged. Thanks, @W4HO-ham. |
The S2MPG14's PMIC interrupt for the Pixel 9a: the S2MPG12 arrangement (five clear-on-read INT registers, in-band through IBIM1, latched by the SoC's VGPIO2AP block, GIC SPI 74), an irq chip in sec-irq.c after the S2MPG12's, the interrupt block and the IBIM registers in the ACPM regmaps, and the RTC cell's alarm resource, so rtc-s5m enables the alarm.
Stacked on #54: the first two commits are that PR's, the last two are this one's (binding first, driver second). CI tests the merge of all four; once #54 lands this rebases to the two.
Tested on the Pixel 9a:
/proc/interruptsshows thes2mpg14-pmicchip behind GIC SPI 74, a 15 swakealarmon rtc0 fires (count advances by one, alarm clears), the line stays at zero otherwise, and the LDOs and the clock behave as before. The device tree side (interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>,google,vgpio2ap-sysreg,wakeup-source, asyscon@15090000node) is in my local tegu DT batch; the binding now requires the interrupt and the sysreg phandle, as the S2MPG12's does. checkpatch --strict is clean apart from theconstwarning the S2MPG12 chip copy gets too, W=1 clean,dt-doc-validateand yamllint pass.