Skip to content

Commit

Permalink
Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare…
Browse files Browse the repository at this point in the history
…-2.6

* 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6:
  i2c/max6875: Really prevent 24RF08 corruption
  i2c-amd756: Fix functionality flags
  i2c: Kill the old driver matching scheme
  i2c: Convert remaining new-style drivers to use module aliasing
  i2c: Switch pasemi to the new device/driver matching scheme
  i2c: Clean up Blackfin BF527 I2C device declarations
  i2c-nforce2: Disable the second SMBus channel on the DFI Lanparty NF4 Expert
  i2c: New co-maintainer
  • Loading branch information
torvalds committed May 18, 2008
2 parents 026bf9b + 70455e7 commit 3e5b787
Show file tree
Hide file tree
Showing 25 changed files with 180 additions and 80 deletions.
4 changes: 3 additions & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -1940,8 +1940,10 @@ L: lm-sensors@lm-sensors.org
S: Maintained

I2C SUBSYSTEM
P: Jean Delvare
P: Jean Delvare (PC drivers, core)
M: khali@linux-fr.org
P: Ben Dooks (embedded platforms)
M: ben-linux@fluff.org
L: i2c@lm-sensors.org
T: quilt http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/
S: Maintained
Expand Down
2 changes: 0 additions & 2 deletions arch/blackfin/mach-bf527/boards/ezkit.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,13 +799,11 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
{
I2C_BOARD_INFO("pcf8574_lcd", 0x22),
.type = "pcf8574_lcd",
},
#endif
#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
{
I2C_BOARD_INFO("pcf8574_keypad", 0x27),
.type = "pcf8574_keypad",
.irq = IRQ_PF8,
},
#endif
Expand Down
7 changes: 2 additions & 5 deletions arch/powerpc/platforms/pasemi/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@
*/
struct i2c_driver_device {
char *of_device;
char *i2c_driver;
char *i2c_type;
};

static struct i2c_driver_device i2c_devices[] __initdata = {
{"dallas,ds1338", "rtc-ds1307", "ds1338"},
{"dallas,ds1338", "ds1338"},
};

static int __init find_i2c_driver(struct device_node *node,
Expand All @@ -40,9 +39,7 @@ static int __init find_i2c_driver(struct device_node *node,
for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) {
if (!of_device_is_compatible(node, i2c_devices[i].of_device))
continue;
if (strlcpy(info->driver_name, i2c_devices[i].i2c_driver,
KOBJ_NAME_LEN) >= KOBJ_NAME_LEN ||
strlcpy(info->type, i2c_devices[i].i2c_type,
if (strlcpy(info->type, i2c_devices[i].i2c_type,
I2C_NAME_SIZE) >= I2C_NAME_SIZE)
return -ENOMEM;
return 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-amd756.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ static u32 amd756_func(struct i2c_adapter *adapter)
{
return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_PROC_CALL;
I2C_FUNC_SMBUS_BLOCK_DATA;
}

static const struct i2c_algorithm smbus_algorithm = {
Expand Down
28 changes: 24 additions & 4 deletions drivers/i2c/busses/i2c-nforce2.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/delay.h>
#include <linux/dmi.h>
#include <asm/io.h>

MODULE_LICENSE("GPL");
Expand Down Expand Up @@ -109,6 +110,18 @@ struct nforce2_smbus {
/* Misc definitions */
#define MAX_TIMEOUT 100

/* We disable the second SMBus channel on these boards */
static struct dmi_system_id __devinitdata nforce2_dmi_blacklist2[] = {
{
.ident = "DFI Lanparty NF4 Expert",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "DFI Corp,LTD"),
DMI_MATCH(DMI_BOARD_NAME, "LP UT NF4 Expert"),
},
},
{ }
};

static struct pci_driver nforce2_driver;

static void nforce2_abort(struct i2c_adapter *adap)
Expand Down Expand Up @@ -367,10 +380,17 @@ static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_
smbuses[0].base = 0; /* to have a check value */
}
/* SMBus adapter 2 */
res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1], "SMB2");
if (res2 < 0) {
dev_err(&dev->dev, "Error probing SMB2.\n");
smbuses[1].base = 0; /* to have a check value */
if (dmi_check_system(nforce2_dmi_blacklist2)) {
dev_err(&dev->dev, "Disabling SMB2 for safety reasons.\n");
res2 = -EPERM;
smbuses[1].base = 0;
} else {
res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1],
"SMB2");
if (res2 < 0) {
dev_err(&dev->dev, "Error probing SMB2.\n");
smbuses[1].base = 0; /* to have a check value */
}
}
if ((res1 < 0) && (res2 < 0)) {
/* we did not find even one of the SMBuses, so we give up */
Expand Down
3 changes: 0 additions & 3 deletions drivers/i2c/chips/max6875.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,6 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind)
fake_client->flags = 0;
strlcpy(fake_client->name, "max6875 subclient", I2C_NAME_SIZE);

/* Prevent 24RF08 corruption (in case of user error) */
i2c_smbus_write_quick(real_client, 0);

if ((err = i2c_attach_client(real_client)) != 0)
goto exit_kfree2;

Expand Down
22 changes: 5 additions & 17 deletions drivers/i2c/i2c-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ static int i2c_device_match(struct device *dev, struct device_driver *drv)
if (driver->id_table)
return i2c_match_id(driver->id_table, client) != NULL;

/* new style drivers use the same kind of driver matching policy
* as platform devices or SPI: compare device and driver IDs.
*/
return strcmp(client->driver_name, drv->name) == 0;
return 0;
}

#ifdef CONFIG_HOTPLUG
Expand All @@ -91,14 +88,9 @@ static int i2c_device_uevent(struct device *dev, struct kobj_uevent_env *env)
if (dev->driver)
return 0;

if (client->driver_name[0]) {
if (add_uevent_var(env, "MODALIAS=%s", client->driver_name))
return -ENOMEM;
} else {
if (add_uevent_var(env, "MODALIAS=%s%s",
I2C_MODULE_PREFIX, client->name))
return -ENOMEM;
}
if (add_uevent_var(env, "MODALIAS=%s%s",
I2C_MODULE_PREFIX, client->name))
return -ENOMEM;
dev_dbg(dev, "uevent\n");
return 0;
}
Expand Down Expand Up @@ -206,9 +198,7 @@ static ssize_t show_client_name(struct device *dev, struct device_attribute *att
static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
{
struct i2c_client *client = to_i2c_client(dev);
return client->driver_name[0]
? sprintf(buf, "%s\n", client->driver_name)
: sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name);
return sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name);
}

static struct device_attribute i2c_dev_attrs[] = {
Expand Down Expand Up @@ -282,8 +272,6 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
client->addr = info->addr;
client->irq = info->irq;

strlcpy(client->driver_name, info->driver_name,
sizeof(client->driver_name));
strlcpy(client->name, info->type, sizeof(client->name));

/* a new style driver may be bound to this device when we
Expand Down
7 changes: 7 additions & 0 deletions drivers/media/video/cs5345.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,17 @@ static int cs5345_probe(struct i2c_client *client,

/* ----------------------------------------------------------------------- */

static const struct i2c_device_id cs5345_id[] = {
{ "cs5345", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, cs5345_id);

static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.name = "cs5345",
.driverid = I2C_DRIVERID_CS5345,
.command = cs5345_command,
.probe = cs5345_probe,
.id_table = cs5345_id,
};

10 changes: 9 additions & 1 deletion drivers/media/video/cs53l32a.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ static int cs53l32a_probe(struct i2c_client *client,
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return -EIO;

snprintf(client->name, sizeof(client->name) - 1, "cs53l32a");
if (!id)
strlcpy(client->name, "cs53l32a", sizeof(client->name));

v4l_info(client, "chip found @ 0x%x (%s)\n",
client->addr << 1, client->adapter->name);
Expand Down Expand Up @@ -175,10 +176,17 @@ static int cs53l32a_probe(struct i2c_client *client,
return 0;
}

static const struct i2c_device_id cs53l32a_id[] = {
{ "cs53l32a", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, cs53l32a_id);

static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.name = "cs53l32a",
.driverid = I2C_DRIVERID_CS53L32A,
.command = cs53l32a_command,
.probe = cs53l32a_probe,
.id_table = cs53l32a_id,
};

9 changes: 4 additions & 5 deletions drivers/media/video/cx18/cx18-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static const u8 hw_bus[] = {
};

/* This array should match the CX18_HW_ defines */
static const char * const hw_drivernames[] = {
static const char * const hw_devicenames[] = {
"tuner",
"tveeprom",
"cs5345",
Expand All @@ -95,8 +95,7 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx)
id = hw_driverids[idx];
bus = hw_bus[idx];
memset(&info, 0, sizeof(info));
strlcpy(info.driver_name, hw_drivernames[idx],
sizeof(info.driver_name));
strlcpy(info.type, hw_devicenames[idx], sizeof(info.type));
info.addr = hw_addrs[idx];
for (i = 0; i < I2C_CLIENTS_MAX; i++)
if (cx->i2c_clients[i] == NULL)
Expand Down Expand Up @@ -279,7 +278,7 @@ static const char *cx18_i2c_id_name(u32 id)

for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
if (hw_driverids[i] == id)
return hw_drivernames[i];
return hw_devicenames[i];
return "unknown device";
}

Expand All @@ -290,7 +289,7 @@ static const char *cx18_i2c_hw_name(u32 hw)

for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
if (1 << i == hw)
return hw_drivernames[i];
return hw_devicenames[i];
return "unknown device";
}

Expand Down
7 changes: 7 additions & 0 deletions drivers/media/video/cx25840/cx25840-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1284,10 +1284,17 @@ static int cx25840_remove(struct i2c_client *client)
return 0;
}

static const struct i2c_device_id cx25840_id[] = {
{ "cx25840", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, cx25840_id);

static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.name = "cx25840",
.driverid = I2C_DRIVERID_CX25840,
.command = cx25840_command,
.probe = cx25840_probe,
.remove = cx25840_remove,
.id_table = cx25840_id,
};
13 changes: 6 additions & 7 deletions drivers/media/video/ivtv/ivtv-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static const u8 hw_addrs[] = {
};

/* This array should match the IVTV_HW_ defines */
static const char * const hw_drivernames[] = {
static const char * const hw_devicenames[] = {
"cx25840",
"saa7115",
"saa7127",
Expand All @@ -145,7 +145,7 @@ static const char * const hw_drivernames[] = {
"wm8775",
"cs53l32a",
"tveeprom",
"saa7115",
"saa7114",
"upd64031a",
"upd64083",
"saa717x",
Expand All @@ -167,8 +167,7 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx)
return -1;
id = hw_driverids[idx];
memset(&info, 0, sizeof(info));
strlcpy(info.driver_name, hw_drivernames[idx],
sizeof(info.driver_name));
strlcpy(info.type, hw_devicenames[idx], sizeof(info.type));
info.addr = hw_addrs[idx];
for (i = 0; itv->i2c_clients[i] && i < I2C_CLIENTS_MAX; i++) {}

Expand Down Expand Up @@ -657,7 +656,7 @@ static const char *ivtv_i2c_id_name(u32 id)

for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
if (hw_driverids[i] == id)
return hw_drivernames[i];
return hw_devicenames[i];
return "unknown device";
}

Expand All @@ -668,7 +667,7 @@ static const char *ivtv_i2c_hw_name(u32 hw)

for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
if (1 << i == hw)
return hw_drivernames[i];
return hw_devicenames[i];
return "unknown device";
}

Expand Down Expand Up @@ -770,7 +769,7 @@ int init_ivtv_i2c(struct ivtv *itv)
* same size and GPIO must be the last entry.
*/
if (ARRAY_SIZE(hw_driverids) != ARRAY_SIZE(hw_addrs) ||
ARRAY_SIZE(hw_drivernames) != ARRAY_SIZE(hw_addrs) ||
ARRAY_SIZE(hw_devicenames) != ARRAY_SIZE(hw_addrs) ||
IVTV_HW_GPIO != (1 << (ARRAY_SIZE(hw_addrs) - 1)) ||
hw_driverids[ARRAY_SIZE(hw_addrs) - 1]) {
IVTV_ERR("Mismatched I2C hardware arrays\n");
Expand Down
9 changes: 7 additions & 2 deletions drivers/media/video/m52790.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ static int m52790_probe(struct i2c_client *client,
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return -EIO;

snprintf(client->name, sizeof(client->name) - 1, "m52790");

v4l_info(client, "chip found @ 0x%x (%s)\n",
client->addr << 1, client->adapter->name);

Expand All @@ -159,11 +157,18 @@ static int m52790_remove(struct i2c_client *client)

/* ----------------------------------------------------------------------- */

static const struct i2c_device_id m52790_id[] = {
{ "m52790", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, m52790_id);

static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.name = "m52790",
.driverid = I2C_DRIVERID_M52790,
.command = m52790_command,
.probe = m52790_probe,
.remove = m52790_remove,
.id_table = m52790_id,
};

Loading

0 comments on commit 3e5b787

Please sign in to comment.