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

Commit 832c7210 authored by Aviral Gupta's avatar Aviral Gupta
Browse files

ASoC: msm: unblock the calls sent to the driver during SSR



Return error code ENETRESET from the platform driver
during the SSR recovery.
This facilitates the client to handle the error code
and take corrective measures rather than being blocked
on the call.

CRs-Fixed: 683288
Change-Id: I618edf0276bbe8826b47edec39df0dd4f87ffe93
Signed-off-by: default avatarAviral Gupta <aviralg@codeaurora.org>
parent 655c3734
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1574,14 +1574,13 @@ static int msm_compr_pointer(struct snd_compr_stream *cstream,
	tstamp.byte_offset = prtd->byte_offset;
	tstamp.copied_total = prtd->copied_total;
	first_buffer = prtd->first_buffer;

	if (atomic_read(&prtd->error)) {
		pr_err("%s Got RESET EVENTS notification, return error",
			__func__);
		tstamp.pcm_io_frames = 0;
		memcpy(arg, &tstamp, sizeof(struct snd_compr_tstamp));
		spin_unlock_irqrestore(&prtd->lock, flags);
		return -EINVAL;
		return -ENETRESET;
	}

	spin_unlock_irqrestore(&prtd->lock, flags);
@@ -1595,6 +1594,9 @@ static int msm_compr_pointer(struct snd_compr_stream *cstream,
		if (rc < 0) {
			pr_err("%s: Get Session Time return value =%lld\n",
				__func__, timestamp);
			if (atomic_read(&prtd->error))
				return -ENETRESET;
			else
				return -EAGAIN;
		}
	} else {
@@ -1678,7 +1680,7 @@ static int msm_compr_copy(struct snd_compr_stream *cstream,
	if (atomic_read(&prtd->error)) {
		pr_err("%s Got RESET EVENTS notification", __func__);
		spin_unlock_irqrestore(&prtd->lock, flags);
		return -EINVAL;
		return -ENETRESET;
	}
	spin_unlock_irqrestore(&prtd->lock, flags);

+4 −0
Original line number Diff line number Diff line
@@ -1400,6 +1400,10 @@ static int32_t q6asm_callback(struct apr_client_data *data, void *priv)
		if (ac->cb)
			ac->cb(data->opcode, data->token,
				data->payload, ac->priv);
		atomic_set(&ac->time_flag, 0);
		atomic_set(&ac->cmd_state, 0);
		wake_up(&ac->time_wait);
		wake_up(&ac->cmd_wait);
		ac->apr = NULL;
		return 0;
	}
+3 −2
Original line number Diff line number Diff line
@@ -680,14 +680,15 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream,
{
	struct snd_soc_pcm_runtime *rtd = cstream->private_data;
	struct snd_soc_platform *platform = rtd->platform;
	int ret = 0;

	mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);

	if (platform->driver->compr_ops && platform->driver->compr_ops->pointer)
		 platform->driver->compr_ops->pointer(cstream, tstamp);
		ret = platform->driver->compr_ops->pointer(cstream, tstamp);

	mutex_unlock(&rtd->pcm_mutex);
	return 0;
	return ret;
}

static int soc_compr_copy(struct snd_compr_stream *cstream,