diff mbox series

[v2,2/2] mfd: atmel-flexcom: use resume_noirq

Message ID 20211028135138.3481166-3-claudiu.beznea@microchip.com (mailing list archive)
State New, archived
Headers show
Series mfd: atmel-flexcom: add a fix and code cosmetics | expand

Commit Message

Claudiu Beznea Oct. 28, 2021, 1:51 p.m. UTC
Flexcom IP embeds 3 other IPs: usart, i2c, spi and selects the operation
mode (usart, i2c, spi) via mode register (FLEX_MR). On i2c bus there might
be connected critical devices (like PMIC) which on suspend/resume should
be suspended/resumed at the end/beginning. i2c uses
.suspend_noirq/.resume_noirq for this kind of purposes. Align flexcom
to use .resume_noirq as it should be resumed before the embedded IPs.
Otherwise the embedded devices might behave badly.

Fixes: 7fdec11015c3 ("atmel_flexcom: Support resuming after a chip reset")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Tested-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
---
 drivers/mfd/atmel-flexcom.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Lee Jones Nov. 24, 2021, 3:36 p.m. UTC | #1
On Thu, 28 Oct 2021, Claudiu Beznea wrote:

> Flexcom IP embeds 3 other IPs: usart, i2c, spi and selects the operation
> mode (usart, i2c, spi) via mode register (FLEX_MR). On i2c bus there might
> be connected critical devices (like PMIC) which on suspend/resume should
> be suspended/resumed at the end/beginning. i2c uses
> .suspend_noirq/.resume_noirq for this kind of purposes. Align flexcom
> to use .resume_noirq as it should be resumed before the embedded IPs.
> Otherwise the embedded devices might behave badly.
> 
> Fixes: 7fdec11015c3 ("atmel_flexcom: Support resuming after a chip reset")
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> Tested-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> ---
>  drivers/mfd/atmel-flexcom.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Applied, thanks.
Lee Jones Jan. 10, 2022, 3:38 p.m. UTC | #2
On Thu, 28 Oct 2021, Claudiu Beznea wrote:

> Flexcom IP embeds 3 other IPs: usart, i2c, spi and selects the operation
> mode (usart, i2c, spi) via mode register (FLEX_MR). On i2c bus there might
> be connected critical devices (like PMIC) which on suspend/resume should
> be suspended/resumed at the end/beginning. i2c uses
> .suspend_noirq/.resume_noirq for this kind of purposes. Align flexcom
> to use .resume_noirq as it should be resumed before the embedded IPs.
> Otherwise the embedded devices might behave badly.
> 
> Fixes: 7fdec11015c3 ("atmel_flexcom: Support resuming after a chip reset")
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> Tested-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> ---
>  drivers/mfd/atmel-flexcom.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mfd/atmel-flexcom.c b/drivers/mfd/atmel-flexcom.c
> index 962f66dc8813..559eb4d352b6 100644
> --- a/drivers/mfd/atmel-flexcom.c
> +++ b/drivers/mfd/atmel-flexcom.c
> @@ -87,7 +87,7 @@ static const struct of_device_id atmel_flexcom_of_match[] = {
>  };
>  MODULE_DEVICE_TABLE(of, atmel_flexcom_of_match);
>  
> -static int __maybe_unused atmel_flexcom_resume(struct device *dev)
> +static int __maybe_unused atmel_flexcom_resume_noirq(struct device *dev)
>  {
>  	struct atmel_flexcom *ddata = dev_get_drvdata(dev);
>  	int err;
> @@ -105,8 +105,9 @@ static int __maybe_unused atmel_flexcom_resume(struct device *dev)
>  	return 0;
>  }
>  
> -static SIMPLE_DEV_PM_OPS(atmel_flexcom_pm_ops, NULL,
> -			 atmel_flexcom_resume);
> +static const struct dev_pm_ops atmel_flexcom_pm_ops = {
> +	.resume_noirq = atmel_flexcom_resume_noirq,

Doesn't this mean you can remove __maybe_unused?

> +};
>  
>  static struct platform_driver atmel_flexcom_driver = {
>  	.probe	= atmel_flexcom_probe,
diff mbox series

Patch

diff --git a/drivers/mfd/atmel-flexcom.c b/drivers/mfd/atmel-flexcom.c
index 962f66dc8813..559eb4d352b6 100644
--- a/drivers/mfd/atmel-flexcom.c
+++ b/drivers/mfd/atmel-flexcom.c
@@ -87,7 +87,7 @@  static const struct of_device_id atmel_flexcom_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, atmel_flexcom_of_match);
 
-static int __maybe_unused atmel_flexcom_resume(struct device *dev)
+static int __maybe_unused atmel_flexcom_resume_noirq(struct device *dev)
 {
 	struct atmel_flexcom *ddata = dev_get_drvdata(dev);
 	int err;
@@ -105,8 +105,9 @@  static int __maybe_unused atmel_flexcom_resume(struct device *dev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(atmel_flexcom_pm_ops, NULL,
-			 atmel_flexcom_resume);
+static const struct dev_pm_ops atmel_flexcom_pm_ops = {
+	.resume_noirq = atmel_flexcom_resume_noirq,
+};
 
 static struct platform_driver atmel_flexcom_driver = {
 	.probe	= atmel_flexcom_probe,