Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 308694
b: refs/heads/master
c: 201cf05
h: refs/heads/master
v: v3
  • Loading branch information
Laxman Dewangan authored and Samuel Ortiz committed May 1, 2012
1 parent a14a20a commit 9f2d38d
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 58d114b669d2b86aa79eac6688590c808072579b
refs/heads/master: 201cf052810d20814a77ca0e0045a2c1a3508a1f
62 changes: 62 additions & 0 deletions trunk/drivers/mfd/tps65910.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,66 @@ static const struct regmap_config tps65910_regmap_config = {
.cache_type = REGCACHE_RBTREE,
};

static int __init tps65910_sleepinit(struct tps65910 *tps65910,
struct tps65910_board *pmic_pdata)
{
struct device *dev = NULL;
int ret = 0;

dev = tps65910->dev;

if (!pmic_pdata->en_dev_slp)
return 0;

/* enabling SLEEP device state */
ret = tps65910_set_bits(tps65910, TPS65910_DEVCTRL,
DEVCTRL_DEV_SLP_MASK);
if (ret < 0) {
dev_err(dev, "set dev_slp failed: %d\n", ret);
goto err_sleep_init;
}

/* Return if there is no sleep keepon data. */
if (!pmic_pdata->slp_keepon)
return 0;

if (pmic_pdata->slp_keepon->therm_keepon) {
ret = tps65910_set_bits(tps65910, TPS65910_SLEEP_KEEP_RES_ON,
SLEEP_KEEP_RES_ON_THERM_KEEPON_MASK);
if (ret < 0) {
dev_err(dev, "set therm_keepon failed: %d\n", ret);
goto disable_dev_slp;
}
}

if (pmic_pdata->slp_keepon->clkout32k_keepon) {
ret = tps65910_set_bits(tps65910, TPS65910_SLEEP_KEEP_RES_ON,
SLEEP_KEEP_RES_ON_CLKOUT32K_KEEPON_MASK);
if (ret < 0) {
dev_err(dev, "set clkout32k_keepon failed: %d\n", ret);
goto disable_dev_slp;
}
}

if (pmic_pdata->slp_keepon->i2chs_keepon) {
ret = tps65910_set_bits(tps65910, TPS65910_SLEEP_KEEP_RES_ON,
SLEEP_KEEP_RES_ON_I2CHS_KEEPON_MASK);
if (ret < 0) {
dev_err(dev, "set i2chs_keepon failed: %d\n", ret);
goto disable_dev_slp;
}
}

return 0;

disable_dev_slp:
tps65910_clear_bits(tps65910, TPS65910_DEVCTRL, DEVCTRL_DEV_SLP_MASK);

err_sleep_init:
return ret;
}


static int tps65910_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
Expand Down Expand Up @@ -140,6 +200,8 @@ static int tps65910_i2c_probe(struct i2c_client *i2c,

tps65910_irq_init(tps65910, init_data->irq, init_data);

tps65910_sleepinit(tps65910, pmic_plat_data);

kfree(init_data);
return ret;

Expand Down
14 changes: 14 additions & 0 deletions trunk/include/linux/mfd/tps65910.h
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,18 @@
#define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN3 0x4
#define TPS65911_SLEEP_CONTROL_EXT_INPUT_SLEEP 0x8

/*
* Sleep keepon data: Maintains the state in sleep mode
* @therm_keepon: Keep on the thermal monitoring in sleep state.
* @clkout32k_keepon: Keep on the 32KHz clock output in sleep state.
* @i2chs_keepon: Keep on high speed internal clock in sleep state.
*/
struct tps65910_sleep_keepon_data {
unsigned therm_keepon:1;
unsigned clkout32k_keepon:1;
unsigned i2chs_keepon:1;
};

/**
* struct tps65910_board
* Board platform data may be used to initialize regulators.
Expand All @@ -794,6 +806,8 @@ struct tps65910_board {
int irq_base;
int vmbch_threshold;
int vmbch2_threshold;
bool en_dev_slp;
struct tps65910_sleep_keepon_data *slp_keepon;
bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO];
unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS];
struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS];
Expand Down

0 comments on commit 9f2d38d

Please sign in to comment.