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

Commit 3fec3dfe authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: sps: update SPS logging"

parents ec232ec8 47c4ac35
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2016, 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
@@ -1505,8 +1505,10 @@ void bam_pipe_set_irq(void *base, u32 pipe, enum bam_enable irq_en,
				__func__, base);
		return;
	}
	SPS_DBG2(dev, "sps:%s:bam=%pa 0x%p(va).pipe=%d.",
			__func__, BAM_ID(dev), dev->base, pipe);
	SPS_DBG2(dev,
		"sps:%s:bam=%pa 0x%p(va).pipe=%d; irq_en:%d; src_mask:0x%x; ee:%d.\n",
			__func__, BAM_ID(dev), dev->base, pipe,
			irq_en, src_mask, ee);
	if (src_mask & BAM_PIPE_IRQ_RST_ERROR) {
		if (enhd_pipe)
			bam_write_reg_field(base, IRQ_EN, 0,
+10 −6
Original line number Diff line number Diff line
/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2016	, 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
@@ -1825,8 +1825,10 @@ int sps_get_config(struct sps_pipe *h, struct sps_connect *config)
	if (pipe->bam == NULL)
		SPS_DBG(sps, "sps:%s.\n", __func__);
	else
	SPS_DBG(pipe->bam, "sps:%s; BAM: %pa; pipe index:%d.\n",
		__func__, BAM_ID(pipe->bam), pipe->pipe_index);
		SPS_DBG(pipe->bam,
			"sps:%s; BAM: %pa; pipe index:%d; options:0x%x.\n",
			__func__, BAM_ID(pipe->bam), pipe->pipe_index,
			pipe->connect.options);

	/* Copy current client connection state */
	*config = pipe->connect;
@@ -1854,11 +1856,13 @@ int sps_set_config(struct sps_pipe *h, struct sps_connect *config)
	}

	bam = sps_bam_lock(pipe);
	if (bam == NULL)
	if (bam == NULL) {
		SPS_ERR(sps, "sps:%s:BAM is NULL.\n", __func__);
		return SPS_ERROR;
	}

	SPS_DBG(bam, "sps:%s; BAM: %pa; pipe index:%d.\n",
		__func__, BAM_ID(bam), pipe->pipe_index);
	SPS_DBG(bam, "sps:%s; BAM: %pa; pipe index:%d, config-options:0x%x.\n",
		__func__, BAM_ID(bam), pipe->pipe_index, config->options);

	result = sps_bam_pipe_set_params(bam, pipe->pipe_index,
					 config->options);
+61 −5
Original line number Diff line number Diff line
/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2016, 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
@@ -840,6 +840,11 @@ int sps_bam_pipe_connect(struct sps_pipe *bam_pipe,
	/* Process map parameters */
	dev = map_pipe->bam;
	pipe_index = map_pipe->pipe_index;

	SPS_DBG2(dev,
		"sps:BAM %pa; pipe %d; mode:%d; options:0x%x.\n",
		BAM_ID(dev), pipe_index, params->mode, params->options);

	if (pipe_index >= dev->props.num_pipes) {
		SPS_ERR(dev, "sps:Invalid BAM %pa pipe: %d\n", BAM_ID(dev),
				pipe_index);
@@ -1046,6 +1051,11 @@ int sps_bam_pipe_connect(struct sps_pipe *bam_pipe,
	dev->pipe_active_mask |= 1UL << pipe_index;
	list_add_tail(&bam_pipe->list, &dev->pipes_q);

	SPS_DBG2(dev,
		"sps:BAM %pa; pipe %d; pipe_index_mask:0x%x; pipe_active_mask:0x%x.\n",
		BAM_ID(dev), pipe_index,
		bam_pipe->pipe_index_mask, dev->pipe_active_mask);

	bam_pipe->state |= BAM_STATE_INIT;
	result = 0;
exit_err:
@@ -1138,6 +1148,11 @@ static void pipe_set_irq(struct sps_bam *dev, u32 pipe_index,
	struct sps_pipe *pipe = dev->pipes[pipe_index];
	enum bam_enable irq_enable;

	SPS_DBG2(dev,
		"sps:BAM:%pa; pipe %d; poll:%d, irq_mask:0x%x; pipe state:0x%x; dev state:0x%x.\n",
		BAM_ID(dev), pipe_index, poll, pipe->irq_mask,
		pipe->state, dev->state);

	if (poll == 0 && pipe->irq_mask != 0 &&
	    (dev->state & BAM_STATE_IRQ)) {
		if ((pipe->state & BAM_STATE_BAM2BAM) != 0 &&
@@ -1184,6 +1199,9 @@ int sps_bam_pipe_set_params(struct sps_bam *dev, u32 pipe_index, u32 options)
	u32 size;
	int n;

	SPS_DBG2(dev, "sps:BAM %pa pipe %d opt 0x%x\n",
		BAM_ID(dev), pipe_index, options);

	/* Capture some options */
	wake_up_is_one_shot = ((options & SPS_O_WAKEUP_IS_ONESHOT));
	no_queue = ((options & SPS_O_NO_Q));
@@ -1749,6 +1767,9 @@ static void pipe_handler_wakeup(struct sps_bam *dev, struct sps_pipe *pipe)
	u32 pipe_index = pipe->pipe_index;

	if (pipe->wake_up_is_one_shot) {
		SPS_DBG2(dev,
			"sps:BAM:%pa pipe %d wake_up_is_one_shot; irq_mask:0x%x.\n",
			BAM_ID(dev), pipe_index, pipe->irq_mask);
		/* Disable the pipe WAKEUP interrupt source */
		pipe->irq_mask &= ~BAM_PIPE_IRQ_WAKE;
		pipe_set_irq(dev, pipe_index, pipe->polled);
@@ -1790,13 +1811,17 @@ static void pipe_handler_eot(struct sps_bam *dev, struct sps_pipe *pipe)
	u32 enabled;
	int producer = (pipe->mode == SPS_MODE_SRC);

	if (pipe->sys.handler_eot)
	if (pipe->sys.handler_eot) {
		/*
		 * This can happen if the pipe is configured for polling
		 * (IRQ disabled) and callback event generation.
		 * The client may perform a get_iovec() inside the callback.
		 */
		SPS_DBG(dev,
			"sps:%s; still handling EOT for pipe %d.\n",
			__func__, pipe->pipe_index);
		return;
	}

	pipe->sys.handler_eot = true;

@@ -1835,6 +1860,9 @@ static void pipe_handler_eot(struct sps_bam *dev, struct sps_pipe *pipe)
			pipe->sys.acked_offset = end_offset;
		}
		pipe->sys.handler_eot = false;
		SPS_DBG(dev,
			"sps:%s; pipe %d has no queue.\n",
			__func__, pipe->pipe_index);
		return;
	}

@@ -1853,6 +1881,9 @@ static void pipe_handler_eot(struct sps_bam *dev, struct sps_pipe *pipe)
	/* Are there any completed descriptors to process? */
	if (offset == end_offset) {
		pipe->sys.handler_eot = false;
		SPS_DBG(dev,
			"sps:%s; there is no completed desc to process for pipe %d.\n",
			__func__, pipe->pipe_index);
		return;
	}

@@ -1903,9 +1934,10 @@ static void pipe_handler_eot(struct sps_bam *dev, struct sps_pipe *pipe)
	user = &pipe->sys.user_ptrs[offset / sizeof(struct sps_iovec)];
	for (;;) {
		SPS_DBG(dev,
			"sps:%s; pipe index:%d; iovec addr:0x%x; size:0x%x; flags:0x%x.\n",
			"sps:%s; pipe index:%d; iovec addr:0x%x; size:0x%x; flags:0x%x; enabled:0x%x; *user is %s NULL.\n",
			__func__, pipe->pipe_index, cache->addr,
			cache->size, cache->flags);
			cache->size, cache->flags, enabled,
			(*user == NULL) ? "" : "not");

		/*
		 * Increment offset to next descriptor and update pipe offset
@@ -1945,6 +1977,10 @@ static void pipe_handler_eot(struct sps_bam *dev, struct sps_pipe *pipe)
				event->notify.event_id = event_id;
				event->notify.user = event_reg->user;
				trigger_event(dev, pipe, event_reg, event);
			} else {
				SPS_ERR(dev,
					"sps: %s: pipe %d: event is NULL.\n",
					__func__, pipe->pipe_index);
			}
#ifdef SPS_BAM_STATISTICS
			if (*user != NULL)
@@ -2149,8 +2185,13 @@ int sps_bam_pipe_get_iovec(struct sps_bam *dev, u32 pipe_index,
	}

	/* If pipe is polled and queue is enabled, perform polling operation */
	if ((pipe->polled || pipe->hybrid) && !pipe->sys.no_queue)
	if ((pipe->polled || pipe->hybrid) && !pipe->sys.no_queue) {
		SPS_DBG(dev,
			"sps:%s; BAM: %pa; pipe index:%d; polled is %d; hybrid is %d.\n",
			__func__, BAM_ID(dev), pipe_index,
			pipe->polled, pipe->hybrid);
		pipe_handler_eot(dev, pipe);
	}

	/* Is there a completed descriptor? */
	if (pipe->sys.no_queue)
@@ -2162,6 +2203,9 @@ int sps_bam_pipe_get_iovec(struct sps_bam *dev, u32 pipe_index,
	if (read_offset == pipe->sys.acked_offset) {
		/* No, so clear the iovec to indicate FIFO is empty */
		memset(iovec, 0, sizeof(*iovec));
		SPS_DBG(dev,
			"sps:%s; BAM: %pa; pipe index:%d; no iovec to process.\n",
			__func__, BAM_ID(dev), pipe_index);
		return 0;
	}

@@ -2178,6 +2222,11 @@ int sps_bam_pipe_get_iovec(struct sps_bam *dev, u32 pipe_index,
	if (pipe->sys.acked_offset >= pipe->desc_size)
		pipe->sys.acked_offset = 0;

	SPS_DBG(dev,
		"sps:%s; pipe index:%d; iovec addr:0x%x; size:0x%x; flags:0x%x; acked_offset:0x%x.\n",
		__func__, pipe->pipe_index, desc->addr,
		desc->size, desc->flags, pipe->sys.acked_offset);

	return 0;
}

@@ -2217,6 +2266,9 @@ int sps_bam_pipe_is_empty(struct sps_bam *dev, u32 pipe_index,
	} else {
		if ((pipe->state & BAM_STATE_BAM2BAM) == 0) {
			*empty = false;
			SPS_DBG1(dev,
				"sps:%s; pipe index:%d; this sys2bam pipe is NOT empty.\n",
				__func__, pipe->pipe_index);
			return 0;
		}
		if (bam_pipe_check_zlt(&dev->base, pipe_index)) {
@@ -2244,6 +2296,10 @@ int sps_bam_pipe_is_empty(struct sps_bam *dev, u32 pipe_index,
		}
	}

	SPS_DBG1(dev,
		"sps:%s; pipe index:%d; this pipe is %s empty.\n",
		__func__, pipe->pipe_index, *empty ? "" : "NOT");

	return 0;
}