Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/broadcom/bcm2835/bcm2835_gpio.c
Show All 12 Lines | |||||
/* | /* | ||||
* Add per-pin sysctl tree/handlers. | * Add per-pin sysctl tree/handlers. | ||||
*/ | */ | ||||
ctx = device_get_sysctl_ctx(sc->sc_dev); | ctx = device_get_sysctl_ctx(sc->sc_dev); | ||||
tree_node = device_get_sysctl_tree(sc->sc_dev); | tree_node = device_get_sysctl_tree(sc->sc_dev); | ||||
tree = SYSCTL_CHILDREN(tree_node); | tree = SYSCTL_CHILDREN(tree_node); | ||||
pin_node = SYSCTL_ADD_NODE(ctx, tree, OID_AUTO, "pin", | pin_node = SYSCTL_ADD_NODE(ctx, tree, OID_AUTO, "pin", | ||||
CTLFLAG_RD, NULL, "GPIO Pins"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "GPIO Pins"); | ||||
pin_tree = SYSCTL_CHILDREN(pin_node); | pin_tree = SYSCTL_CHILDREN(pin_node); | ||||
for (i = 0; i < sc->sc_gpio_npins; i++) { | for (i = 0; i < sc->sc_gpio_npins; i++) { | ||||
snprintf(pinbuf, sizeof(pinbuf), "%d", i); | snprintf(pinbuf, sizeof(pinbuf), "%d", i); | ||||
pinN_node = SYSCTL_ADD_NODE(ctx, pin_tree, OID_AUTO, pinbuf, | pinN_node = SYSCTL_ADD_NODE(ctx, pin_tree, OID_AUTO, pinbuf, | ||||
CTLFLAG_RD, NULL, "GPIO Pin"); | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "GPIO Pin"); | ||||
pinN_tree = SYSCTL_CHILDREN(pinN_node); | pinN_tree = SYSCTL_CHILDREN(pinN_node); | ||||
sc->sc_sysctl[i].sc = sc; | sc->sc_sysctl[i].sc = sc; | ||||
sc_sysctl = &sc->sc_sysctl[i]; | sc_sysctl = &sc->sc_sysctl[i]; | ||||
sc_sysctl->sc = sc; | sc_sysctl->sc = sc; | ||||
sc_sysctl->pin = sc->sc_gpio_pins[i].gp_pin; | sc_sysctl->pin = sc->sc_gpio_pins[i].gp_pin; | ||||
SYSCTL_ADD_PROC(ctx, pinN_tree, OID_AUTO, "function", | SYSCTL_ADD_PROC(ctx, pinN_tree, OID_AUTO, "function", | ||||
CTLFLAG_RW | CTLTYPE_STRING, sc_sysctl, | CTLFLAG_RW | CTLTYPE_STRING | CTLFLAG_NEEDGIANT, sc_sysctl, | ||||
sizeof(struct bcm_gpio_sysctl), bcm_gpio_func_proc, | sizeof(struct bcm_gpio_sysctl), bcm_gpio_func_proc, | ||||
"A", "Pin Function"); | "A", "Pin Function"); | ||||
} | } | ||||
} | } | ||||
static int | static int | ||||
bcm_gpio_get_ro_pins(struct bcm_gpio_softc *sc, phandle_t node, | bcm_gpio_get_ro_pins(struct bcm_gpio_softc *sc, phandle_t node, | ||||
const char *propname, const char *label) | const char *propname, const char *label) | ||||
Show All 12 Lines |