aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeerthy <j-keerthy@ti.com>2017-10-24 04:21:36 -0400
committerLee Jones <lee.jones@linaro.org>2018-01-08 06:03:34 -0500
commit572ff4d560be3784205b224cd67d6715620092d7 (patch)
tree3c8b4ac8357335359863ef578d0d6b79fbc6c8a3
parent0a5d79bfc0154bb587d5a439dc0e439d4d72f25b (diff)
mfd: palmas: Assign the right powerhold mask for tps65917
The powerhold mask for TPS65917 is different when comapred to the other palmas versions. Hence assign the right mask that enables power off of tps65917 pmic correctly. Signed-off-by: Keerthy <j-keerthy@ti.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r--drivers/mfd/palmas.c10
-rw-r--r--include/linux/mfd/palmas.h3
2 files changed, 12 insertions, 1 deletions
diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index 3922a93f9f92..663a2398b6b1 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -430,6 +430,7 @@ static void palmas_power_off(void)
430{ 430{
431 unsigned int addr; 431 unsigned int addr;
432 int ret, slave; 432 int ret, slave;
433 u8 powerhold_mask;
433 struct device_node *np = palmas_dev->dev->of_node; 434 struct device_node *np = palmas_dev->dev->of_node;
434 435
435 if (of_property_read_bool(np, "ti,palmas-override-powerhold")) { 436 if (of_property_read_bool(np, "ti,palmas-override-powerhold")) {
@@ -437,8 +438,15 @@ static void palmas_power_off(void)
437 PALMAS_PRIMARY_SECONDARY_PAD2); 438 PALMAS_PRIMARY_SECONDARY_PAD2);
438 slave = PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE); 439 slave = PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE);
439 440
441 if (of_device_is_compatible(np, "ti,tps65917"))
442 powerhold_mask =
443 TPS65917_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK;
444 else
445 powerhold_mask =
446 PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK;
447
440 ret = regmap_update_bits(palmas_dev->regmap[slave], addr, 448 ret = regmap_update_bits(palmas_dev->regmap[slave], addr,
441 PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK, 0); 449 powerhold_mask, 0);
442 if (ret) 450 if (ret)
443 dev_err(palmas_dev->dev, 451 dev_err(palmas_dev->dev,
444 "Unable to write PRIMARY_SECONDARY_PAD2 %d\n", 452 "Unable to write PRIMARY_SECONDARY_PAD2 %d\n",
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 3c8568aa82a5..75e5c8ff85fc 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -3733,6 +3733,9 @@ enum usb_irq_events {
3733#define TPS65917_REGEN3_CTRL_MODE_ACTIVE 0x01 3733#define TPS65917_REGEN3_CTRL_MODE_ACTIVE 0x01
3734#define TPS65917_REGEN3_CTRL_MODE_ACTIVE_SHIFT 0x00 3734#define TPS65917_REGEN3_CTRL_MODE_ACTIVE_SHIFT 0x00
3735 3735
3736/* POWERHOLD Mask field for PRIMARY_SECONDARY_PAD2 register */
3737#define TPS65917_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK 0xC
3738
3736/* Registers for function RESOURCE */ 3739/* Registers for function RESOURCE */
3737#define TPS65917_REGEN1_CTRL 0x2 3740#define TPS65917_REGEN1_CTRL 0x2
3738#define TPS65917_PLLEN_CTRL 0x3 3741#define TPS65917_PLLEN_CTRL 0x3