Lines Matching defs:sc
77 bus_claim(struct ec_softc *sc)
82 if (sc->our_gpio == 0 || sc->ec_gpio == 0) {
83 device_printf(sc->dev, "i2c arbitrator is not configured\n");
89 device_printf(sc->dev, "cant find gpio_dev\n");
94 GPIO_PIN_SET(gpio_dev, sc->our_gpio, GPIO_PIN_LOW);
99 GPIO_PIN_GET(gpio_dev, sc->ec_gpio, &status);
111 bus_release(struct ec_softc *sc)
115 if (sc->our_gpio == 0 || sc->ec_gpio == 0) {
116 device_printf(sc->dev, "i2c arbitrator is not configured\n");
122 device_printf(sc->dev, "cant find gpio_dev\n");
126 GPIO_PIN_SET(gpio_dev, sc->our_gpio, GPIO_PIN_HIGH);
159 struct ec_softc *sc;
171 sc = ec_sc;
188 ret = iicbus_transfer(sc->dev, msgs, 2);
190 device_printf(sc->dev, "i2c transfer returned %d\n", ret);
222 configure_i2c_arbitrator(struct ec_softc *sc)
231 sc->have_arbitrator = 1;
233 &sc->our_gpio, sizeof(sc->our_gpio));
235 &sc->ec_gpio, sizeof(sc->ec_gpio));
237 sc->have_arbitrator = 0;
238 sc->our_gpio = 0;
239 sc->ec_gpio = 0;
246 struct ec_softc *sc;
248 sc = device_get_softc(dev);
249 sc->dev = dev;
251 ec_sc = sc;
253 configure_i2c_arbitrator(sc);
263 if (sc->have_arbitrator && bus_claim(sc) != 0) {
273 struct ec_softc *sc;
275 sc = device_get_softc(dev);
277 if (sc->have_arbitrator) {
278 bus_release(sc);