Lines Matching refs:msg

28 					 struct cec_msg *msg,
209 static void cec_queue_msg_fh(struct cec_fh *fh, const struct cec_msg *msg) in cec_queue_msg_fh() argument
223 entry->msg = *msg; in cec_queue_msg_fh()
263 const struct cec_msg *msg, in cec_queue_msg_monitor() argument
273 cec_queue_msg_fh(fh, msg); in cec_queue_msg_monitor()
282 const struct cec_msg *msg) in cec_queue_msg_followers() argument
289 cec_queue_msg_fh(fh, msg); in cec_queue_msg_followers()
341 cec_queue_msg_fh(data->fh, &data->msg); in cec_data_completed()
365 if (!(data->msg.tx_status & CEC_TX_STATUS_OK)) in cec_data_cancel()
370 if (data->msg.tx_status & CEC_TX_STATUS_OK) { in cec_data_cancel()
371 data->msg.rx_ts = ktime_get_ns(); in cec_data_cancel()
372 data->msg.rx_status = rx_status; in cec_data_cancel()
374 data->msg.tx_status = 0; in cec_data_cancel()
376 data->msg.tx_ts = ktime_get_ns(); in cec_data_cancel()
377 data->msg.tx_status |= tx_status | in cec_data_cancel()
379 data->msg.tx_error_cnt++; in cec_data_cancel()
382 data->msg.rx_status = 0; in cec_data_cancel()
386 cec_queue_msg_monitor(adap, &data->msg, 1); in cec_data_cancel()
388 if (!data->blocking && data->msg.sequence) in cec_data_cancel()
390 call_void_op(adap, adap_nb_transmit_canceled, &data->msg); in cec_data_cancel()
515 adap->transmitting->msg.len, in cec_thread_func()
516 adap->transmitting->msg.msg); in cec_thread_func()
551 if (data->msg.len == 1 && adap->is_configured) in cec_thread_func()
561 cec_msg_initiator(&data->msg)) { in cec_thread_func()
564 adap->last_initiator = cec_msg_initiator(&data->msg); in cec_thread_func()
578 signal_free_time, &data->msg)) in cec_thread_func()
600 struct cec_msg *msg; in cec_transmit_done_ts() local
627 msg = &data->msg; in cec_transmit_done_ts()
631 msg->tx_ts = ktime_to_ns(ts); in cec_transmit_done_ts()
632 msg->tx_status |= status; in cec_transmit_done_ts()
633 msg->tx_arb_lost_cnt += arb_lost_cnt; in cec_transmit_done_ts()
634 msg->tx_nack_cnt += nack_cnt; in cec_transmit_done_ts()
635 msg->tx_low_drive_cnt += low_drive_cnt; in cec_transmit_done_ts()
636 msg->tx_error_cnt += error_cnt; in cec_transmit_done_ts()
652 if (done && adap->tx_low_drive_log_cnt < 8 && msg->tx_low_drive_cnt) { in cec_transmit_done_ts()
655 msg->tx_low_drive_cnt, msg->sequence, in cec_transmit_done_ts()
656 msg->len, msg->msg); in cec_transmit_done_ts()
658 if (done && adap->tx_error_log_cnt < 8 && msg->tx_error_cnt) { in cec_transmit_done_ts()
661 msg->tx_error_cnt, msg->sequence, in cec_transmit_done_ts()
662 msg->len, msg->msg); in cec_transmit_done_ts()
676 if (msg->timeout) in cec_transmit_done_ts()
678 msg->len, msg->msg, data->attempts, in cec_transmit_done_ts()
682 msg->len, msg->msg, data->attempts); in cec_transmit_done_ts()
695 msg->tx_status |= CEC_TX_STATUS_MAX_RETRIES; in cec_transmit_done_ts()
698 cec_queue_msg_monitor(adap, msg, 1); in cec_transmit_done_ts()
701 msg->timeout) { in cec_transmit_done_ts()
708 msecs_to_jiffies(msg->timeout)); in cec_transmit_done_ts()
780 int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, in cec_transmit_msg_fh() argument
784 bool is_raw = msg_is_raw(msg); in cec_transmit_msg_fh()
785 bool reply_vendor_id = (msg->flags & CEC_MSG_FL_REPLY_VENDOR_ID) && in cec_transmit_msg_fh()
786 msg->len > 1 && msg->msg[1] == CEC_MSG_VENDOR_COMMAND_WITH_ID; in cec_transmit_msg_fh()
792 msg->rx_ts = 0; in cec_transmit_msg_fh()
793 msg->tx_ts = 0; in cec_transmit_msg_fh()
794 msg->rx_status = 0; in cec_transmit_msg_fh()
795 msg->tx_status = 0; in cec_transmit_msg_fh()
796 msg->tx_arb_lost_cnt = 0; in cec_transmit_msg_fh()
797 msg->tx_nack_cnt = 0; in cec_transmit_msg_fh()
798 msg->tx_low_drive_cnt = 0; in cec_transmit_msg_fh()
799 msg->tx_error_cnt = 0; in cec_transmit_msg_fh()
800 msg->sequence = 0; in cec_transmit_msg_fh()
801 msg->flags &= CEC_MSG_FL_REPLY_TO_FOLLOWERS | CEC_MSG_FL_RAW | in cec_transmit_msg_fh()
804 if ((reply_vendor_id || msg->reply) && msg->timeout == 0) { in cec_transmit_msg_fh()
806 msg->timeout = 1000; in cec_transmit_msg_fh()
809 if (!msg->timeout) in cec_transmit_msg_fh()
810 msg->flags &= ~CEC_MSG_FL_REPLY_TO_FOLLOWERS; in cec_transmit_msg_fh()
813 if (msg->len == 0 || msg->len > CEC_MAX_MSG_SIZE) { in cec_transmit_msg_fh()
814 dprintk(1, "%s: invalid length %d\n", __func__, msg->len); in cec_transmit_msg_fh()
817 if (reply_vendor_id && msg->len < 6) { in cec_transmit_msg_fh()
823 memset(msg->msg + msg->len, 0, sizeof(msg->msg) - msg->len); in cec_transmit_msg_fh()
825 if (msg->timeout) in cec_transmit_msg_fh()
827 __func__, msg->len, msg->msg, msg->reply, in cec_transmit_msg_fh()
831 __func__, msg->len, msg->msg, !block ? " (nb)" : ""); in cec_transmit_msg_fh()
833 if (msg->timeout && msg->len == 1) { in cec_transmit_msg_fh()
844 (msg->len == 1 || msg->msg[1] != CEC_MSG_CDC_MESSAGE)) { in cec_transmit_msg_fh()
849 if (msg->len >= 4 && msg->msg[1] == CEC_MSG_CDC_MESSAGE) { in cec_transmit_msg_fh()
850 msg->msg[2] = adap->phys_addr >> 8; in cec_transmit_msg_fh()
851 msg->msg[3] = adap->phys_addr & 0xff; in cec_transmit_msg_fh()
854 if (msg->len == 1) { in cec_transmit_msg_fh()
855 if (cec_msg_destination(msg) == 0xf) { in cec_transmit_msg_fh()
860 if (cec_has_log_addr(adap, cec_msg_destination(msg))) { in cec_transmit_msg_fh()
869 msg->tx_ts = ktime_get_ns(); in cec_transmit_msg_fh()
870 msg->tx_status = CEC_TX_STATUS_NACK | in cec_transmit_msg_fh()
872 msg->tx_nack_cnt = 1; in cec_transmit_msg_fh()
873 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
874 if (!msg->sequence) in cec_transmit_msg_fh()
875 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
879 if (msg->len > 1 && !cec_msg_is_broadcast(msg) && in cec_transmit_msg_fh()
880 cec_has_log_addr(adap, cec_msg_destination(msg))) { in cec_transmit_msg_fh()
885 if (msg->len > 1 && adap->is_configured && in cec_transmit_msg_fh()
886 !cec_has_log_addr(adap, cec_msg_initiator(msg))) { in cec_transmit_msg_fh()
888 __func__, cec_msg_initiator(msg)); in cec_transmit_msg_fh()
898 (msg->len > 2 || in cec_transmit_msg_fh()
899 cec_msg_destination(msg) != CEC_LOG_ADDR_TV || in cec_transmit_msg_fh()
900 (msg->len == 2 && msg->msg[1] != CEC_MSG_IMAGE_VIEW_ON && in cec_transmit_msg_fh()
901 msg->msg[1] != CEC_MSG_TEXT_VIEW_ON))) { in cec_transmit_msg_fh()
913 if (reply_vendor_id || msg->reply) { in cec_transmit_msg_fh()
929 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
930 if (!msg->sequence) in cec_transmit_msg_fh()
931 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
933 data->msg = *msg; in cec_transmit_msg_fh()
938 memcpy(data->match_reply, msg->msg + 1, 4); in cec_transmit_msg_fh()
939 data->match_reply[4] = msg->reply; in cec_transmit_msg_fh()
941 } else if (msg->timeout) { in cec_transmit_msg_fh()
942 data->match_reply[0] = msg->reply; in cec_transmit_msg_fh()
976 if (data->msg.tx_status & CEC_TX_STATUS_OK) in cec_transmit_msg_fh()
983 *msg = data->msg; in cec_transmit_msg_fh()
993 int cec_transmit_msg(struct cec_adapter *adap, struct cec_msg *msg, in cec_transmit_msg() argument
999 ret = cec_transmit_msg_fh(adap, msg, NULL, block); in cec_transmit_msg()
1010 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg,
1105 struct cec_msg *msg, ktime_t ts) in cec_received_msg_ts() argument
1108 u8 msg_init = cec_msg_initiator(msg); in cec_received_msg_ts()
1109 u8 msg_dest = cec_msg_destination(msg); in cec_received_msg_ts()
1110 u8 cmd = msg->msg[1]; in cec_received_msg_ts()
1116 if (WARN_ON(!msg->len || msg->len > CEC_MAX_MSG_SIZE)) in cec_received_msg_ts()
1137 msg->rx_ts = ktime_to_ns(ts); in cec_received_msg_ts()
1138 msg->rx_status = CEC_RX_STATUS_OK; in cec_received_msg_ts()
1139 msg->sequence = msg->reply = msg->timeout = 0; in cec_received_msg_ts()
1140 msg->tx_status = 0; in cec_received_msg_ts()
1141 msg->tx_ts = 0; in cec_received_msg_ts()
1142 msg->tx_arb_lost_cnt = 0; in cec_received_msg_ts()
1143 msg->tx_nack_cnt = 0; in cec_received_msg_ts()
1144 msg->tx_low_drive_cnt = 0; in cec_received_msg_ts()
1145 msg->tx_error_cnt = 0; in cec_received_msg_ts()
1146 msg->flags = 0; in cec_received_msg_ts()
1147 memset(msg->msg + msg->len, 0, sizeof(msg->msg) - msg->len); in cec_received_msg_ts()
1150 dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg); in cec_received_msg_ts()
1156 if (!cec_msg_is_broadcast(msg)) { in cec_received_msg_ts()
1167 if (valid_la && msg->len > 1 && cec_msg_size[cmd]) { in cec_received_msg_ts()
1171 if (msg->len < min_len) in cec_received_msg_ts()
1173 else if (!cec_msg_is_broadcast(msg) && !(dir_fl & DIRECTED)) in cec_received_msg_ts()
1175 else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST)) in cec_received_msg_ts()
1177 else if (cec_msg_is_broadcast(msg) && in cec_received_msg_ts()
1186 switch (msg->msg[2]) { in cec_received_msg_ts()
1190 if (msg->len < 10) in cec_received_msg_ts()
1194 if (msg->len < 7) in cec_received_msg_ts()
1198 if (msg->len < 4) in cec_received_msg_ts()
1202 if (msg->len < 5) in cec_received_msg_ts()
1211 if (valid_la && msg->len > 1 && cmd != CEC_MSG_CDC_MESSAGE) { in cec_received_msg_ts()
1216 cmd = msg->msg[2]; in cec_received_msg_ts()
1223 struct cec_msg *dst = &data->msg; in cec_received_msg_ts()
1230 if (!abort && dst->msg[1] == CEC_MSG_INITIATE_ARC && in cec_received_msg_ts()
1240 if ((abort && cmd != dst->msg[1]) || in cec_received_msg_ts()
1241 (!abort && memcmp(data->match_reply, msg->msg + 1, data->match_len))) in cec_received_msg_ts()
1250 memcpy(dst->msg, msg->msg, msg->len); in cec_received_msg_ts()
1251 dst->len = msg->len; in cec_received_msg_ts()
1252 dst->rx_ts = msg->rx_ts; in cec_received_msg_ts()
1253 dst->rx_status = msg->rx_status; in cec_received_msg_ts()
1256 msg->flags = dst->flags; in cec_received_msg_ts()
1257 msg->sequence = dst->sequence; in cec_received_msg_ts()
1280 cec_queue_msg_monitor(adap, msg, monitor_valid_la); in cec_received_msg_ts()
1283 if (!valid_la || msg->len <= 1) in cec_received_msg_ts()
1294 cec_receive_notify(adap, msg, is_reply); in cec_received_msg_ts()
1310 struct cec_msg msg = { }; in cec_config_log_addr() local
1319 msg.len = 1; in cec_config_log_addr()
1320 msg.msg[0] = (log_addr << 4) | log_addr; in cec_config_log_addr()
1323 err = cec_transmit_msg_fh(adap, &msg, NULL, true); in cec_config_log_addr()
1343 if (msg.tx_status & in cec_config_log_addr()
1346 if (msg.tx_status & CEC_TX_STATUS_OK) in cec_config_log_addr()
1348 if (msg.tx_status & CEC_TX_STATUS_NACK) in cec_config_log_addr()
1365 log_addr, msg.tx_status); in cec_config_log_addr()
1555 struct cec_msg msg = {}; in cec_config_thread_func() local
1561 msg.msg[0] = (las->log_addr[i] << 4) | 0x0f; in cec_config_thread_func()
1566 cec_fill_msg_report_features(adap, &msg, i); in cec_config_thread_func()
1567 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1571 cec_msg_report_physical_addr(&msg, adap->phys_addr, in cec_config_thread_func()
1576 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1580 cec_msg_device_vendor_id(&msg, in cec_config_thread_func()
1582 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1963 struct cec_msg *msg, in cec_fill_msg_report_features() argument
1972 msg->msg[0] = (las->log_addr[la_idx] << 4) | 0x0f; in cec_fill_msg_report_features()
1973 msg->len = 4; in cec_fill_msg_report_features()
1974 msg->msg[1] = CEC_MSG_REPORT_FEATURES; in cec_fill_msg_report_features()
1975 msg->msg[2] = adap->log_addrs.cec_version; in cec_fill_msg_report_features()
1976 msg->msg[3] = las->all_device_types[la_idx]; in cec_fill_msg_report_features()
1980 msg->msg[msg->len++] = features[idx]; in cec_fill_msg_report_features()
1991 struct cec_msg *msg, u8 reason) in cec_feature_abort_reason() argument
1999 if (msg->msg[1] == CEC_MSG_FEATURE_ABORT) in cec_feature_abort_reason()
2002 if (cec_msg_initiator(msg) == CEC_LOG_ADDR_UNREGISTERED) in cec_feature_abort_reason()
2004 cec_msg_set_reply_to(&tx_msg, msg); in cec_feature_abort_reason()
2005 cec_msg_feature_abort(&tx_msg, msg->msg[1], reason); in cec_feature_abort_reason()
2009 static int cec_feature_abort(struct cec_adapter *adap, struct cec_msg *msg) in cec_feature_abort() argument
2011 return cec_feature_abort_reason(adap, msg, in cec_feature_abort()
2015 static int cec_feature_refused(struct cec_adapter *adap, struct cec_msg *msg) in cec_feature_refused() argument
2017 return cec_feature_abort_reason(adap, msg, in cec_feature_refused()
2028 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, in cec_receive_notify() argument
2031 bool is_broadcast = cec_msg_is_broadcast(msg); in cec_receive_notify()
2032 u8 dest_laddr = cec_msg_destination(msg); in cec_receive_notify()
2033 u8 init_laddr = cec_msg_initiator(msg); in cec_receive_notify()
2039 dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg); in cec_receive_notify()
2043 msg->msg[1] != CEC_MSG_CDC_MESSAGE) in cec_receive_notify()
2048 adap->ops->received(adap, msg) != -ENOMSG) in cec_receive_notify()
2057 switch (msg->msg[1]) { in cec_receive_notify()
2105 cec_msg_set_reply_to(&tx_cec_msg, msg); in cec_receive_notify()
2107 switch (msg->msg[1]) { in cec_receive_notify()
2110 u16 pa = (msg->msg[2] << 8) | msg->msg[3]; in cec_receive_notify()
2123 switch (msg->msg[2]) { in cec_receive_notify()
2129 if (msg->len == 2) in cec_receive_notify()
2131 msg->msg[2], 0); in cec_receive_notify()
2134 msg->msg[2] << 8 | msg->msg[3], 0); in cec_receive_notify()
2153 rc_keydown(adap->rc, RC_PROTO_CEC, msg->msg[2], 0); in cec_receive_notify()
2185 return cec_feature_abort(adap, msg); in cec_receive_notify()
2193 return cec_feature_refused(adap, msg); in cec_receive_notify()
2197 return cec_feature_abort(adap, msg); in cec_receive_notify()
2204 return cec_feature_abort(adap, msg); in cec_receive_notify()
2214 !adap->cec_follower && msg->msg[1] != CEC_MSG_FEATURE_ABORT) in cec_receive_notify()
2215 return cec_feature_abort(adap, msg); in cec_receive_notify()
2221 if (is_reply && !(msg->flags & CEC_MSG_FL_REPLY_TO_FOLLOWERS)) in cec_receive_notify()
2229 cec_queue_msg_fh(adap->cec_follower, msg); in cec_receive_notify()
2231 cec_queue_msg_followers(adap, msg); in cec_receive_notify()
2343 data->msg.len, data->msg.msg, in cec_adap_status()
2345 data->msg.timeout); in cec_adap_status()
2349 data->msg.len, data->msg.msg, in cec_adap_status()
2351 data->msg.timeout); in cec_adap_status()
2355 data->msg.len, data->msg.msg, in cec_adap_status()
2357 data->msg.timeout); in cec_adap_status()