All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] PATCH; sensors-detect: do not crash FSC Syleus IC's
@ 2009-02-14 19:12 Hans de Goede
  2009-02-18 16:23 ` Jean Delvare
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hans de Goede @ 2009-02-14 19:12 UTC (permalink / raw)
  To: lm-sensors

[-- Attachment #1: Type: text/plain, Size: 287 bytes --]

Hi,

As discussed on IRC the Syleus does not like our way of seeing if a device is 
present at a certain address, this patch implements a workaround consisting of 
doing a byte data read instead of a quick command or a byte read.

Once reviewed I can commit this myself.

Regards,

Hans

[-- Attachment #2: sensors-detect-dont-crash-syleus.patch --]
[-- Type: text/plain, Size: 885 bytes --]

Index: prog/detect/sensors-detect
===================================================================
--- prog/detect/sensors-detect	(revision 5642)
+++ prog/detect/sensors-detect	(working copy)
@@ -2629,7 +2629,14 @@
 {
 	my ($file, $addr, $funcs) = @_;
 
-	if (($addr >= 0x50 && $addr <= 0x5F)
+	if ($addr == 0x73) {
+		# Special case for FSC chips, as at least the Syleus locks
+		# up with our regular probe code. Note that to our current
+		# knowledge only FSC chips live on this address, and for them
+		# this probe method is safe
+		return 0 unless ($funcs & I2C_FUNC_SMBUS_READ_BYTE);
+		return i2c_smbus_access($file, SMBUS_READ, 0, SMBUS_BYTE_DATA, []);
+	} elsif (($addr >= 0x50 && $addr <= 0x5F)
 	 || ($addr >= 0x30 && $addr <= 0x37)) {
 		# This covers all EEPROMs we know of, including page protection
 		# addresses. Note that some page protection addresses will not

[-- Attachment #3: Type: text/plain, Size: 153 bytes --]

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [lm-sensors] PATCH; sensors-detect: do not crash FSC Syleus IC's
  2009-02-14 19:12 [lm-sensors] PATCH; sensors-detect: do not crash FSC Syleus IC's Hans de Goede
@ 2009-02-18 16:23 ` Jean Delvare
  2009-02-18 18:33 ` Hans de Goede
  2009-02-18 19:10 ` Jean Delvare
  2 siblings, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2009-02-18 16:23 UTC (permalink / raw)
  To: lm-sensors

Hi Hans,

On Sat, 14 Feb 2009 20:12:32 +0100, Hans de Goede wrote:
> As discussed on IRC the Syleus does not like our way of seeing if a device is 
> present at a certain address, this patch implements a workaround consisting of 
> doing a byte data read instead of a quick command or a byte read.
> 
> Once reviewed I can commit this myself.

> Index: prog/detect/sensors-detect
> =================================> --- prog/detect/sensors-detect	(revision 5642)
> +++ prog/detect/sensors-detect	(working copy)
> @@ -2629,7 +2629,14 @@
>  {
>  	my ($file, $addr, $funcs) = @_;
>  
> -	if (($addr >= 0x50 && $addr <= 0x5F)
> +	if ($addr = 0x73) {
> +		# Special case for FSC chips, as at least the Syleus locks
> +		# up with our regular probe code. Note that to our current
> +		# knowledge only FSC chips live on this address, and for them
> +		# this probe method is safe

Missing final dot ;)

> +		return 0 unless ($funcs & I2C_FUNC_SMBUS_READ_BYTE);

Wrong test: you want to check for I2C_FUNC_SMBUS_READ_BYTE_DATA.

> +		return i2c_smbus_access($file, SMBUS_READ, 0, SMBUS_BYTE_DATA, []);
> +	} elsif (($addr >= 0x50 && $addr <= 0x5F)
>  	 || ($addr >= 0x30 && $addr <= 0x37)) {
>  		# This covers all EEPROMs we know of, including page protection
>  		# addresses. Note that some page protection addresses will not

Minor nitpicking: I'd also move the test after the EEPROM test, keeping
the tests in both numeric and historical order.

Other than that, no objection on the principle, I believe it's the
right thing to do.

-- 
Jean Delvare

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [lm-sensors] PATCH; sensors-detect: do not crash FSC Syleus IC's
  2009-02-14 19:12 [lm-sensors] PATCH; sensors-detect: do not crash FSC Syleus IC's Hans de Goede
  2009-02-18 16:23 ` Jean Delvare
@ 2009-02-18 18:33 ` Hans de Goede
  2009-02-18 19:10 ` Jean Delvare
  2 siblings, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2009-02-18 18:33 UTC (permalink / raw)
  To: lm-sensors



Jean Delvare wrote:
> Hi Hans,
> 
> On Sat, 14 Feb 2009 20:12:32 +0100, Hans de Goede wrote:
>> As discussed on IRC the Syleus does not like our way of seeing if a device is 
>> present at a certain address, this patch implements a workaround consisting of 
>> doing a byte data read instead of a quick command or a byte read.
>>
>> Once reviewed I can commit this myself.
> 
>> Index: prog/detect/sensors-detect
>> =================================>> --- prog/detect/sensors-detect	(revision 5642)
>> +++ prog/detect/sensors-detect	(working copy)
>> @@ -2629,7 +2629,14 @@
>>  {
>>  	my ($file, $addr, $funcs) = @_;
>>  
>> -	if (($addr >= 0x50 && $addr <= 0x5F)
>> +	if ($addr = 0x73) {
>> +		# Special case for FSC chips, as at least the Syleus locks
>> +		# up with our regular probe code. Note that to our current
>> +		# knowledge only FSC chips live on this address, and for them
>> +		# this probe method is safe
> 
> Missing final dot ;)
> 
>> +		return 0 unless ($funcs & I2C_FUNC_SMBUS_READ_BYTE);
> 
> Wrong test: you want to check for I2C_FUNC_SMBUS_READ_BYTE_DATA.
> 

I tried that, but I got an undefined symbol (or somethinglike that) error

>> +		return i2c_smbus_access($file, SMBUS_READ, 0, SMBUS_BYTE_DATA, []);
>> +	} elsif (($addr >= 0x50 && $addr <= 0x5F)
>>  	 || ($addr >= 0x30 && $addr <= 0x37)) {
>>  		# This covers all EEPROMs we know of, including page protection
>>  		# addresses. Note that some page protection addresses will not
> 
> Minor nitpicking: I'd also move the test after the EEPROM test, keeping
> the tests in both numeric and historical order.
> 

Ok, will do when the I2C_FUNC_SMBUS_READ_BYTE_DATA thingie is sorted.

Regards,

Hans

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [lm-sensors] PATCH; sensors-detect: do not crash FSC Syleus IC's
  2009-02-14 19:12 [lm-sensors] PATCH; sensors-detect: do not crash FSC Syleus IC's Hans de Goede
  2009-02-18 16:23 ` Jean Delvare
  2009-02-18 18:33 ` Hans de Goede
@ 2009-02-18 19:10 ` Jean Delvare
  2 siblings, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2009-02-18 19:10 UTC (permalink / raw)
  To: lm-sensors

On Wed, 18 Feb 2009 19:33:52 +0100, Hans de Goede wrote:
> 
> 
> Jean Delvare wrote:
> > Hi Hans,
> > 
> > On Sat, 14 Feb 2009 20:12:32 +0100, Hans de Goede wrote:
> >> As discussed on IRC the Syleus does not like our way of seeing if a device is 
> >> present at a certain address, this patch implements a workaround consisting of 
> >> doing a byte data read instead of a quick command or a byte read.
> >>
> >> Once reviewed I can commit this myself.
> > 
> >> Index: prog/detect/sensors-detect
> >> =================================> >> --- prog/detect/sensors-detect	(revision 5642)
> >> +++ prog/detect/sensors-detect	(working copy)
> >> @@ -2629,7 +2629,14 @@
> >>  {
> >>  	my ($file, $addr, $funcs) = @_;
> >>  
> >> -	if (($addr >= 0x50 && $addr <= 0x5F)
> >> +	if ($addr = 0x73) {
> >> +		# Special case for FSC chips, as at least the Syleus locks
> >> +		# up with our regular probe code. Note that to our current
> >> +		# knowledge only FSC chips live on this address, and for them
> >> +		# this probe method is safe
> > 
> > Missing final dot ;)
> > 
> >> +		return 0 unless ($funcs & I2C_FUNC_SMBUS_READ_BYTE);
> > 
> > Wrong test: you want to check for I2C_FUNC_SMBUS_READ_BYTE_DATA.
> > 
> 
> I tried that, but I got an undefined symbol (or somethinglike that) error
> 
> >> +		return i2c_smbus_access($file, SMBUS_READ, 0, SMBUS_BYTE_DATA, []);
> >> +	} elsif (($addr >= 0x50 && $addr <= 0x5F)
> >>  	 || ($addr >= 0x30 && $addr <= 0x37)) {
> >>  		# This covers all EEPROMs we know of, including page protection
> >>  		# addresses. Note that some page protection addresses will not
> > 
> > Minor nitpicking: I'd also move the test after the EEPROM test, keeping
> > the tests in both numeric and historical order.
> > 
> 
> Ok, will do when the I2C_FUNC_SMBUS_READ_BYTE_DATA thingie is sorted.

Ah, right. We can't include the i2c-dev.h header file from a perl
script so we have to redefine everything ourselves. Check for:

use constant I2C_FUNC_SMBUS_QUICK	=> 0x00010000;
use constant I2C_FUNC_SMBUS_READ_BYTE	=> 0x00020000;

and add:

use constant I2C_FUNC_SMBUS_READ_BYTE_DATA	=> 0x00080000;


-- 
Jean Delvare

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-02-18 19:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-14 19:12 [lm-sensors] PATCH; sensors-detect: do not crash FSC Syleus IC's Hans de Goede
2009-02-18 16:23 ` Jean Delvare
2009-02-18 18:33 ` Hans de Goede
2009-02-18 19:10 ` Jean Delvare

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.