Lines Matching refs:le
624 struct gpio_v2_line_event *le) in linereq_put_event() argument
633 kfifo_in(&lr->events, le, 1); in linereq_put_event()
664 struct gpio_v2_line_event le; in process_hw_ts_thread() local
674 memset(&le, 0, sizeof(le)); in process_hw_ts_thread()
676 le.timestamp_ns = line->timestamp_ns; in process_hw_ts_thread()
688 le.id = line_event_id(level); in process_hw_ts_thread()
691 le.id = GPIO_V2_LINE_EVENT_RISING_EDGE; in process_hw_ts_thread()
694 le.id = GPIO_V2_LINE_EVENT_FALLING_EDGE; in process_hw_ts_thread()
699 le.line_seqno = line->line_seqno; in process_hw_ts_thread()
700 le.seqno = (lr->num_lines == 1) ? le.line_seqno : line->req_seqno; in process_hw_ts_thread()
701 le.offset = gpio_chip_hwgpio(line->desc); in process_hw_ts_thread()
703 linereq_put_event(lr, &le); in process_hw_ts_thread()
783 struct gpio_v2_line_event le; in edge_irq_thread() local
786 memset(&le, 0, sizeof(le)); in edge_irq_thread()
789 le.timestamp_ns = line->timestamp_ns; in edge_irq_thread()
796 le.timestamp_ns = line_event_timestamp(line); in edge_irq_thread()
804 le.id = line_event_id(gpiod_get_value_cansleep(line->desc)); in edge_irq_thread()
807 le.id = GPIO_V2_LINE_EVENT_RISING_EDGE; in edge_irq_thread()
810 le.id = GPIO_V2_LINE_EVENT_FALLING_EDGE; in edge_irq_thread()
816 le.line_seqno = line->line_seqno; in edge_irq_thread()
817 le.seqno = (lr->num_lines == 1) ? le.line_seqno : line->req_seqno; in edge_irq_thread()
818 le.offset = gpio_chip_hwgpio(line->desc); in edge_irq_thread()
820 linereq_put_event(lr, &le); in edge_irq_thread()
874 struct gpio_v2_line_event le; in debounce_work_func() local
912 memset(&le, 0, sizeof(le)); in debounce_work_func()
915 le.timestamp_ns = line_event_timestamp(line); in debounce_work_func()
916 le.offset = gpio_chip_hwgpio(line->desc); in debounce_work_func()
924 le.line_seqno = line->line_seqno; in debounce_work_func()
925 le.seqno = (lr->num_lines == 1) ? in debounce_work_func()
926 le.line_seqno : atomic_add_return(diff_seqno, &lr->seqno); in debounce_work_func()
931 le.line_seqno = line->line_seqno; in debounce_work_func()
932 le.seqno = (lr->num_lines == 1) ? in debounce_work_func()
933 le.line_seqno : atomic_inc_return(&lr->seqno); in debounce_work_func()
936 le.id = line_event_id(level); in debounce_work_func()
938 linereq_put_event(lr, &le); in debounce_work_func()
1514 struct gpio_v2_line_event le; in linereq_read_unlocked() local
1521 if (count < sizeof(le)) in linereq_read_unlocked()
1545 ret = kfifo_out(&lr->events, &le, 1); in linereq_read_unlocked()
1557 if (copy_to_user(buf + bytes_read, &le, sizeof(le))) in linereq_read_unlocked()
1559 bytes_read += sizeof(le); in linereq_read_unlocked()
1560 } while (count >= bytes_read + sizeof(le)); in linereq_read_unlocked()
1824 struct lineevent_state *le = file->private_data; in lineevent_poll_unlocked() local
1827 if (!le->gdev->chip) in lineevent_poll_unlocked()
1830 poll_wait(file, &le->wait, wait); in lineevent_poll_unlocked()
1832 if (!kfifo_is_empty_spinlocked_noirqsave(&le->events, &le->wait.lock)) in lineevent_poll_unlocked()
1841 struct lineevent_state *le = file->private_data; in lineevent_poll() local
1843 return call_poll_locked(file, wait, le->gdev, lineevent_poll_unlocked); in lineevent_poll()
1849 struct lineevent_state *le = container_of(nb, struct lineevent_state, in lineevent_unregistered_notify() local
1852 wake_up_poll(&le->wait, EPOLLIN | EPOLLERR); in lineevent_unregistered_notify()
1865 struct lineevent_state *le = file->private_data; in lineevent_read_unlocked() local
1871 if (!le->gdev->chip) in lineevent_read_unlocked()
1891 spin_lock(&le->wait.lock); in lineevent_read_unlocked()
1892 if (kfifo_is_empty(&le->events)) { in lineevent_read_unlocked()
1894 spin_unlock(&le->wait.lock); in lineevent_read_unlocked()
1899 spin_unlock(&le->wait.lock); in lineevent_read_unlocked()
1903 ret = wait_event_interruptible_locked(le->wait, in lineevent_read_unlocked()
1904 !kfifo_is_empty(&le->events)); in lineevent_read_unlocked()
1906 spin_unlock(&le->wait.lock); in lineevent_read_unlocked()
1911 ret = kfifo_out(&le->events, &ge, 1); in lineevent_read_unlocked()
1912 spin_unlock(&le->wait.lock); in lineevent_read_unlocked()
1934 struct lineevent_state *le = file->private_data; in lineevent_read() local
1936 return call_read_locked(file, buf, count, f_ps, le->gdev, in lineevent_read()
1940 static void lineevent_free(struct lineevent_state *le) in lineevent_free() argument
1942 if (le->device_unregistered_nb.notifier_call) in lineevent_free()
1943 blocking_notifier_chain_unregister(&le->gdev->device_notifier, in lineevent_free()
1944 &le->device_unregistered_nb); in lineevent_free()
1945 if (le->irq) in lineevent_free()
1946 free_irq(le->irq, le); in lineevent_free()
1947 if (le->desc) in lineevent_free()
1948 gpiod_free(le->desc); in lineevent_free()
1949 kfree(le->label); in lineevent_free()
1950 gpio_device_put(le->gdev); in lineevent_free()
1951 kfree(le); in lineevent_free()
1963 struct lineevent_state *le = file->private_data; in lineevent_ioctl_unlocked() local
1967 if (!le->gdev->chip) in lineevent_ioctl_unlocked()
1979 val = gpiod_get_value_cansleep(le->desc); in lineevent_ioctl_unlocked()
1995 struct lineevent_state *le = file->private_data; in lineevent_ioctl() local
1997 return call_ioctl_locked(file, cmd, arg, le->gdev, in lineevent_ioctl()
2023 struct lineevent_state *le = p; in lineevent_irq_thread() local
2034 if (!le->timestamp) in lineevent_irq_thread()
2037 ge.timestamp = le->timestamp; in lineevent_irq_thread()
2039 if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE in lineevent_irq_thread()
2040 && le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE) { in lineevent_irq_thread()
2041 int level = gpiod_get_value_cansleep(le->desc); in lineevent_irq_thread()
2049 } else if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE) { in lineevent_irq_thread()
2052 } else if (le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE) { in lineevent_irq_thread()
2059 ret = kfifo_in_spinlocked_noirqsave(&le->events, &ge, in lineevent_irq_thread()
2060 1, &le->wait.lock); in lineevent_irq_thread()
2062 wake_up_poll(&le->wait, EPOLLIN); in lineevent_irq_thread()
2071 struct lineevent_state *le = p; in lineevent_irq_handler() local
2077 le->timestamp = ktime_get_ns(); in lineevent_irq_handler()
2085 struct lineevent_state *le; in lineevent_create() local
2125 le = kzalloc(sizeof(*le), GFP_KERNEL); in lineevent_create()
2126 if (!le) in lineevent_create()
2128 le->gdev = gpio_device_get(gdev); in lineevent_create()
2132 le->label = kstrndup(eventreq.consumer_label, in lineevent_create()
2135 if (!le->label) { in lineevent_create()
2141 ret = gpiod_request_user(desc, le->label); in lineevent_create()
2144 le->desc = desc; in lineevent_create()
2145 le->eflags = eflags; in lineevent_create()
2169 INIT_KFIFO(le->events); in lineevent_create()
2170 init_waitqueue_head(&le->wait); in lineevent_create()
2172 le->device_unregistered_nb.notifier_call = lineevent_unregistered_notify; in lineevent_create()
2174 &le->device_unregistered_nb); in lineevent_create()
2183 le->label, in lineevent_create()
2184 le); in lineevent_create()
2188 le->irq = irq; in lineevent_create()
2198 le, in lineevent_create()
2223 lineevent_free(le); in lineevent_create()