Commit c77fd0a4 authored by Matt Ranostay's avatar Matt Ranostay Committed by Dmitry Torokhov

Input: rename cap1106 driver to cap11xx

There are several devices in cap11xx family besides cap1106. The driver can
be made to support all of them, so let's give it more generic name.
Signed-off-by: default avatarMatt Ranostay <mranostay@gmail.com>
Reviewed-by: default avatarDaniel Mack <daniel@zonque.org>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent a823c267
Device tree bindings for Microchip CAP1106, 6 channel capacitive touch sensor Device tree bindings for Microchip CAP11xx based capacitive touch sensors
The node for this driver must be a child of a I2C controller node, as the The node for this device must be a child of a I2C controller node, as the
device communication via I2C only. device communication via I2C only.
Required properties: Required properties:
compatible: Must be "microchip,cap1106" compatible: Must contain one of:
"microchip,cap1106"
reg: The I2C slave address of the device. reg: The I2C slave address of the device.
Only 0x28 is valid. Only 0x28 is valid.
...@@ -43,11 +44,11 @@ i2c_controller { ...@@ -43,11 +44,11 @@ i2c_controller {
autorepeat; autorepeat;
microchip,sensor-gain = <2>; microchip,sensor-gain = <2>;
linux,keycodes = <103 /* KEY_UP */ linux,keycodes = <103>, /* KEY_UP */
106 /* KEY_RIGHT */ <106>, /* KEY_RIGHT */
108 /* KEY_DOWN */ <108>, /* KEY_DOWN */
105 /* KEY_LEFT */ <105>, /* KEY_LEFT */
109 /* KEY_PAGEDOWN */ <109>, /* KEY_PAGEDOWN */
104>; /* KEY_PAGEUP */ <104>; /* KEY_PAGEUP */
}; };
} }
...@@ -665,14 +665,14 @@ config KEYBOARD_CROS_EC ...@@ -665,14 +665,14 @@ config KEYBOARD_CROS_EC
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called cros_ec_keyb. module will be called cros_ec_keyb.
config KEYBOARD_CAP1106 config KEYBOARD_CAP11XX
tristate "Microchip CAP1106 touch sensor" tristate "Microchip CAP11XX based touch sensors"
depends on OF && I2C depends on OF && I2C
select REGMAP_I2C select REGMAP_I2C
help help
Say Y here to enable the CAP1106 touch sensor driver. Say Y here to enable the CAP11XX touch sensor driver.
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called cap1106. module will be called cap11xx.
endif endif
...@@ -11,7 +11,7 @@ obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o ...@@ -11,7 +11,7 @@ obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o
obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o
obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o
obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o
obj-$(CONFIG_KEYBOARD_CAP1106) += cap1106.o obj-$(CONFIG_KEYBOARD_CAP11XX) += cap11xx.o
obj-$(CONFIG_KEYBOARD_CLPS711X) += clps711x-keypad.o obj-$(CONFIG_KEYBOARD_CLPS711X) += clps711x-keypad.o
obj-$(CONFIG_KEYBOARD_CROS_EC) += cros_ec_keyb.o obj-$(CONFIG_KEYBOARD_CROS_EC) += cros_ec_keyb.o
obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o
......
/* /*
* Input driver for Microchip CAP1106, 6 channel capacitive touch sensor * Input driver for Microchip CAP11xx based capacitive touch sensors
* *
* http://www.microchip.com/wwwproducts/Devices.aspx?product=CAP1106
* *
* (c) 2014 Daniel Mack <linux@zonque.org> * (c) 2014 Daniel Mack <linux@zonque.org>
* *
...@@ -19,123 +18,123 @@ ...@@ -19,123 +18,123 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#define CAP1106_REG_MAIN_CONTROL 0x00 #define CAP11XX_REG_MAIN_CONTROL 0x00
#define CAP1106_REG_MAIN_CONTROL_GAIN_SHIFT (6) #define CAP11XX_REG_MAIN_CONTROL_GAIN_SHIFT (6)
#define CAP1106_REG_MAIN_CONTROL_GAIN_MASK (0xc0) #define CAP11XX_REG_MAIN_CONTROL_GAIN_MASK (0xc0)
#define CAP1106_REG_MAIN_CONTROL_DLSEEP BIT(4) #define CAP11XX_REG_MAIN_CONTROL_DLSEEP BIT(4)
#define CAP1106_REG_GENERAL_STATUS 0x02 #define CAP11XX_REG_GENERAL_STATUS 0x02
#define CAP1106_REG_SENSOR_INPUT 0x03 #define CAP11XX_REG_SENSOR_INPUT 0x03
#define CAP1106_REG_NOISE_FLAG_STATUS 0x0a #define CAP11XX_REG_NOISE_FLAG_STATUS 0x0a
#define CAP1106_REG_SENOR_DELTA(X) (0x10 + (X)) #define CAP11XX_REG_SENOR_DELTA(X) (0x10 + (X))
#define CAP1106_REG_SENSITIVITY_CONTROL 0x1f #define CAP11XX_REG_SENSITIVITY_CONTROL 0x1f
#define CAP1106_REG_CONFIG 0x20 #define CAP11XX_REG_CONFIG 0x20
#define CAP1106_REG_SENSOR_ENABLE 0x21 #define CAP11XX_REG_SENSOR_ENABLE 0x21
#define CAP1106_REG_SENSOR_CONFIG 0x22 #define CAP11XX_REG_SENSOR_CONFIG 0x22
#define CAP1106_REG_SENSOR_CONFIG2 0x23 #define CAP11XX_REG_SENSOR_CONFIG2 0x23
#define CAP1106_REG_SAMPLING_CONFIG 0x24 #define CAP11XX_REG_SAMPLING_CONFIG 0x24
#define CAP1106_REG_CALIBRATION 0x26 #define CAP11XX_REG_CALIBRATION 0x26
#define CAP1106_REG_INT_ENABLE 0x27 #define CAP11XX_REG_INT_ENABLE 0x27
#define CAP1106_REG_REPEAT_RATE 0x28 #define CAP11XX_REG_REPEAT_RATE 0x28
#define CAP1106_REG_MT_CONFIG 0x2a #define CAP11XX_REG_MT_CONFIG 0x2a
#define CAP1106_REG_MT_PATTERN_CONFIG 0x2b #define CAP11XX_REG_MT_PATTERN_CONFIG 0x2b
#define CAP1106_REG_MT_PATTERN 0x2d #define CAP11XX_REG_MT_PATTERN 0x2d
#define CAP1106_REG_RECALIB_CONFIG 0x2f #define CAP11XX_REG_RECALIB_CONFIG 0x2f
#define CAP1106_REG_SENSOR_THRESH(X) (0x30 + (X)) #define CAP11XX_REG_SENSOR_THRESH(X) (0x30 + (X))
#define CAP1106_REG_SENSOR_NOISE_THRESH 0x38 #define CAP11XX_REG_SENSOR_NOISE_THRESH 0x38
#define CAP1106_REG_STANDBY_CHANNEL 0x40 #define CAP11XX_REG_STANDBY_CHANNEL 0x40
#define CAP1106_REG_STANDBY_CONFIG 0x41 #define CAP11XX_REG_STANDBY_CONFIG 0x41
#define CAP1106_REG_STANDBY_SENSITIVITY 0x42 #define CAP11XX_REG_STANDBY_SENSITIVITY 0x42
#define CAP1106_REG_STANDBY_THRESH 0x43 #define CAP11XX_REG_STANDBY_THRESH 0x43
#define CAP1106_REG_CONFIG2 0x44 #define CAP11XX_REG_CONFIG2 0x44
#define CAP1106_REG_SENSOR_BASE_CNT(X) (0x50 + (X)) #define CAP11XX_REG_SENSOR_BASE_CNT(X) (0x50 + (X))
#define CAP1106_REG_SENSOR_CALIB (0xb1 + (X)) #define CAP11XX_REG_SENSOR_CALIB (0xb1 + (X))
#define CAP1106_REG_SENSOR_CALIB_LSB1 0xb9 #define CAP11XX_REG_SENSOR_CALIB_LSB1 0xb9
#define CAP1106_REG_SENSOR_CALIB_LSB2 0xba #define CAP11XX_REG_SENSOR_CALIB_LSB2 0xba
#define CAP1106_REG_PRODUCT_ID 0xfd #define CAP11XX_REG_PRODUCT_ID 0xfd
#define CAP1106_REG_MANUFACTURER_ID 0xfe #define CAP11XX_REG_MANUFACTURER_ID 0xfe
#define CAP1106_REG_REVISION 0xff #define CAP11XX_REG_REVISION 0xff
#define CAP1106_NUM_CHN 6 #define CAP11XX_NUM_CHN 6
#define CAP1106_PRODUCT_ID 0x55 #define CAP11XX_PRODUCT_ID 0x55
#define CAP1106_MANUFACTURER_ID 0x5d #define CAP11XX_MANUFACTURER_ID 0x5d
struct cap1106_priv { struct cap11xx_priv {
struct regmap *regmap; struct regmap *regmap;
struct input_dev *idev; struct input_dev *idev;
/* config */ /* config */
unsigned short keycodes[CAP1106_NUM_CHN]; unsigned short keycodes[CAP11XX_NUM_CHN];
}; };
static const struct reg_default cap1106_reg_defaults[] = { static const struct reg_default cap11xx_reg_defaults[] = {
{ CAP1106_REG_MAIN_CONTROL, 0x00 }, { CAP11XX_REG_MAIN_CONTROL, 0x00 },
{ CAP1106_REG_GENERAL_STATUS, 0x00 }, { CAP11XX_REG_GENERAL_STATUS, 0x00 },
{ CAP1106_REG_SENSOR_INPUT, 0x00 }, { CAP11XX_REG_SENSOR_INPUT, 0x00 },
{ CAP1106_REG_NOISE_FLAG_STATUS, 0x00 }, { CAP11XX_REG_NOISE_FLAG_STATUS, 0x00 },
{ CAP1106_REG_SENSITIVITY_CONTROL, 0x2f }, { CAP11XX_REG_SENSITIVITY_CONTROL, 0x2f },
{ CAP1106_REG_CONFIG, 0x20 }, { CAP11XX_REG_CONFIG, 0x20 },
{ CAP1106_REG_SENSOR_ENABLE, 0x3f }, { CAP11XX_REG_SENSOR_ENABLE, 0x3f },
{ CAP1106_REG_SENSOR_CONFIG, 0xa4 }, { CAP11XX_REG_SENSOR_CONFIG, 0xa4 },
{ CAP1106_REG_SENSOR_CONFIG2, 0x07 }, { CAP11XX_REG_SENSOR_CONFIG2, 0x07 },
{ CAP1106_REG_SAMPLING_CONFIG, 0x39 }, { CAP11XX_REG_SAMPLING_CONFIG, 0x39 },
{ CAP1106_REG_CALIBRATION, 0x00 }, { CAP11XX_REG_CALIBRATION, 0x00 },
{ CAP1106_REG_INT_ENABLE, 0x3f }, { CAP11XX_REG_INT_ENABLE, 0x3f },
{ CAP1106_REG_REPEAT_RATE, 0x3f }, { CAP11XX_REG_REPEAT_RATE, 0x3f },
{ CAP1106_REG_MT_CONFIG, 0x80 }, { CAP11XX_REG_MT_CONFIG, 0x80 },
{ CAP1106_REG_MT_PATTERN_CONFIG, 0x00 }, { CAP11XX_REG_MT_PATTERN_CONFIG, 0x00 },
{ CAP1106_REG_MT_PATTERN, 0x3f }, { CAP11XX_REG_MT_PATTERN, 0x3f },
{ CAP1106_REG_RECALIB_CONFIG, 0x8a }, { CAP11XX_REG_RECALIB_CONFIG, 0x8a },
{ CAP1106_REG_SENSOR_THRESH(0), 0x40 }, { CAP11XX_REG_SENSOR_THRESH(0), 0x40 },
{ CAP1106_REG_SENSOR_THRESH(1), 0x40 }, { CAP11XX_REG_SENSOR_THRESH(1), 0x40 },
{ CAP1106_REG_SENSOR_THRESH(2), 0x40 }, { CAP11XX_REG_SENSOR_THRESH(2), 0x40 },
{ CAP1106_REG_SENSOR_THRESH(3), 0x40 }, { CAP11XX_REG_SENSOR_THRESH(3), 0x40 },
{ CAP1106_REG_SENSOR_THRESH(4), 0x40 }, { CAP11XX_REG_SENSOR_THRESH(4), 0x40 },
{ CAP1106_REG_SENSOR_THRESH(5), 0x40 }, { CAP11XX_REG_SENSOR_THRESH(5), 0x40 },
{ CAP1106_REG_SENSOR_NOISE_THRESH, 0x01 }, { CAP11XX_REG_SENSOR_NOISE_THRESH, 0x01 },
{ CAP1106_REG_STANDBY_CHANNEL, 0x00 }, { CAP11XX_REG_STANDBY_CHANNEL, 0x00 },
{ CAP1106_REG_STANDBY_CONFIG, 0x39 }, { CAP11XX_REG_STANDBY_CONFIG, 0x39 },
{ CAP1106_REG_STANDBY_SENSITIVITY, 0x02 }, { CAP11XX_REG_STANDBY_SENSITIVITY, 0x02 },
{ CAP1106_REG_STANDBY_THRESH, 0x40 }, { CAP11XX_REG_STANDBY_THRESH, 0x40 },
{ CAP1106_REG_CONFIG2, 0x40 }, { CAP11XX_REG_CONFIG2, 0x40 },
{ CAP1106_REG_SENSOR_CALIB_LSB1, 0x00 }, { CAP11XX_REG_SENSOR_CALIB_LSB1, 0x00 },
{ CAP1106_REG_SENSOR_CALIB_LSB2, 0x00 }, { CAP11XX_REG_SENSOR_CALIB_LSB2, 0x00 },
}; };
static bool cap1106_volatile_reg(struct device *dev, unsigned int reg) static bool cap11xx_volatile_reg(struct device *dev, unsigned int reg)
{ {
switch (reg) { switch (reg) {
case CAP1106_REG_MAIN_CONTROL: case CAP11XX_REG_MAIN_CONTROL:
case CAP1106_REG_SENSOR_INPUT: case CAP11XX_REG_SENSOR_INPUT:
case CAP1106_REG_SENOR_DELTA(0): case CAP11XX_REG_SENOR_DELTA(0):
case CAP1106_REG_SENOR_DELTA(1): case CAP11XX_REG_SENOR_DELTA(1):
case CAP1106_REG_SENOR_DELTA(2): case CAP11XX_REG_SENOR_DELTA(2):
case CAP1106_REG_SENOR_DELTA(3): case CAP11XX_REG_SENOR_DELTA(3):
case CAP1106_REG_SENOR_DELTA(4): case CAP11XX_REG_SENOR_DELTA(4):
case CAP1106_REG_SENOR_DELTA(5): case CAP11XX_REG_SENOR_DELTA(5):
case CAP1106_REG_PRODUCT_ID: case CAP11XX_REG_PRODUCT_ID:
case CAP1106_REG_MANUFACTURER_ID: case CAP11XX_REG_MANUFACTURER_ID:
case CAP1106_REG_REVISION: case CAP11XX_REG_REVISION:
return true; return true;
} }
return false; return false;
} }
static const struct regmap_config cap1106_regmap_config = { static const struct regmap_config cap11xx_regmap_config = {
.reg_bits = 8, .reg_bits = 8,
.val_bits = 8, .val_bits = 8,
.max_register = CAP1106_REG_REVISION, .max_register = CAP11XX_REG_REVISION,
.reg_defaults = cap1106_reg_defaults, .reg_defaults = cap11xx_reg_defaults,
.num_reg_defaults = ARRAY_SIZE(cap1106_reg_defaults), .num_reg_defaults = ARRAY_SIZE(cap11xx_reg_defaults),
.cache_type = REGCACHE_RBTREE, .cache_type = REGCACHE_RBTREE,
.volatile_reg = cap1106_volatile_reg, .volatile_reg = cap11xx_volatile_reg,
}; };
static irqreturn_t cap1106_thread_func(int irq_num, void *data) static irqreturn_t cap11xx_thread_func(int irq_num, void *data)
{ {
struct cap1106_priv *priv = data; struct cap11xx_priv *priv = data;
unsigned int status; unsigned int status;
int ret, i; int ret, i;
...@@ -143,15 +142,15 @@ static irqreturn_t cap1106_thread_func(int irq_num, void *data) ...@@ -143,15 +142,15 @@ static irqreturn_t cap1106_thread_func(int irq_num, void *data)
* Deassert interrupt. This needs to be done before reading the status * Deassert interrupt. This needs to be done before reading the status
* registers, which will not carry valid values otherwise. * registers, which will not carry valid values otherwise.
*/ */
ret = regmap_update_bits(priv->regmap, CAP1106_REG_MAIN_CONTROL, 1, 0); ret = regmap_update_bits(priv->regmap, CAP11XX_REG_MAIN_CONTROL, 1, 0);
if (ret < 0) if (ret < 0)
goto out; goto out;
ret = regmap_read(priv->regmap, CAP1106_REG_SENSOR_INPUT, &status); ret = regmap_read(priv->regmap, CAP11XX_REG_SENSOR_INPUT, &status);
if (ret < 0) if (ret < 0)
goto out; goto out;
for (i = 0; i < CAP1106_NUM_CHN; i++) for (i = 0; i < CAP11XX_NUM_CHN; i++)
input_report_key(priv->idev, priv->keycodes[i], input_report_key(priv->idev, priv->keycodes[i],
status & (1 << i)); status & (1 << i));
...@@ -161,70 +160,70 @@ static irqreturn_t cap1106_thread_func(int irq_num, void *data) ...@@ -161,70 +160,70 @@ static irqreturn_t cap1106_thread_func(int irq_num, void *data)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int cap1106_set_sleep(struct cap1106_priv *priv, bool sleep) static int cap11xx_set_sleep(struct cap11xx_priv *priv, bool sleep)
{ {
return regmap_update_bits(priv->regmap, CAP1106_REG_MAIN_CONTROL, return regmap_update_bits(priv->regmap, CAP11XX_REG_MAIN_CONTROL,
CAP1106_REG_MAIN_CONTROL_DLSEEP, CAP11XX_REG_MAIN_CONTROL_DLSEEP,
sleep ? CAP1106_REG_MAIN_CONTROL_DLSEEP : 0); sleep ? CAP11XX_REG_MAIN_CONTROL_DLSEEP : 0);
} }
static int cap1106_input_open(struct input_dev *idev) static int cap11xx_input_open(struct input_dev *idev)
{ {
struct cap1106_priv *priv = input_get_drvdata(idev); struct cap11xx_priv *priv = input_get_drvdata(idev);
return cap1106_set_sleep(priv, false); return cap11xx_set_sleep(priv, false);
} }
static void cap1106_input_close(struct input_dev *idev) static void cap11xx_input_close(struct input_dev *idev)
{ {
struct cap1106_priv *priv = input_get_drvdata(idev); struct cap11xx_priv *priv = input_get_drvdata(idev);
cap1106_set_sleep(priv, true); cap11xx_set_sleep(priv, true);
} }
static int cap1106_i2c_probe(struct i2c_client *i2c_client, static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
struct device *dev = &i2c_client->dev; struct device *dev = &i2c_client->dev;
struct cap1106_priv *priv; struct cap11xx_priv *priv;
struct device_node *node; struct device_node *node;
int i, error, irq, gain = 0; int i, error, irq, gain = 0;
unsigned int val, rev; unsigned int val, rev;
u32 gain32, keycodes[CAP1106_NUM_CHN]; u32 gain32, keycodes[CAP11XX_NUM_CHN];
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
priv->regmap = devm_regmap_init_i2c(i2c_client, &cap1106_regmap_config); priv->regmap = devm_regmap_init_i2c(i2c_client, &cap11xx_regmap_config);
if (IS_ERR(priv->regmap)) if (IS_ERR(priv->regmap))
return PTR_ERR(priv->regmap); return PTR_ERR(priv->regmap);
error = regmap_read(priv->regmap, CAP1106_REG_PRODUCT_ID, &val); error = regmap_read(priv->regmap, CAP11XX_REG_PRODUCT_ID, &val);
if (error) if (error)
return error; return error;
if (val != CAP1106_PRODUCT_ID) { if (val != CAP11XX_PRODUCT_ID) {
dev_err(dev, "Product ID: Got 0x%02x, expected 0x%02x\n", dev_err(dev, "Product ID: Got 0x%02x, expected 0x%02x\n",
val, CAP1106_PRODUCT_ID); val, CAP11XX_PRODUCT_ID);
return -ENODEV; return -ENODEV;
} }
error = regmap_read(priv->regmap, CAP1106_REG_MANUFACTURER_ID, &val); error = regmap_read(priv->regmap, CAP11XX_REG_MANUFACTURER_ID, &val);
if (error) if (error)
return error; return error;
if (val != CAP1106_MANUFACTURER_ID) { if (val != CAP11XX_MANUFACTURER_ID) {
dev_err(dev, "Manufacturer ID: Got 0x%02x, expected 0x%02x\n", dev_err(dev, "Manufacturer ID: Got 0x%02x, expected 0x%02x\n",
val, CAP1106_MANUFACTURER_ID); val, CAP11XX_MANUFACTURER_ID);
return -ENODEV; return -ENODEV;
} }
error = regmap_read(priv->regmap, CAP1106_REG_REVISION, &rev); error = regmap_read(priv->regmap, CAP11XX_REG_REVISION, &rev);
if (error < 0) if (error < 0)
return error; return error;
dev_info(dev, "CAP1106 detected, revision 0x%02x\n", rev); dev_info(dev, "CAP11XX detected, revision 0x%02x\n", rev);
i2c_set_clientdata(i2c_client, priv); i2c_set_clientdata(i2c_client, priv);
node = dev->of_node; node = dev->of_node;
...@@ -247,14 +246,14 @@ static int cap1106_i2c_probe(struct i2c_client *i2c_client, ...@@ -247,14 +246,14 @@ static int cap1106_i2c_probe(struct i2c_client *i2c_client,
for (i = 0; i < ARRAY_SIZE(keycodes); i++) for (i = 0; i < ARRAY_SIZE(keycodes); i++)
priv->keycodes[i] = keycodes[i]; priv->keycodes[i] = keycodes[i];
error = regmap_update_bits(priv->regmap, CAP1106_REG_MAIN_CONTROL, error = regmap_update_bits(priv->regmap, CAP11XX_REG_MAIN_CONTROL,
CAP1106_REG_MAIN_CONTROL_GAIN_MASK, CAP11XX_REG_MAIN_CONTROL_GAIN_MASK,
gain << CAP1106_REG_MAIN_CONTROL_GAIN_SHIFT); gain << CAP11XX_REG_MAIN_CONTROL_GAIN_SHIFT);
if (error) if (error)
return error; return error;
/* Disable autorepeat. The Linux input system has its own handling. */ /* Disable autorepeat. The Linux input system has its own handling. */
error = regmap_write(priv->regmap, CAP1106_REG_REPEAT_RATE, 0); error = regmap_write(priv->regmap, CAP11XX_REG_REPEAT_RATE, 0);
if (error) if (error)
return error; return error;
...@@ -262,14 +261,14 @@ static int cap1106_i2c_probe(struct i2c_client *i2c_client, ...@@ -262,14 +261,14 @@ static int cap1106_i2c_probe(struct i2c_client *i2c_client,
if (!priv->idev) if (!priv->idev)
return -ENOMEM; return -ENOMEM;
priv->idev->name = "CAP1106 capacitive touch sensor"; priv->idev->name = "CAP11XX capacitive touch sensor";
priv->idev->id.bustype = BUS_I2C; priv->idev->id.bustype = BUS_I2C;
priv->idev->evbit[0] = BIT_MASK(EV_KEY); priv->idev->evbit[0] = BIT_MASK(EV_KEY);
if (of_property_read_bool(node, "autorepeat")) if (of_property_read_bool(node, "autorepeat"))
__set_bit(EV_REP, priv->idev->evbit); __set_bit(EV_REP, priv->idev->evbit);
for (i = 0; i < CAP1106_NUM_CHN; i++) for (i = 0; i < CAP11XX_NUM_CHN; i++)
__set_bit(priv->keycodes[i], priv->idev->keybit); __set_bit(priv->keycodes[i], priv->idev->keybit);
__clear_bit(KEY_RESERVED, priv->idev->keybit); __clear_bit(KEY_RESERVED, priv->idev->keybit);
...@@ -278,12 +277,12 @@ static int cap1106_i2c_probe(struct i2c_client *i2c_client, ...@@ -278,12 +277,12 @@ static int cap1106_i2c_probe(struct i2c_client *i2c_client,
priv->idev->keycodesize = sizeof(priv->keycodes[0]); priv->idev->keycodesize = sizeof(priv->keycodes[0]);
priv->idev->keycodemax = ARRAY_SIZE(priv->keycodes); priv->idev->keycodemax = ARRAY_SIZE(priv->keycodes);
priv->idev->id.vendor = CAP1106_MANUFACTURER_ID; priv->idev->id.vendor = CAP11XX_MANUFACTURER_ID;
priv->idev->id.product = CAP1106_PRODUCT_ID; priv->idev->id.product = CAP11XX_PRODUCT_ID;
priv->idev->id.version = rev; priv->idev->id.version = rev;
priv->idev->open = cap1106_input_open; priv->idev->open = cap11xx_input_open;
priv->idev->close = cap1106_input_close; priv->idev->close = cap11xx_input_close;
input_set_drvdata(priv->idev, priv); input_set_drvdata(priv->idev, priv);
...@@ -291,7 +290,7 @@ static int cap1106_i2c_probe(struct i2c_client *i2c_client, ...@@ -291,7 +290,7 @@ static int cap1106_i2c_probe(struct i2c_client *i2c_client,
* Put the device in deep sleep mode for now. * Put the device in deep sleep mode for now.
* ->open() will bring it back once the it is actually needed. * ->open() will bring it back once the it is actually needed.
*/ */
cap1106_set_sleep(priv, true); cap11xx_set_sleep(priv, true);
error = input_register_device(priv->idev); error = input_register_device(priv->idev);
if (error) if (error)
...@@ -303,7 +302,7 @@ static int cap1106_i2c_probe(struct i2c_client *i2c_client, ...@@ -303,7 +302,7 @@ static int cap1106_i2c_probe(struct i2c_client *i2c_client,
return -ENXIO; return -ENXIO;
} }
error = devm_request_threaded_irq(dev, irq, NULL, cap1106_thread_func, error = devm_request_threaded_irq(dev, irq, NULL, cap11xx_thread_func,
IRQF_ONESHOT, dev_name(dev), priv); IRQF_ONESHOT, dev_name(dev), priv);
if (error) if (error)
return error; return error;
...@@ -311,31 +310,31 @@ static int cap1106_i2c_probe(struct i2c_client *i2c_client, ...@@ -311,31 +310,31 @@ static int cap1106_i2c_probe(struct i2c_client *i2c_client,
return 0; return 0;
} }
static const struct of_device_id cap1106_dt_ids[] = { static const struct of_device_id cap11xx_dt_ids[] = {
{ .compatible = "microchip,cap1106", }, { .compatible = "microchip,cap1106", },
{} {}
}; };
MODULE_DEVICE_TABLE(of, cap1106_dt_ids); MODULE_DEVICE_TABLE(of, cap11xx_dt_ids);
static const struct i2c_device_id cap1106_i2c_ids[] = { static const struct i2c_device_id cap11xx_i2c_ids[] = {
{ "cap1106", 0 }, { "cap1106", 0 },
{} {}
}; };
MODULE_DEVICE_TABLE(i2c, cap1106_i2c_ids); MODULE_DEVICE_TABLE(i2c, cap11xx_i2c_ids);
static struct i2c_driver cap1106_i2c_driver = { static struct i2c_driver cap11xx_i2c_driver = {
.driver = { .driver = {
.name = "cap1106", .name = "cap11xx",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = cap1106_dt_ids, .of_match_table = cap11xx_dt_ids,
}, },
.id_table = cap1106_i2c_ids, .id_table = cap11xx_i2c_ids,
.probe = cap1106_i2c_probe, .probe = cap11xx_i2c_probe,
}; };
module_i2c_driver(cap1106_i2c_driver); module_i2c_driver(cap11xx_i2c_driver);
MODULE_ALIAS("platform:cap1106"); MODULE_ALIAS("platform:cap11xx");
MODULE_DESCRIPTION("Microchip CAP1106 driver"); MODULE_DESCRIPTION("Microchip CAP11XX driver");
MODULE_AUTHOR("Daniel Mack <linux@zonque.org>"); MODULE_AUTHOR("Daniel Mack <linux@zonque.org>");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment