+ chardev-gpio-for-scx200-pc-8736x-fix-gpio_current.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     chardev: GPIO for SCx200 & PC-8736x: fix gpio_current, use shadow regs

has been added to the -mm tree.  Its filename is

     chardev-gpio-for-scx200-pc-8736x-fix-gpio_current.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: chardev: GPIO for SCx200 & PC-8736x: fix gpio_current, use shadow regs
From: Jim Cromie <jim.cromie@xxxxxxxxx>


Add a working gpio_current() to pc8736x_gpio.c (the previous implementation
just threw a dev_warn), and fix gpio_change() to use gpio_current() rather
than the incorrect (and temporary) gpio_get().  Initialize shadow-regs so this
all works.

Signed-off-by: Jim Cromie <jim.cromie@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/char/pc8736x_gpio.c |   27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff -puN drivers/char/pc8736x_gpio.c~chardev-gpio-for-scx200-pc-8736x-fix-gpio_current drivers/char/pc8736x_gpio.c
--- a/drivers/char/pc8736x_gpio.c~chardev-gpio-for-scx200-pc-8736x-fix-gpio_current
+++ a/drivers/char/pc8736x_gpio.c
@@ -33,6 +33,7 @@ MODULE_PARM_DESC(major, "Major device nu
 
 static DEFINE_SPINLOCK(pc8736x_gpio_config_lock);
 static unsigned pc8736x_gpio_base;
+static u8 pc8736x_gpio_shadow[4];
 
 #define SIO_BASE1       0x2E	/* 1st command-reg to check */
 #define SIO_BASE2       0x4E	/* alt command-reg to check */
@@ -184,6 +185,7 @@ static void pc8736x_gpio_set(unsigned mi
 	val = inb_p(pc8736x_gpio_base + port_offset[port] + PORT_IN);
 
 	dev_dbg(&pdev->dev, "wrote %x, read: %x\n", curval, val);
+	pc8736x_gpio_shadow[port] = val;
 }
 
 static void pc8736x_gpio_set_high(unsigned index)
@@ -196,15 +198,18 @@ static void pc8736x_gpio_set_low(unsigne
 	pc8736x_gpio_set(index, 0);
 }
 
-static int pc8736x_gpio_current(unsigned index)
+static int pc8736x_gpio_current(unsigned minor)
 {
-	dev_warn(&pdev->dev, "pc8736x_gpio_current unimplemented\n");
-	return 0;
+	int port, bit;
+	minor &= 0x1f;
+	port = minor >> 3;
+	bit = minor & 7;
+	return pc8736x_gpio_shadow[port] >> bit & 0x01;
 }
 
 static void pc8736x_gpio_change(unsigned index)
 {
-	pc8736x_gpio_set(index, !pc8736x_gpio_get(index));
+	pc8736x_gpio_set(index, !pc8736x_gpio_current(index));
 }
 
 extern void nsc_gpio_dump(struct nsc_gpio_ops *amp, unsigned iminor);
@@ -240,6 +245,18 @@ static struct file_operations pc8736x_gp
 	.read	= nsc_gpio_read,
 };
 
+static void __init pc8736x_init_shadow(void)
+{
+	int port;
+
+	/* read the current values driven on the GPIO signals */
+	for (port = 0; port < 4; ++port)
+		pc8736x_gpio_shadow[port]
+		    = inb_p(pc8736x_gpio_base + port_offset[port]
+			    + PORT_OUT);
+
+}
+
 static int __init pc8736x_gpio_init(void)
 {
 	int r, rc;
@@ -306,5 +323,7 @@ static void __exit pc8736x_gpio_cleanup(
 	unregister_chrdev(major, DEVNAME);
 }
 
+EXPORT_SYMBOL(pc8736x_access);
+
 module_init(pc8736x_gpio_init);
 module_exit(pc8736x_gpio_cleanup);
_

Patches currently in -mm which might be from jim.cromie@xxxxxxxxx are

chardev-gpio-for-scx200-pc-8736x-whitespace.patch
chardev-gpio-for-scx200-pc-8736x-modernize.patch
chardev-gpio-for-scx200-pc-8736x-add-platforn_device.patch
chardev-gpio-for-scx200-pc-8736x-device-minor.patch
chardev-gpio-for-scx200-pc-8736x-put-gpio_dump.patch
chardev-gpio-for-scx200-pc-8736x-add-v-command.patch
chardev-gpio-for-scx200-pc-8736x-refactor-scx200_probe.patch
chardev-gpio-for-scx200-pc-8736x-add-gpio-ops.patch
chardev-gpio-for-scx200-pc-8736x-dispatch.patch
chardev-gpio-for-scx200-pc-8736x-add-empty.patch
chardev-gpio-for-scx200-pc-8736x-migrate-file-ops.patch
chardev-gpio-for-scx200-pc-8736x-migrate-gpio_dump.patch
chardev-gpio-for-scx200-pc-8736x-add-new-pc8736x_gpio.patch
chardev-gpio-for-scx200-pc-8736x-add-platform_device.patch
chardev-gpio-for-scx200-pc-8736x-use-dev_dbg.patch
chardev-gpio-for-scx200-pc-8736x-fix-gpio_current.patch
chardev-gpio-for-scx200-pc-8736x-replace-spinlocks.patch
chardev-gpio-for-scx200-pc-8736x-display-pin.patch
chardev-gpio-for-scx200-pc-8736x-add-proper.patch
chardev-gpio-for-scx200-pc-8736x-add-sysfs-gpio.patch
generic-time-add-macro-to-simplify-hide-mask.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux