Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull i2c fixes from Wolfram Sang:

- a bigger fix for i801 to finally be able to be loaded on some
machines again

- smaller driver fixes

- documentation update because of a renamed file

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
i2c: mux: reg: Provide of_match_table
i2c: mux: refer to i2c-mux.txt
i2c: octeon: Avoid printk after too long SMBUS message
i2c: octeon: Missing AAK flag in case of I2C_M_RECV_LEN
i2c: i801: Allow ACPI SystemIO OpRegion to conflict with PCI BAR

+119 -21
+2 -2
Documentation/devicetree/bindings/i2c/i2c-arb-gpio-challenge.txt
··· 44 44 - our-claim-gpio: The GPIO that we use to claim the bus. 45 45 - their-claim-gpios: The GPIOs that the other sides use to claim the bus. 46 46 Note that some implementations may only support a single other master. 47 - - Standard I2C mux properties. See mux.txt in this directory. 48 - - Single I2C child bus node at reg 0. See mux.txt in this directory. 47 + - Standard I2C mux properties. See i2c-mux.txt in this directory. 48 + - Single I2C child bus node at reg 0. See i2c-mux.txt in this directory. 49 49 50 50 Optional properties: 51 51 - slew-delay-us: microseconds to wait for a GPIO to go high. Default is 10 us.
+2 -1
Documentation/devicetree/bindings/i2c/i2c-demux-pinctrl.txt
··· 27 27 - i2c-bus-name: The name of this bus. Also needed as pinctrl-name for the I2C 28 28 parents. 29 29 30 - Furthermore, I2C mux properties and child nodes. See mux.txt in this directory. 30 + Furthermore, I2C mux properties and child nodes. See i2c-mux.txt in this 31 + directory. 31 32 32 33 Example: 33 34
+3 -3
Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
··· 22 22 - i2c-parent: The phandle of the I2C bus that this multiplexer's master-side 23 23 port is connected to. 24 24 - mux-gpios: list of gpios used to control the muxer 25 - * Standard I2C mux properties. See mux.txt in this directory. 26 - * I2C child bus nodes. See mux.txt in this directory. 25 + * Standard I2C mux properties. See i2c-mux.txt in this directory. 26 + * I2C child bus nodes. See i2c-mux.txt in this directory. 27 27 28 28 Optional properties: 29 29 - idle-state: value to set the muxer to when idle. When no value is ··· 33 33 be numbered based on their order in the device tree. 34 34 35 35 Whenever an access is made to a device on a child bus, the value set 36 - in the revelant node's reg property will be output using the list of 36 + in the relevant node's reg property will be output using the list of 37 37 GPIOs, the first in the list holding the least-significant value. 38 38 39 39 If an idle state is defined, using the idle-state (optional) property,
+2 -2
Documentation/devicetree/bindings/i2c/i2c-mux-pinctrl.txt
··· 28 28 * Standard pinctrl properties that specify the pin mux state for each child 29 29 bus. See ../pinctrl/pinctrl-bindings.txt. 30 30 31 - * Standard I2C mux properties. See mux.txt in this directory. 31 + * Standard I2C mux properties. See i2c-mux.txt in this directory. 32 32 33 - * I2C child bus nodes. See mux.txt in this directory. 33 + * I2C child bus nodes. See i2c-mux.txt in this directory. 34 34 35 35 For each named state defined in the pinctrl-names property, an I2C child bus 36 36 will be created. I2C child bus numbers are assigned based on the index into
+3 -3
Documentation/devicetree/bindings/i2c/i2c-mux-reg.txt
··· 7 7 - compatible: i2c-mux-reg 8 8 - i2c-parent: The phandle of the I2C bus that this multiplexer's master-side 9 9 port is connected to. 10 - * Standard I2C mux properties. See mux.txt in this directory. 11 - * I2C child bus nodes. See mux.txt in this directory. 10 + * Standard I2C mux properties. See i2c-mux.txt in this directory. 11 + * I2C child bus nodes. See i2c-mux.txt in this directory. 12 12 13 13 Optional properties: 14 14 - reg: this pair of <offset size> specifies the register to control the mux. ··· 24 24 given, it defaults to the last value used. 25 25 26 26 Whenever an access is made to a device on a child bus, the value set 27 - in the revelant node's reg property will be output to the register. 27 + in the relevant node's reg property will be output to the register. 28 28 29 29 If an idle state is defined, using the idle-state (optional) property, 30 30 whenever an access is not being made to a device on a child bus, the
+96 -3
drivers/i2c/busses/i2c-i801.c
··· 245 245 struct platform_device *mux_pdev; 246 246 #endif 247 247 struct platform_device *tco_pdev; 248 + 249 + /* 250 + * If set to true the host controller registers are reserved for 251 + * ACPI AML use. Protected by acpi_lock. 252 + */ 253 + bool acpi_reserved; 254 + struct mutex acpi_lock; 248 255 }; 249 256 250 257 #define FEATURE_SMBUS_PEC (1 << 0) ··· 725 718 int ret = 0, xact = 0; 726 719 struct i801_priv *priv = i2c_get_adapdata(adap); 727 720 721 + mutex_lock(&priv->acpi_lock); 722 + if (priv->acpi_reserved) { 723 + mutex_unlock(&priv->acpi_lock); 724 + return -EBUSY; 725 + } 726 + 728 727 pm_runtime_get_sync(&priv->pci_dev->dev); 729 728 730 729 hwpec = (priv->features & FEATURE_SMBUS_PEC) && (flags & I2C_CLIENT_PEC) ··· 833 820 out: 834 821 pm_runtime_mark_last_busy(&priv->pci_dev->dev); 835 822 pm_runtime_put_autosuspend(&priv->pci_dev->dev); 823 + mutex_unlock(&priv->acpi_lock); 836 824 return ret; 837 825 } 838 826 ··· 1271 1257 priv->tco_pdev = pdev; 1272 1258 } 1273 1259 1260 + #ifdef CONFIG_ACPI 1261 + static acpi_status 1262 + i801_acpi_io_handler(u32 function, acpi_physical_address address, u32 bits, 1263 + u64 *value, void *handler_context, void *region_context) 1264 + { 1265 + struct i801_priv *priv = handler_context; 1266 + struct pci_dev *pdev = priv->pci_dev; 1267 + acpi_status status; 1268 + 1269 + /* 1270 + * Once BIOS AML code touches the OpRegion we warn and inhibit any 1271 + * further access from the driver itself. This device is now owned 1272 + * by the system firmware. 1273 + */ 1274 + mutex_lock(&priv->acpi_lock); 1275 + 1276 + if (!priv->acpi_reserved) { 1277 + priv->acpi_reserved = true; 1278 + 1279 + dev_warn(&pdev->dev, "BIOS is accessing SMBus registers\n"); 1280 + dev_warn(&pdev->dev, "Driver SMBus register access inhibited\n"); 1281 + 1282 + /* 1283 + * BIOS is accessing the host controller so prevent it from 1284 + * suspending automatically from now on. 1285 + */ 1286 + pm_runtime_get_sync(&pdev->dev); 1287 + } 1288 + 1289 + if ((function & ACPI_IO_MASK) == ACPI_READ) 1290 + status = acpi_os_read_port(address, (u32 *)value, bits); 1291 + else 1292 + status = acpi_os_write_port(address, (u32)*value, bits); 1293 + 1294 + mutex_unlock(&priv->acpi_lock); 1295 + 1296 + return status; 1297 + } 1298 + 1299 + static int i801_acpi_probe(struct i801_priv *priv) 1300 + { 1301 + struct acpi_device *adev; 1302 + acpi_status status; 1303 + 1304 + adev = ACPI_COMPANION(&priv->pci_dev->dev); 1305 + if (adev) { 1306 + status = acpi_install_address_space_handler(adev->handle, 1307 + ACPI_ADR_SPACE_SYSTEM_IO, i801_acpi_io_handler, 1308 + NULL, priv); 1309 + if (ACPI_SUCCESS(status)) 1310 + return 0; 1311 + } 1312 + 1313 + return acpi_check_resource_conflict(&priv->pci_dev->resource[SMBBAR]); 1314 + } 1315 + 1316 + static void i801_acpi_remove(struct i801_priv *priv) 1317 + { 1318 + struct acpi_device *adev; 1319 + 1320 + adev = ACPI_COMPANION(&priv->pci_dev->dev); 1321 + if (!adev) 1322 + return; 1323 + 1324 + acpi_remove_address_space_handler(adev->handle, 1325 + ACPI_ADR_SPACE_SYSTEM_IO, i801_acpi_io_handler); 1326 + 1327 + mutex_lock(&priv->acpi_lock); 1328 + if (priv->acpi_reserved) 1329 + pm_runtime_put(&priv->pci_dev->dev); 1330 + mutex_unlock(&priv->acpi_lock); 1331 + } 1332 + #else 1333 + static inline int i801_acpi_probe(struct i801_priv *priv) { return 0; } 1334 + static inline void i801_acpi_remove(struct i801_priv *priv) { } 1335 + #endif 1336 + 1274 1337 static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) 1275 1338 { 1276 1339 unsigned char temp; ··· 1365 1274 priv->adapter.dev.parent = &dev->dev; 1366 1275 ACPI_COMPANION_SET(&priv->adapter.dev, ACPI_COMPANION(&dev->dev)); 1367 1276 priv->adapter.retries = 3; 1277 + mutex_init(&priv->acpi_lock); 1368 1278 1369 1279 priv->pci_dev = dev; 1370 1280 switch (dev->device) { ··· 1428 1336 return -ENODEV; 1429 1337 } 1430 1338 1431 - err = acpi_check_resource_conflict(&dev->resource[SMBBAR]); 1432 - if (err) { 1339 + if (i801_acpi_probe(priv)) 1433 1340 return -ENODEV; 1434 - } 1435 1341 1436 1342 err = pcim_iomap_regions(dev, 1 << SMBBAR, 1437 1343 dev_driver_string(&dev->dev)); ··· 1438 1348 "Failed to request SMBus region 0x%lx-0x%Lx\n", 1439 1349 priv->smba, 1440 1350 (unsigned long long)pci_resource_end(dev, SMBBAR)); 1351 + i801_acpi_remove(priv); 1441 1352 return err; 1442 1353 } 1443 1354 ··· 1503 1412 err = i2c_add_adapter(&priv->adapter); 1504 1413 if (err) { 1505 1414 dev_err(&dev->dev, "Failed to add SMBus adapter\n"); 1415 + i801_acpi_remove(priv); 1506 1416 return err; 1507 1417 } 1508 1418 ··· 1530 1438 1531 1439 i801_del_mux(priv); 1532 1440 i2c_del_adapter(&priv->adapter); 1441 + i801_acpi_remove(priv); 1533 1442 pci_write_config_byte(dev, SMBHSTCFG, priv->original_hstcfg); 1534 1443 1535 1444 platform_device_unregister(priv->tco_pdev);
+10 -7
drivers/i2c/busses/i2c-octeon.c
··· 934 934 return result; 935 935 936 936 for (i = 0; i < length; i++) { 937 - /* for the last byte TWSI_CTL_AAK must not be set */ 938 - if (i + 1 == length) 937 + /* 938 + * For the last byte to receive TWSI_CTL_AAK must not be set. 939 + * 940 + * A special case is I2C_M_RECV_LEN where we don't know the 941 + * additional length yet. If recv_len is set we assume we're 942 + * not reading the final byte and therefore need to set 943 + * TWSI_CTL_AAK. 944 + */ 945 + if ((i + 1 == length) && !(recv_len && i == 0)) 939 946 final_read = true; 940 947 941 948 /* clear iflg to allow next event */ ··· 957 950 958 951 data[i] = octeon_i2c_data_read(i2c); 959 952 if (recv_len && i == 0) { 960 - if (data[i] > I2C_SMBUS_BLOCK_MAX + 1) { 961 - dev_err(i2c->dev, 962 - "%s: read len > I2C_SMBUS_BLOCK_MAX %d\n", 963 - __func__, data[i]); 953 + if (data[i] > I2C_SMBUS_BLOCK_MAX + 1) 964 954 return -EPROTO; 965 - } 966 955 length += data[i]; 967 956 } 968 957
+1
drivers/i2c/muxes/i2c-mux-reg.c
··· 260 260 .remove = i2c_mux_reg_remove, 261 261 .driver = { 262 262 .name = "i2c-mux-reg", 263 + .of_match_table = of_match_ptr(i2c_mux_reg_of_match), 263 264 }, 264 265 }; 265 266