Acquiring an i2c adapter.
Hello,
I've resolved my trouble with the aparently deprecated function i2c_get_client. One response I had indicated it was no longer used because of locking issues.
The method I'm using is to attach a dummy driver to the adapter I'm interested in, the i2c-voodoo3 module, then use a derivative of the i2c_clients_command function.
At present in the 2.4 kernel, my i2c_driver->attach_adapter function has to do a string cmp on the adapter name to get the right adapter. The i2c-voodoo3 module provides an i2c and a ddc bus, and there is no other way to distinguish them.
This can all be found in the voodoo-i2c.c file at the v3tv site below. This file still has optional support for the v3tv-i2c_adapter, with the
INCLUDE_I2C define.
I'm confused by the i2c_get_adapter function. The prototype has an argument called 'id' yet the function examines the 'nr' member of the i2c_adapter struct.
I was going to use i2c_get_adapter, but would be better served if adapters could be identified by the 'class' field, which would be I2C_ADAP_CLASS_TV_ANALOG for the v3tv, bttv and family.
What is the actual intent of the i2c_get_adapter function?
Thanks,
Perry
-----
V3TV: http://gilfillan.org:8000/v3tv/
VPX3224: http://gilfillan.org:8000/vpx3224/
Quoted 2 lines
We've been wondering over here at sensors what the point was of unique IDs. nobody seemed to use them.
I think we have to make a difference between adapters and chips here. It looks quite obvious that adapters' IDs may have a use (as this is the case now). What I think Greg was suggesting is that we could drop IDs of _chip_ drivers, because those will hardly ever get used.
Although, I don't think was thinking of deleting the id field in the structure definition, only not to fill them when we don't need to. As time passes, I tend to agree more and more. I just have some difficulties submitting a driver with no ID, because they all have one in both 2.4 and 2.6 so it feels strange to change now. But I admit it isn't rational.
I think it would be acceptable to stop filling the id field by default, and only fill them when we need them to be filled.
Quoted 3 lines
Your application is an obvious example of their purpose.
On the Voodoo, the DDC bus should have a separate ID from the I2C bus. Then you could distinguish them without a strcmp.
Correct.
Quoted 1 line
Perhaps we should add IDs to 2.6?
And have 2 different IDs in the 2.4 driver as well, for we want to be consistent.
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
Sorry I didn't answer your first query.
We've been wondering over here at sensors what the point was of unique IDs. nobody seemed to use them.
Your application is an obvious example of their purpose.
On the Voodoo, the DDC bus should have a separate ID from the I2C bus. Then you could distinguish them without a strcmp.
Perhaps we should add IDs to 2.6?
As for the dummy driver, it sounds strange at first but is probably the best way to do it.
Quoted 38 lines · Perry Gilfillan
Hello,
I've resolved my trouble with the aparently deprecated function
i2c_get_client. One response I had indicated it was no longer used because of locking issues.The method I'm using is to attach a dummy driver to the adapter I'm interested in, the i2c-voodoo3 module, then use a derivative of the
i2c_clients_commandfunction.At present in the 2.4 kernel, my
i2c_driver->attach_adapterfunction has to do a string cmp on the adapter name to get the right adapter. The i2c-voodoo3 module provides an i2c and a ddc bus, and there is no other way to distinguish them.This can all be found in the
voodoo-i2c.cfile at the v3tv site below. This file still has optional support for the v3tv-i2c_adapter, with the
INCLUDE_I2Cdefine.I'm confused by the
i2c_get_adapterfunction. The prototype has an argument called 'id' yet the function examines the 'nr' member of thei2c_adapterstruct.I was going to use
i2c_get_adapter, but would be better served if adapters could be identified by the 'class' field, which would beI2C_ADAP_CLASS_TV_ANALOGfor the v3tv, bttv and family.What is the actual intent of the
i2c_get_adapterfunction?Thanks,
Perry
-----
V3TV: http://gilfillan.org:8000/v3tv/
VPX3224: http://gilfillan.org:8000/vpx3224/
Quoted 13 lines · Perry Gilfillan
Mark,
I'm still trying to sort out where the various flags fit in.
I know that the I2C_ADAP_CLASS_* will simplify things in the 2.6 kernel, and there is a small but useful set of defines to work with. The i2c and ddc bus provided by the i2c-voodoo3 are covered here. I've already sent along a patch to Greg KH, and he has applied it.
In the 2.4 kernel, we have too many choices... There is a plethora of I2C_DRIVERID_* defines, yet none for the Voodoo3 yet. My confusion may be that I'm thinking of using a client driver id on the adapter?
Quoted 8 lines
Does the
i2c_adapter->idindicate the algorithim? Greg KH indicated thatI2C_HW_B_VOOwas more correct thanI2C_HW_SMBUS_VOODOO3, but that this was not the place to distinguish the i2c from the ddc.If I read right, the
i2c_bit_add_busfunction or's adap.id with i2c_bit_algo.id yeildingI2C_HW_B_VOO|I2C_ALGO_BIT, which I test for in my dummy driver attach function, and then do the strnicmp.
That's the right way to do it now.
I was arguing for a second ID for the DDC bus but I guess I need to understand Greg's objections.
Quoted 8 lines
The other clients that attach to the i2c-voodoo3's adapters test for a chip that responds properly, so the id is not so important. The exceptioon that I notice is that eeprom seems to see eight instances of the ddcmon, at which point ddcmon can't find it's valid client chip. I recall reading that ddc chips are indestinguishable from eeproms? Nevermind! I see from expermentation that the checksum=1 option to eeprom solves the problem! Something for my HOWTO.
Many monitors contain a really dumb eeprom that responds to all 8 addresses. The eeprom driver latches on to all 8. The ddcmon driver only looks at 0x50. Load ddcmon first, or don't load eeprom, or use the ignore parameter to eeprom.
Quoted 10 lines
The v3tv is the ONLY client that can't tell the difference between the i2c and ddc adapters. So I don't think any action from your group is needed, since only the 2.4 kernel would be affected.
I'm still curious to know what the
i2c_get_adapterfunction intended purpose is. Could I use a derivitive of it, that tests the adapter.class, and omit the dummy client when building the v3tv module for the 2.6 kernel? Would my module not have access to the adapters list unless it were exported?
Greg?
Quoted 8 lines
Thanks,
Perry
-----
V3TV: http://gilfillan.org:8000/v3tv/
VPX3224: http://gilfillan.org:8000/vpx3224/
Quoted 9 lines · Jean Delvare
Quoted 2 lines
We've been wondering over here at sensors what the point was of unique IDs. nobody seemed to use them.
I think we have to make a difference between adapters and chips here. It looks quite obvious that adapters' IDs may have a use (as this is the case now). What I think Greg was suggesting is that we could drop IDs of _chip_ drivers, because those will hardly ever get used.
While the i2c_clients_command function does not use the id, in the v3tv module I have a function voodoo3_call_i2c_client (very bottom of /v3tv/voodoo-i2c.c) that does use it.
The i2c_clients_command pass the command along to any client on the adapter that has a driver->command. With my version, only the client of interest gets the call.
There are two sides to this. On one hand, if a client would respond to a given command, but I don't want it to, I can exclude it.
On the other hand, using i2c_clients_command, if I want all clients to recieve the command, one call to i2c_clients_command will suffice.
Any way, the change from voodoo3_call_i2c_client to i2c_clients_command is a trivial one for me to make, I've considered it before, therefore driver id's are not critical to me.
Cheers,
Perry
-----
V3TV: http://gilfillan.org:8000/v3tv/
VPX3224: http://gilfillan.org:8000/vpx3224/