Commit ca6f8809 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/gregkh/linux/i2c-2.6

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents dc71d7c6 92b82cd7
......@@ -59,6 +59,7 @@ static int mmapped;
static wait_queue_head_t pcf_wait;
static int pcf_pending;
static spinlock_t lock;
/* ----- local functions ---------------------------------------------- */
......@@ -79,10 +80,10 @@ static void pcf_isa_setbyte(void *data, int ctl, int val)
break;
case 2: /* double mapped I/O needed for UP2000 board,
I don't know why this... */
writeb(val, address);
writeb(val, (void *)address);
/* fall */
case 1: /* memory mapped I/O */
writeb(val, address);
writeb(val, (void *)address);
break;
}
}
......@@ -90,7 +91,7 @@ static void pcf_isa_setbyte(void *data, int ctl, int val)
static int pcf_isa_getbyte(void *data, int ctl)
{
int address = ctl ? (base + 1) : base;
int val = mmapped ? readb(address) : inb(address);
int val = mmapped ? readb((void *)address) : inb(address);
pr_debug("i2c-elektor: Read 0x%X 0x%02X\n", address, val);
......@@ -111,14 +112,24 @@ static int pcf_isa_getclock(void *data)
static void pcf_isa_waitforpin(void) {
int timeout = 2;
long flags;
if (irq > 0) {
cli();
spin_lock_irqsave(&lock, flags);
if (pcf_pending == 0) {
interruptible_sleep_on_timeout(&pcf_wait, timeout*HZ );
} else
spin_unlock_irqrestore(&lock, flags);
if (interruptible_sleep_on_timeout(&pcf_wait,
timeout*HZ)) {
spin_lock_irqsave(&lock, flags);
if (pcf_pending == 1) {
pcf_pending = 0;
}
spin_unlock_irqrestore(&lock, flags);
}
} else {
pcf_pending = 0;
sti();
spin_unlock_irqrestore(&lock, flags);
}
} else {
udelay(100);
}
......@@ -126,7 +137,9 @@ static void pcf_isa_waitforpin(void) {
static irqreturn_t pcf_isa_handler(int this_irq, void *dev_id, struct pt_regs *regs) {
spin_lock(&lock);
pcf_pending = 1;
spin_unlock(&lock);
wake_up_interruptible(&pcf_wait);
return IRQ_HANDLED;
}
......@@ -134,6 +147,7 @@ static irqreturn_t pcf_isa_handler(int this_irq, void *dev_id, struct pt_regs *r
static int pcf_isa_init(void)
{
spin_lock_init(&lock);
if (!mmapped) {
if (!request_region(base, 2, "i2c (isa bus adapter)")) {
printk(KERN_ERR
......
......@@ -62,6 +62,7 @@ static int own;
static struct iic_ite gpi;
static wait_queue_head_t iic_wait;
static int iic_pending;
static spinlock_t lock;
/* ----- local functions ---------------------------------------------- */
......@@ -108,6 +109,7 @@ static int iic_ite_getclock(void *data)
static void iic_ite_waitforpin(void) {
int timeout = 2;
long flags;
/* If interrupts are enabled (which they are), then put the process to
* sleep. This process will be awakened by two events -- either the
......@@ -116,24 +118,36 @@ static void iic_ite_waitforpin(void) {
* of time and return.
*/
if (gpi.iic_irq > 0) {
cli();
spin_lock_irqsave(&lock, flags);
if (iic_pending == 0) {
interruptible_sleep_on_timeout(&iic_wait, timeout*HZ );
} else
spin_unlock_irqrestore(&lock, flags);
if (interruptible_sleep_on_timeout(&iic_wait, timeout*HZ)) {
spin_lock_irqsave(&lock, flags);
if (iic_pending == 1) {
iic_pending = 0;
}
spin_unlock_irqrestore(&lock, flags);
}
} else {
iic_pending = 0;
sti();
spin_unlock_irqrestore(&lock, flags);
}
} else {
udelay(100);
}
}
static void iic_ite_handler(int this_irq, void *dev_id, struct pt_regs *regs)
static irqreturn_t iic_ite_handler(int this_irq, void *dev_id,
struct pt_regs *regs)
{
iic_pending = 1;
spin_lock(&lock);
iic_pending = 1;
spin_unlock(&lock);
wake_up_interruptible(&iic_wait);
wake_up_interruptible(&iic_wait);
return IRQ_HANDLED;
}
......@@ -221,6 +235,7 @@ static int __init iic_ite_init(void)
iic_ite_data.data = (void *)piic;
init_waitqueue_head(&iic_wait);
spin_lock_init(&lock);
if (iic_hw_resrc_init() == 0) {
if (i2c_iic_add_bus(&iic_ite_ops) < 0)
return -ENODEV;
......
......@@ -24,9 +24,10 @@
*/
/*
SUPPORTED DEVICES PCI ID
nForce2 MCP 0064
nForce3 Pro150 MCP 00D4
SUPPORTED DEVICES PCI ID
nForce2 MCP 0064
nForce2 Ultra 400 MCP 0084
nForce3 Pro150 MCP 00D4
This driver supports the 2 SMBuses that are included in the MCP2 of the
nForce2 chipset.
......@@ -291,6 +292,8 @@ static u32 nforce2_func(struct i2c_adapter *adapter)
static struct pci_device_id nforce2_ids[] = {
{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ 0 }
......
......@@ -32,6 +32,15 @@ config SENSORS_ADM1025
This driver can also be built as a module. If so, the module
will be called adm1025.
config SENSORS_ADM1026
tristate "Analog Devices ADM1026 and compatibles"
depends on I2C && EXPERIMENTAL
select I2C_SENSOR
help
If you say yes here you get support for Analog Devices ADM1026
This driver can also be built as a module. If so, the module
will be called adm1026.
config SENSORS_ADM1031
tristate "Analog Devices ADM1031 and compatibles"
depends on I2C && EXPERIMENTAL
......
......@@ -9,6 +9,7 @@ obj-$(CONFIG_SENSORS_W83781D) += w83781d.o
obj-$(CONFIG_SENSORS_ADM1021) += adm1021.o
obj-$(CONFIG_SENSORS_ADM1025) += adm1025.o
obj-$(CONFIG_SENSORS_ADM1026) += adm1026.o
obj-$(CONFIG_SENSORS_ADM1031) += adm1031.o
obj-$(CONFIG_SENSORS_DS1621) += ds1621.o
obj-$(CONFIG_SENSORS_EEPROM) += eeprom.o
......
This diff is collapsed.
......@@ -280,14 +280,17 @@ static u8 w83l785ts_read_value(struct i2c_client *client, u8 reg, u8 defval)
* default value requested by the caller. */
for (i = 1; i <= MAX_RETRIES; i++) {
value = i2c_smbus_read_byte_data(client, reg);
if (value >= 0)
if (value >= 0) {
dev_dbg(&client->dev, "Read 0x%02x from register "
"0x%02x.\n", value, reg);
return value;
}
dev_dbg(&client->dev, "Read failed, will retry in %d.\n", i);
msleep(i);
}
dev_err(&client->dev, "Couldn't read value from register. "
"Please report.\n");
dev_err(&client->dev, "Couldn't read value from register 0x%02x. "
"Please report.\n", reg);
return defval;
}
......
......@@ -170,11 +170,11 @@ detach_thermostat(struct i2c_adapter *adapter)
}
static struct i2c_driver thermostat_driver = {
.name ="Apple Thermostat ADT746x",
.id =0xDEAD7467,
.flags =I2C_DF_NOTIFY,
.attach_adapter =&attach_thermostat,
.detach_adapter =&detach_thermostat,
.owner = THIS_MODULE,
.name = "therm_adt746x",
.flags = I2C_DF_NOTIFY,
.attach_adapter = attach_thermostat,
.detach_adapter = detach_thermostat,
};
static int read_fan_speed(struct thermostat *th, u8 addr)
......@@ -381,7 +381,6 @@ static int attach_one_thermostat(struct i2c_adapter *adapter, int addr,
th->clt.addr = addr;
th->clt.adapter = adapter;
th->clt.driver = &thermostat_driver;
th->clt.id = 0xDEAD7467;
strcpy(th->clt.name, "thermostat");
rc = read_reg(th, 0);
......
......@@ -235,8 +235,8 @@ static int therm_pm72_detach(struct i2c_adapter *adapter);
static struct i2c_driver therm_pm72_driver =
{
.owner = THIS_MODULE,
.name = "therm_pm72",
.id = 0xDEADBEEF,
.flags = I2C_DF_NOTIFY,
.attach_adapter = therm_pm72_attach,
.detach_adapter = therm_pm72_detach,
......@@ -266,7 +266,6 @@ static struct i2c_client *attach_i2c_chip(int id, const char *name)
clt->addr = (id >> 1) & 0x7f;
clt->adapter = adap;
clt->driver = &therm_pm72_driver;
clt->id = 0xDEADBEEF;
strncpy(clt->name, name, I2C_NAME_SIZE-1);
if (i2c_attach_client(clt)) {
......
......@@ -353,12 +353,12 @@ do_detach( struct i2c_client *client )
}
static struct i2c_driver g4fan_driver = {
.name = "Apple G4 Thermostat/Fan",
.owner = THIS_MODULE,
.name = "therm_windtunnel",
.id = I2C_DRIVERID_G4FAN,
.flags = I2C_DF_NOTIFY,
.attach_adapter = &do_attach,
.detach_client = &do_detach,
.command = NULL,
.attach_adapter = do_attach,
.detach_client = do_detach,
};
static int
......
......@@ -30,7 +30,7 @@ config W1_DS9490
This support is also available as a module. If so, the module
will be called ds9490r.ko.
config W1_DS9490R_BRIDGE
config W1_DS9490_BRIDGE
tristate "DS9490R USB <-> W1 transport layer for 1-wire"
depends on W1_DS9490
help
......
......@@ -35,26 +35,26 @@ MODULE_DEVICE_TABLE(usb, ds_id_table);
int ds_probe(struct usb_interface *, const struct usb_device_id *);
void ds_disconnect(struct usb_interface *);
inline int ds_touch_bit(struct ds_device *, u8, u8 *);
inline int ds_read_byte(struct ds_device *, u8 *);
inline int ds_read_bit(struct ds_device *, u8 *);
inline int ds_write_byte(struct ds_device *, u8);
inline int ds_write_bit(struct ds_device *, u8);
inline int ds_start_pulse(struct ds_device *, int);
inline int ds_set_speed(struct ds_device *, int);
inline int ds_reset(struct ds_device *, struct ds_status *);
inline int ds_detect(struct ds_device *, struct ds_status *);
inline int ds_stop_pulse(struct ds_device *, int);
inline int ds_send_data(struct ds_device *, unsigned char *, int);
inline int ds_recv_data(struct ds_device *, unsigned char *, int);
inline int ds_recv_status(struct ds_device *, struct ds_status *);
inline struct ds_device * ds_get_device(void);
inline void ds_put_device(struct ds_device *);
int ds_touch_bit(struct ds_device *, u8, u8 *);
int ds_read_byte(struct ds_device *, u8 *);
int ds_read_bit(struct ds_device *, u8 *);
int ds_write_byte(struct ds_device *, u8);
int ds_write_bit(struct ds_device *, u8);
int ds_start_pulse(struct ds_device *, int);
int ds_set_speed(struct ds_device *, int);
int ds_reset(struct ds_device *, struct ds_status *);
int ds_detect(struct ds_device *, struct ds_status *);
int ds_stop_pulse(struct ds_device *, int);
int ds_send_data(struct ds_device *, unsigned char *, int);
int ds_recv_data(struct ds_device *, unsigned char *, int);
int ds_recv_status(struct ds_device *, struct ds_status *);
struct ds_device * ds_get_device(void);
void ds_put_device(struct ds_device *);
static inline void ds_dump_status(unsigned char *, unsigned char *, int);
static inline int ds_send_control(struct ds_device *, u16, u16);
static inline int ds_send_control_mode(struct ds_device *, u16, u16);
static inline int ds_send_control_cmd(struct ds_device *, u16, u16);
static int ds_send_control(struct ds_device *, u16, u16);
static int ds_send_control_mode(struct ds_device *, u16, u16);
static int ds_send_control_cmd(struct ds_device *, u16, u16);
static struct usb_driver ds_driver = {
......@@ -503,7 +503,7 @@ int ds_read_byte(struct ds_device *dev, u8 *byte)
return 0;
}
inline int ds_read_block(struct ds_device *dev, u8 *buf, int len)
int ds_read_block(struct ds_device *dev, u8 *buf, int len)
{
struct ds_status st;
int err;
......@@ -529,7 +529,7 @@ inline int ds_read_block(struct ds_device *dev, u8 *buf, int len)
return err;
}
inline int ds_write_block(struct ds_device *dev, u8 *buf, int len)
int ds_write_block(struct ds_device *dev, u8 *buf, int len)
{
int err;
struct ds_status st;
......
......@@ -151,23 +151,23 @@ struct ds_status
};
inline int ds_touch_bit(struct ds_device *, u8, u8 *);
inline int ds_read_byte(struct ds_device *, u8 *);
inline int ds_read_bit(struct ds_device *, u8 *);
inline int ds_write_byte(struct ds_device *, u8);
inline int ds_write_bit(struct ds_device *, u8);
inline int ds_start_pulse(struct ds_device *, int);
inline int ds_set_speed(struct ds_device *, int);
inline int ds_reset(struct ds_device *, struct ds_status *);
inline int ds_detect(struct ds_device *, struct ds_status *);
inline int ds_stop_pulse(struct ds_device *, int);
inline int ds_send_data(struct ds_device *, unsigned char *, int);
inline int ds_recv_data(struct ds_device *, unsigned char *, int);
inline int ds_recv_status(struct ds_device *, struct ds_status *);
inline struct ds_device * ds_get_device(void);
inline void ds_put_device(struct ds_device *);
inline int ds_write_block(struct ds_device *, u8 *, int);
inline int ds_read_block(struct ds_device *, u8 *, int);
int ds_touch_bit(struct ds_device *, u8, u8 *);
int ds_read_byte(struct ds_device *, u8 *);
int ds_read_bit(struct ds_device *, u8 *);
int ds_write_byte(struct ds_device *, u8);
int ds_write_bit(struct ds_device *, u8);
int ds_start_pulse(struct ds_device *, int);
int ds_set_speed(struct ds_device *, int);
int ds_reset(struct ds_device *, struct ds_status *);
int ds_detect(struct ds_device *, struct ds_status *);
int ds_stop_pulse(struct ds_device *, int);
int ds_send_data(struct ds_device *, unsigned char *, int);
int ds_recv_data(struct ds_device *, unsigned char *, int);
int ds_recv_status(struct ds_device *, struct ds_status *);
struct ds_device * ds_get_device(void);
void ds_put_device(struct ds_device *);
int ds_write_block(struct ds_device *, u8 *, int);
int ds_read_block(struct ds_device *, u8 *, int);
#endif /* __DSCORE_H */
......@@ -89,17 +89,14 @@ struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
dev->seq = 1;
dev->nls = netlink_kernel_create(NETLINK_NFLOG, NULL);
if (!dev->nls) {
printk(KERN_ERR "Failed to create new netlink socket(%u).\n",
NETLINK_NFLOG);
memset(dev, 0, sizeof(struct w1_master));
kfree(dev);
dev = NULL;
printk(KERN_ERR "Failed to create new netlink socket(%u) for w1 master %s.\n",
NETLINK_NFLOG, dev->dev.bus_id);
}
err = device_register(&dev->dev);
if (err) {
printk(KERN_ERR "Failed to register master device. err=%d\n", err);
if (dev->nls->sk_socket)
if (dev->nls && dev->nls->sk_socket)
sock_release(dev->nls->sk_socket);
memset(dev, 0, sizeof(struct w1_master));
kfree(dev);
......@@ -112,7 +109,7 @@ struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
void w1_free_dev(struct w1_master *dev)
{
device_unregister(&dev->dev);
if (dev->nls->sk_socket)
if (dev->nls && dev->nls->sk_socket)
sock_release(dev->nls->sk_socket);
memset(dev, 0, sizeof(struct w1_master) + sizeof(struct w1_bus_master));
kfree(dev);
......
......@@ -34,6 +34,9 @@ void w1_netlink_send(struct w1_master *dev, struct w1_netlink_msg *msg)
struct w1_netlink_msg *data;
struct nlmsghdr *nlh;
if (!dev->nls)
return;
size = NLMSG_SPACE(sizeof(struct w1_netlink_msg));
skb = alloc_skb(size, GFP_ATOMIC);
......
......@@ -1087,6 +1087,7 @@
#define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065
#define PCI_DEVICE_ID_NVIDIA_NVENET_2 0x0066
#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a
#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS 0x0084
#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE 0x0085
#define PCI_DEVICE_ID_NVIDIA_NVENET_4 0x0086
#define PCI_DEVICE_ID_NVIDIA_NVENET_5 0x008c
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment