Gerd Knorr writes: > The sub-drivers get passed a pointer to struct bttv_core which should > have everything you need. There are a few helper functions for gpio > access which accept bttv_core to identify the correct card. There is a > pointer to the pci_dev, so you can look for the matching .1 pci function > for ts stream xfer. And also a pointer to i2c_adapter, so you can do > any i2c transfers you want using the usual functions (i2c_master_* in > i2c-core.c).
That only gives access to the already registered i2c_adapter (but a lot cleaner than the present method used to do this). What one needs for properly registering the frontend is access to the dvb_adapter and the i2c_client pointers at the same time. The only place where this happens is in the attach_inform function of the bttv driver. Currently, only the analog tuners and audio controllers are initialized there. So, that's the natural place to also initialize DVB frontends. Of course the dvb_adapter pointer would also have to be part of the bttv structure. Alternative: get the i2c_adapter pointer via sub_device, lock it, (in case of linuxtv driver, change i2c adapter name), scan it for already present clients, init them, somehow add a callback for sub_devices in attach_inform for future attachments, do the same for detachments (if one allows it at all), unlock i2c_adapter. Ralph