#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>
"%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;
}
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",
#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>
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,