#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/input.h>
#include <linux/module.h>
#include <linux/spi/spi.h>
#include <linux/types.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
#define REVERSE_BIT(x) …
static const u8 PSX_CMD_POLL[] = …;
#ifdef CONFIG_JOYSTICK_PSXPAD_SPI_FF
static const u8 PSX_CMD_ENTER_CFG[] = …;
static const u8 PSX_CMD_EXIT_CFG[] = …;
static const u8 PSX_CMD_ENABLE_MOTOR[] = …;
#endif
struct psxpad { … };
static int psxpad_command(struct psxpad *pad, const u8 sendcmdlen)
{ … }
#ifdef CONFIG_JOYSTICK_PSXPAD_SPI_FF
static void psxpad_control_motor(struct psxpad *pad,
bool motor1enable, bool motor2enable)
{ … }
static void psxpad_set_motor_level(struct psxpad *pad,
u8 motor1level, u8 motor2level)
{ … }
static int psxpad_spi_play_effect(struct input_dev *idev,
void *data, struct ff_effect *effect)
{ … }
static int psxpad_spi_init_ff(struct psxpad *pad)
{ … }
#else
static void psxpad_control_motor(struct psxpad *pad,
bool motor1enable, bool motor2enable)
{
}
static void psxpad_set_motor_level(struct psxpad *pad,
u8 motor1level, u8 motor2level)
{
}
static inline int psxpad_spi_init_ff(struct psxpad *pad)
{
return 0;
}
#endif
static int psxpad_spi_poll_open(struct input_dev *input)
{ … }
static void psxpad_spi_poll_close(struct input_dev *input)
{ … }
static void psxpad_spi_poll(struct input_dev *input)
{ … }
static int psxpad_spi_probe(struct spi_device *spi)
{ … }
static int psxpad_spi_suspend(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(psxpad_spi_pm, psxpad_spi_suspend, NULL);
static const struct spi_device_id psxpad_spi_id[] = …;
MODULE_DEVICE_TABLE(spi, psxpad_spi_id);
static struct spi_driver psxpad_spi_driver = …;
module_spi_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;