From 223f4b75909baf050e95de4b7c88acaf9b423464 Mon Sep 17 00:00:00 2001 From: Michael Hunold Date: Wed, 5 May 2004 02:14:40 -0700 Subject: [PATCH] I2C: add .class to i2c drivers in the "[RFC|PATCH][2.6] Additional i2c adapter flags for i2c client isolation" thread, the i2c people have agreed that an ".class" field should be added to struct i2c_driver. Currently only drivers do checks for plausibility ("Is this an adapter I can attach to?"), but adapters don't have a chance to keep drivers away from their bus. If both drivers and adapters provide a .class entry, the i2c-core can easily compare them and let devices only probe on busses where they can really exist. Real world example: DVB i2c adapters cannot ensure that only known DVB i2c chipsets probe their busses. Most client drivers probe every bus they get their hands on. This will confuse some DVB i2c busses. With the new I2C_CLASS_ALL flag it will be possible that an adapter can request that really all drivers are probed on the adapter. On the other hand, drivers can make sure that they get the chance to probe on every i2c adapter out there (this is not encouraged, though) The attached patch does the first step: - add .class member to struct i2c_device - remove unused .flags member from struct i2c_adapter - rename I2C_ADAP_CLASS_xxx to I2C_CLASS_xxx (to be used both for drivers and adapters) - add new I2C_CLASS_ALL and I2C_CLASS_SOUND classes - follow these changes in the existing drivers with copy & paste --- include/linux/i2c.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'include/linux') diff --git a/include/linux/i2c.h b/include/linux/i2c.h index d1c69565d4dc..799a34331c83 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -113,6 +113,7 @@ struct i2c_driver { struct module *owner; char name[32]; int id; + unsigned int class; unsigned int flags; /* div., see below */ /* Notifies the driver that a new bus has appeared. This routine @@ -237,7 +238,6 @@ struct i2c_adapter { /* data fields that are valid for all devices */ struct semaphore bus_lock; struct semaphore clist_lock; - unsigned int flags;/* flags specifying div. data */ int timeout; int retries; @@ -286,12 +286,14 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) /* Must equal I2C_M_TEN below */ /* i2c adapter classes (bitmask) */ -#define I2C_ADAP_CLASS_SMBUS (1<<0) /* lm_sensors, ... */ -#define I2C_ADAP_CLASS_TV_ANALOG (1<<1) /* bttv + friends */ -#define I2C_ADAP_CLASS_TV_DIGITAL (1<<2) /* dbv cards */ -#define I2C_ADAP_CLASS_DDC (1<<3) /* i2c-matroxfb ? */ -#define I2C_ADAP_CLASS_CAM_ANALOG (1<<4) /* camera with analog CCD */ -#define I2C_ADAP_CLASS_CAM_DIGITAL (1<<5) /* most webcams */ +#define I2C_CLASS_SMBUS (1<<0) /* lm_sensors, ... */ +#define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */ +#define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */ +#define I2C_CLASS_DDC (1<<3) /* i2c-matroxfb ? */ +#define I2C_CLASS_CAM_ANALOG (1<<4) /* camera with analog CCD */ +#define I2C_CLASS_CAM_DIGITAL (1<<5) /* most webcams */ +#define I2C_CLASS_SOUND (1<<6) /* sound devices */ +#define I2C_CLASS_ALL (UINT_MAX) /* all of the above */ /* i2c_client_address_data is the struct for holding default client * addresses for a driver and for the parameters supplied on the -- cgit v1.2.3 From 2afffbde3c122786493087cf68b13d7ad9f522f8 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 10 May 2004 23:44:19 -0700 Subject: [PATCH] I2C: new i2c video decoder calls Attached patch adds three new calls to the i2c video decoder API. The changes were requested by Michael (CC'ed) and approved by Gerd Knorr (v4l maintainer, CC'ed). Short explanation: * INIT is a general initialization call with optional initialization data. Reason for this is that several i2c decoders (or general: clients) are being used by several adapters (main drivers), and in some cases, one adapter simply needs different settings than the other, either because the adapter is completely different or because the card was reverse engineered in a way that doesn't allow multiple adapters to run using the same original initialization data. Michael faces such a problem right now. Both he and me lack time to properly sit together and work out the exact details or a proper way to merge. * VBI_BYPASS and GPIO set specific pins on the decoder. This will be used in the saa7111 driver. My driver (zr36067, original user of the saa7111 driver) doesn't use any of this, but Michael's does. --- include/linux/video_decoder.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/linux') diff --git a/include/linux/video_decoder.h b/include/linux/video_decoder.h index 1302c7f44ec5..0e9e48b83e3b 100644 --- a/include/linux/video_decoder.h +++ b/include/linux/video_decoder.h @@ -22,6 +22,10 @@ DECODER_STATUS_GOOD, the others are just nice things to know. #define DECODER_STATUS_NTSC 8 /* auto detected */ #define DECODER_STATUS_SECAM 16 /* auto detected */ +struct video_decoder_init { + unsigned char len; + const unsigned char *data; +}; #define DECODER_GET_CAPABILITIES _IOR('d', 1, struct video_decoder_capability) #define DECODER_GET_STATUS _IOR('d', 2, int) @@ -30,6 +34,9 @@ DECODER_STATUS_GOOD, the others are just nice things to know. #define DECODER_SET_OUTPUT _IOW('d', 5, int) /* 0 <= output < #outputs */ #define DECODER_ENABLE_OUTPUT _IOW('d', 6, int) /* boolean output enable control */ #define DECODER_SET_PICTURE _IOW('d', 7, struct video_picture) +#define DECODER_SET_GPIO _IOW('d', 8, int) /* switch general purpose pin */ +#define DECODER_INIT _IOW('d', 9, struct video_decoder_init) /* init internal registers at once */ +#define DECODER_SET_VBI_BYPASS _IOW('d', 10, int) /* switch vbi bypass */ #define DECODER_DUMP _IO('d', 192) /* debug hook */ -- cgit v1.2.3 From 0c8a2f9d08b1b6def97cfa6cdf47ac6d8507c0a6 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 10 May 2004 23:46:12 -0700 Subject: [PATCH] I2C: Rename hardware monitoring I2C class Quoting myself: > Mmm, I once proposed that I2C_ADAP_CLASS_SMBUS would be better renamed > I2C_ADAP_CLASS_SENSORS (so I2C_CLASS_SENSORS now). What about that? I > think it would be great to embed that change into your patch, so that > the name changes only once. > > BTW, if HWMON is prefered to SENSORS, this is fine with me too, I > have no strong preference. Below is a patch that does that. I finally went for HWMON. Yes, it's big, but it's actually nothing more than s/I2C_CLASS_SMBUS/I2C_CLASS_HWMON/ (thanks perl -wip :)). --- Documentation/i2c/porting-clients | 4 ++-- drivers/i2c/busses/i2c-ali1535.c | 2 +- drivers/i2c/busses/i2c-ali1563.c | 2 +- drivers/i2c/busses/i2c-ali15x3.c | 2 +- drivers/i2c/busses/i2c-amd756.c | 2 +- drivers/i2c/busses/i2c-amd8111.c | 2 +- drivers/i2c/busses/i2c-i801.c | 2 +- drivers/i2c/busses/i2c-isa.c | 2 +- drivers/i2c/busses/i2c-nforce2.c | 2 +- drivers/i2c/busses/i2c-parport-light.c | 2 +- drivers/i2c/busses/i2c-parport.c | 2 +- drivers/i2c/busses/i2c-piix4.c | 2 +- drivers/i2c/busses/i2c-sis5595.c | 2 +- drivers/i2c/busses/i2c-sis630.c | 2 +- drivers/i2c/busses/i2c-sis96x.c | 2 +- drivers/i2c/busses/i2c-via.c | 2 +- drivers/i2c/busses/i2c-viapro.c | 2 +- drivers/i2c/chips/adm1021.c | 2 +- drivers/i2c/chips/asb100.c | 2 +- drivers/i2c/chips/fscher.c | 2 +- drivers/i2c/chips/gl518sm.c | 2 +- drivers/i2c/chips/it87.c | 2 +- drivers/i2c/chips/lm75.c | 2 +- drivers/i2c/chips/lm78.c | 2 +- drivers/i2c/chips/lm80.c | 2 +- drivers/i2c/chips/lm83.c | 2 +- drivers/i2c/chips/lm90.c | 2 +- drivers/i2c/chips/via686a.c | 2 +- drivers/i2c/chips/w83781d.c | 2 +- drivers/i2c/chips/w83l785ts.c | 2 +- include/linux/i2c.h | 2 +- 31 files changed, 32 insertions(+), 32 deletions(-) (limited to 'include/linux') diff --git a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients index 5ff3226e8e4b..18b9acef0def 100644 --- a/Documentation/i2c/porting-clients +++ b/Documentation/i2c/porting-clients @@ -62,9 +62,9 @@ Technical changes: patch to the Documentation/i2c/sysfs-interface file. * [Attach] For I2C drivers, the attach function should make sure - that the adapter's class has I2C_CLASS_SMBUS, using the + that the adapter's class has I2C_CLASS_HWMON, using the following construct: - if (!(adapter->class & I2C_CLASS_SMBUS)) + if (!(adapter->class & I2C_CLASS_HWMON)) return 0; ISA-only drivers of course don't need this. diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c index e07b6b4772ca..e7fce45bb061 100644 --- a/drivers/i2c/busses/i2c-ali1535.c +++ b/drivers/i2c/busses/i2c-ali1535.c @@ -480,7 +480,7 @@ static struct i2c_algorithm smbus_algorithm = { static struct i2c_adapter ali1535_adapter = { .owner = THIS_MODULE, - .class = I2C_CLASS_SMBUS, + .class = I2C_CLASS_HWMON, .algo = &smbus_algorithm, .name = "unset", }; diff --git a/drivers/i2c/busses/i2c-ali1563.c b/drivers/i2c/busses/i2c-ali1563.c index 65535ae1f561..9b55cbbf293e 100644 --- a/drivers/i2c/busses/i2c-ali1563.c +++ b/drivers/i2c/busses/i2c-ali1563.c @@ -357,7 +357,7 @@ static struct i2c_algorithm ali1563_algorithm = { static struct i2c_adapter ali1563_adapter = { .owner = THIS_MODULE, - .class = I2C_CLASS_SMBUS, + .class = I2C_CLASS_HWMON, .algo = &ali1563_algorithm, }; diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c index 9843b4c0a3b8..673baa5be9d6 100644 --- a/drivers/i2c/busses/i2c-ali15x3.c +++ b/drivers/i2c/busses/i2c-ali15x3.c @@ -470,7 +470,7 @@ static struct i2c_algorithm smbus_algorithm = { static struct i2c_adapter ali15x3_adapter = { .owner = THIS_MODULE, - .class = I2C_CLASS_SMBUS, + .class = I2C_CLASS_HWMON, .algo = &smbus_algorithm, .name = "unset", }; diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index 0d7c562eae33..2a273e472948 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c @@ -303,7 +303,7 @@ static struct i2c_algorithm smbus_algorithm = { static struct i2c_adapter amd756_adapter = { .owner = THIS_MODULE, - .class = I2C_CLASS_SMBUS, + .class = I2C_CLASS_HWMON, .algo = &smbus_algorithm, .name = "unset", }; diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c index 5d893620f22d..54704be10404 100644 --- a/drivers/i2c/busses/i2c-amd8111.c +++ b/drivers/i2c/busses/i2c-amd8111.c @@ -359,7 +359,7 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_ smbus->adapter.owner = THIS_MODULE; snprintf(smbus->adapter.name, I2C_NAME_SIZE, "SMBus2 AMD8111 adapter at %04x", smbus->base); - smbus->adapter.class = I2C_CLASS_SMBUS; + smbus->adapter.class = I2C_CLASS_HWMON; smbus->adapter.algo = &smbus_algorithm; smbus->adapter.algo_data = smbus; diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 939deaedd4f0..5abd992d5b81 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -539,7 +539,7 @@ static struct i2c_algorithm smbus_algorithm = { static struct i2c_adapter i801_adapter = { .owner = THIS_MODULE, - .class = I2C_CLASS_SMBUS, + .class = I2C_CLASS_HWMON, .algo = &smbus_algorithm, .name = "unset", }; diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c index e2069230757d..0f54a2a0afa5 100644 --- a/drivers/i2c/busses/i2c-isa.c +++ b/drivers/i2c/busses/i2c-isa.c @@ -43,7 +43,7 @@ static struct i2c_algorithm isa_algorithm = { /* There can only be one... */ static struct i2c_adapter isa_adapter = { .owner = THIS_MODULE, - .class = I2C_CLASS_SMBUS, + .class = I2C_CLASS_HWMON, .algo = &isa_algorithm, .name = "ISA main adapter", }; diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c index 6d511d3bedc2..774a7ef52d43 100644 --- a/drivers/i2c/busses/i2c-nforce2.c +++ b/drivers/i2c/busses/i2c-nforce2.c @@ -119,7 +119,7 @@ static struct i2c_algorithm smbus_algorithm = { static struct i2c_adapter nforce2_adapter = { .owner = THIS_MODULE, - .class = I2C_CLASS_SMBUS, + .class = I2C_CLASS_HWMON, .algo = &smbus_algorithm, .name = "unset", }; diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c index ffdaf66137df..6798954f0056 100644 --- a/drivers/i2c/busses/i2c-parport-light.c +++ b/drivers/i2c/busses/i2c-parport-light.c @@ -112,7 +112,7 @@ static struct i2c_algo_bit_data parport_algo_data = { static struct i2c_adapter parport_adapter = { .owner = THIS_MODULE, - .class = I2C_CLASS_SMBUS, + .class = I2C_CLASS_HWMON, .id = I2C_HW_B_LP, .algo_data = &parport_algo_data, .name = "Parallel port adapter (light)", diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c index cd2c28605700..e9560bab51c4 100644 --- a/drivers/i2c/busses/i2c-parport.c +++ b/drivers/i2c/busses/i2c-parport.c @@ -147,7 +147,7 @@ static struct i2c_algo_bit_data parport_algo_data = { static struct i2c_adapter parport_adapter = { .owner = THIS_MODULE, - .class = I2C_CLASS_SMBUS, + .class = I2C_CLASS_HWMON, .id = I2C_HW_B_LP, .name = "Parallel port adapter", }; diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 128c89bf232b..0beca9e9b23d 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c @@ -409,7 +409,7 @@ static struct i2c_algorithm smbus_algorithm = { static struct i2c_adapter piix4_adapter = { .owner = THIS_MODULE, - .class = I2C_CLASS_SMBUS, + .class = I2C_CLASS_HWMON, .algo = &smbus_algorithm, .name = "unset", }; diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c index 67516712e574..ec615af7be04 100644 --- a/drivers/i2c/busses/i2c-sis5595.c +++ b/drivers/i2c/busses/i2c-sis5595.c @@ -360,7 +360,7 @@ static struct i2c_algorithm smbus_algorithm = { static struct i2c_adapter sis5595_adapter = { .owner = THIS_MODULE, - .class = I2C_CLASS_SMBUS, + .class = I2C_CLASS_HWMON, .name = "unset", .algo = &smbus_algorithm, }; diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c index 7cb29e3e7b16..b7823c260364 100644 --- a/drivers/i2c/busses/i2c-sis630.c +++ b/drivers/i2c/busses/i2c-sis630.c @@ -456,7 +456,7 @@ static struct i2c_algorithm smbus_algorithm = { static struct i2c_adapter sis630_adapter = { .owner = THIS_MODULE, - .class = I2C_CLASS_SMBUS, + .class = I2C_CLASS_HWMON, .name = "unset", .algo = &smbus_algorithm, }; diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c index 74a2e9781e27..7c053abcea7a 100644 --- a/drivers/i2c/busses/i2c-sis96x.c +++ b/drivers/i2c/busses/i2c-sis96x.c @@ -260,7 +260,7 @@ static struct i2c_algorithm smbus_algorithm = { static struct i2c_adapter sis96x_adapter = { .owner = THIS_MODULE, - .class = I2C_CLASS_SMBUS, + .class = I2C_CLASS_HWMON, .algo = &smbus_algorithm, .name = "unset", }; diff --git a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c index 44f21c7691ff..fba8f0eae3a4 100644 --- a/drivers/i2c/busses/i2c-via.c +++ b/drivers/i2c/busses/i2c-via.c @@ -88,7 +88,7 @@ static struct i2c_algo_bit_data bit_data = { static struct i2c_adapter vt586b_adapter = { .owner = THIS_MODULE, - .class = I2C_CLASS_SMBUS, + .class = I2C_CLASS_HWMON, .name = "VIA i2c", .algo_data = &bit_data, }; diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c index 8cc248feff2e..fc207253d203 100644 --- a/drivers/i2c/busses/i2c-viapro.c +++ b/drivers/i2c/busses/i2c-viapro.c @@ -289,7 +289,7 @@ static struct i2c_algorithm smbus_algorithm = { static struct i2c_adapter vt596_adapter = { .owner = THIS_MODULE, - .class = I2C_CLASS_SMBUS, + .class = I2C_CLASS_HWMON, .algo = &smbus_algorithm, .name = "unset", }; diff --git a/drivers/i2c/chips/adm1021.c b/drivers/i2c/chips/adm1021.c index d656abdccaa1..73ca01db6e75 100644 --- a/drivers/i2c/chips/adm1021.c +++ b/drivers/i2c/chips/adm1021.c @@ -200,7 +200,7 @@ static DEVICE_ATTR(die_code, S_IRUGO, show_die_code, NULL); static int adm1021_attach_adapter(struct i2c_adapter *adapter) { - if (!(adapter->class & I2C_CLASS_SMBUS)) + if (!(adapter->class & I2C_CLASS_HWMON)) return 0; return i2c_detect(adapter, &addr_data, adm1021_detect); } diff --git a/drivers/i2c/chips/asb100.c b/drivers/i2c/chips/asb100.c index 0d904600136f..f93b6f67696e 100644 --- a/drivers/i2c/chips/asb100.c +++ b/drivers/i2c/chips/asb100.c @@ -609,7 +609,7 @@ static DEVICE_ATTR(fan1_pwm_enable, S_IRUGO | S_IWUSR, */ static int asb100_attach_adapter(struct i2c_adapter *adapter) { - if (!(adapter->class & I2C_CLASS_SMBUS)) + if (!(adapter->class & I2C_CLASS_HWMON)) return 0; return i2c_detect(adapter, &addr_data, asb100_detect); } diff --git a/drivers/i2c/chips/fscher.c b/drivers/i2c/chips/fscher.c index 41e2a8c27432..ab5b70f8624d 100644 --- a/drivers/i2c/chips/fscher.c +++ b/drivers/i2c/chips/fscher.c @@ -293,7 +293,7 @@ do { \ static int fscher_attach_adapter(struct i2c_adapter *adapter) { - if (!(adapter->class & I2C_CLASS_SMBUS)) + if (!(adapter->class & I2C_CLASS_HWMON)) return 0; return i2c_detect(adapter, &addr_data, fscher_detect); } diff --git a/drivers/i2c/chips/gl518sm.c b/drivers/i2c/chips/gl518sm.c index 5767df97fef0..3481ddbf0044 100644 --- a/drivers/i2c/chips/gl518sm.c +++ b/drivers/i2c/chips/gl518sm.c @@ -335,7 +335,7 @@ static DEVICE_ATTR(beep_mask, S_IWUSR|S_IRUGO, static int gl518_attach_adapter(struct i2c_adapter *adapter) { - if (!(adapter->class & I2C_CLASS_SMBUS)) + if (!(adapter->class & I2C_CLASS_HWMON)) return 0; return i2c_detect(adapter, &addr_data, gl518_detect); } diff --git a/drivers/i2c/chips/it87.c b/drivers/i2c/chips/it87.c index 6725cdf64cd7..c0d0e00ebda2 100644 --- a/drivers/i2c/chips/it87.c +++ b/drivers/i2c/chips/it87.c @@ -500,7 +500,7 @@ static DEVICE_ATTR(alarms, S_IRUGO | S_IWUSR, show_alarms, NULL); * when a new adapter is inserted (and it87_driver is still present) */ static int it87_attach_adapter(struct i2c_adapter *adapter) { - if (!(adapter->class & I2C_CLASS_SMBUS)) + if (!(adapter->class & I2C_CLASS_HWMON)) return 0; return i2c_detect(adapter, &addr_data, it87_detect); } diff --git a/drivers/i2c/chips/lm75.c b/drivers/i2c/chips/lm75.c index 0ca03e318fd8..e431db905e39 100644 --- a/drivers/i2c/chips/lm75.c +++ b/drivers/i2c/chips/lm75.c @@ -105,7 +105,7 @@ static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input, NULL); static int lm75_attach_adapter(struct i2c_adapter *adapter) { - if (!(adapter->class & I2C_CLASS_SMBUS)) + if (!(adapter->class & I2C_CLASS_HWMON)) return 0; return i2c_detect(adapter, &addr_data, lm75_detect); } diff --git a/drivers/i2c/chips/lm78.c b/drivers/i2c/chips/lm78.c index 093321fdd3de..74a1ca76cc04 100644 --- a/drivers/i2c/chips/lm78.c +++ b/drivers/i2c/chips/lm78.c @@ -488,7 +488,7 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); * when a new adapter is inserted (and lm78_driver is still present) */ static int lm78_attach_adapter(struct i2c_adapter *adapter) { - if (!(adapter->class & I2C_CLASS_SMBUS)) + if (!(adapter->class & I2C_CLASS_HWMON)) return 0; return i2c_detect(adapter, &addr_data, lm78_detect); } diff --git a/drivers/i2c/chips/lm80.c b/drivers/i2c/chips/lm80.c index b28055cc647d..fe78d98a61bf 100644 --- a/drivers/i2c/chips/lm80.c +++ b/drivers/i2c/chips/lm80.c @@ -376,7 +376,7 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); static int lm80_attach_adapter(struct i2c_adapter *adapter) { - if (!(adapter->class & I2C_CLASS_SMBUS)) + if (!(adapter->class & I2C_CLASS_HWMON)) return 0; return i2c_detect(adapter, &addr_data, lm80_detect); } diff --git a/drivers/i2c/chips/lm83.c b/drivers/i2c/chips/lm83.c index 195d5959de92..f6023e989dd5 100644 --- a/drivers/i2c/chips/lm83.c +++ b/drivers/i2c/chips/lm83.c @@ -216,7 +216,7 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); static int lm83_attach_adapter(struct i2c_adapter *adapter) { - if (!(adapter->class & I2C_CLASS_SMBUS)) + if (!(adapter->class & I2C_CLASS_HWMON)) return 0; return i2c_detect(adapter, &addr_data, lm83_detect); } diff --git a/drivers/i2c/chips/lm90.c b/drivers/i2c/chips/lm90.c index da4ce9fb1f33..f28b6679fe6d 100644 --- a/drivers/i2c/chips/lm90.c +++ b/drivers/i2c/chips/lm90.c @@ -274,7 +274,7 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); static int lm90_attach_adapter(struct i2c_adapter *adapter) { - if (!(adapter->class & I2C_CLASS_SMBUS)) + if (!(adapter->class & I2C_CLASS_HWMON)) return 0; return i2c_detect(adapter, &addr_data, lm90_detect); } diff --git a/drivers/i2c/chips/via686a.c b/drivers/i2c/chips/via686a.c index 6b8d138d7789..a5ec359b0f6f 100644 --- a/drivers/i2c/chips/via686a.c +++ b/drivers/i2c/chips/via686a.c @@ -573,7 +573,7 @@ static struct i2c_driver via686a_driver = { /* This is called when the module is loaded */ static int via686a_attach_adapter(struct i2c_adapter *adapter) { - if (!(adapter->class & I2C_CLASS_SMBUS)) + if (!(adapter->class & I2C_CLASS_HWMON)) return 0; return i2c_detect(adapter, &addr_data, via686a_detect); } diff --git a/drivers/i2c/chips/w83781d.c b/drivers/i2c/chips/w83781d.c index 0e0b1c08522a..ac378b54b1cd 100644 --- a/drivers/i2c/chips/w83781d.c +++ b/drivers/i2c/chips/w83781d.c @@ -911,7 +911,7 @@ device_create_file(&client->dev, &dev_attr_rt##offset); \ static int w83781d_attach_adapter(struct i2c_adapter *adapter) { - if (!(adapter->class & I2C_CLASS_SMBUS)) + if (!(adapter->class & I2C_CLASS_HWMON)) return 0; return i2c_detect(adapter, &addr_data, w83781d_detect); } diff --git a/drivers/i2c/chips/w83l785ts.c b/drivers/i2c/chips/w83l785ts.c index f0a559d991f6..bb7abd315c72 100644 --- a/drivers/i2c/chips/w83l785ts.c +++ b/drivers/i2c/chips/w83l785ts.c @@ -145,7 +145,7 @@ static DEVICE_ATTR(temp1_max, S_IRUGO, show_temp_over, NULL) static int w83l785ts_attach_adapter(struct i2c_adapter *adapter) { - if (!(adapter->class & I2C_CLASS_SMBUS)) + if (!(adapter->class & I2C_CLASS_HWMON)) return 0; return i2c_detect(adapter, &addr_data, w83l785ts_detect); } diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 799a34331c83..969044dd3f7f 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -286,7 +286,7 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) /* Must equal I2C_M_TEN below */ /* i2c adapter classes (bitmask) */ -#define I2C_CLASS_SMBUS (1<<0) /* lm_sensors, ... */ +#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ #define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */ #define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */ #define I2C_CLASS_DDC (1<<3) /* i2c-matroxfb ? */ -- cgit v1.2.3 From 5fc5be30cceb0b0c2c190754813a5aaa611f7d11 Mon Sep 17 00:00:00 2001 From: "Jason D. Gaston" Date: Fri, 14 May 2004 00:58:42 -0700 Subject: [PATCH] I2C: ICH6/6300ESB i2c support This patch adds DID support for ICH6 and 6300ESB to i2c-i801.c(SMBus). In order to add this support I needed to patch pci_ids.h with the SMBus DID's. To keep things orginized I renumbered the ICH6 and ESB entries in pci_ids.h. I then patched the piix IDE and i810 audio drivers to reflect the updated #define's. I also removed an error from irq.c; there was a reference to a 6300ESB DID that does not exist. --- arch/i386/pci/irq.c | 3 ++- drivers/i2c/busses/Kconfig | 2 ++ drivers/i2c/busses/i2c-i801.c | 26 ++++++++++++++++++++------ drivers/ide/pci/piix.c | 8 ++++---- drivers/ide/pci/piix.h | 2 +- include/linux/pci_ids.h | 21 ++++++++++++++++++--- sound/oss/i810_audio.c | 10 +++++----- 7 files changed, 52 insertions(+), 20 deletions(-) (limited to 'include/linux') diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c index cfd60cd58b75..1207d3b60294 100644 --- a/arch/i386/pci/irq.c +++ b/arch/i386/pci/irq.c @@ -479,8 +479,9 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route case PCI_DEVICE_ID_INTEL_82801DB_0: case PCI_DEVICE_ID_INTEL_82801E_0: case PCI_DEVICE_ID_INTEL_82801EB_0: - case PCI_DEVICE_ID_INTEL_ESB_0: + case PCI_DEVICE_ID_INTEL_ESB_1: case PCI_DEVICE_ID_INTEL_ICH6_0: + case PCI_DEVICE_ID_INTEL_ICH6_1: r->name = "PIIX/ICH"; r->get = pirq_piix_get; r->set = pirq_piix_set; diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index ad188dc0b667..c6a9ba477eb5 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -95,6 +95,8 @@ config I2C_I801 82801CA/CAM 82801DB 82801EB + 6300ESB + ICH6 This driver can also be built as a module. If so, the module will be called i2c-i801. diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 5abd992d5b81..22c71d7939ab 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -28,7 +28,8 @@ 82801CA/CAM 2483 82801DB 24C3 (HW PEC supported, 32 byte buffer not supported) 82801EB 24D3 (HW PEC supported, 32 byte buffer not supported) - + 6300ESB 25A4 + ICH6 266A This driver supports several versions of Intel's I/O Controller Hubs (ICH). For SMBus support, they are similar to the PIIX4 and are part of Intel's '810' and other chipsets. @@ -121,7 +122,8 @@ static int i801_setup(struct pci_dev *dev) I801_dev = dev; if ((dev->device == PCI_DEVICE_ID_INTEL_82801DB_3) || - (dev->device == PCI_DEVICE_ID_INTEL_82801EB_3)) + (dev->device == PCI_DEVICE_ID_INTEL_82801EB_3) || + (dev->device == PCI_DEVICE_ID_INTEL_ESB_4)) isich4 = 1; else isich4 = 0; @@ -576,10 +578,22 @@ static struct pci_device_id i801_ids[] = { .subdevice = PCI_ANY_ID, }, { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_82801EB_3, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, + .vendor = PCI_VENDOR_ID_INTEL, + .device = PCI_DEVICE_ID_INTEL_82801EB_3, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + }, + { + .vendor = PCI_VENDOR_ID_INTEL, + .device = PCI_DEVICE_ID_INTEL_ESB_4, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + }, + { + .vendor = PCI_VENDOR_ID_INTEL, + .device = PCI_DEVICE_ID_INTEL_ICH6_16, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, }, { 0, } }; diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index 1126ed9070b4..c7d68784d733 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c @@ -153,7 +153,7 @@ static int piix_get_info (char *buffer, char **addr, off_t offset, int count) case PCI_DEVICE_ID_INTEL_82801EB_11: case PCI_DEVICE_ID_INTEL_82801E_11: case PCI_DEVICE_ID_INTEL_ESB_2: - case PCI_DEVICE_ID_INTEL_ICH6_2: + case PCI_DEVICE_ID_INTEL_ICH6_19: p += sprintf(p, "PIIX4 Ultra 100 "); break; case PCI_DEVICE_ID_INTEL_82372FB_1: @@ -292,7 +292,7 @@ static u8 piix_ratemask (ide_drive_t *drive) case PCI_DEVICE_ID_INTEL_82801DB_11: case PCI_DEVICE_ID_INTEL_82801EB_11: case PCI_DEVICE_ID_INTEL_ESB_2: - case PCI_DEVICE_ID_INTEL_ICH6_2: + case PCI_DEVICE_ID_INTEL_ICH6_19: mode = 3; break; /* UDMA 66 capable */ @@ -627,7 +627,7 @@ static unsigned int __devinit init_chipset_piix (struct pci_dev *dev, const char case PCI_DEVICE_ID_INTEL_82801EB_11: case PCI_DEVICE_ID_INTEL_82801E_11: case PCI_DEVICE_ID_INTEL_ESB_2: - case PCI_DEVICE_ID_INTEL_ICH6_2: + case PCI_DEVICE_ID_INTEL_ICH6_19: { unsigned int extra = 0; pci_read_config_dword(dev, 0x54, &extra); @@ -804,7 +804,7 @@ static struct pci_device_id piix_pci_tbl[] = { { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 18}, #endif /* !CONFIG_SCSI_SATA */ { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 19}, - { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20}, + { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_19, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20}, { 0, }, }; MODULE_DEVICE_TABLE(pci, piix_pci_tbl); diff --git a/drivers/ide/pci/piix.h b/drivers/ide/pci/piix.h index bdf164a3120b..2cce7c080988 100644 --- a/drivers/ide/pci/piix.h +++ b/drivers/ide/pci/piix.h @@ -70,7 +70,7 @@ static ide_pci_device_t piix_pci_info[] __devinitdata = { /* 17 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801DB_10, "ICH4"), /* 18 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801EB_1, "ICH5-SATA"), /* 19 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_ESB_2, "ICH5"), - /* 20 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_ICH6_2, "ICH6"), + /* 20 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_ICH6_19, "ICH6"), { .vendor = 0, .device = 0, diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 8e3bbbe83f10..574fabfbc3e4 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -2058,7 +2058,6 @@ #define PCI_DEVICE_ID_INTEL_82801EB_7 0x24d7 #define PCI_DEVICE_ID_INTEL_82801EB_11 0x24db #define PCI_DEVICE_ID_INTEL_82801EB_13 0x24dd -#define PCI_DEVICE_ID_INTEL_ESB_0 0x25a0 #define PCI_DEVICE_ID_INTEL_ESB_1 0x25a1 #define PCI_DEVICE_ID_INTEL_ESB_2 0x25a2 #define PCI_DEVICE_ID_INTEL_ESB_3 0x25a3 @@ -2084,8 +2083,24 @@ #define PCI_DEVICE_ID_INTEL_82875_IG 0x257b #define PCI_DEVICE_ID_INTEL_ICH6_0 0x2640 #define PCI_DEVICE_ID_INTEL_ICH6_1 0x2641 -#define PCI_DEVICE_ID_INTEL_ICH6_2 0x266f -#define PCI_DEVICE_ID_INTEL_ICH6_3 0x266e +#define PCI_DEVICE_ID_INTEL_ICH6_2 0x2642 +#define PCI_DEVICE_ID_INTEL_ICH6_3 0x2651 +#define PCI_DEVICE_ID_INTEL_ICH6_4 0x2652 +#define PCI_DEVICE_ID_INTEL_ICH6_5 0x2653 +#define PCI_DEVICE_ID_INTEL_ICH6_6 0x2658 +#define PCI_DEVICE_ID_INTEL_ICH6_7 0x2659 +#define PCI_DEVICE_ID_INTEL_ICH6_8 0x265a +#define PCI_DEVICE_ID_INTEL_ICH6_9 0x265b +#define PCI_DEVICE_ID_INTEL_ICH6_10 0x265c +#define PCI_DEVICE_ID_INTEL_ICH6_11 0x2660 +#define PCI_DEVICE_ID_INTEL_ICH6_12 0x2662 +#define PCI_DEVICE_ID_INTEL_ICH6_13 0x2664 +#define PCI_DEVICE_ID_INTEL_ICH6_14 0x2666 +#define PCI_DEVICE_ID_INTEL_ICH6_15 0x2668 +#define PCI_DEVICE_ID_INTEL_ICH6_16 0x266a +#define PCI_DEVICE_ID_INTEL_ICH6_17 0x266d +#define PCI_DEVICE_ID_INTEL_ICH6_18 0x266e +#define PCI_DEVICE_ID_INTEL_ICH6_19 0x266f #define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 #define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 #define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 diff --git a/sound/oss/i810_audio.c b/sound/oss/i810_audio.c index cb693b05c095..e88c54c840ac 100644 --- a/sound/oss/i810_audio.c +++ b/sound/oss/i810_audio.c @@ -120,8 +120,8 @@ #ifndef PCI_DEVICE_ID_INTEL_ICH5 #define PCI_DEVICE_ID_INTEL_ICH5 0x24d5 #endif -#ifndef PCI_DEVICE_ID_INTEL_ICH6_3 -#define PCI_DEVICE_ID_INTEL_ICH6_3 0x266e +#ifndef PCI_DEVICE_ID_INTEL_ICH6_18 +#define PCI_DEVICE_ID_INTEL_ICH6_18 0x266e #endif #ifndef PCI_DEVICE_ID_INTEL_440MX #define PCI_DEVICE_ID_INTEL_440MX 0x7195 @@ -351,7 +351,7 @@ static struct pci_device_id i810_pci_tbl [] = { PCI_ANY_ID, PCI_ANY_ID, 0, 0, AMD8111}, {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4}, - {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_3, + {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_18, PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4}, {0,} @@ -2797,7 +2797,7 @@ static int i810_ac97_power_up_bus(struct i810_card *card) /* see i810_ac97_init for the next 7 lines (jsaw) */ inw(card->ac97base); if ((card->pci_id == PCI_DEVICE_ID_INTEL_ICH4 || card->pci_id == PCI_DEVICE_ID_INTEL_ICH5 || - card->pci_id == PCI_DEVICE_ID_INTEL_ESB_5 || card->pci_id == PCI_DEVICE_ID_INTEL_ICH6_3) + card->pci_id == PCI_DEVICE_ID_INTEL_ESB_5 || card->pci_id == PCI_DEVICE_ID_INTEL_ICH6_18) && (card->use_mmio)) { primary_codec_id = (int) readl(card->iobase_mmio + SDM) & 0x3; printk(KERN_INFO "i810_audio: Primary codec has ID %d\n", @@ -2868,7 +2868,7 @@ static int __devinit i810_ac97_init(struct i810_card *card) last codec ID spoken to. */ if ((card->pci_id == PCI_DEVICE_ID_INTEL_ICH4 || card->pci_id == PCI_DEVICE_ID_INTEL_ICH5 || - card->pci_id == PCI_DEVICE_ID_INTEL_ESB_5 || card->pci_id == PCI_DEVICE_ID_INTEL_ICH6_3) + card->pci_id == PCI_DEVICE_ID_INTEL_ESB_5 || card->pci_id == PCI_DEVICE_ID_INTEL_ICH6_18) && (card->use_mmio)) { ac97_id = (int) readl(card->iobase_mmio + SDM) & 0x3; printk(KERN_INFO "i810_audio: Connection %d with codec id %d\n", -- cgit v1.2.3 From 558fcd724e9016b1af08d796f7e762b7dcc6117a Mon Sep 17 00:00:00 2001 From: Deepak Saxena Date: Fri, 14 May 2004 01:00:02 -0700 Subject: [PATCH] I2C: Missed ixp42x -> ixp4xx conversion Forgot to include this with my original patch a few weeks ago... --- include/linux/i2c-id.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/linux') diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index e988edbcb5b8..591e7ad68d30 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h @@ -222,7 +222,7 @@ #define I2C_HW_B_OMAHA 0x14 /* Omaha I2C interface (ARM) */ #define I2C_HW_B_GUIDE 0x15 /* Guide bit-basher */ #define I2C_HW_B_IXP2000 0x16 /* GPIO on IXP2000 systems */ -#define I2C_HW_B_IXP425 0x17 /* GPIO on IXP425 systems */ +#define I2C_HW_B_IXP4XX 0x17 /* GPIO on IXP4XX systems */ #define I2C_HW_B_S3VIA 0x18 /* S3Via ProSavage adapter */ #define I2C_HW_B_ZR36067 0x19 /* Zoran-36057/36067 based boards */ -- cgit v1.2.3