2 * AD7879-1/AD7889-1 touchscreen (I2C bus)
4 * Copyright (C) 2008-2010 Michael Hennerich, Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
9 #include <linux/input.h> /* BUS_I2C */
10 #include <linux/i2c.h>
11 #include <linux/module.h>
12 #include <linux/types.h>
15 #include <linux/regmap.h>
19 #define AD7879_DEVID 0x79 /* AD7879-1/AD7889-1 */
21 static const struct regmap_config ad7879_i2c_regmap_config
= {
27 static int ad7879_i2c_probe(struct i2c_client
*client
,
28 const struct i2c_device_id
*id
)
30 struct regmap
*regmap
;
32 if (!i2c_check_functionality(client
->adapter
,
33 I2C_FUNC_SMBUS_WORD_DATA
)) {
34 dev_err(&client
->dev
, "SMBUS Word Data not Supported\n");
38 regmap
= devm_regmap_init_i2c(client
, &ad7879_i2c_regmap_config
);
40 return PTR_ERR(regmap
);
42 return ad7879_probe(&client
->dev
, regmap
, client
->irq
,
43 BUS_I2C
, AD7879_DEVID
);
46 static const struct i2c_device_id ad7879_id
[] = {
51 MODULE_DEVICE_TABLE(i2c
, ad7879_id
);
54 static const struct of_device_id ad7879_i2c_dt_ids
[] = {
55 { .compatible
= "adi,ad7879-1", },
58 MODULE_DEVICE_TABLE(of
, ad7879_i2c_dt_ids
);
61 static struct i2c_driver ad7879_i2c_driver
= {
65 .of_match_table
= of_match_ptr(ad7879_i2c_dt_ids
),
67 .probe
= ad7879_i2c_probe
,
68 .id_table
= ad7879_id
,
71 module_i2c_driver(ad7879_i2c_driver
);
73 MODULE_AUTHOR("Michael Hennerich <michael.hennerich@analog.com>");
74 MODULE_DESCRIPTION("AD7879(-1) touchscreen I2C bus driver");
75 MODULE_LICENSE("GPL");