rk2928_phonepad: remove exp gpio
authorlinjh <linjh@rock-chips.com>
Tue, 23 Oct 2012 08:31:44 +0000 (16:31 +0800)
committerlinjh <linjh@rock-chips.com>
Tue, 23 Oct 2012 08:31:44 +0000 (16:31 +0800)
[reference files]
modified:

arch/arm/mach-rk2928/include/mach/board.h
    drivers/misc/rk2928_callpad_misc/Kconfig
    drivers/misc/rk2928_callpad_misc/Makefile

deleted:

drivers/misc/rk2928_callpad_misc/gpio_exp_callpad.c
    include/linux/gpio_exp_callpad.h

arch/arm/mach-rk2928/include/mach/board.h
drivers/misc/rk2928_callpad_misc/Kconfig
drivers/misc/rk2928_callpad_misc/Makefile
drivers/misc/rk2928_callpad_misc/gpio_exp_callpad.c [deleted file]
include/linux/gpio_exp_callpad.h [deleted file]

index 840b598dee4edfb2f5cef5d5f62f4720f3fc122c..1c93a099548d3ee8b481b197b9a92423eb2bf889 100755 (executable)
@@ -145,14 +145,6 @@ struct byd_platform_data {
 };
 #endif
 
-
-#if defined (CONFIG_GPIOEXP_AW9523B)
-struct gpio_exp_platform_data {
-    int     (*init_platform_hw)(void);
-    void    (*exit_platform_hw)(void);
-};
-#endif
-
 #ifdef CONFIG_INPUT_AP321XX
 struct ap321xx_platform_data {
        int (*init_platform_hw)(void);
index f53da3432c14c6d1f4dbd5d978949ee14f2b56e1..48f2e3b0c166bbc28d0b7e3d372b6befe7d18183 100755 (executable)
@@ -10,6 +10,3 @@ menuconfig RK2928_CALLPAD_MISC
 config AUDIO_SWITCH
        bool "RK2928 callpad audio switch"
        default n
-config GPIOEXP_AW9523B
-  bool "RK2928 callpad gpio exp"
-  default n
index 05e5d7bcab5706b8b2f313b19aec98df1291931e..d2328ae022605b5ff46f54a152237d969e020ee4 100755 (executable)
@@ -1,2 +1 @@
 obj-$(CONFIG_AUDIO_SWITCH)    += audio_switch.o
-obj-$(CONFIG_GPIOEXP_AW9523B)    += gpio_exp_callpad.o
diff --git a/drivers/misc/rk2928_callpad_misc/gpio_exp_callpad.c b/drivers/misc/rk2928_callpad_misc/gpio_exp_callpad.c
deleted file mode 100755 (executable)
index 0af3c51..0000000
+++ /dev/null
@@ -1,404 +0,0 @@
-#include <linux/module.h>\r
-#include <linux/kernel.h>\r
-#include <linux/i2c.h>\r
-#include <linux/irq.h>\r
-#include <linux/gpio.h>\r
-#include <linux/input.h>\r
-#include <linux/platform_device.h>\r
-#include <linux/fs.h>\r
-#include <linux/uaccess.h>\r
-#include <linux/miscdevice.h>\r
-#include <linux/circ_buf.h>\r
-#include <linux/interrupt.h>\r
-#include <linux/miscdevice.h>\r
-#include <mach/gpio.h>\r
-#include <asm/gpio.h>\r
-#include <linux/delay.h>\r
-#include <linux/poll.h>\r
-#include <linux/wait.h>\r
-#include <linux/wakelock.h>\r
-#include <linux/workqueue.h>\r
-#include <linux/earlysuspend.h>\r
-#include <linux/slab.h>\r
-#include <mach/board.h>\r
-#include <linux/gpio_exp_callpad.h>\r
-\r
-//#define DEBUG_GPIO_EXP\r
-#ifdef DEBUG_GPIO_EXP\r
-#define DEBUGPRINT(x...) printk(x)\r
-#else\r
-#define DEBUGPRINT(x...)\r
-#endif\r
-\r
-struct gpioexp_data {\r
-       struct i2c_client *client;\r
-       int    irq;\r
-       struct work_struct      gpioexp_work;\r
-       struct workqueue_struct *gpioexp_workqueue;\r
-       u16 int_mask_bit;\r
-       u16 pre_int_bit;\r
-       gpioexp_int_handler_t interrupt_handlers [GPIOEXP_PIN_MAX];\r
-       unsigned long interrupt_trigger[GPIOEXP_PIN_MAX];\r
-};\r
-\r
-\r
-static struct gpioexp_data* gpioexp_ptr=NULL;\r
-\r
-int gpioexp_set_direction(unsigned gpio, int is_in)\r
-{\r
-       char buf[1];\r
-       unsigned char reg, gpiobit;\r
-\r
-       if(gpio >= GPIOEXP_PIN_MAX)\r
-               return -EINVAL;\r
-\r
-       reg = (gpio<8) ? 0x04 : 0x05;\r
-       gpiobit = (gpio<8) ? (0x01<<gpio) : (0x01<<(gpio-8));\r
-\r
-       buf[0] = 0;\r
-       i2c_master_reg8_recv(gpioexp_ptr->client, reg, buf, 1, 400*1000);\r
-       if(is_in)\r
-               buf[0] |= gpiobit;\r
-       else\r
-               buf[0] &= ~gpiobit;\r
-\r
-       i2c_master_reg8_send(gpioexp_ptr->client, reg, buf, 1, 400*1000);\r
-       \r
-       DEBUGPRINT("gpioexp_set_direction:gpio = %d, buf[0] = %d\n", gpio, buf[0]);\r
-\r
-       return 0;\r
-\r
-}      \r
-EXPORT_SYMBOL(gpioexp_set_direction);\r
-\r
-int gpioexp_set_output_level(unsigned gpio, int value)\r
-{\r
-    char buf[1];\r
-    unsigned char reg, gpiobit;\r
-    \r
-       if(gpio >= GPIOEXP_PIN_MAX)\r
-               return -EINVAL;\r
-\r
-    reg = (gpio<8) ? 0x02 : 0x03;\r
-    gpiobit = (gpio<8) ? (0x01<<gpio) : (0x01<<(gpio-8));\r
-\r
-    buf[0] = 0;\r
-    i2c_master_reg8_recv(gpioexp_ptr->client, reg, buf, 1, 400*1000);\r
-    if(value)\r
-       buf[0] |= gpiobit;\r
-   else\r
-       buf[0] &= ~gpiobit;\r
-       \r
-    i2c_master_reg8_send(gpioexp_ptr->client, reg, buf, 1, 400*1000);\r
-       DEBUGPRINT("gpioexp_set_output_level:gpio = %d, buf[0] = %d\n", gpio, buf[0]);\r
-\r
-       return 0;\r
-\r
-}      \r
-EXPORT_SYMBOL(gpioexp_set_output_level);\r
-\r
-\r
-int gpioexp_read_input_level(unsigned gpio)\r
-{\r
-    char buf[1];\r
-    unsigned char reg, gpiobit;\r
-    int ret;\r
-    \r
-       if(gpio >= GPIOEXP_PIN_MAX)\r
-               return -EINVAL;\r
-       \r
-    reg = (gpio<8) ? 0x00 : 0x01;\r
-    gpiobit = (gpio<8)?(0x01<<gpio):(0x01<<(gpio-8));\r
-\r
-    buf[0] = 0;\r
-    i2c_master_reg8_recv(gpioexp_ptr->client, reg, buf, 1, 400*1000);\r
-    \r
-    ret = (buf[0] & gpiobit)?1:0;\r
-       \r
-       DEBUGPRINT("gpioexp_read_input_level:gpio = %d, buf[0] = %d\n", gpio, buf[0]);\r
-    return ret;\r
-\r
-}\r
-EXPORT_SYMBOL(gpioexp_read_input_level);\r
-\r
-int gpioexp_request_irq(unsigned int irq, gpioexp_int_handler_t handler, unsigned long flags)\r
-{\r
-       char buf[1];\r
-       \r
-       if(irq > GPIOEXP_PIN_MAX || handler == NULL || !(flags & GPIOEXP_INT_TRIGGER_MASK))\r
-               return -EINVAL;\r
-       \r
-       if(gpioexp_ptr->int_mask_bit & (0x01 << irq) == 0)\r
-               return -EBUSY;\r
-       gpioexp_ptr->interrupt_handlers[irq] = handler;\r
-       gpioexp_ptr->interrupt_trigger[irq] = flags & GPIOEXP_INT_TRIGGER_MASK;\r
-       gpioexp_ptr->int_mask_bit &= ~(0x01 << irq);\r
-\r
-       if(irq >=8){\r
-               buf[0] = (gpioexp_ptr->int_mask_bit >> 8) & 0xff;\r
-               i2c_master_reg8_send(gpioexp_ptr->client, 0x07, buf, 1, 400*1000);\r
-       }\r
-       else{\r
-               buf[0] = gpioexp_ptr->int_mask_bit & 0xff;\r
-               i2c_master_reg8_send(gpioexp_ptr->client, 0x06, buf, 1, 400*1000);\r
-       }\r
-\r
-       return 0;\r
-}\r
-EXPORT_SYMBOL(gpioexp_request_irq);\r
-\r
-int gpioexp_free_irq(unsigned int irq)\r
-{\r
-       char buf[1];\r
-\r
-       if(irq > GPIOEXP_PIN_MAX)\r
-               return -EINVAL;\r
-       if(gpioexp_ptr->int_mask_bit & (0x01 << irq) == 0){\r
-               gpioexp_ptr->int_mask_bit &= ~(0x01 << irq);\r
-               if(irq >=8){\r
-                       buf[0] = (gpioexp_ptr->int_mask_bit >> 8) & 0xff;\r
-                       i2c_master_reg8_send(gpioexp_ptr->client, 0x07, buf, 1, 400*1000);\r
-               }\r
-               else{\r
-                       buf[0] = gpioexp_ptr->int_mask_bit & 0xff;\r
-                       i2c_master_reg8_send(gpioexp_ptr->client, 0x06, buf, 1, 400*1000);\r
-               }\r
-       }\r
-       gpioexp_ptr->interrupt_handlers[irq] = NULL;\r
-       gpioexp_ptr->interrupt_trigger[irq] = 0;\r
-       \r
-       return 0;\r
-}\rEXPORT_SYMBOL(gpioexp_free_irq);\r
-\r
-int gpioexp_enable_irq(unsigned int irq)\r
-{\r
-       char buf[1];\r
-       \r
-       if(irq > GPIOEXP_PIN_MAX)\r
-               return -EINVAL;\r
-       if(gpioexp_ptr->int_mask_bit & (0x01 << irq) == 0)\r
-               return 0;\r
-       gpioexp_ptr->int_mask_bit &= ~(0x01 << irq);\r
-       if(irq >=8){\r
-               buf[0] = (gpioexp_ptr->int_mask_bit >> 8) & 0xff;\r
-               i2c_master_reg8_send(gpioexp_ptr->client, 0x07, buf, 1, 400*1000);\r
-       }\r
-       else{\r
-               buf[0] = gpioexp_ptr->int_mask_bit & 0xff;\r
-               i2c_master_reg8_send(gpioexp_ptr->client, 0x06, buf, 1, 400*1000);\r
-       }\r
-       return 0;\r
-}\r
-EXPORT_SYMBOL(gpioexp_enable_irq);\r
-\r
-int gpioexp_disable_irq(unsigned int irq)\r
-{\r
-       char buf[1];\r
-       \r
-       if(irq > GPIOEXP_PIN_MAX)\r
-               return -EINVAL;\r
-       if(gpioexp_ptr->int_mask_bit & (0x01 << irq) == 1)\r
-               return 0;\r
-       gpioexp_ptr->int_mask_bit |= (0x01 << irq);\r
-       if(irq >=8){\r
-               buf[0] = (gpioexp_ptr->int_mask_bit >> 8) & 0xff;\r
-               i2c_master_reg8_send(gpioexp_ptr->client, 0x07, buf, 1, 400*1000);\r
-       }\r
-       else{\r
-               buf[0] = gpioexp_ptr->int_mask_bit & 0xff;\r
-               i2c_master_reg8_send(gpioexp_ptr->client, 0x06, buf, 1, 400*1000);\r
-       }\r
-       return 0;\r
-}\r
-EXPORT_SYMBOL(gpioexp_disable_irq);\r
-\r
-static inline void gpioexp_handle_interrupt(struct gpioexp_data *data, u16 int_pending_bit)\r
-{\r
-       int i;\r
-       u16 pre_int_bit = data->pre_int_bit;\r
-\r
-       for(i=0;i<GPIOEXP_PIN_MAX;i++){\r
-               if(int_pending_bit & 0x01){\r
-                       if((pre_int_bit >> i) & 0x01){\r
-                               if(data->interrupt_trigger[i] && GPIOEXP_INT_TRIGGER_FALLING)\\r
-                                       data->interrupt_handlers[i](data);\r
-                       }\r
-                       else{\r
-                               if(data->interrupt_trigger[i] && GPIOEXP_INT_TRIGGER_RISING)\\r
-                                       data->interrupt_handlers[i](data);\r
-                       }\r
-               }\r
-               int_pending_bit = int_pending_bit >> 1;\r
-       }\r
-}\r
-\r
-static inline u16 gpioexp_interrupt_pending(struct gpioexp_data *data,u16 cur_int_bit)\r
-{\r
-       u16 int_toggle_bit,int_pending_bit;\r
-       \r
-       int_toggle_bit = (data->pre_int_bit) ^ cur_int_bit;\r
-       int_pending_bit = (~data->int_mask_bit) & int_toggle_bit;\r
-\r
-       return int_pending_bit;\r
-}\r
-\r
-static void gpioexp_chip_init(void)\r
-{\r
-       char buf[1];\r
-\r
-       buf[0] = 0x10; //set P0 Push-Pull\r
-       i2c_master_reg8_send(gpioexp_ptr->client, 0x11, buf, 1, 400*1000);\r
-       \r
-       buf[0] = 0xff; //set interrupt disable\r
-       i2c_master_reg8_send(gpioexp_ptr->client, 0x06, buf, 1, 400*1000);    \r
-       buf[0] = 0xff; //set interrupt disable\r
-       i2c_master_reg8_send(gpioexp_ptr->client, 0x07, buf, 1, 400*1000);    \r
-       gpioexp_ptr->int_mask_bit = 0xffff;\r
-\r
-       buf[0] = 0x00; //set input output P0 0b10111111\r
-       i2c_master_reg8_send(gpioexp_ptr->client, 0x04, buf, 1, 400*1000);    \r
-       buf[0] = 0x00;  //set input output P1 0b01000000\r
-       i2c_master_reg8_send(gpioexp_ptr->client, 0x05, buf, 1, 400*1000);    \r
-\r
-       buf[0] = 0x00; //set output value P0 0b00000000\r
-       i2c_master_reg8_send(gpioexp_ptr->client, 0x02, buf, 1, 400*1000);    \r
-       buf[0] = 0x80; //set output value P1 0b00000011\r
-       i2c_master_reg8_send(gpioexp_ptr->client, 0x03, buf, 1, 400*1000);    \r
-       gpioexp_ptr->pre_int_bit = 0x0000;\r
-               \r
-       DEBUGPRINT("gpioexp_init\n");\r
-}      \r
-\r
-static void gpioexp_work(struct work_struct *work)\r
-{\r
-       struct gpioexp_data *data = container_of(work, struct gpioexp_data, gpioexp_work);\r
-       char buf[2] = {0};\r
-       u16 cur_int_bit,int_pending_bit;\r
-       \r
-       DEBUGPRINT("gpioexp_work: read io status\n");\r
-       \r
-       i2c_master_reg8_recv(gpioexp_ptr->client, 0x00, buf, 1, 400*1000);              //read p0 value\r
-       i2c_master_reg8_recv(gpioexp_ptr->client, 0x01, buf+1, 1, 400*1000);    //read p1 value\r
-       cur_int_bit = (u16)(buf[1]) << 8 | buf[0];\r
-       int_pending_bit = gpioexp_interrupt_pending(data,cur_int_bit);\r
-       if(int_pending_bit){\r
-               gpioexp_handle_interrupt(data,int_pending_bit);\r
-       }\r
-       data->pre_int_bit = cur_int_bit;\r
-\r
-       enable_irq(data->irq);\r
-}\r
-\r
-static irqreturn_t gpioexp_interrupt(int irq, void *dev_id)\r
-{\r
-       struct gpioexp_data *gpioexp = dev_id;\r
-\r
-       DEBUGPRINT("gpioexp_interrupt\n");\r
-       disable_irq_nosync(gpioexp->irq);\r
-       if (!work_pending(&gpioexp->gpioexp_work)) \r
-               queue_work(gpioexp->gpioexp_workqueue, &gpioexp->gpioexp_work);\r
-       return IRQ_HANDLED;\r
-}\r
-\r
-static __devinit int gpioexp_probe(struct i2c_client *i2c,\r
-                           const struct i2c_device_id *id)\r
-{\r
-       struct gpio_exp_platform_data *pdata = i2c->dev.platform_data;\r
-       struct gpioexp_data *gpioexp;\r
-       int ret = 0;\r
-\r
-       DEBUGPRINT("gpioexp_probe\n");\r
-       if (!pdata) {\r
-               dev_err(&i2c->dev, "platform data is required!\n");\r
-               return -EINVAL;\r
-       }\r
-\r
-       gpioexp = kzalloc(sizeof(*gpioexp), GFP_KERNEL);\r
-       if (!gpioexp)   {\r
-               return -ENOMEM;
-       }\r
-\r
-       if (pdata->init_platform_hw)                              \r
-               pdata->init_platform_hw();\r
-\r
-       gpioexp->client = i2c;\r
-       gpioexp->irq = gpio_to_irq(i2c->irq);\r
-\r
-       INIT_WORK(&gpioexp->gpioexp_work, gpioexp_work);\r
-       gpioexp->gpioexp_workqueue = create_singlethread_workqueue("gpioexp_workqueue");\r
-       if (!gpioexp->gpioexp_workqueue) {\r
-               ret = -ESRCH;\r
-               goto gpioexp_wq_fail;\r
-       }\r
-\r
-\r
-       i2c_set_clientdata(gpioexp->client, gpioexp);\r
-       gpioexp_ptr = gpioexp;\r
-\r
-       gpioexp_chip_init();\r
-\r
-       ret = request_irq(gpioexp->irq, gpioexp_interrupt, IRQF_TRIGGER_FALLING, gpioexp->client->dev.driver->name, gpioexp);\r
-       if (ret < 0) {
-               ret = 1;\r
-               goto gpioexp_irq_fail;\r
-       }\r
-\r
-       DEBUGPRINT("gpioexp set modem power on!\n");\r
-       return 0;\r
-\r
-gpioexp_irq_fail:\r
-       destroy_workqueue(gpioexp->gpioexp_workqueue);\r
-       i2c_set_clientdata(gpioexp->client, NULL);\r
-       gpioexp_ptr = NULL;\r
-gpioexp_wq_fail:       \r
-       pdata->exit_platform_hw();\r
-       kfree(gpioexp);\r
-\r
-       return ret;\r
-}\r
-\r
-static __devexit int gpioexp_remove(struct i2c_client *client)\r
-{\r
-       struct gpio_exp_platform_data *pdata = client->dev.platform_data;\r
-       struct gpioexp_data *gpioexp = i2c_get_clientdata(client);\r
-       \r
-       DEBUGPRINT("gpioexp_remove");\r
-\r
-       destroy_workqueue(gpioexp->gpioexp_workqueue);\r
-       pdata->exit_platform_hw();\r
-       kfree(gpioexp);\r
-       gpioexp_ptr = NULL;\r
-       \r
-       return 0;\r
-}\r
-\r
-static const struct i2c_device_id gpioexp_i2c_id[] = {\r
-       { "gpioexp_aw9523b", 0 },{ }\r
-};\r
-\r
-static struct i2c_driver gpioexp_driver = {\r
-       .probe          = gpioexp_probe,\r
-       .remove         = __devexit_p(gpioexp_remove),\r
-       .id_table       = gpioexp_i2c_id,\r
-       .driver = {\r
-               .name   = "gpioexp_aw9523b",\r
-               .owner  = THIS_MODULE,\r
-       },\r
-};\r
-\r
-static int __init gpioexp_init(void)\r
-{\r
-    return i2c_add_driver(&gpioexp_driver);\r
-}\r
-\r
-static void __exit gpioexp_exit(void)\r
-{\r
-       i2c_del_driver(&gpioexp_driver);\r
-}\r
-\r
-subsys_initcall_sync(gpioexp_init);\r
-module_exit(gpioexp_exit);\r
-\r
-MODULE_LICENSE("GPL");\r
-\r
-\r
diff --git a/include/linux/gpio_exp_callpad.h b/include/linux/gpio_exp_callpad.h
deleted file mode 100755 (executable)
index 298882d..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef GPIO_EXP_CALLPAD_H\r
-#define GPIO_EXP_CALLPAD_H\r
-\r
-#define GPIOEXP_INT_TRIGGER_FALLING            0x01\r
-#define GPIOEXP_INT_TRIGGER_RISING             0x02\r
-#define GPIOEXP_INT_TRIGGER_MASK                       (GPIOEXP_INT_TRIGGER_FALLING | GPIOEXP_INT_TRIGGER_RISING)\r
-\r
-enum gpioexp_port_pin_num\r
-{\r
-       //P0\r
-       GPIOEXP_P0_0 = 0,\r
-       GPIOEXP_P0_1,\r
-       GPIOEXP_P0_2,\r
-       GPIOEXP_P0_3,\r
-       GPIOEXP_P0_4,\r
-       GPIOEXP_P0_5,\r
-       GPIOEXP_P0_6,\r
-       GPIOEXP_P0_7,\r
-       \r
-       //P1\r
-       GPIOEXP_P1_0,\r
-       GPIOEXP_P1_1,\r
-       GPIOEXP_P1_2,\r
-       GPIOEXP_P1_3,\r
-       GPIOEXP_P1_4,\r
-       GPIOEXP_P1_5,\r
-       GPIOEXP_P1_6,\r
-       GPIOEXP_P1_7,\r
-       GPIOEXP_PIN_MAX,\r
-};\r
-\r
-typedef void (*gpioexp_int_handler_t)(void *data);\r
-\r
-\r
-extern int gpioexp_set_direction(unsigned gpio, int is_in);\r
-extern int gpioexp_set_output_level(unsigned gpio, int value);\r
-extern int gpioexp_read_input_level(unsigned gpio);\r
-extern int gpioexp_request_irq(unsigned int irq, gpioexp_int_handler_t handler, unsigned long flags);\r
-extern int gpioexp_free_irq(unsigned int irq);\r
-extern int gpioexp_enable_irq(unsigned int irq);\r
-extern int gpioexp_disable_irq(unsigned int irq);\r
-       \r
-#endif\r