Lines Matching refs:htc
69 spin_lock_bh(&ep->htc->tx_lock);
71 spin_unlock_bh(&ep->htc->tx_lock);
74 int ath12k_htc_send(struct ath12k_htc *htc,
78 struct ath12k_htc_ep *ep = &htc->endpoint[eid];
80 struct device *dev = htc->ab->dev;
81 struct ath12k_base *ab = htc->ab;
93 credits = DIV_ROUND_UP(skb->len, htc->target_credit_size);
94 spin_lock_bh(&htc->tx_lock);
97 "htc insufficient credits ep %d required %d available %d\n",
99 spin_unlock_bh(&htc->tx_lock);
105 "htc ep %d consumed %d credits (total %d)\n",
107 spin_unlock_bh(&htc->tx_lock);
119 ret = ath12k_ce_send(htc->ab, skb, ep->ul_pipe_id, ep->eid);
129 spin_lock_bh(&htc->tx_lock);
132 "htc ep %d reverted %d credits back (total %d)\n",
134 spin_unlock_bh(&htc->tx_lock);
137 ep->ep_ops.ep_tx_credits(htc->ab);
145 ath12k_htc_process_credit_report(struct ath12k_htc *htc,
150 struct ath12k_base *ab = htc->ab;
159 spin_lock_bh(&htc->tx_lock);
164 ep = &htc->endpoint[report->eid];
167 ath12k_dbg(ab, ATH12K_DBG_HTC, "htc ep %d got %d credits (total %d)\n",
171 spin_unlock_bh(&htc->tx_lock);
172 ep->ep_ops.ep_tx_credits(htc->ab);
173 spin_lock_bh(&htc->tx_lock);
176 spin_unlock_bh(&htc->tx_lock);
179 static int ath12k_htc_process_trailer(struct ath12k_htc *htc,
184 struct ath12k_base *ab = htc->ab;
213 ath12k_htc_process_credit_report(htc,
251 struct ath12k_htc *htc = &ab->htc;
270 ep = &htc->endpoint[eid];
308 status = ath12k_htc_process_trailer(htc, trailer,
327 if (completion_done(&htc->ctl_resp)) {
332 complete(&htc->ctl_resp);
336 htc->control_resp_len =
340 memcpy(htc->control_resp_buffer, skb->data,
341 htc->control_resp_len);
343 complete(&htc->ctl_resp);
354 ath12k_warn(ab, "ignoring unsolicited htc ep0 event %u\n",
361 ath12k_dbg(ab, ATH12K_DBG_HTC, "htc rx completion ep %d skb %pK\n",
380 ath12k_warn(ab, "unexpected htc rx\n");
424 static void ath12k_htc_reset_endpoint_states(struct ath12k_htc *htc)
430 ep = &htc->endpoint[i];
435 ep->htc = htc;
440 static u8 ath12k_htc_get_credit_allocation(struct ath12k_htc *htc,
446 serv_entry = htc->service_alloc_table;
458 static int ath12k_htc_setup_target_buffer_assignments(struct ath12k_htc *htc)
468 credits = htc->total_transmit_credits;
469 serv_entry = htc->service_alloc_table;
471 if ((htc->wmi_ep_count == 0) ||
472 (htc->wmi_ep_count > ARRAY_SIZE(svc_id)))
476 credits = credits / htc->wmi_ep_count;
477 for (i = 0; i < htc->wmi_ep_count; i++) {
485 int ath12k_htc_wait_target(struct ath12k_htc *htc)
488 struct ath12k_base *ab = htc->ab;
495 time_left = wait_for_completion_timeout(&htc->ctl_resp,
501 ath12k_ce_per_engine_service(htc->ab, i);
504 wait_for_completion_timeout(&htc->ctl_resp,
516 if (htc->control_resp_len < sizeof(*ready)) {
518 htc->control_resp_len);
522 ready = (struct ath12k_htc_ready *)htc->control_resp_buffer;
533 htc->total_transmit_credits = credit_count;
534 htc->target_credit_size = credit_size;
538 htc->total_transmit_credits, htc->target_credit_size);
540 if ((htc->total_transmit_credits == 0) ||
541 (htc->target_credit_size == 0)) {
546 ath12k_htc_setup_target_buffer_assignments(htc);
551 int ath12k_htc_connect_service(struct ath12k_htc *htc,
555 struct ath12k_base *ab = htc->ab;
578 tx_alloc = ath12k_htc_get_credit_allocation(htc,
582 "boot htc service %s does not allocate target credits\n",
613 reinit_completion(&htc->ctl_resp);
615 status = ath12k_htc_send(htc, ATH12K_HTC_EP_0, skb);
622 time_left = wait_for_completion_timeout(&htc->ctl_resp,
630 resp_msg = (struct ath12k_htc_conn_svc_resp *)htc->control_resp_buffer;
636 (htc->control_resp_len < sizeof(*resp_msg))) {
672 ep = &htc->endpoint[assigned_eid];
693 status = ath12k_hif_map_service_to_pipe(htc->ab,
701 "boot htc service '%s' ul pipe %d dl pipe %d eid %d ready\n",
708 "boot htc service '%s' eid %d TX flow control disabled\n",
715 int ath12k_htc_start(struct ath12k_htc *htc)
719 struct ath12k_base *ab = htc->ab;
735 status = ath12k_htc_send(htc, ATH12K_HTC_EP_0, skb);
746 struct ath12k_htc *htc = &ab->htc;
751 spin_lock_init(&htc->tx_lock);
753 ath12k_htc_reset_endpoint_states(htc);
755 htc->ab = ab;
759 htc->wmi_ep_count = 1;
763 htc->wmi_ep_count = 2;
766 htc->wmi_ep_count = 3;
769 htc->wmi_ep_count = ab->hw_params->max_radios;
780 ret = ath12k_htc_connect_service(htc, &conn_req, &conn_resp);
782 ath12k_err(ab, "could not connect to htc service (%d)\n", ret);
786 init_completion(&htc->ctl_resp);