From: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>
To: 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>,
Bamvor Jian Zhang <bamv2005@gmail.com>,
Shuah Khan <shuah@kernel.org>
Cc: kernel@collabora.com, linux-mediatek@lists.infradead.org,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kselftest@vger.kernel.org, kernelci@lists.linux.dev,
"Nícolas F. R. A. Prado" <nfraprado@collabora.com>
Subject: [PATCH RFC 1/3] pinctrl: mediatek: paris: Expose more configurations to GPIO set_config
Date: Mon, 09 Sep 2024 14:37:32 -0400 [thread overview]
Message-ID: <20240909-kselftest-gpio-set-get-config-v1-1-16a065afc3c1@collabora.com> (raw)
In-Reply-To: <20240909-kselftest-gpio-set-get-config-v1-0-16a065afc3c1@collabora.com>
Currently the set_config callback in the gpio_chip registered by the
pinctrl_paris driver only supports PIN_CONFIG_INPUT_DEBOUNCE, despite
many other configurations already being implemented and available
through the pinctrl API for configuration of pins by the Devicetree and
other drivers.
Expose all configurations currently implemented through the GPIO API so
they can also be set from userspace, which is particularly useful to
allow testing them from userspace.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
drivers/pinctrl/mediatek/pinctrl-paris.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c
index e12316c42698..668f8055a544 100644
--- a/drivers/pinctrl/mediatek/pinctrl-paris.c
+++ b/drivers/pinctrl/mediatek/pinctrl-paris.c
@@ -255,10 +255,9 @@ static int mtk_pinconf_get(struct pinctrl_dev *pctldev,
return err;
}
-static int mtk_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
+static int mtk_pinconf_set(struct mtk_pinctrl *hw, unsigned int pin,
enum pin_config_param param, u32 arg)
{
- struct mtk_pinctrl *hw = pinctrl_dev_get_drvdata(pctldev);
const struct mtk_pin_desc *desc;
int err = -ENOTSUPP;
u32 reg;
@@ -795,7 +794,7 @@ static int mtk_pconf_group_set(struct pinctrl_dev *pctldev, unsigned group,
int i, ret;
for (i = 0; i < num_configs; i++) {
- ret = mtk_pinconf_set(pctldev, grp->pin,
+ ret = mtk_pinconf_set(hw, grp->pin,
pinconf_to_config_param(configs[i]),
pinconf_to_config_argument(configs[i]));
if (ret < 0)
@@ -937,18 +936,19 @@ static int mtk_gpio_set_config(struct gpio_chip *chip, unsigned int offset,
{
struct mtk_pinctrl *hw = gpiochip_get_data(chip);
const struct mtk_pin_desc *desc;
- u32 debounce;
+ enum pin_config_param param = pinconf_to_config_param(config);
+ u32 arg = pinconf_to_config_argument(config);
desc = (const struct mtk_pin_desc *)&hw->soc->pins[offset];
- if (!hw->eint ||
- pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE ||
- desc->eint.eint_n == EINT_NA)
- return -ENOTSUPP;
+ if (param == PIN_CONFIG_INPUT_DEBOUNCE) {
+ if (!hw->eint || desc->eint.eint_n == EINT_NA)
+ return -ENOTSUPP;
- debounce = pinconf_to_config_argument(config);
+ return mtk_eint_set_debounce(hw->eint, desc->eint.eint_n, arg);
+ }
- return mtk_eint_set_debounce(hw->eint, desc->eint.eint_n, debounce);
+ return mtk_pinconf_set(hw, offset, param, arg);
}
static int mtk_build_gpiochip(struct mtk_pinctrl *hw)
--
2.46.0
next prev parent reply other threads:[~2024-09-09 18:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-09 18:37 [PATCH RFC 0/3] Verify bias functionality for pinctrl_paris driver through new gpio test Nícolas F. R. A. Prado
2024-09-09 18:37 ` Nícolas F. R. A. Prado [this message]
2024-09-11 10:10 ` [PATCH RFC 1/3] pinctrl: mediatek: paris: Expose more configurations to GPIO set_config AngeloGioacchino Del Regno
2024-10-24 15:17 ` AngeloGioacchino Del Regno
2024-10-24 17:46 ` Nícolas F. R. A. Prado
2024-09-09 18:37 ` [PATCH RFC 2/3] selftest: gpio: Add wait flag to gpio-mockup-cdev Nícolas F. R. A. Prado
2024-09-09 18:37 ` [PATCH RFC 3/3] selftest: gpio: Add a new set-get config test Nícolas F. R. A. Prado
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=20240909-kselftest-gpio-set-get-config-v1-1-16a065afc3c1@collabora.com \
--to=nfraprado@collabora.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bamv2005@gmail.com \
--cc=kernel@collabora.com \
--cc=kernelci@lists.linux.dev \
--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-kselftest@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=sean.wang@kernel.org \
--cc=shuah@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).