commit code adapte raho board
authorroot <root@nzy.(none)>
Sat, 4 Sep 2010 15:14:42 +0000 (23:14 +0800)
committerroot <root@nzy.(none)>
Sat, 4 Sep 2010 15:14:42 +0000 (23:14 +0800)
drivers/fpga/spi_gpio.c
drivers/input/gsensor/mma7660.c
drivers/input/misc/capella_cm3602.c
drivers/input/touchscreen/ctp_it7250.c
drivers/rtc/rtc-s35392a.c

index c4f03da142448b6311aa6a0dc24d8d409005cc53..bf3df3938cee1f8cc6b223589e4bb483165915d5 100755 (executable)
@@ -669,7 +669,10 @@ int spi_gpio_init_first(void)
        spi_gpio_set_pinlevel(SPI_GPIO_P2_15, SPI_GPIO_HIGH);           //TOUCH_SCREEN_RST output//\r
        spi_gpio_set_pindirection(SPI_GPIO_P2_15, SPI_GPIO_OUT);\r
 \r
-       spi_gpio_set_pindirection(SPI_GPIO_P4_06, SPI_GPIO_IN);         //CHARGER_INT_END input\r
+       //spi_gpio_set_pindirection(SPI_GPIO_P4_06, SPI_GPIO_IN);               //CHARGER_INT_END input\r
+       spi_gpio_set_pindirection(SPI_GPIO_P4_06, SPI_GPIO_OUT);                //CHARGER_INT_END output\r
+       spi_gpio_set_pinlevel(SPI_GPIO_P4_06, SPI_GPIO_LOW);            //CM3605_PWD low\r
+\r
        spi_gpio_set_pinlevel(SPI_GPIO_P4_07, SPI_GPIO_LOW);            //CM3605_PWD output\r
        spi_gpio_set_pindirection(SPI_GPIO_P4_07, SPI_GPIO_OUT);\r
        spi_gpio_set_pinlevel(SPI_GPIO_P4_08, SPI_GPIO_LOW);            //CM3605_PS_SHUTDOWN\r
@@ -877,10 +880,10 @@ static int _spi_gpio_irq_set_type(unsigned int irq, unsigned int type)
        }\r
        switch(type)\r
        {\r
-               case IRQF_TRIGGER_FALLING:\r
+               case GPIOEdgelFalling:\r
                        int_type = SPI_GPIO_EDGE_FALLING;\r
                        break;\r
-               case IRQF_TRIGGER_RISING:\r
+               case GPIOEdgelRising:\r
                        int_type = SPI_GPIO_EDGE_RISING;\r
                        break;\r
                default:\r
index eb2cfb00db3ee1e5b86ed116d054de37114900b6..a0c26b0f686db9f080164f902124978ebc68361f 100755 (executable)
@@ -530,6 +530,7 @@ static int  mma7660_probe(struct i2c_client *client, const struct i2c_device_id
        input_set_abs_params(mma7660->input_dev, ABS_Z, -1500, 1500, 0, 0);
 
        mma7660->input_dev->name = "compass";
+       mma7660->input_dev->dev.parent = &client->dev;
 
        err = input_register_device(mma7660->input_dev);
        if (err < 0) {
index 1788ba7de1f77a427178601e2baaa25bea056fbe..d34effaabc4327ac7794625a754442d28fdb1cb0 100755 (executable)
@@ -67,7 +67,7 @@ static int capella_cm3602_report(struct capella_cm3602_data *data)
 static irqreturn_t capella_cm3602_irq_handler(int irq, void *data)
 {
        struct capella_cm3602_data *ip = data;
-       printk("---capella_cm3602_irq_handler----\n");
+       //printk("---capella_cm3602_irq_handler----\n");
        //int val = capella_cm3602_report(ip);
        input_report_abs(ip->input_dev, ABS_DISTANCE, 0);
        input_sync(ip->input_dev);
@@ -119,13 +119,13 @@ void cm3602_work_handler(struct work_struct *work)
 
        struct capella_cm3602_data *pdata = container_of(work, struct capella_cm3602_data, cm3602_work);
        int val = gpio_get_value(pdata->pdata->irq_pin);
-       printk("-------------------cm3602_work_handler,pinlevel:%d----------------\n",val);
+       //printk("-------------------cm3602_work_handler,pinlevel:%d----------------\n",val);
        if (val == 1)
        {
                time_enable = false;
                input_report_abs(pdata->input_dev, ABS_DISTANCE, val);
                input_sync(pdata->input_dev);
-               printk("input_report_abs=%d\n",val);
+               //printk("input_report_abs=%d\n",val);
        }
        
 }
@@ -138,7 +138,7 @@ static void cm3602_timer(unsigned long data)
        add_timer(&ip->cm3602_timer);
        if(time_enable)
        {
-               printk("------------------cm3602_timer,%d------------\n",time_enable);
+               //printk("------------------cm3602_timer,%d------------\n",time_enable);
                queue_work(ip->cm3602_workqueue, &ip->cm3602_work);
        }
 
index 8f78ca76d33d2ae84faeba58b0de478a91aa87ba..26706afcfd4b9048d69c39b6b012ac3db8ed85f4 100755 (executable)
@@ -34,6 +34,8 @@ struct Ctp_it7250_data {
        struct i2c_client *client;
        struct delayed_work delaywork;\r
        int irq;  /* Our chip IRQ */\r
+       u32 temp_x;\r
+       u32 temp_y;\r
 };\r
 static struct i2c_client *Ctp_it7250_client;\r
 \r
@@ -190,7 +192,7 @@ static int Ctp_it7250_touch_open(struct input_dev *idev)
 \r
 static void Ctp_it7250_touch_close(struct input_dev *idev)\r
 {\r
-return 0;\r
+return ;\r
 }\r
 \r
 static irqreturn_t Ctp_it7250_touch_irq(int irq, void *dev_id)\r
@@ -200,7 +202,7 @@ static irqreturn_t Ctp_it7250_touch_irq(int irq, void *dev_id)
        //rk28printk("%s++++ %d \r\n",__FUNCTION__,__LINE__);\r
        disable_irq_nosync(irq);\r
        //rk28printk("%s++++ %d irq=%d\r\n",__FUNCTION__,__LINE__,irq);\r
-       schedule_delayed_work(&Ctp_it7250->delaywork,usecs_to_jiffies(5));      \r
+       schedule_delayed_work(&Ctp_it7250->delaywork,msecs_to_jiffies(10));     \r
        \r
        return IRQ_HANDLED; \r
                \r
@@ -223,7 +225,7 @@ static int ts_input_init(struct i2c_client *client)
 rk28printk("+++++++     %s+++++++\n", __FUNCTION__);\r
        Ctp_it7250->input_dev->name = "CTS_Ctp_it7250";\r
        Ctp_it7250->input_dev->phys = "CTS_Ctp_it7250/input1";\r
-       \r
+       Ctp_it7250->input_dev->dev.parent = &client->dev;\r
      //no need to open & close it,it will do it automaticlly;noted by robert\r
        Ctp_it7250->input_dev->open = Ctp_it7250_touch_open;\r
        Ctp_it7250->input_dev->close = Ctp_it7250_touch_close;\r
@@ -257,6 +259,7 @@ for (i = 0; i < ARRAY_SIZE(panel_key_info); i++)
 \r
 }\r
 \r
+#if 0\r
 static void CTS_configure_pin(struct i2c_client *client)\r
 {\r
        //add  reset pin;but we not used it ;robert\r
@@ -270,6 +273,8 @@ static void CTS_configure_pin(struct i2c_client *client)
        spi_gpio_set_pinlevel(SPI_GPIO_P2_15, SPI_GPIO_HIGH);\r
        mdelay(5);\r
 }\r
+#endif\r
+\r
 \r
 static int Ctp_it7250_init_irq(struct i2c_client *client)\r
 {\r
@@ -284,7 +289,7 @@ static int Ctp_it7250_init_irq(struct i2c_client *client)
        }
        ret = gpio_request(client->irq, "Ctp_it7250_int");\r
        if (ret) {
-               rk28printk( "failed to request Ctp_it7250_init_irq GPIO%d\n",client->irq);\r
+               rk28printk( "failed to request Ctp_it7250_init_irq GPIO%d\n",gpio_to_irq(client->irq));\r
                return ret;
        }\r
 #if 1\r
@@ -295,6 +300,7 @@ ret = gpio_direction_input(client->irq);
        }\r
        gpio_pull_updown(client->irq,GPIOPullUp);\r
 #endif\r
+       rk28printk("%s gpio_to_irq(%d) is %d\n",__FUNCTION__,client->irq,gpio_to_irq(client->irq));\r
                \r
        Ctp_it7250->irq = gpio_to_irq(client->irq);\r
        #endif\r
@@ -304,7 +310,7 @@ ret = gpio_direction_input(client->irq);
                rk28printk(KERN_ERR "Ctp_it7250_init_irq: request irq failed,ret is %d\n",ret);\r
         return ret;
        }\r
-       \r
+       return true;    \r
 }\r
 \r
 \r
@@ -348,10 +354,10 @@ int i;
                        ucQuery = QUERY_BUSY;\r
                }\r
        }while(ucQuery & QUERY_BUSY);\r
-       pucData[5]== 0 ;\r
-        pucData[6] == 0 ;\r
-        pucData[7] == 0 ;\r
-        pucData[8] == 0;\r
+       pucData[5]= 0 ;\r
+        pucData[6]= 0 ;\r
+        pucData[7]= 0 ;\r
+        pucData[8]= 0;\r
        // Read Command Response\r
        if(!ReadCommandResponseBuffer(client, pucData, ucReadLength))\r
        {\r
@@ -580,7 +586,7 @@ rk28printk("%s ReadCommandResponseBuffer EDN\r\n",__FUNCTION__);
        {\r
                * pucStep = pucData[6];\r
        }\r
-       rk28printk("%s x res=%d y res=%d \r\n",__FUNCTION__,*pwXResolution,* pwYResolution);\r
+       rk28printk("%s x res=%d y res=%d !\r\n",__FUNCTION__,*pwXResolution,* pwYResolution);\r
        return true;\r
 }\r
 \r
@@ -721,10 +727,12 @@ if (!GetFirmwareInformation (client))
 #endif\r
        return true;\r
 \r
+#if 0\r
 resetagin:\r
        if (!CaptouchReset(client))\r
                rk28printk("CaptouchReset success \r\n");\r
        mdelay(100);\r
+       #endif\r
 //     if (!CaptouchMode(client, 0x00))\r
        //      rk28printk("CaptouchMode success \r\n");\r
 }\r
@@ -798,7 +806,7 @@ gpucPointBuffer[i * 4 + 4];
 // Return value: \r
 //   return gesture ID\r
 // *******************************************************************************************\r
-int CaptouchGetGesture()\r
+int CaptouchGetGesture(void)\r
 {\r
        return (int)gpucPointBuffer[1];\r
 }\r
@@ -850,12 +858,18 @@ static void  Ctp_it7250_delaywork_func(struct work_struct  *work)
                                else if(dwTouchEvent <=MAX_FINGER_NUM) //CTP_MAX_FINGER_NUMBER)\r
                                {\r
                                        //SynchroSystemEvent(SYSTEM_TOUCH_EVENT_FINGER_ASSERT);\r
-                                       \r
+                       if ((abs(Ctp_it7250->temp_x -gpdwSampleX[0])>10)  ||( abs(Ctp_it7250->temp_y-gpdwSampleY[0])>10))\r
+                                       {\r
                                        input_report_abs(Ctp_it7250->input_dev, ABS_X, gpdwSampleX[0]);// & 0xfff\r
                                        input_report_abs(Ctp_it7250->input_dev, ABS_Y, gpdwSampleY[0]); //& 0xfff\r
                                        input_report_key(Ctp_it7250->input_dev,BTN_TOUCH, 1);\r
                                        input_sync(Ctp_it7250->input_dev);\r
                                        rk28printk("x=%d  y=%d \r\n",gpdwSampleX[0],gpdwSampleY[0]);\r
+                                       Ctp_it7250->temp_x=gpdwSampleX[0];\r
+                                       Ctp_it7250->temp_y=gpdwSampleY[0];\r
+                                       }\r
+                               else\r
+                                       rk28printk("the same \r\n");\r
                                }\r
                                else\r
                                {\r
@@ -942,8 +956,8 @@ static void  Ctp_it7250_delaywork_func(struct work_struct  *work)
  static int  Ctp_it7250_probe(struct i2c_client *client, const struct i2c_device_id *id)\r
 {\r
        struct Ctp_it7250_data *Ctp_it7250;\r
-       u16 TempReg=0x0;\r
-       u16 val=0x0;\r
+//     u16 TempReg=0x0;\r
+//     u16 val=0x0;\r
        \r
        Ctp_it7250_client = client;\r
        rk28printk("+++++++     %s+++++++\n", __FUNCTION__);\r
index 05ceb9d8b556f8fc980ab463d148acb51b36b5af..ba06f22f585f6fcbad2f2e4c1e09cd8a19b7d6c6 100755 (executable)
@@ -22,7 +22,6 @@
 #include <mach/gpio.h>\r
 #include "rtc-s35392a.h"\r
 \r
-#define RTC_S35392A_INT        RK2818_PIN_PE2  //\r
 #define RTC_RATE       100 * 1000\r
 #define S35392_TEST 0\r
 \r
@@ -578,12 +577,17 @@ static int s35392a_reset(struct s35392a *s35392a)
        \r
        if (s35392a_get_reg(s35392a, S35392A_CMD_STATUS1, buf, sizeof(buf)) < 0)\r
                return -EIO;    \r
-       if (!(buf[0] & (S35392A_FLAG_POC | S35392A_FLAG_BLD)))\r
+       if (!(buf[0] & (S35392A_FLAG_POC | S35392A_FLAG_BLD))) {\r
+        buf[0] = 0x00;\r
+        s35392a_set_reg(s35392a, S35392A_CMD_STATUS2, buf, 1);   \r
+        s35392a_set_reg(s35392a, S35392A_CMD_INT2, buf, 1);\r
                return 0;\r
+       }\r
 \r
        buf[0] |= (S35392A_FLAG_RESET | S35392A_FLAG_24H);\r
        buf[0] &= 0xf0;\r
        s35392a_set_reg(s35392a, S35392A_CMD_STATUS1, buf, sizeof(buf));\r
+       \r
        //s35392a_set_init_time( s35392a);      \r
        return 0;               \r
 }\r
@@ -823,16 +827,18 @@ static int s35392a_probe(struct i2c_client *client,
                goto exit_dummy;\r
        }\r
        \r
-       if(err = gpio_request(RTC_S35392A_INT, "rtc gpio"))\r
+       if(err = gpio_request(client->irq, "rtc gpio"))\r
        {\r
                dev_err(&client->dev, "gpio request fail\n");\r
-               gpio_free(RTC_S35392A_INT);\r
+               gpio_free(client->irq);\r
                goto exit_dummy;\r
        }\r
 \r
-       gpio_pull_updown(RTC_S35392A_INT,GPIOPullDown);\r
+       gpio_pull_updown(client->irq,GPIOPullDown);\r
+\r
+       client->irq = gpio_to_irq(client->irq);\r
        \r
-       if(err = request_irq(gpio_to_irq(RTC_S35392A_INT),s35392a_wakeup_irq,IRQF_TRIGGER_HIGH,NULL,s35392a) <0)        \r
+       if(err = request_irq(client->irq, s35392a_wakeup_irq,IRQF_TRIGGER_HIGH,NULL,s35392a) <0)        \r
        {\r
                printk("unable to request rtc irq\n");\r
                goto exit_dummy;\r