From patchwork Wed Apr 5 10:32:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 96834 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp196598qgd; Wed, 5 Apr 2017 03:35:05 -0700 (PDT) X-Received: by 10.99.170.70 with SMTP id x6mr29611564pgo.111.1491388505802; Wed, 05 Apr 2017 03:35:05 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l9si20203815pfi.300.2017.04.05.03.35.05; Wed, 05 Apr 2017 03:35:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932691AbdDEKec (ORCPT + 6 others); Wed, 5 Apr 2017 06:34:32 -0400 Received: from mail-pg0-f46.google.com ([74.125.83.46]:33865 "EHLO mail-pg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933466AbdDEKdZ (ORCPT ); Wed, 5 Apr 2017 06:33:25 -0400 Received: by mail-pg0-f46.google.com with SMTP id 21so6030517pgg.1 for ; Wed, 05 Apr 2017 03:33:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=npA6z32Ekq1KR9faVmOm9RjjDwIR5Sp0t0EtlJQILWc=; b=kHTYY5aDxSJEEGYNVx4hau+R71z8yY9i37t6Gbijn5L+5yXixXBu15VIfvAsI6VuQz 4ALXonKxFc/O6rPdoMGU+CmlO/Kf4kBT8rp6cGn5Fi9nMc4pY1faIcOOu1Sh3C1ZmJAY 4nxVtloSPNeQ1bpqM4DJTfwYWPeCpd7ogERP4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=npA6z32Ekq1KR9faVmOm9RjjDwIR5Sp0t0EtlJQILWc=; b=ahP2EGa/w7C3szHnnlp3MqxIMsLyPbz9X7ZfzMInD5kDx+LWU/3/c/BJ49l2w/MXZW RC1yOvhH9TsJvyON83zK+8AWQJFJ68r7W7RlY8zv4pZ4TFl9cS5yNrrxFAEpXan87i5c FEaGX5xsh0KNW5WCyCQCPPvmPATp7iOeT7gd76gtUe7fvvN4nO/DcNwEO8ndTdTTvlGv njXtr7aujlRgCc++tTMOM3LZPXn2KpWJ0mcShRW45a+jUL+7bUUGQqu9v/PqpkPWr1L8 /IAy8CMjm4m4tApi3oDWuCJovYvvmiYeSjw9G9pSkrPe6DALzjUB8c8fSUVRzA/PMcna SL1w== X-Gm-Message-State: AFeK/H37pTQR5mqF8TZUGuQwWqF6HOmib9vheD4hHh+BaZ5iWCUlQ8JKfusNW3d2gCWVovgn X-Received: by 10.99.106.138 with SMTP id f132mr28850858pgc.66.1491388379956; Wed, 05 Apr 2017 03:32:59 -0700 (PDT) Received: from localhost.localdomain ([106.51.240.246]) by smtp.gmail.com with ESMTPSA id a62sm36732075pgc.60.2017.04.05.03.32.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 05 Apr 2017 03:32:59 -0700 (PDT) From: Amit Pundir To: stable@vger.kernel.org Cc: gregkh@linuxfoundation.org, Matthias Reichl , Martin Sperl , Vinod Koul Subject: [PATCH v2 for-4.9 15/32] dmaengine: bcm2835: Fix cyclic DMA period splitting Date: Wed, 5 Apr 2017 16:02:07 +0530 Message-Id: <1491388344-13521-16-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491388344-13521-1-git-send-email-amit.pundir@linaro.org> References: <1491388344-13521-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Matthias Reichl The code responsible for splitting periods into chunks that can be handled by the DMA controller missed to update total_len, the number of bytes processed in the current period, when there are more chunks to follow. Therefore total_len was stuck at 0 and the code didn't work at all. This resulted in a wrong control block layout and audio issues because the cyclic DMA callback wasn't executing on period boundaries. Fix this by adding the missing total_len update. Signed-off-by: Matthias Reichl Signed-off-by: Martin Sperl Tested-by: Clive Messer Reviewed-by: Eric Anholt Signed-off-by: Vinod Koul (cherry picked from commit 2201ac6129fa162ac24da089a034bb0971648ebb) Signed-off-by: Amit Pundir --- drivers/dma/bcm2835-dma.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c index e18dc59..6204cc3 100644 --- a/drivers/dma/bcm2835-dma.c +++ b/drivers/dma/bcm2835-dma.c @@ -251,8 +251,11 @@ static void bcm2835_dma_create_cb_set_length( */ /* have we filled in period_length yet? */ - if (*total_len + control_block->length < period_len) + if (*total_len + control_block->length < period_len) { + /* update number of bytes in this period so far */ + *total_len += control_block->length; return; + } /* calculate the length that remains to reach period_length */ control_block->length = period_len - *total_len;