fix mpu issues on 1495c383330d098039a56fb0aa3f765bd3a21b6e
authorliuji <liuji@rock-chips.com>
Wed, 10 Aug 2011 09:40:48 +0000 (17:40 +0800)
committerliuji <liuji@rock-chips.com>
Wed, 10 Aug 2011 09:40:48 +0000 (17:40 +0800)
arch/arm/mach-rk29/board-rk29-ddr3sdk.c
arch/arm/mach-rk29/board-rk29sdk.c
drivers/misc/mpu3050/accel/mma845x.c
drivers/misc/mpu3050/mpuirq.c
drivers/misc/mpu3050/slaveirq.c

index 06a4a62e2b9b968029736d17a91bfb6363965629..f4e883fa9feefb8e375a5d015052db2b834ae5d3 100755 (executable)
@@ -492,7 +492,7 @@ static int mma8452_init_platform_hw(void)
 
 static struct mma8452_platform_data mma8452_info = {
   .model= 8452,
-  .swap_xy = 1,
+  .swap_xy = 0,
   .init_platform_hw= mma8452_init_platform_hw,
 
 };
index 302d76384b2f53b65900f0e52157eb97b73bf645..064441f203b5d02617f223d077fe1c06143bb7da 100755 (executable)
@@ -497,7 +497,7 @@ static int mma8452_init_platform_hw(void)
 
 static struct mma8452_platform_data mma8452_info = {
   .model= 8452,
-  .swap_xy = 1,
+  .swap_xy = 0,
   .init_platform_hw= mma8452_init_platform_hw,
 
 };
index 27150ad86994a4bd675df6f0f656f67c39fefd90..648cddbaa935e6a07a657dd6f301e682dbcf9a56 100755 (executable)
 #include <linux/module.h>
 #endif
 
-#include <stdlib.h>
+//#include <stdlib.h>
 #include "mpu.h"
 #include "mlsl.h"
 #include "mlos.h"
-#include <string.h>
+//#include <string.h>
 
 #include <log.h>
 #undef MPL_LOG_TAG
index ce1ad409cbf43f2de9033d767a5b21d60985700b..1aaaa685b827a44476d83406c01a4cf9c01862b5 100755 (executable)
@@ -29,6 +29,8 @@
 #include <linux/i2c-dev.h>
 #include <linux/workqueue.h>
 #include <linux/poll.h>
+#include <linux/gpio.h>
+#include <mach/gpio.h>
 
 #include <linux/errno.h>
 #include <linux/fs.h>
@@ -72,6 +74,9 @@ static int mpuirq_open(struct inode *inode, struct file *file)
                "%s current->pid %d\n", __func__, current->pid);
        mpuirq_dev_data.pid = current->pid;
        file->private_data = &mpuirq_dev_data;
+       /* we could do some checking on the flags supplied by "open" */
+       /* i.e. O_NONBLOCK */
+       /* -> set some flag to disable interruptible_sleep_on in mpuirq_read */
        return 0;
 }
 
@@ -274,10 +279,24 @@ int mpuirq_init(struct i2c_client *mpu_client)
                        flags = IRQF_TRIGGER_FALLING;
                else
                        flags = IRQF_TRIGGER_RISING;
-
-               res =
-                   request_irq(mpuirq_dev_data.irq, mpuirq_handler, flags,
-                               interface, &mpuirq_dev_data.irq);
+               /* mpu irq register xxm*/
+               res = gpio_request(mpuirq_dev_data.irq, "mpu3050_int");
+               if(res)
+               {
+                       printk("failed to request mpu3050_int GPIO %d\n",                       
+                                               gpio_to_irq(mpuirq_dev_data.irq));
+                       return res;
+               }
+               res = gpio_direction_input(mpuirq_dev_data.irq);
+               if(res)
+               {
+                       printk("failed to set mpu3050_int GPIO input\n");
+                       return res;
+               }
+               printk("gpio_to_irq(mpuirq_dev_data.irq) == %d \r\n",   
+                               gpio_to_irq(mpuirq_dev_data.irq));
+               res =request_irq(gpio_to_irq(mpuirq_dev_data.irq), mpuirq_handler, flags,
+                                                       interface,&mpuirq_dev_data.irq);
                if (res) {
                        dev_err(&mpu_client->adapter->dev,
                                "myirqtest: cannot register IRQ %d\n",
index a3c7bfec4b4b7079b492e31717d166db438f4955..0276ddb173fca2106ab6cea74fbdcfcaf51bb93a 100755 (executable)
@@ -28,6 +28,8 @@
 #include <linux/i2c.h>
 #include <linux/i2c-dev.h>
 #include <linux/poll.h>
+#include <linux/gpio.h>
+#include <mach/gpio.h>
 
 #include <linux/errno.h>
 #include <linux/fs.h>
@@ -225,10 +227,25 @@ int slaveirq_init(struct i2c_adapter *slave_adapter,
        data->data_ready = 0;
        data->timeout = 0;
 
+       /* mpu irq register xxm*/
+       res = gpio_request(data->irq, name);
+       if(res)
+       {
+               printk("failed to request %s GPIO %d\n",                        
+                                       name,data->irq);
+               return res;
+       }
+       res = gpio_direction_input(data->irq);
+       if(res)
+       {
+               printk("failed to set %s GPIO input\n",name);
+               return res;
+       }
+       printk("%s registing irq  == %d \r\n",name,gpio_to_irq(data->irq));
+       //gpio_pull_updown(data->irq, GPIOPullUp);
+       //gpio_set_value(data->irq,GPIO_HIGH);
        init_waitqueue_head(&data->slaveirq_wait);
-
-       res = request_irq(data->irq, slaveirq_handler, IRQF_TRIGGER_RISING,
-                         data->dev.name, data);
+       res = request_irq(gpio_to_irq(data->irq), slaveirq_handler, IRQF_TRIGGER_FALLING,data->dev.name, data);
 
        if (res) {
                dev_err(&slave_adapter->dev,