mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Crispin <blogic@openwrt.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-kernel@vger.kernel.org, John Crispin <blogic@openwrt.org>
Subject: [PATCH 04/11] PINCTRL: lantiq: add output pinconf parameter
Date: Fri,  1 Feb 2013 13:04:58 +0100	[thread overview]
Message-ID: <1359720305-31933-4-git-send-email-blogic@openwrt.org> (raw)
In-Reply-To: <1359720305-31933-1-git-send-email-blogic@openwrt.org>

While converting the boards inside OpenWrt to OF I noticed that the we are
missing a pinconf parameter to set a pin to output.

Signed-off-by: John Crispin <blogic@openwrt.org>
---
 drivers/pinctrl/pinctrl-lantiq.h |    1 +
 drivers/pinctrl/pinctrl-xway.c   |   14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-lantiq.h b/drivers/pinctrl/pinctrl-lantiq.h
index 4419d32..6d07f02 100644
--- a/drivers/pinctrl/pinctrl-lantiq.h
+++ b/drivers/pinctrl/pinctrl-lantiq.h
@@ -34,6 +34,7 @@ enum ltq_pinconf_param {
 	LTQ_PINCONF_PARAM_OPEN_DRAIN,
 	LTQ_PINCONF_PARAM_DRIVE_CURRENT,
 	LTQ_PINCONF_PARAM_SLEW_RATE,
+	LTQ_PINCONF_PARAM_OUTPUT,
 };
 
 struct ltq_cfg_param {
diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c
index aa4c8b8..b23b895 100644
--- a/drivers/pinctrl/pinctrl-xway.c
+++ b/drivers/pinctrl/pinctrl-xway.c
@@ -466,6 +466,11 @@ static int xway_pinconf_get(struct pinctrl_dev *pctldev,
 			*config = LTQ_PINCONF_PACK(param, 1);
 		break;
 
+	case LTQ_PINCONF_PARAM_OUTPUT:
+		reg = GPIO_DIR(pin);
+		*config = LTQ_PINCONF_PACK(param,
+			gpio_getbit(info->membase[0], reg, PORT_PIN(pin)));
+		break;
 	default:
 		dev_err(pctldev->dev, "Invalid config param %04x\n", param);
 		return -ENOTSUPP;
@@ -515,6 +520,14 @@ static int xway_pinconf_set(struct pinctrl_dev *pctldev,
 			dev_err(pctldev->dev, "Invalid pull value %d\n", arg);
 		break;
 
+	case LTQ_PINCONF_PARAM_OUTPUT:
+		reg = GPIO_DIR(pin);
+		if (arg == 0)
+			gpio_clearbit(info->membase[0], reg, PORT_PIN(pin));
+		else
+			gpio_setbit(info->membase[0], reg, PORT_PIN(pin));
+		break;
+
 	default:
 		dev_err(pctldev->dev, "Invalid config param %04x\n", param);
 		return -ENOTSUPP;
@@ -573,6 +586,7 @@ static inline int xway_mux_apply(struct pinctrl_dev *pctrldev,
 static const struct ltq_cfg_param xway_cfg_params[] = {
 	{"lantiq,pull",		LTQ_PINCONF_PARAM_PULL},
 	{"lantiq,open-drain",	LTQ_PINCONF_PARAM_OPEN_DRAIN},
+	{"lantiq,output",	LTQ_PINCONF_PARAM_OUTPUT},
 };
 
 static struct ltq_pinmux_info xway_info = {
-- 
1.7.10.4


  parent reply	other threads:[~2013-02-01 12:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-01 12:04 [PATCH 01/11] PINCTRL: lantiq: pinconf uses port instead of pin John Crispin
2013-02-01 12:04 ` [PATCH 02/11] PINCTRL: lantiq: faulty bit inversion John Crispin
2013-02-05 14:39   ` Linus Walleij
2013-02-01 12:04 ` [PATCH 03/11] PINCTRL: lantiq: add pin_config_group_set support John Crispin
2013-02-05 14:42   ` Linus Walleij
2013-02-01 12:04 ` John Crispin [this message]
2013-02-05 14:46   ` [PATCH 04/11] PINCTRL: lantiq: add output pinconf parameter Linus Walleij
2013-02-05 14:46     ` John Crispin
2013-02-01 12:04 ` [PATCH 05/11] PINCTRL: lantiq: the pinconf OD parameter argument was ignored John Crispin
2013-02-05 14:50   ` Linus Walleij
2013-02-01 12:05 ` [PATCH 06/11] PINCTRL: lantiq: only probe available pad controllers John Crispin
2013-02-05 14:58   ` Linus Walleij
2013-02-01 12:05 ` [PATCH 07/11] PINCTRL: lantiq: one of the boot leds was defined incorrectly John Crispin
2013-02-05 14:53   ` Linus Walleij
2013-02-01 12:05 ` [PATCH 08/11] PINCTRL: lantiq: fix pinconfig parameters John Crispin
2013-02-05 14:57   ` Linus Walleij
2013-02-01 12:05 ` [PATCH 09/11] PINCTRL: lantiq: add functionality to falcon_pinconf_dbg_show John Crispin
2013-02-05 14:55   ` Linus Walleij
2013-02-01 12:05 ` [PATCH 10/11] PINCTRL: lantiq: fix pin availability check John Crispin
2013-02-01 12:05 ` [PATCH 11/11] PINCTRL: lantiq: fix pin number in ltq_pmx_gpio_request_enable John Crispin
2013-02-05 15:13   ` Linus Walleij
2013-02-05 14:39 ` [PATCH 01/11] PINCTRL: lantiq: pinconf uses port instead of pin Linus Walleij
2013-02-05 14:59   ` Linus Walleij
2013-02-05 15:00     ` John Crispin
2013-02-05 15:14       ` 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=1359720305-31933-4-git-send-email-blogic@openwrt.org \
    --to=blogic@openwrt.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®