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: macintosh: Don't assume i2c device probing always succeeds i2c: Hide probe errors caused by ACPI resource conflicts i2c: Minor documentation update mfd: AB3100 drop unused module parameters Staging: IIO: tsl2561: Drop unused module parameters leds: leds-pca9532 - Drop unused module parameters ltc4215/ltc4245: Discard obsolete detect methods ds2482: Discard obsolete detect method max6875: Discard obsolete detect method i2c: Move misc devices documentation
This commit is contained in:
commit
663cc813a8
25 changed files with 64 additions and 257 deletions
|
@ -22,12 +22,13 @@ Usage Notes
|
|||
-----------
|
||||
|
||||
This driver does not probe for LTC4215 devices, due to the fact that some
|
||||
of the possible addresses are unfriendly to probing. You will need to use
|
||||
the "force" parameter to tell the driver where to find the device.
|
||||
of the possible addresses are unfriendly to probing. You will have to
|
||||
instantiate the devices explicitly.
|
||||
|
||||
Example: the following will load the driver for an LTC4215 at address 0x44
|
||||
on I2C bus #0:
|
||||
$ modprobe ltc4215 force=0,0x44
|
||||
$ modprobe ltc4215
|
||||
$ echo ltc4215 0x44 > /sys/bus/i2c/devices/i2c-0/new_device
|
||||
|
||||
|
||||
Sysfs entries
|
||||
|
|
|
@ -23,12 +23,13 @@ Usage Notes
|
|||
-----------
|
||||
|
||||
This driver does not probe for LTC4245 devices, due to the fact that some
|
||||
of the possible addresses are unfriendly to probing. You will need to use
|
||||
the "force" parameter to tell the driver where to find the device.
|
||||
of the possible addresses are unfriendly to probing. You will have to
|
||||
instantiate the devices explicitly.
|
||||
|
||||
Example: the following will load the driver for an LTC4245 at address 0x23
|
||||
on I2C bus #1:
|
||||
$ modprobe ltc4245 force=1,0x23
|
||||
$ modprobe ltc4245
|
||||
$ echo ltc4245 0x23 > /sys/bus/i2c/devices/i2c-1/new_device
|
||||
|
||||
|
||||
Sysfs entries
|
||||
|
|
|
@ -188,7 +188,7 @@ segment, the address is sufficient to uniquely identify the device to be
|
|||
deleted.
|
||||
|
||||
Example:
|
||||
# echo eeprom 0x50 > /sys/class/i2c-adapter/i2c-3/new_device
|
||||
# echo eeprom 0x50 > /sys/bus/i2c/devices/i2c-3/new_device
|
||||
|
||||
While this interface should only be used when in-kernel device declaration
|
||||
can't be done, there is a variety of cases where it can be helpful:
|
||||
|
|
|
@ -42,10 +42,12 @@ General Remarks
|
|||
|
||||
Valid addresses for the MAX6875 are 0x50 and 0x52.
|
||||
Valid addresses for the MAX6874 are 0x50, 0x52, 0x54 and 0x56.
|
||||
The driver does not probe any address, so you must force the address.
|
||||
The driver does not probe any address, so you explicitly instantiate the
|
||||
devices.
|
||||
|
||||
Example:
|
||||
$ modprobe max6875 force=0,0x50
|
||||
$ modprobe max6875
|
||||
$ echo max6875 0x50 > /sys/bus/i2c/devices/i2c-0/new_device
|
||||
|
||||
The MAX6874/MAX6875 ignores address bit 0, so this driver attaches to multiple
|
||||
addresses. For example, for address 0x50, it also reserves 0x51.
|
|
@ -24,8 +24,8 @@ General Remarks
|
|||
|
||||
Valid addresses are 0x18, 0x19, 0x1a, and 0x1b.
|
||||
However, the device cannot be detected without writing to the i2c bus, so no
|
||||
detection is done.
|
||||
You should force the device address.
|
||||
detection is done. You should instantiate the device explicitly.
|
||||
|
||||
$ modprobe ds2482 force=0,0x18
|
||||
$ modprobe ds2482
|
||||
$ echo ds2482 0x18 > /sys/bus/i2c/devices/i2c-0/new_device
|
||||
|
||||
|
|
|
@ -20,11 +20,6 @@
|
|||
#include <linux/hwmon.h>
|
||||
#include <linux/hwmon-sysfs.h>
|
||||
|
||||
static const unsigned short normal_i2c[] = { I2C_CLIENT_END };
|
||||
|
||||
/* Insmod parameters */
|
||||
I2C_CLIENT_INSMOD_1(ltc4215);
|
||||
|
||||
/* Here are names of the chip's registers (a.k.a. commands) */
|
||||
enum ltc4215_cmd {
|
||||
LTC4215_CONTROL = 0x00, /* rw */
|
||||
|
@ -246,9 +241,13 @@ static const struct attribute_group ltc4215_group = {
|
|||
static int ltc4215_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct i2c_adapter *adapter = client->adapter;
|
||||
struct ltc4215_data *data;
|
||||
int ret;
|
||||
|
||||
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
||||
return -ENODEV;
|
||||
|
||||
data = kzalloc(sizeof(*data), GFP_KERNEL);
|
||||
if (!data) {
|
||||
ret = -ENOMEM;
|
||||
|
@ -294,56 +293,20 @@ static int ltc4215_remove(struct i2c_client *client)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ltc4215_detect(struct i2c_client *client,
|
||||
int kind,
|
||||
struct i2c_board_info *info)
|
||||
{
|
||||
struct i2c_adapter *adapter = client->adapter;
|
||||
|
||||
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
||||
return -ENODEV;
|
||||
|
||||
if (kind < 0) { /* probed detection - check the chip type */
|
||||
s32 v; /* 8 bits from the chip, or -ERRNO */
|
||||
|
||||
/*
|
||||
* Register 0x01 bit b7 is reserved, expect 0
|
||||
* Register 0x03 bit b6 and b7 are reserved, expect 0
|
||||
*/
|
||||
v = i2c_smbus_read_byte_data(client, LTC4215_ALERT);
|
||||
if (v < 0 || (v & (1 << 7)) != 0)
|
||||
return -ENODEV;
|
||||
|
||||
v = i2c_smbus_read_byte_data(client, LTC4215_FAULT);
|
||||
if (v < 0 || (v & ((1 << 6) | (1 << 7))) != 0)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
strlcpy(info->type, "ltc4215", I2C_NAME_SIZE);
|
||||
dev_info(&adapter->dev, "ltc4215 %s at address 0x%02x\n",
|
||||
kind < 0 ? "probed" : "forced",
|
||||
client->addr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id ltc4215_id[] = {
|
||||
{ "ltc4215", ltc4215 },
|
||||
{ "ltc4215", 0 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, ltc4215_id);
|
||||
|
||||
/* This is the driver that will be inserted */
|
||||
static struct i2c_driver ltc4215_driver = {
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.driver = {
|
||||
.name = "ltc4215",
|
||||
},
|
||||
.probe = ltc4215_probe,
|
||||
.remove = ltc4215_remove,
|
||||
.id_table = ltc4215_id,
|
||||
.detect = ltc4215_detect,
|
||||
.address_data = &addr_data,
|
||||
};
|
||||
|
||||
static int __init ltc4215_init(void)
|
||||
|
|
|
@ -22,15 +22,6 @@
|
|||
#include <linux/hwmon.h>
|
||||
#include <linux/hwmon-sysfs.h>
|
||||
|
||||
/* Valid addresses are 0x20 - 0x3f
|
||||
*
|
||||
* For now, we do not probe, since some of these addresses
|
||||
* are known to be unfriendly to probing */
|
||||
static const unsigned short normal_i2c[] = { I2C_CLIENT_END };
|
||||
|
||||
/* Insmod parameters */
|
||||
I2C_CLIENT_INSMOD_1(ltc4245);
|
||||
|
||||
/* Here are names of the chip's registers (a.k.a. commands) */
|
||||
enum ltc4245_cmd {
|
||||
LTC4245_STATUS = 0x00, /* readonly */
|
||||
|
@ -369,9 +360,13 @@ static const struct attribute_group ltc4245_group = {
|
|||
static int ltc4245_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct i2c_adapter *adapter = client->adapter;
|
||||
struct ltc4245_data *data;
|
||||
int ret;
|
||||
|
||||
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
||||
return -ENODEV;
|
||||
|
||||
data = kzalloc(sizeof(*data), GFP_KERNEL);
|
||||
if (!data) {
|
||||
ret = -ENOMEM;
|
||||
|
@ -418,136 +413,20 @@ static int ltc4245_remove(struct i2c_client *client)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Check that some bits in a control register appear at all possible
|
||||
* locations without changing value
|
||||
*
|
||||
* @client: the i2c client to use
|
||||
* @reg: the register to read
|
||||
* @bits: the bits to check (0xff checks all bits,
|
||||
* 0x03 checks only the last two bits)
|
||||
*
|
||||
* return -ERRNO if the register read failed
|
||||
* return -ENODEV if the register value doesn't stay constant at all
|
||||
* possible addresses
|
||||
*
|
||||
* return 0 for success
|
||||
*/
|
||||
static int ltc4245_check_control_reg(struct i2c_client *client, u8 reg, u8 bits)
|
||||
{
|
||||
int i;
|
||||
s32 v, voff1, voff2;
|
||||
|
||||
/* Read register and check for error */
|
||||
v = i2c_smbus_read_byte_data(client, reg);
|
||||
if (v < 0)
|
||||
return v;
|
||||
|
||||
v &= bits;
|
||||
|
||||
for (i = 0x00; i < 0xff; i += 0x20) {
|
||||
|
||||
voff1 = i2c_smbus_read_byte_data(client, reg + i);
|
||||
if (voff1 < 0)
|
||||
return voff1;
|
||||
|
||||
voff2 = i2c_smbus_read_byte_data(client, reg + i + 0x08);
|
||||
if (voff2 < 0)
|
||||
return voff2;
|
||||
|
||||
voff1 &= bits;
|
||||
voff2 &= bits;
|
||||
|
||||
if (v != voff1 || v != voff2)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ltc4245_detect(struct i2c_client *client,
|
||||
int kind,
|
||||
struct i2c_board_info *info)
|
||||
{
|
||||
struct i2c_adapter *adapter = client->adapter;
|
||||
|
||||
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
||||
return -ENODEV;
|
||||
|
||||
if (kind < 0) { /* probed detection - check the chip type */
|
||||
s32 v; /* 8 bits from the chip, or -ERRNO */
|
||||
|
||||
/* Chip registers 0x00-0x07 are control registers
|
||||
* Chip registers 0x10-0x1f are data registers
|
||||
*
|
||||
* Address bits b7-b5 are ignored. This makes the chip "repeat"
|
||||
* in steps of 0x20. Any control registers should appear with
|
||||
* the same values across all duplicated addresses.
|
||||
*
|
||||
* Register 0x02 bit b2 is reserved, expect 0
|
||||
* Register 0x07 bits b7 to b4 are reserved, expect 0
|
||||
*
|
||||
* Registers 0x01, 0x02 are control registers and should not
|
||||
* change on their own.
|
||||
*
|
||||
* Register 0x06 bits b6 and b7 are control bits, and should
|
||||
* not change on their own.
|
||||
*
|
||||
* Register 0x07 bits b3 to b0 are control bits, and should
|
||||
* not change on their own.
|
||||
*/
|
||||
|
||||
/* read register 0x02 reserved bit, expect 0 */
|
||||
v = i2c_smbus_read_byte_data(client, LTC4245_CONTROL);
|
||||
if (v < 0 || (v & 0x04) != 0)
|
||||
return -ENODEV;
|
||||
|
||||
/* read register 0x07 reserved bits, expect 0 */
|
||||
v = i2c_smbus_read_byte_data(client, LTC4245_ADCADR);
|
||||
if (v < 0 || (v & 0xf0) != 0)
|
||||
return -ENODEV;
|
||||
|
||||
/* check that the alert register appears at all locations */
|
||||
if (ltc4245_check_control_reg(client, LTC4245_ALERT, 0xff))
|
||||
return -ENODEV;
|
||||
|
||||
/* check that the control register appears at all locations */
|
||||
if (ltc4245_check_control_reg(client, LTC4245_CONTROL, 0xff))
|
||||
return -ENODEV;
|
||||
|
||||
/* check that register 0x06 bits b6 and b7 stay constant */
|
||||
if (ltc4245_check_control_reg(client, LTC4245_GPIO, 0xc0))
|
||||
return -ENODEV;
|
||||
|
||||
/* check that register 0x07 bits b3-b0 stay constant */
|
||||
if (ltc4245_check_control_reg(client, LTC4245_ADCADR, 0x0f))
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
strlcpy(info->type, "ltc4245", I2C_NAME_SIZE);
|
||||
dev_info(&adapter->dev, "ltc4245 %s at address 0x%02x\n",
|
||||
kind < 0 ? "probed" : "forced",
|
||||
client->addr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id ltc4245_id[] = {
|
||||
{ "ltc4245", ltc4245 },
|
||||
{ "ltc4245", 0 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, ltc4245_id);
|
||||
|
||||
/* This is the driver that will be inserted */
|
||||
static struct i2c_driver ltc4245_driver = {
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.driver = {
|
||||
.name = "ltc4245",
|
||||
},
|
||||
.probe = ltc4245_probe,
|
||||
.remove = ltc4245_remove,
|
||||
.id_table = ltc4245_id,
|
||||
.detect = ltc4245_detect,
|
||||
.address_data = &addr_data,
|
||||
};
|
||||
|
||||
static int __init ltc4245_init(void)
|
||||
|
|
|
@ -364,7 +364,7 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
|
|||
error = acpi_check_region(amd756_ioport, SMB_IOSIZE,
|
||||
amd756_driver.name);
|
||||
if (error)
|
||||
return error;
|
||||
return -ENODEV;
|
||||
|
||||
if (!request_region(amd756_ioport, SMB_IOSIZE, amd756_driver.name)) {
|
||||
dev_err(&pdev->dev, "SMB region 0x%x already in use!\n",
|
||||
|
|
|
@ -376,8 +376,10 @@ static int __devinit amd8111_probe(struct pci_dev *dev,
|
|||
smbus->size = pci_resource_len(dev, 0);
|
||||
|
||||
error = acpi_check_resource_conflict(&dev->resource[0]);
|
||||
if (error)
|
||||
if (error) {
|
||||
error = -ENODEV;
|
||||
goto out_kfree;
|
||||
}
|
||||
|
||||
if (!request_region(smbus->base, smbus->size, amd8111_driver.name)) {
|
||||
error = -EBUSY;
|
||||
|
|
|
@ -732,8 +732,10 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
|
|||
}
|
||||
|
||||
err = acpi_check_resource_conflict(&dev->resource[SMBBAR]);
|
||||
if (err)
|
||||
if (err) {
|
||||
err = -ENODEV;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
err = pci_request_region(dev, SMBBAR, i801_driver.name);
|
||||
if (err) {
|
||||
|
|
|
@ -281,7 +281,7 @@ static int __devinit sch_probe(struct pci_dev *dev,
|
|||
return -ENODEV;
|
||||
}
|
||||
if (acpi_check_region(sch_smba, SMBIOSIZE, sch_driver.name))
|
||||
return -EBUSY;
|
||||
return -ENODEV;
|
||||
if (!request_region(sch_smba, SMBIOSIZE, sch_driver.name)) {
|
||||
dev_err(&dev->dev, "SMBus region 0x%x already in use!\n",
|
||||
sch_smba);
|
||||
|
|
|
@ -169,7 +169,7 @@ static int __devinit piix4_setup(struct pci_dev *PIIX4_dev,
|
|||
}
|
||||
|
||||
if (acpi_check_region(piix4_smba, SMBIOSIZE, piix4_driver.name))
|
||||
return -EBUSY;
|
||||
return -ENODEV;
|
||||
|
||||
if (!request_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) {
|
||||
dev_err(&PIIX4_dev->dev, "SMBus region 0x%x already in use!\n",
|
||||
|
@ -260,7 +260,7 @@ static int __devinit piix4_setup_sb800(struct pci_dev *PIIX4_dev,
|
|||
|
||||
piix4_smba = ((smba_en_hi << 8) | smba_en_lo) & 0xffe0;
|
||||
if (acpi_check_region(piix4_smba, SMBIOSIZE, piix4_driver.name))
|
||||
return -EBUSY;
|
||||
return -ENODEV;
|
||||
|
||||
if (!request_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) {
|
||||
dev_err(&PIIX4_dev->dev, "SMBus region 0x%x already in use!\n",
|
||||
|
|
|
@ -280,7 +280,7 @@ static int __devinit sis96x_probe(struct pci_dev *dev,
|
|||
|
||||
retval = acpi_check_resource_conflict(&dev->resource[SIS96x_BAR]);
|
||||
if (retval)
|
||||
return retval;
|
||||
return -ENODEV;
|
||||
|
||||
/* Everything is happy, let's grab the memory and set things up. */
|
||||
if (!request_region(sis96x_smbus_base, SMB_IOSIZE,
|
||||
|
|
|
@ -365,7 +365,7 @@ static int __devinit vt596_probe(struct pci_dev *pdev,
|
|||
found:
|
||||
error = acpi_check_region(vt596_smba, 8, vt596_driver.name);
|
||||
if (error)
|
||||
return error;
|
||||
return -ENODEV;
|
||||
|
||||
if (!request_region(vt596_smba, 8, vt596_driver.name)) {
|
||||
dev_err(&pdev->dev, "SMBus region 0x%x already in use!\n",
|
||||
|
|
|
@ -19,9 +19,6 @@
|
|||
#include <linux/workqueue.h>
|
||||
#include <linux/leds-pca9532.h>
|
||||
|
||||
static const unsigned short normal_i2c[] = { /*0x60,*/ I2C_CLIENT_END};
|
||||
I2C_CLIENT_INSMOD_1(pca9532);
|
||||
|
||||
#define PCA9532_REG_PSC(i) (0x2+(i)*2)
|
||||
#define PCA9532_REG_PWM(i) (0x3+(i)*2)
|
||||
#define PCA9532_REG_LS0 0x6
|
||||
|
|
|
@ -124,6 +124,8 @@ read_reg(struct thermostat* th, int reg)
|
|||
return data;
|
||||
}
|
||||
|
||||
static struct i2c_driver thermostat_driver;
|
||||
|
||||
static int
|
||||
attach_thermostat(struct i2c_adapter *adapter)
|
||||
{
|
||||
|
@ -148,7 +150,7 @@ attach_thermostat(struct i2c_adapter *adapter)
|
|||
* Let i2c-core delete that device on driver removal.
|
||||
* This is safe because i2c-core holds the core_lock mutex for us.
|
||||
*/
|
||||
list_add_tail(&client->detected, &client->driver->clients);
|
||||
list_add_tail(&client->detected, &thermostat_driver.clients);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -286,6 +286,8 @@ struct fcu_fan_table fcu_fans[] = {
|
|||
},
|
||||
};
|
||||
|
||||
static struct i2c_driver therm_pm72_driver;
|
||||
|
||||
/*
|
||||
* Utility function to create an i2c_client structure and
|
||||
* attach it to one of u3 adapters
|
||||
|
@ -318,7 +320,7 @@ static struct i2c_client *attach_i2c_chip(int id, const char *name)
|
|||
* Let i2c-core delete that device on driver removal.
|
||||
* This is safe because i2c-core holds the core_lock mutex for us.
|
||||
*/
|
||||
list_add_tail(&clt->detected, &clt->driver->clients);
|
||||
list_add_tail(&clt->detected, &therm_pm72_driver.clients);
|
||||
return clt;
|
||||
}
|
||||
|
||||
|
|
|
@ -115,6 +115,8 @@ static int wf_lm75_probe(struct i2c_client *client,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static struct i2c_driver wf_lm75_driver;
|
||||
|
||||
static struct i2c_client *wf_lm75_create(struct i2c_adapter *adapter,
|
||||
u8 addr, int ds1775,
|
||||
const char *loc)
|
||||
|
@ -157,7 +159,7 @@ static struct i2c_client *wf_lm75_create(struct i2c_adapter *adapter,
|
|||
* Let i2c-core delete that device on driver removal.
|
||||
* This is safe because i2c-core holds the core_lock mutex for us.
|
||||
*/
|
||||
list_add_tail(&client->detected, &client->driver->clients);
|
||||
list_add_tail(&client->detected, &wf_lm75_driver.clients);
|
||||
return client;
|
||||
fail:
|
||||
return NULL;
|
||||
|
|
|
@ -88,6 +88,8 @@ static int wf_max6690_probe(struct i2c_client *client,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static struct i2c_driver wf_max6690_driver;
|
||||
|
||||
static struct i2c_client *wf_max6690_create(struct i2c_adapter *adapter,
|
||||
u8 addr, const char *loc)
|
||||
{
|
||||
|
@ -119,7 +121,7 @@ static struct i2c_client *wf_max6690_create(struct i2c_adapter *adapter,
|
|||
* Let i2c-core delete that device on driver removal.
|
||||
* This is safe because i2c-core holds the core_lock mutex for us.
|
||||
*/
|
||||
list_add_tail(&client->detected, &client->driver->clients);
|
||||
list_add_tail(&client->detected, &wf_max6690_driver.clients);
|
||||
return client;
|
||||
|
||||
fail:
|
||||
|
|
|
@ -194,6 +194,8 @@ static struct wf_sensor_ops wf_sat_ops = {
|
|||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static struct i2c_driver wf_sat_driver;
|
||||
|
||||
static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev)
|
||||
{
|
||||
struct i2c_board_info info;
|
||||
|
@ -222,7 +224,7 @@ static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev)
|
|||
* Let i2c-core delete that device on driver removal.
|
||||
* This is safe because i2c-core holds the core_lock mutex for us.
|
||||
*/
|
||||
list_add_tail(&client->detected, &client->driver->clients);
|
||||
list_add_tail(&client->detected, &wf_sat_driver.clients);
|
||||
}
|
||||
|
||||
static int wf_sat_probe(struct i2c_client *client,
|
||||
|
|
|
@ -57,8 +57,6 @@
|
|||
* The AB3100 is usually assigned address 0x48 (7-bit)
|
||||
* The chip is defined in the platform i2c_board_data section.
|
||||
*/
|
||||
static unsigned short normal_i2c[] = { 0x48, I2C_CLIENT_END };
|
||||
I2C_CLIENT_INSMOD_1(ab3100);
|
||||
|
||||
u8 ab3100_get_chip_type(struct ab3100 *ab3100)
|
||||
{
|
||||
|
@ -966,7 +964,7 @@ static int __exit ab3100_remove(struct i2c_client *client)
|
|||
}
|
||||
|
||||
static const struct i2c_device_id ab3100_id[] = {
|
||||
{ "ab3100", ab3100 },
|
||||
{ "ab3100", 0 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, ab3100_id);
|
||||
|
|
|
@ -33,12 +33,6 @@
|
|||
#include <linux/i2c.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
/* Do not scan - the MAX6875 access method will write to some EEPROM chips */
|
||||
static const unsigned short normal_i2c[] = { I2C_CLIENT_END };
|
||||
|
||||
/* Insmod parameters */
|
||||
I2C_CLIENT_INSMOD_1(max6875);
|
||||
|
||||
/* The MAX6875 can only read/write 16 bytes at a time */
|
||||
#define SLICE_SIZE 16
|
||||
#define SLICE_BITS 4
|
||||
|
@ -146,31 +140,21 @@ static struct bin_attribute user_eeprom_attr = {
|
|||
.read = max6875_read,
|
||||
};
|
||||
|
||||
/* Return 0 if detection is successful, -ENODEV otherwise */
|
||||
static int max6875_detect(struct i2c_client *client, int kind,
|
||||
struct i2c_board_info *info)
|
||||
static int max6875_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct i2c_adapter *adapter = client->adapter;
|
||||
struct max6875_data *data;
|
||||
int err;
|
||||
|
||||
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA
|
||||
| I2C_FUNC_SMBUS_READ_BYTE))
|
||||
return -ENODEV;
|
||||
|
||||
/* Only check even addresses */
|
||||
/* Only bind to even addresses */
|
||||
if (client->addr & 1)
|
||||
return -ENODEV;
|
||||
|
||||
strlcpy(info->type, "max6875", I2C_NAME_SIZE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int max6875_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct max6875_data *data;
|
||||
int err;
|
||||
|
||||
if (!(data = kzalloc(sizeof(struct max6875_data), GFP_KERNEL)))
|
||||
return -ENOMEM;
|
||||
|
||||
|
@ -222,9 +206,6 @@ static struct i2c_driver max6875_driver = {
|
|||
.probe = max6875_probe,
|
||||
.remove = max6875_remove,
|
||||
.id_table = max6875_id,
|
||||
|
||||
.detect = max6875_detect,
|
||||
.address_data = &addr_data,
|
||||
};
|
||||
|
||||
static int __init max6875_init(void)
|
||||
|
|
|
@ -239,10 +239,6 @@ static int __devexit tsl2561_remove(struct i2c_client *client)
|
|||
return tsl2561_powerdown(client);
|
||||
}
|
||||
|
||||
static unsigned short normal_i2c[] = { 0x29, 0x39, 0x49, I2C_CLIENT_END };
|
||||
|
||||
I2C_CLIENT_INSMOD;
|
||||
|
||||
static const struct i2c_device_id tsl2561_id[] = {
|
||||
{ "tsl2561", 0 },
|
||||
{ }
|
||||
|
|
|
@ -23,19 +23,6 @@
|
|||
#include "../w1.h"
|
||||
#include "../w1_int.h"
|
||||
|
||||
/**
|
||||
* Address is selected using 2 pins, resulting in 4 possible addresses.
|
||||
* 0x18, 0x19, 0x1a, 0x1b
|
||||
* However, the chip cannot be detected without doing an i2c write,
|
||||
* so use the force module parameter.
|
||||
*/
|
||||
static const unsigned short normal_i2c[] = { I2C_CLIENT_END };
|
||||
|
||||
/**
|
||||
* Insmod parameters
|
||||
*/
|
||||
I2C_CLIENT_INSMOD_1(ds2482);
|
||||
|
||||
/**
|
||||
* The DS2482 registers - there are 3 registers that are addressed by a read
|
||||
* pointer. The read pointer is set by the last command executed.
|
||||
|
@ -96,8 +83,6 @@ static const u8 ds2482_chan_rd[8] =
|
|||
|
||||
static int ds2482_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id);
|
||||
static int ds2482_detect(struct i2c_client *client, int kind,
|
||||
struct i2c_board_info *info);
|
||||
static int ds2482_remove(struct i2c_client *client);
|
||||
|
||||
|
||||
|
@ -117,8 +102,6 @@ static struct i2c_driver ds2482_driver = {
|
|||
.probe = ds2482_probe,
|
||||
.remove = ds2482_remove,
|
||||
.id_table = ds2482_id,
|
||||
.detect = ds2482_detect,
|
||||
.address_data = &addr_data,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -425,19 +408,6 @@ static u8 ds2482_w1_reset_bus(void *data)
|
|||
}
|
||||
|
||||
|
||||
static int ds2482_detect(struct i2c_client *client, int kind,
|
||||
struct i2c_board_info *info)
|
||||
{
|
||||
if (!i2c_check_functionality(client->adapter,
|
||||
I2C_FUNC_SMBUS_WRITE_BYTE_DATA |
|
||||
I2C_FUNC_SMBUS_BYTE))
|
||||
return -ENODEV;
|
||||
|
||||
strlcpy(info->type, "ds2482", I2C_NAME_SIZE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ds2482_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
|
@ -446,6 +416,11 @@ static int ds2482_probe(struct i2c_client *client,
|
|||
int temp1;
|
||||
int idx;
|
||||
|
||||
if (!i2c_check_functionality(client->adapter,
|
||||
I2C_FUNC_SMBUS_WRITE_BYTE_DATA |
|
||||
I2C_FUNC_SMBUS_BYTE))
|
||||
return -ENODEV;
|
||||
|
||||
if (!(data = kzalloc(sizeof(struct ds2482_data), GFP_KERNEL))) {
|
||||
err = -ENOMEM;
|
||||
goto exit;
|
||||
|
|
Loading…
Reference in a new issue