Subject: Re: autoconf(9) tree in an odd hardware arrangement
To: Marco Trillo <marcotrillo@gmail.com>
From: Quentin Garnier <cube@cubidou.net>
List: tech-kern
Date: 11/25/2007 19:18:08
--Pgaa2uWPnPrfixyx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

First, I apologize if I seem to have missed parts of the discussion.  I
didn't have much time to read the lists, so I'll just make a small point
for now, and catch up later.

On Fri, Nov 23, 2007 at 10:23:15PM +0100, Marco Trillo wrote:
> Hi all,
>=20
> For an experiment, I ran into some sort of, perhaps stupid, autoconf(9)-
> -related doubt.
>=20
> The hardware arrangement looks like this (please excuse the
> poor ASCII drawing):
>=20
>              +------------+
>              |    bus     |
>              +------------+
>      /---------|         |
>      v                   v
> +------------+        +----------+
> |   Audio    |        |   I2C    |
> | controller |        |controller|
> +------------+        +----------+
>   ||                       | (I2C bus)
>   ||                       v
>   ||                   +-------+
>   \\=3D=3D=3D (audio link) =3D=3D| CODEC |->audio out
>                        +-------+
>=20
> The 'doubt' is what is the most clean way to attach an audio(4) bus
> in such an arrangement. Some functions of the audio setup need to
> configure the CODEC via the I2C bus, some functions need to configure
> the 'Audio controller', and some need to configure both devices.
>=20
> A) Attach all the devices. Defer the configuration of the 'Audio
>    controller' with config_defer(9) and then look for the 'CODEC',
>    connect to it, and attach the 'audio' bus:
>=20
>    audio_controller0 at bus0
>    [defers configuration]
>    i2c_controller0 at bus0
>    iic0 at i2c_controller0: I2C bus
>    codec0 at iic0
>    [...]
>    audio_controller0: connecting to codec0
>    audio0 at audio_controller0

This is the best approach, IMO.  As a matter of fact, this is what I did
for attimer/pcppi interaction.

I want to change config_defer(9) to pass the actual device after whose
attachment you want to defer things after, instead of the current
confusing parameter.  That way, as the driver knows more about the
hardware than autoconf(9) can ever guess, it can config_defer(bus)
instead of the (IMO unclear) config_defer(self).

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"See the look on my face from staying too long in one place
[...] every time the morning breaks I know I'm closer to falling"
KT Tunstall, Saving My Face, Drastic Fantastic, 2007.

--Pgaa2uWPnPrfixyx
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (NetBSD)

iQEVAwUBR0m8X9goQloHrPnoAQIYLgf/RGPCzk7twpiXlECPjNT3oTJtUp6JtKaK
kFGBF6cySy/bjL6wylRWUBLtKc+E/ZWKGeUuLCRh27xNq4yMrhD6rhW6RxeAWYe9
xiEuy2HON4+bV3s+oGM8LSMGKPQudod3gl8JdzT5pgZNprglbbBce0GNofLmi7/M
Ipul4/1ZmXho7AKElaaR2YFy25aUViaxfjDVQZSGl1yWfwWJUJ/Zmch9bEtF6A4S
X6vmA0YnvEFWwLV8vp4krmiUKGo9uZ2NVLcckvMJHcvk2lp6sGFNVDvlGeFzwKAC
h+UlRyPG5gyfXqMmXG7lrTFyziJ8BFTyURCjjMUQkQPzQ+hUaXfckg==
=SRhp
-----END PGP SIGNATURE-----

--Pgaa2uWPnPrfixyx--