linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "André Draszik" <andre.draszik@linaro.org>
To: Peter Griffin <peter.griffin@linaro.org>,
	Krzysztof Kozlowski	 <krzk@kernel.org>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Linus Walleij <linus.walleij@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org,  tudor.ambarus@linaro.org,
	willmcvicker@google.com, semen.protsenko@linaro.org,
		kernel-team@android.com, jaewon02.kim@samsung.com,
	stable@vger.kernel.org
Subject: Re: [PATCH v2 3/4] pinctrl: samsung: add gs101 specific eint suspend/resume callbacks
Date: Thu, 06 Mar 2025 15:12:32 +0000	[thread overview]
Message-ID: <5fe34e1193a167c24c7af900f5b7cf85140d66e0.camel@linaro.org> (raw)
In-Reply-To: <20250301-pinctrl-fltcon-suspend-v2-3-a7eef9bb443b@linaro.org>

On Sat, 2025-03-01 at 11:43 +0000, Peter Griffin wrote:
> gs101 differs to other SoCs in that fltcon1 register doesn't
> always exist. Additionally the offset of fltcon0 is not fixed
> and needs to use the newly added eint_fltcon_offset variable.
> 
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> Fixes: 4a8be01a1a7a ("pinctrl: samsung: Add gs101 SoC pinctrl configuration")
> Cc: stable@vger.kernel.org
> ---
>  drivers/pinctrl/samsung/pinctrl-exynos-arm64.c | 24 ++++-----
>  drivers/pinctrl/samsung/pinctrl-exynos.c       | 71 ++++++++++++++++++++++++++
>  drivers/pinctrl/samsung/pinctrl-exynos.h       |  2 +
>  3 files changed, 85 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/pinctrl/samsung/pinctrl-exynos-arm64.c b/drivers/pinctrl/samsung/pinctrl-exynos-arm64.c
> index 57c98d2451b5..fca447ebc5f5 100644
> --- a/drivers/pinctrl/samsung/pinctrl-exynos-arm64.c
> +++ b/drivers/pinctrl/samsung/pinctrl-exynos-arm64.c
> @@ -1455,15 +1455,15 @@ static const struct samsung_pin_ctrl gs101_pin_ctrl[] __initconst = {
>  		.pin_banks	= gs101_pin_alive,
>  		.nr_banks	= ARRAY_SIZE(gs101_pin_alive),
>  		.eint_wkup_init = exynos_eint_wkup_init,
> -		.suspend	= exynos_pinctrl_suspend,
> -		.resume		= exynos_pinctrl_resume,
> +		.suspend	= gs101_pinctrl_suspend,
> +		.resume		= gs101_pinctrl_resume,
>  	}, {
>  		/* pin banks of gs101 pin-controller (FAR_ALIVE) */
>  		.pin_banks	= gs101_pin_far_alive,
>  		.nr_banks	= ARRAY_SIZE(gs101_pin_far_alive),
>  		.eint_wkup_init = exynos_eint_wkup_init,
> -		.suspend	= exynos_pinctrl_suspend,
> -		.resume		= exynos_pinctrl_resume,
> +		.suspend	= gs101_pinctrl_suspend,
> +		.resume		= gs101_pinctrl_resume,
>  	}, {
>  		/* pin banks of gs101 pin-controller (GSACORE) */
>  		.pin_banks	= gs101_pin_gsacore,
> @@ -1477,29 +1477,29 @@ static const struct samsung_pin_ctrl gs101_pin_ctrl[] __initconst = {
>  		.pin_banks	= gs101_pin_peric0,
>  		.nr_banks	= ARRAY_SIZE(gs101_pin_peric0),
>  		.eint_gpio_init = exynos_eint_gpio_init,
> -		.suspend	= exynos_pinctrl_suspend,
> -		.resume		= exynos_pinctrl_resume,
> +		.suspend	= gs101_pinctrl_suspend,
> +		.resume		= gs101_pinctrl_resume,
>  	}, {
>  		/* pin banks of gs101 pin-controller (PERIC1) */
>  		.pin_banks	= gs101_pin_peric1,
>  		.nr_banks	= ARRAY_SIZE(gs101_pin_peric1),
>  		.eint_gpio_init = exynos_eint_gpio_init,
> -		.suspend	= exynos_pinctrl_suspend,
> -		.resume	= exynos_pinctrl_resume,
> +		.suspend	= gs101_pinctrl_suspend,
> +		.resume		= gs101_pinctrl_resume,
>  	}, {
>  		/* pin banks of gs101 pin-controller (HSI1) */
>  		.pin_banks	= gs101_pin_hsi1,
>  		.nr_banks	= ARRAY_SIZE(gs101_pin_hsi1),
>  		.eint_gpio_init = exynos_eint_gpio_init,
> -		.suspend	= exynos_pinctrl_suspend,
> -		.resume		= exynos_pinctrl_resume,
> +		.suspend	= gs101_pinctrl_suspend,
> +		.resume		= gs101_pinctrl_resume,
>  	}, {
>  		/* pin banks of gs101 pin-controller (HSI2) */
>  		.pin_banks	= gs101_pin_hsi2,
>  		.nr_banks	= ARRAY_SIZE(gs101_pin_hsi2),
>  		.eint_gpio_init = exynos_eint_gpio_init,
> -		.suspend	= exynos_pinctrl_suspend,
> -		.resume		= exynos_pinctrl_resume,
> +		.suspend	= gs101_pinctrl_suspend,
> +		.resume		= gs101_pinctrl_resume,
>  	},
>  };
>  
> diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c
> index d65a9fba0781..ddc7245ec2e5 100644
> --- a/drivers/pinctrl/samsung/pinctrl-exynos.c
> +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c
> @@ -801,6 +801,41 @@ void exynos_pinctrl_suspend(struct samsung_pin_bank *bank)
>  	}
>  }
>  
> +void gs101_pinctrl_suspend(struct samsung_pin_bank *bank)
> +{
> +	struct exynos_eint_gpio_save *save = bank->soc_priv;
> +	const void __iomem *regs = bank->eint_base;
> +
> +	exynos_set_wakeup(bank);

As for patch 2, would be good to have this if / else, to make it more
obvious that this is conditional, too.

> +
> +	if (bank->eint_type == EINT_TYPE_GPIO) {
> +		save->eint_con = readl(regs + EXYNOS_GPIO_ECON_OFFSET
> +				       + bank->eint_offset);
> +
> +		save->eint_fltcon0 = readl(regs + EXYNOS_GPIO_EFLTCON_OFFSET +
> +					   bank->eint_fltcon_offset);

If there's another version, maybe align style where the '+'
is placed (end of line vs start of line). It seems this file
generally uses + at start of line.

> +
> +		/* fltcon1 register only exists for pins 4-7 */
> +		if (bank->nr_pins > 4)
> +			save->eint_fltcon1 = readl(regs +
> +						EXYNOS_GPIO_EFLTCON_OFFSET +
> +						bank->eint_fltcon_offset + 4);
> +
> +		save->eint_mask = readl(regs + bank->irq_chip->eint_mask
> +					+ bank->eint_offset);
> +
> +		pr_debug("%s: save     con %#010x\n",
> +			 bank->name, save->eint_con);
> +		pr_debug("%s: save fltcon0 %#010x\n",
> +			 bank->name, save->eint_fltcon0);
> +		if (bank->nr_pins > 4)
> +			pr_debug("%s: save fltcon1 %#010x\n",
> +				 bank->name, save->eint_fltcon1);
> +		pr_debug("%s: save    mask %#010x\n",
> +			 bank->name, save->eint_mask);
> +	}
> +}
> +
>  void exynosautov920_pinctrl_suspend(struct samsung_pin_bank *bank)
>  {
>  	struct exynos_eint_gpio_save *save = bank->soc_priv;
> @@ -820,6 +855,42 @@ void exynosautov920_pinctrl_suspend(struct samsung_pin_bank *bank)
>  	}
>  }
>  
> +void gs101_pinctrl_resume(struct samsung_pin_bank *bank)
> +{
> +	struct exynos_eint_gpio_save *save = bank->soc_priv;
> +
> +	void __iomem *regs = bank->eint_base;
> +	void __iomem *eint_fltcfg0 = regs + EXYNOS_GPIO_EFLTCON_OFFSET
> +		     + bank->eint_fltcon_offset;
> +
> +	if (bank->eint_type == EINT_TYPE_GPIO) {
> +		pr_debug("%s:     con %#010x => %#010x\n", bank->name,
> +			 readl(regs + EXYNOS_GPIO_ECON_OFFSET
> +			       + bank->eint_offset), save->eint_con);
> +
> +		pr_debug("%s: fltcon0 %#010x => %#010x\n", bank->name,
> +			 readl(eint_fltcfg0), save->eint_fltcon0);
> +
> +		/* fltcon1 register only exists for pins 4-7 */
> +		if (bank->nr_pins > 4) {
> +			pr_debug("%s: fltcon1 %#010x => %#010x\n", bank->name,
> +				 readl(eint_fltcfg0 + 4), save->eint_fltcon1);
> +		}

If there's another version, braces are not needed here.

Cheers,
Andre'


> +		pr_debug("%s:    mask %#010x => %#010x\n", bank->name,
> +			 readl(regs + bank->irq_chip->eint_mask
> +			       + bank->eint_offset), save->eint_mask);
> +
> +		writel(save->eint_con, regs + EXYNOS_GPIO_ECON_OFFSET
> +		       + bank->eint_offset);
> +		writel(save->eint_fltcon0, eint_fltcfg0);
> +
> +		if (bank->nr_pins > 4)
> +			writel(save->eint_fltcon1, eint_fltcfg0 + 4);
> +		writel(save->eint_mask, regs + bank->irq_chip->eint_mask
> +		       + bank->eint_offset);
> +	}
> +}
> +
>  void exynos_pinctrl_resume(struct samsung_pin_bank *bank)
>  {
>  	struct exynos_eint_gpio_save *save = bank->soc_priv;
> diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.h b/drivers/pinctrl/samsung/pinctrl-exynos.h
> index 35c2bc4ea488..773f161a82a3 100644
> --- a/drivers/pinctrl/samsung/pinctrl-exynos.h
> +++ b/drivers/pinctrl/samsung/pinctrl-exynos.h
> @@ -225,6 +225,8 @@ void exynosautov920_pinctrl_resume(struct samsung_pin_bank *bank);
>  void exynosautov920_pinctrl_suspend(struct samsung_pin_bank *bank);
>  void exynos_pinctrl_suspend(struct samsung_pin_bank *bank);
>  void exynos_pinctrl_resume(struct samsung_pin_bank *bank);
> +void gs101_pinctrl_suspend(struct samsung_pin_bank *bank);
> +void gs101_pinctrl_resume(struct samsung_pin_bank *bank);
>  struct samsung_retention_ctrl *
>  exynos_retention_init(struct samsung_pinctrl_drv_data *drvdata,
>  		      const struct samsung_retention_data *data);
> 


  reply	other threads:[~2025-03-06 15:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-01 11:43 [PATCH v2 0/4] samsung: pinctrl: Add support for eint_fltcon_offset and filter selection on gs101 Peter Griffin
2025-03-01 11:43 ` [PATCH v2 1/4] pinctrl: samsung: add support for eint_fltcon_offset Peter Griffin
2025-03-06 11:24   ` André Draszik
2025-03-01 11:43 ` [PATCH v2 2/4] pinctrl: samsung: add dedicated SoC eint suspend/resume callbacks Peter Griffin
2025-03-06 11:57   ` André Draszik
2025-03-06 15:12     ` André Draszik
2025-03-06 20:47     ` Peter Griffin
2025-03-01 11:43 ` [PATCH v2 3/4] pinctrl: samsung: add gs101 specific " Peter Griffin
2025-03-06 15:12   ` André Draszik [this message]
2025-03-01 11:43 ` [PATCH v2 4/4] pinctrl: samsung: Add filter selection support for alive bank on gs101 Peter Griffin
2025-03-06 15:26   ` André Draszik

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=5fe34e1193a167c24c7af900f5b7cf85140d66e0.camel@linaro.org \
    --to=andre.draszik@linaro.org \
    --cc=alim.akhtar@samsung.com \
    --cc=jaewon02.kim@samsung.com \
    --cc=kernel-team@android.com \
    --cc=krzk@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=peter.griffin@linaro.org \
    --cc=s.nawrocki@samsung.com \
    --cc=semen.protsenko@linaro.org \
    --cc=stable@vger.kernel.org \
    --cc=tudor.ambarus@linaro.org \
    --cc=willmcvicker@google.com \
    /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).