Commit 203a8311 authored by Linus Walleij's avatar Linus Walleij
Browse files

pinctrl: generic: rename PIN_CONFIG_OUTPUT to LEVEL



This generic pin config property is confusingly named so let's
rename it to make things clearer.

There are already drivers in the tree that use PIN_CONFIG_OUTPUT
to *read* the value of an output driven pin, which is a big
semantic confusion for the head: are we then reading the
setting of the output or the actual value/level that is put
out on the pin?

We already have PIN_CONFIG_OUTPUT_ENABLE that turns on driver
buffers for output, so this can by logical conclusion only
drive the voltage level if it should be any different.

But if we read the pin, are we then reading the *setting* of
the output value or the *actual* value we can see on the
line?

If the pin has not first been set into output mode with
PIN_CONFIG_OUTPUT_ENABLE, but is instead in some input mode
or tristate, what will reading this property actually
return?

Reading the current users reading this property it is clear
that what we read is the logical level of the pin as 0 or 1
depending on if it is low or high.

Rename it to PIN_CONFIG_LEVEL so it is crystal clear that
we set or read the voltage level of the pin and nothing else.

Acked-by: default avatarSudeep Holla <sudeep.holla@arm.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 6c3442b3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -863,7 +863,7 @@ has to be handled by the ``<linux/gpio/consumer.h>`` interface. Instead view thi
a certain pin config setting. Look in e.g. ``<linux/pinctrl/pinconf-generic.h>``
and you find this in the documentation:

  PIN_CONFIG_OUTPUT:
  PIN_CONFIG_LEVEL:
     this will configure the pin in output, use argument
     1 to indicate high level, argument 0 to indicate low level.

@@ -897,7 +897,7 @@ And your machine configuration may look like this:
	};

	static unsigned long uart_sleep_mode[] = {
		PIN_CONF_PACKED(PIN_CONFIG_OUTPUT, 0),
		PIN_CONF_PACKED(PIN_CONFIG_LEVEL, 0),
	};

	static struct pinctrl_map pinmap[] __initdata = {
+1 −1
Original line number Diff line number Diff line
@@ -769,7 +769,7 @@ static int rockchip_gpio_probe(struct platform_device *pdev)
		list_del(&cfg->head);

		switch (cfg->param) {
		case PIN_CONFIG_OUTPUT:
		case PIN_CONFIG_LEVEL:
			ret = rockchip_gpio_direction_output(&bank->gpio_chip, cfg->pin, cfg->arg);
			if (ret)
				dev_warn(dev, "setting output pin %u to %u failed\n", cfg->pin,
+3 −3
Original line number Diff line number Diff line
@@ -1023,7 +1023,7 @@ static int bcm2835_pinconf_get(struct pinctrl_dev *pctldev,
	/* No way to read back bias config in HW */

	switch (param) {
	case PIN_CONFIG_OUTPUT:
	case PIN_CONFIG_LEVEL:
		if (fsel != BCM2835_FSEL_GPIO_OUT)
			return -EINVAL;

@@ -1091,7 +1091,7 @@ static int bcm2835_pinconf_set(struct pinctrl_dev *pctldev,
			break;

		/* Set output-high or output-low */
		case PIN_CONFIG_OUTPUT:
		case PIN_CONFIG_LEVEL:
			bcm2835_gpio_set_bit(pc, arg ? GPSET0 : GPCLR0, pin);
			break;

@@ -1202,7 +1202,7 @@ static int bcm2711_pinconf_set(struct pinctrl_dev *pctldev,
			break;

		/* Set output-high or output-low */
		case PIN_CONFIG_OUTPUT:
		case PIN_CONFIG_LEVEL:
			bcm2835_gpio_set_bit(pc, arg ? GPSET0 : GPCLR0, pin);
			break;

+2 −2
Original line number Diff line number Diff line
@@ -804,7 +804,7 @@ static int madera_pin_conf_get(struct pinctrl_dev *pctldev, unsigned int pin,
		if (conf[0] & MADERA_GP1_IP_CFG_MASK)
			result = 1;
		break;
	case PIN_CONFIG_OUTPUT:
	case PIN_CONFIG_LEVEL:
		if ((conf[1] & MADERA_GP1_DIR_MASK) &&
		    (conf[0] & MADERA_GP1_LVL_MASK))
			result = 1;
@@ -902,7 +902,7 @@ static int madera_pin_conf_set(struct pinctrl_dev *pctldev, unsigned int pin,
			mask[1] |= MADERA_GP1_DIR_MASK;
			conf[1] |= MADERA_GP1_DIR;
			break;
		case PIN_CONFIG_OUTPUT:
		case PIN_CONFIG_LEVEL:
			val = pinconf_to_config_argument(*configs);
			mask[0] |= MADERA_GP1_LVL_MASK;
			if (val)
+2 −2
Original line number Diff line number Diff line
@@ -2765,7 +2765,7 @@ static int airoha_pinconf_set(struct pinctrl_dev *pctrl_dev,
			break;
		case PIN_CONFIG_OUTPUT_ENABLE:
		case PIN_CONFIG_INPUT_ENABLE:
		case PIN_CONFIG_OUTPUT: {
		case PIN_CONFIG_LEVEL: {
			bool input = param == PIN_CONFIG_INPUT_ENABLE;
			int err;

@@ -2774,7 +2774,7 @@ static int airoha_pinconf_set(struct pinctrl_dev *pctrl_dev,
			if (err)
				return err;

			if (param == PIN_CONFIG_OUTPUT) {
			if (param == PIN_CONFIG_LEVEL) {
				err = airoha_pinconf_set_pin_value(pctrl_dev,
								   pin, !!arg);
				if (err)
Loading