From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
To: linus.walleij@linaro.org, geert+renesas@glider.be
Cc: linux-gpio@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Subject: [PATCH v2 1/3] pinctrl: sh-pfc: add new flags into struct sh_pfc_pin_config
Date: Thu, 8 Aug 2019 15:19:01 +0900 [thread overview]
Message-ID: <1565245143-15018-2-git-send-email-yoshihiro.shimoda.uh@renesas.com> (raw)
In-Reply-To: <1565245143-15018-1-git-send-email-yoshihiro.shimoda.uh@renesas.com>
To clean/modify the code up later, this patch just adds new flags
"mux_set" and "gpio_enabled" into the struct sh_pfc_pin_config.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/pinctrl/sh-pfc/pinctrl.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/sh-pfc/pinctrl.c b/drivers/pinctrl/sh-pfc/pinctrl.c
index 2824be4..864da24 100644
--- a/drivers/pinctrl/sh-pfc/pinctrl.c
+++ b/drivers/pinctrl/sh-pfc/pinctrl.c
@@ -27,6 +27,8 @@
struct sh_pfc_pin_config {
u32 type;
+ bool mux_set;
+ bool gpio_enabled;
};
struct sh_pfc_pinctrl {
@@ -364,7 +366,15 @@ static int sh_pfc_func_set_mux(struct pinctrl_dev *pctldev, unsigned selector,
for (i = 0; i < grp->nr_pins; ++i) {
ret = sh_pfc_config_mux(pfc, grp->mux[i], PINMUX_TYPE_FUNCTION);
if (ret < 0)
- break;
+ goto done;
+ }
+
+ /* All group pins are configured, mark the pins as mux_set */
+ for (i = 0; i < grp->nr_pins; ++i) {
+ int idx = sh_pfc_get_pin_index(pfc, grp->pins[i]);
+ struct sh_pfc_pin_config *cfg = &pmx->configs[idx];
+
+ cfg->mux_set = true;
}
done:
@@ -405,6 +415,7 @@ static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev,
}
cfg->type = PINMUX_TYPE_GPIO;
+ cfg->gpio_enabled = true;
ret = 0;
@@ -426,6 +437,7 @@ static void sh_pfc_gpio_disable_free(struct pinctrl_dev *pctldev,
spin_lock_irqsave(&pfc->lock, flags);
cfg->type = PINMUX_TYPE_NONE;
+ cfg->gpio_enabled = false;
spin_unlock_irqrestore(&pfc->lock, flags);
}
--
2.7.4
next prev parent reply other threads:[~2019-08-08 6:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-08 6:19 [PATCH v2 0/3] pinctrl: sh-pfc: Rollback to mux if requires when the gpio is freed Yoshihiro Shimoda
2019-08-08 6:19 ` Yoshihiro Shimoda [this message]
2019-08-09 18:52 ` [PATCH v2 1/3] pinctrl: sh-pfc: add new flags into struct sh_pfc_pin_config Simon Horman
2019-08-08 6:19 ` [PATCH v2 2/3] pinctrl: sh-pfc: remove incomplete flag "cfg->type" Yoshihiro Shimoda
2019-08-09 18:52 ` Simon Horman
2019-08-08 6:19 ` [PATCH v2 3/3] pinctrl: sh-pfc: Rollback to mux if requires when the gpio is freed Yoshihiro Shimoda
2019-08-08 8:29 ` Geert Uytterhoeven
2019-08-23 7:10 ` Geert Uytterhoeven
2019-08-09 18:52 ` Simon Horman
2019-08-08 8:31 ` [PATCH v2 0/3] " Geert Uytterhoeven
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=1565245143-15018-2-git-send-email-yoshihiro.shimoda.uh@renesas.com \
--to=yoshihiro.shimoda.uh@renesas.com \
--cc=geert+renesas@glider.be \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-renesas-soc@vger.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).