diff options
author | Mats Randgaard <matrandg@cisco.com> | 2013-08-14 06:58:45 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-08-24 03:19:45 -0400 |
commit | 25a64ac95055d87e2e7b86ba3b9a81e91cb55a39 (patch) | |
tree | cbd315027baa86ceacfa1f0564fdc9d45ac3700e /drivers/media | |
parent | c3e75c7d5e203b6d1d16519bef8571b5d228b7fe (diff) |
[media] adv7604: debounce "format change" notifications
The bridge driver is only notified when the input status has changed
since the previous interrupt.
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>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/i2c/adv7604.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 3ec7ec0911ca..d093092988f8 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c | |||
@@ -77,6 +77,7 @@ struct adv7604_state { | |||
77 | struct delayed_work delayed_work_enable_hotplug; | 77 | struct delayed_work delayed_work_enable_hotplug; |
78 | bool connector_hdmi; | 78 | bool connector_hdmi; |
79 | bool restart_stdi_once; | 79 | bool restart_stdi_once; |
80 | u32 prev_input_status; | ||
80 | 81 | ||
81 | /* i2c clients */ | 82 | /* i2c clients */ |
82 | struct i2c_client *i2c_avlink; | 83 | struct i2c_client *i2c_avlink; |
@@ -1535,6 +1536,7 @@ static int adv7604_isr(struct v4l2_subdev *sd, u32 status, bool *handled) | |||
1535 | { | 1536 | { |
1536 | struct adv7604_state *state = to_state(sd); | 1537 | struct adv7604_state *state = to_state(sd); |
1537 | u8 fmt_change, fmt_change_digital, tx_5v; | 1538 | u8 fmt_change, fmt_change_digital, tx_5v; |
1539 | u32 input_status; | ||
1538 | 1540 | ||
1539 | /* format change */ | 1541 | /* format change */ |
1540 | fmt_change = io_read(sd, 0x43) & 0x98; | 1542 | fmt_change = io_read(sd, 0x43) & 0x98; |
@@ -1545,9 +1547,18 @@ static int adv7604_isr(struct v4l2_subdev *sd, u32 status, bool *handled) | |||
1545 | io_write(sd, 0x6c, fmt_change_digital); | 1547 | io_write(sd, 0x6c, fmt_change_digital); |
1546 | if (fmt_change || fmt_change_digital) { | 1548 | if (fmt_change || fmt_change_digital) { |
1547 | v4l2_dbg(1, debug, sd, | 1549 | v4l2_dbg(1, debug, sd, |
1548 | "%s: ADV7604_FMT_CHANGE, fmt_change = 0x%x, fmt_change_digital = 0x%x\n", | 1550 | "%s: fmt_change = 0x%x, fmt_change_digital = 0x%x\n", |
1549 | __func__, fmt_change, fmt_change_digital); | 1551 | __func__, fmt_change, fmt_change_digital); |
1550 | v4l2_subdev_notify(sd, ADV7604_FMT_CHANGE, NULL); | 1552 | |
1553 | adv7604_g_input_status(sd, &input_status); | ||
1554 | if (input_status != state->prev_input_status) { | ||
1555 | v4l2_dbg(1, debug, sd, | ||
1556 | "%s: input_status = 0x%x, prev_input_status = 0x%x\n", | ||
1557 | __func__, input_status, state->prev_input_status); | ||
1558 | state->prev_input_status = input_status; | ||
1559 | v4l2_subdev_notify(sd, ADV7604_FMT_CHANGE, NULL); | ||
1560 | } | ||
1561 | |||
1551 | if (handled) | 1562 | if (handled) |
1552 | *handled = true; | 1563 | *handled = true; |
1553 | } | 1564 | } |
@@ -1953,6 +1964,10 @@ static int adv7604_probe(struct i2c_client *client, | |||
1953 | return -ENOMEM; | 1964 | return -ENOMEM; |
1954 | } | 1965 | } |
1955 | 1966 | ||
1967 | /* initialize variables */ | ||
1968 | state->restart_stdi_once = true; | ||
1969 | state->prev_input_status = ~0; | ||
1970 | |||
1956 | /* platform data */ | 1971 | /* platform data */ |
1957 | if (!pdata) { | 1972 | if (!pdata) { |
1958 | v4l_err(client, "No platform data!\n"); | 1973 | v4l_err(client, "No platform data!\n"); |
@@ -2036,7 +2051,6 @@ static int adv7604_probe(struct i2c_client *client, | |||
2036 | v4l2_err(sd, "failed to create all i2c clients\n"); | 2051 | v4l2_err(sd, "failed to create all i2c clients\n"); |
2037 | goto err_i2c; | 2052 | goto err_i2c; |
2038 | } | 2053 | } |
2039 | state->restart_stdi_once = true; | ||
2040 | 2054 | ||
2041 | /* work queues */ | 2055 | /* work queues */ |
2042 | state->work_queues = create_singlethread_workqueue(client->name); | 2056 | state->work_queues = create_singlethread_workqueue(client->name); |