linux/drivers/input/mouse/elantech.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Elantech Touchpad driver (v6)
 *
 * Copyright (C) 2007-2009 Arjan Opmeer <[email protected]>
 *
 * Trademarks are the property of their respective owners.
 */

#ifndef _ELANTECH_H
#define _ELANTECH_H

/*
 * Command values for Synaptics style queries
 */
#define ETP_FW_ID_QUERY
#define ETP_FW_VERSION_QUERY
#define ETP_CAPABILITIES_QUERY
#define ETP_SAMPLE_QUERY
#define ETP_RESOLUTION_QUERY
#define ETP_ICBODY_QUERY

/*
 * Command values for register reading or writing
 */
#define ETP_REGISTER_READ
#define ETP_REGISTER_WRITE
#define ETP_REGISTER_READWRITE

/*
 * Hardware version 2 custom PS/2 command value
 */
#define ETP_PS2_CUSTOM_COMMAND

/*
 * Times to retry a ps2_command and millisecond delay between tries
 */
#define ETP_PS2_COMMAND_TRIES
#define ETP_PS2_COMMAND_DELAY

/*
 * Times to try to read back a register and millisecond delay between tries
 */
#define ETP_READ_BACK_TRIES
#define ETP_READ_BACK_DELAY

/*
 * Register bitmasks for hardware version 1
 */
#define ETP_R10_ABSOLUTE_MODE
#define ETP_R11_4_BYTE_MODE

/*
 * Capability bitmasks
 */
#define ETP_CAP_HAS_ROCKER

/*
 * One hard to find application note states that X axis range is 0 to 576
 * and Y axis range is 0 to 384 for harware version 1.
 * Edge fuzz might be necessary because of bezel around the touchpad
 */
#define ETP_EDGE_FUZZ_V1

#define ETP_XMIN_V1
#define ETP_XMAX_V1
#define ETP_YMIN_V1
#define ETP_YMAX_V1

/*
 * The resolution for older v2 hardware doubled.
 * (newer v2's firmware provides command so we can query)
 */
#define ETP_XMIN_V2
#define ETP_XMAX_V2
#define ETP_YMIN_V2
#define ETP_YMAX_V2

#define ETP_PMIN_V2
#define ETP_PMAX_V2
#define ETP_WMIN_V2
#define ETP_WMAX_V2

/*
 * v3 hardware has 2 kinds of packet types,
 * v4 hardware has 3.
 */
#define PACKET_UNKNOWN
#define PACKET_DEBOUNCE
#define PACKET_V3_HEAD
#define PACKET_V3_TAIL
#define PACKET_V4_HEAD
#define PACKET_V4_MOTION
#define PACKET_V4_STATUS
#define PACKET_TRACKPOINT

/*
 * track up to 5 fingers for v4 hardware
 */
#define ETP_MAX_FINGERS

/*
 * weight value for v4 hardware
 */
#define ETP_WEIGHT_VALUE

/*
 * Bus information on 3rd byte of query ETP_RESOLUTION_QUERY(0x04)
 */
#define ETP_BUS_PS2_ONLY
#define ETP_BUS_SMB_ALERT_ONLY
#define ETP_BUS_SMB_HST_NTFY_ONLY
#define ETP_BUS_PS2_SMB_ALERT
#define ETP_BUS_PS2_SMB_HST_NTFY

/*
 * New ICs are either using SMBus Host Notify or just plain PS2.
 *
 * ETP_FW_VERSION_QUERY is:
 * Byte 1:
 *  - bit 0..3: IC BODY
 * Byte 2:
 *  - bit 4: HiddenButton
 *  - bit 5: PS2_SMBUS_NOTIFY
 *  - bit 6: PS2CRCCheck
 */
#define ETP_NEW_IC_SMBUS_HOST_NOTIFY(fw_version)

/*
 * The base position for one finger, v4 hardware
 */
struct finger_pos {};

struct elantech_device_info {};

struct elantech_data {};

int elantech_detect(struct psmouse *psmouse, bool set_properties);
int elantech_init_ps2(struct psmouse *psmouse);

#ifdef CONFIG_MOUSE_PS2_ELANTECH
int elantech_init(struct psmouse *psmouse);
#else
static inline int elantech_init(struct psmouse *psmouse)
{
	return -ENOSYS;
}
#endif /* CONFIG_MOUSE_PS2_ELANTECH */

int elantech_init_smbus(struct psmouse *psmouse);

#endif