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

Pull i2c fixes from Wolfram Sang:
"I2C has three driver bugfixes for you. We agreed on the Mac regression
to go in via I2C"

* 'i2c/for-current-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
macintosh: therm_windtunnel: fix regression when instantiating devices
i2c: altera: Fix potential integer overflow
i2c: jz4780: silence log flood on txabrt

+36 -58
+1 -1
drivers/i2c/busses/i2c-altera.c
··· 171 171 /* SCL Low Time */ 172 172 writel(t_low, idev->base + ALTR_I2C_SCL_LOW); 173 173 /* SDA Hold Time, 300ns */ 174 - writel(div_u64(300 * clk_mhz, 1000), idev->base + ALTR_I2C_SDA_HOLD); 174 + writel(3 * clk_mhz / 10, idev->base + ALTR_I2C_SDA_HOLD); 175 175 176 176 /* Mask all master interrupt bits */ 177 177 altr_i2c_int_enable(idev, ALTR_I2C_ALL_IRQ, false);
+2 -34
drivers/i2c/busses/i2c-jz4780.c
··· 78 78 79 79 #define X1000_I2C_DC_STOP BIT(9) 80 80 81 - static const char * const jz4780_i2c_abrt_src[] = { 82 - "ABRT_7B_ADDR_NOACK", 83 - "ABRT_10ADDR1_NOACK", 84 - "ABRT_10ADDR2_NOACK", 85 - "ABRT_XDATA_NOACK", 86 - "ABRT_GCALL_NOACK", 87 - "ABRT_GCALL_READ", 88 - "ABRT_HS_ACKD", 89 - "SBYTE_ACKDET", 90 - "ABRT_HS_NORSTRT", 91 - "SBYTE_NORSTRT", 92 - "ABRT_10B_RD_NORSTRT", 93 - "ABRT_MASTER_DIS", 94 - "ARB_LOST", 95 - "SLVFLUSH_TXFIFO", 96 - "SLV_ARBLOST", 97 - "SLVRD_INTX", 98 - }; 99 - 100 81 #define JZ4780_I2C_INTST_IGC BIT(11) 101 82 #define JZ4780_I2C_INTST_ISTT BIT(10) 102 83 #define JZ4780_I2C_INTST_ISTP BIT(9) ··· 557 576 558 577 static void jz4780_i2c_txabrt(struct jz4780_i2c *i2c, int src) 559 578 { 560 - int i; 561 - 562 - dev_err(&i2c->adap.dev, "txabrt: 0x%08x\n", src); 563 - dev_err(&i2c->adap.dev, "device addr=%x\n", 564 - jz4780_i2c_readw(i2c, JZ4780_I2C_TAR)); 565 - dev_err(&i2c->adap.dev, "send cmd count:%d %d\n", 566 - i2c->cmd, i2c->cmd_buf[i2c->cmd]); 567 - dev_err(&i2c->adap.dev, "receive data count:%d %d\n", 568 - i2c->cmd, i2c->data_buf[i2c->cmd]); 569 - 570 - for (i = 0; i < 16; i++) { 571 - if (src & BIT(i)) 572 - dev_dbg(&i2c->adap.dev, "I2C TXABRT[%d]=%s\n", 573 - i, jz4780_i2c_abrt_src[i]); 574 - } 579 + dev_dbg(&i2c->adap.dev, "txabrt: 0x%08x, cmd: %d, send: %d, recv: %d\n", 580 + src, i2c->cmd, i2c->cmd_buf[i2c->cmd], i2c->data_buf[i2c->cmd]); 575 581 } 576 582 577 583 static inline int jz4780_i2c_xfer_read(struct jz4780_i2c *i2c,
+33 -23
drivers/macintosh/therm_windtunnel.c
··· 300 300 /* i2c probing and setup */ 301 301 /************************************************************************/ 302 302 303 - static int 304 - do_attach( struct i2c_adapter *adapter ) 303 + static void do_attach(struct i2c_adapter *adapter) 305 304 { 305 + struct i2c_board_info info = { }; 306 + struct device_node *np; 307 + 306 308 /* scan 0x48-0x4f (DS1775) and 0x2c-2x2f (ADM1030) */ 307 309 static const unsigned short scan_ds1775[] = { 308 310 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, ··· 315 313 I2C_CLIENT_END 316 314 }; 317 315 318 - if( strncmp(adapter->name, "uni-n", 5) ) 319 - return 0; 316 + if (x.running || strncmp(adapter->name, "uni-n", 5)) 317 + return; 320 318 321 - if( !x.running ) { 322 - struct i2c_board_info info; 323 - 324 - memset(&info, 0, sizeof(struct i2c_board_info)); 325 - strlcpy(info.type, "therm_ds1775", I2C_NAME_SIZE); 319 + np = of_find_compatible_node(adapter->dev.of_node, NULL, "MAC,ds1775"); 320 + if (np) { 321 + of_node_put(np); 322 + } else { 323 + strlcpy(info.type, "MAC,ds1775", I2C_NAME_SIZE); 326 324 i2c_new_probed_device(adapter, &info, scan_ds1775, NULL); 327 - 328 - strlcpy(info.type, "therm_adm1030", I2C_NAME_SIZE); 329 - i2c_new_probed_device(adapter, &info, scan_adm1030, NULL); 330 - 331 - if( x.thermostat && x.fan ) { 332 - x.running = 1; 333 - x.poll_task = kthread_run(control_loop, NULL, "g4fand"); 334 - } 335 325 } 336 - return 0; 326 + 327 + np = of_find_compatible_node(adapter->dev.of_node, NULL, "MAC,adm1030"); 328 + if (np) { 329 + of_node_put(np); 330 + } else { 331 + strlcpy(info.type, "MAC,adm1030", I2C_NAME_SIZE); 332 + i2c_new_probed_device(adapter, &info, scan_adm1030, NULL); 333 + } 337 334 } 338 335 339 336 static int ··· 405 404 enum chip { ds1775, adm1030 }; 406 405 407 406 static const struct i2c_device_id therm_windtunnel_id[] = { 408 - { "therm_ds1775", ds1775 }, 409 - { "therm_adm1030", adm1030 }, 407 + { "MAC,ds1775", ds1775 }, 408 + { "MAC,adm1030", adm1030 }, 410 409 { } 411 410 }; 412 411 MODULE_DEVICE_TABLE(i2c, therm_windtunnel_id); ··· 415 414 do_probe(struct i2c_client *cl, const struct i2c_device_id *id) 416 415 { 417 416 struct i2c_adapter *adapter = cl->adapter; 417 + int ret = 0; 418 418 419 419 if( !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA 420 420 | I2C_FUNC_SMBUS_WRITE_BYTE) ) ··· 423 421 424 422 switch (id->driver_data) { 425 423 case adm1030: 426 - return attach_fan( cl ); 424 + ret = attach_fan(cl); 425 + break; 427 426 case ds1775: 428 - return attach_thermostat(cl); 427 + ret = attach_thermostat(cl); 428 + break; 429 429 } 430 - return 0; 430 + 431 + if (!x.running && x.thermostat && x.fan) { 432 + x.running = 1; 433 + x.poll_task = kthread_run(control_loop, NULL, "g4fand"); 434 + } 435 + 436 + return ret; 431 437 } 432 438 433 439 static struct i2c_driver g4fan_driver = {