diff mbox series

[2/3] gpio: sprd: In the sleep state, the eic dbnc clk must be forced open

Message ID 20230808033130.2226-1-Wenhua.Lin@unisoc.com
State New
Headers show
Series [1/3] gpio: sprd: Modify the calculation method of eic number | expand

Commit Message

Wenhua Lin Aug. 8, 2023, 3:31 a.m. UTC
In the sleep state, Eic dbnc has no clock and the clk enable
of dbnc needs to be forced open, so that eic can wake up normally.

Signed-off-by: Wenhua Lin <Wenhua.Lin@unisoc.com>
---
 drivers/gpio/gpio-eic-sprd.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Andy Shevchenko Aug. 8, 2023, 1:23 p.m. UTC | #1
On Tue, Aug 08, 2023 at 05:36:05PM +0800, Chunyan Zhang wrote:
> On Tue, 8 Aug 2023 at 11:32, Wenhua Lin <Wenhua.Lin@unisoc.com> wrote:
> >
> > In the sleep state, Eic dbnc has no clock and the clk enable
> 
> Does "dbnc" mean "debounce"? I suggest not using abbreviation here.

Also +1 here.

> > of dbnc needs to be forced open, so that eic can wake up normally.
Baolin Wang Aug. 9, 2023, 1:29 a.m. UTC | #2
On 8/8/2023 11:31 AM, Wenhua Lin wrote:
> In the sleep state, Eic dbnc has no clock and the clk enable
> of dbnc needs to be forced open, so that eic can wake up normally.

Sounds reasonable to me. Should add a Fixes tag if need to backport for 
stable kernel?

> Signed-off-by: Wenhua Lin <Wenhua.Lin@unisoc.com>
> ---
>   drivers/gpio/gpio-eic-sprd.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c
> index 0d85d9e80848..c506cfd6df8e 100644
> --- a/drivers/gpio/gpio-eic-sprd.c
> +++ b/drivers/gpio/gpio-eic-sprd.c
> @@ -23,6 +23,7 @@
>   #define SPRD_EIC_DBNC_IC		0x24
>   #define SPRD_EIC_DBNC_TRIG		0x28
>   #define SPRD_EIC_DBNC_CTRL0		0x40
> +#define SPRD_EIC_DBNC_FORCE_CLK		0x8000
>   
>   #define SPRD_EIC_LATCH_INTEN		0x0
>   #define SPRD_EIC_LATCH_INTRAW		0x4
> @@ -213,6 +214,7 @@ static int sprd_eic_set_debounce(struct gpio_chip *chip, unsigned int offset,
>   	u32 value = readl_relaxed(base + reg) & ~SPRD_EIC_DBNC_MASK;
>   
>   	value |= (debounce / 1000) & SPRD_EIC_DBNC_MASK;
> +	value |= SPRD_EIC_DBNC_FORCE_CLK;
>   	writel_relaxed(value, base + reg);
>   
>   	return 0;
wenhua lin Aug. 10, 2023, 7:03 a.m. UTC | #3
On Tue, Aug 8, 2023 at 9:23 PM Andy Shevchenko <andy@kernel.org> wrote:
>
> On Tue, Aug 08, 2023 at 11:31:30AM +0800, Wenhua Lin wrote:
> > In the sleep state, Eic dbnc has no clock and the clk enable
>
> Comma is not needed here.

Hi Andy:
We will make changes in patch v2.

Thanks
Wernhua.Lin

>
> > of dbnc needs to be forced open, so that eic can wake up normally.
>
> ...
>
> > +#define SPRD_EIC_DBNC_FORCE_CLK              0x8000
>
> BIT(15) ?

Hi Andy:
Yes, The bit15 is clock of dbnc forced open

Thanks
Wernhua.Lin

>
> --
> With Best Regards,
> Andy Shevchenko
>
>
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c
index 0d85d9e80848..c506cfd6df8e 100644
--- a/drivers/gpio/gpio-eic-sprd.c
+++ b/drivers/gpio/gpio-eic-sprd.c
@@ -23,6 +23,7 @@ 
 #define SPRD_EIC_DBNC_IC		0x24
 #define SPRD_EIC_DBNC_TRIG		0x28
 #define SPRD_EIC_DBNC_CTRL0		0x40
+#define SPRD_EIC_DBNC_FORCE_CLK		0x8000
 
 #define SPRD_EIC_LATCH_INTEN		0x0
 #define SPRD_EIC_LATCH_INTRAW		0x4
@@ -213,6 +214,7 @@  static int sprd_eic_set_debounce(struct gpio_chip *chip, unsigned int offset,
 	u32 value = readl_relaxed(base + reg) & ~SPRD_EIC_DBNC_MASK;
 
 	value |= (debounce / 1000) & SPRD_EIC_DBNC_MASK;
+	value |= SPRD_EIC_DBNC_FORCE_CLK;
 	writel_relaxed(value, base + reg);
 
 	return 0;