Lines Matching refs:adap
26 static void cec_fill_msg_report_features(struct cec_adapter *adap,
42 #define call_op(adap, op, arg...) \ argument
43 (adap->ops->op ? adap->ops->op(adap, ## arg) : 0)
45 #define call_void_op(adap, op, arg...) \ argument
47 if (adap->ops->op) \
48 adap->ops->op(adap, ## arg); \
51 static int cec_log_addr2idx(const struct cec_adapter *adap, u8 log_addr) in cec_log_addr2idx() argument
55 for (i = 0; i < adap->log_addrs.num_log_addrs; i++) in cec_log_addr2idx()
56 if (adap->log_addrs.log_addr[i] == log_addr) in cec_log_addr2idx()
61 static unsigned int cec_log_addr2dev(const struct cec_adapter *adap, u8 log_addr) in cec_log_addr2dev() argument
63 int i = cec_log_addr2idx(adap, log_addr); in cec_log_addr2dev()
65 return adap->log_addrs.primary_device_type[i < 0 ? 0 : i]; in cec_log_addr2dev()
158 static void cec_queue_event(struct cec_adapter *adap, in cec_queue_event() argument
164 mutex_lock(&adap->devnode.lock_fhs); in cec_queue_event()
165 list_for_each_entry(fh, &adap->devnode.fhs, list) in cec_queue_event()
167 mutex_unlock(&adap->devnode.lock_fhs); in cec_queue_event()
171 void cec_queue_pin_cec_event(struct cec_adapter *adap, bool is_high, in cec_queue_pin_cec_event() argument
181 mutex_lock(&adap->devnode.lock_fhs); in cec_queue_pin_cec_event()
182 list_for_each_entry(fh, &adap->devnode.fhs, list) { in cec_queue_pin_cec_event()
186 mutex_unlock(&adap->devnode.lock_fhs); in cec_queue_pin_cec_event()
191 void cec_queue_pin_hpd_event(struct cec_adapter *adap, bool is_high, ktime_t ts) in cec_queue_pin_hpd_event() argument
199 mutex_lock(&adap->devnode.lock_fhs); in cec_queue_pin_hpd_event()
200 list_for_each_entry(fh, &adap->devnode.fhs, list) in cec_queue_pin_hpd_event()
202 mutex_unlock(&adap->devnode.lock_fhs); in cec_queue_pin_hpd_event()
207 void cec_queue_pin_5v_event(struct cec_adapter *adap, bool is_high, ktime_t ts) in cec_queue_pin_5v_event() argument
215 mutex_lock(&adap->devnode.lock_fhs); in cec_queue_pin_5v_event()
216 list_for_each_entry(fh, &adap->devnode.fhs, list) in cec_queue_pin_5v_event()
218 mutex_unlock(&adap->devnode.lock_fhs); in cec_queue_pin_5v_event()
282 static void cec_queue_msg_monitor(struct cec_adapter *adap, in cec_queue_msg_monitor() argument
290 mutex_lock(&adap->devnode.lock_fhs); in cec_queue_msg_monitor()
291 list_for_each_entry(fh, &adap->devnode.fhs, list) { in cec_queue_msg_monitor()
295 mutex_unlock(&adap->devnode.lock_fhs); in cec_queue_msg_monitor()
301 static void cec_queue_msg_followers(struct cec_adapter *adap, in cec_queue_msg_followers() argument
306 mutex_lock(&adap->devnode.lock_fhs); in cec_queue_msg_followers()
307 list_for_each_entry(fh, &adap->devnode.fhs, list) { in cec_queue_msg_followers()
311 mutex_unlock(&adap->devnode.lock_fhs); in cec_queue_msg_followers()
315 static void cec_post_state_event(struct cec_adapter *adap) in cec_post_state_event() argument
321 ev.state_change.phys_addr = adap->phys_addr; in cec_post_state_event()
322 ev.state_change.log_addr_mask = adap->log_addrs.log_addr_mask; in cec_post_state_event()
324 adap->conn_info.type != CEC_CONNECTOR_TYPE_NO_CONNECTOR; in cec_post_state_event()
325 cec_queue_event(adap, &ev); in cec_post_state_event()
379 if (data->adap->transmitting == data) { in cec_data_cancel()
380 data->adap->transmitting = NULL; in cec_data_cancel()
384 if (!WARN_ON(!data->adap->transmit_queue_sz)) in cec_data_cancel()
385 data->adap->transmit_queue_sz--; in cec_data_cancel()
400 cec_queue_msg_monitor(data->adap, &data->msg, 1); in cec_data_cancel()
410 static void cec_flush(struct cec_adapter *adap) in cec_flush() argument
418 while (!list_empty(&adap->transmit_queue)) { in cec_flush()
419 data = list_first_entry(&adap->transmit_queue, in cec_flush()
423 if (adap->transmitting) in cec_flush()
424 cec_data_cancel(adap->transmitting, CEC_TX_STATUS_ABORTED); in cec_flush()
427 list_for_each_entry_safe(data, n, &adap->wait_queue, list) { in cec_flush()
443 if (WARN_ON(adap->transmit_queue_sz)) in cec_flush()
444 adap->transmit_queue_sz = 0; in cec_flush()
461 struct cec_adapter *adap = _adap; in cec_thread_func() local
469 if (adap->transmit_in_progress) { in cec_thread_func()
479 err = wait_event_interruptible_timeout(adap->kthread_waitq, in cec_thread_func()
480 (adap->needs_hpd && in cec_thread_func()
481 (!adap->is_configured && !adap->is_configuring)) || in cec_thread_func()
483 (!adap->transmit_in_progress && in cec_thread_func()
484 !list_empty(&adap->transmit_queue)), in cec_thread_func()
489 wait_event_interruptible(adap->kthread_waitq, in cec_thread_func()
491 (!adap->transmit_in_progress && in cec_thread_func()
492 !list_empty(&adap->transmit_queue))); in cec_thread_func()
495 mutex_lock(&adap->lock); in cec_thread_func()
497 if ((adap->needs_hpd && in cec_thread_func()
498 (!adap->is_configured && !adap->is_configuring)) || in cec_thread_func()
500 cec_flush(adap); in cec_thread_func()
504 if (adap->transmit_in_progress && timeout) { in cec_thread_func()
513 if (adap->transmitting) { in cec_thread_func()
514 pr_warn("cec-%s: message %*ph timed out\n", adap->name, in cec_thread_func()
515 adap->transmitting->msg.len, in cec_thread_func()
516 adap->transmitting->msg.msg); in cec_thread_func()
518 cec_data_cancel(adap->transmitting, in cec_thread_func()
521 pr_warn("cec-%s: transmit timed out\n", adap->name); in cec_thread_func()
523 adap->transmit_in_progress = false; in cec_thread_func()
524 adap->tx_timeouts++; in cec_thread_func()
532 if (adap->transmit_in_progress || list_empty(&adap->transmit_queue)) in cec_thread_func()
536 data = list_first_entry(&adap->transmit_queue, in cec_thread_func()
539 if (!WARN_ON(!data->adap->transmit_queue_sz)) in cec_thread_func()
540 adap->transmit_queue_sz--; in cec_thread_func()
543 adap->transmitting = data; in cec_thread_func()
551 if (data->msg.len == 1 && adap->is_configured) in cec_thread_func()
560 } else if (adap->last_initiator != in cec_thread_func()
564 adap->last_initiator = cec_msg_initiator(&data->msg); in cec_thread_func()
576 if (adap->ops->adap_transmit(adap, data->attempts, in cec_thread_func()
580 adap->transmit_in_progress = true; in cec_thread_func()
583 mutex_unlock(&adap->lock); in cec_thread_func()
594 void cec_transmit_done_ts(struct cec_adapter *adap, u8 status, in cec_transmit_done_ts() argument
607 mutex_lock(&adap->lock); in cec_transmit_done_ts()
608 data = adap->transmitting; in cec_transmit_done_ts()
615 if (!adap->transmit_in_progress) in cec_transmit_done_ts()
618 adap->transmit_in_progress = false; in cec_transmit_done_ts()
621 adap->transmit_in_progress = false; in cec_transmit_done_ts()
635 adap->transmitting = NULL; in cec_transmit_done_ts()
653 list_add(&data->list, &adap->transmit_queue); in cec_transmit_done_ts()
654 adap->transmit_queue_sz++; in cec_transmit_done_ts()
665 cec_queue_msg_monitor(adap, msg, 1); in cec_transmit_done_ts()
667 if ((status & CEC_TX_STATUS_OK) && adap->is_configured && in cec_transmit_done_ts()
673 list_add_tail(&data->list, &adap->wait_queue); in cec_transmit_done_ts()
686 wake_up_interruptible(&adap->kthread_waitq); in cec_transmit_done_ts()
687 mutex_unlock(&adap->lock); in cec_transmit_done_ts()
691 void cec_transmit_attempt_done_ts(struct cec_adapter *adap, in cec_transmit_attempt_done_ts() argument
696 cec_transmit_done_ts(adap, status, 0, 0, 0, 0, ts); in cec_transmit_attempt_done_ts()
699 cec_transmit_done_ts(adap, status, 1, 0, 0, 0, ts); in cec_transmit_attempt_done_ts()
702 cec_transmit_done_ts(adap, status, 0, 1, 0, 0, ts); in cec_transmit_attempt_done_ts()
705 cec_transmit_done_ts(adap, status, 0, 0, 1, 0, ts); in cec_transmit_attempt_done_ts()
708 cec_transmit_done_ts(adap, status, 0, 0, 0, 1, ts); in cec_transmit_attempt_done_ts()
712 WARN(1, "cec-%s: invalid status 0x%02x\n", adap->name, status); in cec_transmit_attempt_done_ts()
724 struct cec_adapter *adap = data->adap; in cec_wait_timeout() local
726 mutex_lock(&adap->lock); in cec_wait_timeout()
740 mutex_unlock(&adap->lock); in cec_wait_timeout()
749 int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, in cec_transmit_msg_fh() argument
755 if (adap->devnode.unregistered) in cec_transmit_msg_fh()
803 if ((adap->log_addrs.flags & CEC_LOG_ADDRS_FL_CDC_ONLY) && in cec_transmit_msg_fh()
810 msg->msg[2] = adap->phys_addr >> 8; in cec_transmit_msg_fh()
811 msg->msg[3] = adap->phys_addr & 0xff; in cec_transmit_msg_fh()
820 if (cec_has_log_addr(adap, cec_msg_destination(msg))) { in cec_transmit_msg_fh()
833 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
835 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
840 cec_has_log_addr(adap, cec_msg_destination(msg))) { in cec_transmit_msg_fh()
845 if (msg->len > 1 && adap->is_configured && in cec_transmit_msg_fh()
846 !cec_has_log_addr(adap, cec_msg_initiator(msg))) { in cec_transmit_msg_fh()
857 if (!adap->is_configured && !adap->is_configuring && in cec_transmit_msg_fh()
867 if (!adap->is_configured && !adap->is_configuring) { in cec_transmit_msg_fh()
868 if (adap->needs_hpd) { in cec_transmit_msg_fh()
879 if (adap->transmit_queue_sz >= CEC_MAX_MSG_TX_QUEUE_SZ) { in cec_transmit_msg_fh()
888 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
890 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
894 data->adap = adap; in cec_transmit_msg_fh()
903 list_add_tail(&data->list, &adap->transmit_queue); in cec_transmit_msg_fh()
904 adap->transmit_queue_sz++; in cec_transmit_msg_fh()
905 if (!adap->transmitting) in cec_transmit_msg_fh()
906 wake_up_interruptible(&adap->kthread_waitq); in cec_transmit_msg_fh()
915 mutex_unlock(&adap->lock); in cec_transmit_msg_fh()
919 mutex_lock(&adap->lock); in cec_transmit_msg_fh()
932 int cec_transmit_msg(struct cec_adapter *adap, struct cec_msg *msg, in cec_transmit_msg() argument
937 mutex_lock(&adap->lock); in cec_transmit_msg()
938 ret = cec_transmit_msg_fh(adap, msg, NULL, block); in cec_transmit_msg()
939 mutex_unlock(&adap->lock); in cec_transmit_msg()
949 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg,
1042 void cec_received_msg_ts(struct cec_adapter *adap, in cec_received_msg_ts() argument
1056 if (adap->devnode.unregistered) in cec_received_msg_ts()
1071 cec_has_log_addr(adap, msg_init)) in cec_received_msg_ts()
1086 mutex_lock(&adap->lock); in cec_received_msg_ts()
1089 if (!adap->transmit_in_progress) in cec_received_msg_ts()
1090 adap->last_initiator = 0xff; in cec_received_msg_ts()
1094 valid_la = cec_has_log_addr(adap, msg_dest); in cec_received_msg_ts()
1113 adap->log_addrs.cec_version < CEC_OP_CEC_VERSION_2_0 && in cec_received_msg_ts()
1171 list_for_each_entry(data, &adap->wait_queue, list) { in cec_received_msg_ts()
1210 mutex_unlock(&adap->lock); in cec_received_msg_ts()
1212 mutex_lock(&adap->lock); in cec_received_msg_ts()
1224 mutex_unlock(&adap->lock); in cec_received_msg_ts()
1227 cec_queue_msg_monitor(adap, msg, valid_la); in cec_received_msg_ts()
1233 if (adap->log_addrs.log_addr_mask == 0) in cec_received_msg_ts()
1241 cec_receive_notify(adap, msg, is_reply); in cec_received_msg_ts()
1252 static int cec_config_log_addr(struct cec_adapter *adap, in cec_config_log_addr() argument
1256 struct cec_log_addrs *las = &adap->log_addrs; in cec_config_log_addr()
1262 if (cec_has_log_addr(adap, log_addr)) in cec_config_log_addr()
1270 err = cec_transmit_msg_fh(adap, &msg, NULL, true); in cec_config_log_addr()
1276 if (adap->phys_addr == CEC_PHYS_ADDR_INVALID) in cec_config_log_addr()
1312 err = adap->ops->adap_log_addr(adap, log_addr); in cec_config_log_addr()
1327 static void cec_adap_unconfigure(struct cec_adapter *adap) in cec_adap_unconfigure() argument
1329 if (!adap->needs_hpd || in cec_adap_unconfigure()
1330 adap->phys_addr != CEC_PHYS_ADDR_INVALID) in cec_adap_unconfigure()
1331 WARN_ON(adap->ops->adap_log_addr(adap, CEC_LOG_ADDR_INVALID)); in cec_adap_unconfigure()
1332 adap->log_addrs.log_addr_mask = 0; in cec_adap_unconfigure()
1333 adap->is_configured = false; in cec_adap_unconfigure()
1334 cec_flush(adap); in cec_adap_unconfigure()
1335 wake_up_interruptible(&adap->kthread_waitq); in cec_adap_unconfigure()
1336 cec_post_state_event(adap); in cec_adap_unconfigure()
1392 struct cec_adapter *adap = arg; in cec_config_thread_func() local
1393 struct cec_log_addrs *las = &adap->log_addrs; in cec_config_thread_func()
1397 mutex_lock(&adap->lock); in cec_config_thread_func()
1399 cec_phys_addr_exp(adap->phys_addr), las->num_log_addrs); in cec_config_thread_func()
1415 if (adap->phys_addr && type == CEC_LOG_ADDR_TYPE_TV) in cec_config_thread_func()
1426 err = cec_config_log_addr(adap, i, last_la); in cec_config_thread_func()
1443 err = cec_config_log_addr(adap, i, la_list[j]); in cec_config_thread_func()
1456 if (adap->log_addrs.log_addr_mask == 0 && in cec_config_thread_func()
1461 if (adap->log_addrs.log_addr_mask == 0) { in cec_config_thread_func()
1470 adap->is_configured = true; in cec_config_thread_func()
1471 adap->is_configuring = false; in cec_config_thread_func()
1472 cec_post_state_event(adap); in cec_config_thread_func()
1495 adap->log_addrs.cec_version >= CEC_OP_CEC_VERSION_2_0) { in cec_config_thread_func()
1496 cec_fill_msg_report_features(adap, &msg, i); in cec_config_thread_func()
1497 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1501 cec_msg_report_physical_addr(&msg, adap->phys_addr, in cec_config_thread_func()
1505 cec_phys_addr_exp(adap->phys_addr)); in cec_config_thread_func()
1506 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1509 if (adap->log_addrs.vendor_id != CEC_VENDOR_ID_NONE) { in cec_config_thread_func()
1511 adap->log_addrs.vendor_id); in cec_config_thread_func()
1512 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1515 adap->kthread_config = NULL; in cec_config_thread_func()
1516 complete(&adap->config_completion); in cec_config_thread_func()
1517 mutex_unlock(&adap->lock); in cec_config_thread_func()
1523 cec_adap_unconfigure(adap); in cec_config_thread_func()
1524 adap->is_configuring = false; in cec_config_thread_func()
1525 adap->kthread_config = NULL; in cec_config_thread_func()
1526 complete(&adap->config_completion); in cec_config_thread_func()
1527 mutex_unlock(&adap->lock); in cec_config_thread_func()
1537 static void cec_claim_log_addrs(struct cec_adapter *adap, bool block) in cec_claim_log_addrs() argument
1539 if (WARN_ON(adap->is_configuring || adap->is_configured)) in cec_claim_log_addrs()
1542 init_completion(&adap->config_completion); in cec_claim_log_addrs()
1545 adap->is_configuring = true; in cec_claim_log_addrs()
1546 adap->kthread_config = kthread_run(cec_config_thread_func, adap, in cec_claim_log_addrs()
1547 "ceccfg-%s", adap->name); in cec_claim_log_addrs()
1548 if (IS_ERR(adap->kthread_config)) { in cec_claim_log_addrs()
1549 adap->kthread_config = NULL; in cec_claim_log_addrs()
1551 mutex_unlock(&adap->lock); in cec_claim_log_addrs()
1552 wait_for_completion(&adap->config_completion); in cec_claim_log_addrs()
1553 mutex_lock(&adap->lock); in cec_claim_log_addrs()
1561 void __cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, bool block) in __cec_s_phys_addr() argument
1563 if (phys_addr == adap->phys_addr) in __cec_s_phys_addr()
1565 if (phys_addr != CEC_PHYS_ADDR_INVALID && adap->devnode.unregistered) in __cec_s_phys_addr()
1571 adap->phys_addr != CEC_PHYS_ADDR_INVALID) { in __cec_s_phys_addr()
1572 adap->phys_addr = CEC_PHYS_ADDR_INVALID; in __cec_s_phys_addr()
1573 cec_post_state_event(adap); in __cec_s_phys_addr()
1574 cec_adap_unconfigure(adap); in __cec_s_phys_addr()
1576 if (adap->monitor_all_cnt) in __cec_s_phys_addr()
1577 WARN_ON(call_op(adap, adap_monitor_all_enable, false)); in __cec_s_phys_addr()
1579 mutex_lock(&adap->devnode.lock); in __cec_s_phys_addr()
1580 if (adap->needs_hpd || list_empty(&adap->devnode.fhs)) { in __cec_s_phys_addr()
1581 WARN_ON(adap->ops->adap_enable(adap, false)); in __cec_s_phys_addr()
1582 adap->transmit_in_progress = false; in __cec_s_phys_addr()
1583 wake_up_interruptible(&adap->kthread_waitq); in __cec_s_phys_addr()
1585 mutex_unlock(&adap->devnode.lock); in __cec_s_phys_addr()
1591 mutex_lock(&adap->devnode.lock); in __cec_s_phys_addr()
1592 adap->last_initiator = 0xff; in __cec_s_phys_addr()
1593 adap->transmit_in_progress = false; in __cec_s_phys_addr()
1595 if (adap->needs_hpd || list_empty(&adap->devnode.fhs)) { in __cec_s_phys_addr()
1596 if (adap->ops->adap_enable(adap, true)) { in __cec_s_phys_addr()
1597 mutex_unlock(&adap->devnode.lock); in __cec_s_phys_addr()
1602 if (adap->monitor_all_cnt && in __cec_s_phys_addr()
1603 call_op(adap, adap_monitor_all_enable, true)) { in __cec_s_phys_addr()
1604 if (adap->needs_hpd || list_empty(&adap->devnode.fhs)) in __cec_s_phys_addr()
1605 WARN_ON(adap->ops->adap_enable(adap, false)); in __cec_s_phys_addr()
1606 mutex_unlock(&adap->devnode.lock); in __cec_s_phys_addr()
1609 mutex_unlock(&adap->devnode.lock); in __cec_s_phys_addr()
1611 adap->phys_addr = phys_addr; in __cec_s_phys_addr()
1612 cec_post_state_event(adap); in __cec_s_phys_addr()
1613 if (adap->log_addrs.num_log_addrs) in __cec_s_phys_addr()
1614 cec_claim_log_addrs(adap, block); in __cec_s_phys_addr()
1617 void cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, bool block) in cec_s_phys_addr() argument
1619 if (IS_ERR_OR_NULL(adap)) in cec_s_phys_addr()
1622 mutex_lock(&adap->lock); in cec_s_phys_addr()
1623 __cec_s_phys_addr(adap, phys_addr, block); in cec_s_phys_addr()
1624 mutex_unlock(&adap->lock); in cec_s_phys_addr()
1628 void cec_s_phys_addr_from_edid(struct cec_adapter *adap, in cec_s_phys_addr_from_edid() argument
1636 cec_s_phys_addr(adap, pa, false); in cec_s_phys_addr_from_edid()
1640 void cec_s_conn_info(struct cec_adapter *adap, in cec_s_conn_info() argument
1643 if (IS_ERR_OR_NULL(adap)) in cec_s_conn_info()
1646 if (!(adap->capabilities & CEC_CAP_CONNECTOR_INFO)) in cec_s_conn_info()
1649 mutex_lock(&adap->lock); in cec_s_conn_info()
1651 adap->conn_info = *conn_info; in cec_s_conn_info()
1653 memset(&adap->conn_info, 0, sizeof(adap->conn_info)); in cec_s_conn_info()
1654 cec_post_state_event(adap); in cec_s_conn_info()
1655 mutex_unlock(&adap->lock); in cec_s_conn_info()
1664 int __cec_s_log_addrs(struct cec_adapter *adap, in __cec_s_log_addrs() argument
1670 if (adap->devnode.unregistered) in __cec_s_log_addrs()
1674 cec_adap_unconfigure(adap); in __cec_s_log_addrs()
1675 adap->log_addrs.num_log_addrs = 0; in __cec_s_log_addrs()
1677 adap->log_addrs.log_addr[i] = CEC_LOG_ADDR_INVALID; in __cec_s_log_addrs()
1678 adap->log_addrs.osd_name[0] = '\0'; in __cec_s_log_addrs()
1679 adap->log_addrs.vendor_id = CEC_VENDOR_ID_NONE; in __cec_s_log_addrs()
1680 adap->log_addrs.cec_version = CEC_OP_CEC_VERSION_2_0; in __cec_s_log_addrs()
1711 if (log_addrs->num_log_addrs > adap->available_log_addrs) { in __cec_s_log_addrs()
1712 dprintk(1, "num_log_addrs > %d\n", adap->available_log_addrs); in __cec_s_log_addrs()
1814 log_addrs->log_addr_mask = adap->log_addrs.log_addr_mask; in __cec_s_log_addrs()
1815 adap->log_addrs = *log_addrs; in __cec_s_log_addrs()
1816 if (adap->phys_addr != CEC_PHYS_ADDR_INVALID) in __cec_s_log_addrs()
1817 cec_claim_log_addrs(adap, block); in __cec_s_log_addrs()
1821 int cec_s_log_addrs(struct cec_adapter *adap, in cec_s_log_addrs() argument
1826 mutex_lock(&adap->lock); in cec_s_log_addrs()
1827 err = __cec_s_log_addrs(adap, log_addrs, block); in cec_s_log_addrs()
1828 mutex_unlock(&adap->lock); in cec_s_log_addrs()
1836 static void cec_fill_msg_report_features(struct cec_adapter *adap, in cec_fill_msg_report_features() argument
1840 const struct cec_log_addrs *las = &adap->log_addrs; in cec_fill_msg_report_features()
1849 msg->msg[2] = adap->log_addrs.cec_version; in cec_fill_msg_report_features()
1864 static int cec_feature_abort_reason(struct cec_adapter *adap, in cec_feature_abort_reason() argument
1880 return cec_transmit_msg(adap, &tx_msg, false); in cec_feature_abort_reason()
1883 static int cec_feature_abort(struct cec_adapter *adap, struct cec_msg *msg) in cec_feature_abort() argument
1885 return cec_feature_abort_reason(adap, msg, in cec_feature_abort()
1889 static int cec_feature_refused(struct cec_adapter *adap, struct cec_msg *msg) in cec_feature_refused() argument
1891 return cec_feature_abort_reason(adap, msg, in cec_feature_refused()
1902 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, in cec_receive_notify() argument
1908 u8 devtype = cec_log_addr2dev(adap, dest_laddr); in cec_receive_notify()
1909 int la_idx = cec_log_addr2idx(adap, dest_laddr); in cec_receive_notify()
1916 if (cec_is_cdc_only(&adap->log_addrs) && in cec_receive_notify()
1920 if (adap->ops->received) { in cec_receive_notify()
1922 if (adap->ops->received(adap, msg) != -ENOMSG) in cec_receive_notify()
1941 if (!adap->passthrough && from_unregistered) in cec_receive_notify()
1951 if (adap->passthrough) in cec_receive_notify()
1993 if (!(adap->capabilities & CEC_CAP_RC) || in cec_receive_notify()
1994 !(adap->log_addrs.flags & CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU)) in cec_receive_notify()
2005 rc_keydown(adap->rc, RC_PROTO_CEC, in cec_receive_notify()
2008 rc_keydown(adap->rc, RC_PROTO_CEC, in cec_receive_notify()
2028 rc_keydown(adap->rc, RC_PROTO_CEC, msg->msg[2], 0); in cec_receive_notify()
2035 if (!(adap->capabilities & CEC_CAP_RC) || in cec_receive_notify()
2036 !(adap->log_addrs.flags & CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU)) in cec_receive_notify()
2039 rc_keyup(adap->rc); in cec_receive_notify()
2048 cec_msg_cec_version(&tx_cec_msg, adap->log_addrs.cec_version); in cec_receive_notify()
2049 return cec_transmit_msg(adap, &tx_cec_msg, false); in cec_receive_notify()
2055 cec_msg_report_physical_addr(&tx_cec_msg, adap->phys_addr, devtype); in cec_receive_notify()
2056 return cec_transmit_msg(adap, &tx_cec_msg, false); in cec_receive_notify()
2059 if (adap->log_addrs.vendor_id == CEC_VENDOR_ID_NONE) in cec_receive_notify()
2060 return cec_feature_abort(adap, msg); in cec_receive_notify()
2061 cec_msg_device_vendor_id(&tx_cec_msg, adap->log_addrs.vendor_id); in cec_receive_notify()
2062 return cec_transmit_msg(adap, &tx_cec_msg, false); in cec_receive_notify()
2068 return cec_feature_refused(adap, msg); in cec_receive_notify()
2071 if (adap->log_addrs.osd_name[0] == 0) in cec_receive_notify()
2072 return cec_feature_abort(adap, msg); in cec_receive_notify()
2073 cec_msg_set_osd_name(&tx_cec_msg, adap->log_addrs.osd_name); in cec_receive_notify()
2074 return cec_transmit_msg(adap, &tx_cec_msg, false); in cec_receive_notify()
2078 if (adap->log_addrs.cec_version < CEC_OP_CEC_VERSION_2_0) in cec_receive_notify()
2079 return cec_feature_abort(adap, msg); in cec_receive_notify()
2080 cec_fill_msg_report_features(adap, &tx_cec_msg, la_idx); in cec_receive_notify()
2081 return cec_transmit_msg(adap, &tx_cec_msg, false); in cec_receive_notify()
2088 if (!is_broadcast && !is_reply && !adap->follower_cnt && in cec_receive_notify()
2089 !adap->cec_follower && msg->msg[1] != CEC_MSG_FEATURE_ABORT) in cec_receive_notify()
2090 return cec_feature_abort(adap, msg); in cec_receive_notify()
2103 if (adap->cec_follower) in cec_receive_notify()
2104 cec_queue_msg_fh(adap->cec_follower, msg); in cec_receive_notify()
2106 cec_queue_msg_followers(adap, msg); in cec_receive_notify()
2115 int cec_monitor_all_cnt_inc(struct cec_adapter *adap) in cec_monitor_all_cnt_inc() argument
2119 if (adap->monitor_all_cnt == 0) in cec_monitor_all_cnt_inc()
2120 ret = call_op(adap, adap_monitor_all_enable, 1); in cec_monitor_all_cnt_inc()
2122 adap->monitor_all_cnt++; in cec_monitor_all_cnt_inc()
2126 void cec_monitor_all_cnt_dec(struct cec_adapter *adap) in cec_monitor_all_cnt_dec() argument
2128 adap->monitor_all_cnt--; in cec_monitor_all_cnt_dec()
2129 if (adap->monitor_all_cnt == 0) in cec_monitor_all_cnt_dec()
2130 WARN_ON(call_op(adap, adap_monitor_all_enable, 0)); in cec_monitor_all_cnt_dec()
2138 int cec_monitor_pin_cnt_inc(struct cec_adapter *adap) in cec_monitor_pin_cnt_inc() argument
2142 if (adap->monitor_pin_cnt == 0) in cec_monitor_pin_cnt_inc()
2143 ret = call_op(adap, adap_monitor_pin_enable, 1); in cec_monitor_pin_cnt_inc()
2145 adap->monitor_pin_cnt++; in cec_monitor_pin_cnt_inc()
2149 void cec_monitor_pin_cnt_dec(struct cec_adapter *adap) in cec_monitor_pin_cnt_dec() argument
2151 adap->monitor_pin_cnt--; in cec_monitor_pin_cnt_dec()
2152 if (adap->monitor_pin_cnt == 0) in cec_monitor_pin_cnt_dec()
2153 WARN_ON(call_op(adap, adap_monitor_pin_enable, 0)); in cec_monitor_pin_cnt_dec()
2163 struct cec_adapter *adap = dev_get_drvdata(file->private); in cec_adap_status() local
2166 mutex_lock(&adap->lock); in cec_adap_status()
2167 seq_printf(file, "configured: %d\n", adap->is_configured); in cec_adap_status()
2168 seq_printf(file, "configuring: %d\n", adap->is_configuring); in cec_adap_status()
2170 cec_phys_addr_exp(adap->phys_addr)); in cec_adap_status()
2171 seq_printf(file, "number of LAs: %d\n", adap->log_addrs.num_log_addrs); in cec_adap_status()
2172 seq_printf(file, "LA mask: 0x%04x\n", adap->log_addrs.log_addr_mask); in cec_adap_status()
2173 if (adap->cec_follower) in cec_adap_status()
2175 adap->passthrough ? " (in passthrough mode)" : ""); in cec_adap_status()
2176 if (adap->cec_initiator) in cec_adap_status()
2178 if (adap->monitor_all_cnt) in cec_adap_status()
2180 adap->monitor_all_cnt); in cec_adap_status()
2181 if (adap->tx_timeouts) { in cec_adap_status()
2183 adap->tx_timeouts); in cec_adap_status()
2184 adap->tx_timeouts = 0; in cec_adap_status()
2186 data = adap->transmitting; in cec_adap_status()
2191 seq_printf(file, "pending transmits: %u\n", adap->transmit_queue_sz); in cec_adap_status()
2192 list_for_each_entry(data, &adap->transmit_queue, list) { in cec_adap_status()
2197 list_for_each_entry(data, &adap->wait_queue, list) { in cec_adap_status()
2203 call_void_op(adap, adap_status, file); in cec_adap_status()
2204 mutex_unlock(&adap->lock); in cec_adap_status()