linux/drivers/input/mouse/sentelic.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*-
 * Finger Sensing Pad PS/2 mouse driver.
 *
 * Copyright (C) 2005-2007 Asia Vital Components Co., Ltd.
 * Copyright (C) 2005-2012 Tai-hwa Liang, Sentelic Corporation.
 */

#include <linux/module.h>
#include <linux/input.h>
#include <linux/input/mt.h>
#include <linux/ctype.h>
#include <linux/libps2.h>
#include <linux/serio.h>
#include <linux/jiffies.h>
#include <linux/slab.h>

#include "psmouse.h"
#include "sentelic.h"

/*
 * Timeout for FSP PS/2 command only (in milliseconds).
 */
#define FSP_CMD_TIMEOUT
#define FSP_CMD_TIMEOUT2

#define GET_ABS_X(packet)
#define GET_ABS_Y(packet)

/** Driver version. */
static const char fsp_drv_ver[] =;

/*
 * Make sure that the value being sent to FSP will not conflict with
 * possible sample rate values.
 */
static unsigned char fsp_test_swap_cmd(unsigned char reg_val)
{}

/*
 * Make sure that the value being sent to FSP will not conflict with certain
 * commands.
 */
static unsigned char fsp_test_invert_cmd(unsigned char reg_val)
{}

static int fsp_reg_read(struct psmouse *psmouse, int reg_addr, int *reg_val)
{}

static int fsp_reg_write(struct psmouse *psmouse, int reg_addr, int reg_val)
{}

/* Enable register clock gating for writing certain registers */
static int fsp_reg_write_enable(struct psmouse *psmouse, bool enable)
{}

static int fsp_page_reg_read(struct psmouse *psmouse, int *reg_val)
{}

static int fsp_page_reg_write(struct psmouse *psmouse, int reg_val)
{}

static int fsp_get_version(struct psmouse *psmouse, int *version)
{}

static int fsp_get_revision(struct psmouse *psmouse, int *rev)
{}

static int fsp_get_sn(struct psmouse *psmouse, int *sn)
{}

static int fsp_get_buttons(struct psmouse *psmouse, int *btn)
{}

/* Enable on-pad command tag output */
static int fsp_opc_tag_enable(struct psmouse *psmouse, bool enable)
{}

static int fsp_onpad_vscr(struct psmouse *psmouse, bool enable)
{}

static int fsp_onpad_hscr(struct psmouse *psmouse, bool enable)
{}

/*
 * Write device specific initial parameters.
 *
 * ex: 0xab 0xcd - write oxcd into register 0xab
 */
static ssize_t fsp_attr_set_setreg(struct psmouse *psmouse, void *data,
				   const char *buf, size_t count)
{}

PSMOUSE_DEFINE_WO_ATTR();

static ssize_t fsp_attr_show_getreg(struct psmouse *psmouse,
					void *data, char *buf)
{}

/*
 * Read a register from device.
 *
 * ex: 0xab -- read content from register 0xab
 */
static ssize_t fsp_attr_set_getreg(struct psmouse *psmouse, void *data,
					const char *buf, size_t count)
{}

PSMOUSE_DEFINE_ATTR();

static ssize_t fsp_attr_show_pagereg(struct psmouse *psmouse,
					void *data, char *buf)
{}

static ssize_t fsp_attr_set_pagereg(struct psmouse *psmouse, void *data,
					const char *buf, size_t count)
{}

PSMOUSE_DEFINE_ATTR();

static ssize_t fsp_attr_show_vscroll(struct psmouse *psmouse,
					void *data, char *buf)
{}

static ssize_t fsp_attr_set_vscroll(struct psmouse *psmouse, void *data,
					const char *buf, size_t count)
{}

PSMOUSE_DEFINE_ATTR();

static ssize_t fsp_attr_show_hscroll(struct psmouse *psmouse,
					void *data, char *buf)
{}

static ssize_t fsp_attr_set_hscroll(struct psmouse *psmouse, void *data,
					const char *buf, size_t count)
{}

PSMOUSE_DEFINE_ATTR();

static ssize_t fsp_attr_show_flags(struct psmouse *psmouse,
					void *data, char *buf)
{}

static ssize_t fsp_attr_set_flags(struct psmouse *psmouse, void *data,
					const char *buf, size_t count)
{}

PSMOUSE_DEFINE_ATTR();

static ssize_t fsp_attr_show_ver(struct psmouse *psmouse,
					void *data, char *buf)
{}

PSMOUSE_DEFINE_RO_ATTR();

static struct attribute *fsp_attributes[] =;

static struct attribute_group fsp_attribute_group =;

#ifdef	FSP_DEBUG
static void fsp_packet_debug(struct psmouse *psmouse, unsigned char packet[])
{
	static unsigned int ps2_packet_cnt;
	static unsigned int ps2_last_second;
	unsigned int jiffies_msec;
	const char *packet_type = "UNKNOWN";
	unsigned short abs_x = 0, abs_y = 0;

	/* Interpret & dump the packet data. */
	switch (packet[0] >> FSP_PKT_TYPE_SHIFT) {
	case FSP_PKT_TYPE_ABS:
		packet_type = "Absolute";
		abs_x = GET_ABS_X(packet);
		abs_y = GET_ABS_Y(packet);
		break;
	case FSP_PKT_TYPE_NORMAL:
		packet_type = "Normal";
		break;
	case FSP_PKT_TYPE_NOTIFY:
		packet_type = "Notify";
		break;
	case FSP_PKT_TYPE_NORMAL_OPC:
		packet_type = "Normal-OPC";
		break;
	}

	ps2_packet_cnt++;
	jiffies_msec = jiffies_to_msecs(jiffies);
	psmouse_dbg(psmouse,
		    "%08dms %s packets: %02x, %02x, %02x, %02x; "
		    "abs_x: %d, abs_y: %d\n",
		    jiffies_msec, packet_type,
		    packet[0], packet[1], packet[2], packet[3], abs_x, abs_y);

	if (jiffies_msec - ps2_last_second > 1000) {
		psmouse_dbg(psmouse, "PS/2 packets/sec = %d\n", ps2_packet_cnt);
		ps2_packet_cnt = 0;
		ps2_last_second = jiffies_msec;
	}
}
#else
static void fsp_packet_debug(struct psmouse *psmouse, unsigned char packet[])
{}
#endif

static void fsp_set_slot(struct input_dev *dev, int slot, bool active,
			 unsigned int x, unsigned int y)
{}

static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse)
{}

static int fsp_activate_protocol(struct psmouse *psmouse)
{}

static int fsp_set_input_params(struct psmouse *psmouse)
{}

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

static void fsp_reset(struct psmouse *psmouse)
{}

static void fsp_disconnect(struct psmouse *psmouse)
{}

static int fsp_reconnect(struct psmouse *psmouse)
{}

int fsp_init(struct psmouse *psmouse)
{}