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]
Date:   Thu, 12 Dec 2019 16:48:26 +0000
From:   Adam Thomson <Adam.Thomson.Opensource@...semi.com>
To:     Marco Felsch <m.felsch@...gutronix.de>,
        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>
CC:     "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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ