git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ipmi: change addr_source to an enum rather than strings
[safe/jmp/linux-2.6]
/
drivers
/
char
/
pc8736x_gpio.c
diff --git
a/drivers/char/pc8736x_gpio.c
b/drivers/char/pc8736x_gpio.c
index
bfc45e0
..
8ecbcc1
100644
(file)
--- a/
drivers/char/pc8736x_gpio.c
+++ b/
drivers/char/pc8736x_gpio.c
@@
-40,7
+40,8
@@
static u8 pc8736x_gpio_shadow[4];
#define SIO_BASE2 0x4E /* alt command-reg to check */
#define SIO_SID 0x20 /* SuperI/O ID Register */
#define SIO_BASE2 0x4E /* alt command-reg to check */
#define SIO_SID 0x20 /* SuperI/O ID Register */
-#define SIO_SID_VALUE 0xe9 /* Expected value in SuperI/O ID Register */
+#define SIO_SID_PC87365 0xe5 /* Expected value in ID Register for PC87365 */
+#define SIO_SID_PC87366 0xe9 /* Expected value in ID Register for PC87366 */
#define SIO_CF1 0x21 /* chip config, bit0 is chip enable */
#define SIO_CF1 0x21 /* chip config, bit0 is chip enable */
@@
-90,13
+91,17
@@
static inline int superio_inb(int addr)
static int pc8736x_superio_present(void)
{
static int pc8736x_superio_present(void)
{
+ int id;
+
/* try the 2 possible values, read a hardware reg to verify */
superio_cmd = SIO_BASE1;
/* try the 2 possible values, read a hardware reg to verify */
superio_cmd = SIO_BASE1;
- if (superio_inb(SIO_SID) == SIO_SID_VALUE)
+ id = superio_inb(SIO_SID);
+ if (id == SIO_SID_PC87365 || id == SIO_SID_PC87366)
return superio_cmd;
superio_cmd = SIO_BASE2;
return superio_cmd;
superio_cmd = SIO_BASE2;
- if (superio_inb(SIO_SID) == SIO_SID_VALUE)
+ id = superio_inb(SIO_SID);
+ if (id == SIO_SID_PC87365 || id == SIO_SID_PC87366)
return superio_cmd;
return 0;
return superio_cmd;
return 0;
@@
-188,16
+193,6
@@
static void pc8736x_gpio_set(unsigned minor, int val)
pc8736x_gpio_shadow[port] = val;
}
pc8736x_gpio_shadow[port] = val;
}
-static void pc8736x_gpio_set_high(unsigned index)
-{
- pc8736x_gpio_set(index, 1);
-}
-
-static void pc8736x_gpio_set_low(unsigned index)
-{
- pc8736x_gpio_set(index, 0);
-}
-
static int pc8736x_gpio_current(unsigned minor)
{
int port, bit;
static int pc8736x_gpio_current(unsigned minor)
{
int port, bit;
@@
-212,14
+207,12
@@
static void pc8736x_gpio_change(unsigned index)
pc8736x_gpio_set(index, !pc8736x_gpio_current(index));
}
pc8736x_gpio_set(index, !pc8736x_gpio_current(index));
}
-static struct nsc_gpio_ops pc8736x_
acces
s = {
+static struct nsc_gpio_ops pc8736x_
gpio_op
s = {
.owner = THIS_MODULE,
.gpio_config = pc8736x_gpio_configure,
.gpio_dump = nsc_gpio_dump,
.gpio_get = pc8736x_gpio_get,
.gpio_set = pc8736x_gpio_set,
.owner = THIS_MODULE,
.gpio_config = pc8736x_gpio_configure,
.gpio_dump = nsc_gpio_dump,
.gpio_get = pc8736x_gpio_get,
.gpio_set = pc8736x_gpio_set,
- .gpio_set_high = pc8736x_gpio_set_high,
- .gpio_set_low = pc8736x_gpio_set_low,
.gpio_change = pc8736x_gpio_change,
.gpio_current = pc8736x_gpio_current
};
.gpio_change = pc8736x_gpio_change,
.gpio_current = pc8736x_gpio_current
};
@@
-227,7
+220,7
@@
static struct nsc_gpio_ops pc8736x_access = {
static int pc8736x_gpio_open(struct inode *inode, struct file *file)
{
unsigned m = iminor(inode);
static int pc8736x_gpio_open(struct inode *inode, struct file *file)
{
unsigned m = iminor(inode);
- file->private_data = &pc8736x_
acces
s;
+ file->private_data = &pc8736x_
gpio_op
s;
dev_dbg(&pdev->dev, "open %d\n", m);
dev_dbg(&pdev->dev, "open %d\n", m);
@@
-236,7
+229,7
@@
static int pc8736x_gpio_open(struct inode *inode, struct file *file)
return nonseekable_open(inode, file);
}
return nonseekable_open(inode, file);
}
-static const struct file_operations pc8736x_gpio_fops = {
+static const struct file_operations pc8736x_gpio_f
ile
ops = {
.owner = THIS_MODULE,
.open = pc8736x_gpio_open,
.write = nsc_gpio_write,
.owner = THIS_MODULE,
.open = pc8736x_gpio_open,
.write = nsc_gpio_write,
@@
-259,7
+252,8
@@
static struct cdev pc8736x_gpio_cdev;
static int __init pc8736x_gpio_init(void)
{
static int __init pc8736x_gpio_init(void)
{
- int rc = 0;
+ int rc;
+ dev_t devid;
pdev = platform_device_alloc(DEVNAME, 0);
if (!pdev)
pdev = platform_device_alloc(DEVNAME, 0);
if (!pdev)
@@
-277,7
+271,7
@@
static int __init pc8736x_gpio_init(void)
dev_err(&pdev->dev, "no device found\n");
goto undo_platform_dev_add;
}
dev_err(&pdev->dev, "no device found\n");
goto undo_platform_dev_add;
}
- pc8736x_
acces
s.dev = &pdev->dev;
+ pc8736x_
gpio_op
s.dev = &pdev->dev;
/* Verify that chip and it's GPIO unit are both enabled.
My BIOS does this, so I take minimum action here
/* Verify that chip and it's GPIO unit are both enabled.
My BIOS does this, so I take minimum action here
@@
-307,7
+301,14
@@
static int __init pc8736x_gpio_init(void)
}
dev_info(&pdev->dev, "GPIO ioport %x reserved\n", pc8736x_gpio_base);
}
dev_info(&pdev->dev, "GPIO ioport %x reserved\n", pc8736x_gpio_base);
- rc = register_chrdev(major, DEVNAME, &pc8736x_gpio_fops);
+ if (major) {
+ devid = MKDEV(major, 0);
+ rc = register_chrdev_region(devid, PC8736X_GPIO_CT, DEVNAME);
+ } else {
+ rc = alloc_chrdev_region(&devid, 0, PC8736X_GPIO_CT, DEVNAME);
+ major = MAJOR(devid);
+ }
+
if (rc < 0) {
dev_err(&pdev->dev, "register-chrdev failed: %d\n", rc);
goto undo_request_region;
if (rc < 0) {
dev_err(&pdev->dev, "register-chrdev failed: %d\n", rc);
goto undo_request_region;
@@
-318,6
+319,11
@@
static int __init pc8736x_gpio_init(void)
}
pc8736x_init_shadow();
}
pc8736x_init_shadow();
+
+ /* ignore minor errs, and succeed */
+ cdev_init(&pc8736x_gpio_cdev, &pc8736x_gpio_fileops);
+ cdev_add(&pc8736x_gpio_cdev, devid, PC8736X_GPIO_CT);
+
return 0;
undo_request_region:
return 0;
undo_request_region:
@@
-342,7
+348,5
@@
static void __exit pc8736x_gpio_cleanup(void)
platform_device_put(pdev);
}
platform_device_put(pdev);
}
-EXPORT_SYMBOL(pc8736x_access);
-
module_init(pc8736x_gpio_init);
module_exit(pc8736x_gpio_cleanup);
module_init(pc8736x_gpio_init);
module_exit(pc8736x_gpio_cleanup);