Re: [PATCH 1/5] ARM: sa1100: add platform functions to handle PWER settings

2015-01-21 Thread Dmitry Eremin-Solenikov
Hello,

2015-01-21 13:05 GMT+03:00 Linus Walleij :
>
> On Thu, Jan 15, 2015 at 11:09 AM, Dmitry Eremin-Solenikov
>  wrote:
>
> > PWER settings logically belongs neither to GPIO nor to system IRQ code.
> > Add special functions to handle PWER (for GPIO and for system IRQs)
> > from platform code.
> >
> > Signed-off-by: Dmitry Eremin-Solenikov 
>
> > diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
> (...)
> > +int sa11x0_gpio_set_wake(unsigned int gpio, unsigned int on)
> (...)
> > +int sa11x0_sc_set_wake(unsigned int irq, unsigned int on)
>
> Why are these two functions not added to any .h file?
>
> Did you miss to commit something or are there compile
> warnings about this?

I thought quite a while about adding them to any header. In the end I ended
adding them to the irqchip header file. PWER handling is (a bit) related to IRQ
handling. The only other user of those functions would be a gpio (or pinctrl
if it ends that way) driver.

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/5] ARM: sa1100: add platform functions to handle PWER settings

2015-01-21 Thread Linus Walleij
On Thu, Jan 15, 2015 at 11:09 AM, Dmitry Eremin-Solenikov
 wrote:

> PWER settings logically belongs neither to GPIO nor to system IRQ code.
> Add special functions to handle PWER (for GPIO and for system IRQs)
> from platform code.
>
> Signed-off-by: Dmitry Eremin-Solenikov 

> diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
(...)
> +int sa11x0_gpio_set_wake(unsigned int gpio, unsigned int on)
(...)
> +int sa11x0_sc_set_wake(unsigned int irq, unsigned int on)

Why are these two functions not added to any .h file?

Did you miss to commit something or are there compile
warnings about this?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/5] ARM: sa1100: add platform functions to handle PWER settings

2015-01-21 Thread Linus Walleij
On Thu, Jan 15, 2015 at 11:09 AM, Dmitry Eremin-Solenikov
dbarysh...@gmail.com wrote:

 PWER settings logically belongs neither to GPIO nor to system IRQ code.
 Add special functions to handle PWER (for GPIO and for system IRQs)
 from platform code.

 Signed-off-by: Dmitry Eremin-Solenikov dbarysh...@gmail.com

 diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
(...)
 +int sa11x0_gpio_set_wake(unsigned int gpio, unsigned int on)
(...)
 +int sa11x0_sc_set_wake(unsigned int irq, unsigned int on)

Why are these two functions not added to any .h file?

Did you miss to commit something or are there compile
warnings about this?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/5] ARM: sa1100: add platform functions to handle PWER settings

2015-01-21 Thread Dmitry Eremin-Solenikov
Hello,

2015-01-21 13:05 GMT+03:00 Linus Walleij linus.wall...@linaro.org:

 On Thu, Jan 15, 2015 at 11:09 AM, Dmitry Eremin-Solenikov
 dbarysh...@gmail.com wrote:

  PWER settings logically belongs neither to GPIO nor to system IRQ code.
  Add special functions to handle PWER (for GPIO and for system IRQs)
  from platform code.
 
  Signed-off-by: Dmitry Eremin-Solenikov dbarysh...@gmail.com

  diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
 (...)
  +int sa11x0_gpio_set_wake(unsigned int gpio, unsigned int on)
 (...)
  +int sa11x0_sc_set_wake(unsigned int irq, unsigned int on)

 Why are these two functions not added to any .h file?

 Did you miss to commit something or are there compile
 warnings about this?

I thought quite a while about adding them to any header. In the end I ended
adding them to the irqchip header file. PWER handling is (a bit) related to IRQ
handling. The only other user of those functions would be a gpio (or pinctrl
if it ends that way) driver.

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/5] ARM: sa1100: add platform functions to handle PWER settings

2015-01-15 Thread Dmitry Eremin-Solenikov
PWER settings logically belongs neither to GPIO nor to system IRQ code.
Add special functions to handle PWER (for GPIO and for system IRQs)
from platform code.

Signed-off-by: Dmitry Eremin-Solenikov 
---
 arch/arm/mach-sa1100/generic.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 40e0d86..022e451 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -416,3 +416,24 @@ void sa1110_mb_enable(void)
local_irq_restore(flags);
 }
 
+int sa11x0_gpio_set_wake(unsigned int gpio, unsigned int on)
+{
+   if (on)
+   PWER |= BIT(gpio);
+   else
+   PWER &= ~BIT(gpio);
+
+   return 0;
+}
+
+int sa11x0_sc_set_wake(unsigned int irq, unsigned int on)
+{
+   if (BIT(irq) != IC_RTCAlrm)
+   return -EINVAL;
+
+   if (on)
+   PWER |= PWER_RTC;
+   else
+   PWER &= ~PWER_RTC;
+   return 0;
+}
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/5] ARM: sa1100: add platform functions to handle PWER settings

2015-01-15 Thread Dmitry Eremin-Solenikov
PWER settings logically belongs neither to GPIO nor to system IRQ code.
Add special functions to handle PWER (for GPIO and for system IRQs)
from platform code.

Signed-off-by: Dmitry Eremin-Solenikov dbarysh...@gmail.com
---
 arch/arm/mach-sa1100/generic.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 40e0d86..022e451 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -416,3 +416,24 @@ void sa1110_mb_enable(void)
local_irq_restore(flags);
 }
 
+int sa11x0_gpio_set_wake(unsigned int gpio, unsigned int on)
+{
+   if (on)
+   PWER |= BIT(gpio);
+   else
+   PWER = ~BIT(gpio);
+
+   return 0;
+}
+
+int sa11x0_sc_set_wake(unsigned int irq, unsigned int on)
+{
+   if (BIT(irq) != IC_RTCAlrm)
+   return -EINVAL;
+
+   if (on)
+   PWER |= PWER_RTC;
+   else
+   PWER = ~PWER_RTC;
+   return 0;
+}
-- 
2.1.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/