All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen-Yu Tsai <wenst@chromium.org>
To: Sean Wang <sean.wang@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Matthias Brugger <matthias.bgg@gmail.com>
Cc: Chen-Yu Tsai <wenst@chromium.org>,
	linux-mediatek@lists.infradead.org, linux-gpio@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@collabora.com>
Subject: [PATCH v2 04/11] pinctrl: mediatek: paris: Fix pingroup pin config state readback
Date: Tue,  8 Mar 2022 18:09:49 +0800	[thread overview]
Message-ID: <20220308100956.2750295-5-wenst@chromium.org> (raw)
In-Reply-To: <20220308100956.2750295-1-wenst@chromium.org>

mtk_pconf_group_get(), used to read back pingroup pin config state,
simply returns a set of configs saved from a previous invocation of
mtk_pconf_group_set(). This is an unfiltered, unvalidated set passed
in from the pinconf core, which does not match the current hardware
state.

Since the driver library is designed to have one pin per group, pass
through mtk_pconf_group_get() to mtk_pinconf_get(), to read back the
current pin config state of the only pin in the group.

Also drop the assignment of pin config state to the group.

Fixes: 805250982bb5 ("pinctrl: mediatek: add pinctrl-paris that implements the vendor dt-bindings")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/pinctrl/mediatek/pinctrl-paris.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c
index c668191933a0..3bda1aac650b 100644
--- a/drivers/pinctrl/mediatek/pinctrl-paris.c
+++ b/drivers/pinctrl/mediatek/pinctrl-paris.c
@@ -732,10 +732,10 @@ static int mtk_pconf_group_get(struct pinctrl_dev *pctldev, unsigned group,
 			       unsigned long *config)
 {
 	struct mtk_pinctrl *hw = pinctrl_dev_get_drvdata(pctldev);
+	struct mtk_pinctrl_group *grp = &hw->groups[group];
 
-	*config = hw->groups[group].config;
-
-	return 0;
+	 /* One pin per group only */
+	return mtk_pinconf_get(pctldev, grp->pin, config);
 }
 
 static int mtk_pconf_group_set(struct pinctrl_dev *pctldev, unsigned group,
@@ -751,8 +751,6 @@ static int mtk_pconf_group_set(struct pinctrl_dev *pctldev, unsigned group,
 				      pinconf_to_config_argument(configs[i]));
 		if (ret < 0)
 			return ret;
-
-		grp->config = configs[i];
 	}
 
 	return 0;
-- 
2.35.1.616.g0bdcbb4464-goog


WARNING: multiple messages have this Message-ID (diff)
From: Chen-Yu Tsai <wenst@chromium.org>
To: Sean Wang <sean.wang@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Matthias Brugger <matthias.bgg@gmail.com>
Cc: Chen-Yu Tsai <wenst@chromium.org>,
	linux-mediatek@lists.infradead.org, linux-gpio@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>
Subject: [PATCH v2 04/11] pinctrl: mediatek: paris: Fix pingroup pin config state readback
Date: Tue,  8 Mar 2022 18:09:49 +0800	[thread overview]
Message-ID: <20220308100956.2750295-5-wenst@chromium.org> (raw)
In-Reply-To: <20220308100956.2750295-1-wenst@chromium.org>

mtk_pconf_group_get(), used to read back pingroup pin config state,
simply returns a set of configs saved from a previous invocation of
mtk_pconf_group_set(). This is an unfiltered, unvalidated set passed
in from the pinconf core, which does not match the current hardware
state.

Since the driver library is designed to have one pin per group, pass
through mtk_pconf_group_get() to mtk_pinconf_get(), to read back the
current pin config state of the only pin in the group.

Also drop the assignment of pin config state to the group.

Fixes: 805250982bb5 ("pinctrl: mediatek: add pinctrl-paris that implements the vendor dt-bindings")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/pinctrl/mediatek/pinctrl-paris.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c
index c668191933a0..3bda1aac650b 100644
--- a/drivers/pinctrl/mediatek/pinctrl-paris.c
+++ b/drivers/pinctrl/mediatek/pinctrl-paris.c
@@ -732,10 +732,10 @@ static int mtk_pconf_group_get(struct pinctrl_dev *pctldev, unsigned group,
 			       unsigned long *config)
 {
 	struct mtk_pinctrl *hw = pinctrl_dev_get_drvdata(pctldev);
+	struct mtk_pinctrl_group *grp = &hw->groups[group];
 
-	*config = hw->groups[group].config;
-
-	return 0;
+	 /* One pin per group only */
+	return mtk_pinconf_get(pctldev, grp->pin, config);
 }
 
 static int mtk_pconf_group_set(struct pinctrl_dev *pctldev, unsigned group,
@@ -751,8 +751,6 @@ static int mtk_pconf_group_set(struct pinctrl_dev *pctldev, unsigned group,
 				      pinconf_to_config_argument(configs[i]));
 		if (ret < 0)
 			return ret;
-
-		grp->config = configs[i];
 	}
 
 	return 0;
-- 
2.35.1.616.g0bdcbb4464-goog


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Chen-Yu Tsai <wenst@chromium.org>
To: Sean Wang <sean.wang@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Matthias Brugger <matthias.bgg@gmail.com>
Cc: Chen-Yu Tsai <wenst@chromium.org>,
	linux-mediatek@lists.infradead.org, linux-gpio@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>
Subject: [PATCH v2 04/11] pinctrl: mediatek: paris: Fix pingroup pin config state readback
Date: Tue,  8 Mar 2022 18:09:49 +0800	[thread overview]
Message-ID: <20220308100956.2750295-5-wenst@chromium.org> (raw)
In-Reply-To: <20220308100956.2750295-1-wenst@chromium.org>

mtk_pconf_group_get(), used to read back pingroup pin config state,
simply returns a set of configs saved from a previous invocation of
mtk_pconf_group_set(). This is an unfiltered, unvalidated set passed
in from the pinconf core, which does not match the current hardware
state.

Since the driver library is designed to have one pin per group, pass
through mtk_pconf_group_get() to mtk_pinconf_get(), to read back the
current pin config state of the only pin in the group.

Also drop the assignment of pin config state to the group.

Fixes: 805250982bb5 ("pinctrl: mediatek: add pinctrl-paris that implements the vendor dt-bindings")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/pinctrl/mediatek/pinctrl-paris.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c
index c668191933a0..3bda1aac650b 100644
--- a/drivers/pinctrl/mediatek/pinctrl-paris.c
+++ b/drivers/pinctrl/mediatek/pinctrl-paris.c
@@ -732,10 +732,10 @@ static int mtk_pconf_group_get(struct pinctrl_dev *pctldev, unsigned group,
 			       unsigned long *config)
 {
 	struct mtk_pinctrl *hw = pinctrl_dev_get_drvdata(pctldev);
+	struct mtk_pinctrl_group *grp = &hw->groups[group];
 
-	*config = hw->groups[group].config;
-
-	return 0;
+	 /* One pin per group only */
+	return mtk_pinconf_get(pctldev, grp->pin, config);
 }
 
 static int mtk_pconf_group_set(struct pinctrl_dev *pctldev, unsigned group,
@@ -751,8 +751,6 @@ static int mtk_pconf_group_set(struct pinctrl_dev *pctldev, unsigned group,
 				      pinconf_to_config_argument(configs[i]));
 		if (ret < 0)
 			return ret;
-
-		grp->config = configs[i];
 	}
 
 	return 0;
-- 
2.35.1.616.g0bdcbb4464-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-03-08 10:10 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08 10:09 [PATCH v2 00/11] pinctrl: mediatek: Fixes and minor improvements Chen-Yu Tsai
2022-03-08 10:09 ` Chen-Yu Tsai
2022-03-08 10:09 ` Chen-Yu Tsai
2022-03-08 10:09 ` [PATCH v2 01/11] pinctrl: pinconf-generic: Print arguments for bias-pull-* Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-08 10:09 ` [PATCH v2 02/11] pinctrl: mediatek: paris: Fix PIN_CONFIG_BIAS_* readback Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-08 15:27   ` AngeloGioacchino Del Regno
2022-03-08 15:27     ` AngeloGioacchino Del Regno
2022-03-08 15:27     ` AngeloGioacchino Del Regno
2022-03-08 10:09 ` [PATCH v2 03/11] pinctrl: mediatek: paris: Fix "argument" argument type for mtk_pinconf_get() Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-08 10:09 ` Chen-Yu Tsai [this message]
2022-03-08 10:09   ` [PATCH v2 04/11] pinctrl: mediatek: paris: Fix pingroup pin config state readback Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-08 10:09 ` [PATCH v2 05/11] pinctrl: mediatek: paris: Drop extra newline in mtk_pctrl_show_one_pin() Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-09 20:01   ` Joe Perches
2022-03-09 20:01     ` Joe Perches
2022-03-09 20:01     ` Joe Perches
2022-03-10  3:37     ` Chen-Yu Tsai
2022-03-10  3:37       ` Chen-Yu Tsai
2022-03-10  3:37       ` Chen-Yu Tsai
2022-03-08 10:09 ` [PATCH v2 06/11] pinctrl: mediatek: paris: Skip custom extra pin config dump for virtual GPIOs Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-08 10:09 ` [PATCH v2 07/11] pinctrl: mediatek: paris: Rework mtk_pinconf_{get,set} switch/case logic Chen-Yu Tsai
2022-03-08 10:09   ` [PATCH v2 07/11] pinctrl: mediatek: paris: Rework mtk_pinconf_{get, set} " Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-08 15:27   ` [PATCH v2 07/11] pinctrl: mediatek: paris: Rework mtk_pinconf_{get,set} " AngeloGioacchino Del Regno
2022-03-08 15:27     ` AngeloGioacchino Del Regno
2022-03-08 15:27     ` AngeloGioacchino Del Regno
2022-03-08 10:09 ` [PATCH v2 08/11] pinctrl: mediatek: paris: Support generic PIN_CONFIG_DRIVE_STRENGTH_UA Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-08 15:27   ` AngeloGioacchino Del Regno
2022-03-08 15:27     ` AngeloGioacchino Del Regno
2022-03-08 15:27     ` AngeloGioacchino Del Regno
2022-03-08 10:09 ` [PATCH v2 09/11] pinctrl: mediatek: pinctrl-moore: Simplify with dev_err_probe() Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-08 10:09 ` [PATCH v2 10/11] pinctrl: mediatek: pinctrl-paris: " Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-08 10:09 ` [PATCH v2 11/11] pinctrl: mediatek: pinctrl-mtk-common: " Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-08 10:09   ` Chen-Yu Tsai
2022-03-15  0:24 ` [PATCH v2 00/11] pinctrl: mediatek: Fixes and minor improvements Linus Walleij
2022-03-15  0:24   ` Linus Walleij
2022-03-15  0:24   ` Linus Walleij

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=20220308100956.2750295-5-wenst@chromium.org \
    --to=wenst@chromium.org \
    --cc=angelogioacchino.delregno@collabora.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=sean.wang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.