X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fhwmon%2Flm81.c;h=c1fc42a83321d002f4c971844e956a447a88916b;hb=e4e251a94a8477d36fa61a9c219430fa4c83fb6b;hp=03bc53d58c421e631ffe01210b9b1fa848b25a4f;hpb=6a40ef62c4300e9f606deef0a4618cbc4b514a51;p=u-boot diff --git a/drivers/hwmon/lm81.c b/drivers/hwmon/lm81.c index 03bc53d58c..c1fc42a833 100644 --- a/drivers/hwmon/lm81.c +++ b/drivers/hwmon/lm81.c @@ -7,23 +7,7 @@ * (C) Copyright 2001 * Bill Hunter, Wave 7 Optics, williamhunter@mediaone.net * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * SPDX-License-Identifier: GPL-2.0+ */ /* @@ -31,13 +15,6 @@ */ #include - -#ifdef CONFIG_DTT_LM81 -#if !defined(CFG_EEPROM_PAGE_WRITE_ENABLE) || \ - (CFG_EEPROM_PAGE_WRITE_BITS < 1) -# error "CFG_EEPROM_PAGE_WRITE_ENABLE must be defined and CFG_EEPROM_PAGE_WRITE_BITS must be greater than 1 to use CONFIG_DTT_LM81" -#endif - #include #include @@ -45,6 +22,11 @@ * Device code */ #define DTT_I2C_DEV_CODE 0x2c /* ON Semi's LM81 device */ +#define DTT_READ_TEMP 0x27 +#define DTT_CONFIG_TEMP 0x4b +#define DTT_TEMP_MAX 0x39 +#define DTT_TEMP_HYST 0x3a +#define DTT_CONFIG 0x40 int dtt_read(int sensor, int reg) { @@ -91,7 +73,7 @@ int dtt_write(int sensor, int reg, int val) #define DTT_CONFIG 0x40 #define DTT_ADR 0x48 -static int _dtt_init(int sensor) +int dtt_init_one(int sensor) { int man; int adr; @@ -111,28 +93,11 @@ static int _dtt_init(int sensor) if (adr < 0) return 1; - printf ("DTT: Found LM81@%x Rev: %d\n", adr, rev); + debug ("DTT: Found LM81@%x Rev: %d\n", adr, rev); return 0; -} /* _dtt_init() */ +} /* dtt_init_one() */ -int dtt_init (void) -{ - int i; - unsigned char sensors[] = CONFIG_DTT_SENSORS; - const char *const header = "DTT: "; - - for (i = 0; i < sizeof(sensors); i++) { - if (_dtt_init(sensors[i]) != 0) - printf("%s%d FAILED INIT\n", header, i+1); - else - printf("%s%d is %i C\n", header, i+1, - dtt_get_temp(sensors[i])); - } - - return (0); -} /* dtt_init() */ - #define TEMP_FROM_REG(temp) \ ((temp)<256?((((temp)&0x1fe) >> 1) * 10) + ((temp) & 1) * 5: \ ((((temp)&0x1fe) >> 1) -255) * 10 - ((temp) & 1) * 5) \ @@ -144,5 +109,3 @@ int dtt_get_temp(int sensor) return (TEMP_FROM_REG((val << 1) + ((tmpcnf & 0x80) >> 7))) / 10; } /* dtt_get_temp() */ - -#endif /* CONFIG_DTT_LM81 */