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_void_op(adap, adap_nb_transmit_canceled, &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()
1058 if (WARN_ON(!msg->len || msg->len > CEC_MAX_MSG_SIZE)) in cec_received_msg_ts()
1079 msg->rx_ts = ktime_to_ns(ts); in cec_received_msg_ts()
1080 msg->rx_status = CEC_RX_STATUS_OK; in cec_received_msg_ts()
1081 msg->sequence = msg->reply = msg->timeout = 0; in cec_received_msg_ts()
1082 msg->tx_status = 0; in cec_received_msg_ts()
1083 msg->tx_ts = 0; in cec_received_msg_ts()
1084 msg->tx_arb_lost_cnt = 0; in cec_received_msg_ts()
1085 msg->tx_nack_cnt = 0; in cec_received_msg_ts()
1086 msg->tx_low_drive_cnt = 0; in cec_received_msg_ts()
1087 msg->tx_error_cnt = 0; in cec_received_msg_ts()
1088 msg->flags = 0; in cec_received_msg_ts()
1089 memset(msg->msg + msg->len, 0, sizeof(msg->msg) - msg->len); in cec_received_msg_ts()
1092 dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg); in cec_received_msg_ts()
1098 if (!cec_msg_is_broadcast(msg)) { in cec_received_msg_ts()
1109 if (valid_la && msg->len > 1 && cec_msg_size[cmd]) { in cec_received_msg_ts()
1113 if (msg->len < min_len) in cec_received_msg_ts()
1115 else if (!cec_msg_is_broadcast(msg) && !(dir_fl & DIRECTED)) in cec_received_msg_ts()
1117 else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST)) in cec_received_msg_ts()
1119 else if (cec_msg_is_broadcast(msg) && in cec_received_msg_ts()
1128 if (msg->msg[2] & 0x10) { in cec_received_msg_ts()
1129 switch (msg->msg[2] & 0xf) { in cec_received_msg_ts()
1132 if (msg->len < 5) in cec_received_msg_ts()
1136 } else if ((msg->msg[2] & 0xf) == CEC_OP_PROG_ERROR_DUPLICATE) { in cec_received_msg_ts()
1137 if (msg->len < 5) in cec_received_msg_ts()
1142 switch (msg->msg[2]) { in cec_received_msg_ts()
1146 if (msg->len < 10) in cec_received_msg_ts()
1150 if (msg->len < 7) in cec_received_msg_ts()
1154 if (msg->len < 4) in cec_received_msg_ts()
1158 if (msg->len < 5) in cec_received_msg_ts()
1167 if (valid_la && msg->len > 1 && cmd != CEC_MSG_CDC_MESSAGE) { in cec_received_msg_ts()
1172 cmd = msg->msg[2]; in cec_received_msg_ts()
1179 struct cec_msg *dst = &data->msg; in cec_received_msg_ts()
1186 if (!abort && dst->msg[1] == CEC_MSG_INITIATE_ARC && in cec_received_msg_ts()
1194 if ((abort && cmd != dst->msg[1]) || in cec_received_msg_ts()
1204 memcpy(dst->msg, msg->msg, msg->len); in cec_received_msg_ts()
1205 dst->len = msg->len; in cec_received_msg_ts()
1206 dst->rx_ts = msg->rx_ts; in cec_received_msg_ts()
1207 dst->rx_status = msg->rx_status; in cec_received_msg_ts()
1210 msg->flags = dst->flags; in cec_received_msg_ts()
1211 msg->sequence = dst->sequence; in cec_received_msg_ts()
1234 cec_queue_msg_monitor(adap, msg, monitor_valid_la); in cec_received_msg_ts()
1237 if (!valid_la || msg->len <= 1) in cec_received_msg_ts()
1248 cec_receive_notify(adap, msg, is_reply); in cec_received_msg_ts()
1264 struct cec_msg msg = { }; in cec_config_log_addr() local
1273 msg.len = 1; in cec_config_log_addr()
1274 msg.msg[0] = (log_addr << 4) | log_addr; in cec_config_log_addr()
1277 err = cec_transmit_msg_fh(adap, &msg, NULL, true); in cec_config_log_addr()
1297 if (msg.tx_status & in cec_config_log_addr()
1300 if (msg.tx_status & CEC_TX_STATUS_OK) in cec_config_log_addr()
1302 if (msg.tx_status & CEC_TX_STATUS_NACK) in cec_config_log_addr()
1319 log_addr, msg.tx_status); in cec_config_log_addr()
1509 struct cec_msg msg = {}; in cec_config_thread_func() local
1515 msg.msg[0] = (las->log_addr[i] << 4) | 0x0f; in cec_config_thread_func()
1520 cec_fill_msg_report_features(adap, &msg, i); in cec_config_thread_func()
1521 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1525 cec_msg_report_physical_addr(&msg, adap->phys_addr, in cec_config_thread_func()
1530 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1534 cec_msg_device_vendor_id(&msg, in cec_config_thread_func()
1536 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1906 struct cec_msg *msg, in cec_fill_msg_report_features() argument
1915 msg->msg[0] = (las->log_addr[la_idx] << 4) | 0x0f; in cec_fill_msg_report_features()
1916 msg->len = 4; in cec_fill_msg_report_features()
1917 msg->msg[1] = CEC_MSG_REPORT_FEATURES; in cec_fill_msg_report_features()
1918 msg->msg[2] = adap->log_addrs.cec_version; in cec_fill_msg_report_features()
1919 msg->msg[3] = las->all_device_types[la_idx]; in cec_fill_msg_report_features()
1923 msg->msg[msg->len++] = features[idx]; in cec_fill_msg_report_features()
1934 struct cec_msg *msg, u8 reason) in cec_feature_abort_reason() argument
1942 if (msg->msg[1] == CEC_MSG_FEATURE_ABORT) in cec_feature_abort_reason()
1945 if (cec_msg_initiator(msg) == CEC_LOG_ADDR_UNREGISTERED) in cec_feature_abort_reason()
1947 cec_msg_set_reply_to(&tx_msg, msg); in cec_feature_abort_reason()
1948 cec_msg_feature_abort(&tx_msg, msg->msg[1], reason); in cec_feature_abort_reason()
1952 static int cec_feature_abort(struct cec_adapter *adap, struct cec_msg *msg) in cec_feature_abort() argument
1954 return cec_feature_abort_reason(adap, msg, in cec_feature_abort()
1958 static int cec_feature_refused(struct cec_adapter *adap, struct cec_msg *msg) in cec_feature_refused() argument
1960 return cec_feature_abort_reason(adap, msg, in cec_feature_refused()
1971 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, in cec_receive_notify() argument
1974 bool is_broadcast = cec_msg_is_broadcast(msg); in cec_receive_notify()
1975 u8 dest_laddr = cec_msg_destination(msg); in cec_receive_notify()
1976 u8 init_laddr = cec_msg_initiator(msg); in cec_receive_notify()
1982 dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg); in cec_receive_notify()
1986 msg->msg[1] != CEC_MSG_CDC_MESSAGE) in cec_receive_notify()
1991 adap->ops->received(adap, msg) != -ENOMSG) in cec_receive_notify()
2000 switch (msg->msg[1]) { in cec_receive_notify()
2048 cec_msg_set_reply_to(&tx_cec_msg, msg); in cec_receive_notify()
2050 switch (msg->msg[1]) { in cec_receive_notify()
2053 u16 pa = (msg->msg[2] << 8) | msg->msg[3]; in cec_receive_notify()
2066 switch (msg->msg[2]) { in cec_receive_notify()
2072 if (msg->len == 2) in cec_receive_notify()
2074 msg->msg[2], 0); in cec_receive_notify()
2077 msg->msg[2] << 8 | msg->msg[3], 0); in cec_receive_notify()
2096 rc_keydown(adap->rc, RC_PROTO_CEC, msg->msg[2], 0); in cec_receive_notify()
2128 return cec_feature_abort(adap, msg); in cec_receive_notify()
2136 return cec_feature_refused(adap, msg); in cec_receive_notify()
2140 return cec_feature_abort(adap, msg); in cec_receive_notify()
2147 return cec_feature_abort(adap, msg); in cec_receive_notify()
2157 !adap->cec_follower && msg->msg[1] != CEC_MSG_FEATURE_ABORT) in cec_receive_notify()
2158 return cec_feature_abort(adap, msg); in cec_receive_notify()
2164 if (is_reply && !(msg->flags & CEC_MSG_FL_REPLY_TO_FOLLOWERS)) in cec_receive_notify()
2172 cec_queue_msg_fh(adap->cec_follower, msg); in cec_receive_notify()
2174 cec_queue_msg_followers(adap, msg); in cec_receive_notify()
2271 data->msg.len, data->msg.msg, data->msg.reply, in cec_adap_status()
2272 data->msg.timeout); in cec_adap_status()
2276 data->msg.len, data->msg.msg, data->msg.reply, in cec_adap_status()
2277 data->msg.timeout); in cec_adap_status()
2281 data->msg.len, data->msg.msg, data->msg.reply, in cec_adap_status()
2282 data->msg.timeout); in cec_adap_status()