|
@@ -14,6 +14,9 @@
|
|
|
#include <linux/pm.h>
|
|
|
#include <linux/proc_fs.h>
|
|
|
|
|
|
+#include <asm/arch/regs-gpio.h>
|
|
|
+#include <asm/arch/regs-gpioj.h>
|
|
|
+
|
|
|
#include <cybook.h>
|
|
|
|
|
|
#include <linux/cyio.h>
|
|
@@ -39,6 +42,8 @@
|
|
|
#include <linux/irq.h>
|
|
|
#include <linux/platform_device.h>
|
|
|
|
|
|
+#include "asm/io.h"
|
|
|
+
|
|
|
// ===========================================================================
|
|
|
spinlock_t io_lock = SPIN_LOCK_UNLOCKED;
|
|
|
|
|
@@ -218,8 +223,8 @@ static int procWriteIo (struct file *file, const char *buffer,
|
|
|
#undef MSG
|
|
|
#undef DBG
|
|
|
#ifdef DEBUG_MESSAGES
|
|
|
-#define MSG(str) { printk(KERN_ALERT str "\n"); }
|
|
|
-#define DBG(str, ...) { printk(KERN_ALERT str "\n", __VA_ARGS__); }
|
|
|
+#define MSG(str) { printk(KERN_ERR str "\n"); }
|
|
|
+#define DBG(str, ...) { printk(KERN_ERR str "\n", __VA_ARGS__); }
|
|
|
#else
|
|
|
#define MSG(str)
|
|
|
#define DBG(str, ...)
|
|
@@ -997,7 +1002,74 @@ ssize_t io_read(struct file *file, char *buf, size_t count, loff_t *ppos)
|
|
|
static int io_ioctl(struct inode *inode, struct file *file,
|
|
|
unsigned int cmd, unsigned long arg)
|
|
|
{
|
|
|
- return -EINVAL;
|
|
|
+ int ret = -EINVAL;
|
|
|
+ unsigned long value;
|
|
|
+ switch(cmd)
|
|
|
+ {
|
|
|
+ default:
|
|
|
+ printk(KERN_ERR "Bad IOCTL\n");
|
|
|
+ ret = 0x42;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case CYIO_CTL_LED_CMD:
|
|
|
+ DBG("CYIO_CTL_LED_CMD arg[0x%03X]", arg);
|
|
|
+
|
|
|
+ if ((arg & 0x2) && (arg & 0x1)) /* Power LED */
|
|
|
+ {
|
|
|
+ MSG("\n----------------> POWER LED ON\n");
|
|
|
+ //GPH12
|
|
|
+ __raw_writel(__raw_readl(S3C2410_GPHDAT) | (1 << 12), S3C2410_GPHDAT);
|
|
|
+ }
|
|
|
+ else if (arg & 0x2)
|
|
|
+ {
|
|
|
+ MSG("\n----------------> POWER LED OFF\n");
|
|
|
+ __raw_writel(__raw_readl(S3C2410_GPHDAT) & ~(1 << 12), S3C2410_GPHDAT);
|
|
|
+ }
|
|
|
+
|
|
|
+ if ((arg & 0x20) && (arg & 0x10)) /* Wifi LED */
|
|
|
+ {
|
|
|
+ MSG("\n----------------> POWER WFI ON\n");
|
|
|
+ //GPK8
|
|
|
+ __raw_writel(__raw_readl(S3C2416_GPKDAT) | (1 << 8), S3C2416_GPKDAT);
|
|
|
+ }
|
|
|
+ else if (arg & 0x20)
|
|
|
+ {
|
|
|
+ MSG("\n----------------> POWER WFI OFF\n");
|
|
|
+ __raw_writel(__raw_readl(S3C2416_GPKDAT) & ~(1 << 8), S3C2416_GPKDAT);
|
|
|
+ }
|
|
|
+
|
|
|
+ if ((arg & 0x200) && (arg & 0x100)) /* Bluetooth LED */
|
|
|
+ {
|
|
|
+ MSG("\n----------------> POWER BTH ON\n");
|
|
|
+ //GPK9
|
|
|
+ __raw_writel(__raw_readl(S3C2416_GPKDAT) | (1 << 9), S3C2416_GPKDAT);
|
|
|
+ }
|
|
|
+ else if (arg & 0x200)
|
|
|
+ {
|
|
|
+ MSG("\n----------------> POWER BTH OFF\n");
|
|
|
+ __raw_writel(__raw_readl(S3C2416_GPKDAT) & ~(1 << 9), S3C2416_GPKDAT);
|
|
|
+ }
|
|
|
+
|
|
|
+ ret = 0;
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
+ case CYIO_CTL_USB_STATUS:
|
|
|
+ value = gpio_get_value(S3C2410_GPG1);
|
|
|
+
|
|
|
+ put_user(value, (unsigned long __user *)arg);
|
|
|
+ ret = 0;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case CYIO_CTL_SD_STATUS:
|
|
|
+ value = gpio_get_value(S3C2410_GPF1);
|
|
|
+
|
|
|
+ put_user(value, (unsigned long __user *)arg);
|
|
|
+ ret = 0;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ return ret;
|
|
|
}
|
|
|
// ===========================================================================
|
|
|
static struct file_operations s_io_fops =
|
|
@@ -1188,6 +1260,6 @@ module_exit(cyIo_exit);
|
|
|
// ---------------------------------------------------------------------------
|
|
|
MODULE_LICENSE("GPL");
|
|
|
MODULE_AUTHOR("Bookeen <developers@bookeen.com>");
|
|
|
-MODULE_DESCRIPTION("Cybook Event Manager");
|
|
|
+MODULE_DESCRIPTION("Cybook IO Manager");
|
|
|
MODULE_VERSION("3.0");
|
|
|
// ===========================================================================
|