linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Jon Smirl" <jonsmirl@gmail.com>
To: "Grant Likely" <grant.likely@secretlab.ca>
Cc: PowerPC dev list <Linuxppc-dev@ozlabs.org>,
	Timur Tabi <timur@freescale.com>
Subject: Re: Audio codec device tree entries
Date: Wed, 24 Oct 2007 13:01:52 -0400	[thread overview]
Message-ID: <9e4733910710241001g165e7aeatdc92096544fbeb60@mail.gmail.com> (raw)
In-Reply-To: <fa686aa40710240938l5b8c30b9qe538cc641df5e61b@mail.gmail.com>

On 10/24/07, Grant Likely <grant.likely@secretlab.ca> wrote:
> Heh, I'm one of the folks who objected to it; here's what was written:
>
> > > >
> > > > pseudo-sound@0 { // use to trigger loading platform specific fabric driver
> > > >       device_type = "pseudo-sound"
> > > > };
> > >
> > > I don't think this is a good idea.  The device tree is for describing
> > > your hardware; so the layout should reflect that.  Make the platform
> > > code do the right thing with the real nodes.
>
> What I objected to was that the pseudo-sound node didn't contain any
> real information.  It was just being a hook to trigger calling a probe
> function.  If you're going to do that then you might as well just call
> it directly from platform code.

Calling it directly from the platform code is an option, but where
does the fabric driver code live? It doesn't make a lot of sense to
put ALSA code into arch/powerpc/platforms/52xx. I could make a
function call from arch/powerpc/platforms/52xx over to
sound/soc/powerpc but that's not very pretty.

Another option is to make the fabric driver a "struct platform_driver"
instead of a "struct of_platform_driver". "struct platform_driver" is
not being probed in the current mpc5200 code. This option makes senses
to me, "struct platform_driver" will load without a device tree node.
The driver will still need to check and see if it is on the right
platform when more than one is compiled in.

>
> > > For example:
> > > sound@0 {
> > >       compatible = "<mfg>,<board>,sound"   // The board might have
> > > more than one sound i/f which could be wired differently
> > >       codec-handle = <&codec0>;
> > > };
>
> The difference here is that the node provides real information about
> the board.  It has a compatible field which tells you *exactly* what
> sound circuit is present on the board.  It can have additional
> information that does make sense to encode into the device tree (ie.
> the codec that is used).  It's not addressable (no registers or
> anything), but it does describe the board.
>
> It would be possible and reasonable for a single fabric driver to work
> with many different circuit layouts as long as it has the information
> needed to adapt each instance.

That is how the Apple driver is implemented. There is a single fabric
driver that uses layout-id to set everything up to match the physical
PCB.
sound/aoa/fabrics/snd-aoa-fabric-layout.c

But Apple put the layout id down inside the a sound node:
/proc/device-tree/pci@f2000000/mac-io@17/i2s@0/i2s-a@10000/sound:
name             "sound"
device_type      "soundchip"
compatible       "AOAbase"
built-in
layout-id        00000046 (70)
object-model-version 00000002
vendor-id        0000106b (4203)
platform-tas-codec-ref ff98cba8
linux,phandle    ff985d48


>
> >
> > Do you even need the parameters,  how about simply this?
> >
> > sound-fabric {
> > };
>
> But this goes back to having nodes that don't provide any information.
>  You don't want that.
>
> >
> > That will trigger loading all of the sound-fabric drivers built into
> > the kernel. In their probe functions they can look in the device tree
> > and extract the machine name and then decide to stay loaded or fail
> > the probe.
> >
>
> ...
>
> Now is probably a good time to mention that there is *nothing* in the
> device tree that enforces a 1:1 relationship between device tree nodes
> and driver instances.  Sure, it make sense to register the i2s and
> codec drivers from probing on the i2s and codec nodes.  However, there
> is nothing that prevents the codec driver from *also* registering a
> fabric driver based on a property in the codec node or the board-level
> compatible property.

But there is something in the kernel that enforces it. I haven't
checked the powerpc code, but the PCI code won't probe anymore drivers
once one has attached to a device. The rule of one driver per device
is a good one. Places where that rule has been broken have caused a
lot of problems (fbdev vs DRM).

> Fabric drivers are codec specific anyway.  It's not all that
> unrealistic for the device tree binding for a codec to have a list of
> fabric drivers that it can register.

The codec drivers in asoc are completely agnostic. The same codec
driver works on x86, arm, powerpc, etc.


>
> Cheers,
> g.
>
> --
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.
> grant.likely@secretlab.ca
> (403) 399-0195
>


-- 
Jon Smirl
jonsmirl@gmail.com

  parent reply	other threads:[~2007-10-24 17:01 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-23  1:59 Audio codec device tree entries Jon Smirl
2007-10-23  2:57 ` David Gibson
2007-10-23  3:57 ` Grant Likely
2007-10-23  8:06   ` Segher Boessenkool
2007-10-23 15:27 ` Timur Tabi
2007-10-23 16:56   ` Segher Boessenkool
2007-10-23 22:29     ` Jon Smirl
2007-10-24 14:13       ` Timur Tabi
2007-10-24 15:00         ` Jon Smirl
2007-10-24 15:07           ` Timur Tabi
2007-10-24 15:28             ` Grant Likely
2007-10-24 23:52               ` David Gibson
2007-10-24 15:16           ` Grant Likely
2007-10-24 15:20             ` Grant Likely
2007-10-24 15:28               ` Jon Smirl
2007-10-24 15:43                 ` Grant Likely
2007-10-24 15:54                   ` Jon Smirl
2007-10-24 16:01                     ` Timur Tabi
2007-10-24 16:39                       ` Grant Likely
2007-10-24 16:41                         ` Timur Tabi
2007-10-24 16:47                           ` Grant Likely
2007-10-24 16:38                     ` Grant Likely
2007-10-24 16:41                       ` Timur Tabi
2007-10-24 16:52                         ` Grant Likely
2007-10-24 17:01                       ` Jon Smirl [this message]
2007-10-24 17:13                         ` Grant Likely
2007-10-24 17:13                         ` Timur Tabi
2007-10-24 19:31                           ` Jon Smirl
2007-10-24 19:41                             ` Timur Tabi
2007-10-24 19:56                               ` Jon Smirl
2007-10-25  0:04                       ` David Gibson
2007-10-25  0:17                         ` Jon Smirl
2007-10-25  0:38                           ` David Gibson
2007-10-25  3:11                             ` Jon Smirl
2007-10-25 16:14                               ` Timur Tabi
2007-10-24 23:55                     ` David Gibson
2007-10-24 15:23             ` Jon Smirl
2007-10-24 15:40               ` Timur Tabi
2007-10-24 15:54                 ` Grant Likely
2007-10-24 15:08         ` Grant Likely
2007-10-24 15:19           ` Jon Smirl
2007-10-25  0:01             ` David Gibson

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=9e4733910710241001g165e7aeatdc92096544fbeb60@mail.gmail.com \
    --to=jonsmirl@gmail.com \
    --cc=Linuxppc-dev@ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=timur@freescale.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).