Lines Matching +full:scan +full:- +full:interval
1 // SPDX-License-Identifier: GPL-2.0-only
18 * @scan_ms: the scan interval in milliseconds.
51 if (gpio->bleft) in gpio_mouse_scan()
53 gpiod_get_value(gpio->bleft)); in gpio_mouse_scan()
54 if (gpio->bmiddle) in gpio_mouse_scan()
56 gpiod_get_value(gpio->bmiddle)); in gpio_mouse_scan()
57 if (gpio->bright) in gpio_mouse_scan()
59 gpiod_get_value(gpio->bright)); in gpio_mouse_scan()
61 x = gpiod_get_value(gpio->right) - gpiod_get_value(gpio->left); in gpio_mouse_scan()
62 y = gpiod_get_value(gpio->down) - gpiod_get_value(gpio->up); in gpio_mouse_scan()
71 struct device *dev = &pdev->dev; in gpio_mouse_probe()
78 return -ENOMEM; in gpio_mouse_probe()
81 error = device_property_read_u32(dev, "scan-interval-ms", in gpio_mouse_probe()
82 &gmouse->scan_ms); in gpio_mouse_probe()
83 if (error || gmouse->scan_ms == 0) { in gpio_mouse_probe()
84 dev_warn(dev, "invalid scan time, set to 50 ms\n"); in gpio_mouse_probe()
85 gmouse->scan_ms = 50; in gpio_mouse_probe()
88 gmouse->up = devm_gpiod_get(dev, "up", GPIOD_IN); in gpio_mouse_probe()
89 if (IS_ERR(gmouse->up)) in gpio_mouse_probe()
90 return PTR_ERR(gmouse->up); in gpio_mouse_probe()
91 gmouse->down = devm_gpiod_get(dev, "down", GPIOD_IN); in gpio_mouse_probe()
92 if (IS_ERR(gmouse->down)) in gpio_mouse_probe()
93 return PTR_ERR(gmouse->down); in gpio_mouse_probe()
94 gmouse->left = devm_gpiod_get(dev, "left", GPIOD_IN); in gpio_mouse_probe()
95 if (IS_ERR(gmouse->left)) in gpio_mouse_probe()
96 return PTR_ERR(gmouse->left); in gpio_mouse_probe()
97 gmouse->right = devm_gpiod_get(dev, "right", GPIOD_IN); in gpio_mouse_probe()
98 if (IS_ERR(gmouse->right)) in gpio_mouse_probe()
99 return PTR_ERR(gmouse->right); in gpio_mouse_probe()
101 gmouse->bleft = devm_gpiod_get_optional(dev, "button-left", GPIOD_IN); in gpio_mouse_probe()
102 if (IS_ERR(gmouse->bleft)) in gpio_mouse_probe()
103 return PTR_ERR(gmouse->bleft); in gpio_mouse_probe()
104 gmouse->bmiddle = devm_gpiod_get_optional(dev, "button-middle", in gpio_mouse_probe()
106 if (IS_ERR(gmouse->bmiddle)) in gpio_mouse_probe()
107 return PTR_ERR(gmouse->bmiddle); in gpio_mouse_probe()
108 gmouse->bright = devm_gpiod_get_optional(dev, "button-right", in gpio_mouse_probe()
110 if (IS_ERR(gmouse->bright)) in gpio_mouse_probe()
111 return PTR_ERR(gmouse->bright); in gpio_mouse_probe()
115 return -ENOMEM; in gpio_mouse_probe()
117 input->name = pdev->name; in gpio_mouse_probe()
118 input->id.bustype = BUS_HOST; in gpio_mouse_probe()
124 if (gmouse->bleft) in gpio_mouse_probe()
126 if (gmouse->bmiddle) in gpio_mouse_probe()
128 if (gmouse->bright) in gpio_mouse_probe()
135 input_set_poll_interval(input, gmouse->scan_ms); in gpio_mouse_probe()
143 dev_dbg(dev, "%d ms scan time, buttons: %s%s%s\n", in gpio_mouse_probe()
144 gmouse->scan_ms, in gpio_mouse_probe()
145 gmouse->bleft ? "" : "left ", in gpio_mouse_probe()
146 gmouse->bmiddle ? "" : "middle ", in gpio_mouse_probe()
147 gmouse->bright ? "" : "right"); in gpio_mouse_probe()
153 { .compatible = "gpio-mouse", },
167 MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>");