diff options
author | Mats Randgaard <matrandg@cisco.com> | 2013-12-05 08:26:11 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-01-07 03:07:48 -0500 |
commit | 14d03233517001849742e45803219755430a5eed (patch) | |
tree | 5ed576aa2812650582625f3976b7d92673d782a8 | |
parent | ff4f80fdfaefb7906ed58ec36248591687f927b5 (diff) |
[media] adv7604: remove debouncing of ADV7604_FMT_CHANGE events
ADV7604_FMT_CHANGE events was debounced in adv7604_isr() to avoid
that a receiver with a unstable input signal would block the event
handling for other inputs. This solution was prone to errors.
A better protection agains interrupt blocking is to delay the call
of the interrupt service routine in the adv7604 driver if too many
interrupts are received within a given time.
Signed-off-by: Mats Randgaard <matrandg@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r-- | drivers/media/i2c/adv7604.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 4e7d39a5b20e..442f70a279a1 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c | |||
@@ -78,7 +78,6 @@ struct adv7604_state { | |||
78 | struct workqueue_struct *work_queues; | 78 | struct workqueue_struct *work_queues; |
79 | struct delayed_work delayed_work_enable_hotplug; | 79 | struct delayed_work delayed_work_enable_hotplug; |
80 | bool restart_stdi_once; | 80 | bool restart_stdi_once; |
81 | u32 prev_input_status; | ||
82 | 81 | ||
83 | /* i2c clients */ | 82 | /* i2c clients */ |
84 | struct i2c_client *i2c_avlink; | 83 | struct i2c_client *i2c_avlink; |
@@ -1524,9 +1523,7 @@ static int adv7604_g_mbus_fmt(struct v4l2_subdev *sd, | |||
1524 | 1523 | ||
1525 | static int adv7604_isr(struct v4l2_subdev *sd, u32 status, bool *handled) | 1524 | static int adv7604_isr(struct v4l2_subdev *sd, u32 status, bool *handled) |
1526 | { | 1525 | { |
1527 | struct adv7604_state *state = to_state(sd); | ||
1528 | u8 fmt_change, fmt_change_digital, tx_5v; | 1526 | u8 fmt_change, fmt_change_digital, tx_5v; |
1529 | u32 input_status; | ||
1530 | 1527 | ||
1531 | v4l2_dbg(2, debug, sd, "%s: ", __func__); | 1528 | v4l2_dbg(2, debug, sd, "%s: ", __func__); |
1532 | 1529 | ||
@@ -1534,22 +1531,17 @@ static int adv7604_isr(struct v4l2_subdev *sd, u32 status, bool *handled) | |||
1534 | fmt_change = io_read(sd, 0x43) & 0x98; | 1531 | fmt_change = io_read(sd, 0x43) & 0x98; |
1535 | if (fmt_change) | 1532 | if (fmt_change) |
1536 | io_write(sd, 0x44, fmt_change); | 1533 | io_write(sd, 0x44, fmt_change); |
1534 | |||
1537 | fmt_change_digital = is_digital_input(sd) ? (io_read(sd, 0x6b) & 0xc0) : 0; | 1535 | fmt_change_digital = is_digital_input(sd) ? (io_read(sd, 0x6b) & 0xc0) : 0; |
1538 | if (fmt_change_digital) | 1536 | if (fmt_change_digital) |
1539 | io_write(sd, 0x6c, fmt_change_digital); | 1537 | io_write(sd, 0x6c, fmt_change_digital); |
1538 | |||
1540 | if (fmt_change || fmt_change_digital) { | 1539 | if (fmt_change || fmt_change_digital) { |
1541 | v4l2_dbg(1, debug, sd, | 1540 | v4l2_dbg(1, debug, sd, |
1542 | "%s: fmt_change = 0x%x, fmt_change_digital = 0x%x\n", | 1541 | "%s: fmt_change = 0x%x, fmt_change_digital = 0x%x\n", |
1543 | __func__, fmt_change, fmt_change_digital); | 1542 | __func__, fmt_change, fmt_change_digital); |
1544 | 1543 | ||
1545 | adv7604_g_input_status(sd, &input_status); | 1544 | v4l2_subdev_notify(sd, ADV7604_FMT_CHANGE, NULL); |
1546 | if (input_status != state->prev_input_status) { | ||
1547 | v4l2_dbg(1, debug, sd, | ||
1548 | "%s: input_status = 0x%x, prev_input_status = 0x%x\n", | ||
1549 | __func__, input_status, state->prev_input_status); | ||
1550 | state->prev_input_status = input_status; | ||
1551 | v4l2_subdev_notify(sd, ADV7604_FMT_CHANGE, NULL); | ||
1552 | } | ||
1553 | 1545 | ||
1554 | if (handled) | 1546 | if (handled) |
1555 | *handled = true; | 1547 | *handled = true; |
@@ -2129,7 +2121,6 @@ static int adv7604_probe(struct i2c_client *client, | |||
2129 | 2121 | ||
2130 | /* initialize variables */ | 2122 | /* initialize variables */ |
2131 | state->restart_stdi_once = true; | 2123 | state->restart_stdi_once = true; |
2132 | state->prev_input_status = ~0; | ||
2133 | state->selected_input = ~0; | 2124 | state->selected_input = ~0; |
2134 | 2125 | ||
2135 | /* platform data */ | 2126 | /* platform data */ |