devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
To: Marco Felsch <m.felsch@pengutronix.de>,
	Support Opensource <Support.Opensource@diasemi.com>,
	"lee.jones@linaro.org" <lee.jones@linaro.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>
Subject: RE: [RESEND PATCH v3 3/3] pinctrl: da9062: add driver support
Date: Thu, 12 Dec 2019 16:48:26 +0000	[thread overview]
Message-ID: <AM5PR1001MB0994E2D72A95E4AC4796F80A80550@AM5PR1001MB0994.EURPRD10.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20191212160413.15232-4-m.felsch@pengutronix.de>

On 12 December 2019 16:04, Marco Felsch wrote:

> +static int da9062_gpio_set_config(struct gpio_chip *gc, unsigned int offset,
> +				  unsigned long config)
> +{
> +	struct da9062_pctl *pctl = gpiochip_get_data(gc);
> +	struct regmap *regmap = pctl->da9062->regmap;
> +	int gpio_mode;
> +
> +	/*
> +	 * We need to meet the following restrictions [1, Figure 18]:
> +	 * - PIN_CONFIG_BIAS_PULL_DOWN -> only allowed if the pin is used as
> +	 *				  gpio input
> +	 * - PIN_CONFIG_BIAS_PULL_UP   -> only allowed if the pin is used as
> +	 *				  gpio output open-drain.
> +	 */
> +
> +	switch (pinconf_to_config_param(config)) {
> +	case PIN_CONFIG_BIAS_PULL_DOWN:
> +		gpio_mode = da9062_pctl_get_pin_mode(pctl, offset);
> +		if (gpio_mode < 0)
> +			return -EINVAL;
> +		else if (gpio_mode != DA9062_PIN_GPI)
> +			return -ENOTSUPP;
> +		return regmap_update_bits(regmap, DA9062AA_CONFIG_K,
> +					  BIT(offset), BIT(offset));
> +	case PIN_CONFIG_BIAS_PULL_UP:
> +		gpio_mode = da9062_pctl_get_pin_mode(pctl, offset);
> +		if (gpio_mode < 0)
> +			return -EINVAL;
> +		else if (gpio_mode != DA9062_PIN_GPO_OD)
> +			return -ENOTSUPP;
> +		return regmap_update_bits(regmap, DA9062AA_CONFIG_K,
> +					  BIT(offset), BIT(offset));

Apologies for the delay on reviewing. Just looking at the datasheet, how do we
disable PULL_DOWN (for input) and PULL_UP (for output)? Should we not have a
'PIN_CONFIG_BIAS_DISABLE' case here to handle this?

> +	case PIN_CONFIG_DRIVE_OPEN_DRAIN:
> +		return da9062_pctl_set_pin_mode(pctl, offset,
> +						DA9062_PIN_GPO_OD);
> +	case PIN_CONFIG_DRIVE_PUSH_PULL:
> +		return da9062_pctl_set_pin_mode(pctl, offset,
> +						DA9062_PIN_GPO_PP);
> +	default:
> +		return -ENOTSUPP;
> +	}
> +}

  reply	other threads:[~2019-12-12 16:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-12 16:04 [RESEND PATCH v3 0/3] Add DA9062 GPIO support Marco Felsch
2019-12-12 16:04 ` [RESEND PATCH v3 1/3] dt-bindings: mfd: da9062: add gpio bindings Marco Felsch
2019-12-12 16:45   ` Adam Thomson
2019-12-13 10:38   ` Lee Jones
2019-12-18 21:54   ` Rob Herring
2019-12-12 16:04 ` [RESEND PATCH v3 2/3] mfd: da9062: add support for the DA9062 GPIOs in the core Marco Felsch
2019-12-12 16:45   ` Adam Thomson
2019-12-13 10:37   ` Lee Jones
2019-12-12 16:04 ` [RESEND PATCH v3 3/3] pinctrl: da9062: add driver support Marco Felsch
2019-12-12 16:48   ` Adam Thomson [this message]
2019-12-16  7:47     ` Marco Felsch
2019-12-16 10:33       ` Linus Walleij
2019-12-17  6:40         ` Marco Felsch
2019-12-17  9:55           ` Adam Thomson

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=AM5PR1001MB0994E2D72A95E4AC4796F80A80550@AM5PR1001MB0994.EURPRD10.PROD.OUTLOOK.COM \
    --to=adam.thomson.opensource@diasemi.com \
    --cc=Support.Opensource@diasemi.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.felsch@pengutronix.de \
    --cc=robh+dt@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).