Commit eea17309 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:
 "I2C has a bunch of driver fixes and a core improvement to make the
  on-going API transition more robust"

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: mediatek: disable zero-length transfers for mt8183
  i2c: iproc: Stop advertising support of SMBUS quick cmd
  MAINTAINERS: i2c mv64xxx: Update documentation path
  i2c: piix4: Fix port selection for AMD Family 16h Model 30h
  i2c: designware: Synchronize IRQs when unregistering slave client
  i2c: i801: Avoid memory leak in check_acpi_smo88xx_device()
  i2c: make i2c_unregister_device() ERR_PTR safe
parents 95381deb abf4923e
...@@ -7513,7 +7513,7 @@ I2C MV64XXX MARVELL AND ALLWINNER DRIVER ...@@ -7513,7 +7513,7 @@ I2C MV64XXX MARVELL AND ALLWINNER DRIVER
M: Gregory CLEMENT <gregory.clement@bootlin.com> M: Gregory CLEMENT <gregory.clement@bootlin.com>
L: linux-i2c@vger.kernel.org L: linux-i2c@vger.kernel.org
S: Maintained S: Maintained
F: Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt F: Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml
F: drivers/i2c/busses/i2c-mv64xxx.c F: drivers/i2c/busses/i2c-mv64xxx.c
I2C OVER PARALLEL PORT I2C OVER PARALLEL PORT
......
...@@ -790,7 +790,10 @@ static int bcm_iproc_i2c_xfer(struct i2c_adapter *adapter, ...@@ -790,7 +790,10 @@ static int bcm_iproc_i2c_xfer(struct i2c_adapter *adapter,
static uint32_t bcm_iproc_i2c_functionality(struct i2c_adapter *adap) static uint32_t bcm_iproc_i2c_functionality(struct i2c_adapter *adap)
{ {
u32 val = I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; u32 val;
/* We do not support the SMBUS Quick command */
val = I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
if (adap->algo->reg_slave) if (adap->algo->reg_slave)
val |= I2C_FUNC_SLAVE; val |= I2C_FUNC_SLAVE;
......
...@@ -94,6 +94,7 @@ static int i2c_dw_unreg_slave(struct i2c_client *slave) ...@@ -94,6 +94,7 @@ static int i2c_dw_unreg_slave(struct i2c_client *slave)
dev->disable_int(dev); dev->disable_int(dev);
dev->disable(dev); dev->disable(dev);
synchronize_irq(dev->irq);
dev->slave = NULL; dev->slave = NULL;
pm_runtime_put(dev->dev); pm_runtime_put(dev->dev);
......
...@@ -1194,19 +1194,28 @@ static acpi_status check_acpi_smo88xx_device(acpi_handle obj_handle, ...@@ -1194,19 +1194,28 @@ static acpi_status check_acpi_smo88xx_device(acpi_handle obj_handle,
int i; int i;
status = acpi_get_object_info(obj_handle, &info); status = acpi_get_object_info(obj_handle, &info);
if (!ACPI_SUCCESS(status) || !(info->valid & ACPI_VALID_HID)) if (ACPI_FAILURE(status))
return AE_OK; return AE_OK;
if (!(info->valid & ACPI_VALID_HID))
goto smo88xx_not_found;
hid = info->hardware_id.string; hid = info->hardware_id.string;
if (!hid) if (!hid)
return AE_OK; goto smo88xx_not_found;
i = match_string(acpi_smo8800_ids, ARRAY_SIZE(acpi_smo8800_ids), hid); i = match_string(acpi_smo8800_ids, ARRAY_SIZE(acpi_smo8800_ids), hid);
if (i < 0) if (i < 0)
return AE_OK; goto smo88xx_not_found;
kfree(info);
*((bool *)return_value) = true; *((bool *)return_value) = true;
return AE_CTRL_TERMINATE; return AE_CTRL_TERMINATE;
smo88xx_not_found:
kfree(info);
return AE_OK;
} }
static bool is_dell_system_with_lis3lv02d(void) static bool is_dell_system_with_lis3lv02d(void)
......
...@@ -234,6 +234,10 @@ static const struct i2c_adapter_quirks mt7622_i2c_quirks = { ...@@ -234,6 +234,10 @@ static const struct i2c_adapter_quirks mt7622_i2c_quirks = {
.max_num_msgs = 255, .max_num_msgs = 255,
}; };
static const struct i2c_adapter_quirks mt8183_i2c_quirks = {
.flags = I2C_AQ_NO_ZERO_LEN,
};
static const struct mtk_i2c_compatible mt2712_compat = { static const struct mtk_i2c_compatible mt2712_compat = {
.regs = mt_i2c_regs_v1, .regs = mt_i2c_regs_v1,
.pmic_i2c = 0, .pmic_i2c = 0,
...@@ -298,6 +302,7 @@ static const struct mtk_i2c_compatible mt8173_compat = { ...@@ -298,6 +302,7 @@ static const struct mtk_i2c_compatible mt8173_compat = {
}; };
static const struct mtk_i2c_compatible mt8183_compat = { static const struct mtk_i2c_compatible mt8183_compat = {
.quirks = &mt8183_i2c_quirks,
.regs = mt_i2c_regs_v2, .regs = mt_i2c_regs_v2,
.pmic_i2c = 0, .pmic_i2c = 0,
.dcm = 0, .dcm = 0,
...@@ -870,6 +875,10 @@ static irqreturn_t mtk_i2c_irq(int irqno, void *dev_id) ...@@ -870,6 +875,10 @@ static irqreturn_t mtk_i2c_irq(int irqno, void *dev_id)
static u32 mtk_i2c_functionality(struct i2c_adapter *adap) static u32 mtk_i2c_functionality(struct i2c_adapter *adap)
{ {
if (adap->quirks->flags & I2C_AQ_NO_ZERO_LEN)
return I2C_FUNC_I2C |
(I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
else
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
} }
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
#define SB800_PIIX4_PORT_IDX_MASK 0x06 #define SB800_PIIX4_PORT_IDX_MASK 0x06
#define SB800_PIIX4_PORT_IDX_SHIFT 1 #define SB800_PIIX4_PORT_IDX_SHIFT 1
/* On kerncz, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */ /* On kerncz and Hudson2, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */
#define SB800_PIIX4_PORT_IDX_KERNCZ 0x02 #define SB800_PIIX4_PORT_IDX_KERNCZ 0x02
#define SB800_PIIX4_PORT_IDX_MASK_KERNCZ 0x18 #define SB800_PIIX4_PORT_IDX_MASK_KERNCZ 0x18
#define SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ 3 #define SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ 3
...@@ -358,18 +358,16 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev, ...@@ -358,18 +358,16 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
/* Find which register is used for port selection */ /* Find which register is used for port selection */
if (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD || if (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD ||
PIIX4_dev->vendor == PCI_VENDOR_ID_HYGON) { PIIX4_dev->vendor == PCI_VENDOR_ID_HYGON) {
switch (PIIX4_dev->device) { if (PIIX4_dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS ||
case PCI_DEVICE_ID_AMD_KERNCZ_SMBUS: (PIIX4_dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS &&
PIIX4_dev->revision >= 0x1F)) {
piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_KERNCZ; piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_KERNCZ;
piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK_KERNCZ; piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK_KERNCZ;
piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ; piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ;
break; } else {
case PCI_DEVICE_ID_AMD_HUDSON2_SMBUS:
default:
piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_ALT; piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_ALT;
piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK; piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK;
piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT; piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT;
break;
} }
} else { } else {
if (!request_muxed_region(SB800_PIIX4_SMB_IDX, 2, if (!request_muxed_region(SB800_PIIX4_SMB_IDX, 2,
......
...@@ -832,7 +832,7 @@ EXPORT_SYMBOL_GPL(i2c_new_device); ...@@ -832,7 +832,7 @@ EXPORT_SYMBOL_GPL(i2c_new_device);
*/ */
void i2c_unregister_device(struct i2c_client *client) void i2c_unregister_device(struct i2c_client *client)
{ {
if (!client) if (IS_ERR_OR_NULL(client))
return; return;
if (client->dev.of_node) { if (client->dev.of_node) {
......
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