Lines Matching +full:pin +full:- +full:count
1 /*-
51 gpio_pin_t pin; member
74 if (led->pin) in gpioled_control()
75 gpio_pin_set_active(led->pin, onoff); in gpioled_control()
86 led->parent_sc = sc; in gpioleds_attach_led()
89 if (OF_getprop_alloc(node, "default-state", in gpioleds_attach_led()
90 (void **)&default_state) != -1) { in gpioleds_attach_led()
96 state = -1; in gpioleds_attach_led()
98 state = -1; in gpioleds_attach_led()
99 device_printf(sc->sc_dev, in gpioleds_attach_led()
100 "unknown value for default-state in FDT\n"); in gpioleds_attach_led()
106 if (OF_getprop_alloc(node, "label", (void **)&name) == -1) in gpioleds_attach_led()
110 device_printf(sc->sc_dev, in gpioleds_attach_led()
115 err = gpio_pin_get_by_ofw_idx(sc->sc_dev, node, 0, &led->pin); in gpioleds_attach_led()
117 device_printf(sc->sc_dev, "<%s> failed to map pin\n", name); in gpioleds_attach_led()
122 gpio_pin_setflags(led->pin, GPIO_PIN_OUTPUT); in gpioleds_attach_led()
124 led->leddev = led_create_state(gpioled_control, led, name, in gpioleds_attach_led()
135 if (led->leddev != NULL) in gpioleds_detach_led()
136 led_destroy(led->leddev); in gpioleds_detach_led()
138 if (led->pin) in gpioleds_detach_led()
139 gpio_pin_release(led->pin); in gpioleds_detach_led()
147 if (!ofw_bus_is_compatible(dev, "gpio-leds")) in gpioled_probe()
162 if ((leds = ofw_bus_get_node(dev)) == -1) in gpioled_attach()
166 sc->sc_dev = dev; in gpioled_attach()
167 sc->sc_busdev = device_get_parent(dev); in gpioled_attach()
169 /* Traverse the 'gpio-leds' node and count leds */ in gpioled_attach()
178 sc->sc_leds = malloc(sizeof(struct gpioled) * total_leds, in gpioled_attach()
181 sc->sc_total_leds = 0; in gpioled_attach()
182 /* Traverse the 'gpio-leds' node and count leds */ in gpioled_attach()
186 gpioleds_attach_led(sc, child, &sc->sc_leds[sc->sc_total_leds]); in gpioled_attach()
187 sc->sc_total_leds++; in gpioled_attach()
202 for (i = 0; i < sc->sc_total_leds; i++) in gpioled_detach()
203 gpioleds_detach_led(&sc->sc_leds[i]); in gpioled_detach()
205 if (sc->sc_leds) in gpioled_detach()
206 free(sc->sc_leds, M_DEVBUF); in gpioled_detach()