• Home
  • Raw
  • Download

Lines Matching refs:pin

96 __set_direction(struct orion_gpio_chip *ochip, unsigned pin, int input)  in __set_direction()  argument
102 u |= 1 << pin; in __set_direction()
104 u &= ~(1 << pin); in __set_direction()
108 static void __set_level(struct orion_gpio_chip *ochip, unsigned pin, int high) in __set_level() argument
114 u |= 1 << pin; in __set_level()
116 u &= ~(1 << pin); in __set_level()
121 __set_blinking(struct orion_gpio_chip *ochip, unsigned pin, int blink) in __set_blinking() argument
127 u |= 1 << pin; in __set_blinking()
129 u &= ~(1 << pin); in __set_blinking()
134 orion_gpio_is_valid(struct orion_gpio_chip *ochip, unsigned pin, int mode) in orion_gpio_is_valid() argument
136 if (pin >= ochip->chip.ngpio) in orion_gpio_is_valid()
139 if ((mode & GPIO_INPUT_OK) && !test_bit(pin, &ochip->valid_input)) in orion_gpio_is_valid()
142 if ((mode & GPIO_OUTPUT_OK) && !test_bit(pin, &ochip->valid_output)) in orion_gpio_is_valid()
148 pr_debug("%s: invalid GPIO %d\n", __func__, pin); in orion_gpio_is_valid()
155 static int orion_gpio_request(struct gpio_chip *chip, unsigned pin) in orion_gpio_request() argument
159 if (orion_gpio_is_valid(ochip, pin, GPIO_INPUT_OK) || in orion_gpio_request()
160 orion_gpio_is_valid(ochip, pin, GPIO_OUTPUT_OK)) in orion_gpio_request()
166 static int orion_gpio_direction_input(struct gpio_chip *chip, unsigned pin) in orion_gpio_direction_input() argument
171 if (!orion_gpio_is_valid(ochip, pin, GPIO_INPUT_OK)) in orion_gpio_direction_input()
175 __set_direction(ochip, pin, 1); in orion_gpio_direction_input()
181 static int orion_gpio_get(struct gpio_chip *chip, unsigned pin) in orion_gpio_get() argument
186 if (readl(GPIO_IO_CONF(ochip)) & (1 << pin)) { in orion_gpio_get()
192 return (val >> pin) & 1; in orion_gpio_get()
196 orion_gpio_direction_output(struct gpio_chip *chip, unsigned pin, int value) in orion_gpio_direction_output() argument
201 if (!orion_gpio_is_valid(ochip, pin, GPIO_OUTPUT_OK)) in orion_gpio_direction_output()
205 __set_blinking(ochip, pin, 0); in orion_gpio_direction_output()
206 __set_level(ochip, pin, value); in orion_gpio_direction_output()
207 __set_direction(ochip, pin, 0); in orion_gpio_direction_output()
213 static void orion_gpio_set(struct gpio_chip *chip, unsigned pin, int value) in orion_gpio_set() argument
219 __set_level(ochip, pin, value); in orion_gpio_set()
223 static int orion_gpio_to_irq(struct gpio_chip *chip, unsigned pin) in orion_gpio_to_irq() argument
228 ochip->secondary_irq_base + pin); in orion_gpio_to_irq()
234 static struct orion_gpio_chip *orion_gpio_chip_find(int pin) in orion_gpio_chip_find() argument
242 if (pin >= chip->base && pin < chip->base + chip->ngpio) in orion_gpio_chip_find()
249 void __init orion_gpio_set_unused(unsigned pin) in orion_gpio_set_unused() argument
251 struct orion_gpio_chip *ochip = orion_gpio_chip_find(pin); in orion_gpio_set_unused()
256 pin -= ochip->chip.base; in orion_gpio_set_unused()
259 __set_level(ochip, pin, 0); in orion_gpio_set_unused()
260 __set_direction(ochip, pin, 0); in orion_gpio_set_unused()
263 void __init orion_gpio_set_valid(unsigned pin, int mode) in orion_gpio_set_valid() argument
265 struct orion_gpio_chip *ochip = orion_gpio_chip_find(pin); in orion_gpio_set_valid()
270 pin -= ochip->chip.base; in orion_gpio_set_valid()
276 __set_bit(pin, &ochip->valid_input); in orion_gpio_set_valid()
278 __clear_bit(pin, &ochip->valid_input); in orion_gpio_set_valid()
281 __set_bit(pin, &ochip->valid_output); in orion_gpio_set_valid()
283 __clear_bit(pin, &ochip->valid_output); in orion_gpio_set_valid()
286 void orion_gpio_set_blink(unsigned pin, int blink) in orion_gpio_set_blink() argument
288 struct orion_gpio_chip *ochip = orion_gpio_chip_find(pin); in orion_gpio_set_blink()
295 __set_level(ochip, pin & 31, 0); in orion_gpio_set_blink()
296 __set_blinking(ochip, pin & 31, blink); in orion_gpio_set_blink()
356 int pin; in gpio_irq_set_type() local
359 pin = d->hwirq - ochip->secondary_irq_base; in gpio_irq_set_type()
361 u = readl(GPIO_IO_CONF(ochip)) & (1 << pin); in gpio_irq_set_type()
380 u &= ~(1 << pin); in gpio_irq_set_type()
384 u |= 1 << pin; in gpio_irq_set_type()
395 if (v & (1 << pin)) in gpio_irq_set_type()
396 u |= 1 << pin; /* falling */ in gpio_irq_set_type()
398 u &= ~(1 << pin); /* rising */ in gpio_irq_set_type()