Lines Matching +full:x +full:- +full:axis

1 // SPDX-License-Identifier: GPL-2.0-only
3 * hdaps.c - driver for IBM's Hard Drive Active Protection System
9 * starting with the R40, T41, and X40. It provides a basic two-axis
31 #define HDAPS_NR_PORTS 0x30 /* number of ports: 0x1600 - 0x162f */
34 #define HDAPS_PORT_YPOS 0x1612 /* y-axis position */
35 #define HDAPS_PORT_XPOS 0x1614 /* x-axis position */
37 #define HDAPS_PORT_YVAR 0x1617 /* y-axis variance (what is this?) */
38 #define HDAPS_PORT_XVAR 0x1619 /* x-axis variance (what is this?) */
71 * __get_latch - Get the value from a given port. Callers must hold hdaps_mtx.
79 * __check_latch - Check a port latch for a given value. Returns zero if the
86 return -EINVAL; in __check_latch()
90 * __wait_latch - Wait up to 100us for a port latch to get a certain value,
103 return -EIO; in __wait_latch()
107 * __device_refresh - request a refresh from the accelerometer. Does not wait
120 * __device_refresh_sync - request a synchronous refresh from the
131 * __device_complete - indicate to the accelerometer that we are done reading
142 * hdaps_readb_one - reads a byte from a single I/O port, placing the value in
152 /* do a sync refresh -- we need to be sure that we read fresh data */ in hdaps_readb_one()
165 /* __hdaps_read_pair - internal lockless helper for hdaps_read_pair(). */
167 int *x, int *y) in __hdaps_read_pair() argument
169 /* do a sync refresh -- we need to be sure that we read fresh data */ in __hdaps_read_pair()
171 return -EIO; in __hdaps_read_pair()
174 *x = inw(port1); in __hdaps_read_pair()
180 *x = -*x; in __hdaps_read_pair()
182 *y = -*y; in __hdaps_read_pair()
188 * hdaps_read_pair - reads the values from a pair of ports, placing the values
204 * hdaps_device_init - initialize the accelerometer. Returns zero on success
209 int total, ret = -ENXIO; in hdaps_device_init()
221 * Others--namely the R50p, T41p, and T42p--return 0x03. These laptops in hdaps_device_init()
231 printk(KERN_DEBUG "hdaps: initial latch check good (0x%02x)\n", in hdaps_device_init()
263 for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) { in hdaps_device_init()
264 int x, y; in hdaps_device_init() local
267 __hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &x, &y); in hdaps_device_init()
314 * hdaps_calibrate - Set our "resting" values. Callers must hold hdaps_mtx.
323 int x, y; in hdaps_mousedev_poll() local
327 if (__hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &x, &y)) in hdaps_mousedev_poll()
330 input_report_abs(input_dev, ABS_X, x - rest_x); in hdaps_mousedev_poll()
331 input_report_abs(input_dev, ABS_Y, y - rest_y); in hdaps_mousedev_poll()
344 int ret, x, y; in hdaps_position_show() local
346 ret = hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &x, &y); in hdaps_position_show()
350 return sprintf(buf, "(%d,%d)\n", x, y); in hdaps_position_show()
356 int ret, x, y; in hdaps_variance_show() local
358 ret = hdaps_read_pair(HDAPS_PORT_XVAR, HDAPS_PORT_YVAR, &x, &y); in hdaps_variance_show()
362 return sprintf(buf, "(%d,%d)\n", x, y); in hdaps_variance_show()
436 return -EINVAL; in hdaps_invert_store()
472 /* hdaps_dmi_match - found a match. return one, short-circuiting the hunt. */
475 pr_info("%s detected\n", id->ident); in hdaps_dmi_match()
479 /* hdaps_dmi_match_invert - found an inverted match. */
482 hdaps_invert = (unsigned long)id->driver_data; in hdaps_dmi_match_invert()
483 pr_info("inverting axis (%u) readings\n", hdaps_invert); in hdaps_dmi_match_invert()
537 ret = -ENODEV; in hdaps_init()
542 ret = -ENXIO; in hdaps_init()
556 ret = sysfs_create_group(&pdev->dev.kobj, &hdaps_attribute_group); in hdaps_init()
562 ret = -ENOMEM; in hdaps_init()
570 hdaps_idev->name = "hdaps"; in hdaps_init()
571 hdaps_idev->phys = "isa1600/input0"; in hdaps_init()
572 hdaps_idev->id.bustype = BUS_ISA; in hdaps_init()
573 hdaps_idev->dev.parent = &pdev->dev; in hdaps_init()
575 -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); in hdaps_init()
577 -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); in hdaps_init()
595 sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group); in hdaps_init()
610 sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group); in hdaps_exit()
622 MODULE_PARM_DESC(invert, "invert data along each axis. 1 invert x-axis, "
623 "2 invert y-axis, 3 invert both axes.");