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

Commit a47f571c authored by Yan He's avatar Yan He
Browse files

msm: sps: use a new flag for disconnecting pipe



Use a new flag to indicate if BAM client has decided to disconnect
a pipe so that we can avoid BAM IRQ handling for a disconnected
pipe.

Change-Id: I1d1e467cf7366f0b00b32674117d381432611e26
Signed-off-by: default avatarYan He <yanhe@codeaurora.org>
parent 2d37de8c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -169,6 +169,7 @@ static irqreturn_t bam_isr(int irq, void *ctxt)
	list_for_each_entry(pipe, &dev->pipes_q, list) {
		/* Check this pipe's bit in the source mask */
		if (BAM_PIPE_IS_ASSIGNED(pipe)
				&& (!pipe->disconnecting)
				&& (source & pipe->pipe_index_mask)) {
			/* This pipe has an interrupt pending */
			pipe_handler(dev, pipe);
@@ -585,6 +586,7 @@ static void pipe_clear(struct sps_pipe *pipe)
	pipe->mode = -1;
	pipe->num_descs = 0;
	pipe->desc_size = 0;
	pipe->disconnecting = false;
	memset(&pipe->sys, 0, sizeof(pipe->sys));
	INIT_LIST_HEAD(&pipe->sys.events_q);
}
+2 −1
Original line number Diff line number Diff line
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -185,6 +185,7 @@ struct sps_pipe {
	/* System mode control */
	struct sps_bam_sys_mode sys;

	bool disconnecting;
};

/* BAM device descriptor */
+3 −6
Original line number Diff line number Diff line
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -556,11 +556,8 @@ static int sps_rm_free(struct sps_pipe *pipe)
{
	struct sps_connection *map = (void *)pipe->map;
	struct sps_connect *cfg = &pipe->connect;
	struct sps_bam *bam = pipe->bam;
	unsigned long flags;

	mutex_lock(&sps_rm->lock);
	spin_lock_irqsave(&bam->isr_lock, flags);

	/* Free this connection */
	if (cfg->mode == SPS_MODE_SRC)
@@ -574,7 +571,6 @@ static int sps_rm_free(struct sps_pipe *pipe)

	sps_rm_remove_ref(map);

	spin_unlock_irqrestore(&bam->isr_lock, flags);
	mutex_unlock(&sps_rm->lock);

	return 0;
@@ -800,8 +796,9 @@ int sps_rm_state_change(struct sps_pipe *pipe, u32 state)
			synchronize_irq(bam->props.irq);

		spin_lock_irqsave(&bam->isr_lock, flags);
		result = sps_bam_pipe_disconnect(pipe->bam, pipe_index);
		pipe->disconnecting = true;
		spin_unlock_irqrestore(&bam->isr_lock, flags);
		result = sps_bam_pipe_disconnect(pipe->bam, pipe_index);
		if (result) {
			SPS_ERR("sps:Failed to disconnect BAM 0x%x pipe %d",
				pipe->bam->props.phys_addr,