public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org, sensors@Stimpy.netroedge.com
Cc: aurelien@aurel32.net
Subject: [PATCH] I2C: Fix DS1621 detection
Date: Thu, 3 Feb 2005 09:38:58 -0800	[thread overview]
Message-ID: <11074523381178@kroah.com> (raw)
In-Reply-To: <20050203173745.GA24076@kroah.com>

ChangeSet 1.2041, 2005/02/03 00:28:34-08:00, aurelien@aurel32.net

[PATCH] I2C: Fix DS1621 detection

Dallas Semiconductors as recently changed the design of their DS1621
chips, including the bits that were checked in the kernel driver to
detect it.

The patch below fixes the detection by checking an other bit of the
configuration register instead.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 drivers/i2c/chips/ds1621.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)


diff -Nru a/drivers/i2c/chips/ds1621.c b/drivers/i2c/chips/ds1621.c
--- a/drivers/i2c/chips/ds1621.c	2005-02-03 09:35:23 -08:00
+++ b/drivers/i2c/chips/ds1621.c	2005-02-03 09:35:23 -08:00
@@ -42,9 +42,8 @@
 /* Many DS1621 constants specified below */
 /* Config register used for detection         */
 /*  7    6    5    4    3    2    1    0      */
-/* |Done|THF |TLF |NVB | 1  | 0  |POL |1SHOT| */
-#define DS1621_REG_CONFIG_MASK		0x0C
-#define DS1621_REG_CONFIG_VAL		0x08
+/* |Done|THF |TLF |NVB | X  | X  |POL |1SHOT| */
+#define DS1621_REG_CONFIG_NVB		0x10
 #define DS1621_REG_CONFIG_POLARITY	0x02
 #define DS1621_REG_CONFIG_1SHOT		0x01
 #define DS1621_REG_CONFIG_DONE		0x80
@@ -55,6 +54,7 @@
 #define DS1621_REG_TEMP_MAX		0xA2 /* word, RW */
 #define DS1621_REG_CONF			0xAC /* byte, RW */
 #define DS1621_COM_START		0xEE /* no data */
+#define DS1621_COM_STOP			0x22 /* no data */
 
 /* The DS1621 configuration register */
 #define DS1621_ALARM_TEMP_HIGH		0x40
@@ -212,9 +212,13 @@
 
 	/* Now, we do the remaining detection. It is lousy. */
 	if (kind < 0) {
+		/* The NVB bit should be low if no EEPROM write has been 
+		   requested during the latest 10ms, which is highly 
+		   improbable in our case. */
 		conf = ds1621_read_value(new_client, DS1621_REG_CONF);
-		if ((conf & DS1621_REG_CONFIG_MASK) != DS1621_REG_CONFIG_VAL)
+		if (conf & DS1621_REG_CONFIG_NVB)
 			goto exit_free;
+		/* The 7 lowest bits of a temperature should always be 0. */
 		temp = ds1621_read_value(new_client, DS1621_REG_TEMP);
 		if (temp & 0x007f)
 			goto exit_free;


  reply	other threads:[~2005-02-03 17:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-03 17:37 [BK PATCH] I2C fixes for 2.6.11-rc3 Greg KH
2005-02-03 17:38 ` Greg KH [this message]
2005-02-03 17:38   ` [PATCH] I2C: Resolve resource conflict between i2c-viapro and via686a Greg KH
2005-02-03 17:38     ` [PATCH] I2C: Use standard temperature converters for as99127f Greg KH
2005-02-03 17:38       ` [PATCH] I2C: Reduce it87 i2c address range Greg KH
2005-02-03 17:38         ` [PATCH] I2C: Fix i2c-sis5595 pci configuration accesses Greg KH
2005-02-03 17:38           ` [PATCH] I2C: Do not show disabled pc87360 fans Greg KH
2005-02-03 17:38             ` [PATCH] I2C: Prevent buffer overflow on SMBus block read in Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11074523381178@kroah.com \
    --to=greg@kroah.com \
    --cc=aurelien@aurel32.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sensors@Stimpy.netroedge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox