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

Commit 57e602b0 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ultrasound: add support for aDSP Sub-System Restart"

parents 4c03433e 1e68478f
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -498,6 +498,24 @@ static int32_t q6usm_callback(struct apr_client_data *data, void *priv)
	}

	switch (data->opcode) {
	case RESET_EVENTS: {
		pr_err("%s: Reset event is received: %d %d\n",
				__func__,
				data->reset_event,
				data->reset_proc);

		opcode = RESET_EVENTS;

		apr_reset(this_mmap.apr);
		this_mmap.apr = NULL;

		apr_reset(usc->apr);
		usc->apr = NULL;

		break;
	}


	case USM_DATA_EVENT_READ_DONE: {
		struct us_port_data *port = &usc->port[OUT];

+29 −5
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ enum usf_state_type {
	USF_OPENED_STATE,
	USF_CONFIGURED_STATE,
	USF_WORK_STATE,
	USF_ADSP_RESTART_STATE,
	USF_ERROR_STATE
};

@@ -406,6 +407,13 @@ static void usf_rx_cb(uint32_t opcode, uint32_t token,
	case Q6USM_EVENT_WRITE_DONE:
		wake_up(&usf_xx->wait);
		break;

	case RESET_EVENTS:
		pr_err("%s: received RESET_EVENTS\n", __func__);
		usf_xx->usf_state = USF_ADSP_RESTART_STATE;
		wake_up(&usf_xx->wait);
		break;

	default:
		break;
	}
@@ -445,6 +453,12 @@ static void usf_tx_cb(uint32_t opcode, uint32_t token,
		}
		break;

	case RESET_EVENTS:
		pr_err("%s: received RESET_EVENTS\n", __func__);
		usf_xx->usf_state = USF_ADSP_RESTART_STATE;
		wake_up(&usf_xx->wait);
		break;

	default:
		break;
	}
@@ -857,7 +871,9 @@ static int __usf_set_us_detection(struct usf_type *usf,
	if (detect_info->detect_timeout == USF_INFINITIVE_TIMEOUT) {
		rc = wait_event_interruptible(usf_xx->wait,
						(usf_xx->us_detect_type !=
						USF_US_DETECT_UNDEF));
						USF_US_DETECT_UNDEF) ||
						(usf_xx->usf_state ==
						USF_ADSP_RESTART_STATE));
	} else {
		if (detect_info->detect_timeout == USF_DEFAULT_TIMEOUT)
			timeout = USF_TIMEOUT_JIFFIES;
@@ -866,8 +882,14 @@ static int __usf_set_us_detection(struct usf_type *usf,
	}
	rc = wait_event_interruptible_timeout(usf_xx->wait,
					(usf_xx->us_detect_type !=
					 USF_US_DETECT_UNDEF),
					timeout);
					USF_US_DETECT_UNDEF) ||
					(usf_xx->usf_state ==
					USF_ADSP_RESTART_STATE), timeout);

	/* In the case of aDSP restart, "no US" is assumed */
	if (usf_xx->usf_state == USF_ADSP_RESTART_STATE) {
		rc = -EFAULT;
	}
	/* In the case of timeout, "no US" is assumed */
	if (rc < 0)
		pr_err("%s: Getting US detection failed rc[%d]\n",
@@ -1417,7 +1439,8 @@ static long usf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)

	case US_STOP_TX: {
		usf_xx = &usf->usf_tx;
		if (usf_xx->usf_state == USF_WORK_STATE)
		if ((usf_xx->usf_state == USF_WORK_STATE)
			|| (usf_xx->usf_state == USF_ADSP_RESTART_STATE))
			rc = usf_stop_tx(usf);
		else {
			pr_err("%s: stop_tx: wrong state[%d]\n",
@@ -1430,7 +1453,8 @@ static long usf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)

	case US_STOP_RX: {
		usf_xx = &usf->usf_rx;
		if (usf_xx->usf_state == USF_WORK_STATE)
		if ((usf_xx->usf_state == USF_WORK_STATE)
			|| (usf_xx->usf_state == USF_ADSP_RESTART_STATE))
			usf_disable(usf_xx);
		else {
			pr_err("%s: stop_rx: wrong state[%d]\n",