Lines Matching +full:no +full:- +full:idle +full:- +full:on +full:- +full:init

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
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
86 * except when we're asked to idle the bus. In that case, we transcribe
87 * sc->idleidx to the pins, unless that is IDLE_NOOP (leave the current
91 if (sc->idleidx == IDLE_NOOP)
93 busidx = sc->idleidx;
96 for (i = 0; i < sc->numpins; ++i)
97 gpio_pin_set_active(sc->pins[i], busidx & (1u << i));
111 ofw_bus_search_compatible(dev, compat_data)->ocd_data)
125 for (i = 0; i < sc->numpins; ++i)
126 gpio_pin_release(sc->pins[i]);
146 err = gpio_pin_get_by_ofw_propidx(dev, node, "mux-gpios", i,
147 &sc->pins[i]);
152 sc->numpins = i;
153 if (sc->numpins == 0) {
154 device_printf(dev, "cannot acquire pins listed in mux-gpios\n");
159 numchannels = 1u << sc->numpins;
161 device_printf(dev, "too many mux-gpios pins for max %d buses\n",
169 * have to locate it via the i2c-parent property. Explicitly tell the
173 len = OF_getencprop(node, "i2c-parent", &propval, sizeof(propval));
175 device_printf(dev, "cannot obtain i2c-parent property\n");
182 "cannot find device referenced by i2c-parent property\n");
189 * If there is an idle-state property, that is the value we set the pins
190 * to when the bus is idle, otherwise idling the bus is a no-op
193 len = OF_getencprop(node, "idle-state", &propval, sizeof(propval));
197 "idle-state property %d exceeds channel count\n",
200 sc->idleidx = (int)propval;
201 idlebits = sc->idleidx;
203 sc->idleidx = IDLE_NOOP;
207 /* Preset the mux to the idle state to get things started. */
208 for (i = 0; i < sc->numpins; ++i) {
209 gpio_pin_setflags(sc->pins[i], GPIO_PIN_OUTPUT);
210 gpio_pin_set_active(sc->pins[i], idlebits & (1u << i));
213 /* Init the core driver, have it add our child downstream buses. */