From: gregory.clement@bootlin.com (Gregory CLEMENT)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] pinctrl: armada-37xx: add suspend/resume support
Date: Mon, 30 Apr 2018 15:49:16 +0200 [thread overview]
Message-ID: <87a7tkby8z.fsf@bootlin.com> (raw)
In-Reply-To: <20180421141731.25556-1-miquel.raynal@bootlin.com> (Miquel Raynal's message of "Sat, 21 Apr 2018 16:17:31 +0200")
Hi Miquel,
On sam., avril 21 2018, Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> From: Ken Ma <make@marvell.com>
>
> Add suspend/resume hooks in pinctrl driver to handle S2RAM operations.
>
> Beyond the traditional register save/restore operations, these hooks
> also keep the GPIOs used for both-edge IRQ synchronized between their
> level (low/high) and expected IRQ polarity (falling/rising edge).
>
> Since pinctrl is an infrastructure module, its resume should be issued
> prior to other IO drivers. The pinctrl PM is registered as syscore
> level to make sure of it. A postcore initcall is added to register
> syscore operation. Because of the use of such syscore_ops, the
> suspend/resume hooks do not have access to a device pointer, and thus
> need to use a global list in order to keep track of the probed devices
> for which registers have to be saved/restored.
Did you consider to use SET_LATE_SYSTEM_SLEEP_PM_OPS ?
[...]
> +#if defined(CONFIG_PM)
> +static int armada_3700_pinctrl_suspend(void)
> +{
> + struct armada_37xx_pinctrl *info;
> +
> + list_for_each_entry(info, &device_list, node) {
> + /* Save GPIO state */
> + regmap_read(info->regmap, OUTPUT_EN, &info->pm.out_en_l);
> + regmap_read(info->regmap, OUTPUT_EN + sizeof(u32),
> + &info->pm.out_en_h);
> + regmap_read(info->regmap, OUTPUT_VAL, &info->pm.out_val_l);
> + regmap_read(info->regmap, OUTPUT_VAL + sizeof(u32),
> + &info->pm.out_val_h);
> +
> + info->pm.irq_en_l = readl(info->base + IRQ_EN);
> + info->pm.irq_en_h = readl(info->base + IRQ_EN + sizeof(u32));
> + info->pm.irq_pol_l = readl(info->base + IRQ_POL);
> + info->pm.irq_pol_h = readl(info->base + IRQ_POL + sizeof(u32));
> +
> + /* Save pinctrl state */
> + regmap_read(info->regmap, SELECTION, &info->pm.selection);
I thought there was an API with regmap which allow to save all the
register in one call. If it is the case it woudl be nice to use it.
Gregory
--
Gregory Clement, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com
next prev parent reply other threads:[~2018-04-30 13:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-21 14:17 [PATCH] pinctrl: armada-37xx: add suspend/resume support Miquel Raynal
2018-04-30 13:49 ` Gregory CLEMENT [this message]
2018-06-26 13:59 ` Miquel Raynal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a7tkby8z.fsf@bootlin.com \
--to=gregory.clement@bootlin.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).