Lines Matching refs:msg

27 					 struct cec_msg *msg,
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()
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_op(adap, received, &data->msg); in cec_data_cancel()
505 adap->transmitting->msg.len, in cec_thread_func()
506 adap->transmitting->msg.msg); in cec_thread_func()
541 if (data->msg.len == 1 && adap->is_configured) in cec_thread_func()
551 cec_msg_initiator(&data->msg)) { in cec_thread_func()
554 adap->last_initiator = cec_msg_initiator(&data->msg); in cec_thread_func()
568 signal_free_time, &data->msg)) in cec_thread_func()
590 struct cec_msg *msg; in cec_transmit_done_ts() local
617 msg = &data->msg; in cec_transmit_done_ts()
621 msg->tx_ts = ktime_to_ns(ts); in cec_transmit_done_ts()
622 msg->tx_status |= status; in cec_transmit_done_ts()
623 msg->tx_arb_lost_cnt += arb_lost_cnt; in cec_transmit_done_ts()
624 msg->tx_nack_cnt += nack_cnt; in cec_transmit_done_ts()
625 msg->tx_low_drive_cnt += low_drive_cnt; in cec_transmit_done_ts()
626 msg->tx_error_cnt += error_cnt; in cec_transmit_done_ts()
639 if (msg->timeout) in cec_transmit_done_ts()
641 msg->len, msg->msg, data->attempts, msg->reply); in cec_transmit_done_ts()
644 msg->len, msg->msg, data->attempts); in cec_transmit_done_ts()
657 msg->tx_status |= CEC_TX_STATUS_MAX_RETRIES; in cec_transmit_done_ts()
660 cec_queue_msg_monitor(adap, msg, 1); in cec_transmit_done_ts()
663 msg->timeout) { in cec_transmit_done_ts()
670 msecs_to_jiffies(msg->timeout)); in cec_transmit_done_ts()
742 int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, in cec_transmit_msg_fh() argument
746 bool is_raw = msg_is_raw(msg); in cec_transmit_msg_fh()
751 msg->rx_ts = 0; in cec_transmit_msg_fh()
752 msg->tx_ts = 0; in cec_transmit_msg_fh()
753 msg->rx_status = 0; in cec_transmit_msg_fh()
754 msg->tx_status = 0; in cec_transmit_msg_fh()
755 msg->tx_arb_lost_cnt = 0; in cec_transmit_msg_fh()
756 msg->tx_nack_cnt = 0; in cec_transmit_msg_fh()
757 msg->tx_low_drive_cnt = 0; in cec_transmit_msg_fh()
758 msg->tx_error_cnt = 0; in cec_transmit_msg_fh()
759 msg->sequence = 0; in cec_transmit_msg_fh()
761 if (msg->reply && msg->timeout == 0) { in cec_transmit_msg_fh()
763 msg->timeout = 1000; in cec_transmit_msg_fh()
765 msg->flags &= CEC_MSG_FL_REPLY_TO_FOLLOWERS | CEC_MSG_FL_RAW; in cec_transmit_msg_fh()
767 if (!msg->timeout) in cec_transmit_msg_fh()
768 msg->flags &= ~CEC_MSG_FL_REPLY_TO_FOLLOWERS; in cec_transmit_msg_fh()
771 if (msg->len == 0 || msg->len > CEC_MAX_MSG_SIZE) { in cec_transmit_msg_fh()
772 dprintk(1, "%s: invalid length %d\n", __func__, msg->len); in cec_transmit_msg_fh()
776 memset(msg->msg + msg->len, 0, sizeof(msg->msg) - msg->len); in cec_transmit_msg_fh()
778 if (msg->timeout) in cec_transmit_msg_fh()
780 __func__, msg->len, msg->msg, msg->reply, in cec_transmit_msg_fh()
784 __func__, msg->len, msg->msg, !block ? " (nb)" : ""); in cec_transmit_msg_fh()
786 if (msg->timeout && msg->len == 1) { in cec_transmit_msg_fh()
797 (msg->len == 1 || msg->msg[1] != CEC_MSG_CDC_MESSAGE)) { in cec_transmit_msg_fh()
802 if (msg->len >= 4 && msg->msg[1] == CEC_MSG_CDC_MESSAGE) { in cec_transmit_msg_fh()
803 msg->msg[2] = adap->phys_addr >> 8; in cec_transmit_msg_fh()
804 msg->msg[3] = adap->phys_addr & 0xff; in cec_transmit_msg_fh()
807 if (msg->len == 1) { in cec_transmit_msg_fh()
808 if (cec_msg_destination(msg) == 0xf) { in cec_transmit_msg_fh()
813 if (cec_has_log_addr(adap, cec_msg_destination(msg))) { in cec_transmit_msg_fh()
822 msg->tx_ts = ktime_get_ns(); in cec_transmit_msg_fh()
823 msg->tx_status = CEC_TX_STATUS_NACK | in cec_transmit_msg_fh()
825 msg->tx_nack_cnt = 1; in cec_transmit_msg_fh()
826 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
827 if (!msg->sequence) in cec_transmit_msg_fh()
828 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
832 if (msg->len > 1 && !cec_msg_is_broadcast(msg) && in cec_transmit_msg_fh()
833 cec_has_log_addr(adap, cec_msg_destination(msg))) { in cec_transmit_msg_fh()
838 if (msg->len > 1 && adap->is_configured && in cec_transmit_msg_fh()
839 !cec_has_log_addr(adap, cec_msg_initiator(msg))) { in cec_transmit_msg_fh()
841 __func__, cec_msg_initiator(msg)); in cec_transmit_msg_fh()
851 (msg->len > 2 || in cec_transmit_msg_fh()
852 cec_msg_destination(msg) != CEC_LOG_ADDR_TV || in cec_transmit_msg_fh()
853 (msg->len == 2 && msg->msg[1] != CEC_MSG_IMAGE_VIEW_ON && in cec_transmit_msg_fh()
854 msg->msg[1] != CEC_MSG_TEXT_VIEW_ON))) { in cec_transmit_msg_fh()
866 if (msg->reply) { in cec_transmit_msg_fh()
881 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
882 if (!msg->sequence) in cec_transmit_msg_fh()
883 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
885 data->msg = *msg; in cec_transmit_msg_fh()
918 if (data->msg.tx_status & CEC_TX_STATUS_OK) in cec_transmit_msg_fh()
925 *msg = data->msg; in cec_transmit_msg_fh()
935 int cec_transmit_msg(struct cec_adapter *adap, struct cec_msg *msg, in cec_transmit_msg() argument
941 ret = cec_transmit_msg_fh(adap, msg, NULL, block); in cec_transmit_msg()
952 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg,
1046 struct cec_msg *msg, ktime_t ts) in cec_received_msg_ts() argument
1049 u8 msg_init = cec_msg_initiator(msg); in cec_received_msg_ts()
1050 u8 msg_dest = cec_msg_destination(msg); in cec_received_msg_ts()
1051 u8 cmd = msg->msg[1]; in cec_received_msg_ts()
1056 if (WARN_ON(!msg->len || msg->len > CEC_MAX_MSG_SIZE)) in cec_received_msg_ts()
1077 msg->rx_ts = ktime_to_ns(ts); in cec_received_msg_ts()
1078 msg->rx_status = CEC_RX_STATUS_OK; in cec_received_msg_ts()
1079 msg->sequence = msg->reply = msg->timeout = 0; in cec_received_msg_ts()
1080 msg->tx_status = 0; in cec_received_msg_ts()
1081 msg->tx_ts = 0; in cec_received_msg_ts()
1082 msg->tx_arb_lost_cnt = 0; in cec_received_msg_ts()
1083 msg->tx_nack_cnt = 0; in cec_received_msg_ts()
1084 msg->tx_low_drive_cnt = 0; in cec_received_msg_ts()
1085 msg->tx_error_cnt = 0; in cec_received_msg_ts()
1086 msg->flags = 0; in cec_received_msg_ts()
1087 memset(msg->msg + msg->len, 0, sizeof(msg->msg) - msg->len); in cec_received_msg_ts()
1090 dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg); in cec_received_msg_ts()
1095 if (!cec_msg_is_broadcast(msg)) in cec_received_msg_ts()
1104 if (valid_la && msg->len > 1 && cec_msg_size[cmd]) { in cec_received_msg_ts()
1108 if (msg->len < min_len) in cec_received_msg_ts()
1110 else if (!cec_msg_is_broadcast(msg) && !(dir_fl & DIRECTED)) in cec_received_msg_ts()
1112 else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST)) in cec_received_msg_ts()
1114 else if (cec_msg_is_broadcast(msg) && in cec_received_msg_ts()
1123 if (msg->msg[2] & 0x10) { in cec_received_msg_ts()
1124 switch (msg->msg[2] & 0xf) { in cec_received_msg_ts()
1127 if (msg->len < 5) in cec_received_msg_ts()
1131 } else if ((msg->msg[2] & 0xf) == CEC_OP_PROG_ERROR_DUPLICATE) { in cec_received_msg_ts()
1132 if (msg->len < 5) in cec_received_msg_ts()
1137 switch (msg->msg[2]) { in cec_received_msg_ts()
1141 if (msg->len < 10) in cec_received_msg_ts()
1145 if (msg->len < 7) in cec_received_msg_ts()
1149 if (msg->len < 4) in cec_received_msg_ts()
1153 if (msg->len < 5) in cec_received_msg_ts()
1162 if (valid_la && msg->len > 1 && cmd != CEC_MSG_CDC_MESSAGE) { in cec_received_msg_ts()
1167 cmd = msg->msg[2]; in cec_received_msg_ts()
1174 struct cec_msg *dst = &data->msg; in cec_received_msg_ts()
1181 if (!abort && dst->msg[1] == CEC_MSG_INITIATE_ARC && in cec_received_msg_ts()
1189 if ((abort && cmd != dst->msg[1]) || in cec_received_msg_ts()
1199 memcpy(dst->msg, msg->msg, msg->len); in cec_received_msg_ts()
1200 dst->len = msg->len; in cec_received_msg_ts()
1201 dst->rx_ts = msg->rx_ts; in cec_received_msg_ts()
1202 dst->rx_status = msg->rx_status; in cec_received_msg_ts()
1205 msg->flags = dst->flags; in cec_received_msg_ts()
1206 msg->sequence = dst->sequence; in cec_received_msg_ts()
1229 cec_queue_msg_monitor(adap, msg, valid_la); in cec_received_msg_ts()
1232 if (!valid_la || msg->len <= 1) in cec_received_msg_ts()
1243 cec_receive_notify(adap, msg, is_reply); in cec_received_msg_ts()
1259 struct cec_msg msg = { }; in cec_config_log_addr() local
1268 msg.len = 1; in cec_config_log_addr()
1269 msg.msg[0] = (log_addr << 4) | log_addr; in cec_config_log_addr()
1272 err = cec_transmit_msg_fh(adap, &msg, NULL, true); in cec_config_log_addr()
1292 if (msg.tx_status & in cec_config_log_addr()
1295 if (msg.tx_status & CEC_TX_STATUS_OK) in cec_config_log_addr()
1297 if (msg.tx_status & CEC_TX_STATUS_NACK) in cec_config_log_addr()
1501 struct cec_msg msg = {}; in cec_config_thread_func() local
1507 msg.msg[0] = (las->log_addr[i] << 4) | 0x0f; in cec_config_thread_func()
1512 cec_fill_msg_report_features(adap, &msg, i); in cec_config_thread_func()
1513 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1517 cec_msg_report_physical_addr(&msg, adap->phys_addr, in cec_config_thread_func()
1522 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1526 cec_msg_device_vendor_id(&msg, in cec_config_thread_func()
1528 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1895 struct cec_msg *msg, in cec_fill_msg_report_features() argument
1904 msg->msg[0] = (las->log_addr[la_idx] << 4) | 0x0f; in cec_fill_msg_report_features()
1905 msg->len = 4; in cec_fill_msg_report_features()
1906 msg->msg[1] = CEC_MSG_REPORT_FEATURES; in cec_fill_msg_report_features()
1907 msg->msg[2] = adap->log_addrs.cec_version; in cec_fill_msg_report_features()
1908 msg->msg[3] = las->all_device_types[la_idx]; in cec_fill_msg_report_features()
1912 msg->msg[msg->len++] = features[idx]; in cec_fill_msg_report_features()
1923 struct cec_msg *msg, u8 reason) in cec_feature_abort_reason() argument
1931 if (msg->msg[1] == CEC_MSG_FEATURE_ABORT) in cec_feature_abort_reason()
1934 if (cec_msg_initiator(msg) == CEC_LOG_ADDR_UNREGISTERED) in cec_feature_abort_reason()
1936 cec_msg_set_reply_to(&tx_msg, msg); in cec_feature_abort_reason()
1937 cec_msg_feature_abort(&tx_msg, msg->msg[1], reason); in cec_feature_abort_reason()
1941 static int cec_feature_abort(struct cec_adapter *adap, struct cec_msg *msg) in cec_feature_abort() argument
1943 return cec_feature_abort_reason(adap, msg, in cec_feature_abort()
1947 static int cec_feature_refused(struct cec_adapter *adap, struct cec_msg *msg) in cec_feature_refused() argument
1949 return cec_feature_abort_reason(adap, msg, in cec_feature_refused()
1960 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, in cec_receive_notify() argument
1963 bool is_broadcast = cec_msg_is_broadcast(msg); in cec_receive_notify()
1964 u8 dest_laddr = cec_msg_destination(msg); in cec_receive_notify()
1965 u8 init_laddr = cec_msg_initiator(msg); in cec_receive_notify()
1971 dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg); in cec_receive_notify()
1975 msg->msg[1] != CEC_MSG_CDC_MESSAGE) in cec_receive_notify()
1980 adap->ops->received(adap, msg) != -ENOMSG) in cec_receive_notify()
1989 switch (msg->msg[1]) { in cec_receive_notify()
2037 cec_msg_set_reply_to(&tx_cec_msg, msg); in cec_receive_notify()
2039 switch (msg->msg[1]) { in cec_receive_notify()
2042 u16 pa = (msg->msg[2] << 8) | msg->msg[3]; in cec_receive_notify()
2055 switch (msg->msg[2]) { in cec_receive_notify()
2061 if (msg->len == 2) in cec_receive_notify()
2063 msg->msg[2], 0); in cec_receive_notify()
2066 msg->msg[2] << 8 | msg->msg[3], 0); in cec_receive_notify()
2085 rc_keydown(adap->rc, RC_PROTO_CEC, msg->msg[2], 0); in cec_receive_notify()
2117 return cec_feature_abort(adap, msg); in cec_receive_notify()
2125 return cec_feature_refused(adap, msg); in cec_receive_notify()
2129 return cec_feature_abort(adap, msg); in cec_receive_notify()
2136 return cec_feature_abort(adap, msg); in cec_receive_notify()
2146 !adap->cec_follower && msg->msg[1] != CEC_MSG_FEATURE_ABORT) in cec_receive_notify()
2147 return cec_feature_abort(adap, msg); in cec_receive_notify()
2153 if (is_reply && !(msg->flags & CEC_MSG_FL_REPLY_TO_FOLLOWERS)) in cec_receive_notify()
2161 cec_queue_msg_fh(adap->cec_follower, msg); in cec_receive_notify()
2163 cec_queue_msg_followers(adap, msg); in cec_receive_notify()
2260 data->msg.len, data->msg.msg, data->msg.reply, in cec_adap_status()
2261 data->msg.timeout); in cec_adap_status()
2265 data->msg.len, data->msg.msg, data->msg.reply, in cec_adap_status()
2266 data->msg.timeout); in cec_adap_status()
2270 data->msg.len, data->msg.msg, data->msg.reply, in cec_adap_status()
2271 data->msg.timeout); in cec_adap_status()