aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-09-18 18:51:19 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-09-19 06:07:56 -0400
commit9582fdcb6fcf1b596a83b161a2ea886272d2a62f (patch)
treed880190567065d64e86b29194a0ec0ca23cfb50b /drivers/mfd
parent48a364b758f861b21747a5148f26aedc504edb7f (diff)
mfd: max8907: Add power off control
Add DT property "maxim,system-power-controller" to indicate whether the PMIC is in charge of controlling the system power. If this is set, the driver will provide the pm_power_off() function. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/max8907.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c
index 6497c98e030d..2303641dd052 100644
--- a/drivers/mfd/max8907.c
+++ b/drivers/mfd/max8907.c
@@ -176,11 +176,26 @@ static const struct regmap_irq_chip max8907_rtc_irq_chip = {
176 .num_irqs = ARRAY_SIZE(max8907_rtc_irqs), 176 .num_irqs = ARRAY_SIZE(max8907_rtc_irqs),
177}; 177};
178 178
179struct max8907 *max8907_pm_off;
180static void max8907_power_off(void)
181{
182 regmap_update_bits(max8907_pm_off->regmap_gen, MAX8907_REG_RESET_CNFG,
183 MAX8907_MASK_POWER_OFF, MAX8907_MASK_POWER_OFF);
184}
185
179static __devinit int max8907_i2c_probe(struct i2c_client *i2c, 186static __devinit int max8907_i2c_probe(struct i2c_client *i2c,
180 const struct i2c_device_id *id) 187 const struct i2c_device_id *id)
181{ 188{
182 struct max8907 *max8907; 189 struct max8907 *max8907;
183 int ret; 190 int ret;
191 struct max8907_platform_data *pdata = dev_get_platdata(&i2c->dev);
192 bool pm_off = false;
193
194 if (pdata)
195 pm_off = pdata->pm_off;
196 else if (i2c->dev.of_node)
197 pm_off = of_property_read_bool(i2c->dev.of_node,
198 "maxim,system-power-controller");
184 199
185 max8907 = devm_kzalloc(&i2c->dev, sizeof(struct max8907), GFP_KERNEL); 200 max8907 = devm_kzalloc(&i2c->dev, sizeof(struct max8907), GFP_KERNEL);
186 if (!max8907) { 201 if (!max8907) {
@@ -251,6 +266,11 @@ static __devinit int max8907_i2c_probe(struct i2c_client *i2c,
251 goto err_add_devices; 266 goto err_add_devices;
252 } 267 }
253 268
269 if (pm_off && !pm_power_off) {
270 max8907_pm_off = max8907;
271 pm_power_off = max8907_power_off;
272 }
273
254 return 0; 274 return 0;
255 275
256err_add_devices: 276err_add_devices: