14 #include <linux/device.h>
16 #include <linux/string.h>
17 #include <linux/slab.h>
19 #include <linux/export.h>
57 static void __scoop_gpio_set(
struct scoop_dev *sdev,
64 gpwr |= 1 << (offset + 1);
66 gpwr &= ~(1 << (offset + 1));
70 static void scoop_gpio_set(
struct gpio_chip *
chip,
unsigned offset,
int value)
77 __scoop_gpio_set(sdev, offset, value);
79 spin_unlock_irqrestore(&sdev->
scoop_lock, flags);
82 static int scoop_gpio_get(
struct gpio_chip *
chip,
unsigned offset)
90 static int scoop_gpio_direction_input(
struct gpio_chip *
chip,
100 gpcr &= ~(1 << (offset + 1));
103 spin_unlock_irqrestore(&sdev->
scoop_lock, flags);
108 static int scoop_gpio_direction_output(
struct gpio_chip *
chip,
109 unsigned offset,
int value)
117 __scoop_gpio_set(sdev, offset, value);
120 gpcr |= 1 << (offset + 1);
123 spin_unlock_irqrestore(&sdev->
scoop_lock, flags);
145 static void check_scoop_reg(
struct scoop_dev *sdev)
150 if ((mcr & 0x100) == 0)
156 struct scoop_dev *sdev = platform_get_drvdata(dev);
158 check_scoop_reg(sdev);
167 struct scoop_dev *sdev = platform_get_drvdata(dev);
169 check_scoop_reg(sdev);
175 #define scoop_suspend NULL
176 #define scoop_resume NULL
196 inf = pdev->
dev.platform_data;
204 platform_set_drvdata(pdev, devptr);
206 printk(
"Sharp Scoop Device found at 0x%08x -> 0x%8p\n",(
unsigned int)mem->
start, devptr->
base);
217 devptr->
gpio.base = -1;
220 devptr->
gpio.label = dev_name(&pdev->
dev);
222 devptr->
gpio.ngpio = 12;
223 devptr->
gpio.set = scoop_gpio_set;
224 devptr->
gpio.get = scoop_gpio_get;
225 devptr->
gpio.direction_input = scoop_gpio_direction_input;
226 devptr->
gpio.direction_output = scoop_gpio_direction_output;
235 if (devptr->
gpio.base != -1)
238 platform_set_drvdata(pdev,
NULL);
248 struct scoop_dev *sdev = platform_get_drvdata(pdev);
254 if (sdev->
gpio.base != -1) {
257 dev_err(&pdev->
dev,
"Can't remove gpio chip: %d\n", ret);
262 platform_set_drvdata(pdev,
NULL);
270 .probe = scoop_probe,
275 .name =
"sharp-scoop",
279 static int __init scoop_init(
void)