Source
/*
* ds1621.c - Part of lm_sensors, Linux kernel modules for hardware
* monitoring
* Christian W. Zuckschwerdt <zany@triq.net> 2000-11-23
* based on lm75.c by Frodo Looijaard <frodol@dds.nl>
* Ported to Linux 2.6 by Aurelien Jarno <aurelien@aurel32.net> with
* the help of Jean Delvare <jdelvare@suse.de>
*
* The DS1621 device is a digital temperature/thermometer with 9-bit
* resolution, a thermal alarm output (Tout), and user-defined minimum
* and maximum temperature thresholds (TH and TL).
*
* The DS1625, DS1631, DS1721, and DS1731 are pin compatible with the DS1621
* and similar in operation, with slight variations as noted in the device
* datasheets (please refer to www.maximintegrated.com for specific
* device information).
*
* Since the DS1621 was the first chipset supported by this driver,
* most comments will refer to this chipset, but are actually general
* and concern all supported chipsets, unless mentioned otherwise.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* Supported devices */
enum chips { ds1621, ds1625, ds1631, ds1721, ds1731 };
/* Insmod parameters */
static int polarity = -1;
module_param(polarity, int, 0);
MODULE_PARM_DESC(polarity, "Output's polarity: 0 = active high, 1 = active low");
/*
* The Configuration/Status register
*
* - DS1621:
* 7 6 5 4 3 2 1 0
* |Done|THF |TLF |NVB | X | X |POL |1SHOT|
*
* - DS1625:
* 7 6 5 4 3 2 1 0
* |Done|THF |TLF |NVB | 1 | 0 |POL |1SHOT|
*
* - DS1631, DS1731:
* 7 6 5 4 3 2 1 0
* |Done|THF |TLF |NVB | R1 | R0 |POL |1SHOT|
*
* - DS1721:
* 7 6 5 4 3 2 1 0
* |Done| X | X | U | R1 | R0 |POL |1SHOT|
*
* Where:
* - 'X' is Reserved
* - 'U' is Undefined
*/
/* ds1721 conversion rates: {C/LSB, time(ms), resolution bit setting} */
static const unsigned short ds1721_convrates[] = {
94, /* 9-bits (0.5, 93.75, RES[0..1] = 0 */
188, /* 10-bits (0.25, 187.5, RES[0..1] = 1 */
375, /* 11-bits (0.125, 375, RES[0..1] = 2 */