diff options
| -rw-r--r-- | arch/arm/mach-omap2/board-omap3h1.c | 129 | ||||
| -rw-r--r-- | drivers/staging/iio/imu/inv_mpu/inv_mpu_core.c | 4 | ||||
| -rw-r--r-- | drivers/staging/iio/imu/inv_mpu/olio_specials.h | 2 | 
3 files changed, 114 insertions, 21 deletions
| diff --git a/arch/arm/mach-omap2/board-omap3h1.c b/arch/arm/mach-omap2/board-omap3h1.c index ef85cf0722f..9d0ab442fea 100644 --- a/arch/arm/mach-omap2/board-omap3h1.c +++ b/arch/arm/mach-omap2/board-omap3h1.c @@ -178,9 +178,9 @@ static int __init omap3h1_spi_init(void) {  static struct mpu_platform_data mpu_data = {  	.int_config  = 0x00,  	.level_shifter = 1, -	.orientation = {   -1,  0,  0, -					   0,  1,  0, -					   0,  0,  -1 }, +	.orientation = {    0,  1,  0, +					    1,  0,  0, +					    0,  0,  1 },  };  static struct lm3530_platform_data omap3h1_backlight_platform_data = { @@ -310,7 +310,7 @@ static struct regulator_init_data tps65910_dummy = {  /* --------------------------------------------------------------------------- */  static struct regulator_consumer_supply tps65910_touch3_supply[] = { -    REGULATOR_SUPPLY("avdd", "1-004a"), +    REGULATOR_SUPPLY("avdd", "2-004a"),  };  static struct regulator_init_data tps65910_touch3 = { @@ -318,8 +318,9 @@ static struct regulator_init_data tps65910_touch3 = {      .constraints = {          .min_uV            = 3300000,          .max_uV            = 3300000, -        .valid_modes_mask  = REGULATOR_MODE_NORMAL, -        .valid_ops_mask    = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, +        .valid_modes_mask  = REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY, +        .valid_ops_mask    = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS  +                             | REGULATOR_CHANGE_MODE,          .always_on         = true,          .apply_uV		   = true,      }, @@ -384,8 +385,8 @@ static struct regulator_init_data tps65910_1v8 = {      .constraints = {          .min_uV            = 1800000,          .max_uV            = 1800000, -        .valid_modes_mask  = REGULATOR_MODE_NORMAL, -        .valid_ops_mask    = REGULATOR_CHANGE_VOLTAGE, +        .valid_modes_mask  = REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY, +        .valid_ops_mask    = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,          .always_on         = false,          .apply_uV		   = true,      }, @@ -416,7 +417,7 @@ static struct regulator_init_data tps65910_vpll = {  /* --------------------------------------------------------------------------- */  static struct regulator_consumer_supply tps65910_touch_supply[] = { -    REGULATOR_SUPPLY("vdd", "1-004a" ), +    REGULATOR_SUPPLY("vdd", "2-004a" ),  };  static struct regulator_init_data tps65910_touch = { @@ -528,6 +529,84 @@ static struct tps65910_board omap3h1_tps65910_pdata = {      .pm_off = true,  }; + +/* ====================================================================== */ +/* Voltage domain settings  */ + + +#define OMAP3_SRI2C_SLAVE_ADDR		0x12 +#define OMAP3_VDD_MPU_SR_CONTROL_REG	0x00 +#define OMAP3_VDD_CORE_SR_CONTROL_REG	0x01 +#define OMAP3_VP_CONFIG_ERROROFFSET	0x00 +#define OMAP3_VP_VSTEPMIN_VSTEPMIN	0x1 +#define OMAP3_VP_VSTEPMAX_VSTEPMAX	0x04 +#define OMAP3_VP_VLIMITTO_TIMEOUT_US	200 + + +static unsigned long olio_vsel_to_uv(const u8 vsel) +{ +	return (((vsel * 125) + 6000)) * 100; +} + +static u8 olio_uv_to_vsel(unsigned long uv) +{ +	return DIV_ROUND_UP(uv - 600000, 12500); +} + + +static struct omap_voltdm_pmic omap3_mpu_pmic = { +	.slew_rate		= 4000, +	.step_size		= 12500, +	.vp_erroroffset		= OMAP3_VP_CONFIG_ERROROFFSET, +	.vp_vstepmin		= OMAP3_VP_VSTEPMIN_VSTEPMIN, +	.vp_vstepmax		= OMAP3_VP_VSTEPMAX_VSTEPMAX, +	.vddmin			= 900000, +	.vddmax			= 1350000, +	.vp_timeout_us		= OMAP3_VP_VLIMITTO_TIMEOUT_US, +	.i2c_slave_addr		= OMAP3_SRI2C_SLAVE_ADDR, +	.volt_reg_addr		= OMAP3_VDD_MPU_SR_CONTROL_REG, +	.i2c_high_speed		= true, +	.vsel_to_uv		= olio_vsel_to_uv, +	.uv_to_vsel		= olio_uv_to_vsel, +}; + +static struct omap_voltdm_pmic omap3_core_pmic = { +	.slew_rate		= 4000, +	.step_size		= 12500, +	.vp_erroroffset		= OMAP3_VP_CONFIG_ERROROFFSET, +	.vp_vstepmin		= OMAP3_VP_VSTEPMIN_VSTEPMIN, +	.vp_vstepmax		= OMAP3_VP_VSTEPMAX_VSTEPMAX, +	.vddmin			= 900000, +	.vddmax			= 1200000, +	.vp_timeout_us		= OMAP3_VP_VLIMITTO_TIMEOUT_US, +	.i2c_slave_addr		= OMAP3_SRI2C_SLAVE_ADDR, +	.volt_reg_addr		= OMAP3_VDD_CORE_SR_CONTROL_REG, +	.i2c_high_speed		= true, +	.vsel_to_uv		= olio_vsel_to_uv, +	.uv_to_vsel		= olio_uv_to_vsel, +}; + +int __init omap3_voltdm_init(void) +{ +	struct voltagedomain *voltdm; + +	if (!cpu_is_omap34xx()) +		return -ENODEV; + +	voltdm = voltdm_lookup("mpu_iva"); +	omap_voltage_register_pmic(voltdm, &omap3_mpu_pmic); + +	voltdm = voltdm_lookup("core"); +	omap_voltage_register_pmic(voltdm, &omap3_core_pmic); + +	return 0; +} + + + +/* ====================================================================== */ + +  static struct i2c_board_info __initdata omap3h1_i2c1_board_info[] = {           {              I2C_BOARD_INFO("tps65910", 0x2d), @@ -662,10 +741,12 @@ static const struct file_operations h1_fops = {   * mode stuff).   */ -#define OLIO_DOUBLE_TAP 800 +#define OLIO_DOUBLE_TAP 500  #define OLIO_ONE_SECOND 1000 +#define OLIO_DT_WAIT 3000  static unsigned long previous; +static unsigned long previous_double;  static irqreturn_t acc_irq_handler_thr(int irq, void * omap3h1_d) {    /* struct platform_device** omap3h1_devs = (struct platform_device **) omap3h1_d; */ @@ -678,7 +759,16 @@ static irqreturn_t acc_irq_handler_thr(int irq, void * omap3h1_d) {    now = jiffies;    if (jiffies_to_msecs(now - previous) < OLIO_DOUBLE_TAP) { -    printk (KERN_DEBUG "Double tap detected!\n");     + +    /* ignore double clicks that happens too soon from the previous one */ +    if (jiffies_to_msecs (now - previous_double) < OLIO_DT_WAIT) +    { +      previous = 0; +      return IRQ_HANDLED; +    } + +    printk (KERN_DEBUG "Double tap detected!\n"); +      /* We want to wake up. Take wake lock (and send signal to user space?)       * BT driver only takes wake lock, then lets higher levels handle        * everything ... but what if there's nothing there to take the lock? @@ -686,7 +776,8 @@ static irqreturn_t acc_irq_handler_thr(int irq, void * omap3h1_d) {      send_wake_signal();          wake_lock_timeout (&acc_wake.lock, msecs_to_jiffies (2 * OLIO_ONE_SECOND)); - +     +    previous_double = now;      previous = 0;    } else {      previous = now; @@ -739,8 +830,6 @@ 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(ON_OFF_BUTTON_GPIO, GPIOF_OUT_INIT_LOW, "on-off button"); -      acc_irq = gpio_to_irq(MPUIRQ_GPIO);  #ifdef CONFIG_MACH_OMAP3_H1_DVT2 @@ -879,15 +968,19 @@ static void __init omap3_h1_init(void)  	usb_bind_phy("musb-hdrc.0.auto", 0, "nop_usb_xceiv"); /* "tusb-usb-h1" */  	usb_musb_init(&musb_board_data); +    /* Set up the voltage domains */ + +    omap3_voltdm_init(); +      /* For handling interrupts from the accelerometer */ -    previous = jiffies; -     +    /* previous = jiffies; */ +           /* Init the code that handles wake ups */ -    omap3_wake_init(); +    /* omap3_wake_init(); */ -    omap3_acc_irq_init(omap3h1_i2c2_board_info[0].irq, (void *) &omap3h1_devices); +    /* omap3_acc_irq_init(omap3h1_i2c2_board_info[0].irq, (void *) &omap3h1_devices); */  }  MACHINE_START(OMAP3_H1, "Olio OMAP3 H1 Board") 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 2a1fec7b54f..94c6b5d49ae 100644 --- a/drivers/staging/iio/imu/inv_mpu/inv_mpu_core.c +++ b/drivers/staging/iio/imu/inv_mpu/inv_mpu_core.c @@ -3033,7 +3033,7 @@ static int inv_mpu_resume(struct device *dev)      /* TODO: OLIO, mfj: Here we need to turn the low-power motion       * detection off, since the watch is now awake.        */  -    result = olio_set_lpa_off (st); +    /* result = olio_set_lpa_off (st); */  	mutex_unlock(&indio_dev->mlock);  	mutex_unlock(&st->suspend_resume_lock); @@ -3075,7 +3075,7 @@ static int inv_mpu_suspend(struct device *dev)       * detection, for waking the watch up.       */ -    result |= olio_set_lpa_on (st); +    /* result |= olio_set_lpa_on (st); */  	mutex_unlock(&indio_dev->mlock);  	mutex_lock(&st->suspend_resume_lock); diff --git a/drivers/staging/iio/imu/inv_mpu/olio_specials.h b/drivers/staging/iio/imu/inv_mpu/olio_specials.h index 8ed976d17bc..e882c3eea86 100644 --- a/drivers/staging/iio/imu/inv_mpu/olio_specials.h +++ b/drivers/staging/iio/imu/inv_mpu/olio_specials.h @@ -14,4 +14,4 @@   */  #define OLIO_DEF_FREQ  0x03 -#define OLIO_DEF_THRES 0xb0  /* 176 */ +#define OLIO_DEF_THRES 0xE0  /* 224 */ |