On 03/02/2017 03:52 AM, Bin Liu wrote:
> The CPPI41 driver polls register to workaround the pre-mature TX
> interrupt issue, but it causes audio playback underrun when triggered in
> Isoch transfers.
> 
> Isoch doesn't do back-to-back transfers, the TX should be done by the
> time the next transfer is scheduled. So skip this polling workaround for
> Isoch transfer.
> 
> Fixes: a655f481d83d6 ("usb: musb: musb_cppi41: handle pre-mature TX complete 
> interrupt")
> Cc: <sta...@vger.kernel.org> #4.1+
> Reported-by: Alexandre Bailon <abai...@baylibre.com>
> Signed-off-by: Bin Liu <b-...@ti.com>
> ---
>  drivers/usb/musb/musb_cppi41.c | 23 +++++++++++++++++++++--
>  1 file changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
> index 00e272bfee39..355655f8a3fb 100644
> --- a/drivers/usb/musb/musb_cppi41.c
> +++ b/drivers/usb/musb/musb_cppi41.c
> @@ -238,8 +238,27 @@ static void cppi41_dma_callback(void *private_data,
>                       transferred < cppi41_channel->packet_sz)
>               cppi41_channel->prog_len = 0;
>  
> -     if (cppi41_channel->is_tx)
> -             empty = musb_is_tx_fifo_empty(hw_ep);
> +     if (cppi41_channel->is_tx) {
> +             u8 type;
> +
> +             if (is_host_active(musb))
> +                     type = hw_ep->out_qh->type;
> +             else
> +                     type = hw_ep->ep_in.type;
> +
> +             if (type == USB_ENDPOINT_XFER_ISOC)
> +                     /*
> +                      * Don't use the early-TX-interrupt workaround below
> +                      * for Isoch transfter. Since Isoch are periodic
> +                      * transfer, by the time the next transfer is
> +                      * scheduled, the current one should be done already.
> +                      *
> +                      * This avoids audio playback underrun issue.
> +                      */
> +                     empty = true;
> +             else
> +                     empty = musb_is_tx_fifo_empty(hw_ep);
> +     }
>  
>       if (!cppi41_channel->is_tx || empty) {
>               cppi41_trans_done(cppi41_channel);
> 

Tested on omapl138-lcdk and it significantly decreases the cpu load
and then fixes the underruns.

Tested-by: Alexandre Bailon <abai...@baylibre.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to