diff options
| -rw-r--r-- | arch/arm/boot/dts/omap3_h1.dts | 59 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/board-omap3h1.c | 10 | ||||
| -rw-r--r-- | drivers/staging/iio/imu/inv_mpu/inv_mpu_core.c | 23 |
3 files changed, 70 insertions, 22 deletions
diff --git a/arch/arm/boot/dts/omap3_h1.dts b/arch/arm/boot/dts/omap3_h1.dts index e2244dc83d0..235a7cbe377 100644 --- a/arch/arm/boot/dts/omap3_h1.dts +++ b/arch/arm/boot/dts/omap3_h1.dts @@ -55,14 +55,37 @@ }; }; + /* Test code for the ACC input pin. Should be disabled when + * we're using the accelerometer. + */ + + gpio_buttons: gpio_buttons@0 { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + /* + interrupt-parent = <&gpio1>; + interrupts = <31>; + wakeup-source; + */ + + power { + label = "mattis_button"; + linux,code = <116>; + gpios = <&gpio1 31 1>; + gpio-key,wakeup; + }; + }; + + pad-wkup { /* on omap, the irqs are calculated as follows: * for the 96 intc IRQs * irq = 16 + irq_offset (from TRM sec 12.3.2) - * for a gpio IRQ (banks numbered 1 to 6 - * irq = 16 + 96 + (gpio_bank - 1) * 32 + * for a gpio IRQ (banks numbered 1 to 6) + * irq = 16 + 96 + (gpio_bank - 1) * 32 + GPIO no. */ - compatible = "ti,pad-wkup"; + compatible = "ti,pad-wkup"; /* Map the pad offset (off) to an interrupt (IRQ). */ /* if handle is 1, an irq will be generated based on */ @@ -81,6 +104,7 @@ <0x1b0 23 1>; /* sys_nirq */ }; + /* gpio-keys { compatible = "gpio-keys"; @@ -90,7 +114,7 @@ gpio-key,wakeup; linux,code = <169>; }; - }; + };*/ }; &vc { @@ -160,6 +184,7 @@ 0x5ba 0x004 /* ETK_D7, MODE4 | OUTPUT */ 0x1b0 0xc100 /* SYS_NIRQ, MODE0 | INPUT | OFFWAKEUP */ + 0x0dc 0x004 /* CAM_HS, MODE4 | OUTPUT */ /* USB */ @@ -185,8 +210,10 @@ 0x0da 0x1204 /* DSS_DATA23, (IDIS | PI | M4 ) */ /* Accelerometer interrupt */ + /* I've tried configuring this both in the wkup pinmux (below) and here, + but this location makes it not function as an interrupt... ??? */ /* 0x9f6 0x4104 */ /* JTAG_EMU1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT | - OMAP_PIN_OFF_WAKEUPENABLE */ + OMAP_PIN_OFF_WAKEUPENABLE */ >; }; @@ -225,7 +252,7 @@ pinctrl-names = "default"; pinctrl-0 = <&wkup_pins>; - wkup_pins: pinmux_wakeup_pins { + wkup_pins: pinmux_wakeup_pins { pinctrl-single,pins = < 0x006 0x008 /* SYS_CLKREQ, MODE0 | PULLDOWN */ 0x018 0x000 /* SYS_OFF_MODE, MODE0 */ @@ -252,7 +279,7 @@ }; }; -#include "tps65910.dtsi" +/include/ "tps65910.dtsi" &tps { interrupts = <7>; /* SYS_NIRQ */ @@ -316,17 +343,20 @@ /* not used, I think */ vdd3_reg: regulator@4 { status = "disabled"; + ti,regulator-ext-sleep-control = <8>; }; + /* This is the accelerometer. We always want it on. */ vdig1_reg: regulator@5 { regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; - regulator-always-on; + regulator-always-on; }; /* vdig2_reg: regulator@6 {}; unused */ vdig2_reg: regulator@6 { status = "disabled"; + ti,regulator-ext-sleep-control = <8>; }; /* Nobody is explicitly using this rail, but it seems like it goes to @@ -334,17 +364,19 @@ */ vpll_reg: regulator@7 { regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <1800000>; - regulator-always-on; + regulator-max-microvolt = <1800000>; + ti,regulator-ext-sleep-control = <8>; }; /* vdac_reg: regulator@8 {}; unused */ vdac_reg: regulator@8 { status = "disabled"; + ti,regulator-ext-sleep-control = <8>; }; vaux1_reg: regulator@9 { /* not used, 2.85V by default */ status = "disabled"; + ti,regulator-ext-sleep-control = <8>; }; vaux2_reg: regulator@10 { @@ -352,12 +384,14 @@ regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-always-on; + ti,regulator-ext-sleep-control = <8>; }; vaux33_reg: regulator@11 { regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-always-on; + ti,regulator-ext-sleep-control = <8>; }; /* This one goes to both SPI (for DSS) and touch. How can I @@ -367,6 +401,7 @@ regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-always-on; + ti,regulator-ext-sleep-control = <8>; }; }; }; @@ -375,8 +410,8 @@ /* leave gpio bank interface clocks on during suspend * to avoid race condition in gpio_irq_handler */ &gpio1 { - ti,no_idle_on_suspend; -}; + ti,no_idle_on_suspend; + }; &gpio2 { ti,no_idle_on_suspend; diff --git a/arch/arm/mach-omap2/board-omap3h1.c b/arch/arm/mach-omap2/board-omap3h1.c index 9c161fb4678..02369be990c 100644 --- a/arch/arm/mach-omap2/board-omap3h1.c +++ b/arch/arm/mach-omap2/board-omap3h1.c @@ -72,7 +72,7 @@ #define NAND_CS 0 -#define MPUIRQ_GPIO 31 +// #define MPUIRQ_GPIO 31 #define ATMEL_MXT_GPIO 105 #define TPS_SYS_NIRQ 0 #define USB_IRQ 124 @@ -305,7 +305,7 @@ static struct i2c_board_info __initdata omap3h1_i2c3_board_info[] = { static int __init omap3_h1_i2c_init(void) { - int acc_irq; + // int acc_irq; /* In Linux 3.10 we need to request an IRQ through * gpio_to_irq. This means it can't be set at compile time, and @@ -313,13 +313,13 @@ static int __init omap3_h1_i2c_init(void) */ gpio_request_one(ATMEL_MXT_GPIO, GPIOF_IN, "atmel_mxt_ts CHG"); - gpio_request_one(MPUIRQ_GPIO, GPIOF_IN, "mpu6515 IRQ pin"); + // gpio_request_one(MPUIRQ_GPIO, GPIOF_IN, "mpu6515 IRQ pin"); - acc_irq = gpio_to_irq(MPUIRQ_GPIO); + // acc_irq = gpio_to_irq(MPUIRQ_GPIO); #ifdef CONFIG_MACH_OMAP3_H1_DVT2 omap3h1_i2c2_board_info[2].irq = gpio_to_irq(ATMEL_MXT_GPIO); - omap3h1_i2c2_board_info[0].irq = acc_irq; + // omap3h1_i2c2_board_info[0].irq = acc_irq; // ((struct tps65910_board *) (omap3h1_i2c1_board_info[0].platform_data))->irq = // gpio_to_irq (TPS_SYS_NIRQ); diff --git a/drivers/staging/iio/imu/inv_mpu/inv_mpu_core.c b/drivers/staging/iio/imu/inv_mpu/inv_mpu_core.c index 94c6b5d49ae..82bfbed35a4 100644 --- a/drivers/staging/iio/imu/inv_mpu/inv_mpu_core.c +++ b/drivers/staging/iio/imu/inv_mpu/inv_mpu_core.c @@ -2473,8 +2473,10 @@ static int inv_check_chip_type(struct inv_mpu_state *st, st->setup_reg(reg); /* reset to make sure previous state are not there */ result = inv_i2c_single_write(st, reg->pwr_mgmt_1, BIT_H_RESET); - if (result) - return result; + if (result) { + printk ("OLIO: %s: Couldn't write to i2c bus (result = %d)\n", __FUNCTION__, result); + return result; + } msleep(POWER_UP_TIME); /* toggle power state */ result = st->set_power_state(st, false); @@ -2674,6 +2676,7 @@ static int inv_mpu_probe(struct i2c_client *client, #ifdef CONFIG_DTS_INV_MPU_IIO enable_irq_wake(client->irq); #endif + enable_irq_wake(client->irq); if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { result = -ENOSYS; @@ -2705,15 +2708,17 @@ static int inv_mpu_probe(struct i2c_client *client, } } -msleep(100); + msleep(100); #else /* power is turned on inside check chip type */ st->plat_data = *(struct mpu_platform_data *)dev_get_platdata(&client->dev); #endif result = inv_check_chip_type(st, id); - if (result) + if (result) { + printk ("OLIO: %s: Couldn't get chip type (result = %d).\n", __FUNCTION__, result); goto out_free; + } result = st->init_config(indio_dev); if (result) { @@ -2783,19 +2788,27 @@ msleep(100); dev_info(&client->dev, "%s is ready to go!\n", indio_dev->name); + device_set_wakeup_capable((struct device *) indio_dev, true); + return 0; out_unreg_iio: + printk ("OLIO: %s: out_unreg_iio\n", __FUNCTION__); iio_device_unregister(indio_dev); out_remove_trigger: + printk ("OLIO: %s: out_remove_trigger\n", __FUNCTION__); if (indio_dev->modes & INDIO_BUFFER_TRIGGERED) inv_mpu_remove_trigger(indio_dev); out_remove_ring: + printk ("OLIO: %s: out_remove_ring\n", __FUNCTION__); iio_buffer_unregister(indio_dev); out_unreg_ring: + printk ("OLIO: %s: out_unreg_ring\n", __FUNCTION__); inv_mpu_unconfigure_ring(indio_dev); out_free: + printk ("OLIO: %s: out_free\n", __FUNCTION__); iio_device_free(indio_dev); out_no_free: + printk ("OLIO: %s: out_no_free\n", __FUNCTION__); dev_err(&client->adapter->dev, "%s failed %d\n", __func__, result); return -EIO; } @@ -3118,7 +3131,7 @@ static struct i2c_driver inv_mpu_driver = { .driver = { .owner = THIS_MODULE, .name = "inv-mpu-iio", - .pm = INV_MPU_PMOPS, + .pm = INV_MPU_PMOPS, }, .address_list = normal_i2c, }; |