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-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
"This contains a 5.8 regression fix for the Designware driver, a
register bitfield fix for the fsi driver, and a missing sanity check
for the I2C core"

* 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
i2c: core: check returned size of emulated smbus block read
i2c: fsi: Fix the port number field in status register
i2c: designware: Adjust bus speed independently of ACPI

+28 -13
+17 -8
drivers/i2c/busses/i2c-designware-common.c
··· 286 286 } 287 287 EXPORT_SYMBOL_GPL(i2c_dw_acpi_configure); 288 288 289 - void i2c_dw_acpi_adjust_bus_speed(struct device *device) 289 + static u32 i2c_dw_acpi_round_bus_speed(struct device *device) 290 290 { 291 - struct dw_i2c_dev *dev = dev_get_drvdata(device); 292 - struct i2c_timings *t = &dev->timings; 293 291 u32 acpi_speed; 294 292 int i; 295 293 ··· 298 300 */ 299 301 for (i = 0; i < ARRAY_SIZE(supported_speeds); i++) { 300 302 if (acpi_speed >= supported_speeds[i]) 301 - break; 303 + return supported_speeds[i]; 302 304 } 303 - acpi_speed = i < ARRAY_SIZE(supported_speeds) ? supported_speeds[i] : 0; 305 + 306 + return 0; 307 + } 308 + 309 + #else /* CONFIG_ACPI */ 310 + 311 + static inline u32 i2c_dw_acpi_round_bus_speed(struct device *device) { return 0; } 312 + 313 + #endif /* CONFIG_ACPI */ 314 + 315 + void i2c_dw_adjust_bus_speed(struct dw_i2c_dev *dev) 316 + { 317 + u32 acpi_speed = i2c_dw_acpi_round_bus_speed(dev->dev); 318 + struct i2c_timings *t = &dev->timings; 304 319 305 320 /* 306 321 * Find bus speed from the "clock-frequency" device property, ACPI ··· 326 315 else 327 316 t->bus_freq_hz = I2C_MAX_FAST_MODE_FREQ; 328 317 } 329 - EXPORT_SYMBOL_GPL(i2c_dw_acpi_adjust_bus_speed); 330 - 331 - #endif /* CONFIG_ACPI */ 318 + EXPORT_SYMBOL_GPL(i2c_dw_adjust_bus_speed); 332 319 333 320 u32 i2c_dw_scl_hcnt(u32 ic_clk, u32 tSYMBOL, u32 tf, int cond, int offset) 334 321 {
+1 -2
drivers/i2c/busses/i2c-designware-core.h
··· 361 361 #endif 362 362 363 363 int i2c_dw_validate_speed(struct dw_i2c_dev *dev); 364 + void i2c_dw_adjust_bus_speed(struct dw_i2c_dev *dev); 364 365 365 366 #if IS_ENABLED(CONFIG_ACPI) 366 367 int i2c_dw_acpi_configure(struct device *device); 367 - void i2c_dw_acpi_adjust_bus_speed(struct device *device); 368 368 #else 369 369 static inline int i2c_dw_acpi_configure(struct device *device) { return -ENODEV; } 370 - static inline void i2c_dw_acpi_adjust_bus_speed(struct device *device) {} 371 370 #endif
+1 -1
drivers/i2c/busses/i2c-designware-pcidrv.c
··· 240 240 } 241 241 } 242 242 243 - i2c_dw_acpi_adjust_bus_speed(&pdev->dev); 243 + i2c_dw_adjust_bus_speed(dev); 244 244 245 245 if (has_acpi_companion(&pdev->dev)) 246 246 i2c_dw_acpi_configure(&pdev->dev);
+1 -1
drivers/i2c/busses/i2c-designware-platdrv.c
··· 228 228 else 229 229 i2c_parse_fw_timings(&pdev->dev, t, false); 230 230 231 - i2c_dw_acpi_adjust_bus_speed(&pdev->dev); 231 + i2c_dw_adjust_bus_speed(dev); 232 232 233 233 if (pdev->dev.of_node) 234 234 dw_i2c_of_configure(pdev);
+1 -1
drivers/i2c/busses/i2c-fsi.c
··· 98 98 #define I2C_STAT_DAT_REQ BIT(25) 99 99 #define I2C_STAT_CMD_COMP BIT(24) 100 100 #define I2C_STAT_STOP_ERR BIT(23) 101 - #define I2C_STAT_MAX_PORT GENMASK(19, 16) 101 + #define I2C_STAT_MAX_PORT GENMASK(22, 16) 102 102 #define I2C_STAT_ANY_INT BIT(15) 103 103 #define I2C_STAT_SCL_IN BIT(11) 104 104 #define I2C_STAT_SDA_IN BIT(10)
+7
drivers/i2c/i2c-core-smbus.c
··· 495 495 break; 496 496 case I2C_SMBUS_BLOCK_DATA: 497 497 case I2C_SMBUS_BLOCK_PROC_CALL: 498 + if (msg[1].buf[0] > I2C_SMBUS_BLOCK_MAX) { 499 + dev_err(&adapter->dev, 500 + "Invalid block size returned: %d\n", 501 + msg[1].buf[0]); 502 + status = -EPROTO; 503 + goto cleanup; 504 + } 498 505 for (i = 0; i < msg[1].buf[0] + 1; i++) 499 506 data->block[i] = msg[1].buf[i]; 500 507 break;