Lines Matching +full:reset +full:- +full:duration +full:- +full:ms
1 /*-
49 #define READ(_sc, _r) bus_read_4((_sc)->res[0], (_r))
50 #define WRITE(_sc, _r, _v) bus_write_4((_sc)->res[0], (_r), (_v))
83 #define AW_IR_RXSTA_COUNTER(val) (((val) >> 8) & (sc->fifo_size * 2 - 1))
96 /* Idle Threshold = (2 + 1) * 128 * 42.7 = ~16.4ms > 9ms */
99 /* Bit 15 - value (pulse/space) */
101 /* Bits 0:14 - sample duration */
114 /* 80 * 42.7 = ~3.4ms, Lead1(4.5ms) > AW_IR_L1_MIN */
116 /* 40 * 42.7 = ~1.7ms, Lead0(4.5ms) Lead0R(2.25ms) > AW_IR_L0_MIN */
127 #define AW_IR_ACTIVE_T (((AW_IR_ACTIVE_T_VAL - 1) & 0xff) << 16)
164 { -1, 0 }
168 { "allwinner,sun4i-a10-ir", A10_IR },
169 { "allwinner,sun5i-a13-ir", A13_IR },
170 { "allwinner,sun6i-a31-ir", A31_IR },
178 sc->dcnt = 0; in aw_ir_buf_reset()
185 if (sc->dcnt < AW_IR_RAW_BUF_SIZE) in aw_ir_buf_write()
186 sc->buf[sc->dcnt++] = data; in aw_ir_buf_write()
189 device_printf(sc->dev, "IR RX Buffer Full!\n"); in aw_ir_buf_write()
196 return (sc->dcnt >= AW_IR_RAW_BUF_SIZE); in aw_ir_buf_full()
215 device_printf(sc->dev, "sc->dcnt = %d\n", sc->dcnt); in aw_ir_decode_packets()
222 device_printf(sc->dev, "Initial len: %d\n", len); in aw_ir_decode_packets()
223 for (i = 0; i < sc->dcnt; i++) { in aw_ir_decode_packets()
224 val = sc->buf[i]; in aw_ir_decode_packets()
234 device_printf(sc->dev, "len = %d\n", len); in aw_ir_decode_packets()
237 device_printf(sc->dev, "Bit separator error\n"); in aw_ir_decode_packets()
243 for (; i < sc->dcnt; i++) { in aw_ir_decode_packets()
244 val = sc->buf[i]; in aw_ir_decode_packets()
254 device_printf(sc->dev, "Bit length error\n"); in aw_ir_decode_packets()
263 for (; i < sc->dcnt; i++) { in aw_ir_decode_packets()
264 val = sc->buf[i]; in aw_ir_decode_packets()
271 device_printf(sc->dev, in aw_ir_decode_packets()
283 device_printf(sc->dev, in aw_ir_decode_packets()
338 device_printf(sc->dev, "RX interrupt status: %x\n", val); in aw_ir_intr()
346 device_printf(sc->dev, in aw_ir_intr()
354 device_printf(sc->dev, in aw_ir_intr()
365 device_printf(sc->dev, "RX Packet end\n"); in aw_ir_intr()
369 evdev_push_event(sc->sc_evdev, in aw_ir_intr()
371 evdev_sync(sc->sc_evdev); in aw_ir_intr()
374 device_printf(sc->dev, "Final IR code: %lx\n", in aw_ir_intr()
376 device_printf(sc->dev, "IR code status: %d\n", in aw_ir_intr()
384 device_printf(sc->dev, "RX FIFO overflow\n"); in aw_ir_intr()
397 if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) in aw_ir_probe()
417 sc->dev = dev; in aw_ir_attach()
419 if (bus_alloc_resources(dev, aw_ir_spec, sc->res) != 0) { in aw_ir_attach()
424 switch (ofw_bus_search_compatible(dev, compat_data)->ocd_data) { in aw_ir_attach()
426 sc->fifo_size = 16; in aw_ir_attach()
430 sc->fifo_size = 64; in aw_ir_attach()
434 /* De-assert reset */ in aw_ir_attach()
438 device_printf(dev, "cannot de-assert reset\n"); in aw_ir_attach()
443 /* Reset buffer */ in aw_ir_attach()
475 if (bus_setup_intr(dev, sc->res[1], in aw_ir_attach()
477 &sc->intrhand)) { in aw_ir_attach()
478 bus_release_resources(dev, aw_ir_spec, sc->res); in aw_ir_attach()
508 AW_IR_RXINT_RAI_EN | AW_IR_RXINT_RAL((sc->fifo_size >> 1) - 1)); in aw_ir_attach()
514 sc->sc_evdev = evdev_alloc(); in aw_ir_attach()
515 evdev_set_name(sc->sc_evdev, device_get_desc(sc->dev)); in aw_ir_attach()
516 evdev_set_phys(sc->sc_evdev, device_get_nameunit(sc->dev)); in aw_ir_attach()
517 evdev_set_id(sc->sc_evdev, BUS_HOST, 0, 0, 0); in aw_ir_attach()
518 evdev_support_event(sc->sc_evdev, EV_SYN); in aw_ir_attach()
519 evdev_support_event(sc->sc_evdev, EV_MSC); in aw_ir_attach()
520 evdev_support_msc(sc->sc_evdev, MSC_SCAN); in aw_ir_attach()
522 err = evdev_register(sc->sc_evdev); in aw_ir_attach()
537 evdev_free(sc->sc_evdev); in aw_ir_attach()
538 sc->sc_evdev = NULL; /* Avoid double free */ in aw_ir_attach()
540 bus_release_resources(dev, aw_ir_spec, sc->res); in aw_ir_attach()