devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Max Filippov <jcmvbkbc@gmail.com>
Cc: alsa-devel@alsa-project.org,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-xtensa@linux-xtensa.org" <linux-xtensa@linux-xtensa.org>,
	LKML <linux-kernel@vger.kernel.org>, Takashi Iwai <tiwai@suse.de>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Grant Likely <grant.likely@linaro.org>
Subject: Re: [PATCH] ASoC: add xtensa xtfpga I2S interface and platform
Date: Tue, 28 Oct 2014 17:38:53 +0000	[thread overview]
Message-ID: <20141028173853.GD18557@sirena.org.uk> (raw)
In-Reply-To: <CAMo8BfLpJ0bdmaFt9+gLQ_kEjB68XdjAJUw8f8s=Owv46h_yDQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4195 bytes --]

On Tue, Oct 28, 2014 at 08:00:45PM +0300, Max Filippov wrote:
> On Tue, Oct 28, 2014 at 6:42 PM, Mark Brown <broonie@kernel.org> wrote:

> > Then this just shouldn't exist at all, adding Kconfig entries for all
> > the simple-card devices would defeat the point of having simple-card
> > which is why we don't do it for other systems.

> sound/soc/sh/Kconfig does that as well.
> Not having single config item to enable at once all relevant drivers feels
> a bit strange... But ok, I'll drop that.

This is new code, not a replacement of old code.

> > So atomics don't work?  Simple flags are one of the few cases where they
> > might cover it...  again, the fact that this isn't similar to other code
> > doing the same thing is worrying.

> tx_substream use pattern is the same as of a typical RCU variable.
> RCU wrappers combine ACCESS_ONCE and barriers that I'd otherwise
> have to write myself.

You *really* need to explain how it's supposed to work - right now it's
not at all obvious, like I say the fact that this is a rarely used idiom
is not helping.  For example when we tear down the stream we just assign
the pointer in _stop() but don't bother with a sync until the stream is
closed - why?  We also appear to be doing several different dereferences
of the pointer inside a single rcu_read_lock() for some reason which is
worrying.

> >> > I would also expect to see the data transfer and I2S bits more split
> >> > out, presumably this IP can actually be used in designs with a DMA
> >> > controller and one would expect that for practical systems this would be
> >> > the common case?

> >> I don't know of other designs that use this IP block. Can we do it when
> >> we get such users?

> > It's also about ensuring that the code is cleanly split up so that
> > someone can actually go in and add the required support later (and TBH

> Can you point me to an example of such split, so that I don't write it in
> an unusual way?

Essentially all drivers are split this way...

> > it'd be better to just add a DMA controller on the FPGA, everyone will
> > be much happier).

> Hardware people think different and it's been like that for more than 5
> years.

They appear to be the only hardware people who think this way, while we
do have some FIQ based PIO stuff in mainline all the examples I can
think of are there because people didn't work out how to drive the DMA
controller yet (and even there we're using FIQs not bashing things in
from a regular interrupt).

> >> Because this callback is said to be potentially called multiple times per
> >> initialization. Is it not?

> > It can but but I'm not seeing any connection between that and the idea
> > of not keeping the clock enabled when the device isn't in use?

> hw_params callback can change MCLK rate, so it has to disable and
> enable the clock anyway, and since enable can fail it does not guarantee
> that the clock will be left in the same state. Or should I adjust MCLK rate
> w/o disabling the clock?

So yet again: why not just enable the clock only when the device is in
use?  If it's being configured it stands to reason that the device isn't
actively in use...

> > I'm not sure I find that terribly convincing, I'd like to be able to
> > look at the code and tell that it's not going to blow up.  This again
> > comes back to the general comment about clarity - the code *looks*
> > suspicious (strange indentation of the for loop with a comment in the
> > middle of the statement itself for example).

> The level field in the control register is 4 bit wide, so the allowed range of
> level is 0..15. FIFO size is 8192 entries, level = 1 corresponds to
> FIFO size / 2, level = 14 -- to FIFO size of 0. I guess this function
> won't get period_size of 0?

So if the IP gets changed and the code gets blown up this could well
explode then...  which doesn't seem entirely unlikely considering this
is a FPGA platform so presumably this is easy to update.  To repeat this
is about clarity and the code looking like it's probably hiding bugs as
much as if the code actually works if you really sit down and study it.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2014-10-28 17:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27 19:07 [PATCH] ASoC: add xtensa xtfpga I2S interface and platform Max Filippov
2014-10-27 19:32 ` Mark Brown
2014-10-27 20:38   ` Max Filippov
2014-10-28 15:42     ` Mark Brown
2014-10-28 17:00       ` Max Filippov
2014-10-28 17:38         ` Mark Brown [this message]
2014-10-28 18:11           ` Max Filippov
2014-10-28 21:34             ` Mark Brown
2014-10-29 14:19               ` Max Filippov
2014-10-29 14:23           ` Max Filippov
2014-10-29 21:02             ` Mark Brown
2014-10-29 21:10               ` Max Filippov
2014-10-29 21:16                 ` Mark Brown
2014-10-28 15:58 ` [alsa-devel] " Lars-Peter Clausen
     [not found]   ` <544FBD20.5000604-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
2014-10-28 16:04     ` Mark Brown
2014-10-28 16:39       ` Lars-Peter Clausen
2014-10-28 16:47         ` Takashi Iwai
2014-10-28 17:06         ` Mark Brown
2014-10-28 17:16   ` Max Filippov

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=20141028173853.GD18557@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=grant.likely@linaro.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jcmvbkbc@gmail.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=perex@perex.cz \
    --cc=robh+dt@kernel.org \
    --cc=tiwai@suse.de \
    /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).