mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-11-26 19:44:21 +08:00
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull more i2c updates from Wolfram Sang: "Mostly bugfixes, small but wanted cleanups, and Paul's init.h removal applied" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: rcar: fix NACK error code i2c: update i2c_algorithm documentation i2c: rcar: use devm_clk_get to ensure clock is properly ref-counted i2c: rcar: do not print error if device nacks transfer i2c: rely on driver core when sanitizing devices i2c: delete non-required instances of include <linux/init.h> i2c: acorn: is tristate and should use module.h i2c: piix4: Standardize log messages i2c: piix4: Use different message for AMD Auxiliary SMBus Controller i2c: piix4: Add support for AMD ML and CZ SMBus changes
This commit is contained in:
commit
f7a6ad9fa2
@ -13,7 +13,7 @@ Supported adapters:
|
||||
* AMD SP5100 (SB700 derivative found on some server mainboards)
|
||||
Datasheet: Publicly available at the AMD website
|
||||
http://support.amd.com/us/Embedded_TechDocs/44413.pdf
|
||||
* AMD Hudson-2, CZ
|
||||
* AMD Hudson-2, ML, CZ
|
||||
Datasheet: Not publicly available
|
||||
* Standard Microsystems (SMSC) SLC90E66 (Victory66) southbridge
|
||||
Datasheet: Publicly available at the SMSC website http://www.smsc.com
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/i2c.h>
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-algo-pca.h>
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-algo-pcf.h>
|
||||
|
@ -152,6 +152,7 @@ config I2C_PIIX4
|
||||
ATI SB700/SP5100
|
||||
ATI SB800
|
||||
AMD Hudson-2
|
||||
AMD ML
|
||||
AMD CZ
|
||||
Serverworks OSB4
|
||||
Serverworks CSB5
|
||||
|
@ -12,7 +12,7 @@
|
||||
* On Acorn machines, the following i2c devices are on the bus:
|
||||
* - PCF8583 real time clock & static RAM
|
||||
*/
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-algo-bit.h>
|
||||
#include <linux/io.h>
|
||||
|
@ -58,7 +58,6 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/acpi.h>
|
||||
|
||||
#define ALI1563_MAX_TIMEOUT 500
|
||||
|
@ -65,7 +65,6 @@
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/acpi.h>
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/slab.h>
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/errno.h>
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/stddef.h>
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/fs.h>
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -12,7 +12,6 @@
|
||||
* of this archive for more details.
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include <linux/types.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-algo-bit.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/io.h>
|
||||
#include <asm/hydra.h>
|
||||
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <asm/irq.h>
|
||||
#include <linux/io.h>
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/i2c.h>
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/acpi.h>
|
||||
|
||||
|
@ -62,7 +62,6 @@
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/stddef.h>
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/of_platform.h>
|
||||
|
@ -51,7 +51,6 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/dmi.h>
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <linux/err.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/i2c.h>
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/of.h>
|
||||
|
@ -12,7 +12,6 @@
|
||||
*/
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
@ -22,7 +22,7 @@
|
||||
Intel PIIX4, 440MX
|
||||
Serverworks OSB4, CSB5, CSB6, HT-1000, HT-1100
|
||||
ATI IXP200, IXP300, IXP400, SB600, SB700/SP5100, SB800
|
||||
AMD Hudson-2, CZ
|
||||
AMD Hudson-2, ML, CZ
|
||||
SMSC Victory66
|
||||
|
||||
Note: we assume there can only be one device, with one or more
|
||||
@ -38,7 +38,6 @@
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/dmi.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/io.h>
|
||||
@ -208,16 +207,16 @@ static int piix4_setup(struct pci_dev *PIIX4_dev,
|
||||
"WARNING: SMBus interface has been FORCEFULLY ENABLED!\n");
|
||||
} else {
|
||||
dev_err(&PIIX4_dev->dev,
|
||||
"Host SMBus controller not enabled!\n");
|
||||
"SMBus Host Controller not enabled!\n");
|
||||
release_region(piix4_smba, SMBIOSIZE);
|
||||
return -ENODEV;
|
||||
}
|
||||
}
|
||||
|
||||
if (((temp & 0x0E) == 8) || ((temp & 0x0E) == 2))
|
||||
dev_dbg(&PIIX4_dev->dev, "Using Interrupt 9 for SMBus.\n");
|
||||
dev_dbg(&PIIX4_dev->dev, "Using IRQ for SMBus\n");
|
||||
else if ((temp & 0x0E) == 0)
|
||||
dev_dbg(&PIIX4_dev->dev, "Using Interrupt SMI# for SMBus.\n");
|
||||
dev_dbg(&PIIX4_dev->dev, "Using SMI# for SMBus\n");
|
||||
else
|
||||
dev_err(&PIIX4_dev->dev, "Illegal Interrupt configuration "
|
||||
"(or code out of date)!\n");
|
||||
@ -235,7 +234,8 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
|
||||
{
|
||||
unsigned short piix4_smba;
|
||||
unsigned short smba_idx = 0xcd6;
|
||||
u8 smba_en_lo, smba_en_hi, i2ccfg, i2ccfg_offset = 0x10, smb_en;
|
||||
u8 smba_en_lo, smba_en_hi, smb_en, smb_en_status;
|
||||
u8 i2ccfg, i2ccfg_offset = 0x10;
|
||||
|
||||
/* SB800 and later SMBus does not support forcing address */
|
||||
if (force || force_addr) {
|
||||
@ -245,7 +245,15 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
|
||||
}
|
||||
|
||||
/* Determine the address of the SMBus areas */
|
||||
smb_en = (aux) ? 0x28 : 0x2c;
|
||||
if ((PIIX4_dev->vendor == PCI_VENDOR_ID_AMD &&
|
||||
PIIX4_dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS &&
|
||||
PIIX4_dev->revision >= 0x41) ||
|
||||
(PIIX4_dev->vendor == PCI_VENDOR_ID_AMD &&
|
||||
PIIX4_dev->device == 0x790b &&
|
||||
PIIX4_dev->revision >= 0x49))
|
||||
smb_en = 0x00;
|
||||
else
|
||||
smb_en = (aux) ? 0x28 : 0x2c;
|
||||
|
||||
if (!request_region(smba_idx, 2, "smba_idx")) {
|
||||
dev_err(&PIIX4_dev->dev, "SMBus base address index region "
|
||||
@ -258,13 +266,22 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
|
||||
smba_en_hi = inb_p(smba_idx + 1);
|
||||
release_region(smba_idx, 2);
|
||||
|
||||
if ((smba_en_lo & 1) == 0) {
|
||||
if (!smb_en) {
|
||||
smb_en_status = smba_en_lo & 0x10;
|
||||
piix4_smba = smba_en_hi << 8;
|
||||
if (aux)
|
||||
piix4_smba |= 0x20;
|
||||
} else {
|
||||
smb_en_status = smba_en_lo & 0x01;
|
||||
piix4_smba = ((smba_en_hi << 8) | smba_en_lo) & 0xffe0;
|
||||
}
|
||||
|
||||
if (!smb_en_status) {
|
||||
dev_err(&PIIX4_dev->dev,
|
||||
"Host SMBus controller not enabled!\n");
|
||||
"SMBus Host Controller not enabled!\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
piix4_smba = ((smba_en_hi << 8) | smba_en_lo) & 0xffe0;
|
||||
if (acpi_check_region(piix4_smba, SMBIOSIZE, piix4_driver.name))
|
||||
return -ENODEV;
|
||||
|
||||
@ -277,7 +294,8 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
|
||||
/* Aux SMBus does not support IRQ information */
|
||||
if (aux) {
|
||||
dev_info(&PIIX4_dev->dev,
|
||||
"SMBus Host Controller at 0x%x\n", piix4_smba);
|
||||
"Auxiliary SMBus Host Controller at 0x%x\n",
|
||||
piix4_smba);
|
||||
return piix4_smba;
|
||||
}
|
||||
|
||||
@ -292,9 +310,9 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
|
||||
release_region(piix4_smba + i2ccfg_offset, 1);
|
||||
|
||||
if (i2ccfg & 1)
|
||||
dev_dbg(&PIIX4_dev->dev, "Using IRQ for SMBus.\n");
|
||||
dev_dbg(&PIIX4_dev->dev, "Using IRQ for SMBus\n");
|
||||
else
|
||||
dev_dbg(&PIIX4_dev->dev, "Using SMI# for SMBus.\n");
|
||||
dev_dbg(&PIIX4_dev->dev, "Using SMI# for SMBus\n");
|
||||
|
||||
dev_info(&PIIX4_dev->dev,
|
||||
"SMBus Host Controller at 0x%x, revision %d\n",
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/of_irq.h>
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <linux/types.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/io.h>
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/i2c.h>
|
||||
@ -111,6 +110,7 @@ struct rcar_i2c_priv {
|
||||
void __iomem *io;
|
||||
struct i2c_adapter adap;
|
||||
struct i2c_msg *msg;
|
||||
struct clk *clk;
|
||||
|
||||
spinlock_t lock;
|
||||
wait_queue_head_t wait;
|
||||
@ -227,18 +227,12 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv,
|
||||
u32 bus_speed,
|
||||
struct device *dev)
|
||||
{
|
||||
struct clk *clkp = clk_get(dev, NULL);
|
||||
u32 scgd, cdf;
|
||||
u32 round, ick;
|
||||
u32 scl;
|
||||
u32 cdf_width;
|
||||
unsigned long rate;
|
||||
|
||||
if (IS_ERR(clkp)) {
|
||||
dev_err(dev, "couldn't get clock\n");
|
||||
return PTR_ERR(clkp);
|
||||
}
|
||||
|
||||
switch (priv->devtype) {
|
||||
case I2C_RCAR_GEN1:
|
||||
cdf_width = 2;
|
||||
@ -266,7 +260,7 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv,
|
||||
* clkp : peripheral_clk
|
||||
* F[] : integer up-valuation
|
||||
*/
|
||||
rate = clk_get_rate(clkp);
|
||||
rate = clk_get_rate(priv->clk);
|
||||
cdf = rate / 20000000;
|
||||
if (cdf >= 1 << cdf_width) {
|
||||
dev_err(dev, "Input clock %lu too high\n", rate);
|
||||
@ -308,7 +302,7 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv,
|
||||
|
||||
scgd_find:
|
||||
dev_dbg(dev, "clk %d/%d(%lu), round %u, CDF:0x%x, SCGD: 0x%x\n",
|
||||
scl, bus_speed, clk_get_rate(clkp), round, cdf, scgd);
|
||||
scl, bus_speed, clk_get_rate(priv->clk), round, cdf, scgd);
|
||||
|
||||
/*
|
||||
* keep icccr value
|
||||
@ -604,7 +598,7 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
|
||||
* error handling
|
||||
*/
|
||||
if (rcar_i2c_flags_has(priv, ID_NACK)) {
|
||||
ret = -EREMOTEIO;
|
||||
ret = -ENXIO;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -623,7 +617,7 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
|
||||
|
||||
pm_runtime_put(dev);
|
||||
|
||||
if (ret < 0)
|
||||
if (ret < 0 && ret != -ENXIO)
|
||||
dev_err(dev, "error %d : %x\n", ret, priv->flags);
|
||||
|
||||
return ret;
|
||||
@ -664,6 +658,12 @@ static int rcar_i2c_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
priv->clk = devm_clk_get(dev, NULL);
|
||||
if (IS_ERR(priv->clk)) {
|
||||
dev_err(dev, "cannot get clock\n");
|
||||
return PTR_ERR(priv->clk);
|
||||
}
|
||||
|
||||
bus_speed = 100000; /* default 100 kHz */
|
||||
ret = of_property_read_u32(dev->of_node, "clock-frequency", &bus_speed);
|
||||
if (ret < 0 && pdata && pdata->bus_speed)
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/acpi.h>
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/io.h>
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-algo-bit.h>
|
||||
#include <linux/io.h>
|
||||
|
@ -30,7 +30,6 @@
|
||||
*/
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/errno.h>
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-algo-bit.h>
|
||||
#include <linux/io.h>
|
||||
|
@ -261,10 +261,9 @@ static int i2c_device_probe(struct device *dev)
|
||||
|
||||
acpi_dev_pm_attach(&client->dev, true);
|
||||
status = driver->probe(client, i2c_match_id(driver->id_table, client));
|
||||
if (status) {
|
||||
i2c_set_clientdata(client, NULL);
|
||||
if (status)
|
||||
acpi_dev_pm_detach(&client->dev, true);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -272,7 +271,7 @@ static int i2c_device_remove(struct device *dev)
|
||||
{
|
||||
struct i2c_client *client = i2c_verify_client(dev);
|
||||
struct i2c_driver *driver;
|
||||
int status;
|
||||
int status = 0;
|
||||
|
||||
if (!client || !dev->driver)
|
||||
return 0;
|
||||
@ -281,12 +280,8 @@ static int i2c_device_remove(struct device *dev)
|
||||
if (driver->remove) {
|
||||
dev_dbg(dev, "remove\n");
|
||||
status = driver->remove(client);
|
||||
} else {
|
||||
dev->driver = NULL;
|
||||
status = 0;
|
||||
}
|
||||
if (status == 0)
|
||||
i2c_set_clientdata(client, NULL);
|
||||
|
||||
acpi_dev_pm_detach(&client->dev, true);
|
||||
return status;
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-mux.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <linux/i2c-mux.h>
|
||||
#include <linux/i2c-mux-gpio.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/gpio.h>
|
||||
|
@ -17,7 +17,6 @@
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/slab.h>
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-mux.h>
|
||||
#include <linux/i2c/pca954x.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/slab.h>
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-mux.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/i2c-mux-pinctrl.h>
|
||||
|
@ -342,11 +342,25 @@ i2c_register_board_info(int busnum, struct i2c_board_info const *info,
|
||||
}
|
||||
#endif /* I2C_BOARDINFO */
|
||||
|
||||
/*
|
||||
/**
|
||||
* struct i2c_algorithm - represent I2C transfer method
|
||||
* @master_xfer: Issue a set of i2c transactions to the given I2C adapter
|
||||
* defined by the msgs array, with num messages available to transfer via
|
||||
* the adapter specified by adap.
|
||||
* @smbus_xfer: Issue smbus transactions to the given I2C adapter. If this
|
||||
* is not present, then the bus layer will try and convert the SMBus calls
|
||||
* into I2C transfers instead.
|
||||
* @functionality: Return the flags that this algorithm/adapter pair supports
|
||||
* from the I2C_FUNC_* flags.
|
||||
*
|
||||
* The following structs are for those who like to implement new bus drivers:
|
||||
* i2c_algorithm is the interface to a class of hardware solutions which can
|
||||
* be addressed using the same bus algorithms - i.e. bit-banging or the PCF8584
|
||||
* to name two of the most common.
|
||||
*
|
||||
* The return codes from the @master_xfer field should indicate the type of
|
||||
* error code that occured during the transfer, as documented in the kernel
|
||||
* Documentation file Documentation/i2c/fault-codes.
|
||||
*/
|
||||
struct i2c_algorithm {
|
||||
/* If an adapter algorithm can't do I2C-level access, set master_xfer
|
||||
|
Loading…
Reference in New Issue
Block a user