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

Commit 0eeb5acf authored by Venkat Sudhir's avatar Venkat Sudhir Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: msm: qdsp6v2: Fix event status issue for Sound Model V1



Multikeyword supports different sound models. Keyword detection
status for sound model V1 and V2 are different. This caused the
event status for sound model V1 to fail even though the events
were from ADSP were correct. This change fixes the issue of
detecting the status correctly for Sound model V1 and V2 types.

Crs-fixed: 654078
Change-Id: Ia11a4e98813e40e80fd68e458fb9d33a37402035
Signed-off-by: default avatarVenkat Sudhir <vsudhir@codeaurora.org>
parent a771904b
Loading
Loading
Loading
Loading
+20 −9
Original line number Diff line number Diff line
@@ -49,15 +49,31 @@ static void lsm_event_handler(uint32_t opcode, uint32_t token,
	struct snd_pcm_substream *substream = prtd->substream;
	uint16_t status = 0;
	uint16_t payload_size = 0;
	uint16_t index = 0;

	pr_debug("%s: Opcode 0x%x\n", __func__, opcode);
	switch (opcode) {
	case LSM_SESSION_EVENT_DETECTION_STATUS_V2:
	case LSM_SESSION_EVENT_DETECTION_STATUS:
		status = (uint16_t)((uint8_t *)payload)[0];
		payload_size = (uint16_t)((uint8_t *)payload)[2];
		index = 4;
		pr_debug("%s: event detect status = %d payload size = %d\n",
			 __func__, status , payload_size);
	break;
	case LSM_SESSION_EVENT_DETECTION_STATUS_V2:
		status = (uint16_t)((uint8_t *)payload)[0];
		payload_size = (uint16_t)((uint8_t *)payload)[1];
		index = 2;
		pr_debug("%s: event detect status = %d payload size = %d\n",
			 __func__, status , payload_size);
		break;
	default:
		pr_debug("%s: Unsupported Event opcode 0x%x\n", __func__,
			 opcode);
		break;
	}
	if (opcode == LSM_SESSION_EVENT_DETECTION_STATUS ||
		opcode == LSM_SESSION_EVENT_DETECTION_STATUS_V2) {
		spin_lock_irqsave(&prtd->event_lock, flags);
		prtd->event_status = krealloc(prtd->event_status,
					sizeof(struct snd_lsm_event_status) +
@@ -66,7 +82,7 @@ static void lsm_event_handler(uint32_t opcode, uint32_t token,
		prtd->event_status->payload_size = payload_size;
		if (likely(prtd->event_status)) {
			memcpy(prtd->event_status->payload,
			       &((uint8_t *)payload)[2],
			       &((uint8_t *)payload)[index],
			       payload_size);
			prtd->event_avail = 1;
			spin_unlock_irqrestore(&prtd->event_lock, flags);
@@ -78,11 +94,6 @@ static void lsm_event_handler(uint32_t opcode, uint32_t token,
		}
		if (substream->timer_running)
			snd_timer_interrupt(substream->timer, 1);
		break;
	default:
		pr_debug("%s: Unsupported Event opcode 0x%x\n", __func__,
			 opcode);
		break;
	}
}