public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab•ca>
To: Jon Smirl <jonsmirl@gmail•com>
Cc: liam.girdwood@wolfsonmicro•com, alsa-devel@alsa-project•org,
	broonie@opensource•wolfsonmicro.com, timur@freescale•com,
	linuxppc-dev@ozlabs•org
Subject: Re: [alsa-devel] [PATCH 1/3] ALSA SoC: Add OpenFirmware helper for matching bus and codec drivers
Date: Thu, 3 Jul 2008 10:33:51 -0600	[thread overview]
Message-ID: <20080703163351.GJ2284@secretlab.ca> (raw)
In-Reply-To: <9e4733910807020827k115fe63r7a0dd09daffc1895@mail.gmail.com>

On Wed, Jul 02, 2008 at 11:27:17AM -0400, Jon Smirl wrote:
> On 7/1/08, Grant Likely <grant.likely@secretlab•ca> wrote:
> >  +static struct of_snd_soc_device *
> >  +of_snd_soc_get_device(struct device_node *codec_node)
> >  +{
> >  +       struct of_snd_soc_device *of_soc;
> >  +
> >  +       list_for_each_entry(of_soc, &of_snd_soc_device_list, list) {
> >  +               if (of_soc->codec_node == codec_node)
> >  +                       return of_soc;
> >  +       }
> >  +
> >  +       of_soc = kzalloc(sizeof(struct of_snd_soc_device), GFP_KERNEL);
> >  +       if (!of_soc)
> >  +               return NULL;
> >  +
> >  +       /* Initialize the structure and add it to the global list */
> >  +       of_soc->codec_node = codec_node;
> >  +       of_soc->id = of_snd_soc_next_index++;
> >  +       of_soc->machine.dai_link = &of_soc->dai_link;
> >  +       of_soc->machine.num_links = 1;
> >  +       of_soc->device.machine = &of_soc->machine;
> >  +       of_soc->dai_link.ops = &of_snd_soc_ops;
> >  +       list_add(&of_soc->list, &of_snd_soc_device_list);
> >  +
> >  +       return of_soc;
> >  +}
> 
> Isn't this performing the same basic function as this code (except for
> spi)? Should this list be maintained in alsa or should there be an
> equivalent for searching the spi bus? If you follow the link to the
> codec node and get it's parent you know which bus to search. But it
> might be simpler to just search the buses sequentially for the node.
> 
> static int of_dev_node_match(struct device *dev, void *data)
> {
>         return dev->archdata.of_node == data;
> }
> 
> struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
> {
> 	struct device *dev;
> 	
> 	dev = bus_find_device(&i2c_bus_type, NULL, node,
> 					 of_dev_node_match);
> 	if (!dev)
> 		return NULL;
> 		
> 	return to_i2c_client(dev);
> }
> EXPORT_SYMBOL(of_find_i2c_device_by_node);

Yes, but you hadn't written these functions when I wrote this helper.
:-P.  I believe ASoC v2 makes all this stuff unnecessary, but I'm
waiting for v2 to hit mainline before I port forward.

g.

  reply	other threads:[~2008-07-03 16:34 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-01 23:53 [PATCH 1/3] ALSA SoC: Add OpenFirmware helper for matching bus and codec drivers Grant Likely
2008-07-01 23:53 ` [PATCH 2/3] ALSA SoC: Add mpc5200-psc I2S driver Grant Likely
2008-07-02 10:34   ` [alsa-devel] " Liam Girdwood
2008-07-02 13:51   ` Jon Smirl
2008-07-03 16:28     ` Grant Likely
2008-07-04 11:03       ` Timur Tabi
2008-07-04 14:41         ` Grant Likely
2008-07-05  1:28         ` David Gibson
2008-07-02 15:19   ` Jon Smirl
2008-07-03 16:30     ` Grant Likely
2008-07-06 17:56   ` Jon Smirl
2008-07-07 10:59     ` Mark Brown
2008-07-07 13:23       ` Jon Smirl
2008-07-12  6:26         ` Grant Likely
2008-07-07 16:32   ` Jon Smirl
2008-07-12  6:30     ` Grant Likely
2008-07-09  8:22   ` new to sound world
2008-07-01 23:53 ` [PATCH 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver Grant Likely
2008-07-02 10:48   ` [alsa-devel] " Liam Girdwood
2008-07-12  6:00     ` Grant Likely
2008-07-12 17:36       ` Mark Brown
2008-07-12 18:13         ` Grant Likely
2008-07-17 23:31         ` Grant Likely
2008-07-18  9:58           ` Mark Brown
2008-07-18 16:14             ` Grant Likely
2008-07-02 13:52   ` Jon Smirl
2008-07-02 16:08     ` Liam Girdwood
2008-07-04 20:49   ` Mark Brown
2008-07-04 23:44     ` Grant Likely
2008-07-02  9:50 ` [alsa-devel] [PATCH 1/3] ALSA SoC: Add OpenFirmware helper for matching bus and codec drivers Takashi Iwai
2008-07-02 15:48   ` Grant Likely
2008-07-02 15:57     ` Liam Girdwood
2008-07-02 13:50 ` Jon Smirl
2008-07-02 15:27 ` Jon Smirl
2008-07-03 16:33   ` Grant Likely [this message]
2008-07-04 11:05     ` Timur Tabi

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=20080703163351.GJ2284@secretlab.ca \
    --to=grant.likely@secretlab$(echo .)ca \
    --cc=alsa-devel@alsa-project$(echo .)org \
    --cc=broonie@opensource$(echo .)wolfsonmicro.com \
    --cc=jonsmirl@gmail$(echo .)com \
    --cc=liam.girdwood@wolfsonmicro$(echo .)com \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=timur@freescale$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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