[7260] trunk: update according to the feedback of David Brownell/ Mike Frysinger
Revision
7260
Author
bhsong
Date 2009-09-02 17:47:05 -0400 (Wed, 02 Sep 2009)
Log Message
update according to the feedback of David Brownell/Mike Frysinger
1.enable both i2c and spi bus, use bus-match to trigger devices probing
2.move headfile ad714x.h from include/linux/spi to include/linux/input
3.coding style issues
Modified Paths
Added Paths
Removed Paths
Diff
Modified: trunk/arch/blackfin/mach-bf537/boards/stamp.c (7259 => 7260)
--- trunk/arch/blackfin/mach-bf537/boards/stamp.c 2009-09-02 08:14:05 UTC (rev 7259)
+++ trunk/arch/blackfin/mach-bf537/boards/stamp.c 2009-09-02 21:47:05 UTC (rev 7260)
<at> <at> -553,7 +553,7 <at> <at>
#if defined(CONFIG_INPUT_EVAL_AD7147EBZ)
#include <linux/input.h>
-#include <linux/spi/ad714x.h>
+#include <linux/input/ad714x.h>
static struct bfin5xx_spi_chip ad7147_spi_chip_info = {
.enable_dma = 0,
.bits_per_word = 16,
<at> <at> -615,9 +615,11 <at> <at>
},
.sys_cfg_reg = {0x2B2, 0x0, 0x3233, 0x819, 0x832, 0xCFF, 0xCFF, 0x0},
};
-#elif defined(CONFIG_INPUT_EVAL_AD7142EB)
+#endif
+
+#if defined(CONFIG_INPUT_EVAL_AD7142EB)
#include <linux/input.h>
-#include <linux/spi/ad714x.h>
+#include <linux/input/ad714x.h>
static struct ad714x_button_plat button_plat[] = {
{
.keycode = BTN_1,
<at> <at> -1450,7 +1452,7 <at> <at>
static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
#if defined(CONFIG_INPUT_EVAL_AD7142EB)
{
- I2C_BOARD_INFO("ad714x_captouch", 0x2C),
+ I2C_BOARD_INFO("ad7142_captouch", 0x2C),
.irq = IRQ_PG5,
.platform_data = (void *)&ad7142_platfrom_data,
},
Modified: trunk/drivers/input/misc/Kconfig (7259 => 7260)
--- trunk/drivers/input/misc/Kconfig 2009-09-02 08:14:05 UTC (rev 7259)
+++ trunk/drivers/input/misc/Kconfig 2009-09-02 21:47:05 UTC (rev 7260)
<at> <at> -259,47 +259,19 <at> <at>
To compile this driver as a module, choose M here: the
module will be called ad714X.
-choice
- prompt "AD714X Communication Method"
- depends on INPUT_AD714X
- default INPUT_AD714X_I2C if I2C
- default INPUT_AD714X_SPI if (!I2C) && SPI_MASTER
-
-config INPUT_AD714X_I2C
- bool "I2C Interface"
- depends on I2C
- help
- Select this if you have a Capacitance Touch Sensor using the
- AD714X controller, and your board-specific initialization
- code includes that in its table of I2C devices.
-
-config INPUT_AD714X_SPI
- bool "SPI Interface"
- depends on SPI_MASTER
- help
- Select this if you have a Capacitance Touch Sensor using the
- AD714X controller, and your board-specific initialization
- code includes that in its table of SPI devices.
-endchoice
-
-choice
- prompt "Select a AD7142/AD7147 board you are connecting"
- depends on INPUT_AD714X
-
config INPUT_EVAL_AD7147EBZ
bool "ADI EVAL-AD7147EBZ board"
- depends on INPUT_AD714X_SPI
+ depends on INPUT_AD714X && SPI
help
Select this if you are using ADI EVAL-AD7147EBZ board, there are
five buttons and one slider on this board.
config INPUT_EVAL_AD7142EB
bool "ADI EVAL-AD7142EB board"
- depends on INPUT_AD714X_I2C
+ depends on INPUT_AD714X && I2C
help
Select this if you are using ADI EVAL-AD7142EB board, there are
four buttons and two sliders on this board.
-endchoice
config INPUT_ADXL34X
tristate "ADXL345/346 Three-Axis Digital Accelerometer"
Modified: trunk/drivers/input/misc/ad714x.c (7259 => 7260)
--- trunk/drivers/input/misc/ad714x.c 2009-09-02 08:14:05 UTC (rev 7259)
+++ trunk/drivers/input/misc/ad714x.c 2009-09-02 21:47:05 UTC (rev 7260)
<at> <at> -5,28 +5,26 <at> <at>
*
* Licensed under the GPL-2 or later.
*/
-
+#define pr_fmt(fmt) "ad714x: " fmt
#include <linux/device.h>
#include <linux/init.h>
#include <linux/spi/spi.h>
#include <linux/i2c.h>
#include <linux/input.h>
#include <linux/interrupt.h>
-#include <linux/spi/ad714x.h>
+#include <linux/input/ad714x.h>
-#define AD714x_SPI_ADDR 0x1C
-#define AD714x_SPI_ADDR_SHFT 11
-#define AD714x_SPI_READ 1
-#define AD714x_SPI_READ_SHFT 10
+#define AD714x_SPI_CMD_PREFIX 0xE000 /* bits 15:11 */
+#define AD714x_SPI_READ BIT(10)
#define AD714X_PWR_CTRL 0x0
-#define AD714x_STG_CAL_EN_REG 0x1
+#define AD714X_STG_CAL_EN_REG 0x1
#define AD714X_AMB_COMP_CTRL0_REG 0x2
-#define AD714x_PARTID_REG 0x17
+#define AD714X_PARTID_REG 0x17
#define AD7147_PARTID 0x1470
#define AD7142_PARTID 0xE620
-#define AD714x_STAGECFG_REG 0x80
-#define AD714x_SYSCFG_REG 0x0
+#define AD714X_STAGECFG_REG 0x80
+#define AD714X_SYSCFG_REG 0x0
#define STG_LOW_INT_EN_REG 0x5
#define STG_HIGH_INT_EN_REG 0x6
<at> <at> -66,14 +64,6 <at> <at>
#define STAGE_CFGREG_NUM 8
#define SYS_CFGREG_NUM 8
-#if defined(CONFIG_INPUT_AD714X_SPI)
-#define bus_device struct spi_device
-#elif defined(CONFIG_INPUT_AD714X_I2C)
-#define bus_device struct i2c_client
-#else
-#error Communication method needs to be selected (I2C or SPI)
-#endif
-
/*
* driver information which will be used to maintain the software flow
*/
<at> <at> -124,7 +114,8 <at> <at>
struct ad714x_button_drv {
ad714x_device_state state;
/* Unlike slider/wheel/touchpad, all buttons point to
- * same input_dev instance */
+ * same input_dev instance
+ */
struct input_dev *input;
};
<at> <at> -136,7 +127,8 <at> <at>
};
/* information to integrate all things which will be private data
- * of spi/i2c device */
+ * of spi/i2c device
+ */
struct ad714x_chip {
unsigned short h_state;
unsigned short l_state;
<at> <at> -148,14 +140,18 <at> <at>
struct ad714x_platform_data *hw;
struct ad714x_driver_data *sw;
- bus_device *bus;
- int (*read) (bus_device *, unsigned short, unsigned short *);
- int (*write) (bus_device *, unsigned short, unsigned short);
+ int irq;
+ struct device *dev;
+ int (*read) (struct device *, unsigned short, unsigned short *);
+ int (*write) (struct device *, unsigned short, unsigned short);
struct mutex mutex;
+
+ unsigned product;
+ unsigned version;
};
-static void stage_use_com_int(struct ad714x_chip *ad714x, int start_stage,
+static void ad714x_use_com_int(struct ad714x_chip *ad714x, int start_stage,
int end_stage)
{
unsigned short data;
<at> <at> -163,16 +159,16 <at> <at>
mask = ((1 << (end_stage + 1)) - 1) - (1 << start_stage);
- ad714x->read(ad714x->bus, STG_COM_INT_EN_REG, &data);
+ ad714x->read(ad714x->dev, STG_COM_INT_EN_REG, &data);
data |= 1 << start_stage;
- ad714x->write(ad714x->bus, STG_COM_INT_EN_REG, data);
+ ad714x->write(ad714x->dev, STG_COM_INT_EN_REG, data);
- ad714x->read(ad714x->bus, STG_HIGH_INT_EN_REG, &data);
+ ad714x->read(ad714x->dev, STG_HIGH_INT_EN_REG, &data);
data &= ~mask;
- ad714x->write(ad714x->bus, STG_HIGH_INT_EN_REG, data);
+ ad714x->write(ad714x->dev, STG_HIGH_INT_EN_REG, data);
}
-static void stage_use_thr_int(struct ad714x_chip *ad714x, int start_stage,
+static void ad714x_use_thr_int(struct ad714x_chip *ad714x, int start_stage,
int end_stage)
{
unsigned short data;
<at> <at> -180,16 +176,16 <at> <at>
mask = ((1 << (end_stage + 1)) - 1) - (1 << start_stage);
- ad714x->read(ad714x->bus, STG_COM_INT_EN_REG, &data);
+ ad714x->read(ad714x->dev, STG_COM_INT_EN_REG, &data);
data &= ~(1 << start_stage);
- ad714x->write(ad714x->bus, STG_COM_INT_EN_REG, data);
+ ad714x->write(ad714x->dev, STG_COM_INT_EN_REG, data);
- ad714x->read(ad714x->bus, STG_HIGH_INT_EN_REG, &data);
+ ad714x->read(ad714x->dev, STG_HIGH_INT_EN_REG, &data);
data |= mask;
- ad714x->write(ad714x->bus, STG_HIGH_INT_EN_REG, data);
+ ad714x->write(ad714x->dev, STG_HIGH_INT_EN_REG, data);
}
-static int stage_cal_highest_stage(struct ad714x_chip *ad714x, int start_stage,
+static int ad714x_cal_highest_stage(struct ad714x_chip *ad714x, int start_stage,
int end_stage)
{
int max_res = 0;
<at> <at> -206,7 +202,7 <at> <at>
return max_idx;
}
-static int stage_cal_abs_pos(struct ad714x_chip *ad714x, int start_stage,
+static int ad714x_cal_abs_pos(struct ad714x_chip *ad714x, int start_stage,
int end_stage, int highest_stage, int max_coord)
{
int a_param, b_param;
<at> <at> -238,10 +234,10 <at> <at>
}
-/* One button can connect to multi postive and negative of CDCs
- * Multi-buttons can connect to same postive/negative of one CDC
+/* One button can connect to multi positive and negative of CDCs
+ * Multi-buttons can connect to same positive/negative of one CDC
*/
-static void button_state_machine(struct ad714x_chip *ad714x, int idx)
+static void ad714x_button_state_machine(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_button_plat *hw = &ad714x->hw->button[idx];
struct ad714x_button_drv *sw = &ad714x->sw->button[idx];
<at> <at> -250,7 +246,7 <at> <at>
case IDLE:
if (((ad714x->h_state & hw->h_mask) == hw->h_mask) &&
((ad714x->l_state & hw->l_mask) == hw->l_mask)) {
- pr_debug("button %d touched\n", idx);
+ dev_dbg(ad714x->dev, "button %d touched\n", idx);
input_report_key(sw->input, hw->keycode, 1);
input_sync(sw->input);
sw->state = ACTIVE;
<at> <at> -259,7 +255,7 <at> <at>
case ACTIVE:
if (((ad714x->h_state & hw->h_mask) != hw->h_mask) ||
((ad714x->l_state & hw->l_mask) != hw->l_mask)) {
- pr_debug("button %d released\n", idx);
+ dev_dbg(ad714x->dev, "button %d released\n", idx);
input_report_key(sw->input, hw->keycode, 0);
input_sync(sw->input);
sw->state = IDLE;
<at> <at> -273,15 +269,15 <at> <at>
/* The response of a sensor is defined by the absolute number of codes
* between the current CDC value and the ambient value.
*/
-void slider_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
+void ad714x_slider_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx];
int i;
for (i = hw->start_stage; i <= hw->end_stage; i++) {
- ad714x->read(ad714x->bus, CDC_RESULT_S0 + i,
+ ad714x->read(ad714x->dev, CDC_RESULT_S0 + i,
&ad714x->adc_reg[i]);
- ad714x->read(ad714x->bus,
+ ad714x->read(ad714x->dev,
STAGE0_AMBIENT + i * PER_STAGE_REG_NUM,
&ad714x->amb_reg[i]);
<at> <at> -290,15 +286,16 <at> <at>
}
}
-void slider_cal_highest_stage(struct ad714x_chip *ad714x, int idx)
+void ad714x_slider_cal_highest_stage(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx];
struct ad714x_slider_drv *sw = &ad714x->sw->slider[idx];
- sw->highest_stage = stage_cal_highest_stage(ad714x, hw->start_stage,
+ sw->highest_stage = ad714x_cal_highest_stage(ad714x, hw->start_stage,
hw->end_stage);
- pr_debug("slider %d highest_stage:%d\n", idx, sw->highest_stage);
+ dev_dbg(ad714x->dev, "slider %d highest_stage:%d\n", idx,
+ sw->highest_stage);
}
/* The formulae are very straight forward. It uses the sensor with the
<at> <at> -313,15 +310,16 <at> <at>
* w += Sensor response(i)
* POS=(Number_of_Positions_Wanted/(Number_of_Sensors_Used-1)) *(v/w)
*/
-void slider_cal_abs_pos(struct ad714x_chip *ad714x, int idx)
+void ad714x_slider_cal_abs_pos(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx];
struct ad714x_slider_drv *sw = &ad714x->sw->slider[idx];
- sw->abs_pos = stage_cal_abs_pos(ad714x, hw->start_stage, hw->end_stage,
+ sw->abs_pos = ad714x_cal_abs_pos(ad714x, hw->start_stage, hw->end_stage,
sw->highest_stage, hw->max_coord);
- pr_debug("slider %d absolute position:%d\n", idx, sw->abs_pos);
+ dev_dbg(ad714x->dev, "slider %d absolute position:%d\n", idx,
+ sw->abs_pos);
}
/*
<at> <at> -334,29 +332,30 <at> <at>
* Filtered_CDC_result = (Filtered_CDC_result * (10 - Coefficient) +
* Latest_CDC_result * Coefficient)/10
*/
-void slider_cal_flt_pos(struct ad714x_chip *ad714x, int idx)
+void ad714x_slider_cal_flt_pos(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_slider_drv *sw = &ad714x->sw->slider[idx];
sw->flt_pos = (sw->flt_pos * (10 - 4) +
sw->abs_pos * 4)/10;
- pr_debug("slider %d filter position:%d\n", idx, sw->flt_pos);
+ dev_dbg(ad714x->dev, "slider %d filter position:%d\n", idx,
+ sw->flt_pos);
}
-static void slider_use_com_int(struct ad714x_chip *ad714x, int idx)
+static void ad714x_slider_use_com_int(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx];
- stage_use_com_int(ad714x, hw->start_stage, hw->end_stage);
+ ad714x_use_com_int(ad714x, hw->start_stage, hw->end_stage);
}
-static void slider_use_thr_int(struct ad714x_chip *ad714x, int idx)
+static void ad714x_slider_use_thr_int(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx];
- stage_use_thr_int(ad714x, hw->start_stage, hw->end_stage);
+ ad714x_use_thr_int(ad714x, hw->start_stage, hw->end_stage);
}
-static void slider_state_machine(struct ad714x_chip *ad714x, int idx)
+static void ad714x_slider_state_machine(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx];
struct ad714x_slider_drv *sw = &ad714x->sw->slider[idx];
<at> <at> -372,18 +371,18 <at> <at>
case IDLE:
if (h_state) {
sw->state = JITTER;
- /* In End of Conversion interrupt mode, the AD714x
+ /* In End of Conversion interrupt mode, the AD714X
* continuously generates hardware interrupts.
*/
- slider_use_com_int(ad714x, idx);
- pr_debug("slider %d touched\n", idx);
+ ad714x_slider_use_com_int(ad714x, idx);
+ dev_dbg(ad714x->dev, "slider %d touched\n", idx);
}
break;
case JITTER:
if (c_state == mask) {
- slider_cal_sensor_val(ad714x, idx);
- slider_cal_highest_stage(ad714x, idx);
- slider_cal_abs_pos(ad714x, idx);
+ ad714x_slider_cal_sensor_val(ad714x, idx);
+ ad714x_slider_cal_highest_stage(ad714x, idx);
+ ad714x_slider_cal_abs_pos(ad714x, idx);
sw->flt_pos = sw->abs_pos;
sw->state = ACTIVE;
}
<at> <at> -391,10 +390,10 <at> <at>
case ACTIVE:
if (c_state == mask) {
if (h_state) {
- slider_cal_sensor_val(ad714x, idx);
- slider_cal_highest_stage(ad714x, idx);
- slider_cal_abs_pos(ad714x, idx);
- slider_cal_flt_pos(ad714x, idx);
+ ad714x_slider_cal_sensor_val(ad714x, idx);
+ ad714x_slider_cal_highest_stage(ad714x, idx);
+ ad714x_slider_cal_abs_pos(ad714x, idx);
+ ad714x_slider_cal_flt_pos(ad714x, idx);
input_report_abs(sw->input, ABS_X, sw->flt_pos);
input_report_abs(sw->input, ABS_PRESSURE, 1);
<at> <at> -402,10 +401,11 <at> <at>
/* When the user lifts off the sensor, configure
* the AD714X back to threshold interrupt mode.
*/
- slider_use_thr_int(ad714x, idx);
+ ad714x_slider_use_thr_int(ad714x, idx);
sw->state = IDLE;
input_report_abs(sw->input, ABS_PRESSURE, 0);
- pr_debug("slider %d released\n", idx);
+ dev_dbg(ad714x->dev, "slider %d released\n",
+ idx);
}
input_sync(sw->input);
}
<at> <at> -421,27 +421,28 <at> <at>
* the scrollwheel. Then we determined the 2 sensors on either sides of the
* sensor with the highest response and we apply weights to these sensors.
*/
-void wheel_cal_highest_stage(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_cal_highest_stage(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx];
struct ad714x_wheel_drv *sw = &ad714x->sw->wheel[idx];
sw->pre_highest_stage = sw->highest_stage;
- sw->highest_stage = stage_cal_highest_stage(ad714x, hw->start_stage,
+ sw->highest_stage = ad714x_cal_highest_stage(ad714x, hw->start_stage,
hw->end_stage);
- pr_debug("wheel %d highest_stage:%d\n", idx, sw->highest_stage);
+ dev_dbg(ad714x->dev, "wheel %d highest_stage:%d\n", idx,
+ sw->highest_stage);
}
-void wheel_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx];
int i;
for (i = hw->start_stage; i <= hw->end_stage; i++) {
- ad714x->read(ad714x->bus, CDC_RESULT_S0 + i,
+ ad714x->read(ad714x->dev, CDC_RESULT_S0 + i,
&ad714x->adc_reg[i]);
- ad714x->read(ad714x->bus,
+ ad714x->read(ad714x->dev,
STAGE0_AMBIENT + i * PER_STAGE_REG_NUM,
&ad714x->amb_reg[i]);
if (ad714x->adc_reg[i] > ad714x->amb_reg[i])
<at> <at> -470,7 +471,7 <at> <at>
#define WEIGHT_FACTOR 30
/* This constant prevents the "PositionOffset" from reaching a big value */
#define OFFSET_POSITION_CLAMP 120
-void wheel_cal_abs_pos(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_cal_abs_pos(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx];
struct ad714x_wheel_drv *sw = &ad714x->sw->wheel[idx];
<at> <at> -554,7 +555,7 <at> <at>
sw->abs_pos = hw->max_coord;
}
-void wheel_cal_flt_pos(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_cal_flt_pos(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx];
struct ad714x_wheel_drv *sw = &ad714x->sw->wheel[idx];
<at> <at> -570,19 +571,19 <at> <at>
sw->flt_pos = hw->max_coord;
}
-static void wheel_use_com_int(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_use_com_int(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx];
- stage_use_com_int(ad714x, hw->start_stage, hw->end_stage);
+ ad714x_use_com_int(ad714x, hw->start_stage, hw->end_stage);
}
-static void wheel_use_thr_int(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_use_thr_int(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx];
- stage_use_thr_int(ad714x, hw->start_stage, hw->end_stage);
+ ad714x_use_thr_int(ad714x, hw->start_stage, hw->end_stage);
}
-static void wheel_state_machine(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_state_machine(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx];
struct ad714x_wheel_drv *sw = &ad714x->sw->wheel[idx];
<at> <at> -598,18 +599,18 <at> <at>
case IDLE:
if (h_state) {
sw->state = JITTER;
- /* In End of Conversion interrupt mode, the AD714x
+ /* In End of Conversion interrupt mode, the AD714X
* continuously generates hardware interrupts.
*/
- wheel_use_com_int(ad714x, idx);
- pr_debug("wheel %d touched\n", idx);
+ ad714x_wheel_use_com_int(ad714x, idx);
+ dev_dbg(ad714x->dev, "wheel %d touched\n", idx);
}
break;
case JITTER:
if (c_state == mask) {
- wheel_cal_sensor_val(ad714x, idx);
- wheel_cal_highest_stage(ad714x, idx);
- wheel_cal_abs_pos(ad714x, idx);
+ ad714x_wheel_cal_sensor_val(ad714x, idx);
+ ad714x_wheel_cal_highest_stage(ad714x, idx);
+ ad714x_wheel_cal_abs_pos(ad714x, idx);
sw->flt_pos = sw->abs_pos;
sw->state = ACTIVE;
}
<at> <at> -617,9 +618,10 <at> <at>
case ACTIVE:
if (c_state == mask) {
if (h_state) {
- wheel_cal_sensor_val(ad714x, idx);
- wheel_cal_highest_stage(ad714x, idx);
- wheel_cal_abs_pos(ad714x, idx);
+ ad714x_wheel_cal_sensor_val(ad714x, idx);
+ ad714x_wheel_cal_highest_stage(ad714x, idx);
+ ad714x_wheel_cal_abs_pos(ad714x, idx);
+ ad714x_wheel_cal_flt_pos(ad714x, idx);
input_report_abs(sw->input, ABS_WHEEL,
sw->abs_pos);
<at> <at> -628,11 +630,12 <at> <at>
/* When the user lifts off the sensor, configure
* the AD714X back to threshold interrupt mode.
*/
- wheel_use_thr_int(ad714x, idx);
+ ad714x_wheel_use_thr_int(ad714x, idx);
sw->state = IDLE;
input_report_abs(sw->input, ABS_PRESSURE, 0);
- pr_debug("wheel %d released\n", idx);
+ dev_dbg(ad714x->dev, "wheel %d released\n",
+ idx);
}
input_sync(sw->input);
}
<at> <at> -642,15 +645,15 <at> <at>
}
}
-void touchpad_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
+static void touchpad_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx];
int i;
for (i = hw->x_start_stage; i <= hw->x_end_stage; i++) {
- ad714x->read(ad714x->bus, CDC_RESULT_S0 + i,
+ ad714x->read(ad714x->dev, CDC_RESULT_S0 + i,
&ad714x->adc_reg[i]);
- ad714x->read(ad714x->bus,
+ ad714x->read(ad714x->dev,
STAGE0_AMBIENT + i * PER_STAGE_REG_NUM,
&ad714x->amb_reg[i]);
if (ad714x->adc_reg[i] > ad714x->amb_reg[i])
<at> <at> -666,13 +669,14 <at> <at>
struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx];
struct ad714x_touchpad_drv *sw = &ad714x->sw->touchpad[idx];
- sw->x_highest_stage = stage_cal_highest_stage(ad714x, hw->x_start_stage,
- hw->x_end_stage);
- sw->y_highest_stage = stage_cal_highest_stage(ad714x, hw->y_start_stage,
- hw->y_end_stage);
+ sw->x_highest_stage = ad714x_cal_highest_stage(ad714x,
+ hw->x_start_stage, hw->x_end_stage);
+ sw->y_highest_stage = ad714x_cal_highest_stage(ad714x,
+ hw->y_start_stage, hw->y_end_stage);
- pr_debug("touchpad %d x_highest_stage:%d, y_highest_stage:%d\n",
- idx, sw->x_highest_stage, sw->y_highest_stage);
+ dev_dbg(ad714x->dev,
+ "touchpad %d x_highest_stage:%d, y_highest_stage:%d\n",
+ idx, sw->x_highest_stage, sw->y_highest_stage);
}
/* If 2 fingers are touching the sensor then 2 peaks can be observed in the
<at> <at> -723,12 +727,12 <at> <at>
struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx];
struct ad714x_touchpad_drv *sw = &ad714x->sw->touchpad[idx];
- sw->x_abs_pos = stage_cal_abs_pos(ad714x, hw->x_start_stage,
+ sw->x_abs_pos = ad714x_cal_abs_pos(ad714x, hw->x_start_stage,
hw->x_end_stage, sw->x_highest_stage, hw->x_max_coord);
- sw->y_abs_pos = stage_cal_abs_pos(ad714x, hw->y_start_stage,
+ sw->y_abs_pos = ad714x_cal_abs_pos(ad714x, hw->y_start_stage,
hw->y_end_stage, sw->y_highest_stage, hw->y_max_coord);
- pr_debug("touchpad %d absolute position:(%d, %d)\n", idx,
+ dev_dbg(ad714x->dev, "touchpad %d absolute position:(%d, %d)\n", idx,
sw->x_abs_pos, sw->y_abs_pos);
}
<at> <at> -741,7 +745,7 <at> <at>
sw->y_flt_pos = (sw->y_flt_pos * (10 - 4) +
sw->y_abs_pos * 4)/10;
- pr_debug("touchpad %d filter position:(%d, %d)\n",
+ dev_dbg(ad714x->dev, "touchpad %d filter position:(%d, %d)\n",
idx, sw->x_flt_pos, sw->y_flt_pos);
}
<at> <at> -756,12 +760,12 <at> <at>
* detection independent of the pressure.
*/
-#define LEFT_END_POINT_DETECTION_LEVEL 550
-#define RIGHT_END_POINT_DETECTION_LEVEL 750
-#define LEFT_RIGHT_END_POINT_DEAVTIVALION_LEVEL 850
-#define TOP_END_POINT_DETECTION_LEVEL 550
-#define BOTTOM_END_POINT_DETECTION_LEVEL 950
-#define TOP_BOTTOM_END_POINT_DEAVTIVALION_LEVEL 700
+#define LEFT_END_POINT_DETECTION_LEVEL 550
+#define RIGHT_END_POINT_DETECTION_LEVEL 750
+#define LEFT_RIGHT_END_POINT_DEAVTIVALION_LEVEL 850
+#define TOP_END_POINT_DETECTION_LEVEL 550
+#define BOTTOM_END_POINT_DETECTION_LEVEL 950
+#define TOP_BOTTOM_END_POINT_DEAVTIVALION_LEVEL 700
static int touchpad_check_endpoint(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx];
<at> <at> -842,17 +846,17 <at> <at>
static void touchpad_use_com_int(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx];
- stage_use_com_int(ad714x, hw->x_start_stage, hw->x_end_stage);
+ ad714x_use_com_int(ad714x, hw->x_start_stage, hw->x_end_stage);
}
static void touchpad_use_thr_int(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx];
- stage_use_thr_int(ad714x, hw->x_start_stage, hw->x_end_stage);
- stage_use_thr_int(ad714x, hw->y_start_stage, hw->y_end_stage);
+ ad714x_use_thr_int(ad714x, hw->x_start_stage, hw->x_end_stage);
+ ad714x_use_thr_int(ad714x, hw->y_start_stage, hw->y_end_stage);
}
-static void touchpad_state_machine(struct ad714x_chip *ad714x, int idx)
+static void ad714x_touchpad_state_machine(struct ad714x_chip *ad714x, int idx)
{
struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx];
struct ad714x_touchpad_drv *sw = &ad714x->sw->touchpad[idx];
<at> <at> -871,11 +875,11 <at> <at>
case IDLE:
if (h_state) {
sw->state = JITTER;
- /* In End of Conversion interrupt mode, the AD714x
+ /* In End of Conversion interrupt mode, the AD714X
* continuously generates hardware interrupts.
*/
touchpad_use_com_int(ad714x, idx);
- pr_debug("touchpad %d touched\n", idx);
+ dev_dbg(ad714x->dev, "touchpad %d touched\n", idx);
}
break;
case JITTER:
<at> <at> -884,8 +888,9 <at> <at>
touchpad_cal_highest_stage(ad714x, idx);
if ((!touchpad_check_second_peak(ad714x, idx)) &&
(!touchpad_check_endpoint(ad714x, idx))) {
- pr_debug("touchpad%d, 2 fingers or endpoint\n",
- idx);
+ dev_dbg(ad714x->dev,
+ "touchpad%d, 2 fingers or endpoint\n",
+ idx);
touchpad_cal_abs_pos(ad714x, idx);
sw->x_flt_pos = sw->x_abs_pos;
sw->y_flt_pos = sw->y_abs_pos;
<at> <at> -916,7 +921,8 <at> <at>
touchpad_use_thr_int(ad714x, idx);
sw->state = IDLE;
input_report_abs(sw->input, ABS_PRESSURE, 0);
- pr_debug("touchpad %d released\n", idx);
+ dev_dbg(ad714x->dev, "touchpad %d released\n",
+ idx);
}
input_sync(sw->input);
}
<at> <at> -930,24 +936,29 <at> <at>
{
unsigned short data;
- ad714x->read(ad714x->bus, AD714x_PARTID_REG, &data);
+ ad714x->read(ad714x->dev, AD714X_PARTID_REG, &data);
switch (data & 0xFFF0) {
case AD7147_PARTID:
- dev_info(&ad714x->bus->dev, "Found AD7147 captouch, rev:%d\n",
- data & 0xF);
+ ad714x->product = 0x7147;
+ ad714x->version = data & 0xF;
+ dev_info(ad714x->dev, "Found AD7147 captouch, rev:%d\n",
+ ad714x->version);
return 0;
case AD7142_PARTID:
- dev_info(&ad714x->bus->dev, "Found AD7142 captouch, rev:%d\n",
- data & 0xF);
+ ad714x->product = 0x7142;
+ ad714x->version = data & 0xF;
+ dev_info(ad714x->dev, "Found AD7142 captouch, rev:%d\n",
+ ad714x->version);
return 0;
default:
- dev_err(&ad714x->bus->dev, "Fail to detect AD714x captouch,\
- read ID is %04x\n", data);
+ dev_err(ad714x->dev,
+ "Fail to detect AD714X captouch, read ID is %04x\n",
+ data);
return -ENODEV;
}
}
-static int ad714x_hw_init(struct ad714x_chip *ad714x)
+static void __devinit ad714x_hw_init(struct ad714x_chip *ad714x)
{
int i, j;
unsigned short reg_base;
<at> <at> -956,24 +967,25 <at> <at>
/* configuration CDC and interrupts*/
for (i = 0; i < STAGE_NUM; i++) {
- reg_base = AD714x_STAGECFG_REG + i * STAGE_CFGREG_NUM;
+ reg_base = AD714X_STAGECFG_REG + i * STAGE_CFGREG_NUM;
for (j = 0; j < STAGE_CFGREG_NUM; j++)
- ad714x->write(ad714x->bus, reg_base + j,
- ad714x->hw->stage_cfg_reg[i][j]);
+ ad714x->write(ad714x->dev, reg_base + j,
+ ad714x->hw->stage_cfg_reg[i][j]);
}
for (i = 0; i < SYS_CFGREG_NUM; i++)
- ad714x->write(ad714x->bus, AD714x_SYSCFG_REG + i,
+ ad714x->write(ad714x->dev, AD714X_SYSCFG_REG + i,
ad714x->hw->sys_cfg_reg[i]);
+ for (i = 0; i < SYS_CFGREG_NUM; i++)
+ ad714x->read(ad714x->dev, AD714X_SYSCFG_REG + i,
+ &data);
- ad714x->write(ad714x->bus, AD714x_STG_CAL_EN_REG, 0xFFF);
+ ad714x->write(ad714x->dev, AD714X_STG_CAL_EN_REG, 0xFFF);
/* clear all interrupts */
- ad714x->read(ad714x->bus, STG_LOW_INT_STA_REG, &data);
- ad714x->read(ad714x->bus, STG_HIGH_INT_STA_REG, &data);
- ad714x->read(ad714x->bus, STG_COM_INT_STA_REG, &data);
-
- return 0;
+ ad714x->read(ad714x->dev, STG_LOW_INT_STA_REG, &data);
+ ad714x->read(ad714x->dev, STG_HIGH_INT_STA_REG, &data);
+ ad714x->read(ad714x->dev, STG_COM_INT_STA_REG, &data);
}
static irqreturn_t ad714x_interrupt_thread(int irq, void *data)
<at> <at> -983,21 +995,18 <at> <at>
mutex_lock(&ad714x->mutex);
- ad714x->read(ad714x->bus, STG_LOW_INT_STA_REG, &ad714x->l_state);
- ad714x->read(ad714x->bus, STG_HIGH_INT_STA_REG, &ad714x->h_state);
- ad714x->read(ad714x->bus, STG_COM_INT_STA_REG, &ad714x->c_state);
+ ad714x->read(ad714x->dev, STG_LOW_INT_STA_REG, &ad714x->l_state);
+ ad714x->read(ad714x->dev, STG_HIGH_INT_STA_REG, &ad714x->h_state);
+ ad714x->read(ad714x->dev, STG_COM_INT_STA_REG, &ad714x->c_state);
- pr_debug("%s l_state:%04x h_state:%04x c_stage:%04x\n", __func__,
- ad714x->l_state, ad714x->h_state, ad714x->c_state);
-
for (i = 0; i < ad714x->hw->button_num; i++)
- button_state_machine(ad714x, i);
+ ad714x_button_state_machine(ad714x, i);
for (i = 0; i < ad714x->hw->slider_num; i++)
- slider_state_machine(ad714x, i);
+ ad714x_slider_state_machine(ad714x, i);
for (i = 0; i < ad714x->hw->wheel_num; i++)
- wheel_state_machine(ad714x, i);
+ ad714x_wheel_state_machine(ad714x, i);
for (i = 0; i < ad714x->hw->touchpad_num; i++)
- touchpad_state_machine(ad714x, i);
+ ad714x_touchpad_state_machine(ad714x, i);
mutex_unlock(&ad714x->mutex);
<at> <at> -1010,7 +1019,7 <at> <at>
}
#define MAX_DEVICE_NUM 8
-static int __devinit ad714x_probe(struct ad714x_chip *ad714x)
+static int __devinit ad714x_probe(struct ad714x_chip *ad714x, u16 bus_type)
{
int ret = 0;
struct input_dev *input[MAX_DEVICE_NUM];
<at> <at> -1034,13 +1043,30 <at> <at>
if (ret)
goto det_err;
+ /* initilize and request sw/hw resources */
+
+ ad714x_hw_init(ad714x);
+ mutex_init(&ad714x->mutex);
+
+ if (ad714x->irq > 0) {
+ ret = request_threaded_irq(ad714x->irq, ad714x_interrupt,
+ ad714x_interrupt_thread, IRQF_TRIGGER_FALLING,
+ "ad714x_captouch", ad714x);
+ if (ret) {
+ dev_err(ad714x->dev, "Can't allocate irq %d\n",
+ ad714x->irq);
+ goto fail_irq;
+ }
+ } else
+ dev_err(ad714x->dev, "IRQ not configured!\n");
+
/*
- * Allocate and register AD714x input device
+ * Allocate and register AD714X input device
*/
drv_data = kzalloc(sizeof(struct ad714x_driver_data), GFP_KERNEL);
if (!drv_data) {
- dev_err(&ad714x->bus->dev,
+ dev_err(ad714x->dev,
"Can't allocate memory for ad714x driver info\n");
ret = -ENOMEM;
goto fail_alloc_reg;
<at> <at> -1052,7 +1078,7 <at> <at>
sd_drv = kzalloc(sizeof(struct ad714x_slider_drv) *
ad714x->hw->slider_num, GFP_KERNEL);
if (!sd_drv) {
- dev_err(&ad714x->bus->dev,
+ dev_err(ad714x->dev,
"Can't allocate memory for slider info\n");
ret = -ENOMEM;
goto fail_alloc_reg;
<at> <at> -1061,7 +1087,7 <at> <at>
for (i = 0; i < ad714x->hw->slider_num; i++) {
input[alloc_idx] = input_allocate_device();
if (!input[alloc_idx]) {
- dev_err(&ad714x->bus->dev,
+ dev_err(ad714x->dev,
"Can't allocate input device %d\n", alloc_idx);
ret = -ENOMEM;
goto fail_alloc_reg;
<at> <at> -1076,12 +1102,14 <at> <at>
input_set_abs_params(input[alloc_idx-1], ABS_PRESSURE,
0, 1, 0, 0);
- input[alloc_idx-1]->id.bustype = BUS_I2C;
+ input[alloc_idx-1]->id.bustype = bus_type;
+ input[alloc_idx-1]->id.product = ad714x->product;
+ input[alloc_idx-1]->id.version = ad714x->version;
ret = input_register_device(input[reg_idx]);
if (ret) {
- dev_err(&ad714x->bus->dev,
- "Failed to register AD714x input device!\n");
+ dev_err(ad714x->dev,
+ "Failed to register AD714X input device!\n");
goto fail_alloc_reg;
}
reg_idx++;
<at> <at> -1096,7 +1124,7 <at> <at>
wl_drv = kzalloc(sizeof(struct ad714x_wheel_drv) *
ad714x->hw->wheel_num, GFP_KERNEL);
if (!wl_drv) {
- dev_err(&ad714x->bus->dev,
+ dev_err(ad714x->dev,
"Can't allocate memory for wheel info\n");
ret = -ENOMEM;
goto fail_alloc_reg;
<at> <at> -1105,7 +1133,7 <at> <at>
for (i = 0; i < ad714x->hw->wheel_num; i++) {
input[alloc_idx] = input_allocate_device();
if (!input[alloc_idx]) {
- dev_err(&ad714x->bus->dev,
+ dev_err(ad714x->dev,
"Can't allocate input device %d\n", alloc_idx);
ret = -ENOMEM;
goto fail_alloc_reg;
<at> <at> -1120,12 +1148,14 <at> <at>
input_set_abs_params(input[alloc_idx-1], ABS_PRESSURE,
0, 1, 0, 0);
- input[alloc_idx-1]->id.bustype = BUS_I2C;
+ input[alloc_idx-1]->id.bustype = bus_type;
+ input[alloc_idx-1]->id.product = ad714x->product;
+ input[alloc_idx-1]->id.version = ad714x->version;
ret = input_register_device(input[reg_idx]);
if (ret) {
- dev_err(&ad714x->bus->dev,
- "Failed to register AD714x input device!\n");
+ dev_err(ad714x->dev,
+ "Failed to register AD714X input device!\n");
goto fail_alloc_reg;
}
reg_idx++;
<at> <at> -1140,7 +1170,7 <at> <at>
tp_drv = kzalloc(sizeof(struct ad714x_touchpad_drv) *
ad714x->hw->touchpad_num, GFP_KERNEL);
if (!tp_drv) {
- dev_err(&ad714x->bus->dev,
+ dev_err(ad714x->dev,
"Can't allocate memory for touchpad info\n");
ret = -ENOMEM;
goto fail_alloc_reg;
<at> <at> -1149,7 +1179,7 <at> <at>
for (i = 0; i < ad714x->hw->touchpad_num; i++) {
input[alloc_idx] = input_allocate_device();
if (!input[alloc_idx]) {
- dev_err(&ad714x->bus->dev,
+ dev_err(ad714x->dev,
"Can't allocate input device %d\n",
alloc_idx);
ret = -ENOMEM;
<at> <at> -1168,12 +1198,14 <at> <at>
input_set_abs_params(input[alloc_idx-1], ABS_PRESSURE,
0, 1, 0, 0);
- input[alloc_idx-1]->id.bustype = BUS_I2C;
+ input[alloc_idx-1]->id.bustype = bus_type;
+ input[alloc_idx-1]->id.product = ad714x->product;
+ input[alloc_idx-1]->id.version = ad714x->version;
ret = input_register_device(input[reg_idx]);
if (ret) {
- dev_err(&ad714x->bus->dev,
- "Failed to register AD714x input device!\n");
+ dev_err(ad714x->dev,
+ "Failed to register AD714X input device!\n");
goto fail_alloc_reg;
}
reg_idx++;
<at> <at> -1188,7 +1220,7 <at> <at>
bt_drv = kzalloc(sizeof(struct ad714x_button_drv) *
ad714x->hw->button_num, GFP_KERNEL);
if (!bt_drv) {
- dev_err(&ad714x->bus->dev,
+ dev_err(ad714x->dev,
"Can't allocate memory for button info\n");
ret = -ENOMEM;
goto fail_alloc_reg;
<at> <at> -1196,7 +1228,7 <at> <at>
input[alloc_idx] = input_allocate_device();
if (!input[alloc_idx]) {
- dev_err(&ad714x->bus->dev,
+ dev_err(ad714x->dev,
"Can't allocate input device %d\n",
alloc_idx);
ret = -ENOMEM;
<at> <at> -1210,12 +1242,14 <at> <at>
input[alloc_idx-1]->keybit);
}
- input[alloc_idx-1]->id.bustype = BUS_I2C;
+ input[alloc_idx-1]->id.bustype = bus_type;
+ input[alloc_idx-1]->id.product = ad714x->product;
+ input[alloc_idx-1]->id.version = ad714x->version;
ret = input_register_device(input[reg_idx]);
if (ret) {
- dev_err(&ad714x->bus->dev,
- "Failed to register AD714x input device!\n");
+ dev_err(ad714x->dev,
+ "Failed to register AD714X input device!\n");
goto fail_alloc_reg;
}
reg_idx++;
<at> <at> -1225,36 +1259,23 <at> <at>
ad714x->sw->button = bt_drv;
}
- /* initilize and request sw/hw resources */
- ad714x_hw_init(ad714x);
- mutex_init(&ad714x->mutex);
-
- if (ad714x->bus->irq > 0) {
- ret = request_threaded_irq(ad714x->bus->irq, ad714x_interrupt,
- ad714x_interrupt_thread, IRQF_TRIGGER_FALLING,
- "ad714x_captouch", ad714x);
- if (ret) {
- dev_err(&ad714x->bus->dev, "Can't allocate irq %d\n",
- ad714x->bus->irq);
- goto fail_irq;
- }
- } else
- dev_warn(&ad714x->bus->dev, "IRQ not configured!\n");
-
return 0;
-fail_irq:
fail_alloc_reg:
for (i = 0; i < reg_idx; i++)
input_unregister_device(input[i]);
for (i = 0; i < alloc_idx; i++)
input_free_device(input[i]);
- kfree(bt_drv); /* kfree(NULL) is safe check is not required */
+
+ kfree(bt_drv);
kfree(sd_drv);
kfree(wl_drv);
kfree(tp_drv);
kfree(drv_data);
+
+ free_irq(ad714x->irq, ad714x);
+fail_irq:
det_err:
return ret;
}
<at> <at> -1269,11 +1290,7 <at> <at>
struct ad714x_wheel_drv *wl_drv = ad714x->sw->wheel;
struct ad714x_touchpad_drv *tp_drv = ad714x->sw->touchpad;
- /* free irq hardware resource */
- if (ad714x->bus->irq > 0)
- free_irq(ad714x->bus->irq, ad714x);
-
/* unregister and free all input devices */
for (i = 0; i < ad714x->hw->slider_num; i++) {
<at> <at> -1295,119 +1312,132 <at> <at>
input_free_device(ad714x->sw->button[0].input);
/* free all memories for software flow */
- kfree(bt_drv); /* kfree(NULL) is safe check is not required */
+
+ kfree(bt_drv);
kfree(sd_drv);
kfree(wl_drv);
kfree(tp_drv);
kfree(drv_data);
- kfree(ad714x);
+ /* free irq hardware resource */
+
+ free_irq(ad714x->irq, ad714x);
+
return 0;
}
#ifdef CONFIG_PM
-static int ad714x_suspend(bus_device *bus, pm_message_t message)
+static int ad714x_disable(struct ad714x_chip *ad714x)
{
- struct ad714x_chip *ad714x = dev_get_drvdata(&bus->dev);
unsigned short data;
- pr_debug("%s enter\n", __func__);
+ dev_dbg(ad714x->dev, "%s enter\n", __func__);
mutex_lock(&ad714x->mutex);
data = ad714x->hw->sys_cfg_reg[AD714X_PWR_CTRL] | 0x3;
- ad714x->write(bus, AD714X_PWR_CTRL, data);
+ ad714x->write(ad714x->dev, AD714X_PWR_CTRL, data);
mutex_unlock(&ad714x->mutex);
return 0;
}
-static int ad714x_resume(bus_device *bus)
+static int ad714x_enable(struct ad714x_chip *ad714x)
{
- struct ad714x_chip *ad714x = dev_get_drvdata(&bus->dev);
unsigned short data;
- pr_debug("%s enter\n", __func__);
+ dev_dbg(ad714x->dev, "%s enter\n", __func__);
mutex_lock(&ad714x->mutex);
/* resume to non-shutdown mode */
- ad714x->write(bus, AD714X_PWR_CTRL,
+ ad714x->write(ad714x->dev, AD714X_PWR_CTRL,
ad714x->hw->sys_cfg_reg[AD714X_PWR_CTRL]);
/* make sure the interrupt output line is not low level after resume,
* otherwise we will get no chance to enter falling-edge irq again
*/
- ad714x->read(bus, STG_LOW_INT_STA_REG, &data);
- ad714x->read(bus, STG_HIGH_INT_STA_REG, &data);
- ad714x->read(bus, STG_COM_INT_STA_REG, &data);
+ ad714x->read(ad714x->dev, STG_LOW_INT_STA_REG, &data);
+ ad714x->read(ad714x->dev, STG_HIGH_INT_STA_REG, &data);
+ ad714x->read(ad714x->dev, STG_COM_INT_STA_REG, &data);
mutex_unlock(&ad714x->mutex);
return 0;
}
-#else
-#define ad714x_suspend NULL
-#define ad714x_resume NULL
-#endif
-#if defined(CONFIG_INPUT_AD714X_SPI)
-int ad714x_spi_read(struct spi_device *spi, unsigned short reg,
- unsigned short *data)
+#if defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)
+static int ad714x_spi_suspend(struct spi_device *spi, pm_message_t message)
{
- int ret;
- unsigned short tx[2];
- unsigned short rx[2];
- struct spi_transfer t = {
- .tx_buf = tx,
- .rx_buf = rx,
- .len = 4,
- };
- struct spi_message m;
+ struct ad714x_chip *ad714x = spi_get_drvdata(spi);
- tx[0] = (AD714x_SPI_ADDR << AD714x_SPI_ADDR_SHFT) |
- (AD714x_SPI_READ << AD714x_SPI_READ_SHFT) | reg;
+ ad714x_disable(ad714x);
- spi_message_init(&m);
- spi_message_add_tail(&t, &m);
- ret = spi_sync(spi, &m);
+ return 0;
+}
- if (ret < 0) {
- dev_err(&spi->dev, "SPI read error\n");
- return ret;
- }
+static int ad714x_spi_resume(struct spi_device *spi)
+{
+ struct ad714x_chip *ad714x = spi_get_drvdata(spi);
- *data = rx[1];
- return ret;
+ ad714x_enable(ad714x);
+
+ return 0;
}
+#endif
-int ad714x_spi_write(struct spi_device *spi, unsigned short reg,
- unsigned short data)
+#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+static int ad714x_i2c_suspend(struct i2c_client *client, pm_message_t message)
{
- int ret = 0;
- unsigned short tx[2];
- struct spi_transfer t = {
- .tx_buf = tx,
- .len = 4,
- };
- struct spi_message m;
+ struct ad714x_chip *ad714x = i2c_get_clientdata(client);
- tx[0] = (AD714x_SPI_ADDR << AD714x_SPI_ADDR_SHFT) | reg;
- tx[1] = data;
+ ad714x_disable(ad714x);
- spi_message_init(&m);
- spi_message_add_tail(&t, &m);
+ return 0;
+}
- ret = spi_sync(spi, &m);
- if (ret < 0)
- dev_err(&spi->dev, "SPI write error\n");
+static int ad714x_i2c_resume(struct i2c_client *client)
+{
+ struct ad714x_chip *ad714x = i2c_get_clientdata(client);
- return ret;
+ ad714x_enable(ad714x);
+
+ return 0;
}
+#endif
+#else
+#define ad714x_spi_suspend NULL
+#define ad714x_spi_resume NULL
+#define ad714x_i2c_suspend NULL
+#define ad714x_i2c_resume NULL
+#endif
+
+#if defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)
+static int ad714x_spi_read(struct device *dev, unsigned short reg,
+ unsigned short *data)
+{
+ struct spi_device *spi = to_spi_device(dev);
+ unsigned short tx = AD714x_SPI_CMD_PREFIX | AD714x_SPI_READ | reg;
+
+ return spi_write_then_read(spi, (u8 *)&tx, 2, (u8 *)data, 2);
+}
+
+static int ad714x_spi_write(struct device *dev, unsigned short reg,
+ unsigned short data)
+{
+ struct spi_device *spi = to_spi_device(dev);
+ unsigned short tx[2] = {
+ AD714x_SPI_CMD_PREFIX | reg,
+ data
+ };
+
+ return spi_write(spi, (u8 *)tx, 4);
+}
+
static int __devinit ad714x_spi_probe(struct spi_device *spi)
{
int ret = 0;
<at> <at> -1422,14 +1452,15 <at> <at>
if (!chip)
return -ENOMEM;
- chip->bus = spi;
chip->read = ad714x_spi_read;
chip->write = ad714x_spi_write;
chip->hw = spi->dev.platform_data;
+ chip->irq = spi->irq;
+ chip->dev = &spi->dev;
spi_set_drvdata(spi, chip);
/* common probe not related with spi/i2c */
- ret = ad714x_probe(chip);
+ ret = ad714x_probe(chip, BUS_SPI);
if (ret)
kfree(chip);
<at> <at> -1439,52 +1470,42 <at> <at>
static int __devexit ad714x_spi_remove(struct spi_device *spi)
{
struct ad714x_chip *chip = spi_get_drvdata(spi);
+
ad714x_remove(chip);
+ kfree(chip);
+
return 0;
}
static struct spi_driver ad714x_spi_driver = {
.driver = {
.name = "ad714x_captouch",
- .bus = &spi_bus_type,
.owner = THIS_MODULE,
},
.probe = ad714x_spi_probe,
.remove = __devexit_p(ad714x_spi_remove),
- .suspend = ad714x_suspend,
- .resume = ad714x_resume,
+ .suspend = ad714x_spi_suspend,
+ .resume = ad714x_spi_resume,
};
+#endif
-static int __init ad714x_init(void)
-{
- int ret;
- ret = spi_register_driver(&ad714x_spi_driver);
- if (ret != 0) {
- printk(KERN_ERR "Failed to register ad714x SPI driver: %d\n",
- ret);
- }
-
- return ret;
-}
-
-static void __exit ad714x_exit(void)
-{
- spi_unregister_driver(&ad714x_spi_driver);
-}
-#else
-static int ad714x_i2c_write(struct i2c_client *client, unsigned short reg,
+#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+static int ad714x_i2c_write(struct device *dev, unsigned short reg,
unsigned short data)
{
+ struct i2c_client *client = to_i2c_client(dev);
int ret = 0;
- u8 tx[4];
+ u8 *_reg = (u8 *)®
+ u8 *_data = (u8 *)&data;
- /* Do raw I2C, not smbus compatible */
- tx[0] = (reg & 0xFF00) >> 8;
- tx[1] = (reg & 0x00FF);
- tx[2] = (data & 0xFF00) >> 8;
- tx[3] = data & 0x00FF;
+ u8 tx[4] = {
+ _reg[1],
+ _reg[0],
+ _data[1],
+ _data[0]
+ };
ret = i2c_master_send(client, tx, 4);
if (ret < 0)
<at> <at> -1493,17 +1514,20 <at> <at>
return ret;
}
-static int ad714x_i2c_read(struct i2c_client *client, unsigned short reg,
+static int ad714x_i2c_read(struct device *dev, unsigned short reg,
unsigned short *data)
{
+ struct i2c_client *client = to_i2c_client(dev);
int ret = 0;
- u8 tx[2];
+ u8 *_reg = (u8 *)®
+ u8 *_data = (u8 *)data;
+
+ u8 tx[2] = {
+ _reg[1],
+ _reg[0]
+ };
u8 rx[2];
- /* Do raw I2C, not smbus compatible */
- tx[0] = (reg & 0xFF00) >> 8;
- tx[1] = (reg & 0x00FF);
-
ret = i2c_master_send(client, tx, 2);
if (ret < 0) {
dev_err(&client->dev, "I2C read error\n");
<at> <at> -1516,8 +1540,8 <at> <at>
return ret;
}
- *data = rx[0];
- *data = (*data << 8) | rx[1];
+ _data[0] = rx[1];
+ _data[1] = rx[0];
return ret;
}
<at> <at> -1538,14 +1562,15 <at> <at>
if (!chip)
return -ENOMEM;
- chip->bus = client;
chip->read = ad714x_i2c_read;
chip->write = ad714x_i2c_write;
chip->hw = client->dev.platform_data;
+ chip->irq = client->irq;
+ chip->dev = &client->dev;
i2c_set_clientdata(client, chip);
/* common probe not related with spi/i2c */
- ret = ad714x_probe(chip);
+ ret = ad714x_probe(chip, BUS_I2C);
if (ret)
kfree(chip);
<at> <at> -1555,13 +1580,17 <at> <at>
static int __devexit ad714x_i2c_remove(struct i2c_client *client)
{
struct ad714x_chip *chip = i2c_get_clientdata(client);
+
ad714x_remove(chip);
+ kfree(chip);
+
return 0;
}
static const struct i2c_device_id ad714x_id[] = {
- { "ad714x_captouch", 0 },
+ { "ad7142_captouch", 0 },
+ { "ad7147_captouch", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, ad714x_id);
<at> <at> -1570,27 +1599,54 <at> <at>
.driver = {
.name = "ad714x_captouch",
},
- .probe = ad714x_i2c_probe,
- .remove = __devexit_p(ad714x_i2c_remove),
- .suspend = ad714x_suspend,
- .resume = ad714x_resume,
+ .probe = ad714x_i2c_probe,
+ .remove = __devexit_p(ad714x_i2c_remove),
+ .suspend = ad714x_i2c_suspend,
+ .resume = ad714x_i2c_resume,
.id_table = ad714x_id,
};
+#endif
static int __init ad714x_init(void)
{
+#if (defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)) && \
+ !(defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE))
+ return spi_register_driver(&ad714x_spi_driver);
+#endif
+
+#if (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)) && \
+ !(defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE))
return i2c_add_driver(&ad714x_i2c_driver);
+#endif
+
+#if (defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)) && \
+ (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE))
+ int ret = 0;
+ ret = spi_register_driver(&ad714x_spi_driver);
+ if (ret)
+ goto err;
+ ret = i2c_add_driver(&ad714x_i2c_driver);
+ if (ret)
+ spi_unregister_driver(&ad714x_spi_driver);
+err:
+ return ret;
+#endif
}
static void __exit ad714x_exit(void)
{
+#if defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)
+ spi_unregister_driver(&ad714x_spi_driver);
+#endif
+
+#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
i2c_del_driver(&ad714x_i2c_driver);
+#endif
}
-#endif
module_init(ad714x_init);
module_exit(ad714x_exit);
-MODULE_DESCRIPTION("ad714x captouch driver");
+MODULE_DESCRIPTION("Analog Devices AD714X Capacitance Touch Sensor Driver");
MODULE_AUTHOR("Barry Song <21cnbao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>");
MODULE_LICENSE("GPL");
Copied: trunk/include/linux/input/ad714x.h (from rev 7259, trunk/include/linux/spi/ad714x.h) (0 => 7260)
--- trunk/include/linux/input/ad714x.h (rev 0)
+++ trunk/include/linux/input/ad714x.h 2009-09-02 21:47:05 UTC (rev 7260)
<at> <at> -0,0 +1,62 <at> <at>
+/*
+ * include/linux/input/ad714x.h
+ *
+ * AD714x is very flexible, it can be used as buttons, scrollwheel,
+ * slider, touchpad at the same time. That depends on the boards.
+ * The platform_data for the device's "struct device" holds this
+ * information.
+ * Copyright 2009 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#ifndef __LINUX_INPUT_AD714X_H__
+#define __LINUX_INPUT_AD714X_H__
+
+#define STAGE_NUM 12
+#define STAGE_CFGREG_NUM 8
+#define SYS_CFGREG_NUM 8
+
+/* board information which need be initialized in arch/mach... */
+struct ad714x_slider_plat {
+ int start_stage;
+ int end_stage;
+ int max_coord;
+};
+
+struct ad714x_wheel_plat {
+ int start_stage;
+ int end_stage;
+ int max_coord;
+};
+
+struct ad714x_touchpad_plat {
+ int x_start_stage;
+ int x_end_stage;
+ int x_max_coord;
+
+ int y_start_stage;
+ int y_end_stage;
+ int y_max_coord;
+};
+
+struct ad714x_button_plat {
+ int keycode;
+ unsigned short l_mask;
+ unsigned short h_mask;
+};
+
+struct ad714x_platform_data {
+ int slider_num;
+ int wheel_num;
+ int touchpad_num;
+ int button_num;
+ struct ad714x_slider_plat *slider;
+ struct ad714x_wheel_plat *wheel;
+ struct ad714x_touchpad_plat *touchpad;
+ struct ad714x_button_plat *button;
+ unsigned short stage_cfg_reg[STAGE_NUM][STAGE_CFGREG_NUM];
+ unsigned short sys_cfg_reg[SYS_CFGREG_NUM];
+};
+
+#endif
Property changes: trunk/include/linux/input/ad714x.h
Added: svn:mergeinfo
Deleted: trunk/include/linux/spi/ad714x.h (7259 => 7260)
--- trunk/include/linux/spi/ad714x.h 2009-09-02 08:14:05 UTC (rev 7259)
+++ trunk/include/linux/spi/ad714x.h 2009-09-02 21:47:05 UTC (rev 7260)
<at> <at> -1,62 +0,0 <at> <at>
-/*
- * include/linux/ad714x.h
- *
- * AD714x is very flexible, it can be used as buttons, scrollwheel,
- * slider, touchpad at the same time. That depends on the boards.
- * The platform_data for the device's "struct device" holds this
- * information.
- * Copyright 2009 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later.
- */
-
-#ifndef __LINUX_SPI_AD714X_H__
-#define __LINUX_SPI_AD714X_H__
-
-#define STAGE_NUM 12
-#define STAGE_CFGREG_NUM 8
-#define SYS_CFGREG_NUM 8
-
-/* board information which need be initialized in arch/mach... */
-struct ad714x_slider_plat {
- int start_stage;
- int end_stage;
- int max_coord;
-};
-
-struct ad714x_wheel_plat {
- int start_stage;
- int end_stage;
- int max_coord;
-};
-
-struct ad714x_touchpad_plat {
- int x_start_stage;
- int x_end_stage;
- int x_max_coord;
-
- int y_start_stage;
- int y_end_stage;
- int y_max_coord;
-};
-
-struct ad714x_button_plat {
- int keycode;
- unsigned short l_mask;
- unsigned short h_mask;
-};
-
-struct ad714x_platform_data {
- int slider_num;
- int wheel_num;
- int touchpad_num;
- int button_num;
- struct ad714x_slider_plat *slider;
- struct ad714x_wheel_plat *wheel;
- struct ad714x_touchpad_plat *touchpad;
- struct ad714x_button_plat *button;
- unsigned short stage_cfg_reg[STAGE_NUM][STAGE_CFGREG_NUM];
- unsigned short sys_cfg_reg[SYS_CFGREG_NUM];
-};
-
-#endif
<div>
<div>
Revision <a href="http://blackfin.uclinux.org/gf/project/linux-kernel/scmsvn/?action=browse&path=/&view=rev&root=linux-kernel&revision=7260">7260</a>
Author <a href="http://blackfin.uclinux.org/gf/user/bhsong/">bhsong</a>
Date 2009-09-02 17:47:05 -0400 (Wed, 02 Sep 2009)
<h3>Log Message</h3>
update according to the feedback of David Brownell/Mike Frysinger
1.enable both i2c and spi bus, use bus-match to trigger devices probing
2.move headfile ad714x.h from include/linux/spi to include/linux/input
3.coding style issues
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkarchblackfinmachbf537boardsstampc">trunk/arch/blackfin/mach-bf537/boards/stamp.c</a></li>
<li><a href="#trunkdriversinputmiscKconfig">trunk/drivers/input/misc/Kconfig</a></li>
<li><a href="#trunkdriversinputmiscad714xc">trunk/drivers/input/misc/ad714x.c</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/include/linux/input/≤/li>
<li><a href="#trunkincludelinuxinputad714xh">trunk/include/linux/input/ad714x.h</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkincludelinuxspiad714xh">trunk/include/linux/spi/ad714x.h</a></li>
</ul>
</div>
<div>
<h3>Diff</h3>
<a></a>
<div class="modfile">
<h4>Modified: trunk/arch/blackfin/mach-bf537/boards/stamp.c (7259 => 7260)</h4>
<span>
<span class="info">--- trunk/arch/blackfin/mach-bf537/boards/stamp.c 2009-09-02 08:14:05 UTC (rev 7259)
+++ trunk/arch/blackfin/mach-bf537/boards/stamp.c 2009-09-02 21:47:05 UTC (rev 7260)
</span><span class="lines"> <at> <at> -553,7 +553,7 <at> <at>
</span><span class="cx">
</span><span class="cx"> #if defined(CONFIG_INPUT_EVAL_AD7147EBZ)
</span><span class="cx"> #include <linux/input.h>
</span>-#include <linux/spi/ad714x.h>
+#include <linux/input/ad714x.h>
<span class="cx"> static struct bfin5xx_spi_chip ad7147_spi_chip_info = {
</span><span class="cx"> .enable_dma = 0,
</span><span class="cx"> .bits_per_word = 16,
</span><span class="lines"> <at> <at> -615,9 +615,11 <at> <at>
</span><span class="cx"> },
</span><span class="cx"> .sys_cfg_reg = {0x2B2, 0x0, 0x3233, 0x819, 0x832, 0xCFF, 0xCFF, 0x0},
</span><span class="cx"> };
</span>-#elif defined(CONFIG_INPUT_EVAL_AD7142EB)
+#endif
+
+#if defined(CONFIG_INPUT_EVAL_AD7142EB)
<span class="cx"> #include <linux/input.h>
</span>-#include <linux/spi/ad714x.h>
+#include <linux/input/ad714x.h>
<span class="cx"> static struct ad714x_button_plat button_plat[] = {
</span><span class="cx"> {
</span><span class="cx"> .keycode = BTN_1,
</span><span class="lines"> <at> <at> -1450,7 +1452,7 <at> <at>
</span><span class="cx"> static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
</span><span class="cx"> #if defined(CONFIG_INPUT_EVAL_AD7142EB)
</span><span class="cx"> {
</span>- I2C_BOARD_INFO("ad714x_captouch", 0x2C),
+ I2C_BOARD_INFO("ad7142_captouch", 0x2C),
<span class="cx"> .irq = IRQ_PG5,
</span><span class="cx"> .platform_data = (void *)&ad7142_platfrom_data,
</span><span class="cx"> },
</span></span>
</div>
<a></a>
<div class="modfile">
<h4>Modified: trunk/drivers/input/misc/Kconfig (7259 => 7260)</h4>
<span>
<span class="info">--- trunk/drivers/input/misc/Kconfig 2009-09-02 08:14:05 UTC (rev 7259)
+++ trunk/drivers/input/misc/Kconfig 2009-09-02 21:47:05 UTC (rev 7260)
</span><span class="lines"> <at> <at> -259,47 +259,19 <at> <at>
</span><span class="cx"> To compile this driver as a module, choose M here: the
</span><span class="cx"> module will be called ad714X.
</span><span class="cx">
</span>-choice
- prompt "AD714X Communication Method"
- depends on INPUT_AD714X
- default INPUT_AD714X_I2C if I2C
- default INPUT_AD714X_SPI if (!I2C) && SPI_MASTER
-
-config INPUT_AD714X_I2C
- bool "I2C Interface"
- depends on I2C
- help
- Select this if you have a Capacitance Touch Sensor using the
- AD714X controller, and your board-specific initialization
- code includes that in its table of I2C devices.
-
-config INPUT_AD714X_SPI
- bool "SPI Interface"
- depends on SPI_MASTER
- help
- Select this if you have a Capacitance Touch Sensor using the
- AD714X controller, and your board-specific initialization
- code includes that in its table of SPI devices.
-endchoice
-
-choice
- prompt "Select a AD7142/AD7147 board you are connecting"
- depends on INPUT_AD714X
-
<span class="cx"> config INPUT_EVAL_AD7147EBZ
</span><span class="cx"> bool "ADI EVAL-AD7147EBZ board"
</span>- depends on INPUT_AD714X_SPI
+ depends on INPUT_AD714X && SPI
<span class="cx"> help
</span><span class="cx"> Select this if you are using ADI EVAL-AD7147EBZ board, there are
</span><span class="cx"> five buttons and one slider on this board.
</span><span class="cx">
</span><span class="cx"> config INPUT_EVAL_AD7142EB
</span><span class="cx"> bool "ADI EVAL-AD7142EB board"
</span>- depends on INPUT_AD714X_I2C
+ depends on INPUT_AD714X && I2C
<span class="cx"> help
</span><span class="cx"> Select this if you are using ADI EVAL-AD7142EB board, there are
</span><span class="cx"> four buttons and two sliders on this board.
</span>-endchoice
<span class="cx">
</span><span class="cx"> config INPUT_ADXL34X
</span><span class="cx"> tristate "ADXL345/346 Three-Axis Digital Accelerometer"
</span></span>
</div>
<a></a>
<div class="modfile">
<h4>Modified: trunk/drivers/input/misc/ad714x.c (7259 => 7260)</h4>
<span>
<span class="info">--- trunk/drivers/input/misc/ad714x.c 2009-09-02 08:14:05 UTC (rev 7259)
+++ trunk/drivers/input/misc/ad714x.c 2009-09-02 21:47:05 UTC (rev 7260)
</span><span class="lines"> <at> <at> -5,28 +5,26 <at> <at>
</span><span class="cx"> *
</span><span class="cx"> * Licensed under the GPL-2 or later.
</span><span class="cx"> */
</span>-
+#define pr_fmt(fmt) "ad714x: " fmt
<span class="cx"> #include <linux/device.h>
</span><span class="cx"> #include <linux/init.h>
</span><span class="cx"> #include <linux/spi/spi.h>
</span><span class="cx"> #include <linux/i2c.h>
</span><span class="cx"> #include <linux/input.h>
</span><span class="cx"> #include <linux/interrupt.h>
</span>-#include <linux/spi/ad714x.h>
+#include <linux/input/ad714x.h>
<span class="cx">
</span>-#define AD714x_SPI_ADDR 0x1C
-#define AD714x_SPI_ADDR_SHFT 11
-#define AD714x_SPI_READ 1
-#define AD714x_SPI_READ_SHFT 10
+#define AD714x_SPI_CMD_PREFIX 0xE000 /* bits 15:11 */
+#define AD714x_SPI_READ BIT(10)
<span class="cx">
</span><span class="cx"> #define AD714X_PWR_CTRL 0x0
</span>-#define AD714x_STG_CAL_EN_REG 0x1
+#define AD714X_STG_CAL_EN_REG 0x1
<span class="cx"> #define AD714X_AMB_COMP_CTRL0_REG 0x2
</span>-#define AD714x_PARTID_REG 0x17
+#define AD714X_PARTID_REG 0x17
<span class="cx"> #define AD7147_PARTID 0x1470
</span><span class="cx"> #define AD7142_PARTID 0xE620
</span>-#define AD714x_STAGECFG_REG 0x80
-#define AD714x_SYSCFG_REG 0x0
+#define AD714X_STAGECFG_REG 0x80
+#define AD714X_SYSCFG_REG 0x0
<span class="cx">
</span><span class="cx"> #define STG_LOW_INT_EN_REG 0x5
</span><span class="cx"> #define STG_HIGH_INT_EN_REG 0x6
</span><span class="lines"> <at> <at> -66,14 +64,6 <at> <at>
</span><span class="cx"> #define STAGE_CFGREG_NUM 8
</span><span class="cx"> #define SYS_CFGREG_NUM 8
</span><span class="cx">
</span>-#if defined(CONFIG_INPUT_AD714X_SPI)
-#define bus_device struct spi_device
-#elif defined(CONFIG_INPUT_AD714X_I2C)
-#define bus_device struct i2c_client
-#else
-#error Communication method needs to be selected (I2C or SPI)
-#endif
-
<span class="cx"> /*
</span><span class="cx"> * driver information which will be used to maintain the software flow
</span><span class="cx"> */
</span><span class="lines"> <at> <at> -124,7 +114,8 <at> <at>
</span><span class="cx"> struct ad714x_button_drv {
</span><span class="cx"> ad714x_device_state state;
</span><span class="cx"> /* Unlike slider/wheel/touchpad, all buttons point to
</span>- * same input_dev instance */
+ * same input_dev instance
+ */
<span class="cx"> struct input_dev *input;
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines"> <at> <at> -136,7 +127,8 <at> <at>
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> /* information to integrate all things which will be private data
</span>- * of spi/i2c device */
+ * of spi/i2c device
+ */
<span class="cx"> struct ad714x_chip {
</span><span class="cx"> unsigned short h_state;
</span><span class="cx"> unsigned short l_state;
</span><span class="lines"> <at> <at> -148,14 +140,18 <at> <at>
</span><span class="cx"> struct ad714x_platform_data *hw;
</span><span class="cx"> struct ad714x_driver_data *sw;
</span><span class="cx">
</span>- bus_device *bus;
- int (*read) (bus_device *, unsigned short, unsigned short *);
- int (*write) (bus_device *, unsigned short, unsigned short);
+ int irq;
+ struct device *dev;
+ int (*read) (struct device *, unsigned short, unsigned short *);
+ int (*write) (struct device *, unsigned short, unsigned short);
<span class="cx">
</span><span class="cx"> struct mutex mutex;
</span>+
+ unsigned product;
+ unsigned version;
<span class="cx"> };
</span><span class="cx">
</span>-static void stage_use_com_int(struct ad714x_chip *ad714x, int start_stage,
+static void ad714x_use_com_int(struct ad714x_chip *ad714x, int start_stage,
<span class="cx"> int end_stage)
</span><span class="cx"> {
</span><span class="cx"> unsigned short data;
</span><span class="lines"> <at> <at> -163,16 +159,16 <at> <at>
</span><span class="cx">
</span><span class="cx"> mask = ((1 << (end_stage + 1)) - 1) - (1 << start_stage);
</span><span class="cx">
</span>- ad714x->read(ad714x->bus, STG_COM_INT_EN_REG, &data);
+ ad714x->read(ad714x->dev, STG_COM_INT_EN_REG, &data);
<span class="cx"> data |= 1 << start_stage;
</span>- ad714x->write(ad714x->bus, STG_COM_INT_EN_REG, data);
+ ad714x->write(ad714x->dev, STG_COM_INT_EN_REG, data);
<span class="cx">
</span>- ad714x->read(ad714x->bus, STG_HIGH_INT_EN_REG, &data);
+ ad714x->read(ad714x->dev, STG_HIGH_INT_EN_REG, &data);
<span class="cx"> data &= ~mask;
</span>- ad714x->write(ad714x->bus, STG_HIGH_INT_EN_REG, data);
+ ad714x->write(ad714x->dev, STG_HIGH_INT_EN_REG, data);
<span class="cx"> }
</span><span class="cx">
</span>-static void stage_use_thr_int(struct ad714x_chip *ad714x, int start_stage,
+static void ad714x_use_thr_int(struct ad714x_chip *ad714x, int start_stage,
<span class="cx"> int end_stage)
</span><span class="cx"> {
</span><span class="cx"> unsigned short data;
</span><span class="lines"> <at> <at> -180,16 +176,16 <at> <at>
</span><span class="cx">
</span><span class="cx"> mask = ((1 << (end_stage + 1)) - 1) - (1 << start_stage);
</span><span class="cx">
</span>- ad714x->read(ad714x->bus, STG_COM_INT_EN_REG, &data);
+ ad714x->read(ad714x->dev, STG_COM_INT_EN_REG, &data);
<span class="cx"> data &= ~(1 << start_stage);
</span>- ad714x->write(ad714x->bus, STG_COM_INT_EN_REG, data);
+ ad714x->write(ad714x->dev, STG_COM_INT_EN_REG, data);
<span class="cx">
</span>- ad714x->read(ad714x->bus, STG_HIGH_INT_EN_REG, &data);
+ ad714x->read(ad714x->dev, STG_HIGH_INT_EN_REG, &data);
<span class="cx"> data |= mask;
</span>- ad714x->write(ad714x->bus, STG_HIGH_INT_EN_REG, data);
+ ad714x->write(ad714x->dev, STG_HIGH_INT_EN_REG, data);
<span class="cx"> }
</span><span class="cx">
</span>-static int stage_cal_highest_stage(struct ad714x_chip *ad714x, int start_stage,
+static int ad714x_cal_highest_stage(struct ad714x_chip *ad714x, int start_stage,
<span class="cx"> int end_stage)
</span><span class="cx"> {
</span><span class="cx"> int max_res = 0;
</span><span class="lines"> <at> <at> -206,7 +202,7 <at> <at>
</span><span class="cx"> return max_idx;
</span><span class="cx"> }
</span><span class="cx">
</span>-static int stage_cal_abs_pos(struct ad714x_chip *ad714x, int start_stage,
+static int ad714x_cal_abs_pos(struct ad714x_chip *ad714x, int start_stage,
<span class="cx"> int end_stage, int highest_stage, int max_coord)
</span><span class="cx"> {
</span><span class="cx"> int a_param, b_param;
</span><span class="lines"> <at> <at> -238,10 +234,10 <at> <at>
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span>-/* One button can connect to multi postive and negative of CDCs
- * Multi-buttons can connect to same postive/negative of one CDC
+/* One button can connect to multi positive and negative of CDCs
+ * Multi-buttons can connect to same positive/negative of one CDC
<span class="cx"> */
</span>-static void button_state_machine(struct ad714x_chip *ad714x, int idx)
+static void ad714x_button_state_machine(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> struct ad714x_button_plat *hw = &ad714x->hw->button[idx];
</span><span class="cx"> struct ad714x_button_drv *sw = &ad714x->sw->button[idx];
</span><span class="lines"> <at> <at> -250,7 +246,7 <at> <at>
</span><span class="cx"> case IDLE:
</span><span class="cx"> if (((ad714x->h_state & hw->h_mask) == hw->h_mask) &&
</span><span class="cx"> ((ad714x->l_state & hw->l_mask) == hw->l_mask)) {
</span>- pr_debug("button %d touched\n", idx);
+ dev_dbg(ad714x->dev, "button %d touched\n", idx);
<span class="cx"> input_report_key(sw->input, hw->keycode, 1);
</span><span class="cx"> input_sync(sw->input);
</span><span class="cx"> sw->state = ACTIVE;
</span><span class="lines"> <at> <at> -259,7 +255,7 <at> <at>
</span><span class="cx"> case ACTIVE:
</span><span class="cx"> if (((ad714x->h_state & hw->h_mask) != hw->h_mask) ||
</span><span class="cx"> ((ad714x->l_state & hw->l_mask) != hw->l_mask)) {
</span>- pr_debug("button %d released\n", idx);
+ dev_dbg(ad714x->dev, "button %d released\n", idx);
<span class="cx"> input_report_key(sw->input, hw->keycode, 0);
</span><span class="cx"> input_sync(sw->input);
</span><span class="cx"> sw->state = IDLE;
</span><span class="lines"> <at> <at> -273,15 +269,15 <at> <at>
</span><span class="cx"> /* The response of a sensor is defined by the absolute number of codes
</span><span class="cx"> * between the current CDC value and the ambient value.
</span><span class="cx"> */
</span>-void slider_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
+void ad714x_slider_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx];
</span><span class="cx"> int i;
</span><span class="cx">
</span><span class="cx"> for (i = hw->start_stage; i <= hw->end_stage; i++) {
</span>- ad714x->read(ad714x->bus, CDC_RESULT_S0 + i,
+ ad714x->read(ad714x->dev, CDC_RESULT_S0 + i,
<span class="cx"> &ad714x->adc_reg[i]);
</span>- ad714x->read(ad714x->bus,
+ ad714x->read(ad714x->dev,
<span class="cx"> STAGE0_AMBIENT + i * PER_STAGE_REG_NUM,
</span><span class="cx"> &ad714x->amb_reg[i]);
</span><span class="cx">
</span><span class="lines"> <at> <at> -290,15 +286,16 <at> <at>
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span>-void slider_cal_highest_stage(struct ad714x_chip *ad714x, int idx)
+void ad714x_slider_cal_highest_stage(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx];
</span><span class="cx"> struct ad714x_slider_drv *sw = &ad714x->sw->slider[idx];
</span><span class="cx">
</span>- sw->highest_stage = stage_cal_highest_stage(ad714x, hw->start_stage,
+ sw->highest_stage = ad714x_cal_highest_stage(ad714x, hw->start_stage,
<span class="cx"> hw->end_stage);
</span><span class="cx">
</span>- pr_debug("slider %d highest_stage:%d\n", idx, sw->highest_stage);
+ dev_dbg(ad714x->dev, "slider %d highest_stage:%d\n", idx,
+ sw->highest_stage);
<span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /* The formulae are very straight forward. It uses the sensor with the
</span><span class="lines"> <at> <at> -313,15 +310,16 <at> <at>
</span><span class="cx"> * w += Sensor response(i)
</span><span class="cx"> * POS=(Number_of_Positions_Wanted/(Number_of_Sensors_Used-1)) *(v/w)
</span><span class="cx"> */
</span>-void slider_cal_abs_pos(struct ad714x_chip *ad714x, int idx)
+void ad714x_slider_cal_abs_pos(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx];
</span><span class="cx"> struct ad714x_slider_drv *sw = &ad714x->sw->slider[idx];
</span><span class="cx">
</span>- sw->abs_pos = stage_cal_abs_pos(ad714x, hw->start_stage, hw->end_stage,
+ sw->abs_pos = ad714x_cal_abs_pos(ad714x, hw->start_stage, hw->end_stage,
<span class="cx"> sw->highest_stage, hw->max_coord);
</span><span class="cx">
</span>- pr_debug("slider %d absolute position:%d\n", idx, sw->abs_pos);
+ dev_dbg(ad714x->dev, "slider %d absolute position:%d\n", idx,
+ sw->abs_pos);
<span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /*
</span><span class="lines"> <at> <at> -334,29 +332,30 <at> <at>
</span><span class="cx"> * Filtered_CDC_result = (Filtered_CDC_result * (10 - Coefficient) +
</span><span class="cx"> * Latest_CDC_result * Coefficient)/10
</span><span class="cx"> */
</span>-void slider_cal_flt_pos(struct ad714x_chip *ad714x, int idx)
+void ad714x_slider_cal_flt_pos(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> struct ad714x_slider_drv *sw = &ad714x->sw->slider[idx];
</span><span class="cx">
</span><span class="cx"> sw->flt_pos = (sw->flt_pos * (10 - 4) +
</span><span class="cx"> sw->abs_pos * 4)/10;
</span><span class="cx">
</span>- pr_debug("slider %d filter position:%d\n", idx, sw->flt_pos);
+ dev_dbg(ad714x->dev, "slider %d filter position:%d\n", idx,
+ sw->flt_pos);
<span class="cx"> }
</span><span class="cx">
</span>-static void slider_use_com_int(struct ad714x_chip *ad714x, int idx)
+static void ad714x_slider_use_com_int(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx];
</span>- stage_use_com_int(ad714x, hw->start_stage, hw->end_stage);
+ ad714x_use_com_int(ad714x, hw->start_stage, hw->end_stage);
<span class="cx"> }
</span><span class="cx">
</span>-static void slider_use_thr_int(struct ad714x_chip *ad714x, int idx)
+static void ad714x_slider_use_thr_int(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx];
</span>- stage_use_thr_int(ad714x, hw->start_stage, hw->end_stage);
+ ad714x_use_thr_int(ad714x, hw->start_stage, hw->end_stage);
<span class="cx"> }
</span><span class="cx">
</span>-static void slider_state_machine(struct ad714x_chip *ad714x, int idx)
+static void ad714x_slider_state_machine(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx];
</span><span class="cx"> struct ad714x_slider_drv *sw = &ad714x->sw->slider[idx];
</span><span class="lines"> <at> <at> -372,18 +371,18 <at> <at>
</span><span class="cx"> case IDLE:
</span><span class="cx"> if (h_state) {
</span><span class="cx"> sw->state = JITTER;
</span>- /* In End of Conversion interrupt mode, the AD714x
+ /* In End of Conversion interrupt mode, the AD714X
<span class="cx"> * continuously generates hardware interrupts.
</span><span class="cx"> */
</span>- slider_use_com_int(ad714x, idx);
- pr_debug("slider %d touched\n", idx);
+ ad714x_slider_use_com_int(ad714x, idx);
+ dev_dbg(ad714x->dev, "slider %d touched\n", idx);
<span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> case JITTER:
</span><span class="cx"> if (c_state == mask) {
</span>- slider_cal_sensor_val(ad714x, idx);
- slider_cal_highest_stage(ad714x, idx);
- slider_cal_abs_pos(ad714x, idx);
+ ad714x_slider_cal_sensor_val(ad714x, idx);
+ ad714x_slider_cal_highest_stage(ad714x, idx);
+ ad714x_slider_cal_abs_pos(ad714x, idx);
<span class="cx"> sw->flt_pos = sw->abs_pos;
</span><span class="cx"> sw->state = ACTIVE;
</span><span class="cx"> }
</span><span class="lines"> <at> <at> -391,10 +390,10 <at> <at>
</span><span class="cx"> case ACTIVE:
</span><span class="cx"> if (c_state == mask) {
</span><span class="cx"> if (h_state) {
</span>- slider_cal_sensor_val(ad714x, idx);
- slider_cal_highest_stage(ad714x, idx);
- slider_cal_abs_pos(ad714x, idx);
- slider_cal_flt_pos(ad714x, idx);
+ ad714x_slider_cal_sensor_val(ad714x, idx);
+ ad714x_slider_cal_highest_stage(ad714x, idx);
+ ad714x_slider_cal_abs_pos(ad714x, idx);
+ ad714x_slider_cal_flt_pos(ad714x, idx);
<span class="cx">
</span><span class="cx"> input_report_abs(sw->input, ABS_X, sw->flt_pos);
</span><span class="cx"> input_report_abs(sw->input, ABS_PRESSURE, 1);
</span><span class="lines"> <at> <at> -402,10 +401,11 <at> <at>
</span><span class="cx"> /* When the user lifts off the sensor, configure
</span><span class="cx"> * the AD714X back to threshold interrupt mode.
</span><span class="cx"> */
</span>- slider_use_thr_int(ad714x, idx);
+ ad714x_slider_use_thr_int(ad714x, idx);
<span class="cx"> sw->state = IDLE;
</span><span class="cx"> input_report_abs(sw->input, ABS_PRESSURE, 0);
</span>- pr_debug("slider %d released\n", idx);
+ dev_dbg(ad714x->dev, "slider %d released\n",
+ idx);
<span class="cx"> }
</span><span class="cx"> input_sync(sw->input);
</span><span class="cx"> }
</span><span class="lines"> <at> <at> -421,27 +421,28 <at> <at>
</span><span class="cx"> * the scrollwheel. Then we determined the 2 sensors on either sides of the
</span><span class="cx"> * sensor with the highest response and we apply weights to these sensors.
</span><span class="cx"> */
</span>-void wheel_cal_highest_stage(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_cal_highest_stage(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx];
</span><span class="cx"> struct ad714x_wheel_drv *sw = &ad714x->sw->wheel[idx];
</span><span class="cx">
</span><span class="cx"> sw->pre_highest_stage = sw->highest_stage;
</span>- sw->highest_stage = stage_cal_highest_stage(ad714x, hw->start_stage,
+ sw->highest_stage = ad714x_cal_highest_stage(ad714x, hw->start_stage,
<span class="cx"> hw->end_stage);
</span><span class="cx">
</span>- pr_debug("wheel %d highest_stage:%d\n", idx, sw->highest_stage);
+ dev_dbg(ad714x->dev, "wheel %d highest_stage:%d\n", idx,
+ sw->highest_stage);
<span class="cx"> }
</span><span class="cx">
</span>-void wheel_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx];
</span><span class="cx"> int i;
</span><span class="cx">
</span><span class="cx"> for (i = hw->start_stage; i <= hw->end_stage; i++) {
</span>- ad714x->read(ad714x->bus, CDC_RESULT_S0 + i,
+ ad714x->read(ad714x->dev, CDC_RESULT_S0 + i,
<span class="cx"> &ad714x->adc_reg[i]);
</span>- ad714x->read(ad714x->bus,
+ ad714x->read(ad714x->dev,
<span class="cx"> STAGE0_AMBIENT + i * PER_STAGE_REG_NUM,
</span><span class="cx"> &ad714x->amb_reg[i]);
</span><span class="cx"> if (ad714x->adc_reg[i] > ad714x->amb_reg[i])
</span><span class="lines"> <at> <at> -470,7 +471,7 <at> <at>
</span><span class="cx"> #define WEIGHT_FACTOR 30
</span><span class="cx"> /* This constant prevents the "PositionOffset" from reaching a big value */
</span><span class="cx"> #define OFFSET_POSITION_CLAMP 120
</span>-void wheel_cal_abs_pos(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_cal_abs_pos(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx];
</span><span class="cx"> struct ad714x_wheel_drv *sw = &ad714x->sw->wheel[idx];
</span><span class="lines"> <at> <at> -554,7 +555,7 <at> <at>
</span><span class="cx"> sw->abs_pos = hw->max_coord;
</span><span class="cx"> }
</span><span class="cx">
</span>-void wheel_cal_flt_pos(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_cal_flt_pos(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx];
</span><span class="cx"> struct ad714x_wheel_drv *sw = &ad714x->sw->wheel[idx];
</span><span class="lines"> <at> <at> -570,19 +571,19 <at> <at>
</span><span class="cx"> sw->flt_pos = hw->max_coord;
</span><span class="cx"> }
</span><span class="cx">
</span>-static void wheel_use_com_int(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_use_com_int(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx];
</span>- stage_use_com_int(ad714x, hw->start_stage, hw->end_stage);
+ ad714x_use_com_int(ad714x, hw->start_stage, hw->end_stage);
<span class="cx"> }
</span><span class="cx">
</span>-static void wheel_use_thr_int(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_use_thr_int(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx];
</span>- stage_use_thr_int(ad714x, hw->start_stage, hw->end_stage);
+ ad714x_use_thr_int(ad714x, hw->start_stage, hw->end_stage);
<span class="cx"> }
</span><span class="cx">
</span>-static void wheel_state_machine(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_state_machine(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx];
</span><span class="cx"> struct ad714x_wheel_drv *sw = &ad714x->sw->wheel[idx];
</span><span class="lines"> <at> <at> -598,18 +599,18 <at> <at>
</span><span class="cx"> case IDLE:
</span><span class="cx"> if (h_state) {
</span><span class="cx"> sw->state = JITTER;
</span>- /* In End of Conversion interrupt mode, the AD714x
+ /* In End of Conversion interrupt mode, the AD714X
<span class="cx"> * continuously generates hardware interrupts.
</span><span class="cx"> */
</span>- wheel_use_com_int(ad714x, idx);
- pr_debug("wheel %d touched\n", idx);
+ ad714x_wheel_use_com_int(ad714x, idx);
+ dev_dbg(ad714x->dev, "wheel %d touched\n", idx);
<span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> case JITTER:
</span><span class="cx"> if (c_state == mask) {
</span>- wheel_cal_sensor_val(ad714x, idx);
- wheel_cal_highest_stage(ad714x, idx);
- wheel_cal_abs_pos(ad714x, idx);
+ ad714x_wheel_cal_sensor_val(ad714x, idx);
+ ad714x_wheel_cal_highest_stage(ad714x, idx);
+ ad714x_wheel_cal_abs_pos(ad714x, idx);
<span class="cx"> sw->flt_pos = sw->abs_pos;
</span><span class="cx"> sw->state = ACTIVE;
</span><span class="cx"> }
</span><span class="lines"> <at> <at> -617,9 +618,10 <at> <at>
</span><span class="cx"> case ACTIVE:
</span><span class="cx"> if (c_state == mask) {
</span><span class="cx"> if (h_state) {
</span>- wheel_cal_sensor_val(ad714x, idx);
- wheel_cal_highest_stage(ad714x, idx);
- wheel_cal_abs_pos(ad714x, idx);
+ ad714x_wheel_cal_sensor_val(ad714x, idx);
+ ad714x_wheel_cal_highest_stage(ad714x, idx);
+ ad714x_wheel_cal_abs_pos(ad714x, idx);
+ ad714x_wheel_cal_flt_pos(ad714x, idx);
<span class="cx">
</span><span class="cx"> input_report_abs(sw->input, ABS_WHEEL,
</span><span class="cx"> sw->abs_pos);
</span><span class="lines"> <at> <at> -628,11 +630,12 <at> <at>
</span><span class="cx"> /* When the user lifts off the sensor, configure
</span><span class="cx"> * the AD714X back to threshold interrupt mode.
</span><span class="cx"> */
</span>- wheel_use_thr_int(ad714x, idx);
+ ad714x_wheel_use_thr_int(ad714x, idx);
<span class="cx"> sw->state = IDLE;
</span><span class="cx"> input_report_abs(sw->input, ABS_PRESSURE, 0);
</span><span class="cx">
</span>- pr_debug("wheel %d released\n", idx);
+ dev_dbg(ad714x->dev, "wheel %d released\n",
+ idx);
<span class="cx"> }
</span><span class="cx"> input_sync(sw->input);
</span><span class="cx"> }
</span><span class="lines"> <at> <at> -642,15 +645,15 <at> <at>
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span>-void touchpad_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
+static void touchpad_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx];
</span><span class="cx"> int i;
</span><span class="cx">
</span><span class="cx"> for (i = hw->x_start_stage; i <= hw->x_end_stage; i++) {
</span>- ad714x->read(ad714x->bus, CDC_RESULT_S0 + i,
+ ad714x->read(ad714x->dev, CDC_RESULT_S0 + i,
<span class="cx"> &ad714x->adc_reg[i]);
</span>- ad714x->read(ad714x->bus,
+ ad714x->read(ad714x->dev,
<span class="cx"> STAGE0_AMBIENT + i * PER_STAGE_REG_NUM,
</span><span class="cx"> &ad714x->amb_reg[i]);
</span><span class="cx"> if (ad714x->adc_reg[i] > ad714x->amb_reg[i])
</span><span class="lines"> <at> <at> -666,13 +669,14 <at> <at>
</span><span class="cx"> struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx];
</span><span class="cx"> struct ad714x_touchpad_drv *sw = &ad714x->sw->touchpad[idx];
</span><span class="cx">
</span>- sw->x_highest_stage = stage_cal_highest_stage(ad714x, hw->x_start_stage,
- hw->x_end_stage);
- sw->y_highest_stage = stage_cal_highest_stage(ad714x, hw->y_start_stage,
- hw->y_end_stage);
+ sw->x_highest_stage = ad714x_cal_highest_stage(ad714x,
+ hw->x_start_stage, hw->x_end_stage);
+ sw->y_highest_stage = ad714x_cal_highest_stage(ad714x,
+ hw->y_start_stage, hw->y_end_stage);
<span class="cx">
</span>- pr_debug("touchpad %d x_highest_stage:%d, y_highest_stage:%d\n",
- idx, sw->x_highest_stage, sw->y_highest_stage);
+ dev_dbg(ad714x->dev,
+ "touchpad %d x_highest_stage:%d, y_highest_stage:%d\n",
+ idx, sw->x_highest_stage, sw->y_highest_stage);
<span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /* If 2 fingers are touching the sensor then 2 peaks can be observed in the
</span><span class="lines"> <at> <at> -723,12 +727,12 <at> <at>
</span><span class="cx"> struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx];
</span><span class="cx"> struct ad714x_touchpad_drv *sw = &ad714x->sw->touchpad[idx];
</span><span class="cx">
</span>- sw->x_abs_pos = stage_cal_abs_pos(ad714x, hw->x_start_stage,
+ sw->x_abs_pos = ad714x_cal_abs_pos(ad714x, hw->x_start_stage,
<span class="cx"> hw->x_end_stage, sw->x_highest_stage, hw->x_max_coord);
</span>- sw->y_abs_pos = stage_cal_abs_pos(ad714x, hw->y_start_stage,
+ sw->y_abs_pos = ad714x_cal_abs_pos(ad714x, hw->y_start_stage,
<span class="cx"> hw->y_end_stage, sw->y_highest_stage, hw->y_max_coord);
</span><span class="cx">
</span>- pr_debug("touchpad %d absolute position:(%d, %d)\n", idx,
+ dev_dbg(ad714x->dev, "touchpad %d absolute position:(%d, %d)\n", idx,
<span class="cx"> sw->x_abs_pos, sw->y_abs_pos);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines"> <at> <at> -741,7 +745,7 <at> <at>
</span><span class="cx"> sw->y_flt_pos = (sw->y_flt_pos * (10 - 4) +
</span><span class="cx"> sw->y_abs_pos * 4)/10;
</span><span class="cx">
</span>- pr_debug("touchpad %d filter position:(%d, %d)\n",
+ dev_dbg(ad714x->dev, "touchpad %d filter position:(%d, %d)\n",
<span class="cx"> idx, sw->x_flt_pos, sw->y_flt_pos);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines"> <at> <at> -756,12 +760,12 <at> <at>
</span><span class="cx"> * detection independent of the pressure.
</span><span class="cx"> */
</span><span class="cx">
</span>-#define LEFT_END_POINT_DETECTION_LEVEL 550
-#define RIGHT_END_POINT_DETECTION_LEVEL 750
-#define LEFT_RIGHT_END_POINT_DEAVTIVALION_LEVEL 850
-#define TOP_END_POINT_DETECTION_LEVEL 550
-#define BOTTOM_END_POINT_DETECTION_LEVEL 950
-#define TOP_BOTTOM_END_POINT_DEAVTIVALION_LEVEL 700
+#define LEFT_END_POINT_DETECTION_LEVEL 550
+#define RIGHT_END_POINT_DETECTION_LEVEL 750
+#define LEFT_RIGHT_END_POINT_DEAVTIVALION_LEVEL 850
+#define TOP_END_POINT_DETECTION_LEVEL 550
+#define BOTTOM_END_POINT_DETECTION_LEVEL 950
+#define TOP_BOTTOM_END_POINT_DEAVTIVALION_LEVEL 700
<span class="cx"> static int touchpad_check_endpoint(struct ad714x_chip *ad714x, int idx)
</span><span class="cx"> {
</span><span class="cx"> struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx];
</span><span class="lines"> <at> <at> -842,17 +846,17 <at> <at>
</span><span class="cx"> static void touchpad_use_com_int(struct ad714x_chip *ad714x, int idx)
</span><span class="cx"> {
</span><span class="cx"> struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx];
</span>- stage_use_com_int(ad714x, hw->x_start_stage, hw->x_end_stage);
+ ad714x_use_com_int(ad714x, hw->x_start_stage, hw->x_end_stage);
<span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static void touchpad_use_thr_int(struct ad714x_chip *ad714x, int idx)
</span><span class="cx"> {
</span><span class="cx"> struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx];
</span>- stage_use_thr_int(ad714x, hw->x_start_stage, hw->x_end_stage);
- stage_use_thr_int(ad714x, hw->y_start_stage, hw->y_end_stage);
+ ad714x_use_thr_int(ad714x, hw->x_start_stage, hw->x_end_stage);
+ ad714x_use_thr_int(ad714x, hw->y_start_stage, hw->y_end_stage);
<span class="cx"> }
</span><span class="cx">
</span>-static void touchpad_state_machine(struct ad714x_chip *ad714x, int idx)
+static void ad714x_touchpad_state_machine(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx];
</span><span class="cx"> struct ad714x_touchpad_drv *sw = &ad714x->sw->touchpad[idx];
</span><span class="lines"> <at> <at> -871,11 +875,11 <at> <at>
</span><span class="cx"> case IDLE:
</span><span class="cx"> if (h_state) {
</span><span class="cx"> sw->state = JITTER;
</span>- /* In End of Conversion interrupt mode, the AD714x
+ /* In End of Conversion interrupt mode, the AD714X
<span class="cx"> * continuously generates hardware interrupts.
</span><span class="cx"> */
</span><span class="cx"> touchpad_use_com_int(ad714x, idx);
</span>- pr_debug("touchpad %d touched\n", idx);
+ dev_dbg(ad714x->dev, "touchpad %d touched\n", idx);
<span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> case JITTER:
</span><span class="lines"> <at> <at> -884,8 +888,9 <at> <at>
</span><span class="cx"> touchpad_cal_highest_stage(ad714x, idx);
</span><span class="cx"> if ((!touchpad_check_second_peak(ad714x, idx)) &&
</span><span class="cx"> (!touchpad_check_endpoint(ad714x, idx))) {
</span>- pr_debug("touchpad%d, 2 fingers or endpoint\n",
- idx);
+ dev_dbg(ad714x->dev,
+ "touchpad%d, 2 fingers or endpoint\n",
+ idx);
<span class="cx"> touchpad_cal_abs_pos(ad714x, idx);
</span><span class="cx"> sw->x_flt_pos = sw->x_abs_pos;
</span><span class="cx"> sw->y_flt_pos = sw->y_abs_pos;
</span><span class="lines"> <at> <at> -916,7 +921,8 <at> <at>
</span><span class="cx"> touchpad_use_thr_int(ad714x, idx);
</span><span class="cx"> sw->state = IDLE;
</span><span class="cx"> input_report_abs(sw->input, ABS_PRESSURE, 0);
</span>- pr_debug("touchpad %d released\n", idx);
+ dev_dbg(ad714x->dev, "touchpad %d released\n",
+ idx);
<span class="cx"> }
</span><span class="cx"> input_sync(sw->input);
</span><span class="cx"> }
</span><span class="lines"> <at> <at> -930,24 +936,29 <at> <at>
</span><span class="cx"> {
</span><span class="cx"> unsigned short data;
</span><span class="cx">
</span>- ad714x->read(ad714x->bus, AD714x_PARTID_REG, &data);
+ ad714x->read(ad714x->dev, AD714X_PARTID_REG, &data);
<span class="cx"> switch (data & 0xFFF0) {
</span><span class="cx"> case AD7147_PARTID:
</span>- dev_info(&ad714x->bus->dev, "Found AD7147 captouch, rev:%d\n",
- data & 0xF);
+ ad714x->product = 0x7147;
+ ad714x->version = data & 0xF;
+ dev_info(ad714x->dev, "Found AD7147 captouch, rev:%d\n",
+ ad714x->version);
<span class="cx"> return 0;
</span><span class="cx"> case AD7142_PARTID:
</span>- dev_info(&ad714x->bus->dev, "Found AD7142 captouch, rev:%d\n",
- data & 0xF);
+ ad714x->product = 0x7142;
+ ad714x->version = data & 0xF;
+ dev_info(ad714x->dev, "Found AD7142 captouch, rev:%d\n",
+ ad714x->version);
<span class="cx"> return 0;
</span><span class="cx"> default:
</span>- dev_err(&ad714x->bus->dev, "Fail to detect AD714x captouch,\
- read ID is %04x\n", data);
+ dev_err(ad714x->dev,
+ "Fail to detect AD714X captouch, read ID is %04x\n",
+ data);
<span class="cx"> return -ENODEV;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span>-static int ad714x_hw_init(struct ad714x_chip *ad714x)
+static void __devinit ad714x_hw_init(struct ad714x_chip *ad714x)
<span class="cx"> {
</span><span class="cx"> int i, j;
</span><span class="cx"> unsigned short reg_base;
</span><span class="lines"> <at> <at> -956,24 +967,25 <at> <at>
</span><span class="cx"> /* configuration CDC and interrupts*/
</span><span class="cx">
</span><span class="cx"> for (i = 0; i < STAGE_NUM; i++) {
</span>- reg_base = AD714x_STAGECFG_REG + i * STAGE_CFGREG_NUM;
+ reg_base = AD714X_STAGECFG_REG + i * STAGE_CFGREG_NUM;
<span class="cx"> for (j = 0; j < STAGE_CFGREG_NUM; j++)
</span>- ad714x->write(ad714x->bus, reg_base + j,
- ad714x->hw->stage_cfg_reg[i][j]);
+ ad714x->write(ad714x->dev, reg_base + j,
+ ad714x->hw->stage_cfg_reg[i][j]);
<span class="cx"> }
</span><span class="cx">
</span><span class="cx"> for (i = 0; i < SYS_CFGREG_NUM; i++)
</span>- ad714x->write(ad714x->bus, AD714x_SYSCFG_REG + i,
+ ad714x->write(ad714x->dev, AD714X_SYSCFG_REG + i,
<span class="cx"> ad714x->hw->sys_cfg_reg[i]);
</span>+ for (i = 0; i < SYS_CFGREG_NUM; i++)
+ ad714x->read(ad714x->dev, AD714X_SYSCFG_REG + i,
+ &data);
<span class="cx">
</span>- ad714x->write(ad714x->bus, AD714x_STG_CAL_EN_REG, 0xFFF);
+ ad714x->write(ad714x->dev, AD714X_STG_CAL_EN_REG, 0xFFF);
<span class="cx">
</span><span class="cx"> /* clear all interrupts */
</span>- ad714x->read(ad714x->bus, STG_LOW_INT_STA_REG, &data);
- ad714x->read(ad714x->bus, STG_HIGH_INT_STA_REG, &data);
- ad714x->read(ad714x->bus, STG_COM_INT_STA_REG, &data);
-
- return 0;
+ ad714x->read(ad714x->dev, STG_LOW_INT_STA_REG, &data);
+ ad714x->read(ad714x->dev, STG_HIGH_INT_STA_REG, &data);
+ ad714x->read(ad714x->dev, STG_COM_INT_STA_REG, &data);
<span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static irqreturn_t ad714x_interrupt_thread(int irq, void *data)
</span><span class="lines"> <at> <at> -983,21 +995,18 <at> <at>
</span><span class="cx">
</span><span class="cx"> mutex_lock(&ad714x->mutex);
</span><span class="cx">
</span>- ad714x->read(ad714x->bus, STG_LOW_INT_STA_REG, &ad714x->l_state);
- ad714x->read(ad714x->bus, STG_HIGH_INT_STA_REG, &ad714x->h_state);
- ad714x->read(ad714x->bus, STG_COM_INT_STA_REG, &ad714x->c_state);
+ ad714x->read(ad714x->dev, STG_LOW_INT_STA_REG, &ad714x->l_state);
+ ad714x->read(ad714x->dev, STG_HIGH_INT_STA_REG, &ad714x->h_state);
+ ad714x->read(ad714x->dev, STG_COM_INT_STA_REG, &ad714x->c_state);
<span class="cx">
</span>- pr_debug("%s l_state:%04x h_state:%04x c_stage:%04x\n", __func__,
- ad714x->l_state, ad714x->h_state, ad714x->c_state);
-
<span class="cx"> for (i = 0; i < ad714x->hw->button_num; i++)
</span>- button_state_machine(ad714x, i);
+ ad714x_button_state_machine(ad714x, i);
<span class="cx"> for (i = 0; i < ad714x->hw->slider_num; i++)
</span>- slider_state_machine(ad714x, i);
+ ad714x_slider_state_machine(ad714x, i);
<span class="cx"> for (i = 0; i < ad714x->hw->wheel_num; i++)
</span>- wheel_state_machine(ad714x, i);
+ ad714x_wheel_state_machine(ad714x, i);
<span class="cx"> for (i = 0; i < ad714x->hw->touchpad_num; i++)
</span>- touchpad_state_machine(ad714x, i);
+ ad714x_touchpad_state_machine(ad714x, i);
<span class="cx">
</span><span class="cx"> mutex_unlock(&ad714x->mutex);
</span><span class="cx">
</span><span class="lines"> <at> <at> -1010,7 +1019,7 <at> <at>
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #define MAX_DEVICE_NUM 8
</span>-static int __devinit ad714x_probe(struct ad714x_chip *ad714x)
+static int __devinit ad714x_probe(struct ad714x_chip *ad714x, u16 bus_type)
<span class="cx"> {
</span><span class="cx"> int ret = 0;
</span><span class="cx"> struct input_dev *input[MAX_DEVICE_NUM];
</span><span class="lines"> <at> <at> -1034,13 +1043,30 <at> <at>
</span><span class="cx"> if (ret)
</span><span class="cx"> goto det_err;
</span><span class="cx">
</span>+ /* initilize and request sw/hw resources */
+
+ ad714x_hw_init(ad714x);
+ mutex_init(&ad714x->mutex);
+
+ if (ad714x->irq > 0) {
+ ret = request_threaded_irq(ad714x->irq, ad714x_interrupt,
+ ad714x_interrupt_thread, IRQF_TRIGGER_FALLING,
+ "ad714x_captouch", ad714x);
+ if (ret) {
+ dev_err(ad714x->dev, "Can't allocate irq %d\n",
+ ad714x->irq);
+ goto fail_irq;
+ }
+ } else
+ dev_err(ad714x->dev, "IRQ not configured!\n");
+
<span class="cx"> /*
</span>- * Allocate and register AD714x input device
+ * Allocate and register AD714X input device
<span class="cx"> */
</span><span class="cx">
</span><span class="cx"> drv_data = kzalloc(sizeof(struct ad714x_driver_data), GFP_KERNEL);
</span><span class="cx"> if (!drv_data) {
</span>- dev_err(&ad714x->bus->dev,
+ dev_err(ad714x->dev,
<span class="cx"> "Can't allocate memory for ad714x driver info\n");
</span><span class="cx"> ret = -ENOMEM;
</span><span class="cx"> goto fail_alloc_reg;
</span><span class="lines"> <at> <at> -1052,7 +1078,7 <at> <at>
</span><span class="cx"> sd_drv = kzalloc(sizeof(struct ad714x_slider_drv) *
</span><span class="cx"> ad714x->hw->slider_num, GFP_KERNEL);
</span><span class="cx"> if (!sd_drv) {
</span>- dev_err(&ad714x->bus->dev,
+ dev_err(ad714x->dev,
<span class="cx"> "Can't allocate memory for slider info\n");
</span><span class="cx"> ret = -ENOMEM;
</span><span class="cx"> goto fail_alloc_reg;
</span><span class="lines"> <at> <at> -1061,7 +1087,7 <at> <at>
</span><span class="cx"> for (i = 0; i < ad714x->hw->slider_num; i++) {
</span><span class="cx"> input[alloc_idx] = input_allocate_device();
</span><span class="cx"> if (!input[alloc_idx]) {
</span>- dev_err(&ad714x->bus->dev,
+ dev_err(ad714x->dev,
<span class="cx"> "Can't allocate input device %d\n", alloc_idx);
</span><span class="cx"> ret = -ENOMEM;
</span><span class="cx"> goto fail_alloc_reg;
</span><span class="lines"> <at> <at> -1076,12 +1102,14 <at> <at>
</span><span class="cx"> input_set_abs_params(input[alloc_idx-1], ABS_PRESSURE,
</span><span class="cx"> 0, 1, 0, 0);
</span><span class="cx">
</span>- input[alloc_idx-1]->id.bustype = BUS_I2C;
+ input[alloc_idx-1]->id.bustype = bus_type;
+ input[alloc_idx-1]->id.product = ad714x->product;
+ input[alloc_idx-1]->id.version = ad714x->version;
<span class="cx">
</span><span class="cx"> ret = input_register_device(input[reg_idx]);
</span><span class="cx"> if (ret) {
</span>- dev_err(&ad714x->bus->dev,
- "Failed to register AD714x input device!\n");
+ dev_err(ad714x->dev,
+ "Failed to register AD714X input device!\n");
<span class="cx"> goto fail_alloc_reg;
</span><span class="cx"> }
</span><span class="cx"> reg_idx++;
</span><span class="lines"> <at> <at> -1096,7 +1124,7 <at> <at>
</span><span class="cx"> wl_drv = kzalloc(sizeof(struct ad714x_wheel_drv) *
</span><span class="cx"> ad714x->hw->wheel_num, GFP_KERNEL);
</span><span class="cx"> if (!wl_drv) {
</span>- dev_err(&ad714x->bus->dev,
+ dev_err(ad714x->dev,
<span class="cx"> "Can't allocate memory for wheel info\n");
</span><span class="cx"> ret = -ENOMEM;
</span><span class="cx"> goto fail_alloc_reg;
</span><span class="lines"> <at> <at> -1105,7 +1133,7 <at> <at>
</span><span class="cx"> for (i = 0; i < ad714x->hw->wheel_num; i++) {
</span><span class="cx"> input[alloc_idx] = input_allocate_device();
</span><span class="cx"> if (!input[alloc_idx]) {
</span>- dev_err(&ad714x->bus->dev,
+ dev_err(ad714x->dev,
<span class="cx"> "Can't allocate input device %d\n", alloc_idx);
</span><span class="cx"> ret = -ENOMEM;
</span><span class="cx"> goto fail_alloc_reg;
</span><span class="lines"> <at> <at> -1120,12 +1148,14 <at> <at>
</span><span class="cx"> input_set_abs_params(input[alloc_idx-1], ABS_PRESSURE,
</span><span class="cx"> 0, 1, 0, 0);
</span><span class="cx">
</span>- input[alloc_idx-1]->id.bustype = BUS_I2C;
+ input[alloc_idx-1]->id.bustype = bus_type;
+ input[alloc_idx-1]->id.product = ad714x->product;
+ input[alloc_idx-1]->id.version = ad714x->version;
<span class="cx">
</span><span class="cx"> ret = input_register_device(input[reg_idx]);
</span><span class="cx"> if (ret) {
</span>- dev_err(&ad714x->bus->dev,
- "Failed to register AD714x input device!\n");
+ dev_err(ad714x->dev,
+ "Failed to register AD714X input device!\n");
<span class="cx"> goto fail_alloc_reg;
</span><span class="cx"> }
</span><span class="cx"> reg_idx++;
</span><span class="lines"> <at> <at> -1140,7 +1170,7 <at> <at>
</span><span class="cx"> tp_drv = kzalloc(sizeof(struct ad714x_touchpad_drv) *
</span><span class="cx"> ad714x->hw->touchpad_num, GFP_KERNEL);
</span><span class="cx"> if (!tp_drv) {
</span>- dev_err(&ad714x->bus->dev,
+ dev_err(ad714x->dev,
<span class="cx"> "Can't allocate memory for touchpad info\n");
</span><span class="cx"> ret = -ENOMEM;
</span><span class="cx"> goto fail_alloc_reg;
</span><span class="lines"> <at> <at> -1149,7 +1179,7 <at> <at>
</span><span class="cx"> for (i = 0; i < ad714x->hw->touchpad_num; i++) {
</span><span class="cx"> input[alloc_idx] = input_allocate_device();
</span><span class="cx"> if (!input[alloc_idx]) {
</span>- dev_err(&ad714x->bus->dev,
+ dev_err(ad714x->dev,
<span class="cx"> "Can't allocate input device %d\n",
</span><span class="cx"> alloc_idx);
</span><span class="cx"> ret = -ENOMEM;
</span><span class="lines"> <at> <at> -1168,12 +1198,14 <at> <at>
</span><span class="cx"> input_set_abs_params(input[alloc_idx-1], ABS_PRESSURE,
</span><span class="cx"> 0, 1, 0, 0);
</span><span class="cx">
</span>- input[alloc_idx-1]->id.bustype = BUS_I2C;
+ input[alloc_idx-1]->id.bustype = bus_type;
+ input[alloc_idx-1]->id.product = ad714x->product;
+ input[alloc_idx-1]->id.version = ad714x->version;
<span class="cx">
</span><span class="cx"> ret = input_register_device(input[reg_idx]);
</span><span class="cx"> if (ret) {
</span>- dev_err(&ad714x->bus->dev,
- "Failed to register AD714x input device!\n");
+ dev_err(ad714x->dev,
+ "Failed to register AD714X input device!\n");
<span class="cx"> goto fail_alloc_reg;
</span><span class="cx"> }
</span><span class="cx"> reg_idx++;
</span><span class="lines"> <at> <at> -1188,7 +1220,7 <at> <at>
</span><span class="cx"> bt_drv = kzalloc(sizeof(struct ad714x_button_drv) *
</span><span class="cx"> ad714x->hw->button_num, GFP_KERNEL);
</span><span class="cx"> if (!bt_drv) {
</span>- dev_err(&ad714x->bus->dev,
+ dev_err(ad714x->dev,
<span class="cx"> "Can't allocate memory for button info\n");
</span><span class="cx"> ret = -ENOMEM;
</span><span class="cx"> goto fail_alloc_reg;
</span><span class="lines"> <at> <at> -1196,7 +1228,7 <at> <at>
</span><span class="cx">
</span><span class="cx"> input[alloc_idx] = input_allocate_device();
</span><span class="cx"> if (!input[alloc_idx]) {
</span>- dev_err(&ad714x->bus->dev,
+ dev_err(ad714x->dev,
<span class="cx"> "Can't allocate input device %d\n",
</span><span class="cx"> alloc_idx);
</span><span class="cx"> ret = -ENOMEM;
</span><span class="lines"> <at> <at> -1210,12 +1242,14 <at> <at>
</span><span class="cx"> input[alloc_idx-1]->keybit);
</span><span class="cx"> }
</span><span class="cx">
</span>- input[alloc_idx-1]->id.bustype = BUS_I2C;
+ input[alloc_idx-1]->id.bustype = bus_type;
+ input[alloc_idx-1]->id.product = ad714x->product;
+ input[alloc_idx-1]->id.version = ad714x->version;
<span class="cx">
</span><span class="cx"> ret = input_register_device(input[reg_idx]);
</span><span class="cx"> if (ret) {
</span>- dev_err(&ad714x->bus->dev,
- "Failed to register AD714x input device!\n");
+ dev_err(ad714x->dev,
+ "Failed to register AD714X input device!\n");
<span class="cx"> goto fail_alloc_reg;
</span><span class="cx"> }
</span><span class="cx"> reg_idx++;
</span><span class="lines"> <at> <at> -1225,36 +1259,23 <at> <at>
</span><span class="cx"> ad714x->sw->button = bt_drv;
</span><span class="cx"> }
</span><span class="cx">
</span>- /* initilize and request sw/hw resources */
<span class="cx">
</span>- ad714x_hw_init(ad714x);
- mutex_init(&ad714x->mutex);
-
- if (ad714x->bus->irq > 0) {
- ret = request_threaded_irq(ad714x->bus->irq, ad714x_interrupt,
- ad714x_interrupt_thread, IRQF_TRIGGER_FALLING,
- "ad714x_captouch", ad714x);
- if (ret) {
- dev_err(&ad714x->bus->dev, "Can't allocate irq %d\n",
- ad714x->bus->irq);
- goto fail_irq;
- }
- } else
- dev_warn(&ad714x->bus->dev, "IRQ not configured!\n");
-
<span class="cx"> return 0;
</span><span class="cx">
</span>-fail_irq:
<span class="cx"> fail_alloc_reg:
</span><span class="cx"> for (i = 0; i < reg_idx; i++)
</span><span class="cx"> input_unregister_device(input[i]);
</span><span class="cx"> for (i = 0; i < alloc_idx; i++)
</span><span class="cx"> input_free_device(input[i]);
</span>- kfree(bt_drv); /* kfree(NULL) is safe check is not required */
+
+ kfree(bt_drv);
<span class="cx"> kfree(sd_drv);
</span><span class="cx"> kfree(wl_drv);
</span><span class="cx"> kfree(tp_drv);
</span><span class="cx"> kfree(drv_data);
</span>+
+ free_irq(ad714x->irq, ad714x);
+fail_irq:
<span class="cx"> det_err:
</span><span class="cx"> return ret;
</span><span class="cx"> }
</span><span class="lines"> <at> <at> -1269,11 +1290,7 <at> <at>
</span><span class="cx"> struct ad714x_wheel_drv *wl_drv = ad714x->sw->wheel;
</span><span class="cx"> struct ad714x_touchpad_drv *tp_drv = ad714x->sw->touchpad;
</span><span class="cx">
</span>- /* free irq hardware resource */
<span class="cx">
</span>- if (ad714x->bus->irq > 0)
- free_irq(ad714x->bus->irq, ad714x);
-
<span class="cx"> /* unregister and free all input devices */
</span><span class="cx">
</span><span class="cx"> for (i = 0; i < ad714x->hw->slider_num; i++) {
</span><span class="lines"> <at> <at> -1295,119 +1312,132 <at> <at>
</span><span class="cx"> input_free_device(ad714x->sw->button[0].input);
</span><span class="cx">
</span><span class="cx"> /* free all memories for software flow */
</span>- kfree(bt_drv); /* kfree(NULL) is safe check is not required */
+
+ kfree(bt_drv);
<span class="cx"> kfree(sd_drv);
</span><span class="cx"> kfree(wl_drv);
</span><span class="cx"> kfree(tp_drv);
</span><span class="cx"> kfree(drv_data);
</span>- kfree(ad714x);
<span class="cx">
</span>+ /* free irq hardware resource */
+
+ free_irq(ad714x->irq, ad714x);
+
<span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #ifdef CONFIG_PM
</span>-static int ad714x_suspend(bus_device *bus, pm_message_t message)
+static int ad714x_disable(struct ad714x_chip *ad714x)
<span class="cx"> {
</span>- struct ad714x_chip *ad714x = dev_get_drvdata(&bus->dev);
<span class="cx"> unsigned short data;
</span><span class="cx">
</span>- pr_debug("%s enter\n", __func__);
+ dev_dbg(ad714x->dev, "%s enter\n", __func__);
<span class="cx">
</span><span class="cx"> mutex_lock(&ad714x->mutex);
</span><span class="cx">
</span><span class="cx"> data = ad714x->hw->sys_cfg_reg[AD714X_PWR_CTRL] | 0x3;
</span>- ad714x->write(bus, AD714X_PWR_CTRL, data);
+ ad714x->write(ad714x->dev, AD714X_PWR_CTRL, data);
<span class="cx">
</span><span class="cx"> mutex_unlock(&ad714x->mutex);
</span><span class="cx">
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span>-static int ad714x_resume(bus_device *bus)
+static int ad714x_enable(struct ad714x_chip *ad714x)
<span class="cx"> {
</span>- struct ad714x_chip *ad714x = dev_get_drvdata(&bus->dev);
<span class="cx"> unsigned short data;
</span><span class="cx">
</span>- pr_debug("%s enter\n", __func__);
+ dev_dbg(ad714x->dev, "%s enter\n", __func__);
<span class="cx">
</span><span class="cx"> mutex_lock(&ad714x->mutex);
</span><span class="cx">
</span><span class="cx"> /* resume to non-shutdown mode */
</span><span class="cx">
</span>- ad714x->write(bus, AD714X_PWR_CTRL,
+ ad714x->write(ad714x->dev, AD714X_PWR_CTRL,
<span class="cx"> ad714x->hw->sys_cfg_reg[AD714X_PWR_CTRL]);
</span><span class="cx">
</span><span class="cx"> /* make sure the interrupt output line is not low level after resume,
</span><span class="cx"> * otherwise we will get no chance to enter falling-edge irq again
</span><span class="cx"> */
</span><span class="cx">
</span>- ad714x->read(bus, STG_LOW_INT_STA_REG, &data);
- ad714x->read(bus, STG_HIGH_INT_STA_REG, &data);
- ad714x->read(bus, STG_COM_INT_STA_REG, &data);
+ ad714x->read(ad714x->dev, STG_LOW_INT_STA_REG, &data);
+ ad714x->read(ad714x->dev, STG_HIGH_INT_STA_REG, &data);
+ ad714x->read(ad714x->dev, STG_COM_INT_STA_REG, &data);
<span class="cx">
</span><span class="cx"> mutex_unlock(&ad714x->mutex);
</span><span class="cx">
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span>-#else
-#define ad714x_suspend NULL
-#define ad714x_resume NULL
-#endif
<span class="cx">
</span>-#if defined(CONFIG_INPUT_AD714X_SPI)
-int ad714x_spi_read(struct spi_device *spi, unsigned short reg,
- unsigned short *data)
+#if defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)
+static int ad714x_spi_suspend(struct spi_device *spi, pm_message_t message)
<span class="cx"> {
</span>- int ret;
- unsigned short tx[2];
- unsigned short rx[2];
- struct spi_transfer t = {
- .tx_buf = tx,
- .rx_buf = rx,
- .len = 4,
- };
- struct spi_message m;
+ struct ad714x_chip *ad714x = spi_get_drvdata(spi);
<span class="cx">
</span>- tx[0] = (AD714x_SPI_ADDR << AD714x_SPI_ADDR_SHFT) |
- (AD714x_SPI_READ << AD714x_SPI_READ_SHFT) | reg;
+ ad714x_disable(ad714x);
<span class="cx">
</span>- spi_message_init(&m);
- spi_message_add_tail(&t, &m);
- ret = spi_sync(spi, &m);
+ return 0;
+}
<span class="cx">
</span>- if (ret < 0) {
- dev_err(&spi->dev, "SPI read error\n");
- return ret;
- }
+static int ad714x_spi_resume(struct spi_device *spi)
+{
+ struct ad714x_chip *ad714x = spi_get_drvdata(spi);
<span class="cx">
</span>- *data = rx[1];
- return ret;
+ ad714x_enable(ad714x);
+
+ return 0;
<span class="cx"> }
</span>+#endif
<span class="cx">
</span>-int ad714x_spi_write(struct spi_device *spi, unsigned short reg,
- unsigned short data)
+#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+static int ad714x_i2c_suspend(struct i2c_client *client, pm_message_t message)
<span class="cx"> {
</span>- int ret = 0;
- unsigned short tx[2];
- struct spi_transfer t = {
- .tx_buf = tx,
- .len = 4,
- };
- struct spi_message m;
+ struct ad714x_chip *ad714x = i2c_get_clientdata(client);
<span class="cx">
</span>- tx[0] = (AD714x_SPI_ADDR << AD714x_SPI_ADDR_SHFT) | reg;
- tx[1] = data;
+ ad714x_disable(ad714x);
<span class="cx">
</span>- spi_message_init(&m);
- spi_message_add_tail(&t, &m);
+ return 0;
+}
<span class="cx">
</span>- ret = spi_sync(spi, &m);
- if (ret < 0)
- dev_err(&spi->dev, "SPI write error\n");
+static int ad714x_i2c_resume(struct i2c_client *client)
+{
+ struct ad714x_chip *ad714x = i2c_get_clientdata(client);
<span class="cx">
</span>- return ret;
+ ad714x_enable(ad714x);
+
+ return 0;
<span class="cx"> }
</span>+#endif
<span class="cx">
</span>+#else
+#define ad714x_spi_suspend NULL
+#define ad714x_spi_resume NULL
+#define ad714x_i2c_suspend NULL
+#define ad714x_i2c_resume NULL
+#endif
+
+#if defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)
+static int ad714x_spi_read(struct device *dev, unsigned short reg,
+ unsigned short *data)
+{
+ struct spi_device *spi = to_spi_device(dev);
+ unsigned short tx = AD714x_SPI_CMD_PREFIX | AD714x_SPI_READ | reg;
+
+ return spi_write_then_read(spi, (u8 *)&tx, 2, (u8 *)data, 2);
+}
+
+static int ad714x_spi_write(struct device *dev, unsigned short reg,
+ unsigned short data)
+{
+ struct spi_device *spi = to_spi_device(dev);
+ unsigned short tx[2] = {
+ AD714x_SPI_CMD_PREFIX | reg,
+ data
+ };
+
+ return spi_write(spi, (u8 *)tx, 4);
+}
+
<span class="cx"> static int __devinit ad714x_spi_probe(struct spi_device *spi)
</span><span class="cx"> {
</span><span class="cx"> int ret = 0;
</span><span class="lines"> <at> <at> -1422,14 +1452,15 <at> <at>
</span><span class="cx"> if (!chip)
</span><span class="cx"> return -ENOMEM;
</span><span class="cx">
</span>- chip->bus = spi;
<span class="cx"> chip->read = ad714x_spi_read;
</span><span class="cx"> chip->write = ad714x_spi_write;
</span><span class="cx"> chip->hw = spi->dev.platform_data;
</span>+ chip->irq = spi->irq;
+ chip->dev = &spi->dev;
<span class="cx"> spi_set_drvdata(spi, chip);
</span><span class="cx">
</span><span class="cx"> /* common probe not related with spi/i2c */
</span>- ret = ad714x_probe(chip);
+ ret = ad714x_probe(chip, BUS_SPI);
<span class="cx"> if (ret)
</span><span class="cx"> kfree(chip);
</span><span class="cx">
</span><span class="lines"> <at> <at> -1439,52 +1470,42 <at> <at>
</span><span class="cx"> static int __devexit ad714x_spi_remove(struct spi_device *spi)
</span><span class="cx"> {
</span><span class="cx"> struct ad714x_chip *chip = spi_get_drvdata(spi);
</span>+
<span class="cx"> ad714x_remove(chip);
</span><span class="cx">
</span>+ kfree(chip);
+
<span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static struct spi_driver ad714x_spi_driver = {
</span><span class="cx"> .driver = {
</span><span class="cx"> .name = "ad714x_captouch",
</span>- .bus = &spi_bus_type,
<span class="cx"> .owner = THIS_MODULE,
</span><span class="cx"> },
</span><span class="cx"> .probe = ad714x_spi_probe,
</span><span class="cx"> .remove = __devexit_p(ad714x_spi_remove),
</span>- .suspend = ad714x_suspend,
- .resume = ad714x_resume,
+ .suspend = ad714x_spi_suspend,
+ .resume = ad714x_spi_resume,
<span class="cx"> };
</span>+#endif
<span class="cx">
</span>-static int __init ad714x_init(void)
-{
- int ret;
<span class="cx">
</span>- ret = spi_register_driver(&ad714x_spi_driver);
- if (ret != 0) {
- printk(KERN_ERR "Failed to register ad714x SPI driver: %d\n",
- ret);
- }
-
- return ret;
-}
-
-static void __exit ad714x_exit(void)
-{
- spi_unregister_driver(&ad714x_spi_driver);
-}
-#else
-static int ad714x_i2c_write(struct i2c_client *client, unsigned short reg,
+#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+static int ad714x_i2c_write(struct device *dev, unsigned short reg,
<span class="cx"> unsigned short data)
</span><span class="cx"> {
</span>+ struct i2c_client *client = to_i2c_client(dev);
<span class="cx"> int ret = 0;
</span>- u8 tx[4];
+ u8 *_reg = (u8 *)&reg;
+ u8 *_data = (u8 *)&data;
<span class="cx">
</span>- /* Do raw I2C, not smbus compatible */
- tx[0] = (reg & 0xFF00) >> 8;
- tx[1] = (reg & 0x00FF);
- tx[2] = (data & 0xFF00) >> 8;
- tx[3] = data & 0x00FF;
+ u8 tx[4] = {
+ _reg[1],
+ _reg[0],
+ _data[1],
+ _data[0]
+ };
<span class="cx">
</span><span class="cx"> ret = i2c_master_send(client, tx, 4);
</span><span class="cx"> if (ret < 0)
</span><span class="lines"> <at> <at> -1493,17 +1514,20 <at> <at>
</span><span class="cx"> return ret;
</span><span class="cx"> }
</span><span class="cx">
</span>-static int ad714x_i2c_read(struct i2c_client *client, unsigned short reg,
+static int ad714x_i2c_read(struct device *dev, unsigned short reg,
<span class="cx"> unsigned short *data)
</span><span class="cx"> {
</span>+ struct i2c_client *client = to_i2c_client(dev);
<span class="cx"> int ret = 0;
</span>- u8 tx[2];
+ u8 *_reg = (u8 *)&reg;
+ u8 *_data = (u8 *)data;
+
+ u8 tx[2] = {
+ _reg[1],
+ _reg[0]
+ };
<span class="cx"> u8 rx[2];
</span><span class="cx">
</span>- /* Do raw I2C, not smbus compatible */
- tx[0] = (reg & 0xFF00) >> 8;
- tx[1] = (reg & 0x00FF);
-
<span class="cx"> ret = i2c_master_send(client, tx, 2);
</span><span class="cx"> if (ret < 0) {
</span><span class="cx"> dev_err(&client->dev, "I2C read error\n");
</span><span class="lines"> <at> <at> -1516,8 +1540,8 <at> <at>
</span><span class="cx"> return ret;
</span><span class="cx"> }
</span><span class="cx">
</span>- *data = rx[0];
- *data = (*data << 8) | rx[1];
+ _data[0] = rx[1];
+ _data[1] = rx[0];
<span class="cx">
</span><span class="cx"> return ret;
</span><span class="cx"> }
</span><span class="lines"> <at> <at> -1538,14 +1562,15 <at> <at>
</span><span class="cx"> if (!chip)
</span><span class="cx"> return -ENOMEM;
</span><span class="cx">
</span>- chip->bus = client;
<span class="cx"> chip->read = ad714x_i2c_read;
</span><span class="cx"> chip->write = ad714x_i2c_write;
</span><span class="cx"> chip->hw = client->dev.platform_data;
</span>+ chip->irq = client->irq;
+ chip->dev = &client->dev;
<span class="cx"> i2c_set_clientdata(client, chip);
</span><span class="cx">
</span><span class="cx"> /* common probe not related with spi/i2c */
</span>- ret = ad714x_probe(chip);
+ ret = ad714x_probe(chip, BUS_I2C);
<span class="cx"> if (ret)
</span><span class="cx"> kfree(chip);
</span><span class="cx">
</span><span class="lines"> <at> <at> -1555,13 +1580,17 <at> <at>
</span><span class="cx"> static int __devexit ad714x_i2c_remove(struct i2c_client *client)
</span><span class="cx"> {
</span><span class="cx"> struct ad714x_chip *chip = i2c_get_clientdata(client);
</span>+
<span class="cx"> ad714x_remove(chip);
</span><span class="cx">
</span>+ kfree(chip);
+
<span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static const struct i2c_device_id ad714x_id[] = {
</span>- { "ad714x_captouch", 0 },
+ { "ad7142_captouch", 0 },
+ { "ad7147_captouch", 0 },
<span class="cx"> { }
</span><span class="cx"> };
</span><span class="cx"> MODULE_DEVICE_TABLE(i2c, ad714x_id);
</span><span class="lines"> <at> <at> -1570,27 +1599,54 <at> <at>
</span><span class="cx"> .driver = {
</span><span class="cx"> .name = "ad714x_captouch",
</span><span class="cx"> },
</span>- .probe = ad714x_i2c_probe,
- .remove = __devexit_p(ad714x_i2c_remove),
- .suspend = ad714x_suspend,
- .resume = ad714x_resume,
+ .probe = ad714x_i2c_probe,
+ .remove = __devexit_p(ad714x_i2c_remove),
+ .suspend = ad714x_i2c_suspend,
+ .resume = ad714x_i2c_resume,
<span class="cx"> .id_table = ad714x_id,
</span><span class="cx"> };
</span>+#endif
<span class="cx">
</span><span class="cx"> static int __init ad714x_init(void)
</span><span class="cx"> {
</span>+#if (defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)) && \
+ !(defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE))
+ return spi_register_driver(&ad714x_spi_driver);
+#endif
+
+#if (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)) && \
+ !(defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE))
<span class="cx"> return i2c_add_driver(&ad714x_i2c_driver);
</span>+#endif
+
+#if (defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)) && \
+ (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE))
+ int ret = 0;
+ ret = spi_register_driver(&ad714x_spi_driver);
+ if (ret)
+ goto err;
+ ret = i2c_add_driver(&ad714x_i2c_driver);
+ if (ret)
+ spi_unregister_driver(&ad714x_spi_driver);
+err:
+ return ret;
+#endif
<span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static void __exit ad714x_exit(void)
</span><span class="cx"> {
</span>+#if defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)
+ spi_unregister_driver(&ad714x_spi_driver);
+#endif
+
+#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
<span class="cx"> i2c_del_driver(&ad714x_i2c_driver);
</span>+#endif
<span class="cx"> }
</span>-#endif
<span class="cx">
</span><span class="cx"> module_init(ad714x_init);
</span><span class="cx"> module_exit(ad714x_exit);
</span><span class="cx">
</span>-MODULE_DESCRIPTION("ad714x captouch driver");
+MODULE_DESCRIPTION("Analog Devices AD714X Capacitance Touch Sensor Driver");
<span class="cx"> MODULE_AUTHOR("Barry Song <21cnbao@...>");
</span><span class="cx"> MODULE_LICENSE("GPL");
</span></span>
</div>
<a></a>
<div class="copfile">
<h4>Copied: trunk/include/linux/input/ad714x.h (from rev 7259, trunk/include/linux/spi/ad714x.h) (0 => 7260)</h4>
<span>
<span class="info">--- trunk/include/linux/input/ad714x.h (rev 0)
+++ trunk/include/linux/input/ad714x.h 2009-09-02 21:47:05 UTC (rev 7260)
</span><span class="lines"> <at> <at> -0,0 +1,62 <at> <at>
</span>+/*
+ * include/linux/input/ad714x.h
+ *
+ * AD714x is very flexible, it can be used as buttons, scrollwheel,
+ * slider, touchpad at the same time. That depends on the boards.
+ * The platform_data for the device's "struct device" holds this
+ * information.
+ * Copyright 2009 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#ifndef __LINUX_INPUT_AD714X_H__
+#define __LINUX_INPUT_AD714X_H__
+
+#define STAGE_NUM 12
+#define STAGE_CFGREG_NUM 8
+#define SYS_CFGREG_NUM 8
+
+/* board information which need be initialized in arch/mach... */
+struct ad714x_slider_plat {
+ int start_stage;
+ int end_stage;
+ int max_coord;
+};
+
+struct ad714x_wheel_plat {
+ int start_stage;
+ int end_stage;
+ int max_coord;
+};
+
+struct ad714x_touchpad_plat {
+ int x_start_stage;
+ int x_end_stage;
+ int x_max_coord;
+
+ int y_start_stage;
+ int y_end_stage;
+ int y_max_coord;
+};
+
+struct ad714x_button_plat {
+ int keycode;
+ unsigned short l_mask;
+ unsigned short h_mask;
+};
+
+struct ad714x_platform_data {
+ int slider_num;
+ int wheel_num;
+ int touchpad_num;
+ int button_num;
+ struct ad714x_slider_plat *slider;
+ struct ad714x_wheel_plat *wheel;
+ struct ad714x_touchpad_plat *touchpad;
+ struct ad714x_button_plat *button;
+ unsigned short stage_cfg_reg[STAGE_NUM][STAGE_CFGREG_NUM];
+ unsigned short sys_cfg_reg[SYS_CFGREG_NUM];
+};
+
+#endif
</span>
</div>
<a></a>
<div class="propset">
<h4>Property changes: trunk/include/linux/input/ad714x.h</h4>
<span>
</span>
</div>
<a></a>
<div class="addfile"><h4>Added: svn:mergeinfo</h4></div>
<a></a>
<div class="delfile">
<h4>Deleted: trunk/include/linux/spi/ad714x.h (7259 => 7260)</h4>
<span>
<span class="info">--- trunk/include/linux/spi/ad714x.h 2009-09-02 08:14:05 UTC (rev 7259)
+++ trunk/include/linux/spi/ad714x.h 2009-09-02 21:47:05 UTC (rev 7260)
</span><span class="lines"> <at> <at> -1,62 +0,0 <at> <at>
</span>-/*
- * include/linux/ad714x.h
- *
- * AD714x is very flexible, it can be used as buttons, scrollwheel,
- * slider, touchpad at the same time. That depends on the boards.
- * The platform_data for the device's "struct device" holds this
- * information.
- * Copyright 2009 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later.
- */
-
-#ifndef __LINUX_SPI_AD714X_H__
-#define __LINUX_SPI_AD714X_H__
-
-#define STAGE_NUM 12
-#define STAGE_CFGREG_NUM 8
-#define SYS_CFGREG_NUM 8
-
-/* board information which need be initialized in arch/mach... */
-struct ad714x_slider_plat {
- int start_stage;
- int end_stage;
- int max_coord;
-};
-
-struct ad714x_wheel_plat {
- int start_stage;
- int end_stage;
- int max_coord;
-};
-
-struct ad714x_touchpad_plat {
- int x_start_stage;
- int x_end_stage;
- int x_max_coord;
-
- int y_start_stage;
- int y_end_stage;
- int y_max_coord;
-};
-
-struct ad714x_button_plat {
- int keycode;
- unsigned short l_mask;
- unsigned short h_mask;
-};
-
-struct ad714x_platform_data {
- int slider_num;
- int wheel_num;
- int touchpad_num;
- int button_num;
- struct ad714x_slider_plat *slider;
- struct ad714x_wheel_plat *wheel;
- struct ad714x_touchpad_plat *touchpad;
- struct ad714x_button_plat *button;
- unsigned short stage_cfg_reg[STAGE_NUM][STAGE_CFGREG_NUM];
- unsigned short sys_cfg_reg[SYS_CFGREG_NUM];
-};
-
-#endif
</span>
</div>
</div>
</div>