^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef _PSMOUSE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define _PSMOUSE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #define PSMOUSE_OOB_NONE 0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #define PSMOUSE_OOB_EXTRA_BTNS 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define PSMOUSE_CMD_SETSCALE11 0x00e6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define PSMOUSE_CMD_SETSCALE21 0x00e7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define PSMOUSE_CMD_SETRES 0x10e8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define PSMOUSE_CMD_GETINFO 0x03e9
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #define PSMOUSE_CMD_SETSTREAM 0x00ea
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define PSMOUSE_CMD_SETPOLL 0x00f0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define PSMOUSE_CMD_POLL 0x00eb /* caller sets number of bytes to receive */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define PSMOUSE_CMD_RESET_WRAP 0x00ec
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define PSMOUSE_CMD_GETID 0x02f2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define PSMOUSE_CMD_SETRATE 0x10f3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define PSMOUSE_CMD_ENABLE 0x00f4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define PSMOUSE_CMD_DISABLE 0x00f5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define PSMOUSE_CMD_RESET_DIS 0x00f6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define PSMOUSE_CMD_RESET_BAT 0x02ff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define PSMOUSE_RET_BAT 0xaa
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define PSMOUSE_RET_ID 0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define PSMOUSE_RET_ACK 0xfa
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define PSMOUSE_RET_NAK 0xfe
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) enum psmouse_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) PSMOUSE_IGNORE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) PSMOUSE_INITIALIZING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) PSMOUSE_RESYNCING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) PSMOUSE_CMD_MODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) PSMOUSE_ACTIVATED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) /* psmouse protocol handler return codes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) typedef enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) PSMOUSE_BAD_DATA,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) PSMOUSE_GOOD_DATA,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) PSMOUSE_FULL_PACKET
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) } psmouse_ret_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) enum psmouse_scale {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) PSMOUSE_SCALE11,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) PSMOUSE_SCALE21
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) enum psmouse_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) PSMOUSE_NONE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) PSMOUSE_PS2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) PSMOUSE_PS2PP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) PSMOUSE_THINKPS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) PSMOUSE_GENPS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) PSMOUSE_IMPS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) PSMOUSE_IMEX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) PSMOUSE_SYNAPTICS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) PSMOUSE_ALPS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) PSMOUSE_LIFEBOOK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) PSMOUSE_TRACKPOINT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) PSMOUSE_TOUCHKIT_PS2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) PSMOUSE_CORTRON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) PSMOUSE_HGPK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) PSMOUSE_ELANTECH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) PSMOUSE_FSP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) PSMOUSE_SYNAPTICS_RELATIVE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) PSMOUSE_CYPRESS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) PSMOUSE_FOCALTECH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) PSMOUSE_VMMOUSE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) PSMOUSE_BYD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) PSMOUSE_SYNAPTICS_SMBUS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) PSMOUSE_ELANTECH_SMBUS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) PSMOUSE_AUTO /* This one should always be last */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) struct psmouse;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) struct psmouse_protocol {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) enum psmouse_type type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) bool maxproto;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) bool ignore_parity; /* Protocol should ignore parity errors from KBC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) bool try_passthru; /* Try protocol also on passthrough ports */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) bool smbus_companion; /* "Protocol" is a stub, device is on SMBus */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) const char *alias;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) int (*detect)(struct psmouse *, bool);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) int (*init)(struct psmouse *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) struct psmouse {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) void *private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) struct input_dev *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) struct ps2dev ps2dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) struct delayed_work resync_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) const char *vendor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) const struct psmouse_protocol *protocol;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) unsigned char packet[8];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) unsigned char badbyte;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) unsigned char pktcnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) unsigned char pktsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) unsigned char oob_data_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) unsigned char extra_buttons;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) bool acks_disable_command;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) unsigned int model;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) unsigned long last;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) unsigned long out_of_sync_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) unsigned long num_resyncs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) enum psmouse_state state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) char devname[64];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) char phys[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) unsigned int rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) unsigned int resolution;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) unsigned int resetafter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) unsigned int resync_time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) bool smartscroll; /* Logitech only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) psmouse_ret_t (*protocol_handler)(struct psmouse *psmouse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) void (*set_rate)(struct psmouse *psmouse, unsigned int rate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) void (*set_resolution)(struct psmouse *psmouse, unsigned int resolution);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) void (*set_scale)(struct psmouse *psmouse, enum psmouse_scale scale);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) int (*reconnect)(struct psmouse *psmouse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) int (*fast_reconnect)(struct psmouse *psmouse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) void (*disconnect)(struct psmouse *psmouse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) void (*cleanup)(struct psmouse *psmouse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) int (*poll)(struct psmouse *psmouse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) void (*pt_activate)(struct psmouse *psmouse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) void (*pt_deactivate)(struct psmouse *psmouse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) void psmouse_queue_work(struct psmouse *psmouse, struct delayed_work *work,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) unsigned long delay);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) int psmouse_reset(struct psmouse *psmouse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) void psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) int psmouse_activate(struct psmouse *psmouse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) int psmouse_deactivate(struct psmouse *psmouse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) bool psmouse_matches_pnp_id(struct psmouse *psmouse, const char * const ids[]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) void psmouse_report_standard_buttons(struct input_dev *, u8 buttons);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) void psmouse_report_standard_motion(struct input_dev *, u8 *packet);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) void psmouse_report_standard_packet(struct input_dev *, u8 *packet);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) struct psmouse_attribute {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) struct device_attribute dattr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) void *data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) ssize_t (*show)(struct psmouse *psmouse, void *data, char *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) ssize_t (*set)(struct psmouse *psmouse, void *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) const char *buf, size_t count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) bool protect;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) #define to_psmouse_attr(a) container_of((a), struct psmouse_attribute, dattr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) ssize_t psmouse_attr_show_helper(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) char *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) const char *buf, size_t count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) #define __PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, _show, _set, _protect) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) static struct psmouse_attribute psmouse_attr_##_name = { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) .dattr = { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) .attr = { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) .name = __stringify(_name), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) .mode = _mode, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) .show = psmouse_attr_show_helper, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) .store = psmouse_attr_set_helper, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) .data = _data, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) .show = _show, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) .set = _set, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) .protect = _protect, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) #define __PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set, _protect) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) static ssize_t _show(struct psmouse *, void *, char *); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) static ssize_t _set(struct psmouse *, void *, const char *, size_t); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) __PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, _show, _set, _protect)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) #define PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) __PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set, true)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) #define PSMOUSE_DEFINE_RO_ATTR(_name, _mode, _data, _show) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) static ssize_t _show(struct psmouse *, void *, char *); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) __PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, _show, NULL, true)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) #define PSMOUSE_DEFINE_WO_ATTR(_name, _mode, _data, _set) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) static ssize_t _set(struct psmouse *, void *, const char *, size_t); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) __PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, NULL, _set, true)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) #ifndef psmouse_fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) #define psmouse_fmt(fmt) KBUILD_BASENAME ": " fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) #define psmouse_dbg(psmouse, format, ...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) dev_dbg(&(psmouse)->ps2dev.serio->dev, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) psmouse_fmt(format), ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) #define psmouse_info(psmouse, format, ...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) dev_info(&(psmouse)->ps2dev.serio->dev, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) psmouse_fmt(format), ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) #define psmouse_warn(psmouse, format, ...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) dev_warn(&(psmouse)->ps2dev.serio->dev, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) psmouse_fmt(format), ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) #define psmouse_err(psmouse, format, ...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) dev_err(&(psmouse)->ps2dev.serio->dev, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) psmouse_fmt(format), ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) #define psmouse_notice(psmouse, format, ...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) dev_notice(&(psmouse)->ps2dev.serio->dev, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) psmouse_fmt(format), ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) #define psmouse_printk(level, psmouse, format, ...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) dev_printk(level, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) &(psmouse)->ps2dev.serio->dev, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) psmouse_fmt(format), ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) #ifdef CONFIG_MOUSE_PS2_SMBUS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) int psmouse_smbus_module_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) void psmouse_smbus_module_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) struct i2c_board_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) int psmouse_smbus_init(struct psmouse *psmouse,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) const struct i2c_board_info *board,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) const void *pdata, size_t pdata_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) bool need_deactivate,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) bool leave_breadcrumbs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) void psmouse_smbus_cleanup(struct psmouse *psmouse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) #else /* !CONFIG_MOUSE_PS2_SMBUS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) static inline int psmouse_smbus_module_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) static inline void psmouse_smbus_module_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) static inline void psmouse_smbus_cleanup(struct psmouse *psmouse)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) #endif /* CONFIG_MOUSE_PS2_SMBUS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) #endif /* _PSMOUSE_H */