diff options
| author | Fenglin Wu <fenglinw@codeaurora.org> | 2016-11-22 13:21:11 +0800 |
|---|---|---|
| committer | Fenglin Wu <fenglinw@codeaurora.org> | 2016-12-22 09:36:13 +0800 |
| commit | 4569877e351900be3df0b34f4e7acb1d32e687fa (patch) | |
| tree | cbe7b576097d50e23f494b1499ee8e77a20e1249 | |
| parent | 83134d5df11ca497a061a492fb9b20e24f56acca (diff) | |
input: qpnp-power-on: Set ship mode in system_pwr_off
Set ship mode in qpnp_pon_system_pwr_off() API if it has been requested
previously.
CRs-Fixed: 1092969
Change-Id: I6e315eec256f01c143ffc8b463279f2b30e64610
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
| -rw-r--r-- | drivers/input/qpnp-power-on.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/input/qpnp-power-on.c b/drivers/input/qpnp-power-on.c index 760c92a47a36..967b23cae05c 100644 --- a/drivers/input/qpnp-power-on.c +++ b/drivers/input/qpnp-power-on.c @@ -31,6 +31,7 @@ #include <linux/regulator/machine.h> #include <linux/regulator/of_regulator.h> #include <linux/qpnp/power-on.h> +#include <linux/power_supply.h> #define PMIC_VER_8941 0x01 #define PMIC_VERSION_REG 0x0105 @@ -220,6 +221,11 @@ struct qpnp_pon { bool store_hard_reset_reason; }; +static int pon_ship_mode_en; +module_param_named( + ship_mode_en, pon_ship_mode_en, int, S_IRUSR | S_IWUSR +); + static struct qpnp_pon *sys_reset_dev; static DEFINE_SPINLOCK(spon_list_slock); static LIST_HEAD(spon_dev_list); @@ -523,6 +529,8 @@ int qpnp_pon_system_pwr_off(enum pon_power_off_type type) int rc = 0; struct qpnp_pon *pon = sys_reset_dev; struct qpnp_pon *tmp; + struct power_supply *batt_psy; + union power_supply_propval val; unsigned long flags; if (!pon) @@ -557,6 +565,19 @@ int qpnp_pon_system_pwr_off(enum pon_power_off_type type) goto out; } } + /* Set ship mode here if it has been requested */ + if (!!pon_ship_mode_en) { + batt_psy = power_supply_get_by_name("battery"); + if (batt_psy) { + pr_debug("Set ship mode!\n"); + val.intval = 1; + rc = power_supply_set_property(batt_psy, + POWER_SUPPLY_PROP_SET_SHIP_MODE, &val); + if (rc) + dev_err(&pon->pdev->dev, + "Set ship-mode failed\n"); + } + } out: spin_unlock_irqrestore(&spon_list_slock, flags); return rc; |
