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); in cec_queue_event()
165 list_for_each_entry(fh, &adap->devnode.fhs, list) in cec_queue_event()
167 mutex_unlock(&adap->devnode.lock); 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); in cec_queue_pin_cec_event()
182 list_for_each_entry(fh, &adap->devnode.fhs, list) in cec_queue_pin_cec_event()
185 mutex_unlock(&adap->devnode.lock); in cec_queue_pin_cec_event()
190 void cec_queue_pin_hpd_event(struct cec_adapter *adap, bool is_high, ktime_t ts) in cec_queue_pin_hpd_event() argument
198 mutex_lock(&adap->devnode.lock); in cec_queue_pin_hpd_event()
199 list_for_each_entry(fh, &adap->devnode.fhs, list) in cec_queue_pin_hpd_event()
201 mutex_unlock(&adap->devnode.lock); in cec_queue_pin_hpd_event()
206 void cec_queue_pin_5v_event(struct cec_adapter *adap, bool is_high, ktime_t ts) in cec_queue_pin_5v_event() argument
214 mutex_lock(&adap->devnode.lock); in cec_queue_pin_5v_event()
215 list_for_each_entry(fh, &adap->devnode.fhs, list) in cec_queue_pin_5v_event()
217 mutex_unlock(&adap->devnode.lock); in cec_queue_pin_5v_event()
281 static void cec_queue_msg_monitor(struct cec_adapter *adap, in cec_queue_msg_monitor() argument
289 mutex_lock(&adap->devnode.lock); in cec_queue_msg_monitor()
290 list_for_each_entry(fh, &adap->devnode.fhs, list) { in cec_queue_msg_monitor()
294 mutex_unlock(&adap->devnode.lock); in cec_queue_msg_monitor()
300 static void cec_queue_msg_followers(struct cec_adapter *adap, in cec_queue_msg_followers() argument
305 mutex_lock(&adap->devnode.lock); in cec_queue_msg_followers()
306 list_for_each_entry(fh, &adap->devnode.fhs, list) { in cec_queue_msg_followers()
310 mutex_unlock(&adap->devnode.lock); in cec_queue_msg_followers()
314 static void cec_post_state_event(struct cec_adapter *adap) in cec_post_state_event() argument
320 ev.state_change.phys_addr = adap->phys_addr; in cec_post_state_event()
321 ev.state_change.log_addr_mask = adap->log_addrs.log_addr_mask; in cec_post_state_event()
323 adap->conn_info.type != CEC_CONNECTOR_TYPE_NO_CONNECTOR; in cec_post_state_event()
324 cec_queue_event(adap, &ev); in cec_post_state_event()
378 if (data->adap->transmitting == data) { in cec_data_cancel()
379 data->adap->transmitting = NULL; in cec_data_cancel()
383 if (!WARN_ON(!data->adap->transmit_queue_sz)) in cec_data_cancel()
384 data->adap->transmit_queue_sz--; in cec_data_cancel()
399 cec_queue_msg_monitor(data->adap, &data->msg, 1); in cec_data_cancel()
409 static void cec_flush(struct cec_adapter *adap) in cec_flush() argument
417 while (!list_empty(&adap->transmit_queue)) { in cec_flush()
418 data = list_first_entry(&adap->transmit_queue, in cec_flush()
422 if (adap->transmitting) in cec_flush()
423 cec_data_cancel(adap->transmitting, CEC_TX_STATUS_ABORTED); in cec_flush()
426 list_for_each_entry_safe(data, n, &adap->wait_queue, list) { in cec_flush()
442 if (WARN_ON(adap->transmit_queue_sz)) in cec_flush()
443 adap->transmit_queue_sz = 0; in cec_flush()
460 struct cec_adapter *adap = _adap; in cec_thread_func() local
468 if (adap->transmit_in_progress) { in cec_thread_func()
478 err = wait_event_interruptible_timeout(adap->kthread_waitq, in cec_thread_func()
479 (adap->needs_hpd && in cec_thread_func()
480 (!adap->is_configured && !adap->is_configuring)) || in cec_thread_func()
482 (!adap->transmit_in_progress && in cec_thread_func()
483 !list_empty(&adap->transmit_queue)), in cec_thread_func()
488 wait_event_interruptible(adap->kthread_waitq, in cec_thread_func()
490 (!adap->transmit_in_progress && in cec_thread_func()
491 !list_empty(&adap->transmit_queue))); in cec_thread_func()
494 mutex_lock(&adap->lock); in cec_thread_func()
496 if ((adap->needs_hpd && in cec_thread_func()
497 (!adap->is_configured && !adap->is_configuring)) || in cec_thread_func()
499 cec_flush(adap); in cec_thread_func()
503 if (adap->transmit_in_progress && timeout) { in cec_thread_func()
512 if (adap->transmitting) { in cec_thread_func()
513 pr_warn("cec-%s: message %*ph timed out\n", adap->name, in cec_thread_func()
514 adap->transmitting->msg.len, in cec_thread_func()
515 adap->transmitting->msg.msg); in cec_thread_func()
517 cec_data_cancel(adap->transmitting, in cec_thread_func()
520 pr_warn("cec-%s: transmit timed out\n", adap->name); in cec_thread_func()
522 adap->transmit_in_progress = false; in cec_thread_func()
523 adap->tx_timeouts++; in cec_thread_func()
531 if (adap->transmit_in_progress || list_empty(&adap->transmit_queue)) in cec_thread_func()
535 data = list_first_entry(&adap->transmit_queue, in cec_thread_func()
538 if (!WARN_ON(!data->adap->transmit_queue_sz)) in cec_thread_func()
539 adap->transmit_queue_sz--; in cec_thread_func()
542 adap->transmitting = data; in cec_thread_func()
550 if (data->msg.len == 1 && adap->is_configured) in cec_thread_func()
559 } else if (adap->last_initiator != in cec_thread_func()
563 adap->last_initiator = cec_msg_initiator(&data->msg); in cec_thread_func()
575 if (adap->ops->adap_transmit(adap, data->attempts, in cec_thread_func()
579 adap->transmit_in_progress = true; in cec_thread_func()
582 mutex_unlock(&adap->lock); in cec_thread_func()
593 void cec_transmit_done_ts(struct cec_adapter *adap, u8 status, in cec_transmit_done_ts() argument
606 mutex_lock(&adap->lock); in cec_transmit_done_ts()
607 data = adap->transmitting; in cec_transmit_done_ts()
614 if (!adap->transmit_in_progress) in cec_transmit_done_ts()
617 adap->transmit_in_progress = false; in cec_transmit_done_ts()
620 adap->transmit_in_progress = false; in cec_transmit_done_ts()
634 adap->transmitting = NULL; in cec_transmit_done_ts()
652 list_add(&data->list, &adap->transmit_queue); in cec_transmit_done_ts()
653 adap->transmit_queue_sz++; in cec_transmit_done_ts()
664 cec_queue_msg_monitor(adap, msg, 1); in cec_transmit_done_ts()
666 if ((status & CEC_TX_STATUS_OK) && adap->is_configured && in cec_transmit_done_ts()
672 list_add_tail(&data->list, &adap->wait_queue); in cec_transmit_done_ts()
685 wake_up_interruptible(&adap->kthread_waitq); in cec_transmit_done_ts()
686 mutex_unlock(&adap->lock); in cec_transmit_done_ts()
690 void cec_transmit_attempt_done_ts(struct cec_adapter *adap, in cec_transmit_attempt_done_ts() argument
695 cec_transmit_done_ts(adap, status, 0, 0, 0, 0, ts); in cec_transmit_attempt_done_ts()
698 cec_transmit_done_ts(adap, status, 1, 0, 0, 0, ts); in cec_transmit_attempt_done_ts()
701 cec_transmit_done_ts(adap, status, 0, 1, 0, 0, ts); in cec_transmit_attempt_done_ts()
704 cec_transmit_done_ts(adap, status, 0, 0, 1, 0, ts); in cec_transmit_attempt_done_ts()
707 cec_transmit_done_ts(adap, status, 0, 0, 0, 1, ts); in cec_transmit_attempt_done_ts()
711 WARN(1, "cec-%s: invalid status 0x%02x\n", adap->name, status); in cec_transmit_attempt_done_ts()
723 struct cec_adapter *adap = data->adap; in cec_wait_timeout() local
725 mutex_lock(&adap->lock); in cec_wait_timeout()
739 mutex_unlock(&adap->lock); in cec_wait_timeout()
748 int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, in cec_transmit_msg_fh() argument
754 if (adap->devnode.unregistered) in cec_transmit_msg_fh()
802 if ((adap->log_addrs.flags & CEC_LOG_ADDRS_FL_CDC_ONLY) && in cec_transmit_msg_fh()
809 msg->msg[2] = adap->phys_addr >> 8; in cec_transmit_msg_fh()
810 msg->msg[3] = adap->phys_addr & 0xff; in cec_transmit_msg_fh()
819 if (cec_has_log_addr(adap, cec_msg_destination(msg))) { in cec_transmit_msg_fh()
832 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
834 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
839 cec_has_log_addr(adap, cec_msg_destination(msg))) { in cec_transmit_msg_fh()
844 if (msg->len > 1 && adap->is_configured && in cec_transmit_msg_fh()
845 !cec_has_log_addr(adap, cec_msg_initiator(msg))) { in cec_transmit_msg_fh()
856 if (!adap->is_configured && !adap->is_configuring && in cec_transmit_msg_fh()
866 if (!adap->is_configured && !adap->is_configuring) { in cec_transmit_msg_fh()
867 if (adap->needs_hpd) { in cec_transmit_msg_fh()
878 if (adap->transmit_queue_sz >= CEC_MAX_MSG_TX_QUEUE_SZ) { in cec_transmit_msg_fh()
887 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
889 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
893 data->adap = adap; in cec_transmit_msg_fh()
902 list_add_tail(&data->list, &adap->transmit_queue); in cec_transmit_msg_fh()
903 adap->transmit_queue_sz++; in cec_transmit_msg_fh()
904 if (!adap->transmitting) in cec_transmit_msg_fh()
905 wake_up_interruptible(&adap->kthread_waitq); in cec_transmit_msg_fh()
914 mutex_unlock(&adap->lock); in cec_transmit_msg_fh()
918 mutex_lock(&adap->lock); in cec_transmit_msg_fh()
931 int cec_transmit_msg(struct cec_adapter *adap, struct cec_msg *msg, in cec_transmit_msg() argument
936 mutex_lock(&adap->lock); in cec_transmit_msg()
937 ret = cec_transmit_msg_fh(adap, msg, NULL, block); in cec_transmit_msg()
938 mutex_unlock(&adap->lock); in cec_transmit_msg()
948 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg,
1041 void cec_received_msg_ts(struct cec_adapter *adap, in cec_received_msg_ts() argument
1055 if (adap->devnode.unregistered) in cec_received_msg_ts()
1070 cec_has_log_addr(adap, msg_init)) in cec_received_msg_ts()
1085 mutex_lock(&adap->lock); in cec_received_msg_ts()
1088 adap->last_initiator = 0xff; in cec_received_msg_ts()
1092 valid_la = cec_has_log_addr(adap, msg_dest); in cec_received_msg_ts()
1111 adap->log_addrs.cec_version < CEC_OP_CEC_VERSION_2_0 && in cec_received_msg_ts()
1169 list_for_each_entry(data, &adap->wait_queue, list) { in cec_received_msg_ts()
1208 mutex_unlock(&adap->lock); in cec_received_msg_ts()
1210 mutex_lock(&adap->lock); in cec_received_msg_ts()
1222 mutex_unlock(&adap->lock); in cec_received_msg_ts()
1225 cec_queue_msg_monitor(adap, msg, valid_la); in cec_received_msg_ts()
1231 if (adap->log_addrs.log_addr_mask == 0) in cec_received_msg_ts()
1239 cec_receive_notify(adap, msg, is_reply); in cec_received_msg_ts()
1250 static int cec_config_log_addr(struct cec_adapter *adap, in cec_config_log_addr() argument
1254 struct cec_log_addrs *las = &adap->log_addrs; in cec_config_log_addr()
1260 if (cec_has_log_addr(adap, log_addr)) in cec_config_log_addr()
1268 err = cec_transmit_msg_fh(adap, &msg, NULL, true); in cec_config_log_addr()
1274 if (!adap->is_configuring) in cec_config_log_addr()
1310 err = adap->ops->adap_log_addr(adap, log_addr); in cec_config_log_addr()
1325 static void cec_adap_unconfigure(struct cec_adapter *adap) in cec_adap_unconfigure() argument
1327 if (!adap->needs_hpd || in cec_adap_unconfigure()
1328 adap->phys_addr != CEC_PHYS_ADDR_INVALID) in cec_adap_unconfigure()
1329 WARN_ON(adap->ops->adap_log_addr(adap, CEC_LOG_ADDR_INVALID)); in cec_adap_unconfigure()
1330 adap->log_addrs.log_addr_mask = 0; in cec_adap_unconfigure()
1331 adap->is_configuring = false; in cec_adap_unconfigure()
1332 adap->is_configured = false; in cec_adap_unconfigure()
1333 cec_flush(adap); in cec_adap_unconfigure()
1334 wake_up_interruptible(&adap->kthread_waitq); in cec_adap_unconfigure()
1335 cec_post_state_event(adap); in cec_adap_unconfigure()
1391 struct cec_adapter *adap = arg; in cec_config_thread_func() local
1392 struct cec_log_addrs *las = &adap->log_addrs; in cec_config_thread_func()
1396 mutex_lock(&adap->lock); in cec_config_thread_func()
1398 cec_phys_addr_exp(adap->phys_addr), las->num_log_addrs); in cec_config_thread_func()
1414 if (adap->phys_addr && type == CEC_LOG_ADDR_TYPE_TV) in cec_config_thread_func()
1425 err = cec_config_log_addr(adap, i, last_la); in cec_config_thread_func()
1442 err = cec_config_log_addr(adap, i, la_list[j]); in cec_config_thread_func()
1455 if (adap->log_addrs.log_addr_mask == 0 && in cec_config_thread_func()
1460 if (adap->log_addrs.log_addr_mask == 0) { in cec_config_thread_func()
1469 adap->is_configured = true; in cec_config_thread_func()
1470 adap->is_configuring = false; in cec_config_thread_func()
1471 cec_post_state_event(adap); in cec_config_thread_func()
1494 adap->log_addrs.cec_version >= CEC_OP_CEC_VERSION_2_0) { in cec_config_thread_func()
1495 cec_fill_msg_report_features(adap, &msg, i); in cec_config_thread_func()
1496 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1500 cec_msg_report_physical_addr(&msg, adap->phys_addr, in cec_config_thread_func()
1504 cec_phys_addr_exp(adap->phys_addr)); in cec_config_thread_func()
1505 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1508 if (adap->log_addrs.vendor_id != CEC_VENDOR_ID_NONE) { in cec_config_thread_func()
1510 adap->log_addrs.vendor_id); in cec_config_thread_func()
1511 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1514 adap->kthread_config = NULL; in cec_config_thread_func()
1515 complete(&adap->config_completion); in cec_config_thread_func()
1516 mutex_unlock(&adap->lock); in cec_config_thread_func()
1522 cec_adap_unconfigure(adap); in cec_config_thread_func()
1523 adap->kthread_config = NULL; in cec_config_thread_func()
1524 mutex_unlock(&adap->lock); in cec_config_thread_func()
1525 complete(&adap->config_completion); in cec_config_thread_func()
1535 static void cec_claim_log_addrs(struct cec_adapter *adap, bool block) in cec_claim_log_addrs() argument
1537 if (WARN_ON(adap->is_configuring || adap->is_configured)) in cec_claim_log_addrs()
1540 init_completion(&adap->config_completion); in cec_claim_log_addrs()
1543 adap->is_configuring = true; in cec_claim_log_addrs()
1544 adap->kthread_config = kthread_run(cec_config_thread_func, adap, in cec_claim_log_addrs()
1545 "ceccfg-%s", adap->name); in cec_claim_log_addrs()
1546 if (IS_ERR(adap->kthread_config)) { in cec_claim_log_addrs()
1547 adap->kthread_config = NULL; in cec_claim_log_addrs()
1549 mutex_unlock(&adap->lock); in cec_claim_log_addrs()
1550 wait_for_completion(&adap->config_completion); in cec_claim_log_addrs()
1551 mutex_lock(&adap->lock); in cec_claim_log_addrs()
1559 void __cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, bool block) in __cec_s_phys_addr() argument
1561 if (phys_addr == adap->phys_addr) in __cec_s_phys_addr()
1563 if (phys_addr != CEC_PHYS_ADDR_INVALID && adap->devnode.unregistered) in __cec_s_phys_addr()
1569 adap->phys_addr != CEC_PHYS_ADDR_INVALID) { in __cec_s_phys_addr()
1570 adap->phys_addr = CEC_PHYS_ADDR_INVALID; in __cec_s_phys_addr()
1571 cec_post_state_event(adap); in __cec_s_phys_addr()
1572 cec_adap_unconfigure(adap); in __cec_s_phys_addr()
1574 if (adap->monitor_all_cnt) in __cec_s_phys_addr()
1575 WARN_ON(call_op(adap, adap_monitor_all_enable, false)); in __cec_s_phys_addr()
1576 mutex_lock(&adap->devnode.lock); in __cec_s_phys_addr()
1577 if (adap->needs_hpd || list_empty(&adap->devnode.fhs)) { in __cec_s_phys_addr()
1578 WARN_ON(adap->ops->adap_enable(adap, false)); in __cec_s_phys_addr()
1579 adap->transmit_in_progress = false; in __cec_s_phys_addr()
1580 wake_up_interruptible(&adap->kthread_waitq); in __cec_s_phys_addr()
1582 mutex_unlock(&adap->devnode.lock); in __cec_s_phys_addr()
1587 mutex_lock(&adap->devnode.lock); in __cec_s_phys_addr()
1588 adap->last_initiator = 0xff; in __cec_s_phys_addr()
1589 adap->transmit_in_progress = false; in __cec_s_phys_addr()
1591 if ((adap->needs_hpd || list_empty(&adap->devnode.fhs)) && in __cec_s_phys_addr()
1592 adap->ops->adap_enable(adap, true)) { in __cec_s_phys_addr()
1593 mutex_unlock(&adap->devnode.lock); in __cec_s_phys_addr()
1597 if (adap->monitor_all_cnt && in __cec_s_phys_addr()
1598 call_op(adap, adap_monitor_all_enable, true)) { in __cec_s_phys_addr()
1599 if (adap->needs_hpd || list_empty(&adap->devnode.fhs)) in __cec_s_phys_addr()
1600 WARN_ON(adap->ops->adap_enable(adap, false)); in __cec_s_phys_addr()
1601 mutex_unlock(&adap->devnode.lock); in __cec_s_phys_addr()
1604 mutex_unlock(&adap->devnode.lock); in __cec_s_phys_addr()
1606 adap->phys_addr = phys_addr; in __cec_s_phys_addr()
1607 cec_post_state_event(adap); in __cec_s_phys_addr()
1608 if (adap->log_addrs.num_log_addrs) in __cec_s_phys_addr()
1609 cec_claim_log_addrs(adap, block); in __cec_s_phys_addr()
1612 void cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, bool block) in cec_s_phys_addr() argument
1614 if (IS_ERR_OR_NULL(adap)) in cec_s_phys_addr()
1617 mutex_lock(&adap->lock); in cec_s_phys_addr()
1618 __cec_s_phys_addr(adap, phys_addr, block); in cec_s_phys_addr()
1619 mutex_unlock(&adap->lock); in cec_s_phys_addr()
1623 void cec_s_phys_addr_from_edid(struct cec_adapter *adap, in cec_s_phys_addr_from_edid() argument
1631 cec_s_phys_addr(adap, pa, false); in cec_s_phys_addr_from_edid()
1635 void cec_s_conn_info(struct cec_adapter *adap, in cec_s_conn_info() argument
1638 if (IS_ERR_OR_NULL(adap)) in cec_s_conn_info()
1641 if (!(adap->capabilities & CEC_CAP_CONNECTOR_INFO)) in cec_s_conn_info()
1644 mutex_lock(&adap->lock); in cec_s_conn_info()
1646 adap->conn_info = *conn_info; in cec_s_conn_info()
1648 memset(&adap->conn_info, 0, sizeof(adap->conn_info)); in cec_s_conn_info()
1649 cec_post_state_event(adap); in cec_s_conn_info()
1650 mutex_unlock(&adap->lock); in cec_s_conn_info()
1659 int __cec_s_log_addrs(struct cec_adapter *adap, in __cec_s_log_addrs() argument
1665 if (adap->devnode.unregistered) in __cec_s_log_addrs()
1669 cec_adap_unconfigure(adap); in __cec_s_log_addrs()
1670 adap->log_addrs.num_log_addrs = 0; in __cec_s_log_addrs()
1672 adap->log_addrs.log_addr[i] = CEC_LOG_ADDR_INVALID; in __cec_s_log_addrs()
1673 adap->log_addrs.osd_name[0] = '\0'; in __cec_s_log_addrs()
1674 adap->log_addrs.vendor_id = CEC_VENDOR_ID_NONE; in __cec_s_log_addrs()
1675 adap->log_addrs.cec_version = CEC_OP_CEC_VERSION_2_0; in __cec_s_log_addrs()
1706 if (log_addrs->num_log_addrs > adap->available_log_addrs) { in __cec_s_log_addrs()
1707 dprintk(1, "num_log_addrs > %d\n", adap->available_log_addrs); in __cec_s_log_addrs()
1809 log_addrs->log_addr_mask = adap->log_addrs.log_addr_mask; in __cec_s_log_addrs()
1810 adap->log_addrs = *log_addrs; in __cec_s_log_addrs()
1811 if (adap->phys_addr != CEC_PHYS_ADDR_INVALID) in __cec_s_log_addrs()
1812 cec_claim_log_addrs(adap, block); in __cec_s_log_addrs()
1816 int cec_s_log_addrs(struct cec_adapter *adap, in cec_s_log_addrs() argument
1821 mutex_lock(&adap->lock); in cec_s_log_addrs()
1822 err = __cec_s_log_addrs(adap, log_addrs, block); in cec_s_log_addrs()
1823 mutex_unlock(&adap->lock); in cec_s_log_addrs()
1831 static void cec_fill_msg_report_features(struct cec_adapter *adap, in cec_fill_msg_report_features() argument
1835 const struct cec_log_addrs *las = &adap->log_addrs; in cec_fill_msg_report_features()
1844 msg->msg[2] = adap->log_addrs.cec_version; in cec_fill_msg_report_features()
1859 static int cec_feature_abort_reason(struct cec_adapter *adap, in cec_feature_abort_reason() argument
1875 return cec_transmit_msg(adap, &tx_msg, false); in cec_feature_abort_reason()
1878 static int cec_feature_abort(struct cec_adapter *adap, struct cec_msg *msg) in cec_feature_abort() argument
1880 return cec_feature_abort_reason(adap, msg, in cec_feature_abort()
1884 static int cec_feature_refused(struct cec_adapter *adap, struct cec_msg *msg) in cec_feature_refused() argument
1886 return cec_feature_abort_reason(adap, msg, in cec_feature_refused()
1897 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, in cec_receive_notify() argument
1903 u8 devtype = cec_log_addr2dev(adap, dest_laddr); in cec_receive_notify()
1904 int la_idx = cec_log_addr2idx(adap, dest_laddr); in cec_receive_notify()
1911 if (cec_is_cdc_only(&adap->log_addrs) && in cec_receive_notify()
1915 if (adap->ops->received) { in cec_receive_notify()
1917 if (adap->ops->received(adap, msg) != -ENOMSG) in cec_receive_notify()
1936 if (!adap->passthrough && from_unregistered) in cec_receive_notify()
1946 if (adap->passthrough) in cec_receive_notify()
1988 if (!(adap->capabilities & CEC_CAP_RC) || in cec_receive_notify()
1989 !(adap->log_addrs.flags & CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU)) in cec_receive_notify()
2000 rc_keydown(adap->rc, RC_PROTO_CEC, in cec_receive_notify()
2003 rc_keydown(adap->rc, RC_PROTO_CEC, in cec_receive_notify()
2023 rc_keydown(adap->rc, RC_PROTO_CEC, msg->msg[2], 0); in cec_receive_notify()
2030 if (!(adap->capabilities & CEC_CAP_RC) || in cec_receive_notify()
2031 !(adap->log_addrs.flags & CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU)) in cec_receive_notify()
2034 rc_keyup(adap->rc); in cec_receive_notify()
2043 cec_msg_cec_version(&tx_cec_msg, adap->log_addrs.cec_version); in cec_receive_notify()
2044 return cec_transmit_msg(adap, &tx_cec_msg, false); in cec_receive_notify()
2050 cec_msg_report_physical_addr(&tx_cec_msg, adap->phys_addr, devtype); in cec_receive_notify()
2051 return cec_transmit_msg(adap, &tx_cec_msg, false); in cec_receive_notify()
2054 if (adap->log_addrs.vendor_id == CEC_VENDOR_ID_NONE) in cec_receive_notify()
2055 return cec_feature_abort(adap, msg); in cec_receive_notify()
2056 cec_msg_device_vendor_id(&tx_cec_msg, adap->log_addrs.vendor_id); in cec_receive_notify()
2057 return cec_transmit_msg(adap, &tx_cec_msg, false); in cec_receive_notify()
2063 return cec_feature_refused(adap, msg); in cec_receive_notify()
2066 if (adap->log_addrs.osd_name[0] == 0) in cec_receive_notify()
2067 return cec_feature_abort(adap, msg); in cec_receive_notify()
2068 cec_msg_set_osd_name(&tx_cec_msg, adap->log_addrs.osd_name); in cec_receive_notify()
2069 return cec_transmit_msg(adap, &tx_cec_msg, false); in cec_receive_notify()
2073 if (adap->log_addrs.cec_version < CEC_OP_CEC_VERSION_2_0) in cec_receive_notify()
2074 return cec_feature_abort(adap, msg); in cec_receive_notify()
2075 cec_fill_msg_report_features(adap, &tx_cec_msg, la_idx); in cec_receive_notify()
2076 return cec_transmit_msg(adap, &tx_cec_msg, false); in cec_receive_notify()
2083 if (!is_broadcast && !is_reply && !adap->follower_cnt && in cec_receive_notify()
2084 !adap->cec_follower && msg->msg[1] != CEC_MSG_FEATURE_ABORT) in cec_receive_notify()
2085 return cec_feature_abort(adap, msg); in cec_receive_notify()
2098 if (adap->cec_follower) in cec_receive_notify()
2099 cec_queue_msg_fh(adap->cec_follower, msg); in cec_receive_notify()
2101 cec_queue_msg_followers(adap, msg); in cec_receive_notify()
2110 int cec_monitor_all_cnt_inc(struct cec_adapter *adap) in cec_monitor_all_cnt_inc() argument
2114 if (adap->monitor_all_cnt == 0) in cec_monitor_all_cnt_inc()
2115 ret = call_op(adap, adap_monitor_all_enable, 1); in cec_monitor_all_cnt_inc()
2117 adap->monitor_all_cnt++; in cec_monitor_all_cnt_inc()
2121 void cec_monitor_all_cnt_dec(struct cec_adapter *adap) in cec_monitor_all_cnt_dec() argument
2123 adap->monitor_all_cnt--; in cec_monitor_all_cnt_dec()
2124 if (adap->monitor_all_cnt == 0) in cec_monitor_all_cnt_dec()
2125 WARN_ON(call_op(adap, adap_monitor_all_enable, 0)); in cec_monitor_all_cnt_dec()
2133 int cec_monitor_pin_cnt_inc(struct cec_adapter *adap) in cec_monitor_pin_cnt_inc() argument
2137 if (adap->monitor_pin_cnt == 0) in cec_monitor_pin_cnt_inc()
2138 ret = call_op(adap, adap_monitor_pin_enable, 1); in cec_monitor_pin_cnt_inc()
2140 adap->monitor_pin_cnt++; in cec_monitor_pin_cnt_inc()
2144 void cec_monitor_pin_cnt_dec(struct cec_adapter *adap) in cec_monitor_pin_cnt_dec() argument
2146 adap->monitor_pin_cnt--; in cec_monitor_pin_cnt_dec()
2147 if (adap->monitor_pin_cnt == 0) in cec_monitor_pin_cnt_dec()
2148 WARN_ON(call_op(adap, adap_monitor_pin_enable, 0)); in cec_monitor_pin_cnt_dec()
2158 struct cec_adapter *adap = dev_get_drvdata(file->private); in cec_adap_status() local
2161 mutex_lock(&adap->lock); in cec_adap_status()
2162 seq_printf(file, "configured: %d\n", adap->is_configured); in cec_adap_status()
2163 seq_printf(file, "configuring: %d\n", adap->is_configuring); in cec_adap_status()
2165 cec_phys_addr_exp(adap->phys_addr)); in cec_adap_status()
2166 seq_printf(file, "number of LAs: %d\n", adap->log_addrs.num_log_addrs); in cec_adap_status()
2167 seq_printf(file, "LA mask: 0x%04x\n", adap->log_addrs.log_addr_mask); in cec_adap_status()
2168 if (adap->cec_follower) in cec_adap_status()
2170 adap->passthrough ? " (in passthrough mode)" : ""); in cec_adap_status()
2171 if (adap->cec_initiator) in cec_adap_status()
2173 if (adap->monitor_all_cnt) in cec_adap_status()
2175 adap->monitor_all_cnt); in cec_adap_status()
2176 if (adap->tx_timeouts) { in cec_adap_status()
2178 adap->tx_timeouts); in cec_adap_status()
2179 adap->tx_timeouts = 0; in cec_adap_status()
2181 data = adap->transmitting; in cec_adap_status()
2186 seq_printf(file, "pending transmits: %u\n", adap->transmit_queue_sz); in cec_adap_status()
2187 list_for_each_entry(data, &adap->transmit_queue, list) { in cec_adap_status()
2192 list_for_each_entry(data, &adap->wait_queue, list) { in cec_adap_status()
2198 call_void_op(adap, adap_status, file); in cec_adap_status()
2199 mutex_unlock(&adap->lock); in cec_adap_status()