From b91f814b4969c93ee18f4dd1a9a9964fac8142eb Mon Sep 17 00:00:00 2001 From: Forenche Date: Thu, 30 Jun 2022 01:01:58 +0530 Subject: [PATCH] Revert "input: qpnp-power-on: Adapt software debounce to work for all keys" This reverts commit 72e9af81113b4f53c849adedf2285a2a5d35a021. Signed-off-by: Forenche --- .../bindings/input/qpnp-power-on.txt | 4 ++-- drivers/input/misc/qpnp-power-on.c | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Documentation/devicetree/bindings/input/qpnp-power-on.txt b/Documentation/devicetree/bindings/input/qpnp-power-on.txt index f3b822ae58de..e13669a6acbd 100644 --- a/Documentation/devicetree/bindings/input/qpnp-power-on.txt +++ b/Documentation/devicetree/bindings/input/qpnp-power-on.txt @@ -80,8 +80,8 @@ Optional properties: - qcom,shutdown-poweroff-type: Same description as qcom,warm-reset-poweroff- type but this applies for the system shutdown case. -- qcom,pon-sw-debounce Boolean property to enable software debouncing - logic for pon input keys. +- qcom,kpdpwr-sw-debounce: Boolean property to enable the debounce logic + on the KPDPWR_N rising edge. - qcom,resin-pon-reset: Boolean property which indicates that resin needs to be configured during reset in addition to the primary PON device that is configured diff --git a/drivers/input/misc/qpnp-power-on.c b/drivers/input/misc/qpnp-power-on.c index 14326303830b..e4025a6bbac8 100644 --- a/drivers/input/misc/qpnp-power-on.c +++ b/drivers/input/misc/qpnp-power-on.c @@ -167,7 +167,6 @@ enum pon_type { PON_RESIN = PON_POWER_ON_TYPE_RESIN, PON_CBLPWR = PON_POWER_ON_TYPE_CBLPWR, PON_KPDPWR_RESIN = PON_POWER_ON_TYPE_KPDPWR_RESIN, - PON_KEY_MAX }; struct pon_reg { @@ -238,12 +237,12 @@ struct qpnp_pon { bool resin_shutdown_disable; bool ps_hold_hard_reset_disable; bool ps_hold_shutdown_disable; + bool kpdpwr_dbc_enable; bool support_twm_config; bool resin_pon_reset; + ktime_t kpdpwr_last_release_time; struct notifier_block pon_nb; bool legacy_hard_reset_offset; - bool sw_dbc_enable; - ktime_t sw_dbc_last_release_time[PON_KEY_MAX]; }; static int pon_ship_mode_en; @@ -961,9 +960,9 @@ static int qpnp_pon_input_dispatch(struct qpnp_pon *pon, u32 pon_type) if (!cfg->key_code) return 0; - if (pon->sw_dbc_enable) { + if (pon->kpdpwr_dbc_enable && cfg->pon_type == PON_KPDPWR) { elapsed_us = ktime_us_delta(ktime_get(), - pon->sw_dbc_last_release_time[cfg->pon_type]); + pon->kpdpwr_last_release_time); if (elapsed_us < pon->dbc_time_us) { pr_debug("Ignoring kpdpwr event; within debounce time\n"); return 0; @@ -996,8 +995,10 @@ static int qpnp_pon_input_dispatch(struct qpnp_pon *pon, u32 pon_type) pon_rt_sts); key_status = pon_rt_sts & pon_rt_bit; - if (pon->sw_dbc_enable && !key_status) - pon->sw_dbc_last_release_time[cfg->pon_type] = ktime_get(); + if (pon->kpdpwr_dbc_enable && cfg->pon_type == PON_KPDPWR) { + if (!key_status) + pon->kpdpwr_last_release_time = ktime_get(); + } /* * Simulate a press event in case release event occurred without a press @@ -2424,8 +2425,8 @@ static int qpnp_pon_probe(struct platform_device *pdev) if (rc) return rc; - pon->sw_dbc_enable = of_property_read_bool(dev->of_node, - "qcom,pon-sw-debounce"); + pon->kpdpwr_dbc_enable = of_property_read_bool(dev->of_node, + "qcom,kpdpwr-sw-debounce"); pon->store_hard_reset_reason = of_property_read_bool(dev->of_node, "qcom,store-hard-reset-reason");