w83l785ts.c
Quoted 2 lines
i've found the driver for winbond chip
w83l785ts.cyou have written. i own this chip (asus a7n8x), so i want to use it.
Preliminary disclaimer: the driver is still considered beta stuff, and I expect bus problems on a number of systems.
Quoted 4 lines
but i wasn't able to build the lmsensors-cvs-vsersion because i'm using kernel 2.6.0. so i tried to build it as an extra kernel module, but i failed cause i didn't know how to do it. (i just tried some ways, i thought it could work)
Drivers have to be ported in order to work under Linux 2.6.x. They don't work out-of-the-box, far from that, so no surprise you did not succeed.
BTW, if you are interested in sensors, you should consider upgrading to 2.6.1-rc1 or later, since -rc1 contains a huge number of fixes of all sorts. Also, you will need lm_sensors CVS for w83l785ts support, and lm_sensors CVS has a change that breaks support of 2.6.0 (long story, but this is needed).
Quoted 2 lines
so it would be nice, if you would tell me, how i can compile it for kernel 2.6.0 as module (if it works with 2.6.0 also)
Two choices:
1* Read Documentation/i2c/porting-clients as found in linux 2.6.1-rc1 and later, and port the driver yourself. That's not very complex if you can follow a guide, especially since the w83l785ts.c driver is really simple (and read-only for now). Feedback about the guide is welcome. Questions are welcome too.
2* Wait for me to have some time to do it. The problem here is that the waiting time is undetermined. Could be ready tomorrow, or in two weeks, or never if I forget about it. And I'm busy these days (who isn't?).
Good luck :)
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
Am Do, den 08.01.2004 schrieb Jean Delvare um 20:04:
Quoted 57 lines
Quoted 4 lines
I've tried choice 1. I(!) would not say it is not complex ;) I've never had a closer look to any linux source code and know just some basics of c. i wondered that it's possible to write several functions with the help of defines.
OK, this isn't trivial, but I don't consider it unfeasable by someone with reasonble C knowledge either.
Quoted 5 lines
your instructions were not really clear to me, but with the help of the other modules source code (
lm83.c,lm78.c), it was more copy, paste and edit ;)
i think the document is alright.I agree that looking at an already converted driver helps much more than any guide I could write.
Quoted 9 lines
so now to my problems ;)
1. i got this error message by compiling it.
w83l785ts.c:86: error: `I2C_DRIVERID_W83L785TS' undeclared here (not in a function)
w83l785ts.c:86: error: initializer element is not constant w83l785ts.c:86: error: (near initialization for `w83l785ts_driver.id')Quoted 5 lines
i think i get it, because the driver must be declared somewhere in the kernel sources. if right, where? which value should the ID get?
i just replaced ".id =
I2C_DRIVERID_W83L785TS," with ".id =I2C_DRIVERID_W83781D+ 1,", so it compiled. (i suppose very dirty ;)Yes that's dirty, but it the end we don't care because IDs are now used. The prefered fix though is to add the relevant line to
include/linux/i2c-id.h:
#defineI2C_DRIVERID_W83L785TS1047Quoted 11 lines
2. how can i compile just this one module for my kernel?
i tried compiling with a call i've seen when i was compiling a 2.4.*er kernel.
gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes
(quoted diff) +0
-4-Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer-pipe -mpreferred-stack-boundary=2 -DMODULE -DMODVERSIONS -nostdinc-iwithprefix include -DKBUILD_BASENAME=isicom -c w83l785ts.cQuoted 4 lines
so i get a .o file.
the kernel 2.6 compile isn't verbose any more, but i remembered that it has used ld for a modul. but link with what?!?
do you know how i can build a kernel 2.6 module (.ko)??I don't know. What I'd suggest is that you edit
drivers/i2c/chips/KconfigandMakefileto add support for the new driver. This is really easy. Cut, paste :) Then, all you have to do is configure your kernel, enable the driver, and compile.
Quoted 8 lines
Quoted 1 line
i've attached the edited source file. i hope it will do its work.....
Didn't look indeep but it looks overall good to me. I can't test it since I do not have any supported device here. Let us know how it goes! If you get it to work on your system, we'll prepare a patch and send it to Greg KH so that it is included into Linux 2.6.2.
Thanks :)
Yeah it works :))
Thanky you for your help, really cool =)
I'm getting a temperature of 46?C, which is what i expected about. I'm also running the ASUS C.O.P feature, which also uses this chip for determining the temperature (so i've read somewhere), i hope there will be no problems, let's see.
for know it works fine, i can't believe :)
regards, fago
Am Do, den 08.01.2004 schrieb Jean Delvare um 21:34:
Quoted 11 lines
Quoted 4 lines
I'm getting a temperature of 46?C, which is what i expected about. I'm also running the ASUS C.O.P feature, which also uses this chip for determining the temperature (so i've read somewhere), i hope there will be no problems, let's see.
I fear that problem could arise. Could you do a test for me? Unload the w83l785ts driver, and run "i2ddump 0
0x4e" (assuming your i2c bus has number 0). Some users have reported "XX" which basically means read errors. I suspect that this is related to the C.O.P. feature. I'd like you to do the test with and without this feature enabled, to see if it makes any difference.
i'm not familiar with lm-sensors tools, because i never used it before. i use the lm-sensors package from SID, which is 2.8.1.
so i don't know my bus number. i2cdetect don't lists it, but i can run it with 0,1 and 2
i think it's 2 because the sysfs entries are in 2-00**
i am also running the module w83781d for the other sensors on my board.
i disabled C.O.P unloaded the modules and i 've got something for 0,1 and 2
i2cdetect 2 0x4e:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: XX XX XX XX XX XX XX XX 08 XX XX XX XX XX XX XX 10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 20: XX XX XX XX XX XX XX XX XX XX XX XX XX 2d 2e 2f 30: XX XX XX XX XX XX XX 37 XX XX XX XX XX XX XX XX 40: XX XX XX XX XX XX XX XX 48 49 XX XX XX XX XX XX 50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 60: XX 61 XX 63 XX XX XX XX XX XX XX XX XX XX XX XX 70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
after loading w83l785ts i've got
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: XX XX XX XX XX XX XX XX 08 XX XX XX XX XX XX XX 10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 20: XX XX XX XX XX XX XX XX XX XX XX XX XX 2d 2e 2f 30: XX XX XX XX XX XX XX 37 XX XX XX XX XX XX XX XX 40: XX XX XX XX XX XX XX XX 48 49 XX XX XX XX XX XX 50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 60: XX 61 XX 63 XX XX XX XX XX XX XX XX XX XX XX XX 70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
and with both modules loaded i 've got
0 1 2 3 4 5 6 7 8 9 a b c d e f 00: XX XX XX XX XX XX XX XX 08 XX XX XX XX XX XX XX 10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 20: XX XX XX XX XX XX XX XX XX XX XX XX XX UU 2e 2f 30: XX XX XX XX XX XX XX 37 XX XX XX XX XX XX XX XX 40: XX XX XX XX XX XX XX XX UU UU XX XX XX XX XX XX 50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 60: XX 61 XX 63 XX XX XX XX XX XX XX XX XX XX XX XX 70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
(i don't know if this matters ;)
then i enabled the C.O.P feature and again the tests
both modules loaded:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: XX XX XX XX XX XX XX XX 08 XX XX XX XX XX XX XX 10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 20: XX XX XX XX XX XX XX XX XX XX XX XX XX UU UU 2f 30: XX XX XX XX XX XX XX 37 XX XX XX XX XX XX XX XX 40: XX XX XX XX XX XX XX XX UU UU XX XX XX XX XX XX 50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 60: XX 61 XX 63 XX XX XX XX XX XX XX XX XX XX XX XX 70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
both unloaded:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: XX XX XX XX XX XX XX XX 08 XX XX XX XX XX XX XX 10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 20: XX XX XX XX XX XX XX XX XX XX XX XX XX 2d 2e 2f 30: XX XX XX XX XX XX XX 37 XX XX XX XX XX XX XX XX 40: XX XX XX XX XX XX XX XX 48 49 XX XX XX XX XX XX 50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 60: XX 61 XX 63 XX XX XX XX XX XX XX XX XX XX XX XX 70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
w83781d loaded:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: XX XX XX XX XX XX XX XX 08 XX XX XX XX XX XX XX 10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 20: XX XX XX XX XX XX XX XX XX XX XX XX XX UU 2e 2f 30: XX XX XX XX XX XX XX 37 XX XX XX XX XX XX XX XX 40: XX XX XX XX XX XX XX XX UU UU XX XX XX XX XX XX 50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 60: XX 61 XX 63 XX XX XX XX XX XX XX XX XX XX XX XX 70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
and w83l785ts loaded:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: XX XX XX XX XX XX XX XX 08 XX XX XX XX XX XX XX 10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 20: XX XX XX XX XX XX XX XX XX XX XX XX XX 2d UU 2f 30: XX XX XX XX XX XX XX 37 XX XX XX XX XX XX XX XX 40: XX XX XX XX XX XX XX XX 48 49 XX XX XX XX XX XX 50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 60: XX 61 XX 63 XX XX XX XX XX XX XX XX XX XX XX XX 70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
i think its no coincidence that 2e changes and the sysfs files are in a directory called "2-002e"
Quoted 8 lines
Quoted 2 lines
for know it works fine, i can't believe :)
regards, fagoCould you please provide a complete patch against a 2.6.x kernel? This should ideally include changes made to
i2c-id.h, chips/Kconfig, chips/Makefile and of course the driver itself. I could then clean up whatever needs to be, ensure it applies against our current stack of patches, and send it to Greg.
ok, i'll do it :)
here the patch + the c.file
i hope i've made the patch correctly, it's my first ;)
i've another strange problem with the module. it works, but only if i load it twice, so i have to load it, unload, and load again. only then the new sysfs-files appear.
probably a silly fault in the code. would be nice if you could have a look at it..
thanks, fago
-------------- next part --------------
A non-text attachment was scrubbed...
Name: w83l785ts.patch
Type: text/x-patch
Size: 10690 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040109/886f461b/w83l785ts.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: w83l785ts.c
Type: text/x-c
Size: 8299 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040109/886f461b/w83l785ts-0001.bin
Am Do, den 08.01.2004 schrieb Jean Delvare um 21:34:
Quoted 10 lines
Quoted 2 lines
Yeah it works :))
Thanky you for your help, really cool =)You're welcome.
Quoted 4 lines
I'm getting a temperature of 46?C, which is what i expected about. I'm also running the ASUS C.O.P feature, which also uses this chip for determining the temperature (so i've read somewhere), i hope there will be no problems, let's see.
Quoted 6 lines
I fear that problem could arise. Could you do a test for me? Unload the w83l785ts driver, and run "i2ddump 0
0x4e" (assuming your i2c bus has number 0). Some users have reported "XX" which basically means read errors. I suspect that this is related to the C.O.P. feature. I'd like you to do the test with and without this feature enabled, to see if it makes any difference.
eeehm, in the mail before concerning the i2cdumps - i've made the mistake to use i2cdetect instead of i2cdump. only with i2cdetect i got values. with i2cdump i always got X, with and without C.O.P, with and without the modules.
sry, fago
Quoted 1 line
i think it's 2 because the sysfs entries are in 2-00**
You're right.
Quoted 2 lines
i am also running the module w83781d for the other sensors on my board.
Starting with lm_sensors 2.8.2, you can use the asb100 driver instead of the w83781d. It wil support your chipset better.
Quoted 2 lines
i disabled C.O.P unloaded the modules and i 've got something for 0,1 and 2
Just to be sure I understand you: disabling the C.O.P is something you do in the BIOS setup screen, right?
Quoted 15 lines
i2cdetect 2
0x4e:0 1 2 3 4 5 6 7 8 9 a b c d e f
00: XX XX XX XX XX XX XX XX 08 XX XX XX XX XX XX XX 10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 20: XX XX XX XX XX XX XX XX XX XX XX XX XX 2d 2e 2f 30: XX XX XX XX XX XX XX 37 XX XX XX XX XX XX XX XX 40: XX XX XX XX XX XX XX XX 48 49 XX XX XX XX XX XX 50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 60: XX 61 XX 63 XX XX XX XX XX XX XX XX XX XX XX XX 70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXafter loading w83l785ts i've got
Quoted 9 lines
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: XX XX XX XX XX XX XX XX 08 XX XX XX XX XX XX XX 10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 20: XX XX XX XX XX XX XX XX XX XX XX XX XX 2d 2e 2f 30: XX XX XX XX XX XX XX 37 XX XX XX XX XX XX XX XX 40: XX XX XX XX XX XX XX XX 48 49 XX XX XX XX XX XX 50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 60: XX 61 XX 63 XX XX XX XX XX XX XX XX XX XX XX XX 70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
Something wrong there, 2e should be marked as used ("UU").
Quoted 4 lines
then i enabled the C.O.P feature and again the tests
both modules loaded:
Quoted 9 lines
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: XX XX XX XX XX XX XX XX 08 XX XX XX XX XX XX XX 10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 20: XX XX XX XX XX XX XX XX XX XX XX XX XX UU UU 2f 30: XX XX XX XX XX XX XX 37 XX XX XX XX XX XX XX XX 40: XX XX XX XX XX XX XX XX UU UU XX XX XX XX XX XX 50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 60: XX 61 XX 63 XX XX XX XX XX XX XX XX XX XX XX XX 70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
That's better. Later dumps are OK too.
Quoted 2 lines
i think its no coincidence that 2e changes and the sysfs files are in a directory called "2-002e"
Of course it is no coincidence ;)
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
Quoted 2 lines
here the patch + the c.file
i hope i've made the patch correctly, it's my first ;)
Does look very good at first sight :) except for a few indentation issues and extra blank lines, but I'll take care of that.
Quoted 6 lines
i've another strange problem with the module. it works, but only if i load it twice, so i have to load it, unload, and load again. only then the new sysfs-files appear.
probably a silly fault in the code. would be nice if you could have a look at it..
Will do. Can you provide the relevant part of "dmesg" as you do the operation? Maybe it'll help.
Also, is it *always* failing the first time you run it, or does it *randomly* fail?
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
Quoted 4 lines
eeehm, in the mail before concerning the i2cdumps - i've made the mistake to use i2cdetect instead of i2cdump. only with i2cdetect i got values. with i2cdump i always got X, with and without C.O.P, with and without the modules.
I can't believe it. Didn't you by mistake run "i2cdump 0 0x4e" instead of "i2cdump 2 0x4e"? Please make sure (using i2cdetect) that you are accessing the right bus.
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
Quoted 4 lines
I've tried choice 1. I(!) would not say it is not complex ;) I've never had a closer look to any linux source code and know just some basics of c. i wondered that it's possible to write several functions with the help of defines.
OK, this isn't trivial, but I don't consider it unfeasable by someone with reasonble C knowledge either.
Quoted 5 lines
your instructions were not really clear to me, but with the help of the other modules source code (
lm83.c,lm78.c), it was more copy, paste and edit ;)
i think the document is alright.
I agree that looking at an already converted driver helps much more than any guide I could write.
Quoted 9 lines
so now to my problems ;)
1. i got this error message by compiling it.
w83l785ts.c:86: error: `I2C_DRIVERID_W83L785TS' undeclared here (not in a function)
w83l785ts.c:86: error: initializer element is not constant w83l785ts.c:86: error: (near initialization for `w83l785ts_driver.id')
Quoted 5 lines
i think i get it, because the driver must be declared somewhere in the kernel sources. if right, where? which value should the ID get?
i just replaced ".id =
I2C_DRIVERID_W83L785TS," with ".id =I2C_DRIVERID_W83781D+ 1,", so it compiled. (i suppose very dirty ;)
Yes that's dirty, but it the end we don't care because IDs are now used. The prefered fix though is to add the relevant line to include/linux/i2c-id.h:
#define I2C_DRIVERID_W83L785TS 1047
Quoted 11 lines
2. how can i compile just this one module for my kernel?
i tried compiling with a call i've seen when i was compiling a 2.4.*er kernel.
gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes
(quoted diff) +0
-4-Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer-pipe -mpreferred-stack-boundary=2 -DMODULE -DMODVERSIONS -nostdinc-iwithprefix include -DKBUILD_BASENAME=isicom -c w83l785ts.c
Quoted 4 lines
so i get a .o file.
the kernel 2.6 compile isn't verbose any more, but i remembered that it has used ld for a modul. but link with what?!?
do you know how i can build a kernel 2.6 module (.ko)??
I don't know. What I'd suggest is that you edit drivers/i2c/chips/Kconfig and Makefile to add support for the new driver. This is really easy. Cut, paste :) Then, all you have to do is configure your kernel, enable the driver, and compile.
Quoted 1 line
i've attached the edited source file. i hope it will do its work.....
Didn't look indeep but it looks overall good to me. I can't test it since I do not have any supported device here. Let us know how it goes! If you get it to work on your system, we'll prepare a patch and send it to Greg KH so that it is included into Linux 2.6.2.
Thanks :)
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
Quoted 2 lines
Yeah it works :))
Thanky you for your help, really cool =)
You're welcome.
Quoted 4 lines
I'm getting a temperature of 46?C, which is what i expected about. I'm also running the ASUS C.O.P feature, which also uses this chip for determining the temperature (so i've read somewhere), i hope there will be no problems, let's see.
I fear that problem could arise. Could you do a test for me? Unload the w83l785ts driver, and run "i2ddump 0 0x4e" (assuming your i2c bus has number 0). Some users have reported "XX" which basically means read errors. I suspect that this is related to the C.O.P. feature. I'd like you to do the test with and without this feature enabled, to see if it makes any difference.
Quoted 2 lines
for know it works fine, i can't believe :)
regards, fago
Could you please provide a complete patch against a 2.6.x kernel? This should ideally include changes made to i2c-id.h, chips/Kconfig, chips/Makefile and of course the driver itself. I could then clean up whatever needs to be, ensure it applies against our current stack of patches, and send it to Greg.
Thanks!
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
Quoting fago <[email protected]>:
Quoted 6 lines
Quoted 3 lines
I can't believe it. Didn't you by mistake run "i2cdump 0
0x4e" instead of "i2cdump 20x4e"? Please make sure (using i2cdetect) that you are accessing the right bus.shouldn't it be "i2cdump 1
0x2e"? because the sensor is always in a directory called "1-002e".
Aha, stupid me. I'm giving you the bad address from the beginning. I'm really sorry about that. We're lucky you're smarter than I am ;)
Quoted 6 lines
but sometimes there a some X:
(...)
40: 0d XX 00 00 00 80 ff ff ff ff ff ff a3 5c 70 ffand i'm sorry the cop feature can't be disabled. there is only the q-fan feature to disable, i don't know which temperature this uses.
For my own knowledge, what does the q-fan feature do? I you disable it, are the 'XX' still there?
Quoted 2 lines
i'm using now kernel 2.6.1 with the patch, works fine (for me and another user :)
Great :) If you did not do any change to the code you sent to me, I'll prepare a patch and send it to Greg for inclusion into the mainstream.
Quoted 6 lines
the module is loading now at bootup time, this has been always working until now. but the loading problem is still here:
(...)
perhaps the bios is using the chip this time, and so it is not found.
so it's not really a driver problem?
Yeah, I think that it is what's happening. As the driver loads, we read a few registers from the chipset to ensure it is a W83L785TS-S. If one read fails, the identification will fails. The 'XX' in the dumps show that this sometimes happens.
So this is no bug in the driver, although we could try to detect read errors and reissue a read command as they happen. Ideally this shouldn't be done at chip driver level but in i2c-core itself I guess, but that's still something to start with. I'll give it a go maybe this evening unless you are willing to try it yourself.
Thanks a lot for your work and feedback :)
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/