new drivers for linux 2.6, testers wanted
Hi all,
I have new i2c drivers for linux 2.6 and am looking for testers.
*** i2c-parport and i2c-parport light ***
These are replacements for the i2c-philips-par, i2c-elv and i2c-velleman drivers, as well as for the i2c-old i2c-parport driver as found under drivers/media/video in linux 2.4. My reason for writing them, as already discussed on this list, is that all these drivers basically do the same thing, so I thought it would be easier to maintain a single driver instead of four. As Simon Vogl pointed out that using a direct I/O access (as done in i2c-elv and i2c-velleman) could be prefered over clean parport access (as done in i2c-philips-par) on embedded devices, I finally wrote two drivers instead of one. But both drivers support all devices, it's just a matter of how they are accessed (and wether the driver depends on the parport driver).
I made it so that the definition of the adapters (i.e. how to set and get SDA and SCL, basically) is completely separated from the code itself. Thus, adding support for a new adapter is simply adding a new set of data to the definition table, describing how the adapter works, in a single file.
This means that all simple parallel port adapters are virtually supported. The i2c-pport driver we have in CVS isn't supported yet because it works a bit differently, but I believe that extending the current driver(s) to support it should be possible (although it can be discussed wether it's worth it).
So, if any of you have parallel port i2c adapters and are running a 2.6 kernel, that would be nice to you to give a try to my new drivers. You'll have to pass the type parameter that is correct for your board:
0 = Philips
2 = Velleman
3 = ELV
4 = ADM evaluation board
If you have a different hardware setup, add the definition for it in i2c-parallel.h and send me a patch so that I can update on my side too.
The drivers are available here as a patch against linux-2.6.1-rc1:
http://delvare.nerim.net/i2c/linux-2.6/linux-2.6.1-rc1-i2c-parport.diff
I could only test with my ADM eval board, and it worked ok with both drivers. If they are confirmed to work, we could get rid of all other parallel port i2c drivers in 2.6.
*** lm90 ***
This is my lm90 driver ported to 2.6. It supports the LM90 and ADM1032 chips. Lm_sensors2 CVS as of today has support for it. I tested it on my ADM1032 eval board and it worked OK.
If anyone wants to give it a try, it's there:
http://delvare.nerim.net/i2c/linux-2.6/linux-2.6.1-rc1-i2c-lm90.diff
Thanks and happy new year everyone.
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
Quoted 8 lines · Jean Delvare
So, if any of you have parallel port i2c adapters and are running a 2.6 kernel, that would be nice to you to give a try to my new drivers. You'll have to pass the type parameter that is correct for your board:
0 = Philips
2 = Velleman
3 = ELV
4 = ADM evaluation board
Is there any way to autodetect this so the module parameter is not needed?
thanks,
greg k-h
Quoted 11 lines
Quoted 8 lines
So, if any of you have parallel port i2c adapters and are running a 2.6 kernel, that would be nice to you to give a try to my new drivers. You'll have to pass the type parameter that is correct for your board:
0 = Philips
2 = Velleman
3 = ELV
4 = ADM evaluation boardIs there any way to autodetect this so the module parameter is not needed?
We could autodetect if and only if (at the moment) i2c-algo-bit has been loaded with bit_test=1, which isn't the default. For this reason, I have not implemented it yet.
We could duplicate the test code into the i2c-parport module(s), but I don't really like duplicating code. This makes maintainance harder, and modules bigger for not benefit. Or we could have a more simple test (e.g. just verify that the bus "reset" worked) but this would result in a less reliable detection.
We could make i2c-algo-bit's bit_test=1 the default, but this would break (sort of) several modules that do not seem to reset the lines correctly at load time (i2c-matroxfb and one of the zoran modules come to mind). On the other hand, this would be the right time to fix them. This would also mean that we would be using bit_test in a way it wasn't made for in the first place (i.e. detection instead of debug) so we would obviously have to make it less verbose, which in turn would make it useless for debugging.
One possibility I see is:
1* Make the bus_test function of i2c-algo-bit publicly available. 2* Have an extra parameter to that function to control its verbosity. 3* I2c-parport would call it in non-verbose mode for detection purposes.
One other possibility I see is:
1* Testing the bus is a good idea, so this is not only 1 by default, but the bit_test parameter is gone.
2* So this is not for debug purposes and has to be less verbose (i.e. don't output anything on success and maybe not even on error). 3* We fix bus drivers that don't work with it.
But there will still be something fundamentally broken, which is that the test_but function cannot detect if lines are inverted or not, nor which line is which. For example, if two types were supported by the i2c-parport module, which have SDA and SCL swapped but otherwise use the same pins, it couldn't possibly differenciate between them. Same goes for types that would use the same pins for the lines but have them inverted. I think that types 1 and 4 fall into this category. And the more adapter types the module will support, the more likely the detection is to fail.
This make me think of another possible approach. We could consider the detection a one-time procedure, proposed to the user who doesn't know what type to use (which IMHO is unlikely because not everyone plays with parallel-port adapters, and I'd expect people who do to have solid hardware and software experience), to tell him which type to pass the next time he wants to load the module. Let's use an example since I'm not sure I've been very clear there ;)
Our user has a parallel port adapter and doesn't know which type to use. He/she runs "modprobe i2c-parport detect=1". Inside i2c-parport, we would then try adapter types from 1-1=0 to the last possible type or a type passes the test, whatever comes first. In the logs, we would output the failures and succes, but not load the module. Log messages would look like:
i2c-parport: Type 0 failed.
i2c-parport: Type 1 succeeded. You now have to load i2c-parport with type=1. If it doesn't work, run detection again with detect=3.
So this would basically be a way to give a hint to the user.
But frankly, is it worth it? I doubt it. As said before, I don't expect unexperienced users to need this module, and I expect experienced users not to be afraid by having to "modinfo i2c-parport" and pick the correct type. I would have liked to implement autodetection too, were it possible to be sure it would work, but as underline above, there are cases were we already know it just won't work.
But of course comments are welcome. Maybe I've missed easier ways that would make me revise my judgment.
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
I was always agains autodetection, because I was wary not to disturb any chips on the line,
not to mention the times when I had other hardware on my parallel ports which would break
when the wrong lines pulled ;)
but it would be nice to have a kernel config option which sets the default just my two cents ;)
Happy new year to you all,
Simon
Quoted 89 lines · Jean Delvare
Quoted 10 lines
Quoted 10 lines
So, if any of you have parallel port i2c adapters and are running a 2.6 kernel, that would be nice to you to give a try to my new drivers. You'll have to pass the type parameter that is correct for your board:
0 = Philips
2 = Velleman
3 = ELV
4 = ADM evaluation boardQuoted 4 lines
Is there any way to autodetect this so the module parameter is not needed?
We could autodetect if and only if (at the moment) i2c-algo-bit has been loaded with bit_test=1, which isn't the default. For this reason, I have not implemented it yet.
We could duplicate the test code into the i2c-parport module(s), but I don't really like duplicating code. This makes maintainance harder, and modules bigger for not benefit. Or we could have a more simple test (e.g. just verify that the bus "reset" worked) but this would result in a less reliable detection.
We could make i2c-algo-bit's bit_test=1 the default, but this would break (sort of) several modules that do not seem to reset the lines correctly at load time (i2c-matroxfb and one of the zoran modules come to mind). On the other hand, this would be the right time to fix them. This would also mean that we would be using
bit_testin a way it wasn't made for in the first place (i.e. detection instead of debug) so we would obviously have to make it less verbose, which in turn would make it useless for debugging.One possibility I see is:
1* Make thebus_testfunction of i2c-algo-bit publicly available. 2* Have an extra parameter to that function to control its verbosity. 3* I2c-parport would call it in non-verbose mode for detection purposes.One other possibility I see is:
1* Testing the bus is a good idea, so this is not only 1 by default, but thebit_testparameter is gone.
2* So this is not for debug purposes and has to be less verbose (i.e. don't output anything on success and maybe not even on error). 3* We fix bus drivers that don't work with it.But there will still be something fundamentally broken, which is that the
test_butfunction cannot detect if lines are inverted or not, nor which line is which. For example, if two types were supported by the i2c-parport module, which have SDA and SCL swapped but otherwise use the same pins, it couldn't possibly differenciate between them. Same goes for types that would use the same pins for the lines but have them inverted. I think that types 1 and 4 fall into this category. And the more adapter types the module will support, the more likely the detection is to fail.This make me think of another possible approach. We could consider the detection a one-time procedure, proposed to the user who doesn't know what type to use (which IMHO is unlikely because not everyone plays with parallel-port adapters, and I'd expect people who do to have solid hardware and software experience), to tell him which type to pass the next time he wants to load the module. Let's use an example since I'm not sure I've been very clear there ;)
Our user has a parallel port adapter and doesn't know which type to use. He/she runs "modprobe i2c-parport detect=1". Inside i2c-parport, we would then try adapter types from 1-1=0 to the last possible type or a type passes the test, whatever comes first. In the logs, we would output the failures and succes, but not load the module. Log messages would look like:
i2c-parport: Type 0 failed.
i2c-parport: Type 1 succeeded. You now have to load i2c-parport with type=1. If it doesn't work, run detection again with detect=3.So this would basically be a way to give a hint to the user.
But frankly, is it worth it? I doubt it. As said before, I don't expect unexperienced users to need this module, and I expect experienced users not to be afraid by having to "modinfo i2c-parport" and pick the correct type. I would have liked to implement autodetection too, were it possible to be sure it would work, but as underline above, there are cases were we already know it just won't work.
But of course comments are welcome. Maybe I've missed easier ways that would make me revise my judgment.
Signature · 4 lines
Dipl.-Ing. Dr. Simon Vogl ! http://www.voxel.at/ VoXel Interaction Design ! [email protected] Breitwiesergutstr. 50 ! +43 650 2323 555 A-4020 Linz - Austria !