Lines Matching refs:msg
24 struct cec_msg *msg,
202 static void cec_queue_msg_fh(struct cec_fh *fh, const struct cec_msg *msg) in cec_queue_msg_fh() argument
216 entry->msg = *msg; in cec_queue_msg_fh()
256 const struct cec_msg *msg, in cec_queue_msg_monitor() argument
266 cec_queue_msg_fh(fh, msg); in cec_queue_msg_monitor()
275 const struct cec_msg *msg) in cec_queue_msg_followers() argument
282 cec_queue_msg_fh(fh, msg); in cec_queue_msg_followers()
332 cec_queue_msg_fh(data->fh, &data->msg); in cec_data_completed()
354 if (!(data->msg.tx_status & CEC_TX_STATUS_OK)) in cec_data_cancel()
358 if (data->msg.tx_status & CEC_TX_STATUS_OK) { in cec_data_cancel()
360 data->msg.rx_ts = ktime_get_ns(); in cec_data_cancel()
361 data->msg.rx_status = CEC_RX_STATUS_TIMEOUT; in cec_data_cancel()
364 data->msg.tx_ts = ktime_get_ns(); in cec_data_cancel()
365 data->msg.tx_status |= CEC_TX_STATUS_ERROR | in cec_data_cancel()
367 data->msg.tx_error_cnt++; in cec_data_cancel()
372 cec_queue_msg_monitor(data->adap, &data->msg, 1); in cec_data_cancel()
478 adap->transmitting->msg.len, in cec_thread_func()
479 adap->transmitting->msg.msg); in cec_thread_func()
508 if (data->msg.len == 1 && adap->is_configured) in cec_thread_func()
532 signal_free_time, &data->msg)) in cec_thread_func()
552 struct cec_msg *msg; in cec_transmit_done_ts() local
573 msg = &data->msg; in cec_transmit_done_ts()
577 msg->tx_ts = ktime_to_ns(ts); in cec_transmit_done_ts()
578 msg->tx_status |= status; in cec_transmit_done_ts()
579 msg->tx_arb_lost_cnt += arb_lost_cnt; in cec_transmit_done_ts()
580 msg->tx_nack_cnt += nack_cnt; in cec_transmit_done_ts()
581 msg->tx_low_drive_cnt += low_drive_cnt; in cec_transmit_done_ts()
582 msg->tx_error_cnt += error_cnt; in cec_transmit_done_ts()
596 if (msg->timeout) in cec_transmit_done_ts()
598 msg->len, msg->msg, data->attempts, msg->reply); in cec_transmit_done_ts()
601 msg->len, msg->msg, data->attempts); in cec_transmit_done_ts()
612 msg->tx_status |= CEC_TX_STATUS_MAX_RETRIES; in cec_transmit_done_ts()
615 cec_queue_msg_monitor(adap, msg, 1); in cec_transmit_done_ts()
618 msg->timeout) { in cec_transmit_done_ts()
625 msecs_to_jiffies(msg->timeout)); in cec_transmit_done_ts()
687 data->msg.rx_ts = ktime_get_ns(); in cec_wait_timeout()
688 data->msg.rx_status = CEC_RX_STATUS_TIMEOUT; in cec_wait_timeout()
700 int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, in cec_transmit_msg_fh() argument
708 msg->rx_ts = 0; in cec_transmit_msg_fh()
709 msg->tx_ts = 0; in cec_transmit_msg_fh()
710 msg->rx_status = 0; in cec_transmit_msg_fh()
711 msg->tx_status = 0; in cec_transmit_msg_fh()
712 msg->tx_arb_lost_cnt = 0; in cec_transmit_msg_fh()
713 msg->tx_nack_cnt = 0; in cec_transmit_msg_fh()
714 msg->tx_low_drive_cnt = 0; in cec_transmit_msg_fh()
715 msg->tx_error_cnt = 0; in cec_transmit_msg_fh()
716 msg->sequence = 0; in cec_transmit_msg_fh()
718 if (msg->reply && msg->timeout == 0) { in cec_transmit_msg_fh()
720 msg->timeout = 1000; in cec_transmit_msg_fh()
722 if (msg->timeout) in cec_transmit_msg_fh()
723 msg->flags &= CEC_MSG_FL_REPLY_TO_FOLLOWERS; in cec_transmit_msg_fh()
725 msg->flags = 0; in cec_transmit_msg_fh()
727 if (msg->len > 1 && msg->msg[1] == CEC_MSG_CDC_MESSAGE) { in cec_transmit_msg_fh()
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()
733 if (msg->len == 0 || msg->len > CEC_MAX_MSG_SIZE) { in cec_transmit_msg_fh()
734 dprintk(1, "%s: invalid length %d\n", __func__, msg->len); in cec_transmit_msg_fh()
738 memset(msg->msg + msg->len, 0, sizeof(msg->msg) - msg->len); in cec_transmit_msg_fh()
740 if (msg->timeout) in cec_transmit_msg_fh()
742 __func__, msg->len, msg->msg, msg->reply, in cec_transmit_msg_fh()
746 __func__, msg->len, msg->msg, !block ? " (nb)" : ""); in cec_transmit_msg_fh()
748 if (msg->timeout && msg->len == 1) { in cec_transmit_msg_fh()
752 if (msg->len == 1) { in cec_transmit_msg_fh()
753 if (cec_msg_destination(msg) == 0xf) { in cec_transmit_msg_fh()
757 if (cec_has_log_addr(adap, cec_msg_destination(msg))) { in cec_transmit_msg_fh()
766 msg->tx_ts = ktime_get_ns(); in cec_transmit_msg_fh()
767 msg->tx_status = CEC_TX_STATUS_NACK | in cec_transmit_msg_fh()
769 msg->tx_nack_cnt = 1; in cec_transmit_msg_fh()
770 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
771 if (!msg->sequence) in cec_transmit_msg_fh()
772 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
776 if (msg->len > 1 && !cec_msg_is_broadcast(msg) && 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()
784 __func__, cec_msg_initiator(msg)); in cec_transmit_msg_fh()
788 if (adap->needs_hpd || msg->msg[0] != 0xf0) { in cec_transmit_msg_fh()
792 if (msg->reply) { in cec_transmit_msg_fh()
807 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
808 if (!msg->sequence) in cec_transmit_msg_fh()
809 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
811 data->msg = *msg; in cec_transmit_msg_fh()
820 if (msg->len > 1) { in cec_transmit_msg_fh()
826 last_initiator = cec_msg_initiator(&last->msg); in cec_transmit_msg_fh()
829 cec_msg_initiator(&adap->transmitting->msg); in cec_transmit_msg_fh()
832 data->new_initiator = last_initiator != cec_msg_initiator(msg); in cec_transmit_msg_fh()
854 if (msg->timeout) in cec_transmit_msg_fh()
855 timeout += msg->timeout; in cec_transmit_msg_fh()
867 *msg = data->msg; in cec_transmit_msg_fh()
884 if (msg->timeout && (msg->tx_status & CEC_TX_STATUS_OK)) in cec_transmit_msg_fh()
885 msg->rx_status = CEC_RX_STATUS_TIMEOUT; in cec_transmit_msg_fh()
887 msg->tx_status = CEC_TX_STATUS_MAX_RETRIES; in cec_transmit_msg_fh()
893 int cec_transmit_msg(struct cec_adapter *adap, struct cec_msg *msg, in cec_transmit_msg() argument
899 ret = cec_transmit_msg_fh(adap, msg, NULL, block); in cec_transmit_msg()
910 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg,
1004 struct cec_msg *msg, ktime_t ts) in cec_received_msg_ts() argument
1007 u8 msg_init = cec_msg_initiator(msg); in cec_received_msg_ts()
1008 u8 msg_dest = cec_msg_destination(msg); in cec_received_msg_ts()
1009 u8 cmd = msg->msg[1]; in cec_received_msg_ts()
1014 if (WARN_ON(!msg->len || msg->len > CEC_MAX_MSG_SIZE)) in cec_received_msg_ts()
1032 msg->rx_ts = ktime_to_ns(ts); in cec_received_msg_ts()
1033 msg->rx_status = CEC_RX_STATUS_OK; in cec_received_msg_ts()
1034 msg->sequence = msg->reply = msg->timeout = 0; in cec_received_msg_ts()
1035 msg->tx_status = 0; in cec_received_msg_ts()
1036 msg->tx_ts = 0; in cec_received_msg_ts()
1037 msg->tx_arb_lost_cnt = 0; in cec_received_msg_ts()
1038 msg->tx_nack_cnt = 0; in cec_received_msg_ts()
1039 msg->tx_low_drive_cnt = 0; in cec_received_msg_ts()
1040 msg->tx_error_cnt = 0; in cec_received_msg_ts()
1041 msg->flags = 0; in cec_received_msg_ts()
1042 memset(msg->msg + msg->len, 0, sizeof(msg->msg) - msg->len); in cec_received_msg_ts()
1045 dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg); in cec_received_msg_ts()
1048 if (!cec_msg_is_broadcast(msg)) in cec_received_msg_ts()
1057 if (valid_la && msg->len > 1 && cec_msg_size[cmd]) { in cec_received_msg_ts()
1061 if (msg->len < min_len) in cec_received_msg_ts()
1063 else if (!cec_msg_is_broadcast(msg) && !(dir_fl & DIRECTED)) in cec_received_msg_ts()
1065 else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST1_4)) in cec_received_msg_ts()
1067 else if (cec_msg_is_broadcast(msg) && in cec_received_msg_ts()
1076 if (msg->msg[2] & 0x10) { in cec_received_msg_ts()
1077 switch (msg->msg[2] & 0xf) { in cec_received_msg_ts()
1080 if (msg->len < 5) in cec_received_msg_ts()
1084 } else if ((msg->msg[2] & 0xf) == CEC_OP_PROG_ERROR_DUPLICATE) { in cec_received_msg_ts()
1085 if (msg->len < 5) in cec_received_msg_ts()
1090 switch (msg->msg[2]) { in cec_received_msg_ts()
1094 if (msg->len < 10) in cec_received_msg_ts()
1098 if (msg->len < 7) in cec_received_msg_ts()
1102 if (msg->len < 4) in cec_received_msg_ts()
1106 if (msg->len < 5) in cec_received_msg_ts()
1115 if (valid_la && msg->len > 1 && cmd != CEC_MSG_CDC_MESSAGE) { in cec_received_msg_ts()
1120 cmd = msg->msg[2]; in cec_received_msg_ts()
1127 struct cec_msg *dst = &data->msg; in cec_received_msg_ts()
1134 if (!abort && dst->msg[1] == CEC_MSG_INITIATE_ARC && in cec_received_msg_ts()
1142 if ((abort && cmd != dst->msg[1]) || in cec_received_msg_ts()
1152 memcpy(dst->msg, msg->msg, msg->len); in cec_received_msg_ts()
1153 dst->len = msg->len; in cec_received_msg_ts()
1154 dst->rx_ts = msg->rx_ts; in cec_received_msg_ts()
1155 dst->rx_status = msg->rx_status; in cec_received_msg_ts()
1158 msg->flags = dst->flags; in cec_received_msg_ts()
1181 cec_queue_msg_monitor(adap, msg, valid_la); in cec_received_msg_ts()
1184 if (!valid_la || msg->len <= 1) in cec_received_msg_ts()
1195 cec_receive_notify(adap, msg, is_reply); in cec_received_msg_ts()
1211 struct cec_msg msg = { }; in cec_config_log_addr() local
1218 msg.len = 1; in cec_config_log_addr()
1219 msg.msg[0] = (log_addr << 4) | log_addr; in cec_config_log_addr()
1220 err = cec_transmit_msg_fh(adap, &msg, NULL, true); in cec_config_log_addr()
1232 if (msg.tx_status & CEC_TX_STATUS_OK) in cec_config_log_addr()
1415 struct cec_msg msg = {}; in cec_config_thread_func() local
1421 msg.msg[0] = (las->log_addr[i] << 4) | 0x0f; 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()
1436 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1731 struct cec_msg *msg, in cec_fill_msg_report_features() argument
1740 msg->msg[0] = (las->log_addr[la_idx] << 4) | 0x0f; in cec_fill_msg_report_features()
1741 msg->len = 4; in cec_fill_msg_report_features()
1742 msg->msg[1] = CEC_MSG_REPORT_FEATURES; in cec_fill_msg_report_features()
1743 msg->msg[2] = adap->log_addrs.cec_version; in cec_fill_msg_report_features()
1744 msg->msg[3] = las->all_device_types[la_idx]; in cec_fill_msg_report_features()
1748 msg->msg[msg->len++] = features[idx]; in cec_fill_msg_report_features()
1759 struct cec_msg *msg, u8 reason) in cec_feature_abort_reason() argument
1767 if (msg->msg[1] == CEC_MSG_FEATURE_ABORT) in cec_feature_abort_reason()
1770 if (cec_msg_initiator(msg) == CEC_LOG_ADDR_UNREGISTERED) in cec_feature_abort_reason()
1772 cec_msg_set_reply_to(&tx_msg, msg); in cec_feature_abort_reason()
1773 cec_msg_feature_abort(&tx_msg, msg->msg[1], reason); 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
1799 bool is_broadcast = cec_msg_is_broadcast(msg); in cec_receive_notify()
1800 u8 dest_laddr = cec_msg_destination(msg); in cec_receive_notify()
1801 u8 init_laddr = cec_msg_initiator(msg); in cec_receive_notify()
1807 dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg); in cec_receive_notify()
1811 msg->msg[1] != CEC_MSG_CDC_MESSAGE) in cec_receive_notify()
1816 if (adap->ops->received(adap, msg) != -ENOMSG) in cec_receive_notify()
1826 switch (msg->msg[1]) { in cec_receive_notify()
1874 cec_msg_set_reply_to(&tx_cec_msg, msg); in cec_receive_notify()
1876 switch (msg->msg[1]) { in cec_receive_notify()
1879 u16 pa = (msg->msg[2] << 8) | msg->msg[3]; in cec_receive_notify()
1894 switch (msg->msg[2]) { in cec_receive_notify()
1900 if (msg->len == 2) in cec_receive_notify()
1902 msg->msg[2], 0); in cec_receive_notify()
1905 msg->msg[2] << 8 | msg->msg[3], 0); in cec_receive_notify()
1920 rc_keydown(adap->rc, RC_PROTO_CEC, msg->msg[2], 0); in cec_receive_notify()
1952 return cec_feature_abort(adap, msg); in cec_receive_notify()
1960 return cec_feature_refused(adap, msg); in cec_receive_notify()
1964 return cec_feature_abort(adap, msg); in cec_receive_notify()
1971 return cec_feature_abort(adap, msg); 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()
1988 if (is_reply && !(msg->flags & CEC_MSG_FL_REPLY_TO_FOLLOWERS)) 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()
2081 data->msg.len, data->msg.msg, data->msg.reply, in cec_adap_status()
2082 data->msg.timeout); in cec_adap_status()
2086 data->msg.len, data->msg.msg, data->msg.reply, in cec_adap_status()
2087 data->msg.timeout); in cec_adap_status()
2091 data->msg.len, data->msg.msg, data->msg.reply, in cec_adap_status()
2092 data->msg.timeout); in cec_adap_status()