Lines Matching +full:res +full:- +full:cpi
4 * SPDX-License-Identifier: Apache-2.0
122 const struct pmw3610_config *cfg = dev->config; in pmw3610_read()
148 return spi_transceive_dt(&cfg->spi, &tx, &rx); in pmw3610_read()
158 const struct pmw3610_config *cfg = dev->config; in pmw3610_write_reg()
170 return spi_write_dt(&cfg->spi, &tx); in pmw3610_write_reg()
193 const struct device *dev = data->dev; in pmw3610_motion_work_handler()
194 const struct pmw3610_config *cfg = dev->config; in pmw3610_motion_work_handler()
200 if (cfg->smart_mode) { in pmw3610_motion_work_handler()
218 x = sign_extend(x, PMW3610_DATA_SIZE_BITS - 1); in pmw3610_motion_work_handler()
219 y = sign_extend(y, PMW3610_DATA_SIZE_BITS - 1); in pmw3610_motion_work_handler()
221 input_report_rel(data->dev, cfg->axis_x, x, false, K_FOREVER); in pmw3610_motion_work_handler()
222 input_report_rel(data->dev, cfg->axis_y, y, true, K_FOREVER); in pmw3610_motion_work_handler()
224 if (cfg->smart_mode) { in pmw3610_motion_work_handler()
227 if (data->smart_flag && shutter_val < SHUTTER_SMART_THRESHOLD) { in pmw3610_motion_work_handler()
237 data->smart_flag = false; in pmw3610_motion_work_handler()
238 } else if (!data->smart_flag && shutter_val > SHUTTER_SMART_THRESHOLD) { in pmw3610_motion_work_handler()
248 data->smart_flag = true; in pmw3610_motion_work_handler()
260 k_work_submit(&data->motion_work); in pmw3610_motion_handler()
270 return -EINVAL; in pmw3610_set_resolution()
346 const struct pmw3610_config *cfg = dev->config; in pmw3610_configure()
350 if (cfg->reset_gpio.port != NULL) { in pmw3610_configure()
351 if (!gpio_is_ready_dt(&cfg->reset_gpio)) { in pmw3610_configure()
352 LOG_ERR("%s is not ready", cfg->reset_gpio.port->name); in pmw3610_configure()
353 return -ENODEV; in pmw3610_configure()
356 ret = gpio_pin_configure_dt(&cfg->reset_gpio, GPIO_OUTPUT_ACTIVE); in pmw3610_configure()
364 gpio_pin_set_dt(&cfg->reset_gpio, 0); in pmw3610_configure()
383 return -ENOTSUP; in pmw3610_configure()
386 /* Power-up init sequence */ in pmw3610_configure()
406 return -EINVAL; in pmw3610_configure()
438 if (cfg->invert_x || cfg->invert_y) { in pmw3610_configure()
449 WRITE_BIT(val, RES_STEP_INV_X_BIT, cfg->invert_x); in pmw3610_configure()
450 WRITE_BIT(val, RES_STEP_INV_Y_BIT, cfg->invert_y); in pmw3610_configure()
471 if (cfg->res_cpi > 0) { in pmw3610_configure()
472 pmw3610_set_resolution(dev, cfg->res_cpi); in pmw3610_configure()
475 pmw3610_force_awake(dev, cfg->force_awake); in pmw3610_configure()
482 const struct pmw3610_config *cfg = dev->config; in pmw3610_init()
483 struct pmw3610_data *data = dev->data; in pmw3610_init()
486 if (!spi_is_ready_dt(&cfg->spi)) { in pmw3610_init()
487 LOG_ERR("%s is not ready", cfg->spi.bus->name); in pmw3610_init()
488 return -ENODEV; in pmw3610_init()
491 data->dev = dev; in pmw3610_init()
493 k_work_init(&data->motion_work, pmw3610_motion_work_handler); in pmw3610_init()
495 if (!gpio_is_ready_dt(&cfg->motion_gpio)) { in pmw3610_init()
496 LOG_ERR("%s is not ready", cfg->motion_gpio.port->name); in pmw3610_init()
497 return -ENODEV; in pmw3610_init()
500 ret = gpio_pin_configure_dt(&cfg->motion_gpio, GPIO_INPUT); in pmw3610_init()
506 gpio_init_callback(&data->motion_cb, pmw3610_motion_handler, in pmw3610_init()
507 BIT(cfg->motion_gpio.pin)); in pmw3610_init()
509 ret = gpio_add_callback_dt(&cfg->motion_gpio, &data->motion_cb); in pmw3610_init()
521 ret = gpio_pin_interrupt_configure_dt(&cfg->motion_gpio, in pmw3610_init()
557 return -ENOTSUP; in pmw3610_pm_action()
569 RES_MIN, RES_MAX), "invalid res-cpi"); \
577 .res_cpi = DT_INST_PROP_OR(n, res_cpi, -1), \