Commit 22a44279 authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/i2c-2.6

parents 9f02d6b7 ede7fbdf
......@@ -2,10 +2,10 @@ Kernel driver max6875
=====================
Supported chips:
* Maxim max6874, max6875
Prefixes: 'max6875'
* Maxim MAX6874, MAX6875
Prefix: 'max6875'
Addresses scanned: 0x50, 0x52
Datasheets:
Datasheet:
http://pdfserv.maxim-ic.com/en/ds/MAX6874-MAX6875.pdf
Author: Ben Gardner <bgardner@wabtec.com>
......@@ -23,14 +23,26 @@ Module Parameters
Description
-----------
The MAXIM max6875 is a EEPROM-programmable power-supply sequencer/supervisor.
The Maxim MAX6875 is an EEPROM-programmable power-supply sequencer/supervisor.
It provides timed outputs that can be used as a watchdog, if properly wired.
It also provides 512 bytes of user EEPROM.
At reset, the max6875 reads the configuration eeprom into its configuration
At reset, the MAX6875 reads the configuration EEPROM into its configuration
registers. The chip then begins to operate according to the values in the
registers.
The Maxim MAX6874 is a similar, mostly compatible device, with more intputs
and outputs:
vin gpi vout
MAX6874 6 4 8
MAX6875 4 3 5
MAX6874 chips can have four different addresses (as opposed to only two for
the MAX6875). The additional addresses (0x54 and 0x56) are not probed by
this driver by default, but the probe module parameter can be used if
needed.
See the datasheet for details on how to program the EEPROM.
......
......@@ -14,9 +14,12 @@ C example
=========
So let's say you want to access an i2c adapter from a C program. The
first thing to do is `#include <linux/i2c.h>" and "#include <linux/i2c-dev.h>.
Yes, I know, you should never include kernel header files, but until glibc
knows about i2c, there is not much choice.
first thing to do is "#include <linux/i2c-dev.h>". Please note that
there are two files named "i2c-dev.h" out there, one is distributed
with the Linux kernel and is meant to be included from kernel
driver code, the other one is distributed with lm_sensors and is
meant to be included from user-space programs. You obviously want
the second one here.
Now, you have to decide which adapter you want to access. You should
inspect /sys/class/i2c-dev/ to decide this. Adapter numbers are assigned
......@@ -78,7 +81,7 @@ Full interface description
==========================
The following IOCTLs are defined and fully supported
(see also i2c-dev.h and i2c.h):
(see also i2c-dev.h):
ioctl(file,I2C_SLAVE,long addr)
Change slave address. The address is passed in the 7 lower bits of the
......@@ -97,10 +100,10 @@ ioctl(file,I2C_PEC,long select)
ioctl(file,I2C_FUNCS,unsigned long *funcs)
Gets the adapter functionality and puts it in *funcs.
ioctl(file,I2C_RDWR,struct i2c_ioctl_rdwr_data *msgset)
ioctl(file,I2C_RDWR,struct i2c_rdwr_ioctl_data *msgset)
Do combined read/write transaction without stop in between.
The argument is a pointer to a struct i2c_ioctl_rdwr_data {
The argument is a pointer to a struct i2c_rdwr_ioctl_data {
struct i2c_msg *msgs; /* ptr to array of simple messages */
int nmsgs; /* number of messages to exchange */
......
......@@ -27,7 +27,6 @@ address.
static struct i2c_driver foo_driver = {
.owner = THIS_MODULE,
.name = "Foo version 2.3 driver",
.id = I2C_DRIVERID_FOO, /* from i2c-id.h, optional */
.flags = I2C_DF_NOTIFY,
.attach_adapter = &foo_attach_adapter,
.detach_client = &foo_detach_client,
......@@ -37,12 +36,6 @@ static struct i2c_driver foo_driver = {
The name can be chosen freely, and may be upto 40 characters long. Please
use something descriptive here.
If used, the id should be a unique ID. The range 0xf000 to 0xffff is
reserved for local use, and you can use one of those until you start
distributing the driver, at which time you should contact the i2c authors
to get your own ID(s). Note that most of the time you don't need an ID
at all so you can just omit it.
Don't worry about the flags field; just put I2C_DF_NOTIFY into it. This
means that your driver will be notified when new adapters are found.
This is almost always what you want.
......
......@@ -746,6 +746,8 @@ source "drivers/char/Kconfig"
source "drivers/i2c/Kconfig"
source "drivers/hwmon/Kconfig"
#source "drivers/l3/Kconfig"
source "drivers/misc/Kconfig"
......
......@@ -181,6 +181,8 @@ source "drivers/serial/Kconfig"
source "drivers/i2c/Kconfig"
source "drivers/hwmon/Kconfig"
source "drivers/usb/Kconfig"
endmenu
......
......@@ -649,6 +649,8 @@ source "drivers/input/Kconfig"
source "drivers/i2c/Kconfig"
source "drivers/hwmon/Kconfig"
source "fs/Kconfig"
source "drivers/media/Kconfig"
......
......@@ -44,6 +44,8 @@ source "drivers/i2c/Kconfig"
source "drivers/w1/Kconfig"
source "drivers/hwmon/Kconfig"
source "drivers/misc/Kconfig"
source "drivers/media/Kconfig"
......
......@@ -52,6 +52,7 @@ obj-$(CONFIG_INPUT) += input/
obj-$(CONFIG_I2O) += message/
obj-$(CONFIG_I2C) += i2c/
obj-$(CONFIG_W1) += w1/
obj-$(CONFIG_HWMON) += hwmon/
obj-$(CONFIG_PHONE) += telephony/
obj-$(CONFIG_MD) += md/
obj-$(CONFIG_BT) += bluetooth/
......
This diff is collapsed.
#
# Makefile for sensor chip drivers.
#
# asb100, then w83781d go first, as they can override other drivers' addresses.
obj-$(CONFIG_SENSORS_ASB100) += asb100.o
obj-$(CONFIG_SENSORS_W83627HF) += w83627hf.o
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_ADM9240) += adm9240.o
obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o
obj-$(CONFIG_SENSORS_DS1621) += ds1621.o
obj-$(CONFIG_SENSORS_FSCHER) += fscher.o
obj-$(CONFIG_SENSORS_FSCPOS) += fscpos.o
obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o
obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o
obj-$(CONFIG_SENSORS_IT87) += it87.o
obj-$(CONFIG_SENSORS_LM63) += lm63.o
obj-$(CONFIG_SENSORS_LM75) += lm75.o
obj-$(CONFIG_SENSORS_LM77) += lm77.o
obj-$(CONFIG_SENSORS_LM78) += lm78.o
obj-$(CONFIG_SENSORS_LM80) += lm80.o
obj-$(CONFIG_SENSORS_LM83) += lm83.o
obj-$(CONFIG_SENSORS_LM85) += lm85.o
obj-$(CONFIG_SENSORS_LM87) += lm87.o
obj-$(CONFIG_SENSORS_LM90) += lm90.o
obj-$(CONFIG_SENSORS_LM92) += lm92.o
obj-$(CONFIG_SENSORS_MAX1619) += max1619.o
obj-$(CONFIG_SENSORS_PC87360) += pc87360.o
obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o
obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o
obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o
obj-$(CONFIG_SENSORS_VIA686A) += via686a.o
obj-$(CONFIG_SENSORS_W83627EHF) += w83627ehf.o
obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o
ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
EXTRA_CFLAGS += -DDEBUG
endif
/*
via686a.c - Part of lm_sensors, Linux kernel modules
for hardware monitoring
for hardware monitoring
Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>,
Kyösti Mälkki <kmalkki@cc.hut.fi>,
Kyösti Mälkki <kmalkki@cc.hut.fi>,
Mark Studebaker <mdsxyz123@yahoo.com>,
and Bob Dougherty <bobd@stanford.edu>
(Some conversion-factor data were contributed by Jonathan Teh Soon Yew
......@@ -171,18 +171,18 @@ static inline u8 FAN_TO_REG(long rpm, int div)
/******** TEMP CONVERSIONS (Bob Dougherty) *********/
/* linear fits from HWMon.cpp (Copyright 1998-2000 Jonathan Teh Soon Yew)
if(temp<169)
return double(temp)*0.427-32.08;
return double(temp)*0.427-32.08;
else if(temp>=169 && temp<=202)
return double(temp)*0.582-58.16;
return double(temp)*0.582-58.16;
else
return double(temp)*0.924-127.33;
return double(temp)*0.924-127.33;
A fifth-order polynomial fits the unofficial data (provided by Alex van
Kaam <darkside@chello.nl>) a bit better. It also give more reasonable
numbers on my machine (ie. they agree with what my BIOS tells me).
Here's the fifth-order fit to the 8-bit data:
temp = 1.625093e-10*val^5 - 1.001632e-07*val^4 + 2.457653e-05*val^3 -
2.967619e-03*val^2 + 2.175144e-01*val - 7.090067e+0.
2.967619e-03*val^2 + 2.175144e-01*val - 7.090067e+0.
(2000-10-25- RFD: thanks to Uwe Andersen <uandersen@mayah.com> for
finding my typos in this formula!)
......
......@@ -208,7 +208,7 @@ static int test_bus(struct i2c_algo_iic_data *adap, char *name) {
goto bailout;
}
sdalo(adap);
printk("test_bus:1 scl: %d sda: %d \n",getscl(adap),
printk("test_bus:1 scl: %d sda: %d\n", getscl(adap),
getsda(adap));
if ( 0 != getsda(adap) ) {
printk("test_bus: %s SDA stuck high!\n",name);
......@@ -221,7 +221,7 @@ static int test_bus(struct i2c_algo_iic_data *adap, char *name) {
goto bailout;
}
sdahi(adap);
printk("test_bus:2 scl: %d sda: %d \n",getscl(adap),
printk("test_bus:2 scl: %d sda: %d\n", getscl(adap),
getsda(adap));
if ( 0 == getsda(adap) ) {
printk("test_bus: %s SDA stuck low!\n",name);
......@@ -234,7 +234,7 @@ static int test_bus(struct i2c_algo_iic_data *adap, char *name) {
goto bailout;
}
scllo(adap);
printk("test_bus:3 scl: %d sda: %d \n",getscl(adap),
printk("test_bus:3 scl: %d sda: %d\n", getscl(adap),
getsda(adap));
if ( 0 != getscl(adap) ) {
......@@ -247,7 +247,7 @@ static int test_bus(struct i2c_algo_iic_data *adap, char *name) {
goto bailout;
}
sclhi(adap);
printk("test_bus:4 scl: %d sda: %d \n",getscl(adap),
printk("test_bus:4 scl: %d sda: %d\n", getscl(adap),
getsda(adap));
if ( 0 == getscl(adap) ) {
printk("test_bus: %s SCL stuck low!\n",name);
......
......@@ -194,7 +194,7 @@ static int i801_transaction(void)
/* Make sure the SMBus host is ready to start transmitting */
/* 0x1f = Failed, Bus_Err, Dev_Err, Intr, Host_Busy */
if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) {
dev_dbg(&I801_dev->dev, "SMBus busy (%02x). Resetting... \n",
dev_dbg(&I801_dev->dev, "SMBus busy (%02x). Resetting...\n",
temp);
outb_p(temp, SMBHSTSTS);
if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) {
......@@ -315,7 +315,7 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
}
if (temp & errmask) {
dev_dbg(&I801_dev->dev, "SMBus busy (%02x). "
"Resetting... \n", temp);
"Resetting...\n", temp);
outb_p(temp, SMBHSTSTS);
if (((temp = inb_p(SMBHSTSTS)) & errmask) != 0x00) {
dev_err(&I801_dev->dev,
......
......@@ -243,7 +243,7 @@ static int piix4_transaction(void)
/* Make sure the SMBus host is ready to start transmitting */
if ((temp = inb_p(SMBHSTSTS)) != 0x00) {
dev_dbg(&piix4_adapter.dev, "SMBus busy (%02x). "
"Resetting... \n", temp);
"Resetting...\n", temp);
outb_p(temp, SMBHSTSTS);
if ((temp = inb_p(SMBHSTSTS)) != 0x00) {
dev_err(&piix4_adapter.dev, "Failed! (%02x)\n", temp);
......
......@@ -228,7 +228,7 @@ static int sis5595_transaction(struct i2c_adapter *adap)
/* Make sure the SMBus host is ready to start transmitting */
temp = sis5595_read(SMB_STS_LO) + (sis5595_read(SMB_STS_HI) << 8);
if (temp != 0x00) {
dev_dbg(&adap->dev, "SMBus busy (%04x). Resetting... \n", temp);
dev_dbg(&adap->dev, "SMBus busy (%04x). Resetting...\n", temp);
sis5595_write(SMB_STS_LO, temp & 0xff);
sis5595_write(SMB_STS_HI, temp >> 8);
if ((temp = sis5595_read(SMB_STS_LO) + (sis5595_read(SMB_STS_HI) << 8)) != 0x00) {
......
This diff is collapsed.
#
# Makefile for sensor and "other" I2C chip drivers.
# Makefile for miscellaneous I2C chip drivers.
#
# asb100, then w83781d go first, as they can override other drivers' addresses.
obj-$(CONFIG_SENSORS_ASB100) += asb100.o
obj-$(CONFIG_SENSORS_W83627HF) += w83627hf.o
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_ADM9240) += adm9240.o
obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o
obj-$(CONFIG_SENSORS_DS1337) += ds1337.o
obj-$(CONFIG_SENSORS_DS1374) += ds1374.o
obj-$(CONFIG_SENSORS_DS1621) += ds1621.o
obj-$(CONFIG_SENSORS_EEPROM) += eeprom.o
obj-$(CONFIG_SENSORS_FSCHER) += fscher.o
obj-$(CONFIG_SENSORS_FSCPOS) += fscpos.o
obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o
obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o
obj-$(CONFIG_SENSORS_IT87) += it87.o
obj-$(CONFIG_SENSORS_LM63) += lm63.o
obj-$(CONFIG_SENSORS_LM75) += lm75.o
obj-$(CONFIG_SENSORS_LM77) += lm77.o
obj-$(CONFIG_SENSORS_LM78) += lm78.o
obj-$(CONFIG_SENSORS_LM80) += lm80.o
obj-$(CONFIG_SENSORS_LM83) += lm83.o
obj-$(CONFIG_SENSORS_LM85) += lm85.o
obj-$(CONFIG_SENSORS_LM87) += lm87.o
obj-$(CONFIG_SENSORS_LM90) += lm90.o
obj-$(CONFIG_SENSORS_LM92) += lm92.o
obj-$(CONFIG_SENSORS_MAX1619) += max1619.o
obj-$(CONFIG_SENSORS_MAX6875) += max6875.o
obj-$(CONFIG_SENSORS_M41T00) += m41t00.o
obj-$(CONFIG_SENSORS_PC87360) += pc87360.o
obj-$(CONFIG_SENSORS_PCA9539) += pca9539.o
obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o
obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o
obj-$(CONFIG_SENSORS_RTC8564) += rtc8564.o
obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o
obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o
obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o
obj-$(CONFIG_SENSORS_VIA686A) += via686a.o
obj-$(CONFIG_SENSORS_W83627EHF) += w83627ehf.o
obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o
obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o
obj-$(CONFIG_TPS65010) += tps65010.o
......
......@@ -173,9 +173,6 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind)
| I2C_FUNC_SMBUS_BYTE))
goto exit;
/* OK. For now, we presume we have a valid client. We now create the
client structure, even though we cannot fill it completely yet.
But it allows us to access eeprom_{read,write}_value. */
if (!(data = kmalloc(sizeof(struct eeprom_data), GFP_KERNEL))) {
err = -ENOMEM;
goto exit;
......
......@@ -207,7 +207,7 @@ m41t00_detach(struct i2c_client *client)
int rc;
if ((rc = i2c_detach_client(client)) == 0) {
kfree(i2c_get_clientdata(client));
kfree(client);
tasklet_kill(&m41t00_tasklet);
}
return rc;
......
......@@ -37,7 +37,8 @@
#include <linux/i2c-sensor.h>
/* Addresses to scan */
static unsigned short normal_i2c[] = {0x50, 0x52, I2C_CLIENT_END};
/* No address scanned by default, as this could corrupt standard EEPROMS. */
static unsigned short normal_i2c[] = {I2C_CLIENT_END};
static unsigned int normal_isa[] = {I2C_CLIENT_ISA_END};
/* Insmod parameters */
......@@ -369,6 +370,9 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind)
new_client->driver = &max6875_driver;
new_client->flags = 0;
/* Prevent 24RF08 corruption */
i2c_smbus_write_quick(new_client, 0);
/* Setup the user section */
data->blocks[max6875_eeprom_user].type = max6875_eeprom_user;
data->blocks[max6875_eeprom_user].slices = USER_EEPROM_SLICES;
......
......@@ -18,7 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#undef DEBUG
#include <linux/config.h>
#include <linux/kernel.h>
......@@ -49,11 +48,7 @@
MODULE_DESCRIPTION("TPS6501x Power Management Driver");
MODULE_LICENSE("GPL");
/* only two addresses possible */
#define TPS_BASE 0x48
static unsigned short normal_i2c[] = {
TPS_BASE,
I2C_CLIENT_END };
static unsigned short normal_i2c[] = { 0x48, /* 0x49, */ I2C_CLIENT_END };
static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
I2C_CLIENT_INSMOD;
......@@ -102,7 +97,7 @@ struct tps65010 {
u8 chgstatus, regstatus, chgconf;
u8 nmask1, nmask2;
/* plus four GPIOs, probably used to switch power */
/* not currently tracking GPIO state */
};
#define POWER_POLL_DELAY msecs_to_jiffies(800)
......@@ -135,7 +130,7 @@ static void dbg_regstat(char *buf, size_t len, u8 regstatus)
(regstatus & TPS_REG_COVER) ? " uncover" : "",
(regstatus & TPS_REG_UVLO) ? " UVLO" : "",
(regstatus & TPS_REG_NO_CHG) ? " NO_CHG" : "",
(regstatus & TPS_REG_PG_LD02) ? " ld01_bad" : "",
(regstatus & TPS_REG_PG_LD02) ? " ld02_bad" : "",
(regstatus & TPS_REG_PG_LD01) ? " ld01_bad" : "",
(regstatus & TPS_REG_PG_MAIN) ? " main_bad" : "",
(regstatus & TPS_REG_PG_CORE) ? " core_bad" : "");
......@@ -143,7 +138,7 @@ static void dbg_regstat(char *buf, size_t len, u8 regstatus)
static void dbg_chgconf(int por, char *buf, size_t len, u8 chgconfig)
{
char *hibit;
const char *hibit;
if (por)
hibit = (chgconfig & TPS_CHARGE_POR)
......@@ -295,7 +290,7 @@ static int dbg_show(struct seq_file *s, void *_)
seq_printf(s, "defgpio %02x mask3 %02x\n", value, v2);
for (i = 0; i < 4; i++) {
if (value & (1 << (4 +i)))
if (value & (1 << (4 + i)))
seq_printf(s, " gpio%d-out %s\n", i + 1,
(value & (1 << i)) ? "low" : "hi ");
else
......@@ -481,7 +476,7 @@ static int __exit tps65010_detach_client(struct i2c_client *client)
debugfs_remove(tps->file);
if (i2c_detach_client(client) == 0)
kfree(tps);
the_tps = 0;
the_tps = NULL;
return 0;
}
......@@ -514,7 +509,6 @@ tps65010_probe(struct i2c_adapter *bus, int address, int kind)
INIT_WORK(&tps->work, tps65010_work, tps);
tps->irq = -1;
tps->client.addr = address;
i2c_set_clientdata(&tps->client, tps);
tps->client.adapter = bus;
tps->client.driver = &tps65010_driver;
strlcpy(tps->client.name, DRIVER_NAME, I2C_NAME_SIZE);
......@@ -523,9 +517,7 @@ tps65010_probe(struct i2c_adapter *bus, int address, int kind)
if (status < 0) {
dev_dbg(&bus->dev, "can't attach %s to device %d, err %d\n",
DRIVER_NAME, address, status);
fail1:
kfree(tps);
return 0;
goto fail1;
}
#ifdef CONFIG_ARM
......@@ -535,7 +527,7 @@ fail1:
tps->irq = OMAP_GPIO_IRQ(58);
omap_request_gpio(58);
omap_set_gpio_direction(58, 1);
omap_set_gpio_edge_ctrl(58, OMAP_GPIO_FALLING_EDGE);
set_irq_type(tps->irq, IRQT_FALLING);
}
if (machine_is_omap_osk()) {
tps->model = TPS65010;
......@@ -543,7 +535,7 @@ fail1:
tps->irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1));
omap_request_gpio(OMAP_MPUIO(1));
omap_set_gpio_direction(OMAP_MPUIO(1), 1);
omap_set_gpio_edge_ctrl(OMAP_MPUIO(1), OMAP_GPIO_FALLING_EDGE);
set_irq_type(tps->irq, IRQT_FALLING);
}
if (machine_is_omap_h3()) {
tps->model = TPS65013;
......@@ -633,6 +625,9 @@ fail1:
tps->file = debugfs_create_file(DRIVER_NAME, S_IRUGO, NULL,
tps, DEBUG_FOPS);
return 0;
fail1:
kfree(tps);
return 0;
}
static int __init tps65010_scan_bus(struct i2c_adapter *bus)
......@@ -645,7 +640,6 @@ static int __init tps65010_scan_bus(struct i2c_adapter *bus)
static struct i2c_driver tps65010_driver = {
.owner = THIS_MODULE,
.name = "tps65010",
.id = 888, /* FIXME assign "official" value */
.flags = I2C_DF_NOTIFY,
.attach_adapter = tps65010_scan_bus,
.detach_client = __exit_p(tps65010_detach_client),
......@@ -744,7 +738,7 @@ int tps65010_set_led(unsigned led, unsigned mode)
if (!the_tps)
return -ENODEV;
if(led == LED1)
if (led == LED1)
offs = 0;
else {
offs = 2;
......@@ -753,11 +747,13 @@ int tps65010_set_led(unsigned led, unsigned mode)
down(&the_tps->lock);
dev_dbg (&the_tps->client.dev, "led%i_on 0x%02x\n", led,
i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_ON + offs));
pr_debug("%s: led%i_on 0x%02x\n", DRIVER_NAME, led,
i2c_smbus_read_byte_data(&the_tps->client,
TPS_LED1_ON + offs));
dev_dbg (&the_tps->client.dev, "led%i_per 0x%02x\n", led,
i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_PER + offs));
pr_debug("%s: led%i_per 0x%02x\n", DRIVER_NAME, led,
i2c_smbus_read_byte_data(&the_tps->client,
TPS_LED1_PER + offs));
switch (mode) {
case OFF:
......@@ -773,7 +769,7 @@ int tps65010_set_led(unsigned led, unsigned mode)
led_per = 0x08 | (1 << 7);
break;
default:
printk(KERN_ERR "%s: Wrong mode parameter for tps65010_set_led()\n",
printk(KERN_ERR "%s: Wrong mode parameter for set_led()\n",
DRIVER_NAME);
up(&the_tps->lock);
return -EINVAL;
......@@ -789,7 +785,7 @@ int tps65010_set_led(unsigned led, unsigned mode)
return status;
}
dev_dbg (&the_tps->client.dev, "led%i_on 0x%02x\n", led,
pr_debug("%s: led%i_on 0x%02x\n", DRIVER_NAME, led,
i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_ON + offs));
status = i2c_smbus_write_byte_data(&the_tps->client,
......@@ -802,8 +798,9 @@ int tps65010_set_led(unsigned led, unsigned mode)
return status;
}
dev_dbg (&the_tps->client.dev, "led%i_per 0x%02x\n", led,
i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_PER + offs));
pr_debug("%s: led%i_per 0x%02x\n", DRIVER_NAME, led,
i2c_smbus_read_byte_data(&the_tps->client,
TPS_LED1_PER + offs));
up(&the_tps->lock);
......@@ -874,7 +871,7 @@ int tps65010_set_low_pwr(unsigned mode)
if (status != 0)
printk(KERN_ERR "%s: Failed to write vdcdc1 register\n",
DRIVER_NAME);
DRIVER_NAME);
else
pr_debug("%s: vdcdc1 0x%02x\n", DRIVER_NAME,
i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1));
......@@ -900,14 +897,14 @@ int tps65010_config_vregs1(unsigned value)
down(&the_tps->lock);
pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME,
i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1));
i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1));
status = i2c_smbus_write_byte_data(&the_tps->client,
TPS_VREGS1, value);
if (status != 0)
printk(KERN_ERR "%s: Failed to write vregs1 register\n",
DRIVER_NAME);
DRIVER_NAME);
else
pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME,
i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1));
......@@ -1009,7 +1006,7 @@ static int __init tps_init(void)
msleep(10);
}
#if defined(CONFIG_ARM)
#ifdef CONFIG_ARM
if (machine_is_omap_osk()) {
// FIXME: More should be placed in the initialization code
......
......@@ -156,7 +156,7 @@ int i2c_add_adapter(struct i2c_adapter *adap)
goto out_unlock;
}
res = idr_get_new(&i2c_adapter_idr, NULL, &id);
res = idr_get_new(&i2c_adapter_idr, adap, &id);
if (res < 0) {
if (res == -EAGAIN)
res = -ENOMEM;
......@@ -765,20 +765,15 @@ int i2c_adapter_id(struct i2c_adapter *adap)
struct i2c_adapter* i2c_get_adapter(int id)
{
struct list_head *item;
struct i2c_adapter *adapter;
down(&core_lists);
list_for_each(item,&adapters) {
adapter = list_entry(item, struct i2c_adapter, list);
if (id == adapter->nr &&
try_module_get(adapter->owner)) {
up(&core_lists);
return adapter;
}
}
adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id);
if (adapter && !try_module_get(adapter->owner))
adapter = NULL;
up(&core_lists);
return NULL;
return adapter;
}
void i2c_put_adapter(struct i2c_adapter *adap)
......
......@@ -516,6 +516,7 @@ static void w1_slave_found(unsigned long data, u64 rn)
struct w1_reg_num *tmp;
int family_found = 0;
struct w1_master *dev;
u64 rn_le = cpu_to_le64(rn);
dev = w1_search_master(data);
if (!dev) {
......@@ -544,10 +545,8 @@ static void w1_slave_found(unsigned long data, u64 rn)
slave_count++;
}
rn = cpu_to_le64(rn);
if (slave_count == dev->slave_count &&
rn && ((le64_to_cpu(rn) >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn, 7)) {
rn && ((rn >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn_le, 7)) {
w1_attach_slave_device(dev, tmp);
}
......
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