Lines Matching refs:msg

27 					 struct cec_msg *msg,
228 static void cec_queue_msg_fh(struct cec_fh *fh, const struct cec_msg *msg) in cec_queue_msg_fh() argument
242 entry->msg = *msg; in cec_queue_msg_fh()
282 const struct cec_msg *msg, in cec_queue_msg_monitor() argument
292 cec_queue_msg_fh(fh, msg); in cec_queue_msg_monitor()
301 const struct cec_msg *msg) in cec_queue_msg_followers() argument
308 cec_queue_msg_fh(fh, msg); in cec_queue_msg_followers()
358 cec_queue_msg_fh(data->fh, &data->msg); in cec_data_completed()
380 if (!(data->msg.tx_status & CEC_TX_STATUS_OK)) in cec_data_cancel()
384 if (data->msg.tx_status & CEC_TX_STATUS_OK) { in cec_data_cancel()
385 data->msg.rx_ts = ktime_get_ns(); in cec_data_cancel()
386 data->msg.rx_status = CEC_RX_STATUS_ABORTED; in cec_data_cancel()
388 data->msg.tx_ts = ktime_get_ns(); in cec_data_cancel()
389 data->msg.tx_status |= tx_status | in cec_data_cancel()
391 data->msg.tx_error_cnt++; in cec_data_cancel()
396 cec_queue_msg_monitor(data->adap, &data->msg, 1); in cec_data_cancel()
502 adap->transmitting->msg.len, in cec_thread_func()
503 adap->transmitting->msg.msg); in cec_thread_func()
534 if (data->msg.len == 1 && adap->is_configured) in cec_thread_func()
544 cec_msg_initiator(&data->msg)) { in cec_thread_func()
547 adap->last_initiator = cec_msg_initiator(&data->msg); in cec_thread_func()
560 signal_free_time, &data->msg)) in cec_thread_func()
582 struct cec_msg *msg; in cec_transmit_done_ts() local
606 msg = &data->msg; in cec_transmit_done_ts()
610 msg->tx_ts = ktime_to_ns(ts); in cec_transmit_done_ts()
611 msg->tx_status |= status; in cec_transmit_done_ts()
612 msg->tx_arb_lost_cnt += arb_lost_cnt; in cec_transmit_done_ts()
613 msg->tx_nack_cnt += nack_cnt; in cec_transmit_done_ts()
614 msg->tx_low_drive_cnt += low_drive_cnt; in cec_transmit_done_ts()
615 msg->tx_error_cnt += error_cnt; in cec_transmit_done_ts()
629 if (msg->timeout) in cec_transmit_done_ts()
631 msg->len, msg->msg, data->attempts, msg->reply); in cec_transmit_done_ts()
634 msg->len, msg->msg, data->attempts); in cec_transmit_done_ts()
645 msg->tx_status |= CEC_TX_STATUS_MAX_RETRIES; in cec_transmit_done_ts()
648 cec_queue_msg_monitor(adap, msg, 1); in cec_transmit_done_ts()
651 msg->timeout) { in cec_transmit_done_ts()
658 msecs_to_jiffies(msg->timeout)); in cec_transmit_done_ts()
719 data->msg.rx_ts = ktime_get_ns(); in cec_wait_timeout()
720 data->msg.rx_status = CEC_RX_STATUS_TIMEOUT; in cec_wait_timeout()
732 int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, in cec_transmit_msg_fh() argument
736 bool is_raw = msg_is_raw(msg); in cec_transmit_msg_fh()
738 msg->rx_ts = 0; in cec_transmit_msg_fh()
739 msg->tx_ts = 0; in cec_transmit_msg_fh()
740 msg->rx_status = 0; in cec_transmit_msg_fh()
741 msg->tx_status = 0; in cec_transmit_msg_fh()
742 msg->tx_arb_lost_cnt = 0; in cec_transmit_msg_fh()
743 msg->tx_nack_cnt = 0; in cec_transmit_msg_fh()
744 msg->tx_low_drive_cnt = 0; in cec_transmit_msg_fh()
745 msg->tx_error_cnt = 0; in cec_transmit_msg_fh()
746 msg->sequence = 0; in cec_transmit_msg_fh()
748 if (msg->reply && msg->timeout == 0) { in cec_transmit_msg_fh()
750 msg->timeout = 1000; in cec_transmit_msg_fh()
752 msg->flags &= CEC_MSG_FL_REPLY_TO_FOLLOWERS | CEC_MSG_FL_RAW; in cec_transmit_msg_fh()
754 if (!msg->timeout) in cec_transmit_msg_fh()
755 msg->flags &= ~CEC_MSG_FL_REPLY_TO_FOLLOWERS; in cec_transmit_msg_fh()
758 if (msg->len == 0 || msg->len > CEC_MAX_MSG_SIZE) { in cec_transmit_msg_fh()
759 dprintk(1, "%s: invalid length %d\n", __func__, msg->len); in cec_transmit_msg_fh()
763 memset(msg->msg + msg->len, 0, sizeof(msg->msg) - msg->len); in cec_transmit_msg_fh()
765 if (msg->timeout) in cec_transmit_msg_fh()
767 __func__, msg->len, msg->msg, msg->reply, in cec_transmit_msg_fh()
771 __func__, msg->len, msg->msg, !block ? " (nb)" : ""); in cec_transmit_msg_fh()
773 if (msg->timeout && msg->len == 1) { in cec_transmit_msg_fh()
784 (msg->len == 1 || msg->msg[1] != CEC_MSG_CDC_MESSAGE)) { in cec_transmit_msg_fh()
789 if (msg->len >= 4 && msg->msg[1] == CEC_MSG_CDC_MESSAGE) { in cec_transmit_msg_fh()
790 msg->msg[2] = adap->phys_addr >> 8; in cec_transmit_msg_fh()
791 msg->msg[3] = adap->phys_addr & 0xff; in cec_transmit_msg_fh()
794 if (msg->len == 1) { in cec_transmit_msg_fh()
795 if (cec_msg_destination(msg) == 0xf) { in cec_transmit_msg_fh()
800 if (cec_has_log_addr(adap, cec_msg_destination(msg))) { in cec_transmit_msg_fh()
809 msg->tx_ts = ktime_get_ns(); in cec_transmit_msg_fh()
810 msg->tx_status = CEC_TX_STATUS_NACK | in cec_transmit_msg_fh()
812 msg->tx_nack_cnt = 1; in cec_transmit_msg_fh()
813 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
814 if (!msg->sequence) in cec_transmit_msg_fh()
815 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
819 if (msg->len > 1 && !cec_msg_is_broadcast(msg) && in cec_transmit_msg_fh()
820 cec_has_log_addr(adap, cec_msg_destination(msg))) { in cec_transmit_msg_fh()
825 if (msg->len > 1 && adap->is_configured && in cec_transmit_msg_fh()
826 !cec_has_log_addr(adap, cec_msg_initiator(msg))) { in cec_transmit_msg_fh()
828 __func__, cec_msg_initiator(msg)); in cec_transmit_msg_fh()
838 (msg->len > 2 || in cec_transmit_msg_fh()
839 cec_msg_destination(msg) != CEC_LOG_ADDR_TV || in cec_transmit_msg_fh()
840 (msg->len == 2 && msg->msg[1] != CEC_MSG_IMAGE_VIEW_ON && in cec_transmit_msg_fh()
841 msg->msg[1] != CEC_MSG_TEXT_VIEW_ON))) { in cec_transmit_msg_fh()
853 if (msg->reply) { in cec_transmit_msg_fh()
868 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
869 if (!msg->sequence) in cec_transmit_msg_fh()
870 msg->sequence = ++adap->sequence; in cec_transmit_msg_fh()
872 data->msg = *msg; in cec_transmit_msg_fh()
906 *msg = data->msg; in cec_transmit_msg_fh()
912 int cec_transmit_msg(struct cec_adapter *adap, struct cec_msg *msg, in cec_transmit_msg() argument
918 ret = cec_transmit_msg_fh(adap, msg, NULL, block); in cec_transmit_msg()
929 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg,
1023 struct cec_msg *msg, ktime_t ts) in cec_received_msg_ts() argument
1026 u8 msg_init = cec_msg_initiator(msg); in cec_received_msg_ts()
1027 u8 msg_dest = cec_msg_destination(msg); in cec_received_msg_ts()
1028 u8 cmd = msg->msg[1]; in cec_received_msg_ts()
1033 if (WARN_ON(!msg->len || msg->len > CEC_MAX_MSG_SIZE)) in cec_received_msg_ts()
1051 msg->rx_ts = ktime_to_ns(ts); in cec_received_msg_ts()
1052 msg->rx_status = CEC_RX_STATUS_OK; in cec_received_msg_ts()
1053 msg->sequence = msg->reply = msg->timeout = 0; in cec_received_msg_ts()
1054 msg->tx_status = 0; in cec_received_msg_ts()
1055 msg->tx_ts = 0; in cec_received_msg_ts()
1056 msg->tx_arb_lost_cnt = 0; in cec_received_msg_ts()
1057 msg->tx_nack_cnt = 0; in cec_received_msg_ts()
1058 msg->tx_low_drive_cnt = 0; in cec_received_msg_ts()
1059 msg->tx_error_cnt = 0; in cec_received_msg_ts()
1060 msg->flags = 0; in cec_received_msg_ts()
1061 memset(msg->msg + msg->len, 0, sizeof(msg->msg) - msg->len); in cec_received_msg_ts()
1064 dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg); in cec_received_msg_ts()
1069 if (!cec_msg_is_broadcast(msg)) in cec_received_msg_ts()
1078 if (valid_la && msg->len > 1 && cec_msg_size[cmd]) { in cec_received_msg_ts()
1082 if (msg->len < min_len) in cec_received_msg_ts()
1084 else if (!cec_msg_is_broadcast(msg) && !(dir_fl & DIRECTED)) in cec_received_msg_ts()
1086 else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST1_4)) in cec_received_msg_ts()
1088 else if (cec_msg_is_broadcast(msg) && in cec_received_msg_ts()
1097 if (msg->msg[2] & 0x10) { in cec_received_msg_ts()
1098 switch (msg->msg[2] & 0xf) { in cec_received_msg_ts()
1101 if (msg->len < 5) in cec_received_msg_ts()
1105 } else if ((msg->msg[2] & 0xf) == CEC_OP_PROG_ERROR_DUPLICATE) { in cec_received_msg_ts()
1106 if (msg->len < 5) in cec_received_msg_ts()
1111 switch (msg->msg[2]) { in cec_received_msg_ts()
1115 if (msg->len < 10) in cec_received_msg_ts()
1119 if (msg->len < 7) in cec_received_msg_ts()
1123 if (msg->len < 4) in cec_received_msg_ts()
1127 if (msg->len < 5) in cec_received_msg_ts()
1136 if (valid_la && msg->len > 1 && cmd != CEC_MSG_CDC_MESSAGE) { in cec_received_msg_ts()
1141 cmd = msg->msg[2]; in cec_received_msg_ts()
1148 struct cec_msg *dst = &data->msg; in cec_received_msg_ts()
1155 if (!abort && dst->msg[1] == CEC_MSG_INITIATE_ARC && in cec_received_msg_ts()
1163 if ((abort && cmd != dst->msg[1]) || in cec_received_msg_ts()
1173 memcpy(dst->msg, msg->msg, msg->len); in cec_received_msg_ts()
1174 dst->len = msg->len; in cec_received_msg_ts()
1175 dst->rx_ts = msg->rx_ts; in cec_received_msg_ts()
1176 dst->rx_status = msg->rx_status; in cec_received_msg_ts()
1179 msg->flags = dst->flags; in cec_received_msg_ts()
1202 cec_queue_msg_monitor(adap, msg, valid_la); in cec_received_msg_ts()
1205 if (!valid_la || msg->len <= 1) in cec_received_msg_ts()
1216 cec_receive_notify(adap, msg, is_reply); in cec_received_msg_ts()
1232 struct cec_msg msg = { }; in cec_config_log_addr() local
1241 msg.len = 1; in cec_config_log_addr()
1242 msg.msg[0] = (log_addr << 4) | log_addr; in cec_config_log_addr()
1245 err = cec_transmit_msg_fh(adap, &msg, NULL, true); in cec_config_log_addr()
1261 if (msg.tx_status & CEC_TX_STATUS_ABORTED) in cec_config_log_addr()
1263 if (msg.tx_status & CEC_TX_STATUS_OK) in cec_config_log_addr()
1265 if (msg.tx_status & CEC_TX_STATUS_NACK) in cec_config_log_addr()
1463 struct cec_msg msg = {}; in cec_config_thread_func() local
1469 msg.msg[0] = (las->log_addr[i] << 4) | 0x0f; in cec_config_thread_func()
1474 cec_fill_msg_report_features(adap, &msg, i); in cec_config_thread_func()
1475 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1479 cec_msg_report_physical_addr(&msg, adap->phys_addr, in cec_config_thread_func()
1484 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1488 cec_msg_device_vendor_id(&msg, in cec_config_thread_func()
1490 cec_transmit_msg_fh(adap, &msg, NULL, false); in cec_config_thread_func()
1811 struct cec_msg *msg, in cec_fill_msg_report_features() argument
1820 msg->msg[0] = (las->log_addr[la_idx] << 4) | 0x0f; in cec_fill_msg_report_features()
1821 msg->len = 4; in cec_fill_msg_report_features()
1822 msg->msg[1] = CEC_MSG_REPORT_FEATURES; in cec_fill_msg_report_features()
1823 msg->msg[2] = adap->log_addrs.cec_version; in cec_fill_msg_report_features()
1824 msg->msg[3] = las->all_device_types[la_idx]; in cec_fill_msg_report_features()
1828 msg->msg[msg->len++] = features[idx]; in cec_fill_msg_report_features()
1839 struct cec_msg *msg, u8 reason) in cec_feature_abort_reason() argument
1847 if (msg->msg[1] == CEC_MSG_FEATURE_ABORT) in cec_feature_abort_reason()
1850 if (cec_msg_initiator(msg) == CEC_LOG_ADDR_UNREGISTERED) in cec_feature_abort_reason()
1852 cec_msg_set_reply_to(&tx_msg, msg); in cec_feature_abort_reason()
1853 cec_msg_feature_abort(&tx_msg, msg->msg[1], reason); in cec_feature_abort_reason()
1857 static int cec_feature_abort(struct cec_adapter *adap, struct cec_msg *msg) in cec_feature_abort() argument
1859 return cec_feature_abort_reason(adap, msg, in cec_feature_abort()
1863 static int cec_feature_refused(struct cec_adapter *adap, struct cec_msg *msg) in cec_feature_refused() argument
1865 return cec_feature_abort_reason(adap, msg, in cec_feature_refused()
1876 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, in cec_receive_notify() argument
1879 bool is_broadcast = cec_msg_is_broadcast(msg); in cec_receive_notify()
1880 u8 dest_laddr = cec_msg_destination(msg); in cec_receive_notify()
1881 u8 init_laddr = cec_msg_initiator(msg); in cec_receive_notify()
1887 dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg); in cec_receive_notify()
1891 msg->msg[1] != CEC_MSG_CDC_MESSAGE) in cec_receive_notify()
1896 if (adap->ops->received(adap, msg) != -ENOMSG) in cec_receive_notify()
1906 switch (msg->msg[1]) { in cec_receive_notify()
1954 cec_msg_set_reply_to(&tx_cec_msg, msg); in cec_receive_notify()
1956 switch (msg->msg[1]) { in cec_receive_notify()
1959 u16 pa = (msg->msg[2] << 8) | msg->msg[3]; in cec_receive_notify()
1974 switch (msg->msg[2]) { in cec_receive_notify()
1980 if (msg->len == 2) in cec_receive_notify()
1982 msg->msg[2], 0); in cec_receive_notify()
1985 msg->msg[2] << 8 | msg->msg[3], 0); in cec_receive_notify()
2000 rc_keydown(adap->rc, RC_PROTO_CEC, msg->msg[2], 0); in cec_receive_notify()
2032 return cec_feature_abort(adap, msg); in cec_receive_notify()
2040 return cec_feature_refused(adap, msg); in cec_receive_notify()
2044 return cec_feature_abort(adap, msg); in cec_receive_notify()
2051 return cec_feature_abort(adap, msg); in cec_receive_notify()
2061 !adap->cec_follower && msg->msg[1] != CEC_MSG_FEATURE_ABORT) in cec_receive_notify()
2062 return cec_feature_abort(adap, msg); in cec_receive_notify()
2068 if (is_reply && !(msg->flags & CEC_MSG_FL_REPLY_TO_FOLLOWERS)) in cec_receive_notify()
2076 cec_queue_msg_fh(adap->cec_follower, msg); in cec_receive_notify()
2078 cec_queue_msg_followers(adap, msg); in cec_receive_notify()
2161 data->msg.len, data->msg.msg, data->msg.reply, in cec_adap_status()
2162 data->msg.timeout); in cec_adap_status()
2166 data->msg.len, data->msg.msg, data->msg.reply, in cec_adap_status()
2167 data->msg.timeout); in cec_adap_status()
2171 data->msg.len, data->msg.msg, data->msg.reply, in cec_adap_status()
2172 data->msg.timeout); in cec_adap_status()