input: add snapshot of qpnp-power-on driver

The qpnp-power-on driver provides support for key presses via
several key specific PMIC inputs.  It also supports reading
power-on reasons and configuring the power-off type (i.e.
restart, shutdown, etc).

This snapshot is taken as of msm-4.19
commit 47598dd0e809 ("input: misc: qpnp-power-on: add support
to power off a modem chip").

Note that support for boot_reason, cold_boot, and ship_mode
configuration was removed as these have unmet dependencies and
are no longer needed.

Change-Id: I8105cf74d65609932146157f82a8e99f29a4dde2
Signed-off-by: David Collins <collinsd@codeaurora.org>
This commit is contained in:
David Collins 2019-12-05 12:03:50 -08:00
commit 726328684e
4 changed files with 2526 additions and 0 deletions

View file

@ -175,6 +175,15 @@ config INPUT_PMIC8XXX_PWRKEY
To compile this driver as a module, choose M here: the
module will be called pmic8xxx-pwrkey.
config INPUT_QPNP_POWER_ON
tristate "QPNP PMIC Power-on support"
depends on SPMI
help
This option enables device driver support for the power-on
functionality of Qualcomm Technologies, Inc. PNP PMICs. It supports
reporting the change in status of the KPDPWR_N line (connected to the
power-key) as well as reset features.
config INPUT_SPARCSPKR
tristate "SPARC Speaker support"
depends on PCI && SPARC64

View file

@ -59,6 +59,7 @@ obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o
obj-$(CONFIG_INPUT_PM8941_PWRKEY) += pm8941-pwrkey.o
obj-$(CONFIG_INPUT_PM8XXX_VIBRATOR) += pm8xxx-vibrator.o
obj-$(CONFIG_INPUT_PMIC8XXX_PWRKEY) += pmic8xxx-pwrkey.o
obj-$(CONFIG_INPUT_QPNP_POWER_ON) += qpnp-power-on.o
obj-$(CONFIG_INPUT_POWERMATE) += powermate.o
obj-$(CONFIG_INPUT_PWM_BEEPER) += pwm-beeper.o
obj-$(CONFIG_INPUT_PWM_VIBRA) += pwm-vibra.o

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,108 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2012-2015, 2017-2019, The Linux Foundation.
* All rights reserved.
*/
#ifndef QPNP_PON_H
#define QPNP_PON_H
#include <dt-bindings/input/qcom,qpnp-power-on.h>
#include <linux/errno.h>
/**
* enum pon_trigger_source: List of PON trigger sources
* %PON_SMPL: PON triggered by Sudden Momentary Power Loss (SMPL)
* %PON_RTC: PON triggered by real-time clock (RTC) alarm
* %PON_DC_CHG: PON triggered by insertion of DC charger
* %PON_USB_CHG: PON triggered by insertion of USB
* %PON_PON1: PON triggered by other PMIC (multi-PMIC option)
* %PON_CBLPWR_N: PON triggered by power-cable insertion
* %PON_KPDPWR_N: PON triggered by long press of the power-key
*/
enum pon_trigger_source {
PON_SMPL = 1,
PON_RTC,
PON_DC_CHG,
PON_USB_CHG,
PON_PON1,
PON_CBLPWR_N,
PON_KPDPWR_N,
};
/**
* enum pon_power_off_type: Possible power off actions to perform
* %PON_POWER_OFF_RESERVED: Reserved, not used
* %PON_POWER_OFF_WARM_RESET: Reset the MSM but not all PMIC peripherals
* %PON_POWER_OFF_SHUTDOWN: Shutdown the MSM and PMIC completely
* %PON_POWER_OFF_HARD_RESET: Reset the MSM and all PMIC peripherals
* %PON_POWER_OFF_MAX_TYPE: Reserved, not used
*/
enum pon_power_off_type {
PON_POWER_OFF_RESERVED = 0x00,
PON_POWER_OFF_WARM_RESET = PON_POWER_OFF_TYPE_WARM_RESET,
PON_POWER_OFF_SHUTDOWN = PON_POWER_OFF_TYPE_SHUTDOWN,
PON_POWER_OFF_HARD_RESET = PON_POWER_OFF_TYPE_HARD_RESET,
PON_POWER_OFF_MAX_TYPE = 0x10,
};
enum pon_restart_reason {
PON_RESTART_REASON_UNKNOWN = 0x00,
PON_RESTART_REASON_RECOVERY = 0x01,
PON_RESTART_REASON_BOOTLOADER = 0x02,
PON_RESTART_REASON_RTC = 0x03,
PON_RESTART_REASON_DMVERITY_CORRUPTED = 0x04,
PON_RESTART_REASON_DMVERITY_ENFORCE = 0x05,
PON_RESTART_REASON_KEYS_CLEAR = 0x06,
};
#if IS_ENABLED(CONFIG_INPUT_QPNP_POWER_ON)
int qpnp_pon_system_pwr_off(enum pon_power_off_type type);
int qpnp_pon_is_warm_reset(void);
int qpnp_pon_trigger_config(enum pon_trigger_source pon_src, bool enable);
int qpnp_pon_wd_config(bool enable);
int qpnp_pon_set_restart_reason(enum pon_restart_reason reason);
bool qpnp_pon_check_hard_reset_stored(void);
int qpnp_pon_modem_pwr_off(enum pon_power_off_type type);
#else
static int qpnp_pon_system_pwr_off(enum pon_power_off_type type)
{
return -ENODEV;
}
static inline int qpnp_pon_is_warm_reset(void)
{
return -ENODEV;
}
static inline int qpnp_pon_trigger_config(enum pon_trigger_source pon_src,
bool enable)
{
return -ENODEV;
}
int qpnp_pon_wd_config(bool enable)
{
return -ENODEV;
}
static inline int qpnp_pon_set_restart_reason(enum pon_restart_reason reason)
{
return -ENODEV;
}
static inline bool qpnp_pon_check_hard_reset_stored(void)
{
return false;
}
static inline int qpnp_pon_modem_pwr_off(enum pon_power_off_type type)
{
return -ENODEV;
}
#endif
#endif