summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2016-07-16 16:49:36 +0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-07-19 19:26:33 +0300
commit83505028d859bcbb69691aabade9dc633e5b74ea (patch)
tree6b764182dc15dc49a5fdfcc53349880028443990 /drivers/media
parent58ecc29b5e829c2072fe3a98a93ef163bdb36dd9 (diff)
downloadlinux-83505028d859bcbb69691aabade9dc633e5b74ea.tar.xz
[media] vivid: support monitor all mode
Just pass the transmitted CEC message to all CEC adapters. This implements the Monitor All mode for vivid. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/vivid/vivid-cec.c44
1 files changed, 15 insertions, 29 deletions
diff --git a/drivers/media/platform/vivid/vivid-cec.c b/drivers/media/platform/vivid/vivid-cec.c
index b5714fae905d..66aa7292076b 100644
--- a/drivers/media/platform/vivid/vivid-cec.c
+++ b/drivers/media/platform/vivid/vivid-cec.c
@@ -40,19 +40,18 @@ void vivid_cec_bus_free_work(struct vivid_dev *dev)
spin_unlock(&dev->cec_slock);
}
-static struct cec_adapter *vivid_cec_find_dest_adap(struct vivid_dev *dev,
- struct cec_adapter *adap,
- u8 dest)
+static bool vivid_cec_find_dest_adap(struct vivid_dev *dev,
+ struct cec_adapter *adap, u8 dest)
{
unsigned int i;
if (dest >= 0xf)
- return NULL;
+ return false;
if (adap != dev->cec_rx_adap && dev->cec_rx_adap &&
dev->cec_rx_adap->is_configured &&
cec_has_log_addr(dev->cec_rx_adap, dest))
- return dev->cec_rx_adap;
+ return true;
for (i = 0; i < MAX_OUTPUTS && dev->cec_tx_adap[i]; i++) {
if (adap == dev->cec_tx_adap[i])
@@ -60,9 +59,9 @@ static struct cec_adapter *vivid_cec_find_dest_adap(struct vivid_dev *dev,
if (!dev->cec_tx_adap[i]->is_configured)
continue;
if (cec_has_log_addr(dev->cec_tx_adap[i], dest))
- return dev->cec_tx_adap[i];
+ return true;
}
- return NULL;
+ return false;
}
static void vivid_cec_xfer_done_worker(struct work_struct *work)
@@ -71,18 +70,14 @@ static void vivid_cec_xfer_done_worker(struct work_struct *work)
container_of(work, struct vivid_cec_work, work.work);
struct vivid_dev *dev = cw->dev;
struct cec_adapter *adap = cw->adap;
- bool is_poll = cw->msg.len == 1;
u8 dest = cec_msg_destination(&cw->msg);
- struct cec_adapter *dest_adap = NULL;
bool valid_dest;
unsigned int i;
valid_dest = cec_msg_is_broadcast(&cw->msg);
- if (!valid_dest) {
- dest_adap = vivid_cec_find_dest_adap(dev, adap, dest);
- if (dest_adap)
- valid_dest = true;
- }
+ if (!valid_dest)
+ valid_dest = vivid_cec_find_dest_adap(dev, adap, dest);
+
cw->tx_status = valid_dest ? CEC_TX_STATUS_OK : CEC_TX_STATUS_NACK;
spin_lock(&dev->cec_slock);
dev->cec_xfer_time_jiffies = 0;
@@ -91,21 +86,12 @@ static void vivid_cec_xfer_done_worker(struct work_struct *work)
spin_unlock(&dev->cec_slock);
cec_transmit_done(cw->adap, cw->tx_status, 0, valid_dest ? 0 : 1, 0, 0);
- if (!is_poll && dest_adap) {
- /* Directed message */
- cec_received_msg(dest_adap, &cw->msg);
- } else if (!is_poll && valid_dest) {
- /* Broadcast message */
- if (adap != dev->cec_rx_adap &&
- dev->cec_rx_adap->log_addrs.log_addr_mask)
- cec_received_msg(dev->cec_rx_adap, &cw->msg);
- for (i = 0; i < MAX_OUTPUTS && dev->cec_tx_adap[i]; i++) {
- if (adap == dev->cec_tx_adap[i] ||
- !dev->cec_tx_adap[i]->log_addrs.log_addr_mask)
- continue;
+ /* Broadcast message */
+ if (adap != dev->cec_rx_adap)
+ cec_received_msg(dev->cec_rx_adap, &cw->msg);
+ for (i = 0; i < MAX_OUTPUTS && dev->cec_tx_adap[i]; i++)
+ if (adap != dev->cec_tx_adap[i])
cec_received_msg(dev->cec_tx_adap[i], &cw->msg);
- }
- }
kfree(cw);
}
@@ -245,7 +231,7 @@ struct cec_adapter *vivid_cec_alloc_adap(struct vivid_dev *dev,
{
char name[sizeof(dev->vid_out_dev.name) + 2];
u32 caps = CEC_CAP_TRANSMIT | CEC_CAP_LOG_ADDRS |
- CEC_CAP_PASSTHROUGH | CEC_CAP_RC;
+ CEC_CAP_PASSTHROUGH | CEC_CAP_RC | CEC_CAP_MONITOR_ALL;
snprintf(name, sizeof(name), "%s%d",
is_source ? dev->vid_out_dev.name : dev->vid_cap_dev.name,