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-algo-bit: Add pre- and post-xfer hooks at24: Init dynamic bin_attribute structures i2c: Drop configure option I2C_DEBUG_CHIP tsl2550: Move from i2c/chips to misc i2c-i801: Don't use the block buffer for I2C block writes i2c-powermac: Be less verbose in the absence of real errors. i2c-smbus: Use device_lock/device_unlock
This commit is contained in:
commit
bced863599
|
@ -73,7 +73,6 @@ config I2C_SMBUS
|
|||
|
||||
source drivers/i2c/algos/Kconfig
|
||||
source drivers/i2c/busses/Kconfig
|
||||
source drivers/i2c/chips/Kconfig
|
||||
|
||||
config I2C_DEBUG_CORE
|
||||
bool "I2C Core debugging messages"
|
||||
|
@ -98,12 +97,4 @@ config I2C_DEBUG_BUS
|
|||
a problem with I2C support and want to see more of what is going
|
||||
on.
|
||||
|
||||
config I2C_DEBUG_CHIP
|
||||
bool "I2C Chip debugging messages"
|
||||
help
|
||||
Say Y here if you want the I2C chip drivers to produce a bunch of
|
||||
debug messages to the system log. Select this if you are having
|
||||
a problem with I2C support and want to see more of what is going
|
||||
on.
|
||||
|
||||
endif # I2C
|
||||
|
|
|
@ -6,7 +6,7 @@ obj-$(CONFIG_I2C_BOARDINFO) += i2c-boardinfo.o
|
|||
obj-$(CONFIG_I2C) += i2c-core.o
|
||||
obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o
|
||||
obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o
|
||||
obj-y += busses/ chips/ algos/
|
||||
obj-y += algos/ busses/
|
||||
|
||||
ifeq ($(CONFIG_I2C_DEBUG_CORE),y)
|
||||
EXTRA_CFLAGS += -DDEBUG
|
||||
|
|
|
@ -522,6 +522,12 @@ static int bit_xfer(struct i2c_adapter *i2c_adap,
|
|||
int i, ret;
|
||||
unsigned short nak_ok;
|
||||
|
||||
if (adap->pre_xfer) {
|
||||
ret = adap->pre_xfer(i2c_adap);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bit_dbg(3, &i2c_adap->dev, "emitting start condition\n");
|
||||
i2c_start(adap);
|
||||
for (i = 0; i < num; i++) {
|
||||
|
@ -570,6 +576,9 @@ static int bit_xfer(struct i2c_adapter *i2c_adap,
|
|||
bailout:
|
||||
bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n");
|
||||
i2c_stop(adap);
|
||||
|
||||
if (adap->post_xfer)
|
||||
adap->post_xfer(i2c_adap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -416,9 +416,11 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
|
|||
data->block[0] = 32; /* max for SMBus block reads */
|
||||
}
|
||||
|
||||
/* Experience has shown that the block buffer can only be used for
|
||||
SMBus (not I2C) block transactions, even though the datasheet
|
||||
doesn't mention this limitation. */
|
||||
if ((i801_features & FEATURE_BLOCK_BUFFER)
|
||||
&& !(command == I2C_SMBUS_I2C_BLOCK_DATA
|
||||
&& read_write == I2C_SMBUS_READ)
|
||||
&& command != I2C_SMBUS_I2C_BLOCK_DATA
|
||||
&& i801_set_block_buffer_mode() == 0)
|
||||
result = i801_block_transaction_by_block(data, read_write,
|
||||
hwpec);
|
||||
|
|
|
@ -122,9 +122,14 @@ static s32 i2c_powermac_smbus_xfer( struct i2c_adapter* adap,
|
|||
|
||||
rc = pmac_i2c_xfer(bus, addrdir, subsize, subaddr, buf, len);
|
||||
if (rc) {
|
||||
dev_err(&adap->dev,
|
||||
"I2C transfer at 0x%02x failed, size %d, err %d\n",
|
||||
addrdir >> 1, size, rc);
|
||||
if (rc == -ENXIO)
|
||||
dev_dbg(&adap->dev,
|
||||
"I2C transfer at 0x%02x failed, size %d, "
|
||||
"err %d\n", addrdir >> 1, size, rc);
|
||||
else
|
||||
dev_err(&adap->dev,
|
||||
"I2C transfer at 0x%02x failed, size %d, "
|
||||
"err %d\n", addrdir >> 1, size, rc);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
|
@ -175,10 +180,16 @@ static int i2c_powermac_master_xfer( struct i2c_adapter *adap,
|
|||
goto bail;
|
||||
}
|
||||
rc = pmac_i2c_xfer(bus, addrdir, 0, 0, msgs->buf, msgs->len);
|
||||
if (rc < 0)
|
||||
dev_err(&adap->dev, "I2C %s 0x%02x failed, err %d\n",
|
||||
addrdir & 1 ? "read from" : "write to", addrdir >> 1,
|
||||
rc);
|
||||
if (rc < 0) {
|
||||
if (rc == -ENXIO)
|
||||
dev_dbg(&adap->dev, "I2C %s 0x%02x failed, err %d\n",
|
||||
addrdir & 1 ? "read from" : "write to",
|
||||
addrdir >> 1, rc);
|
||||
else
|
||||
dev_err(&adap->dev, "I2C %s 0x%02x failed, err %d\n",
|
||||
addrdir & 1 ? "read from" : "write to",
|
||||
addrdir >> 1, rc);
|
||||
}
|
||||
bail:
|
||||
pmac_i2c_close(bus);
|
||||
return rc < 0 ? rc : 1;
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
#
|
||||
# Miscellaneous I2C chip drivers configuration
|
||||
#
|
||||
# *** DEPRECATED! Do not add new entries! See Makefile ***
|
||||
#
|
||||
|
||||
menu "Miscellaneous I2C Chip support"
|
||||
|
||||
config SENSORS_TSL2550
|
||||
tristate "Taos TSL2550 ambient light sensor"
|
||||
depends on EXPERIMENTAL
|
||||
help
|
||||
If you say yes here you get support for the Taos TSL2550
|
||||
ambient light sensor.
|
||||
|
||||
This driver can also be built as a module. If so, the module
|
||||
will be called tsl2550.
|
||||
|
||||
endmenu
|
|
@ -1,18 +0,0 @@
|
|||
#
|
||||
# Makefile for miscellaneous I2C chip drivers.
|
||||
#
|
||||
# Do not add new drivers to this directory! It is DEPRECATED.
|
||||
#
|
||||
# Device drivers are better grouped according to the functionality they
|
||||
# implement rather than to the bus they are connected to. In particular:
|
||||
# * Hardware monitoring chip drivers go to drivers/hwmon
|
||||
# * RTC chip drivers go to drivers/rtc
|
||||
# * I/O expander drivers go to drivers/gpio
|
||||
#
|
||||
|
||||
obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o
|
||||
|
||||
ifeq ($(CONFIG_I2C_DEBUG_CHIP),y)
|
||||
EXTRA_CFLAGS += -DDEBUG
|
||||
endif
|
||||
|
|
@ -22,7 +22,6 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/semaphore.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/i2c.h>
|
||||
|
@ -55,7 +54,7 @@ static int smbus_do_alert(struct device *dev, void *addrp)
|
|||
* Drivers should either disable alerts, or provide at least
|
||||
* a minimal handler. Lock so client->driver won't change.
|
||||
*/
|
||||
down(&dev->sem);
|
||||
device_lock(dev);
|
||||
if (client->driver) {
|
||||
if (client->driver->alert)
|
||||
client->driver->alert(client, data->flag);
|
||||
|
@ -63,7 +62,7 @@ static int smbus_do_alert(struct device *dev, void *addrp)
|
|||
dev_warn(&client->dev, "no driver alert()!\n");
|
||||
} else
|
||||
dev_dbg(&client->dev, "alert with no driver\n");
|
||||
up(&dev->sem);
|
||||
device_unlock(dev);
|
||||
|
||||
/* Stop iterating after we find the device */
|
||||
return -EBUSY;
|
||||
|
|
|
@ -268,6 +268,16 @@ config ISL29003
|
|||
This driver can also be built as a module. If so, the module
|
||||
will be called isl29003.
|
||||
|
||||
config SENSORS_TSL2550
|
||||
tristate "Taos TSL2550 ambient light sensor"
|
||||
depends on I2C && SYSFS
|
||||
help
|
||||
If you say yes here you get support for the Taos TSL2550
|
||||
ambient light sensor.
|
||||
|
||||
This driver can also be built as a module. If so, the module
|
||||
will be called tsl2550.
|
||||
|
||||
config EP93XX_PWM
|
||||
tristate "EP93xx PWM support"
|
||||
depends on ARCH_EP93XX
|
||||
|
|
|
@ -21,6 +21,7 @@ obj-$(CONFIG_SGI_GRU) += sgi-gru/
|
|||
obj-$(CONFIG_CS5535_MFGPT) += cs5535-mfgpt.o
|
||||
obj-$(CONFIG_HP_ILO) += hpilo.o
|
||||
obj-$(CONFIG_ISL29003) += isl29003.o
|
||||
obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o
|
||||
obj-$(CONFIG_EP93XX_PWM) += ep93xx_pwm.o
|
||||
obj-$(CONFIG_DS1682) += ds1682.o
|
||||
obj-$(CONFIG_TI_DAC7512) += ti_dac7512.o
|
||||
|
|
|
@ -505,6 +505,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
|||
* Export the EEPROM bytes through sysfs, since that's convenient.
|
||||
* By default, only root should see the data (maybe passwords etc)
|
||||
*/
|
||||
sysfs_bin_attr_init(&at24->bin);
|
||||
at24->bin.attr.name = "eeprom";
|
||||
at24->bin.attr.mode = chip.flags & AT24_FLAG_IRUGO ? S_IRUGO : S_IRUSR;
|
||||
at24->bin.read = at24_bin_read;
|
||||
|
|
|
@ -47,8 +47,8 @@ struct tsl2550_data {
|
|||
struct i2c_client *client;
|
||||
struct mutex update_lock;
|
||||
|
||||
unsigned int power_state : 1;
|
||||
unsigned int operating_mode : 1;
|
||||
unsigned int power_state:1;
|
||||
unsigned int operating_mode:1;
|
||||
};
|
||||
|
||||
/*
|
|
@ -36,6 +36,8 @@ struct i2c_algo_bit_data {
|
|||
void (*setscl) (void *data, int state);
|
||||
int (*getsda) (void *data);
|
||||
int (*getscl) (void *data);
|
||||
int (*pre_xfer) (struct i2c_adapter *);
|
||||
void (*post_xfer) (struct i2c_adapter *);
|
||||
|
||||
/* local settings */
|
||||
int udelay; /* half clock cycle time in us,
|
||||
|
|
Loading…
Reference in New Issue