linux/drivers/input/mouse/byd.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * BYD TouchPad PS/2 mouse driver
 *
 * Copyright (C) 2015 Chris Diamand <[email protected]>
 * Copyright (C) 2015 Richard Pospesel
 * Copyright (C) 2015 Tai Chi Minh Ralph Eastwood
 * Copyright (C) 2015 Martin Wimpress
 * Copyright (C) 2015 Jay Kuri
 */

#include <linux/delay.h>
#include <linux/input.h>
#include <linux/libps2.h>
#include <linux/serio.h>
#include <linux/slab.h>

#include "psmouse.h"
#include "byd.h"

/* PS2 Bits */
#define PS2_Y_OVERFLOW
#define PS2_X_OVERFLOW
#define PS2_Y_SIGN
#define PS2_X_SIGN
#define PS2_ALWAYS_1
#define PS2_MIDDLE
#define PS2_RIGHT
#define PS2_LEFT

/*
 * BYD pad constants
 */

/*
 * True device resolution is unknown, however experiments show the
 * resolution is about 111 units/mm.
 * Absolute coordinate packets are in the range 0-255 for both X and Y
 * we pick ABS_X/ABS_Y dimensions which are multiples of 256 and in
 * the right ballpark given the touchpad's physical dimensions and estimate
 * resolution per spec sheet, device active area dimensions are
 * 101.6 x 60.1 mm.
 */
#define BYD_PAD_WIDTH
#define BYD_PAD_HEIGHT
#define BYD_PAD_RESOLUTION

/*
 * Given the above dimensions, relative packets velocity is in multiples of
 * 1 unit / 11 milliseconds.  We use this dt to estimate distance traveled
 */
#define BYD_DT
/* Time in jiffies used to timeout various touch events (64 ms) */
#define BYD_TOUCH_TIMEOUT

/* BYD commands reverse engineered from windows driver */

/*
 * Swipe gesture from off-pad to on-pad
 *  0 : disable
 *  1 : enable
 */
#define BYD_CMD_SET_OFFSCREEN_SWIPE
/*
 * Tap and drag delay time
 *  0 : disable
 *  1 - 8 : least to most delay
 */
#define BYD_CMD_SET_TAP_DRAG_DELAY_TIME
/*
 * Physical buttons function mapping
 *  0 : enable
 *  4 : normal
 *  5 : left button custom command
 *  6 : right button custom command
 *  8 : disable
 */
#define BYD_CMD_SET_PHYSICAL_BUTTONS
/*
 * Absolute mode (1 byte X/Y resolution)
 *  0 : disable
 *  2 : enable
 */
#define BYD_CMD_SET_ABSOLUTE_MODE
/*
 * Two finger scrolling
 *  1 : vertical
 *  2 : horizontal
 *  3 : vertical + horizontal
 *  4 : disable
 */
#define BYD_CMD_SET_TWO_FINGER_SCROLL
/*
 * Handedness
 *  1 : right handed
 *  2 : left handed
 */
#define BYD_CMD_SET_HANDEDNESS
/*
 * Tap to click
 *  1 : enable
 *  2 : disable
 */
#define BYD_CMD_SET_TAP
/*
 * Tap and drag
 *  1 : tap and hold to drag
 *  2 : tap and hold to drag + lock
 *  3 : disable
 */
#define BYD_CMD_SET_TAP_DRAG
/*
 * Touch sensitivity
 *  1 - 7 : least to most sensitive
 */
#define BYD_CMD_SET_TOUCH_SENSITIVITY
/*
 * One finger scrolling
 *  1 : vertical
 *  2 : horizontal
 *  3 : vertical + horizontal
 *  4 : disable
 */
#define BYD_CMD_SET_ONE_FINGER_SCROLL
/*
 * One finger scrolling function
 *  1 : free scrolling
 *  2 : edge motion
 *  3 : free scrolling + edge motion
 *  4 : disable
 */
#define BYD_CMD_SET_ONE_FINGER_SCROLL_FUNC
/*
 * Sliding speed
 *  1 - 5 : slowest to fastest
 */
#define BYD_CMD_SET_SLIDING_SPEED
/*
 * Edge motion
 *  1 : disable
 *  2 : enable when dragging
 *  3 : enable when dragging and pointing
 */
#define BYD_CMD_SET_EDGE_MOTION
/*
 * Left edge region size
 *  0 - 7 : smallest to largest width
 */
#define BYD_CMD_SET_LEFT_EDGE_REGION
/*
 * Top edge region size
 *  0 - 9 : smallest to largest height
 */
#define BYD_CMD_SET_TOP_EDGE_REGION
/*
 * Disregard palm press as clicks
 *  1 - 6 : smallest to largest
 */
#define BYD_CMD_SET_PALM_CHECK
/*
 * Right edge region size
 *  0 - 7 : smallest to largest width
 */
#define BYD_CMD_SET_RIGHT_EDGE_REGION
/*
 * Bottom edge region size
 *  0 - 9 : smallest to largest height
 */
#define BYD_CMD_SET_BOTTOM_EDGE_REGION
/*
 * Multitouch gestures
 *  1 : enable
 *  2 : disable
 */
#define BYD_CMD_SET_MULTITOUCH
/*
 * Edge motion speed
 *  0 : control with finger pressure
 *  1 - 9 : slowest to fastest
 */
#define BYD_CMD_SET_EDGE_MOTION_SPEED
/*
 * Two finger scolling function
 *  0 : free scrolling
 *  1 : free scrolling (with momentum)
 *  2 : edge motion
 *  3 : free scrolling (with momentum) + edge motion
 *  4 : disable
 */
#define BYD_CMD_SET_TWO_FINGER_SCROLL_FUNC

/*
 * The touchpad generates a mixture of absolute and relative packets, indicated
 * by the last byte of each packet being set to one of the following:
 */
#define BYD_PACKET_ABSOLUTE
#define BYD_PACKET_RELATIVE
/* Multitouch gesture packets */
#define BYD_PACKET_PINCH_IN
#define BYD_PACKET_PINCH_OUT
#define BYD_PACKET_ROTATE_CLOCKWISE
#define BYD_PACKET_ROTATE_ANTICLOCKWISE
#define BYD_PACKET_TWO_FINGER_SCROLL_RIGHT
#define BYD_PACKET_TWO_FINGER_SCROLL_DOWN
#define BYD_PACKET_TWO_FINGER_SCROLL_UP
#define BYD_PACKET_TWO_FINGER_SCROLL_LEFT
#define BYD_PACKET_THREE_FINGER_SWIPE_RIGHT
#define BYD_PACKET_THREE_FINGER_SWIPE_DOWN
#define BYD_PACKET_THREE_FINGER_SWIPE_UP
#define BYD_PACKET_THREE_FINGER_SWIPE_LEFT
#define BYD_PACKET_FOUR_FINGER_DOWN
#define BYD_PACKET_FOUR_FINGER_UP
#define BYD_PACKET_REGION_SCROLL_RIGHT
#define BYD_PACKET_REGION_SCROLL_DOWN
#define BYD_PACKET_REGION_SCROLL_UP
#define BYD_PACKET_REGION_SCROLL_LEFT
#define BYD_PACKET_RIGHT_CORNER_CLICK
#define BYD_PACKET_LEFT_CORNER_CLICK
#define BYD_PACKET_LEFT_AND_RIGHT_CORNER_CLICK
#define BYD_PACKET_ONTO_PAD_SWIPE_RIGHT
#define BYD_PACKET_ONTO_PAD_SWIPE_DOWN
#define BYD_PACKET_ONTO_PAD_SWIPE_UP
#define BYD_PACKET_ONTO_PAD_SWIPE_LEFT

struct byd_data {};

static void byd_report_input(struct psmouse *psmouse)
{}

static void byd_clear_touch(struct timer_list *t)
{}

static psmouse_ret_t byd_process_byte(struct psmouse *psmouse)
{}

static int byd_reset_touchpad(struct psmouse *psmouse)
{}

static int byd_reconnect(struct psmouse *psmouse)
{}

static void byd_disconnect(struct psmouse *psmouse)
{}

int byd_detect(struct psmouse *psmouse, bool set_properties)
{}

int byd_init(struct psmouse *psmouse)
{}