Lines Matching +full:no +full:- +full:idle
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
32 * hinted attachment, but there is currently no support for hinted attachment.
56 {"i2c-mux-gpio", true},
74 #define IDLE_NOOP (-1) /* When asked to idle the bus, do nothing. */
84 * we passed to iicmux_init_softc(), no need for validation here. The in gpiomux_bus_select()
86 * except when we're asked to idle the bus. In that case, we transcribe in gpiomux_bus_select()
87 * sc->idleidx to the pins, unless that is IDLE_NOOP (leave the current in gpiomux_bus_select()
91 if (sc->idleidx == IDLE_NOOP) in gpiomux_bus_select()
93 busidx = sc->idleidx; in gpiomux_bus_select()
96 for (i = 0; i < sc->numpins; ++i) in gpiomux_bus_select()
97 gpio_pin_set_active(sc->pins[i], busidx & (1u << i)); in gpiomux_bus_select()
111 ofw_bus_search_compatible(dev, compat_data)->ocd_data) in gpiomux_probe()
125 for (i = 0; i < sc->numpins; ++i) in gpiomux_release_pins()
126 gpio_pin_release(sc->pins[i]); in gpiomux_release_pins()
146 err = gpio_pin_get_by_ofw_propidx(dev, node, "mux-gpios", i, in gpiomux_attach()
147 &sc->pins[i]); in gpiomux_attach()
152 sc->numpins = i; in gpiomux_attach()
153 if (sc->numpins == 0) { in gpiomux_attach()
154 device_printf(dev, "cannot acquire pins listed in mux-gpios\n"); in gpiomux_attach()
159 numchannels = 1u << sc->numpins; in gpiomux_attach()
161 device_printf(dev, "too many mux-gpios pins for max %d buses\n", in gpiomux_attach()
169 * have to locate it via the i2c-parent property. Explicitly tell the in gpiomux_attach()
173 len = OF_getencprop(node, "i2c-parent", &propval, sizeof(propval)); in gpiomux_attach()
175 device_printf(dev, "cannot obtain i2c-parent property\n"); in gpiomux_attach()
182 "cannot find device referenced by i2c-parent property\n"); in gpiomux_attach()
189 * If there is an idle-state property, that is the value we set the pins in gpiomux_attach()
190 * to when the bus is idle, otherwise idling the bus is a no-op in gpiomux_attach()
193 len = OF_getencprop(node, "idle-state", &propval, sizeof(propval)); in gpiomux_attach()
197 "idle-state property %d exceeds channel count\n", in gpiomux_attach()
200 sc->idleidx = (int)propval; in gpiomux_attach()
201 idlebits = sc->idleidx; in gpiomux_attach()
203 sc->idleidx = IDLE_NOOP; in gpiomux_attach()
207 /* Preset the mux to the idle state to get things started. */ in gpiomux_attach()
208 for (i = 0; i < sc->numpins; ++i) { in gpiomux_attach()
209 gpio_pin_setflags(sc->pins[i], GPIO_PIN_OUTPUT); in gpiomux_attach()
210 gpio_pin_set_active(sc->pins[i], idlebits & (1u << i)); in gpiomux_attach()