Commit c5a5b14e authored by Stephen Rothwell's avatar Stephen Rothwell

Merge remote-tracking branch 'input/next'

parents 91ec099c b6eba860
Samsung tm2-touchkey
Required properties:
- compatible: must be "cypress,tm2-touchkey"
- compatible:
* "cypress,tm2-touchkey" - for the touchkey found on the tm2 board
* "cypress,midas-touchkey" - for the touchkey found on midas boards
* "cypress,aries-touchkey" - for the touchkey found on aries boards
- reg: I2C address of the chip.
- interrupts: interrupt to which the chip is connected (see interrupt
binding[0]).
- vcc-supply : internal regulator output. 1.8V
- vdd-supply : power supply for IC 3.3V
Optional properties:
- linux,keycodes: array of keycodes (max 4), default KEY_PHONE and KEY_BACK
[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
Example:
......@@ -21,5 +27,6 @@ Example:
interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
vcc-supply=<&ldo32_reg>;
vdd-supply=<&ldo33_reg>;
linux,keycodes = <KEY_PHONE KEY_BACK>;
};
};
FocalTech EDT-FT5x06 Polytouch driver
=====================================
There are 3 variants of the chip for various touch panel sizes
There are 5 variants of the chip for various touch panel sizes
FT5206GE1 2.8" .. 3.8"
FT5306DE4 4.3" .. 7"
FT5406EE8 7" .. 8.9"
FT5506EEG 7" .. 8.9"
FT5726NEI 5.7” .. 11.6"
The software interface is identical for all those chips, so that
currently there is no need for the driver to distinguish between the
......@@ -19,6 +20,7 @@ Required properties:
or: "edt,edt-ft5306"
or: "edt,edt-ft5406"
or: "edt,edt-ft5506"
or: "evervision,ev-ft5726"
or: "focaltech,ft6236"
- reg: I2C slave address of the chip (0x38)
......@@ -42,6 +44,15 @@ Optional properties:
- offset: allows setting the edge compensation in the range from
0 to 31.
- offset-x: Same as offset, but applies only to the horizontal position.
Range from 0 to 80, only supported by evervision,ev-ft5726
devices.
- offset-y: Same as offset, but applies only to the vertical position.
Range from 0 to 80, only supported by evervision,ev-ft5726
devices.
- touchscreen-size-x : See touchscreen.txt
- touchscreen-size-y : See touchscreen.txt
- touchscreen-fuzz-x : See touchscreen.txt
......
......@@ -113,9 +113,8 @@ static int mcs_touchkey_probe(struct i2c_client *client,
return -EINVAL;
}
data = kzalloc(sizeof(struct mcs_touchkey_data) +
sizeof(data->keycodes[0]) * (pdata->key_maxval + 1),
GFP_KERNEL);
data = kzalloc(struct_size(data, keycodes, pdata->key_maxval + 1),
GFP_KERNEL);
input_dev = input_allocate_device();
if (!data || !input_dev) {
dev_err(&client->dev, "Failed to allocate memory\n");
......
......@@ -14,18 +14,17 @@
*
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/kernel.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/regmap.h>
#include <linux/mfd/mt6323/registers.h>
#include <linux/mfd/mt6397/registers.h>
#include <linux/mfd/mt6397/core.h>
#include <linux/mfd/mt6397/registers.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#define MTK_PMIC_PWRKEY_RST_EN_MASK 0x1
#define MTK_PMIC_PWRKEY_RST_EN_SHIFT 6
......
......@@ -219,9 +219,7 @@ static int tca6416_keypad_probe(struct i2c_client *client,
return -EINVAL;
}
chip = kzalloc(sizeof(struct tca6416_keypad_chip) +
pdata->nbuttons * sizeof(struct tca6416_button),
GFP_KERNEL);
chip = kzalloc(struct_size(chip, buttons, pdata->nbuttons), GFP_KERNEL);
input = input_allocate_device();
if (!chip || !input) {
error = -ENOMEM;
......
......@@ -22,12 +22,14 @@
#include <linux/leds.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/pm.h>
#include <linux/regulator/consumer.h>
#define TM2_TOUCHKEY_DEV_NAME "tm2-touchkey"
#define TM2_TOUCHKEY_KEYCODE_REG 0x03
#define TM2_TOUCHKEY_BASE_REG 0x00
#define ARIES_TOUCHKEY_CMD_LED_ON 0x1
#define ARIES_TOUCHKEY_CMD_LED_OFF 0x2
#define TM2_TOUCHKEY_CMD_LED_ON 0x10
#define TM2_TOUCHKEY_CMD_LED_OFF 0x20
#define TM2_TOUCHKEY_BIT_PRESS_EV BIT(3)
......@@ -35,9 +37,13 @@
#define TM2_TOUCHKEY_LED_VOLTAGE_MIN 2500000
#define TM2_TOUCHKEY_LED_VOLTAGE_MAX 3300000
enum {
TM2_TOUCHKEY_KEY_MENU = 0x1,
TM2_TOUCHKEY_KEY_BACK,
struct touchkey_variant {
u8 keycode_reg;
u8 base_reg;
u8 cmd_led_on;
u8 cmd_led_off;
bool no_reg;
bool fixed_regulator;
};
struct tm2_touchkey_data {
......@@ -46,6 +52,30 @@ struct tm2_touchkey_data {
struct led_classdev led_dev;
struct regulator *vdd;
struct regulator_bulk_data regulators[2];
const struct touchkey_variant *variant;
u32 keycodes[4];
int num_keycodes;
};
static const struct touchkey_variant tm2_touchkey_variant = {
.keycode_reg = 0x03,
.base_reg = 0x00,
.cmd_led_on = TM2_TOUCHKEY_CMD_LED_ON,
.cmd_led_off = TM2_TOUCHKEY_CMD_LED_OFF,
};
static const struct touchkey_variant midas_touchkey_variant = {
.keycode_reg = 0x00,
.base_reg = 0x00,
.cmd_led_on = TM2_TOUCHKEY_CMD_LED_ON,
.cmd_led_off = TM2_TOUCHKEY_CMD_LED_OFF,
};
static struct touchkey_variant aries_touchkey_variant = {
.no_reg = true,
.fixed_regulator = true,
.cmd_led_on = ARIES_TOUCHKEY_CMD_LED_ON,
.cmd_led_off = ARIES_TOUCHKEY_CMD_LED_OFF,
};
static void tm2_touchkey_led_brightness_set(struct led_classdev *led_dev,
......@@ -58,15 +88,20 @@ static void tm2_touchkey_led_brightness_set(struct led_classdev *led_dev,
if (brightness == LED_OFF) {
volt = TM2_TOUCHKEY_LED_VOLTAGE_MIN;
data = TM2_TOUCHKEY_CMD_LED_OFF;
data = touchkey->variant->cmd_led_off;
} else {
volt = TM2_TOUCHKEY_LED_VOLTAGE_MAX;
data = TM2_TOUCHKEY_CMD_LED_ON;
data = touchkey->variant->cmd_led_on;
}
regulator_set_voltage(touchkey->vdd, volt, volt);
i2c_smbus_write_byte_data(touchkey->client,
TM2_TOUCHKEY_BASE_REG, data);
if (!touchkey->variant->fixed_regulator)
regulator_set_voltage(touchkey->vdd, volt, volt);
if (touchkey->variant->no_reg)
i2c_smbus_write_byte(touchkey->client, data);
else
i2c_smbus_write_byte_data(touchkey->client,
touchkey->variant->base_reg, data);
}
static int tm2_touchkey_power_enable(struct tm2_touchkey_data *touchkey)
......@@ -96,49 +131,57 @@ static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid)
{
struct tm2_touchkey_data *touchkey = devid;
int data;
int key;
data = i2c_smbus_read_byte_data(touchkey->client,
TM2_TOUCHKEY_KEYCODE_REG);
int index;
int i;
if (touchkey->variant->no_reg)
data = i2c_smbus_read_byte(touchkey->client);
else
data = i2c_smbus_read_byte_data(touchkey->client,
touchkey->variant->keycode_reg);
if (data < 0) {
dev_err(&touchkey->client->dev,
"failed to read i2c data: %d\n", data);
goto out;
}
switch (data & TM2_TOUCHKEY_BIT_KEYCODE) {
case TM2_TOUCHKEY_KEY_MENU:
key = KEY_PHONE;
break;
case TM2_TOUCHKEY_KEY_BACK:
key = KEY_BACK;
break;
default:
index = (data & TM2_TOUCHKEY_BIT_KEYCODE) - 1;
if (index < 0 || index >= touchkey->num_keycodes) {
dev_warn(&touchkey->client->dev,
"unhandled keycode, data %#02x\n", data);
"invalid keycode index %d\n", index);
goto out;
}
if (data & TM2_TOUCHKEY_BIT_PRESS_EV) {
input_report_key(touchkey->input_dev, KEY_PHONE, 0);
input_report_key(touchkey->input_dev, KEY_BACK, 0);
for (i = 0; i < touchkey->num_keycodes; i++)
input_report_key(touchkey->input_dev,
touchkey->keycodes[i], 0);
} else {
input_report_key(touchkey->input_dev, key, 1);
input_report_key(touchkey->input_dev,
touchkey->keycodes[index], 1);
}
input_sync(touchkey->input_dev);
out:
if (touchkey->variant->fixed_regulator &&
data & TM2_TOUCHKEY_BIT_PRESS_EV) {
/* touch turns backlight on, so make sure we're in sync */
if (touchkey->led_dev.brightness == LED_OFF)
tm2_touchkey_led_brightness_set(&touchkey->led_dev,
LED_OFF);
}
return IRQ_HANDLED;
}
static int tm2_touchkey_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct device_node *np = client->dev.of_node;
struct tm2_touchkey_data *touchkey;
int error;
int i;
if (!i2c_check_functionality(client->adapter,
I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_BYTE_DATA)) {
......@@ -153,6 +196,8 @@ static int tm2_touchkey_probe(struct i2c_client *client,
touchkey->client = client;
i2c_set_clientdata(client, touchkey);
touchkey->variant = of_device_get_match_data(&client->dev);
touchkey->regulators[0].supply = "vcc";
touchkey->regulators[1].supply = "vdd";
error = devm_regulator_bulk_get(&client->dev,
......@@ -166,6 +211,16 @@ static int tm2_touchkey_probe(struct i2c_client *client,
/* Save VDD for easy access */
touchkey->vdd = touchkey->regulators[1].consumer;
touchkey->num_keycodes = of_property_read_variable_u32_array(np,
"linux,keycodes", touchkey->keycodes, 0,
ARRAY_SIZE(touchkey->keycodes));
if (touchkey->num_keycodes <= 0) {
/* default keycodes */
touchkey->keycodes[0] = KEY_PHONE;
touchkey->keycodes[1] = KEY_BACK;
touchkey->num_keycodes = 2;
}
error = tm2_touchkey_power_enable(touchkey);
if (error) {
dev_err(&client->dev, "failed to power up device: %d\n", error);
......@@ -190,8 +245,9 @@ static int tm2_touchkey_probe(struct i2c_client *client,
touchkey->input_dev->name = TM2_TOUCHKEY_DEV_NAME;
touchkey->input_dev->id.bustype = BUS_I2C;
input_set_capability(touchkey->input_dev, EV_KEY, KEY_PHONE);
input_set_capability(touchkey->input_dev, EV_KEY, KEY_BACK);
for (i = 0; i < touchkey->num_keycodes; i++)
input_set_capability(touchkey->input_dev, EV_KEY,
touchkey->keycodes[i]);
error = input_register_device(touchkey->input_dev);
if (error) {
......@@ -212,7 +268,7 @@ static int tm2_touchkey_probe(struct i2c_client *client,
/* led device */
touchkey->led_dev.name = TM2_TOUCHKEY_DEV_NAME;
touchkey->led_dev.brightness = LED_FULL;
touchkey->led_dev.brightness = LED_ON;
touchkey->led_dev.max_brightness = LED_ON;
touchkey->led_dev.brightness_set = tm2_touchkey_led_brightness_set;
......@@ -223,6 +279,9 @@ static int tm2_touchkey_probe(struct i2c_client *client,
return error;
}
if (touchkey->variant->fixed_regulator)
tm2_touchkey_led_brightness_set(&touchkey->led_dev, LED_ON);
return 0;
}
......@@ -262,7 +321,16 @@ static const struct i2c_device_id tm2_touchkey_id_table[] = {
MODULE_DEVICE_TABLE(i2c, tm2_touchkey_id_table);
static const struct of_device_id tm2_touchkey_of_match[] = {
{ .compatible = "cypress,tm2-touchkey", },
{
.compatible = "cypress,tm2-touchkey",
.data = &tm2_touchkey_variant,
}, {
.compatible = "cypress,midas-touchkey",
.data = &midas_touchkey_variant,
}, {
.compatible = "cypress,aries-touchkey",
.data = &aries_touchkey_variant,
},
{ },
};
MODULE_DEVICE_TABLE(of, tm2_touchkey_of_match);
......
......@@ -185,6 +185,10 @@ static int soc_button_parse_btn_desc(struct device *dev,
info->name = "power";
info->event_code = KEY_POWER;
info->wakeup = true;
} else if (upage == 0x01 && usage == 0xca) {
info->name = "rotation lock switch";
info->event_type = EV_SW;
info->event_code = SW_ROTATE_LOCK;
} else if (upage == 0x07 && usage == 0xe3) {
info->name = "home";
info->event_code = KEY_LEFTMETA;
......@@ -373,7 +377,7 @@ static struct soc_button_info soc_button_PNP0C40[] = {
{ "home", 1, EV_KEY, KEY_LEFTMETA, false, true },
{ "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false },
{ "volume_down", 3, EV_KEY, KEY_VOLUMEDOWN, true, false },
{ "rotation_lock", 4, EV_SW, SW_ROTATE_LOCK, false, false },
{ "rotation_lock", 4, EV_KEY, KEY_ROTATE_LOCK_TOGGLE, false, false },
{ }
};
......
......@@ -246,11 +246,14 @@ static void ad7879_timer(struct timer_list *t)
static irqreturn_t ad7879_irq(int irq, void *handle)
{
struct ad7879 *ts = handle;
int error;
regmap_bulk_read(ts->regmap, AD7879_REG_XPLUS,
ts->conversion_data, AD7879_NR_SENSE);
if (!ad7879_report(ts))
error = regmap_bulk_read(ts->regmap, AD7879_REG_XPLUS,
ts->conversion_data, AD7879_NR_SENSE);
if (error)
dev_err_ratelimited(ts->dev, "failed to read %#02x: %d\n",
AD7879_REG_XPLUS, error);
else if (!ad7879_report(ts))
mod_timer(&ts->timer, jiffies + TS_PEN_UP_TIMEOUT);
return IRQ_HANDLED;
......
......@@ -31,6 +31,7 @@
#include <linux/interrupt.h>
#include <linux/input.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/uaccess.h>
#include <linux/delay.h>
#include <linux/debugfs.h>
......@@ -53,6 +54,11 @@
#define M09_REGISTER_NUM_X 0x94
#define M09_REGISTER_NUM_Y 0x95
#define EV_REGISTER_THRESHOLD 0x40
#define EV_REGISTER_GAIN 0x41
#define EV_REGISTER_OFFSET_Y 0x45
#define EV_REGISTER_OFFSET_X 0x46
#define NO_REGISTER 0xff
#define WORK_REGISTER_OPMODE 0x3c
......@@ -73,6 +79,7 @@ enum edt_ver {
EDT_M06,
EDT_M09,
EDT_M12,
EV_FT,
GENERIC_FT,
};
......@@ -81,6 +88,8 @@ struct edt_reg_addr {
int reg_report_rate;
int reg_gain;
int reg_offset;
int reg_offset_x;
int reg_offset_y;
int reg_num_x;
int reg_num_y;
};
......@@ -106,6 +115,8 @@ struct edt_ft5x06_ts_data {
int threshold;
int gain;
int offset;
int offset_x;
int offset_y;
int report_rate;
int max_support_points;
......@@ -190,6 +201,7 @@ static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id)
case EDT_M09:
case EDT_M12:
case EV_FT:
case GENERIC_FT:
cmd = 0x0;
offset = 3;
......@@ -242,6 +254,10 @@ static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id)
x = ((buf[0] << 8) | buf[1]) & 0x0fff;
y = ((buf[2] << 8) | buf[3]) & 0x0fff;
/* The FT5x26 send the y coordinate first */
if (tsdata->version == EV_FT)
swap(x, y);
id = (buf[2] >> 4) & 0x0f;
down = type != TOUCH_EVENT_UP;
......@@ -275,8 +291,10 @@ static int edt_ft5x06_register_write(struct edt_ft5x06_ts_data *tsdata,
wrbuf[3] = wrbuf[0] ^ wrbuf[1] ^ wrbuf[2];
return edt_ft5x06_ts_readwrite(tsdata->client, 4,
wrbuf, 0, NULL);
/* fallthrough */
case EDT_M09:
case EDT_M12:
case EV_FT:
case GENERIC_FT:
wrbuf[0] = addr;
wrbuf[1] = value;
......@@ -315,8 +333,10 @@ static int edt_ft5x06_register_read(struct edt_ft5x06_ts_data *tsdata,
}
break;
/* fallthrough */
case EDT_M09:
case EDT_M12:
case EV_FT:
case GENERIC_FT:
wrbuf[0] = addr;
error = edt_ft5x06_ts_readwrite(tsdata->client, 1,
......@@ -339,9 +359,10 @@ struct edt_ft5x06_attribute {
u8 limit_high;
u8 addr_m06;
u8 addr_m09;
u8 addr_ev;
};
#define EDT_ATTR(_field, _mode, _addr_m06, _addr_m09, \
#define EDT_ATTR(_field, _mode, _addr_m06, _addr_m09, _addr_ev, \
_limit_low, _limit_high) \
struct edt_ft5x06_attribute edt_ft5x06_attr_##_field = { \
.dattr = __ATTR(_field, _mode, \
......@@ -350,6 +371,7 @@ struct edt_ft5x06_attribute {
.field_offset = offsetof(struct edt_ft5x06_ts_data, _field), \
.addr_m06 = _addr_m06, \
.addr_m09 = _addr_m09, \
.addr_ev = _addr_ev, \
.limit_low = _limit_low, \
.limit_high = _limit_high, \
}
......@@ -386,6 +408,10 @@ static ssize_t edt_ft5x06_setting_show(struct device *dev,
addr = attr->addr_m09;
break;
case EV_FT:
addr = attr->addr_ev;
break;
default:
error = -ENODEV;
goto out;
......@@ -457,6 +483,10 @@ static ssize_t edt_ft5x06_setting_store(struct device *dev,
addr = attr->addr_m09;
break;
case EV_FT:
addr = attr->addr_ev;
break;
default:
error = -ENODEV;
goto out;
......@@ -480,20 +510,28 @@ static ssize_t edt_ft5x06_setting_store(struct device *dev,
/* m06, m09: range 0-31, m12: range 0-5 */
static EDT_ATTR(gain, S_IWUSR | S_IRUGO, WORK_REGISTER_GAIN,
M09_REGISTER_GAIN, 0, 31);
M09_REGISTER_GAIN, EV_REGISTER_GAIN, 0, 31);
/* m06, m09: range 0-31, m12: range 0-16 */
static EDT_ATTR(offset, S_IWUSR | S_IRUGO, WORK_REGISTER_OFFSET,
M09_REGISTER_OFFSET, 0, 31);
M09_REGISTER_OFFSET, NO_REGISTER, 0, 31);
/* m06, m09, m12: no supported, ev_ft: range 0-80 */
static EDT_ATTR(offset_x, S_IWUSR | S_IRUGO, NO_REGISTER, NO_REGISTER,
EV_REGISTER_OFFSET_X, 0, 80);
/* m06, m09, m12: no supported, ev_ft: range 0-80 */
static EDT_ATTR(offset_y, S_IWUSR | S_IRUGO, NO_REGISTER, NO_REGISTER,
EV_REGISTER_OFFSET_Y, 0, 80);
/* m06: range 20 to 80, m09: range 0 to 30, m12: range 1 to 255... */
static EDT_ATTR(threshold, S_IWUSR | S_IRUGO, WORK_REGISTER_THRESHOLD,
M09_REGISTER_THRESHOLD, 0, 255);
M09_REGISTER_THRESHOLD, EV_REGISTER_THRESHOLD, 0, 255);
/* m06: range 3 to 14, m12: (0x64: 100Hz) */
static EDT_ATTR(report_rate, S_IWUSR | S_IRUGO, WORK_REGISTER_REPORT_RATE,
NO_REGISTER, 0, 255);
NO_REGISTER, NO_REGISTER, 0, 255);
static struct attribute *edt_ft5x06_attrs[] = {
&edt_ft5x06_attr_gain.dattr.attr,
&edt_ft5x06_attr_offset.dattr.attr,
&edt_ft5x06_attr_offset_x.dattr.attr,
&edt_ft5x06_attr_offset_y.dattr.attr,
&edt_ft5x06_attr_threshold.dattr.attr,
&edt_ft5x06_attr_report_rate.dattr.attr,
NULL
......@@ -605,8 +643,15 @@ static int edt_ft5x06_work_mode(struct edt_ft5x06_ts_data *tsdata)
tsdata->threshold);
edt_ft5x06_register_write(tsdata, reg_addr->reg_gain,
tsdata->gain);
edt_ft5x06_register_write(tsdata, reg_addr->reg_offset,
tsdata->offset);
if (reg_addr->reg_offset != NO_REGISTER)
edt_ft5x06_register_write(tsdata, reg_addr->reg_offset,
tsdata->offset);
if (reg_addr->reg_offset_x != NO_REGISTER)
edt_ft5x06_register_write(tsdata, reg_addr->reg_offset_x,
tsdata->offset_x);
if (reg_addr->reg_offset_y != NO_REGISTER)
edt_ft5x06_register_write(tsdata, reg_addr->reg_offset_y,
tsdata->offset_y);
if (reg_addr->reg_report_rate != NO_REGISTER)
edt_ft5x06_register_write(tsdata, reg_addr->reg_report_rate,
tsdata->report_rate);
......@@ -867,6 +912,16 @@ static int edt_ft5x06_ts_identify(struct i2c_client *client,
case 0x5a: /* Solomon Goldentek Display */
snprintf(model_name, EDT_NAME_LEN, "GKTW50SCED1R0");
break;
case 0x59: /* Evervision Display with FT5xx6 TS */
tsdata->version = EV_FT;
error = edt_ft5x06_ts_readwrite(client, 1, "\x53",
1, rdbuf);
if (error)
return error;
strlcpy(fw_version, rdbuf, 1);
snprintf(model_name, EDT_NAME_LEN,
"EVERVISION-FT5726NEi");
break;
default:
snprintf(model_name, EDT_NAME_LEN,
"generic ft5x06 (%02x)",
......@@ -902,6 +957,18 @@ static void edt_ft5x06_ts_get_defaults(struct device *dev,
edt_ft5x06_register_write(tsdata, reg_addr->reg_offset, val);
tsdata->offset = val;
}
error = device_property_read_u32(dev, "offset-x", &val);
if (!error) {
edt_ft5x06_register_write(tsdata, reg_addr->reg_offset_x, val);
tsdata->offset_x = val;
}
error = device_property_read_u32(dev, "offset-y", &val);
if (!error) {
edt_ft5x06_register_write(tsdata, reg_addr->reg_offset_y, val);
tsdata->offset_y = val;
}
}
static void
......@@ -912,7 +979,15 @@ edt_ft5x06_ts_get_parameters(struct edt_ft5x06_ts_data *tsdata)
tsdata->threshold = edt_ft5x06_register_read(tsdata,
reg_addr->reg_threshold);
tsdata->gain = edt_ft5x06_register_read(tsdata, reg_addr->reg_gain);
tsdata->offset = edt_ft5x06_register_read(tsdata, reg_addr->reg_offset);
if (reg_addr->reg_offset != NO_REGISTER)
tsdata->offset =
edt_ft5x06_register_read(tsdata, reg_addr->reg_offset);
if (reg_addr->reg_offset_x != NO_REGISTER)
tsdata->offset_x = edt_ft5x06_register_read(tsdata,
reg_addr->reg_offset_x);
if (reg_addr->reg_offset_y != NO_REGISTER)
tsdata->offset_y = edt_ft5x06_register_read(tsdata,
reg_addr->reg_offset_y);
if (reg_addr->reg_report_rate != NO_REGISTER)
tsdata->report_rate = edt_ft5x06_register_read(tsdata,
reg_addr->reg_report_rate);
......@@ -940,6 +1015,8 @@ edt_ft5x06_ts_set_regs(struct edt_ft5x06_ts_data *tsdata)
reg_addr->reg_report_rate = WORK_REGISTER_REPORT_RATE;
reg_addr->reg_gain = WORK_REGISTER_GAIN;
reg_addr->reg_offset = WORK_REGISTER_OFFSET;
reg_addr->reg_offset_x = NO_REGISTER;
reg_addr->reg_offset_y = NO_REGISTER;
reg_addr->reg_num_x = WORK_REGISTER_NUM_X;
reg_addr->reg_num_y = WORK_REGISTER_NUM_Y;
break;
......@@ -950,15 +1027,30 @@ edt_ft5x06_ts_set_regs(struct edt_ft5x06_ts_data *tsdata)
reg_addr->reg_report_rate = NO_REGISTER;
reg_addr->reg_gain = M09_REGISTER_GAIN;
reg_addr->reg_offset = M09_REGISTER_OFFSET;
reg_addr->reg_offset_x = NO_REGISTER;
reg_addr->reg_offset_y = NO_REGISTER;
reg_addr->reg_num_x = M09_REGISTER_NUM_X;
reg_addr->reg_num_y = M09_REGISTER_NUM_Y;
break;
case EV_FT:
reg_addr->reg_threshold = EV_REGISTER_THRESHOLD;
reg_addr->reg_gain = EV_REGISTER_GAIN;
reg_addr->reg_offset = NO_REGISTER;
reg_addr->reg_offset_x = EV_REGISTER_OFFSET_X;
reg_addr->reg_offset_y = EV_REGISTER_OFFSET_Y;
reg_addr->reg_num_x = NO_REGISTER;
reg_addr->reg_num_y = NO_REGISTER;
reg_addr->reg_report_rate = NO_REGISTER;
break;
case GENERIC_FT:
/* this is a guesswork */
reg_addr->reg_threshold = M09_REGISTER_THRESHOLD;
reg_addr->reg_gain = M09_REGISTER_GAIN;
reg_addr->reg_offset = M09_REGISTER_OFFSET;
reg_addr->reg_offset_x = NO_REGISTER;
reg_addr->reg_offset_y = NO_REGISTER;
break;
}
}
......@@ -1155,6 +1247,7 @@ static const struct edt_i2c_chip_data edt_ft6236_data = {
static const struct i2c_device_id edt_ft5x06_ts_id[] = {
{ .name = "edt-ft5x06", .driver_data = (long)&edt_ft5x06_data },
{ .name = "edt-ft5506", .driver_data = (long)&edt_ft5506_data },
{ .name = "ev-ft5726", .driver_data = (long)&edt_ft5506_data },
/* Note no edt- prefix for compatibility with the ft6236.c driver */
{ .name = "ft6236", .driver_data = (long)&edt_ft6236_data },
{ /* sentinel */ }
......@@ -1167,6 +1260,7 @@ static const struct of_device_id edt_ft5x06_of_match[] = {
{ .compatible = "edt,edt-ft5306", .data = &edt_ft5x06_data },
{ .compatible = "edt,edt-ft5406", .data = &edt_ft5x06_data },
{ .compatible = "edt,edt-ft5506", .data = &edt_ft5506_data },
{ .compatible = "evervision,ev-ft5726", .data = &edt_ft5506_data },
/* Note focaltech vendor prefix for compatibility with ft6236.c */
{ .compatible = "focaltech,ft6236", .data = &edt_ft6236_data },
{ /* sentinel */ }
......
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