Skip to content

Commit 37d8cb5

Browse files
committed
Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: i2c-parport: Various cleanups i2c-i801: Don't depend on other kernel driver config options i2c-i801: Check for vendor Fujitsu before probing for apanel i2c-i801: Don't probe for slaves on IDF channels i2c-i801: SMBus patch for Intel Panther Point DeviceIDs i2c/writing-clients: Fix foo_driver.id_table
2 parents dc522ad + 07da037 commit 37d8cb5

7 files changed

Lines changed: 97 additions & 83 deletions

File tree

‎Documentation/i2c/busses/i2c-i801‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Supported adapters:
1919
* Intel 6 Series (PCH)
2020
* Intel Patsburg (PCH)
2121
* Intel DH89xxCC (PCH)
22+
* Intel Panther Point (PCH)
2223
Datasheets: Publicly available at the Intel website
2324

2425
On Intel Patsburg and later chipsets, both the normal host SMBus controller

‎Documentation/i2c/writing-clients‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static struct i2c_driver foo_driver = {
3838
.name = "foo",
3939
},
4040

41-
.id_table = foo_ids,
41+
.id_table = foo_idtable,
4242
.probe = foo_probe,
4343
.remove = foo_remove,
4444
/* if device autodetection is needed: */

‎drivers/i2c/busses/Kconfig‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ config I2C_AMD8111
7979
config I2C_I801
8080
tristate "Intel 82801 (ICH/PCH)"
8181
depends on PCI
82+
select CHECK_SIGNATURE if X86 && DMI
8283
help
8384
If you say yes to this option, support will be included for the Intel
8485
801 family of mainboard I2C interfaces. Specifically, the following
@@ -101,6 +102,7 @@ config I2C_I801
101102
6 Series (PCH)
102103
Patsburg (PCH)
103104
DH89xxCC (PCH)
105+
Panther Point (PCH)
104106

105107
This driver can also be built as a module. If so, the module
106108
will be called i2c-i801.

‎drivers/i2c/busses/i2c-i801.c‎

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
Patsburg (PCH) IDF 0x1d71 32 hard yes yes yes
5151
Patsburg (PCH) IDF 0x1d72 32 hard yes yes yes
5252
DH89xxCC (PCH) 0x2330 32 hard yes yes yes
53+
Panther Point (PCH) 0x1e22 32 hard yes yes yes
5354
5455
Features supported by this driver:
5556
Software PEC no
@@ -137,11 +138,11 @@
137138
/* Older devices have their ID defined in <linux/pci_ids.h> */
138139
#define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22
139140
#define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22
140-
#define PCI_DEVICE_ID_INTEL_PANTHERPOINT_SMBUS 0x1e22
141141
/* Patsburg also has three 'Integrated Device Function' SMBus controllers */
142142
#define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF0 0x1d70
143143
#define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF1 0x1d71
144144
#define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF2 0x1d72
145+
#define PCI_DEVICE_ID_INTEL_PANTHERPOINT_SMBUS 0x1e22
145146
#define PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS 0x2330
146147
#define PCI_DEVICE_ID_INTEL_5_3400_SERIES_SMBUS 0x3b30
147148

@@ -159,6 +160,8 @@ static struct pci_driver i801_driver;
159160
#define FEATURE_BLOCK_BUFFER (1 << 1)
160161
#define FEATURE_BLOCK_PROC (1 << 2)
161162
#define FEATURE_I2C_BLOCK_READ (1 << 3)
163+
/* Not really a feature, but it's convenient to handle it as such */
164+
#define FEATURE_IDF (1 << 15)
162165

163166
static const char *i801_feature_names[] = {
164167
"SMBus PEC",
@@ -629,12 +632,13 @@ static const struct pci_device_id i801_ids[] = {
629632
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF1) },
630633
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF2) },
631634
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS) },
635+
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PANTHERPOINT_SMBUS) },
632636
{ 0, }
633637
};
634638

635639
MODULE_DEVICE_TABLE(pci, i801_ids);
636640

637-
#if defined CONFIG_INPUT_APANEL || defined CONFIG_INPUT_APANEL_MODULE
641+
#if defined CONFIG_X86 && defined CONFIG_DMI
638642
static unsigned char apanel_addr;
639643

640644
/* Scan the system ROM for the signature "FJKEYINF" */
@@ -664,11 +668,7 @@ static void __init input_apanel_init(void)
664668
}
665669
iounmap(bios);
666670
}
667-
#else
668-
static void __init input_apanel_init(void) {}
669-
#endif
670671

671-
#if defined CONFIG_SENSORS_FSCHMD || defined CONFIG_SENSORS_FSCHMD_MODULE
672672
struct dmi_onboard_device_info {
673673
const char *name;
674674
u8 type;
@@ -734,7 +734,30 @@ static void __devinit dmi_check_onboard_devices(const struct dmi_header *dm,
734734
dmi_check_onboard_device(type, name, adap);
735735
}
736736
}
737-
#endif
737+
738+
/* Register optional slaves */
739+
static void __devinit i801_probe_optional_slaves(struct i801_priv *priv)
740+
{
741+
/* Only register slaves on main SMBus channel */
742+
if (priv->features & FEATURE_IDF)
743+
return;
744+
745+
if (apanel_addr) {
746+
struct i2c_board_info info;
747+
748+
memset(&info, 0, sizeof(struct i2c_board_info));
749+
info.addr = apanel_addr;
750+
strlcpy(info.type, "fujitsu_apanel", I2C_NAME_SIZE);
751+
i2c_new_device(&priv->adapter, &info);
752+
}
753+
754+
if (dmi_name_in_vendors("FUJITSU"))
755+
dmi_walk(dmi_check_onboard_devices, &priv->adapter);
756+
}
757+
#else
758+
static void __init input_apanel_init(void) {}
759+
static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) {}
760+
#endif /* CONFIG_X86 && CONFIG_DMI */
738761

739762
static int __devinit i801_probe(struct pci_dev *dev,
740763
const struct pci_device_id *id)
@@ -754,6 +777,11 @@ static int __devinit i801_probe(struct pci_dev *dev,
754777

755778
priv->pci_dev = dev;
756779
switch (dev->device) {
780+
case PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF0:
781+
case PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF1:
782+
case PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF2:
783+
priv->features |= FEATURE_IDF;
784+
/* fall through */
757785
default:
758786
priv->features |= FEATURE_I2C_BLOCK_READ;
759787
/* fall through */
@@ -839,21 +867,7 @@ static int __devinit i801_probe(struct pci_dev *dev,
839867
goto exit_release;
840868
}
841869

842-
/* Register optional slaves */
843-
#if defined CONFIG_INPUT_APANEL || defined CONFIG_INPUT_APANEL_MODULE
844-
if (apanel_addr) {
845-
struct i2c_board_info info;
846-
847-
memset(&info, 0, sizeof(struct i2c_board_info));
848-
info.addr = apanel_addr;
849-
strlcpy(info.type, "fujitsu_apanel", I2C_NAME_SIZE);
850-
i2c_new_device(&priv->adapter, &info);
851-
}
852-
#endif
853-
#if defined CONFIG_SENSORS_FSCHMD || defined CONFIG_SENSORS_FSCHMD_MODULE
854-
if (dmi_name_in_vendors("FUJITSU"))
855-
dmi_walk(dmi_check_onboard_devices, &priv->adapter);
856-
#endif
870+
i801_probe_optional_slaves(priv);
857871

858872
pci_set_drvdata(dev, priv);
859873
return 0;
@@ -913,7 +927,8 @@ static struct pci_driver i801_driver = {
913927

914928
static int __init i2c_i801_init(void)
915929
{
916-
input_apanel_init();
930+
if (dmi_name_in_vendors("FUJITSU"))
931+
input_apanel_init();
917932
return pci_register_driver(&i801_driver);
918933
}
919934

‎drivers/i2c/busses/i2c-parport-light.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
* i2c-parport-light.c I2C bus over parallel port *
33
* ------------------------------------------------------------------------ *
44
Copyright (C) 2003-2010 Jean Delvare <khali@linux-fr.org>
5-
5+
66
Based on older i2c-velleman.c driver
77
Copyright (C) 1995-2000 Simon G. Vogl
88
With some changes from:
99
Frodo Looijaard <frodol@dds.nl>
1010
Kyösti Mälkki <kmalkki@cc.hut.fi>
11-
11+
1212
This program is free software; you can redistribute it and/or modify
1313
it under the terms of the GNU General Public License as published by
1414
the Free Software Foundation; either version 2 of the License, or
@@ -114,7 +114,7 @@ static struct i2c_algo_bit_data parport_algo_data = {
114114
.getscl = parport_getscl,
115115
.udelay = 50,
116116
.timeout = HZ,
117-
};
117+
};
118118

119119
/* ----- Driver registration ---------------------------------------------- */
120120

@@ -132,7 +132,7 @@ static struct i2c_smbus_alert_setup alert_data = {
132132
static struct i2c_client *ara;
133133
static struct lineop parport_ctrl_irq = {
134134
.val = (1 << 4),
135-
.port = CTRL,
135+
.port = PORT_CTRL,
136136
};
137137

138138
static int __devinit i2c_parport_probe(struct platform_device *pdev)
@@ -245,7 +245,7 @@ static int __init i2c_parport_init(void)
245245
if (irq != 0)
246246
pr_info(DRVNAME ": using irq %d\n", irq);
247247

248-
if (!adapter_parm[type].getscl.val)
248+
if (!adapter_parm[type].getscl.val)
249249
parport_algo_data.getscl = NULL;
250250

251251
/* Sets global pdev as a side effect */

‎drivers/i2c/busses/i2c-parport.c‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
* i2c-parport.c I2C bus over parallel port *
33
* ------------------------------------------------------------------------ *
44
Copyright (C) 2003-2011 Jean Delvare <khali@linux-fr.org>
5-
5+
66
Based on older i2c-philips-par.c driver
77
Copyright (C) 1995-2000 Simon G. Vogl
88
With some changes from:
99
Frodo Looijaard <frodol@dds.nl>
1010
Kyösti Mälkki <kmalkki@cc.hut.fi>
11-
11+
1212
This program is free software; you can redistribute it and/or modify
1313
it under the terms of the GNU General Public License as published by
1414
the Free Software Foundation; either version 2 of the License, or
@@ -78,13 +78,13 @@ static unsigned char port_read_control(struct parport *p)
7878
return parport_read_control(p);
7979
}
8080

81-
static void (*port_write[])(struct parport *, unsigned char) = {
81+
static void (* const port_write[])(struct parport *, unsigned char) = {
8282
port_write_data,
8383
NULL,
8484
port_write_control,
8585
};
8686

87-
static unsigned char (*port_read[])(struct parport *) = {
87+
static unsigned char (* const port_read[])(struct parport *) = {
8888
port_read_data,
8989
port_read_status,
9090
port_read_control,
@@ -147,7 +147,7 @@ static const struct i2c_algo_bit_data parport_algo_data = {
147147
.getscl = parport_getscl,
148148
.udelay = 10, /* ~50 kbps */
149149
.timeout = HZ,
150-
};
150+
};
151151

152152
/* ----- I2c and parallel port call-back functions and structures --------- */
153153

@@ -164,10 +164,10 @@ void i2c_parport_irq(void *data)
164164
"SMBus alert received but no ARA client!\n");
165165
}
166166

167-
static void i2c_parport_attach (struct parport *port)
167+
static void i2c_parport_attach(struct parport *port)
168168
{
169169
struct i2c_par *adapter;
170-
170+
171171
adapter = kzalloc(sizeof(struct i2c_par), GFP_KERNEL);
172172
if (adapter == NULL) {
173173
printk(KERN_ERR "i2c-parport: Failed to kzalloc\n");
@@ -180,7 +180,7 @@ static void i2c_parport_attach (struct parport *port)
180180
NULL, NULL, i2c_parport_irq, PARPORT_FLAG_EXCL, adapter);
181181
if (!adapter->pdev) {
182182
printk(KERN_ERR "i2c-parport: Unable to register with parport\n");
183-
goto ERROR0;
183+
goto err_free;
184184
}
185185

186186
/* Fill the rest of the structure */
@@ -200,7 +200,7 @@ static void i2c_parport_attach (struct parport *port)
200200

201201
if (parport_claim_or_block(adapter->pdev) < 0) {
202202
printk(KERN_ERR "i2c-parport: Could not claim parallel port\n");
203-
goto ERROR1;
203+
goto err_unregister;
204204
}
205205

206206
/* Reset hardware to a sane state (SCL and SDA high) */
@@ -215,7 +215,7 @@ static void i2c_parport_attach (struct parport *port)
215215

216216
if (i2c_bit_add_bus(&adapter->adapter) < 0) {
217217
printk(KERN_ERR "i2c-parport: Unable to register with I2C\n");
218-
goto ERROR1;
218+
goto err_unregister;
219219
}
220220

221221
/* Setup SMBus alert if supported */
@@ -234,16 +234,16 @@ static void i2c_parport_attach (struct parport *port)
234234
mutex_lock(&adapter_list_lock);
235235
list_add_tail(&adapter->node, &adapter_list);
236236
mutex_unlock(&adapter_list_lock);
237-
return;
237+
return;
238238

239-
ERROR1:
239+
err_unregister:
240240
parport_release(adapter->pdev);
241241
parport_unregister_device(adapter->pdev);
242-
ERROR0:
242+
err_free:
243243
kfree(adapter);
244244
}
245245

246-
static void i2c_parport_detach (struct parport *port)
246+
static void i2c_parport_detach(struct parport *port)
247247
{
248248
struct i2c_par *adapter, *_n;
249249

@@ -260,7 +260,7 @@ static void i2c_parport_detach (struct parport *port)
260260
/* Un-init if needed (power off...) */
261261
if (adapter_parm[type].init.val)
262262
line_set(port, 0, &adapter_parm[type].init);
263-
263+
264264
parport_release(adapter->pdev);
265265
parport_unregister_device(adapter->pdev);
266266
list_del(&adapter->node);

0 commit comments

Comments
 (0)