linux/drivers/input/mouse/synaptics_i2c.c

/*
 * Synaptics touchpad with I2C interface
 *
 * Copyright (C) 2009 Compulab, Ltd.
 * Mike Rapoport <[email protected]>
 * Igor Grinberg <[email protected]>
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file COPYING in the main directory of this archive for
 * more details.
 */

#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/input.h>
#include <linux/delay.h>
#include <linux/workqueue.h>
#include <linux/slab.h>
#include <linux/pm.h>

#define DRIVER_NAME
/* maximum product id is 15 characters */
#define PRODUCT_ID_LENGTH
#define REGISTER_LENGTH

/*
 * after soft reset, we should wait for 1 ms
 * before the device becomes operational
 */
#define SOFT_RESET_DELAY_US
/* and after hard reset, we should wait for max 500ms */
#define HARD_RESET_DELAY_MS

/* Registers by SMBus address */
#define PAGE_SEL_REG
#define DEVICE_STATUS_REG

/* Registers by RMI address */
#define DEV_CONTROL_REG
#define INTERRUPT_EN_REG
#define ERR_STAT_REG
#define INT_REQ_STAT_REG
#define DEV_COMMAND_REG

#define RMI_PROT_VER_REG
#define MANUFACT_ID_REG
#define PHYS_INT_VER_REG
#define PROD_PROPERTY_REG
#define INFO_QUERY_REG0
#define INFO_QUERY_REG1
#define INFO_QUERY_REG2
#define INFO_QUERY_REG3

#define PRODUCT_ID_REG0
#define PRODUCT_ID_REG1
#define PRODUCT_ID_REG2
#define PRODUCT_ID_REG3
#define PRODUCT_ID_REG4
#define PRODUCT_ID_REG5
#define PRODUCT_ID_REG6
#define PRODUCT_ID_REG7
#define PRODUCT_ID_REG8
#define PRODUCT_ID_REG9
#define PRODUCT_ID_REG10
#define PRODUCT_ID_REG11
#define PRODUCT_ID_REG12
#define PRODUCT_ID_REG13
#define PRODUCT_ID_REG14
#define PRODUCT_ID_REG15

#define DATA_REG0
#define ABS_PRESSURE_REG
#define ABS_MSB_X_REG
#define ABS_LSB_X_REG
#define ABS_MSB_Y_REG
#define ABS_LSB_Y_REG
#define REL_X_REG
#define REL_Y_REG

#define DEV_QUERY_REG0
#define DEV_QUERY_REG1
#define DEV_QUERY_REG2
#define DEV_QUERY_REG3
#define DEV_QUERY_REG4
#define DEV_QUERY_REG5
#define DEV_QUERY_REG6
#define DEV_QUERY_REG7
#define DEV_QUERY_REG8

#define GENERAL_2D_CONTROL_REG
#define SENSOR_SENSITIVITY_REG
#define SENS_MAX_POS_MSB_REG
#define SENS_MAX_POS_LSB_REG

/* Register bits */
/* Device Control Register Bits */
#define REPORT_RATE_1ST_BIT

/* Interrupt Enable Register Bits (INTERRUPT_EN_REG) */
#define F10_ABS_INT_ENA
#define F10_REL_INT_ENA
#define F20_INT_ENA

/* Interrupt Request Register Bits (INT_REQ_STAT_REG | DEVICE_STATUS_REG) */
#define F10_ABS_INT_REQ
#define F10_REL_INT_REQ
#define F20_INT_REQ
/* Device Status Register Bits (DEVICE_STATUS_REG) */
#define STAT_CONFIGURED
#define STAT_ERROR

/* Device Command Register Bits (DEV_COMMAND_REG) */
#define RESET_COMMAND
#define REZERO_COMMAND

/* Data Register 0 Bits (DATA_REG0) */
#define GESTURE

/* Device Query Registers Bits */
/* DEV_QUERY_REG3 */
#define HAS_PALM_DETECT
#define HAS_MULTI_FING
#define HAS_SCROLLER
#define HAS_2D_SCROLL

/* General 2D Control Register Bits (GENERAL_2D_CONTROL_REG) */
#define NO_DECELERATION
#define REDUCE_REPORTING
#define NO_FILTER

/* Function Masks */
/* Device Control Register Masks (DEV_CONTROL_REG) */
#define REPORT_RATE_MSK
#define SLEEP_MODE_MSK

/* Device Sleep Modes */
#define FULL_AWAKE
#define NORMAL_OP
#define LOW_PWR_OP
#define VERY_LOW_PWR_OP
#define SENS_SLEEP
#define SLEEP_MOD
#define DEEP_SLEEP
#define HIBERNATE

/* Interrupt Register Mask */
/* (INT_REQ_STAT_REG | DEVICE_STATUS_REG | INTERRUPT_EN_REG) */
#define INT_ENA_REQ_MSK
#define INT_ENA_ABS_MSK
#define INT_ENA_REL_MSK
#define INT_ENA_F20_MSK

/* Device Status Register Masks (DEVICE_STATUS_REG) */
#define CONFIGURED_MSK
#define ERROR_MSK

/* Data Register 0 Masks */
#define FINGER_WIDTH_MSK
#define GESTURE_MSK
#define SENSOR_STATUS_MSK

/*
 * MSB Position Register Masks
 * ABS_MSB_X_REG | ABS_MSB_Y_REG | SENS_MAX_POS_MSB_REG |
 * DEV_QUERY_REG3 | DEV_QUERY_REG5
 */
#define MSB_POSITION_MSK

/* Device Query Registers Masks */

/* DEV_QUERY_REG2 */
#define NUM_EXTRA_POS_MSK

/* When in IRQ mode read the device every THREAD_IRQ_SLEEP_SECS */
#define THREAD_IRQ_SLEEP_SECS
#define THREAD_IRQ_SLEEP_MSECS

/*
 * When in Polling mode and no data received for NO_DATA_THRES msecs
 * reduce the polling rate to NO_DATA_SLEEP_MSECS
 */
#define NO_DATA_THRES
#define NO_DATA_SLEEP_MSECS

/* Control touchpad's No Deceleration option */
static bool no_decel =;
module_param(no_decel, bool, 0644);
MODULE_PARM_DESC();

/* Control touchpad's Reduced Reporting option */
static bool reduce_report;
module_param(reduce_report, bool, 0644);
MODULE_PARM_DESC();

/* Control touchpad's No Filter option */
static bool no_filter;
module_param(no_filter, bool, 0644);
MODULE_PARM_DESC();

/*
 * touchpad Attention line is Active Low and Open Drain,
 * therefore should be connected to pulled up line
 * and the irq configuration should be set to Falling Edge Trigger
 */
/* Control IRQ / Polling option */
static bool polling_req;
module_param(polling_req, bool, 0444);
MODULE_PARM_DESC();

/* Control Polling Rate */
static int scan_rate =;
module_param(scan_rate, int, 0644);
MODULE_PARM_DESC();

/* The main device structure */
struct synaptics_i2c {};

static inline void set_scan_rate(struct synaptics_i2c *touch, int scan_rate)
{}

/*
 * Driver's initial design makes no race condition possible on i2c bus,
 * so there is no need in any locking.
 * Keep it in mind, while playing with the code.
 */
static s32 synaptics_i2c_reg_get(struct i2c_client *client, u16 reg)
{}

static s32 synaptics_i2c_reg_set(struct i2c_client *client, u16 reg, u8 val)
{}

static s32 synaptics_i2c_word_get(struct i2c_client *client, u16 reg)
{}

static int synaptics_i2c_config(struct i2c_client *client)
{}

static int synaptics_i2c_reset_config(struct i2c_client *client)
{}

static int synaptics_i2c_check_error(struct i2c_client *client)
{}

static bool synaptics_i2c_get_input(struct synaptics_i2c *touch)
{}

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

static void synaptics_i2c_check_params(struct synaptics_i2c *touch)
{}

/* Control the Device polling rate / Work Handler sleep time */
static unsigned long synaptics_i2c_adjust_delay(struct synaptics_i2c *touch,
						bool have_data)
{}

/* Work Handler */
static void synaptics_i2c_work_handler(struct work_struct *work)
{}

static int synaptics_i2c_open(struct input_dev *input)
{}

static void synaptics_i2c_close(struct input_dev *input)
{}

static void synaptics_i2c_set_input_params(struct synaptics_i2c *touch)
{}

static struct synaptics_i2c *synaptics_i2c_touch_create(struct i2c_client *client)
{}

static int synaptics_i2c_probe(struct i2c_client *client)
{}

static void synaptics_i2c_remove(struct i2c_client *client)
{}

static int synaptics_i2c_suspend(struct device *dev)
{}

static int synaptics_i2c_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(synaptics_i2c_pm, synaptics_i2c_suspend,
				synaptics_i2c_resume);

static const struct i2c_device_id synaptics_i2c_id_table[] =;
MODULE_DEVICE_TABLE(i2c, synaptics_i2c_id_table);

#ifdef CONFIG_OF
static const struct of_device_id synaptics_i2c_of_match[] =;
MODULE_DEVICE_TABLE(of, synaptics_i2c_of_match);
#endif

static struct i2c_driver synaptics_i2c_driver =;

module_i2c_driver();

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