mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
input: misc: qcom-power-on: Add support to log KPDPWR status
Add support to log KPDPWR status during driver INIT and runtime when "qcom,log-kpd-event" is enabled. Change-Id: I6eb58e560552741ea5f48967b56bb2236b375830 Signed-off-by: Ashish Chavan <ashichav@codeaurora.org>
This commit is contained in:
parent
d4762490a3
commit
d452343881
1 changed files with 19 additions and 0 deletions
|
|
@ -147,6 +147,7 @@ enum qpnp_pon_version {
|
|||
|
||||
#define QPNP_PON_UVLO_DLOAD_EN BIT(7)
|
||||
#define QPNP_PON_SMPL_EN BIT(7)
|
||||
#define QPNP_PON_KPDPWR_ON BIT(0)
|
||||
|
||||
/* Limits */
|
||||
#define QPNP_PON_S1_TIMER_MAX 10256
|
||||
|
|
@ -244,6 +245,7 @@ struct qpnp_pon {
|
|||
bool resin_pon_reset;
|
||||
ktime_t kpdpwr_last_release_time;
|
||||
bool legacy_hard_reset_offset;
|
||||
bool log_kpd_event;
|
||||
};
|
||||
|
||||
static struct qpnp_pon *sys_reset_dev;
|
||||
|
|
@ -1041,6 +1043,10 @@ static int qpnp_pon_input_dispatch(struct qpnp_pon *pon, u32 pon_type)
|
|||
* Simulate a press event in case release event occurred without a press
|
||||
* event
|
||||
*/
|
||||
if (pon->log_kpd_event && (cfg->pon_type == PON_KPDPWR))
|
||||
pr_info_ratelimited("PMIC input: KPDPWR status=0x%02x, KPDPWR_ON=%d\n",
|
||||
pon_rt_sts, (pon_rt_sts & QPNP_PON_KPDPWR_ON));
|
||||
|
||||
if (!cfg->old_state && !key_status) {
|
||||
input_report_key(pon->pon_input, cfg->key_code, 1);
|
||||
input_sync(pon->pon_input);
|
||||
|
|
@ -1446,6 +1452,7 @@ static int qpnp_pon_config_kpdpwr_init(struct qpnp_pon *pon,
|
|||
struct device_node *node)
|
||||
{
|
||||
int rc;
|
||||
uint pon_rt_sts;
|
||||
|
||||
cfg->state_irq = platform_get_irq_byname(pdev, "kpdpwr");
|
||||
if (cfg->state_irq < 0) {
|
||||
|
|
@ -1484,6 +1491,16 @@ static int qpnp_pon_config_kpdpwr_init(struct qpnp_pon *pon,
|
|||
cfg->s2_cntl2_addr = QPNP_PON_KPDPWR_S2_CNTL2(pon);
|
||||
}
|
||||
|
||||
if (pon->log_kpd_event) {
|
||||
/* Read PON_RT_STS status during driver initialization. */
|
||||
rc = qpnp_pon_read(pon, QPNP_PON_RT_STS(pon), &pon_rt_sts);
|
||||
if (rc < 0)
|
||||
pr_err("failed to read QPNP_PON_RT_STS rc=%d\n", rc);
|
||||
|
||||
pr_info("KPDPWR status at init=0x%02x, KPDPWR_ON=%d\n",
|
||||
pon_rt_sts, (pon_rt_sts & QPNP_PON_KPDPWR_ON));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2466,6 +2483,8 @@ static int qpnp_pon_probe(struct platform_device *pdev)
|
|||
pon->is_spon = true;
|
||||
}
|
||||
|
||||
pon->log_kpd_event = of_property_read_bool(dev->of_node, "qcom,log-kpd-event");
|
||||
|
||||
/* Register the PON configurations */
|
||||
rc = qpnp_pon_config_init(pon, pdev);
|
||||
if (rc)
|
||||
|
|
|
|||
Loading…
Reference in a new issue