mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
To: linux-kernel@vger.kernel.org
Cc: Hans-Christian Egtvedt <hcegtvedt@atmel.com>,
	Haavard Skinnemoen <hskinnemoen@atmel.com>,
	Andrew Victor <avictor.za@gmail.com>
Subject: [PATCH] at73c213: Fix DMA size at the end of DMA buffer
Date: Mon, 10 Mar 2008 23:43:06 +0900 (JST)	[thread overview]
Message-ID: <20080310.234306.15242180.anemo@mba.ocn.ne.jp> (raw)

The interrupt handler always provide runtime->period_size data, but it
should provide additional residual data when the pointer back to zero.

This patch fixes periodic click noise when runtime->buffer_size was
not multiple of runtime->period_size.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
This patch depends on a patch titled "at73c213: Monaural support".

diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c
index 7c077c6..d614a8c 100644
--- a/sound/spi/at73c213.c
+++ b/sound/spi/at73c213.c
@@ -355,6 +355,7 @@ static irqreturn_t snd_at73c213_interrupt(int irq, void *dev_id)
 	u32 status;
 	int offset;
 	int block_size;
+	int size;
 	int next_period;
 	int retval = IRQ_NONE;
 
@@ -372,11 +373,14 @@ static irqreturn_t snd_at73c213_interrupt(int irq, void *dev_id)
 			next_period = 0;
 
 		offset = block_size * next_period;
+		size = runtime->period_size * runtime->channels;
+		if (next_period == runtime->periods - 1)
+			size += (runtime->buffer_size % runtime->period_size)
+				* runtime->channels;
 
 		ssc_writel(chip->ssc->regs, PDC_TNPR,
 				(long)runtime->dma_addr + offset);
-		ssc_writel(chip->ssc->regs, PDC_TNCR,
-				runtime->period_size * runtime->channels);
+		ssc_writel(chip->ssc->regs, PDC_TNCR, size);
 		retval = IRQ_HANDLED;
 	}
 

             reply	other threads:[~2008-03-10 14:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-10 14:43 Atsushi Nemoto [this message]
2008-03-14  9:44 ` Haavard Skinnemoen
2008-03-14 13:29   ` Atsushi Nemoto
2008-03-14 13:39     ` Takashi Iwai
2008-03-17 13:00       ` Atsushi Nemoto
2008-03-17 13:21         ` Takashi Iwai
2008-03-17 13:32           ` Atsushi Nemoto
2008-03-17 13:54             ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080310.234306.15242180.anemo@mba.ocn.ne.jp \
    --to=anemo@mba.ocn.ne.jp \
    --cc=avictor.za@gmail.com \
    --cc=hcegtvedt@atmel.com \
    --cc=hskinnemoen@atmel.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®