public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Michal Simek <monstr@seznam.cz>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] -Support fot the ADT7640 Monitor chip
Date: Fri, 11 Jul 2008 08:49:57 +0200	[thread overview]
Message-ID: <48770295.4030007@seznam.cz> (raw)
In-Reply-To: <1215712408-23567-2-git-send-email-ricardo.ribalda@uam.es>


Clean coding style especially long lines, free lines and please choose only one
email address.

Michal

> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@uam.es>
> ---
>  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

look at line below to proper style.

>  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 @@
> +/*   
> +    (C) Copyright 2008
> +    Ricado Ribalda, Universidad Autonoma de Madrid, ricardo.ribalda<at>uam.es , ricardo.ribalda<at>gmail.com
long line

> +    This work has been supported by: Q-Technology  http://qtec.com/
> +
> +    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.
> +
> +    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, see <http://www.gnu.org/licenses/>.
> +*/
> +
> +#include <common.h>
> +
> +#ifdef CONFIG_DTT_ADT7460

why is this ifdef here?

> +
> +#include <i2c.h>
> +#include <dtt.h>
> +#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))
> +		return -1;
> +	
> +	if (data==ADT7460_INVALID)
> +		return -1;
> +
> +	return data;
> +
> +} 
> +
> +
> +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;
> +} 
> +
> +
> +
> +int dtt_init (void)
> +{
> +	printf("ADT7460 at I2C address 0x%2x\n",ADT7460_ADDRESS);
> +	if (-1==dtt_write(0,ADT7460_CONFIG,1)){
> +		printf("Error initialiting ADT7460\n");
> +		return -1;
> +	}
> +	return 0;
> +} 
> +
> +
> +int dtt_get_temp(int sensor)
> +{
> +	int aux;
> +	u8 table[]={ADT7460_REM1_TEMP,ADT7460_LOCAL_TEMP,ADT7460_REM2_TEMP};
> +	if (sensor>2){
> +		printf("DTT sensor does not exist\n");
> +		return -1;
> +	}
> +	
> +	aux=dtt_read(0,table[sensor]);
> +
> +	if (-1==aux){
> +		printf("DTT temperature read failed\n");
> +		return -1;
> +
> +	}
> +	return aux;
> +}
> +#endif 
> diff --git a/drivers/hwmon/adt7460.h b/drivers/hwmon/adt7460.h
> new file mode 100644
> index 0000000..48666f7
> --- /dev/null
> +++ b/drivers/hwmon/adt7460.h
> @@ -0,0 +1,49 @@
> +/*   
> +    (C) Copyright 2008
> +    Ricado Ribalda, Universidad Autonoma de Madrid, ricardo.ribalda<at>uam.es , ricardo.ribalda<at>gmail.com
> +    This work has been supported by: Q-Technology  http://qtec.com/    
> +
> +    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.
> +
> +    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, see <http://www.gnu.org/licenses/>.
> +*/
> +#ifndef ADT7460
> +#define ADT7460
> +
> +
> +#define ADT7460_INVALID 128
> +
> +#define ADT7460_2_5V		0x20
> +#define ADT7460_VCCP		0x21
> +#define ADT7460_VCC		0x22
> +#define ADT7460_V5		0x23
> +#define ADT7460_V12		0x24
> +#define ADT7460_REM1_TEMP	0x25
> +#define ADT7460_LOCAL_TEMP	0x26
> +#define ADT7460_REM2_TEMP	0x27
> +#define ADT7460_TACH1L		0x28
> +#define ADT7460_TACH1H		0x29
> +#define ADT7460_TACH2L		0x2a
> +#define ADT7460_TACH2H		0x2b
> +#define ADT7460_TACH3L		0x2c
> +#define ADT7460_TACH3H		0x2d
> +#define ADT7460_TACH4L		0x2e
> +#define ADT7460_TACH4H		0x2f
> +#define ADT7460_TACH5L		0xa9
> +#define ADT7460_TACH5H		0xaa
> +#define ADT7460_TACH6L		0xab
> +#define ADT7460_TACH6H		0xac
> +#define ADT7460_REVISION	0x3f
> +#define ADT7460_CONFIG		0x40
> +
> +
> +#endif
> diff --git a/include/dtt.h b/include/dtt.h
> index 4e8aaad..73d7547 100644
> --- 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)

follow the same style
>  
>  #define CONFIG_DTT				/* We have a DTT */
>  

      parent reply	other threads:[~2008-07-11  6:49 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-10 17:53 [U-Boot-Users] Support for the ML507 Xilinx Board Ricardo Ribalda Delgado
2008-07-10 17:53 ` [U-Boot-Users] [PATCH] -Support fot the ADT7640 Monitor chip Ricardo Ribalda Delgado
2008-07-10 17:53   ` [U-Boot-Users] [PATCH] I2C Dummy Driver Ricardo Ribalda Delgado
     [not found]     ` <1215712408-23567-4-git-send-email-ricardo.ribalda@uam.es>
     [not found]       ` <1215712408-23567-5-git-send-email-ricardo.ribalda@uam.es>
     [not found]         ` <1215712408-23567-6-git-send-email-ricardo.ribalda@uam.es>
2008-07-10 17:53           ` [U-Boot-Users] [PATCH] Adds support for the PPC440x5 Processor on Virtex5 FX Ricardo Ribalda Delgado
2008-07-10 17:53             ` [U-Boot-Users] [PATCH] Adds support for Xilinx Uart Lite on ppc4xx Ricardo Ribalda Delgado
2008-07-10 18:41               ` Wolfgang Denk
2008-07-10 18:52                 ` Ricardo Ribalda Delgado
2008-07-10 19:02                   ` Wolfgang Denk
2008-07-11  6:57                   ` Michal Simek
2008-07-11  6:30               ` Michal Simek
2008-07-11  7:12                 ` Wolfgang Denk
2008-07-10 18:36             ` [U-Boot-Users] [PATCH] Adds support for the PPC440x5 Processor on Virtex5 FX Wolfgang Denk
2008-07-10 18:45               ` Ricardo Ribalda Delgado
2008-07-10 18:11     ` [U-Boot-Users] [PATCH] I2C Dummy Driver Jerry Van Baren
2008-07-10 20:03     ` Wolfgang Denk
2008-07-10 21:02       ` Ricardo Ribalda Delgado
2008-07-11  6:59         ` Michal Simek
2008-07-11  9:03       ` Andre Schwarz
2008-07-11  6:30     ` Michal Simek
2008-07-10 18:10   ` [U-Boot-Users] [PATCH] -Support fot the ADT7640 Monitor chip Jerry Van Baren
2008-07-10 18:16     ` Ricardo Ribalda Delgado
2008-07-10 18:32       ` Ricardo Ribalda Delgado
2008-07-10 18:57         ` Wolfgang Denk
2008-07-10 19:58   ` Wolfgang Denk
2008-07-10 21:04     ` Ricardo Ribalda Delgado
2008-07-11  6:49   ` Michal Simek [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=48770295.4030007@seznam.cz \
    --to=monstr@seznam.cz \
    --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