Commit f869b87c authored by Patrick Mochel's avatar Patrick Mochel

[sa1100 irq] Convert to new system device API.

parent 3db29faf
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/device.h> #include <linux/sysdev.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/irq.h> #include <asm/irq.h>
...@@ -211,94 +211,73 @@ static struct resource irq_resource = { ...@@ -211,94 +211,73 @@ static struct resource irq_resource = {
.end = 0x9005ffff, .end = 0x9005ffff,
}; };
struct sa1100irq_state { static struct {
unsigned int saved; unsigned int saved;
unsigned int icmr; unsigned int icmr;
unsigned int iclr; unsigned int iclr;
unsigned int iccr; unsigned int iccr;
}; } sa1100irq_state;
static int sa1100irq_suspend(struct device *dev, u32 state, u32 level) static int sa1100irq_suspend(struct device *dev, u32 state, u32 level)
{ {
struct sa1100irq_state *st; struct sa1100irq_state *st = &sa1100irq_state;
if (!dev->saved_state && level == SUSPEND_NOTIFY)
dev->saved_state = kmalloc(sizeof(struct sa1100irq_state),
GFP_KERNEL);
if (!dev->saved_state)
return -ENOMEM;
if (level == SUSPEND_POWER_DOWN) {
st = (struct sa1100irq_state *)dev->saved_state;
st->saved = 1; st->saved = 1;
st->icmr = ICMR; st->icmr = ICMR;
st->iclr = ICLR; st->iclr = ICLR;
st->iccr = ICCR; st->iccr = ICCR;
/* /*
* Disable all GPIO-based interrupts. * Disable all GPIO-based interrupts.
*/ */
ICMR &= ~(IC_GPIO11_27|IC_GPIO10|IC_GPIO9|IC_GPIO8|IC_GPIO7| ICMR &= ~(IC_GPIO11_27|IC_GPIO10|IC_GPIO9|IC_GPIO8|IC_GPIO7|
IC_GPIO6|IC_GPIO5|IC_GPIO4|IC_GPIO3|IC_GPIO2| IC_GPIO6|IC_GPIO5|IC_GPIO4|IC_GPIO3|IC_GPIO2|
IC_GPIO1|IC_GPIO0); IC_GPIO1|IC_GPIO0);
/* /*
* Set the appropriate edges for wakeup. * Set the appropriate edges for wakeup.
*/ */
GRER = PWER & GPIO_IRQ_rising_edge; GRER = PWER & GPIO_IRQ_rising_edge;
GFER = PWER & GPIO_IRQ_falling_edge; GFER = PWER & GPIO_IRQ_falling_edge;
/*
* Clear any pending GPIO interrupts.
*/
GEDR = GEDR;
/*
* Clear any pending GPIO interrupts.
*/
GEDR = GEDR;
}
return 0; return 0;
} }
static int sa1100irq_resume(struct device *dev, u32 level) static int sa1100irq_resume(struct sys_device *dev)
{ {
struct sa1100irq_state *st; struct sa1100irq_state *st = &sa1100irq_state;
if (level == RESUME_POWER_ON) {
st = (struct sa1100irq_state *)dev->saved_state;
dev->saved_state = NULL;
if (st->saved) {
ICCR = st->iccr;
ICLR = st->iclr;
GRER = GPIO_IRQ_rising_edge & GPIO_IRQ_mask; if (st->saved) {
GFER = GPIO_IRQ_falling_edge & GPIO_IRQ_mask; ICCR = st->iccr;
ICLR = st->iclr;
ICMR = st->icmr; GRER = GPIO_IRQ_rising_edge & GPIO_IRQ_mask;
} GFER = GPIO_IRQ_falling_edge & GPIO_IRQ_mask;
kfree(st); ICMR = st->icmr;
} }
return 0; return 0;
} }
static struct device_driver sa1100irq_driver = { static struct sysdev_class sa1100irq_sysclass = {
.name = "sa11x0-irq", set_kset_name("sa11x0-irq"),
.bus = &system_bus_type,
.suspend = sa1100irq_suspend, .suspend = sa1100irq_suspend,
.resume = sa1100irq_resume, .resume = sa1100irq_resume,
}; };
static struct sys_device sa1100irq_device = { static struct sys_device sa1100irq_device = {
.name = "irq",
.id = 0, .id = 0,
.dev = { .cls = &sa1100irq_sysclass,
.name = "Intel SA11x0 [Interrupt Controller]",
.driver = &sa1100irq_driver,
},
}; };
static int __init sa1100irq_init_devicefs(void) static int __init sa1100irq_init_devicefs(void)
{ {
driver_register(&sa1100irq_driver); sysdev_class_register(&sa1100irq_sysclass);
return sys_device_register(&sa1100irq_device); return sys_device_register(&sa1100irq_device);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment