hackers at dino.sk
Thu Mar 16 11:35:41 UTC 2006
On Thursday 16 March 2006 11:59, Artem 'ZaZooBred' Ignatiev wrote:
> Hello, hackers!
> As far as I understand, all such cards have the same architecture: there
> is bridge chip (Philips SAA7146) which interfaces with PC (using PCI)
> and tuner on the card (using I2C), so in terms of newbus Properly
> Written (tm) driver must be split in two parts: driver for the SAA7146
> itself (which will be a ``bus-device'') and drivers for specific tuners
> (which will act as a child device on a SAA7146 "bus").
> 1. How to create the bus itself, and properly describe its interfaces?
> skeletons of bus-driver and frontend-drivers would be a GREAT help.
Being far from everything knowing hacker, I just can help with what I found
when working on something totally unrelated.
First you need to write .m file describing your methods - they are class
description, kind of. There are couple of them - maybe PCI analogy (pci_if.m
and pcib_if.m) could help a little to understand their role. Then you can use
these methods in your device_method_t array describing your device. Actually,
these definitions are something like software bus between parent and child
device. And maybe you could get some clue looking at bktr driver, which could
be somehow related to your are of interest.
> 2. SAA7146 uses I2C to communicate with tuners, and I know that there
> are some I2C-related peaces already in kernel. I would like to reuse
> that code, if possible, but can't figure out where to look and how to
> link it in.
There is some basis for i2c, look in /usr/src/sys/dev/iicbus directory. There
are two kinds of i2c controllers - bit banged and full hardware controlled.
The former is easily usable, you need just set and query methods
implementation (look into iicbb_if.m), even if this has not the full i2c
potential, the latter is (at least for me) somewhat hard to understand. I
tried to implement such driver with Geode's Access.BUS controller, but so far
no luck. And no description, google does not help me either.
If SAA7146 uses bit banging interface or can be forced into such mode, you can
do it in small amount of time.
> 3. Card vendors use different PCI_SUBDEVICE on SAA7146 to indicate which
> tuner is (possibly) used. So, I suppose that "bus"-driver shall provide
> some way to tuner-driver to get this information. How that can be done?
This is not that easy to understand at first, but bus 'ivars' are intended for
this purpose. man device_get_ivars would be first step as it was for me to
There is maybe much more into this, but I can comment only on what I
tried/did. Hopefully you could find some usefull info in my writing :)
Please reply only to mailing list. This address is filtered.
More information about the freebsd-hackers