[PATCH] pinctrl: mediatek: common: Fix probe failure for devices without EINT

Luca Leonardo Scorcia posted 1 patch 2 weeks, 6 days ago
drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
[PATCH] pinctrl: mediatek: common: Fix probe failure for devices without EINT
Posted by Luca Leonardo Scorcia 2 weeks, 6 days ago
Some pinctrl devices like mt6397 or mt6392 don't support EINT at all, but
the mtk_eint_init function is always called and returns -ENODEV, which
then bubbles up and causes probe failure.

To address this only call mtk_eint_init if EINT pins are present.

Tested on Xiaomi Mi Smart Clock x04g (mt6392).

Fixes: e46df235b4e6 ("pinctrl: mediatek: refactor EINT related code for all MediaTek pinctrl can fit")
Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index d6a46fe0cda8..3f518dce6d23 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1135,9 +1135,12 @@ int mtk_pctrl_init(struct platform_device *pdev,
 		goto chip_error;
 	}
 
-	ret = mtk_eint_init(pctl, pdev);
-	if (ret)
-		goto chip_error;
+	/* Only initialize EINT if we have EINT pins */
+	if (data->eint_hw.ap_num > 0) {
+		ret = mtk_eint_init(pctl, pdev);
+		if (ret)
+			goto chip_error;
+	}
 
 	return 0;
 
-- 
2.43.0
Re: [PATCH] pinctrl: mediatek: common: Fix probe failure for devices without EINT
Posted by Linus Walleij 2 weeks, 4 days ago
On Tue, Mar 17, 2026 at 12:03 PM Luca Leonardo Scorcia
<l.scorcia@gmail.com> wrote:

> Some pinctrl devices like mt6397 or mt6392 don't support EINT at all, but
> the mtk_eint_init function is always called and returns -ENODEV, which
> then bubbles up and causes probe failure.
>
> To address this only call mtk_eint_init if EINT pins are present.
>
> Tested on Xiaomi Mi Smart Clock x04g (mt6392).
>
> Fixes: e46df235b4e6 ("pinctrl: mediatek: refactor EINT related code for all MediaTek pinctrl can fit")
> Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>

Patch applied for fixes!

Yours,
Linus Walleij
Re: [PATCH] pinctrl: mediatek: common: Fix probe failure for devices without EINT
Posted by AngeloGioacchino Del Regno 2 weeks, 6 days ago
Il 17/03/26 12:02, Luca Leonardo Scorcia ha scritto:
> Some pinctrl devices like mt6397 or mt6392 don't support EINT at all, but
> the mtk_eint_init function is always called and returns -ENODEV, which
> then bubbles up and causes probe failure.
> 
> To address this only call mtk_eint_init if EINT pins are present.
> 
> Tested on Xiaomi Mi Smart Clock x04g (mt6392).
> 
> Fixes: e46df235b4e6 ("pinctrl: mediatek: refactor EINT related code for all MediaTek pinctrl can fit")
> Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>

That's right. Not all do - and the ones that don't have eint support also won't
have the pm ops, so no further check is required.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

> ---
>   drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index d6a46fe0cda8..3f518dce6d23 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -1135,9 +1135,12 @@ int mtk_pctrl_init(struct platform_device *pdev,
>   		goto chip_error;
>   	}
>   
> -	ret = mtk_eint_init(pctl, pdev);
> -	if (ret)
> -		goto chip_error;
> +	/* Only initialize EINT if we have EINT pins */
> +	if (data->eint_hw.ap_num > 0) {
> +		ret = mtk_eint_init(pctl, pdev);
> +		if (ret)
> +			goto chip_error;
> +	}
>   
>   	return 0;
>