linux/drivers/input/mouse/psmouse-base.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * PS/2 mouse driver
 *
 * Copyright (c) 1999-2002 Vojtech Pavlik
 * Copyright (c) 2003-2004 Dmitry Torokhov
 */


#define pr_fmt(fmt)
#define psmouse_fmt(fmt)

#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/input.h>
#include <linux/serio.h>
#include <linux/init.h>
#include <linux/libps2.h>
#include <linux/mutex.h>
#include <linux/types.h>

#include "psmouse.h"
#include "synaptics.h"
#include "logips2pp.h"
#include "alps.h"
#include "hgpk.h"
#include "lifebook.h"
#include "trackpoint.h"
#include "touchkit_ps2.h"
#include "elantech.h"
#include "sentelic.h"
#include "cypress_ps2.h"
#include "focaltech.h"
#include "vmmouse.h"
#include "byd.h"

#define DRIVER_DESC

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

static unsigned int psmouse_max_proto =;
static int psmouse_set_maxproto(const char *val, const struct kernel_param *);
static int psmouse_get_maxproto(char *buffer, const struct kernel_param *kp);
static const struct kernel_param_ops param_ops_proto_abbrev =;
#define param_check_proto_abbrev(name, p)
module_param_named(proto, psmouse_max_proto, proto_abbrev, 0644);
MODULE_PARM_DESC();

static unsigned int psmouse_resolution =;
module_param_named(resolution, psmouse_resolution, uint, 0644);
MODULE_PARM_DESC();

static unsigned int psmouse_rate =;
module_param_named(rate, psmouse_rate, uint, 0644);
MODULE_PARM_DESC();

static bool psmouse_smartscroll =;
module_param_named(smartscroll, psmouse_smartscroll, bool, 0644);
MODULE_PARM_DESC();

static bool psmouse_a4tech_2wheels;
module_param_named(a4tech_workaround, psmouse_a4tech_2wheels, bool, 0644);
MODULE_PARM_DESC();

static unsigned int psmouse_resetafter =;
module_param_named(resetafter, psmouse_resetafter, uint, 0644);
MODULE_PARM_DESC();

static unsigned int psmouse_resync_time;
module_param_named(resync_time, psmouse_resync_time, uint, 0644);
MODULE_PARM_DESC();

PSMOUSE_DEFINE_ATTR();
PSMOUSE_DEFINE_ATTR();
PSMOUSE_DEFINE_ATTR();
PSMOUSE_DEFINE_ATTR();
PSMOUSE_DEFINE_ATTR();

static struct attribute *psmouse_dev_attrs[] =;

ATTRIBUTE_GROUPS();

/*
 * psmouse_mutex protects all operations changing state of mouse
 * (connecting, disconnecting, changing rate or resolution via
 * sysfs). We could use a per-device semaphore but since there
 * rarely more than one PS/2 mouse connected and since semaphore
 * is taken in "slow" paths it is not worth it.
 */
static DEFINE_MUTEX(psmouse_mutex);

static struct workqueue_struct *kpsmoused_wq;

struct psmouse *psmouse_from_serio(struct serio *serio)
{}

void psmouse_report_standard_buttons(struct input_dev *dev, u8 buttons)
{}

void psmouse_report_standard_motion(struct input_dev *dev, u8 *packet)
{}

void psmouse_report_standard_packet(struct input_dev *dev, u8 *packet)
{}

/*
 * psmouse_process_byte() analyzes the PS/2 data stream and reports
 * relevant events to the input module once full packet has arrived.
 */
psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse)
{}

void psmouse_queue_work(struct psmouse *psmouse, struct delayed_work *work,
		unsigned long delay)
{}

/*
 * __psmouse_set_state() sets new psmouse state and resets all flags.
 */
static inline void __psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state)
{}

/*
 * psmouse_set_state() sets new psmouse state and resets all flags and
 * counters while holding serio lock so fighting with interrupt handler
 * is not a concern.
 */
void psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state)
{}

/*
 * psmouse_handle_byte() processes one byte of the input data stream
 * by calling corresponding protocol handler.
 */
static int psmouse_handle_byte(struct psmouse *psmouse)
{}

static void psmouse_handle_oob_data(struct psmouse *psmouse, u8 data)
{}

static enum ps2_disposition psmouse_pre_receive_byte(struct ps2dev *ps2dev,
						     u8 data,
						     unsigned int flags)
{}

static void psmouse_receive_byte(struct ps2dev *ps2dev, u8 data)
{}

/*
 * psmouse_reset() resets the mouse into power-on state.
 */
int psmouse_reset(struct psmouse *psmouse)
{}

/*
 * Here we set the mouse resolution.
 */
void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution)
{}

/*
 * Here we set the mouse report rate.
 */
static void psmouse_set_rate(struct psmouse *psmouse, unsigned int rate)
{}

/*
 * Here we set the mouse scaling.
 */
static void psmouse_set_scale(struct psmouse *psmouse, enum psmouse_scale scale)
{}

/*
 * psmouse_poll() - default poll handler. Everyone except for ALPS uses it.
 */
static int psmouse_poll(struct psmouse *psmouse)
{}

static bool psmouse_check_pnp_id(const char *id, const char * const ids[])
{}

/*
 * psmouse_matches_pnp_id - check if psmouse matches one of the passed in ids.
 */
bool psmouse_matches_pnp_id(struct psmouse *psmouse, const char * const ids[])
{}

/*
 * Genius NetMouse magic init.
 */
static int genius_detect(struct psmouse *psmouse, bool set_properties)
{}

/*
 * IntelliMouse magic init.
 */
static int intellimouse_detect(struct psmouse *psmouse, bool set_properties)
{}

/*
 * Try IntelliMouse/Explorer magic init.
 */
static int im_explorer_detect(struct psmouse *psmouse, bool set_properties)
{}

/*
 * Kensington ThinkingMouse / ExpertMouse magic init.
 */
static int thinking_detect(struct psmouse *psmouse, bool set_properties)
{}

/*
 * Bare PS/2 protocol "detection". Always succeeds.
 */
static int ps2bare_detect(struct psmouse *psmouse, bool set_properties)
{}

/*
 * Cortron PS/2 protocol detection. There's no special way to detect it, so it
 * must be forced by sysfs protocol writing.
 */
static int cortron_detect(struct psmouse *psmouse, bool set_properties)
{}

static const struct psmouse_protocol psmouse_protocols[] =;

static const struct psmouse_protocol *__psmouse_protocol_by_type(enum psmouse_type type)
{}

static const struct psmouse_protocol *psmouse_protocol_by_type(enum psmouse_type type)
{}

static const struct psmouse_protocol *psmouse_protocol_by_name(const char *name, size_t len)
{}

/*
 * Apply default settings to the psmouse structure. Most of them will
 * be overridden by individual protocol initialization routines.
 */
static void psmouse_apply_defaults(struct psmouse *psmouse)
{}

static bool psmouse_do_detect(int (*detect)(struct psmouse *, bool),
			      struct psmouse *psmouse, bool allow_passthrough,
			      bool set_properties)
{}

static bool psmouse_try_protocol(struct psmouse *psmouse,
				 enum psmouse_type type,
				 unsigned int *max_proto,
				 bool set_properties, bool init_allowed)
{}

/*
 * psmouse_extensions() probes for any extensions to the basic PS/2 protocol
 * the mouse may have.
 */
static int psmouse_extensions(struct psmouse *psmouse,
			      unsigned int max_proto, bool set_properties)
{}

/*
 * psmouse_probe() probes for a PS/2 mouse.
 */
static int psmouse_probe(struct psmouse *psmouse)
{}

/*
 * psmouse_initialize() initializes the mouse to a sane state.
 */
static void psmouse_initialize(struct psmouse *psmouse)
{}

/*
 * psmouse_activate() enables the mouse so that we get motion reports from it.
 */
int psmouse_activate(struct psmouse *psmouse)
{}

/*
 * psmouse_deactivate() puts the mouse into poll mode so that we don't get
 * motion reports from it unless we explicitly request it.
 */
int psmouse_deactivate(struct psmouse *psmouse)
{}

/*
 * psmouse_resync() attempts to re-validate current protocol.
 */
static void psmouse_resync(struct work_struct *work)
{}

/*
 * psmouse_cleanup() resets the mouse into power-on state.
 */
static void psmouse_cleanup(struct serio *serio)
{}

/*
 * psmouse_disconnect() closes and frees.
 */
static void psmouse_disconnect(struct serio *serio)
{}

static int psmouse_switch_protocol(struct psmouse *psmouse,
				   const struct psmouse_protocol *proto)
{}

/*
 * psmouse_connect() is a callback from the serio module when
 * an unhandled serio port is found.
 */
static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
{}

static int __psmouse_reconnect(struct serio *serio, bool fast_reconnect)
{}

static int psmouse_reconnect(struct serio *serio)
{}

static int psmouse_fast_reconnect(struct serio *serio)
{}

static struct serio_device_id psmouse_serio_ids[] =;

MODULE_DEVICE_TABLE(serio, psmouse_serio_ids);

static struct serio_driver psmouse_drv =;

ssize_t psmouse_attr_show_helper(struct device *dev, struct device_attribute *devattr,
				 char *buf)
{}

ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *devattr,
				const char *buf, size_t count)
{}

static ssize_t psmouse_show_int_attr(struct psmouse *psmouse, void *offset, char *buf)
{}

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

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

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

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

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


static int psmouse_set_maxproto(const char *val, const struct kernel_param *kp)
{}

static int psmouse_get_maxproto(char *buffer, const struct kernel_param *kp)
{}

static int __init psmouse_init(void)
{}

static void __exit psmouse_exit(void)
{}

module_init();
module_exit(psmouse_exit);