diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/gpio/gpio-tps65910.c | 4 | ||||
| -rw-r--r-- | drivers/mfd/tps65910.c | 38 | ||||
| -rw-r--r-- | drivers/regulator/core.c | 13 | ||||
| -rw-r--r-- | drivers/regulator/omap-pmic-regulator.c | 32 | ||||
| -rw-r--r-- | drivers/staging/iio/imu/inv_mpu/inv_mpu_core.c | 23 | 
5 files changed, 91 insertions, 19 deletions
diff --git a/drivers/gpio/gpio-tps65910.c b/drivers/gpio/gpio-tps65910.c index d64de51db97..06146219d9d 100644 --- a/drivers/gpio/gpio-tps65910.c +++ b/drivers/gpio/gpio-tps65910.c @@ -82,7 +82,7 @@ static int tps65910_gpio_input(struct gpio_chip *gc, unsigned offset)  						GPIO_CFG_MASK);  } -#if 0 /* #ifdef CONFIG_OF - olio: We DO have a DT, but no tps info there. */ +#ifdef CONFIG_OF  static struct tps65910_board *tps65910_parse_dt_for_gpio(struct device *dev,  		struct tps65910 *tps65910, int chip_ngpio)  { @@ -149,7 +149,7 @@ static int tps65910_gpio_probe(struct platform_device *pdev)  	tps65910_gpio->gpio_chip.set	= tps65910_gpio_set;  	tps65910_gpio->gpio_chip.get	= tps65910_gpio_get;  	tps65910_gpio->gpio_chip.dev = &pdev->dev; -#if 0 /* #ifdef CONFIG_OF_GPIO */ +#ifdef CONFIG_OF_GPIO  	tps65910_gpio->gpio_chip.of_node = tps65910->dev->of_node;  #endif  	if (pdata && pdata->gpio_base) diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c index f4b99d84396..15f2c8dea2f 100644 --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c @@ -312,6 +312,23 @@ static int tps65910_ck32k_init(struct tps65910 *tps65910,  	return 0;  } +static void tps65910_clear_interrupts(struct tps65910 *tps65910) +{ +	u32 val; +	int ret; + +	ret = tps65910_reg_read(tps65910, TPS65910_INT_STS, &val); + +	/* interrupts are cleared by writing '1' to the bit */ +	if (val) +		ret = tps65910_reg_write(tps65910, TPS65910_INT_STS, val); + +	ret = tps65910_reg_read(tps65910, TPS65910_INT_STS2, &val); + +	if (val) +		ret = tps65910_reg_write(tps65910, TPS65910_INT_STS2, val); +} +  static int tps65910_sleepinit(struct tps65910 *tps65910,  		struct tps65910_board *pmic_pdata)  { @@ -320,8 +337,13 @@ static int tps65910_sleepinit(struct tps65910 *tps65910,  	dev = tps65910->dev; -	if (!pmic_pdata->en_dev_slp) -		return 0; +	/* set polarity of SLLEEPSIG requst ot enter OFF mode */ +	ret = tps65910_reg_set_bits(tps65910, TPS65910_DEVCTRL2, +				DEVCTRL2_SLEEPSIG_POL_MASK); +	if (ret < 0) { +		dev_err(dev, "set sleepsig_pol failed: %d\n", ret); +		goto err_sleep_init; +	}  	/* enabling SLEEP device state */  	ret = tps65910_reg_set_bits(tps65910, TPS65910_DEVCTRL, @@ -331,6 +353,13 @@ static int tps65910_sleepinit(struct tps65910 *tps65910,  		goto err_sleep_init;  	} +	ret = tps65910_reg_set_bits(tps65910, TPS65910_SLEEP_KEEP_RES_ON, +				SLEEP_KEEP_RES_ON_CLKOUT32K_KEEPON_MASK); +	if (ret < 0) { +		dev_err(dev, "set sleep_keep_res_on failed: %d\n", ret); +		goto err_sleep_init; +	} +  	/* Return if there is no sleep keepon data. */  	if (!pmic_pdata->slp_keepon)  		return 0; @@ -497,6 +526,11 @@ static int tps65910_i2c_probe(struct i2c_client *i2c,  	init_data->irq = pmic_plat_data->irq;  	init_data->irq_base = pmic_plat_data->irq_base; +	/* +	 * clear pending interrupts - power on event generate several +	 * interrupts. +	 */ +	tps65910_clear_interrupts(tps65910);  	tps65910_irq_init(tps65910, init_data->irq, init_data);  	tps65910_ck32k_init(tps65910, pmic_plat_data);  	tps65910_sleepinit(tps65910, pmic_plat_data); diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 7c75ab88f9b..815d6df8bd5 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -3673,9 +3673,8 @@ regulator_register(const struct regulator_desc *regulator_desc,  add_dev:  	/* add consumers devices */ -  	if (init_data) { -      for (i = 0; i < init_data->num_consumer_supplies; i++) { +		for (i = 0; i < init_data->num_consumer_supplies; i++) {  			ret = set_consumer_device_supply(rdev,  				init_data->consumer_supplies[i].dev_name,  				init_data->consumer_supplies[i].supply); @@ -3685,14 +3684,13 @@ add_dev:  				goto unset_supplies;  			}  		} -	}  +	}  	list_add(&rdev->list, ®ulator_list);  	rdev_init_debugfs(rdev);  out:  	mutex_unlock(®ulator_list_mutex); -  	return rdev;  unset_supplies: @@ -3712,8 +3710,7 @@ wash:  clean:  	kfree(rdev);  	rdev = ERR_PTR(ret); - -    goto out; +	goto out;  }  EXPORT_SYMBOL_GPL(regulator_register); @@ -3983,12 +3980,8 @@ static int __init regulator_init_complete(void)  	 * with DT to provide them just assume that a DT enabled  	 * system has full constraints.  	 */ - -#if 0 -    // TODO OLIO: This assumption isn't true for us. Not yet, at least.  	if (of_have_populated_dt())  		has_full_constraints = true; -#endif  	mutex_lock(®ulator_list_mutex); diff --git a/drivers/regulator/omap-pmic-regulator.c b/drivers/regulator/omap-pmic-regulator.c index 2eab7c158e2..ca71c9fd85b 100644 --- a/drivers/regulator/omap-pmic-regulator.c +++ b/drivers/regulator/omap-pmic-regulator.c @@ -518,6 +518,36 @@ static const struct omap_pmic_info omap_tps65912_dcdc4 = {  	.voltage_selector_zero = true,  }; +static const struct omap_pmic_info omap_tps65910_vdd1 = { +	.slave_addr = 0x12, +	.voltage_reg_addr = 0x22, +	.cmd_reg_addr = 0x23, +	.i2c_timeout_us = 200, +	.slew_rate_uV = 7500, +	.step_size_uV = 12500, +	.min_uV = 562500, +	.max_uV = 1350000, +	.voltage_selector_offset = 0, +	.voltage_selector_mask = 0x7F, +	.voltage_selector_setbits = 0x0, +	.voltage_selector_zero = true, +}; + +static const struct omap_pmic_info omap_tps65910_vdd2 = { +	.slave_addr = 0x12, +	.voltage_reg_addr = 0x24, +	.cmd_reg_addr = 0x25, +	.i2c_timeout_us = 200, +	.slew_rate_uV = 7500, +	.step_size_uV = 12500, +	.min_uV = 562500, +	.max_uV = 1200000, +	.voltage_selector_offset = 0, +	.voltage_selector_mask = 0x7F, +	.voltage_selector_setbits = 0x0, +	.voltage_selector_zero = true, +}; +  static const struct of_device_id omap_pmic_of_match_tbl[] = {  	{.compatible = "ti,omap-twl4030-vdd1", .data = &omap_twl4030_vdd1,},  	{.compatible = "ti,omap-twl4030-vdd2", .data = &omap_twl4030_vdd2,}, @@ -533,6 +563,8 @@ static const struct of_device_id omap_pmic_of_match_tbl[] = {  	{.compatible = "ti,omap-twl6035-smps8", .data = &omap_twl6035_smps8,},  	{.compatible = "ti,omap-tps65912-dcdc1", .data = &omap_tps65912_dcdc1,},  	{.compatible = "ti,omap-tps65912-dcdc4", .data = &omap_tps65912_dcdc4,}, +	{.compatible = "ti,omap-tps65910-vdd1", .data = &omap_tps65910_vdd1,}, +	{.compatible = "ti,omap-tps65910-vdd2", .data = &omap_tps65910_vdd2,},  	{},  };  MODULE_DEVICE_TABLE(of, omap_pmic_of_match_tbl); 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,  };  |