linux/drivers/input/serio/ps2-gpio.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * GPIO based serio bus driver for bit banging the PS/2 protocol
 *
 * Author: Danilo Krummrich <[email protected]>
 */

#include <linux/gpio/consumer.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/serio.h>
#include <linux/slab.h>
#include <linux/platform_device.h>
#include <linux/workqueue.h>
#include <linux/completion.h>
#include <linux/mutex.h>
#include <linux/preempt.h>
#include <linux/property.h>
#include <linux/of.h>
#include <linux/jiffies.h>
#include <linux/delay.h>
#include <linux/timekeeping.h>

#define DRIVER_NAME

#define PS2_MODE_RX
#define PS2_MODE_TX

#define PS2_START_BIT
#define PS2_DATA_BIT0
#define PS2_DATA_BIT1
#define PS2_DATA_BIT2
#define PS2_DATA_BIT3
#define PS2_DATA_BIT4
#define PS2_DATA_BIT5
#define PS2_DATA_BIT6
#define PS2_DATA_BIT7
#define PS2_PARITY_BIT
#define PS2_STOP_BIT
#define PS2_ACK_BIT

#define PS2_DEV_RET_ACK
#define PS2_DEV_RET_NACK

#define PS2_CMD_RESEND

/*
 * The PS2 protocol specifies a clock frequency between 10kHz and 16.7kHz,
 * therefore the maximal interrupt interval should be 100us and the minimum
 * interrupt interval should be ~60us. Let's allow +/- 20us for frequency
 * deviations and interrupt latency.
 *
 * The data line must be samples after ~30us to 50us after the falling edge,
 * since the device updates the data line at the rising edge.
 *
 * ___            ______            ______            ______            ___
 *    \          /      \          /      \          /      \          /
 *     \        /        \        /        \        /        \        /
 *      \______/          \______/          \______/          \______/
 *
 *     |-----------------|                 |--------|
 *          60us/100us                      30us/50us
 */
#define PS2_CLK_FREQ_MIN_HZ
#define PS2_CLK_FREQ_MAX_HZ
#define PS2_CLK_MIN_INTERVAL_US
#define PS2_CLK_MAX_INTERVAL_US
#define PS2_IRQ_MIN_INTERVAL_US
#define PS2_IRQ_MAX_INTERVAL_US

struct ps2_gpio_data {};

static int ps2_gpio_open(struct serio *serio)
{}

static void ps2_gpio_close(struct serio *serio)
{}

static int __ps2_gpio_write(struct serio *serio, unsigned char val)
{}

static int ps2_gpio_write(struct serio *serio, unsigned char val)
{}

static void ps2_gpio_tx_work_fn(struct work_struct *work)
{}

static irqreturn_t ps2_gpio_irq_rx(struct ps2_gpio_data *drvdata)
{}

static irqreturn_t ps2_gpio_irq_tx(struct ps2_gpio_data *drvdata)
{}

static irqreturn_t ps2_gpio_irq(int irq, void *dev_id)
{}

static int ps2_gpio_get_props(struct device *dev,
				 struct ps2_gpio_data *drvdata)
{}

static int ps2_gpio_probe(struct platform_device *pdev)
{}

static void ps2_gpio_remove(struct platform_device *pdev)
{}

#if defined(CONFIG_OF)
static const struct of_device_id ps2_gpio_match[] =;
MODULE_DEVICE_TABLE(of, ps2_gpio_match);
#endif

static struct platform_driver ps2_gpio_driver =;
module_platform_driver();

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