Lines Matching full:pin
3 * Core driver for the pin muxing portions of the pin control subsystem
74 * pinmux_can_be_used_for_gpio() - check if a specific pin
77 * @pctldev: the associated pin controller device
78 * @pin: the pin number in the global pin space
83 bool pinmux_can_be_used_for_gpio(struct pinctrl_dev *pctldev, unsigned pin) in pinmux_can_be_used_for_gpio() argument
85 struct pin_desc *desc = pin_desc_get(pctldev, pin); in pinmux_can_be_used_for_gpio()
88 /* Can't inspect pin, assume it can be used */ in pinmux_can_be_used_for_gpio()
99 * pin_request() - request a single pin to be muxed in, typically for GPIO
100 * @pctldev: the associated pin controller device
101 * @pin: the pin number in the global pin space
102 * @owner: a representation of the owner of this pin; typically the device
104 * @gpio_range: the range matching the GPIO pin if this is a request for a
105 * single GPIO pin
108 int pin, const char *owner, in pin_request()
115 desc = pin_desc_get(pctldev, pin); in pin_request()
118 "pin %d is not registered so it cannot be requested\n", in pin_request()
119 pin); in pin_request()
123 dev_dbg(pctldev->dev, "request pin %d (%s) for %s\n", in pin_request()
124 pin, desc->name, owner); in pin_request()
129 "pin %s already requested by %s; cannot claim for %s\n", in pin_request()
136 "pin %s already requested by %s; cannot claim for %s\n", in pin_request()
151 /* Let each pin increase references to this module */ in pin_request()
154 "could not increase module refcount for pin %d\n", in pin_request()
155 pin); in pin_request()
161 * If there is no kind of request function for the pin we just assume in pin_request()
165 /* This requests and enables a single GPIO pin */ in pin_request()
166 status = ops->gpio_request_enable(pctldev, gpio_range, pin); in pin_request()
168 status = ops->request(pctldev, pin); in pin_request()
173 dev_err(pctldev->dev, "request() failed for pin %d\n", pin); in pin_request()
189 dev_err(pctldev->dev, "pin-%d (%s) status %d\n", in pin_request()
190 pin, owner, status); in pin_request()
196 * pin_free() - release a single muxed in pin so something else can be muxed
197 * @pctldev: pin controller device handling this pin
198 * @pin: the pin to free
199 * @gpio_range: the range matching the GPIO pin if this is a request for a
200 * single GPIO pin
204 * once the pin is free. This is done for GPIO request functions.
206 static const char *pin_free(struct pinctrl_dev *pctldev, int pin, in pin_free() argument
213 desc = pin_desc_get(pctldev, pin); in pin_free()
216 "pin is not registered so it cannot be freed\n"); in pin_free()
222 * A pin should not be freed more times than allocated. in pin_free()
232 * If there is no kind of request function for the pin we just assume in pin_free()
236 ops->gpio_disable_free(pctldev, gpio_range, pin); in pin_free()
238 ops->free(pctldev, pin); in pin_free()
255 * pinmux_request_gpio() - request pinmuxing for a GPIO pin
256 * @pctldev: pin controller device affected
257 * @pin: the pin to mux in for GPIO
263 unsigned pin, unsigned gpio) in pinmux_request_gpio() argument
268 /* Conjure some name stating what chip and pin this is taken by */ in pinmux_request_gpio()
273 ret = pin_request(pctldev, pin, owner, range); in pinmux_request_gpio()
281 * pinmux_free_gpio() - release a pin from GPIO muxing
282 * @pctldev: the pin controller device for the pin
283 * @pin: the affected currently GPIO-muxed in pin
286 void pinmux_free_gpio(struct pinctrl_dev *pctldev, unsigned pin, in pinmux_free_gpio() argument
291 owner = pin_free(pctldev, pin, range); in pinmux_free_gpio()
296 * pinmux_gpio_direction() - set the direction of a single muxed-in GPIO pin
297 * @pctldev: the pin controller handling this pin
299 * @pin: the affected GPIO pin in this controller
300 * @input: true if we set the pin as input, false for output
304 unsigned pin, bool input) in pinmux_gpio_direction() argument
312 ret = ops->gpio_set_direction(pctldev, range, pin, input); in pinmux_gpio_direction()
443 "could not request pin %d (%s) from group %s " in pinmux_enable_setting()
456 "could not get pin desc for pin %d\n", in pinmux_enable_setting()
515 "could not get pin desc for pin %d\n", in pinmux_disable_setting()
527 "not freeing pin %d (%s) as part of " in pinmux_disable_setting()
585 unsigned i, pin; in pinmux_pins_show() local
590 seq_puts(s, "Pinmux settings per pin\n"); in pinmux_pins_show()
593 "Format: pin (name): mux_owner|gpio_owner (strict) hog?\n"); in pinmux_pins_show()
596 "Format: pin (name): mux_owner gpio_owner hog?\n"); in pinmux_pins_show()
600 /* The pin number can be retrived from the pin controller descriptor */ in pinmux_pins_show()
605 pin = pctldev->desc->pins[i].number; in pinmux_pins_show()
606 desc = pin_desc_get(pctldev, pin); in pinmux_pins_show()
607 /* Skip if we cannot search the pin */ in pinmux_pins_show()
617 seq_printf(s, "pin %d (%s): device %s%s", in pinmux_pins_show()
618 pin, desc->name, desc->mux_owner, in pinmux_pins_show()
621 seq_printf(s, "pin %d (%s): GPIO %s", in pinmux_pins_show()
622 pin, desc->name, desc->gpio_owner); in pinmux_pins_show()
624 seq_printf(s, "pin %d (%s): UNCLAIMED", in pinmux_pins_show()
625 pin, desc->name); in pinmux_pins_show()
628 seq_printf(s, "pin %d (%s): %s %s%s", pin, desc->name, in pinmux_pins_show()
636 /* If mux: print function+group claiming the pin */ in pinmux_pins_show()
691 * @pctldev: pin controller device
701 * @pctldev: pin controller device
721 * @pctldev: pin controller device
723 * @groups: array of pin groups
724 * @num_groups: number of pin groups
749 * @pctldev: pin controller device
768 * @pctldev: pin controller device
770 * @groups: array of pin groups
771 * @num_groups: number of pin groups
772 * @data: pin controller driver specific data
811 * @pctldev: pin controller device
837 * @pctldev: pin controller device