aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>2018-07-03 11:04:11 -0400
committerLee Jones <lee.jones@linaro.org>2018-07-27 03:16:01 -0400
commitc8fda5bfa9972dc1175b898dfdaa3a375dca6022 (patch)
tree886e77bfaf2c6f578d564042f95f560c2cb26305
parent99e19b7c48f852acd8341de4390931a9da699ee3 (diff)
mfd: as3722: Disable auto-power-on when AC OK
On ams AS3722, power on when AC OK is enabled by default. Making this option as disable by default and enable only when platform need this explicitly. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com> Tested-by: Bibek Basu <bbasu@nvidia.com> Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r--Documentation/devicetree/bindings/mfd/as3722.txt2
-rw-r--r--drivers/mfd/as3722.c12
-rw-r--r--include/linux/mfd/as3722.h3
3 files changed, 17 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/mfd/as3722.txt b/Documentation/devicetree/bindings/mfd/as3722.txt
index 5297b2210704..2a665741d7fe 100644
--- a/Documentation/devicetree/bindings/mfd/as3722.txt
+++ b/Documentation/devicetree/bindings/mfd/as3722.txt
@@ -20,6 +20,8 @@ Optional properties:
20- ams,enable-internal-i2c-pullup: Boolean property, to enable internal pullup on 20- ams,enable-internal-i2c-pullup: Boolean property, to enable internal pullup on
21 i2c scl/sda pins. Missing this will disable internal pullup on i2c 21 i2c scl/sda pins. Missing this will disable internal pullup on i2c
22 scl/sda lines. 22 scl/sda lines.
23- ams,enable-ac-ok-power-on: Boolean property, to enable exit out of power off
24 mode with AC_OK pin (pin enabled in power off mode).
23 25
24Optional submodule and their properties: 26Optional submodule and their properties:
25======================================= 27=======================================
diff --git a/drivers/mfd/as3722.c b/drivers/mfd/as3722.c
index f87342c211bc..4d069ed21ff6 100644
--- a/drivers/mfd/as3722.c
+++ b/drivers/mfd/as3722.c
@@ -349,6 +349,8 @@ static int as3722_i2c_of_probe(struct i2c_client *i2c,
349 "ams,enable-internal-int-pullup"); 349 "ams,enable-internal-int-pullup");
350 as3722->en_intern_i2c_pullup = of_property_read_bool(np, 350 as3722->en_intern_i2c_pullup = of_property_read_bool(np,
351 "ams,enable-internal-i2c-pullup"); 351 "ams,enable-internal-i2c-pullup");
352 as3722->en_ac_ok_pwr_on = of_property_read_bool(np,
353 "ams,enable-ac-ok-power-on");
352 as3722->irq_flags = irqd_get_trigger_type(irq_data); 354 as3722->irq_flags = irqd_get_trigger_type(irq_data);
353 dev_dbg(&i2c->dev, "IRQ flags are 0x%08lx\n", as3722->irq_flags); 355 dev_dbg(&i2c->dev, "IRQ flags are 0x%08lx\n", as3722->irq_flags);
354 return 0; 356 return 0;
@@ -360,6 +362,7 @@ static int as3722_i2c_probe(struct i2c_client *i2c,
360 struct as3722 *as3722; 362 struct as3722 *as3722;
361 unsigned long irq_flags; 363 unsigned long irq_flags;
362 int ret; 364 int ret;
365 u8 val = 0;
363 366
364 as3722 = devm_kzalloc(&i2c->dev, sizeof(struct as3722), GFP_KERNEL); 367 as3722 = devm_kzalloc(&i2c->dev, sizeof(struct as3722), GFP_KERNEL);
365 if (!as3722) 368 if (!as3722)
@@ -398,6 +401,15 @@ static int as3722_i2c_probe(struct i2c_client *i2c,
398 if (ret < 0) 401 if (ret < 0)
399 return ret; 402 return ret;
400 403
404 if (as3722->en_ac_ok_pwr_on)
405 val = AS3722_CTRL_SEQU1_AC_OK_PWR_ON;
406 ret = as3722_update_bits(as3722, AS3722_CTRL_SEQU1_REG,
407 AS3722_CTRL_SEQU1_AC_OK_PWR_ON, val);
408 if (ret < 0) {
409 dev_err(as3722->dev, "CTRLsequ1 update failed: %d\n", ret);
410 return ret;
411 }
412
401 ret = devm_mfd_add_devices(&i2c->dev, -1, as3722_devs, 413 ret = devm_mfd_add_devices(&i2c->dev, -1, as3722_devs,
402 ARRAY_SIZE(as3722_devs), NULL, 0, 414 ARRAY_SIZE(as3722_devs), NULL, 0,
403 regmap_irq_get_domain(as3722->irq_data)); 415 regmap_irq_get_domain(as3722->irq_data));
diff --git a/include/linux/mfd/as3722.h b/include/linux/mfd/as3722.h
index 51e6f9414575..b404a5af9bba 100644
--- a/include/linux/mfd/as3722.h
+++ b/include/linux/mfd/as3722.h
@@ -296,6 +296,8 @@
296#define AS3722_ADC1_CONV_NOTREADY BIT(7) 296#define AS3722_ADC1_CONV_NOTREADY BIT(7)
297#define AS3722_ADC1_SOURCE_SELECT_MASK 0x1F 297#define AS3722_ADC1_SOURCE_SELECT_MASK 0x1F
298 298
299#define AS3722_CTRL_SEQU1_AC_OK_PWR_ON BIT(0)
300
299/* GPIO modes */ 301/* GPIO modes */
300#define AS3722_GPIO_MODE_MASK 0x07 302#define AS3722_GPIO_MODE_MASK 0x07
301#define AS3722_GPIO_MODE_INPUT 0x00 303#define AS3722_GPIO_MODE_INPUT 0x00
@@ -391,6 +393,7 @@ struct as3722 {
391 unsigned long irq_flags; 393 unsigned long irq_flags;
392 bool en_intern_int_pullup; 394 bool en_intern_int_pullup;
393 bool en_intern_i2c_pullup; 395 bool en_intern_i2c_pullup;
396 bool en_ac_ok_pwr_on;
394 struct regmap_irq_chip_data *irq_data; 397 struct regmap_irq_chip_data *irq_data;
395}; 398};
396 399