All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] lm-sensors: Add detection of MAX6639
@ 2011-01-21 16:58 Guenter Roeck
  2011-01-21 17:06 ` Jean Delvare
  0 siblings, 1 reply; 2+ messages in thread
From: Guenter Roeck @ 2011-01-21 16:58 UTC (permalink / raw)
  To: lm-sensors

Index: prog/detect/sensors-detect
=================================--- prog/detect/sensors-detect	(revision 5906)
+++ prog/detect/sensors-detect	(working copy)
@@ -828,6 +828,11 @@
 		i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e],
 		i2c_detect => sub { max1668_detect(@_, 2); },
 	}, {
+		name => "Maxim MAX6639",
+		driver => "max6639",
+		i2c_addrs => [0x2c, 0x2e, 0x2f],
+		i2c_detect => sub { max6639_detect(@_); },
+	}, {
 		name => "Maxim MAX6650/MAX6651",
 		driver => "max6650",
 		i2c_addrs => [0x1b, 0x1f, 0x48, 0x4b],
@@ -5446,6 +5451,27 @@
 	return @res;
 }
 
+# Chip to detect: MAX6639
+# Registers used:
+#   0x3d: Device ID
+#   0x3e: Manufacturer ID
+#   0x3f: Chip revision
+sub max6639_detect
+{
+	my ($file, $addr) = @_;
+	my ($man_id, $dev_id, $rev);
+
+	$dev_id = i2c_smbus_read_byte_data($file, 0x3d);
+	$man_id = i2c_smbus_read_byte_data($file, 0x3e);
+	$rev = i2c_smbus_read_byte_data($file, 0x3f);
+	
+	return unless $man_id = 0x4d;	# Maxim
+	return unless $dev_id = 0x58;	# MAX6639
+	return unless $rev = 0x00;
+
+	return 6;
+}
+
 # The max6650 has no device ID register. However, a few registers have
 # spare bits, which are documented as being always zero on read. We read
 # all of these registers check the spare bits. Any non-zero means this
Index: CHANGES
=================================--- CHANGES	(revision 5906)
+++ CHANGES	(working copy)
@@ -19,6 +19,7 @@
                   Add detection of the National Semiconductor LM94
                   Add detection of the ITE IT8728F
                   Implement universal detection for coretemp (#2381)
+                  Add detection of Maxim MAX6639
 
 3.2.0 (2010-10-10)
   libsensors: Increase MAX_SENSORS_PER_TYPE to 24

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

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

* Re: [lm-sensors] lm-sensors: Add detection of MAX6639
  2011-01-21 16:58 [lm-sensors] lm-sensors: Add detection of MAX6639 Guenter Roeck
@ 2011-01-21 17:06 ` Jean Delvare
  0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2011-01-21 17:06 UTC (permalink / raw)
  To: lm-sensors

On Fri, 21 Jan 2011 08:58:22 -0800, Guenter Roeck wrote:
> Index: prog/detect/sensors-detect
> =================================> --- prog/detect/sensors-detect	(revision 5906)
> +++ prog/detect/sensors-detect	(working copy)
> @@ -828,6 +828,11 @@
>  		i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e],
>  		i2c_detect => sub { max1668_detect(@_, 2); },
>  	}, {
> +		name => "Maxim MAX6639",
> +		driver => "max6639",
> +		i2c_addrs => [0x2c, 0x2e, 0x2f],
> +		i2c_detect => sub { max6639_detect(@_); },
> +	}, {
>  		name => "Maxim MAX6650/MAX6651",
>  		driver => "max6650",
>  		i2c_addrs => [0x1b, 0x1f, 0x48, 0x4b],
> @@ -5446,6 +5451,27 @@
>  	return @res;
>  }
>  
> +# Chip to detect: MAX6639
> +# Registers used:
> +#   0x3d: Device ID
> +#   0x3e: Manufacturer ID
> +#   0x3f: Chip revision
> +sub max6639_detect
> +{
> +	my ($file, $addr) = @_;
> +	my ($man_id, $dev_id, $rev);
> +
> +	$dev_id = i2c_smbus_read_byte_data($file, 0x3d);
> +	$man_id = i2c_smbus_read_byte_data($file, 0x3e);
> +	$rev = i2c_smbus_read_byte_data($file, 0x3f);
> +	
> +	return unless $man_id = 0x4d;	# Maxim
> +	return unless $dev_id = 0x58;	# MAX6639
> +	return unless $rev = 0x00;
> +
> +	return 6;
> +}
> +
>  # The max6650 has no device ID register. However, a few registers have
>  # spare bits, which are documented as being always zero on read. We read
>  # all of these registers check the spare bits. Any non-zero means this
> Index: CHANGES
> =================================> --- CHANGES	(revision 5906)
> +++ CHANGES	(working copy)
> @@ -19,6 +19,7 @@
>                    Add detection of the National Semiconductor LM94
>                    Add detection of the ITE IT8728F
>                    Implement universal detection for coretemp (#2381)
> +                  Add detection of Maxim MAX6639
>  
>  3.2.0 (2010-10-10)
>    libsensors: Increase MAX_SENSORS_PER_TYPE to 24
> 

Looks good, feel free to commit.

-- 
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] 2+ messages in thread

end of thread, other threads:[~2011-01-21 17:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-21 16:58 [lm-sensors] lm-sensors: Add detection of MAX6639 Guenter Roeck
2011-01-21 17:06 ` 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.