Commit 6b0cb4ee authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging

Pull i2c subsystem fixes from Jean Delvare.

* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  i2c-i801: Fix comment
  i2c-i801: Simplify dependency towards GPIOLIB
  i2c-stub: Move to drivers/i2c
parents 8f0d8163 28901f57
...@@ -8,6 +8,7 @@ obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o ...@@ -8,6 +8,7 @@ obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o
obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o
obj-$(CONFIG_I2C_MUX) += i2c-mux.o obj-$(CONFIG_I2C_MUX) += i2c-mux.o
obj-y += algos/ busses/ muxes/ obj-y += algos/ busses/ muxes/
obj-$(CONFIG_I2C_STUB) += i2c-stub.o
ccflags-$(CONFIG_I2C_DEBUG_CORE) := -DDEBUG ccflags-$(CONFIG_I2C_DEBUG_CORE) := -DDEBUG
CFLAGS_i2c-core.o := -Wno-deprecated-declarations CFLAGS_i2c-core.o := -Wno-deprecated-declarations
...@@ -81,7 +81,6 @@ config I2C_I801 ...@@ -81,7 +81,6 @@ config I2C_I801
tristate "Intel 82801 (ICH/PCH)" tristate "Intel 82801 (ICH/PCH)"
depends on PCI depends on PCI
select CHECK_SIGNATURE if X86 && DMI select CHECK_SIGNATURE if X86 && DMI
select GPIOLIB if I2C_MUX
help help
If you say yes to this option, support will be included for the Intel If you say yes to this option, support will be included for the Intel
801 family of mainboard I2C interfaces. Specifically, the following 801 family of mainboard I2C interfaces. Specifically, the following
......
...@@ -85,7 +85,6 @@ obj-$(CONFIG_I2C_ACORN) += i2c-acorn.o ...@@ -85,7 +85,6 @@ obj-$(CONFIG_I2C_ACORN) += i2c-acorn.o
obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o
obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o
obj-$(CONFIG_I2C_SIBYTE) += i2c-sibyte.o obj-$(CONFIG_I2C_SIBYTE) += i2c-sibyte.o
obj-$(CONFIG_I2C_STUB) += i2c-stub.o
obj-$(CONFIG_SCx200_ACB) += scx200_acb.o obj-$(CONFIG_SCx200_ACB) += scx200_acb.o
obj-$(CONFIG_SCx200_I2C) += scx200_i2c.o obj-$(CONFIG_SCx200_I2C) += scx200_i2c.o
......
...@@ -82,7 +82,8 @@ ...@@ -82,7 +82,8 @@
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/err.h> #include <linux/err.h>
#if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE #if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \
defined CONFIG_DMI
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/i2c-mux-gpio.h> #include <linux/i2c-mux-gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -192,7 +193,8 @@ struct i801_priv { ...@@ -192,7 +193,8 @@ struct i801_priv {
int len; int len;
u8 *data; u8 *data;
#if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE #if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \
defined CONFIG_DMI
const struct i801_mux_config *mux_drvdata; const struct i801_mux_config *mux_drvdata;
struct platform_device *mux_pdev; struct platform_device *mux_pdev;
#endif #endif
...@@ -921,7 +923,8 @@ static void __init input_apanel_init(void) {} ...@@ -921,7 +923,8 @@ static void __init input_apanel_init(void) {}
static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) {} static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) {}
#endif /* CONFIG_X86 && CONFIG_DMI */ #endif /* CONFIG_X86 && CONFIG_DMI */
#if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE #if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \
defined CONFIG_DMI
static struct i801_mux_config i801_mux_config_asus_z8_d12 = { static struct i801_mux_config i801_mux_config_asus_z8_d12 = {
.gpio_chip = "gpio_ich", .gpio_chip = "gpio_ich",
.values = { 0x02, 0x03 }, .values = { 0x02, 0x03 },
...@@ -1059,7 +1062,7 @@ static unsigned int __devinit i801_get_adapter_class(struct i801_priv *priv) ...@@ -1059,7 +1062,7 @@ static unsigned int __devinit i801_get_adapter_class(struct i801_priv *priv)
id = dmi_first_match(mux_dmi_table); id = dmi_first_match(mux_dmi_table);
if (id) { if (id) {
/* Remove from branch classes from trunk */ /* Remove branch classes from trunk */
mux_config = id->driver_data; mux_config = id->driver_data;
for (i = 0; i < mux_config->n_values; i++) for (i = 0; i < mux_config->n_values; i++)
class &= ~mux_config->classes[i]; class &= ~mux_config->classes[i];
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
i2c-stub.c - I2C/SMBus chip emulator i2c-stub.c - I2C/SMBus chip emulator
Copyright (c) 2004 Mark M. Hoffman <mhoffman@lightlink.com> Copyright (c) 2004 Mark M. Hoffman <mhoffman@lightlink.com>
Copyright (C) 2007 Jean Delvare <khali@linux-fr.org> Copyright (C) 2007, 2012 Jean Delvare <khali@linux-fr.org>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -51,8 +51,8 @@ struct stub_chip { ...@@ -51,8 +51,8 @@ struct stub_chip {
static struct stub_chip *stub_chips; static struct stub_chip *stub_chips;
/* Return negative errno on error. */ /* Return negative errno on error. */
static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, static s32 stub_xfer(struct i2c_adapter *adap, u16 addr, unsigned short flags,
char read_write, u8 command, int size, union i2c_smbus_data * data) char read_write, u8 command, int size, union i2c_smbus_data *data)
{ {
s32 ret; s32 ret;
int i, len; int i, len;
...@@ -78,13 +78,13 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, ...@@ -78,13 +78,13 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags,
case I2C_SMBUS_BYTE: case I2C_SMBUS_BYTE:
if (read_write == I2C_SMBUS_WRITE) { if (read_write == I2C_SMBUS_WRITE) {
chip->pointer = command; chip->pointer = command;
dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, " dev_dbg(&adap->dev,
"wrote 0x%02x.\n", "smbus byte - addr 0x%02x, wrote 0x%02x.\n",
addr, command); addr, command);
} else { } else {
data->byte = chip->words[chip->pointer++] & 0xff; data->byte = chip->words[chip->pointer++] & 0xff;
dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, " dev_dbg(&adap->dev,
"read 0x%02x.\n", "smbus byte - addr 0x%02x, read 0x%02x.\n",
addr, data->byte); addr, data->byte);
} }
...@@ -95,13 +95,13 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, ...@@ -95,13 +95,13 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags,
if (read_write == I2C_SMBUS_WRITE) { if (read_write == I2C_SMBUS_WRITE) {
chip->words[command] &= 0xff00; chip->words[command] &= 0xff00;
chip->words[command] |= data->byte; chip->words[command] |= data->byte;
dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, " dev_dbg(&adap->dev,
"wrote 0x%02x at 0x%02x.\n", "smbus byte data - addr 0x%02x, wrote 0x%02x at 0x%02x.\n",
addr, data->byte, command); addr, data->byte, command);
} else { } else {
data->byte = chip->words[command] & 0xff; data->byte = chip->words[command] & 0xff;
dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, " dev_dbg(&adap->dev,
"read 0x%02x at 0x%02x.\n", "smbus byte data - addr 0x%02x, read 0x%02x at 0x%02x.\n",
addr, data->byte, command); addr, data->byte, command);
} }
chip->pointer = command + 1; chip->pointer = command + 1;
...@@ -112,13 +112,13 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, ...@@ -112,13 +112,13 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags,
case I2C_SMBUS_WORD_DATA: case I2C_SMBUS_WORD_DATA:
if (read_write == I2C_SMBUS_WRITE) { if (read_write == I2C_SMBUS_WRITE) {
chip->words[command] = data->word; chip->words[command] = data->word;
dev_dbg(&adap->dev, "smbus word data - addr 0x%02x, " dev_dbg(&adap->dev,
"wrote 0x%04x at 0x%02x.\n", "smbus word data - addr 0x%02x, wrote 0x%04x at 0x%02x.\n",
addr, data->word, command); addr, data->word, command);
} else { } else {
data->word = chip->words[command]; data->word = chip->words[command];
dev_dbg(&adap->dev, "smbus word data - addr 0x%02x, " dev_dbg(&adap->dev,
"read 0x%04x at 0x%02x.\n", "smbus word data - addr 0x%02x, read 0x%04x at 0x%02x.\n",
addr, data->word, command); addr, data->word, command);
} }
...@@ -132,16 +132,16 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, ...@@ -132,16 +132,16 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags,
chip->words[command + i] &= 0xff00; chip->words[command + i] &= 0xff00;
chip->words[command + i] |= data->block[1 + i]; chip->words[command + i] |= data->block[1 + i];
} }
dev_dbg(&adap->dev, "i2c block data - addr 0x%02x, " dev_dbg(&adap->dev,
"wrote %d bytes at 0x%02x.\n", "i2c block data - addr 0x%02x, wrote %d bytes at 0x%02x.\n",
addr, len, command); addr, len, command);
} else { } else {
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
data->block[1 + i] = data->block[1 + i] =
chip->words[command + i] & 0xff; chip->words[command + i] & 0xff;
} }
dev_dbg(&adap->dev, "i2c block data - addr 0x%02x, " dev_dbg(&adap->dev,
"read %d bytes at 0x%02x.\n", "i2c block data - addr 0x%02x, read %d bytes at 0x%02x.\n",
addr, len, command); addr, len, command);
} }
...@@ -179,25 +179,24 @@ static int __init i2c_stub_init(void) ...@@ -179,25 +179,24 @@ static int __init i2c_stub_init(void)
int i, ret; int i, ret;
if (!chip_addr[0]) { if (!chip_addr[0]) {
printk(KERN_ERR "i2c-stub: Please specify a chip address\n"); pr_err("i2c-stub: Please specify a chip address\n");
return -ENODEV; return -ENODEV;
} }
for (i = 0; i < MAX_CHIPS && chip_addr[i]; i++) { for (i = 0; i < MAX_CHIPS && chip_addr[i]; i++) {
if (chip_addr[i] < 0x03 || chip_addr[i] > 0x77) { if (chip_addr[i] < 0x03 || chip_addr[i] > 0x77) {
printk(KERN_ERR "i2c-stub: Invalid chip address " pr_err("i2c-stub: Invalid chip address 0x%02x\n",
"0x%02x\n", chip_addr[i]); chip_addr[i]);
return -EINVAL; return -EINVAL;
} }
printk(KERN_INFO "i2c-stub: Virtual chip at 0x%02x\n", pr_info("i2c-stub: Virtual chip at 0x%02x\n", chip_addr[i]);
chip_addr[i]);
} }
/* Allocate memory for all chips at once */ /* Allocate memory for all chips at once */
stub_chips = kzalloc(i * sizeof(struct stub_chip), GFP_KERNEL); stub_chips = kzalloc(i * sizeof(struct stub_chip), GFP_KERNEL);
if (!stub_chips) { if (!stub_chips) {
printk(KERN_ERR "i2c-stub: Out of memory\n"); pr_err("i2c-stub: Out of memory\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -219,4 +218,3 @@ MODULE_LICENSE("GPL"); ...@@ -219,4 +218,3 @@ MODULE_LICENSE("GPL");
module_init(i2c_stub_init); module_init(i2c_stub_init);
module_exit(i2c_stub_exit); module_exit(i2c_stub_exit);
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