Linux Input Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2 0/3] DA9063 Onkey Improvements and Fixes
@ 2019-11-27 13:23 Marco Felsch
  2019-11-27 13:23 ` [PATCH v2 1/3] dt-bindings: Input: da9062 - add key-opmode documentation Marco Felsch
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Marco Felsch @ 2019-11-27 13:23 UTC (permalink / raw)
  To: support.opensource, stwiss.opensource, dmitry.torokhov, robh+dt,
	Adam.Thomson.Opensource
  Cc: devicetree, kernel, linux-input

Hi,

this is v2 contains all comments made on [1]. Please check the patch
based changelog for further information. Patch "Input: da9063 - fix
capability and drop KEY_SLEEP"  is already applied mainline.

[1] https://www.spinics.net/lists/devicetree/msg309431.html

Marco Felsch (3):
  dt-bindings: Input: da9062 - add key-opmode documentation
  input: misc: da9063_onkey: add mode change support
  dt-bindings: Input: da9062 - fix dlg,disable-key-power description

 .../devicetree/bindings/input/da9062-onkey.txt   | 15 ++++++++++++---
 drivers/input/misc/da9063_onkey.c                | 16 ++++++++++++++++
 drivers/mfd/da9062-core.c                        |  1 +
 3 files changed, 29 insertions(+), 3 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 1/3] dt-bindings: Input: da9062 - add key-opmode documentation
  2019-11-27 13:23 [PATCH v2 0/3] DA9063 Onkey Improvements and Fixes Marco Felsch
@ 2019-11-27 13:23 ` Marco Felsch
  2019-12-02 11:38   ` Adam Thomson
                     ` (2 more replies)
  2019-11-27 13:23 ` [PATCH v2 2/3] input: misc: da9063_onkey: add mode change support Marco Felsch
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 18+ messages in thread
From: Marco Felsch @ 2019-11-27 13:23 UTC (permalink / raw)
  To: support.opensource, stwiss.opensource, dmitry.torokhov, robh+dt,
	Adam.Thomson.Opensource
  Cc: devicetree, kernel, linux-input

The onkey behaviour can be changed by programming the NONKEY_PIN
bitfield. Since the driver supports the reconfiguration we need to add
the documentation here.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
v2:
- add da9061/3 references
- adapt binding description to be more general

 .../devicetree/bindings/input/da9062-onkey.txt         | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/da9062-onkey.txt b/Documentation/devicetree/bindings/input/da9062-onkey.txt
index 5f9fbc68e58a..0005b2bdcdd7 100644
--- a/Documentation/devicetree/bindings/input/da9062-onkey.txt
+++ b/Documentation/devicetree/bindings/input/da9062-onkey.txt
@@ -19,6 +19,16 @@ Optional properties:
     entry exists the OnKey driver will remove support for the KEY_POWER key
     press when triggered using a long press of the OnKey.
 
+- dlg,key-opmode : Set the nONKEY behaviour. This value is initial set by the
+    otp values. See nONKEY_PIN register description for more information.
+    Valid value range: 0x0..0x3
+
+References:
+
+[1] https://www.dialog-semiconductor.com/sites/default/files/da9061_datasheet_3v6.pdf
+[2] https://www.dialog-semiconductor.com/sites/default/files/da9062_datasheet_3v6.pdf
+[3] https://www.dialog-semiconductor.com/sites/default/files/da9063_datasheet_2v2.pdf
+
 Example: DA9063
 
 	pmic0: da9063@58 {
-- 
2.20.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 2/3] input: misc: da9063_onkey: add mode change support
  2019-11-27 13:23 [PATCH v2 0/3] DA9063 Onkey Improvements and Fixes Marco Felsch
  2019-11-27 13:23 ` [PATCH v2 1/3] dt-bindings: Input: da9062 - add key-opmode documentation Marco Felsch
@ 2019-11-27 13:23 ` Marco Felsch
  2019-12-02 12:01   ` Adam Thomson
  2020-01-08  8:48   ` Marco Felsch
  2019-11-27 13:23 ` [PATCH v2 3/3] dt-bindings: Input: da9062 - fix dlg,disable-key-power description Marco Felsch
  2020-01-16  8:51 ` [PATCH v2 0/3] DA9063 Onkey Improvements and Fixes Marco Felsch
  3 siblings, 2 replies; 18+ messages in thread
From: Marco Felsch @ 2019-11-27 13:23 UTC (permalink / raw)
  To: support.opensource, stwiss.opensource, dmitry.torokhov, robh+dt,
	Adam.Thomson.Opensource
  Cc: devicetree, kernel, linux-input

The pmic state machine behaviour upon a 'onkey press' event can be
configured using the ONKEY_PIN bit field. Most the time this is
configured correct by the OTP but sometimes we need to adjust the
behaviour so we need to add the support here.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
v2:
- make use of da906x_chip_config
- rm unnecessary key_opmode

 drivers/input/misc/da9063_onkey.c | 16 ++++++++++++++++
 drivers/mfd/da9062-core.c         |  1 +
 2 files changed, 17 insertions(+)

diff --git a/drivers/input/misc/da9063_onkey.c b/drivers/input/misc/da9063_onkey.c
index 79851923ee57..3a3f06a33eda 100644
--- a/drivers/input/misc/da9063_onkey.c
+++ b/drivers/input/misc/da9063_onkey.c
@@ -19,6 +19,7 @@
 
 struct da906x_chip_config {
 	/* REGS */
+	int onkey_config;
 	int onkey_status;
 	int onkey_pwr_signalling;
 	int onkey_fault_log;
@@ -26,6 +27,7 @@ struct da906x_chip_config {
 	/* MASKS */
 	int onkey_nonkey_mask;
 	int onkey_nonkey_lock_mask;
+	int onkey_nonkey_pin_mask;
 	int onkey_key_reset_mask;
 	int onkey_shutdown_mask;
 	/* NAMES */
@@ -44,6 +46,7 @@ struct da9063_onkey {
 
 static const struct da906x_chip_config da9063_regs = {
 	/* REGS */
+	.onkey_config = DA9063_REG_CONFIG_I,
 	.onkey_status = DA9063_REG_STATUS_A,
 	.onkey_pwr_signalling = DA9063_REG_CONTROL_B,
 	.onkey_fault_log = DA9063_REG_FAULT_LOG,
@@ -51,6 +54,7 @@ static const struct da906x_chip_config da9063_regs = {
 	/* MASKS */
 	.onkey_nonkey_mask = DA9063_NONKEY,
 	.onkey_nonkey_lock_mask = DA9063_NONKEY_LOCK,
+	.onkey_nonkey_pin_mask = DA9063_NONKEY_PIN_MASK,
 	.onkey_key_reset_mask = DA9063_KEY_RESET,
 	.onkey_shutdown_mask = DA9063_SHUTDOWN,
 	/* NAMES */
@@ -59,6 +63,7 @@ static const struct da906x_chip_config da9063_regs = {
 
 static const struct da906x_chip_config da9062_regs = {
 	/* REGS */
+	.onkey_config = DA9062AA_CONFIG_I,
 	.onkey_status = DA9062AA_STATUS_A,
 	.onkey_pwr_signalling = DA9062AA_CONTROL_B,
 	.onkey_fault_log = DA9062AA_FAULT_LOG,
@@ -66,6 +71,7 @@ static const struct da906x_chip_config da9062_regs = {
 	/* MASKS */
 	.onkey_nonkey_mask = DA9062AA_NONKEY_MASK,
 	.onkey_nonkey_lock_mask = DA9062AA_NONKEY_LOCK_MASK,
+	.onkey_nonkey_pin_mask = DA9062AA_NONKEY_PIN_MASK,
 	.onkey_key_reset_mask = DA9062AA_KEY_RESET_MASK,
 	.onkey_shutdown_mask = DA9062AA_SHUTDOWN_MASK,
 	/* NAMES */
@@ -193,6 +199,7 @@ static int da9063_onkey_probe(struct platform_device *pdev)
 {
 	struct da9063_onkey *onkey;
 	const struct of_device_id *match;
+	unsigned int val;
 	int irq;
 	int error;
 
@@ -220,6 +227,15 @@ static int da9063_onkey_probe(struct platform_device *pdev)
 	onkey->key_power = !of_property_read_bool(pdev->dev.of_node,
 						  "dlg,disable-key-power");
 
+	if (!of_property_read_u32(pdev->dev.of_node, "dlg,key-opmode", &val)) {
+		error = regmap_update_bits(onkey->regmap,
+					   onkey->config->onkey_config,
+					   onkey->config->onkey_nonkey_pin_mask,
+					   val);
+		if (error)
+			return error;
+	}
+
 	onkey->input = devm_input_allocate_device(&pdev->dev);
 	if (!onkey->input) {
 		dev_err(&pdev->dev, "Failed to allocated input device.\n");
diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c
index e69626867c26..aaa1f1841bc3 100644
--- a/drivers/mfd/da9062-core.c
+++ b/drivers/mfd/da9062-core.c
@@ -510,6 +510,7 @@ static const struct regmap_range da9062_aa_writeable_ranges[] = {
 	regmap_reg_range(DA9062AA_VLDO1_B, DA9062AA_VLDO4_B),
 	regmap_reg_range(DA9062AA_BBAT_CONT, DA9062AA_BBAT_CONT),
 	regmap_reg_range(DA9062AA_GP_ID_0, DA9062AA_GP_ID_19),
+	regmap_reg_range(DA9062AA_CONFIG_I, DA9062AA_CONFIG_I),
 };
 
 static const struct regmap_range da9062_aa_volatile_ranges[] = {
-- 
2.20.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 3/3] dt-bindings: Input: da9062 - fix dlg,disable-key-power description
  2019-11-27 13:23 [PATCH v2 0/3] DA9063 Onkey Improvements and Fixes Marco Felsch
  2019-11-27 13:23 ` [PATCH v2 1/3] dt-bindings: Input: da9062 - add key-opmode documentation Marco Felsch
  2019-11-27 13:23 ` [PATCH v2 2/3] input: misc: da9063_onkey: add mode change support Marco Felsch
@ 2019-11-27 13:23 ` Marco Felsch
  2019-12-02 12:15   ` Adam Thomson
  2019-12-05 21:38   ` Rob Herring
  2020-01-16  8:51 ` [PATCH v2 0/3] DA9063 Onkey Improvements and Fixes Marco Felsch
  3 siblings, 2 replies; 18+ messages in thread
From: Marco Felsch @ 2019-11-27 13:23 UTC (permalink / raw)
  To: support.opensource, stwiss.opensource, dmitry.torokhov, robh+dt,
	Adam.Thomson.Opensource
  Cc: devicetree, kernel, linux-input

There was a bug within the driver since commit f889beaaab1c ("Input:
da9063 - report KEY_POWER instead of KEY_SLEEP during power
key-press"). Since we fixed the bug the KEY_POWER will be reported
always so we need to adapt the dt-bindings too. Make the description
more precise while on it.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
v2:
- change description according Dmitry's suggestion.

 Documentation/devicetree/bindings/input/da9062-onkey.txt | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/input/da9062-onkey.txt b/Documentation/devicetree/bindings/input/da9062-onkey.txt
index 0005b2bdcdd7..9f895454179d 100644
--- a/Documentation/devicetree/bindings/input/da9062-onkey.txt
+++ b/Documentation/devicetree/bindings/input/da9062-onkey.txt
@@ -15,9 +15,8 @@ Required properties:
 
 Optional properties:
 
-- dlg,disable-key-power : Disable power-down using a long key-press. If this
-    entry exists the OnKey driver will remove support for the KEY_POWER key
-    press when triggered using a long press of the OnKey.
+- dlg,disable-key-power : If this property is present, the host will not be
+    issuing shutdown command over I2C in response to a long key-press.
 
 - dlg,key-opmode : Set the nONKEY behaviour. This value is initial set by the
     otp values. See nONKEY_PIN register description for more information.
-- 
2.20.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [PATCH v2 1/3] dt-bindings: Input: da9062 - add key-opmode documentation
  2019-11-27 13:23 ` [PATCH v2 1/3] dt-bindings: Input: da9062 - add key-opmode documentation Marco Felsch
@ 2019-12-02 11:38   ` Adam Thomson
  2019-12-05 21:40   ` Rob Herring
  2020-01-22  5:57   ` Dmitry Torokhov
  2 siblings, 0 replies; 18+ messages in thread
From: Adam Thomson @ 2019-12-02 11:38 UTC (permalink / raw)
  To: Marco Felsch, Support Opensource, Steve Twiss, dmitry.torokhov,
	robh+dt, Adam Thomson
  Cc: devicetree, kernel, linux-input

On 27 November 2019 13:23, Marco Felsch wrote:

> The onkey behaviour can be changed by programming the NONKEY_PIN
> bitfield. Since the driver supports the reconfiguration we need to add
> the documentation here.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>

Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

> ---
> v2:
> - add da9061/3 references
> - adapt binding description to be more general
> 
>  .../devicetree/bindings/input/da9062-onkey.txt         | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/input/da9062-onkey.txt
> b/Documentation/devicetree/bindings/input/da9062-onkey.txt
> index 5f9fbc68e58a..0005b2bdcdd7 100644
> --- a/Documentation/devicetree/bindings/input/da9062-onkey.txt
> +++ b/Documentation/devicetree/bindings/input/da9062-onkey.txt
> @@ -19,6 +19,16 @@ Optional properties:
>      entry exists the OnKey driver will remove support for the KEY_POWER key
>      press when triggered using a long press of the OnKey.
> 
> +- dlg,key-opmode : Set the nONKEY behaviour. This value is initial set by the
> +    otp values. See nONKEY_PIN register description for more information.
> +    Valid value range: 0x0..0x3
> +
> +References:
> +
> +[1] https://www.dialog-
> semiconductor.com/sites/default/files/da9061_datasheet_3v6.pdf
> +[2] https://www.dialog-
> semiconductor.com/sites/default/files/da9062_datasheet_3v6.pdf
> +[3] https://www.dialog-
> semiconductor.com/sites/default/files/da9063_datasheet_2v2.pdf
> +
>  Example: DA9063
> 
>  	pmic0: da9063@58 {
> --
> 2.20.1

^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [PATCH v2 2/3] input: misc: da9063_onkey: add mode change support
  2019-11-27 13:23 ` [PATCH v2 2/3] input: misc: da9063_onkey: add mode change support Marco Felsch
@ 2019-12-02 12:01   ` Adam Thomson
  2020-01-08  8:48   ` Marco Felsch
  1 sibling, 0 replies; 18+ messages in thread
From: Adam Thomson @ 2019-12-02 12:01 UTC (permalink / raw)
  To: Marco Felsch, Support Opensource, Steve Twiss, dmitry.torokhov,
	robh+dt, Adam Thomson
  Cc: devicetree, kernel, linux-input

On 27 November 2019 13:23, Marco Felsch wrote:

> The pmic state machine behaviour upon a 'onkey press' event can be
> configured using the ONKEY_PIN bit field. Most the time this is
> configured correct by the OTP but sometimes we need to adjust the
> behaviour so we need to add the support here.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>

Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

> ---
> v2:
> - make use of da906x_chip_config
> - rm unnecessary key_opmode
> 
>  drivers/input/misc/da9063_onkey.c | 16 ++++++++++++++++
>  drivers/mfd/da9062-core.c         |  1 +
>  2 files changed, 17 insertions(+)
> 
> diff --git a/drivers/input/misc/da9063_onkey.c
> b/drivers/input/misc/da9063_onkey.c
> index 79851923ee57..3a3f06a33eda 100644
> --- a/drivers/input/misc/da9063_onkey.c
> +++ b/drivers/input/misc/da9063_onkey.c
> @@ -19,6 +19,7 @@
> 
>  struct da906x_chip_config {
>  	/* REGS */
> +	int onkey_config;
>  	int onkey_status;
>  	int onkey_pwr_signalling;
>  	int onkey_fault_log;
> @@ -26,6 +27,7 @@ struct da906x_chip_config {
>  	/* MASKS */
>  	int onkey_nonkey_mask;
>  	int onkey_nonkey_lock_mask;
> +	int onkey_nonkey_pin_mask;
>  	int onkey_key_reset_mask;
>  	int onkey_shutdown_mask;
>  	/* NAMES */
> @@ -44,6 +46,7 @@ struct da9063_onkey {
> 
>  static const struct da906x_chip_config da9063_regs = {
>  	/* REGS */
> +	.onkey_config = DA9063_REG_CONFIG_I,
>  	.onkey_status = DA9063_REG_STATUS_A,
>  	.onkey_pwr_signalling = DA9063_REG_CONTROL_B,
>  	.onkey_fault_log = DA9063_REG_FAULT_LOG,
> @@ -51,6 +54,7 @@ static const struct da906x_chip_config da9063_regs = {
>  	/* MASKS */
>  	.onkey_nonkey_mask = DA9063_NONKEY,
>  	.onkey_nonkey_lock_mask = DA9063_NONKEY_LOCK,
> +	.onkey_nonkey_pin_mask = DA9063_NONKEY_PIN_MASK,
>  	.onkey_key_reset_mask = DA9063_KEY_RESET,
>  	.onkey_shutdown_mask = DA9063_SHUTDOWN,
>  	/* NAMES */
> @@ -59,6 +63,7 @@ static const struct da906x_chip_config da9063_regs = {
> 
>  static const struct da906x_chip_config da9062_regs = {
>  	/* REGS */
> +	.onkey_config = DA9062AA_CONFIG_I,
>  	.onkey_status = DA9062AA_STATUS_A,
>  	.onkey_pwr_signalling = DA9062AA_CONTROL_B,
>  	.onkey_fault_log = DA9062AA_FAULT_LOG,
> @@ -66,6 +71,7 @@ static const struct da906x_chip_config da9062_regs = {
>  	/* MASKS */
>  	.onkey_nonkey_mask = DA9062AA_NONKEY_MASK,
>  	.onkey_nonkey_lock_mask = DA9062AA_NONKEY_LOCK_MASK,
> +	.onkey_nonkey_pin_mask = DA9062AA_NONKEY_PIN_MASK,
>  	.onkey_key_reset_mask = DA9062AA_KEY_RESET_MASK,
>  	.onkey_shutdown_mask = DA9062AA_SHUTDOWN_MASK,
>  	/* NAMES */
> @@ -193,6 +199,7 @@ static int da9063_onkey_probe(struct platform_device
> *pdev)
>  {
>  	struct da9063_onkey *onkey;
>  	const struct of_device_id *match;
> +	unsigned int val;
>  	int irq;
>  	int error;
> 
> @@ -220,6 +227,15 @@ static int da9063_onkey_probe(struct platform_device
> *pdev)
>  	onkey->key_power = !of_property_read_bool(pdev->dev.of_node,
>  						  "dlg,disable-key-power");
> 
> +	if (!of_property_read_u32(pdev->dev.of_node, "dlg,key-opmode",
> &val)) {
> +		error = regmap_update_bits(onkey->regmap,
> +					   onkey->config->onkey_config,
> +					   onkey->config-
> >onkey_nonkey_pin_mask,
> +					   val);
> +		if (error)
> +			return error;
> +	}
> +
>  	onkey->input = devm_input_allocate_device(&pdev->dev);
>  	if (!onkey->input) {
>  		dev_err(&pdev->dev, "Failed to allocated input device.\n");
> diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c
> index e69626867c26..aaa1f1841bc3 100644
> --- a/drivers/mfd/da9062-core.c
> +++ b/drivers/mfd/da9062-core.c
> @@ -510,6 +510,7 @@ static const struct regmap_range
> da9062_aa_writeable_ranges[] = {
>  	regmap_reg_range(DA9062AA_VLDO1_B, DA9062AA_VLDO4_B),
>  	regmap_reg_range(DA9062AA_BBAT_CONT, DA9062AA_BBAT_CONT),
>  	regmap_reg_range(DA9062AA_GP_ID_0, DA9062AA_GP_ID_19),
> +	regmap_reg_range(DA9062AA_CONFIG_I, DA9062AA_CONFIG_I),
>  };
> 
>  static const struct regmap_range da9062_aa_volatile_ranges[] = {
> --
> 2.20.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [PATCH v2 3/3] dt-bindings: Input: da9062 - fix dlg,disable-key-power description
  2019-11-27 13:23 ` [PATCH v2 3/3] dt-bindings: Input: da9062 - fix dlg,disable-key-power description Marco Felsch
@ 2019-12-02 12:15   ` Adam Thomson
  2019-12-10  8:27     ` Marco Felsch
  2019-12-05 21:38   ` Rob Herring
  1 sibling, 1 reply; 18+ messages in thread
From: Adam Thomson @ 2019-12-02 12:15 UTC (permalink / raw)
  To: Marco Felsch, Support Opensource, Steve Twiss, dmitry.torokhov,
	robh+dt, Adam Thomson
  Cc: devicetree, kernel, linux-input

On 27 November 2019 13:23, Marco Felsch wrote:

> There was a bug within the driver since commit f889beaaab1c ("Input:
> da9063 - report KEY_POWER instead of KEY_SLEEP during power
> key-press"). Since we fixed the bug the KEY_POWER will be reported
> always so we need to adapt the dt-bindings too. Make the description
> more precise while on it.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
> v2:
> - change description according Dmitry's suggestion.
> 
>  Documentation/devicetree/bindings/input/da9062-onkey.txt | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/input/da9062-onkey.txt
> b/Documentation/devicetree/bindings/input/da9062-onkey.txt
> index 0005b2bdcdd7..9f895454179d 100644
> --- a/Documentation/devicetree/bindings/input/da9062-onkey.txt
> +++ b/Documentation/devicetree/bindings/input/da9062-onkey.txt
> @@ -15,9 +15,8 @@ Required properties:
> 
>  Optional properties:
> 
> -- dlg,disable-key-power : Disable power-down using a long key-press. If this
> -    entry exists the OnKey driver will remove support for the KEY_POWER key
> -    press when triggered using a long press of the OnKey.
> +- dlg,disable-key-power : If this property is present, the host will not be
> +    issuing shutdown command over I2C in response to a long key-press.

This also changes behaviour of button press reporting as the driver will not
report a longer press (i.e. a button hold where the driver polls for release).
It will only report a short key press to user-space with this property provided.

The question here is do we still want to support long press reporting but
without the I2C sequence for shutdown? If so the driver needs to be updated to
work this way as right now it doesn't.

> 
>  - dlg,key-opmode : Set the nONKEY behaviour. This value is initial set by the
>      otp values. See nONKEY_PIN register description for more information.
> --
> 2.20.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 3/3] dt-bindings: Input: da9062 - fix dlg,disable-key-power description
  2019-11-27 13:23 ` [PATCH v2 3/3] dt-bindings: Input: da9062 - fix dlg,disable-key-power description Marco Felsch
  2019-12-02 12:15   ` Adam Thomson
@ 2019-12-05 21:38   ` Rob Herring
  1 sibling, 0 replies; 18+ messages in thread
From: Rob Herring @ 2019-12-05 21:38 UTC (permalink / raw)
  To: Marco Felsch
  Cc: support.opensource, stwiss.opensource, dmitry.torokhov,
	Adam.Thomson.Opensource, devicetree, kernel, linux-input

On Wed, Nov 27, 2019 at 02:23:04PM +0100, Marco Felsch wrote:
> There was a bug within the driver since commit f889beaaab1c ("Input:
> da9063 - report KEY_POWER instead of KEY_SLEEP during power
> key-press"). Since we fixed the bug the KEY_POWER will be reported
> always so we need to adapt the dt-bindings too. Make the description
> more precise while on it.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
> v2:
> - change description according Dmitry's suggestion.
> 
>  Documentation/devicetree/bindings/input/da9062-onkey.txt | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/input/da9062-onkey.txt b/Documentation/devicetree/bindings/input/da9062-onkey.txt
> index 0005b2bdcdd7..9f895454179d 100644
> --- a/Documentation/devicetree/bindings/input/da9062-onkey.txt
> +++ b/Documentation/devicetree/bindings/input/da9062-onkey.txt
> @@ -15,9 +15,8 @@ Required properties:
>  
>  Optional properties:
>  
> -- dlg,disable-key-power : Disable power-down using a long key-press. If this
> -    entry exists the OnKey driver will remove support for the KEY_POWER key
> -    press when triggered using a long press of the OnKey.
> +- dlg,disable-key-power : If this property is present, the host will not be
> +    issuing shutdown command over I2C in response to a long key-press.

This seems odd. Typically a long key press is used when the system is 
locked up and would have to be a h/w mechanism. 

Also, the new wording sounds like s/w policy, not h/w configuration. 
What the OS does in response to KEY_POWER doesn't belong in DT.

>  
>  - dlg,key-opmode : Set the nONKEY behaviour. This value is initial set by the
>      otp values. See nONKEY_PIN register description for more information.
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/3] dt-bindings: Input: da9062 - add key-opmode documentation
  2019-11-27 13:23 ` [PATCH v2 1/3] dt-bindings: Input: da9062 - add key-opmode documentation Marco Felsch
  2019-12-02 11:38   ` Adam Thomson
@ 2019-12-05 21:40   ` Rob Herring
  2020-01-22  5:57   ` Dmitry Torokhov
  2 siblings, 0 replies; 18+ messages in thread
From: Rob Herring @ 2019-12-05 21:40 UTC (permalink / raw)
  To: Marco Felsch
  Cc: support.opensource, stwiss.opensource, dmitry.torokhov,
	Adam.Thomson.Opensource, devicetree, kernel, linux-input

On Wed, Nov 27, 2019 at 02:23:02PM +0100, Marco Felsch wrote:
> The onkey behaviour can be changed by programming the NONKEY_PIN
> bitfield. Since the driver supports the reconfiguration we need to add
> the documentation here.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
> v2:
> - add da9061/3 references
> - adapt binding description to be more general
> 
>  .../devicetree/bindings/input/da9062-onkey.txt         | 10 ++++++++++
>  1 file changed, 10 insertions(+)

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 3/3] dt-bindings: Input: da9062 - fix dlg,disable-key-power description
  2019-12-02 12:15   ` Adam Thomson
@ 2019-12-10  8:27     ` Marco Felsch
  2019-12-12 10:08       ` Adam Thomson
  0 siblings, 1 reply; 18+ messages in thread
From: Marco Felsch @ 2019-12-10  8:27 UTC (permalink / raw)
  To: Adam Thomson
  Cc: Support Opensource, Steve Twiss, dmitry.torokhov, robh+dt,
	devicetree, kernel, linux-input

Hi Adam,

On 19-12-02 12:15, Adam Thomson wrote:
> On 27 November 2019 13:23, Marco Felsch wrote:
> 
> > There was a bug within the driver since commit f889beaaab1c ("Input:
> > da9063 - report KEY_POWER instead of KEY_SLEEP during power
> > key-press"). Since we fixed the bug the KEY_POWER will be reported
> > always so we need to adapt the dt-bindings too. Make the description
> > more precise while on it.
> > 
> > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > ---
> > v2:
> > - change description according Dmitry's suggestion.
> > 
> >  Documentation/devicetree/bindings/input/da9062-onkey.txt | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > b/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > index 0005b2bdcdd7..9f895454179d 100644
> > --- a/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > +++ b/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > @@ -15,9 +15,8 @@ Required properties:
> > 
> >  Optional properties:
> > 
> > -- dlg,disable-key-power : Disable power-down using a long key-press. If this
> > -    entry exists the OnKey driver will remove support for the KEY_POWER key
> > -    press when triggered using a long press of the OnKey.
> > +- dlg,disable-key-power : If this property is present, the host will not be
> > +    issuing shutdown command over I2C in response to a long key-press.
> 
> This also changes behaviour of button press reporting as the driver will not
> report a longer press (i.e. a button hold where the driver polls for release).
> It will only report a short key press to user-space with this property provided.
> 
> The question here is do we still want to support long press reporting but
> without the I2C sequence for shutdown? If so the driver needs to be updated to
> work this way as right now it doesn't.

Good point. I checked the driver and the documentation for the
da9062/3 again and it seems that we interrupt the pmic hw by doing the
shutdown by itself. As the documentation says:

DA9063:
If the hardware reset was initiated by a (debounced) press of nONKEY (or
GPIO14 and GPIO15 together) longer than SD_DELAY, the DA9063 initially
only asserts control bit KEY_RESET in the fault register and signals a
non-maskable interrupt allowing the host to clear the armed reset
sequence within 1 s. If the host does not clear KEY_RESET then a
shutdown to RESET mode is executed. KEY_SD_MODE determines if normal
power sequence timing or a fast shutdown is implemented.

DA9062:
If the reset was initiated by a user’s long press of nONKEY, initially
only KEY_RESET is set and the nIRQ port will be asserted. KEY_RESET
signals the host that a shutdown sequence is started. If the host does
not then clear KEY_RESET within 1 s by writing a 1 to the related bit in
register FAULT_LOG, the shutdown sequence will complete. When the reset
condition has disappeared, DA9062 requires a supply (VSYS >
VDD_FAULT_UPPER) that provides enough power to start-up from the
POWERDOWN mode.

So we don't need to check for the KEY_RESET? This would cleanup the code
a bit.

Regards,
  Marco 

> > 
> >  - dlg,key-opmode : Set the nONKEY behaviour. This value is initial set by the
> >      otp values. See nONKEY_PIN register description for more information.
> > --
> > 2.20.1
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [PATCH v2 3/3] dt-bindings: Input: da9062 - fix dlg,disable-key-power description
  2019-12-10  8:27     ` Marco Felsch
@ 2019-12-12 10:08       ` Adam Thomson
  2020-01-07  8:08         ` Marco Felsch
  0 siblings, 1 reply; 18+ messages in thread
From: Adam Thomson @ 2019-12-12 10:08 UTC (permalink / raw)
  To: Marco Felsch, Adam Thomson
  Cc: Support Opensource, Steve Twiss, dmitry.torokhov, robh+dt,
	devicetree, kernel, linux-input

On 10 December 2019 08:28, Marco Felsch wrote:

> Hi Adam,
>
> On 19-12-02 12:15, Adam Thomson wrote:
> > On 27 November 2019 13:23, Marco Felsch wrote:
> >
> > > There was a bug within the driver since commit f889beaaab1c ("Input:
> > > da9063 - report KEY_POWER instead of KEY_SLEEP during power
> > > key-press"). Since we fixed the bug the KEY_POWER will be reported
> > > always so we need to adapt the dt-bindings too. Make the description
> > > more precise while on it.
> > >
> > > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > > ---
> > > v2:
> > > - change description according Dmitry's suggestion.
> > >
> > >  Documentation/devicetree/bindings/input/da9062-onkey.txt | 5 ++---
> > >  1 file changed, 2 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > > b/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > > index 0005b2bdcdd7..9f895454179d 100644
> > > --- a/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > > +++ b/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > > @@ -15,9 +15,8 @@ Required properties:
> > >
> > >  Optional properties:
> > >
> > > -- dlg,disable-key-power : Disable power-down using a long key-press. If this
> > > -    entry exists the OnKey driver will remove support for the KEY_POWER key
> > > -    press when triggered using a long press of the OnKey.
> > > +- dlg,disable-key-power : If this property is present, the host will not be
> > > +    issuing shutdown command over I2C in response to a long key-press.
> >
> > This also changes behaviour of button press reporting as the driver will not
> > report a longer press (i.e. a button hold where the driver polls for release).
> > It will only report a short key press to user-space with this property provided.
> >
> > The question here is do we still want to support long press reporting but
> > without the I2C sequence for shutdown? If so the driver needs to be updated
> to
> > work this way as right now it doesn't.
>
> Good point. I checked the driver and the documentation for the
> da9062/3 again and it seems that we interrupt the pmic hw by doing the
> shutdown by itself. As the documentation says:
>
> DA9063:
> If the hardware reset was initiated by a (debounced) press of nONKEY (or
> GPIO14 and GPIO15 together) longer than SD_DELAY, the DA9063 initially
> only asserts control bit KEY_RESET in the fault register and signals a
> non-maskable interrupt allowing the host to clear the armed reset
> sequence within 1 s. If the host does not clear KEY_RESET then a
> shutdown to RESET mode is executed. KEY_SD_MODE determines if normal
> power sequence timing or a fast shutdown is implemented.
>
> DA9062:
> If the reset was initiated by a user’s long press of nONKEY, initially
> only KEY_RESET is set and the nIRQ port will be asserted. KEY_RESET
> signals the host that a shutdown sequence is started. If the host does
> not then clear KEY_RESET within 1 s by writing a 1 to the related bit in
> register FAULT_LOG, the shutdown sequence will complete. When the reset
> condition has disappeared, DA9062 requires a supply (VSYS >
> VDD_FAULT_UPPER) that provides enough power to start-up from the
> POWERDOWN mode.
>
> So we don't need to check for the KEY_RESET? This would cleanup the code
> a bit.

We could remove that but I think the intention originally was to have this code
there in case there was some way to more gracefully shutdown the system in this
scenario. Right now that's not the case as the code simply calls to shutdown
the pmic via a manual register call, but maybe in the future this could be made
more gracful. Another slight advantage of leaving that code in is that we're
not waiting for another second delay for the PMIC to pull the plug.

With regards to this patch and the subsequent one to update the OnKey driver, I
think we should deprecate this property. The OnKey mode binding you added in
a different patch will configure the OnKey according to how you want it to
behave in hardware so I don't think this property makes much sense anymore. We
can then remove the need for 'key_power' usage in the driver.

>
> Regards,
>   Marco
>
> > >
> > >  - dlg,key-opmode : Set the nONKEY behaviour. This value is initial set by the
> > >      otp values. See nONKEY_PIN register description for more information.
> > > --
> > > 2.20.1
> >
> >
>
> --
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 3/3] dt-bindings: Input: da9062 - fix dlg,disable-key-power description
  2019-12-12 10:08       ` Adam Thomson
@ 2020-01-07  8:08         ` Marco Felsch
  2020-01-08 10:05           ` Adam Thomson
  0 siblings, 1 reply; 18+ messages in thread
From: Marco Felsch @ 2020-01-07  8:08 UTC (permalink / raw)
  To: Adam Thomson
  Cc: Support Opensource, Steve Twiss, dmitry.torokhov, robh+dt,
	devicetree, kernel, linux-input

Hi Adam, Dmitry,

On 19-12-12 10:08, Adam Thomson wrote:
> On 10 December 2019 08:28, Marco Felsch wrote:
> 
> > Hi Adam,
> >
> > On 19-12-02 12:15, Adam Thomson wrote:
> > > On 27 November 2019 13:23, Marco Felsch wrote:
> > >
> > > > There was a bug within the driver since commit f889beaaab1c ("Input:
> > > > da9063 - report KEY_POWER instead of KEY_SLEEP during power
> > > > key-press"). Since we fixed the bug the KEY_POWER will be reported
> > > > always so we need to adapt the dt-bindings too. Make the description
> > > > more precise while on it.
> > > >
> > > > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > > > ---
> > > > v2:
> > > > - change description according Dmitry's suggestion.
> > > >
> > > >  Documentation/devicetree/bindings/input/da9062-onkey.txt | 5 ++---
> > > >  1 file changed, 2 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > > > b/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > > > index 0005b2bdcdd7..9f895454179d 100644
> > > > --- a/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > > > +++ b/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > > > @@ -15,9 +15,8 @@ Required properties:
> > > >
> > > >  Optional properties:
> > > >
> > > > -- dlg,disable-key-power : Disable power-down using a long key-press. If this
> > > > -    entry exists the OnKey driver will remove support for the KEY_POWER key
> > > > -    press when triggered using a long press of the OnKey.
> > > > +- dlg,disable-key-power : If this property is present, the host will not be
> > > > +    issuing shutdown command over I2C in response to a long key-press.
> > >
> > > This also changes behaviour of button press reporting as the driver will not
> > > report a longer press (i.e. a button hold where the driver polls for release).
> > > It will only report a short key press to user-space with this property provided.
> > >
> > > The question here is do we still want to support long press reporting but
> > > without the I2C sequence for shutdown? If so the driver needs to be updated
> > to
> > > work this way as right now it doesn't.
> >
> > Good point. I checked the driver and the documentation for the
> > da9062/3 again and it seems that we interrupt the pmic hw by doing the
> > shutdown by itself. As the documentation says:
> >
> > DA9063:
> > If the hardware reset was initiated by a (debounced) press of nONKEY (or
> > GPIO14 and GPIO15 together) longer than SD_DELAY, the DA9063 initially
> > only asserts control bit KEY_RESET in the fault register and signals a
> > non-maskable interrupt allowing the host to clear the armed reset
> > sequence within 1 s. If the host does not clear KEY_RESET then a
> > shutdown to RESET mode is executed. KEY_SD_MODE determines if normal
> > power sequence timing or a fast shutdown is implemented.
> >
> > DA9062:
> > If the reset was initiated by a user’s long press of nONKEY, initially
> > only KEY_RESET is set and the nIRQ port will be asserted. KEY_RESET
> > signals the host that a shutdown sequence is started. If the host does
> > not then clear KEY_RESET within 1 s by writing a 1 to the related bit in
> > register FAULT_LOG, the shutdown sequence will complete. When the reset
> > condition has disappeared, DA9062 requires a supply (VSYS >
> > VDD_FAULT_UPPER) that provides enough power to start-up from the
> > POWERDOWN mode.
> >
> > So we don't need to check for the KEY_RESET? This would cleanup the code
> > a bit.
> 
> We could remove that but I think the intention originally was to have this code
> there in case there was some way to more gracefully shutdown the system in this
> scenario. Right now that's not the case as the code simply calls to shutdown
> the pmic via a manual register call, but maybe in the future this could be made
> more gracful. Another slight advantage of leaving that code in is that we're
> not waiting for another second delay for the PMIC to pull the plug.
> 
> With regards to this patch and the subsequent one to update the OnKey driver, I
> think we should deprecate this property. The OnKey mode binding you added in
> a different patch will configure the OnKey according to how you want it to
> behave in hardware so I don't think this property makes much sense anymore. We
> can then remove the need for 'key_power' usage in the driver.

Is it okay for you both to drop this patch from this series and open a
new 'rework' series?

Regards,
  Marco

> 
> >
> > Regards,
> >   Marco
> >
> > > >
> > > >  - dlg,key-opmode : Set the nONKEY behaviour. This value is initial set by the
> > > >      otp values. See nONKEY_PIN register description for more information.
> > > > --
> > > > 2.20.1
> > >
> > >
> >
> > --
> > Pengutronix e.K.                           |                             |
> > Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> > 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> > Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 2/3] input: misc: da9063_onkey: add mode change support
  2019-11-27 13:23 ` [PATCH v2 2/3] input: misc: da9063_onkey: add mode change support Marco Felsch
  2019-12-02 12:01   ` Adam Thomson
@ 2020-01-08  8:48   ` Marco Felsch
  2020-01-13 10:40     ` Lee Jones
  1 sibling, 1 reply; 18+ messages in thread
From: Marco Felsch @ 2020-01-08  8:48 UTC (permalink / raw)
  To: support.opensource, stwiss.opensource, dmitry.torokhov, robh+dt,
	Adam.Thomson.Opensource, lee.jones
  Cc: devicetree, kernel, linux-input

Hi Lee,

I forgot to add you to review the mfd part, sorry. Please can you have a
look on it?

Regards,
  Marco

On 19-11-27 14:23, Marco Felsch wrote:
> The pmic state machine behaviour upon a 'onkey press' event can be
> configured using the ONKEY_PIN bit field. Most the time this is
> configured correct by the OTP but sometimes we need to adjust the
> behaviour so we need to add the support here.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
> v2:
> - make use of da906x_chip_config
> - rm unnecessary key_opmode
> 
>  drivers/input/misc/da9063_onkey.c | 16 ++++++++++++++++
>  drivers/mfd/da9062-core.c         |  1 +
>  2 files changed, 17 insertions(+)
> 
> diff --git a/drivers/input/misc/da9063_onkey.c b/drivers/input/misc/da9063_onkey.c
> index 79851923ee57..3a3f06a33eda 100644
> --- a/drivers/input/misc/da9063_onkey.c
> +++ b/drivers/input/misc/da9063_onkey.c
> @@ -19,6 +19,7 @@
>  
>  struct da906x_chip_config {
>  	/* REGS */
> +	int onkey_config;
>  	int onkey_status;
>  	int onkey_pwr_signalling;
>  	int onkey_fault_log;
> @@ -26,6 +27,7 @@ struct da906x_chip_config {
>  	/* MASKS */
>  	int onkey_nonkey_mask;
>  	int onkey_nonkey_lock_mask;
> +	int onkey_nonkey_pin_mask;
>  	int onkey_key_reset_mask;
>  	int onkey_shutdown_mask;
>  	/* NAMES */
> @@ -44,6 +46,7 @@ struct da9063_onkey {
>  
>  static const struct da906x_chip_config da9063_regs = {
>  	/* REGS */
> +	.onkey_config = DA9063_REG_CONFIG_I,
>  	.onkey_status = DA9063_REG_STATUS_A,
>  	.onkey_pwr_signalling = DA9063_REG_CONTROL_B,
>  	.onkey_fault_log = DA9063_REG_FAULT_LOG,
> @@ -51,6 +54,7 @@ static const struct da906x_chip_config da9063_regs = {
>  	/* MASKS */
>  	.onkey_nonkey_mask = DA9063_NONKEY,
>  	.onkey_nonkey_lock_mask = DA9063_NONKEY_LOCK,
> +	.onkey_nonkey_pin_mask = DA9063_NONKEY_PIN_MASK,
>  	.onkey_key_reset_mask = DA9063_KEY_RESET,
>  	.onkey_shutdown_mask = DA9063_SHUTDOWN,
>  	/* NAMES */
> @@ -59,6 +63,7 @@ static const struct da906x_chip_config da9063_regs = {
>  
>  static const struct da906x_chip_config da9062_regs = {
>  	/* REGS */
> +	.onkey_config = DA9062AA_CONFIG_I,
>  	.onkey_status = DA9062AA_STATUS_A,
>  	.onkey_pwr_signalling = DA9062AA_CONTROL_B,
>  	.onkey_fault_log = DA9062AA_FAULT_LOG,
> @@ -66,6 +71,7 @@ static const struct da906x_chip_config da9062_regs = {
>  	/* MASKS */
>  	.onkey_nonkey_mask = DA9062AA_NONKEY_MASK,
>  	.onkey_nonkey_lock_mask = DA9062AA_NONKEY_LOCK_MASK,
> +	.onkey_nonkey_pin_mask = DA9062AA_NONKEY_PIN_MASK,
>  	.onkey_key_reset_mask = DA9062AA_KEY_RESET_MASK,
>  	.onkey_shutdown_mask = DA9062AA_SHUTDOWN_MASK,
>  	/* NAMES */
> @@ -193,6 +199,7 @@ static int da9063_onkey_probe(struct platform_device *pdev)
>  {
>  	struct da9063_onkey *onkey;
>  	const struct of_device_id *match;
> +	unsigned int val;
>  	int irq;
>  	int error;
>  
> @@ -220,6 +227,15 @@ static int da9063_onkey_probe(struct platform_device *pdev)
>  	onkey->key_power = !of_property_read_bool(pdev->dev.of_node,
>  						  "dlg,disable-key-power");
>  
> +	if (!of_property_read_u32(pdev->dev.of_node, "dlg,key-opmode", &val)) {
> +		error = regmap_update_bits(onkey->regmap,
> +					   onkey->config->onkey_config,
> +					   onkey->config->onkey_nonkey_pin_mask,
> +					   val);
> +		if (error)
> +			return error;
> +	}
> +
>  	onkey->input = devm_input_allocate_device(&pdev->dev);
>  	if (!onkey->input) {
>  		dev_err(&pdev->dev, "Failed to allocated input device.\n");
> diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c
> index e69626867c26..aaa1f1841bc3 100644
> --- a/drivers/mfd/da9062-core.c
> +++ b/drivers/mfd/da9062-core.c
> @@ -510,6 +510,7 @@ static const struct regmap_range da9062_aa_writeable_ranges[] = {
>  	regmap_reg_range(DA9062AA_VLDO1_B, DA9062AA_VLDO4_B),
>  	regmap_reg_range(DA9062AA_BBAT_CONT, DA9062AA_BBAT_CONT),
>  	regmap_reg_range(DA9062AA_GP_ID_0, DA9062AA_GP_ID_19),
> +	regmap_reg_range(DA9062AA_CONFIG_I, DA9062AA_CONFIG_I),
>  };
>  
>  static const struct regmap_range da9062_aa_volatile_ranges[] = {
> -- 
> 2.20.1
> 
> 
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [PATCH v2 3/3] dt-bindings: Input: da9062 - fix dlg,disable-key-power description
  2020-01-07  8:08         ` Marco Felsch
@ 2020-01-08 10:05           ` Adam Thomson
  0 siblings, 0 replies; 18+ messages in thread
From: Adam Thomson @ 2020-01-08 10:05 UTC (permalink / raw)
  To: Marco Felsch, Adam Thomson
  Cc: Support Opensource, Steve Twiss, dmitry.torokhov, robh+dt,
	devicetree, kernel, linux-input

On 07 January 2020 08:09, Marco Felsch wrote:

> Hi Adam, Dmitry,
> 
> On 19-12-12 10:08, Adam Thomson wrote:
> > On 10 December 2019 08:28, Marco Felsch wrote:
> >
> > > Hi Adam,
> > >
> > > On 19-12-02 12:15, Adam Thomson wrote:
> > > > On 27 November 2019 13:23, Marco Felsch wrote:
> > > >
> > > > > There was a bug within the driver since commit f889beaaab1c ("Input:
> > > > > da9063 - report KEY_POWER instead of KEY_SLEEP during power
> > > > > key-press"). Since we fixed the bug the KEY_POWER will be reported
> > > > > always so we need to adapt the dt-bindings too. Make the description
> > > > > more precise while on it.
> > > > >
> > > > > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > > > > ---
> > > > > v2:
> > > > > - change description according Dmitry's suggestion.
> > > > >
> > > > >  Documentation/devicetree/bindings/input/da9062-onkey.txt | 5 ++---
> > > > >  1 file changed, 2 insertions(+), 3 deletions(-)
> > > > >
> > > > > diff --git a/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > > > > b/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > > > > index 0005b2bdcdd7..9f895454179d 100644
> > > > > --- a/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > > > > +++ b/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > > > > @@ -15,9 +15,8 @@ Required properties:
> > > > >
> > > > >  Optional properties:
> > > > >
> > > > > -- dlg,disable-key-power : Disable power-down using a long key-press. If
> this
> > > > > -    entry exists the OnKey driver will remove support for the KEY_POWER
> key
> > > > > -    press when triggered using a long press of the OnKey.
> > > > > +- dlg,disable-key-power : If this property is present, the host will not be
> > > > > +    issuing shutdown command over I2C in response to a long key-press.
> > > >
> > > > This also changes behaviour of button press reporting as the driver will not
> > > > report a longer press (i.e. a button hold where the driver polls for release).
> > > > It will only report a short key press to user-space with this property
> provided.
> > > >
> > > > The question here is do we still want to support long press reporting but
> > > > without the I2C sequence for shutdown? If so the driver needs to be
> updated
> > > to
> > > > work this way as right now it doesn't.
> > >
> > > Good point. I checked the driver and the documentation for the
> > > da9062/3 again and it seems that we interrupt the pmic hw by doing the
> > > shutdown by itself. As the documentation says:
> > >
> > > DA9063:
> > > If the hardware reset was initiated by a (debounced) press of nONKEY (or
> > > GPIO14 and GPIO15 together) longer than SD_DELAY, the DA9063 initially
> > > only asserts control bit KEY_RESET in the fault register and signals a
> > > non-maskable interrupt allowing the host to clear the armed reset
> > > sequence within 1 s. If the host does not clear KEY_RESET then a
> > > shutdown to RESET mode is executed. KEY_SD_MODE determines if normal
> > > power sequence timing or a fast shutdown is implemented.
> > >
> > > DA9062:
> > > If the reset was initiated by a user’s long press of nONKEY, initially
> > > only KEY_RESET is set and the nIRQ port will be asserted. KEY_RESET
> > > signals the host that a shutdown sequence is started. If the host does
> > > not then clear KEY_RESET within 1 s by writing a 1 to the related bit in
> > > register FAULT_LOG, the shutdown sequence will complete. When the reset
> > > condition has disappeared, DA9062 requires a supply (VSYS >
> > > VDD_FAULT_UPPER) that provides enough power to start-up from the
> > > POWERDOWN mode.
> > >
> > > So we don't need to check for the KEY_RESET? This would cleanup the code
> > > a bit.
> >
> > We could remove that but I think the intention originally was to have this code
> > there in case there was some way to more gracefully shutdown the system in
> this
> > scenario. Right now that's not the case as the code simply calls to shutdown
> > the pmic via a manual register call, but maybe in the future this could be made
> > more gracful. Another slight advantage of leaving that code in is that we're
> > not waiting for another second delay for the PMIC to pull the plug.
> >
> > With regards to this patch and the subsequent one to update the OnKey driver,
> I
> > think we should deprecate this property. The OnKey mode binding you added
> in
> > a different patch will configure the OnKey according to how you want it to
> > behave in hardware so I don't think this property makes much sense anymore.
> We
> > can then remove the need for 'key_power' usage in the driver.
> 
> Is it okay for you both to drop this patch from this series and open a
> new 'rework' series?

I have no issues with this.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 2/3] input: misc: da9063_onkey: add mode change support
  2020-01-08  8:48   ` Marco Felsch
@ 2020-01-13 10:40     ` Lee Jones
  0 siblings, 0 replies; 18+ messages in thread
From: Lee Jones @ 2020-01-13 10:40 UTC (permalink / raw)
  To: Marco Felsch
  Cc: support.opensource, stwiss.opensource, dmitry.torokhov, robh+dt,
	Adam.Thomson.Opensource, devicetree, kernel, linux-input

On Wed, 08 Jan 2020, Marco Felsch wrote:

> Hi Lee,
> 
> I forgot to add you to review the mfd part, sorry. Please can you have a
> look on it?

[...]

> > --- a/drivers/mfd/da9062-core.c
> > +++ b/drivers/mfd/da9062-core.c
> > @@ -510,6 +510,7 @@ static const struct regmap_range da9062_aa_writeable_ranges[] = {
> >  	regmap_reg_range(DA9062AA_VLDO1_B, DA9062AA_VLDO4_B),
> >  	regmap_reg_range(DA9062AA_BBAT_CONT, DA9062AA_BBAT_CONT),
> >  	regmap_reg_range(DA9062AA_GP_ID_0, DA9062AA_GP_ID_19),
> > +	regmap_reg_range(DA9062AA_CONFIG_I, DA9062AA_CONFIG_I),
> >  };
> >  
> >  static const struct regmap_range da9062_aa_volatile_ranges[] = {

Looks fine.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/3] DA9063 Onkey Improvements and Fixes
  2019-11-27 13:23 [PATCH v2 0/3] DA9063 Onkey Improvements and Fixes Marco Felsch
                   ` (2 preceding siblings ...)
  2019-11-27 13:23 ` [PATCH v2 3/3] dt-bindings: Input: da9062 - fix dlg,disable-key-power description Marco Felsch
@ 2020-01-16  8:51 ` Marco Felsch
  3 siblings, 0 replies; 18+ messages in thread
From: Marco Felsch @ 2020-01-16  8:51 UTC (permalink / raw)
  To: support.opensource, stwiss.opensource, dmitry.torokhov, robh+dt,
	Adam.Thomson.Opensource
  Cc: devicetree, kernel, linux-input

Hi Dmitry,

On 19-11-27 14:23, Marco Felsch wrote:
> Hi,
> 
> this is v2 contains all comments made on [1]. Please check the patch
> based changelog for further information. Patch "Input: da9063 - fix
> capability and drop KEY_SLEEP"  is already applied mainline.
> 
> [1] https://www.spinics.net/lists/devicetree/msg309431.html
> 
> Marco Felsch (3):
>   dt-bindings: Input: da9062 - add key-opmode documentation
>   input: misc: da9063_onkey: add mode change support

Can we apply those patches.

>   dt-bindings: Input: da9062 - fix dlg,disable-key-power description

This one can be dropped from this series.

Regards,
  Marco

>  .../devicetree/bindings/input/da9062-onkey.txt   | 15 ++++++++++++---
>  drivers/input/misc/da9063_onkey.c                | 16 ++++++++++++++++
>  drivers/mfd/da9062-core.c                        |  1 +
>  3 files changed, 29 insertions(+), 3 deletions(-)
> 
> -- 
> 2.20.1

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/3] dt-bindings: Input: da9062 - add key-opmode documentation
  2019-11-27 13:23 ` [PATCH v2 1/3] dt-bindings: Input: da9062 - add key-opmode documentation Marco Felsch
  2019-12-02 11:38   ` Adam Thomson
  2019-12-05 21:40   ` Rob Herring
@ 2020-01-22  5:57   ` Dmitry Torokhov
  2020-02-18 11:56     ` Marco Felsch
  2 siblings, 1 reply; 18+ messages in thread
From: Dmitry Torokhov @ 2020-01-22  5:57 UTC (permalink / raw)
  To: Marco Felsch, robh+dt
  Cc: support.opensource, stwiss.opensource, Adam.Thomson.Opensource,
	devicetree, kernel, linux-input

On Wed, Nov 27, 2019 at 02:23:02PM +0100, Marco Felsch wrote:
> The onkey behaviour can be changed by programming the NONKEY_PIN
> bitfield. Since the driver supports the reconfiguration we need to add
> the documentation here.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
> v2:
> - add da9061/3 references
> - adapt binding description to be more general
> 
>  .../devicetree/bindings/input/da9062-onkey.txt         | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/input/da9062-onkey.txt b/Documentation/devicetree/bindings/input/da9062-onkey.txt
> index 5f9fbc68e58a..0005b2bdcdd7 100644
> --- a/Documentation/devicetree/bindings/input/da9062-onkey.txt
> +++ b/Documentation/devicetree/bindings/input/da9062-onkey.txt
> @@ -19,6 +19,16 @@ Optional properties:
>      entry exists the OnKey driver will remove support for the KEY_POWER key
>      press when triggered using a long press of the OnKey.
>  
> +- dlg,key-opmode : Set the nONKEY behaviour. This value is initial set by the
> +    otp values. 

Did you mean to say "nONKEY behavior is normally specified in OTP
settings; this property allows modifying it".

Rob, do you have any comments?

> See nONKEY_PIN register description for more information.
> +    Valid value range: 0x0..0x3
> +
> +References:
> +
> +[1] https://www.dialog-semiconductor.com/sites/default/files/da9061_datasheet_3v6.pdf
> +[2] https://www.dialog-semiconductor.com/sites/default/files/da9062_datasheet_3v6.pdf
> +[3] https://www.dialog-semiconductor.com/sites/default/files/da9063_datasheet_2v2.pdf
> +
>  Example: DA9063
>  
>  	pmic0: da9063@58 {
> -- 
> 2.20.1
> 

-- 
Dmitry

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/3] dt-bindings: Input: da9062 - add key-opmode documentation
  2020-01-22  5:57   ` Dmitry Torokhov
@ 2020-02-18 11:56     ` Marco Felsch
  0 siblings, 0 replies; 18+ messages in thread
From: Marco Felsch @ 2020-02-18 11:56 UTC (permalink / raw)
  To: Dmitry Torokhov, robh+dt
  Cc: robh+dt, support.opensource, stwiss.opensource,
	Adam.Thomson.Opensource, devicetree, kernel, linux-input

Hi Rob,

On 20-01-21 21:57, Dmitry Torokhov wrote:
> On Wed, Nov 27, 2019 at 02:23:02PM +0100, Marco Felsch wrote:
> > The onkey behaviour can be changed by programming the NONKEY_PIN
> > bitfield. Since the driver supports the reconfiguration we need to add
> > the documentation here.
> > 
> > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > ---
> > v2:
> > - add da9061/3 references
> > - adapt binding description to be more general
> > 
> >  .../devicetree/bindings/input/da9062-onkey.txt         | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/input/da9062-onkey.txt b/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > index 5f9fbc68e58a..0005b2bdcdd7 100644
> > --- a/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > +++ b/Documentation/devicetree/bindings/input/da9062-onkey.txt
> > @@ -19,6 +19,16 @@ Optional properties:
> >      entry exists the OnKey driver will remove support for the KEY_POWER key
> >      press when triggered using a long press of the OnKey.
> >  
> > +- dlg,key-opmode : Set the nONKEY behaviour. This value is initial set by the
> > +    otp values. 
> 
> Did you mean to say "nONKEY behavior is normally specified in OTP
> settings; this property allows modifying it".
> 
> Rob, do you have any comments?

gentle ping.

> > See nONKEY_PIN register description for more information.
> > +    Valid value range: 0x0..0x3
> > +
> > +References:
> > +
> > +[1] https://www.dialog-semiconductor.com/sites/default/files/da9061_datasheet_3v6.pdf
> > +[2] https://www.dialog-semiconductor.com/sites/default/files/da9062_datasheet_3v6.pdf
> > +[3] https://www.dialog-semiconductor.com/sites/default/files/da9063_datasheet_2v2.pdf
> > +
> >  Example: DA9063
> >  
> >  	pmic0: da9063@58 {
> > -- 
> > 2.20.1
> > 
> 
> -- 
> Dmitry
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, back to index

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-27 13:23 [PATCH v2 0/3] DA9063 Onkey Improvements and Fixes Marco Felsch
2019-11-27 13:23 ` [PATCH v2 1/3] dt-bindings: Input: da9062 - add key-opmode documentation Marco Felsch
2019-12-02 11:38   ` Adam Thomson
2019-12-05 21:40   ` Rob Herring
2020-01-22  5:57   ` Dmitry Torokhov
2020-02-18 11:56     ` Marco Felsch
2019-11-27 13:23 ` [PATCH v2 2/3] input: misc: da9063_onkey: add mode change support Marco Felsch
2019-12-02 12:01   ` Adam Thomson
2020-01-08  8:48   ` Marco Felsch
2020-01-13 10:40     ` Lee Jones
2019-11-27 13:23 ` [PATCH v2 3/3] dt-bindings: Input: da9062 - fix dlg,disable-key-power description Marco Felsch
2019-12-02 12:15   ` Adam Thomson
2019-12-10  8:27     ` Marco Felsch
2019-12-12 10:08       ` Adam Thomson
2020-01-07  8:08         ` Marco Felsch
2020-01-08 10:05           ` Adam Thomson
2019-12-05 21:38   ` Rob Herring
2020-01-16  8:51 ` [PATCH v2 0/3] DA9063 Onkey Improvements and Fixes Marco Felsch

Linux Input Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-input/0 linux-input/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-input linux-input/ https://lore.kernel.org/linux-input \
		linux-input@vger.kernel.org
	public-inbox-index linux-input

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-input


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git