[linux-dvb] Re: [Patch] Adding support for the Hauppage HVR1100

Patrick Boettcher patrick.boettcher at desy.de
Tue Nov 29 16:40:08 CET 2005


On Tue, 29 Nov 2005, Steve Toth wrote:
> I know, it's a problem. That's why I asked for implementation suggestions 
> late last week.
>
> Two very different parts of the kernel need to use the same PLL. When you're 
> inside the cx22702 driver it's a no brainer, you can toggle the gate. When 
> you're outside of the 702 driver, in tuner.ko, you have no concept of the 
> 702, you only have an I2C bus to operate on. I could not see a nice solution 
> to the problem without a lot of re-engineering.of the kernel tuner support in 
> V4L.
>
> Please, I'm open to ideas.

For me the i2c-gate of the demod is a virtual i2c-bus. When I attach the 
tuner I give it the gated-i2c-bus (I received from the demod) as i2c-bus 
to use for communication. And then the main i2c-master/i2c-adapter is in 
charge for opening/closing the gate of a gate-keeper.

Two small graphs:

          Tuner
            ||
            ||
          Demod  Decoder
            |        |
       +----+--------+
       |
       |
   main_I2C

Maybe a future device :)

          Tuner  Tuner
            ||     ||
            ||     ||
          Demod  Demod
            |      |
       +----+------+
       |
       |
   main_I2C

(just the i2c-bus - no IF-connection) - ||  is the virtual gated-i2c-bus

main_I2C is the i2c-master for the main i2c bus and is also in charge for 
submitting messages to the device behind the gate. When data is 
transferred from or to the device behind the gate, main_I2C has to take 
care that there is only one gate open at a time and that it is the correct 
one - for some tuners it is even necessary to close the gate before 
writing something else on the i2c-bus or when accessing the other tuner 
behind the second demod, which can have the same i2c-address.

pseudo code ahead:

==== init
demod  = init_demod(main_i2c)
gated_i2c = get_virtual_i2c_bus_controlled_by_the_demod(demod);
tuner = init_tuner(gated_i2c);

==== i2c-transfer function

// called when gated_i2c is getting a transfer
demod_i2c_transfer(i2c_adap,msg)
{
 	demod = i2c_adap->priv;

 	msg->need_gate = 1;
 	msg->gate_keeper = demod->gate_keeper;
 	return main_i2c_transfer(demod->i2c_adap,msg);
}

main_i2c_transfer(i2c_adap, msg)
{
 	take_mutex();
 	close_gate_if_open_and different_i2c_address();

 	if (msg->need_gate)
 		open_gate(msg->gate_keeper,msg->i2c_addr);

 	do_actual_transfer();

 	release_mutex();
}

=== end of pseudo code

I did it like this for our local drivers inspired by i2c-structures of the 
kernel. When I will have the time, I will create such a thing at least for 
the devices I have access to for v4l-dvb, but I'm not sure when this will 
be. (Maybe during the next 2 weeks).

On the other hand I don't want to keep back any ideas which are needed 
now.

Please ask if I'm unclear (I'm sure I am).

best regards,
Patrick.

--
   Mail: patrick.boettcher at desy.de
   WWW:  http://www.wi-bw.tfh-wildau.de/~pboettch/



More information about the linux-dvb mailing list