msm: sps: add the support to reset a pipe

Add the support for BAM client drivers to reset a pipe of a BAM.

CRs-fixed: 659597
Change-Id: I83aaf5c7377b6217647aec3c8f69dc7ed4e10344
Signed-off-by: Yan He <yanhe@codeaurora.org>
This commit is contained in:
Yan He 2014-07-24 18:48:40 -07:00
parent c8abc4ce63
commit 3df955f598
4 changed files with 68 additions and 0 deletions

View File

@ -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
*/

View File

@ -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
*

View File

@ -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_ */

View File

@ -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_ */