diff mbox series

[5/7] Input: mtk-pmic-keys: add field to store if PMIC has key release IRQs

Message ID 20220415153629.1817202-6-fparent@baylibre.com (mailing list archive)
State Accepted
Commit 95d19b9891c35b581940c8dc277d997a95eaf8c5
Headers show
Series [1/7] dt-bindings: input: mtk-pmic-keys: add MT6359 binding definition | expand

Commit Message

Fabien Parent April 15, 2022, 3:36 p.m. UTC
The MT6358 PMIC is not the only PMIC to have release IRQs. In order to
support more PMIC that supports release IRQs, such as MT6357, MT6359,
and possibly others, let's add some field in the platform data to
indicate whether a PMIC support release keys.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
---
 drivers/input/keyboard/mtk-pmic-keys.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Mattijs Korpershoek April 21, 2022, 3:57 p.m. UTC | #1
On ven., avril 15, 2022 at 17:36, Fabien Parent <fparent@baylibre.com> wrote:

> The MT6358 PMIC is not the only PMIC to have release IRQs. In order to
> support more PMIC that supports release IRQs, such as MT6357, MT6359,
> and possibly others, let's add some field in the platform data to
> indicate whether a PMIC support release keys.
>
> Signed-off-by: Fabien Parent <fparent@baylibre.com>

Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # on mt8183-pumpkin 

> ---
>  drivers/input/keyboard/mtk-pmic-keys.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
> index a0da644fe93d..609b87afd020 100644
> --- a/drivers/input/keyboard/mtk-pmic-keys.c
> +++ b/drivers/input/keyboard/mtk-pmic-keys.c
> @@ -53,6 +53,7 @@ struct mtk_pmic_keys_regs {
>  struct mtk_pmic_keys_pdata {
>  	const struct mtk_pmic_keys_regs keys_regs[MTK_PMIC_MAX_KEY_COUNT];
>  	u32 pmic_rst_reg;
> +	bool has_key_release_irqs;
>  };
>  
>  static const struct mtk_pmic_keys_pdata mt6397_pdata = {
> @@ -83,6 +84,7 @@ static const struct mtk_pmic_keys_pdata mt6358_pdata = {
>  		MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
>  				   0x8, MT6358_PSC_TOP_INT_CON0, 0xa),
>  	.pmic_rst_reg = MT6358_TOP_RST_MISC,
> +	.has_key_release_irqs = true,
>  };
>  
>  struct mtk_pmic_keys_info {
> @@ -319,7 +321,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
>  			return keys->keys[index].irq;
>  		}
>  
> -		if (of_device_is_compatible(node, "mediatek,mt6358-keys")) {
> +		if (mtk_pmic_keys_pdata->has_key_release_irqs) {
>  			keys->keys[index].irq_r = platform_get_irq_byname(pdev,
>  									  irqnames_r[index]);
>  
> -- 
> 2.35.2
diff mbox series

Patch

diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
index a0da644fe93d..609b87afd020 100644
--- a/drivers/input/keyboard/mtk-pmic-keys.c
+++ b/drivers/input/keyboard/mtk-pmic-keys.c
@@ -53,6 +53,7 @@  struct mtk_pmic_keys_regs {
 struct mtk_pmic_keys_pdata {
 	const struct mtk_pmic_keys_regs keys_regs[MTK_PMIC_MAX_KEY_COUNT];
 	u32 pmic_rst_reg;
+	bool has_key_release_irqs;
 };
 
 static const struct mtk_pmic_keys_pdata mt6397_pdata = {
@@ -83,6 +84,7 @@  static const struct mtk_pmic_keys_pdata mt6358_pdata = {
 		MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
 				   0x8, MT6358_PSC_TOP_INT_CON0, 0xa),
 	.pmic_rst_reg = MT6358_TOP_RST_MISC,
+	.has_key_release_irqs = true,
 };
 
 struct mtk_pmic_keys_info {
@@ -319,7 +321,7 @@  static int mtk_pmic_keys_probe(struct platform_device *pdev)
 			return keys->keys[index].irq;
 		}
 
-		if (of_device_is_compatible(node, "mediatek,mt6358-keys")) {
+		if (mtk_pmic_keys_pdata->has_key_release_irqs) {
 			keys->keys[index].irq_r = platform_get_irq_byname(pdev,
 									  irqnames_r[index]);