Lines Matching refs:msg
27 struct cec_msg *msg,
228 static void cec_queue_msg_fh(struct cec_fh *fh, const struct cec_msg *msg) in cec_queue_msg_fh() argument
242 entry->msg = *msg; in cec_queue_msg_fh()
282 const struct cec_msg *msg, in cec_queue_msg_monitor() argument
292 cec_queue_msg_fh(fh, msg); in cec_queue_msg_monitor()
301 const struct cec_msg *msg) in cec_queue_msg_followers() argument
308 cec_queue_msg_fh(fh, msg); in cec_queue_msg_followers()
360 cec_queue_msg_fh(data->fh, &data->msg); in cec_data_completed()
382 if (!(data->msg.tx_status & CEC_TX_STATUS_OK)) in cec_data_cancel()
387 if (data->msg.tx_status & CEC_TX_STATUS_OK) { in cec_data_cancel()
388 data->msg.rx_ts = ktime_get_ns(); in cec_data_cancel()
389 data->msg.rx_status = CEC_RX_STATUS_ABORTED; in cec_data_cancel()
391 data->msg.tx_ts = ktime_get_ns(); in cec_data_cancel()
392 data->msg.tx_status |= tx_status | in cec_data_cancel()
394 data->msg.tx_error_cnt++; in cec_data_cancel()
399 cec_queue_msg_monitor(data->adap, &data->msg, 1); in cec_data_cancel()
514 adap->transmitting->msg.len, in cec_thread_func()
515 adap->transmitting->msg.msg); in cec_thread_func()
550 if (data->msg.len == 1 && adap->is_configured) in cec_thread_func()
560 cec_msg_initiator(&data->msg)) { in cec_thread_func()
563 adap->last_initiator = cec_msg_initiator(&data->msg); in cec_thread_func()
576 signal_free_time, &data->msg)) in cec_thread_func()
598 struct cec_msg *msg; in cec_transmit_done_ts() local
622 msg = &data->msg; in cec_transmit_done_ts()
626 msg->tx_ts = ktime_to_ns(ts); in cec_transmit_done_ts()
627 msg->tx_status |= status; in cec_transmit_done_ts()
628 msg->tx_arb_lost_cnt += arb_lost_cnt; in cec_transmit_done_ts()
629 msg->tx_nack_cnt += nack_cnt; in cec_transmit_done_ts()
630 msg->tx_low_drive_cnt += low_drive_cnt; in cec_transmit_done_ts()
631 msg->tx_error_cnt += error_cnt; in cec_transmit_done_ts()
645 if (msg->timeout) in cec_transmit_done_ts()
647 msg->len, msg->msg, data->attempts, msg->reply); in cec_transmit_done_ts()
650 msg->len, msg->msg, data->attempts); in cec_transmit_done_ts()
661 msg->tx_status |= CEC_TX_STATUS_MAX_RETRIES; in cec_transmit_done_ts()
664 cec_queue_msg_monitor(adap, msg, 1); in cec_transmit_done_ts()
667 msg->timeout) { in cec_transmit_done_ts()
674 msecs_to_jiffies(msg->timeout)); in cec_transmit_done_ts()
735 data->msg.rx_ts = ktime_get_ns(); in cec_wait_timeout()
736 data->msg.rx_status = CEC_RX_STATUS_TIMEOUT; in cec_wait_timeout()
748 int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, in cec_transmit_msg_fh() argument
752 bool is_raw = msg_is_raw(msg); in cec_transmit_msg_fh()
757 msg->rx_ts = 0; in cec_transmit_msg_fh()
758 msg->tx_ts = 0; in cec_transmit_msg_fh()
759 msg->rx_status = 0; in cec_transmit_msg_fh()
760 msg->tx_status = 0; in cec_transmit_msg_fh()
761 msg->tx_arb_lost_cnt = 0; in cec_transmit_msg_fh()
762 msg->tx_nack_cnt = 0; in cec_transmit_msg_fh()
763 msg->tx_low_drive_cnt = 0; in cec_transmit_msg_fh()
764 msg->tx_error_cnt = 0; in cec_transmit_msg_fh()
765 msg->sequence = 0; in cec_transmit_msg_fh()
767 if (msg->reply && msg->timeout == 0) { in cec_transmit_msg_fh()
769 msg->timeout = 1000; in cec_transmit_msg_fh()
771 msg->flags &= CEC_MSG_FL_REPLY_TO_FOLLOWERS | CEC_MSG_FL_RAW; in cec_transmit_msg_fh()
773 if (!msg->timeout) in cec_transmit_msg_fh()
774 msg->flags &= ~CEC_MSG_FL_REPLY_TO_FOLLOWERS; in cec_transmit_msg_fh()
777 if (msg->len == 0 || msg->len > CEC_MAX_MSG_SIZE) { in cec_transmit_msg_fh()
778 dprintk(1, "%s: invalid length %d\n", __func__, msg->len); in cec_transmit_msg_fh()
782 memset(msg->msg + msg->len, 0, sizeof(msg->msg) - msg->len); in cec_transmit_msg_fh()
784 if (msg->timeout) in cec_transmit_msg_fh()
786 __func__, msg->len, msg->msg, msg->reply, in cec_transmit_msg_fh()
790 __func__, msg->len, msg->msg, !block ? " (nb)" : ""); in cec_transmit_msg_fh()
792 if (msg->timeout && msg->len == 1) { in cec_transmit_msg_fh()
803 (msg->len == 1 || msg->msg[1] != CEC_MSG_CDC_MESSAGE)) { in cec_transmit_msg_fh()
808 if (msg->len >= 4 && msg->msg[1] == CEC_MSG_CDC_MESSAGE) { 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()
813 if (msg->len == 1) { in cec_transmit_msg_fh()
814 if (cec_msg_destination(msg) == 0xf) { in cec_transmit_msg_fh()
819 if (cec_has_log_addr(adap, cec_msg_destination(msg))) { in cec_transmit_msg_fh()
828 msg->tx_ts = ktime_get_ns(); in cec_transmit_msg_fh()
829 msg->tx_status = CEC_TX_STATUS_NACK | in cec_transmit_msg_fh()
831 msg->tx_nack_cnt = 1; in cec_transmit_msg_fh()
832 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
833 if (!msg->sequence) in cec_transmit_msg_fh()
834 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
838 if (msg->len > 1 && !cec_msg_is_broadcast(msg) && 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()
847 __func__, cec_msg_initiator(msg)); in cec_transmit_msg_fh()
857 (msg->len > 2 || in cec_transmit_msg_fh()
858 cec_msg_destination(msg) != CEC_LOG_ADDR_TV || in cec_transmit_msg_fh()
859 (msg->len == 2 && msg->msg[1] != CEC_MSG_IMAGE_VIEW_ON && in cec_transmit_msg_fh()
860 msg->msg[1] != CEC_MSG_TEXT_VIEW_ON))) { in cec_transmit_msg_fh()
872 if (msg->reply) { in cec_transmit_msg_fh()
887 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
888 if (!msg->sequence) in cec_transmit_msg_fh()
889 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
891 data->msg = *msg; in cec_transmit_msg_fh()
925 *msg = data->msg; in cec_transmit_msg_fh()
931 int cec_transmit_msg(struct cec_adapter *adap, struct cec_msg *msg, in cec_transmit_msg() argument
937 ret = cec_transmit_msg_fh(adap, msg, NULL, block); in cec_transmit_msg()
948 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg,
1042 struct cec_msg *msg, ktime_t ts) in cec_received_msg_ts() argument
1045 u8 msg_init = cec_msg_initiator(msg); in cec_received_msg_ts()
1046 u8 msg_dest = cec_msg_destination(msg); in cec_received_msg_ts()
1047 u8 cmd = msg->msg[1]; in cec_received_msg_ts()
1052 if (WARN_ON(!msg->len || msg->len > CEC_MAX_MSG_SIZE)) in cec_received_msg_ts()
1073 msg->rx_ts = ktime_to_ns(ts); in cec_received_msg_ts()
1074 msg->rx_status = CEC_RX_STATUS_OK; in cec_received_msg_ts()
1075 msg->sequence = msg->reply = msg->timeout = 0; in cec_received_msg_ts()
1076 msg->tx_status = 0; in cec_received_msg_ts()
1077 msg->tx_ts = 0; in cec_received_msg_ts()
1078 msg->tx_arb_lost_cnt = 0; in cec_received_msg_ts()
1079 msg->tx_nack_cnt = 0; in cec_received_msg_ts()
1080 msg->tx_low_drive_cnt = 0; in cec_received_msg_ts()
1081 msg->tx_error_cnt = 0; in cec_received_msg_ts()
1082 msg->flags = 0; in cec_received_msg_ts()
1083 memset(msg->msg + msg->len, 0, sizeof(msg->msg) - msg->len); in cec_received_msg_ts()
1086 dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg); in cec_received_msg_ts()
1091 if (!cec_msg_is_broadcast(msg)) in cec_received_msg_ts()
1100 if (valid_la && msg->len > 1 && cec_msg_size[cmd]) { in cec_received_msg_ts()
1104 if (msg->len < min_len) in cec_received_msg_ts()
1106 else if (!cec_msg_is_broadcast(msg) && !(dir_fl & DIRECTED)) in cec_received_msg_ts()
1108 else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST)) in cec_received_msg_ts()
1110 else if (cec_msg_is_broadcast(msg) && in cec_received_msg_ts()
1119 if (msg->msg[2] & 0x10) { in cec_received_msg_ts()
1120 switch (msg->msg[2] & 0xf) { in cec_received_msg_ts()
1123 if (msg->len < 5) in cec_received_msg_ts()
1127 } else if ((msg->msg[2] & 0xf) == CEC_OP_PROG_ERROR_DUPLICATE) { in cec_received_msg_ts()
1128 if (msg->len < 5) in cec_received_msg_ts()
1133 switch (msg->msg[2]) { in cec_received_msg_ts()
1137 if (msg->len < 10) in cec_received_msg_ts()
1141 if (msg->len < 7) in cec_received_msg_ts()
1145 if (msg->len < 4) in cec_received_msg_ts()
1149 if (msg->len < 5) in cec_received_msg_ts()
1158 if (valid_la && msg->len > 1 && cmd != CEC_MSG_CDC_MESSAGE) { in cec_received_msg_ts()
1163 cmd = msg->msg[2]; in cec_received_msg_ts()
1170 struct cec_msg *dst = &data->msg; in cec_received_msg_ts()
1177 if (!abort && dst->msg[1] == CEC_MSG_INITIATE_ARC && in cec_received_msg_ts()
1185 if ((abort && cmd != dst->msg[1]) || in cec_received_msg_ts()
1195 memcpy(dst->msg, msg->msg, msg->len); in cec_received_msg_ts()
1196 dst->len = msg->len; in cec_received_msg_ts()
1197 dst->rx_ts = msg->rx_ts; in cec_received_msg_ts()
1198 dst->rx_status = msg->rx_status; in cec_received_msg_ts()
1201 msg->flags = dst->flags; in cec_received_msg_ts()
1202 msg->sequence = dst->sequence; in cec_received_msg_ts()
1225 cec_queue_msg_monitor(adap, msg, valid_la); in cec_received_msg_ts()
1228 if (!valid_la || msg->len <= 1) in cec_received_msg_ts()
1239 cec_receive_notify(adap, msg, is_reply); in cec_received_msg_ts()
1255 struct cec_msg msg = { }; in cec_config_log_addr() local
1264 msg.len = 1; in cec_config_log_addr()
1265 msg.msg[0] = (log_addr << 4) | log_addr; in cec_config_log_addr()
1268 err = cec_transmit_msg_fh(adap, &msg, NULL, true); in cec_config_log_addr()
1284 if (msg.tx_status & CEC_TX_STATUS_ABORTED) in cec_config_log_addr()
1286 if (msg.tx_status & CEC_TX_STATUS_OK) in cec_config_log_addr()
1288 if (msg.tx_status & CEC_TX_STATUS_NACK) in cec_config_log_addr()
1484 struct cec_msg msg = {}; in cec_config_thread_func() local
1490 msg.msg[0] = (las->log_addr[i] << 4) | 0x0f; 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()
1505 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1509 cec_msg_device_vendor_id(&msg, in cec_config_thread_func()
1511 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1832 struct cec_msg *msg, in cec_fill_msg_report_features() argument
1841 msg->msg[0] = (las->log_addr[la_idx] << 4) | 0x0f; in cec_fill_msg_report_features()
1842 msg->len = 4; in cec_fill_msg_report_features()
1843 msg->msg[1] = CEC_MSG_REPORT_FEATURES; in cec_fill_msg_report_features()
1844 msg->msg[2] = adap->log_addrs.cec_version; in cec_fill_msg_report_features()
1845 msg->msg[3] = las->all_device_types[la_idx]; in cec_fill_msg_report_features()
1849 msg->msg[msg->len++] = features[idx]; in cec_fill_msg_report_features()
1860 struct cec_msg *msg, u8 reason) in cec_feature_abort_reason() argument
1868 if (msg->msg[1] == CEC_MSG_FEATURE_ABORT) in cec_feature_abort_reason()
1871 if (cec_msg_initiator(msg) == CEC_LOG_ADDR_UNREGISTERED) in cec_feature_abort_reason()
1873 cec_msg_set_reply_to(&tx_msg, msg); in cec_feature_abort_reason()
1874 cec_msg_feature_abort(&tx_msg, msg->msg[1], reason); 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
1900 bool is_broadcast = cec_msg_is_broadcast(msg); in cec_receive_notify()
1901 u8 dest_laddr = cec_msg_destination(msg); in cec_receive_notify()
1902 u8 init_laddr = cec_msg_initiator(msg); in cec_receive_notify()
1908 dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg); in cec_receive_notify()
1912 msg->msg[1] != CEC_MSG_CDC_MESSAGE) in cec_receive_notify()
1917 if (adap->ops->received(adap, msg) != -ENOMSG) in cec_receive_notify()
1927 switch (msg->msg[1]) { in cec_receive_notify()
1975 cec_msg_set_reply_to(&tx_cec_msg, msg); in cec_receive_notify()
1977 switch (msg->msg[1]) { in cec_receive_notify()
1980 u16 pa = (msg->msg[2] << 8) | msg->msg[3]; in cec_receive_notify()
1993 switch (msg->msg[2]) { in cec_receive_notify()
1999 if (msg->len == 2) in cec_receive_notify()
2001 msg->msg[2], 0); in cec_receive_notify()
2004 msg->msg[2] << 8 | msg->msg[3], 0); in cec_receive_notify()
2023 rc_keydown(adap->rc, RC_PROTO_CEC, msg->msg[2], 0); in cec_receive_notify()
2055 return cec_feature_abort(adap, msg); in cec_receive_notify()
2063 return cec_feature_refused(adap, msg); in cec_receive_notify()
2067 return cec_feature_abort(adap, msg); in cec_receive_notify()
2074 return cec_feature_abort(adap, msg); 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()
2091 if (is_reply && !(msg->flags & CEC_MSG_FL_REPLY_TO_FOLLOWERS)) 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()
2184 data->msg.len, data->msg.msg, data->msg.reply, in cec_adap_status()
2185 data->msg.timeout); in cec_adap_status()
2189 data->msg.len, data->msg.msg, data->msg.reply, in cec_adap_status()
2190 data->msg.timeout); in cec_adap_status()
2194 data->msg.len, data->msg.msg, data->msg.reply, in cec_adap_status()
2195 data->msg.timeout); in cec_adap_status()