Lines Matching refs:adap

23 static void cec_fill_msg_report_features(struct cec_adapter *adap,
39 #define call_op(adap, op, arg...) \ argument
40 (adap->ops->op ? adap->ops->op(adap, ## arg) : 0)
42 #define call_void_op(adap, op, arg...) \ argument
44 if (adap->ops->op) \
45 adap->ops->op(adap, ## arg); \
48 static int cec_log_addr2idx(const struct cec_adapter *adap, u8 log_addr) in cec_log_addr2idx() argument
52 for (i = 0; i < adap->log_addrs.num_log_addrs; i++) in cec_log_addr2idx()
53 if (adap->log_addrs.log_addr[i] == log_addr) in cec_log_addr2idx()
58 static unsigned int cec_log_addr2dev(const struct cec_adapter *adap, u8 log_addr) in cec_log_addr2dev() argument
60 int i = cec_log_addr2idx(adap, log_addr); in cec_log_addr2dev()
62 return adap->log_addrs.primary_device_type[i < 0 ? 0 : i]; in cec_log_addr2dev()
132 static void cec_queue_event(struct cec_adapter *adap, in cec_queue_event() argument
138 mutex_lock(&adap->devnode.lock); in cec_queue_event()
139 list_for_each_entry(fh, &adap->devnode.fhs, list) in cec_queue_event()
141 mutex_unlock(&adap->devnode.lock); in cec_queue_event()
145 void cec_queue_pin_cec_event(struct cec_adapter *adap, bool is_high, in cec_queue_pin_cec_event() argument
155 mutex_lock(&adap->devnode.lock); in cec_queue_pin_cec_event()
156 list_for_each_entry(fh, &adap->devnode.fhs, list) in cec_queue_pin_cec_event()
159 mutex_unlock(&adap->devnode.lock); in cec_queue_pin_cec_event()
164 void cec_queue_pin_hpd_event(struct cec_adapter *adap, bool is_high, ktime_t ts) in cec_queue_pin_hpd_event() argument
172 mutex_lock(&adap->devnode.lock); in cec_queue_pin_hpd_event()
173 list_for_each_entry(fh, &adap->devnode.fhs, list) in cec_queue_pin_hpd_event()
175 mutex_unlock(&adap->devnode.lock); in cec_queue_pin_hpd_event()
180 void cec_queue_pin_5v_event(struct cec_adapter *adap, bool is_high, ktime_t ts) in cec_queue_pin_5v_event() argument
188 mutex_lock(&adap->devnode.lock); in cec_queue_pin_5v_event()
189 list_for_each_entry(fh, &adap->devnode.fhs, list) in cec_queue_pin_5v_event()
191 mutex_unlock(&adap->devnode.lock); in cec_queue_pin_5v_event()
255 static void cec_queue_msg_monitor(struct cec_adapter *adap, in cec_queue_msg_monitor() argument
263 mutex_lock(&adap->devnode.lock); in cec_queue_msg_monitor()
264 list_for_each_entry(fh, &adap->devnode.fhs, list) { in cec_queue_msg_monitor()
268 mutex_unlock(&adap->devnode.lock); in cec_queue_msg_monitor()
274 static void cec_queue_msg_followers(struct cec_adapter *adap, in cec_queue_msg_followers() argument
279 mutex_lock(&adap->devnode.lock); in cec_queue_msg_followers()
280 list_for_each_entry(fh, &adap->devnode.fhs, list) { in cec_queue_msg_followers()
284 mutex_unlock(&adap->devnode.lock); in cec_queue_msg_followers()
288 static void cec_post_state_event(struct cec_adapter *adap) in cec_post_state_event() argument
294 ev.state_change.phys_addr = adap->phys_addr; in cec_post_state_event()
295 ev.state_change.log_addr_mask = adap->log_addrs.log_addr_mask; in cec_post_state_event()
296 cec_queue_event(adap, &ev); in cec_post_state_event()
350 if (data->adap->transmitting == data) { in cec_data_cancel()
351 data->adap->transmitting = NULL; in cec_data_cancel()
355 data->adap->transmit_queue_sz--; in cec_data_cancel()
372 cec_queue_msg_monitor(data->adap, &data->msg, 1); in cec_data_cancel()
382 static void cec_flush(struct cec_adapter *adap) in cec_flush() argument
390 while (!list_empty(&adap->transmit_queue)) { in cec_flush()
391 data = list_first_entry(&adap->transmit_queue, in cec_flush()
395 if (adap->transmitting) in cec_flush()
396 cec_data_cancel(adap->transmitting); in cec_flush()
399 list_for_each_entry_safe(data, n, &adap->wait_queue, list) { in cec_flush()
425 struct cec_adapter *adap = _adap; in cec_thread_func() local
433 if (adap->transmitting) { in cec_thread_func()
443 err = wait_event_interruptible_timeout(adap->kthread_waitq, in cec_thread_func()
444 (adap->needs_hpd && in cec_thread_func()
445 (!adap->is_configured && !adap->is_configuring)) || in cec_thread_func()
447 (!adap->transmitting && in cec_thread_func()
448 !list_empty(&adap->transmit_queue)), in cec_thread_func()
453 wait_event_interruptible(adap->kthread_waitq, in cec_thread_func()
455 (!adap->transmitting && in cec_thread_func()
456 !list_empty(&adap->transmit_queue))); in cec_thread_func()
459 mutex_lock(&adap->lock); in cec_thread_func()
461 if ((adap->needs_hpd && in cec_thread_func()
462 (!adap->is_configured && !adap->is_configuring)) || in cec_thread_func()
464 cec_flush(adap); in cec_thread_func()
468 if (adap->transmitting && timeout) { in cec_thread_func()
478 adap->transmitting->msg.len, in cec_thread_func()
479 adap->transmitting->msg.msg); in cec_thread_func()
480 adap->tx_timeouts++; in cec_thread_func()
482 cec_data_cancel(adap->transmitting); in cec_thread_func()
490 if (adap->transmitting || list_empty(&adap->transmit_queue)) in cec_thread_func()
494 data = list_first_entry(&adap->transmit_queue, in cec_thread_func()
497 adap->transmit_queue_sz--; in cec_thread_func()
500 adap->transmitting = data; in cec_thread_func()
508 if (data->msg.len == 1 && adap->is_configured) in cec_thread_func()
531 if (adap->ops->adap_transmit(adap, data->attempts, in cec_thread_func()
536 mutex_unlock(&adap->lock); in cec_thread_func()
547 void cec_transmit_done_ts(struct cec_adapter *adap, u8 status, in cec_transmit_done_ts() argument
560 mutex_lock(&adap->lock); in cec_transmit_done_ts()
561 data = adap->transmitting; in cec_transmit_done_ts()
585 adap->transmitting = NULL; in cec_transmit_done_ts()
603 list_add(&data->list, &adap->transmit_queue); in cec_transmit_done_ts()
604 adap->transmit_queue_sz++; in cec_transmit_done_ts()
615 cec_queue_msg_monitor(adap, msg, 1); in cec_transmit_done_ts()
617 if ((status & CEC_TX_STATUS_OK) && adap->is_configured && in cec_transmit_done_ts()
623 list_add_tail(&data->list, &adap->wait_queue); in cec_transmit_done_ts()
636 wake_up_interruptible(&adap->kthread_waitq); in cec_transmit_done_ts()
638 mutex_unlock(&adap->lock); in cec_transmit_done_ts()
642 void cec_transmit_attempt_done_ts(struct cec_adapter *adap, in cec_transmit_attempt_done_ts() argument
647 cec_transmit_done_ts(adap, status, 0, 0, 0, 0, ts); in cec_transmit_attempt_done_ts()
650 cec_transmit_done_ts(adap, status, 1, 0, 0, 0, ts); in cec_transmit_attempt_done_ts()
653 cec_transmit_done_ts(adap, status, 0, 1, 0, 0, ts); in cec_transmit_attempt_done_ts()
656 cec_transmit_done_ts(adap, status, 0, 0, 1, 0, ts); in cec_transmit_attempt_done_ts()
659 cec_transmit_done_ts(adap, status, 0, 0, 0, 1, ts); in cec_transmit_attempt_done_ts()
663 WARN(1, "cec-%s: invalid status 0x%02x\n", adap->name, status); in cec_transmit_attempt_done_ts()
675 struct cec_adapter *adap = data->adap; in cec_wait_timeout() local
677 mutex_lock(&adap->lock); in cec_wait_timeout()
691 mutex_unlock(&adap->lock); in cec_wait_timeout()
700 int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, in cec_transmit_msg_fh() argument
728 msg->msg[2] = adap->phys_addr >> 8; in cec_transmit_msg_fh()
729 msg->msg[3] = adap->phys_addr & 0xff; in cec_transmit_msg_fh()
757 if (cec_has_log_addr(adap, cec_msg_destination(msg))) { in cec_transmit_msg_fh()
770 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
772 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
777 cec_has_log_addr(adap, cec_msg_destination(msg))) { in cec_transmit_msg_fh()
781 if (msg->len > 1 && adap->is_configured && in cec_transmit_msg_fh()
782 !cec_has_log_addr(adap, cec_msg_initiator(msg))) { in cec_transmit_msg_fh()
787 if (!adap->is_configured && !adap->is_configuring) { in cec_transmit_msg_fh()
788 if (adap->needs_hpd || msg->msg[0] != 0xf0) { in cec_transmit_msg_fh()
798 if (adap->transmit_queue_sz >= CEC_MAX_MSG_TX_QUEUE_SZ) { in cec_transmit_msg_fh()
807 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
809 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
813 data->adap = adap; in cec_transmit_msg_fh()
821 if (!(list_empty(&adap->transmit_queue))) { in cec_transmit_msg_fh()
824 last = list_last_entry(&adap->transmit_queue, in cec_transmit_msg_fh()
827 } else if (adap->transmitting) { in cec_transmit_msg_fh()
829 cec_msg_initiator(&adap->transmitting->msg); in cec_transmit_msg_fh()
839 list_add_tail(&data->list, &adap->transmit_queue); in cec_transmit_msg_fh()
840 adap->transmit_queue_sz++; in cec_transmit_msg_fh()
841 if (!adap->transmitting) in cec_transmit_msg_fh()
842 wake_up_interruptible(&adap->kthread_waitq); in cec_transmit_msg_fh()
860 mutex_unlock(&adap->lock); in cec_transmit_msg_fh()
863 mutex_lock(&adap->lock); in cec_transmit_msg_fh()
893 int cec_transmit_msg(struct cec_adapter *adap, struct cec_msg *msg, in cec_transmit_msg() argument
898 mutex_lock(&adap->lock); in cec_transmit_msg()
899 ret = cec_transmit_msg_fh(adap, msg, NULL, block); in cec_transmit_msg()
900 mutex_unlock(&adap->lock); in cec_transmit_msg()
910 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg,
1003 void cec_received_msg_ts(struct cec_adapter *adap, in cec_received_msg_ts() argument
1029 cec_has_log_addr(adap, msg_init)) in cec_received_msg_ts()
1044 mutex_lock(&adap->lock); in cec_received_msg_ts()
1049 valid_la = cec_has_log_addr(adap, msg_dest); in cec_received_msg_ts()
1068 adap->log_addrs.cec_version >= CEC_OP_CEC_VERSION_2_0 && in cec_received_msg_ts()
1126 list_for_each_entry(data, &adap->wait_queue, list) { in cec_received_msg_ts()
1164 mutex_unlock(&adap->lock); in cec_received_msg_ts()
1166 mutex_lock(&adap->lock); in cec_received_msg_ts()
1178 mutex_unlock(&adap->lock); in cec_received_msg_ts()
1181 cec_queue_msg_monitor(adap, msg, valid_la); in cec_received_msg_ts()
1187 if (adap->log_addrs.log_addr_mask == 0) in cec_received_msg_ts()
1195 cec_receive_notify(adap, msg, is_reply); in cec_received_msg_ts()
1206 static int cec_config_log_addr(struct cec_adapter *adap, in cec_config_log_addr() argument
1210 struct cec_log_addrs *las = &adap->log_addrs; in cec_config_log_addr()
1214 if (cec_has_log_addr(adap, log_addr)) in cec_config_log_addr()
1220 err = cec_transmit_msg_fh(adap, &msg, NULL, true); in cec_config_log_addr()
1226 if (!adap->is_configuring) in cec_config_log_addr()
1239 err = adap->ops->adap_log_addr(adap, log_addr); in cec_config_log_addr()
1245 adap->phys_addrs[log_addr] = adap->phys_addr; in cec_config_log_addr()
1255 static void cec_adap_unconfigure(struct cec_adapter *adap) in cec_adap_unconfigure() argument
1257 if (!adap->needs_hpd || in cec_adap_unconfigure()
1258 adap->phys_addr != CEC_PHYS_ADDR_INVALID) in cec_adap_unconfigure()
1259 WARN_ON(adap->ops->adap_log_addr(adap, CEC_LOG_ADDR_INVALID)); in cec_adap_unconfigure()
1260 adap->log_addrs.log_addr_mask = 0; in cec_adap_unconfigure()
1261 adap->is_configuring = false; in cec_adap_unconfigure()
1262 adap->is_configured = false; in cec_adap_unconfigure()
1263 memset(adap->phys_addrs, 0xff, sizeof(adap->phys_addrs)); in cec_adap_unconfigure()
1264 cec_flush(adap); in cec_adap_unconfigure()
1265 wake_up_interruptible(&adap->kthread_waitq); in cec_adap_unconfigure()
1266 cec_post_state_event(adap); in cec_adap_unconfigure()
1322 struct cec_adapter *adap = arg; in cec_config_thread_func() local
1323 struct cec_log_addrs *las = &adap->log_addrs; in cec_config_thread_func()
1327 mutex_lock(&adap->lock); in cec_config_thread_func()
1329 cec_phys_addr_exp(adap->phys_addr), las->num_log_addrs); in cec_config_thread_func()
1345 if (adap->phys_addr && type == CEC_LOG_ADDR_TYPE_TV) in cec_config_thread_func()
1356 err = cec_config_log_addr(adap, i, last_la); in cec_config_thread_func()
1373 err = cec_config_log_addr(adap, i, la_list[j]); in cec_config_thread_func()
1386 if (adap->log_addrs.log_addr_mask == 0 && in cec_config_thread_func()
1391 if (adap->log_addrs.log_addr_mask == 0) { in cec_config_thread_func()
1400 adap->is_configured = true; in cec_config_thread_func()
1401 adap->is_configuring = false; in cec_config_thread_func()
1402 cec_post_state_event(adap); in cec_config_thread_func()
1425 adap->log_addrs.cec_version >= CEC_OP_CEC_VERSION_2_0) { in cec_config_thread_func()
1426 cec_fill_msg_report_features(adap, &msg, i); in cec_config_thread_func()
1427 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1431 cec_msg_report_physical_addr(&msg, adap->phys_addr, in cec_config_thread_func()
1435 cec_phys_addr_exp(adap->phys_addr)); in cec_config_thread_func()
1436 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1438 adap->kthread_config = NULL; in cec_config_thread_func()
1439 complete(&adap->config_completion); in cec_config_thread_func()
1440 mutex_unlock(&adap->lock); in cec_config_thread_func()
1446 cec_adap_unconfigure(adap); in cec_config_thread_func()
1447 adap->kthread_config = NULL; in cec_config_thread_func()
1448 mutex_unlock(&adap->lock); in cec_config_thread_func()
1449 complete(&adap->config_completion); in cec_config_thread_func()
1459 static void cec_claim_log_addrs(struct cec_adapter *adap, bool block) in cec_claim_log_addrs() argument
1461 if (WARN_ON(adap->is_configuring || adap->is_configured)) in cec_claim_log_addrs()
1464 init_completion(&adap->config_completion); in cec_claim_log_addrs()
1467 adap->is_configuring = true; in cec_claim_log_addrs()
1468 adap->kthread_config = kthread_run(cec_config_thread_func, adap, in cec_claim_log_addrs()
1469 "ceccfg-%s", adap->name); in cec_claim_log_addrs()
1470 if (IS_ERR(adap->kthread_config)) { in cec_claim_log_addrs()
1471 adap->kthread_config = NULL; in cec_claim_log_addrs()
1473 mutex_unlock(&adap->lock); in cec_claim_log_addrs()
1474 wait_for_completion(&adap->config_completion); in cec_claim_log_addrs()
1475 mutex_lock(&adap->lock); in cec_claim_log_addrs()
1483 void __cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, bool block) in __cec_s_phys_addr() argument
1485 if (phys_addr == adap->phys_addr) in __cec_s_phys_addr()
1487 if (phys_addr != CEC_PHYS_ADDR_INVALID && adap->devnode.unregistered) in __cec_s_phys_addr()
1493 adap->phys_addr != CEC_PHYS_ADDR_INVALID) { in __cec_s_phys_addr()
1494 adap->phys_addr = CEC_PHYS_ADDR_INVALID; in __cec_s_phys_addr()
1495 cec_post_state_event(adap); in __cec_s_phys_addr()
1496 cec_adap_unconfigure(adap); in __cec_s_phys_addr()
1498 if (adap->monitor_all_cnt) in __cec_s_phys_addr()
1499 WARN_ON(call_op(adap, adap_monitor_all_enable, false)); in __cec_s_phys_addr()
1500 mutex_lock(&adap->devnode.lock); in __cec_s_phys_addr()
1501 if (adap->needs_hpd || list_empty(&adap->devnode.fhs)) in __cec_s_phys_addr()
1502 WARN_ON(adap->ops->adap_enable(adap, false)); in __cec_s_phys_addr()
1503 mutex_unlock(&adap->devnode.lock); in __cec_s_phys_addr()
1508 mutex_lock(&adap->devnode.lock); in __cec_s_phys_addr()
1509 if ((adap->needs_hpd || list_empty(&adap->devnode.fhs)) && in __cec_s_phys_addr()
1510 adap->ops->adap_enable(adap, true)) { in __cec_s_phys_addr()
1511 mutex_unlock(&adap->devnode.lock); in __cec_s_phys_addr()
1515 if (adap->monitor_all_cnt && in __cec_s_phys_addr()
1516 call_op(adap, adap_monitor_all_enable, true)) { in __cec_s_phys_addr()
1517 if (adap->needs_hpd || list_empty(&adap->devnode.fhs)) in __cec_s_phys_addr()
1518 WARN_ON(adap->ops->adap_enable(adap, false)); in __cec_s_phys_addr()
1519 mutex_unlock(&adap->devnode.lock); in __cec_s_phys_addr()
1522 mutex_unlock(&adap->devnode.lock); in __cec_s_phys_addr()
1524 adap->phys_addr = phys_addr; in __cec_s_phys_addr()
1525 cec_post_state_event(adap); in __cec_s_phys_addr()
1526 if (adap->log_addrs.num_log_addrs) in __cec_s_phys_addr()
1527 cec_claim_log_addrs(adap, block); in __cec_s_phys_addr()
1530 void cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, bool block) in cec_s_phys_addr() argument
1532 if (IS_ERR_OR_NULL(adap)) in cec_s_phys_addr()
1535 mutex_lock(&adap->lock); in cec_s_phys_addr()
1536 __cec_s_phys_addr(adap, phys_addr, block); in cec_s_phys_addr()
1537 mutex_unlock(&adap->lock); in cec_s_phys_addr()
1541 void cec_s_phys_addr_from_edid(struct cec_adapter *adap, in cec_s_phys_addr_from_edid() argument
1549 cec_s_phys_addr(adap, pa, false); in cec_s_phys_addr_from_edid()
1558 int __cec_s_log_addrs(struct cec_adapter *adap, in __cec_s_log_addrs() argument
1564 if (adap->devnode.unregistered) in __cec_s_log_addrs()
1568 cec_adap_unconfigure(adap); in __cec_s_log_addrs()
1569 adap->log_addrs.num_log_addrs = 0; in __cec_s_log_addrs()
1571 adap->log_addrs.log_addr[i] = CEC_LOG_ADDR_INVALID; in __cec_s_log_addrs()
1572 adap->log_addrs.osd_name[0] = '\0'; in __cec_s_log_addrs()
1573 adap->log_addrs.vendor_id = CEC_VENDOR_ID_NONE; in __cec_s_log_addrs()
1574 adap->log_addrs.cec_version = CEC_OP_CEC_VERSION_2_0; in __cec_s_log_addrs()
1605 if (log_addrs->num_log_addrs > adap->available_log_addrs) { in __cec_s_log_addrs()
1606 dprintk(1, "num_log_addrs > %d\n", adap->available_log_addrs); in __cec_s_log_addrs()
1708 log_addrs->log_addr_mask = adap->log_addrs.log_addr_mask; in __cec_s_log_addrs()
1709 adap->log_addrs = *log_addrs; in __cec_s_log_addrs()
1710 if (adap->phys_addr != CEC_PHYS_ADDR_INVALID) in __cec_s_log_addrs()
1711 cec_claim_log_addrs(adap, block); in __cec_s_log_addrs()
1715 int cec_s_log_addrs(struct cec_adapter *adap, in cec_s_log_addrs() argument
1720 mutex_lock(&adap->lock); in cec_s_log_addrs()
1721 err = __cec_s_log_addrs(adap, log_addrs, block); in cec_s_log_addrs()
1722 mutex_unlock(&adap->lock); in cec_s_log_addrs()
1730 static void cec_fill_msg_report_features(struct cec_adapter *adap, in cec_fill_msg_report_features() argument
1734 const struct cec_log_addrs *las = &adap->log_addrs; in cec_fill_msg_report_features()
1743 msg->msg[2] = adap->log_addrs.cec_version; in cec_fill_msg_report_features()
1758 static int cec_feature_abort_reason(struct cec_adapter *adap, in cec_feature_abort_reason() argument
1774 return cec_transmit_msg(adap, &tx_msg, false); in cec_feature_abort_reason()
1777 static int cec_feature_abort(struct cec_adapter *adap, struct cec_msg *msg) in cec_feature_abort() argument
1779 return cec_feature_abort_reason(adap, msg, in cec_feature_abort()
1783 static int cec_feature_refused(struct cec_adapter *adap, struct cec_msg *msg) in cec_feature_refused() argument
1785 return cec_feature_abort_reason(adap, msg, in cec_feature_refused()
1796 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, in cec_receive_notify() argument
1802 u8 devtype = cec_log_addr2dev(adap, dest_laddr); in cec_receive_notify()
1803 int la_idx = cec_log_addr2idx(adap, dest_laddr); in cec_receive_notify()
1810 if (cec_is_cdc_only(&adap->log_addrs) && in cec_receive_notify()
1814 if (adap->ops->received) { in cec_receive_notify()
1816 if (adap->ops->received(adap, msg) != -ENOMSG) in cec_receive_notify()
1835 if (!adap->passthrough && from_unregistered) in cec_receive_notify()
1845 if (adap->passthrough) in cec_receive_notify()
1882 adap->phys_addrs[init_laddr] = pa; in cec_receive_notify()
1889 if (!(adap->capabilities & CEC_CAP_RC) || in cec_receive_notify()
1890 !(adap->log_addrs.flags & CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU)) in cec_receive_notify()
1901 rc_keydown(adap->rc, RC_PROTO_CEC, in cec_receive_notify()
1904 rc_keydown(adap->rc, RC_PROTO_CEC, in cec_receive_notify()
1920 rc_keydown(adap->rc, RC_PROTO_CEC, msg->msg[2], 0); in cec_receive_notify()
1927 if (!(adap->capabilities & CEC_CAP_RC) || in cec_receive_notify()
1928 !(adap->log_addrs.flags & CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU)) in cec_receive_notify()
1931 rc_keyup(adap->rc); in cec_receive_notify()
1940 cec_msg_cec_version(&tx_cec_msg, adap->log_addrs.cec_version); in cec_receive_notify()
1941 return cec_transmit_msg(adap, &tx_cec_msg, false); in cec_receive_notify()
1947 cec_msg_report_physical_addr(&tx_cec_msg, adap->phys_addr, devtype); in cec_receive_notify()
1948 return cec_transmit_msg(adap, &tx_cec_msg, false); in cec_receive_notify()
1951 if (adap->log_addrs.vendor_id == CEC_VENDOR_ID_NONE) in cec_receive_notify()
1952 return cec_feature_abort(adap, msg); in cec_receive_notify()
1953 cec_msg_device_vendor_id(&tx_cec_msg, adap->log_addrs.vendor_id); in cec_receive_notify()
1954 return cec_transmit_msg(adap, &tx_cec_msg, false); in cec_receive_notify()
1960 return cec_feature_refused(adap, msg); in cec_receive_notify()
1963 if (adap->log_addrs.osd_name[0] == 0) in cec_receive_notify()
1964 return cec_feature_abort(adap, msg); in cec_receive_notify()
1965 cec_msg_set_osd_name(&tx_cec_msg, adap->log_addrs.osd_name); in cec_receive_notify()
1966 return cec_transmit_msg(adap, &tx_cec_msg, false); in cec_receive_notify()
1970 if (adap->log_addrs.cec_version < CEC_OP_CEC_VERSION_2_0) in cec_receive_notify()
1971 return cec_feature_abort(adap, msg); in cec_receive_notify()
1972 cec_fill_msg_report_features(adap, &tx_cec_msg, la_idx); in cec_receive_notify()
1973 return cec_transmit_msg(adap, &tx_cec_msg, false); in cec_receive_notify()
1980 if (!is_broadcast && !is_reply && !adap->follower_cnt && in cec_receive_notify()
1981 !adap->cec_follower && msg->msg[1] != CEC_MSG_FEATURE_ABORT) in cec_receive_notify()
1982 return cec_feature_abort(adap, msg); in cec_receive_notify()
1995 if (adap->cec_follower) in cec_receive_notify()
1996 cec_queue_msg_fh(adap->cec_follower, msg); in cec_receive_notify()
1998 cec_queue_msg_followers(adap, msg); in cec_receive_notify()
2007 int cec_monitor_all_cnt_inc(struct cec_adapter *adap) in cec_monitor_all_cnt_inc() argument
2011 if (adap->monitor_all_cnt == 0) in cec_monitor_all_cnt_inc()
2012 ret = call_op(adap, adap_monitor_all_enable, 1); in cec_monitor_all_cnt_inc()
2014 adap->monitor_all_cnt++; in cec_monitor_all_cnt_inc()
2018 void cec_monitor_all_cnt_dec(struct cec_adapter *adap) in cec_monitor_all_cnt_dec() argument
2020 adap->monitor_all_cnt--; in cec_monitor_all_cnt_dec()
2021 if (adap->monitor_all_cnt == 0) in cec_monitor_all_cnt_dec()
2022 WARN_ON(call_op(adap, adap_monitor_all_enable, 0)); in cec_monitor_all_cnt_dec()
2030 int cec_monitor_pin_cnt_inc(struct cec_adapter *adap) in cec_monitor_pin_cnt_inc() argument
2034 if (adap->monitor_pin_cnt == 0) in cec_monitor_pin_cnt_inc()
2035 ret = call_op(adap, adap_monitor_pin_enable, 1); in cec_monitor_pin_cnt_inc()
2037 adap->monitor_pin_cnt++; in cec_monitor_pin_cnt_inc()
2041 void cec_monitor_pin_cnt_dec(struct cec_adapter *adap) in cec_monitor_pin_cnt_dec() argument
2043 adap->monitor_pin_cnt--; in cec_monitor_pin_cnt_dec()
2044 if (adap->monitor_pin_cnt == 0) in cec_monitor_pin_cnt_dec()
2045 WARN_ON(call_op(adap, adap_monitor_pin_enable, 0)); in cec_monitor_pin_cnt_dec()
2055 struct cec_adapter *adap = dev_get_drvdata(file->private); in cec_adap_status() local
2058 mutex_lock(&adap->lock); in cec_adap_status()
2059 seq_printf(file, "configured: %d\n", adap->is_configured); in cec_adap_status()
2060 seq_printf(file, "configuring: %d\n", adap->is_configuring); in cec_adap_status()
2062 cec_phys_addr_exp(adap->phys_addr)); in cec_adap_status()
2063 seq_printf(file, "number of LAs: %d\n", adap->log_addrs.num_log_addrs); in cec_adap_status()
2064 seq_printf(file, "LA mask: 0x%04x\n", adap->log_addrs.log_addr_mask); in cec_adap_status()
2065 if (adap->cec_follower) in cec_adap_status()
2067 adap->passthrough ? " (in passthrough mode)" : ""); in cec_adap_status()
2068 if (adap->cec_initiator) in cec_adap_status()
2070 if (adap->monitor_all_cnt) in cec_adap_status()
2072 adap->monitor_all_cnt); in cec_adap_status()
2073 if (adap->tx_timeouts) { in cec_adap_status()
2075 adap->tx_timeouts); in cec_adap_status()
2076 adap->tx_timeouts = 0; in cec_adap_status()
2078 data = adap->transmitting; in cec_adap_status()
2083 seq_printf(file, "pending transmits: %u\n", adap->transmit_queue_sz); in cec_adap_status()
2084 list_for_each_entry(data, &adap->transmit_queue, list) { in cec_adap_status()
2089 list_for_each_entry(data, &adap->wait_queue, list) { in cec_adap_status()
2095 call_void_op(adap, adap_status, file); in cec_adap_status()
2096 mutex_unlock(&adap->lock); in cec_adap_status()