[alsa-devel] [PATCH 2/6] ASoC: ux500: Do not clear state if already idle
Lee Jones
lee.jones at linaro.org
Wed May 8 10:04:48 CEST 2013
On Wed, 08 May 2013, Fabio Baltieri wrote:
> As enable_msp gets called only after some audio data has been received,
> if the userspace closes the device before sending any data it causes
> ux500_msp_i2s_close to clear device state even if it was not previously
> initialized.
>
> This in turns leads to some non necessary but harmless writel, but also
Singular ^
> to decrementing the pinctrl usage counter (pinctrl_rxtx_ref) below zero.
>
> To prevent this from happening add a condition to skip register and
> pinctrl clear if current msp state is already MSP_STATE_IDLE.
>
> Signed-off-by: Fabio Baltieri <fabio.baltieri at linaro.org>
> ---
> sound/soc/ux500/ux500_msp_i2s.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c
> index a26c6bf..964cfd6 100644
> --- a/sound/soc/ux500/ux500_msp_i2s.c
> +++ b/sound/soc/ux500/ux500_msp_i2s.c
> @@ -638,7 +638,7 @@ int ux500_msp_i2s_close(struct ux500_msp *msp, unsigned int dir)
> dev_dbg(msp->dev, "%s: Enter (dir = 0x%01x).\n", __func__, dir);
>
> status = disable_msp(msp, dir);
> - if (msp->dir_busy == 0) {
> + if (msp->dir_busy == 0 && msp->msp_state != MSP_STATE_IDLE) {
> /* disable sample rate and frame generators */
> msp->msp_state = MSP_STATE_IDLE;
> writel((readl(msp->registers + MSP_GCR) &
Code looks good though:
Acked-by: Lee Jones <lee.jones at linaro.org>
--
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
More information about the Alsa-devel
mailing list