Re: [PATCH 1/3] input: pm8941-pwrkey: add support for PMK8350 PON_HLOS PMIC peripheral

2021-04-08 Thread Dmitry Torokhov
Hi Satya,

On Wed, Apr 07, 2021 at 08:59:39PM +0530, ska...@codeaurora.org wrote:
> Gentle Reminder!

Sorry, please address Rob's comments on the bindings, the driver code
looks OK to me.

Thanks.

-- 
Dmitry


Re: [PATCH 1/3] input: pm8941-pwrkey: add support for PMK8350 PON_HLOS PMIC peripheral

2021-04-07 Thread skakit

Gentle Reminder!

Thanks,
Satya Priya
On 2021-03-05 11:08, satya priya wrote:

From: David Collins 

On Qualcomm Technologies, Inc. PMIC PMK8350, the PON peripheral
is split into two peripherals: PON_HLOS and PON_PBS.  The
application processor only has write access to PON_HLOS which
limits it to only receiving PON interrupts.

Add support for the PMK8350 PON_HLOS peripheral so that its
KPDPWR_N and RESIN_N interrupts can be used to detect key
presses.

Signed-off-by: David Collins 
Signed-off-by: satya priya 
---
 drivers/input/misc/pm8941-pwrkey.c | 103 
++---

 1 file changed, 72 insertions(+), 31 deletions(-)

diff --git a/drivers/input/misc/pm8941-pwrkey.c
b/drivers/input/misc/pm8941-pwrkey.c
index cf81044..2044d187 100644
--- a/drivers/input/misc/pm8941-pwrkey.c
+++ b/drivers/input/misc/pm8941-pwrkey.c


[PATCH 1/3] input: pm8941-pwrkey: add support for PMK8350 PON_HLOS PMIC peripheral

2021-03-04 Thread satya priya
From: David Collins 

On Qualcomm Technologies, Inc. PMIC PMK8350, the PON peripheral
is split into two peripherals: PON_HLOS and PON_PBS.  The
application processor only has write access to PON_HLOS which
limits it to only receiving PON interrupts.

Add support for the PMK8350 PON_HLOS peripheral so that its
KPDPWR_N and RESIN_N interrupts can be used to detect key
presses.

Signed-off-by: David Collins 
Signed-off-by: satya priya 
---
 drivers/input/misc/pm8941-pwrkey.c | 103 ++---
 1 file changed, 72 insertions(+), 31 deletions(-)

diff --git a/drivers/input/misc/pm8941-pwrkey.c 
b/drivers/input/misc/pm8941-pwrkey.c
index cf81044..2044d187 100644
--- a/drivers/input/misc/pm8941-pwrkey.c
+++ b/drivers/input/misc/pm8941-pwrkey.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2010-2011, 2020, The Linux Foundation. All rights reserved.
  * Copyright (c) 2014, Sony Mobile Communications Inc.
  */
 
@@ -22,6 +22,8 @@
 #define PON_RT_STS 0x10
 #define  PON_KPDPWR_N_SET  BIT(0)
 #define  PON_RESIN_N_SET   BIT(1)
+#define  PON_GEN3_RESIN_N_SET  BIT(6)
+#define  PON_GEN3_KPDPWR_N_SET BIT(7)
 
 #define PON_PS_HOLD_RST_CTL0x5a
 #define PON_PS_HOLD_RST_CTL2   0x5b
@@ -38,8 +40,12 @@
 #define  PON_DBC_DELAY_MASK0x7
 
 struct pm8941_data {
-   unsigned int pull_up_bit;
-   unsigned int status_bit;
+   unsigned intpull_up_bit;
+   unsigned intstatus_bit;
+   boolsupports_ps_hold_poff_config;
+   boolsupports_debounce_config;
+   const char  *name;
+   const char  *phys;
 };
 
 struct pm8941_pwrkey {
@@ -231,34 +237,40 @@ static int pm8941_pwrkey_probe(struct platform_device 
*pdev)
 
input_set_capability(pwrkey->input, EV_KEY, pwrkey->code);
 
-   pwrkey->input->name = "pm8941_pwrkey";
-   pwrkey->input->phys = "pm8941_pwrkey/input0";
-
-   req_delay = (req_delay << 6) / USEC_PER_SEC;
-   req_delay = ilog2(req_delay);
-
-   error = regmap_update_bits(pwrkey->regmap,
-  pwrkey->baseaddr + PON_DBC_CTL,
-  PON_DBC_DELAY_MASK,
-  req_delay);
-   if (error) {
-   dev_err(>dev, "failed to set debounce: %d\n", error);
-   return error;
+   pwrkey->input->name = pwrkey->data->name;
+   pwrkey->input->phys = pwrkey->data->phys;
+
+   if (pwrkey->data->supports_debounce_config) {
+   req_delay = (req_delay << 6) / USEC_PER_SEC;
+   req_delay = ilog2(req_delay);
+
+   error = regmap_update_bits(pwrkey->regmap,
+  pwrkey->baseaddr + PON_DBC_CTL,
+  PON_DBC_DELAY_MASK,
+  req_delay);
+   if (error) {
+   dev_err(>dev, "failed to set debounce: %d\n",
+   error);
+   return error;
+   }
}
 
-   error = regmap_update_bits(pwrkey->regmap,
-  pwrkey->baseaddr + PON_PULL_CTL,
-  pwrkey->data->pull_up_bit,
-  pull_up ? pwrkey->data->pull_up_bit : 0);
-   if (error) {
-   dev_err(>dev, "failed to set pull: %d\n", error);
-   return error;
+   if (pwrkey->data->pull_up_bit) {
+   error = regmap_update_bits(pwrkey->regmap,
+  pwrkey->baseaddr + PON_PULL_CTL,
+  pwrkey->data->pull_up_bit,
+  pull_up ? pwrkey->data->pull_up_bit :
+0);
+   if (error) {
+   dev_err(>dev, "failed to set pull: %d\n", error);
+   return error;
+   }
}
 
error = devm_request_threaded_irq(>dev, pwrkey->irq,
  NULL, pm8941_pwrkey_irq,
  IRQF_ONESHOT,
- "pm8941_pwrkey", pwrkey);
+ pwrkey->data->name, pwrkey);
if (error) {
dev_err(>dev, "failed requesting IRQ: %d\n", error);
return error;
@@ -271,12 +283,14 @@ static int pm8941_pwrkey_probe(struct platform_device 
*pdev)
return error;
}
 
-   pwrkey->reboot_notifier.notifier_call = pm8941_reboot_notify,
-   error = register_reboot_notifier(>reboot_notifier);
-   if (error) {
-   dev_err(>dev, "failed to register reboot notifier: %d\n",
-   error);
-