Linux Input Archive on lore.kernel.org
 help / color / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: support.opensource@diasemi.com, stwiss.opensource@diasemi.com,
	dmitry.torokhov@gmail.com, robh+dt@kernel.org,
	Adam.Thomson.Opensource@diasemi.com, lee.jones@linaro.org
Cc: devicetree@vger.kernel.org, kernel@pengutronix.de,
	linux-input@vger.kernel.org
Subject: Re: [PATCH v2 2/3] input: misc: da9063_onkey: add mode change support
Date: Wed, 8 Jan 2020 09:48:00 +0100
Message-ID: <20200108084800.x2doud4v6m3ssz6s@pengutronix.de> (raw)
In-Reply-To: <20191127132304.22924-3-m.felsch@pengutronix.de>

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
> 
> 
> 

  parent reply index

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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
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 [this message]
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

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200108084800.x2doud4v6m3ssz6s@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=Adam.Thomson.Opensource@diasemi.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-input@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=stwiss.opensource@diasemi.com \
    --cc=support.opensource@diasemi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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