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

Commit 9fdd8d6e 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: add the support to reset a pipe"

parents 6fb48163 3df955f5
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1145,6 +1145,19 @@ u32 bam_check_irq_source(void *base, u32 ee, u32 mask,
	return source;
}

/*
 * Reset a BAM pipe
 */
void bam_pipe_reset(void *base, u32 pipe)
{
	SPS_DBG2("sps:%s:bam=0x%p(va).pipe=%d.", __func__, base, pipe);

	bam_write_reg(base, P_RST, pipe, 1);
	wmb(); /* ensure pipe is reset */
	bam_write_reg(base, P_RST, pipe, 0);
	wmb(); /* ensure pipe reset is de-asserted*/
}

/**
 * Initialize a BAM pipe
 */
+31 −0
Original line number Diff line number Diff line
@@ -2309,6 +2309,37 @@ int sps_timer_ctrl(struct sps_pipe *h,
}
EXPORT_SYMBOL(sps_timer_ctrl);

/*
 * Reset a BAM pipe
 */
int sps_pipe_reset(unsigned long dev, u32 pipe)
{
	struct sps_bam *bam;

	SPS_DBG("sps:%s.", __func__);

	if (!dev) {
		SPS_ERR("sps:%s:BAM handle is NULL.\n", __func__);
		return SPS_ERROR;
	}

	if (pipe >= BAM_MAX_PIPES) {
		SPS_ERR("sps:%s:pipe index is invalid.\n", __func__);
		return SPS_ERROR;
	}

	bam = sps_h2bam(dev);
	if (bam == NULL) {
		SPS_ERR("sps:%s:BAM is not found by handle.\n", __func__);
		return SPS_ERROR;
	}

	bam_pipe_reset(bam->base, pipe);

	return 0;
}
EXPORT_SYMBOL(sps_pipe_reset);

/**
 * Allocate client state context
 *
+8 −0
Original line number Diff line number Diff line
@@ -424,4 +424,12 @@ int sps_map_init(const struct sps_map *map_props, u32 options);
 */
void sps_map_de_init(void);

/*
 * bam_pipe_reset - reset a BAM pipe.
 * @base:	BAM virtual address
 * @pipe:	pipe index
 *
 * This function resets a BAM pipe.
 */
void bam_pipe_reset(void *base, u32 pipe);
#endif	/* _SPSI_H_ */
+16 −0
Original line number Diff line number Diff line
@@ -1347,6 +1347,17 @@ int sps_get_bam_debug_info(unsigned long dev, u32 option, u32 para,
 *
 */
int sps_ctrl_bam_dma_clk(bool clk_on);

/*
 * sps_pipe_reset - reset a pipe of a BAM.
 * @dev:	BAM device handle
 * @pipe:	pipe index
 *
 * This function resets a pipe of a BAM.
 *
 * Return: 0 on success, negative value on error
 */
int sps_pipe_reset(unsigned long dev, u32 pipe);
#else
static inline int sps_register_bam_device(const struct sps_bam_props
			*bam_props, unsigned long *dev_handle)
@@ -1514,6 +1525,11 @@ static inline int sps_ctrl_bam_dma_clk(bool clk_on)
{
	return -EPERM;
}

static inline int sps_pipe_reset(unsigned long dev, u32 pipe)
{
	return -EPERM;
}
#endif

#endif /* _SPS_H_ */