Skip to content

Commit d747b80

Browse files
pH5mchehab
authored andcommitted
[media] tc358743: add direct interrupt handling
When probed from device tree, the i2c client driver can handle the interrupt on its own. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 2561482 commit d747b80

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

drivers/media/i2c/tc358743.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <linux/clk.h>
3333
#include <linux/delay.h>
3434
#include <linux/gpio/consumer.h>
35+
#include <linux/interrupt.h>
3536
#include <linux/videodev2.h>
3637
#include <linux/workqueue.h>
3738
#include <linux/v4l2-dv-timings.h>
@@ -1306,6 +1307,16 @@ static int tc358743_isr(struct v4l2_subdev *sd, u32 status, bool *handled)
13061307
return 0;
13071308
}
13081309

1310+
static irqreturn_t tc358743_irq_handler(int irq, void *dev_id)
1311+
{
1312+
struct tc358743_state *state = dev_id;
1313+
bool handled;
1314+
1315+
tc358743_isr(&state->sd, 0, &handled);
1316+
1317+
return handled ? IRQ_HANDLED : IRQ_NONE;
1318+
}
1319+
13091320
/* --------------- VIDEO OPS --------------- */
13101321

13111322
static int tc358743_g_input_status(struct v4l2_subdev *sd, u32 *status)
@@ -1876,6 +1887,17 @@ static int tc358743_probe(struct i2c_client *client,
18761887
tc358743_set_csi_color_space(sd);
18771888

18781889
tc358743_init_interrupts(sd);
1890+
1891+
if (state->i2c_client->irq) {
1892+
err = devm_request_threaded_irq(&client->dev,
1893+
state->i2c_client->irq,
1894+
NULL, tc358743_irq_handler,
1895+
IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
1896+
"tc358743", state);
1897+
if (err)
1898+
goto err_work_queues;
1899+
}
1900+
18791901
tc358743_enable_interrupts(sd, tx_5v_power_present(sd));
18801902
i2c_wr16(sd, INTMASK, ~(MASK_HDMI_MSK | MASK_CSI_MSK) & 0xffff);
18811903

0 commit comments

Comments
 (0)