All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Prendel <andre.prendel@gmx.de>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH] sensors-detect: Add TMP42x chip detection
Date: Tue, 14 Jul 2009 20:19:22 +0000	[thread overview]
Message-ID: <20090714201922.GC4482@ubuntu> (raw)
In-Reply-To: <20090712193403.GA4444@ubuntu>

On Tue, Jul 14, 2009 at 07:47:00PM +0200, Jean Delvare wrote:
> On Tue, 14 Jul 2009 19:11:32 +0200, Andre Prendel wrote:
> > Below you can find an updated patch with the comment for addresses not
> > probed. Further I've adjusted the address range for TMP422 and
> > TMP423. TMP422 only supports 0x4c-0x4f and TMP423 0x4c, 0x4d.
> > ---
> 
> Ah, yeah, good catch. BTW this could be used to improve detection
> reliability in the tmp421 driver.
> 
> > 
> > Index: sensors/prog/detect/sensors-detect
> > =================================> > --- sensors.orig/prog/detect/sensors-detect	2009-07-10 22:15:41.000000000 +0200
> > +++ sensors/prog/detect/sensors-detect	2009-07-14 18:34:05.000000000 +0200
> > @@ -908,6 +908,21 @@
> >  		i2c_addrs => [0x4c..0x4e],
> >  		i2c_detect => sub { lm90_detect(@_, 10); },
> >  	}, {
> > +		name => "Texas Instruments TMP421",
> > +		driver => "tmp421",
> > +		i2c_addrs => [0x2a, 0x4c..0x4f], # 0x1c-0x1f not probed.
> > +		i2c_detect => sub { tmp42x_detect(@_, 0); },
> > +	}, {
> > +		name => "Texas Instruments TMP422",
> > +		driver => "tmp421",
> > +		i2c_addrs => [0x4c..0x4f],
> > +		i2c_detect => sub { tmp42x_detect(@_, 1); },
> > +	}, {
> > +		name => "Texas Instruments TMP423",
> > +		driver => "tmp421",
> > +		i2c_addrs => [0x4c, 0x4d],
> > +		i2c_detect => sub { tmp42x_detect(@_, 2); },
> > +	}, {
> >  		name => "National Semiconductor LM95231",
> >  		driver => "to-be-written",
> >  		i2c_addrs => [0x2b, 0x19, 0x2a],
> > @@ -3907,6 +3922,25 @@
> >  }
> >  
> >  # Registers used:
> 
> Please add a reminder about the values of $chip, as other detect
> functions do.
> 
> > +#   0xfe: Manufactorer ID
> > +#   0xff: Device ID
> > +sub tmp42x_detect()
> > +{
> > +	my ($file, $addr, $chip) = @_;
> > +
> > +	my $mid = i2c_smbus_read_byte_data($file, 0xfe);
> > +	my $cid = i2c_smbus_read_byte_data($file, 0xff);
> > +
> > +	return if ($mid != 0x55);
> > +
> > +	return 6 if ($chip = 0 && $cid = 0x21); # TMP421
> > +	return 6 if ($chip = 1 && $cid = 0x22); # TMP422
> > +	return 6 if ($chip = 2 && $cid = 0x23); # TMP423
> > +
> > +	return;
> > +}
> > +
> > +# Registers used:
> >  #   0x03: Configuration (no low nibble, returns the previous low nibble)
> >  #   0x04: Conversion rate
> >  #   0xfe: Manufacturer ID
> 
> Other than that, looks good, please apply.

Done.

Thanks,
Andre

> -- 
> Jean Delvare

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

      parent reply	other threads:[~2009-07-14 20:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-12 19:34 [lm-sensors] [PATCH] sensors-detect: Add TMP42x chip detection Andre Prendel
2009-07-13  8:53 ` Jean Delvare
2009-07-13 11:44 ` Andre Prendel
2009-07-13 12:10 ` Jean Delvare
2009-07-14 17:11 ` Andre Prendel
2009-07-14 17:47 ` Jean Delvare
2009-07-14 20:19 ` Andre Prendel [this message]

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=20090714201922.GC4482@ubuntu \
    --to=andre.prendel@gmx.de \
    --cc=lm-sensors@vger.kernel.org \
    /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 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.