diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-07-23 07:59:19 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-07-23 07:59:19 -0300 |
commit | c278256d05a2fc75b427fa6a5dc0024faa93465d (patch) | |
tree | 2c09c6c65a4b6c597a568ec2425adb75eff7d5d5 /drivers/media/platform/vivid/vivid-cec.c | |
parent | 7e5b7d1b3a8facd4dc1ddb5d9ec53c0687d13de7 (diff) | |
parent | 009a620848218d521f008141c62f56bf19294dd9 (diff) | |
download | op-kernel-dev-c278256d05a2fc75b427fa6a5dc0024faa93465d.zip op-kernel-dev-c278256d05a2fc75b427fa6a5dc0024faa93465d.tar.gz |
Merge branch 'patchwork' into topic/docs-next
* patchwork: (1492 commits)
[media] cec: always check all_device_types and features
[media] cec: poll should check if there is room in the tx queue
[media] vivid: support monitor all mode
[media] cec: fix test for unconfigured adapter in main message loop
[media] cec: limit the size of the transmit queue
[media] cec: zero unused msg part after msg->len
[media] cec: don't set fh to NULL in CEC_TRANSMIT
[media] cec: clear all status fields before transmit and always fill in sequence
[media] cec: CEC_RECEIVE overwrote the timeout field
[media] cxd2841er: Reading SNR for DVB-C added
[media] cxd2841er: Reading BER and UCB for DVB-C added
[media] cxd2841er: fix switch-case for DVB-C
[media] cxd2841er: fix signal strength scale for ISDB-T
[media] cxd2841er: adjust the dB scale for DVB-C
[media] cxd2841er: provide signal strength for DVB-C
[media] cxd2841er: fix BER report via DVBv5 stats API
[media] mb86a20s: apply mask to val after checking for read failure
[media] airspy: fix error logic during device register
[media] s5p-cec/TODO: add TODO item
[media] cec/TODO: drop comment about sphinx documentation
...
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/platform/vivid/vivid-cec.c')
-rw-r--r-- | drivers/media/platform/vivid/vivid-cec.c | 44 |
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 b5714fa..66aa7292 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, |