linux/drivers/input/mouse/alps.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * ALPS touchpad PS/2 mouse driver
 *
 * Copyright (c) 2003 Peter Osterlund <[email protected]>
 * Copyright (c) 2005 Vojtech Pavlik <[email protected]>
 */

#ifndef _ALPS_H
#define _ALPS_H

#include <linux/input/mt.h>

#define ALPS_PROTO_V1
#define ALPS_PROTO_V2
#define ALPS_PROTO_V3
#define ALPS_PROTO_V3_RUSHMORE
#define ALPS_PROTO_V4
#define ALPS_PROTO_V5
#define ALPS_PROTO_V6
#define ALPS_PROTO_V7
#define ALPS_PROTO_V8
#define ALPS_PROTO_V9

#define MAX_TOUCHES

#define DOLPHIN_COUNT_PER_ELECTRODE
#define DOLPHIN_PROFILE_XOFFSET
#define DOLPHIN_PROFILE_YOFFSET

/*
 * enum SS4_PACKET_ID - defines the packet type for V8
 * SS4_PACKET_ID_IDLE: There's no finger and no button activity.
 * SS4_PACKET_ID_ONE: There's one finger on touchpad
 *  or there's button activities.
 * SS4_PACKET_ID_TWO: There's two or more fingers on touchpad
 * SS4_PACKET_ID_MULTI: There's three or more fingers on touchpad
 * SS4_PACKET_ID_STICK: A stick pointer packet
*/
enum SS4_PACKET_ID {};

#define SS4_COUNT_PER_ELECTRODE
#define SS4_NUMSENSOR_XOFFSET
#define SS4_NUMSENSOR_YOFFSET
#define SS4_MIN_PITCH_MM

#define SS4_MASK_NORMAL_BUTTONS

#define SS4PLUS_COUNT_PER_ELECTRODE
#define SS4PLUS_NUMSENSOR_XOFFSET
#define SS4PLUS_NUMSENSOR_YOFFSET
#define SS4PLUS_MIN_PITCH_MM

#define IS_SS4PLUS_DEV(_b)

#define SS4_IS_IDLE_V2(_b)

#define SS4_1F_X_V2(_b)

#define SS4_1F_Y_V2(_b)

#define SS4_1F_Z_V2(_b)

#define SS4_1F_LFB_V2(_b)

#define SS4_MF_LF_V2(_b, _i)

#define SS4_BTN_V2(_b)

#define SS4_STD_MF_X_V2(_b, _i)

#define SS4_PLUS_STD_MF_X_V2(_b, _i)

#define SS4_STD_MF_Y_V2(_b, _i)

#define SS4_BTL_MF_X_V2(_b, _i)

#define SS4_PLUS_BTL_MF_X_V2(_b, _i)

#define SS4_BTL_MF_Y_V2(_b, _i)

#define SS4_MF_Z_V2(_b, _i)

#define SS4_IS_MF_CONTINUE(_b)
#define SS4_IS_5F_DETECTED(_b)

#define SS4_TS_X_V2(_b)

#define SS4_TS_Y_V2(_b)

#define SS4_TS_Z_V2(_b)


#define SS4_MFPACKET_NO_AX
#define SS4_MFPACKET_NO_AY
#define SS4_MFPACKET_NO_AX_BL
#define SS4_MFPACKET_NO_AY_BL
#define SS4_PLUS_MFPACKET_NO_AX
#define SS4_PLUS_MFPACKET_NO_AX_BL

/*
 * enum V7_PACKET_ID - defines the packet type for V7
 * V7_PACKET_ID_IDLE: There's no finger and no button activity.
 * V7_PACKET_ID_TWO: There's one or two non-resting fingers on touchpad
 *  or there's button activities.
 * V7_PACKET_ID_MULTI: There are at least three non-resting fingers.
 * V7_PACKET_ID_NEW: The finger position in slot is not continues from
 *  previous packet.
*/
enum V7_PACKET_ID {};

/**
 * struct alps_protocol_info - information about protocol used by a device
 * @version: Indicates V1/V2/V3/...
 * @byte0: Helps figure out whether a position report packet matches the
 *   known format for this model.  The first byte of the report, ANDed with
 *   mask0, should match byte0.
 * @mask0: The mask used to check the first byte of the report.
 * @flags: Additional device capabilities (passthrough port, trackstick, etc.).
 */
struct alps_protocol_info {};

/**
 * struct alps_model_info - touchpad ID table
 * @signature: E7 response string to match.
 * @protocol_info: information about protocol used by the device.
 *
 * Many (but not all) ALPS touchpads can be identified by looking at the
 * values returned in the "E7 report" and/or the "EC report."  This table
 * lists a number of such touchpads.
 */
struct alps_model_info {};

/**
 * struct alps_nibble_commands - encodings for register accesses
 * @command: PS/2 command used for the nibble
 * @data: Data supplied as an argument to the PS/2 command, if applicable
 *
 * The ALPS protocol uses magic sequences to transmit binary data to the
 * touchpad, as it is generally not OK to send arbitrary bytes out the
 * PS/2 port.  Each of the sequences in this table sends one nibble of the
 * register address or (write) data.  Different versions of the ALPS protocol
 * use slightly different encodings.
 */
struct alps_nibble_commands {};

struct alps_bitmap_point {};

/**
 * struct alps_fields - decoded version of the report packet
 * @x_map: Bitmap of active X positions for MT.
 * @y_map: Bitmap of active Y positions for MT.
 * @fingers: Number of fingers for MT.
 * @pressure: Pressure.
 * @st: position for ST.
 * @mt: position for MT.
 * @first_mp: Packet is the first of a multi-packet report.
 * @is_mp: Packet is part of a multi-packet report.
 * @left: Left touchpad button is active.
 * @right: Right touchpad button is active.
 * @middle: Middle touchpad button is active.
 * @ts_left: Left trackstick button is active.
 * @ts_right: Right trackstick button is active.
 * @ts_middle: Middle trackstick button is active.
 */
struct alps_fields {};

/**
 * struct alps_data - private data structure for the ALPS driver
 * @psmouse: Pointer to parent psmouse device
 * @dev2: Trackstick device (can be NULL).
 * @dev3: Generic PS/2 mouse (can be NULL, delayed registering).
 * @phys2: Physical path for the trackstick device.
 * @phys3: Physical path for the generic PS/2 mouse.
 * @dev3_register_work: Delayed work for registering PS/2 mouse.
 * @nibble_commands: Command mapping used for touchpad register accesses.
 * @addr_command: Command used to tell the touchpad that a register address
 *   follows.
 * @proto_version: Indicates V1/V2/V3/...
 * @byte0: Helps figure out whether a position report packet matches the
 *   known format for this model.  The first byte of the report, ANDed with
 *   mask0, should match byte0.
 * @mask0: The mask used to check the first byte of the report.
 * @fw_ver: cached copy of firmware version (EC report)
 * @flags: Additional device capabilities (passthrough port, trackstick, etc.).
 * @x_max: Largest possible X position value.
 * @y_max: Largest possible Y position value.
 * @x_bits: Number of X bits in the MT bitmap.
 * @y_bits: Number of Y bits in the MT bitmap.
 * @hw_init: Protocol-specific hardware init function.
 * @process_packet: Protocol-specific function to process a report packet.
 * @decode_fields: Protocol-specific function to read packet bitfields.
 * @set_abs_params: Protocol-specific function to configure the input_dev.
 * @prev_fin: Finger bit from previous packet.
 * @multi_packet: Multi-packet data in progress.
 * @multi_data: Saved multi-packet data.
 * @f: Decoded packet data fields.
 * @quirks: Bitmap of ALPS_QUIRK_*.
 * @timer: Timer for flushing out the final report packet in the stream.
 */
struct alps_data {};

#define ALPS_QUIRK_TRACKSTICK_BUTTONS

int alps_detect(struct psmouse *psmouse, bool set_properties);
int alps_init(struct psmouse *psmouse);

#endif