Commit 6c16fa73 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge kroah.com:/home/greg/linux/BK/bleed-2.5

into kroah.com:/home/greg/linux/BK/i2c-2.6
parents 8912ad07 285dde44
...@@ -22,10 +22,20 @@ config I2C ...@@ -22,10 +22,20 @@ config I2C
If you want I2C support, you should say Y here and also to the If you want I2C support, you should say Y here and also to the
specific driver for your bus adapter(s) below. specific driver for your bus adapter(s) below.
This I2C support is also available as a module. If you want to This I2C support can also be built as a module. If so, the module
compile it as a module, say M here and read will be called i2c-core.
<file:Documentation/modules.txt>.
The module will be called i2c-core. config I2C_CHARDEV
tristate "I2C device interface"
depends on I2C
help
Say Y here to use i2c-* device files, usually found in the /dev
directory on your system. They make it possible to have user-space
programs use the I2C bus. Information on how to do this is
contained in the file <file:Documentation/i2c/dev-interface>.
This support is also available as a module. If so, the module
will be called i2c-dev.
config I2C_ALGOBIT config I2C_ALGOBIT
tristate "I2C bit-banging interfaces" tristate "I2C bit-banging interfaces"
...@@ -35,105 +45,8 @@ config I2C_ALGOBIT ...@@ -35,105 +45,8 @@ config I2C_ALGOBIT
adapters. Say Y if you own an I2C adapter belonging to this class adapters. Say Y if you own an I2C adapter belonging to this class
and then say Y to the specific driver for you adapter below. and then say Y to the specific driver for you adapter below.
This support is also available as a module. If you want to compile This support is also available as a module. If so, the module
it as a module, say M here and read will be called i2c-algo-bit.
<file:Documentation/modules.txt>.
The module will be called i2c-algo-bit.
config I2C_PROSAVAGE
tristate "S3/VIA (Pro)Savage"
depends on I2C_ALGOBIT && PCI && EXPERIMENTAL
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
graphics processors.
chipsets supported:
S3/VIA KM266/VT8375 aka ProSavage8
S3/VIA KM133/VT8365 aka Savage4
This can also be built as a module which can be inserted and removed
while the kernel is running. If you want to compile it as a module,
say M here and read <file:Documentation/modules.txt>.
The module will be called i2c-prosavage.
You will also need the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
config I2C_PHILIPSPAR
tristate "Philips style parallel port adapter"
depends on I2C_ALGOBIT && PARPORT
---help---
This supports parallel-port I2C adapters made by Philips. Say Y if
you own such an adapter.
This driver is also available as a module. If you want to compile
it as a module, say M here and read
<file:Documentation/modules.txt>.
The module will be called i2c-philips-par.
Note that if you want support for different parallel port devices,
life will be much easier if you compile them all as modules.
config I2C_ELV
tristate "ELV adapter"
depends on I2C_ALGOBIT && ISA
help
This supports parallel-port I2C adapters called ELV. Say Y if you
own such an adapter.
This driver is also available as a module. If you want to compile
it as a module, say M here and read
<file:Documentation/modules.txt>.
The module will be called i2c-elv.
config I2C_VELLEMAN
tristate "Velleman K9000 adapter"
depends on I2C_ALGOBIT && ISA
help
This supports the Velleman K9000 parallel-port I2C adapter. Say Y
if you own such an adapter.
This driver is also available as a module. If you want to compile
it as a module, say M here and read
<file:Documentation/modules.txt>.
The module will be called i2c-velleman.
config SCx200_I2C
tristate "NatSemi SCx200 I2C using GPIO pins"
depends on SCx200 && I2C_ALGOBIT
help
Enable the use of two GPIO pins of a SCx200 processor as an I2C bus.
If you don't know what to do here, say N.
If compiled as a module, it will be called scx200_i2c.
config SCx200_I2C_SCL
int "GPIO pin used for SCL"
depends on SCx200_I2C
default "12"
help
Enter the GPIO pin number used for the SCL signal. This value can
also be specified with a module parameter.
config SCx200_I2C_SDA
int "GPIO pin used for SDA"
depends on SCx200_I2C
default "13"
help
Enter the GPIO pin number used for the SSA signal. This value can
also be specified with a module parameter.
config SCx200_ACB
tristate "NatSemi SCx200 ACCESS.bus"
depends on I2C_ALGOBIT!=n && I2C
help
Enable the use of the ACCESS.bus controllers of a SCx200 processor.
If you don't know what to do here, say N.
If compiled as a module, it will be called scx200_acb.
config I2C_ALGOPCF config I2C_ALGOPCF
tristate "I2C PCF 8584 interfaces" tristate "I2C PCF 8584 interfaces"
...@@ -143,35 +56,10 @@ config I2C_ALGOPCF ...@@ -143,35 +56,10 @@ config I2C_ALGOPCF
Say Y if you own an I2C adapter belonging to this class and then say Say Y if you own an I2C adapter belonging to this class and then say
Y to the specific driver for you adapter below. Y to the specific driver for you adapter below.
This support is also available as a module. If you want to compile This support is also available as a module. If so, the module
it as a module, say M here and read will be called i2c-algo-pcf.
<file:Documentation/modules.txt>.
The module will be called i2c-algo-pcf.
config I2C_ELEKTOR
tristate "Elektor ISA card"
depends on I2C_ALGOPCF && BROKEN_ON_SMP
help
This supports the PCF8584 ISA bus I2C adapter. Say Y if you own
such an adapter.
This driver is also available as a module. If you want to compile
it as a module, say M here and read
<file:Documentation/modules.txt>.
The module will be called i2c-elektor.
config I2C_KEYWEST config I2C_ALGOITE
tristate "Powermac Keywest I2C interface"
depends on I2C && PPC_PMAC
help
This supports the use of the I2C interface in the combo-I/O
chip on recent Apple machines. Say Y if you have such a machine.
This driver is also available as a module. If you want to compile
it as a module, say M here and read Documentation/modules.txt.
The module will be called i2c-keywest.
config ITE_I2C_ALGO
tristate "ITE I2C Algorithm" tristate "ITE I2C Algorithm"
depends on MIPS_ITE8172 && I2C depends on MIPS_ITE8172 && I2C
help help
...@@ -179,56 +67,13 @@ config ITE_I2C_ALGO ...@@ -179,56 +67,13 @@ config ITE_I2C_ALGO
systems. Say Y if you have one of these. You should also say Y for systems. Say Y if you have one of these. You should also say Y for
the ITE I2C peripheral driver support below. the ITE I2C peripheral driver support below.
This support is also available as a module. If you want to compile This support is also available as a module. If so, the module
it as a module, say M here and read Documentation/modules.txt. will be called i2c-algo-ite.
The module will be called i2c-algo-ite.
config ITE_I2C_ADAP
tristate "ITE I2C Adapter"
depends on ITE_I2C_ALGO
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
the ITE I2C driver algorithm support above.
This support is also available as a module. If you want to compile
it as a module, say M here and read Documentation/modules.txt.
The module will be called i2c-adap-ite.
config I2C_ALGO8XX config I2C_ALGO8XX
tristate "MPC8xx CPM I2C interface" tristate "MPC8xx CPM I2C interface"
depends on 8xx && I2C depends on 8xx && I2C
config I2C_RPXLITE
tristate "Embedded Planet RPX Lite/Classic suppoort"
depends on (RPXLITE || RPXCLASSIC) && I2C_ALGO8XX
config I2C_IBM_OCP_ALGO
tristate "IBM on-chip I2C Algorithm"
depends on IBM_OCP && I2C
config I2C_IBM_OCP_ADAP
tristate "IBM on-chip I2C Adapter"
depends on I2C_IBM_OCP_ALGO
config I2C_IOP3XX
tristate "Intel XScale IOP3xx on-chip I2C interface"
depends on ARCH_IOP3XX && I2C
config I2C_CHARDEV
tristate "I2C device interface"
depends on I2C
help
Say Y here to use i2c-* device files, usually found in the /dev
directory on your system. They make it possible to have user-space
programs use the I2C bus. Information on how to do this is
contained in the file <file:Documentation/i2c/dev-interface>.
This code is also available as a module. If you want to compile
it as a module, say M here and read
<file:Documentation/modules.txt>.
The module will be called i2c-dev.
source drivers/i2c/busses/Kconfig source drivers/i2c/busses/Kconfig
source drivers/i2c/chips/Kconfig source drivers/i2c/chips/Kconfig
......
# #
# Makefile for the kernel i2c bus driver. # Makefile for the i2c core.
# #
obj-$(CONFIG_I2C) += i2c-core.o obj-$(CONFIG_I2C) += i2c-core.o
obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o
obj-$(CONFIG_I2C_SENSOR) += i2c-sensor.o
obj-$(CONFIG_I2C_ALGOBIT) += i2c-algo-bit.o obj-$(CONFIG_I2C_ALGOBIT) += i2c-algo-bit.o
obj-$(CONFIG_I2C_PROSAVAGE) += i2c-prosavage.o
obj-$(CONFIG_I2C_PHILIPSPAR) += i2c-philips-par.o
obj-$(CONFIG_I2C_ELV) += i2c-elv.o
obj-$(CONFIG_I2C_VELLEMAN) += i2c-velleman.o
obj-$(CONFIG_I2C_ALGOPCF) += i2c-algo-pcf.o obj-$(CONFIG_I2C_ALGOPCF) += i2c-algo-pcf.o
obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o obj-$(CONFIG_I2C_ALGOITE) += i2c-algo-ite.o
obj-$(CONFIG_I2C_KEYWEST) += i2c-keywest.o
obj-$(CONFIG_ITE_I2C_ALGO) += i2c-algo-ite.o
obj-$(CONFIG_ITE_I2C_ADAP) += i2c-adap-ite.o
obj-$(CONFIG_SCx200_I2C) += scx200_i2c.o
obj-$(CONFIG_SCx200_ACB) += scx200_acb.o
obj-$(CONFIG_I2C_SENSOR) += i2c-sensor.o
obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o
obj-y += busses/ chips/ obj-y += busses/ chips/
This diff is collapsed.
# #
# Makefile for the kernel hardware sensors bus drivers. # Makefile for the i2c bus drivers.
# #
obj-$(CONFIG_I2C_ALI1535) += i2c-ali1535.o obj-$(CONFIG_I2C_ALI1535) += i2c-ali1535.o
obj-$(CONFIG_I2C_ALI15X3) += i2c-ali15x3.o obj-$(CONFIG_I2C_ALI15X3) += i2c-ali15x3.o
obj-$(CONFIG_I2C_AMD756) += i2c-amd756.o obj-$(CONFIG_I2C_AMD756) += i2c-amd756.o
obj-$(CONFIG_I2C_AMD8111) += i2c-amd8111.o obj-$(CONFIG_I2C_AMD8111) += i2c-amd8111.o
obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o
obj-$(CONFIG_I2C_ELV) += i2c-elv.o
obj-$(CONFIG_I2C_I801) += i2c-i801.o obj-$(CONFIG_I2C_I801) += i2c-i801.o
obj-$(CONFIG_I2C_I810) += i2c-i810.o
obj-$(CONFIG_I2C_IBM_IIC) += i2c-ibm_iic.o
obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o
obj-$(CONFIG_I2C_ISA) += i2c-isa.o obj-$(CONFIG_I2C_ISA) += i2c-isa.o
obj-$(CONFIG_I2C_ITE) += i2c-ite.o
obj-$(CONFIG_I2C_KEYWEST) += i2c-keywest.o
obj-$(CONFIG_I2C_NFORCE2) += i2c-nforce2.o obj-$(CONFIG_I2C_NFORCE2) += i2c-nforce2.o
obj-$(CONFIG_I2C_PHILIPSPAR) += i2c-philips-par.o
obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o
obj-$(CONFIG_I2C_PROSAVAGE) += i2c-prosavage.o
obj-$(CONFIG_I2C_RPXLITE) += i2c-rpx.o
obj-$(CONFIG_I2C_SAVAGE4) += i2c-savage4.o
obj-$(CONFIG_I2C_SIS5595) += i2c-sis5595.o
obj-$(CONFIG_I2C_SIS630) += i2c-sis630.o
obj-$(CONFIG_I2C_SIS96X) += i2c-sis96x.o obj-$(CONFIG_I2C_SIS96X) += i2c-sis96x.o
obj-$(CONFIG_I2C_VELLEMAN) += i2c-velleman.o
obj-$(CONFIG_I2C_VIA) += i2c-via.o
obj-$(CONFIG_I2C_VIAPRO) += i2c-viapro.o obj-$(CONFIG_I2C_VIAPRO) += i2c-viapro.o
obj-$(CONFIG_I2C_VOODOO3) += i2c-voodoo3.o
obj-$(CONFIG_SCx200_ACB) += scx200_acb.o
obj-$(CONFIG_SCx200_I2C) += scx200_i2c.o
...@@ -481,7 +481,6 @@ static struct i2c_algorithm smbus_algorithm = { ...@@ -481,7 +481,6 @@ static struct i2c_algorithm smbus_algorithm = {
static struct i2c_adapter ali1535_adapter = { static struct i2c_adapter ali1535_adapter = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_ALI1535,
.algo = &smbus_algorithm, .algo = &smbus_algorithm,
.name = "unset", .name = "unset",
}; };
...@@ -507,7 +506,7 @@ static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_ ...@@ -507,7 +506,7 @@ static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_
/* set up the driverfs linkage to our parent device */ /* set up the driverfs linkage to our parent device */
ali1535_adapter.dev.parent = &dev->dev; ali1535_adapter.dev.parent = &dev->dev;
snprintf(ali1535_adapter.name, DEVICE_NAME_SIZE, snprintf(ali1535_adapter.name, I2C_NAME_SIZE,
"SMBus ALI1535 adapter at %04x", ali1535_smba); "SMBus ALI1535 adapter at %04x", ali1535_smba);
return i2c_add_adapter(&ali1535_adapter); return i2c_add_adapter(&ali1535_adapter);
} }
......
...@@ -471,7 +471,6 @@ static struct i2c_algorithm smbus_algorithm = { ...@@ -471,7 +471,6 @@ static struct i2c_algorithm smbus_algorithm = {
static struct i2c_adapter ali15x3_adapter = { static struct i2c_adapter ali15x3_adapter = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_ALI15X3,
.class = I2C_ADAP_CLASS_SMBUS, .class = I2C_ADAP_CLASS_SMBUS,
.algo = &smbus_algorithm, .algo = &smbus_algorithm,
.name = "unset", .name = "unset",
...@@ -498,7 +497,7 @@ static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_ ...@@ -498,7 +497,7 @@ static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_
/* set up the driverfs linkage to our parent device */ /* set up the driverfs linkage to our parent device */
ali15x3_adapter.dev.parent = &dev->dev; ali15x3_adapter.dev.parent = &dev->dev;
snprintf(ali15x3_adapter.name, DEVICE_NAME_SIZE, snprintf(ali15x3_adapter.name, I2C_NAME_SIZE,
"SMBus ALI15X3 adapter at %04x", ali15x3_smba); "SMBus ALI15X3 adapter at %04x", ali15x3_smba);
return i2c_add_adapter(&ali15x3_adapter); return i2c_add_adapter(&ali15x3_adapter);
} }
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
/* #define DEBUG 1 */ /* #define DEBUG 1 */
#include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -304,7 +303,6 @@ static struct i2c_algorithm smbus_algorithm = { ...@@ -304,7 +303,6 @@ static struct i2c_algorithm smbus_algorithm = {
static struct i2c_adapter amd756_adapter = { static struct i2c_adapter amd756_adapter = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_AMD756,
.class = I2C_ADAP_CLASS_SMBUS, .class = I2C_ADAP_CLASS_SMBUS,
.algo = &smbus_algorithm, .algo = &smbus_algorithm,
.name = "unset", .name = "unset",
...@@ -369,7 +367,7 @@ static int __devinit amd756_probe(struct pci_dev *pdev, ...@@ -369,7 +367,7 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
/* set up the driverfs linkage to our parent device */ /* set up the driverfs linkage to our parent device */
amd756_adapter.dev.parent = &pdev->dev; amd756_adapter.dev.parent = &pdev->dev;
snprintf(amd756_adapter.name, DEVICE_NAME_SIZE, snprintf(amd756_adapter.name, I2C_NAME_SIZE,
"SMBus AMD75x adapter at %04x", amd756_ioport); "SMBus AMD75x adapter at %04x", amd756_ioport);
error = i2c_add_adapter(&amd756_adapter); error = i2c_add_adapter(&amd756_adapter);
......
...@@ -356,9 +356,8 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_ ...@@ -356,9 +356,8 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_
goto out_kfree; goto out_kfree;
smbus->adapter.owner = THIS_MODULE; smbus->adapter.owner = THIS_MODULE;
snprintf(smbus->adapter.name, DEVICE_NAME_SIZE, snprintf(smbus->adapter.name, I2C_NAME_SIZE,
"SMBus2 AMD8111 adapter at %04x", smbus->base); "SMBus2 AMD8111 adapter at %04x", smbus->base);
smbus->adapter.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_AMD8111;
smbus->adapter.class = I2C_ADAP_CLASS_SMBUS; smbus->adapter.class = I2C_ADAP_CLASS_SMBUS;
smbus->adapter.algo = &smbus_algorithm; smbus->adapter.algo = &smbus_algorithm;
smbus->adapter.algo_data = smbus; smbus->adapter.algo_data = smbus;
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/version.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/pci.h> #include <linux/pci.h>
...@@ -42,7 +41,7 @@ ...@@ -42,7 +41,7 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h> #include <asm/irq.h>
#include "i2c-pcf8584.h" #include "../i2c-pcf8584.h"
#define DEFAULT_BASE 0x330 #define DEFAULT_BASE 0x330
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
/* With some changes from Kysti Mlkki <kmalkki@cc.hut.fi> and even /* With some changes from Kysti Mlkki <kmalkki@cc.hut.fi> and even
Frodo Looijaard <frodol@dds.nl> */ Frodo Looijaard <frodol@dds.nl> */
/* $Id: i2c-elv.c,v 1.27 2003/01/21 08:08:16 kmalkki Exp $ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/delay.h> #include <linux/delay.h>
...@@ -36,7 +34,7 @@ ...@@ -36,7 +34,7 @@
#define DEFAULT_BASE 0x378 #define DEFAULT_BASE 0x378
static int base=0; static int base=0;
static unsigned char PortData = 0; static unsigned char port_data = 0;
/* ----- global defines ----------------------------------------------- */ /* ----- global defines ----------------------------------------------- */
#define DEB(x) /* should be reasonable open, close &c. */ #define DEB(x) /* should be reasonable open, close &c. */
...@@ -57,21 +55,21 @@ static unsigned char PortData = 0; ...@@ -57,21 +55,21 @@ static unsigned char PortData = 0;
static void bit_elv_setscl(void *data, int state) static void bit_elv_setscl(void *data, int state)
{ {
if (state) { if (state) {
PortData &= 0xfe; port_data &= 0xfe;
} else { } else {
PortData |=1; port_data |=1;
} }
outb(PortData, DATA); outb(port_data, DATA);
} }
static void bit_elv_setsda(void *data, int state) static void bit_elv_setsda(void *data, int state)
{ {
if (state) { if (state) {
PortData &=0xfd; port_data &=0xfd;
} else { } else {
PortData |=2; port_data |=2;
} }
outb(PortData, DATA); outb(port_data, DATA);
} }
static int bit_elv_getscl(void *data) static int bit_elv_getscl(void *data)
...@@ -103,7 +101,7 @@ static int bit_elv_init(void) ...@@ -103,7 +101,7 @@ static int bit_elv_init(void)
goto fail; goto fail;
} }
PortData = 0; port_data = 0;
bit_elv_setsda((void*)base,1); bit_elv_setsda((void*)base,1);
bit_elv_setscl((void*)base,1); bit_elv_setscl((void*)base,1);
return 0; return 0;
...@@ -129,14 +127,13 @@ static struct i2c_algo_bit_data bit_elv_data = { ...@@ -129,14 +127,13 @@ static struct i2c_algo_bit_data bit_elv_data = {
static struct i2c_adapter bit_elv_ops = { static struct i2c_adapter bit_elv_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.id = I2C_HW_B_ELV,
.algo_data = &bit_elv_data, .algo_data = &bit_elv_data,
.name = "ELV Parallel port adaptor", .name = "ELV Parallel port adaptor",
}; };
static int __init i2c_bitelv_init(void) static int __init i2c_bitelv_init(void)
{ {
printk(KERN_INFO "i2c-elv.o: i2c ELV parallel port adapter module version %s (%s)\n", I2C_VERSION, I2C_DATE); printk(KERN_INFO "i2c ELV parallel port adapter driver\n");
if (base==0) { if (base==0) {
/* probe some values */ /* probe some values */
base=DEFAULT_BASE; base=DEFAULT_BASE;
......
...@@ -540,7 +540,6 @@ static struct i2c_algorithm smbus_algorithm = { ...@@ -540,7 +540,6 @@ static struct i2c_algorithm smbus_algorithm = {
static struct i2c_adapter i801_adapter = { static struct i2c_adapter i801_adapter = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_I801,
.class = I2C_ADAP_CLASS_SMBUS, .class = I2C_ADAP_CLASS_SMBUS,
.algo = &smbus_algorithm, .algo = &smbus_algorithm,
.name = "unset", .name = "unset",
...@@ -598,7 +597,7 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id ...@@ -598,7 +597,7 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
/* set up the driverfs linkage to our parent device */ /* set up the driverfs linkage to our parent device */
i801_adapter.dev.parent = &dev->dev; i801_adapter.dev.parent = &dev->dev;
snprintf(i801_adapter.name, DEVICE_NAME_SIZE, snprintf(i801_adapter.name, I2C_NAME_SIZE,
"SMBus I801 adapter at %04x", i801_smba); "SMBus I801 adapter at %04x", i801_smba);
return i2c_add_adapter(&i801_adapter); return i2c_add_adapter(&i801_adapter);
} }
......
/*
i2c-i810.c - Part of lm_sensors, Linux kernel modules for hardware
monitoring
Copyright (c) 1998, 1999, 2000 Frodo Looijaard <frodol@dds.nl>,
Philip Edelbrock <phil@netroedge.com>,
Ralph Metzler <rjkm@thp.uni-koeln.de>, and
Mark D. Studebaker <mdsxyz123@yahoo.com>
Based on code written by Ralph Metzler <rjkm@thp.uni-koeln.de> and
Simon Vogl
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 interfaces to the I810/I815 to provide access to
the DDC Bus and the I2C Bus.
SUPPORTED DEVICES PCI ID
i810AA 7121
i810AB 7123
i810E 7125
i815 1132
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
/* GPIO register locations */
#define I810_IOCONTROL_OFFSET 0x5000
#define I810_HVSYNC 0x00 /* not used */
#define I810_GPIOA 0x10
#define I810_GPIOB 0x14
/* bit locations in the registers */
#define SCL_DIR_MASK 0x0001
#define SCL_DIR 0x0002
#define SCL_VAL_MASK 0x0004
#define SCL_VAL_OUT 0x0008
#define SCL_VAL_IN 0x0010
#define SDA_DIR_MASK 0x0100
#define SDA_DIR 0x0200
#define SDA_VAL_MASK 0x0400
#define SDA_VAL_OUT 0x0800
#define SDA_VAL_IN 0x1000
/* initialization states */
#define INIT1 0x1
#define INIT2 0x2
#define INIT3 0x4
/* delays */
#define CYCLE_DELAY 10
#define TIMEOUT (HZ / 2)
static void *ioaddr;
/* The i810 GPIO registers have individual masks for each bit
so we never have to read before writing. Nice. */
static void bit_i810i2c_setscl(void *data, int val)
{
writel((val ? SCL_VAL_OUT : 0) | SCL_DIR | SCL_DIR_MASK | SCL_VAL_MASK,
ioaddr + I810_GPIOB);
readl(ioaddr + I810_GPIOB); /* flush posted write */
}
static void bit_i810i2c_setsda(void *data, int val)
{
writel((val ? SDA_VAL_OUT : 0) | SDA_DIR | SDA_DIR_MASK | SDA_VAL_MASK,
ioaddr + I810_GPIOB);
readl(ioaddr + I810_GPIOB); /* flush posted write */
}
/* The GPIO pins are open drain, so the pins could always remain outputs.
However, some chip versions don't latch the inputs unless they
are set as inputs.
We rely on the i2c-algo-bit routines to set the pins high before
reading the input from other chips. Following guidance in the 815
prog. ref. guide, we do a "dummy write" of 0 to the register before
reading which forces the input value to be latched. We presume this
applies to the 810 as well; shouldn't hurt anyway. This is necessary to get
i2c_algo_bit bit_test=1 to pass. */
static int bit_i810i2c_getscl(void *data)
{
writel(SCL_DIR_MASK, ioaddr + I810_GPIOB);
writel(0, ioaddr + I810_GPIOB);
return (0 != (readl(ioaddr + I810_GPIOB) & SCL_VAL_IN));
}
static int bit_i810i2c_getsda(void *data)
{
writel(SDA_DIR_MASK, ioaddr + I810_GPIOB);
writel(0, ioaddr + I810_GPIOB);
return (0 != (readl(ioaddr + I810_GPIOB) & SDA_VAL_IN));
}
static void bit_i810ddc_setscl(void *data, int val)
{
writel((val ? SCL_VAL_OUT : 0) | SCL_DIR | SCL_DIR_MASK | SCL_VAL_MASK,
ioaddr + I810_GPIOA);
readl(ioaddr + I810_GPIOA); /* flush posted write */
}
static void bit_i810ddc_setsda(void *data, int val)
{
writel((val ? SDA_VAL_OUT : 0) | SDA_DIR | SDA_DIR_MASK | SDA_VAL_MASK,
ioaddr + I810_GPIOA);
readl(ioaddr + I810_GPIOA); /* flush posted write */
}
static int bit_i810ddc_getscl(void *data)
{
writel(SCL_DIR_MASK, ioaddr + I810_GPIOA);
writel(0, ioaddr + I810_GPIOA);
return (0 != (readl(ioaddr + I810_GPIOA) & SCL_VAL_IN));
}
static int bit_i810ddc_getsda(void *data)
{
writel(SDA_DIR_MASK, ioaddr + I810_GPIOA);
writel(0, ioaddr + I810_GPIOA);
return (0 != (readl(ioaddr + I810_GPIOA) & SDA_VAL_IN));
}
static int config_i810(struct pci_dev *dev)
{
unsigned long cadr;
/* map I810 memory */
cadr = dev->resource[1].start;
cadr += I810_IOCONTROL_OFFSET;
cadr &= PCI_BASE_ADDRESS_MEM_MASK;
ioaddr = ioremap_nocache(cadr, 0x1000);
if (ioaddr) {
bit_i810i2c_setscl(NULL, 1);
bit_i810i2c_setsda(NULL, 1);
bit_i810ddc_setscl(NULL, 1);
bit_i810ddc_setsda(NULL, 1);
return 0;
}
return -ENODEV;
}
static struct i2c_algo_bit_data i810_i2c_bit_data = {
.setsda = bit_i810i2c_setsda,
.setscl = bit_i810i2c_setscl,
.getsda = bit_i810i2c_getsda,
.getscl = bit_i810i2c_getscl,
.udelay = CYCLE_DELAY,
.mdelay = CYCLE_DELAY,
.timeout = TIMEOUT,
};
static struct i2c_adapter i810_i2c_adapter = {
.owner = THIS_MODULE,
.name = "I810/I815 I2C Adapter",
.algo_data = &i810_i2c_bit_data,
};
static struct i2c_algo_bit_data i810_ddc_bit_data = {
.setsda = bit_i810ddc_setsda,
.setscl = bit_i810ddc_setscl,
.getsda = bit_i810ddc_getsda,
.getscl = bit_i810ddc_getscl,
.udelay = CYCLE_DELAY,
.mdelay = CYCLE_DELAY,
.timeout = TIMEOUT,
};
static struct i2c_adapter i810_ddc_adapter = {
.owner = THIS_MODULE,
.name = "I810/I815 DDC Adapter",
.algo_data = &i810_ddc_bit_data,
};
static struct pci_device_id i810_ids[] __devinitdata = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82810_IG1) },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82810_IG3) },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82810E_IG) },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82815_CGC) },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82845G_IG) },
{ 0, },
};
static int __devinit i810_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
int retval;
retval = config_i810(dev);
if (retval)
return retval;
dev_info(&dev->dev, "i810/i815 i2c device found.\n");
/* set up the sysfs linkage to our parent device */
i810_i2c_adapter.dev.parent = &dev->dev;
i810_ddc_adapter.dev.parent = &dev->dev;
retval = i2c_bit_add_bus(&i810_i2c_adapter);
if (retval)
return retval;
retval = i2c_bit_add_bus(&i810_ddc_adapter);
if (retval)
i2c_bit_del_bus(&i810_i2c_adapter);
return retval;
}
static void __devexit i810_remove(struct pci_dev *dev)
{
i2c_bit_del_bus(&i810_ddc_adapter);
i2c_bit_del_bus(&i810_i2c_adapter);
iounmap(ioaddr);
}
static struct pci_driver i810_driver = {
.name = "i810 smbus",
.id_table = i810_ids,
.probe = i810_probe,
.remove = __devexit_p(i810_remove),
};
static int __init i2c_i810_init(void)
{
return pci_module_init(&i810_driver);
}
static void __exit i2c_i810_exit(void)
{
pci_unregister_driver(&i810_driver);
}
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, "
"Philip Edelbrock <phil@netroedge.com>, "
"Ralph Metzler <rjkm@thp.uni-koeln.de>, "
"and Mark D. Studebaker <mdsxyz123@yahoo.com>");
MODULE_DESCRIPTION("I810/I815 I2C/DDC driver");
MODULE_LICENSE("GPL");
module_init(i2c_i810_init);
module_exit(i2c_i810_exit);
This diff is collapsed.
/*
* drivers/i2c/i2c-ibm_iic.h
*
* Support for the IIC peripheral on IBM PPC 4xx
*
* Copyright (c) 2003 Zultys Technologies.
* Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
*
* Based on original work by
* Ian DaSilva <idasilva@mvista.com>
* Armin Kuster <akuster@mvista.com>
* Matt Porter <mporter@mvista.com>
*
* Copyright 2000-2003 MontaVista Software Inc.
*
* 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.
*
*/
#ifndef __I2C_IBM_IIC_H_
#define __I2C_IBM_IIC_H_
#include <linux/config.h>
#include <linux/i2c.h>
struct iic_regs {
u16 mdbuf;
u16 sbbuf;
u8 lmadr;
u8 hmadr;
u8 cntl;
u8 mdcntl;
u8 sts;
u8 extsts;
u8 lsadr;
u8 hsadr;
u8 clkdiv;
u8 intmsk;
u8 xfrcnt;
u8 xtcntlss;
u8 directcntl;
};
struct ibm_iic_private {
struct i2c_adapter adap;
volatile struct iic_regs *vaddr;
wait_queue_head_t wq;
int idx;
int irq;
int fast_mode;
u8 clckdiv;
};
/* IICx_CNTL register */
#define CNTL_HMT 0x80
#define CNTL_AMD 0x40
#define CNTL_TCT_MASK 0x30
#define CNTL_TCT_SHIFT 4
#define CNTL_RPST 0x08
#define CNTL_CHT 0x04
#define CNTL_RW 0x02
#define CNTL_PT 0x01
/* IICx_MDCNTL register */
#define MDCNTL_FSDB 0x80
#define MDCNTL_FMDB 0x40
#define MDCNTL_EGC 0x20
#define MDCNTL_FSM 0x10
#define MDCNTL_ESM 0x08
#define MDCNTL_EINT 0x04
#define MDCNTL_EUBS 0x02
#define MDCNTL_HSCL 0x01
/* IICx_STS register */
#define STS_SSS 0x80
#define STS_SLPR 0x40
#define STS_MDBS 0x20
#define STS_MDBF 0x10
#define STS_SCMP 0x08
#define STS_ERR 0x04
#define STS_IRQA 0x02
#define STS_PT 0x01
/* IICx_EXTSTS register */
#define EXTSTS_IRQP 0x80
#define EXTSTS_BCS_MASK 0x70
#define EXTSTS_BCS_FREE 0x40
#define EXTSTS_IRQD 0x08
#define EXTSTS_LA 0x04
#define EXTSTS_ICT 0x02
#define EXTSTS_XFRA 0x01
/* IICx_INTRMSK register */
#define INTRMSK_EIRC 0x80
#define INTRMSK_EIRS 0x40
#define INTRMSK_EIWC 0x20
#define INTRMSK_EIWS 0x10
#define INTRMSK_EIHE 0x08
#define INTRMSK_EIIC 0x04
#define INTRMSK_EITA 0x02
#define INTRMSK_EIMTC 0x01
/* IICx_XFRCNT register */
#define XFRCNT_MTC_MASK 0x07
/* IICx_XTCNTLSS register */
#define XTCNTLSS_SRC 0x80
#define XTCNTLSS_SRS 0x40
#define XTCNTLSS_SWC 0x20
#define XTCNTLSS_SWS 0x10
#define XTCNTLSS_SRST 0x01
/* IICx_DIRECTCNTL register */
#define DIRCNTL_SDAC 0x08
#define DIRCNTL_SCC 0x04
#define DIRCNTL_MSDA 0x02
#define DIRCNTL_MSC 0x01
/* Check if we really control the I2C bus and bus is free */
#define DIRCTNL_FREE(v) (((v) & 0x0f) == 0x0f)
#endif /* __I2C_IBM_IIC_H_ */
...@@ -30,21 +30,29 @@ ...@@ -30,21 +30,29 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/i2c.h> #include <linux/i2c.h>
static u32 isa_func(struct i2c_adapter *adapter);
/* This is the actual algorithm we define */ /* This is the actual algorithm we define */
static struct i2c_algorithm isa_algorithm = { static struct i2c_algorithm isa_algorithm = {
.name = "ISA bus algorithm", .name = "ISA bus algorithm",
.id = I2C_ALGO_ISA, .id = I2C_ALGO_ISA,
.functionality = isa_func,
}; };
/* There can only be one... */ /* There can only be one... */
static struct i2c_adapter isa_adapter = { static struct i2c_adapter isa_adapter = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.id = I2C_ALGO_ISA | I2C_HW_ISA,
.class = I2C_ADAP_CLASS_SMBUS, .class = I2C_ADAP_CLASS_SMBUS,
.algo = &isa_algorithm, .algo = &isa_algorithm,
.name = "ISA main adapter", .name = "ISA main adapter",
}; };
/* We can't do a thing... */
static u32 isa_func(struct i2c_adapter *adapter)
{
return 0;
}
static int __init i2c_isa_init(void) static int __init i2c_isa_init(void)
{ {
return i2c_add_adapter(&isa_adapter); return i2c_add_adapter(&isa_adapter);
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/version.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -46,7 +45,7 @@ ...@@ -46,7 +45,7 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-algo-ite.h> #include <linux/i2c-algo-ite.h>
#include <linux/i2c-adap-ite.h> #include <linux/i2c-adap-ite.h>
#include "i2c-ite.h" #include "../i2c-ite.h"
#define DEFAULT_BASE 0x14014030 #define DEFAULT_BASE 0x14014030
#define ITE_IIC_IO_SIZE 0x40 #define ITE_IIC_IO_SIZE 0x40
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/config.h> #include <linux/config.h>
#include <linux/version.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/pci.h> #include <linux/pci.h>
......
...@@ -118,7 +118,6 @@ static struct i2c_algorithm smbus_algorithm = { ...@@ -118,7 +118,6 @@ static struct i2c_algorithm smbus_algorithm = {
static struct i2c_adapter nforce2_adapter = { static struct i2c_adapter nforce2_adapter = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_NFORCE2,
.class = I2C_ADAP_CLASS_SMBUS, .class = I2C_ADAP_CLASS_SMBUS,
.algo = &smbus_algorithm, .algo = &smbus_algorithm,
.name = "unset", .name = "unset",
...@@ -321,7 +320,7 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int reg, ...@@ -321,7 +320,7 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int reg,
smbus->adapter = nforce2_adapter; smbus->adapter = nforce2_adapter;
smbus->adapter.algo_data = smbus; smbus->adapter.algo_data = smbus;
smbus->adapter.dev.parent = &dev->dev; smbus->adapter.dev.parent = &dev->dev;
snprintf(smbus->adapter.name, DEVICE_NAME_SIZE, snprintf(smbus->adapter.name, I2C_NAME_SIZE,
"SMBus nForce2 adapter at %04x", smbus->base); "SMBus nForce2 adapter at %04x", smbus->base);
error = i2c_add_adapter(&smbus->adapter); error = i2c_add_adapter(&smbus->adapter);
......
...@@ -24,10 +24,8 @@ ...@@ -24,10 +24,8 @@
/* $Id: i2c-philips-par.c,v 1.29 2003/01/21 08:08:16 kmalkki Exp $ */ /* $Id: i2c-philips-par.c,v 1.29 2003/01/21 08:08:16 kmalkki Exp $ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/stddef.h>
#include <linux/parport.h> #include <linux/parport.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-algo-bit.h> #include <linux/i2c-algo-bit.h>
...@@ -45,11 +43,6 @@ struct i2c_par ...@@ -45,11 +43,6 @@ struct i2c_par
static struct i2c_par *adapter_list; static struct i2c_par *adapter_list;
/* ----- 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 */
/* ----- printer port defines ------------------------------------------*/ /* ----- printer port defines ------------------------------------------*/
/* Pin Port Inverted name */ /* Pin Port Inverted name */
#define I2C_ON 0x20 /* 12 status N paper */ #define I2C_ON 0x20 /* 12 status N paper */
...@@ -163,8 +156,9 @@ static void i2c_parport_attach (struct parport *port) ...@@ -163,8 +156,9 @@ static void i2c_parport_attach (struct parport *port)
printk(KERN_ERR "i2c-philips-par: Unable to malloc.\n"); printk(KERN_ERR "i2c-philips-par: Unable to malloc.\n");
return; return;
} }
memset (adapter, 0x00, sizeof(struct i2c_par));
printk(KERN_DEBUG "i2c-philips-par.o: attaching to %s\n", port->name); /* printk(KERN_DEBUG "i2c-philips-par.o: attaching to %s\n", port->name); */
adapter->pdev = parport_register_device(port, "i2c-philips-par", adapter->pdev = parport_register_device(port, "i2c-philips-par",
NULL, NULL, NULL, NULL, NULL, NULL,
...@@ -191,8 +185,7 @@ static void i2c_parport_attach (struct parport *port) ...@@ -191,8 +185,7 @@ static void i2c_parport_attach (struct parport *port)
bit_lp_setscl(port, 1); bit_lp_setscl(port, 1);
parport_release(adapter->pdev); parport_release(adapter->pdev);
if (i2c_bit_add_bus(&adapter->adapter) < 0) if (i2c_bit_add_bus(&adapter->adapter) < 0) {
{
printk(KERN_ERR "i2c-philips-par: Unable to register with I2C.\n"); printk(KERN_ERR "i2c-philips-par: Unable to register with I2C.\n");
parport_unregister_device(adapter->pdev); parport_unregister_device(adapter->pdev);
kfree(adapter); kfree(adapter);
...@@ -207,10 +200,8 @@ static void i2c_parport_detach (struct parport *port) ...@@ -207,10 +200,8 @@ static void i2c_parport_detach (struct parport *port)
{ {
struct i2c_par *adapter, *prev = NULL; struct i2c_par *adapter, *prev = NULL;
for (adapter = adapter_list; adapter; adapter = adapter->next) for (adapter = adapter_list; adapter; adapter = adapter->next) {
{ if (adapter->pdev->port == port) {
if (adapter->pdev->port == port)
{
parport_unregister_device(adapter->pdev); parport_unregister_device(adapter->pdev);
i2c_bit_del_bus(&adapter->adapter); i2c_bit_del_bus(&adapter->adapter);
if (prev) if (prev)
...@@ -224,21 +215,17 @@ static void i2c_parport_detach (struct parport *port) ...@@ -224,21 +215,17 @@ static void i2c_parport_detach (struct parport *port)
} }
} }
static struct parport_driver i2c_driver = { static struct parport_driver i2c_driver = {
"i2c-philips-par", .name = "i2c-philips-par",
i2c_parport_attach, .attach = i2c_parport_attach,
i2c_parport_detach, .detach = i2c_parport_detach,
NULL
}; };
int __init i2c_bitlp_init(void) int __init i2c_bitlp_init(void)
{ {
printk(KERN_INFO "i2c-philips-par.o: i2c Philips parallel port adapter module version %s (%s)\n", I2C_VERSION, I2C_DATE); printk(KERN_INFO "i2c Philips parallel port adapter driver\n");
parport_register_driver(&i2c_driver); return parport_register_driver(&i2c_driver);
return 0;
} }
void __exit i2c_bitlp_exit(void) void __exit i2c_bitlp_exit(void)
......
...@@ -395,7 +395,6 @@ static struct i2c_algorithm smbus_algorithm = { ...@@ -395,7 +395,6 @@ static struct i2c_algorithm smbus_algorithm = {
static struct i2c_adapter piix4_adapter = { static struct i2c_adapter piix4_adapter = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_PIIX4,
.class = I2C_ADAP_CLASS_SMBUS, .class = I2C_ADAP_CLASS_SMBUS,
.algo = &smbus_algorithm, .algo = &smbus_algorithm,
.name = "unset", .name = "unset",
...@@ -451,7 +450,7 @@ static int __devinit piix4_probe(struct pci_dev *dev, const struct pci_device_id ...@@ -451,7 +450,7 @@ static int __devinit piix4_probe(struct pci_dev *dev, const struct pci_device_id
/* set up the driverfs linkage to our parent device */ /* set up the driverfs linkage to our parent device */
piix4_adapter.dev.parent = &dev->dev; piix4_adapter.dev.parent = &dev->dev;
snprintf(piix4_adapter.name, DEVICE_NAME_SIZE, snprintf(piix4_adapter.name, I2C_NAME_SIZE,
"SMBus PIIX4 adapter at %04x", piix4_smba); "SMBus PIIX4 adapter at %04x", piix4_smba);
retval = i2c_add_adapter(&piix4_adapter); retval = i2c_add_adapter(&piix4_adapter);
......
...@@ -54,28 +54,20 @@ ...@@ -54,28 +54,20 @@
* (Additional documentation needed :( * (Additional documentation needed :(
*/ */
#include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-algo-bit.h> #include <linux/i2c-algo-bit.h>
#include <asm/io.h>
/* /*
* driver configuration * driver configuration
*/ */
#define DRIVER_ID "i2c-prosavage"
#define DRIVER_VERSION "20030621"
#define ADAPTER_NAME(x) (x).name
#define MAX_BUSSES 2 #define MAX_BUSSES 2
struct s_i2c_bus { struct s_i2c_bus {
u8 *mmvga; void *mmvga;
int i2c_reg; int i2c_reg;
int adap_ok; int adap_ok;
struct i2c_adapter adap; struct i2c_adapter adap;
...@@ -83,7 +75,7 @@ struct s_i2c_bus { ...@@ -83,7 +75,7 @@ struct s_i2c_bus {
}; };
struct s_i2c_chip { struct s_i2c_chip {
u8 *mmio; void *mmio;
struct s_i2c_bus i2c_bus[MAX_BUSSES]; struct s_i2c_bus i2c_bus[MAX_BUSSES];
}; };
...@@ -103,9 +95,6 @@ struct s_i2c_chip { ...@@ -103,9 +95,6 @@ struct s_i2c_chip {
/* /*
* S3/VIA 8365/8375 registers * S3/VIA 8365/8375 registers
*/ */
#ifndef PCI_VENDOR_ID_S3
#define PCI_VENDOR_ID_S3 0x5333
#endif
#ifndef PCI_DEVICE_ID_S3_SAVAGE4 #ifndef PCI_DEVICE_ID_S3_SAVAGE4
#define PCI_DEVICE_ID_S3_SAVAGE4 0x8a25 #define PCI_DEVICE_ID_S3_SAVAGE4 0x8a25
#endif #endif
...@@ -127,9 +116,9 @@ struct s_i2c_chip { ...@@ -127,9 +116,9 @@ struct s_i2c_chip {
#define I2C_SCL_IN 0x04 #define I2C_SCL_IN 0x04
#define I2C_SDA_IN 0x08 #define I2C_SDA_IN 0x08
#define SET_CR_IX(p, val) *((p)->mmvga + VGA_CR_IX) = (u8)(val) #define SET_CR_IX(p, val) writeb((val), (p)->mmvga + VGA_CR_IX)
#define SET_CR_DATA(p, val) *((p)->mmvga + VGA_CR_DATA) = (u8)(val) #define SET_CR_DATA(p, val) writeb((val), (p)->mmvga + VGA_CR_DATA)
#define GET_CR_DATA(p) *((p)->mmvga + VGA_CR_DATA) #define GET_CR_DATA(p) readb((p)->mmvga + VGA_CR_DATA)
/* /*
...@@ -191,12 +180,13 @@ static int bit_s3via_getsda(void *bus) ...@@ -191,12 +180,13 @@ static int bit_s3via_getsda(void *bus)
/* /*
* adapter initialisation * adapter initialisation
*/ */
static int i2c_register_bus(struct s_i2c_bus *p, u8 *mmvga, u32 i2c_reg) static int i2c_register_bus(struct pci_dev *dev, struct s_i2c_bus *p, u8 *mmvga, u32 i2c_reg)
{ {
int ret; int ret;
p->adap.owner = THIS_MODULE; p->adap.owner = THIS_MODULE;
p->adap.id = I2C_HW_B_S3VIA; p->adap.id = I2C_HW_B_S3VIA;
p->adap.algo_data = &p->algo; p->adap.algo_data = &p->algo;
p->adap.dev.parent = &dev->dev;
p->algo.setsda = bit_s3via_setsda; p->algo.setsda = bit_s3via_setsda;
p->algo.setscl = bit_s3via_setscl; p->algo.setscl = bit_s3via_setscl;
p->algo.getsda = bit_s3via_getsda; p->algo.getsda = bit_s3via_getsda;
...@@ -237,8 +227,8 @@ static void __devexit prosavage_remove(struct pci_dev *dev) ...@@ -237,8 +227,8 @@ static void __devexit prosavage_remove(struct pci_dev *dev)
ret = i2c_bit_del_bus(&chip->i2c_bus[i].adap); ret = i2c_bit_del_bus(&chip->i2c_bus[i].adap);
if (ret) { if (ret) {
printk(DRIVER_ID ": %s not removed\n", dev_err(&dev->dev, ": %s not removed\n",
ADAPTER_NAME(chip->i2c_bus[i].adap)); chip->i2c_bus[i].adap.name);
} }
} }
if (chip->mmio) { if (chip->mmio) {
...@@ -271,7 +261,7 @@ static int __devinit prosavage_probe(struct pci_dev *dev, const struct pci_devic ...@@ -271,7 +261,7 @@ static int __devinit prosavage_probe(struct pci_dev *dev, const struct pci_devic
chip->mmio = ioremap_nocache(base, len); chip->mmio = ioremap_nocache(base, len);
if (chip->mmio == NULL) { if (chip->mmio == NULL) {
printk (DRIVER_ID ": ioremap failed\n"); dev_err(&dev->dev, "ioremap failed\n");
prosavage_remove(dev); prosavage_remove(dev);
return -ENODEV; return -ENODEV;
} }
...@@ -287,10 +277,10 @@ static int __devinit prosavage_probe(struct pci_dev *dev, const struct pci_devic ...@@ -287,10 +277,10 @@ static int __devinit prosavage_probe(struct pci_dev *dev, const struct pci_devic
* i2c bus registration * i2c bus registration
*/ */
bus = &chip->i2c_bus[0]; bus = &chip->i2c_bus[0];
snprintf(ADAPTER_NAME(bus->adap), sizeof(ADAPTER_NAME(bus->adap)), snprintf(bus->adap.name, sizeof(bus->adap.name),
"ProSavage I2C bus at %02x:%02x.%x", "ProSavage I2C bus at %02x:%02x.%x",
dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
ret = i2c_register_bus(bus, chip->mmio + 0x8000, CR_SERIAL1); ret = i2c_register_bus(dev, bus, chip->mmio + 0x8000, CR_SERIAL1);
if (ret) { if (ret) {
goto err_adap; goto err_adap;
} }
...@@ -298,16 +288,16 @@ static int __devinit prosavage_probe(struct pci_dev *dev, const struct pci_devic ...@@ -298,16 +288,16 @@ static int __devinit prosavage_probe(struct pci_dev *dev, const struct pci_devic
* ddc bus registration * ddc bus registration
*/ */
bus = &chip->i2c_bus[1]; bus = &chip->i2c_bus[1];
snprintf(ADAPTER_NAME(bus->adap), sizeof(ADAPTER_NAME(bus->adap)), snprintf(bus->adap.name, sizeof(bus->adap.name),
"ProSavage DDC bus at %02x:%02x.%x", "ProSavage DDC bus at %02x:%02x.%x",
dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
ret = i2c_register_bus(bus, chip->mmio + 0x8000, CR_SERIAL2); ret = i2c_register_bus(dev, bus, chip->mmio + 0x8000, CR_SERIAL2);
if (ret) { if (ret) {
goto err_adap; goto err_adap;
} }
return 0; return 0;
err_adap: err_adap:
printk (DRIVER_ID ": %s failed\n", ADAPTER_NAME(bus->adap)); dev_err(&dev->dev, ": %s failed\n", bus->adap.name);
prosavage_remove(dev); prosavage_remove(dev);
return ret; return ret;
} }
...@@ -317,17 +307,9 @@ static int __devinit prosavage_probe(struct pci_dev *dev, const struct pci_devic ...@@ -317,17 +307,9 @@ static int __devinit prosavage_probe(struct pci_dev *dev, const struct pci_devic
* Data for PCI driver interface * Data for PCI driver interface
*/ */
static struct pci_device_id prosavage_pci_tbl[] = { static struct pci_device_id prosavage_pci_tbl[] = {
{ { PCI_DEVICE(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_SAVAGE4) },
.vendor = PCI_VENDOR_ID_S3, { PCI_DEVICE(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_PROSAVAGE8) },
.device = PCI_DEVICE_ID_S3_SAVAGE4, { 0, },
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
},{
.vendor = PCI_VENDOR_ID_S3,
.device = PCI_DEVICE_ID_S3_PROSAVAGE8,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
},{ 0, }
}; };
static struct pci_driver prosavage_driver = { static struct pci_driver prosavage_driver = {
...@@ -339,7 +321,6 @@ static struct pci_driver prosavage_driver = { ...@@ -339,7 +321,6 @@ static struct pci_driver prosavage_driver = {
static int __init i2c_prosavage_init(void) static int __init i2c_prosavage_init(void)
{ {
printk(DRIVER_ID " version %s (%s)\n", I2C_VERSION, DRIVER_VERSION);
return pci_module_init(&prosavage_driver); return pci_module_init(&prosavage_driver);
} }
......
/*
i2c-savage4.c - Part of lm_sensors, Linux kernel modules for hardware
monitoring
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>,
Philip Edelbrock <phil@netroedge.com>,
Ralph Metzler <rjkm@thp.uni-koeln.de>, and
Mark D. Studebaker <mdsxyz123@yahoo.com>
Based on code written by Ralph Metzler <rjkm@thp.uni-koeln.de> and
Simon Vogl
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 interfaces to the I2C bus of the Savage4 to gain access to
the BT869 and possibly other I2C devices. The DDC bus is not
yet supported because its register is not memory-mapped.
However we leave the DDC code here, commented out, to make
it easier to add later.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
/* 3DFX defines */
#define PCI_CHIP_SAVAGE3D 0x8A20
#define PCI_CHIP_SAVAGE3D_MV 0x8A21
#define PCI_CHIP_SAVAGE4 0x8A22
#define PCI_CHIP_SAVAGE2000 0x9102
#define PCI_CHIP_PROSAVAGE_PM 0x8A25
#define PCI_CHIP_PROSAVAGE_KM 0x8A26
#define PCI_CHIP_SAVAGE_MX_MV 0x8c10
#define PCI_CHIP_SAVAGE_MX 0x8c11
#define PCI_CHIP_SAVAGE_IX_MV 0x8c12
#define PCI_CHIP_SAVAGE_IX 0x8c13
#define REG 0xff20 /* Serial Port 1 Register */
/* bit locations in the register */
#define DDC_ENAB 0x00040000
#define DDC_SCL_OUT 0x00080000
#define DDC_SDA_OUT 0x00100000
#define DDC_SCL_IN 0x00200000
#define DDC_SDA_IN 0x00400000
#define I2C_ENAB 0x00000020
#define I2C_SCL_OUT 0x00000001
#define I2C_SDA_OUT 0x00000002
#define I2C_SCL_IN 0x00000008
#define I2C_SDA_IN 0x00000010
/* initialization states */
#define INIT2 0x20
#define INIT3 0x04
/* delays */
#define CYCLE_DELAY 10
#define TIMEOUT (HZ / 2)
static void *ioaddr;
/* The sav GPIO registers don't have individual masks for each bit
so we always have to read before writing. */
static void bit_savi2c_setscl(void *data, int val)
{
unsigned int r;
r = readl(ioaddr + REG);
if(val)
r |= I2C_SCL_OUT;
else
r &= ~I2C_SCL_OUT;
writel(r, ioaddr + REG);
readl(ioaddr + REG); /* flush posted write */
}
static void bit_savi2c_setsda(void *data, int val)
{
unsigned int r;
r = readl(ioaddr + REG);
if(val)
r |= I2C_SDA_OUT;
else
r &= ~I2C_SDA_OUT;
writel(r, ioaddr + REG);
readl(ioaddr + REG); /* flush posted write */
}
/* The GPIO pins are open drain, so the pins always remain outputs.
We rely on the i2c-algo-bit routines to set the pins high before
reading the input from other chips. */
static int bit_savi2c_getscl(void *data)
{
return (0 != (readl(ioaddr + REG) & I2C_SCL_IN));
}
static int bit_savi2c_getsda(void *data)
{
return (0 != (readl(ioaddr + REG) & I2C_SDA_IN));
}
/* Configures the chip */
static int config_s4(struct pci_dev *dev)
{
unsigned int cadr;
/* map memory */
cadr = dev->resource[0].start;
cadr &= PCI_BASE_ADDRESS_MEM_MASK;
ioaddr = ioremap_nocache(cadr, 0x0080000);
if (ioaddr) {
/* writel(0x8160, ioaddr + REG2); */
writel(0x00000020, ioaddr + REG);
dev_info(&dev->dev, "Using Savage4 at %p\n", ioaddr);
return 0;
}
return -ENODEV;
}
static struct i2c_algo_bit_data sav_i2c_bit_data = {
.setsda = bit_savi2c_setsda,
.setscl = bit_savi2c_setscl,
.getsda = bit_savi2c_getsda,
.getscl = bit_savi2c_getscl,
.udelay = CYCLE_DELAY,
.mdelay = CYCLE_DELAY,
.timeout = TIMEOUT
};
static struct i2c_adapter savage4_i2c_adapter = {
.owner = THIS_MODULE,
.name = "I2C Savage4 adapter",
.algo_data = &sav_i2c_bit_data,
};
static struct pci_device_id savage4_ids[] __devinitdata = {
{ PCI_DEVICE(PCI_VENDOR_ID_S3, PCI_CHIP_SAVAGE4) },
{ PCI_DEVICE(PCI_VENDOR_ID_S3, PCI_CHIP_SAVAGE2000) },
{ 0, }
};
static int __devinit savage4_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
int retval;
retval = config_s4(dev);
if (retval)
return retval;
/* set up the sysfs linkage to our parent device */
savage4_i2c_adapter.dev.parent = &dev->dev;
return i2c_bit_add_bus(&savage4_i2c_adapter);
}
static void __devexit savage4_remove(struct pci_dev *dev)
{
i2c_bit_del_bus(&savage4_i2c_adapter);
iounmap(ioaddr);
}
static struct pci_driver savage4_driver = {
.name = "savage4 smbus",
.id_table = savage4_ids,
.probe = savage4_probe,
.remove = __devexit_p(savage4_remove),
};
static int __init i2c_savage4_init(void)
{
return pci_module_init(&savage4_driver);
}
static void __exit i2c_savage4_exit(void)
{
pci_unregister_driver(&savage4_driver);
}
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, "
"Philip Edelbrock <phil@netroedge.com>, "
"Ralph Metzler <rjkm@thp.uni-koeln.de>, "
"and Mark D. Studebaker <mdsxyz123@yahoo.com>");
MODULE_DESCRIPTION("Savage4 I2C/SMBus driver");
MODULE_LICENSE("GPL");
module_init(i2c_savage4_init);
module_exit(i2c_savage4_exit);
This diff is collapsed.
This diff is collapsed.
...@@ -261,7 +261,6 @@ static struct i2c_algorithm smbus_algorithm = { ...@@ -261,7 +261,6 @@ static struct i2c_algorithm smbus_algorithm = {
static struct i2c_adapter sis96x_adapter = { static struct i2c_adapter sis96x_adapter = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_SIS96X,
.class = I2C_ADAP_CLASS_SMBUS, .class = I2C_ADAP_CLASS_SMBUS,
.algo = &smbus_algorithm, .algo = &smbus_algorithm,
.name = "unset", .name = "unset",
...@@ -318,7 +317,7 @@ static int __devinit sis96x_probe(struct pci_dev *dev, ...@@ -318,7 +317,7 @@ static int __devinit sis96x_probe(struct pci_dev *dev,
/* set up the driverfs linkage to our parent device */ /* set up the driverfs linkage to our parent device */
sis96x_adapter.dev.parent = &dev->dev; sis96x_adapter.dev.parent = &dev->dev;
snprintf(sis96x_adapter.name, DEVICE_NAME_SIZE, snprintf(sis96x_adapter.name, I2C_NAME_SIZE,
"SiS96x SMBus adapter at 0x%04x", sis96x_smbus_base); "SiS96x SMBus adapter at 0x%04x", sis96x_smbus_base);
if ((retval = i2c_add_adapter(&sis96x_adapter))) { if ((retval = i2c_add_adapter(&sis96x_adapter))) {
......
...@@ -114,7 +114,6 @@ static struct i2c_algo_bit_data bit_velle_data = { ...@@ -114,7 +114,6 @@ static struct i2c_algo_bit_data bit_velle_data = {
static struct i2c_adapter bit_velle_ops = { static struct i2c_adapter bit_velle_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.id = I2C_HW_B_VELLE,
.algo_data = &bit_velle_data, .algo_data = &bit_velle_data,
.name = "Velleman K8000", .name = "Velleman K8000",
}; };
......
/*
i2c-via.c - Part of lm_sensors, Linux kernel modules
for hardware monitoring
i2c Support for Via Technologies 82C586B South Bridge
Copyright (c) 1998, 1999 Kysti Mlkki <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.
*/
#define DEBUG
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
/* Power management registers */
#define PM_CFG_REVID 0x08 /* silicon revision code */
#define PM_CFG_IOBASE0 0x20
#define PM_CFG_IOBASE1 0x48
#define I2C_DIR (pm_io_base+0x40)
#define I2C_OUT (pm_io_base+0x42)
#define I2C_IN (pm_io_base+0x44)
#define I2C_SCL 0x02 /* clock bit in DIR/OUT/IN register */
#define I2C_SDA 0x04
/* io-region reservation */
#define IOSPACE 0x06
#define IOTEXT "via-i2c"
static u16 pm_io_base = 0;
/*
It does not appear from the datasheet that the GPIO pins are
open drain. So a we set a low value by setting the direction to
output and a high value by setting the direction to input and
relying on the required I2C pullup. The data value is initialized
to 0 in via_init() and never changed.
*/
static void bit_via_setscl(void *data, int state)
{
outb(state ? inb(I2C_DIR) & ~I2C_SCL : inb(I2C_DIR) | I2C_SCL, I2C_DIR);
}
static void bit_via_setsda(void *data, int state)
{
outb(state ? inb(I2C_DIR) & ~I2C_SDA : inb(I2C_DIR) | I2C_SDA, I2C_DIR);
}
static int bit_via_getscl(void *data)
{
return (0 != (inb(I2C_IN) & I2C_SCL));
}
static int bit_via_getsda(void *data)
{
return (0 != (inb(I2C_IN) & I2C_SDA));
}
static struct i2c_algo_bit_data bit_data = {
.setsda = bit_via_setsda,
.setscl = bit_via_setscl,
.getsda = bit_via_getsda,
.getscl = bit_via_getscl,
.udelay = 5,
.mdelay = 5,
.timeout = HZ
};
static struct i2c_adapter vt586b_adapter = {
.owner = THIS_MODULE,
.name = "VIA i2c",
.algo_data = &bit_data,
};
static struct pci_device_id vt586b_ids[] __devinitdata = {
{ PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3) },
{ 0, }
};
static int __devinit vt586b_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
u16 base;
u8 rev;
int res;
if (pm_io_base) {
dev_err(&dev->dev, "i2c-via: Will only support one host\n");
return -ENODEV;
}
pci_read_config_byte(dev, PM_CFG_REVID, &rev);
switch (rev) {
case 0x00:
base = PM_CFG_IOBASE0;
break;
case 0x01:
case 0x10:
base = PM_CFG_IOBASE1;
break;
default:
base = PM_CFG_IOBASE1;
/* later revision */
}
pci_read_config_word(dev, base, &pm_io_base);
pm_io_base &= (0xff << 8);
if (!request_region(I2C_DIR, IOSPACE, IOTEXT)) {
dev_err(&dev->dev, "IO 0x%x-0x%x already in use\n", I2C_DIR, I2C_DIR + IOSPACE);
return -ENODEV;
}
outb(inb(I2C_DIR) & ~(I2C_SDA | I2C_SCL), I2C_DIR);
outb(inb(I2C_OUT) & ~(I2C_SDA | I2C_SCL), I2C_OUT);
/* set up the driverfs linkage to our parent device */
vt586b_adapter.dev.parent = &dev->dev;
res = i2c_bit_add_bus(&vt586b_adapter);
if ( res < 0 ) {
release_region(I2C_DIR, IOSPACE);
pm_io_base = 0;
return res;
}
return 0;
}
static void __devexit vt586b_remove(struct pci_dev *dev)
{
i2c_bit_del_bus(&vt586b_adapter);
release_region(I2C_DIR, IOSPACE);
pm_io_base = 0;
}
static struct pci_driver vt586b_driver = {
.name = "vt586b smbus",
.id_table = vt586b_ids,
.probe = vt586b_probe,
.remove = __devexit_p(vt586b_remove),
};
static int __init i2c_vt586b_init(void)
{
printk(KERN_INFO "i2c-via version %s (%s)\n", I2C_VERSION, I2C_DATE);
return pci_module_init(&vt586b_driver);
}
static void __exit i2c_vt586b_exit(void)
{
pci_unregister_driver(&vt586b_driver);
}
MODULE_AUTHOR("Kysti Mlkki <kmalkki@cc.hut.fi>");
MODULE_DESCRIPTION("i2c for Via vt82c586b southbridge");
MODULE_LICENSE("GPL");
module_init(i2c_vt586b_init);
module_exit(i2c_vt586b_exit);
...@@ -287,7 +287,6 @@ static struct i2c_algorithm smbus_algorithm = { ...@@ -287,7 +287,6 @@ static struct i2c_algorithm smbus_algorithm = {
static struct i2c_adapter vt596_adapter = { static struct i2c_adapter vt596_adapter = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_VIA2,
.class = I2C_ADAP_CLASS_SMBUS, .class = I2C_ADAP_CLASS_SMBUS,
.algo = &smbus_algorithm, .algo = &smbus_algorithm,
.name = "unset", .name = "unset",
...@@ -376,7 +375,7 @@ static int __devinit vt596_probe(struct pci_dev *pdev, ...@@ -376,7 +375,7 @@ static int __devinit vt596_probe(struct pci_dev *pdev,
dev_dbg(&pdev->dev, "VT596_smba = 0x%X\n", vt596_smba); dev_dbg(&pdev->dev, "VT596_smba = 0x%X\n", vt596_smba);
vt596_adapter.dev.parent = &pdev->dev; vt596_adapter.dev.parent = &pdev->dev;
snprintf(vt596_adapter.name, DEVICE_NAME_SIZE, snprintf(vt596_adapter.name, I2C_NAME_SIZE,
"SMBus Via Pro adapter at %04x", vt596_smba); "SMBus Via Pro adapter at %04x", vt596_smba);
return i2c_add_adapter(&vt596_adapter); return i2c_add_adapter(&vt596_adapter);
......
/*
voodoo3.c - Part of lm_sensors, Linux kernel modules for hardware
monitoring
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>,
Philip Edelbrock <phil@netroedge.com>,
Ralph Metzler <rjkm@thp.uni-koeln.de>, and
Mark D. Studebaker <mdsxyz123@yahoo.com>
Based on code written by Ralph Metzler <rjkm@thp.uni-koeln.de> and
Simon Vogl
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 interfaces to the I2C bus of the Voodoo3 to gain access to
the BT869 and possibly other I2C devices. */
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
/* the only registers we use */
#define REG 0x78
#define REG2 0x70
/* bit locations in the register */
#define DDC_ENAB 0x00040000
#define DDC_SCL_OUT 0x00080000
#define DDC_SDA_OUT 0x00100000
#define DDC_SCL_IN 0x00200000
#define DDC_SDA_IN 0x00400000
#define I2C_ENAB 0x00800000
#define I2C_SCL_OUT 0x01000000
#define I2C_SDA_OUT 0x02000000
#define I2C_SCL_IN 0x04000000
#define I2C_SDA_IN 0x08000000
/* initialization states */
#define INIT2 0x2
#define INIT3 0x4
/* delays */
#define CYCLE_DELAY 10
#define TIMEOUT (HZ / 2)
static void *ioaddr;
/* The voo GPIO registers don't have individual masks for each bit
so we always have to read before writing. */
static void bit_vooi2c_setscl(void *data, int val)
{
unsigned int r;
r = readl(ioaddr + REG);
if (val)
r |= I2C_SCL_OUT;
else
r &= ~I2C_SCL_OUT;
writel(r, ioaddr + REG);
readl(ioaddr + REG); /* flush posted write */
}
static void bit_vooi2c_setsda(void *data, int val)
{
unsigned int r;
r = readl(ioaddr + REG);
if (val)
r |= I2C_SDA_OUT;
else
r &= ~I2C_SDA_OUT;
writel(r, ioaddr + REG);
readl(ioaddr + REG); /* flush posted write */
}
/* The GPIO pins are open drain, so the pins always remain outputs.
We rely on the i2c-algo-bit routines to set the pins high before
reading the input from other chips. */
static int bit_vooi2c_getscl(void *data)
{
return (0 != (readl(ioaddr + REG) & I2C_SCL_IN));
}
static int bit_vooi2c_getsda(void *data)
{
return (0 != (readl(ioaddr + REG) & I2C_SDA_IN));
}
static void bit_vooddc_setscl(void *data, int val)
{
unsigned int r;
r = readl(ioaddr + REG);
if (val)
r |= DDC_SCL_OUT;
else
r &= ~DDC_SCL_OUT;
writel(r, ioaddr + REG);
readl(ioaddr + REG); /* flush posted write */
}
static void bit_vooddc_setsda(void *data, int val)
{
unsigned int r;
r = readl(ioaddr + REG);
if (val)
r |= DDC_SDA_OUT;
else
r &= ~DDC_SDA_OUT;
writel(r, ioaddr + REG);
readl(ioaddr + REG); /* flush posted write */
}
static int bit_vooddc_getscl(void *data)
{
return (0 != (readl(ioaddr + REG) & DDC_SCL_IN));
}
static int bit_vooddc_getsda(void *data)
{
return (0 != (readl(ioaddr + REG) & DDC_SDA_IN));
}
static int config_v3(struct pci_dev *dev)
{
unsigned int cadr;
/* map Voodoo3 memory */
cadr = dev->resource[0].start;
cadr &= PCI_BASE_ADDRESS_MEM_MASK;
ioaddr = ioremap_nocache(cadr, 0x1000);
if (ioaddr) {
writel(0x8160, ioaddr + REG2);
writel(0xcffc0020, ioaddr + REG);
dev_info(&dev->dev, "Using Banshee/Voodoo3 I2C device at %p\n", ioaddr);
return 0;
}
return -ENODEV;
}
static struct i2c_algo_bit_data voo_i2c_bit_data = {
.setsda = bit_vooi2c_setsda,
.setscl = bit_vooi2c_setscl,
.getsda = bit_vooi2c_getsda,
.getscl = bit_vooi2c_getscl,
.udelay = CYCLE_DELAY,
.mdelay = CYCLE_DELAY,
.timeout = TIMEOUT
};
static struct i2c_adapter voodoo3_i2c_adapter = {
.owner = THIS_MODULE,
.name = "I2C Voodoo3/Banshee adapter",
.algo_data = &voo_i2c_bit_data,
};
static struct i2c_algo_bit_data voo_ddc_bit_data = {
.setsda = bit_vooddc_setsda,
.setscl = bit_vooddc_setscl,
.getsda = bit_vooddc_getsda,
.getscl = bit_vooddc_getscl,
.udelay = CYCLE_DELAY,
.mdelay = CYCLE_DELAY,
.timeout = TIMEOUT
};
static struct i2c_adapter voodoo3_ddc_adapter = {
.owner = THIS_MODULE,
.name = "DDC Voodoo3/Banshee adapter",
.algo_data = &voo_ddc_bit_data,
};
static struct pci_device_id voodoo3_ids[] __devinitdata = {
{ PCI_DEVICE(PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO3) },
{ PCI_DEVICE(PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_BANSHEE) },
{ 0, }
};
static int __devinit voodoo3_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
int retval;
retval = config_v3(dev);
if (retval)
return retval;
/* set up the sysfs linkage to our parent device */
voodoo3_i2c_adapter.dev.parent = &dev->dev;
voodoo3_ddc_adapter.dev.parent = &dev->dev;
retval = i2c_bit_add_bus(&voodoo3_i2c_adapter);
if (retval)
return retval;
retval = i2c_bit_add_bus(&voodoo3_ddc_adapter);
if (retval)
i2c_bit_del_bus(&voodoo3_i2c_adapter);
return retval;
}
static void __devexit voodoo3_remove(struct pci_dev *dev)
{
i2c_bit_del_bus(&voodoo3_i2c_adapter);
i2c_bit_del_bus(&voodoo3_ddc_adapter);
iounmap(ioaddr);
}
static struct pci_driver voodoo3_driver = {
.name = "voodoo3 smbus",
.id_table = voodoo3_ids,
.probe = voodoo3_probe,
.remove = __devexit_p(voodoo3_remove),
};
static int __init i2c_voodoo3_init(void)
{
return pci_module_init(&voodoo3_driver);
}
static void __exit i2c_voodoo3_exit(void)
{
pci_unregister_driver(&voodoo3_driver);
}
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, "
"Philip Edelbrock <phil@netroedge.com>, "
"Ralph Metzler <rjkm@thp.uni-koeln.de>, "
"and Mark D. Studebaker <mdsxyz123@yahoo.com>");
MODULE_DESCRIPTION("Voodoo3 I2C/SMBus driver");
MODULE_LICENSE("GPL");
module_init(i2c_voodoo3_init);
module_exit(i2c_voodoo3_exit);
...@@ -456,7 +456,7 @@ static int __init scx200_acb_create(int base, int index) ...@@ -456,7 +456,7 @@ static int __init scx200_acb_create(int base, int index)
memset(iface, 0, sizeof(*iface)); memset(iface, 0, sizeof(*iface));
adapter = &iface->adapter; adapter = &iface->adapter;
i2c_set_adapdata(adapter, iface); i2c_set_adapdata(adapter, iface);
snprintf(adapter->name, DEVICE_NAME_SIZE, "SCx200 ACB%d", index); snprintf(adapter->name, I2C_NAME_SIZE, "SCx200 ACB%d", index);
adapter->owner = THIS_MODULE; adapter->owner = THIS_MODULE;
adapter->id = I2C_ALGO_SMBUS; adapter->id = I2C_ALGO_SMBUS;
adapter->algo = &scx200_acb_algorithm; adapter->algo = &scx200_acb_algorithm;
......
...@@ -82,7 +82,6 @@ static struct i2c_algo_bit_data scx200_i2c_data = { ...@@ -82,7 +82,6 @@ static struct i2c_algo_bit_data scx200_i2c_data = {
static struct i2c_adapter scx200_i2c_ops = { static struct i2c_adapter scx200_i2c_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.id = I2C_HW_B_VELLE,
.algo_data = &scx200_i2c_data, .algo_data = &scx200_i2c_data,
.name = "NatSemi SCx200 I2C", .name = "NatSemi SCx200 I2C",
}; };
......
# #
# Sensor device configuration # I2C Sensor device configuration
# All depend on EXPERIMENTAL and I2C
# #
menu "I2C Hardware Sensors Chip support" menu "I2C Hardware Sensors Chip support"
config I2C_SENSOR
tristate
default n
config SENSORS_ADM1021 config SENSORS_ADM1021
tristate " Analog Devices ADM1021 and compatibles" tristate "Analog Devices ADM1021 and compatibles"
depends on I2C && EXPERIMENTAL depends on I2C && EXPERIMENTAL
select I2C_SENSOR
help help
If you say yes here you get support for Analog Devices ADM1021 If you say yes here you get support for Analog Devices ADM1021
and ADM1023 sensor chips and clones: Maxim MAX1617 and MAX1617A, and ADM1023 sensor chips and clones: Maxim MAX1617 and MAX1617A,
Genesys Logic GL523SM, National Semi LM84, TI THMC10, Genesys Logic GL523SM, National Semi LM84, TI THMC10,
and the XEON processor built-in sensor. This can also and the XEON processor built-in sensor.
be built as a module which can be inserted and removed while the
kernel is running.
The module will be called adm1021. This driver can also be built as a module. If so, the module
will be called adm1021.
You will also need the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
config SENSORS_IT87 config SENSORS_IT87
tristate " National Semiconductors IT87 and compatibles" tristate "National Semiconductors IT87 and compatibles"
depends on I2C && EXPERIMENTAL depends on I2C && EXPERIMENTAL
select I2C_SENSOR
help help
The module will be called it87. If you say yes here you get support for National Semiconductor IT87
sensor chips and clones: IT8705F, IT8712F and SiS960.
You will also need the latest user-space utilties: you can find them This driver can also be built as a module. If so, the module
in the lm_sensors package, which you can download at will be called it87.
http://www.lm-sensors.nu
config SENSORS_LM75 config SENSORS_LM75
tristate " National Semiconductors LM75 and compatibles" tristate "National Semiconductors LM75 and compatibles"
depends on I2C && EXPERIMENTAL depends on I2C && EXPERIMENTAL
select I2C_SENSOR
help help
If you say yes here you get support for National Semiconductor LM75 If you say yes here you get support for National Semiconductor LM75
sensor chips and clones: Dallas Semi DS75 and DS1775, TelCon sensor chips and clones: Dallas Semi DS75 and DS1775, TelCon
TCN75, and National Semi LM77. This can also be built as a module TCN75, and National Semi LM77.
which can be inserted and removed while the kernel is running.
The module will be called lm75.
You will also need the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
config SENSORS_LM85
tristate " National Semiconductors LM85 and compatibles"
depends on I2C && EXPERIMENTAL
help
If you say yes here you get support for National Semiconductor LM85
sensor chips and clones: ADT7463 and ADM1027.
This can also be built as a module which can be inserted and
removed while the kernel is running.
The module will be called lm85. This driver can also be built as a module. If so, the module
will be called lm75.
You will also need the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
config SENSORS_LM78 config SENSORS_LM78
tristate " National Semiconductors LM78 and compatibles" tristate "National Semiconductors LM78 and compatibles"
depends on I2C && EXPERIMENTAL depends on I2C && EXPERIMENTAL
select I2C_SENSOR
help help
If you say yes here you get support for National Semiconductor LM78, If you say yes here you get support for National Semiconductor LM78,
LM78-J and LM79. This can also be built as a module which can be LM78-J and LM79. This can also be built as a module which can be
inserted and removed while the kernel is running. inserted and removed while the kernel is running.
The module will be called lm78. This driver can also be built as a module. If so, the module
will be called lm78.
config SENSORS_LM85
tristate "National Semiconductors LM85 and compatibles"
depends on I2C && EXPERIMENTAL
select I2C_SENSOR
help
If you say yes here you get support for National Semiconductor LM85
sensor chips and clones: ADT7463 and ADM1027.
This driver can also be built as a module. If so, the module
will be called lm85.
You will also need the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
config SENSORS_VIA686A config SENSORS_VIA686A
tristate " VIA686A" tristate "VIA686A"
depends on I2C && EXPERIMENTAL depends on I2C && EXPERIMENTAL
select I2C_SENSOR
help help
support for via686a
If you say yes here you get support for the integrated sensors in If you say yes here you get support for the integrated sensors in
Via 686A/B South Bridges. This can also be built as a module Via 686A/B South Bridges.
which can be inserted and removed while the kernel is running.
You will also need the latest user-space utilties: you can find them This driver can also be built as a module. If so, the module
in the lm_sensors package, which you can download at will be called via686a.
http://www.lm-sensors.nu
config SENSORS_W83781D config SENSORS_W83781D
tristate " Winbond W83781D, W83782D, W83783S, W83627HF, Asus AS99127F" tristate "Winbond W83781D, W83782D, W83783S, W83627HF, Asus AS99127F"
depends on I2C && EXPERIMENTAL depends on I2C && EXPERIMENTAL
select I2C_SENSOR
help help
If you say yes here you get support for the Winbond W8378x series If you say yes here you get support for the Winbond W8378x series
of sensor chips: the W83781D, W83782D, W83783S and W83682HF, of sensor chips: the W83781D, W83782D, W83783S and W83682HF,
and the similar Asus AS99127F. This and the similar Asus AS99127F.
can also be built as a module which can be inserted and removed
while the kernel is running.
You will also need the latest user-space utilties: you can find them This driver can also be built as a module. If so, the module
in the lm_sensors package, which you can download at will be called w83781d.
http://www.lm-sensors.nu
config I2C_SENSOR
tristate
default y if SENSORS_ADM1021=y || SENSORS_IT87=y || SENSORS_LM75=y || SENSORS_VIA686A=y || SENSORS_W83781D=y || SENSORS_LM85=y
default m if SENSORS_ADM1021=m || SENSORS_IT87=m || SENSORS_LM75=m || SENSORS_VIA686A=m || SENSORS_W83781D=m || SENSORS_LM85=m
default n
endmenu endmenu
...@@ -225,7 +225,6 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -225,7 +225,6 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind)
struct adm1021_data *data; struct adm1021_data *data;
int err = 0; int err = 0;
const char *type_name = ""; const char *type_name = "";
const char *client_name = "";
/* Make sure we aren't probing the ISA bus!! This is just a safety check /* Make sure we aren't probing the ISA bus!! This is just a safety check
at this moment; i2c_detect really won't call us. */ at this moment; i2c_detect really won't call us. */
...@@ -291,28 +290,20 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -291,28 +290,20 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind)
if (kind == max1617) { if (kind == max1617) {
type_name = "max1617"; type_name = "max1617";
client_name = "MAX1617 chip";
} else if (kind == max1617a) { } else if (kind == max1617a) {
type_name = "max1617a"; type_name = "max1617a";
client_name = "MAX1617A chip";
} else if (kind == adm1021) { } else if (kind == adm1021) {
type_name = "adm1021"; type_name = "adm1021";
client_name = "ADM1021 chip";
} else if (kind == adm1023) { } else if (kind == adm1023) {
type_name = "adm1023"; type_name = "adm1023";
client_name = "ADM1023 chip";
} else if (kind == thmc10) { } else if (kind == thmc10) {
type_name = "thmc10"; type_name = "thmc10";
client_name = "THMC10 chip";
} else if (kind == lm84) { } else if (kind == lm84) {
type_name = "lm84"; type_name = "lm84";
client_name = "LM84 chip";
} else if (kind == gl523sm) { } else if (kind == gl523sm) {
type_name = "gl523sm"; type_name = "gl523sm";
client_name = "GL523SM chip";
} else if (kind == mc1066) { } else if (kind == mc1066) {
type_name = "mc1066"; type_name = "mc1066";
client_name = "MC1066 chip";
} else { } else {
dev_err(&adapter->dev, "Internal error: unknown kind (%d)?!?", dev_err(&adapter->dev, "Internal error: unknown kind (%d)?!?",
kind); kind);
...@@ -320,7 +311,7 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -320,7 +311,7 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind)
} }
/* Fill in the remaining client fields and put it into the global list */ /* Fill in the remaining client fields and put it into the global list */
strlcpy(new_client->name, client_name, DEVICE_NAME_SIZE); strlcpy(new_client->name, type_name, I2C_NAME_SIZE);
data->type = kind; data->type = kind;
new_client->id = adm1021_id++; new_client->id = adm1021_id++;
......
...@@ -592,7 +592,6 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -592,7 +592,6 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind)
struct it87_data *data; struct it87_data *data;
int err = 0; int err = 0;
const char *name = ""; const char *name = "";
const char *client_name = "";
int is_isa = i2c_is_isa_adapter(adapter); int is_isa = i2c_is_isa_adapter(adapter);
if (!is_isa && if (!is_isa &&
...@@ -681,10 +680,8 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -681,10 +680,8 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind)
if (kind == it87) { if (kind == it87) {
name = "it87"; name = "it87";
client_name = "IT87 chip";
} /* else if (kind == it8712) { } /* else if (kind == it8712) {
name = "it8712"; name = "it8712";
client_name = "IT87-J chip";
} */ else { } */ else {
dev_dbg(&adapter->dev, "Internal error: unknown kind (%d)?!?", dev_dbg(&adapter->dev, "Internal error: unknown kind (%d)?!?",
kind); kind);
...@@ -692,7 +689,7 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -692,7 +689,7 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind)
} }
/* Fill in the remaining client fields and put it into the global list */ /* Fill in the remaining client fields and put it into the global list */
strlcpy(new_client->name, name, DEVICE_NAME_SIZE); strlcpy(new_client->name, name, I2C_NAME_SIZE);
data->type = kind; data->type = kind;
......
...@@ -194,7 +194,7 @@ static int lm75_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -194,7 +194,7 @@ static int lm75_detect(struct i2c_adapter *adapter, int address, int kind)
} }
/* Fill in the remaining client fields and put it into the global list */ /* Fill in the remaining client fields and put it into the global list */
strlcpy(new_client->name, name, DEVICE_NAME_SIZE); strlcpy(new_client->name, name, I2C_NAME_SIZE);
new_client->id = lm75_id++; new_client->id = lm75_id++;
data->valid = 0; data->valid = 0;
......
...@@ -625,11 +625,11 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -625,11 +625,11 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
} }
if (kind == lm78) { if (kind == lm78) {
client_name = "LM78 chip"; client_name = "lm78";
} else if (kind == lm78j) { } else if (kind == lm78j) {
client_name = "LM78-J chip"; client_name = "lm78-j";
} else if (kind == lm79) { } else if (kind == lm79) {
client_name = "LM79 chip"; client_name = "lm79";
} else { } else {
dev_dbg(&adapter->dev, "Internal error: unknown kind (%d)?!?", dev_dbg(&adapter->dev, "Internal error: unknown kind (%d)?!?",
kind); kind);
...@@ -638,7 +638,7 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -638,7 +638,7 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
} }
/* Fill in the remaining client fields and put into the global list */ /* Fill in the remaining client fields and put into the global list */
strlcpy(new_client->name, client_name, DEVICE_NAME_SIZE); strlcpy(new_client->name, client_name, I2C_NAME_SIZE);
data->type = kind; data->type = kind;
data->valid = 0; data->valid = 0;
......
...@@ -853,24 +853,20 @@ int lm85_detect(struct i2c_adapter *adapter, int address, ...@@ -853,24 +853,20 @@ int lm85_detect(struct i2c_adapter *adapter, int address,
/* Fill in the chip specific driver values */ /* Fill in the chip specific driver values */
if ( kind == any_chip ) { if ( kind == any_chip ) {
type_name = "lm85"; type_name = "lm85";
strlcpy(new_client->name, "Generic LM85", DEVICE_NAME_SIZE);
} else if ( kind == lm85b ) { } else if ( kind == lm85b ) {
type_name = "lm85b"; type_name = "lm85b";
strlcpy(new_client->name, "National LM85-B", DEVICE_NAME_SIZE);
} else if ( kind == lm85c ) { } else if ( kind == lm85c ) {
type_name = "lm85c"; type_name = "lm85c";
strlcpy(new_client->name, "National LM85-C", DEVICE_NAME_SIZE);
} else if ( kind == adm1027 ) { } else if ( kind == adm1027 ) {
type_name = "adm1027"; type_name = "adm1027";
strlcpy(new_client->name, "Analog Devices ADM1027", DEVICE_NAME_SIZE);
} else if ( kind == adt7463 ) { } else if ( kind == adt7463 ) {
type_name = "adt7463"; type_name = "adt7463";
strlcpy(new_client->name, "Analog Devices ADT7463", DEVICE_NAME_SIZE);
} else { } else {
dev_dbg(&adapter->dev, "Internal error, invalid kind (%d)!", kind); dev_dbg(&adapter->dev, "Internal error, invalid kind (%d)!", kind);
err = -EFAULT ; err = -EFAULT ;
goto ERROR1; goto ERROR1;
} }
strlcpy(new_client->name, type_name, I2C_NAME_SIZE);
/* Fill in the remaining client fields */ /* Fill in the remaining client fields */
new_client->id = lm85_id++; new_client->id = lm85_id++;
......
...@@ -671,7 +671,7 @@ static int via686a_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -671,7 +671,7 @@ static int via686a_detect(struct i2c_adapter *adapter, int address, int kind)
struct i2c_client *new_client; struct i2c_client *new_client;
struct via686a_data *data; struct via686a_data *data;
int err = 0; int err = 0;
const char client_name[] = "via686a chip"; const char client_name[] = "via686a";
u16 val; u16 val;
/* Make sure we are probing the ISA bus!! */ /* Make sure we are probing the ISA bus!! */
...@@ -727,7 +727,7 @@ static int via686a_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -727,7 +727,7 @@ static int via686a_detect(struct i2c_adapter *adapter, int address, int kind)
new_client->dev.parent = &adapter->dev; new_client->dev.parent = &adapter->dev;
/* Fill in the remaining client fields and put into the global list */ /* Fill in the remaining client fields and put into the global list */
snprintf(new_client->name, DEVICE_NAME_SIZE, client_name); snprintf(new_client->name, I2C_NAME_SIZE, client_name);
data->valid = 0; data->valid = 0;
init_MUTEX(&data->update_lock); init_MUTEX(&data->update_lock);
......
...@@ -378,8 +378,8 @@ static ssize_t store_in_##reg (struct device *dev, const char *buf, size_t count ...@@ -378,8 +378,8 @@ static ssize_t store_in_##reg (struct device *dev, const char *buf, size_t count
struct w83781d_data *data = i2c_get_clientdata(client); \ struct w83781d_data *data = i2c_get_clientdata(client); \
u32 val; \ u32 val; \
\ \
val = simple_strtoul(buf, NULL, 10); \ val = simple_strtoul(buf, NULL, 10) / 10; \
data->in_##reg[nr] = (IN_TO_REG(val) / 10); \ data->in_##reg[nr] = IN_TO_REG(val); \
w83781d_write_value(client, W83781D_REG_IN_##REG(nr), data->in_##reg[nr]); \ w83781d_write_value(client, W83781D_REG_IN_##REG(nr), data->in_##reg[nr]); \
\ \
return count; \ return count; \
...@@ -1098,15 +1098,15 @@ w83781d_detect_subclients(struct i2c_adapter *adapter, int address, int kind, ...@@ -1098,15 +1098,15 @@ w83781d_detect_subclients(struct i2c_adapter *adapter, int address, int kind,
} }
if (kind == w83781d) if (kind == w83781d)
client_name = "W83781D subclient"; client_name = "w83781d subclient";
else if (kind == w83782d) else if (kind == w83782d)
client_name = "W83782D subclient"; client_name = "w83782d subclient";
else if (kind == w83783s) else if (kind == w83783s)
client_name = "W83783S subclient"; client_name = "w83783s subclient";
else if (kind == w83627hf) else if (kind == w83627hf)
client_name = "W83627HF subclient"; client_name = "w83627hf subclient";
else if (kind == as99127f) else if (kind == as99127f)
client_name = "AS99127F subclient"; client_name = "as99127f subclient";
else else
client_name = "unknown subclient?"; client_name = "unknown subclient?";
...@@ -1117,7 +1117,7 @@ w83781d_detect_subclients(struct i2c_adapter *adapter, int address, int kind, ...@@ -1117,7 +1117,7 @@ w83781d_detect_subclients(struct i2c_adapter *adapter, int address, int kind,
data->lm75[i]->driver = &w83781d_driver; data->lm75[i]->driver = &w83781d_driver;
data->lm75[i]->flags = 0; data->lm75[i]->flags = 0;
strlcpy(data->lm75[i]->name, client_name, strlcpy(data->lm75[i]->name, client_name,
DEVICE_NAME_SIZE); I2C_NAME_SIZE);
if ((err = i2c_attach_client(data->lm75[i]))) { if ((err = i2c_attach_client(data->lm75[i]))) {
dev_err(&new_client->dev, "Subclient %d " dev_err(&new_client->dev, "Subclient %d "
"registration at address 0x%x " "registration at address 0x%x "
...@@ -1304,20 +1304,20 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -1304,20 +1304,20 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind)
} }
if (kind == w83781d) { if (kind == w83781d) {
client_name = "W83781D chip"; client_name = "w83781d";
} else if (kind == w83782d) { } else if (kind == w83782d) {
client_name = "W83782D chip"; client_name = "w83782d";
} else if (kind == w83783s) { } else if (kind == w83783s) {
client_name = "W83783S chip"; client_name = "w83783s";
} else if (kind == w83627hf) { } else if (kind == w83627hf) {
if (val1 == 0x90) if (val1 == 0x90)
client_name = "W83627THF chip"; client_name = "w83627thf";
else else
client_name = "W83627HF chip"; client_name = "w83627hf";
} else if (kind == as99127f) { } else if (kind == as99127f) {
client_name = "AS99127F chip"; client_name = "as99127f";
} else if (kind == w83697hf) { } else if (kind == w83697hf) {
client_name = "W83697HF chip"; client_name = "w83697hf";
} else { } else {
dev_err(&new_client->dev, "Internal error: unknown " dev_err(&new_client->dev, "Internal error: unknown "
"kind (%d)?!?", kind); "kind (%d)?!?", kind);
...@@ -1326,7 +1326,7 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -1326,7 +1326,7 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind)
} }
/* Fill in the remaining client fields and put into the global list */ /* Fill in the remaining client fields and put into the global list */
strlcpy(new_client->name, client_name, DEVICE_NAME_SIZE); strlcpy(new_client->name, client_name, I2C_NAME_SIZE);
data->type = kind; data->type = kind;
data->valid = 0; data->valid = 0;
......
This diff is collapsed.
/* ------------------------------------------------------------------------- */
/* i2c-algo-ibm_ocp.h i2c driver algorithms for IBM PPC 405 IIC adapters */
/* ------------------------------------------------------------------------- */
/* Copyright (C) 1995-97 Simon G. Vogl
1998-99 Hans Berglund
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. */
/* ------------------------------------------------------------------------- */
/* With some changes from Kysti Mlkki <kmalkki@cc.hut.fi> and even
Frodo Looijaard <frodol@dds.nl> */
/* Modifications by MontaVista Software, August 2000
Changes made to support the IIC peripheral on the IBM PPC 405 */
#ifndef I2C_ALGO_IIC_H
#define I2C_ALGO_IIC_H 1
/* --- Defines for pcf-adapters --------------------------------------- */
#include <linux/i2c.h>
struct i2c_algo_iic_data {
struct iic_regs *data; /* private data for lolevel routines */
void (*setiic) (void *data, int ctl, int val);
int (*getiic) (void *data, int ctl);
int (*getown) (void *data);
int (*getclock) (void *data);
void (*waitforpin) (void *data);
/* local settings */
int udelay;
int mdelay;
int timeout;
};
#define I2C_IIC_ADAP_MAX 16
int i2c_ocp_add_bus(struct i2c_adapter *);
int i2c_ocp_del_bus(struct i2c_adapter *);
#endif /* I2C_ALGO_IIC_H */
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/version.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/ioport.h> #include <linux/ioport.h>
......
...@@ -581,8 +581,7 @@ int i2c_master_send(struct i2c_client *client,const char *buf ,int count) ...@@ -581,8 +581,7 @@ int i2c_master_send(struct i2c_client *client,const char *buf ,int count)
*/ */
return (ret == 1 )? count : ret; return (ret == 1 )? count : ret;
} else { } else {
printk(KERN_ERR "i2c-core.o: I2C adapter %04x: I2C level transfers not supported\n", dev_err(&client->adapter->dev, "I2C level transfers not supported\n");
client->adapter->id);
return -ENOSYS; return -ENOSYS;
} }
} }
...@@ -614,8 +613,7 @@ int i2c_master_recv(struct i2c_client *client, char *buf ,int count) ...@@ -614,8 +613,7 @@ int i2c_master_recv(struct i2c_client *client, char *buf ,int count)
*/ */
return (ret == 1 )? count : ret; return (ret == 1 )? count : ret;
} else { } else {
printk(KERN_DEBUG "i2c-core.o: I2C adapter %04x: I2C level transfers not supported\n", dev_err(&client->adapter->dev, "I2C level transfers not supported\n");
client->adapter->id);
return -ENOSYS; return -ENOSYS;
} }
} }
......
...@@ -50,8 +50,9 @@ int i2c_detect(struct i2c_adapter *adapter, ...@@ -50,8 +50,9 @@ int i2c_detect(struct i2c_adapter *adapter,
return -1; return -1;
for (addr = 0x00; addr <= (is_isa ? 0xffff : 0x7f); addr++) { for (addr = 0x00; addr <= (is_isa ? 0xffff : 0x7f); addr++) {
/* XXX: WTF is going on here??? */ void *region_used = request_region(addr, 1, "foo");
if ((is_isa && check_region(addr, 1)) || release_region(addr, 1);
if ((is_isa && (region_used == NULL)) ||
(!is_isa && i2c_check_addr(adapter, addr))) (!is_isa && i2c_check_addr(adapter, addr)))
continue; continue;
......
...@@ -1316,7 +1316,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -1316,7 +1316,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind)
#endif #endif
msp3400c_setvolume(c,msp->muted,msp->left,msp->right); msp3400c_setvolume(c,msp->muted,msp->left,msp->right);
snprintf(c->name, DEVICE_NAME_SIZE, "MSP34%02d%c-%c%d", snprintf(c->name, I2C_NAME_SIZE, "MSP34%02d%c-%c%d",
(msp->rev2>>8)&0xff, (msp->rev1&0xff)+'@', (msp->rev2>>8)&0xff, (msp->rev1&0xff)+'@',
((msp->rev1>>8)&0xff)+'@', msp->rev2&0x1f); ((msp->rev1>>8)&0xff)+'@', msp->rev2&0x1f);
......
...@@ -171,7 +171,7 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -171,7 +171,7 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind)
return -ENOMEM; return -ENOMEM;
} }
memset(t, 0, sizeof(*t)); memset(t, 0, sizeof(*t));
strlcpy(client->name, IF_NAME, DEVICE_NAME_SIZE); strlcpy(client->name, IF_NAME, I2C_NAME_SIZE);
init_MUTEX(&t->lock); init_MUTEX(&t->lock);
/* /*
......
...@@ -824,7 +824,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -824,7 +824,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
if (type < TUNERS) { if (type < TUNERS) {
t->type = type; t->type = type;
printk("tuner(bttv): type forced to %d (%s) [insmod]\n",t->type,tuners[t->type].name); printk("tuner(bttv): type forced to %d (%s) [insmod]\n",t->type,tuners[t->type].name);
strlcpy(client->name, tuners[t->type].name, DEVICE_NAME_SIZE); strlcpy(client->name, tuners[t->type].name, I2C_NAME_SIZE);
} }
i2c_attach_client(client); i2c_attach_client(client);
if (t->type == TUNER_MT2032) if (t->type == TUNER_MT2032)
...@@ -875,7 +875,7 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -875,7 +875,7 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
t->type = *iarg; t->type = *iarg;
printk("tuner: type set to %d (%s)\n", printk("tuner: type set to %d (%s)\n",
t->type,tuners[t->type].name); t->type,tuners[t->type].name);
strlcpy(client->name, tuners[t->type].name, DEVICE_NAME_SIZE); strlcpy(client->name, tuners[t->type].name, I2C_NAME_SIZE);
if (t->type == TUNER_MT2032) if (t->type == TUNER_MT2032)
mt2032_init(client); mt2032_init(client);
break; break;
......
...@@ -111,7 +111,7 @@ static int i2c_bus_reg(struct i2c_bit_adapter* b, struct matrox_fb_info* minfo, ...@@ -111,7 +111,7 @@ static int i2c_bus_reg(struct i2c_bit_adapter* b, struct matrox_fb_info* minfo,
b->mask.data = data; b->mask.data = data;
b->mask.clock = clock; b->mask.clock = clock;
b->adapter = matrox_i2c_adapter_template; b->adapter = matrox_i2c_adapter_template;
snprintf(b->adapter.name, DEVICE_NAME_SIZE, name, snprintf(b->adapter.name, I2C_NAME_SIZE, name,
minfo->fbcon.node); minfo->fbcon.node);
i2c_set_adapdata(&b->adapter, b); i2c_set_adapdata(&b->adapter, b);
b->adapter.algo_data = &b->bac; b->adapter.algo_data = &b->bac;
......
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
#define I2C_DRIVERID_STM41T00 52 /* real time clock */ #define I2C_DRIVERID_STM41T00 52 /* real time clock */
#define I2C_DRIVERID_UDA1342 53 /* UDA1342 audio codec */ #define I2C_DRIVERID_UDA1342 53 /* UDA1342 audio codec */
#define I2C_DRIVERID_ADV7170 54 /* video encoder */ #define I2C_DRIVERID_ADV7170 54 /* video encoder */
#define I2C_DRIVERID_RADEON 55 /* I2C bus on Radeon boards */
#define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */ #define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */
......
...@@ -146,6 +146,8 @@ struct i2c_driver { ...@@ -146,6 +146,8 @@ struct i2c_driver {
extern struct bus_type i2c_bus_type; extern struct bus_type i2c_bus_type;
#define I2C_NAME_SIZE 50
/* /*
* i2c_client identifies a single device (i.e. chip) that is connected to an * i2c_client identifies a single device (i.e. chip) that is connected to an
* i2c bus. The behaviour is defined by the routines of the driver. This * i2c bus. The behaviour is defined by the routines of the driver. This
...@@ -166,7 +168,7 @@ struct i2c_client { ...@@ -166,7 +168,7 @@ struct i2c_client {
/* to the client */ /* to the client */
struct device dev; /* the device structure */ struct device dev; /* the device structure */
struct list_head list; struct list_head list;
char name[DEVICE_NAME_SIZE]; char name[I2C_NAME_SIZE];
struct completion released; struct completion released;
}; };
#define to_i2c_client(d) container_of(d, struct i2c_client, dev) #define to_i2c_client(d) container_of(d, struct i2c_client, dev)
...@@ -253,7 +255,7 @@ struct i2c_adapter { ...@@ -253,7 +255,7 @@ struct i2c_adapter {
int nr; int nr;
struct list_head clients; struct list_head clients;
struct list_head list; struct list_head list;
char name[DEVICE_NAME_SIZE]; char name[I2C_NAME_SIZE];
struct completion dev_released; struct completion dev_released;
struct completion class_dev_released; struct completion class_dev_released;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment