Changeset View
Changeset View
Standalone View
Standalone View
head/share/man/man9/fdt_pinctrl.9
Show First 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | npins = OF_getencprop_alloc_multi(cfgnode, "foo,pins", sizeof(*pins), | ||||
(void **)&pins); | (void **)&pins); | ||||
functions = NULL; | functions = NULL; | ||||
nfunctions = OF_getencprop_alloc_multi(cfgnode, "foo,functions", | nfunctions = OF_getencprop_alloc_multi(cfgnode, "foo,functions", | ||||
sizeof(*functions), (void **)&functions); | sizeof(*functions), (void **)&functions); | ||||
... | ... | ||||
} | } | ||||
static int | static int | ||||
foo_is_gpio(device_t dev, device_t gpiodev, bool *is_gpio) | |||||
{ | |||||
return (foo_is_pin_func_gpio(is_gpio)); | |||||
} | |||||
static int | |||||
foo_set_flags(device_t dev, device_t gpiodev, uint32_t pin, uint32_t flags) | |||||
{ | |||||
int rv; | |||||
rv = foo_is_pin_func_gpio(is_gpio); | |||||
if (rv != 0) | |||||
return (rv); | |||||
foo_set_flags(pin, flags); | |||||
return (0); | |||||
} | |||||
static int | |||||
foo_get_flags(device_t dev, device_t gpiodev, uint32_t pin, uint32_t *flags) | |||||
{ | |||||
int rv; | |||||
rv = foo_is_pin_func_gpio(is_gpio); | |||||
if (rv != 0) | |||||
return (rv); | |||||
foo_get_flags(pin, flags); | |||||
return (0); | |||||
} | |||||
static int | |||||
foo_attach(device_t dev) | foo_attach(device_t dev) | ||||
{ | { | ||||
... | ... | ||||
fdt_pinctrl_register(dev, "foo,pins"); | fdt_pinctrl_register(dev, "foo,pins"); | ||||
/* | /* | ||||
* It is possible to register more than one pinprop handler | * It is possible to register more than one pinprop handler | ||||
*/ | */ | ||||
fdt_pinctrl_register(dev, "bar,pins"); | fdt_pinctrl_register(dev, "bar,pins"); | ||||
fdt_pinctrl_configure_tree(dev); | fdt_pinctrl_configure_tree(dev); | ||||
return (0); | return (0); | ||||
} | } | ||||
static device_method_t foo_methods[] = { | static device_method_t foo_methods[] = { | ||||
... | ... | ||||
/* fdt_pinctrl interface */ | /* fdt_pinctrl interface */ | ||||
DEVMETHOD(fdt_pinctrl_configure, foo_configure_pins), | DEVMETHOD(fdt_pinctrl_configure, foo_configure_pins), | ||||
DEVMETHOD(fdt_pinctrl_is_gpio, foo_is_gpio), | |||||
DEVMETHOD(fdt_pinctrl_set_flags, foo_set_flags), | |||||
DEVMETHOD(fdt_pinctrl_get_flags, foo_get_flags), | |||||
/* Terminate method list */ | /* Terminate method list */ | ||||
DEVMETHOD_END | DEVMETHOD_END | ||||
}; | }; | ||||
DRIVER_MODULE(foo, simplebus, foo_driver, foo_devclass, NULL, NULL); | DRIVER_MODULE(foo, simplebus, foo_driver, foo_devclass, NULL, NULL); | ||||
.Ed | .Ed | ||||
.Sh SEE ALSO | .Sh SEE ALSO | ||||
.Xr fdt_pinctrl 4 , | .Xr fdt_pinctrl 4 , | ||||
.Sh AUTHORS | .Sh AUTHORS | ||||
This manual page was written by | This manual page was written by | ||||
.An Oleksandr Tymoshenko . | .An Oleksandr Tymoshenko . |