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

Commit b20aa2b4 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: sps: SPS driver changes for dummy BAM connect"

parents b6110fa7 c889450c
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2017, 2020, 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
@@ -1388,8 +1388,13 @@ int bam_pipe_init(void *base, u32 pipe, struct bam_pipe_parameters *param,
		bam_write_reg_field(base, P_FIFO_SIZES, pipe,
				    P_DATA_FIFO_SIZE, param->data_size);

		bam_write_reg(base, P_EVNT_DEST_ADDR, pipe, peer_dest_addr);

		if (!(param->dummy_peer)) {
			bam_write_reg(base, P_EVNT_DEST_ADDR, pipe,
						peer_dest_addr);
		} else {
			bam_write_reg(base, P_EVNT_DEST_ADDR, pipe,
						param->peer_phys_addr);
		}
		SPS_DBG2(dev,
			"sps:bam=0x%pK(va).pipe=%d.peer_bam=0x%x.peer_pipe=%d.\n",
			dev->base, pipe,
+2 −1
Original line number Diff line number Diff line
/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2017, 2020, 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
@@ -83,6 +83,7 @@ struct bam_pipe_parameters {
	u32 peer_pipe;
	phys_addr_t data_base;	/* Physical address of data FIFO */
	u32 data_size;	/* Size (bytes) of data FIFO */
	bool dummy_peer;
};

/**
+20 −8
Original line number Diff line number Diff line
/* Copyright (c) 2011-2017, 2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2017, 2019-2020, 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
@@ -875,13 +875,15 @@ int sps_bam_pipe_connect(struct sps_pipe *bam_pipe,
	}

	/* Determine operational mode */
	if (other_pipe->bam != NULL) {
	if ((bam_pipe->connect.options & SPS_O_DUMMY_PEER) ||
						other_pipe->bam != NULL) {
		unsigned long iova;
		struct sps_bam *peer_bam = (struct sps_bam *)(other_pipe->bam);
		struct sps_bam *peer_bam;
		/* BAM-to-BAM mode */
		bam_pipe->state |= BAM_STATE_BAM2BAM;
		hw_params.mode = BAM_PIPE_MODE_BAM2BAM;

		if (!(bam_pipe->connect.options & SPS_O_DUMMY_PEER))
			peer_bam = (struct sps_bam *)(other_pipe->bam);
		if (dev->props.options & SPS_BAM_SMMU_EN) {
			if (bam_pipe->mode == SPS_MODE_SRC)
				iova = bam_pipe->connect.dest_iova;
@@ -892,11 +894,21 @@ int sps_bam_pipe_connect(struct sps_pipe *bam_pipe,
				 BAM_ID(dev), pipe_index, (void *)iova);
			hw_params.peer_phys_addr = (u32)iova;
		} else {
			hw_params.peer_phys_addr = peer_bam->props.phys_addr;
		}

			if (!(bam_pipe->connect.options & SPS_O_DUMMY_PEER))
				hw_params.peer_phys_addr =
					peer_bam->props.phys_addr;
		}
		if (!(bam_pipe->connect.options & SPS_O_DUMMY_PEER)) {
			hw_params.peer_phys_addr =
				bam_pipe->connect.destination;
			hw_params.peer_pipe =
				bam_pipe->connect.dest_pipe_index;
		} else {
			hw_params.peer_phys_addr =
					bam_pipe->connect.destination;
			hw_params.peer_pipe = other_pipe->pipe_index;

			hw_params.dummy_peer = true;
		}
		/* Verify FIFO buffers are allocated for BAM-to-BAM pipes */
		if (map->desc.phys_base == SPS_ADDR_INVALID ||
		    map->data.phys_base == SPS_ADDR_INVALID ||
+15 −10
Original line number Diff line number Diff line
/* Copyright (c) 2011-2015, 2017-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2015, 2017-2020, 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
@@ -404,15 +404,19 @@ static struct sps_connection *sps_rm_create(struct sps_pipe *pipe)
		}
	map->src.pipe_index = SPS_BAM_PIPE_INVALID;
	}

	if (!(pipe->connect.options & SPS_O_DUMMY_PEER)) {
		map->dest.bam = sps_h2bam(map->dest.dev);
		if (map->dest.bam == NULL) {
			if (map->dest.dev != SPS_DEV_HANDLE_MEM) {
			SPS_ERR(sps, "sps:Invalid BAM handle: %pK",
				SPS_ERR(sps,
				"sps:Invalid BAM handle: %pK",
				(void *)(&map->dest.dev));
				goto exit_err;
			}
		map->dest.pipe_index = SPS_BAM_PIPE_INVALID;
		}
	}

	/* Check the BAM device for the pipe */
	if ((dir == SPS_MODE_SRC && map->src.bam == NULL) ||
@@ -504,6 +508,7 @@ static struct sps_connection *sps_rm_create(struct sps_pipe *pipe)
		if (map->data.size == SPSRM_CLEAR)
			map->data.size = data_size;
	} else {
		if (!(pipe->connect.options & SPS_O_DUMMY_PEER))
			map->data.size = 0;
	}
	if (map->desc.size > SPSRM_MAX_DESC_FIFO_SIZE) {
+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2017, 2020, 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
@@ -211,6 +211,8 @@ enum sps_option {
	SPS_O_NO_EP_SYNC = 0x40000000,
	/* Allow partial polling duing IRQ mode */
	SPS_O_HYBRID = 0x80000000,
	/* Allow dummy BAM connection */
	SPS_O_DUMMY_PEER = 0x00000400,
};

/**