linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Jean Delvare <khali@linux-fr.org>
Cc: Takashi Iwai <tiwai@suse.de>,
	linuxppc-dev@ozlabs.org, alsa-devel@alsa-project.org
Subject: Re: [PATCH] AOA: Convert onyx and tas codecs to new-style i2c   drivers
Date: Thu, 09 Apr 2009 14:34:44 +0200	[thread overview]
Message-ID: <1239280485.4953.6.camel@johannes.local> (raw)
In-Reply-To: <20090409141945.116772e3@hyperion.delvare>

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

Hi Jean,

> OK, I understand how it works now, thanks for pointing me to the
> relevant piece of code. It's easier to modify the code when you
> understand the current logic ;)

:)

> The idea is to assign fixed i2c bus numbers to the relevant i2c buses,
> and declare the i2c devices connected to each bus by bus number and
> device address. The i2c-powermac buses are created in
> arch/powerpc/platforms/powermac/low_i2c.c, so you would have to
> instantiate the i2c devices there too. That would basically mean
> merging part of snd-aoa-fabric-layout into
> arch/powerpc/platforms/powermac/low_i2c.c as I understand it, I don't
> know if this sounds reasonable to you.

That doesn't sound too hot -- the fabric module is quite a lot of code
and data.

> So I think we have two options: switch the powermac systems to fixed
> i2c bus numbers and instantiate the i2c sound devices from
> arch/powerpc/platforms/powermac/*, or find a way to obtain a reference
> to the relevant i2c_adapter.
> 
> I think I have found a way to achieve the latter. This isn't exactly
> how the new model was supposed to work, but it has the advantage to be
> way less intrusive than my original proposal. It may require larger
> changes in the future as the i2c-core cleanups go on, but this should
> do for now.

Heh :)

> My new approach doesn't auto-load anything. Here we go, what you think?
> This time there is no logic change, I'm really only turning legacy code
> into new-style i2c code (basically calling i2c_new_device() instead of
> i2c_attach_client()) and that's about it.
> 
> (Once again this is only build-tested and I would like people with the
> hardware to give it a try.)

Looks reasonable.

>  static int onyx_create(struct i2c_adapter *adapter,
>  		       struct device_node *node,
>  		       int addr)
>  {
> +	struct i2c_board_info info;
> +	struct i2c_client *client;
> +
> +	memset(&info, 0, sizeof(struct i2c_board_info));
> +	strlcpy(info.type, "aoa_codec_onyx", I2C_NAME_SIZE);
> +	if (node) {
> +		info.addr = addr;
> +		info.platform_data = node;
> +		client = i2c_new_device(adapter, &info);
> +	} else {
> +		/* probe both possible addresses for the onyx chip */
> +		unsigned short probe_onyx[] = {
> +			0x46, 0x47, I2C_CLIENT_END
> +		};
> +
> +		client = i2c_new_probed_device(adapter, &info, probe_onyx);
> +	}
> +	if (!client)
> +		return -ENODEV;
> +
> +	list_add_tail(&client->detected, &client->driver->clients);

That list_add looks a little hackish, and wouldn't it be racy?

> +static const struct i2c_device_id onyx_i2c_id[] = {
> +	{ "aoa_codec_onyx", 0 },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(i2c, onyx_i2c_id);

Should it really export the device table?

(same comments for tas)

It'll be until mid next week that I can test anything.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2009-04-09 12:34 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08 13:02 [PATCH] AOA: Convert onyx and tas codecs to new-style i2c drivers Jean Delvare
2009-04-08 15:51 ` Johannes Berg
2009-04-08 20:48   ` Jean Delvare
2009-04-09  7:44     ` Johannes Berg
2009-04-09 12:19       ` Jean Delvare
2009-04-09 12:34         ` Johannes Berg [this message]
2009-04-09 14:21           ` Jean Delvare
2009-04-10 15:02         ` Jean Delvare
2009-04-14 14:37           ` Jean Delvare
2009-04-14 14:45             ` Takashi Iwai
2009-04-16  7:53               ` Jean Delvare
2009-04-16  7:56                 ` Takashi Iwai
2009-04-14 15:40         ` Johannes Berg
2009-04-14 15:50           ` Johannes Berg
2009-04-14 16:57             ` Jean Delvare
2009-04-14 17:41             ` Johannes Berg
2009-04-14 19:49               ` Jean Delvare
2009-04-14 21:59                 ` Johannes Berg
2009-04-15 12:15                   ` Jean Delvare
2009-04-15 12:52                     ` Johannes Berg
2009-04-15 13:06                       ` Jean Delvare
2009-04-15 13:18                         ` Johannes Berg
2009-04-15 13:52                           ` Jean Delvare
2009-04-14 22:48                 ` Andreas Schwab
2009-04-15  8:19                   ` Jean Delvare
2009-04-14 16:48           ` Andreas Schwab
2009-04-14 17:20             ` Johannes Berg
  -- strict thread matches above, loose matches on Subject: below --
2009-04-20 20:54 Jean Delvare
2009-04-20 21:04 ` Johannes Berg
2009-04-21  9:29   ` Jean Delvare
2009-04-21  9:41     ` Johannes Berg
2009-04-21  6:30 ` 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=1239280485.4953.6.camel@johannes.local \
    --to=johannes@sipsolutions.net \
    --cc=alsa-devel@alsa-project.org \
    --cc=khali@linux-fr.org \
    --cc=linuxppc-dev@ozlabs.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).