I am trying to get an i2c device driver for an Atmel capacitive touchscreen controller to work in the Linux Kernel of our Android Lollipop (version 5.0.2) based system. I have added the manufacturer supplied updated source code (atmel_mxt_ts.c) to kernel/drivers/input/touchscreen, and modified the devicetree as appropriate, but when the kernel boots, i2c_device_register never gets called for this particular driver. This means I am unable to communicate with this device on the i2C bus, and consequently the touchpanel will not work. Note that this driver file was already present in the kernel, I just needed to make sure it was included in the kernel build, by running make menuconfig, and doing a full clean build. The i2c_device_register function is being called for other i2c drivers, such as the battery driver, as I can see printk output for them. Note also that the device address for this device is shown in sysfs. i.e. a directory listing for the relevant i2c bus shows the following:
root@var_mx6:/ # ls /sys/bus/i2c/devices/i2c-2/
2-000b
2-004a
2-0068
delete_device
i2c-dev
name
new_device
power
subsystem
uevent
004a is the address of the Atmel capacitive touch device, 000b is the SMBus battery, and 0068 is an RTC device.
Does anyone have any suggestions as to why the i2c_register_driver is not getting called for the Atmel capacitive touch device driver?
I have included some snippets of code below.
Here is the last part of the driver source file atmel_mxt_ts.c:
static const struct of_device_id mxt_of_match[] = {
{ .compatible = "atmel,atmel_mxt_ts"},
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, mxt_of_match);
#ifdef CONFIG_ACPI
static const struct acpi_device_id mxt_acpi_id[] = {
{ "ATML0000", 0 }, /* Touchpad */
{ "ATML0001", 0 }, /* Touchscreen */
{ }
};
MODULE_DEVICE_TABLE(acpi, mxt_acpi_id);
#endif
static const struct i2c_device_id mxt_id[] = {
{ "atmel_mxt_ts", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, mxt_id);
static struct i2c_driver mxt_driver = {
.driver = {
.name = "atmel_mxt_ts",
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(mxt_of_match),
.acpi_match_table = ACPI_PTR(mxt_acpi_id),
.pm = &mxt_pm_ops,
},
.probe = mxt_probe,
.remove = mxt_remove,
.id_table = mxt_id,
};
module_i2c_driver(mxt_driver);
/* Module information */
MODULE_AUTHOR("Joonyoung Shim <[email protected]>");
MODULE_DESCRIPTION("Atmel maXTouch Touchscreen driver");
MODULE_LICENSE("GPL");
and here is the relevant section of the devicetree source:
&i2c3 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c3_3>;
status = "okay";
battery {
compatible = "ti,bq20z75";
reg = <0xb>;
/* nBATT_PRES */
battery-detect-gpios = <&expander1 4 GPIO_ACTIVE_LOW>;
power-supplies = <&charger>;
};
touch@4a {
compatible = "atmel,atmel_mxt_ts";
reg = <0x4a>;
interrupt-parent = <&gpio1>;
interrupts = <4 1>;
};
/* DS1307 RTC module */
rtc@0x68 {
compatible = "dallas,ds1307";
reg = <0x68>;
};
};
Makefile
andKconfig
files indrivers/input/touchscreen/
. Did you update them? Did you reconfigure the kernel and select the new touchscreen driver? And of course, did you rebuild and install the kernel and devicetree? – Ian Abbott/sys/bus/i2c/drivers
directory? – Ian Abbott