Lines Matching +full:inverted +full:- +full:out

1 /*-
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
71 #define GPIO_LOCK(_sc) sx_slock(&(_sc)->gpio_lock)
72 #define GPIO_UNLOCK(_sc) sx_unlock(&(_sc)->gpio_lock)
73 #define GPIO_ASSERT(_sc) sx_assert(&(_sc)->gpio_lock, SA_LOCKED)
85 {"bias-disable", AS3722_CFG_BIAS_DISABLE},
86 {"bias-pull-up", AS3722_CFG_BIAS_PULL_UP},
87 {"bias-pull-down", AS3722_CFG_BIAS_PULL_DOWN},
88 {"bias-high-impedance", AS3722_CFG_BIAS_HIGH_IMPEDANCE},
89 {"drive-open-drain", AS3722_CFG_OPEN_DRAIN},
97 {"interrupt-out", AS3722_IOSF_INTERRUPT_OUT},
98 {"vsup-vbat-low-undebounce-out", AS3722_IOSF_VSUP_VBAT_LOW_UNDEBOUNCE_OUT},
99 {"gpio-in-interrupt", AS3722_IOSF_GPIO_IN_INTERRUPT},
100 {"pwm-in", AS3722_IOSF_PWM_IN},
101 {"voltage-in-standby", AS3722_IOSF_VOLTAGE_IN_STANDBY},
102 {"oc-pg-sd0", AS3722_IOSF_OC_PG_SD0},
103 {"powergood-out", AS3722_IOSF_POWERGOOD_OUT},
104 {"clk32k-out", AS3722_IOSF_CLK32K_OUT},
105 {"watchdog-in", AS3722_IOSF_WATCHDOG_IN},
106 {"soft-reset-in", AS3722_IOSF_SOFT_RESET_IN},
107 {"pwm-out", AS3722_IOSF_PWM_OUT},
108 {"vsup-vbat-low-debounce-out", AS3722_IOSF_VSUP_VBAT_LOW_DEBOUNCE_OUT},
109 {"oc-pg-sd6", AS3722_IOSF_OC_PG_SD6},
124 /* --------------------------------------------------------------------------
137 return (-1); in as3722_pinmux_get_function()
147 for (pin = 0; pin < sc->gpio_npins; pin++) { in as3722_pinmux_config_node()
148 if (strcmp(sc->gpio_pins[pin]->pin_name, pin_name) == 0) in as3722_pinmux_config_node()
151 if (pin >= sc->gpio_npins) { in as3722_pinmux_config_node()
152 device_printf(sc->dev, "Unknown pin: %s\n", pin_name); in as3722_pinmux_config_node()
156 ctrl = sc->gpio_pins[pin]->pin_ctrl_reg; in as3722_pinmux_config_node()
157 sc->gpio_pins[pin]->pin_cfg_flags = cfg->flags; in as3722_pinmux_config_node()
158 if (cfg->function != NULL) { in as3722_pinmux_config_node()
159 fnc = as3722_pinmux_get_function(sc, cfg->function); in as3722_pinmux_config_node()
160 if (fnc == -1) { in as3722_pinmux_config_node()
161 device_printf(sc->dev, in as3722_pinmux_config_node()
162 "Unknown function %s for pin %s\n", cfg->function, in as3722_pinmux_config_node()
163 sc->gpio_pins[pin]->pin_name); in as3722_pinmux_config_node()
196 if (ctrl != sc->gpio_pins[pin]->pin_ctrl_reg) { in as3722_pinmux_config_node()
198 sc->gpio_pins[pin]->pin_ctrl_reg = ctrl; in as3722_pinmux_config_node()
214 rv = OF_getprop_alloc(node, "function", (void **)&cfg->function); in as3722_pinmux_read_node()
216 cfg->function = NULL; in as3722_pinmux_read_node()
221 cfg->flags |= as3722_cfg_names[i].config; in as3722_pinmux_read_node()
243 device_printf(sc->dev, in as3722_pinmux_process_node()
277 /* --------------------------------------------------------------------------
287 return (sc->gpio_busdev); in as3722_gpio_get_bus()
294 *maxpin = NGPIO - 1; in as3722_gpio_pin_max()
304 if (pin >= sc->gpio_npins) in as3722_gpio_pin_getcaps()
307 *caps = sc->gpio_pins[pin]->pin_caps; in as3722_gpio_pin_getcaps()
318 if (pin >= sc->gpio_npins) in as3722_gpio_pin_getname()
321 memcpy(name, sc->gpio_pins[pin]->pin_name, GPIOMAXNAME); in as3722_gpio_pin_getname()
332 bool inverted; in as3722_gpio_pin_getflags() local
335 if (pin >= sc->gpio_npins) in as3722_gpio_pin_getflags()
339 tmp = sc->gpio_pins[pin]->pin_ctrl_reg; in as3722_gpio_pin_getflags()
343 inverted = (tmp & AS3722_GPIO_INVERT) != 0; in as3722_gpio_pin_getflags()
372 if (inverted) in as3722_gpio_pin_getflags()
383 flags = sc->gpio_pins[pin]->pin_cfg_flags; in as3722_gpio_get_mode()
428 if (pin >= sc->gpio_npins) in as3722_gpio_pin_setflags()
432 ctrl = sc->gpio_pins[pin]->pin_ctrl_reg; in as3722_gpio_pin_setflags()
443 if (ctrl != sc->gpio_pins[pin]->pin_ctrl_reg) { in as3722_gpio_pin_setflags()
445 sc->gpio_pins[pin]->pin_ctrl_reg = ctrl; in as3722_gpio_pin_setflags()
459 if (pin >= sc->gpio_npins) in as3722_gpio_pin_set()
463 if (sc->gpio_pins[pin]->pin_ctrl_reg & AS3722_GPIO_INVERT) in as3722_gpio_pin_set()
480 if (pin >= sc->gpio_npins) in as3722_gpio_pin_get()
484 ctrl = sc->gpio_pins[pin]->pin_ctrl_reg; in as3722_gpio_pin_get()
509 if (pin >= sc->gpio_npins) in as3722_gpio_pin_toggle()
542 sx_init(&sc->gpio_lock, "AS3722 GPIO lock"); in as3722_gpio_attach()
543 sc->gpio_npins = NGPIO; in as3722_gpio_attach()
544 sc->gpio_pins = malloc(sizeof(struct as3722_gpio_pin *) * in as3722_gpio_attach()
545 sc->gpio_npins, M_AS3722_GPIO, M_WAITOK | M_ZERO); in as3722_gpio_attach()
547 sc->gpio_busdev = gpiobus_attach_bus(sc->dev); in as3722_gpio_attach()
548 if (sc->gpio_busdev == NULL) in as3722_gpio_attach()
550 for (i = 0; i < sc->gpio_npins; i++) { in as3722_gpio_attach()
551 sc->gpio_pins[i] = malloc(sizeof(struct as3722_gpio_pin), in as3722_gpio_attach()
553 pin = sc->gpio_pins[i]; in as3722_gpio_attach()
554 sprintf(pin->pin_name, "gpio%d", i); in as3722_gpio_attach()
555 pin->pin_caps = GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | in as3722_gpio_attach()
559 rv = RD1(sc, AS3722_GPIO0_CONTROL + i, &pin->pin_ctrl_reg); in as3722_gpio_attach()
561 device_printf(sc->dev, in as3722_gpio_attach()
563 sc->gpio_pins[i]->pin_name); in as3722_gpio_attach()