All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] pinctrl: pinctrl-single: Add functions to save and restore pinctrl contex
@ 2018-05-16  5:40 ` Keerthy
  0 siblings, 0 replies; 10+ messages in thread
From: Keerthy @ 2018-05-16  5:40 UTC (permalink / raw)
  To: tony
  Cc: j-keerthy, linus.walleij, t-kristo, linux-gpio, linux-omap,
	linux-arm-kernel

The series adds save/restore functions to pinctrl-single driver.
This is specially needed in case of RTC only mode with
DDR in self refresh where the register contents are lost.

Tested on am437x-gp-evm.

Keerthy (2):
  arm: mach-omap2: pdata-quirks: Add a quirk function to convey off mode
    state
  pinctrl: pinctrl-single: Add functions to save and restore pinctrl
    context

 arch/arm/mach-omap2/pdata-quirks.c           |  6 ++
 drivers/pinctrl/pinctrl-single.c             | 95 +++++++++++++++++++++++++++-
 include/linux/platform_data/pinctrl-single.h |  1 +
 3 files changed, 101 insertions(+), 1 deletion(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 0/2] pinctrl: pinctrl-single: Add functions to save and restore pinctrl contex
@ 2018-05-16  5:40 ` Keerthy
  0 siblings, 0 replies; 10+ messages in thread
From: Keerthy @ 2018-05-16  5:40 UTC (permalink / raw)
  To: linux-arm-kernel

The series adds save/restore functions to pinctrl-single driver.
This is specially needed in case of RTC only mode with
DDR in self refresh where the register contents are lost.

Tested on am437x-gp-evm.

Keerthy (2):
  arm: mach-omap2: pdata-quirks: Add a quirk function to convey off mode
    state
  pinctrl: pinctrl-single: Add functions to save and restore pinctrl
    context

 arch/arm/mach-omap2/pdata-quirks.c           |  6 ++
 drivers/pinctrl/pinctrl-single.c             | 95 +++++++++++++++++++++++++++-
 include/linux/platform_data/pinctrl-single.h |  1 +
 3 files changed, 101 insertions(+), 1 deletion(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] arm: mach-omap2: pdata-quirks: Add a quirk function to convey off mode state
  2018-05-16  5:40 ` Keerthy
@ 2018-05-16  5:40   ` Keerthy
  -1 siblings, 0 replies; 10+ messages in thread
From: Keerthy @ 2018-05-16  5:40 UTC (permalink / raw)
  To: tony
  Cc: j-keerthy, linus.walleij, t-kristo, linux-gpio, linux-omap,
	linux-arm-kernel

Add a quirk function to convey off mode state. This can be used
to perform additional save/restore during off mode.

Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 arch/arm/mach-omap2/pdata-quirks.c           | 6 ++++++
 include/linux/platform_data/pinctrl-single.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index 7f02743..f2e16e3 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -35,6 +35,7 @@
 #include "omap-secure.h"
 #include "soc.h"
 #include "hsmmc.h"
+#include "pm.h"
 
 static struct omap_hsmmc_platform_data __maybe_unused mmc_pdata[2];
 
@@ -489,12 +490,17 @@ static int ti_sysc_shutdown_module(struct device *dev,
 	.shutdown_module = ti_sysc_shutdown_module,
 };
 
+int context_may_be_lost(void)
+{
+	return enable_off_mode;
+}
 static struct pcs_pdata pcs_pdata;
 
 void omap_pcs_legacy_init(int irq, void (*rearm)(void))
 {
 	pcs_pdata.irq = irq;
 	pcs_pdata.rearm = rearm;
+	pcs_pdata.context_may_be_lost = context_may_be_lost;
 }
 
 /*
diff --git a/include/linux/platform_data/pinctrl-single.h b/include/linux/platform_data/pinctrl-single.h
index 1cf36fd..f07c1f2 100644
--- a/include/linux/platform_data/pinctrl-single.h
+++ b/include/linux/platform_data/pinctrl-single.h
@@ -10,4 +10,5 @@
 struct pcs_pdata {
 	int irq;
 	void (*rearm)(void);
+	int (*context_may_be_lost)(void);
 };
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 1/2] arm: mach-omap2: pdata-quirks: Add a quirk function to convey off mode state
@ 2018-05-16  5:40   ` Keerthy
  0 siblings, 0 replies; 10+ messages in thread
From: Keerthy @ 2018-05-16  5:40 UTC (permalink / raw)
  To: linux-arm-kernel

Add a quirk function to convey off mode state. This can be used
to perform additional save/restore during off mode.

Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 arch/arm/mach-omap2/pdata-quirks.c           | 6 ++++++
 include/linux/platform_data/pinctrl-single.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index 7f02743..f2e16e3 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -35,6 +35,7 @@
 #include "omap-secure.h"
 #include "soc.h"
 #include "hsmmc.h"
+#include "pm.h"
 
 static struct omap_hsmmc_platform_data __maybe_unused mmc_pdata[2];
 
@@ -489,12 +490,17 @@ static int ti_sysc_shutdown_module(struct device *dev,
 	.shutdown_module = ti_sysc_shutdown_module,
 };
 
+int context_may_be_lost(void)
+{
+	return enable_off_mode;
+}
 static struct pcs_pdata pcs_pdata;
 
 void omap_pcs_legacy_init(int irq, void (*rearm)(void))
 {
 	pcs_pdata.irq = irq;
 	pcs_pdata.rearm = rearm;
+	pcs_pdata.context_may_be_lost = context_may_be_lost;
 }
 
 /*
diff --git a/include/linux/platform_data/pinctrl-single.h b/include/linux/platform_data/pinctrl-single.h
index 1cf36fd..f07c1f2 100644
--- a/include/linux/platform_data/pinctrl-single.h
+++ b/include/linux/platform_data/pinctrl-single.h
@@ -10,4 +10,5 @@
 struct pcs_pdata {
 	int irq;
 	void (*rearm)(void);
+	int (*context_may_be_lost)(void);
 };
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] pinctrl: pinctrl-single: Add functions to save and restore pinctrl context
  2018-05-16  5:40 ` Keerthy
@ 2018-05-16  5:40   ` Keerthy
  -1 siblings, 0 replies; 10+ messages in thread
From: Keerthy @ 2018-05-16  5:40 UTC (permalink / raw)
  To: tony
  Cc: j-keerthy, linus.walleij, t-kristo, linux-gpio, linux-omap,
	linux-arm-kernel

This adds a pair of context save/restore functions to save/restore the
state of a set of pinctrl registers. This simplifies some of the AM33XX
PM code as some of the pinctrl registers are lost when the per power
domain loses power. The pincrtl code can perform the necessary
save/restore.

This will also be necessary for hibernation and RTC only sleep, as all
pinctrl registers all lost.

Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 drivers/pinctrl/pinctrl-single.c | 95 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 94 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index a7c5eb3..3062ebb 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -16,6 +16,7 @@
 #include <linux/err.h>
 #include <linux/list.h>
 #include <linux/interrupt.h>
+#include <linux/cpu_pm.h>
 
 #include <linux/irqchip/chained_irq.h>
 
@@ -144,6 +145,7 @@ struct pcs_soc_data {
  * struct pcs_device - pinctrl device instance
  * @res:	resources
  * @base:	virtual address of the controller
+ * @saved_vals: saved values for the controller
  * @size:	size of the ioremapped area
  * @dev:	device entry
  * @np:		device tree node
@@ -172,11 +174,13 @@ struct pcs_soc_data {
 struct pcs_device {
 	struct resource *res;
 	void __iomem *base;
+	void *saved_vals;
 	unsigned size;
 	struct device *dev;
 	struct device_node *np;
 	struct pinctrl_dev *pctl;
 	unsigned flags;
+#define PCS_CONTEXT_LOSS_OFF	(1 << 3)
 #define PCS_QUIRK_SHARED_IRQ	(1 << 2)
 #define PCS_FEAT_IRQ		(1 << 1)
 #define PCS_FEAT_PINCONF	(1 << 0)
@@ -195,6 +199,7 @@ struct pcs_device {
 	struct list_head gpiofuncs;
 	struct list_head irqs;
 	struct irq_chip chip;
+	struct notifier_block nb;
 	struct irq_domain *domain;
 	struct pinctrl_desc desc;
 	unsigned (*read)(void __iomem *reg);
@@ -1649,6 +1654,86 @@ static int pcs_quirk_missing_pinctrl_cells(struct pcs_device *pcs,
 	return error;
 }
 
+static int pcs_save_context(struct pcs_device *pcs)
+{
+	int i, mux_bytes;
+	u64 *regsl;
+	u32 *regsw;
+	u16 *regshw;
+
+	mux_bytes = pcs->width / BITS_PER_BYTE;
+
+	if (!pcs->saved_vals)
+		pcs->saved_vals = devm_kzalloc(pcs->dev, pcs->size, GFP_ATOMIC);
+
+	switch (pcs->width) {
+	case 64:
+		regsl = (u64 *)pcs->saved_vals;
+		for (i = 0; i < pcs->size / mux_bytes; i++)
+			regsl[i] = pcs->read(pcs->base + i * mux_bytes);
+		break;
+	case 32:
+		regsw = (u32 *)pcs->saved_vals;
+		for (i = 0; i < pcs->size / mux_bytes; i++)
+			regsw[i] = pcs->read(pcs->base + i * mux_bytes);
+		break;
+	case 16:
+		regshw = (u16 *)pcs->saved_vals;
+		for (i = 0; i < pcs->size / mux_bytes; i++)
+			regshw[i] = pcs->read(pcs->base + i * mux_bytes);
+		break;
+	}
+
+	return 0;
+}
+
+static void pcs_restore_context(struct pcs_device *pcs)
+{
+	int i, mux_bytes;
+	u64 *regsl;
+	u32 *regsw;
+	u16 *regshw;
+
+	mux_bytes = pcs->width / BITS_PER_BYTE;
+
+	switch (pcs->width) {
+	case 64:
+		regsl = (u64 *)pcs->saved_vals;
+		for (i = 0; i < pcs->size / mux_bytes; i++)
+			pcs->write(regsl[i], pcs->base + i * mux_bytes);
+		break;
+	case 32:
+		regsw = (u32 *)pcs->saved_vals;
+		for (i = 0; i < pcs->size / mux_bytes; i++)
+			pcs->write(regsw[i], pcs->base + i * mux_bytes);
+		break;
+	case 16:
+		regshw = (u16 *)pcs->saved_vals;
+		for (i = 0; i < pcs->size / mux_bytes; i++)
+			pcs->write(regshw[i], pcs->base + i * mux_bytes);
+		break;
+	}
+}
+
+static int cpu_notifier(struct notifier_block *nb, unsigned long cmd, void *v)
+{
+	struct pcs_device *pcs = container_of(nb, struct pcs_device, nb);
+	struct pcs_pdata *pdata = dev_get_platdata(pcs->dev);
+
+	switch (cmd) {
+	case CPU_CLUSTER_PM_ENTER:
+		if (pdata->context_may_be_lost())
+			pcs_save_context(pcs);
+		break;
+	case CPU_CLUSTER_PM_EXIT:
+		if (pdata->context_may_be_lost())
+			pcs_restore_context(pcs);
+		break;
+	}
+
+	return NOTIFY_OK;
+}
+
 static int pcs_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
@@ -1792,6 +1877,11 @@ static int pcs_probe(struct platform_device *pdev)
 
 	dev_info(pcs->dev, "%i pins, size %u\n", pcs->desc.npins, pcs->size);
 
+	if (soc->flags & PCS_CONTEXT_LOSS_OFF) {
+		pcs->nb.notifier_call = cpu_notifier;
+		cpu_pm_register_notifier(&pcs->nb);
+	}
+
 	return pinctrl_enable(pcs->pctl);
 
 free:
@@ -1807,6 +1897,9 @@ static int pcs_remove(struct platform_device *pdev)
 	if (!pcs)
 		return 0;
 
+	if (pcs->flags & PCS_CONTEXT_LOSS_OFF)
+		cpu_pm_unregister_notifier(&pcs->nb);
+
 	pcs_free_resources(pcs);
 
 	return 0;
@@ -1824,7 +1917,7 @@ static int pcs_remove(struct platform_device *pdev)
 };
 
 static const struct pcs_soc_data pinctrl_single_am437x = {
-	.flags = PCS_QUIRK_SHARED_IRQ,
+	.flags = PCS_QUIRK_SHARED_IRQ | PCS_CONTEXT_LOSS_OFF,
 	.irq_enable_mask = (1 << 29),   /* OMAP_WAKEUP_EN */
 	.irq_status_mask = (1 << 30),   /* OMAP_WAKEUP_EVENT */
 };
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] pinctrl: pinctrl-single: Add functions to save and restore pinctrl context
@ 2018-05-16  5:40   ` Keerthy
  0 siblings, 0 replies; 10+ messages in thread
From: Keerthy @ 2018-05-16  5:40 UTC (permalink / raw)
  To: linux-arm-kernel

This adds a pair of context save/restore functions to save/restore the
state of a set of pinctrl registers. This simplifies some of the AM33XX
PM code as some of the pinctrl registers are lost when the per power
domain loses power. The pincrtl code can perform the necessary
save/restore.

This will also be necessary for hibernation and RTC only sleep, as all
pinctrl registers all lost.

Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 drivers/pinctrl/pinctrl-single.c | 95 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 94 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index a7c5eb3..3062ebb 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -16,6 +16,7 @@
 #include <linux/err.h>
 #include <linux/list.h>
 #include <linux/interrupt.h>
+#include <linux/cpu_pm.h>
 
 #include <linux/irqchip/chained_irq.h>
 
@@ -144,6 +145,7 @@ struct pcs_soc_data {
  * struct pcs_device - pinctrl device instance
  * @res:	resources
  * @base:	virtual address of the controller
+ * @saved_vals: saved values for the controller
  * @size:	size of the ioremapped area
  * @dev:	device entry
  * @np:		device tree node
@@ -172,11 +174,13 @@ struct pcs_soc_data {
 struct pcs_device {
 	struct resource *res;
 	void __iomem *base;
+	void *saved_vals;
 	unsigned size;
 	struct device *dev;
 	struct device_node *np;
 	struct pinctrl_dev *pctl;
 	unsigned flags;
+#define PCS_CONTEXT_LOSS_OFF	(1 << 3)
 #define PCS_QUIRK_SHARED_IRQ	(1 << 2)
 #define PCS_FEAT_IRQ		(1 << 1)
 #define PCS_FEAT_PINCONF	(1 << 0)
@@ -195,6 +199,7 @@ struct pcs_device {
 	struct list_head gpiofuncs;
 	struct list_head irqs;
 	struct irq_chip chip;
+	struct notifier_block nb;
 	struct irq_domain *domain;
 	struct pinctrl_desc desc;
 	unsigned (*read)(void __iomem *reg);
@@ -1649,6 +1654,86 @@ static int pcs_quirk_missing_pinctrl_cells(struct pcs_device *pcs,
 	return error;
 }
 
+static int pcs_save_context(struct pcs_device *pcs)
+{
+	int i, mux_bytes;
+	u64 *regsl;
+	u32 *regsw;
+	u16 *regshw;
+
+	mux_bytes = pcs->width / BITS_PER_BYTE;
+
+	if (!pcs->saved_vals)
+		pcs->saved_vals = devm_kzalloc(pcs->dev, pcs->size, GFP_ATOMIC);
+
+	switch (pcs->width) {
+	case 64:
+		regsl = (u64 *)pcs->saved_vals;
+		for (i = 0; i < pcs->size / mux_bytes; i++)
+			regsl[i] = pcs->read(pcs->base + i * mux_bytes);
+		break;
+	case 32:
+		regsw = (u32 *)pcs->saved_vals;
+		for (i = 0; i < pcs->size / mux_bytes; i++)
+			regsw[i] = pcs->read(pcs->base + i * mux_bytes);
+		break;
+	case 16:
+		regshw = (u16 *)pcs->saved_vals;
+		for (i = 0; i < pcs->size / mux_bytes; i++)
+			regshw[i] = pcs->read(pcs->base + i * mux_bytes);
+		break;
+	}
+
+	return 0;
+}
+
+static void pcs_restore_context(struct pcs_device *pcs)
+{
+	int i, mux_bytes;
+	u64 *regsl;
+	u32 *regsw;
+	u16 *regshw;
+
+	mux_bytes = pcs->width / BITS_PER_BYTE;
+
+	switch (pcs->width) {
+	case 64:
+		regsl = (u64 *)pcs->saved_vals;
+		for (i = 0; i < pcs->size / mux_bytes; i++)
+			pcs->write(regsl[i], pcs->base + i * mux_bytes);
+		break;
+	case 32:
+		regsw = (u32 *)pcs->saved_vals;
+		for (i = 0; i < pcs->size / mux_bytes; i++)
+			pcs->write(regsw[i], pcs->base + i * mux_bytes);
+		break;
+	case 16:
+		regshw = (u16 *)pcs->saved_vals;
+		for (i = 0; i < pcs->size / mux_bytes; i++)
+			pcs->write(regshw[i], pcs->base + i * mux_bytes);
+		break;
+	}
+}
+
+static int cpu_notifier(struct notifier_block *nb, unsigned long cmd, void *v)
+{
+	struct pcs_device *pcs = container_of(nb, struct pcs_device, nb);
+	struct pcs_pdata *pdata = dev_get_platdata(pcs->dev);
+
+	switch (cmd) {
+	case CPU_CLUSTER_PM_ENTER:
+		if (pdata->context_may_be_lost())
+			pcs_save_context(pcs);
+		break;
+	case CPU_CLUSTER_PM_EXIT:
+		if (pdata->context_may_be_lost())
+			pcs_restore_context(pcs);
+		break;
+	}
+
+	return NOTIFY_OK;
+}
+
 static int pcs_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
@@ -1792,6 +1877,11 @@ static int pcs_probe(struct platform_device *pdev)
 
 	dev_info(pcs->dev, "%i pins, size %u\n", pcs->desc.npins, pcs->size);
 
+	if (soc->flags & PCS_CONTEXT_LOSS_OFF) {
+		pcs->nb.notifier_call = cpu_notifier;
+		cpu_pm_register_notifier(&pcs->nb);
+	}
+
 	return pinctrl_enable(pcs->pctl);
 
 free:
@@ -1807,6 +1897,9 @@ static int pcs_remove(struct platform_device *pdev)
 	if (!pcs)
 		return 0;
 
+	if (pcs->flags & PCS_CONTEXT_LOSS_OFF)
+		cpu_pm_unregister_notifier(&pcs->nb);
+
 	pcs_free_resources(pcs);
 
 	return 0;
@@ -1824,7 +1917,7 @@ static int pcs_remove(struct platform_device *pdev)
 };
 
 static const struct pcs_soc_data pinctrl_single_am437x = {
-	.flags = PCS_QUIRK_SHARED_IRQ,
+	.flags = PCS_QUIRK_SHARED_IRQ | PCS_CONTEXT_LOSS_OFF,
 	.irq_enable_mask = (1 << 29),   /* OMAP_WAKEUP_EN */
 	.irq_status_mask = (1 << 30),   /* OMAP_WAKEUP_EVENT */
 };
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] arm: mach-omap2: pdata-quirks: Add a quirk function to convey off mode state
  2018-05-16  5:40   ` Keerthy
@ 2018-05-16 14:36     ` Tony Lindgren
  -1 siblings, 0 replies; 10+ messages in thread
From: Tony Lindgren @ 2018-05-16 14:36 UTC (permalink / raw)
  To: Keerthy; +Cc: t-kristo, linux-gpio, linus.walleij, linux-omap, linux-arm-kernel

* Keerthy <j-keerthy@ti.com> [180516 05:42]:
> --- a/arch/arm/mach-omap2/pdata-quirks.c
> +++ b/arch/arm/mach-omap2/pdata-quirks.c
> @@ -35,6 +35,7 @@
>  #include "omap-secure.h"
>  #include "soc.h"
>  #include "hsmmc.h"
> +#include "pm.h"
>  
>  static struct omap_hsmmc_platform_data __maybe_unused mmc_pdata[2];
>  
> @@ -489,12 +490,17 @@ static int ti_sysc_shutdown_module(struct device *dev,
>  	.shutdown_module = ti_sysc_shutdown_module,
>  };
>  
> +int context_may_be_lost(void)
> +{
> +	return enable_off_mode;
> +}
>  static struct pcs_pdata pcs_pdata;

Hmm seems that this could be generic so also gpio-omap can use
this to remove omap2_gpio_prepare_for_idle() and
omap2_gpio_resume_after_idle(). So how about just make it:

int context_may_be_lost(struct device *dev);

And then we can easily add more logic to it as needed for
gpio-omap in addition to enable_off_mode.

Regards,

Tony

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] arm: mach-omap2: pdata-quirks: Add a quirk function to convey off mode state
@ 2018-05-16 14:36     ` Tony Lindgren
  0 siblings, 0 replies; 10+ messages in thread
From: Tony Lindgren @ 2018-05-16 14:36 UTC (permalink / raw)
  To: linux-arm-kernel

* Keerthy <j-keerthy@ti.com> [180516 05:42]:
> --- a/arch/arm/mach-omap2/pdata-quirks.c
> +++ b/arch/arm/mach-omap2/pdata-quirks.c
> @@ -35,6 +35,7 @@
>  #include "omap-secure.h"
>  #include "soc.h"
>  #include "hsmmc.h"
> +#include "pm.h"
>  
>  static struct omap_hsmmc_platform_data __maybe_unused mmc_pdata[2];
>  
> @@ -489,12 +490,17 @@ static int ti_sysc_shutdown_module(struct device *dev,
>  	.shutdown_module = ti_sysc_shutdown_module,
>  };
>  
> +int context_may_be_lost(void)
> +{
> +	return enable_off_mode;
> +}
>  static struct pcs_pdata pcs_pdata;

Hmm seems that this could be generic so also gpio-omap can use
this to remove omap2_gpio_prepare_for_idle() and
omap2_gpio_resume_after_idle(). So how about just make it:

int context_may_be_lost(struct device *dev);

And then we can easily add more logic to it as needed for
gpio-omap in addition to enable_off_mode.

Regards,

Tony

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] pinctrl: pinctrl-single: Add functions to save and restore pinctrl context
  2018-05-16  5:40   ` Keerthy
@ 2018-05-16 15:22     ` Tony Lindgren
  -1 siblings, 0 replies; 10+ messages in thread
From: Tony Lindgren @ 2018-05-16 15:22 UTC (permalink / raw)
  To: Keerthy; +Cc: t-kristo, linux-gpio, linus.walleij, linux-omap, linux-arm-kernel

* Keerthy <j-keerthy@ti.com> [180516 05:43]:
> This adds a pair of context save/restore functions to save/restore the
> state of a set of pinctrl registers. This simplifies some of the AM33XX
> PM code as some of the pinctrl registers are lost when the per power
> domain loses power. The pincrtl code can perform the necessary
> save/restore.
> 
> This will also be necessary for hibernation and RTC only sleep, as all
> pinctrl registers all lost.

I think for now you can get away with just adding suspend and resume
calls where suspend calls pdata->context_may_be_lost() and saves
context as needed. And you do want to still call context_may_be_lost()
as Android configured kernel does suspend and resume constantly..

Then the cpu_notifier() can be added later on as needed once the
cpuidle patches are ready.

Regards,

Tony

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/2] pinctrl: pinctrl-single: Add functions to save and restore pinctrl context
@ 2018-05-16 15:22     ` Tony Lindgren
  0 siblings, 0 replies; 10+ messages in thread
From: Tony Lindgren @ 2018-05-16 15:22 UTC (permalink / raw)
  To: linux-arm-kernel

* Keerthy <j-keerthy@ti.com> [180516 05:43]:
> This adds a pair of context save/restore functions to save/restore the
> state of a set of pinctrl registers. This simplifies some of the AM33XX
> PM code as some of the pinctrl registers are lost when the per power
> domain loses power. The pincrtl code can perform the necessary
> save/restore.
> 
> This will also be necessary for hibernation and RTC only sleep, as all
> pinctrl registers all lost.

I think for now you can get away with just adding suspend and resume
calls where suspend calls pdata->context_may_be_lost() and saves
context as needed. And you do want to still call context_may_be_lost()
as Android configured kernel does suspend and resume constantly..

Then the cpu_notifier() can be added later on as needed once the
cpuidle patches are ready.

Regards,

Tony

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-05-16 15:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-16  5:40 [PATCH 0/2] pinctrl: pinctrl-single: Add functions to save and restore pinctrl contex Keerthy
2018-05-16  5:40 ` Keerthy
2018-05-16  5:40 ` [PATCH 1/2] arm: mach-omap2: pdata-quirks: Add a quirk function to convey off mode state Keerthy
2018-05-16  5:40   ` Keerthy
2018-05-16 14:36   ` Tony Lindgren
2018-05-16 14:36     ` Tony Lindgren
2018-05-16  5:40 ` [PATCH 2/2] pinctrl: pinctrl-single: Add functions to save and restore pinctrl context Keerthy
2018-05-16  5:40   ` Keerthy
2018-05-16 15:22   ` Tony Lindgren
2018-05-16 15:22     ` Tony Lindgren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.