From: Macpaul Lin <macpaul.lin@mediatek.com>
To: Bo Ye <bo.ye@mediatek.com>, Sean Wang <sean.wang@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
<Jades.shih@mediatek.com>, <ivan.tseng@mediatek.com>
Cc: Yongdong Zhang <yongdong.zhang@mediatek.com>,
Xiujuan Tan <xiujuan.tan@mediatek.com>,
Browse Zhang <browse.zhang@mediatek.com>,
Light Hsieh <light.hsieh@mediatek.com>,
Evan Cao <ot_evan.cao@mediatek.com>,
<linux-mediatek@lists.infradead.org>,
<linux-gpio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] pinctrl: mediatek: paris: Revert "Rework support for PIN_CONFIG_{INPUT,OUTPUT}_ENABLE"
Date: Thu, 17 Oct 2024 16:15:30 +0800 [thread overview]
Message-ID: <433295fe-8d34-af8b-f6bf-be1953b6e479@mediatek.com> (raw)
In-Reply-To: <20241017075522.178337-1-bo.ye@mediatek.com>
On 10/17/24 15:55, Bo Ye wrote:
> [This reverts commit c5d3b64c568a344e998830e0e94a7c04e372f89b.]
>
> For MTK HW,
> 1. to enable GPIO input direction: set DIR=0, IES=1
> 2. to enable GPIO output direction: set DIR=1, and set DO=1 to output high, set DO=0 to out low
>
> The PIN_CONFIG_INPUT/PIN_CONFIG_OUTPUT/PIN_CONFIG_INPUT_ENABLE/PIN_CONFIG_OUTPUT_ENABLE shall
> be implemented according to view of its purpose - set GPIO direction and output value (for
> output only) according to specific HW design.
>
> However, the reverted patch implement according to author's own explanation of IES without
> understanding of MTK's HW. Such patch does not correctly set DIR/IES bit to control GPIO
> direction on MTK's HW.
>
> Signed-off-by: Light Hsieh <light.hsieh@mediatek.com>
> Signed-off-by: Evan Cao <ot_evan.cao@mediatek.com>
> Signed-off-by: Bo Ye <bo.ye@mediatek.com>
The "Fixes:" tag is missing. Please add it.
Besides, please update "MAINTAINERS" file with the correct owner.
The Linux kernel is open source and anyone modify it.
If the patch appears reasonable and has been tested, it usually
will be accepted as long as there are no opposing review opinions.
> ---
> drivers/pinctrl/mediatek/pinctrl-paris.c | 38 +++++++++++++++++-------
> 1 file changed, 27 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c
> index 87e958d827bf..a8af62e6f8ca 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-paris.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-paris.c
> @@ -165,21 +165,20 @@ static int mtk_pinconf_get(struct pinctrl_dev *pctldev,
> err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_SR, &ret);
> break;
> case PIN_CONFIG_INPUT_ENABLE:
> - err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_IES, &ret);
> - if (!ret)
> - err = -EINVAL;
> - break;
> - case PIN_CONFIG_OUTPUT:
> + case PIN_CONFIG_OUTPUT_ENABLE:
> err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DIR, &ret);
> if (err)
> break;
> + /* CONFIG Current direction return value
> + * ------------- ----------------- ----------------------
> + * OUTPUT_ENABLE output 1 (= HW value)
> + * input 0 (= HW value)
> + * INPUT_ENABLE output 0 (= reverse HW value)
> + * input 1 (= reverse HW value)
> + */
> + if (param == PIN_CONFIG_INPUT_ENABLE)
> + ret = !ret;
>
> - if (!ret) {
> - err = -EINVAL;
> - break;
> - }
> -
> - err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DO, &ret);
> break;
> case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
> err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DIR, &ret);
> @@ -284,9 +283,26 @@ static int mtk_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
> break;
> err = hw->soc->bias_set_combo(hw, desc, 0, arg);
> break;
> + case PIN_CONFIG_OUTPUT_ENABLE:
> + err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_SMT,
> + MTK_DISABLE);
> + /* Keep set direction to consider the case that a GPIO pin
> + * does not have SMT control
> + */
> + if (err != -ENOTSUPP)
> + break;
> +
> + err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DIR,
> + MTK_OUTPUT);
> + break;
> case PIN_CONFIG_INPUT_ENABLE:
> /* regard all non-zero value as enable */
> err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_IES, !!arg);
> + if (err)
> + break;
> +
> + err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DIR,
> + MTK_INPUT);
> break;
> case PIN_CONFIG_SLEW_RATE:
> /* regard all non-zero value as enable */
Best regards,
Macpaul Lin
next prev parent reply other threads:[~2024-10-17 8:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 7:55 Bo Ye
2024-10-17 8:15 ` Macpaul Lin [this message]
2024-10-17 8:58 ` Chen-Yu Tsai
Reply instructions:
You may reply publicly 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=433295fe-8d34-af8b-f6bf-be1953b6e479@mediatek.com \
--to=macpaul.lin@mediatek.com \
--cc=Jades.shih@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bo.ye@mediatek.com \
--cc=browse.zhang@mediatek.com \
--cc=ivan.tseng@mediatek.com \
--cc=light.hsieh@mediatek.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=ot_evan.cao@mediatek.com \
--cc=sean.wang@kernel.org \
--cc=xiujuan.tan@mediatek.com \
--cc=yongdong.zhang@mediatek.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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®