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

Commit b6eea41d authored by Rama Krishna Phani A's avatar Rama Krishna Phani A Committed by Matt Wagantall
Browse files

Revert "msm: sps: Support low memory condition in SPS driver"



In low memory conditions, BAM DMUX is getting time out while
allocating memory through kzalloc. Atomic flag is then used with
kzalloc to avoid delay during memory allocation. However, this
method results in memory allocation failure instead of timeout in
BAM DMUX. Thus, the change here reverts commit
1ac9b940a1e33a8cba64d4d5932944c752af154c.

Change-Id: I64257d30f5f694a212a43ff2ef02d4529b894942
Signed-off-by: default avatarRama Krishna Phani A <rphani@codeaurora.org>
parent 0e88ce3e
Loading
Loading
Loading
Loading
+11 −20
Original line number Diff line number Diff line
@@ -1153,7 +1153,6 @@ int sps_bam_pipe_set_params(struct sps_bam *dev, u32 pipe_index, u32 options)
	int ack_xfers;
	u32 size;
	int n;
	bool atmc_enbl = false;

	/* Capture some options */
	wake_up_is_one_shot = ((options & SPS_O_WAKEUP_IS_ONESHOT));
@@ -1200,25 +1199,10 @@ int sps_bam_pipe_set_params(struct sps_bam *dev, u32 pipe_index, u32 options)
		/* Allocate both descriptor cache and user pointer array */
		size = pipe->num_descs * sizeof(void *);

		if (pipe->desc_size + size <= PAGE_SIZE) {
			if (dev->props.options & SPS_BAM_ATMC_MEM) {
				pipe->sys.desc_cache =
					kzalloc(pipe->desc_size + size,
							GFP_ATOMIC);
				atmc_enbl = true;
			} else {
		if (pipe->desc_size + size <= PAGE_SIZE)
			pipe->sys.desc_cache =
					kzalloc(pipe->desc_size + size,
							GFP_KERNEL);
			}
			if (pipe->sys.desc_cache == NULL) {
				SPS_ERR("sps:BAM %pa pipe %d: %d Atmc = %s\n",
					BAM_ID(dev), pipe_index,
					pipe->desc_size + size ,
					atmc_enbl ? "true" : "false");
				return -ENOMEM;
			}
		} else {
				kzalloc(pipe->desc_size + size, GFP_KERNEL);
		else {
			pipe->sys.desc_cache =
				vmalloc(pipe->desc_size + size);

@@ -1232,6 +1216,13 @@ int sps_bam_pipe_set_params(struct sps_bam *dev, u32 pipe_index, u32 options)
			memset(pipe->sys.desc_cache, 0, pipe->desc_size + size);
		}

		if (pipe->sys.desc_cache == NULL) {
			/*** MUST BE LAST POINT OF FAILURE (see below) *****/
			SPS_ERR("sps:Desc cache error: BAM %pa pipe %d: %d\n",
				BAM_ID(dev), pipe_index,
				pipe->desc_size + size);
			return SPS_ERROR;
		}
		pipe->sys.user_ptrs = (void **)(pipe->sys.desc_cache +
						 pipe->desc_size);
		pipe->sys.cache_offset = pipe->sys.acked_offset;
+0 −2
Original line number Diff line number Diff line
@@ -113,8 +113,6 @@
#define SPS_BAM_SMMU_EN             (1UL << 9)
/* Confirm resource status before access BAM*/
#define SPS_BAM_RES_CONFIRM         (1UL << 7)
/* Verify Low Memory status */
#define SPS_BAM_ATMC_MEM            (1UL << 8)

/* BAM device management flags */