From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH 1/4] Add driver for National Semiconductor LM73 temperature sensor
Date: Fri, 2 Nov 2007 07:36:01 +0100 [thread overview]
Message-ID: <200711020736.02238.sr@denx.de> (raw)
In-Reply-To: <472AC03C.4070301@arlinx.com>
Hi Larry,
On Friday 02 November 2007, Larry Johnson wrote:
> This driver is based on the driver for the LM75.
>
> Signed-off-by: Larry Johnson <lrj@acm.org>
> ---
>
> dtt/Makefile | 2 +-
> dtt/lm73.c | 186
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/dtt.h |
> 12 ++++-
> 3 files changed, 198 insertions(+), 2 deletions(-)
>
> diff --git a/dtt/Makefile b/dtt/Makefile
> index c6a670a..04abbaf 100644
> --- a/dtt/Makefile
> +++ b/dtt/Makefile
> @@ -30,7 +30,7 @@ include $(TOPDIR)/config.mk
>
> LIB = $(obj)libdtt.a
>
> -COBJS = lm75.o ds1621.o adm1021.o lm81.o ds1775.o
> +COBJS = lm75.o ds1621.o adm1021.o lm81.o ds1775.o lm73.o
>
> SRCS := $(COBJS:.o=.c)
> OBJS := $(addprefix $(obj),$(COBJS))
> diff --git a/dtt/lm73.c b/dtt/lm73.c
> new file mode 100644
> index 0000000..1e0bffa
> --- /dev/null
> +++ b/dtt/lm73.c
> @@ -0,0 +1,186 @@
> +/*
> + * (C) Copyright 2007
> + * Larry Johnson, lrj at acm.org
> + *
> + * based on dtt/lm75.c which is ...
> + *
> + * (C) Copyright 2001
> + * Bill Hunter, Wave 7 Optics, williamhunter at 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
> + */
> +
> +/*
> + * National Semiconductor LM73 Temperature Sensor
> + */
> +
> +#include <common.h>
> +
> +#ifdef CONFIG_DTT_LM73
> +#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_LM73"
> +#endif
> +
> +#include <i2c.h>
> +#include <dtt.h>
> +
> +/*
> + * Device code
> + */
> +#define DTT_I2C_DEV_CODE 0x48 /* National Semi's LM73 device */
> +
> +int dtt_read(int sensor, int reg)
> +{
> + int dlen;
> + uchar data[2];
> +
> + /*
> + * Validate 'reg' param and get register size.
> + */
> + switch (reg) {
> + case DTT_CONFIG:
> + case DTT_CONTROL:
> + dlen = 1;
> + break;
> + case DTT_READ_TEMP:
> + case DTT_TEMP_HIGH:
> + case DTT_TEMP_LOW:
> + case DTT_ID:
> + dlen = 2;
> + break;
> + default:
> + return -1;
> + }
> + /*
> + * Calculate sensor address and register.
> + */
> + sensor = DTT_I2C_DEV_CODE + (sensor & 0x07); /* calculate LM73 addr */
> + /*
> + * Now try to read the register.
> + */
> + if (i2c_read(sensor, reg, 1, data, dlen) != 0) {
> + return -1;
> + }
No braces for single line statements please. This is a problem with all your
patches. Please recheck them and fix this.
Otherwise looks good. Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
prev parent reply other threads:[~2007-11-02 6:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-02 6:14 [U-Boot-Users] [PATCH 1/4] Add driver for National Semiconductor LM73 temperature sensor Larry Johnson
2007-11-02 6:36 ` Stefan Roese [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=200711020736.02238.sr@denx.de \
--to=sr@denx.de \
--cc=u-boot@lists.denx.de \
/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