Lines Matching refs:dev

52 #include <dev/fdt/fdt_common.h>
53 #include <dev/ofw/ofw_bus.h>
54 #include <dev/ofw/ofw_bus_subr.h>
56 #include <dev/gpio/gpiobusvar.h>
62 device_t dev;
79 mtx_init(&(sc)->mtx, device_get_nameunit((sc)->dev), \
91 aml8726_gpio_probe(device_t dev)
94 if (!ofw_bus_status_okay(dev))
97 if (!ofw_bus_is_compatible(dev, "amlogic,aml8726-gpio"))
100 device_set_desc(dev, "Amlogic aml8726 GPIO");
106 aml8726_gpio_attach(device_t dev)
108 struct aml8726_gpio_softc *sc = device_get_softc(dev);
112 sc->dev = dev;
114 node = ofw_bus_get_node(dev);
118 device_printf(dev, "missing pin-count attribute in FDT\n");
126 if (bus_alloc_resources(dev, aml8726_gpio_spec, sc->res)) {
127 device_printf(dev, "can not allocate resources for device\n");
136 device_printf(dev,
138 bus_release_resources(dev, aml8726_gpio_spec, sc->res);
144 sc->busdev = gpiobus_attach_bus(dev);
147 bus_release_resources(dev, aml8726_gpio_spec, sc->res);
155 aml8726_gpio_detach(device_t dev)
157 struct aml8726_gpio_softc *sc = device_get_softc(dev);
159 gpiobus_detach_bus(dev);
163 bus_release_resources(dev, aml8726_gpio_spec, sc->res);
169 aml8726_gpio_get_bus(device_t dev)
171 struct aml8726_gpio_softc *sc = device_get_softc(dev);
177 aml8726_gpio_pin_max(device_t dev, int *maxpin)
179 struct aml8726_gpio_softc *sc = device_get_softc(dev);
188 aml8726_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps)
190 struct aml8726_gpio_softc *sc = device_get_softc(dev);
202 aml8726_gpio_pin_getname(device_t dev, uint32_t pin, char *name)
204 struct aml8726_gpio_softc *sc = device_get_softc(dev);
209 snprintf(name, GPIOMAXNAME, "%s.%u", ofw_bus_get_name(dev), pin);
216 aml8726_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags)
218 struct aml8726_gpio_softc *sc = device_get_softc(dev);
236 aml8726_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
238 struct aml8726_gpio_softc *sc = device_get_softc(dev);
263 aml8726_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
265 struct aml8726_gpio_softc *sc = device_get_softc(dev);
291 aml8726_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *value)
293 struct aml8726_gpio_softc *sc = device_get_softc(dev);
306 aml8726_gpio_pin_toggle(device_t dev, uint32_t pin)
308 struct aml8726_gpio_softc *sc = device_get_softc(dev);
333 aml8726_gpio_get_node(device_t bus, device_t dev)