linux/include/linux/i8042.h

/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _LINUX_I8042_H
#define _LINUX_I8042_H


#include <linux/errno.h>
#include <linux/types.h>

/*
 * Standard commands.
 */

#define I8042_CMD_CTL_RCTR
#define I8042_CMD_CTL_WCTR
#define I8042_CMD_CTL_TEST

#define I8042_CMD_KBD_DISABLE
#define I8042_CMD_KBD_ENABLE
#define I8042_CMD_KBD_TEST
#define I8042_CMD_KBD_LOOP

#define I8042_CMD_AUX_DISABLE
#define I8042_CMD_AUX_ENABLE
#define I8042_CMD_AUX_TEST
#define I8042_CMD_AUX_SEND
#define I8042_CMD_AUX_LOOP

#define I8042_CMD_MUX_PFX
#define I8042_CMD_MUX_SEND

/*
 * Status register bits.
 */

#define I8042_STR_PARITY
#define I8042_STR_TIMEOUT
#define I8042_STR_AUXDATA
#define I8042_STR_KEYLOCK
#define I8042_STR_CMDDAT
#define I8042_STR_MUXERR
#define I8042_STR_IBF
#define I8042_STR_OBF

/*
 * Control register bits.
 */

#define I8042_CTR_KBDINT
#define I8042_CTR_AUXINT
#define I8042_CTR_IGNKEYLOCK
#define I8042_CTR_KBDDIS
#define I8042_CTR_AUXDIS
#define I8042_CTR_XLATE

struct serio;

#if defined(CONFIG_SERIO_I8042) || defined(CONFIG_SERIO_I8042_MODULE)

void i8042_lock_chip(void);
void i8042_unlock_chip(void);
int i8042_command(unsigned char *param, int command);
int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
					struct serio *serio));
int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
				       struct serio *serio));

#else

static inline void i8042_lock_chip(void)
{
}

static inline void i8042_unlock_chip(void)
{
}

static inline int i8042_command(unsigned char *param, int command)
{
	return -ENODEV;
}

static inline int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
					struct serio *serio))
{
	return -ENODEV;
}

static inline int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
				       struct serio *serio))
{
	return -ENODEV;
}

#endif

#endif