- compatible : "rohm,bu21013_tp"
- reg : I2C device address
- reset-gpios : GPIO pin enabling (selecting) chip (CS)
+ - interrupt-parent : the phandle for the gpio controller
+ - interrupts : (gpio) interrupt to which the chip is connected
Optional properties:
- touch-gpios : GPIO pin registering a touch event
bu21013_tp@5c {
compatible = "rohm,bu21013_tp";
reg = <0x5c>;
- touch-gpio = <&gpio2 20 0x4>;
+ interrupt-parent = <&gpio2>;
+ interrupts <&20 IRQ_TYPE_LEVEL_LOW>;
+ touch-gpio = <&gpio2 20 GPIO_ACTIVE_LOW>;
avdd-supply = <&ab8500_ldo_aux1_reg>;
rohm,touch-max-x = <384>;
* @regulator: pointer to the Regulator used for touch screen
* @cs_gpiod: chip select GPIO line
* @int_gpiod: touch interrupt GPIO line
- * @irq: interrupt number the device is using
* @touch_x_max: maximum X coordinate reported by the device
* @touch_y_max: maximum Y coordinate reported by the device
* @x_flip: indicates that the driver should invert X coordinate before
struct regulator *regulator;
struct gpio_desc *cs_gpiod;
struct gpio_desc *int_gpiod;
- unsigned int irq;
u32 touch_x_max;
u32 touch_y_max;
bool x_flip;
if (unlikely(ts->touch_stopped))
break;
- keep_polling = gpiod_get_value(ts->int_gpiod);
+ keep_polling = ts->int_gpiod ?
+ gpiod_get_value(ts->int_gpiod) : false;
if (keep_polling)
usleep_range(2000, 2500);
} while (keep_polling);
return -EIO;
}
+ if (!client->irq) {
+ dev_err(&client->dev, "No IRQ set up\n");
+ return -EINVAL;
+ }
+
ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL);
if (!ts)
return -ENOMEM;
}
/* Named "INT" on the chip, DT binding is "touch" */
- ts->int_gpiod = devm_gpiod_get(&client->dev, "touch", GPIOD_IN);
+ ts->int_gpiod = devm_gpiod_get_optional(&client->dev,
+ "touch", GPIOD_IN);
error = PTR_ERR_OR_ZERO(ts->int_gpiod);
if (error) {
if (error != -EPROBE_DEFER)
dev_err(&client->dev, "failed to get INT GPIO\n");
return error;
}
- gpiod_set_consumer_name(ts->int_gpiod, "BU21013 INT");
+
+ if (ts->int_gpiod)
+ gpiod_set_consumer_name(ts->int_gpiod, "BU21013 INT");
/* configure the touch panel controller */
error = bu21013_init_chip(ts);
return error;
}
- ts->irq = gpiod_to_irq(ts->int_gpiod);
- error = devm_request_threaded_irq(&client->dev, ts->irq,
+ error = devm_request_threaded_irq(&client->dev, client->irq,
NULL, bu21013_gpio_irq,
- IRQF_TRIGGER_FALLING |
- IRQF_SHARED |
- IRQF_ONESHOT,
- DRIVER_TP, ts);
+ IRQF_ONESHOT, DRIVER_TP, ts);
if (error) {
dev_err(&client->dev, "request irq %d failed\n",
- ts->irq);
+ client->irq);
return error;
}
ts->touch_stopped = true;
if (device_may_wakeup(&client->dev))
- enable_irq_wake(ts->irq);
+ enable_irq_wake(client->irq);
else
- disable_irq(ts->irq);
+ disable_irq(client->irq);
regulator_disable(ts->regulator);
ts->touch_stopped = false;
if (device_may_wakeup(&client->dev))
- disable_irq_wake(ts->irq);
+ disable_irq_wake(client->irq);
else
- enable_irq(ts->irq);
+ enable_irq(client->irq);
return 0;
}