Commit 77834854 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
 "The usual driver fixes and documentation updates"

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: mlxcpld: check correct size of maximum RECV_LEN packet
  i2c: add Kconfig help text for slave mode
  i2c: slave-eeprom: update documentation
  i2c: eg20t: Load module automatically if ID matches
  i2c: designware: platdrv: Set class based on DMI
  i2c: algo-pca: Add 0x78 as SCL stuck low status for PCA9665
parents 45a5ac7a 59791128
============================== ==============================
Linux I2C slave eeprom backend Linux I2C slave EEPROM backend
============================== ==============================
by Wolfram Sang <wsa@sang-engineering.com> in 2014-15 by Wolfram Sang <wsa@sang-engineering.com> in 2014-20
This is a proof-of-concept backend which acts like an EEPROM on the connected This backend simulates an EEPROM on the connected I2C bus. Its memory contents
I2C bus. The memory contents can be modified from userspace via this file can be accessed from userspace via this file located in sysfs::
located in sysfs::
/sys/bus/i2c/devices/<device-directory>/slave-eeprom /sys/bus/i2c/devices/<device-directory>/slave-eeprom
The following types are available: 24c02, 24c32, 24c64, and 24c512. Read-only
variants are also supported. The name needed for instantiating has the form
'slave-<type>[ro]'. Examples follow:
24c02, read/write, address 0x64:
# echo slave-24c02 0x1064 > /sys/bus/i2c/devices/i2c-1/new_device
24c512, read-only, address 0x42:
# echo slave-24c512ro 0x1042 > /sys/bus/i2c/devices/i2c-1/new_device
You can also preload data during boot if a device-property named
'firmware-name' contains a valid filename (DT or ACPI only).
As of 2015, Linux doesn't support poll on binary sysfs files, so there is no As of 2015, Linux doesn't support poll on binary sysfs files, so there is no
notification when another master changed the content. notification when another master changed the content.
...@@ -113,11 +113,18 @@ config I2C_STUB ...@@ -113,11 +113,18 @@ config I2C_STUB
config I2C_SLAVE config I2C_SLAVE
bool "I2C slave support" bool "I2C slave support"
help
This enables Linux to act as an I2C slave device. Note that your I2C
bus master driver also needs to support this functionality. Please
read Documentation/i2c/slave-interface.rst for further details.
if I2C_SLAVE if I2C_SLAVE
config I2C_SLAVE_EEPROM config I2C_SLAVE_EEPROM
tristate "I2C eeprom slave driver" tristate "I2C eeprom slave driver"
help
This backend makes Linux behave like an I2C EEPROM. Please read
Documentation/i2c/slave-eeprom-backend.rst for further details.
endif endif
......
...@@ -314,7 +314,8 @@ static int pca_xfer(struct i2c_adapter *i2c_adap, ...@@ -314,7 +314,8 @@ static int pca_xfer(struct i2c_adapter *i2c_adap,
DEB2("BUS ERROR - SDA Stuck low\n"); DEB2("BUS ERROR - SDA Stuck low\n");
pca_reset(adap); pca_reset(adap);
goto out; goto out;
case 0x90: /* Bus error - SCL stuck low */ case 0x78: /* Bus error - SCL stuck low (PCA9665) */
case 0x90: /* Bus error - SCL stuck low (PCA9564) */
DEB2("BUS ERROR - SCL Stuck low\n"); DEB2("BUS ERROR - SCL Stuck low\n");
pca_reset(adap); pca_reset(adap);
goto out; goto out;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/dmi.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/i2c.h> #include <linux/i2c.h>
...@@ -191,6 +192,17 @@ static int dw_i2c_plat_request_regs(struct dw_i2c_dev *dev) ...@@ -191,6 +192,17 @@ static int dw_i2c_plat_request_regs(struct dw_i2c_dev *dev)
return ret; return ret;
} }
static const struct dmi_system_id dw_i2c_hwmon_class_dmi[] = {
{
.ident = "Qtechnology QT5222",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Qtechnology"),
DMI_MATCH(DMI_PRODUCT_NAME, "QT5222"),
},
},
{ } /* terminate list */
};
static int dw_i2c_plat_probe(struct platform_device *pdev) static int dw_i2c_plat_probe(struct platform_device *pdev)
{ {
struct dw_i2c_platform_data *pdata = dev_get_platdata(&pdev->dev); struct dw_i2c_platform_data *pdata = dev_get_platdata(&pdev->dev);
...@@ -267,7 +279,8 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) ...@@ -267,7 +279,8 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
adap = &dev->adapter; adap = &dev->adapter;
adap->owner = THIS_MODULE; adap->owner = THIS_MODULE;
adap->class = I2C_CLASS_DEPRECATED; adap->class = dmi_check_system(dw_i2c_hwmon_class_dmi) ?
I2C_CLASS_HWMON : I2C_CLASS_DEPRECATED;
ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev)); ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev));
adap->dev.of_node = pdev->dev.of_node; adap->dev.of_node = pdev->dev.of_node;
adap->nr = -1; adap->nr = -1;
......
...@@ -180,6 +180,7 @@ static const struct pci_device_id pch_pcidev_id[] = { ...@@ -180,6 +180,7 @@ static const struct pci_device_id pch_pcidev_id[] = {
{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7831_I2C), 1, }, { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7831_I2C), 1, },
{0,} {0,}
}; };
MODULE_DEVICE_TABLE(pci, pch_pcidev_id);
static irqreturn_t pch_i2c_handler(int irq, void *pData); static irqreturn_t pch_i2c_handler(int irq, void *pData);
......
...@@ -337,9 +337,9 @@ static int mlxcpld_i2c_wait_for_tc(struct mlxcpld_i2c_priv *priv) ...@@ -337,9 +337,9 @@ static int mlxcpld_i2c_wait_for_tc(struct mlxcpld_i2c_priv *priv)
if (priv->smbus_block && (val & MLXCPLD_I2C_SMBUS_BLK_BIT)) { if (priv->smbus_block && (val & MLXCPLD_I2C_SMBUS_BLK_BIT)) {
mlxcpld_i2c_read_comm(priv, MLXCPLD_LPCI2C_NUM_DAT_REG, mlxcpld_i2c_read_comm(priv, MLXCPLD_LPCI2C_NUM_DAT_REG,
&datalen, 1); &datalen, 1);
if (unlikely(datalen > (I2C_SMBUS_BLOCK_MAX + 1))) { if (unlikely(datalen > I2C_SMBUS_BLOCK_MAX)) {
dev_err(priv->dev, "Incorrect smbus block read message len\n"); dev_err(priv->dev, "Incorrect smbus block read message len\n");
return -E2BIG; return -EPROTO;
} }
} else { } else {
datalen = priv->xfer.data_len; datalen = priv->xfer.data_len;
......
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