Lines Matching full:msg

27 					 struct cec_msg *msg,
109 /* Add new msg at the end of the queue */ in cec_queue_event_fh()
208 static void cec_queue_msg_fh(struct cec_fh *fh, const struct cec_msg *msg) in cec_queue_msg_fh() argument
222 entry->msg = *msg; in cec_queue_msg_fh()
223 /* Add new msg at the end of the queue */ in cec_queue_msg_fh()
262 const struct cec_msg *msg, in cec_queue_msg_monitor() argument
272 cec_queue_msg_fh(fh, msg); in cec_queue_msg_monitor()
281 const struct cec_msg *msg) in cec_queue_msg_followers() argument
288 cec_queue_msg_fh(fh, msg); in cec_queue_msg_followers()
340 cec_queue_msg_fh(data->fh, &data->msg); in cec_data_completed()
364 if (!(data->msg.tx_status & CEC_TX_STATUS_OK)) in cec_data_cancel()
369 if (data->msg.tx_status & CEC_TX_STATUS_OK) { in cec_data_cancel()
370 data->msg.rx_ts = ktime_get_ns(); in cec_data_cancel()
371 data->msg.rx_status = rx_status; in cec_data_cancel()
373 data->msg.tx_status = 0; in cec_data_cancel()
375 data->msg.tx_ts = ktime_get_ns(); in cec_data_cancel()
376 data->msg.tx_status |= tx_status | in cec_data_cancel()
378 data->msg.tx_error_cnt++; in cec_data_cancel()
381 data->msg.rx_status = 0; in cec_data_cancel()
385 cec_queue_msg_monitor(adap, &data->msg, 1); in cec_data_cancel()
387 if (!data->blocking && data->msg.sequence) in cec_data_cancel()
389 call_void_op(adap, adap_nb_transmit_canceled, &data->msg); 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()
577 signal_free_time, &data->msg)) in cec_thread_func()
599 struct cec_msg *msg; in cec_transmit_done_ts() local
626 msg = &data->msg; in cec_transmit_done_ts()
630 msg->tx_ts = ktime_to_ns(ts); in cec_transmit_done_ts()
631 msg->tx_status |= status; in cec_transmit_done_ts()
632 msg->tx_arb_lost_cnt += arb_lost_cnt; in cec_transmit_done_ts()
633 msg->tx_nack_cnt += nack_cnt; in cec_transmit_done_ts()
634 msg->tx_low_drive_cnt += low_drive_cnt; in cec_transmit_done_ts()
635 msg->tx_error_cnt += error_cnt; in cec_transmit_done_ts()
651 if (done && adap->tx_low_drive_log_cnt < 8 && msg->tx_low_drive_cnt) { in cec_transmit_done_ts()
654 msg->tx_low_drive_cnt, msg->sequence, in cec_transmit_done_ts()
655 msg->len, msg->msg); in cec_transmit_done_ts()
657 if (done && adap->tx_error_log_cnt < 8 && msg->tx_error_cnt) { in cec_transmit_done_ts()
660 msg->tx_error_cnt, msg->sequence, in cec_transmit_done_ts()
661 msg->len, msg->msg); in cec_transmit_done_ts()
675 if (msg->timeout) in cec_transmit_done_ts()
677 msg->len, msg->msg, data->attempts, in cec_transmit_done_ts()
681 msg->len, msg->msg, data->attempts); in cec_transmit_done_ts()
694 msg->tx_status |= CEC_TX_STATUS_MAX_RETRIES; in cec_transmit_done_ts()
697 cec_queue_msg_monitor(adap, msg, 1); in cec_transmit_done_ts()
700 msg->timeout) { in cec_transmit_done_ts()
707 msecs_to_jiffies(msg->timeout)); in cec_transmit_done_ts()
779 int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, in cec_transmit_msg_fh() argument
783 bool is_raw = msg_is_raw(msg); in cec_transmit_msg_fh()
784 bool reply_vendor_id = (msg->flags & CEC_MSG_FL_REPLY_VENDOR_ID) && in cec_transmit_msg_fh()
785 msg->len > 1 && msg->msg[1] == CEC_MSG_VENDOR_COMMAND_WITH_ID; in cec_transmit_msg_fh()
791 msg->rx_ts = 0; in cec_transmit_msg_fh()
792 msg->tx_ts = 0; in cec_transmit_msg_fh()
793 msg->rx_status = 0; in cec_transmit_msg_fh()
794 msg->tx_status = 0; in cec_transmit_msg_fh()
795 msg->tx_arb_lost_cnt = 0; in cec_transmit_msg_fh()
796 msg->tx_nack_cnt = 0; in cec_transmit_msg_fh()
797 msg->tx_low_drive_cnt = 0; in cec_transmit_msg_fh()
798 msg->tx_error_cnt = 0; in cec_transmit_msg_fh()
799 msg->sequence = 0; in cec_transmit_msg_fh()
800 msg->flags &= CEC_MSG_FL_REPLY_TO_FOLLOWERS | CEC_MSG_FL_RAW | in cec_transmit_msg_fh()
803 if ((reply_vendor_id || msg->reply) && msg->timeout == 0) { in cec_transmit_msg_fh()
805 msg->timeout = 1000; in cec_transmit_msg_fh()
808 if (!msg->timeout) in cec_transmit_msg_fh()
809 msg->flags &= ~CEC_MSG_FL_REPLY_TO_FOLLOWERS; in cec_transmit_msg_fh()
812 if (msg->len == 0 || msg->len > CEC_MAX_MSG_SIZE) { in cec_transmit_msg_fh()
813 dprintk(1, "%s: invalid length %d\n", __func__, msg->len); in cec_transmit_msg_fh()
816 if (reply_vendor_id && msg->len < 6) { in cec_transmit_msg_fh()
822 memset(msg->msg + msg->len, 0, sizeof(msg->msg) - msg->len); in cec_transmit_msg_fh()
824 if (msg->timeout) in cec_transmit_msg_fh()
826 __func__, msg->len, msg->msg, msg->reply, in cec_transmit_msg_fh()
830 __func__, msg->len, msg->msg, !block ? " (nb)" : ""); in cec_transmit_msg_fh()
832 if (msg->timeout && msg->len == 1) { in cec_transmit_msg_fh()
833 dprintk(1, "%s: can't reply to poll msg\n", __func__); in cec_transmit_msg_fh()
843 (msg->len == 1 || msg->msg[1] != CEC_MSG_CDC_MESSAGE)) { in cec_transmit_msg_fh()
848 if (msg->len >= 4 && msg->msg[1] == CEC_MSG_CDC_MESSAGE) { in cec_transmit_msg_fh()
849 msg->msg[2] = adap->phys_addr >> 8; in cec_transmit_msg_fh()
850 msg->msg[3] = adap->phys_addr & 0xff; in cec_transmit_msg_fh()
853 if (msg->len == 1) { in cec_transmit_msg_fh()
854 if (cec_msg_destination(msg) == 0xf) { in cec_transmit_msg_fh()
859 if (cec_has_log_addr(adap, cec_msg_destination(msg))) { in cec_transmit_msg_fh()
868 msg->tx_ts = ktime_get_ns(); in cec_transmit_msg_fh()
869 msg->tx_status = CEC_TX_STATUS_NACK | in cec_transmit_msg_fh()
871 msg->tx_nack_cnt = 1; in cec_transmit_msg_fh()
872 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
873 if (!msg->sequence) in cec_transmit_msg_fh()
874 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
878 if (msg->len > 1 && !cec_msg_is_broadcast(msg) && in cec_transmit_msg_fh()
879 cec_has_log_addr(adap, cec_msg_destination(msg))) { in cec_transmit_msg_fh()
884 if (msg->len > 1 && adap->is_configured && in cec_transmit_msg_fh()
885 !cec_has_log_addr(adap, cec_msg_initiator(msg))) { in cec_transmit_msg_fh()
887 __func__, cec_msg_initiator(msg)); in cec_transmit_msg_fh()
897 (msg->len > 2 || in cec_transmit_msg_fh()
898 cec_msg_destination(msg) != CEC_LOG_ADDR_TV || in cec_transmit_msg_fh()
899 (msg->len == 2 && msg->msg[1] != CEC_MSG_IMAGE_VIEW_ON && in cec_transmit_msg_fh()
900 msg->msg[1] != CEC_MSG_TEXT_VIEW_ON))) { in cec_transmit_msg_fh()
912 if (reply_vendor_id || msg->reply) { in cec_transmit_msg_fh()
928 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
929 if (!msg->sequence) in cec_transmit_msg_fh()
930 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
932 data->msg = *msg; in cec_transmit_msg_fh()
937 memcpy(data->match_reply, msg->msg + 1, 4); in cec_transmit_msg_fh()
938 data->match_reply[4] = msg->reply; in cec_transmit_msg_fh()
940 } else if (msg->timeout) { in cec_transmit_msg_fh()
941 data->match_reply[0] = msg->reply; in cec_transmit_msg_fh()
975 if (data->msg.tx_status & CEC_TX_STATUS_OK) in cec_transmit_msg_fh()
982 *msg = data->msg; in cec_transmit_msg_fh()
992 int cec_transmit_msg(struct cec_adapter *adap, struct cec_msg *msg, in cec_transmit_msg() argument
998 ret = cec_transmit_msg_fh(adap, msg, NULL, block); in cec_transmit_msg()
1009 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg,
1104 struct cec_msg *msg, ktime_t ts) in cec_received_msg_ts() argument
1107 u8 msg_init = cec_msg_initiator(msg); in cec_received_msg_ts()
1108 u8 msg_dest = cec_msg_destination(msg); in cec_received_msg_ts()
1109 u8 cmd = msg->msg[1]; in cec_received_msg_ts()
1115 if (WARN_ON(!msg->len || msg->len > CEC_MAX_MSG_SIZE)) in cec_received_msg_ts()
1136 msg->rx_ts = ktime_to_ns(ts); in cec_received_msg_ts()
1137 msg->rx_status = CEC_RX_STATUS_OK; in cec_received_msg_ts()
1138 msg->sequence = msg->reply = msg->timeout = 0; in cec_received_msg_ts()
1139 msg->tx_status = 0; in cec_received_msg_ts()
1140 msg->tx_ts = 0; in cec_received_msg_ts()
1141 msg->tx_arb_lost_cnt = 0; in cec_received_msg_ts()
1142 msg->tx_nack_cnt = 0; in cec_received_msg_ts()
1143 msg->tx_low_drive_cnt = 0; in cec_received_msg_ts()
1144 msg->tx_error_cnt = 0; in cec_received_msg_ts()
1145 msg->flags = 0; in cec_received_msg_ts()
1146 memset(msg->msg + msg->len, 0, sizeof(msg->msg) - msg->len); in cec_received_msg_ts()
1149 dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg); in cec_received_msg_ts()
1155 if (!cec_msg_is_broadcast(msg)) { in cec_received_msg_ts()
1166 if (valid_la && msg->len > 1 && cec_msg_size[cmd]) { in cec_received_msg_ts()
1170 if (msg->len < min_len) in cec_received_msg_ts()
1172 else if (!cec_msg_is_broadcast(msg) && !(dir_fl & DIRECTED)) in cec_received_msg_ts()
1174 else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST)) in cec_received_msg_ts()
1176 else if (cec_msg_is_broadcast(msg) && in cec_received_msg_ts()
1185 switch (msg->msg[2]) { in cec_received_msg_ts()
1189 if (msg->len < 10) in cec_received_msg_ts()
1193 if (msg->len < 7) in cec_received_msg_ts()
1197 if (msg->len < 4) in cec_received_msg_ts()
1201 if (msg->len < 5) in cec_received_msg_ts()
1210 if (valid_la && msg->len > 1 && cmd != CEC_MSG_CDC_MESSAGE) { in cec_received_msg_ts()
1213 /* The aborted command is in msg[2] */ in cec_received_msg_ts()
1215 cmd = msg->msg[2]; in cec_received_msg_ts()
1222 struct cec_msg *dst = &data->msg; in cec_received_msg_ts()
1229 if (!abort && dst->msg[1] == CEC_MSG_INITIATE_ARC && in cec_received_msg_ts()
1239 if ((abort && cmd != dst->msg[1]) || in cec_received_msg_ts()
1240 (!abort && memcmp(data->match_reply, msg->msg + 1, data->match_len))) in cec_received_msg_ts()
1249 memcpy(dst->msg, msg->msg, msg->len); in cec_received_msg_ts()
1250 dst->len = msg->len; in cec_received_msg_ts()
1251 dst->rx_ts = msg->rx_ts; in cec_received_msg_ts()
1252 dst->rx_status = msg->rx_status; in cec_received_msg_ts()
1255 msg->flags = dst->flags; in cec_received_msg_ts()
1256 msg->sequence = dst->sequence; in cec_received_msg_ts()
1279 cec_queue_msg_monitor(adap, msg, monitor_valid_la); in cec_received_msg_ts()
1282 if (!valid_la || msg->len <= 1) in cec_received_msg_ts()
1293 cec_receive_notify(adap, msg, is_reply); in cec_received_msg_ts()
1309 struct cec_msg msg = { }; in cec_config_log_addr() local
1318 msg.len = 1; in cec_config_log_addr()
1319 msg.msg[0] = (log_addr << 4) | log_addr; in cec_config_log_addr()
1322 err = cec_transmit_msg_fh(adap, &msg, NULL, true); in cec_config_log_addr()
1342 if (msg.tx_status & in cec_config_log_addr()
1345 if (msg.tx_status & CEC_TX_STATUS_OK) in cec_config_log_addr()
1347 if (msg.tx_status & CEC_TX_STATUS_NACK) in cec_config_log_addr()
1364 log_addr, msg.tx_status); in cec_config_log_addr()
1554 struct cec_msg msg = {}; in cec_config_thread_func() local
1560 msg.msg[0] = (las->log_addr[i] << 4) | 0x0f; in cec_config_thread_func()
1565 cec_fill_msg_report_features(adap, &msg, i); in cec_config_thread_func()
1566 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1570 cec_msg_report_physical_addr(&msg, adap->phys_addr, in cec_config_thread_func()
1575 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1579 cec_msg_device_vendor_id(&msg, in cec_config_thread_func()
1581 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1962 struct cec_msg *msg, in cec_fill_msg_report_features() argument
1971 msg->msg[0] = (las->log_addr[la_idx] << 4) | 0x0f; in cec_fill_msg_report_features()
1972 msg->len = 4; in cec_fill_msg_report_features()
1973 msg->msg[1] = CEC_MSG_REPORT_FEATURES; in cec_fill_msg_report_features()
1974 msg->msg[2] = adap->log_addrs.cec_version; in cec_fill_msg_report_features()
1975 msg->msg[3] = las->all_device_types[la_idx]; in cec_fill_msg_report_features()
1979 msg->msg[msg->len++] = features[idx]; in cec_fill_msg_report_features()
1990 struct cec_msg *msg, u8 reason) in cec_feature_abort_reason() argument
1998 if (msg->msg[1] == CEC_MSG_FEATURE_ABORT) in cec_feature_abort_reason()
2001 if (cec_msg_initiator(msg) == CEC_LOG_ADDR_UNREGISTERED) in cec_feature_abort_reason()
2003 cec_msg_set_reply_to(&tx_msg, msg); in cec_feature_abort_reason()
2004 cec_msg_feature_abort(&tx_msg, msg->msg[1], reason); in cec_feature_abort_reason()
2008 static int cec_feature_abort(struct cec_adapter *adap, struct cec_msg *msg) in cec_feature_abort() argument
2010 return cec_feature_abort_reason(adap, msg, in cec_feature_abort()
2014 static int cec_feature_refused(struct cec_adapter *adap, struct cec_msg *msg) in cec_feature_refused() argument
2016 return cec_feature_abort_reason(adap, msg, in cec_feature_refused()
2027 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, in cec_receive_notify() argument
2030 bool is_broadcast = cec_msg_is_broadcast(msg); in cec_receive_notify()
2031 u8 dest_laddr = cec_msg_destination(msg); in cec_receive_notify()
2032 u8 init_laddr = cec_msg_initiator(msg); in cec_receive_notify()
2038 dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg); in cec_receive_notify()
2042 msg->msg[1] != CEC_MSG_CDC_MESSAGE) in cec_receive_notify()
2047 adap->ops->received(adap, msg) != -ENOMSG) in cec_receive_notify()
2056 switch (msg->msg[1]) { in cec_receive_notify()
2104 cec_msg_set_reply_to(&tx_cec_msg, msg); in cec_receive_notify()
2106 switch (msg->msg[1]) { in cec_receive_notify()
2109 u16 pa = (msg->msg[2] << 8) | msg->msg[3]; in cec_receive_notify()
2122 switch (msg->msg[2]) { in cec_receive_notify()
2128 if (msg->len == 2) in cec_receive_notify()
2130 msg->msg[2], 0); in cec_receive_notify()
2133 msg->msg[2] << 8 | msg->msg[3], 0); in cec_receive_notify()
2152 rc_keydown(adap->rc, RC_PROTO_CEC, msg->msg[2], 0); in cec_receive_notify()
2184 return cec_feature_abort(adap, msg); in cec_receive_notify()
2192 return cec_feature_refused(adap, msg); in cec_receive_notify()
2196 return cec_feature_abort(adap, msg); in cec_receive_notify()
2203 return cec_feature_abort(adap, msg); in cec_receive_notify()
2213 !adap->cec_follower && msg->msg[1] != CEC_MSG_FEATURE_ABORT) in cec_receive_notify()
2214 return cec_feature_abort(adap, msg); in cec_receive_notify()
2220 if (is_reply && !(msg->flags & CEC_MSG_FL_REPLY_TO_FOLLOWERS)) in cec_receive_notify()
2228 cec_queue_msg_fh(adap->cec_follower, msg); in cec_receive_notify()
2230 cec_queue_msg_followers(adap, msg); in cec_receive_notify()
2342 data->msg.len, data->msg.msg, in cec_adap_status()
2344 data->msg.timeout); in cec_adap_status()
2348 data->msg.len, data->msg.msg, in cec_adap_status()
2350 data->msg.timeout); in cec_adap_status()
2354 data->msg.len, data->msg.msg, in cec_adap_status()
2356 data->msg.timeout); in cec_adap_status()