From: Wolfgang Denk Date: Thu, 10 Jul 2008 21:58:52 +0200 Subject: [U-Boot-Users] [PATCH] -Support fot the ADT7640 Monitor chip In-Reply-To: Your message of "Thu, 10 Jul 2008 19:53:21 +0200." <1215712408-23567-2-git-send-email-ricardo.ribalda@uam.es> Message-ID: <20080710195852.C2BC4242FF@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de In message <1215712408-23567-2-git-send-email-ricardo.ribalda@uam.es> you wrote: > > Signed-off-by: Ricardo Ribalda Delgado > --- > drivers/hwmon/Makefile | 1 + > drivers/hwmon/adt7460.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++ > drivers/hwmon/adt7460.h | 49 ++++++++++++++++++++++++++ > include/dtt.h | 2 +- > 4 files changed, 140 insertions(+), 1 deletions(-) > create mode 100644 drivers/hwmon/adt7460.c > create mode 100644 drivers/hwmon/adt7460.h > > diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile > index 065433a..83aa297 100644 > --- a/drivers/hwmon/Makefile > +++ b/drivers/hwmon/Makefile > @@ -34,6 +34,7 @@ COBJS-y += adm1021.o > COBJS-y += ds1621.o > COBJS-y += ds1722.o > COBJS-y += ds1775.o > +COBJS-y += adt7460.o Please make this COBJS-$(CONFIG_DTT_ADT7460) += adt7460.o instead, > COBJS-$(CONFIG_DTT_LM73) += lm73.o > COBJS-y += lm75.o > COBJS-y += lm81.o > diff --git a/drivers/hwmon/adt7460.c b/drivers/hwmon/adt7460.c > new file mode 100644 > index 0000000..255d6ed > --- /dev/null > +++ b/drivers/hwmon/adt7460.c > @@ -0,0 +1,89 @@ ... > +#ifdef CONFIG_DTT_ADT7460 ...and then drop this #ifdef / #endif > +#include > +#include > +#include "adt7460.h" > + > +#define ADT7460_ADDRESS 0x2c > + > + > +int dtt_read(int sensor, int reg) > +{ > + u8 dir=reg; > + u8 data; > + > + if (-1==i2c_read(ADT7460_ADDRESS,dir,1,&data,1)) Please write if (i2c_read(ADT7460_ADDRESS,dir,1,&data,1) == -1) here and everywhere else. > +int dtt_write(int sensor, int reg, int val) > +{ > + u8 dir=reg; > + u8 data=val; > + > + if (-1==i2c_write(ADT7460_ADDRESS,dir,1,&data,1)) > + return -1; > + > + return 0; Maybe this could be simplyfied as return i2c_write(ADT7460_ADDRESS,dir,1,&data,1); ? > + 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 3 of the License, or > + (at your option) any later version. Please make GPLv2 (or later). ... > --- a/include/dtt.h > +++ b/include/dtt.h > @@ -32,7 +32,7 @@ > defined(CONFIG_DTT_DS1775) || \ > defined(CONFIG_DTT_LM81) || \ > defined(CONFIG_DTT_ADM1021) || \ > - defined(CONFIG_DTT_LM73) > + defined(CONFIG_DTT_LM73)||defined(CONFIG_DTT_ADT7460) Please split on separate line. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Earth -- mother of the most beautiful women in the universe. -- Apollo, "Who Mourns for Adonais?" stardate 3468.1