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,
1047 struct cec_msg *msg, ktime_t ts) in cec_received_msg_ts() argument
1050 u8 msg_init = cec_msg_initiator(msg); in cec_received_msg_ts()
1051 u8 msg_dest = cec_msg_destination(msg); in cec_received_msg_ts()
1052 u8 cmd = msg->msg[1]; in cec_received_msg_ts()
1057 if (WARN_ON(!msg->len || msg->len > CEC_MAX_MSG_SIZE)) in cec_received_msg_ts()
1078 msg->rx_ts = ktime_to_ns(ts); in cec_received_msg_ts()
1079 msg->rx_status = CEC_RX_STATUS_OK; in cec_received_msg_ts()
1080 msg->sequence = msg->reply = msg->timeout = 0; in cec_received_msg_ts()
1081 msg->tx_status = 0; in cec_received_msg_ts()
1082 msg->tx_ts = 0; in cec_received_msg_ts()
1083 msg->tx_arb_lost_cnt = 0; in cec_received_msg_ts()
1084 msg->tx_nack_cnt = 0; in cec_received_msg_ts()
1085 msg->tx_low_drive_cnt = 0; in cec_received_msg_ts()
1086 msg->tx_error_cnt = 0; in cec_received_msg_ts()
1087 msg->flags = 0; in cec_received_msg_ts()
1088 memset(msg->msg + msg->len, 0, sizeof(msg->msg) - msg->len); in cec_received_msg_ts()
1091 dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg); in cec_received_msg_ts()
1096 if (!cec_msg_is_broadcast(msg)) in cec_received_msg_ts()
1105 if (valid_la && msg->len > 1 && cec_msg_size[cmd]) { in cec_received_msg_ts()
1109 if (msg->len < min_len) in cec_received_msg_ts()
1111 else if (!cec_msg_is_broadcast(msg) && !(dir_fl & DIRECTED)) in cec_received_msg_ts()
1113 else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST)) in cec_received_msg_ts()
1115 else if (cec_msg_is_broadcast(msg) && in cec_received_msg_ts()
1124 if (msg->msg[2] & 0x10) { in cec_received_msg_ts()
1125 switch (msg->msg[2] & 0xf) { in cec_received_msg_ts()
1128 if (msg->len < 5) in cec_received_msg_ts()
1132 } else if ((msg->msg[2] & 0xf) == CEC_OP_PROG_ERROR_DUPLICATE) { in cec_received_msg_ts()
1133 if (msg->len < 5) in cec_received_msg_ts()
1138 switch (msg->msg[2]) { in cec_received_msg_ts()
1142 if (msg->len < 10) in cec_received_msg_ts()
1146 if (msg->len < 7) in cec_received_msg_ts()
1150 if (msg->len < 4) in cec_received_msg_ts()
1154 if (msg->len < 5) in cec_received_msg_ts()
1163 if (valid_la && msg->len > 1 && cmd != CEC_MSG_CDC_MESSAGE) { in cec_received_msg_ts()
1168 cmd = msg->msg[2]; in cec_received_msg_ts()
1175 struct cec_msg *dst = &data->msg; in cec_received_msg_ts()
1182 if (!abort && dst->msg[1] == CEC_MSG_INITIATE_ARC && in cec_received_msg_ts()
1190 if ((abort && cmd != dst->msg[1]) || in cec_received_msg_ts()
1200 memcpy(dst->msg, msg->msg, msg->len); in cec_received_msg_ts()
1201 dst->len = msg->len; in cec_received_msg_ts()
1202 dst->rx_ts = msg->rx_ts; in cec_received_msg_ts()
1203 dst->rx_status = msg->rx_status; in cec_received_msg_ts()
1206 msg->flags = dst->flags; in cec_received_msg_ts()
1207 msg->sequence = dst->sequence; in cec_received_msg_ts()
1230 cec_queue_msg_monitor(adap, msg, valid_la); in cec_received_msg_ts()
1233 if (!valid_la || msg->len <= 1) in cec_received_msg_ts()
1244 cec_receive_notify(adap, msg, is_reply); in cec_received_msg_ts()
1260 struct cec_msg msg = { }; in cec_config_log_addr() local
1269 msg.len = 1; in cec_config_log_addr()
1270 msg.msg[0] = (log_addr << 4) | log_addr; in cec_config_log_addr()
1273 err = cec_transmit_msg_fh(adap, &msg, NULL, true); in cec_config_log_addr()
1293 if (msg.tx_status & in cec_config_log_addr()
1296 if (msg.tx_status & CEC_TX_STATUS_OK) in cec_config_log_addr()
1298 if (msg.tx_status & CEC_TX_STATUS_NACK) in cec_config_log_addr()
1315 log_addr, msg.tx_status); in cec_config_log_addr()
1505 struct cec_msg msg = {}; in cec_config_thread_func() local
1511 msg.msg[0] = (las->log_addr[i] << 4) | 0x0f; in cec_config_thread_func()
1516 cec_fill_msg_report_features(adap, &msg, i); in cec_config_thread_func()
1517 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1521 cec_msg_report_physical_addr(&msg, adap->phys_addr, in cec_config_thread_func()
1526 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1530 cec_msg_device_vendor_id(&msg, in cec_config_thread_func()
1532 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1899 struct cec_msg *msg, in cec_fill_msg_report_features() argument
1908 msg->msg[0] = (las->log_addr[la_idx] << 4) | 0x0f; in cec_fill_msg_report_features()
1909 msg->len = 4; in cec_fill_msg_report_features()
1910 msg->msg[1] = CEC_MSG_REPORT_FEATURES; in cec_fill_msg_report_features()
1911 msg->msg[2] = adap->log_addrs.cec_version; in cec_fill_msg_report_features()
1912 msg->msg[3] = las->all_device_types[la_idx]; in cec_fill_msg_report_features()
1916 msg->msg[msg->len++] = features[idx]; in cec_fill_msg_report_features()
1927 struct cec_msg *msg, u8 reason) in cec_feature_abort_reason() argument
1935 if (msg->msg[1] == CEC_MSG_FEATURE_ABORT) in cec_feature_abort_reason()
1938 if (cec_msg_initiator(msg) == CEC_LOG_ADDR_UNREGISTERED) in cec_feature_abort_reason()
1940 cec_msg_set_reply_to(&tx_msg, msg); in cec_feature_abort_reason()
1941 cec_msg_feature_abort(&tx_msg, msg->msg[1], reason); in cec_feature_abort_reason()
1945 static int cec_feature_abort(struct cec_adapter *adap, struct cec_msg *msg) in cec_feature_abort() argument
1947 return cec_feature_abort_reason(adap, msg, in cec_feature_abort()
1951 static int cec_feature_refused(struct cec_adapter *adap, struct cec_msg *msg) in cec_feature_refused() argument
1953 return cec_feature_abort_reason(adap, msg, in cec_feature_refused()
1964 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, in cec_receive_notify() argument
1967 bool is_broadcast = cec_msg_is_broadcast(msg); in cec_receive_notify()
1968 u8 dest_laddr = cec_msg_destination(msg); in cec_receive_notify()
1969 u8 init_laddr = cec_msg_initiator(msg); in cec_receive_notify()
1975 dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg); in cec_receive_notify()
1979 msg->msg[1] != CEC_MSG_CDC_MESSAGE) in cec_receive_notify()
1984 adap->ops->received(adap, msg) != -ENOMSG) in cec_receive_notify()
1993 switch (msg->msg[1]) { in cec_receive_notify()
2041 cec_msg_set_reply_to(&tx_cec_msg, msg); in cec_receive_notify()
2043 switch (msg->msg[1]) { in cec_receive_notify()
2046 u16 pa = (msg->msg[2] << 8) | msg->msg[3]; in cec_receive_notify()
2059 switch (msg->msg[2]) { in cec_receive_notify()
2065 if (msg->len == 2) in cec_receive_notify()
2067 msg->msg[2], 0); in cec_receive_notify()
2070 msg->msg[2] << 8 | msg->msg[3], 0); in cec_receive_notify()
2089 rc_keydown(adap->rc, RC_PROTO_CEC, msg->msg[2], 0); in cec_receive_notify()
2121 return cec_feature_abort(adap, msg); in cec_receive_notify()
2129 return cec_feature_refused(adap, msg); in cec_receive_notify()
2133 return cec_feature_abort(adap, msg); in cec_receive_notify()
2140 return cec_feature_abort(adap, msg); in cec_receive_notify()
2150 !adap->cec_follower && msg->msg[1] != CEC_MSG_FEATURE_ABORT) in cec_receive_notify()
2151 return cec_feature_abort(adap, msg); in cec_receive_notify()
2157 if (is_reply && !(msg->flags & CEC_MSG_FL_REPLY_TO_FOLLOWERS)) in cec_receive_notify()
2165 cec_queue_msg_fh(adap->cec_follower, msg); in cec_receive_notify()
2167 cec_queue_msg_followers(adap, msg); in cec_receive_notify()
2264 data->msg.len, data->msg.msg, data->msg.reply, in cec_adap_status()
2265 data->msg.timeout); in cec_adap_status()
2269 data->msg.len, data->msg.msg, data->msg.reply, in cec_adap_status()
2270 data->msg.timeout); in cec_adap_status()
2274 data->msg.len, data->msg.msg, data->msg.reply, in cec_adap_status()
2275 data->msg.timeout); in cec_adap_status()