Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit afe46893 authored by Sujeev Dias's avatar Sujeev Dias
Browse files

mhi: mhi_uci: add support for shutdown and system error notification



Add support to handle system error and shutdown
notifications from mhi host.

CRs-Fixed: 1097560
Change-Id: Ied6c907586aa4dc2ed3b1a7c19305877144b3b21
Signed-off-by: default avatarSujeev Dias <sdias@codeaurora.org>
parent 4c332132
Loading
Loading
Loading
Loading
+35 −1
Original line number Diff line number Diff line
@@ -1185,9 +1185,43 @@ static void uci_xfer_cb(struct mhi_cb_info *cb_info)
		mutex_unlock(&chan_attr->chan_lock);
		wake_up(&chan_attr->wq);
		break;
	case MHI_CB_SYS_ERROR:
	case MHI_CB_MHI_SHUTDOWN:
	case MHI_CB_MHI_DISABLED:
		uci_log(uci_handle->uci_ipc_log, UCI_DBG_INFO,
			"MHI disabled CB received\n");
			"MHI disabled CB received 0x%x for chan:%d\n",
			cb_info->cb_reason, cb_info->chan);

		chan_attr = (cb_info->chan % 2) ? &uci_handle->in_attr :
			&uci_handle->out_attr;
		mutex_lock(&chan_attr->chan_lock);
		chan_attr->enabled = false;
		/* we disable entire handler by grabbing only one lock */
		uci_handle->enabled = false;
		mutex_unlock(&chan_attr->chan_lock);
		wake_up(&chan_attr->wq);

		/*
		 * if it's ctrl channel clear the resource now
		 * otherwise during file close we will release the
		 * resources
		 */
		if (uci_handle == uci_handle->uci_ctxt->ctrl_client &&
		    chan_attr == &uci_handle->out_attr) {
			struct uci_buf *itr, *tmp;

			mutex_lock(&chan_attr->chan_lock);
			atomic_set(&uci_handle->out_attr.avail_pkts, 0);
			atomic_set(&uci_handle->out_pkt_pend_ack, 0);
			list_for_each_entry_safe(itr, tmp, &chan_attr->buf_head,
						 node) {
				list_del(&itr->node);
				kfree(itr->data);
			}
			atomic_set(&uci_handle->completion_ack, 0);
			INIT_LIST_HEAD(&uci_handle->out_attr.buf_head);
			mutex_unlock(&chan_attr->chan_lock);
		}
		break;
	case MHI_CB_XFER:
		if (!cb_info->result) {