mbox series

[v4,0/4] input: MT6358 PMIC button support

Message ID 20220121140323.4080640-1-mkorpershoek@baylibre.com
Headers show
Series input: MT6358 PMIC button support | expand

Message

Mattijs Korpershoek Jan. 21, 2022, 2:03 p.m. UTC
The MediaTek MT6358 PMIC has support for two buttons: PWR and HOME.

The interrupt logic is a little different than other PMICs from the
same family:
for MT6323 and MT6397, we have one interrupt source per button
* for MT6358, we have two interrupts lines per button: the press and
* release interrupts are distinct sources.

Changes since v3 [1]:
* checkpatch.pl --strict fixes

Changes since v2 [2]:
* added 4th patch with device tree enable
* cover letter title prefixed with 'input'

This has been tested with evtest on mt8183-pumpkin on input/next

[1] https://lore.kernel.org/r/20210702134310.3451560-1-mkorpershoek@baylibre.com
[2] https://lore.kernel.org/r/id:20210512152648.39961-1-mkorpershoek@baylibre.com

Mattijs Korpershoek (4):
  Input: mtk-pmic-keys - use get_irq_byname() instead of index
  dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition
  Input: mtk-pmic-keys - add support for MT6358
  arm64: dts: mt6358: add mt6358-keys node

 .../bindings/input/mtk-pmic-keys.txt          |  5 +-
 arch/arm64/boot/dts/mediatek/mt6358.dtsi      | 12 ++++
 drivers/input/keyboard/mtk-pmic-keys.c        | 55 +++++++++++++++++--
 3 files changed, 67 insertions(+), 5 deletions(-)


base-commit: 87a0b2fafc09766d8c55461a18345a1cfb10a7fe

Comments

Dmitry Torokhov Feb. 8, 2022, 5:51 a.m. UTC | #1
On Fri, Jan 21, 2022 at 03:03:20PM +0100, Mattijs Korpershoek wrote:
> Some pmics of the mt6397 family (such as MT6358), have two IRQs per
> physical key: one for press event, another for release event.
> 
> The mtk-pmic-keys driver assumes that each key only has one
> IRQ. The key index and the RES_IRQ resource index have a 1/1 mapping.
> 
> This won't work for MT6358, as we have multiple resources (2) for one key.
> 
> To prepare mtk-pmic-keys to support MT6358, retrieve IRQs by name
> instead of by index.
> 
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

Applied, thank you.
Dmitry Torokhov Feb. 8, 2022, 5:51 a.m. UTC | #2
On Fri, Jan 21, 2022 at 03:03:22PM +0100, Mattijs Korpershoek wrote:
> MT6358 pmic keys behave differently than mt6397 and mt6323: there are
> two interrupts per key: one for press, the other one for release (_r)
> 
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

Applied, thank you.
Mattijs Korpershoek Feb. 8, 2022, 3:38 p.m. UTC | #3
Hi Matthias,

On ven., janv. 21, 2022 at 15:03, Mattijs Korpershoek <mkorpershoek@baylibre.com> wrote:

> This enables the power,home keys on MediaTek boards with a mt6358 pmic.
>
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Since the driver change has been merged [1], can we queue up the DT change?
Or should I resubmit this separately?

Thanks

[1] https://lore.kernel.org/all/YgIE%2F806gDmRJYCn@google.com/
> ---
>  arch/arm64/boot/dts/mediatek/mt6358.dtsi | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/mediatek/mt6358.dtsi b/arch/arm64/boot/dts/mediatek/mt6358.dtsi
> index 95145076b7e6..98f3b0e0c9f6 100644
> --- a/arch/arm64/boot/dts/mediatek/mt6358.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt6358.dtsi
> @@ -2,6 +2,7 @@
>  /*
>   * Copyright (c) 2020 MediaTek Inc.
>   */
> +#include <dt-bindings/input/input.h>
>  
>  &pwrap {
>  	pmic: mt6358 {
> @@ -357,5 +358,16 @@ mt6358_vsim2_reg: ldo_vsim2 {
>  		mt6358rtc: mt6358rtc {
>  			compatible = "mediatek,mt6358-rtc";
>  		};
> +
> +		mt6358keys: mt6358keys {
> +			compatible = "mediatek,mt6358-keys";
> +			power {
> +				linux,keycodes = <KEY_POWER>;
> +				wakeup-source;
> +			};
> +			home {
> +				linux,keycodes = <KEY_HOME>;
> +			};
> +		};
>  	};
>  };
> -- 
> 2.32.0