Lines Matching +full:assert +full:- +full:falling +full:- +full:edge

1 /*-
44 {"pps-gpio", 1},
67 struct pps_softc *sc = dev->si_drv1; in gpiopps_open()
70 mtx_lock(&sc->pps_mtx); in gpiopps_open()
71 device_busy(sc->dev); in gpiopps_open()
72 mtx_unlock(&sc->pps_mtx); in gpiopps_open()
80 struct pps_softc *sc = dev->si_drv1; in gpiopps_close()
82 mtx_lock(&sc->pps_mtx); in gpiopps_close()
83 device_unbusy(sc->dev); in gpiopps_close()
84 mtx_unlock(&sc->pps_mtx); in gpiopps_close()
92 struct pps_softc *sc = dev->si_drv1; in gpiopps_ioctl()
96 mtx_lock(&sc->pps_mtx); in gpiopps_ioctl()
97 err = pps_ioctl(cmd, data, &sc->pps_state); in gpiopps_ioctl()
98 mtx_unlock(&sc->pps_mtx); in gpiopps_ioctl()
121 * pps_event() routine. We don't need lock-based management of access in gpiopps_ifltr()
122 * to the capture area because we have time-based access management: we in gpiopps_ifltr()
129 pps_capture(&sc->pps_state); in gpiopps_ifltr()
142 * handler. The pps_event() routine updates the non-capture part of the in gpiopps_ithrd()
144 * data right now in a non-interrupt context, so we need an interlock. in gpiopps_ithrd()
146 mtx_lock(&sc->pps_mtx); in gpiopps_ithrd()
147 pps_event(&sc->pps_state, PPS_CAPTUREASSERT); in gpiopps_ithrd()
148 mtx_unlock(&sc->pps_mtx); in gpiopps_ithrd()
156 if (sc->pps_cdev != NULL) in gpiopps_detach()
157 destroy_dev(sc->pps_cdev); in gpiopps_detach()
158 if (sc->ihandler != NULL) in gpiopps_detach()
159 bus_teardown_intr(dev, sc->ires, sc->ihandler); in gpiopps_detach()
160 if (sc->ires != NULL) in gpiopps_detach()
161 bus_release_resource(dev, SYS_RES_IRQ, sc->irid, sc->ires); in gpiopps_detach()
162 if (sc->gpin != NULL) in gpiopps_detach()
163 gpiobus_release_pin(GPIO_GET_BUS(sc->gpin->dev), sc->gpin->pin); in gpiopps_detach()
174 uint32_t edge, pincaps; in gpiopps_fdt_attach() local
178 sc->dev = dev; in gpiopps_fdt_attach()
180 mtx_init(&sc->pps_mtx, device_get_nameunit(dev), NULL, MTX_DEF); in gpiopps_fdt_attach()
183 sc->pps_state.ppscap = PPS_CAPTUREASSERT | PPS_CAPTURECLEAR; in gpiopps_fdt_attach()
184 sc->pps_state.driver_abi = PPS_ABI_VERSION; in gpiopps_fdt_attach()
185 sc->pps_state.driver_mtx = &sc->pps_mtx; in gpiopps_fdt_attach()
186 pps_init_abi(&sc->pps_state); in gpiopps_fdt_attach()
188 /* Check which edge we're configured to capture (default is rising). */ in gpiopps_fdt_attach()
189 if (ofw_bus_has_prop(dev, "assert-falling-edge")) in gpiopps_fdt_attach()
190 edge = GPIO_INTR_EDGE_FALLING; in gpiopps_fdt_attach()
192 edge = GPIO_INTR_EDGE_RISING; in gpiopps_fdt_attach()
199 if ((err = gpio_pin_get_by_ofw_idx(dev, node, 0, &sc->gpin)) != 0) { in gpiopps_fdt_attach()
204 device_get_nameunit(sc->gpin->dev), sc->gpin->pin); in gpiopps_fdt_attach()
206 if ((err = gpio_pin_getcaps(sc->gpin, &pincaps)) != 0) { in gpiopps_fdt_attach()
211 if ((pincaps & edge) == 0) { in gpiopps_fdt_attach()
212 device_printf(dev, "Pin cannot be configured for the requested signal edge\n"); in gpiopps_fdt_attach()
221 if ((sc->ires = gpio_alloc_intr_resource(dev, &sc->irid, RF_ACTIVE, in gpiopps_fdt_attach()
222 sc->gpin, edge)) == NULL) { in gpiopps_fdt_attach()
228 err = bus_setup_intr(dev, sc->ires, INTR_TYPE_CLK | INTR_MPSAFE, in gpiopps_fdt_attach()
229 gpiopps_ifltr, gpiopps_ithrd, sc, &sc->ihandler); in gpiopps_fdt_attach()
236 /* Create the RFC 2783 pps-api cdev. */ in gpiopps_fdt_attach()
243 err = make_dev_s(&devargs, &sc->pps_cdev, PPS_CDEV_NAME "%d", in gpiopps_fdt_attach()
261 if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) { in gpiopps_fdt_probe()