When using the device tree to configure the kernel I2C devices,
the devices are not probed. So if we want to support multiple optional
peripherals, we might end up executing their probe callback.
In that case, just probe early the Atmel chip on the i2c and bail out
early if it is not present.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=chrome-os-partner:17825
TEST=boot a machine with an Atmel trackpad attached and one with Cypress
trackpad and have a working pointer on both of them.
Change-Id: I0c948cac2a38f587cc5f1efa5ba424715f25804d
Reviewed-on: https://gerrit.chromium.org/gerrit/43229
Reviewed-by: Benson Leung <bleung@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
const struct mxt_platform_data *pdata = client->dev.platform_data;
struct mxt_data *data;
int error;
+ union i2c_smbus_data dummy;
+
+ /* Make sure there is something at this address */
+ if (client->dev.of_node && i2c_smbus_xfer(client->adapter, client->addr,
+ 0, I2C_SMBUS_READ, 0, I2C_SMBUS_BYTE, &dummy) < 0)
+ return -ENODEV;
data = kzalloc(sizeof(struct mxt_data), GFP_KERNEL);
if (!data) {