* [PATCH RFC 0/3] ARM: imx: Add a more agressive idle mode on i.MX6SLL
@ 2026-11-23 20:31 Andreas Kemnade
2026-11-23 20:31 ` [PATCH RFC 1/3] ARM: imx: enable STOP-ON mode in idle if wakeup requirements permit Andreas Kemnade
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Andreas Kemnade @ 2026-11-23 20:31 UTC (permalink / raw)
To: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Daniel Lezcano, Thomas Gleixner, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-arm-kernel, imx, linux-kernel, devicetree, linux,
Andreas Kemnade
On Ebook readers there are often situations in which the system waits
only for some GPIO IRQs and no module is active, all the clock system
is using most of the power, not every clock gets disabled via RPM,
esp. those are marked as CLK_IS_CRITICAL.
A usual he situation might be mainly wating for touchscreen input.
Since nothing needs to be sent to the display continously, clocks
are not in use. Maybe some frontlight is consuming power, but if it
is not used in maximum brightness mode, the clock system is still
using a significant portion of power.
In contrast to suspend state, that is not forcefully turning things of
and wake up only on selected important things when the device is not used.
E.g. you might still want to have frontlight enabled.
Vendor kernel work around this by adding an extended suspend mode in
which more things are disabled, e.g. the touchscreen.
So rather add another idle state, which is only conditionally used
depending on clock usage.
System timekeeping is currently using a high speed clock, which is a
major blocker for this idle state.
The imx-thermal driver currently needs to be disabled, maybe some
cpuidle notifier block called by cpu_cluster_pm_enter() is the solution.
PXP driver is missing power management, so it should be disabled, too.
Also serial console needs to be disabled.
Use 32K clock for the timer and the clock source to avoid that
dependency and allow the timer to be used in stop mode if that low
power clock source is used.
With these patches are applied (and the not-yet-upstreamed EPDC driver)
I can run a loop displaying the current consumption in every 20 seconds
for about one week. Power saving is around 70% in such
situations.
Probably patch 1 needs a more clean solution, Patch 2 should be good to
go, after that patch 3 can go in, too.
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
Andreas Kemnade (3):
[RFC] ARM: imx: enable STOP-ON mode in idle if wakeup requirements permit
timer-imx-gpt: Allow 32K clock to be used as a clock source
ARM: dts: imx: kobo-clarahd: Use 32K clock for the timer
arch/arm/boot/dts/nxp/imx/imx6sll-kobo-clarahd.dts | 5 +++
arch/arm/mach-imx/common.h | 1 +
arch/arm/mach-imx/cpuidle-imx6sx.c | 42 +++++++++++++++++++++-
arch/arm/mach-imx/pm-imx6.c | 23 ++++++++++++
drivers/clocksource/timer-imx-gpt.c | 13 +++++--
5 files changed, 80 insertions(+), 4 deletions(-)
---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
change-id: 20261123-imx6-idlestop-b14454a91e67
Best regards,
--
Andreas Kemnade <andreas@kemnade.info>
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH RFC 1/3] ARM: imx: enable STOP-ON mode in idle if wakeup requirements permit 2026-11-23 20:31 [PATCH RFC 0/3] ARM: imx: Add a more agressive idle mode on i.MX6SLL Andreas Kemnade @ 2026-11-23 20:31 ` Andreas Kemnade 2026-11-23 20:49 ` sashiko-bot 2026-11-23 20:31 ` [PATCH 2/3] timer-imx-gpt: Allow 32K clock to be used as a clock source Andreas Kemnade 2026-11-23 20:31 ` [PATCH 3/3] ARM: dts: imx: kobo-clarahd: Use 32K clock for the timer Andreas Kemnade 2 siblings, 1 reply; 7+ messages in thread From: Andreas Kemnade @ 2026-11-23 20:31 UTC (permalink / raw) To: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Daniel Lezcano, Thomas Gleixner, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: linux-arm-kernel, imx, linux-kernel, devicetree, linux, Andreas Kemnade Since there are situations when only wakeup from some GPIO IRQs is required (besides the timekeeping infrastructure which can be fed by an always on 32K clock), add another idle state to allow power-hungry PLLs to be turned off in that condition. Since some clocks are not turned off by RPM and implementing it seems not feasible, keep a list of clocks to be ignored. This includes clocks marked as CLK_IS_CRITICAL (romclk, aips_tzX clocks). This is RFC because that mask check feels hacky. collecting references to every clock feels a bit too much, maybe set a flag somewhere by the clock driver. Signed-off-by: Andreas Kemnade <andreas@kemnade.info> --- arch/arm/mach-imx/common.h | 1 + arch/arm/mach-imx/cpuidle-imx6sx.c | 42 +++++++++++++++++++++++++++++++++++++- arch/arm/mach-imx/pm-imx6.c | 23 +++++++++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h index d7ecaa822adbd..7804cf5d83922 100644 --- a/arch/arm/mach-imx/common.h +++ b/arch/arm/mach-imx/common.h @@ -35,6 +35,7 @@ void imx_gpc_set_arm_power_down_timing(u32 sw2iso, u32 sw); void imx25_pm_init(void); void imx27_pm_init(void); void imx5_pmu_init(void); +bool imx6sll_check_pll_are_used(void); enum mxc_cpu_pwr_mode { WAIT_CLOCKED, /* wfi only */ diff --git a/arch/arm/mach-imx/cpuidle-imx6sx.c b/arch/arm/mach-imx/cpuidle-imx6sx.c index 83c5cbd3748e1..4537cb7b3a637 100644 --- a/arch/arm/mach-imx/cpuidle-imx6sx.c +++ b/arch/arm/mach-imx/cpuidle-imx6sx.c @@ -65,6 +65,36 @@ static __cpuidle int imx6sx_enter_wait(struct cpuidle_device *dev, return index; } +static __cpuidle int imx6sx_enter_pll_off(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int index) +{ + if (!cpu_is_imx6sll() || imx6sll_check_pll_are_used()) + return imx6sx_enter_wait(dev, drv, 2); + + imx6_set_lpm(STOP_POWER_ON); + imx6_enable_rbc(true); + imx_gpc_set_arm_power_in_lpm(true); + imx_set_cpu_jump(0, v7_cpu_resume); + imx6_set_int_mem_clk_lpm(true); + /* Need to notify there is a cpu pm operation. */ + cpu_pm_enter(); + cpu_cluster_pm_enter(); + + ct_cpuidle_enter(); + + cpu_suspend(0, imx6sx_idle_finish); + + ct_cpuidle_exit(); + + cpu_cluster_pm_exit(); + cpu_pm_exit(); + imx6_enable_rbc(false); + imx_gpc_set_arm_power_in_lpm(false); + + imx6_set_lpm(WAIT_CLOCKED); + return index; +} + static struct cpuidle_driver imx6sx_cpuidle_driver = { .name = "imx6sx_cpuidle", .owner = THIS_MODULE, @@ -95,8 +125,18 @@ static struct cpuidle_driver imx6sx_cpuidle_driver = { .name = "LOW-POWER-IDLE", .desc = "ARM power off", }, + /* STOP ON */ + { + .exit_latency = 500, + .target_residency = 800, + .flags = CPUIDLE_FLAG_TIMER_STOP | + CPUIDLE_FLAG_RCU_IDLE, + .enter = imx6sx_enter_pll_off, + .name = "STOP ON", + .desc = "ARM power off + PLL off", + }, }, - .state_count = 3, + .state_count = 4, .safe_state_index = 0, }; diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c index 3c73e2cdb8ceb..65a5268d31614 100644 --- a/arch/arm/mach-imx/pm-imx6.c +++ b/arch/arm/mach-imx/pm-imx6.c @@ -64,6 +64,14 @@ #define MX6Q_SUSPEND_OCRAM_SIZE 0x1000 #define MX6_MAX_MMDC_IO_NUM 33 +#define CCGR0 0x68 +#define CCGR1 0x6c +#define CCGR2 0x70 +#define CCGR3 0x74 +#define CCGR4 0x78 +#define CCGR5 0x7c +#define CCGR6 0x80 + static void __iomem *ccm_base __ro_after_init; static void __iomem *suspend_ocram_base __ro_after_init; static void (*imx6_suspend_in_ocram_fn)(void __iomem *ocram_vbase) __ro_after_init; @@ -287,6 +295,21 @@ void imx6_enable_rbc(bool enable) imx_gpc_restore_all(); } +bool imx6sll_check_pll_are_used(void) +{ + /* check for any clock active which provides more than register access */ + return readl_relaxed(ccm_base + CCGR0) & BIT(29) || + readl_relaxed(ccm_base + CCGR1) & (BIT(25) | BIT(23) | BIT(15) | BIT(13) | + BIT(11) | BIT(7) | BIT(5) | BIT(3) | BIT(1)) || + readl_relaxed(ccm_base + CCGR2) & (BIT(31) | BIT(29) | BIT(11) | BIT(9) | + BIT(7) | BIT(3)) || + readl_relaxed(ccm_base + CCGR3) & (BIT(11) | BIT(5) | BIT(3)) || + readl_relaxed(ccm_base + CCGR4) & (BIT(23) | BIT(21) | BIT(19) | BIT(17)) || + readl_relaxed(ccm_base + CCGR5) & (BIT(25) | BIT(23) | BIT(21) | BIT(21) | + BIT(19) | BIT(15) | BIT(7)) || + readl_relaxed(ccm_base + CCGR6) & (BIT(7) | BIT(5) | BIT(3) | BIT(1)); +} + static void imx6q_enable_wb(bool enable) { u32 val; -- 2.47.3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH RFC 1/3] ARM: imx: enable STOP-ON mode in idle if wakeup requirements permit 2026-11-23 20:31 ` [PATCH RFC 1/3] ARM: imx: enable STOP-ON mode in idle if wakeup requirements permit Andreas Kemnade @ 2026-11-23 20:49 ` sashiko-bot 0 siblings, 0 replies; 7+ messages in thread From: sashiko-bot @ 2026-11-23 20:49 UTC (permalink / raw) To: Andreas Kemnade; +Cc: imx, devicetree, robh, conor+dt, Frank.Li Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [Medium] ARM: imx: i.MX6SLL-only STOP ON idle state registered on all i.MX6SX/UL SoCs - [Medium] ARM: imx: imx6sll_check_pll_are_used() omits DCP DMA clock in CCGR0 check - [Low] ARM: imx: duplicate BIT(21) term in CCGR5 mask in imx6sll_check_pll_are_used() - [Low] ARM: imx: imx6sx_enter_pll_off() duplicates state 2 power-off sequence -- commit faf6510335563388f22705edc72db8052152fc32 Author: Andreas Kemnade <andreas@kemnade.info> ARM: imx: enable STOP-ON mode in idle if wakeup requirements permit This commit adds a fourth cpuidle state ("STOP ON") to imx6sx_cpuidle_driver that enters STOP_POWER_ON mode on i.MX6SLL when CCGR0..CCGR6 indicate that PLLs are not in use. > diff --git a/arch/arm/mach-imx/cpuidle-imx6sx.c b/arch/arm/mach-imx/cpuidle-imx6sx.c > index 83c5cbd3748e1..4537cb7b3a637 100644 > --- a/arch/arm/mach-imx/cpuidle-imx6sx.c > +++ b/arch/arm/mach-imx/cpuidle-imx6sx.c > @@ -65,6 +65,36 @@ static __cpuidle int imx6sx_enter_wait(struct cpuidle_device *dev, > return index; > } > > +static __cpuidle int imx6sx_enter_pll_off(struct cpuidle_device *dev, > + struct cpuidle_driver *drv, int index) > +{ > + if (!cpu_is_imx6sll() || imx6sll_check_pll_are_used()) > + return imx6sx_enter_wait(dev, drv, 2); > + > + imx6_set_lpm(STOP_POWER_ON); > + imx6_enable_rbc(true); > + imx_gpc_set_arm_power_in_lpm(true); > + imx_set_cpu_jump(0, v7_cpu_resume); > + imx6_set_int_mem_clk_lpm(true); > + /* Need to notify there is a cpu pm operation. */ > + cpu_pm_enter(); > + cpu_cluster_pm_enter(); > + > + ct_cpuidle_enter(); > + > + cpu_suspend(0, imx6sx_idle_finish); > + > + ct_cpuidle_exit(); > + > + cpu_cluster_pm_exit(); > + cpu_pm_exit(); > + imx6_enable_rbc(false); > + imx_gpc_set_arm_power_in_lpm(false); > + > + imx6_set_lpm(WAIT_CLOCKED); > + return index; > +} [Severity: Low] This isn't a bug, but imx6sx_enter_pll_off() duplicates the state 2 power-off sequence from imx6sx_enter_wait(), differing only in passing STOP_POWER_ON instead of WAIT_UNCLOCKED to imx6_set_lpm(). Calling imx6_set_int_mem_clk_lpm(true) on every entry is also redundant, since imx6sx_cpuidle_init() sets it at init and imx6q_pm_enter() restores it on resume from suspend. > @@ -95,8 +125,18 @@ static struct cpuidle_driver imx6sx_cpuidle_driver = { > .name = "LOW-POWER-IDLE", > .desc = "ARM power off", > }, > + /* STOP ON */ > + { > + .exit_latency = 500, > + .target_residency = 800, > + .flags = CPUIDLE_FLAG_TIMER_STOP | > + CPUIDLE_FLAG_RCU_IDLE, > + .enter = imx6sx_enter_pll_off, > + .name = "STOP ON", > + .desc = "ARM power off + PLL off", > + }, > }, > - .state_count = 3, > + .state_count = 4, > .safe_state_index = 0, > }; [Severity: Medium] Should state 3 only be exposed on i.MX6SLL, and should falling back to state 2 respect dev->states_usage[2].disable? imx6sx_cpuidle_init() registers imx6sx_cpuidle_driver on i.MX6SX, i.MX6UL, i.MX6ULL and i.MX6ULZ as well as i.MX6SLL. Unconditionally setting state_count = 4 advertises an enabled state 3 on those other SoCs that always demotes to state 2, causing cpuidle_enter_state() to record false state 2 "below" misses whenever actual idle time reaches 800 us and skewing governor residency bins. In addition, calling imx6sx_enter_wait(dev, drv, 2) directly bypasses sysfs if state 2 has been disabled by userspace. > diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c > index 3c73e2cdb8ceb..65a5268d31614 100644 > --- a/arch/arm/mach-imx/pm-imx6.c > +++ b/arch/arm/mach-imx/pm-imx6.c [ ... ] > @@ -287,6 +295,21 @@ void imx6_enable_rbc(bool enable) > imx_gpc_restore_all(); > } > > +bool imx6sll_check_pll_are_used(void) > +{ > + /* check for any clock active which provides more than register access */ > + return readl_relaxed(ccm_base + CCGR0) & BIT(29) || [Severity: Medium] Does the CCGR0 mask also need BIT(11) for IMX6SLL_CLK_DCP? In drivers/clk/imx/clk-imx6sll.c, IMX6SLL_CLK_DCP ("dcp", parented to "ahb") is gated by CCGR0 bits 11:10. When mxs_dcp_start_dma() starts a crypto DMA transfer and sleeps in wait_for_completion_timeout(), the single CPU on i.MX6SLL can enter cpuidle; without BIT(11) in the CCGR0 check, entering STOP_POWER_ON stops AHB and PLL clocks mid-transfer and stalls DCP DMA until it times out. > + readl_relaxed(ccm_base + CCGR1) & (BIT(25) | BIT(23) | BIT(15) | BIT(13) | > + BIT(11) | BIT(7) | BIT(5) | BIT(3) | BIT(1)) || > + readl_relaxed(ccm_base + CCGR2) & (BIT(31) | BIT(29) | BIT(11) | BIT(9) | > + BIT(7) | BIT(3)) || > + readl_relaxed(ccm_base + CCGR3) & (BIT(11) | BIT(5) | BIT(3)) || > + readl_relaxed(ccm_base + CCGR4) & (BIT(23) | BIT(21) | BIT(19) | BIT(17)) || > + readl_relaxed(ccm_base + CCGR5) & (BIT(25) | BIT(23) | BIT(21) | BIT(21) | > + BIT(19) | BIT(15) | BIT(7)) || [Severity: Low] BIT(21) is listed twice in the CCGR5 mask; is one of them redundant or meant to be another bit? -- Sashiko AI review · https://sashiko.dev/#/patchset/20261123-imx6-idlestop-v1-0-e32f1f44e46f@kemnade.info?part=1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] timer-imx-gpt: Allow 32K clock to be used as a clock source 2026-11-23 20:31 [PATCH RFC 0/3] ARM: imx: Add a more agressive idle mode on i.MX6SLL Andreas Kemnade 2026-11-23 20:31 ` [PATCH RFC 1/3] ARM: imx: enable STOP-ON mode in idle if wakeup requirements permit Andreas Kemnade @ 2026-11-23 20:31 ` Andreas Kemnade 2026-11-23 20:45 ` sashiko-bot 2026-11-23 20:31 ` [PATCH 3/3] ARM: dts: imx: kobo-clarahd: Use 32K clock for the timer Andreas Kemnade 2 siblings, 1 reply; 7+ messages in thread From: Andreas Kemnade @ 2026-11-23 20:31 UTC (permalink / raw) To: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Daniel Lezcano, Thomas Gleixner, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: linux-arm-kernel, imx, linux-kernel, devicetree, linux, Andreas Kemnade To avoid depending on PLL infrastructure for timekeeping, prepare for using the 32K clock by configuring the clock source accordingly. Signed-off-by: Andreas Kemnade <andreas@kemnade.info> --- drivers/clocksource/timer-imx-gpt.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/clocksource/timer-imx-gpt.c b/drivers/clocksource/timer-imx-gpt.c index 8335bd7f8c6ce..3c023da565564 100644 --- a/drivers/clocksource/timer-imx-gpt.c +++ b/drivers/clocksource/timer-imx-gpt.c @@ -50,8 +50,10 @@ enum imx_gpt_type { /* MX31, MX35, MX25, MX5, MX6 */ #define V2_TCTL_WAITEN (1 << 3) /* Wait enable mode */ +#define V2_TCTL_STOPEN (1 << 5) /* Stop enable mode */ #define V2_TCTL_CLK_IPG (1 << 6) #define V2_TCTL_CLK_PER (2 << 6) +#define V2_TCTL_CLK_32K (4 << 6) #define V2_TCTL_CLK_OSC_DIV8 (5 << 6) #define V2_TCTL_FRR (1 << 9) #define V2_TCTL_24MEN (1 << 10) @@ -314,14 +316,19 @@ static void imx6dl_gpt_setup_tctl(struct imx_timer *imxtm) u32 tctl_val; tctl_val = V2_TCTL_FRR | V2_TCTL_WAITEN | MXC_TCTL_TEN; - if (clk_get_rate(imxtm->clk_per) == V2_TIMER_RATE_OSC_DIV8) { + if (clk_get_rate(imxtm->clk_per) == V2_TIMER_RATE_OSC_DIV8) { tctl_val |= V2_TCTL_CLK_OSC_DIV8; /* 24 / 8 = 3 MHz */ writel_relaxed(7 << V2_TPRER_PRE24M, imxtm->base + MXC_TPRER); tctl_val |= V2_TCTL_24MEN; - } else { + } else if (clk_get_rate(imxtm->clk_per) == 32768) + /* + * if powered by that always on clock, it is feasible to let + * it run in stop mode, too, allowing lower idle states + */ + tctl_val |= V2_TCTL_CLK_32K | V2_TCTL_STOPEN; + else tctl_val |= V2_TCTL_CLK_PER; - } writel_relaxed(tctl_val, imxtm->base + MXC_TCTL); } -- 2.47.3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] timer-imx-gpt: Allow 32K clock to be used as a clock source 2026-11-23 20:31 ` [PATCH 2/3] timer-imx-gpt: Allow 32K clock to be used as a clock source Andreas Kemnade @ 2026-11-23 20:45 ` sashiko-bot 0 siblings, 0 replies; 7+ messages in thread From: sashiko-bot @ 2026-11-23 20:45 UTC (permalink / raw) To: Andreas Kemnade; +Cc: imx, devicetree, robh, conor+dt, Frank.Li Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] clocksource/drivers/imx-gpt: 0xff min_delta in mxc_clockevent_init() at 32kHz -- commit 0ecf0128c84aa5f3ec6bfdf07afd50c02de8f373 Author: Andreas Kemnade <andreas@kemnade.info> timer-imx-gpt: Allow 32K clock to be used as a clock source This commit configures the i.MX GPT TCTL register to select the 32 kHz clock and enable stop mode when the peripheral clock runs at 32768 Hz. > diff --git a/drivers/clocksource/timer-imx-gpt.c b/drivers/clocksource/timer-imx-gpt.c > index 8335bd7f8c6ce..3c023da565564 100644 > --- a/drivers/clocksource/timer-imx-gpt.c > +++ b/drivers/clocksource/timer-imx-gpt.c [ ... ] > @@ -314,14 +316,19 @@ static void imx6dl_gpt_setup_tctl(struct imx_timer *imxtm) > u32 tctl_val; > > tctl_val = V2_TCTL_FRR | V2_TCTL_WAITEN | MXC_TCTL_TEN; > - if (clk_get_rate(imxtm->clk_per) == V2_TIMER_RATE_OSC_DIV8) { > + if (clk_get_rate(imxtm->clk_per) == V2_TIMER_RATE_OSC_DIV8) { > tctl_val |= V2_TCTL_CLK_OSC_DIV8; > /* 24 / 8 = 3 MHz */ > writel_relaxed(7 << V2_TPRER_PRE24M, imxtm->base + MXC_TPRER); > tctl_val |= V2_TCTL_24MEN; > - } else { > + } else if (clk_get_rate(imxtm->clk_per) == 32768) > + /* > + * if powered by that always on clock, it is feasible to let > + * it run in stop mode, too, allowing lower idle states > + */ > + tctl_val |= V2_TCTL_CLK_32K | V2_TCTL_STOPEN; > + else > tctl_val |= V2_TCTL_CLK_PER; > - } > > writel_relaxed(tctl_val, imxtm->base + MXC_TCTL); > } [Severity: High] Does running clk_per at 32768 Hz leave the hardcoded 0xff min_delta in mxc_clockevent_init() too large? drivers/clocksource/timer-imx-gpt.c:mxc_clockevent_init() { ... clockevents_config_and_register(ced, clk_get_rate(imxtm->clk_per), 0xff, 0xfffffffe); ... } At 32768 Hz, 255 ticks sets min_delta_ns to ~7.78 ms, so clockevents_program_event() clamps every shorter hrtimer and scheduler tick (such as HZ=250 or HZ=1000) to ~7.78 ms (~128.5 Hz). In addition, mxc_clocksource_init() unconditionally calls register_current_timer_delay() with freq = 32768, which fails with a pr_err() in arch/arm/lib/delay.c because a 30517 ns tick exceeds the 1000 ns resolution limit, falling back to jiffies-based calibrate_delay() while jiffies are advancing at the clamped ~128.5 Hz rate and miscalibrating loops_per_jiffy. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261123-imx6-idlestop-v1-0-e32f1f44e46f@kemnade.info?part=2 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] ARM: dts: imx: kobo-clarahd: Use 32K clock for the timer 2026-11-23 20:31 [PATCH RFC 0/3] ARM: imx: Add a more agressive idle mode on i.MX6SLL Andreas Kemnade 2026-11-23 20:31 ` [PATCH RFC 1/3] ARM: imx: enable STOP-ON mode in idle if wakeup requirements permit Andreas Kemnade 2026-11-23 20:31 ` [PATCH 2/3] timer-imx-gpt: Allow 32K clock to be used as a clock source Andreas Kemnade @ 2026-11-23 20:31 ` Andreas Kemnade 2026-11-23 20:59 ` sashiko-bot 2 siblings, 1 reply; 7+ messages in thread From: Andreas Kemnade @ 2026-11-23 20:31 UTC (permalink / raw) To: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Daniel Lezcano, Thomas Gleixner, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: linux-arm-kernel, imx, linux-kernel, devicetree, linux, Andreas Kemnade To avoid depending on PLL infrastructure for timekeeping, use 32K timer for the timer. --- arch/arm/boot/dts/nxp/imx/imx6sll-kobo-clarahd.dts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/nxp/imx/imx6sll-kobo-clarahd.dts b/arch/arm/boot/dts/nxp/imx/imx6sll-kobo-clarahd.dts index 1000ee8b807aa..2e907c4163629 100644 --- a/arch/arm/boot/dts/nxp/imx/imx6sll-kobo-clarahd.dts +++ b/arch/arm/boot/dts/nxp/imx/imx6sll-kobo-clarahd.dts @@ -46,6 +46,11 @@ &gpio_keys { pinctrl-0 = <&pinctrl_gpio_keys>; }; +&gpt1 { + clocks = <&clks IMX6SLL_CLK_GPT_BUS>, + <&clks IMX6SLL_CLK_CKIL>; +}; + &i2c1 { pinctrl-names = "default","sleep"; pinctrl-0 = <&pinctrl_i2c1>; -- 2.47.3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] ARM: dts: imx: kobo-clarahd: Use 32K clock for the timer 2026-11-23 20:31 ` [PATCH 3/3] ARM: dts: imx: kobo-clarahd: Use 32K clock for the timer Andreas Kemnade @ 2026-11-23 20:59 ` sashiko-bot 0 siblings, 0 replies; 7+ messages in thread From: sashiko-bot @ 2026-11-23 20:59 UTC (permalink / raw) To: Andreas Kemnade; +Cc: imx, devicetree, robh, conor+dt, Frank.Li Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] ARM: dts: imx: kobo-clarahd: missing Signed-off-by trailer in commit message - [High] ARM: dts: imx: overriding gpt1 per clock with 32K CKIL degrades system timer -- commit f6e6f44334678659ba2ecc2406ebe0d33a2e4544 Author: Andreas Kemnade <andreas@kemnade.info> > ARM: dts: imx: kobo-clarahd: Use 32K clock for the timer > > To avoid depending on PLL infrastructure for timekeeping, use 32K timer > for the timer. [Severity: High] The commit message is missing a Signed-off-by: tag. > diff --git a/arch/arm/boot/dts/nxp/imx/imx6sll-kobo-clarahd.dts b/arch/arm/boot/dts/nxp/imx/imx6sll-kobo-clarahd.dts > index 1000ee8b807aa..2e907c4163629 100644 > --- a/arch/arm/boot/dts/nxp/imx/imx6sll-kobo-clarahd.dts > +++ b/arch/arm/boot/dts/nxp/imx/imx6sll-kobo-clarahd.dts > @@ -46,6 +46,11 @@ &gpio_keys { > pinctrl-0 = <&pinctrl_gpio_keys>; > }; > > +&gpt1 { > + clocks = <&clks IMX6SLL_CLK_GPT_BUS>, > + <&clks IMX6SLL_CLK_CKIL>; > +}; > + > &i2c1 { > pinctrl-names = "default","sleep"; > pinctrl-0 = <&pinctrl_i2c1>; [Severity: High] Does overriding gpt1's per clock with the 32.768 kHz IMX6SLL_CLK_CKIL degrade system timekeeping on i.MX6SLL, where gpt1 is the only system timer? In drivers/clocksource/timer-imx-gpt.c, mxc_clockevent_init() registers the clockevent device with a hardcoded min_delta of 0xff ticks: drivers/clocksource/timer-imx-gpt.c:mxc_clockevent_init() { ... clockevents_config_and_register(ced, clk_get_rate(imxtm->clk_per), 0xff, 0xfffffffe); ... } At 32768 Hz, 255 ticks is ~7.78 ms, so clockevents_program_event() clamps every timer or hrtimer wakeup below 7.78 ms (including scheduler ticks at CONFIG_HZ >= 200 and short cpuidle sleeps) to 7.78 ms. At 32768 Hz, mxc_clocksource_init() also reduces sched_clock and clocksource resolution to ~30.5 us, and register_current_timer_delay() rejects imx_delay_timer because its resolution exceeds 1000 ns, falling back to loop-based udelay() on a board with cpufreq scaling. In addition, the GPT clock inputs are internal to the i.MX6SLL SoC, so overriding the per clock in the board DTS does not describe board-specific hardware. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261123-imx6-idlestop-v1-0-e32f1f44e46f@kemnade.info?part=3 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-11-23 20:59 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-23 20:31 [PATCH RFC 0/3] ARM: imx: Add a more agressive idle mode on i.MX6SLL Andreas Kemnade 2026-11-23 20:31 ` [PATCH RFC 1/3] ARM: imx: enable STOP-ON mode in idle if wakeup requirements permit Andreas Kemnade 2026-11-23 20:49 ` sashiko-bot 2026-11-23 20:31 ` [PATCH 2/3] timer-imx-gpt: Allow 32K clock to be used as a clock source Andreas Kemnade 2026-11-23 20:45 ` sashiko-bot 2026-11-23 20:31 ` [PATCH 3/3] ARM: dts: imx: kobo-clarahd: Use 32K clock for the timer Andreas Kemnade 2026-11-23 20:59 ` sashiko-bot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox