Skip to content

Commit 837afa5

Browse files
bijudasgeertu
authored andcommitted
pinctrl: renesas: rzg2l: Add suspend/resume support for Schmitt control registers
Renesas RZ/G3E supports a power-saving mode where power to most of the SoC components is lost, including the PIN controller. Save and restore the Schmitt control register contents to ensure the functionality is preserved after a suspend/resume cycle. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> # on RZ/G3S Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/20250819084022.20512-1-biju.das.jz@bp.renesas.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
1 parent 30247fc commit 837afa5

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

drivers/pinctrl/renesas/pinctrl-rzg2l.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ struct rzg2l_pinctrl_pin_settings {
321321
* @iolh: IOLH registers cache
322322
* @pupd: PUPD registers cache
323323
* @ien: IEN registers cache
324+
* @smt: SMT registers cache
324325
* @sd_ch: SD_CH registers cache
325326
* @eth_poc: ET_POC registers cache
326327
* @oen: Output Enable register cache
@@ -334,6 +335,7 @@ struct rzg2l_pinctrl_reg_cache {
334335
u32 *iolh[2];
335336
u32 *ien[2];
336337
u32 *pupd[2];
338+
u32 *smt;
337339
u8 sd_ch[2];
338340
u8 eth_poc[2];
339341
u8 oen;
@@ -2704,6 +2706,10 @@ static int rzg2l_pinctrl_reg_cache_alloc(struct rzg2l_pinctrl *pctrl)
27042706
if (!cache->pfc)
27052707
return -ENOMEM;
27062708

2709+
cache->smt = devm_kcalloc(pctrl->dev, nports, sizeof(*cache->smt), GFP_KERNEL);
2710+
if (!cache->smt)
2711+
return -ENOMEM;
2712+
27072713
for (u8 i = 0; i < 2; i++) {
27082714
u32 n_dedicated_pins = pctrl->data->n_dedicated_pins;
27092715

@@ -2965,7 +2971,7 @@ static void rzg2l_pinctrl_pm_setup_regs(struct rzg2l_pinctrl *pctrl, bool suspen
29652971
struct rzg2l_pinctrl_reg_cache *cache = pctrl->cache;
29662972

29672973
for (u32 port = 0; port < nports; port++) {
2968-
bool has_iolh, has_ien, has_pupd;
2974+
bool has_iolh, has_ien, has_pupd, has_smt;
29692975
u32 off, caps;
29702976
u8 pincnt;
29712977
u64 cfg;
@@ -2978,6 +2984,7 @@ static void rzg2l_pinctrl_pm_setup_regs(struct rzg2l_pinctrl *pctrl, bool suspen
29782984
has_iolh = !!(caps & (PIN_CFG_IOLH_A | PIN_CFG_IOLH_B | PIN_CFG_IOLH_C));
29792985
has_ien = !!(caps & PIN_CFG_IEN);
29802986
has_pupd = !!(caps & PIN_CFG_PUPD);
2987+
has_smt = !!(caps & PIN_CFG_SMT);
29812988

29822989
if (suspend)
29832990
RZG2L_PCTRL_REG_ACCESS32(suspend, pctrl->base + PFC(off), cache->pfc[port]);
@@ -3016,6 +3023,9 @@ static void rzg2l_pinctrl_pm_setup_regs(struct rzg2l_pinctrl *pctrl, bool suspen
30163023
cache->ien[1][port]);
30173024
}
30183025
}
3026+
3027+
if (has_smt)
3028+
RZG2L_PCTRL_REG_ACCESS32(suspend, pctrl->base + SMT(off), cache->smt[port]);
30193029
}
30203030
}
30213031

0 commit comments

Comments
 (0)