Skip to contentSkip to conversation

R: i2c-sis5595.c, kernel 2.6.10

DISCUSSION Jean Delvare 2 participants 3 messages May 19, 2005

lore
Share & tools
lore
#0 lore raw

Hi Sebastian,

Quoted 14 lines

I am currently debugging your i2c-sis5595 module because my brother asked me why his sis540/5595 chipset is not recognized by this module. I figured out that your setup code _may_ contain bugs especially when reading from pci config registers. I searched the web an found out that pci_read_config_xxx() returns 0 on success and negative values on error. IMHO if you check the result like this:

if (!pci_read_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, &val))
goto error;

the if-clause fails on successful reads, too!
I changed this to:
myret = pci_read_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, &val);

Quoted 8 lines

and printed myret and val to stdout. As expected myret is 0 and val contains 0xF8 which is the correct value for acpi and other stuff enabled.

Maybe you should consider to check for values lower than 0 !?

Please correct me if I am wrong, because I am not very firm at C and device driver development ;)

As incredible as it may sound, I think you are right and the tests are wrong in i2c-sis5595. Most probably this driver never worked in the 2.6 Linix kernel. It's really odd that nobody ever complained.

FYI, pci errors are not necessarily negative, some of them are positive. The only success value is PCIBIOS_SUCCESSFUL, AKA 0.

I've prepared a patch that should hopefully fix the i2c-sis5595 driver. Could you please give it a try and confirm that the driver works once you apply it?

http://jdelvare.net1.nerim.net/sensors/linux-2.6.11-rc2-i2c-sis5595-pci-logic.diff

Thanks,

Signature · 2 lines
Jean Delvare
http://khali.linux-fr.org/
#1 lore raw

Hi Sebastian,

Quoted 4 lines

The driver loads and adds the i2c device. i2cdetect -l tells:

i2c-1 unknown SMBus SIS5595 adapter at 5038 Algorithm unavailable
i2c-0 dummy ISA main adapter ISA bus algorithm

Great, so it somehow works. I'll send the patch to Greg KH for inclusion into his tree.

Quoted 3 lines

Is there any way to allow sensors to read out the internal voltage and temperature values from the sis5595's Data Acquisition Module ? Or just check the i2c function (i2cdump !?)

First of all you should try "i2cdetect 1" to find out whether there are chips on the SMBus or not.

Then you might try loading the sis5595 chip driver (no i2c- prefix).

If it doesn't work, there is always the sensors-detect script which can hint you at which drivers you should try.

Signature · 2 lines
Jean Delvare
http://khali.linux-fr.org/
#2 lore raw
In reply to Jean Delvare
Quoted 10 lines · Jean Delvare

As incredible as it may sound, I think you are right and the tests are wrong in i2c-sis5595. Most probably this driver never worked in the 2.6 Linix kernel. It's really odd that nobody ever complained.

FYI, pci errors are not necessarily negative, some of them are positive. The only success value is PCIBIOS_SUCCESSFUL, AKA 0.

I've prepared a patch that should hopefully fix the i2c-sis5595 driver. Could you please give it a try and confirm that the driver works once you apply it?

The driver loads and adds the i2c device. i2cdetect -l tells:

i2c-1 unknown SMBus SIS5595 adapter at 5038 Algorithm unavailable
i2c-0 dummy ISA main adapter ISA bus algorithm

Is there any way to allow sensors to read out the internal voltage and temperature values from the sis5595's Data Acquisition Module ? Or just check the i2c function (i2cdump !?)

Quoted 1 line

Thanks,

Regards,

Sebastian