Skip to content

Commit

Permalink
ARM: 8361/1: sa1100: add platform functions to handle PWER settings
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Russell King <[email protected]>
  • Loading branch information
lumag authored and Russell King committed May 18, 2015
1 parent b787f68 commit 982b465
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
24 changes: 24 additions & 0 deletions arch/arm/mach-sa1100/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#include <video/sa1100fb.h>

#include <soc/sa1100/pwer.h>

#include <asm/div64.h>
#include <asm/mach/map.h>
#include <asm/mach/flash.h>
Expand Down Expand Up @@ -416,3 +418,25 @@ 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;
}
15 changes: 15 additions & 0 deletions include/soc/sa1100/pwer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef SOC_SA1100_PWER_H
#define SOC_SA1100_PWER_H

/*
* Copyright (C) 2015, Dmitry Eremin-Solenikov
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

int sa11x0_gpio_set_wake(unsigned int gpio, unsigned int on);
int sa11x0_sc_set_wake(unsigned int irq, unsigned int on);

#endif

0 comments on commit 982b465

Please sign in to comment.