@@ -4085,6 +4085,19 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
return error;
}
+ if (data->reset_gpio) {
+ error = gpiod_export(data->reset_gpio, 0);
+ if (error)
+ return error;
+
+ error = gpiod_export_link(&client->dev, "reset",
+ data->reset_gpio);
+ if (error) {
+ gpiod_unexport(data->reset_gpio);
+ return error;
+ }
+ }
+
if (data->suspend_mode == MXT_SUSPEND_REGULATOR) {
error = mxt_acquire_irq(data);
if (error)
@@ -4117,6 +4130,10 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
err_free_object:
mxt_free_input_device(data);
mxt_free_object_table(data);
+ if (data->reset_gpio) {
+ sysfs_remove_link(&client->dev.kobj, "reset");
+ gpiod_unexport(data->reset_gpio);
+ }
return error;
}
@@ -4126,6 +4143,10 @@ static int mxt_remove(struct i2c_client *client)
disable_irq(data->irq);
sysfs_remove_group(&client->dev.kobj, &mxt_fw_attr_group);
+ if (data->reset_gpio) {
+ sysfs_remove_link(&client->dev.kobj, "reset");
+ gpiod_unexport(data->reset_gpio);
+ }
mxt_debug_msg_remove(data);
mxt_sysfs_remove(data);
mxt_free_input_device(data);