Skip to contentSkip to conversation

hwmon/pc87360 as a platform driver

lm-sensors Jim Cromie 3 participants 5 messages Apr 7, 2006 – Apr 9, 2006

lore
Share & tools
lore

Jim Cromie

author
#0 lore raw

hi folks,

Ive just made a rough pass thru pc87360, and have converted it to a non-working, but non-crashing platform_driver that does at least a little of what it should:

soekris:~# modprobe pc87360
[  964.952000] pc87360: Device 0x09 not activated
[  966.576000] pc87360 pc87360.26144: VLM conversion set to 1s period, 
160us delay
soekris:~#
soekris:~# ls /sys/bus/platform/devices/pc87360.26144/
alarms_in      in1_input   in4_min     in8_input     temp2_input   
temp5_crit
alarms_temp    in1_max     in4_status  in8_max       temp2_max     
temp5_input
bus@           in1_min     in5_input   in8_min       temp2_min     temp5_max
cpu0_vid       in1_status  in5_max     in8_status    temp2_status  temp5_min
driver@        in2_input   in5_min     in9_input     temp3_crit    
temp5_status
hwmon:hwmon0@  in2_max     in5_status  in9_max       temp3_input   
temp6_crit
in0_input      in2_min     in6_input   in9_min       temp3_max     
temp6_input
in0_max        in2_status  in6_max     in9_status    temp3_min     temp6_max
in0_min        in3_input   in6_min     temp1_crit    temp3_status  temp6_min
in0_status     in3_max     in6_status  temp1_input   temp4_crit    
temp6_status
in10_input     in3_min     in7_input   temp1_max     temp4_input   uevent
in10_max       in3_status  in7_max     temp1_min     temp4_max     vrm
in10_min       in4_input   in7_min     temp1_status  temp4_min
in10_status    in4_max     in7_status  temp2_crit    temp4_status
soekris:~# ll /sys/bus/platform/drivers/pc87360/
total 0
--w------- 1 root root 4096 Apr  7 12:08 bind
lrwxrwxrwx 1 root root    0 Apr  7 12:08 module -> 
../../../../module/pc87360/
lrwxrwxrwx 1 root root    0 Apr  7 12:08 pc87360.26144 -> 
../../../../devices/platform/pc87360.26144/
--w------- 1 root root 4096 Apr  7 12:08 unbind

so far so good, but:

soekris:~# sensors -s
No sensors found!
soekris:~#
soekris:~# sensors
No sensors found!

my libsensors is unstable debian package: libsensors 1:2.10.0-3 That version number looks to contain 2.10.0

Frankly, Im hoping that with 2.10, the user-side just works, but this is not the case here.

Any guesses / suggestions as to whats wrong ?
Im continuiing to look at the kernel-side (Im sure Ive got multiple errs in there)
Im hoping for some user-side-fu for free ;-)

for anyone reading along, this is a perfect ref:

http://lists.lm-sensors.org/pipermail/lm-sensors/2006-February/015180.html

given the wider staging issues, this is arguably a later/lower priority.

tia
jimc

#1 lore raw

Jim,

I had a similar problem when I converted the vt1211 to a platform driver. Turned out to be a bug in lm_sensors which required some I2C modules to function properly. Try either loading an I2C module or use the CVS version of lm_sensors.

Check the following thread:
http://lists.lm-sensors.org/pipermail/lm-sensors/2006-February/015358.html

...juerg

Quoted 80 lines · Jim Cromie

hi folks,

Ive just made a rough pass thru pc87360, and have converted it to a non-working, but non-crashing platform_driver that does at least a little of what it should:

soekris:~# modprobe pc87360
[  964.952000] pc87360: Device 0x09 not activated
[  966.576000] pc87360 pc87360.26144: VLM conversion set to 1s period,
160us delay
soekris:~#
soekris:~# ls /sys/bus/platform/devices/pc87360.26144/
alarms_in      in1_input   in4_min     in8_input     temp2_input
temp5_crit
alarms_temp    in1_max     in4_status  in8_max       temp2_max
temp5_input
bus@           in1_min     in5_input   in8_min       temp2_min
temp5_max
cpu0_vid       in1_status  in5_max
in8_status    temp2_status  temp5_min
driver@        in2_input   in5_min     in9_input     temp3_crit
temp5_status
hwmon:hwmon0@  in2_max     in5_status  in9_max       temp3_input
temp6_crit
in0_input      in2_min     in6_input   in9_min       temp3_max
temp6_input
in0_max        in2_status  in6_max     in9_status    temp3_min
temp6_max
in0_min        in3_input   in6_min
temp1_crit    temp3_status  temp6_min
in0_status     in3_max     in6_status  temp1_input   temp4_crit
temp6_status
in10_input     in3_min     in7_input   temp1_max     temp4_input   uevent
in10_max       in3_status  in7_max     temp1_min     temp4_max     vrm
in10_min       in4_input   in7_min     temp1_status  temp4_min
in10_status    in4_max     in7_status  temp2_crit    temp4_status
soekris:~# ll /sys/bus/platform/drivers/pc87360/
total 0
--w------- 1 root root 4096 Apr  7 12:08 bind
lrwxrwxrwx 1 root root    0 Apr  7 12:08 module ->
../../../../module/pc87360/
lrwxrwxrwx 1 root root    0 Apr  7 12:08 pc87360.26144 ->
../../../../devices/platform/pc87360.26144/
--w------- 1 root root 4096 Apr  7 12:08 unbind

so far so good, but:

soekris:~# sensors -s
No sensors found!
soekris:~#
soekris:~# sensors
No sensors found!

my libsensors is unstable debian package: libsensors 1:2.10.0-3 That version number looks to contain 2.10.0

Frankly, Im hoping that with 2.10, the user-side just works, but this is not the case here.

Any guesses / suggestions as to whats wrong ?
Im continuiing to look at the kernel-side (Im sure Ive got multiple errs in there)
Im hoping for some user-side-fu for free ;-)

for anyone reading along, this is a perfect ref:

http://lists.lm-sensors.org/pipermail/lm-sensors/2006-February/015180.html

given the wider staging issues, this is arguably a later/lower priority.

Quoted 8 lines

tia
jimc

_______________________________________________
lm-sensors mailing list
lm-sensors at lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20060407/27579a0b/attachment-0001.html

author
#2 lore raw
In reply to Jim Cromie
Quoted 13 lines · Juerg Haefliger

Jim,

I had a similar problem when I converted the vt1211 to a platform driver. Turned out to be a bug in lm_sensors which required some I2C modules to function properly. Try either loading an I2C module or use the CVS version of lm_sensors.

Check the following thread:
http://lists.lm-sensors.org/pipermail/lm-sensors/2006-February/015358.html

...juerg

Quoted 9 lines

On 4/7/06, *Jim Cromie* <jim.cromie at gmail.com
<mailto:jim.cromie at gmail.com>> wrote:

hi folks,

Ive just made a rough pass thru pc87360, and have converted it to a non-working, but non-crashing platform_driver that does at least a little of what it should:

thanks!
but alas, error-driven cut-paste will only get me so far. More to the point, I have code similar to yours and Jean's

    data->class_dev = hwmon_device_register(&pdev->dev);

Guess I'll have to roll up my sleeves and actually figure it out.

BTW, I glanced at your patch, saw you're :
using sensor_attribute_2's,
that you're using the .nr field to switch the 'functionality'
of your combined-functionality callbacks.

thats all quite similar to what Im doing in these:
http://lists.lm-sensors.org/pipermail/lm-sensors/2006-March/015702.html
http://lists.lm-sensors.org/pipermail/lm-sensors/2006-March/015703.html

The SHOW_SET_*_* constants are just a bit off-putting at first read, but I know what you mean, and I dont have a better idea. maybe SHOW_SETTNG_*_* ?
or SHOW_CURR_*_*, thats confuse-able with the current reading

you can improve your printks :

s/(printk\(KERN_DEBUG)/dev_dbg\(&pdev->dev/;
s/(printk\(KERN_ERR)/dev_err\(&pdev->dev/
s/(printk\(KERN_INFO)/dev_info\(&pdev->dev/

at least where pdev has already been initd

Ill try to read thru the enire patch this weekend sometime.

thanks
jimc

#3 lore raw
In reply to Jim Cromie

Hi Jim,

Quoted 18 lines

Ive just made a rough pass thru pc87360, and have converted it to a non-working, but non-crashing platform_driver that does at least a little of what it should:

soekris:~# modprobe pc87360
[  964.952000] pc87360: Device 0x09 not activated
[  966.576000] pc87360 pc87360.26144: VLM conversion set to 1s period, 
160us delay
soekris:~#
(...)
so far so good, but:
soekris:~# sensors -s
No sensors found!
soekris:~#
soekris:~# sensors
No sensors found!
Quoted 7 lines

my libsensors is unstable debian package: libsensors 1:2.10.0-3 That version number looks to contain 2.10.0

Frankly, Im hoping that with 2.10, the user-side just works, but this is not the case here.

Any guesses / suggestions as to whats wrong ?

First of all, Juerg's answer is correct, 2.10.0 doesn't play fair with platform hwmon drivers unless an i2c driver is also present.

Secondly, your driver must have a "name" attribute containing the chip name (such as "pc87360" or "pc87366" etc. in your case) else libsensors won't be able to use it. That's probably what you're missing here.

BTW, I don't want to discourage you from working on this, as this will be needed at some point in time, but remember that I do not plan to accept any i2c-isa -> platform conversion before next year, because we need a widely deployed base of working libsensors before we do, and unfortunately even 2.10.0 doesn't qualify, as Juerg and you found out.

Thanks,

Signature · 1 line
Jean Delvare
#4 lore raw
In reply to Jim Cromie
Quoted 4 lines

The SHOW_SET_*_* constants are just a bit off-putting at first read, but I know what you mean, and I dont have a better idea. maybe SHOW_SETTNG_*_* ?
or SHOW_CURR_*_*, thats confuse-able with the current reading

Well SHOW_SET_xxx_yyy is supposed to hint that the constant is used in both the show_xxx and set_xxx callbacks. It's the best I could come up with although I have to admit I didn't spend too much time thinking about this....

Quoted 8 lines

you can improve your printks :

s/(printk\(KERN_DEBUG)/dev_dbg\(&pdev->dev/;
s/(printk\(KERN_ERR)/dev_err\(&pdev->dev/
s/(printk\(KERN_INFO)/dev_info\(&pdev->dev/

at least where pdev has already been initd

Hmm... I thought I used printks only in places where pdev is not initialized.

Quoted 2 lines

Ill try to read thru the enire patch this weekend sometime.

I certainly appreciate the review :-)

...juerg