lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191216074734.ctjxx6rqtj6mt2dw@pengutronix.de>
Date:   Mon, 16 Dec 2019 08:47:34 +0100
From:   Marco Felsch <m.felsch@...gutronix.de>
To:     Adam Thomson <Adam.Thomson.Opensource@...semi.com>
Cc:     Support Opensource <Support.Opensource@...semi.com>,
        "lee.jones@...aro.org" <lee.jones@...aro.org>,
        "robh+dt@...nel.org" <robh+dt@...nel.org>,
        "linus.walleij@...aro.org" <linus.walleij@...aro.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
        "kernel@...gutronix.de" <kernel@...gutronix.de>
Subject: Re: [RESEND PATCH v3 3/3] pinctrl: da9062: add driver support

Hi Adam,

On 19-12-12 16:48, Adam Thomson wrote:
> 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?

No worries, thanks for the review :)
Nice catch, Linus is it okay to add this as follow up patch? The current
patch isn't wrong without the 'PIN_CONFIG_BIAS_DISABLE' case.

Regards,
  Marco

> > +	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;
> > +	}
> > +}
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ