Lines Matching defs:pin
3 * Driver for the ps-mode pin configuration.
22 * modepin_gpio_get_value - Get the state of the specified pin of GPIO device
24 * @pin: gpio pin number within the device
26 * This function reads the state of the specified pin of the GPIO device.
28 * Return: 0 if the pin is low, 1 if pin is high, -EINVAL wrong pin configured
31 static int modepin_gpio_get_value(struct gpio_chip *chip, unsigned int pin)
43 if (regval & BIT(pin))
44 return !!(regval & BIT(pin + 8));
46 return !!(regval & BIT(pin + 4));
50 * modepin_gpio_set_value - Modify the state of the pin with specified value
52 * @pin: gpio pin number within the device
53 * @state: value used to modify the state of the specified pin
55 * This function reads the state of the specified pin of the GPIO device, mask
56 * with the capture state of GPIO pin, and update pin of GPIO device.
60 static int modepin_gpio_set_value(struct gpio_chip *chip, unsigned int pin,
68 /* Configure pin as an output by set bit [0:3] */
69 bootpin_val |= BIT(pin);
72 bootpin_val |= BIT(pin + 8);
74 bootpin_val &= ~BIT(pin + 8);
79 pr_err("modepin: set value error %d for pin %d\n", ret, pin);
85 * modepin_gpio_dir_in - Set the direction of the specified GPIO pin as input
87 * @pin: gpio pin number within the device
91 static int modepin_gpio_dir_in(struct gpio_chip *chip, unsigned int pin)
97 * modepin_gpio_dir_out - Set the direction of the specified GPIO pin as output
99 * @pin: gpio pin number within the device
100 * @state: value to be written to specified pin
104 static int modepin_gpio_dir_out(struct gpio_chip *chip, unsigned int pin,
107 return modepin_gpio_set_value(chip, pin, state);