linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Tomoya MORINAGA <tomoya.rohm@gmail.com>
Cc: Liam Girdwood <lrg@ti.com>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Dimitris Papastamos <dp@opensource.wolfsonmicro.com>,
	Mike Frysinger <vapier@gentoo.org>,
	Daniel Mack <zonque@gmail.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	qi.wang@intel.com, yong.y.wang@intel.com, joel.clark@intel.com,
	kok.howg.ewe@intel.com
Subject: Re: [PATCH 3/3 v2] sound/soc/lapis: add platform driver for ML7213 IOH I2S
Date: Thu, 22 Dec 2011 00:58:16 +0000	[thread overview]
Message-ID: <20111222005816.GB27144@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <CANKRQng8N3oS2o17HPUZeonXB3KLBK9oNQj-zd9+aUUvWcTo0A@mail.gmail.com>

On Wed, Dec 21, 2011 at 08:22:56PM +0900, Tomoya MORINAGA wrote:
> 2011/12/20 Mark Brown <broonie@opensource.wolfsonmicro.com>:
> > On Tue, Dec 20, 2011 at 11:45:44AM +0900, Tomoya MORINAGA wrote:

> >> +     iowrite32(I2S_TX_FINT | I2S_TX_AFINT | I2S_TX_EINT | I2S_TX_AEINT,
> >> +             i2s_data->iobase + I2SISTTX_OFFSET + offset);

> > This appears to unconditionally acknowledge all interrupts, generally
> > you should only acknowledge interrupts that have been handled.
> > Otherwise it's possible that interrupts may be dropped if they're
> > flagged between the status read and acknowledgement write.

> I can understand your saying.
> If following your saying, only called by i2s_dma_tx_complete is enough.

> However I think adding clearing interrupt status at both before and
> after i2s communicating start/finish is better.

No, the issue is that you're acknowleding a hard coded set of
interrupts, not the interrupts that were actually handled.  The ordering
isn't really the issue, the issue is that you could acknowledge things
that weren't handled.  For example:

   1. ISR runs, reads status A
   2. Condition B happens
   3. ISR handles condition A.
   4. ISR acknowledges both A and B.

would mean that B would just get ignored.

> >> +static bool filter(struct dma_chan *chan, void *slave)

> > This needs a better name.  It's not namespaced and it's not clear what
> > it's filtering.

> In case of using Linux standard DMA API, function "filter" is the most
> popular name.
> Almost drivers which use standard use "filter".

I suspect they may have the filter immediately next to the code that
uses it, which certainly isn't the case here.

> >> +ioh_i2s_write(struct snd_pcm_substream *substream, const void *data, int len)
> >> +{
> >> +     int rem1;
> >> +     int rem2;

> > What is this supposed to do?  There's an awful lot of it, and it looks
> > like it's supposed to be rewriting the data format for some reason which
> > isn't something that a driver ought to be doing (apart from anything
> > else it does rather defeat the point of DMA).

> This driver has buffer which is for preventing noisy sound  by jitter
> So, this buffer is variable.

You're implementing some sort of custom buffering in your driver?  That
sounds terribly unidiomatic - pretty much all DMA drivers are very thin
and manage to work well, I'd expect this is masking some problems in the
code rather than anything else.  Can you provide more detail on what
this is working around?

> >> +     num = ((int)dma->tx_avail) / (I2S_AEMPTY_THRESH * 4);

> > That case looks *very* suspect.

> This is correct.
> Why do you think so ?

I can't tell what it's supposed to do, and casting that isn't super
clear especially casting to integer types tends to be a big red flag.

  reply	other threads:[~2011-12-22  0:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-20  2:45 [PATCH 1/3 v5] sound/soc/codecs: add LAPIS Semiconductor ML26124 Tomoya MORINAGA
2011-12-20  2:45 ` [PATCH 2/3 v4] sound/soc/lapis: add machine driver for ML7213 Carrier Board Tomoya MORINAGA
2011-12-20 10:45   ` Mark Brown
2011-12-20  2:45 ` [PATCH 3/3 v2] sound/soc/lapis: add platform driver for ML7213 IOH I2S Tomoya MORINAGA
2011-12-20 13:23   ` Mark Brown
2011-12-21 11:22     ` Tomoya MORINAGA
2011-12-22  0:58       ` Mark Brown [this message]
2011-12-22  8:10         ` Tomoya MORINAGA
2011-12-22 10:39           ` Mark Brown
2011-12-26  6:33             ` Tomoya MORINAGA
2011-12-26 12:12               ` Mark Brown
2011-12-27  1:25                 ` Tomoya MORINAGA
2011-12-27 17:33                   ` Mark Brown
2011-12-20 10:40 ` [PATCH 1/3 v5] sound/soc/codecs: add LAPIS Semiconductor ML26124 Mark Brown
2011-12-22  8:31   ` Tomoya MORINAGA
2011-12-22 10:50     ` Mark Brown
2011-12-20 10:42 ` Mark Brown

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=20111222005816.GB27144@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=dp@opensource.wolfsonmicro.com \
    --cc=joel.clark@intel.com \
    --cc=kok.howg.ewe@intel.com \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=perex@perex.cz \
    --cc=qi.wang@intel.com \
    --cc=tiwai@suse.de \
    --cc=tomoya.rohm@gmail.com \
    --cc=vapier@gentoo.org \
    --cc=yong.y.wang@intel.com \
    --cc=zonque@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).