* [BK PATCH] i2c driver fixes for 2.6.1
@ 2004-01-19 23:57 Greg KH
2004-01-19 23:59 ` [PATCH] " Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:57 UTC (permalink / raw)
To: torvalds, akpm; +Cc: linux-kernel, sensors
Hi,
Here are some i2c driver fixes and updates for 2.6.1. There are a
number of bug fixes here, and a few new drivers have been added to the
tree.
Please pull from: bk://kernel.bkbits.net/gregkh/linux/i2c-2.6
Individual patches will follow, sent to the sensors and linux-kernel
lists.
thanks,
greg k-h
Documentation/i2c/porting-clients | 5
drivers/Kconfig | 2
drivers/char/Kconfig | 2
drivers/i2c/Kconfig | 32
drivers/i2c/algos/Kconfig | 1
drivers/i2c/algos/i2c-algo-pcf.h | 2
drivers/i2c/busses/Kconfig | 101 ++-
drivers/i2c/busses/Makefile | 2
drivers/i2c/busses/i2c-ali1535.c | 5
drivers/i2c/busses/i2c-ali15x3.c | 5
drivers/i2c/busses/i2c-amd756.c | 5
drivers/i2c/busses/i2c-amd8111.c | 5
drivers/i2c/busses/i2c-elektor.c | 19
drivers/i2c/busses/i2c-elv.c | 17
drivers/i2c/busses/i2c-frodo.c | 5
drivers/i2c/busses/i2c-i801.c | 5
drivers/i2c/busses/i2c-i810.c | 5
drivers/i2c/busses/i2c-ibm_iic.c | 8
drivers/i2c/busses/i2c-iop3xx.c | 9
drivers/i2c/busses/i2c-isa.c | 5
drivers/i2c/busses/i2c-ite.c | 24
drivers/i2c/busses/i2c-keywest.c | 36 -
drivers/i2c/busses/i2c-nforce2.c | 5
drivers/i2c/busses/i2c-parport-light.c | 179 +++++
drivers/i2c/busses/i2c-parport.c | 273 ++++++++
drivers/i2c/busses/i2c-parport.h | 87 ++
drivers/i2c/busses/i2c-philips-par.c | 9
drivers/i2c/busses/i2c-piix4.c | 12
drivers/i2c/busses/i2c-prosavage.c | 5
drivers/i2c/busses/i2c-rpx.c | 9
drivers/i2c/busses/i2c-savage4.c | 5
drivers/i2c/busses/i2c-sis5595.c | 10
drivers/i2c/busses/i2c-sis630.c | 5
drivers/i2c/busses/i2c-sis96x.c | 5
drivers/i2c/busses/i2c-velleman.c | 14
drivers/i2c/busses/i2c-via.c | 7
drivers/i2c/busses/i2c-viapro.c | 5
drivers/i2c/busses/i2c-voodoo3.c | 5
drivers/i2c/busses/scx200_acb.c | 15
drivers/i2c/busses/scx200_i2c.c | 10
drivers/i2c/chips/Kconfig | 36 +
drivers/i2c/chips/Makefile | 7
drivers/i2c/chips/adm1021.c | 5
drivers/i2c/chips/asb100.c | 1059 ++++++++++++++++++++++++++++++++-
drivers/i2c/chips/eeprom.c | 67 +-
drivers/i2c/chips/it87.c | 13
drivers/i2c/chips/lm75.c | 5
drivers/i2c/chips/lm78.c | 7
drivers/i2c/chips/lm83.c | 7
drivers/i2c/chips/lm85.c | 5
drivers/i2c/chips/lm90.c | 529 ++++++++++++++++
drivers/i2c/chips/via686a.c | 5
drivers/i2c/chips/w83781d.c | 37 -
drivers/i2c/chips/w83l785ts.c | 314 +++++++++
drivers/i2c/i2c-core.c | 114 +--
drivers/i2c/i2c-dev.c | 10
drivers/i2c/i2c-sensor.c | 5
drivers/ieee1394/Kconfig | 9
drivers/media/video/Kconfig | 13
drivers/media/video/saa7146.h | 1
drivers/video/Kconfig | 21
include/linux/i2c-id.h | 3
62 files changed, 2966 insertions(+), 266 deletions(-)
-----
<ebs:ebshome.net>:
o I2C: IBM IIC compile fix
Greg Kroah-Hartman:
o I2C: remove unneeded CVS Id: lines
o I2C: add I2C_DEBUG_BUS config option and convert the i2c bus drivers to use it
o I2C: add I2C_DEBUG_CHIP config option and convert the i2c chip drivers to use it
o I2C: add I2C_DEBUG_CORE config option and convert the i2c core code to use it
o I2C: only select I2C_ITE if we are a MIPS system
o I2C: remove CONFIG_ISA dependancy for I2C_ISA as x86_64 does not have CONFIG_ISA
o I2C: move the Kconfig "source..." out of the drivers/char/ location
Jean Delvare:
o I2C: Autoselect i2c algos
o I2C: New driver: w83l785ts
o I2C: Fix i2c busses warnings with DEBUG
o I2C: Fix i2c-core.c with DEBUG
o I2C: Fix lm90.c with DEBUG
o I2C: speed up eeprom driver by a factor of 4
o I2C: i2c-i801 help
o I2C: clean up ISA dependancies
o I2C: restore correct vaio handling in eeprom driver
o I2C: Fix debug bug in lm83 driver
o I2C: Fix w83781d temp
o I2C: New chip driver: lm90
o I2C: New parport bus drivers
o I2C: i2c-rpx.c doesn't need ioports.h nor parport.h
o I2C: Typo in i2c/busses/Kconfig
o I2C: saa7146.h doesn't need i2c.h
o I2C: documentation update
Mark M. Hoffman:
o I2C: link asb100 in the proper order
o I2C: Add ported sensor chip driver: asb100
Matthew Wilcox:
o I2C: Kconfig cleanups
Tom Rini:
o I2C: module_parm fixes for i2c-piix4.c
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:57 [BK PATCH] i2c driver fixes for 2.6.1 Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.1, 2004/01/14 11:08:59-08:00, trini@kernel.crashing.org
[PATCH] I2C: module_parm fixes for i2c-piix4.c
drivers/i2c/busses/i2c-piix4.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff -Nru a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
--- a/drivers/i2c/busses/i2c-piix4.c Mon Jan 19 15:33:22 2004
+++ b/drivers/i2c/busses/i2c-piix4.c Mon Jan 19 15:33:22 2004
@@ -31,6 +31,7 @@
/* #define DEBUG 1 */
#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/config.h>
#include <linux/pci.h>
#include <linux/kernel.h>
@@ -88,13 +89,13 @@
/* If force is set to anything different from 0, we forcibly enable the
PIIX4. DANGEROUS! */
static int force = 0;
-MODULE_PARM(force, "i");
+module_param (force, int, 0);
MODULE_PARM_DESC(force, "Forcibly enable the PIIX4. DANGEROUS!");
/* If force_addr is set to anything different from 0, we forcibly enable
the PIIX4 at the given address. VERY DANGEROUS! */
static int force_addr = 0;
-MODULE_PARM(force_addr, "i");
+module_param (force_addr, int, 0);
MODULE_PARM_DESC(force_addr,
"Forcibly enable the PIIX4 at the given address. "
"EXTREMELY DANGEROUS!");
@@ -102,7 +103,7 @@
/* If fix_hstcfg is set to anything different from 0, we reset one of the
registers to be a valid value. */
static int fix_hstcfg = 0;
-MODULE_PARM(fix_hstcfg, "i");
+module_param (fix_hstcfg, int, 0);
MODULE_PARM_DESC(fix_hstcfg,
"Fix config register. Needed on some boards (Force CPCI735).");
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` [PATCH] " Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-20 22:03 ` Jean Delvare
0 siblings, 2 replies; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.2, 2004/01/14 11:09:15-08:00, khali@linux-fr.org
[PATCH] I2C: documentation update
> > They should be converted. From module.h:
> > /* DEPRECATED: Do not use. */
> > #define MODULE_PARM(var,type) \
> > ...
>
> Note that realistically, it's not going away in 2.6, so mass migration
> doesn't really win anything. However, I never implemented mixing old
> and new style in the same module, so if you're adding a parameter, it
> makes sense to convert them all.
OK, I don't have much time for a mass conversion anyway. Greg, could you
please apply the following patch to the "porting-clients" document so
that at least the new drivers don't need to be converted afterwards?
Documentation/i2c/porting-clients | 5 ++++-
1 files changed, 4 insertions(+), 1 deletion(-)
diff -Nru a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients
--- a/Documentation/i2c/porting-clients Mon Jan 19 15:33:17 2004
+++ b/Documentation/i2c/porting-clients Mon Jan 19 15:33:17 2004
@@ -92,7 +92,10 @@
i2c_get_clientdata(client) instead.
* [Interface] Init function should not print anything. Make sure
- there is a MODULE_LICENSE() line.
+ there is a MODULE_LICENSE() line. MODULE_PARM() is replaced
+ by module_param(). Note that module_param has a third parameter,
+ that you should set to 0 by default. See include/linux/moduleparam.h
+ for details.
Coding policy:
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-20 22:03 ` Jean Delvare
1 sibling, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.3, 2004/01/14 11:10:53-08:00, mhoffman@lightlink.com
[PATCH] I2C: Add ported sensor chip driver: asb100
This patch adds support for the ASB100 Bach sensor chip, which
is found on some Asus mainboards. The port corresponds to
lm_sensors CVS revision 1.5. The patch applies to and was tested
against 2.6.1-rc1.
drivers/i2c/chips/Kconfig | 11
drivers/i2c/chips/Makefile | 1
drivers/i2c/chips/asb100.c | 1053 +++++++++++++++++++++++++++++++++++++++++++++
include/linux/i2c-id.h | 1
4 files changed, 1066 insertions(+)
diff -Nru a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
--- a/drivers/i2c/chips/Kconfig Mon Jan 19 15:33:05 2004
+++ b/drivers/i2c/chips/Kconfig Mon Jan 19 15:33:05 2004
@@ -21,6 +21,17 @@
This driver can also be built as a module. If so, the module
will be called adm1021.
+config SENSORS_ASB100
+ tristate "Asus ASB100 Bach"
+ depends on I2C && EXPERIMENTAL
+ select I2C_SENSOR
+ help
+ If you say yes here you get support for the ASB100 Bach sensor
+ chip found on some Asus mainboards.
+
+ This driver can also be built as a module. If so, the module
+ will be called asb100.
+
config SENSORS_EEPROM
tristate "EEPROM (DIMM) reader"
depends on I2C && EXPERIMENTAL
diff -Nru a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
--- a/drivers/i2c/chips/Makefile Mon Jan 19 15:33:05 2004
+++ b/drivers/i2c/chips/Makefile Mon Jan 19 15:33:05 2004
@@ -6,6 +6,7 @@
obj-$(CONFIG_SENSORS_W83781D) += w83781d.o
obj-$(CONFIG_SENSORS_ADM1021) += adm1021.o
+obj-$(CONFIG_SENSORS_ASB100) += asb100.o
obj-$(CONFIG_SENSORS_EEPROM) += eeprom.o
obj-$(CONFIG_SENSORS_IT87) += it87.o
obj-$(CONFIG_SENSORS_LM75) += lm75.o
diff -Nru a/drivers/i2c/chips/asb100.c b/drivers/i2c/chips/asb100.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/i2c/chips/asb100.c Mon Jan 19 15:33:05 2004
@@ -0,0 +1,1053 @@
+/*
+ asb100.c - Part of lm_sensors, Linux kernel modules for hardware
+ monitoring
+
+ Copyright (C) 2004 Mark M. Hoffman <mhoffman@lightlink.com>
+
+ (derived from w83781d.c)
+
+ Copyright (C) 1998 - 2003 Frodo Looijaard <frodol@dds.nl>,
+ Philip Edelbrock <phil@netroedge.com>, and
+ Mark Studebaker <mdsxyz123@yahoo.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 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.
+*/
+
+/*
+ This driver supports the hardware sensor chips: Asus ASB100 and
+ ASB100-A "BACH".
+
+ ASB100-A supports pwm1, while plain ASB100 does not. There is no known
+ way for the driver to tell which one is there.
+
+ Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA
+ asb100 7 3 1 4 0x31 0x0694 yes no
+*/
+
+/* #define DEBUG 1 */
+
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/ioport.h>
+#include <linux/types.h>
+#include <linux/i2c.h>
+#include <linux/i2c-sensor.h>
+#include <linux/i2c-vid.h>
+#include <linux/init.h>
+#include <asm/errno.h>
+#include <asm/io.h>
+#include "lm75.h"
+
+/*
+ HISTORY:
+ 2003-12-29 1.0.0 Ported from lm_sensors project for kernel 2.6
+*/
+#define ASB100_VERSION "1.0.0"
+
+/* I2C addresses to scan */
+static unsigned short normal_i2c[] = { I2C_CLIENT_END };
+static unsigned short normal_i2c_range[] = { 0x28, 0x2f, I2C_CLIENT_END };
+
+/* ISA addresses to scan (none) */
+static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
+static unsigned int normal_isa_range[] = { I2C_CLIENT_ISA_END };
+
+/* default VRM to 9.0 instead of 8.2 */
+#define ASB100_DEFAULT_VRM 90
+
+/* Insmod parameters */
+SENSORS_INSMOD_1(asb100);
+I2C_CLIENT_MODULE_PARM(force_subclients, "List of subclient addresses: "
+ "{bus, clientaddr, subclientaddr1, subclientaddr2}");
+
+/* Voltage IN registers 0-6 */
+#define ASB100_REG_IN(nr) (0x20 + (nr))
+#define ASB100_REG_IN_MAX(nr) (0x2b + (nr * 2))
+#define ASB100_REG_IN_MIN(nr) (0x2c + (nr * 2))
+
+/* FAN IN registers 1-3 */
+#define ASB100_REG_FAN(nr) (0x28 + (nr))
+#define ASB100_REG_FAN_MIN(nr) (0x3b + (nr))
+
+/* TEMPERATURE registers 1-4 */
+static const u16 asb100_reg_temp[] = {0, 0x27, 0x150, 0x250, 0x17};
+static const u16 asb100_reg_temp_max[] = {0, 0x39, 0x155, 0x255, 0x18};
+static const u16 asb100_reg_temp_hyst[] = {0, 0x3a, 0x153, 0x253, 0x19};
+
+#define ASB100_REG_TEMP(nr) (asb100_reg_temp[nr])
+#define ASB100_REG_TEMP_MAX(nr) (asb100_reg_temp_max[nr])
+#define ASB100_REG_TEMP_HYST(nr) (asb100_reg_temp_hyst[nr])
+
+#define ASB100_REG_TEMP2_CONFIG 0x0152
+#define ASB100_REG_TEMP3_CONFIG 0x0252
+
+
+#define ASB100_REG_CONFIG 0x40
+#define ASB100_REG_ALARM1 0x41
+#define ASB100_REG_ALARM2 0x42
+#define ASB100_REG_SMIM1 0x43
+#define ASB100_REG_SMIM2 0x44
+#define ASB100_REG_VID_FANDIV 0x47
+#define ASB100_REG_I2C_ADDR 0x48
+#define ASB100_REG_CHIPID 0x49
+#define ASB100_REG_I2C_SUBADDR 0x4a
+#define ASB100_REG_PIN 0x4b
+#define ASB100_REG_IRQ 0x4c
+#define ASB100_REG_BANK 0x4e
+#define ASB100_REG_CHIPMAN 0x4f
+
+#define ASB100_REG_WCHIPID 0x58
+
+/* bit 7 -> enable, bits 0-3 -> duty cycle */
+#define ASB100_REG_PWM1 0x59
+
+/* CONVERSIONS
+ Rounding and limit checking is only done on the TO_REG variants. */
+
+/* These constants are a guess, consistent w/ w83781d */
+#define ASB100_IN_MIN ( 0)
+#define ASB100_IN_MAX (4080)
+
+/* IN: 1/1000 V (0V to 4.08V)
+ REG: 16mV/bit */
+static u8 IN_TO_REG(unsigned val)
+{
+ unsigned nval = SENSORS_LIMIT(val, ASB100_IN_MIN, ASB100_IN_MAX);
+ return nval / 16;
+}
+
+static unsigned IN_FROM_REG(u8 reg)
+{
+ return reg * 16;
+}
+
+static u8 FAN_TO_REG(long rpm, int div)
+{
+ if (rpm == -1)
+ return 0;
+ if (rpm == 0)
+ return 255;
+ rpm = SENSORS_LIMIT(rpm, 1, 1000000);
+ return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, 254);
+}
+
+static int FAN_FROM_REG(u8 val, int div)
+{
+ return val==0 ? -1 : val==255 ? 0 : 1350000/(val*div);
+}
+
+/* These constants are a guess, consistent w/ w83781d */
+#define ASB100_TEMP_MIN (-128000)
+#define ASB100_TEMP_MAX ( 127000)
+
+/* TEMP: 0.001C/bit (-128C to +127C)
+ REG: 1C/bit, two's complement */
+static u8 TEMP_TO_REG(int temp)
+{
+ int ntemp = SENSORS_LIMIT(temp, ASB100_TEMP_MIN, ASB100_TEMP_MAX);
+ ntemp += (ntemp<0 ? -500 : 500);
+ return (u8)(ntemp / 1000);
+}
+
+static int TEMP_FROM_REG(u8 reg)
+{
+ return (s8)reg * 1000;
+}
+
+/* PWM: 0 - 255 per sensors documentation
+ REG: (6.25% duty cycle per bit) */
+static u8 ASB100_PWM_TO_REG(int pwm)
+{
+ pwm = SENSORS_LIMIT(pwm, 0, 255);
+ return (u8)(pwm / 16);
+}
+
+static int ASB100_PWM_FROM_REG(u8 reg)
+{
+ return reg * 16;
+}
+
+#define ALARMS_FROM_REG(val) (val)
+
+#define DIV_FROM_REG(val) (1 << (val))
+
+/* FAN DIV: 1, 2, 4, or 8 (defaults to 2)
+ REG: 0, 1, 2, or 3 (respectively) (defaults to 1) */
+static u8 DIV_TO_REG(long val)
+{
+ return val==8 ? 3 : val==4 ? 2 : val==1 ? 0 : 1;
+}
+
+/* For each registered client, we need to keep some data in memory. That
+ data is pointed to by client->data. The structure itself is
+ dynamically allocated, at the same time the client itself is allocated. */
+struct asb100_data {
+ struct semaphore lock;
+ enum chips type;
+
+ struct semaphore update_lock;
+ unsigned long last_updated; /* In jiffies */
+
+ /* array of 2 pointers to subclients */
+ struct i2c_client *lm75[2];
+
+ char valid; /* !=0 if following fields are valid */
+ u8 in[7]; /* Register value */
+ u8 in_max[7]; /* Register value */
+ u8 in_min[7]; /* Register value */
+ u8 fan[3]; /* Register value */
+ u8 fan_min[3]; /* Register value */
+ u16 temp[4]; /* Register value (0 and 3 are u8 only) */
+ u16 temp_max[4]; /* Register value (0 and 3 are u8 only) */
+ u16 temp_hyst[4]; /* Register value (0 and 3 are u8 only) */
+ u8 fan_div[3]; /* Register encoding, right justified */
+ u8 pwm; /* Register encoding */
+ u8 vid; /* Register encoding, combined */
+ u32 alarms; /* Register encoding, combined */
+ u8 vrm;
+};
+
+static int asb100_read_value(struct i2c_client *client, u16 reg);
+static void asb100_write_value(struct i2c_client *client, u16 reg, u16 val);
+
+static int asb100_attach_adapter(struct i2c_adapter *adapter);
+static int asb100_detect(struct i2c_adapter *adapter, int address, int kind);
+static int asb100_detach_client(struct i2c_client *client);
+static struct asb100_data *asb100_update_device(struct device *dev);
+static void asb100_init_client(struct i2c_client *client);
+
+static struct i2c_driver asb100_driver = {
+ .owner = THIS_MODULE,
+ .name = "asb100",
+ .id = I2C_DRIVERID_ASB100,
+ .flags = I2C_DF_NOTIFY,
+ .attach_adapter = asb100_attach_adapter,
+ .detach_client = asb100_detach_client,
+};
+
+/* 7 Voltages */
+#define show_in_reg(reg) \
+static ssize_t show_##reg (struct device *dev, char *buf, int nr) \
+{ \
+ struct asb100_data *data = asb100_update_device(dev); \
+ return sprintf(buf, "%d\n", IN_FROM_REG(data->reg[nr])); \
+}
+
+show_in_reg(in)
+show_in_reg(in_min)
+show_in_reg(in_max)
+
+#define set_in_reg(REG, reg) \
+static ssize_t set_in_##reg(struct device *dev, const char *buf, \
+ size_t count, int nr) \
+{ \
+ struct i2c_client *client = to_i2c_client(dev); \
+ struct asb100_data *data = i2c_get_clientdata(client); \
+ unsigned long val = simple_strtoul(buf, NULL, 10); \
+ data->in_##reg[nr] = IN_TO_REG(val); \
+ asb100_write_value(client, ASB100_REG_IN_##REG(nr), \
+ data->in_##reg[nr]); \
+ return count; \
+}
+
+set_in_reg(MIN, min)
+set_in_reg(MAX, max)
+
+#define sysfs_in(offset) \
+static ssize_t \
+ show_in##offset (struct device *dev, char *buf) \
+{ \
+ return show_in(dev, buf, 0x##offset); \
+} \
+static DEVICE_ATTR(in_input##offset, S_IRUGO, \
+ show_in##offset, NULL) \
+static ssize_t \
+ show_in##offset##_min (struct device *dev, char *buf) \
+{ \
+ return show_in_min(dev, buf, 0x##offset); \
+} \
+static ssize_t \
+ show_in##offset##_max (struct device *dev, char *buf) \
+{ \
+ return show_in_max(dev, buf, 0x##offset); \
+} \
+static ssize_t set_in##offset##_min (struct device *dev, \
+ const char *buf, size_t count) \
+{ \
+ return set_in_min(dev, buf, count, 0x##offset); \
+} \
+static ssize_t set_in##offset##_max (struct device *dev, \
+ const char *buf, size_t count) \
+{ \
+ return set_in_max(dev, buf, count, 0x##offset); \
+} \
+static DEVICE_ATTR(in_min##offset, S_IRUGO | S_IWUSR, \
+ show_in##offset##_min, set_in##offset##_min) \
+static DEVICE_ATTR(in_max##offset, S_IRUGO | S_IWUSR, \
+ show_in##offset##_max, set_in##offset##_max)
+
+sysfs_in(0)
+sysfs_in(1)
+sysfs_in(2)
+sysfs_in(3)
+sysfs_in(4)
+sysfs_in(5)
+sysfs_in(6)
+
+#define device_create_file_in(client, offset) do { \
+ device_create_file(&client->dev, &dev_attr_in_input##offset); \
+ device_create_file(&client->dev, &dev_attr_in_min##offset); \
+ device_create_file(&client->dev, &dev_attr_in_max##offset); \
+} while (0)
+
+/* 3 Fans */
+static ssize_t show_fan(struct device *dev, char *buf, int nr)
+{
+ struct asb100_data *data = asb100_update_device(dev);
+ return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[nr],
+ DIV_FROM_REG(data->fan_div[nr])));
+}
+
+static ssize_t show_fan_min(struct device *dev, char *buf, int nr)
+{
+ struct asb100_data *data = asb100_update_device(dev);
+ return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan_min[nr],
+ DIV_FROM_REG(data->fan_div[nr])));
+}
+
+static ssize_t show_fan_div(struct device *dev, char *buf, int nr)
+{
+ struct asb100_data *data = asb100_update_device(dev);
+ return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[nr]));
+}
+
+static ssize_t set_fan_min(struct device *dev, const char *buf,
+ size_t count, int nr)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct asb100_data *data = i2c_get_clientdata(client);
+ u32 val = simple_strtoul(buf, NULL, 10);
+ data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr]));
+ asb100_write_value(client, ASB100_REG_FAN_MIN(nr), data->fan_min[nr]);
+ return count;
+}
+
+/* Note: we save and restore the fan minimum here, because its value is
+ determined in part by the fan divisor. This follows the principle of
+ least suprise; the user doesn't expect the fan minimum to change just
+ because the divisor changed. */
+static ssize_t set_fan_div(struct device *dev, const char *buf,
+ size_t count, int nr)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct asb100_data *data = i2c_get_clientdata(client);
+ unsigned long min = FAN_FROM_REG(data->fan_min[nr],
+ DIV_FROM_REG(data->fan_div[nr]));
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+ int reg;
+
+ data->fan_div[nr] = DIV_TO_REG(val);
+
+ switch(nr) {
+ case 0: /* fan 1 */
+ reg = asb100_read_value(client, ASB100_REG_VID_FANDIV);
+ reg = (reg & 0xcf) | (data->fan_div[0] << 4);
+ asb100_write_value(client, ASB100_REG_VID_FANDIV, reg);
+ break;
+
+ case 1: /* fan 2 */
+ reg = asb100_read_value(client, ASB100_REG_VID_FANDIV);
+ reg = (reg & 0x3f) | (data->fan_div[1] << 6);
+ asb100_write_value(client, ASB100_REG_VID_FANDIV, reg);
+ break;
+
+ case 2: /* fan 3 */
+ reg = asb100_read_value(client, ASB100_REG_PIN);
+ reg = (reg & 0x3f) | (data->fan_div[2] << 6);
+ asb100_write_value(client, ASB100_REG_PIN, reg);
+ break;
+ }
+
+ data->fan_min[nr] =
+ FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr]));
+ asb100_write_value(client, ASB100_REG_FAN_MIN(nr), data->fan_min[nr]);
+ return count;
+}
+
+#define sysfs_fan(offset) \
+static ssize_t show_fan##offset(struct device *dev, char *buf) \
+{ \
+ return show_fan(dev, buf, offset - 1); \
+} \
+static ssize_t show_fan##offset##_min(struct device *dev, char *buf) \
+{ \
+ return show_fan_min(dev, buf, offset - 1); \
+} \
+static ssize_t show_fan##offset##_div(struct device *dev, char *buf) \
+{ \
+ return show_fan_div(dev, buf, offset - 1); \
+} \
+static ssize_t set_fan##offset##_min(struct device *dev, const char *buf, \
+ size_t count) \
+{ \
+ return set_fan_min(dev, buf, count, offset - 1); \
+} \
+static ssize_t set_fan##offset##_div(struct device *dev, const char *buf, \
+ size_t count) \
+{ \
+ return set_fan_div(dev, buf, count, offset - 1); \
+} \
+static DEVICE_ATTR(fan_input##offset, S_IRUGO, \
+ show_fan##offset, NULL) \
+static DEVICE_ATTR(fan_min##offset, S_IRUGO | S_IWUSR, \
+ show_fan##offset##_min, set_fan##offset##_min) \
+static DEVICE_ATTR(fan_div##offset, S_IRUGO | S_IWUSR, \
+ show_fan##offset##_div, set_fan##offset##_div)
+
+sysfs_fan(1)
+sysfs_fan(2)
+sysfs_fan(3)
+
+#define device_create_file_fan(client, offset) do { \
+ device_create_file(&client->dev, &dev_attr_fan_input##offset); \
+ device_create_file(&client->dev, &dev_attr_fan_min##offset); \
+ device_create_file(&client->dev, &dev_attr_fan_div##offset); \
+} while (0)
+
+/* 4 Temp. Sensors */
+static int sprintf_temp_from_reg(u16 reg, char *buf, int nr)
+{
+ int ret = 0;
+
+ switch (nr) {
+ case 1: case 2:
+ ret = sprintf(buf, "%d\n", LM75_TEMP_FROM_REG(reg));
+ break;
+ case 0: case 3: default:
+ ret = sprintf(buf, "%d\n", TEMP_FROM_REG(reg));
+ break;
+ }
+ return ret;
+}
+
+#define show_temp_reg(reg) \
+static ssize_t show_##reg(struct device *dev, char *buf, int nr) \
+{ \
+ struct asb100_data *data = asb100_update_device(dev); \
+ return sprintf_temp_from_reg(data->reg[nr], buf, nr); \
+}
+
+show_temp_reg(temp)
+show_temp_reg(temp_max)
+show_temp_reg(temp_hyst)
+
+#define set_temp_reg(REG, reg) \
+static ssize_t set_##reg(struct device *dev, const char *buf, \
+ size_t count, int nr) \
+{ \
+ struct i2c_client *client = to_i2c_client(dev); \
+ struct asb100_data *data = i2c_get_clientdata(client); \
+ unsigned long val = simple_strtoul(buf, NULL, 10); \
+ switch (nr) { \
+ case 1: case 2: \
+ data->reg[nr] = LM75_TEMP_TO_REG(val); \
+ break; \
+ case 0: case 3: default: \
+ data->reg[nr] = TEMP_TO_REG(val); \
+ break; \
+ } \
+ asb100_write_value(client, ASB100_REG_TEMP_##REG(nr), \
+ data->reg[nr]); \
+ return count; \
+}
+
+set_temp_reg(MAX, temp_max)
+set_temp_reg(HYST, temp_hyst)
+
+#define sysfs_temp(num) \
+static ssize_t show_temp##num(struct device *dev, char *buf) \
+{ \
+ return show_temp(dev, buf, num-1); \
+} \
+static DEVICE_ATTR(temp_input##num, S_IRUGO, show_temp##num, NULL) \
+static ssize_t show_temp_max##num(struct device *dev, char *buf) \
+{ \
+ return show_temp_max(dev, buf, num-1); \
+} \
+static ssize_t set_temp_max##num(struct device *dev, const char *buf, \
+ size_t count) \
+{ \
+ return set_temp_max(dev, buf, count, num-1); \
+} \
+static DEVICE_ATTR(temp_max##num, S_IRUGO | S_IWUSR, \
+ show_temp_max##num, set_temp_max##num) \
+static ssize_t show_temp_hyst##num(struct device *dev, char *buf) \
+{ \
+ return show_temp_hyst(dev, buf, num-1); \
+} \
+static ssize_t set_temp_hyst##num(struct device *dev, const char *buf, \
+ size_t count) \
+{ \
+ return set_temp_hyst(dev, buf, count, num-1); \
+} \
+static DEVICE_ATTR(temp_hyst##num, S_IRUGO | S_IWUSR, \
+ show_temp_hyst##num, set_temp_hyst##num)
+
+sysfs_temp(1)
+sysfs_temp(2)
+sysfs_temp(3)
+sysfs_temp(4)
+
+/* VID */
+#define device_create_file_temp(client, num) do { \
+ device_create_file(&client->dev, &dev_attr_temp_input##num); \
+ device_create_file(&client->dev, &dev_attr_temp_max##num); \
+ device_create_file(&client->dev, &dev_attr_temp_hyst##num); \
+} while (0)
+
+static ssize_t show_vid(struct device *dev, char *buf)
+{
+ struct asb100_data *data = asb100_update_device(dev);
+ return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm));
+}
+
+static DEVICE_ATTR(vid, S_IRUGO, show_vid, NULL)
+#define device_create_file_vid(client) \
+device_create_file(&client->dev, &dev_attr_vid)
+
+/* VRM */
+static ssize_t show_vrm(struct device *dev, char *buf)
+{
+ struct asb100_data *data = asb100_update_device(dev);
+ return sprintf(buf, "%d\n", data->vrm);
+}
+
+static ssize_t set_vrm(struct device *dev, const char *buf, size_t count)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct asb100_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+ data->vrm = val;
+ return count;
+}
+
+/* Alarms */
+static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm)
+#define device_create_file_vrm(client) \
+device_create_file(&client->dev, &dev_attr_vrm);
+
+static ssize_t show_alarms(struct device *dev, char *buf)
+{
+ struct asb100_data *data = asb100_update_device(dev);
+ return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->alarms));
+}
+
+static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL)
+#define device_create_file_alarms(client) \
+device_create_file(&client->dev, &dev_attr_alarms)
+
+/* 1 PWM */
+static ssize_t show_pwm1(struct device *dev, char *buf)
+{
+ struct asb100_data *data = asb100_update_device(dev);
+ return sprintf(buf, "%d\n", ASB100_PWM_FROM_REG(data->pwm & 0x0f));
+}
+
+static ssize_t set_pwm1(struct device *dev, const char *buf, size_t count)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct asb100_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+ data->pwm &= 0x80; /* keep the enable bit */
+ data->pwm |= (0x0f & ASB100_PWM_TO_REG(val));
+ asb100_write_value(client, ASB100_REG_PWM1, data->pwm);
+ return count;
+}
+
+static ssize_t show_pwm_enable1(struct device *dev, char *buf)
+{
+ struct asb100_data *data = asb100_update_device(dev);
+ return sprintf(buf, "%d\n", (data->pwm & 0x80) ? 1 : 0);
+}
+
+static ssize_t set_pwm_enable1(struct device *dev, const char *buf,
+ size_t count)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct asb100_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+ data->pwm &= 0x0f; /* keep the duty cycle bits */
+ data->pwm |= (val ? 0x80 : 0x00);
+ asb100_write_value(client, ASB100_REG_PWM1, data->pwm);
+ return count;
+}
+
+static DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, show_pwm1, set_pwm1)
+static DEVICE_ATTR(pwm_enable1, S_IRUGO | S_IWUSR,
+ show_pwm_enable1, set_pwm_enable1)
+#define device_create_file_pwm1(client) do { \
+ device_create_file(&new_client->dev, &dev_attr_pwm1); \
+ device_create_file(&new_client->dev, &dev_attr_pwm_enable1); \
+} while (0)
+
+/* This function is called when:
+ asb100_driver is inserted (when this module is loaded), for each
+ available adapter
+ when a new adapter is inserted (and asb100_driver is still present)
+ */
+static int asb100_attach_adapter(struct i2c_adapter *adapter)
+{
+ if (!(adapter->class & I2C_ADAP_CLASS_SMBUS))
+ return 0;
+ return i2c_detect(adapter, &addr_data, asb100_detect);
+}
+
+static int asb100_detect_subclients(struct i2c_adapter *adapter, int address,
+ int kind, struct i2c_client *new_client)
+{
+ int i, id, err;
+ struct asb100_data *data = i2c_get_clientdata(new_client);
+
+ data->lm75[0] = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+ if (!(data->lm75[0])) {
+ err = -ENOMEM;
+ goto ERROR_SC_0;
+ }
+ memset(data->lm75[0], 0x00, sizeof(struct i2c_client));
+
+ data->lm75[1] = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+ if (!(data->lm75[1])) {
+ err = -ENOMEM;
+ goto ERROR_SC_1;
+ }
+ memset(data->lm75[1], 0x00, sizeof(struct i2c_client));
+
+ id = i2c_adapter_id(adapter);
+
+ if (force_subclients[0] == id && force_subclients[1] == address) {
+ for (i = 2; i <= 3; i++) {
+ if (force_subclients[i] < 0x48 ||
+ force_subclients[i] > 0x4f) {
+ dev_err(&new_client->dev, "invalid subclient "
+ "address %d; must be 0x48-0x4f\n",
+ force_subclients[i]);
+ err = -ENODEV;
+ goto ERROR_SC_2;
+ }
+ }
+ asb100_write_value(new_client, ASB100_REG_I2C_SUBADDR,
+ (force_subclients[2] & 0x07) |
+ ((force_subclients[3] & 0x07) <<4));
+ data->lm75[0]->addr = force_subclients[2];
+ data->lm75[1]->addr = force_subclients[3];
+ } else {
+ int val = asb100_read_value(new_client, ASB100_REG_I2C_SUBADDR);
+ data->lm75[0]->addr = 0x48 + (val & 0x07);
+ data->lm75[1]->addr = 0x48 + ((val >> 4) & 0x07);
+ }
+
+ if(data->lm75[0]->addr == data->lm75[1]->addr) {
+ dev_err(&new_client->dev, "duplicate addresses 0x%x "
+ "for subclients\n", data->lm75[0]->addr);
+ err = -ENODEV;
+ goto ERROR_SC_2;
+ }
+
+ for (i = 0; i <= 1; i++) {
+ i2c_set_clientdata(data->lm75[i], NULL);
+ data->lm75[i]->adapter = adapter;
+ data->lm75[i]->driver = &asb100_driver;
+ data->lm75[i]->flags = 0;
+ strlcpy(data->lm75[i]->name, "asb100 subclient", I2C_NAME_SIZE);
+ }
+
+ if ((err = i2c_attach_client(data->lm75[0]))) {
+ dev_err(&new_client->dev, "subclient %d registration "
+ "at address 0x%x failed.\n", i, data->lm75[0]->addr);
+ goto ERROR_SC_2;
+ }
+
+ if ((err = i2c_attach_client(data->lm75[1]))) {
+ dev_err(&new_client->dev, "subclient %d registration "
+ "at address 0x%x failed.\n", i, data->lm75[1]->addr);
+ goto ERROR_SC_3;
+ }
+
+ return 0;
+
+/* Undo inits in case of errors */
+ERROR_SC_3:
+ i2c_detach_client(data->lm75[0]);
+ERROR_SC_2:
+ kfree(data->lm75[1]);
+ERROR_SC_1:
+ kfree(data->lm75[0]);
+ERROR_SC_0:
+ return err;
+}
+
+static int asb100_detect(struct i2c_adapter *adapter, int address, int kind)
+{
+ int err;
+ struct i2c_client *new_client;
+ struct asb100_data *data;
+
+ /* asb100 is SMBus only */
+ if (i2c_is_isa_adapter(adapter)) {
+ pr_debug("asb100.o: detect failed, "
+ "cannot attach to legacy adapter!\n");
+ err = -ENODEV;
+ goto ERROR0;
+ }
+
+ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
+ pr_debug("asb100.o: detect failed, "
+ "smbus byte data not supported!\n");
+ err = -ENODEV;
+ goto ERROR0;
+ }
+
+ /* OK. For now, we presume we have a valid client. We now create the
+ client structure, even though we cannot fill it completely yet.
+ But it allows us to access asb100_{read,write}_value. */
+
+ if (!(new_client = kmalloc(sizeof(struct i2c_client) +
+ sizeof(struct asb100_data), GFP_KERNEL))) {
+ pr_debug("asb100.o: detect failed, kmalloc failed!\n");
+ err = -ENOMEM;
+ goto ERROR0;
+ }
+
+ memset(new_client, 0,
+ sizeof(struct i2c_client) + sizeof(struct asb100_data));
+
+ data = (struct asb100_data *) (new_client + 1);
+ init_MUTEX(&data->lock);
+ i2c_set_clientdata(new_client, data);
+ new_client->addr = address;
+ new_client->adapter = adapter;
+ new_client->driver = &asb100_driver;
+ new_client->flags = 0;
+
+ /* Now, we do the remaining detection. */
+
+ /* The chip may be stuck in some other bank than bank 0. This may
+ make reading other information impossible. Specify a force=... or
+ force_*=... parameter, and the chip will be reset to the right
+ bank. */
+ if (kind < 0) {
+
+ int val1 = asb100_read_value(new_client, ASB100_REG_BANK);
+ int val2 = asb100_read_value(new_client, ASB100_REG_CHIPMAN);
+
+ /* If we're in bank 0 */
+ if ( (!(val1 & 0x07)) &&
+ /* Check for ASB100 ID (low byte) */
+ ( ((!(val1 & 0x80)) && (val2 != 0x94)) ||
+ /* Check for ASB100 ID (high byte ) */
+ ((val1 & 0x80) && (val2 != 0x06)) ) ) {
+ pr_debug("asb100.o: detect failed, "
+ "bad chip id 0x%02x!\n", val2);
+ err = -ENODEV;
+ goto ERROR1;
+ }
+
+ } /* kind < 0 */
+
+ /* We have either had a force parameter, or we have already detected
+ Winbond. Put it now into bank 0 and Vendor ID High Byte */
+ asb100_write_value(new_client, ASB100_REG_BANK,
+ (asb100_read_value(new_client, ASB100_REG_BANK) & 0x78) | 0x80);
+
+ /* Determine the chip type. */
+ if (kind <= 0) {
+ int val1 = asb100_read_value(new_client, ASB100_REG_WCHIPID);
+ int val2 = asb100_read_value(new_client, ASB100_REG_CHIPMAN);
+
+ if ((val1 == 0x31) && (val2 == 0x06))
+ kind = asb100;
+ else {
+ if (kind == 0)
+ dev_warn(&new_client->dev, "ignoring "
+ "'force' parameter for unknown chip "
+ "at adapter %d, address 0x%02x.\n",
+ i2c_adapter_id(adapter), address);
+ err = -ENODEV;
+ goto ERROR1;
+ }
+ }
+
+ /* Fill in remaining client fields and put it into the global list */
+ strlcpy(new_client->name, "asb100", I2C_NAME_SIZE);
+ data->type = kind;
+
+ data->valid = 0;
+ init_MUTEX(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+ goto ERROR1;
+
+ /* Attach secondary lm75 clients */
+ if ((err = asb100_detect_subclients(adapter, address, kind,
+ new_client)))
+ goto ERROR2;
+
+ /* Initialize the chip */
+ asb100_init_client(new_client);
+
+ /* Register sysfs hooks */
+ device_create_file_in(new_client, 0);
+ device_create_file_in(new_client, 1);
+ device_create_file_in(new_client, 2);
+ device_create_file_in(new_client, 3);
+ device_create_file_in(new_client, 4);
+ device_create_file_in(new_client, 5);
+ device_create_file_in(new_client, 6);
+
+ device_create_file_fan(new_client, 1);
+ device_create_file_fan(new_client, 2);
+ device_create_file_fan(new_client, 3);
+
+ device_create_file_temp(new_client, 1);
+ device_create_file_temp(new_client, 2);
+ device_create_file_temp(new_client, 3);
+ device_create_file_temp(new_client, 4);
+
+ device_create_file_vid(new_client);
+ device_create_file_vrm(new_client);
+
+ device_create_file_alarms(new_client);
+
+ device_create_file_pwm1(new_client);
+
+ return 0;
+
+ERROR2:
+ i2c_detach_client(new_client);
+ERROR1:
+ kfree(new_client);
+ERROR0:
+ return err;
+}
+
+static int asb100_detach_client(struct i2c_client *client)
+{
+ int err;
+
+ if ((err = i2c_detach_client(client))) {
+ dev_err(&client->dev, "client deregistration failed; "
+ "client not detached.\n");
+ return err;
+ }
+
+ kfree(client);
+
+ return 0;
+}
+
+static u16 swap_bytes(u16 val)
+{
+ return (val >> 8) | (val << 8);
+}
+
+/* The SMBus locks itself, usually, but nothing may access the chip between
+ bank switches. */
+static int asb100_read_value(struct i2c_client *client, u16 reg)
+{
+ struct asb100_data *data = i2c_get_clientdata(client);
+ struct i2c_client *cl;
+ int res, bank;
+
+ down(&data->lock);
+
+ bank = (reg >> 8) & 0x0f;
+ if (bank > 2)
+ /* switch banks */
+ i2c_smbus_write_byte_data(client, ASB100_REG_BANK, bank);
+
+ if (bank == 0 || bank > 2) {
+ res = i2c_smbus_read_byte_data(client, reg & 0xff);
+ } else {
+ /* switch to subclient */
+ cl = data->lm75[bank - 1];
+
+ /* convert from ISA to LM75 I2C addresses */
+ switch (reg & 0xff) {
+ case 0x50: /* TEMP */
+ res = swap_bytes(i2c_smbus_read_word_data (cl, 0));
+ break;
+ case 0x52: /* CONFIG */
+ res = i2c_smbus_read_byte_data(cl, 1);
+ break;
+ case 0x53: /* HYST */
+ res = swap_bytes(i2c_smbus_read_word_data (cl, 2));
+ break;
+ case 0x55: /* MAX */
+ default:
+ res = swap_bytes(i2c_smbus_read_word_data (cl, 3));
+ break;
+ }
+ }
+
+ if (bank > 2)
+ i2c_smbus_write_byte_data(client, ASB100_REG_BANK, 0);
+
+ up(&data->lock);
+
+ return res;
+}
+
+static void asb100_write_value(struct i2c_client *client, u16 reg, u16 value)
+{
+ struct asb100_data *data = i2c_get_clientdata(client);
+ struct i2c_client *cl;
+ int bank;
+
+ down(&data->lock);
+
+ bank = (reg >> 8) & 0x0f;
+ if (bank > 2)
+ /* switch banks */
+ i2c_smbus_write_byte_data(client, ASB100_REG_BANK, bank);
+
+ if (bank == 0 || bank > 2) {
+ i2c_smbus_write_byte_data(client, reg & 0xff, value & 0xff);
+ } else {
+ /* switch to subclient */
+ cl = data->lm75[bank - 1];
+
+ /* convert from ISA to LM75 I2C addresses */
+ switch (reg & 0xff) {
+ case 0x52: /* CONFIG */
+ i2c_smbus_write_byte_data(cl, 1, value & 0xff);
+ break;
+ case 0x53: /* HYST */
+ i2c_smbus_write_word_data(cl, 2, swap_bytes(value));
+ break;
+ case 0x55: /* MAX */
+ i2c_smbus_write_word_data(cl, 3, swap_bytes(value));
+ break;
+ }
+ }
+
+ if (bank > 2)
+ i2c_smbus_write_byte_data(client, ASB100_REG_BANK, 0);
+
+ up(&data->lock);
+}
+
+static void asb100_init_client(struct i2c_client *client)
+{
+ struct asb100_data *data = i2c_get_clientdata(client);
+ int vid = 0;
+
+ vid = asb100_read_value(client, ASB100_REG_VID_FANDIV) & 0x0f;
+ vid |= (asb100_read_value(client, ASB100_REG_CHIPID) & 0x01) << 4;
+ data->vrm = ASB100_DEFAULT_VRM;
+ vid = vid_from_reg(vid, data->vrm);
+
+ /* Start monitoring */
+ asb100_write_value(client, ASB100_REG_CONFIG,
+ (asb100_read_value(client, ASB100_REG_CONFIG) & 0xf7) | 0x01);
+}
+
+static struct asb100_data *asb100_update_device(struct device *dev)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct asb100_data *data = i2c_get_clientdata(client);
+ int i;
+
+ down(&data->update_lock);
+
+ if (time_after(jiffies - data->last_updated, (unsigned long)(HZ+HZ/2))
+ || time_before(jiffies, data->last_updated) || !data->valid) {
+
+ dev_dbg(&client->dev, "starting device update...\n");
+
+ /* 7 voltage inputs */
+ for (i = 0; i < 7; i++) {
+ data->in[i] = asb100_read_value(client,
+ ASB100_REG_IN(i));
+ data->in_min[i] = asb100_read_value(client,
+ ASB100_REG_IN_MIN(i));
+ data->in_max[i] = asb100_read_value(client,
+ ASB100_REG_IN_MAX(i));
+ }
+
+ /* 3 fan inputs */
+ for (i = 0; i < 3; i++) {
+ data->fan[i] = asb100_read_value(client,
+ ASB100_REG_FAN(i));
+ data->fan_min[i] = asb100_read_value(client,
+ ASB100_REG_FAN_MIN(i));
+ }
+
+ /* 4 temperature inputs */
+ for (i = 1; i <= 4; i++) {
+ data->temp[i-1] = asb100_read_value(client,
+ ASB100_REG_TEMP(i));
+ data->temp_max[i-1] = asb100_read_value(client,
+ ASB100_REG_TEMP_MAX(i));
+ data->temp_hyst[i-1] = asb100_read_value(client,
+ ASB100_REG_TEMP_HYST(i));
+ }
+
+ /* VID and fan divisors */
+ i = asb100_read_value(client, ASB100_REG_VID_FANDIV);
+ data->vid = i & 0x0f;
+ data->vid |= (asb100_read_value(client,
+ ASB100_REG_CHIPID) & 0x01) << 4;
+ data->fan_div[0] = (i >> 4) & 0x03;
+ data->fan_div[1] = (i >> 6) & 0x03;
+ data->fan_div[2] = (asb100_read_value(client,
+ ASB100_REG_PIN) >> 6) & 0x03;
+
+ /* PWM */
+ data->pwm = asb100_read_value(client, ASB100_REG_PWM1);
+
+ /* alarms */
+ data->alarms = asb100_read_value(client, ASB100_REG_ALARM1) +
+ (asb100_read_value(client, ASB100_REG_ALARM2) << 8);
+
+ data->last_updated = jiffies;
+ data->valid = 1;
+
+ dev_dbg(&client->dev, "... device update complete\n");
+ }
+
+ up(&data->update_lock);
+
+ return data;
+}
+
+static int __init asb100_init(void)
+{
+ printk(KERN_INFO "asb100 version %s\n", ASB100_VERSION);
+ return i2c_add_driver(&asb100_driver);
+}
+
+static void __exit asb100_exit(void)
+{
+ i2c_del_driver(&asb100_driver);
+}
+
+MODULE_AUTHOR("Mark M. Hoffman <mhoffman@lightlink.com>");
+MODULE_DESCRIPTION("ASB100 Bach driver");
+MODULE_LICENSE("GPL");
+
+module_init(asb100_init);
+module_exit(asb100_exit);
+
diff -Nru a/include/linux/i2c-id.h b/include/linux/i2c-id.h
--- a/include/linux/i2c-id.h Mon Jan 19 15:33:05 2004
+++ b/include/linux/i2c-id.h Mon Jan 19 15:33:05 2004
@@ -154,6 +154,7 @@
#define I2C_DRIVERID_W83627HF 1038
#define I2C_DRIVERID_LM85 1039
#define I2C_DRIVERID_LM83 1040
+#define I2C_DRIVERID_ASB100 1043
/*
* ---- Adapter types ----------------------------------------------------
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.4, 2004/01/14 11:11:06-08:00, mhoffman@lightlink.com
[PATCH] I2C: link asb100 in the proper order
* Jean Delvare <khali@linux-fr.org> [2004-01-09 22:58:58 +0100]:
> Shouldn't the asb100 be listed first, the same way the w83781d is, since
> it has subclients? I would even put asb100 before w83781d, since for now
> the w83781d driver will try to handle ASB100 chips too, thus preventing
> the asb100 driver from being used if both drivers are built-in.
You're right, thanks
* * * * *
This patch fixes the link order for asb100 sensors chip driver.
drivers/i2c/chips/Makefile | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff -Nru a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
--- a/drivers/i2c/chips/Makefile Mon Jan 19 15:32:50 2004
+++ b/drivers/i2c/chips/Makefile Mon Jan 19 15:32:50 2004
@@ -2,11 +2,11 @@
# Makefile for the kernel hardware sensors chip drivers.
#
-# w83781d goes first, as it can override other driver's addresses.
+# asb100, then w83781d go first, as they can override other drivers' addresses.
+obj-$(CONFIG_SENSORS_ASB100) += asb100.o
obj-$(CONFIG_SENSORS_W83781D) += w83781d.o
obj-$(CONFIG_SENSORS_ADM1021) += adm1021.o
-obj-$(CONFIG_SENSORS_ASB100) += asb100.o
obj-$(CONFIG_SENSORS_EEPROM) += eeprom.o
obj-$(CONFIG_SENSORS_IT87) += it87.o
obj-$(CONFIG_SENSORS_LM75) += lm75.o
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.5, 2004/01/14 11:12:07-08:00, ebs@ebshome.net
[PATCH] I2C: IBM IIC compile fix
please apply this trivial one-liner. It fixes compilation of IBM IIC
driver.
drivers/i2c/busses/i2c-ibm_iic.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -Nru a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
--- a/drivers/i2c/busses/i2c-ibm_iic.c Mon Jan 19 15:32:37 2004
+++ b/drivers/i2c/busses/i2c-ibm_iic.c Mon Jan 19 15:32:37 2004
@@ -601,7 +601,7 @@
/* Register it with i2c layer */
adap = &dev->adap;
- strcpy(adap->dev.name, "IBM IIC");
+ strcpy(adap->name, "IBM IIC");
i2c_set_adapdata(adap, dev);
adap->id = I2C_HW_OCP | iic_algo.id;
adap->algo = &iic_algo;
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.6, 2004/01/14 11:13:34-08:00, khali@linux-fr.org
[PATCH] I2C: saa7146.h doesn't need i2c.h
drivers/media/video/saa7146.h | 1 -
1 files changed, 1 deletion(-)
diff -Nru a/drivers/media/video/saa7146.h b/drivers/media/video/saa7146.h
--- a/drivers/media/video/saa7146.h Mon Jan 19 15:32:24 2004
+++ b/drivers/media/video/saa7146.h Mon Jan 19 15:32:24 2004
@@ -25,7 +25,6 @@
#include <linux/types.h>
#include <linux/wait.h>
-#include <linux/i2c.h>
#include <linux/videodev.h>
#ifndef O_NONCAP
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.7, 2004/01/14 11:19:14-08:00, khali@linux-fr.org
[PATCH] I2C: Typo in i2c/busses/Kconfig
Another simple patch for your collection. BTW I don't think that i2c-rpx
can be used in 2.6 since it relies on an algorithm that hasn't been
ported yet.
drivers/i2c/busses/Kconfig | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
--- a/drivers/i2c/busses/Kconfig Mon Jan 19 15:32:11 2004
+++ b/drivers/i2c/busses/Kconfig Mon Jan 19 15:32:11 2004
@@ -187,7 +187,7 @@
will be called i2c-prosavage.
config I2C_RPXLITE
- tristate "Embedded Planet RPX Lite/Classic suppoort"
+ tristate "Embedded Planet RPX Lite/Classic support"
depends on (RPXLITE || RPXCLASSIC) && I2C_ALGO8XX
config I2C_SAVAGE4
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.9, 2004/01/14 11:23:34-08:00, khali@linux-fr.org
[PATCH] I2C: New parport bus drivers
These are replacements for the i2c-philips-par, i2c-elv and i2c-velleman
drivers, as well as for the i2c-old i2c-parport driver as found under
drivers/media/video in linux 2.4. My reason for writing them, as already
discussed on the sensors and linux-kernel mailing-lists, is that all
these drivers basically do the same thing, so I thought it would be
easier to maintain a single driver instead of four. As Simon Vogl
pointed out that using a direct I/O access (as done in i2c-elv and
i2c-velleman) could be prefered over clean parport access (as done in
i2c-philips-par) on embedded devices, I finally wrote two drivers
instead of one. But both drivers support all devices, it's just a matter
of how they are accessed (and wether the driver depends on the parport
driver).
I made it so that the definition of the adapters (i.e. how to set and
get SDA and SCL, basically) is completely separated from the code
itself. Thus, adding support for a new adapter is simply adding a new
set of data to the definition table, describing how the adapter works,
in a single file.
This means that all simple parallel port adapters are virtually
supported. The i2c-pport driver we have in i2c CVS isn't supported yet
because it works a bit differently, but I believe that extending the
current driver(s) to support it should be possible (although it can be
discussed wether it's worth it).
You'll have to pass the type parameter that is correct for your board:
0 = Philips
2 = Velleman
3 = ELV
4 = ADM evaluation board
I could only test with my ADM eval board, and it worked OK with
both drivers. If they are confirmed to work, we could get rid of all
other parallel port i2c drivers in 2.6.
***
I think we should mark the i2c-philips-par, i2c-elv and i2c-velleman drivers as "deprecated" in i2c/busses/Kconfig. Is there a standard way to do so (like there is "&& EXPERIMENTAL" for new drivers)?
Thanks.
drivers/i2c/busses/Kconfig | 43 +++++
drivers/i2c/busses/Makefile | 2
drivers/i2c/busses/i2c-parport-light.c | 174 +++++++++++++++++++++
drivers/i2c/busses/i2c-parport.c | 266 +++++++++++++++++++++++++++++++++
drivers/i2c/busses/i2c-parport.h | 87 ++++++++++
5 files changed, 572 insertions(+)
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
--- a/drivers/i2c/busses/Kconfig Mon Jan 19 15:31:46 2004
+++ b/drivers/i2c/busses/Kconfig Mon Jan 19 15:31:46 2004
@@ -155,6 +155,49 @@
This support is also available as a module. If so, the module
will be called i2c-philips-par.
+config I2C_PARPORT
+ tristate "Parallel port adapter"
+ depends on I2C_ALGOBIT && PARPORT
+ help
+ This supports parallel port I2C adapters such as the ones made by
+ Philips or Velleman, Analog Devices evaluation boards, and more.
+ Basically any adapter using the parallel port as an I2C bus with
+ no extra chipset is supported by this driver, or could be.
+
+ This driver is a replacement for (and was inspired by) an older
+ driver named i2c-philips-par. The new driver supports more devices,
+ and makes it easier to add support for new devices.
+
+ Another driver exists, named i2c-parport-light, which doesn't depend
+ on the parport driver. This is meant for embedded systems. Don't say
+ Y here if you intend to say Y or M there.
+
+ This support is also available as a module. If so, the module
+ will be called i2c-parport.
+
+config I2C_PARPORT_LIGHT
+ tristate "Parallel port adapter (light)"
+ depends on I2C_ALGOBIT
+ help
+ This supports parallel port I2C adapters such as the ones made by
+ Philips or Velleman, Analog Devices evaluation boards, and more.
+ Basically any adapter using the parallel port as an I2C bus with
+ no extra chipset is supported by this driver, or could be.
+
+ This driver is a light version of i2c-parport. It doesn't depend
+ on the parport driver, and uses direct I/O access instead. This
+ might be prefered on embedded systems where wasting memory for
+ the clean but heavy parport handling is not an option. The
+ drawback is a reduced portability and the impossibility to
+ dasiy-chain other parallel port devices.
+
+ Don't say Y here if you said Y or M to i2c-parport. Saying M to
+ both is possible but both modules should not be loaded at the same
+ time.
+
+ This support is also available as a module. If so, the module
+ will be called i2c-parport-light.
+
config I2C_PIIX4
tristate "Intel PIIX4"
depends on I2C && PCI && EXPERIMENTAL && !64BIT
diff -Nru a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
--- a/drivers/i2c/busses/Makefile Mon Jan 19 15:31:46 2004
+++ b/drivers/i2c/busses/Makefile Mon Jan 19 15:31:46 2004
@@ -17,6 +17,8 @@
obj-$(CONFIG_I2C_KEYWEST) += i2c-keywest.o
obj-$(CONFIG_I2C_NFORCE2) += i2c-nforce2.o
obj-$(CONFIG_I2C_PHILIPSPAR) += i2c-philips-par.o
+obj-$(CONFIG_I2C_PARPORT) += i2c-parport.o
+obj-$(CONFIG_I2C_PARPORT_LIGHT) += i2c-parport-light.o
obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o
obj-$(CONFIG_I2C_PROSAVAGE) += i2c-prosavage.o
obj-$(CONFIG_I2C_RPXLITE) += i2c-rpx.o
diff -Nru a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/i2c/busses/i2c-parport-light.c Mon Jan 19 15:31:46 2004
@@ -0,0 +1,174 @@
+/* ------------------------------------------------------------------------ *
+ * i2c-parport.c I2C bus over parallel port *
+ * ------------------------------------------------------------------------ *
+ Copyright (C) 2003-2004 Jean Delvare <khali@linux-fr.org>
+
+ Based on older i2c-velleman.c driver
+ Copyright (C) 1995-2000 Simon G. Vogl
+ With some changes from:
+ Frodo Looijaard <frodol@dds.nl>
+ Kyösti Mälkki <kmalkki@cc.hut.fi>
+
+ 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.
+ * ------------------------------------------------------------------------ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/i2c.h>
+#include <linux/i2c-algo-bit.h>
+#include <asm/io.h>
+#include "i2c-parport.h"
+
+#define DEFAULT_BASE 0x378
+
+static int base;
+MODULE_PARM(base, "i");
+MODULE_PARM_DESC(base, "Base I/O address");
+
+/* ----- Low-level parallel port access ----------------------------------- */
+
+static inline void port_write(unsigned char p, unsigned char d)
+{
+ outb(d, base+p);
+}
+
+static inline unsigned char port_read(unsigned char p)
+{
+ return inb(base+p);
+}
+
+/* ----- Unified line operation functions --------------------------------- */
+
+static inline void line_set(int state, const struct lineop *op)
+{
+ u8 oldval = port_read(op->port);
+
+ /* Touch only the bit(s) needed */
+ if ((op->inverted && !state) || (!op->inverted && state))
+ port_write(op->port, oldval | op->val);
+ else
+ port_write(op->port, oldval & ~op->val);
+}
+
+static inline int line_get(const struct lineop *op)
+{
+ u8 oldval = port_read(op->port);
+
+ return ((op->inverted && (oldval & op->val) != op->val)
+ || (!op->inverted && (oldval & op->val) == op->val));
+}
+
+/* ----- I2C algorithm call-back functions and structures ----------------- */
+
+static void parport_setscl(void *data, int state)
+{
+ line_set(state, &adapter_parm[type].setscl);
+}
+
+static void parport_setsda(void *data, int state)
+{
+ line_set(state, &adapter_parm[type].setsda);
+}
+
+static int parport_getscl(void *data)
+{
+ return line_get(&adapter_parm[type].getscl);
+}
+
+static int parport_getsda(void *data)
+{
+ return line_get(&adapter_parm[type].getsda);
+}
+
+/* Encapsulate the functions above in the correct structure
+ Note that getscl will be set to NULL by the attaching code for adapters
+ that cannot read SCL back */
+static struct i2c_algo_bit_data parport_algo_data = {
+ .setsda = parport_setsda,
+ .setscl = parport_setscl,
+ .getsda = parport_getsda,
+ .getscl = parport_getscl,
+ .udelay = 50,
+ .mdelay = 50,
+ .timeout = HZ,
+};
+
+/* ----- I2c structure ---------------------------------------------------- */
+
+static struct i2c_adapter parport_adapter = {
+ .owner = THIS_MODULE,
+ .class = I2C_ADAP_CLASS_SMBUS,
+ .id = I2C_HW_B_LP,
+ .algo_data = &parport_algo_data,
+ .name = "Parallel port adapter (light)",
+};
+
+/* ----- Module loading, unloading and information ------------------------ */
+
+static int __init i2c_parport_init(void)
+{
+ int type_count;
+
+ type_count = sizeof(adapter_parm)/sizeof(struct adapter_parm);
+ if (type < 0 || type >= type_count) {
+ printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type);
+ type = 0;
+ }
+
+ if (base == 0) {
+ printk(KERN_INFO "i2c-parport: using default base 0x%x\n", DEFAULT_BASE);
+ base = DEFAULT_BASE;
+ }
+
+ if (!request_region(base, 3, "i2c-parport"))
+ return -ENODEV;
+
+ if (!adapter_parm[type].getscl.val)
+ parport_algo_data.getscl = NULL;
+
+ /* Reset hardware to a sane state (SCL and SDA high) */
+ parport_setsda(NULL, 1);
+ parport_setscl(NULL, 1);
+ /* Other init if needed (power on...) */
+ if (adapter_parm[type].init.val)
+ line_set(1, &adapter_parm[type].init);
+
+ if (i2c_bit_add_bus(&parport_adapter) < 0) {
+ printk(KERN_ERR "i2c-parport: Unable to register with I2C\n");
+ release_region(base, 3);
+ return -ENODEV;
+ }
+
+ return 0;
+}
+
+static void __exit i2c_parport_exit(void)
+{
+ /* Un-init if needed (power off...) */
+ if (adapter_parm[type].init.val)
+ line_set(0, &adapter_parm[type].init);
+
+ i2c_bit_del_bus(&parport_adapter);
+ release_region(base, 3);
+}
+
+MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>");
+MODULE_DESCRIPTION("I2C bus over parallel port (light)");
+MODULE_LICENSE("GPL");
+
+module_init(i2c_parport_init);
+module_exit(i2c_parport_exit);
diff -Nru a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/i2c/busses/i2c-parport.c Mon Jan 19 15:31:46 2004
@@ -0,0 +1,266 @@
+/* ------------------------------------------------------------------------ *
+ * i2c-parport.c I2C bus over parallel port *
+ * ------------------------------------------------------------------------ *
+ Copyright (C) 2003-2004 Jean Delvare <khali@linux-fr.org>
+
+ Based on older i2c-philips-par.c driver
+ Copyright (C) 1995-2000 Simon G. Vogl
+ With some changes from:
+ Frodo Looijaard <frodol@dds.nl>
+ Kyösti Mälkki <kmalkki@cc.hut.fi>
+
+ 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.
+ * ------------------------------------------------------------------------ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/parport.h>
+#include <linux/i2c.h>
+#include <linux/i2c-algo-bit.h>
+#include "i2c-parport.h"
+
+/* ----- Device list ------------------------------------------------------ */
+
+struct i2c_par {
+ struct pardevice *pdev;
+ struct i2c_adapter adapter;
+ struct i2c_algo_bit_data algo_data;
+ struct i2c_par *next;
+};
+
+static struct i2c_par *adapter_list;
+
+/* ----- Low-level parallel port access ----------------------------------- */
+
+static void port_write_data(struct parport *p, unsigned char d)
+{
+ parport_write_data(p, d);
+}
+
+static void port_write_control(struct parport *p, unsigned char d)
+{
+ parport_write_control(p, d);
+}
+
+static unsigned char port_read_data(struct parport *p)
+{
+ return parport_read_data(p);
+}
+
+static unsigned char port_read_status(struct parport *p)
+{
+ return parport_read_status(p);
+}
+
+static unsigned char port_read_control(struct parport *p)
+{
+ return parport_read_control(p);
+}
+
+static void (*port_write[])(struct parport *, unsigned char) = {
+ port_write_data,
+ NULL,
+ port_write_control,
+};
+
+static unsigned char (*port_read[])(struct parport *) = {
+ port_read_data,
+ port_read_status,
+ port_read_control,
+};
+
+/* ----- Unified line operation functions --------------------------------- */
+
+static inline void line_set(struct parport *data, int state,
+ const struct lineop *op)
+{
+ u8 oldval = port_read[op->port](data);
+
+ /* Touch only the bit(s) needed */
+ if ((op->inverted && !state) || (!op->inverted && state))
+ port_write[op->port](data, oldval | op->val);
+ else
+ port_write[op->port](data, oldval & ~op->val);
+}
+
+static inline int line_get(struct parport *data,
+ const struct lineop *op)
+{
+ u8 oldval = port_read[op->port](data);
+
+ return ((op->inverted && (oldval & op->val) != op->val)
+ || (!op->inverted && (oldval & op->val) == op->val));
+}
+
+/* ----- I2C algorithm call-back functions and structures ----------------- */
+
+static void parport_setscl(void *data, int state)
+{
+ line_set((struct parport *) data, state, &adapter_parm[type].setscl);
+}
+
+static void parport_setsda(void *data, int state)
+{
+ line_set((struct parport *) data, state, &adapter_parm[type].setsda);
+}
+
+static int parport_getscl(void *data)
+{
+ return line_get((struct parport *) data, &adapter_parm[type].getscl);
+}
+
+static int parport_getsda(void *data)
+{
+ return line_get((struct parport *) data, &adapter_parm[type].getsda);
+}
+
+/* Encapsulate the functions above in the correct structure.
+ Note that this is only a template, from which the real structures are
+ copied. The attaching code will set getscl to NULL for adapters that
+ cannot read SCL back, and will also make the the data field point to
+ the parallel port structure. */
+static struct i2c_algo_bit_data parport_algo_data = {
+ .setsda = parport_setsda,
+ .setscl = parport_setscl,
+ .getsda = parport_getsda,
+ .getscl = parport_getscl,
+ .udelay = 60,
+ .mdelay = 60,
+ .timeout = HZ,
+};
+
+/* ----- I2c and parallel port call-back functions and structures --------- */
+
+static struct i2c_adapter parport_adapter = {
+ .owner = THIS_MODULE,
+ .class = I2C_ADAP_CLASS_SMBUS,
+ .id = I2C_HW_B_LP,
+ .name = "Parallel port adapter",
+};
+
+static void i2c_parport_attach (struct parport *port)
+{
+ struct i2c_par *adapter;
+
+ adapter = kmalloc(sizeof(struct i2c_par), GFP_KERNEL);
+ if (adapter == NULL) {
+ printk(KERN_ERR "i2c-parport: Failed to kmalloc\n");
+ return;
+ }
+ memset(adapter, 0x00, sizeof(struct i2c_par));
+
+ printk(KERN_DEBUG "i2c-parport: attaching to %s\n", port->name);
+ adapter->pdev = parport_register_device(port, "i2c-parport",
+ NULL, NULL, NULL, PARPORT_FLAG_EXCL, NULL);
+ if (!adapter->pdev) {
+ printk(KERN_ERR "i2c-parport: Unable to register with parport\n");
+ goto ERROR0;
+ }
+
+ /* Fill the rest of the structure */
+ adapter->adapter = parport_adapter;
+ adapter->algo_data = parport_algo_data;
+ if (!adapter_parm[type].getscl.val)
+ adapter->algo_data.getscl = NULL;
+ adapter->algo_data.data = port;
+ adapter->adapter.algo_data = &adapter->algo_data;
+
+ if (parport_claim_or_block(adapter->pdev) < 0) {
+ printk(KERN_ERR "i2c-parport: Could not claim parallel port\n");
+ goto ERROR1;
+ }
+
+ /* Reset hardware to a sane state (SCL and SDA high) */
+ parport_setsda(port, 1);
+ parport_setscl(port, 1);
+ /* Other init if needed (power on...) */
+ if (adapter_parm[type].init.val)
+ line_set(port, 1, &adapter_parm[type].init);
+
+ parport_release(adapter->pdev);
+
+ if (i2c_bit_add_bus(&adapter->adapter) < 0) {
+ printk(KERN_ERR "i2c-parport: Unable to register with I2C\n");
+ goto ERROR1;
+ }
+
+ /* Add the new adapter to the list */
+ adapter->next = adapter_list;
+ adapter_list = adapter;
+ return;
+
+ERROR1:
+ parport_unregister_device(adapter->pdev);
+ERROR0:
+ kfree(adapter);
+}
+
+static void i2c_parport_detach (struct parport *port)
+{
+ struct i2c_par *adapter, *prev;
+
+ /* Walk the list */
+ for (prev = NULL, adapter = adapter_list; adapter;
+ prev = adapter, adapter = adapter->next) {
+ if (adapter->pdev->port == port) {
+ /* Un-init if needed (power off...) */
+ if (adapter_parm[type].init.val)
+ line_set(port, 0, &adapter_parm[type].init);
+
+ i2c_bit_del_bus(&adapter->adapter);
+ parport_unregister_device(adapter->pdev);
+ if (prev)
+ prev->next = adapter->next;
+ else
+ adapter_list = adapter->next;
+ kfree(adapter);
+ return;
+ }
+ }
+}
+
+static struct parport_driver i2c_driver = {
+ .name = "i2c-parport",
+ .attach = i2c_parport_attach,
+ .detach = i2c_parport_detach,
+};
+
+/* ----- Module loading, unloading and information ------------------------ */
+
+static int __init i2c_parport_init(void)
+{
+ int type_count;
+
+ type_count = sizeof(adapter_parm)/sizeof(struct adapter_parm);
+ if (type < 0 || type >= type_count) {
+ printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type);
+ type = 0;
+ }
+
+ return parport_register_driver(&i2c_driver);
+}
+
+static void __exit i2c_parport_exit(void)
+{
+ parport_unregister_driver(&i2c_driver);
+}
+
+MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>");
+MODULE_DESCRIPTION("I2C bus over parallel port");
+MODULE_LICENSE("GPL");
+
+module_init(i2c_parport_init);
+module_exit(i2c_parport_exit);
diff -Nru a/drivers/i2c/busses/i2c-parport.h b/drivers/i2c/busses/i2c-parport.h
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/i2c/busses/i2c-parport.h Mon Jan 19 15:31:46 2004
@@ -0,0 +1,87 @@
+/* ------------------------------------------------------------------------ *
+ * i2c-parport.h I2C bus over parallel port *
+ * ------------------------------------------------------------------------ *
+ Copyright (C) 2003-2004 Jean Delvare <khali@linux-fr.org>
+
+ 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.
+ * ------------------------------------------------------------------------ */
+
+#ifdef DATA
+#undef DATA
+#endif
+
+#define DATA 0
+#define STAT 1
+#define CTRL 2
+
+struct lineop {
+ u8 val;
+ u8 port;
+ u8 inverted;
+};
+
+struct adapter_parm {
+ struct lineop setsda;
+ struct lineop setscl;
+ struct lineop getsda;
+ struct lineop getscl;
+ struct lineop init;
+};
+
+static struct adapter_parm adapter_parm[] = {
+ /* type 0: Philips adapter */
+ {
+ .setsda = { 0x80, DATA, 1 },
+ .setscl = { 0x08, CTRL, 0 },
+ .getsda = { 0x80, STAT, 0 },
+ .getscl = { 0x08, STAT, 0 },
+ },
+ /* type 1: home brew teletext adapter */
+ {
+ .setsda = { 0x02, DATA, 0 },
+ .setscl = { 0x01, DATA, 0 },
+ .getsda = { 0x80, STAT, 1 },
+ },
+ /* type 2: Velleman K8000 adapter */
+ {
+ .setsda = { 0x02, CTRL, 1 },
+ .setscl = { 0x08, CTRL, 1 },
+ .getsda = { 0x10, STAT, 0 },
+ },
+ /* type 3: ELV adapter */
+ {
+ .setsda = { 0x02, DATA, 1 },
+ .setscl = { 0x01, DATA, 1 },
+ .getsda = { 0x40, STAT, 1 },
+ .getscl = { 0x08, STAT, 1 },
+ },
+ /* type 4: ADM 1032 evaluation board */
+ {
+ .setsda = { 0x02, DATA, 1 },
+ .setscl = { 0x01, DATA, 1 },
+ .getsda = { 0x10, STAT, 1 },
+ .init = { 0xf0, DATA, 0 },
+ },
+};
+
+static int type;
+MODULE_PARM(type, "i");
+MODULE_PARM_DESC(type,
+ "Type of adapter:\n"
+ " 0 = Philips adapter\n"
+ " 1 = home brew teletext adapter\n"
+ " 2 = Velleman K8000 adapter\n"
+ " 3 = ELV adapter\n"
+ " 4 = ADM 1032 evalulation board\n");
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.8, 2004/01/14 11:19:29-08:00, khali@linux-fr.org
[PATCH] I2C: i2c-rpx.c doesn't need ioports.h nor parport.h
One more simple patch... These headers are useless as far as I can see.
drivers/i2c/busses/i2c-rpx.c | 2 --
1 files changed, 2 deletions(-)
diff -Nru a/drivers/i2c/busses/i2c-rpx.c b/drivers/i2c/busses/i2c-rpx.c
--- a/drivers/i2c/busses/i2c-rpx.c Mon Jan 19 15:31:59 2004
+++ b/drivers/i2c/busses/i2c-rpx.c Mon Jan 19 15:31:59 2004
@@ -12,11 +12,9 @@
*/
#include <linux/kernel.h>
-#include <linux/ioport.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/stddef.h>
-#include <linux/parport.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-8xx.h>
#include <asm/mpc8xx.h>
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.10, 2004/01/14 11:27:32-08:00, khali@linux-fr.org
[PATCH] I2C: New chip driver: lm90
This is my LM90/ADM1032 i2c chip driver ported to Linux 2.6
drivers/i2c/chips/Kconfig | 11
drivers/i2c/chips/Makefile | 1
drivers/i2c/chips/lm90.c | 520 +++++++++++++++++++++++++++++++++++++++++++++
include/linux/i2c-id.h | 1
4 files changed, 533 insertions(+)
diff -Nru a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
--- a/drivers/i2c/chips/Kconfig Mon Jan 19 15:31:33 2004
+++ b/drivers/i2c/chips/Kconfig Mon Jan 19 15:31:33 2004
@@ -101,6 +101,17 @@
This driver can also be built as a module. If so, the module
will be called lm85.
+config SENSORS_LM90
+ tristate "National Semiconductor LM90 and compatibles"
+ depends on I2C && EXPERIMENTAL
+ select I2C_SENSOR
+ help
+ If you say yes here you get support for National Semiconductor LM90
+ and Analog Devices ADM1032 sensor chips.
+
+ This driver can also be built as a module. If so, the module
+ will be called lm90.
+
config SENSORS_VIA686A
tristate "VIA686A"
depends on I2C && EXPERIMENTAL
diff -Nru a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
--- a/drivers/i2c/chips/Makefile Mon Jan 19 15:31:33 2004
+++ b/drivers/i2c/chips/Makefile Mon Jan 19 15:31:33 2004
@@ -13,4 +13,5 @@
obj-$(CONFIG_SENSORS_LM78) += lm78.o
obj-$(CONFIG_SENSORS_LM83) += lm83.o
obj-$(CONFIG_SENSORS_LM85) += lm85.o
+obj-$(CONFIG_SENSORS_LM90) += lm90.o
obj-$(CONFIG_SENSORS_VIA686A) += via686a.o
diff -Nru a/drivers/i2c/chips/lm90.c b/drivers/i2c/chips/lm90.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/i2c/chips/lm90.c Mon Jan 19 15:31:33 2004
@@ -0,0 +1,520 @@
+/*
+ * lm90.c - Part of lm_sensors, Linux kernel modules for hardware
+ * monitoring
+ * Copyright (C) 2003 Jean Delvare <khali@linux-fr.org>
+ *
+ * Based on the lm83 driver. The LM90 is a sensor chip made by National
+ * Semiconductor. It reports up to two temperatures (its own plus up to
+ * one external one) with a 0.125 deg resolution (1 deg for local
+ * temperature) and a 3-4 deg accuracy. Complete datasheet can be
+ * obtained from National's website at:
+ * http://www.national.com/pf/LM/LM90.html
+ *
+ * This driver also supports the ADM1032, a sensor chip made by Analog
+ * Devices. That chip is similar to the LM90, with a few differences
+ * that are not handled by this driver. Complete datasheet can be
+ * obtained from Analog's website at:
+ * http://products.analog.com/products/info.asp?product=ADM1032
+ *
+ * Since the LM90 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.
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/i2c.h>
+#include <linux/i2c-sensor.h>
+
+/*
+ * Addresses to scan
+ * Address is fully defined internally and cannot be changed.
+ */
+
+static unsigned short normal_i2c[] = { 0x4c, I2C_CLIENT_END };
+static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
+static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
+static unsigned int normal_isa_range[] = { I2C_CLIENT_ISA_END };
+
+/*
+ * Insmod parameters
+ */
+
+SENSORS_INSMOD_2(lm90, adm1032);
+
+/*
+ * The LM90 registers
+ */
+
+#define LM90_REG_R_MAN_ID 0xFE
+#define LM90_REG_R_CHIP_ID 0xFF
+#define LM90_REG_R_CONFIG1 0x03
+#define LM90_REG_W_CONFIG1 0x09
+#define LM90_REG_R_CONFIG2 0xBF
+#define LM90_REG_W_CONFIG2 0xBF
+#define LM90_REG_R_CONVRATE 0x04
+#define LM90_REG_W_CONVRATE 0x0A
+#define LM90_REG_R_STATUS 0x02
+#define LM90_REG_R_LOCAL_TEMP 0x00
+#define LM90_REG_R_LOCAL_HIGH 0x05
+#define LM90_REG_W_LOCAL_HIGH 0x0B
+#define LM90_REG_R_LOCAL_LOW 0x06
+#define LM90_REG_W_LOCAL_LOW 0x0C
+#define LM90_REG_R_LOCAL_CRIT 0x20
+#define LM90_REG_W_LOCAL_CRIT 0x20
+#define LM90_REG_R_REMOTE_TEMPH 0x01
+#define LM90_REG_R_REMOTE_TEMPL 0x10
+#define LM90_REG_R_REMOTE_OFFSH 0x11
+#define LM90_REG_W_REMOTE_OFFSH 0x11
+#define LM90_REG_R_REMOTE_OFFSL 0x12
+#define LM90_REG_W_REMOTE_OFFSL 0x12
+#define LM90_REG_R_REMOTE_HIGHH 0x07
+#define LM90_REG_W_REMOTE_HIGHH 0x0D
+#define LM90_REG_R_REMOTE_HIGHL 0x13
+#define LM90_REG_W_REMOTE_HIGHL 0x13
+#define LM90_REG_R_REMOTE_LOWH 0x08
+#define LM90_REG_W_REMOTE_LOWH 0x0E
+#define LM90_REG_R_REMOTE_LOWL 0x14
+#define LM90_REG_W_REMOTE_LOWL 0x14
+#define LM90_REG_R_REMOTE_CRIT 0x19
+#define LM90_REG_W_REMOTE_CRIT 0x19
+#define LM90_REG_R_TCRIT_HYST 0x21
+#define LM90_REG_W_TCRIT_HYST 0x21
+
+/*
+ * Conversions and various macros
+ * The LM90 uses signed 8-bit values for the local temperatures,
+ * and signed 11-bit values for the remote temperatures (except
+ * T_CRIT). Note that TEMP2_TO_REG does not round values, but
+ * stick to the nearest lower value instead. Fixing it is just
+ * not worth it.
+ */
+
+#define TEMP1_FROM_REG(val) ((val & 0x80 ? val-0x100 : val) * 1000)
+#define TEMP1_TO_REG(val) ((val < 0 ? val+0x100*1000 : val) / 1000)
+#define TEMP2_FROM_REG(val) (((val & 0x8000 ? val-0x10000 : val) >> 5) * 125)
+#define TEMP2_TO_REG(val) ((((val / 125) << 5) + (val < 0 ? 0x10000 : 0)) & 0xFFE0)
+#define HYST_FROM_REG(val) (val * 1000)
+#define HYST_TO_REG(val) (val <= 0 ? 0 : val >= 31000 ? 31 : val / 1000)
+
+/*
+ * Functions declaration
+ */
+
+static int lm90_attach_adapter(struct i2c_adapter *adapter);
+static int lm90_detect(struct i2c_adapter *adapter, int address,
+ int kind);
+static void lm90_init_client(struct i2c_client *client);
+static int lm90_detach_client(struct i2c_client *client);
+static void lm90_update_client(struct i2c_client *client);
+
+/*
+ * Driver data (common to all clients)
+ */
+
+static struct i2c_driver lm90_driver = {
+ .owner = THIS_MODULE,
+ .name = "lm90",
+ .id = I2C_DRIVERID_LM90,
+ .flags = I2C_DF_NOTIFY,
+ .attach_adapter = lm90_attach_adapter,
+ .detach_client = lm90_detach_client,
+};
+
+/*
+ * Client data (each client gets its own)
+ */
+
+struct lm90_data {
+ struct semaphore update_lock;
+ char valid; /* zero until following fields are valid */
+ unsigned long last_updated; /* in jiffies */
+
+ /* registers values */
+ u8 temp_input1, temp_low1, temp_high1; /* local */
+ u16 temp_input2, temp_low2, temp_high2; /* remote, combined */
+ u8 temp_crit1, temp_crit2;
+ u8 temp_hyst;
+ u16 alarms; /* bitvector, combined */
+};
+
+/*
+ * Internal variables
+ */
+
+static int lm90_id = 0;
+
+/*
+ * Sysfs stuff
+ */
+
+#define show_temp(value, converter) \
+static ssize_t show_##value(struct device *dev, char *buf) \
+{ \
+ struct i2c_client *client = to_i2c_client(dev); \
+ struct lm90_data *data = i2c_get_clientdata(client); \
+ lm90_update_client(client); \
+ return sprintf(buf, "%d\n", converter(data->value)); \
+}
+show_temp(temp_input1, TEMP1_FROM_REG);
+show_temp(temp_input2, TEMP2_FROM_REG);
+show_temp(temp_low1, TEMP1_FROM_REG);
+show_temp(temp_low2, TEMP2_FROM_REG);
+show_temp(temp_high1, TEMP1_FROM_REG);
+show_temp(temp_high2, TEMP2_FROM_REG);
+show_temp(temp_crit1, TEMP1_FROM_REG);
+show_temp(temp_crit2, TEMP1_FROM_REG);
+
+#define set_temp1(value, reg) \
+static ssize_t set_##value(struct device *dev, const char *buf, \
+ size_t count) \
+{ \
+ struct i2c_client *client = to_i2c_client(dev); \
+ struct lm90_data *data = i2c_get_clientdata(client); \
+ data->value = TEMP1_TO_REG(simple_strtol(buf, NULL, 10)); \
+ i2c_smbus_write_byte_data(client, reg, data->value); \
+ return count; \
+}
+#define set_temp2(value, regh, regl) \
+static ssize_t set_##value(struct device *dev, const char *buf, \
+ size_t count) \
+{ \
+ struct i2c_client *client = to_i2c_client(dev); \
+ struct lm90_data *data = i2c_get_clientdata(client); \
+ data->value = TEMP2_TO_REG(simple_strtol(buf, NULL, 10)); \
+ i2c_smbus_write_byte_data(client, regh, data->value >> 8); \
+ i2c_smbus_write_byte_data(client, regl, data->value & 0xff); \
+ return count; \
+}
+set_temp1(temp_low1, LM90_REG_W_LOCAL_LOW);
+set_temp2(temp_low2, LM90_REG_W_REMOTE_LOWH, LM90_REG_W_REMOTE_LOWL);
+set_temp1(temp_high1, LM90_REG_W_LOCAL_HIGH);
+set_temp2(temp_high2, LM90_REG_W_REMOTE_HIGHH, LM90_REG_W_REMOTE_HIGHL);
+set_temp1(temp_crit1, LM90_REG_W_LOCAL_CRIT);
+set_temp1(temp_crit2, LM90_REG_W_REMOTE_CRIT);
+
+#define show_temp_hyst(value, basereg) \
+static ssize_t show_##value(struct device *dev, char *buf) \
+{ \
+ struct i2c_client *client = to_i2c_client(dev); \
+ struct lm90_data *data = i2c_get_clientdata(client); \
+ lm90_update_client(client); \
+ return sprintf(buf, "%d\n", TEMP1_FROM_REG(data->basereg) \
+ - HYST_FROM_REG(data->temp_hyst)); \
+}
+show_temp_hyst(temp_hyst1, temp_crit1);
+show_temp_hyst(temp_hyst2, temp_crit2);
+
+static ssize_t set_temp_hyst1(struct device *dev, const char *buf,
+ size_t count)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct lm90_data *data = i2c_get_clientdata(client);
+ int hyst = TEMP1_FROM_REG(data->temp_crit1) -
+ simple_strtol(buf, NULL, 10);
+ i2c_smbus_write_byte_data(client, LM90_REG_W_TCRIT_HYST,
+ HYST_TO_REG(hyst));
+ return count;
+}
+
+static ssize_t show_alarms(struct device *dev, char *buf)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct lm90_data *data = i2c_get_clientdata(client);
+ lm90_update_client(client);
+ return sprintf(buf, "%d\n", data->alarms);
+}
+
+static DEVICE_ATTR(temp_input1, S_IRUGO, show_temp_input1, NULL);
+static DEVICE_ATTR(temp_input2, S_IRUGO, show_temp_input2, NULL);
+static DEVICE_ATTR(temp_min1, S_IWUSR | S_IRUGO, show_temp_low1,
+ set_temp_low1);
+static DEVICE_ATTR(temp_min2, S_IWUSR | S_IRUGO, show_temp_low2,
+ set_temp_low2);
+static DEVICE_ATTR(temp_max1, S_IWUSR | S_IRUGO, show_temp_high1,
+ set_temp_high1);
+static DEVICE_ATTR(temp_max2, S_IWUSR | S_IRUGO, show_temp_high2,
+ set_temp_high2);
+static DEVICE_ATTR(temp_crit1, S_IWUSR | S_IRUGO, show_temp_crit1,
+ set_temp_crit1);
+static DEVICE_ATTR(temp_crit2, S_IWUSR | S_IRUGO, show_temp_crit2,
+ set_temp_crit2);
+static DEVICE_ATTR(temp_hyst1, S_IWUSR | S_IRUGO, show_temp_hyst1,
+ set_temp_hyst1);
+static DEVICE_ATTR(temp_hyst2, S_IRUGO, show_temp_hyst2, NULL);
+static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
+
+/*
+ * Real code
+ */
+
+static int lm90_attach_adapter(struct i2c_adapter *adapter)
+{
+ if (!(adapter->class & I2C_ADAP_CLASS_SMBUS))
+ return 0;
+ return i2c_detect(adapter, &addr_data, lm90_detect);
+}
+
+/*
+ * The following function does more than just detection. If detection
+ * succeeds, it also registers the new chip.
+ */
+static int lm90_detect(struct i2c_adapter *adapter, int address, int kind)
+{
+ struct i2c_client *new_client;
+ struct lm90_data *data;
+ int err = 0;
+ const char *name = "";
+ u8 reg_config1=0, reg_convrate=0;
+
+ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
+ goto exit;
+
+ if (!(new_client = kmalloc(sizeof(struct i2c_client) +
+ sizeof(struct lm90_data), GFP_KERNEL))) {
+ err = -ENOMEM;
+ goto exit;
+ }
+ memset(new_client, 0x00, sizeof(struct i2c_client) +
+ sizeof(struct lm90_data));
+
+ /* The LM90-specific data is placed right after the common I2C
+ * client data. */
+ data = (struct lm90_data *) (new_client + 1);
+ i2c_set_clientdata(new_client, data);
+ new_client->addr = address;
+ new_client->adapter = adapter;
+ new_client->driver = &lm90_driver;
+ new_client->flags = 0;
+
+ /*
+ * Now we do the remaining detection. A negative kind means that
+ * the driver was loaded with no force parameter (default), so we
+ * must both detect and identify the chip. A zero kind means that
+ * the driver was loaded with the force parameter, the detection
+ * step shall be skipped. A positive kind means that the driver
+ * was loaded with the force parameter and a given kind of chip is
+ * requested, so both the detection and the identification steps
+ * are skipped.
+ */
+ if (kind < 0) { /* detection */
+ reg_config1 = i2c_smbus_read_byte_data(new_client,
+ LM90_REG_R_CONFIG1);
+ reg_convrate = i2c_smbus_read_byte_data(new_client,
+ LM90_REG_R_CONVRATE);
+
+ if ((reg_config1 & 0x2A) != 0x00
+ || reg_convrate > 0x0A) {
+ dev_dbg(&client->dev,
+ "LM90 detection failed at 0x%02x.\n"
+ address);
+ goto exit_free;
+ }
+ }
+
+ if (kind <= 0) { /* identification */
+ u8 man_id, chip_id;
+
+ man_id = i2c_smbus_read_byte_data(new_client,
+ LM90_REG_R_MAN_ID);
+ chip_id = i2c_smbus_read_byte_data(new_client,
+ LM90_REG_R_CHIP_ID);
+
+ if (man_id == 0x01) { /* National Semiconductor */
+ if (chip_id >= 0x21 && chip_id < 0x30 /* LM90 */
+ && (kind == 0 /* skip detection */
+ || ((i2c_smbus_read_byte_data(new_client,
+ LM90_REG_R_CONFIG2) & 0xF8) == 0x00
+ && reg_convrate <= 0x09))) {
+ kind = lm90;
+ name = "lm90";
+ }
+ }
+ else if (man_id == 0x41) { /* Analog Devices */
+ if ((chip_id & 0xF0) == 0x40 /* ADM1032 */
+ && (kind == 0 /* skip detection */
+ || (reg_config1 & 0x3F) == 0x00)) {
+ kind = adm1032;
+ name = "adm1032";
+ }
+ }
+
+ if (kind <= 0) { /* identification failed */
+ dev_info(&adapter->dev,
+ "Unsupported chip (man_id=0x%02X, "
+ "chip_id=0x%02X).\n", man_id, chip_id);
+ goto exit_free;
+ }
+ }
+
+ /* We can fill in the remaining client fields */
+ strlcpy(new_client->name, name, I2C_NAME_SIZE);
+ new_client->id = lm90_id++;
+ data->valid = 0;
+ init_MUTEX(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+ goto exit_free;
+
+ /* Initialize the LM90 chip */
+ lm90_init_client(new_client);
+
+ /* Register sysfs hooks */
+ device_create_file(&new_client->dev, &dev_attr_temp_input1);
+ device_create_file(&new_client->dev, &dev_attr_temp_input2);
+ device_create_file(&new_client->dev, &dev_attr_temp_min1);
+ device_create_file(&new_client->dev, &dev_attr_temp_min2);
+ device_create_file(&new_client->dev, &dev_attr_temp_max1);
+ device_create_file(&new_client->dev, &dev_attr_temp_max2);
+ device_create_file(&new_client->dev, &dev_attr_temp_crit1);
+ device_create_file(&new_client->dev, &dev_attr_temp_crit2);
+ device_create_file(&new_client->dev, &dev_attr_temp_hyst1);
+ device_create_file(&new_client->dev, &dev_attr_temp_hyst2);
+ device_create_file(&new_client->dev, &dev_attr_alarms);
+
+ return 0;
+
+exit_free:
+ kfree(new_client);
+exit:
+ return err;
+}
+
+static void lm90_init_client(struct i2c_client *client)
+{
+ u8 config;
+
+ /*
+ * Start the conversions.
+ */
+ i2c_smbus_write_byte_data(client, LM90_REG_W_CONVRATE,
+ 5); /* 2 Hz */
+ config = i2c_smbus_read_byte_data(client, LM90_REG_R_CONFIG1);
+ if (config & 0x40)
+ i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1,
+ config & 0xBF); /* run */
+}
+
+static int lm90_detach_client(struct i2c_client *client)
+{
+ int err;
+
+ if ((err = i2c_detach_client(client))) {
+ dev_err(&client->dev, "Client deregistration failed, "
+ "client not detached.\n");
+ return err;
+ }
+
+ kfree(client);
+ return 0;
+}
+
+static void lm90_update_client(struct i2c_client *client)
+{
+ struct lm90_data *data = i2c_get_clientdata(client);
+
+ down(&data->update_lock);
+
+ if ((jiffies - data->last_updated > HZ * 2) ||
+ (jiffies < data->last_updated) ||
+ !data->valid) {
+ u8 oldh, newh;
+
+ dev_dbg(&client->dev, "Updating lm90 data.\n");
+ data->temp_input1 = i2c_smbus_read_byte_data(client,
+ LM90_REG_R_LOCAL_TEMP);
+ data->temp_high1 = i2c_smbus_read_byte_data(client,
+ LM90_REG_R_LOCAL_HIGH);
+ data->temp_low1 = i2c_smbus_read_byte_data(client,
+ LM90_REG_R_LOCAL_LOW);
+ data->temp_crit1 = i2c_smbus_read_byte_data(client,
+ LM90_REG_R_LOCAL_CRIT);
+ data->temp_crit2 = i2c_smbus_read_byte_data(client,
+ LM90_REG_R_REMOTE_CRIT);
+ data->temp_hyst = i2c_smbus_read_byte_data(client,
+ LM90_REG_R_TCRIT_HYST);
+
+ /*
+ * There is a trick here. We have to read two registers to
+ * have the remote sensor temperature, but we have to beware
+ * a conversion could occur inbetween the readings. The
+ * datasheet says we should either use the one-shot
+ * conversion register, which we don't want to do (disables
+ * hardware monitoring) or monitor the busy bit, which is
+ * impossible (we can't read the values and monitor that bit
+ * at the exact same time). So the solution used here is to
+ * read the high byte once, then the low byte, then the high
+ * byte again. If the new high byte matches the old one,
+ * then we have a valid reading. Else we have to read the low
+ * byte again, and now we believe we have a correct reading.
+ */
+ oldh = i2c_smbus_read_byte_data(client,
+ LM90_REG_R_REMOTE_TEMPH);
+ data->temp_input2 = i2c_smbus_read_byte_data(client,
+ LM90_REG_R_REMOTE_TEMPL);
+ newh = i2c_smbus_read_byte_data(client,
+ LM90_REG_R_REMOTE_TEMPH);
+ if (newh != oldh) {
+ data->temp_input2 = i2c_smbus_read_byte_data(client,
+ LM90_REG_R_REMOTE_TEMPL);
+#ifdef DEBUG
+ oldh = i2c_smbus_read_byte_data(client,
+ LM90_REG_R_REMOTE_TEMPH);
+ /* oldh is actually newer */
+ if (newh != oldh)
+ dev_warn(&client->dev, "Remote temperature may be "
+ "wrong.\n");
+#endif
+ }
+ data->temp_input2 |= (newh << 8);
+
+ data->temp_high2 = (i2c_smbus_read_byte_data(client,
+ LM90_REG_R_REMOTE_HIGHH) << 8) +
+ i2c_smbus_read_byte_data(client,
+ LM90_REG_R_REMOTE_HIGHL);
+ data->temp_low2 = (i2c_smbus_read_byte_data(client,
+ LM90_REG_R_REMOTE_LOWH) << 8) +
+ i2c_smbus_read_byte_data(client,
+ LM90_REG_R_REMOTE_LOWL);
+ data->alarms = i2c_smbus_read_byte_data(client,
+ LM90_REG_R_STATUS);
+
+ data->last_updated = jiffies;
+ data->valid = 1;
+ }
+
+ up(&data->update_lock);
+}
+
+static int __init sensors_lm90_init(void)
+{
+ return i2c_add_driver(&lm90_driver);
+}
+
+static void __exit sensors_lm90_exit(void)
+{
+ i2c_del_driver(&lm90_driver);
+}
+
+MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>");
+MODULE_DESCRIPTION("LM90/ADM1032 driver");
+MODULE_LICENSE("GPL");
+
+module_init(sensors_lm90_init);
+module_exit(sensors_lm90_exit);
diff -Nru a/include/linux/i2c-id.h b/include/linux/i2c-id.h
--- a/include/linux/i2c-id.h Mon Jan 19 15:31:33 2004
+++ b/include/linux/i2c-id.h Mon Jan 19 15:31:33 2004
@@ -154,6 +154,7 @@
#define I2C_DRIVERID_W83627HF 1038
#define I2C_DRIVERID_LM85 1039
#define I2C_DRIVERID_LM83 1040
+#define I2C_DRIVERID_LM90 1042
#define I2C_DRIVERID_ASB100 1043
/*
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.11, 2004/01/14 11:27:58-08:00, khali@linux-fr.org
[PATCH] I2C: Fix w83781d temp
This patch fixes the temperature handling in the w83781d driver:
1* Fix bad magnitude.
2* Use MMH's lm75.h.
3* Allow negative temperatures.
drivers/i2c/chips/w83781d.c | 30 ++++++++++++++----------------
1 files changed, 14 insertions(+), 16 deletions(-)
diff -Nru a/drivers/i2c/chips/w83781d.c b/drivers/i2c/chips/w83781d.c
--- a/drivers/i2c/chips/w83781d.c Mon Jan 19 15:31:21 2004
+++ b/drivers/i2c/chips/w83781d.c Mon Jan 19 15:31:21 2004
@@ -43,6 +43,7 @@
#include <linux/i2c-sensor.h>
#include <linux/i2c-vid.h>
#include <asm/io.h>
+#include "lm75.h"
/* RT Table support #defined so we can take it out if it gets bothersome */
#define W83781D_RT 1
@@ -170,17 +171,14 @@
((val) == 255 ? 0 : \
1350000 / ((val) * (div))))
-#define TEMP_TO_REG(val) (SENSORS_LIMIT(((val / 10) < 0 ? (((val / 10) - 5) / 10) : \
- ((val / 10) + 5) / 10), 0, 255))
-#define TEMP_FROM_REG(val) ((((val ) > 0x80 ? (val) - 0x100 : (val)) * 10) * 10)
-
-#define TEMP_ADD_TO_REG(val) (SENSORS_LIMIT(((((val / 10) + 2) / 5) << 7),\
- 0, 0xffff))
-#define TEMP_ADD_FROM_REG(val) ((((val) >> 7) * 5) * 10)
-
-#define AS99127_TEMP_ADD_TO_REG(val) (SENSORS_LIMIT((((((val / 10) + 2)*4)/10) \
- << 7), 0, 0xffff))
-#define AS99127_TEMP_ADD_FROM_REG(val) (((((val) >> 7) * 10) / 4) * 10)
+#define TEMP_TO_REG(val) (SENSORS_LIMIT(((val) < 0 ? (val)+0x100*1000 \
+ : (val)) / 1000, 0, 0xff))
+#define TEMP_FROM_REG(val) (((val) & 0x80 ? (val)-0x100 : (val)) * 1000)
+
+#define AS99127_TEMP_ADD_TO_REG(val) (SENSORS_LIMIT((((val) < 0 ? (val)+0x10000*250 \
+ : (val)) / 250) << 7, 0, 0xffff))
+#define AS99127_TEMP_ADD_FROM_REG(val) ((((val) & 0x8000 ? (val)-0x10000 : (val)) \
+ >> 7) * 250)
#define ALARMS_FROM_REG(val) (val)
#define PWM_FROM_REG(val) (val)
@@ -437,8 +435,8 @@
return sprintf(buf,"%ld\n", \
(long)AS99127_TEMP_ADD_FROM_REG(data->reg##_add[nr-2])); \
} else { \
- return sprintf(buf,"%ld\n", \
- (long)TEMP_ADD_FROM_REG(data->reg##_add[nr-2])); \
+ return sprintf(buf,"%d\n", \
+ LM75_TEMP_FROM_REG(data->reg##_add[nr-2])); \
} \
} else { /* TEMP1 */ \
return sprintf(buf,"%ld\n", (long)TEMP_FROM_REG(data->reg)); \
@@ -453,15 +451,15 @@
{ \
struct i2c_client *client = to_i2c_client(dev); \
struct w83781d_data *data = i2c_get_clientdata(client); \
- u32 val; \
+ s32 val; \
\
- val = simple_strtoul(buf, NULL, 10); \
+ val = simple_strtol(buf, NULL, 10); \
\
if (nr >= 2) { /* TEMP2 and TEMP3 */ \
if (data->type == as99127f) \
data->temp_##reg##_add[nr-2] = AS99127_TEMP_ADD_TO_REG(val); \
else \
- data->temp_##reg##_add[nr-2] = TEMP_ADD_TO_REG(val); \
+ data->temp_##reg##_add[nr-2] = LM75_TEMP_TO_REG(val); \
\
w83781d_write_value(client, W83781D_REG_TEMP_##REG(nr), \
data->temp_##reg##_add[nr-2]); \
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.12, 2004/01/14 11:44:33-08:00, khali@linux-fr.org
[PATCH] I2C: Fix debug bug in lm83 driver
The following patch fixes lm83 failing to compile if DEBUG is set.
drivers/i2c/chips/lm83.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -Nru a/drivers/i2c/chips/lm83.c b/drivers/i2c/chips/lm83.c
--- a/drivers/i2c/chips/lm83.c Mon Jan 19 15:31:08 2004
+++ b/drivers/i2c/chips/lm83.c Mon Jan 19 15:31:08 2004
@@ -270,7 +270,7 @@
& 0x48) != 0x00) ||
((i2c_smbus_read_byte_data(new_client, LM83_REG_R_CONFIG)
& 0x41) != 0x00)) {
- dev_dbg(&client->dev,
+ dev_dbg(&adapter->dev,
"LM83 detection failed at 0x%02x.\n", address);
goto exit_free;
}
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.14, 2004/01/15 10:34:52-08:00, greg@kroah.com
[PATCH] I2C: move the Kconfig "source..." out of the drivers/char/ location
drivers/Kconfig | 2 ++
drivers/char/Kconfig | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)
diff -Nru a/drivers/Kconfig b/drivers/Kconfig
--- a/drivers/Kconfig Mon Jan 19 15:30:43 2004
+++ b/drivers/Kconfig Mon Jan 19 15:30:43 2004
@@ -38,6 +38,8 @@
source "drivers/char/Kconfig"
+source "drivers/i2c/Kconfig"
+
# source "drivers/misc/Kconfig"
source "drivers/media/Kconfig"
diff -Nru a/drivers/char/Kconfig b/drivers/char/Kconfig
--- a/drivers/char/Kconfig Mon Jan 19 15:30:43 2004
+++ b/drivers/char/Kconfig Mon Jan 19 15:30:43 2004
@@ -588,8 +588,6 @@
bool "Support for console on line printer"
depends on PC9800_OLDLP
-source "drivers/i2c/Kconfig"
-
menu "Mice"
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.15, 2004/01/15 16:05:33-08:00, greg@kroah.com
[PATCH] I2C: remove CONFIG_ISA dependancy for I2C_ISA as x86_64 does not have CONFIG_ISA
drivers/i2c/busses/Kconfig | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
--- a/drivers/i2c/busses/Kconfig Mon Jan 19 15:30:30 2004
+++ b/drivers/i2c/busses/Kconfig Mon Jan 19 15:30:30 2004
@@ -108,7 +108,7 @@
config I2C_ISA
tristate "ISA Bus support"
- depends on I2C && ISA && EXPERIMENTAL
+ depends on I2C && EXPERIMENTAL
help
If you say yes to this option, support will be included for i2c
interfaces that are on the ISA bus.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.13, 2004/01/14 11:52:05-08:00, willy@debian.org
[PATCH] I2C: Kconfig cleanups
This patch attempts to reduce the number of inappropriate questions being
asked by menuconfig.
drivers/i2c/Kconfig | 6 +++---
drivers/i2c/algos/Kconfig | 1 +
drivers/i2c/busses/Kconfig | 1 +
drivers/i2c/chips/Kconfig | 1 +
4 files changed, 6 insertions(+), 3 deletions(-)
diff -Nru a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
--- a/drivers/i2c/Kconfig Mon Jan 19 15:30:56 2004
+++ b/drivers/i2c/Kconfig Mon Jan 19 15:30:56 2004
@@ -37,9 +37,9 @@
This support is also available as a module. If so, the module
will be called i2c-dev.
- source drivers/i2c/algos/Kconfig
- source drivers/i2c/busses/Kconfig
- source drivers/i2c/chips/Kconfig
+source drivers/i2c/algos/Kconfig
+source drivers/i2c/busses/Kconfig
+source drivers/i2c/chips/Kconfig
endmenu
diff -Nru a/drivers/i2c/algos/Kconfig b/drivers/i2c/algos/Kconfig
--- a/drivers/i2c/algos/Kconfig Mon Jan 19 15:30:56 2004
+++ b/drivers/i2c/algos/Kconfig Mon Jan 19 15:30:56 2004
@@ -3,6 +3,7 @@
#
menu "I2C Algorithms"
+ depends on I2C
config I2C_ALGOBIT
tristate "I2C bit-banging interfaces"
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
--- a/drivers/i2c/busses/Kconfig Mon Jan 19 15:30:56 2004
+++ b/drivers/i2c/busses/Kconfig Mon Jan 19 15:30:56 2004
@@ -3,6 +3,7 @@
#
menu "I2C Hardware Bus support"
+ depends on I2C
config I2C_ALI1535
tristate "ALI 1535"
diff -Nru a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
--- a/drivers/i2c/chips/Kconfig Mon Jan 19 15:30:56 2004
+++ b/drivers/i2c/chips/Kconfig Mon Jan 19 15:30:56 2004
@@ -3,6 +3,7 @@
#
menu "I2C Hardware Sensors Chip support"
+ depends on I2C
config I2C_SENSOR
tristate
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.16, 2004/01/15 17:28:54-08:00, khali@linux-fr.org
[PATCH] I2C: restore correct vaio handling in eeprom driver
Here is a patch to the eeprom driver in 2.6.1 that changes the way Vaio
eeproms are handled. In 2.6.1, the eeprom is readable only by root,
which isn't consistent with the 2.4 driver which simple hides (i.e.
fills it with zeroes) the first row (16 bytes) of the eeprom to regular
users.
The patch restores a similar behaviour in the 2.6 driver.
drivers/i2c/chips/eeprom.c | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diff -Nru a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c
--- a/drivers/i2c/chips/eeprom.c Mon Jan 19 15:30:17 2004
+++ b/drivers/i2c/chips/eeprom.c Mon Jan 19 15:30:17 2004
@@ -27,6 +27,7 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
+#include <linux/sched.h>
#include <linux/i2c.h>
#include <linux/i2c-sensor.h>
@@ -62,6 +63,7 @@
char valid; /* !=0 if following fields are valid */
unsigned long last_updated; /* In jiffies */
u8 data[EEPROM_SIZE]; /* Register values */
+ enum eeprom_nature nature;
};
@@ -127,7 +129,16 @@
if (off + count > EEPROM_SIZE)
count = EEPROM_SIZE - off;
- memcpy(buf, &data->data[off], count);
+ /* Hide Vaio security settings to regular users (16 first bytes) */
+ if (data->nature == VAIO && off < 16 && !capable(CAP_SYS_ADMIN)) {
+ int in_row1 = 16 - off;
+ memset(buf, 0, in_row1);
+ if (count - in_row1 > 0)
+ memcpy(buf + in_row1, &data->data[16], count - in_row1);
+ } else {
+ memcpy(buf, &data->data[off], count);
+ }
+
return count;
}
@@ -151,7 +162,6 @@
int i, cs;
struct i2c_client *new_client;
struct eeprom_data *data;
- enum eeprom_nature nature = UNKNOWN;
int err = 0;
/* Make sure we aren't probing the ISA bus!! This is just a safety check
@@ -199,6 +209,7 @@
goto exit_kfree;
}
+ data->nature = UNKNOWN;
/* Detect the Vaio nature of EEPROMs.
We use the "PCG-" prefix as the signature. */
if (address == 0x57) {
@@ -206,17 +217,7 @@
i2c_smbus_read_byte_data(new_client, 0x81) == 'C' &&
i2c_smbus_read_byte_data(new_client, 0x82) == 'G' &&
i2c_smbus_read_byte_data(new_client, 0x83) == '-')
- nature = VAIO;
- }
-
- /* If this is a VIAO, then we only allow root to read from this file,
- as BIOS passwords can be present here in plaintext */
- switch (nature) {
- case VAIO:
- eeprom_attr.attr.mode = S_IRUSR;
- break;
- default:
- eeprom_attr.attr.mode = S_IRUGO;
+ data->nature = VAIO;
}
/* Fill in the remaining client fields */
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.18, 2004/01/16 14:12:54-08:00, khali@linux-fr.org
[PATCH] I2C: i2c-i801 help
drivers/i2c/busses/Kconfig | 3 ++-
1 files changed, 2 insertions(+), 1 deletion(-)
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
--- a/drivers/i2c/busses/Kconfig Mon Jan 19 15:29:51 2004
+++ b/drivers/i2c/busses/Kconfig Mon Jan 19 15:29:51 2004
@@ -73,12 +73,13 @@
help
If you say yes to this option, support will be included for the Intel
801 family of mainboard I2C interfaces. Specifically, the following
- versions of the chipset is supported:
+ versions of the chipset are supported:
82801AA
82801AB
82801BA
82801CA/CAM
82801DB
+ 82801EB
This driver can also be built as a module. If so, the module
will be called i2c-i801.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.17, 2004/01/16 14:12:27-08:00, khali@linux-fr.org
[PATCH] I2C: clean up ISA dependancies
Quoting myself:
> 1* Elektor depends on ISA.
> 2* ELV and Velleman do not depend on ISA.
> 3* i2c-isa is M by default, and has an additional help text
> 4* via686a autoselects i2c-isa
> 5* i2c-isa doesn't depend on ISA
Here's the patch:
drivers/i2c/busses/Kconfig | 6 +++---
drivers/i2c/chips/Kconfig | 1 +
2 files changed, 4 insertions(+), 3 deletions(-)
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
--- a/drivers/i2c/busses/Kconfig Mon Jan 19 15:30:05 2004
+++ b/drivers/i2c/busses/Kconfig Mon Jan 19 15:30:05 2004
@@ -49,7 +49,7 @@
config I2C_ELEKTOR
tristate "Elektor ISA card"
- depends on I2C_ALGOPCF && BROKEN_ON_SMP
+ depends on I2C_ALGOPCF && ISA && BROKEN_ON_SMP
help
This supports the PCF8584 ISA bus I2C adapter. Say Y if you own
such an adapter.
@@ -59,7 +59,7 @@
config I2C_ELV
tristate "ELV adapter"
- depends on I2C_ALGOBIT && ISA
+ depends on I2C_ALGOBIT
help
This supports parallel-port I2C adapters called ELV. Say Y if you
own such an adapter.
@@ -321,7 +321,7 @@
config I2C_VELLEMAN
tristate "Velleman K8000 adapter"
- depends on I2C_ALGOBIT && ISA
+ depends on I2C_ALGOBIT
help
This supports the Velleman K8000 parallel-port I2C adapter. Say Y
if you own such an adapter.
diff -Nru a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
--- a/drivers/i2c/chips/Kconfig Mon Jan 19 15:30:05 2004
+++ b/drivers/i2c/chips/Kconfig Mon Jan 19 15:30:05 2004
@@ -117,6 +117,7 @@
tristate "VIA686A"
depends on I2C && EXPERIMENTAL
select I2C_SENSOR
+ select I2C_ISA
help
If you say yes here you get support for the integrated sensors in
Via 686A/B South Bridges.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.19, 2004/01/16 14:13:08-08:00, khali@linux-fr.org
[PATCH] I2C: speed up eeprom driver by a factor of 4
Basically, I divide the eeprom in 8 32-byte slices. Each of it has a
"valid" boolean (combined together into a bitfield) and a jiffies
counter. Eeprom_update_client() is added a new parameter to specify
which slice to update. Code updated accordingly. Finally, the read
function updates only slices that need to be. The code is heavily
inspired from what was done in the CVS driver, of course.
Three additional notes:
1* This fixes a bug in eeprom_update_client()'s refresh condition. We
used to check jiffies before valid, although jiffies are not defined if
valid isn't true. That was already fixed in our CVS driver but for some
reason the fix did not go into 2.6 yet.
2* This also skips the update if the read if out of bounds. I think this
is the thing to do.
3* It can be discussed wether eeprom_update_client() should take two
slice parameters instead of one (start slice, end slice). This would
make things slightly faster when consecutive slices are requested. Maybe
the code would even be clearer. It wasn't done so far because the CVS
driver wouldn't benefit from it (because the EEPROM's contents are split
over several "output" files in that version of the driver) but I'll
probably give it a try in 2.6.
drivers/i2c/chips/eeprom.c | 35 ++++++++++++++++++++++-------------
1 files changed, 22 insertions(+), 13 deletions(-)
diff -Nru a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c
--- a/drivers/i2c/chips/eeprom.c Mon Jan 19 15:29:39 2004
+++ b/drivers/i2c/chips/eeprom.c Mon Jan 19 15:29:39 2004
@@ -6,6 +6,11 @@
Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
Copyright (C) 2003 IBM Corp.
+ 2004-01-16 Jean Delvare <khali@linux-fr.org>
+ Divide the eeprom in 32-byte (arbitrary) slices. This significantly
+ speeds sensors up, as well as various scripts using the eeprom
+ module.
+
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
@@ -60,8 +65,8 @@
/* Each client has this additional data */
struct eeprom_data {
struct semaphore update_lock;
- char valid; /* !=0 if following fields are valid */
- unsigned long last_updated; /* In jiffies */
+ u8 valid; /* bitfield, bit!=0 if slice is valid */
+ unsigned long last_updated[8]; /* In jiffies, 8 slices */
u8 data[EEPROM_SIZE]; /* Register values */
enum eeprom_nature nature;
};
@@ -83,35 +88,36 @@
static int eeprom_id = 0;
-static void eeprom_update_client(struct i2c_client *client)
+static void eeprom_update_client(struct i2c_client *client, u8 slice)
{
struct eeprom_data *data = i2c_get_clientdata(client);
int i, j;
down(&data->update_lock);
- if ((jiffies - data->last_updated > 300 * HZ) |
- (jiffies < data->last_updated) || !data->valid) {
- dev_dbg(&client->dev, "Starting eeprom update\n");
+ if (!(data->valid & (1 << slice)) ||
+ (jiffies - data->last_updated[slice] > 300 * HZ) ||
+ (jiffies < data->last_updated[slice])) {
+ dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice);
if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK)) {
- for (i=0; i < EEPROM_SIZE; i += I2C_SMBUS_I2C_BLOCK_MAX)
+ for (i = slice << 5; i < (slice + 1) << 5; i += I2C_SMBUS_I2C_BLOCK_MAX)
if (i2c_smbus_read_i2c_block_data(client, i, data->data + i) != I2C_SMBUS_I2C_BLOCK_MAX)
goto exit;
} else {
- if (i2c_smbus_write_byte(client, 0)) {
+ if (i2c_smbus_write_byte(client, slice << 5)) {
dev_dbg(&client->dev, "eeprom read start has failed!\n");
goto exit;
}
- for (i = 0; i < EEPROM_SIZE; i++) {
+ for (i = slice << 5; i < (slice + 1) << 5; i++) {
j = i2c_smbus_read_byte(client);
if (j < 0)
goto exit;
data->data[i] = (u8) j;
}
}
- data->last_updated = jiffies;
- data->valid = 1;
+ data->last_updated[slice] = jiffies;
+ data->valid |= (1 << slice);
}
exit:
up(&data->update_lock);
@@ -121,13 +127,16 @@
{
struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj));
struct eeprom_data *data = i2c_get_clientdata(client);
-
- eeprom_update_client(client);
+ u8 slice;
if (off > EEPROM_SIZE)
return 0;
if (off + count > EEPROM_SIZE)
count = EEPROM_SIZE - off;
+
+ /* Only refresh slices which contain requested bytes */
+ for (slice = off >> 5; slice <= (off + count - 1) >> 5; slice++)
+ eeprom_update_client(client, slice);
/* Hide Vaio security settings to regular users (16 first bytes) */
if (data->nature == VAIO && off < 16 && !capable(CAP_SYS_ADMIN)) {
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.20, 2004/01/19 12:49:37-08:00, khali@linux-fr.org
[PATCH] I2C: Fix lm90.c with DEBUG
The recent patch that fixes lm83.c with DEBUG also applies to lm90.c. No
wonder since I used the first as a template when porting the second.
Patch follows.
drivers/i2c/chips/lm90.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff -Nru a/drivers/i2c/chips/lm90.c b/drivers/i2c/chips/lm90.c
--- a/drivers/i2c/chips/lm90.c Mon Jan 19 15:29:26 2004
+++ b/drivers/i2c/chips/lm90.c Mon Jan 19 15:29:26 2004
@@ -320,8 +320,8 @@
if ((reg_config1 & 0x2A) != 0x00
|| reg_convrate > 0x0A) {
- dev_dbg(&client->dev,
- "LM90 detection failed at 0x%02x.\n"
+ dev_dbg(&adapter->dev,
+ "LM90 detection failed at 0x%02x.\n",
address);
goto exit_free;
}
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.21, 2004/01/19 12:49:57-08:00, khali@linux-fr.org
[PATCH] I2C: Fix i2c-core.c with DEBUG
At the moment, i2c-core.c fails compiling with DEBUG. Following patch
should fix that.
drivers/i2c/i2c-core.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c Mon Jan 19 15:29:13 2004
+++ b/drivers/i2c/i2c-core.c Mon Jan 19 15:29:13 2004
@@ -373,7 +373,7 @@
}
DEB(dev_dbg(&adapter->dev, "client [%s] registered to adapter\n",
- client->dev.name));
+ client->name));
if (client->flags & I2C_CLIENT_ALLOW_USE)
client->usage_count = 0;
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.22, 2004/01/19 12:50:11-08:00, khali@linux-fr.org
[PATCH] I2C: Fix i2c busses warnings with DEBUG
Two bus drivers (i2c-via and scx200_acb.c) generate warnings when the
whole i2c subsystem is compiled with -DDEBUG. Suggested changes follow.
drivers/i2c/busses/i2c-via.c | 2 +-
drivers/i2c/busses/scx200_acb.c | 6 ++----
2 files changed, 3 insertions(+), 5 deletions(-)
diff -Nru a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c
--- a/drivers/i2c/busses/i2c-via.c Mon Jan 19 15:29:00 2004
+++ b/drivers/i2c/busses/i2c-via.c Mon Jan 19 15:29:00 2004
@@ -21,7 +21,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#define DEBUG
+/* #define DEBUG */
#include <linux/kernel.h>
#include <linux/module.h>
diff -Nru a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
--- a/drivers/i2c/busses/scx200_acb.c Mon Jan 19 15:29:00 2004
+++ b/drivers/i2c/busses/scx200_acb.c Mon Jan 19 15:29:00 2004
@@ -47,9 +47,7 @@
MODULE_PARM(base, "1-4i");
MODULE_PARM_DESC(base, "Base addresses for the ACCESS.bus controllers");
-#define DEBUG 0
-
-#if DEBUG
+#ifdef DEBUG
#define DBG(x...) printk(KERN_DEBUG NAME ": " x)
#else
#define DBG(x...)
@@ -374,7 +372,7 @@
if (rc == 0 && size == I2C_SMBUS_WORD_DATA && rw == I2C_SMBUS_READ)
data->word = le16_to_cpu(cur_word);
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG NAME ": transfer done, result: %d", rc);
if (buffer) {
int i;
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-21 21:50 ` Jean Delvare
0 siblings, 2 replies; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.24, 2004/01/19 12:57:20-08:00, khali@linux-fr.org
[PATCH] I2C: Autoselect i2c algos
I replaced all dependancies on algos with dependancies on
I2C + select algo. There are some cases outside of the i2c subdirectory.
Also note that I slightly altered the condition to display the PCILynx
comment. I think it's more logical that way. Without it, the user could
get the message he/she needs I2C, go to enable it, come back and still
not see the option.
drivers/i2c/busses/Kconfig | 42 ++++++++++++++++++++++++++++--------------
drivers/ieee1394/Kconfig | 7 ++++---
drivers/media/video/Kconfig | 3 ++-
drivers/video/Kconfig | 3 ++-
4 files changed, 36 insertions(+), 19 deletions(-)
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
--- a/drivers/i2c/busses/Kconfig Mon Jan 19 15:28:33 2004
+++ b/drivers/i2c/busses/Kconfig Mon Jan 19 15:28:33 2004
@@ -49,7 +49,8 @@
config I2C_ELEKTOR
tristate "Elektor ISA card"
- depends on I2C_ALGOPCF && ISA && BROKEN_ON_SMP
+ depends on I2C && ISA && BROKEN_ON_SMP
+ select I2C_ALGOPCF
help
This supports the PCF8584 ISA bus I2C adapter. Say Y if you own
such an adapter.
@@ -59,7 +60,8 @@
config I2C_ELV
tristate "ELV adapter"
- depends on I2C_ALGOBIT
+ depends on I2C
+ select I2C_ALGOBIT
help
This supports parallel-port I2C adapters called ELV. Say Y if you
own such an adapter.
@@ -86,7 +88,8 @@
config I2C_I810
tristate "Intel 810/815"
- depends on I2C_ALGOBIT && PCI && EXPERIMENTAL
+ depends on I2C && PCI && EXPERIMENTAL
+ select I2C_ALGOBIT
help
If you say yes to this option, support will be included for the Intel
810/815 family of mainboard I2C interfaces. Specifically, the
@@ -119,7 +122,8 @@
config I2C_ITE
tristate "ITE I2C Adapter"
- depends on I2C_ALGOITE
+ depends on I2C
+ select I2C_ALGOITE
help
This supports the ITE8172 I2C peripheral found on some MIPS
systems. Say Y if you have one of these. You should also say Y for
@@ -150,7 +154,8 @@
config I2C_PHILIPSPAR
tristate "Philips style parallel port adapter"
- depends on I2C_ALGOBIT && PARPORT
+ depends on I2C && PARPORT
+ select I2C_ALGOBIT
help
This supports parallel-port I2C adapters made by Philips.
@@ -159,7 +164,8 @@
config I2C_PARPORT
tristate "Parallel port adapter"
- depends on I2C_ALGOBIT && PARPORT
+ depends on I2C && PARPORT
+ select I2C_ALGOBIT
help
This supports parallel port I2C adapters such as the ones made by
Philips or Velleman, Analog Devices evaluation boards, and more.
@@ -179,7 +185,8 @@
config I2C_PARPORT_LIGHT
tristate "Parallel port adapter (light)"
- depends on I2C_ALGOBIT
+ depends on I2C
+ select I2C_ALGOBIT
help
This supports parallel port I2C adapters such as the ones made by
Philips or Velleman, Analog Devices evaluation boards, and more.
@@ -219,7 +226,8 @@
config I2C_PROSAVAGE
tristate "S3/VIA (Pro)Savage"
- depends on I2C_ALGOBIT && PCI && EXPERIMENTAL
+ depends on I2C && PCI && EXPERIMENTAL
+ select I2C_ALGOBIT
help
If you say yes to this option, support will be included for the
I2C bus and DDC bus of the S3VIA embedded Savage4 and ProSavage8
@@ -233,11 +241,13 @@
config I2C_RPXLITE
tristate "Embedded Planet RPX Lite/Classic support"
- depends on (RPXLITE || RPXCLASSIC) && I2C_ALGO8XX
+ depends on (RPXLITE || RPXCLASSIC) && I2C
+ select I2C_ALGO8XX
config I2C_SAVAGE4
tristate "S3 Savage 4"
- depends on I2C_ALGOBIT && PCI && EXPERIMENTAL
+ depends on I2C && PCI && EXPERIMENTAL
+ select I2C_ALGOBIT
help
If you say yes to this option, support will be included for the
S3 Savage 4 I2C interface.
@@ -247,7 +257,8 @@
config SCx200_I2C
tristate "NatSemi SCx200 I2C using GPIO pins"
- depends on SCx200_GPIO && I2C_ALGOBIT
+ depends on SCx200_GPIO && I2C
+ select I2C_ALGOBIT
help
Enable the use of two GPIO pins of a SCx200 processor as an I2C bus.
@@ -322,7 +333,8 @@
config I2C_VELLEMAN
tristate "Velleman K8000 adapter"
- depends on I2C_ALGOBIT
+ depends on I2C
+ select I2C_ALGOBIT
help
This supports the Velleman K8000 parallel-port I2C adapter. Say Y
if you own such an adapter.
@@ -332,7 +344,8 @@
config I2C_VIA
tristate "VIA 82C586B"
- depends on I2C_ALGOBIT && PCI && EXPERIMENTAL
+ depends on I2C && PCI && EXPERIMENTAL
+ select I2C_ALGOBIT
help
If you say yes to this option, support will be included for the VIA
@@ -362,7 +375,8 @@
config I2C_VOODOO3
tristate "Voodoo 3"
- depends on I2C_ALGOBIT && PCI && EXPERIMENTAL
+ depends on I2C && PCI && EXPERIMENTAL
+ select I2C_ALGOBIT
help
If you say yes to this option, support will be included for the
diff -Nru a/drivers/ieee1394/Kconfig b/drivers/ieee1394/Kconfig
--- a/drivers/ieee1394/Kconfig Mon Jan 19 15:28:33 2004
+++ b/drivers/ieee1394/Kconfig Mon Jan 19 15:28:33 2004
@@ -51,12 +51,13 @@
comment "Device Drivers"
depends on IEEE1394
-comment "Texas Instruments PCILynx requires I2C bit-banging"
- depends on IEEE1394 && (I2C=n || I2C_ALGOBIT=n)
+comment "Texas Instruments PCILynx requires I2C"
+ depends on IEEE1394 && I2C=n
config IEEE1394_PCILYNX
tristate "Texas Instruments PCILynx support"
- depends on PCI && IEEE1394 && I2C_ALGOBIT
+ depends on PCI && IEEE1394 && I2C
+ select I2C_ALGOBIT
help
Say Y here if you have an IEEE-1394 controller with the Texas
Instruments PCILynx chip. Note: this driver is written for revision
diff -Nru a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
--- a/drivers/media/video/Kconfig Mon Jan 19 15:28:33 2004
+++ b/drivers/media/video/Kconfig Mon Jan 19 15:28:33 2004
@@ -9,7 +9,8 @@
config VIDEO_BT848
tristate "BT848 Video For Linux"
- depends on VIDEO_DEV && PCI && I2C_ALGOBIT && SOUND
+ depends on VIDEO_DEV && PCI && I2C && SOUND
+ select I2C_ALGOBIT
---help---
Support for BT848 based frame grabber/overlay boards. This includes
the Miro, Hauppauge and STB boards. Please read the material in
diff -Nru a/drivers/video/Kconfig b/drivers/video/Kconfig
--- a/drivers/video/Kconfig Mon Jan 19 15:28:33 2004
+++ b/drivers/video/Kconfig Mon Jan 19 15:28:33 2004
@@ -579,7 +579,8 @@
config FB_MATROX_I2C
tristate "Matrox I2C support"
- depends on FB_MATROX && I2C_ALGOBIT
+ depends on FB_MATROX && I2C
+ select I2C_ALGOBIT
---help---
This drivers creates I2C buses which are needed for accessing the
DDC (I2C) bus present on all Matroxes, an I2C bus which
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-21 21:50 ` Jean Delvare
1 sibling, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.25, 2004/01/19 13:10:24-08:00, greg@kroah.com
[PATCH] I2C: only select I2C_ITE if we are a MIPS system
drivers/i2c/busses/Kconfig | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
--- a/drivers/i2c/busses/Kconfig Mon Jan 19 15:28:21 2004
+++ b/drivers/i2c/busses/Kconfig Mon Jan 19 15:28:21 2004
@@ -122,7 +122,7 @@
config I2C_ITE
tristate "ITE I2C Adapter"
- depends on I2C
+ depends on I2C && MIPS_ITE8172
select I2C_ALGOITE
help
This supports the ITE8172 I2C peripheral found on some MIPS
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.23, 2004/01/19 12:52:59-08:00, khali@linux-fr.org
[PATCH] I2C: New driver: w83l785ts
Here is a patch that adds a new chip driver to Linux 2.6.1 (+ previous
patches). The w83l785ts driver handles a single chipset, the Winbond
W83L785TS-S. I am the author of the original driver as found in
lm_sensors 2.8.3. Wolfgang Ziegler AKA fago made an initial port to
Linux 2.6, which I reviewed, and here it is.
drivers/i2c/chips/Kconfig | 12 +
drivers/i2c/chips/Makefile | 1
drivers/i2c/chips/w83l785ts.c | 309 ++++++++++++++++++++++++++++++++++++++++++
include/linux/i2c-id.h | 1
4 files changed, 323 insertions(+)
diff -Nru a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
--- a/drivers/i2c/chips/Kconfig Mon Jan 19 15:28:47 2004
+++ b/drivers/i2c/chips/Kconfig Mon Jan 19 15:28:47 2004
@@ -137,4 +137,16 @@
This driver can also be built as a module. If so, the module
will be called w83781d.
+config SENSORS_W83L785TS
+ tristate "Winbond W83L785TS-S"
+ depends on I2C && EXPERIMENTAL
+ select I2C_SENSOR
+ help
+ If you say yes here you get support for the Winbond W83L785TS-S
+ sensor chip, which is used on the Asus A7N8X, among other
+ motherboards.
+
+ This driver can also be built as a module. If so, the module
+ will be called w83l785ts.
+
endmenu
diff -Nru a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
--- a/drivers/i2c/chips/Makefile Mon Jan 19 15:28:47 2004
+++ b/drivers/i2c/chips/Makefile Mon Jan 19 15:28:47 2004
@@ -15,3 +15,4 @@
obj-$(CONFIG_SENSORS_LM85) += lm85.o
obj-$(CONFIG_SENSORS_LM90) += lm90.o
obj-$(CONFIG_SENSORS_VIA686A) += via686a.o
+obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o
diff -Nru a/drivers/i2c/chips/w83l785ts.c b/drivers/i2c/chips/w83l785ts.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/i2c/chips/w83l785ts.c Mon Jan 19 15:28:47 2004
@@ -0,0 +1,309 @@
+/*
+ * w83l785ts.c - Part of lm_sensors, Linux kernel modules for hardware
+ * monitoring
+ * Copyright (C) 2003-2004 Jean Delvare <khali@linux-fr.org>
+ *
+ * Inspired from the lm83 driver. The W83L785TS-S is a sensor chip made
+ * by Winbond. It reports a single external temperature with a 1 deg
+ * resolution and a 3 deg accuracy. Datasheet can be obtained from
+ * Winbond's website at:
+ * http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/W83L785TS-S.pdf
+ *
+ * Ported to Linux 2.6 by Wolfgang Ziegler <nuppla@gmx.at> and Jean Delvare
+ * <khali@linux-fr.org>.
+ *
+ * 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.
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/i2c.h>
+#include <linux/i2c-sensor.h>
+
+/*
+ * Address to scan
+ * Address is fully defined internally and cannot be changed.
+ */
+
+static unsigned short normal_i2c[] = { 0x2e, I2C_CLIENT_END };
+static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
+static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
+static unsigned int normal_isa_range[] = { I2C_CLIENT_ISA_END };
+
+/*
+ * Insmod parameters
+ */
+
+SENSORS_INSMOD_1(w83l785ts);
+
+/*
+ * The W83L785TS-S registers
+ * Manufacturer ID is 0x5CA3 for Winbond.
+ */
+
+#define W83L785TS_REG_MAN_ID1 0x4D
+#define W83L785TS_REG_MAN_ID2 0x4C
+#define W83L785TS_REG_CHIP_ID 0x4E
+#define W83L785TS_REG_CONFIG 0x40
+#define W83L785TS_REG_TYPE 0x52
+#define W83L785TS_REG_TEMP 0x27
+#define W83L785TS_REG_TEMP_OVER 0x53 /* not sure about this one */
+
+/*
+ * Conversions
+ * The W83L785TS-S uses signed 8-bit values.
+ */
+
+#define TEMP_FROM_REG(val) ((val & 0x80 ? val-0x100 : val) * 1000)
+
+/*
+ * Functions declaration
+ */
+
+static int w83l785ts_attach_adapter(struct i2c_adapter *adapter);
+static int w83l785ts_detect(struct i2c_adapter *adapter, int address,
+ int kind);
+static int w83l785ts_detach_client(struct i2c_client *client);
+static void w83l785ts_update_client(struct i2c_client *client);
+
+/*
+ * Driver data (common to all clients)
+ */
+
+static struct i2c_driver w83l785ts_driver = {
+ .owner = THIS_MODULE,
+ .name = "w83l785ts",
+ .id = I2C_DRIVERID_W83L785TS,
+ .flags = I2C_DF_NOTIFY,
+ .attach_adapter = w83l785ts_attach_adapter,
+ .detach_client = w83l785ts_detach_client,
+};
+
+/*
+ * Client data (each client gets its own)
+ */
+
+struct w83l785ts_data {
+
+ struct semaphore update_lock;
+ char valid; /* zero until following fields are valid */
+ unsigned long last_updated; /* in jiffies */
+
+ /* registers values */
+ u8 temp, temp_over;
+};
+
+/*
+ * Internal variables
+ */
+
+static int w83l785ts_id = 0;
+
+/*
+ * Sysfs stuff
+ */
+
+static ssize_t show_temp(struct device *dev, char *buf)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct w83l785ts_data *data = i2c_get_clientdata(client);
+ w83l785ts_update_client(client);
+ return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp));
+}
+
+static ssize_t show_temp_over(struct device *dev, char *buf)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct w83l785ts_data *data = i2c_get_clientdata(client);
+ w83l785ts_update_client(client);
+ return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_over));
+}
+
+static DEVICE_ATTR(temp_input, S_IRUGO, show_temp, NULL)
+static DEVICE_ATTR(temp_max, S_IRUGO, show_temp_over, NULL)
+
+/*
+ * Real code
+ */
+
+static int w83l785ts_attach_adapter(struct i2c_adapter *adapter)
+{
+ if (!(adapter->class & I2C_ADAP_CLASS_SMBUS))
+ return 0;
+ return i2c_detect(adapter, &addr_data, w83l785ts_detect);
+}
+
+/*
+ * The following function does more than just detection. If detection
+ * succeeds, it also registers the new chip.
+ */
+static int w83l785ts_detect(struct i2c_adapter *adapter, int address, int kind)
+{
+ struct i2c_client *new_client;
+ struct w83l785ts_data *data;
+ int err = 0;
+ const char *name = "";
+
+
+ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
+ goto exit;
+
+ if (!(new_client = kmalloc(sizeof(struct i2c_client) +
+ sizeof(struct w83l785ts_data), GFP_KERNEL))) {
+ err = -ENOMEM;
+ goto exit;
+ }
+ memset(new_client, 0x00, sizeof(struct i2c_client) +
+ sizeof(struct w83l785ts_data));
+
+
+ /* The W83L785TS-specific data is placed right after the common I2C
+ * client data. */
+ data = (struct w83l785ts_data *) (new_client + 1);
+ i2c_set_clientdata(new_client, data);
+ new_client->addr = address;
+ new_client->adapter = adapter;
+ new_client->driver = &w83l785ts_driver;
+ new_client->flags = 0;
+
+ /*
+ * Now we do the remaining detection. A negative kind means that
+ * the driver was loaded with no force parameter (default), so we
+ * must both detect and identify the chip (actually there is only
+ * one possible kind of chip for now, W83L785TS-S). A zero kind means
+ * that the driver was loaded with the force parameter, the detection
+ * step shall be skipped. A positive kind means that the driver
+ * was loaded with the force parameter and a given kind of chip is
+ * requested, so both the detection and the identification steps
+ * are skipped.
+ */
+ if (kind < 0) { /* detection */
+ if (((i2c_smbus_read_byte_data(new_client,
+ W83L785TS_REG_CONFIG) & 0x80) != 0x00)
+ || ((i2c_smbus_read_byte_data(new_client,
+ W83L785TS_REG_TYPE) & 0xFC) != 0x00)) {
+ dev_dbg(&adapter->dev,
+ "W83L785TS-S detection failed at 0x%02x.\n",
+ address);
+ goto exit_free;
+ }
+ }
+
+ if (kind <= 0) { /* identification */
+ u16 man_id;
+ u8 chip_id;
+
+ man_id = (i2c_smbus_read_byte_data(new_client,
+ W83L785TS_REG_MAN_ID1) << 8) +
+ i2c_smbus_read_byte_data(new_client,
+ W83L785TS_REG_MAN_ID2);
+ chip_id = i2c_smbus_read_byte_data(new_client,
+ W83L785TS_REG_CHIP_ID);
+
+ if (man_id == 0x5CA3) { /* Winbond */
+ if (chip_id == 0x70) { /* W83L785TS-S */
+ kind = w83l785ts;
+ name = "w83l785ts";
+ }
+ }
+
+ if (kind <= 0) { /* identification failed */
+ dev_info(&adapter->dev,
+ "Unsupported chip (man_id=0x%04X, "
+ "chip_id=0x%02X).\n", man_id, chip_id);
+ goto exit_free;
+ }
+ }
+
+ /* We can fill in the remaining client fields. */
+ strlcpy(new_client->name, name, I2C_NAME_SIZE);
+ new_client->id = w83l785ts_id++;
+ data->valid = 0;
+ init_MUTEX(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived. */
+ if ((err = i2c_attach_client(new_client)))
+ goto exit_free;
+
+ /*
+ * Initialize the W83L785TS chip
+ * Nothing yet, assume it is already started.
+ */
+
+ /* Register sysfs hooks */
+ device_create_file(&new_client->dev, &dev_attr_temp_input);
+ device_create_file(&new_client->dev, &dev_attr_temp_max);
+
+ return 0;
+
+exit_free:
+ kfree(new_client);
+exit:
+ return err;
+}
+
+static int w83l785ts_detach_client(struct i2c_client *client)
+{
+ int err;
+
+ if ((err = i2c_detach_client(client))) {
+ dev_err(&client->dev, "Client deregistration failed, "
+ "client not detached.\n");
+ return err;
+ }
+
+ kfree(client);
+ return 0;
+}
+
+static void w83l785ts_update_client(struct i2c_client *client)
+{
+ struct w83l785ts_data *data = i2c_get_clientdata(client);
+
+ down(&data->update_lock);
+
+ if (!data->valid
+ || (jiffies - data->last_updated > HZ * 2)
+ || (jiffies < data->last_updated)) {
+ dev_dbg(&client->dev, "Updating w83l785ts data.\n");
+ data->temp = i2c_smbus_read_byte_data(client,
+ W83L785TS_REG_TEMP);
+ data->temp_over = i2c_smbus_read_byte_data(client,
+ W83L785TS_REG_TEMP_OVER);
+
+ data->last_updated = jiffies;
+ data->valid = 1;
+ }
+
+ up(&data->update_lock);
+}
+
+static int __init sensors_w83l785ts_init(void)
+{
+ return i2c_add_driver(&w83l785ts_driver);
+}
+
+static void __exit sensors_w83l785ts_exit(void)
+{
+ i2c_del_driver(&w83l785ts_driver);
+}
+
+MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>");
+MODULE_DESCRIPTION("W83L785TS-S driver");
+MODULE_LICENSE("GPL");
+
+module_init(sensors_w83l785ts_init);
+module_exit(sensors_w83l785ts_exit);
diff -Nru a/include/linux/i2c-id.h b/include/linux/i2c-id.h
--- a/include/linux/i2c-id.h Mon Jan 19 15:28:47 2004
+++ b/include/linux/i2c-id.h Mon Jan 19 15:28:47 2004
@@ -156,6 +156,7 @@
#define I2C_DRIVERID_LM83 1040
#define I2C_DRIVERID_LM90 1042
#define I2C_DRIVERID_ASB100 1043
+#define I2C_DRIVERID_W83L785TS 1047
/*
* ---- Adapter types ----------------------------------------------------
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.27, 2004/01/19 15:07:28-08:00, greg@kroah.com
[PATCH] I2C: add I2C_DEBUG_CHIP config option and convert the i2c chip drivers to use it.
This cleans up the mismatch of ways we could enable debugging messages.
drivers/i2c/Kconfig | 9 +++++++++
drivers/i2c/chips/adm1021.c | 5 +++++
drivers/i2c/chips/asb100.c | 6 ++++--
drivers/i2c/chips/eeprom.c | 5 ++++-
drivers/i2c/chips/it87.c | 13 +++++++++----
drivers/i2c/chips/lm75.c | 5 ++++-
drivers/i2c/chips/lm78.c | 7 ++++++-
drivers/i2c/chips/lm83.c | 5 +++++
drivers/i2c/chips/lm85.c | 5 +++++
drivers/i2c/chips/lm90.c | 5 +++++
drivers/i2c/chips/via686a.c | 5 +++++
drivers/i2c/chips/w83781d.c | 7 ++++++-
drivers/i2c/chips/w83l785ts.c | 5 +++++
13 files changed, 72 insertions(+), 10 deletions(-)
diff -Nru a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
--- a/drivers/i2c/Kconfig Mon Jan 19 15:27:56 2004
+++ b/drivers/i2c/Kconfig Mon Jan 19 15:27:56 2004
@@ -49,5 +49,14 @@
messages to the system log. Select this if you are having a
problem with I2C support and want to see more of what is going on.
+config I2C_DEBUG_CHIP
+ bool "I2C Chip debugging messages"
+ depends on I2C
+ help
+ Say Y here if you want the I2C chip drivers to produce a bunch of
+ debug messages to the system log. Select this if you are having
+ a problem with I2C support and want to see more of what is going
+ on.
+
endmenu
diff -Nru a/drivers/i2c/chips/adm1021.c b/drivers/i2c/chips/adm1021.c
--- a/drivers/i2c/chips/adm1021.c Mon Jan 19 15:27:56 2004
+++ b/drivers/i2c/chips/adm1021.c Mon Jan 19 15:27:56 2004
@@ -19,6 +19,11 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG 1
+#endif
+
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
diff -Nru a/drivers/i2c/chips/asb100.c b/drivers/i2c/chips/asb100.c
--- a/drivers/i2c/chips/asb100.c Mon Jan 19 15:27:56 2004
+++ b/drivers/i2c/chips/asb100.c Mon Jan 19 15:27:56 2004
@@ -36,7 +36,10 @@
asb100 7 3 1 4 0x31 0x0694 yes no
*/
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG 1
+#endif
#include <linux/module.h>
#include <linux/slab.h>
@@ -1035,7 +1038,6 @@
static int __init asb100_init(void)
{
- printk(KERN_INFO "asb100 version %s\n", ASB100_VERSION);
return i2c_add_driver(&asb100_driver);
}
diff -Nru a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c
--- a/drivers/i2c/chips/eeprom.c Mon Jan 19 15:27:56 2004
+++ b/drivers/i2c/chips/eeprom.c Mon Jan 19 15:27:56 2004
@@ -26,7 +26,10 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* #define DEBUG */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG 1
+#endif
#include <linux/kernel.h>
#include <linux/init.h>
diff -Nru a/drivers/i2c/chips/it87.c b/drivers/i2c/chips/it87.c
--- a/drivers/i2c/chips/it87.c Mon Jan 19 15:27:56 2004
+++ b/drivers/i2c/chips/it87.c Mon Jan 19 15:27:56 2004
@@ -31,6 +31,11 @@
type at module load time.
*/
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG 1
+#endif
+
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
@@ -667,10 +672,10 @@
}
else {
if (kind == 0)
- printk
- ("it87.o: Ignoring 'force' parameter for unknown chip at "
- "adapter %d, address 0x%02x\n",
- i2c_adapter_id(adapter), address);
+ dev_info(&adapter->dev,
+ "Ignoring 'force' parameter for unknown chip at "
+ "adapter %d, address 0x%02x\n",
+ i2c_adapter_id(adapter), address);
goto ERROR1;
}
}
diff -Nru a/drivers/i2c/chips/lm75.c b/drivers/i2c/chips/lm75.c
--- a/drivers/i2c/chips/lm75.c Mon Jan 19 15:27:56 2004
+++ b/drivers/i2c/chips/lm75.c Mon Jan 19 15:27:56 2004
@@ -18,7 +18,10 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG 1
+#endif
#include <linux/module.h>
#include <linux/init.h>
diff -Nru a/drivers/i2c/chips/lm78.c b/drivers/i2c/chips/lm78.c
--- a/drivers/i2c/chips/lm78.c Mon Jan 19 15:27:56 2004
+++ b/drivers/i2c/chips/lm78.c Mon Jan 19 15:27:56 2004
@@ -18,6 +18,11 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG 1
+#endif
+
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
@@ -615,7 +620,7 @@
kind = lm79;
else {
if (kind == 0)
- printk(KERN_WARNING "lm78.o: Ignoring 'force' "
+ dev_warn(&adapter->dev, "Ignoring 'force' "
"parameter for unknown chip at "
"adapter %d, address 0x%02x\n",
i2c_adapter_id(adapter), address);
diff -Nru a/drivers/i2c/chips/lm83.c b/drivers/i2c/chips/lm83.c
--- a/drivers/i2c/chips/lm83.c Mon Jan 19 15:27:56 2004
+++ b/drivers/i2c/chips/lm83.c Mon Jan 19 15:27:56 2004
@@ -27,6 +27,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG 1
+#endif
+
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
diff -Nru a/drivers/i2c/chips/lm85.c b/drivers/i2c/chips/lm85.c
--- a/drivers/i2c/chips/lm85.c Mon Jan 19 15:27:56 2004
+++ b/drivers/i2c/chips/lm85.c Mon Jan 19 15:27:56 2004
@@ -22,6 +22,11 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG 1
+#endif
+
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
diff -Nru a/drivers/i2c/chips/lm90.c b/drivers/i2c/chips/lm90.c
--- a/drivers/i2c/chips/lm90.c Mon Jan 19 15:27:56 2004
+++ b/drivers/i2c/chips/lm90.c Mon Jan 19 15:27:56 2004
@@ -35,6 +35,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG 1
+#endif
+
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
diff -Nru a/drivers/i2c/chips/via686a.c b/drivers/i2c/chips/via686a.c
--- a/drivers/i2c/chips/via686a.c Mon Jan 19 15:27:56 2004
+++ b/drivers/i2c/chips/via686a.c Mon Jan 19 15:27:56 2004
@@ -31,6 +31,11 @@
Warning - only supports a single device.
*/
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG 1
+#endif
+
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/pci.h>
diff -Nru a/drivers/i2c/chips/w83781d.c b/drivers/i2c/chips/w83781d.c
--- a/drivers/i2c/chips/w83781d.c Mon Jan 19 15:27:56 2004
+++ b/drivers/i2c/chips/w83781d.c Mon Jan 19 15:27:56 2004
@@ -36,6 +36,11 @@
*/
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG 1
+#endif
+
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
@@ -1651,7 +1656,7 @@
if (time_after
(jiffies - data->last_updated, (unsigned long) (HZ + HZ / 2))
|| time_before(jiffies, data->last_updated) || !data->valid) {
- pr_debug(KERN_DEBUG "Starting device update\n");
+ pr_debug("Starting device update\n");
for (i = 0; i <= 8; i++) {
if ((data->type == w83783s || data->type == w83697hf)
diff -Nru a/drivers/i2c/chips/w83l785ts.c b/drivers/i2c/chips/w83l785ts.c
--- a/drivers/i2c/chips/w83l785ts.c Mon Jan 19 15:27:56 2004
+++ b/drivers/i2c/chips/w83l785ts.c Mon Jan 19 15:27:56 2004
@@ -27,6 +27,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG 1
+#endif
+
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.26, 2004/01/19 15:06:56-08:00, greg@kroah.com
[PATCH] I2C: add I2C_DEBUG_CORE config option and convert the i2c core code to use it.
This cleans up the mismatch of ways we could enable debugging messages.
drivers/i2c/Kconfig | 8 +++
drivers/i2c/i2c-core.c | 110 +++++++++++++++++++++--------------------------
drivers/i2c/i2c-dev.c | 10 ++--
drivers/i2c/i2c-sensor.c | 5 +-
4 files changed, 69 insertions(+), 64 deletions(-)
diff -Nru a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
--- a/drivers/i2c/Kconfig Mon Jan 19 15:28:09 2004
+++ b/drivers/i2c/Kconfig Mon Jan 19 15:28:09 2004
@@ -41,5 +41,13 @@
source drivers/i2c/busses/Kconfig
source drivers/i2c/chips/Kconfig
+config I2C_DEBUG_CORE
+ bool "I2C Core debugging messages"
+ depends on I2C
+ help
+ Say Y here if you want the I2C core to produce a bunch of debug
+ messages to the system log. Select this if you are having a
+ problem with I2C support and want to see more of what is going on.
+
endmenu
diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c Mon Jan 19 15:28:09 2004
+++ b/drivers/i2c/i2c-core.c Mon Jan 19 15:28:09 2004
@@ -23,7 +23,10 @@
/* $Id: i2c-core.c,v 1.95 2003/01/22 05:25:08 kmalkki Exp $ */
-/* #define DEBUG 1 */ /* needed to pick up the dev_dbg() calls */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CORE
+#define DEBUG 1
+#endif
#include <linux/module.h>
#include <linux/kernel.h>
@@ -35,16 +38,10 @@
#include <asm/uaccess.h>
-#define DEB(x) if (i2c_debug>=1) x;
-#define DEB2(x) if (i2c_debug>=2) x;
-
static LIST_HEAD(adapters);
static LIST_HEAD(drivers);
static DECLARE_MUTEX(core_lists);
-/**** debug level */
-static int i2c_debug;
-
int i2c_device_probe(struct device *dev)
{
return -ENODEV;
@@ -162,7 +159,7 @@
}
up(&core_lists);
- DEB(dev_dbg(&adap->dev, "registered as adapter #%d\n", adap->nr));
+ dev_dbg(&adap->dev, "registered as adapter #%d\n", adap->nr);
return 0;
}
@@ -217,7 +214,7 @@
wait_for_completion(&adap->dev_released);
wait_for_completion(&adap->class_dev_released);
- DEB(dev_dbg(&adap->dev, "adapter unregistered\n"));
+ dev_dbg(&adap->dev, "adapter unregistered\n");
out_unlock:
up(&core_lists);
@@ -250,7 +247,7 @@
goto out_unlock;
list_add_tail(&driver->list,&drivers);
- DEB(printk(KERN_DEBUG "i2c-core.o: driver %s registered.\n",driver->name));
+ pr_debug("i2c-core: driver %s registered.\n", driver->name);
/* now look for instances of driver on our adapters */
if (driver->flags & I2C_DF_NOTIFY) {
@@ -279,14 +276,14 @@
* attached. If so, detach them to be able to kill the driver
* afterwards.
*/
- DEB2(printk(KERN_DEBUG "i2c-core.o: unregister_driver - looking for clients.\n"));
+ pr_debug("i2c-core: unregister_driver - looking for clients.\n");
/* removing clients does not depend on the notify flag, else
* invalid operation might (will!) result, when using stale client
* pointers.
*/
list_for_each(item1,&adapters) {
adap = list_entry(item1, struct i2c_adapter, list);
- DEB2(dev_dbg(&adap->dev, "examining adapter\n"));
+ dev_dbg(&adap->dev, "examining adapter\n");
if (driver->detach_adapter) {
if ((res = driver->detach_adapter(adap))) {
dev_warn(&adap->dev, "while unregistering "
@@ -300,9 +297,7 @@
client = list_entry(item2, struct i2c_client, list);
if (client->driver != driver)
continue;
- DEB2(printk(KERN_DEBUG "i2c-core.o: "
- "detaching client %s:\n",
- client->name));
+ pr_debug("i2c-core.o: detaching client %s:\n", client->name);
if ((res = driver->detach_client(client))) {
dev_err(&adap->dev, "while "
"unregistering driver "
@@ -321,7 +316,7 @@
driver_unregister(&driver->driver);
list_del(&driver->list);
- DEB(printk(KERN_DEBUG "i2c-core.o: driver unregistered: %s\n",driver->name));
+ pr_debug("i2c-core: driver unregistered: %s\n", driver->name);
out_unlock:
up(&core_lists);
@@ -372,8 +367,8 @@
}
}
- DEB(dev_dbg(&adapter->dev, "client [%s] registered to adapter\n",
- client->name));
+ dev_dbg(&adapter->dev, "client [%s] registered to adapter\n",
+ client->name);
if (client->flags & I2C_CLIENT_ALLOW_USE)
client->usage_count = 0;
@@ -385,7 +380,7 @@
snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id),
"%d-%04x", i2c_adapter_id(adapter), client->addr);
- printk("registering %s\n", client->dev.bus_id);
+ pr_debug("registering %s\n", client->dev.bus_id);
device_register(&client->dev);
device_create_file(&client->dev, &dev_attr_client_name);
@@ -404,8 +399,8 @@
if (adapter->client_unregister) {
res = adapter->client_unregister(client);
if (res) {
- printk(KERN_ERR
- "i2c-core.o: client_unregister [%s] failed, "
+ dev_err(&client->dev,
+ "client_unregister [%s] failed, "
"client not detached", client->name);
goto out;
}
@@ -467,9 +462,9 @@
if(client->flags & I2C_CLIENT_ALLOW_USE) {
if(client->usage_count>0)
client->usage_count--;
- else
- {
- printk(KERN_WARNING " i2c-core.o: dec_use_client used one too many times\n");
+ else {
+ pr_debug("i2c-core: %s used one too many times\n",
+ __FUNCTION__);
return -EPERM;
}
}
@@ -544,7 +539,7 @@
int ret;
if (adap->algo->master_xfer) {
- DEB2(dev_dbg(&adap->dev, "master_xfer: with %d msgs.\n", num));
+ dev_dbg(&adap->dev, "master_xfer: with %d msgs.\n", num);
down(&adap->bus_lock);
ret = adap->algo->master_xfer(adap,msgs,num);
@@ -552,7 +547,7 @@
return ret;
} else {
- DEB2(dev_dbg(&adap->dev, "I2C level transfers not supported\n"));
+ dev_dbg(&adap->dev, "I2C level transfers not supported\n");
return -ENOSYS;
}
}
@@ -569,8 +564,8 @@
msg.len = count;
msg.buf = (char *)buf;
- DEB2(dev_dbg(&client->adapter->dev, "master_send: writing %d bytes.\n",
- count));
+ dev_dbg(&client->adapter->dev, "master_send: writing %d bytes.\n",
+ count);
down(&adap->bus_lock);
ret = adap->algo->master_xfer(adap,&msg,1);
@@ -598,15 +593,15 @@
msg.len = count;
msg.buf = buf;
- DEB2(dev_dbg(&client->adapter->dev, "master_recv: reading %d bytes.\n",
- count));
+ dev_dbg(&client->adapter->dev, "master_recv: reading %d bytes.\n",
+ count);
down(&adap->bus_lock);
ret = adap->algo->master_xfer(adap,&msg,1);
up(&adap->bus_lock);
- DEB2(printk(KERN_DEBUG "i2c-core.o: master_recv: return:%d (count:%d, addr:0x%02x)\n",
- ret, count, client->addr));
+ dev_dbg(&client->dev, "master_recv: return:%d (count:%d, addr:0x%02x)\n",
+ ret, count, client->addr);
/* if everything went ok (i.e. 1 msg transmitted), return #bytes
* transmitted, else error code.
@@ -625,8 +620,8 @@
int ret = 0;
struct i2c_adapter *adap = client->adapter;
- DEB2(printk(KERN_DEBUG "i2c-core.o: i2c ioctl, cmd: 0x%x, arg: %#lx\n", cmd, arg));
- switch ( cmd ) {
+ dev_dbg(&client->dev, "i2c ioctl, cmd: 0x%x, arg: %#lx\n", cmd, arg);
+ switch (cmd) {
case I2C_RETRIES:
adap->retries = arg;
break;
@@ -670,8 +665,8 @@
if (((adap_id == address_data->force[i]) ||
(address_data->force[i] == ANY_I2C_BUS)) &&
(addr == address_data->force[i+1])) {
- DEB2(printk(KERN_DEBUG "i2c-core.o: found force parameter for adapter %d, addr %04x\n",
- adap_id,addr));
+ dev_dbg(&adapter->dev, "found force parameter for adapter %d, addr %04x\n",
+ adap_id, addr);
if ((err = found_proc(adapter,addr,0)))
return err;
found = 1;
@@ -688,8 +683,8 @@
if (((adap_id == address_data->ignore[i]) ||
((address_data->ignore[i] == ANY_I2C_BUS))) &&
(addr == address_data->ignore[i+1])) {
- DEB2(printk(KERN_DEBUG "i2c-core.o: found ignore parameter for adapter %d, "
- "addr %04x\n", adap_id ,addr));
+ dev_dbg(&adapter->dev, "found ignore parameter for adapter %d, "
+ "addr %04x\n", adap_id ,addr);
found = 1;
}
}
@@ -700,8 +695,8 @@
((address_data->ignore_range[i]==ANY_I2C_BUS))) &&
(addr >= address_data->ignore_range[i+1]) &&
(addr <= address_data->ignore_range[i+2])) {
- DEB2(printk(KERN_DEBUG "i2c-core.o: found ignore_range parameter for adapter %d, "
- "addr %04x\n", adap_id,addr));
+ dev_dbg(&adapter->dev, "found ignore_range parameter for adapter %d, "
+ "addr %04x\n", adap_id,addr);
found = 1;
}
}
@@ -715,8 +710,8 @@
i += 1) {
if (addr == address_data->normal_i2c[i]) {
found = 1;
- DEB2(printk(KERN_DEBUG "i2c-core.o: found normal i2c entry for adapter %d, "
- "addr %02x", adap_id,addr));
+ dev_dbg(&adapter->dev, "found normal i2c entry for adapter %d, "
+ "addr %02x", adap_id,addr);
}
}
@@ -726,8 +721,8 @@
if ((addr >= address_data->normal_i2c_range[i]) &&
(addr <= address_data->normal_i2c_range[i+1])) {
found = 1;
- DEB2(printk(KERN_DEBUG "i2c-core.o: found normal i2c_range entry for adapter %d, "
- "addr %04x\n", adap_id,addr));
+ dev_dbg(&adapter->dev, "found normal i2c_range entry for adapter %d, "
+ "addr %04x\n", adap_id,addr);
}
}
@@ -738,8 +733,8 @@
((address_data->probe[i] == ANY_I2C_BUS))) &&
(addr == address_data->probe[i+1])) {
found = 1;
- DEB2(printk(KERN_DEBUG "i2c-core.o: found probe parameter for adapter %d, "
- "addr %04x\n", adap_id,addr));
+ dev_dbg(&adapter->dev, "found probe parameter for adapter %d, "
+ "addr %04x\n", adap_id,addr);
}
}
for (i = 0;
@@ -750,8 +745,8 @@
(addr >= address_data->probe_range[i+1]) &&
(addr <= address_data->probe_range[i+2])) {
found = 1;
- DEB2(printk(KERN_DEBUG "i2c-core.o: found probe_range parameter for adapter %d, "
- "addr %04x\n", adap_id,addr));
+ dev_dbg(&adapter->dev, "found probe_range parameter for adapter %d, "
+ "addr %04x\n", adap_id,addr);
}
}
if (!found)
@@ -908,9 +903,9 @@
cpec = rpec = 0;
break;
}
- if(rpec != cpec) {
- DEB(printk(KERN_DEBUG "i2c-core.o: Bad PEC 0x%02x vs. 0x%02x\n",
- rpec, cpec));
+ if (rpec != cpec) {
+ pr_debug("i2c-core: Bad PEC 0x%02x vs. 0x%02x\n",
+ rpec, cpec);
return -1;
}
return 0;
@@ -1130,13 +1125,13 @@
case I2C_SMBUS_BLOCK_DATA:
case I2C_SMBUS_BLOCK_DATA_PEC:
if (read_write == I2C_SMBUS_READ) {
- printk(KERN_ERR "i2c-core.o: Block read not supported "
+ dev_err(&adapter->dev, "Block read not supported "
"under I2C emulation!\n");
return -1;
} else {
msg[0].len = data->block[0] + 2;
if (msg[0].len > I2C_SMBUS_BLOCK_MAX + 2) {
- printk(KERN_ERR "i2c-core.o: smbus_access called with "
+ dev_err(&adapter->dev, "smbus_access called with "
"invalid block write size (%d)\n",
data->block[0]);
return -1;
@@ -1149,7 +1144,7 @@
break;
case I2C_SMBUS_BLOCK_PROC_CALL:
case I2C_SMBUS_BLOCK_PROC_CALL_PEC:
- printk(KERN_ERR "i2c-core.o: Block process call not supported "
+ dev_dbg(&adapter->dev, "Block process call not supported "
"under I2C emulation!\n");
return -1;
case I2C_SMBUS_I2C_BLOCK_DATA:
@@ -1158,7 +1153,7 @@
} else {
msg[0].len = data->block[0] + 1;
if (msg[0].len > I2C_SMBUS_I2C_BLOCK_MAX + 1) {
- printk("i2c-core.o: i2c_smbus_xfer_emulated called with "
+ dev_err(&adapter->dev, "i2c_smbus_xfer_emulated called with "
"invalid block write size (%d)\n",
data->block[0]);
return -1;
@@ -1168,7 +1163,7 @@
}
break;
default:
- printk(KERN_ERR "i2c-core.o: smbus_access called with invalid size (%d)\n",
+ dev_err(&adapter->dev, "smbus_access called with invalid size (%d)\n",
size);
return -1;
}
@@ -1303,6 +1298,3 @@
MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>");
MODULE_DESCRIPTION("I2C-Bus main module");
MODULE_LICENSE("GPL");
-
-MODULE_PARM(i2c_debug, "i");
-MODULE_PARM_DESC(i2c_debug,"debug level");
diff -Nru a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
--- a/drivers/i2c/i2c-dev.c Mon Jan 19 15:28:09 2004
+++ b/drivers/i2c/i2c-dev.c Mon Jan 19 15:28:09 2004
@@ -29,8 +29,10 @@
/* The devfs code is contributed by Philipp Matthias Hahn
<pmhahn@titan.lahn.de> */
-/* If you want debugging uncomment: */
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CORE
+#define DEBUG 1
+#endif
#include <linux/kernel.h>
#include <linux/module.h>
@@ -137,7 +139,7 @@
if (tmp==NULL)
return -ENOMEM;
- pr_debug("i2c-dev.o: i2c-%d reading %d bytes.\n",
+ pr_debug("i2c-dev: i2c-%d reading %d bytes.\n",
iminor(file->f_dentry->d_inode), count);
ret = i2c_master_recv(client,tmp,count);
@@ -165,7 +167,7 @@
return -EFAULT;
}
- pr_debug("i2c-dev.o: i2c-%d writing %d bytes.\n",
+ pr_debug("i2c-dev: i2c-%d writing %d bytes.\n",
iminor(file->f_dentry->d_inode), count);
ret = i2c_master_send(client,tmp,count);
diff -Nru a/drivers/i2c/i2c-sensor.c b/drivers/i2c/i2c-sensor.c
--- a/drivers/i2c/i2c-sensor.c Mon Jan 19 15:28:09 2004
+++ b/drivers/i2c/i2c-sensor.c Mon Jan 19 15:28:09 2004
@@ -19,7 +19,10 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CORE
+#define DEBUG 1
+#endif
#include <linux/module.h>
#include <linux/kernel.h>
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
0 siblings, 0 replies; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.29, 2004/01/19 15:17:17-08:00, greg@kroah.com
[PATCH] I2C: remove unneeded CVS Id: lines.
drivers/i2c/algos/i2c-algo-pcf.h | 2 --
drivers/i2c/busses/i2c-philips-par.c | 2 --
drivers/i2c/busses/i2c-velleman.c | 2 --
drivers/i2c/i2c-core.c | 2 --
4 files changed, 8 deletions(-)
diff -Nru a/drivers/i2c/algos/i2c-algo-pcf.h b/drivers/i2c/algos/i2c-algo-pcf.h
--- a/drivers/i2c/algos/i2c-algo-pcf.h Mon Jan 19 15:27:31 2004
+++ b/drivers/i2c/algos/i2c-algo-pcf.h Mon Jan 19 15:27:31 2004
@@ -21,8 +21,6 @@
/* With some changes from Frodo Looijaard <frodol@dds.nl> */
-/* $Id: i2c-pcf8584.h,v 1.3 2000/01/18 23:54:07 frodo Exp $ */
-
#ifndef I2C_PCF8584_H
#define I2C_PCF8584_H 1
diff -Nru a/drivers/i2c/busses/i2c-philips-par.c b/drivers/i2c/busses/i2c-philips-par.c
--- a/drivers/i2c/busses/i2c-philips-par.c Mon Jan 19 15:27:31 2004
+++ b/drivers/i2c/busses/i2c-philips-par.c Mon Jan 19 15:27:31 2004
@@ -21,8 +21,6 @@
/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
Frodo Looijaard <frodol@dds.nl> */
-/* $Id: i2c-philips-par.c,v 1.29 2003/01/21 08:08:16 kmalkki Exp $ */
-
#include <linux/config.h>
#ifdef CONFIG_I2C_DEBUG_BUS
#define DEBUG 1
diff -Nru a/drivers/i2c/busses/i2c-velleman.c b/drivers/i2c/busses/i2c-velleman.c
--- a/drivers/i2c/busses/i2c-velleman.c Mon Jan 19 15:27:31 2004
+++ b/drivers/i2c/busses/i2c-velleman.c Mon Jan 19 15:27:31 2004
@@ -18,8 +18,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* ------------------------------------------------------------------------- */
-/* $Id: i2c-velleman.c,v 1.29 2003/01/21 08:08:16 kmalkki Exp $ */
-
#include <linux/config.h>
#ifdef CONFIG_I2C_DEBUG_BUS
#define DEBUG 1
diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c Mon Jan 19 15:27:31 2004
+++ b/drivers/i2c/i2c-core.c Mon Jan 19 15:27:31 2004
@@ -21,8 +21,6 @@
All SMBus-related things are written by Frodo Looijaard <frodol@dds.nl>
SMBus 2.0 support by Mark Studebaker <mdsxyz123@yahoo.com> */
-/* $Id: i2c-core.c,v 1.95 2003/01/22 05:25:08 kmalkki Exp $ */
-
#include <linux/config.h>
#ifdef CONFIG_I2C_DEBUG_CORE
#define DEBUG 1
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
@ 2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-19 23:59 UTC (permalink / raw)
To: linux-kernel, sensors
ChangeSet 1.1474.98.28, 2004/01/19 15:07:53-08:00, greg@kroah.com
[PATCH] I2C: add I2C_DEBUG_BUS config option and convert the i2c bus drivers to use it.
This cleans up the mismatch of ways we could enable debugging messages.
drivers/i2c/Kconfig | 9 ++++++++
drivers/i2c/busses/i2c-ali1535.c | 5 +++-
drivers/i2c/busses/i2c-ali15x3.c | 5 +++-
drivers/i2c/busses/i2c-amd756.c | 5 +++-
drivers/i2c/busses/i2c-amd8111.c | 5 ++++
drivers/i2c/busses/i2c-elektor.c | 19 +++++++----------
drivers/i2c/busses/i2c-elv.c | 17 +++++++--------
drivers/i2c/busses/i2c-frodo.c | 5 ++++
drivers/i2c/busses/i2c-i801.c | 5 +++-
drivers/i2c/busses/i2c-i810.c | 5 ++++
drivers/i2c/busses/i2c-ibm_iic.c | 6 +++++
drivers/i2c/busses/i2c-iop3xx.c | 9 +++-----
drivers/i2c/busses/i2c-isa.c | 5 ++++
drivers/i2c/busses/i2c-ite.c | 24 ++++++++++------------
drivers/i2c/busses/i2c-keywest.c | 36 +++++++++++++++------------------
drivers/i2c/busses/i2c-nforce2.c | 5 ++++
drivers/i2c/busses/i2c-parport-light.c | 5 ++++
drivers/i2c/busses/i2c-parport.c | 7 +++++-
drivers/i2c/busses/i2c-philips-par.c | 7 +++++-
drivers/i2c/busses/i2c-piix4.c | 5 +++-
drivers/i2c/busses/i2c-prosavage.c | 5 ++++
drivers/i2c/busses/i2c-rpx.c | 7 +++++-
drivers/i2c/busses/i2c-savage4.c | 5 ++++
drivers/i2c/busses/i2c-sis5595.c | 10 +++++----
drivers/i2c/busses/i2c-sis630.c | 5 +++-
drivers/i2c/busses/i2c-sis96x.c | 5 +++-
drivers/i2c/busses/i2c-velleman.c | 12 +++++------
drivers/i2c/busses/i2c-via.c | 5 +++-
drivers/i2c/busses/i2c-viapro.c | 5 ++++
drivers/i2c/busses/i2c-voodoo3.c | 5 ++++
drivers/i2c/busses/scx200_acb.c | 9 ++++++--
drivers/i2c/busses/scx200_i2c.c | 10 ++++++---
32 files changed, 189 insertions(+), 83 deletions(-)
diff -Nru a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
--- a/drivers/i2c/Kconfig Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/Kconfig Mon Jan 19 15:27:44 2004
@@ -49,6 +49,15 @@
messages to the system log. Select this if you are having a
problem with I2C support and want to see more of what is going on.
+config I2C_DEBUG_BUS
+ bool "I2C Bus debugging messages"
+ depends on I2C
+ help
+ Say Y here if you want the I2C bus drivers to produce a bunch of
+ debug messages to the system log. Select this if you are having
+ a problem with I2C support and want to see more of what is going
+ on.
+
config I2C_DEBUG_CHIP
bool "I2C Chip debugging messages"
depends on I2C
diff -Nru a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c
--- a/drivers/i2c/busses/i2c-ali1535.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-ali1535.c Mon Jan 19 15:27:44 2004
@@ -53,7 +53,10 @@
/* Note: we assume there can only be one ALI1535, with one SMBus interface */
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
#include <linux/module.h>
#include <linux/pci.h>
diff -Nru a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c
--- a/drivers/i2c/busses/i2c-ali15x3.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-ali15x3.c Mon Jan 19 15:27:44 2004
@@ -60,7 +60,10 @@
/* Note: we assume there can only be one ALI15X3, with one SMBus interface */
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
#include <linux/module.h>
#include <linux/pci.h>
diff -Nru a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
--- a/drivers/i2c/busses/i2c-amd756.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-amd756.c Mon Jan 19 15:27:44 2004
@@ -37,7 +37,10 @@
Note: we assume there can only be one device, with one SMBus interface.
*/
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
#include <linux/module.h>
#include <linux/pci.h>
diff -Nru a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
--- a/drivers/i2c/busses/i2c-amd8111.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-amd8111.c Mon Jan 19 15:27:44 2004
@@ -8,6 +8,11 @@
* the Free Software Foundation version 2.
*/
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/kernel.h>
diff -Nru a/drivers/i2c/busses/i2c-elektor.c b/drivers/i2c/busses/i2c-elektor.c
--- a/drivers/i2c/busses/i2c-elektor.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-elektor.c Mon Jan 19 15:27:44 2004
@@ -25,6 +25,11 @@
/* Partialy rewriten by Oleg I. Vdovikin for mmapped support of
for Alpha Processor Inc. UP-2000(+) boards */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/module.h>
@@ -50,7 +55,6 @@
static int clock = 0x1c;
static int own = 0x55;
static int mmapped;
-static int i2c_debug;
/* vdovikin: removed static struct i2c_pcf_isa gpi; code -
this module in real supports only one device, due to missing arguments
@@ -60,12 +64,6 @@
static wait_queue_head_t pcf_wait;
static int pcf_pending;
-/* ----- global defines ----------------------------------------------- */
-#define DEB(x) if (i2c_debug>=1) x
-#define DEB2(x) if (i2c_debug>=2) x
-#define DEB3(x) if (i2c_debug>=3) x
-#define DEBE(x) x /* error messages */
-
/* ----- local functions ---------------------------------------------- */
static void pcf_isa_setbyte(void *data, int ctl, int val)
@@ -77,7 +75,7 @@
val |= I2C_PCF_ENI;
}
- DEB3(printk(KERN_DEBUG "i2c-elektor: Write 0x%X 0x%02X\n", address, val & 255));
+ pr_debug("i2c-elektor: Write 0x%X 0x%02X\n", address, val & 255);
switch (mmapped) {
case 0: /* regular I/O */
@@ -98,7 +96,7 @@
int address = ctl ? (base + 1) : base;
int val = mmapped ? readb(address) : inb(address);
- DEB3(printk(KERN_DEBUG "i2c-elektor: Read 0x%X 0x%02X\n", address, val));
+ pr_debug("i2c-elektor: Read 0x%X 0x%02X\n", address, val);
return (val);
}
@@ -196,7 +194,7 @@
/* yeap, we've found cypress, let's check config */
if (!pci_read_config_byte(cy693_dev, 0x47, &config)) {
- DEB3(printk(KERN_DEBUG "i2c-elektor: found cy82c693, config register 0x47 = 0x%02x.\n", config));
+ pr_debug("i2c-elektor: found cy82c693, config register 0x47 = 0x%02x.\n", config);
/* UP2000 board has this register set to 0xe1,
but the most significant bit as seems can be
@@ -280,7 +278,6 @@
MODULE_PARM(clock, "i");
MODULE_PARM(own, "i");
MODULE_PARM(mmapped, "i");
-MODULE_PARM(i2c_debug, "i");
module_init(i2c_pcfisa_init);
module_exit(i2c_pcfisa_exit);
diff -Nru a/drivers/i2c/busses/i2c-elv.c b/drivers/i2c/busses/i2c-elv.c
--- a/drivers/i2c/busses/i2c-elv.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-elv.c Mon Jan 19 15:27:44 2004
@@ -21,6 +21,11 @@
/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
Frodo Looijaard <frodol@dds.nl> */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/delay.h>
@@ -36,12 +41,6 @@
static int base=0;
static unsigned char port_data = 0;
-/* ----- global defines ----------------------------------------------- */
-#define DEB(x) /* should be reasonable open, close &c. */
-#define DEB2(x) /* low level debugging - very slow */
-#define DEBE(x) x /* error messages */
-#define DEBINIT(x) x /* detection status messages */
-
/* --- Convenience defines for the parallel port: */
#define BASE (unsigned int)(data)
#define DATA BASE /* Centronics data port */
@@ -89,7 +88,7 @@
return -ENODEV;
if (inb(base+1) & 0x80) { /* BUSY should be high */
- DEBINIT(printk(KERN_DEBUG "i2c-elv.o: Busy was low.\n"));
+ pr_debug("i2c-elv: Busy was low.\n");
goto fail;
}
@@ -97,7 +96,7 @@
udelay(400);
if (!(inb(base+1) && 0x10)) {
outb(0x04,base+2);
- DEBINIT(printk(KERN_DEBUG "i2c-elv.o: Select was high.\n"));
+ pr_debug("i2c-elv: Select was high.\n");
goto fail;
}
@@ -153,7 +152,7 @@
return -ENODEV;
}
}
- printk(KERN_DEBUG "i2c-elv.o: found device at %#x.\n",base);
+ pr_debug("i2c-elv: found device at %#x.\n",base);
return 0;
}
diff -Nru a/drivers/i2c/busses/i2c-frodo.c b/drivers/i2c/busses/i2c-frodo.c
--- a/drivers/i2c/busses/i2c-frodo.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-frodo.c Mon Jan 19 15:27:44 2004
@@ -12,6 +12,11 @@
* version 2 as published by the Free Software Foundation.
*/
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
diff -Nru a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
--- a/drivers/i2c/busses/i2c-i801.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-i801.c Mon Jan 19 15:27:44 2004
@@ -38,7 +38,10 @@
/* Note: we assume there can only be one I801, with one SMBus interface */
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
#include <linux/module.h>
#include <linux/pci.h>
diff -Nru a/drivers/i2c/busses/i2c-i810.c b/drivers/i2c/busses/i2c-i810.c
--- a/drivers/i2c/busses/i2c-i810.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-i810.c Mon Jan 19 15:27:44 2004
@@ -34,6 +34,11 @@
i815 1132
*/
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
diff -Nru a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
--- a/drivers/i2c/busses/i2c-ibm_iic.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-ibm_iic.c Mon Jan 19 15:27:44 2004
@@ -27,6 +27,12 @@
* option) any later version.
*
*/
+
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/ioport.h>
diff -Nru a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
--- a/drivers/i2c/busses/i2c-iop3xx.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-iop3xx.c Mon Jan 19 15:27:44 2004
@@ -31,6 +31,10 @@
---------------------------------------------------------------------------*/
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
#include <linux/interrupt.h>
#include <linux/kernel.h>
@@ -529,8 +533,3 @@
MODULE_AUTHOR("D-TACQ Solutions Ltd <www.d-tacq.com>");
MODULE_DESCRIPTION("IOP3xx iic algorithm and driver");
MODULE_LICENSE("GPL");
-
-MODULE_PARM(i2c_debug,"i");
-
-MODULE_PARM_DESC(i2c_debug, "debug level - 0 off; 1 normal; 2,3 more verbose; 9 iic-protocol");
-
diff -Nru a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c
--- a/drivers/i2c/busses/i2c-isa.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-isa.c Mon Jan 19 15:27:44 2004
@@ -24,6 +24,11 @@
the SMBus and the ISA bus very much easier. See lm78.c for an example
of this. */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
diff -Nru a/drivers/i2c/busses/i2c-ite.c b/drivers/i2c/busses/i2c-ite.c
--- a/drivers/i2c/busses/i2c-ite.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-ite.c Mon Jan 19 15:27:44 2004
@@ -33,6 +33,11 @@
/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
Frodo Looijaard <frodol@dds.nl> */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/module.h>
@@ -58,26 +63,21 @@
static int clock = 0;
static int own = 0;
-static int i2c_debug=0;
static struct iic_ite gpi;
static wait_queue_head_t iic_wait;
static int iic_pending;
-/* ----- global defines ----------------------------------------------- */
-#define DEB(x) if (i2c_debug>=1) x
-#define DEB2(x) if (i2c_debug>=2) x
-#define DEB3(x) if (i2c_debug>=3) x
-#define DEBE(x) x /* error messages */
-
-
/* ----- local functions ---------------------------------------------- */
static void iic_ite_setiic(void *data, int ctl, short val)
{
unsigned long j = jiffies + 10;
- DEB3(printk(" Write 0x%02x to 0x%x\n",(unsigned short)val, ctl&0xff));
- DEB3({while (time_before(jiffies, j)) schedule();})
+ pr_debug(" Write 0x%02x to 0x%x\n",(unsigned short)val, ctl&0xff);
+#ifdef DEBUG
+ while (time_before(jiffies, j))
+ schedule();
+#endif
outw(val,ctl);
}
@@ -86,7 +86,7 @@
short val;
val = inw(ctl);
- DEB3(printk("Read 0x%02x from 0x%x\n",(unsigned short)val, ctl&0xff));
+ pr_debug("Read 0x%02x from 0x%x\n",(unsigned short)val, ctl&0xff);
return (val);
}
@@ -145,7 +145,6 @@
iic_pending = 1;
- DEB2(printk("iic_ite_handler: in interrupt handler\n"));
wake_up_interruptible(&iic_wait);
}
@@ -263,7 +262,6 @@
MODULE_PARM(irq, "i");
MODULE_PARM(clock, "i");
MODULE_PARM(own, "i");
-MODULE_PARM(i2c_debug,"i");
/* Called when module is loaded or when kernel is initialized.
diff -Nru a/drivers/i2c/busses/i2c-keywest.c b/drivers/i2c/busses/i2c-keywest.c
--- a/drivers/i2c/busses/i2c-keywest.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-keywest.c Mon Jan 19 15:27:44 2004
@@ -43,6 +43,11 @@
sound driver to be happy
*/
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/module.h>
#include <linux/config.h>
#include <linux/kernel.h>
@@ -65,20 +70,13 @@
#include "i2c-keywest.h"
-#define DBG(x...) do {\
- if (debug > 0) \
- printk(KERN_DEBUG "KW:" x); \
- } while(0)
-
MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
MODULE_DESCRIPTION("I2C driver for Apple's Keywest");
MODULE_LICENSE("GPL");
MODULE_PARM(probe, "i");
-MODULE_PARM(debug, "i");
-int probe = 0;
-int debug = 0;
+static int probe = 0;
static void
do_stop(struct keywest_iface* iface, int result)
@@ -95,7 +93,7 @@
int ack;
int rearm_timer = 1;
- DBG("handle_interrupt(), got: %x, status: %x, state: %d\n",
+ pr_debug("handle_interrupt(), got: %x, status: %x, state: %d\n",
isr, read_reg(reg_status), iface->state);
if (isr == 0 && iface->state != state_stop) {
do_stop(iface, -1);
@@ -112,7 +110,7 @@
break;
}
ack = read_reg(reg_status);
- DBG("ack on set address: %x\n", ack);
+ pr_debug("ack on set address: %x\n", ack);
if ((ack & KW_I2C_STAT_LAST_AAK) == 0) {
do_stop(iface, -1);
break;
@@ -127,7 +125,7 @@
| KW_I2C_CTL_AAK);
} else {
iface->state = state_write;
- DBG("write byte: %x\n", *(iface->data));
+ pr_debug("write byte: %x\n", *(iface->data));
write_reg(reg_data, *(iface->data++));
iface->datalen--;
}
@@ -139,7 +137,7 @@
break;
}
*(iface->data++) = read_reg(reg_data);
- DBG("read byte: %x\n", *(iface->data-1));
+ pr_debug("read byte: %x\n", *(iface->data-1));
iface->datalen--;
if (iface->datalen == 0)
iface->state = state_stop;
@@ -153,13 +151,13 @@
}
/* Check ack status */
ack = read_reg(reg_status);
- DBG("ack on data write: %x\n", ack);
+ pr_debug("ack on data write: %x\n", ack);
if ((ack & KW_I2C_STAT_LAST_AAK) == 0) {
do_stop(iface, -1);
break;
}
if (iface->datalen) {
- DBG("write byte: %x\n", *(iface->data));
+ pr_debug("write byte: %x\n", *(iface->data));
write_reg(reg_data, *(iface->data++));
iface->datalen--;
} else
@@ -203,7 +201,7 @@
{
struct keywest_iface *iface = (struct keywest_iface *)data;
- DBG("timeout !\n");
+ pr_debug("timeout !\n");
spin_lock_irq(&iface->lock);
if (handle_interrupt(iface, read_reg(reg_isr)))
mod_timer(&iface->timeout_timer, jiffies + POLL_TIMEOUT);
@@ -271,7 +269,7 @@
down(&iface->sem);
- DBG("chan: %d, addr: 0x%x, transfer len: %d, read: %d\n",
+ pr_debug("chan: %d, addr: 0x%x, transfer len: %d, read: %d\n",
chan->chan_no, addr, len, read_write == I2C_SMBUS_READ);
iface->data = buffer;
@@ -306,7 +304,7 @@
wait_for_completion(&iface->complete);
rc = iface->result;
- DBG("transfer done, result: %d\n", rc);
+ pr_debug("transfer done, result: %d\n", rc);
if (rc == 0 && size == I2C_SMBUS_WORD_DATA && read_write == I2C_SMBUS_READ)
data->word = le16_to_cpu(cur_word);
@@ -348,7 +346,7 @@
rc = -EINVAL;
break;
}
- DBG("xfer: chan: %d, doing %s %d bytes to 0x%02x - %d of %d messages\n",
+ pr_debug("xfer: chan: %d, doing %s %d bytes to 0x%02x - %d of %d messages\n",
chan->chan_no,
pmsg->flags & I2C_M_RD ? "read" : "write",
pmsg->len, addr, i, num);
@@ -388,7 +386,7 @@
rc = iface->result;
if (rc == 0)
completed++;
- DBG("transfer done, result: %d\n", rc);
+ pr_debug("transfer done, result: %d\n", rc);
}
/* Release sem */
diff -Nru a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
--- a/drivers/i2c/busses/i2c-nforce2.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-nforce2.c Mon Jan 19 15:27:44 2004
@@ -32,6 +32,11 @@
/* Note: we assume there can only be one nForce2, with two SMBus interfaces */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/kernel.h>
diff -Nru a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c
--- a/drivers/i2c/busses/i2c-parport-light.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-parport-light.c Mon Jan 19 15:27:44 2004
@@ -24,6 +24,11 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* ------------------------------------------------------------------------ */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
diff -Nru a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
--- a/drivers/i2c/busses/i2c-parport.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-parport.c Mon Jan 19 15:27:44 2004
@@ -24,6 +24,11 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* ------------------------------------------------------------------------ */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -162,7 +167,7 @@
}
memset(adapter, 0x00, sizeof(struct i2c_par));
- printk(KERN_DEBUG "i2c-parport: attaching to %s\n", port->name);
+ pr_debug("i2c-parport: attaching to %s\n", port->name);
adapter->pdev = parport_register_device(port, "i2c-parport",
NULL, NULL, NULL, PARPORT_FLAG_EXCL, NULL);
if (!adapter->pdev) {
diff -Nru a/drivers/i2c/busses/i2c-philips-par.c b/drivers/i2c/busses/i2c-philips-par.c
--- a/drivers/i2c/busses/i2c-philips-par.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-philips-par.c Mon Jan 19 15:27:44 2004
@@ -23,6 +23,11 @@
/* $Id: i2c-philips-par.c,v 1.29 2003/01/21 08:08:16 kmalkki Exp $ */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -158,7 +163,7 @@
}
memset (adapter, 0x00, sizeof(struct i2c_par));
- /* printk(KERN_DEBUG "i2c-philips-par.o: attaching to %s\n", port->name); */
+ /* pr_debug("i2c-philips-par: attaching to %s\n", port->name); */
adapter->pdev = parport_register_device(port, "i2c-philips-par",
NULL, NULL, NULL,
diff -Nru a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
--- a/drivers/i2c/busses/i2c-piix4.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-piix4.c Mon Jan 19 15:27:44 2004
@@ -28,7 +28,10 @@
Note: we assume there can only be one device, with one SMBus interface.
*/
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
#include <linux/module.h>
#include <linux/moduleparam.h>
diff -Nru a/drivers/i2c/busses/i2c-prosavage.c b/drivers/i2c/busses/i2c-prosavage.c
--- a/drivers/i2c/busses/i2c-prosavage.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-prosavage.c Mon Jan 19 15:27:44 2004
@@ -54,6 +54,11 @@
* (Additional documentation needed :(
*/
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/module.h>
#include <linux/init.h>
#include <linux/pci.h>
diff -Nru a/drivers/i2c/busses/i2c-rpx.c b/drivers/i2c/busses/i2c-rpx.c
--- a/drivers/i2c/busses/i2c-rpx.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-rpx.c Mon Jan 19 15:27:44 2004
@@ -11,6 +11,11 @@
* changed to eliminate RPXLite references.
*/
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -82,7 +87,7 @@
rpx_iic_init(&rpx_data);
if (i2c_8xx_add_bus(&rpx_ops) < 0) {
- printk("i2c-rpx: Unable to register with I2C\n");
+ printk(KERN_ERR "i2c-rpx: Unable to register with I2C\n");
return -ENODEV;
}
diff -Nru a/drivers/i2c/busses/i2c-savage4.c b/drivers/i2c/busses/i2c-savage4.c
--- a/drivers/i2c/busses/i2c-savage4.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-savage4.c Mon Jan 19 15:27:44 2004
@@ -29,6 +29,11 @@
it easier to add later.
*/
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
diff -Nru a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c
--- a/drivers/i2c/busses/i2c-sis5595.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-sis5595.c Mon Jan 19 15:27:44 2004
@@ -55,7 +55,10 @@
* Add adapter resets
*/
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
#include <linux/kernel.h>
#include <linux/module.h>
@@ -311,13 +314,12 @@
break;
/*
case I2C_SMBUS_BLOCK_DATA:
- printk("sis5595.o: Block data not yet implemented!\n");
+ printk(KERN_WARNING "sis5595.o: Block data not yet implemented!\n");
return -1;
break;
*/
default:
- printk
- (KERN_WARNING "sis5595.o: Unsupported transaction %d\n", size);
+ printk(KERN_WARNING "sis5595.o: Unsupported transaction %d\n", size);
return -1;
}
diff -Nru a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c
--- a/drivers/i2c/busses/i2c-sis630.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-sis630.c Mon Jan 19 15:27:44 2004
@@ -48,7 +48,10 @@
Note: we assume there can only be one device, with one SMBus interface.
*/
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
#include <linux/kernel.h>
#include <linux/module.h>
diff -Nru a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c
--- a/drivers/i2c/busses/i2c-sis96x.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-sis96x.c Mon Jan 19 15:27:44 2004
@@ -32,7 +32,10 @@
We assume there can only be one SiS96x with one SMBus interface.
*/
-/* #define DEBUG */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
#include <linux/module.h>
#include <linux/pci.h>
diff -Nru a/drivers/i2c/busses/i2c-velleman.c b/drivers/i2c/busses/i2c-velleman.c
--- a/drivers/i2c/busses/i2c-velleman.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-velleman.c Mon Jan 19 15:27:44 2004
@@ -20,6 +20,11 @@
/* $Id: i2c-velleman.c,v 1.29 2003/01/21 08:08:16 kmalkki Exp $ */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/module.h>
@@ -29,11 +34,6 @@
#include <linux/i2c-algo-bit.h>
#include <asm/io.h>
-/* ----- global defines ----------------------------------------------- */
-#define DEB(x) /* should be reasonable open, close &c. */
-#define DEB2(x) /* low level debugging - very slow */
-#define DEBE(x) x /* error messages */
-
/* Pin Port Inverted name */
#define I2C_SDA 0x02 /* ctrl bit 1 (inv) */
#define I2C_SCL 0x08 /* ctrl bit 3 (inv) */
@@ -140,7 +140,7 @@
return -ENODEV;
}
}
- printk(KERN_DEBUG "i2c-velleman: found device at %#x.\n",base);
+ pr_debug("i2c-velleman: found device at %#x.\n",base);
return 0;
}
diff -Nru a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c
--- a/drivers/i2c/busses/i2c-via.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-via.c Mon Jan 19 15:27:44 2004
@@ -21,7 +21,10 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* #define DEBUG */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
#include <linux/kernel.h>
#include <linux/module.h>
diff -Nru a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c
--- a/drivers/i2c/busses/i2c-viapro.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-viapro.c Mon Jan 19 15:27:44 2004
@@ -33,6 +33,11 @@
Note: we assume there can only be one device, with one SMBus interface.
*/
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/kernel.h>
diff -Nru a/drivers/i2c/busses/i2c-voodoo3.c b/drivers/i2c/busses/i2c-voodoo3.c
--- a/drivers/i2c/busses/i2c-voodoo3.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/i2c-voodoo3.c Mon Jan 19 15:27:44 2004
@@ -27,6 +27,11 @@
/* This interfaces to the I2C bus of the Voodoo3 to gain access to
the BT869 and possibly other I2C devices. */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
diff -Nru a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
--- a/drivers/i2c/busses/scx200_acb.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/scx200_acb.c Mon Jan 19 15:27:44 2004
@@ -25,6 +25,11 @@
*/
#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
+#include <linux/config.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/kernel.h>
@@ -373,7 +378,7 @@
data->word = le16_to_cpu(cur_word);
#ifdef DEBUG
- printk(KERN_DEBUG NAME ": transfer done, result: %d", rc);
+ DBG(": transfer done, result: %d", rc);
if (buffer) {
int i;
printk(" data:");
@@ -505,7 +510,7 @@
int i;
int rc;
- printk(KERN_DEBUG NAME ": NatSemi SCx200 ACCESS.bus Driver\n");
+ pr_debug(NAME ": NatSemi SCx200 ACCESS.bus Driver\n");
/* Verify that this really is a SCx200 processor */
if (pci_find_device(PCI_VENDOR_ID_NS,
diff -Nru a/drivers/i2c/busses/scx200_i2c.c b/drivers/i2c/busses/scx200_i2c.c
--- a/drivers/i2c/busses/scx200_i2c.c Mon Jan 19 15:27:44 2004
+++ b/drivers/i2c/busses/scx200_i2c.c Mon Jan 19 15:27:44 2004
@@ -22,6 +22,11 @@
*/
#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG 1
+#endif
+
+#include <linux/config.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/kernel.h>
@@ -88,15 +93,14 @@
int scx200_i2c_init(void)
{
- printk(KERN_DEBUG NAME ": NatSemi SCx200 I2C Driver\n");
+ pr_debug(NAME ": NatSemi SCx200 I2C Driver\n");
if (!scx200_gpio_present()) {
printk(KERN_ERR NAME ": no SCx200 gpio pins available\n");
return -ENODEV;
}
- printk(KERN_DEBUG NAME ": SCL=GPIO%02u, SDA=GPIO%02u\n",
- scl, sda);
+ pr_debug(NAME ": SCL=GPIO%02u, SDA=GPIO%02u\n", scl, sda);
if (scl == -1 || sda == -1 || scl == sda) {
printk(KERN_ERR NAME ": scl and sda must be specified\n");
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
@ 2004-01-20 22:03 ` Jean Delvare
2004-01-20 22:07 ` Greg KH
1 sibling, 1 reply; 38+ messages in thread
From: Jean Delvare @ 2004-01-20 22:03 UTC (permalink / raw)
To: Greg KH, Rusty Russell; +Cc: linux-kernel, sensors
Quoting myself:
> (...) Greg, could
> you please apply the following patch to the "porting-clients" document
> so that at least the new drivers don't need to be converted
> afterwards?
>
> Documentation/i2c/porting-clients | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletion(-)
>
>
> diff -Nru a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients
> --- a/Documentation/i2c/porting-clients Mon Jan 19 15:33:17 2004
> +++ b/Documentation/i2c/porting-clients Mon Jan 19 15:33:17 2004
> @@ -92,7 +92,10 @@
> i2c_get_clientdata(client) instead.
>
> * [Interface] Init function should not print anything. Make sure
> - there is a MODULE_LICENSE() line.
> + there is a MODULE_LICENSE() line. MODULE_PARM() is replaced
> + by module_param(). Note that module_param has a third parameter,
> + that you should set to 0 by default. See
> include/linux/moduleparam.h+ for details.
>
> Coding policy:
On second thought I think I shouldn't have done that change. I2c chip
drivers use SENSORS_INSMOD_* macros which in the end include
MODULE_PARM() calls.
Quoting Rusty Russell: "However, I never implemented mixing old
and new style in the same module, so if you're adding a parameter, it
makes sense to convert them all."
So maybe I shouldn't suggest that new drivers use the new style, since
they will mix old and new in this case. What about forgetting about that
doc change for now? Sorry for the trouble, I should have thought about
that before submitting.
--
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-20 22:03 ` Jean Delvare
@ 2004-01-20 22:07 ` Greg KH
2004-01-21 20:47 ` Jean Delvare
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-20 22:07 UTC (permalink / raw)
To: linux-kernel, sensors; +Cc: Rusty Russell
On Tue, Jan 20, 2004 at 11:03:22PM +0100, Jean Delvare wrote:
> Quoting myself:
>
> > (...) Greg, could
> > you please apply the following patch to the "porting-clients" document
> > so that at least the new drivers don't need to be converted
> > afterwards?
> >
> > Documentation/i2c/porting-clients | 5 ++++-
> > 1 files changed, 4 insertions(+), 1 deletion(-)
> >
> >
> > diff -Nru a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients
> > --- a/Documentation/i2c/porting-clients Mon Jan 19 15:33:17 2004
> > +++ b/Documentation/i2c/porting-clients Mon Jan 19 15:33:17 2004
> > @@ -92,7 +92,10 @@
> > i2c_get_clientdata(client) instead.
> >
> > * [Interface] Init function should not print anything. Make sure
> > - there is a MODULE_LICENSE() line.
> > + there is a MODULE_LICENSE() line. MODULE_PARM() is replaced
> > + by module_param(). Note that module_param has a third parameter,
> > + that you should set to 0 by default. See
> > include/linux/moduleparam.h+ for details.
> >
> > Coding policy:
>
> On second thought I think I shouldn't have done that change. I2c chip
> drivers use SENSORS_INSMOD_* macros which in the end include
> MODULE_PARM() calls.
>
> Quoting Rusty Russell: "However, I never implemented mixing old
> and new style in the same module, so if you're adding a parameter, it
> makes sense to convert them all."
>
> So maybe I shouldn't suggest that new drivers use the new style, since
> they will mix old and new in this case. What about forgetting about that
> doc change for now? Sorry for the trouble, I should have thought about
> that before submitting.
Heh, feel free to port the SENSORS_INSMOD_* crap too if you want to. I
really hate that code, and want to drop it entirely in 2.7 if
possible...
Or just send me a patch, backing out your change, I'll apply that :)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-20 22:07 ` Greg KH
@ 2004-01-21 20:47 ` Jean Delvare
2004-01-24 1:14 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Jean Delvare @ 2004-01-21 20:47 UTC (permalink / raw)
To: Greg KH; +Cc: linux-kernel, sensors, rusty
> Or just send me a patch, backing out your change, I'll apply that :)
Here you are. Sorry again for the noise.
--------------------------------
Undo a recent change to the i2c documentation. The change belongs to
2.7.
--- linux-2.6.2-rc1/Documentation/i2c/porting-clients.orig Wed Jan 21 21:41:04 2004
+++ linux-2.6.2-rc1/Documentation/i2c/porting-clients Wed Jan 21 21:41:12 2004
@@ -92,10 +92,7 @@
i2c_get_clientdata(client) instead.
* [Interface] Init function should not print anything. Make sure
- there is a MODULE_LICENSE() line. MODULE_PARM() is replaced
- by module_param(). Note that module_param has a third parameter,
- that you should set to 0 by default. See include/linux/moduleparam.h
- for details.
+ there is a MODULE_LICENSE() line.
Coding policy:
--
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
@ 2004-01-21 21:50 ` Jean Delvare
2004-01-21 23:56 ` Greg KH
1 sibling, 1 reply; 38+ messages in thread
From: Jean Delvare @ 2004-01-21 21:50 UTC (permalink / raw)
To: Greg KH; +Cc: linux-kernel, sensors
> Also note that I slightly altered the condition to display the PCILynx
> comment. I think it's more logical that way. Without it, the user
> could get the message he/she needs I2C, go to enable it, come back and
> still not see the option.
For the records, please let it be noted that this change is *not* included
in the patch submitted by Greg.
That said, I still think it was a good idea. Not that it matters much to
me since I don't use that driver, but anyway... Who should I contact to
get it included?
Thanks.
--
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-21 21:50 ` Jean Delvare
@ 2004-01-21 23:56 ` Greg KH
2004-01-31 8:56 ` Jean Delvare
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2004-01-21 23:56 UTC (permalink / raw)
To: sensors, linux-kernel
On Wed, Jan 21, 2004 at 10:50:12PM +0100, Jean Delvare wrote:
> > Also note that I slightly altered the condition to display the PCILynx
> > comment. I think it's more logical that way. Without it, the user
> > could get the message he/she needs I2C, go to enable it, come back and
> > still not see the option.
>
> For the records, please let it be noted that this change is *not* included
> in the patch submitted by Greg.
>
> That said, I still think it was a good idea. Not that it matters much to
> me since I don't use that driver, but anyway... Who should I contact to
> get it included?
The ieee1394 maintainer?
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-21 20:47 ` Jean Delvare
@ 2004-01-24 1:14 ` Greg KH
0 siblings, 0 replies; 38+ messages in thread
From: Greg KH @ 2004-01-24 1:14 UTC (permalink / raw)
To: sensors, linux-kernel; +Cc: rusty
On Wed, Jan 21, 2004 at 09:47:05PM +0100, Jean Delvare wrote:
> > Or just send me a patch, backing out your change, I'll apply that :)
>
> Here you are. Sorry again for the noise.
Applied, thanks,
greg k-h
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-21 23:56 ` Greg KH
@ 2004-01-31 8:56 ` Jean Delvare
2004-01-31 15:23 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: Jean Delvare @ 2004-01-31 8:56 UTC (permalink / raw)
To: Greg KH; +Cc: sensors, linux-kernel
> > That said, I still think it was a good idea. Not that it matters
> > much to me since I don't use that driver, but anyway... Who should I
> > contact to get it included?
>
> The ieee1394 maintainer?
OK, done that. It is supposed to have been applied, although it's not in
2.6.2-rc3.
--
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH] i2c driver fixes for 2.6.1
2004-01-31 8:56 ` Jean Delvare
@ 2004-01-31 15:23 ` Greg KH
0 siblings, 0 replies; 38+ messages in thread
From: Greg KH @ 2004-01-31 15:23 UTC (permalink / raw)
To: sensors, linux-kernel
On Sat, Jan 31, 2004 at 09:56:42AM +0100, Jean Delvare wrote:
> > > That said, I still think it was a good idea. Not that it matters
> > > much to me since I don't use that driver, but anyway... Who should I
> > > contact to get it included?
> >
> > The ieee1394 maintainer?
>
> OK, done that. It is supposed to have been applied, although it's not in
> 2.6.2-rc3.
Give them time, iee1394 doesn't sync up with Linus as often as USB and
I2C does :)
greg k-h
^ permalink raw reply [flat|nested] 38+ messages in thread
end of thread, other threads:[~2004-01-31 15:32 UTC | newest]
Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-19 23:57 [BK PATCH] i2c driver fixes for 2.6.1 Greg KH
2004-01-19 23:59 ` [PATCH] " Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-19 23:59 ` Greg KH
2004-01-21 21:50 ` Jean Delvare
2004-01-21 23:56 ` Greg KH
2004-01-31 8:56 ` Jean Delvare
2004-01-31 15:23 ` Greg KH
2004-01-20 22:03 ` Jean Delvare
2004-01-20 22:07 ` Greg KH
2004-01-21 20:47 ` Jean Delvare
2004-01-24 1:14 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox