From b6d1a303ecb43dbb4e030bca9dcb016f5e558138 Mon Sep 17 00:00:00 2001 From: liuji Date: Wed, 10 Aug 2011 15:07:02 +0800 Subject: [PATCH] path mpu code --- drivers/misc/Kconfig | 4 --- drivers/misc/Makefile | 2 -- drivers/misc/mpu3050/Kconfig | 0 drivers/misc/mpu3050/Makefile | 0 drivers/misc/mpu3050/README | 0 drivers/misc/mpu3050/accel/adxl346.c | 0 drivers/misc/mpu3050/accel/bma150.c | 0 drivers/misc/mpu3050/accel/bma222.c | 0 drivers/misc/mpu3050/accel/cma3000.c | 0 drivers/misc/mpu3050/accel/kxsd9.c | 0 drivers/misc/mpu3050/accel/kxtf9.c | 0 drivers/misc/mpu3050/accel/lis331.c | 0 drivers/misc/mpu3050/accel/lis3dh.c | 0 drivers/misc/mpu3050/accel/lsm303a.c | 0 drivers/misc/mpu3050/accel/mantis.c | 0 drivers/misc/mpu3050/accel/mma8450.c | 0 drivers/misc/mpu3050/accel/mma845x.c | 4 +-- drivers/misc/mpu3050/compass/ak8975.c | 0 drivers/misc/mpu3050/compass/ami306.c | 0 drivers/misc/mpu3050/compass/ami30x.c | 0 drivers/misc/mpu3050/compass/hmc5883.c | 0 drivers/misc/mpu3050/compass/hscdtd002b.c | 0 drivers/misc/mpu3050/compass/hscdtd004a.c | 0 drivers/misc/mpu3050/compass/lsm303m.c | 0 drivers/misc/mpu3050/compass/mmc314x.c | 0 drivers/misc/mpu3050/compass/yas529-kernel.c | 0 drivers/misc/mpu3050/compass/yas530-kernel.c | 0 drivers/misc/mpu3050/compass/yas530.c | 0 drivers/misc/mpu3050/log.h | 0 drivers/misc/mpu3050/mldl_cfg.c | 0 drivers/misc/mpu3050/mldl_cfg.h | 0 drivers/misc/mpu3050/mlos-kernel.c | 0 drivers/misc/mpu3050/mlos.h | 0 drivers/misc/mpu3050/mlsl-kernel.c | 0 drivers/misc/mpu3050/mlsl.h | 0 drivers/misc/mpu3050/mltypes.h | 0 drivers/misc/mpu3050/mpu-dev.c | 0 drivers/misc/mpu3050/mpu-i2c.c | 0 drivers/misc/mpu3050/mpu-i2c.h | 0 drivers/misc/mpu3050/mpuirq.c | 27 +++++++++++++++++--- drivers/misc/mpu3050/mpuirq.h | 0 drivers/misc/mpu3050/slaveirq.c | 23 ++++++++++++++--- drivers/misc/mpu3050/slaveirq.h | 0 drivers/misc/mpu3050/timerirq.c | 0 drivers/misc/mpu3050/timerirq.h | 0 include/linux/mpu.h | 0 include/linux/mpu3050.h | 0 include/linux/mpu6000.h | 0 48 files changed, 45 insertions(+), 15 deletions(-) mode change 100755 => 100644 drivers/misc/Kconfig mode change 100755 => 100644 drivers/misc/Makefile mode change 100755 => 100644 drivers/misc/mpu3050/Kconfig mode change 100755 => 100644 drivers/misc/mpu3050/Makefile mode change 100755 => 100644 drivers/misc/mpu3050/README mode change 100755 => 100644 drivers/misc/mpu3050/accel/adxl346.c mode change 100755 => 100644 drivers/misc/mpu3050/accel/bma150.c mode change 100755 => 100644 drivers/misc/mpu3050/accel/bma222.c mode change 100755 => 100644 drivers/misc/mpu3050/accel/cma3000.c mode change 100755 => 100644 drivers/misc/mpu3050/accel/kxsd9.c mode change 100755 => 100644 drivers/misc/mpu3050/accel/kxtf9.c mode change 100755 => 100644 drivers/misc/mpu3050/accel/lis331.c mode change 100755 => 100644 drivers/misc/mpu3050/accel/lis3dh.c mode change 100755 => 100644 drivers/misc/mpu3050/accel/lsm303a.c mode change 100755 => 100644 drivers/misc/mpu3050/accel/mantis.c mode change 100755 => 100644 drivers/misc/mpu3050/accel/mma8450.c mode change 100755 => 100644 drivers/misc/mpu3050/accel/mma845x.c mode change 100755 => 100644 drivers/misc/mpu3050/compass/ak8975.c mode change 100755 => 100644 drivers/misc/mpu3050/compass/ami306.c mode change 100755 => 100644 drivers/misc/mpu3050/compass/ami30x.c mode change 100755 => 100644 drivers/misc/mpu3050/compass/hmc5883.c mode change 100755 => 100644 drivers/misc/mpu3050/compass/hscdtd002b.c mode change 100755 => 100644 drivers/misc/mpu3050/compass/hscdtd004a.c mode change 100755 => 100644 drivers/misc/mpu3050/compass/lsm303m.c mode change 100755 => 100644 drivers/misc/mpu3050/compass/mmc314x.c mode change 100755 => 100644 drivers/misc/mpu3050/compass/yas529-kernel.c mode change 100755 => 100644 drivers/misc/mpu3050/compass/yas530-kernel.c mode change 100755 => 100644 drivers/misc/mpu3050/compass/yas530.c mode change 100755 => 100644 drivers/misc/mpu3050/log.h mode change 100755 => 100644 drivers/misc/mpu3050/mldl_cfg.c mode change 100755 => 100644 drivers/misc/mpu3050/mldl_cfg.h mode change 100755 => 100644 drivers/misc/mpu3050/mlos-kernel.c mode change 100755 => 100644 drivers/misc/mpu3050/mlos.h mode change 100755 => 100644 drivers/misc/mpu3050/mlsl-kernel.c mode change 100755 => 100644 drivers/misc/mpu3050/mlsl.h mode change 100755 => 100644 drivers/misc/mpu3050/mltypes.h mode change 100755 => 100644 drivers/misc/mpu3050/mpu-dev.c mode change 100755 => 100644 drivers/misc/mpu3050/mpu-i2c.c mode change 100755 => 100644 drivers/misc/mpu3050/mpu-i2c.h mode change 100755 => 100644 drivers/misc/mpu3050/mpuirq.c mode change 100755 => 100644 drivers/misc/mpu3050/mpuirq.h mode change 100755 => 100644 drivers/misc/mpu3050/slaveirq.c mode change 100755 => 100644 drivers/misc/mpu3050/slaveirq.h mode change 100755 => 100644 drivers/misc/mpu3050/timerirq.c mode change 100755 => 100644 drivers/misc/mpu3050/timerirq.h mode change 100755 => 100644 include/linux/mpu.h mode change 100755 => 100644 include/linux/mpu3050.h mode change 100755 => 100644 include/linux/mpu6000.h diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig old mode 100755 new mode 100644 index 0d3ad52ea80d..b47b6b51cfde --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -300,10 +300,6 @@ config MU509 bool "MU509 modem control driver" default n -config RK29_NEWTON - bool "RK29_NEWTON misc driver" - default n - source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig" diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile old mode 100755 new mode 100644 index c3dc3cf11ce2..73819025e527 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -35,5 +35,3 @@ obj-$(CONFIG_STE) += ste.o obj-$(CONFIG_RK29_SUPPORT_MODEM) += rk29_modem/ obj-$(CONFIG_GPS_GNS7560) += gps/ obj-y += mpu3050/ -obj-$(CONFIG_RK29_NEWTON) += newton.o - diff --git a/drivers/misc/mpu3050/Kconfig b/drivers/misc/mpu3050/Kconfig old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/Makefile b/drivers/misc/mpu3050/Makefile old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/README b/drivers/misc/mpu3050/README old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/accel/adxl346.c b/drivers/misc/mpu3050/accel/adxl346.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/accel/bma150.c b/drivers/misc/mpu3050/accel/bma150.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/accel/bma222.c b/drivers/misc/mpu3050/accel/bma222.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/accel/cma3000.c b/drivers/misc/mpu3050/accel/cma3000.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/accel/kxsd9.c b/drivers/misc/mpu3050/accel/kxsd9.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/accel/kxtf9.c b/drivers/misc/mpu3050/accel/kxtf9.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/accel/lis331.c b/drivers/misc/mpu3050/accel/lis331.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/accel/lis3dh.c b/drivers/misc/mpu3050/accel/lis3dh.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/accel/lsm303a.c b/drivers/misc/mpu3050/accel/lsm303a.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/accel/mantis.c b/drivers/misc/mpu3050/accel/mantis.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/accel/mma8450.c b/drivers/misc/mpu3050/accel/mma8450.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/accel/mma845x.c b/drivers/misc/mpu3050/accel/mma845x.c old mode 100755 new mode 100644 index 27150ad86994..648cddbaa935 --- a/drivers/misc/mpu3050/accel/mma845x.c +++ b/drivers/misc/mpu3050/accel/mma845x.c @@ -35,11 +35,11 @@ #include #endif -#include +//#include #include "mpu.h" #include "mlsl.h" #include "mlos.h" -#include +//#include #include #undef MPL_LOG_TAG diff --git a/drivers/misc/mpu3050/compass/ak8975.c b/drivers/misc/mpu3050/compass/ak8975.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/compass/ami306.c b/drivers/misc/mpu3050/compass/ami306.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/compass/ami30x.c b/drivers/misc/mpu3050/compass/ami30x.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/compass/hmc5883.c b/drivers/misc/mpu3050/compass/hmc5883.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/compass/hscdtd002b.c b/drivers/misc/mpu3050/compass/hscdtd002b.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/compass/hscdtd004a.c b/drivers/misc/mpu3050/compass/hscdtd004a.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/compass/lsm303m.c b/drivers/misc/mpu3050/compass/lsm303m.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/compass/mmc314x.c b/drivers/misc/mpu3050/compass/mmc314x.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/compass/yas529-kernel.c b/drivers/misc/mpu3050/compass/yas529-kernel.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/compass/yas530-kernel.c b/drivers/misc/mpu3050/compass/yas530-kernel.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/compass/yas530.c b/drivers/misc/mpu3050/compass/yas530.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/log.h b/drivers/misc/mpu3050/log.h old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/mldl_cfg.c b/drivers/misc/mpu3050/mldl_cfg.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/mldl_cfg.h b/drivers/misc/mpu3050/mldl_cfg.h old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/mlos-kernel.c b/drivers/misc/mpu3050/mlos-kernel.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/mlos.h b/drivers/misc/mpu3050/mlos.h old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/mlsl-kernel.c b/drivers/misc/mpu3050/mlsl-kernel.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/mlsl.h b/drivers/misc/mpu3050/mlsl.h old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/mltypes.h b/drivers/misc/mpu3050/mltypes.h old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/mpu-dev.c b/drivers/misc/mpu3050/mpu-dev.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/mpu-i2c.c b/drivers/misc/mpu3050/mpu-i2c.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/mpu-i2c.h b/drivers/misc/mpu3050/mpu-i2c.h old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/mpuirq.c b/drivers/misc/mpu3050/mpuirq.c old mode 100755 new mode 100644 index ce1ad409cbf4..1aaaa685b827 --- a/drivers/misc/mpu3050/mpuirq.c +++ b/drivers/misc/mpu3050/mpuirq.c @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include #include @@ -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", diff --git a/drivers/misc/mpu3050/mpuirq.h b/drivers/misc/mpu3050/mpuirq.h old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/slaveirq.c b/drivers/misc/mpu3050/slaveirq.c old mode 100755 new mode 100644 index a3c7bfec4b4b..0276ddb173fc --- a/drivers/misc/mpu3050/slaveirq.c +++ b/drivers/misc/mpu3050/slaveirq.c @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include @@ -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, diff --git a/drivers/misc/mpu3050/slaveirq.h b/drivers/misc/mpu3050/slaveirq.h old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/timerirq.c b/drivers/misc/mpu3050/timerirq.c old mode 100755 new mode 100644 diff --git a/drivers/misc/mpu3050/timerirq.h b/drivers/misc/mpu3050/timerirq.h old mode 100755 new mode 100644 diff --git a/include/linux/mpu.h b/include/linux/mpu.h old mode 100755 new mode 100644 diff --git a/include/linux/mpu3050.h b/include/linux/mpu3050.h old mode 100755 new mode 100644 diff --git a/include/linux/mpu6000.h b/include/linux/mpu6000.h old mode 100755 new mode 100644 -- 2.34.1