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

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

Pull i2c fixes from Wolfram Sang:
"A set of driver and core fixes as well as MAINTAINER update"

* 'i2c/for-current-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
MAINTAINERS: add maintainer for mediatek i2c controller driver
i2c: mux: Replace zero-length array with flexible-array
i2c: mux: demux-pinctrl: Fix an error handling path in 'i2c_demux_pinctrl_probe()'
i2c: altera: Fix race between xfer_msg and isr thread
i2c: algo-pca: update contact email
i2c: at91: Fix pinmux after devm_gpiod_get() for bus recovery
i2c: use my kernel.org address from now on
i2c: fix missing pm_runtime_put_sync in i2c_device_probe

+58 -16
+2
.mailmap
··· 288 288 Vladimir Davydov <vdavydov.dev@gmail.com> <vdavydov@parallels.com> 289 289 Takashi YOSHII <takashi.yoshii.zj@renesas.com> 290 290 Will Deacon <will@kernel.org> <will.deacon@arm.com> 291 + Wolfram Sang <wsa@kernel.org> <wsa@the-dreams.de> 292 + Wolfram Sang <wsa@kernel.org> <w.sang@pengutronix.de> 291 293 Yakir Yang <kuankuan.y@gmail.com> <ykk@rock-chips.com> 292 294 Yusuke Goda <goda.yusuke@renesas.com> 293 295 Gustavo Padovan <gustavo@las.ic.unicamp.br>
+8 -1
MAINTAINERS
··· 7941 7941 F: drivers/i2c/busses/i2c-parport.c 7942 7942 7943 7943 I2C SUBSYSTEM 7944 - M: Wolfram Sang <wsa@the-dreams.de> 7944 + M: Wolfram Sang <wsa@kernel.org> 7945 7945 L: linux-i2c@vger.kernel.org 7946 7946 S: Maintained 7947 7947 W: https://i2c.wiki.kernel.org/ ··· 10661 10661 L: netdev@vger.kernel.org 10662 10662 S: Maintained 10663 10663 F: drivers/net/ethernet/mediatek/ 10664 + 10665 + MEDIATEK I2C CONTROLLER DRIVER 10666 + M: Qii Wang <qii.wang@mediatek.com> 10667 + L: linux-i2c@vger.kernel.org 10668 + S: Maintained 10669 + F: Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt 10670 + F: drivers/i2c/busses/i2c-mt65xx.c 10664 10671 10665 10672 MEDIATEK JPEG DRIVER 10666 10673 M: Rick Chang <rick.chang@mediatek.com>
+1 -1
drivers/i2c/algos/i2c-algo-pca.c
··· 542 542 EXPORT_SYMBOL(i2c_pca_add_numbered_bus); 543 543 544 544 MODULE_AUTHOR("Ian Campbell <icampbell@arcom.com>, " 545 - "Wolfram Sang <w.sang@pengutronix.de>"); 545 + "Wolfram Sang <kernel@pengutronix.de>"); 546 546 MODULE_DESCRIPTION("I2C-Bus PCA9564/PCA9665 algorithm"); 547 547 MODULE_LICENSE("GPL"); 548 548
+9 -1
drivers/i2c/busses/i2c-altera.c
··· 70 70 * @isr_mask: cached copy of local ISR enables. 71 71 * @isr_status: cached copy of local ISR status. 72 72 * @lock: spinlock for IRQ synchronization. 73 + * @isr_mutex: mutex for IRQ thread. 73 74 */ 74 75 struct altr_i2c_dev { 75 76 void __iomem *base; ··· 87 86 u32 isr_mask; 88 87 u32 isr_status; 89 88 spinlock_t lock; /* IRQ synchronization */ 89 + struct mutex isr_mutex; 90 90 }; 91 91 92 92 static void ··· 247 245 struct altr_i2c_dev *idev = _dev; 248 246 u32 status = idev->isr_status; 249 247 248 + mutex_lock(&idev->isr_mutex); 250 249 if (!idev->msg) { 251 250 dev_warn(idev->dev, "unexpected interrupt\n"); 252 251 altr_i2c_int_clear(idev, ALTR_I2C_ALL_IRQ); 253 - return IRQ_HANDLED; 252 + goto out; 254 253 } 255 254 read = (idev->msg->flags & I2C_M_RD) != 0; 256 255 ··· 304 301 complete(&idev->msg_complete); 305 302 dev_dbg(idev->dev, "Message Complete\n"); 306 303 } 304 + out: 305 + mutex_unlock(&idev->isr_mutex); 307 306 308 307 return IRQ_HANDLED; 309 308 } ··· 317 312 u32 value; 318 313 u8 addr = i2c_8bit_addr_from_msg(msg); 319 314 315 + mutex_lock(&idev->isr_mutex); 320 316 idev->msg = msg; 321 317 idev->msg_len = msg->len; 322 318 idev->buf = msg->buf; ··· 342 336 altr_i2c_int_enable(idev, imask, true); 343 337 altr_i2c_fill_tx_fifo(idev); 344 338 } 339 + mutex_unlock(&idev->isr_mutex); 345 340 346 341 time_left = wait_for_completion_timeout(&idev->msg_complete, 347 342 ALTR_I2C_XFER_TIMEOUT); ··· 416 409 idev->dev = &pdev->dev; 417 410 init_completion(&idev->msg_complete); 418 411 spin_lock_init(&idev->lock); 412 + mutex_init(&idev->isr_mutex); 419 413 420 414 ret = device_property_read_u32(idev->dev, "fifo-size", 421 415 &idev->fifo_size);
+17 -3
drivers/i2c/busses/i2c-at91-master.c
··· 845 845 PINCTRL_STATE_DEFAULT); 846 846 dev->pinctrl_pins_gpio = pinctrl_lookup_state(dev->pinctrl, 847 847 "gpio"); 848 + if (IS_ERR(dev->pinctrl_pins_default) || 849 + IS_ERR(dev->pinctrl_pins_gpio)) { 850 + dev_info(&pdev->dev, "pinctrl states incomplete for recovery\n"); 851 + return -EINVAL; 852 + } 853 + 854 + /* 855 + * pins will be taken as GPIO, so we might as well inform pinctrl about 856 + * this and move the state to GPIO 857 + */ 858 + pinctrl_select_state(dev->pinctrl, dev->pinctrl_pins_gpio); 859 + 848 860 rinfo->sda_gpiod = devm_gpiod_get(&pdev->dev, "sda", GPIOD_IN); 849 861 if (PTR_ERR(rinfo->sda_gpiod) == -EPROBE_DEFER) 850 862 return -EPROBE_DEFER; ··· 867 855 return -EPROBE_DEFER; 868 856 869 857 if (IS_ERR(rinfo->sda_gpiod) || 870 - IS_ERR(rinfo->scl_gpiod) || 871 - IS_ERR(dev->pinctrl_pins_default) || 872 - IS_ERR(dev->pinctrl_pins_gpio)) { 858 + IS_ERR(rinfo->scl_gpiod)) { 873 859 dev_info(&pdev->dev, "recovery information incomplete\n"); 874 860 if (!IS_ERR(rinfo->sda_gpiod)) { 875 861 gpiod_put(rinfo->sda_gpiod); ··· 877 867 gpiod_put(rinfo->scl_gpiod); 878 868 rinfo->scl_gpiod = NULL; 879 869 } 870 + pinctrl_select_state(dev->pinctrl, dev->pinctrl_pins_default); 880 871 return -EINVAL; 881 872 } 873 + 874 + /* change the state of the pins back to their default state */ 875 + pinctrl_select_state(dev->pinctrl, dev->pinctrl_pins_default); 882 876 883 877 dev_info(&pdev->dev, "using scl, sda for recovery\n"); 884 878
+17 -7
drivers/i2c/i2c-core-base.c
··· 7 7 * Mux support by Rodolfo Giometti <giometti@enneenne.com> and 8 8 * Michael Lawnick <michael.lawnick.ext@nsn.com> 9 9 * 10 - * Copyright (C) 2013-2017 Wolfram Sang <wsa@the-dreams.de> 10 + * Copyright (C) 2013-2017 Wolfram Sang <wsa@kernel.org> 11 11 */ 12 12 13 13 #define pr_fmt(fmt) "i2c-core: " fmt ··· 338 338 } else if (ACPI_COMPANION(dev)) { 339 339 irq = i2c_acpi_get_irq(client); 340 340 } 341 - if (irq == -EPROBE_DEFER) 342 - return irq; 341 + if (irq == -EPROBE_DEFER) { 342 + status = irq; 343 + goto put_sync_adapter; 344 + } 343 345 344 346 if (irq < 0) 345 347 irq = 0; ··· 355 353 */ 356 354 if (!driver->id_table && 357 355 !i2c_acpi_match_device(dev->driver->acpi_match_table, client) && 358 - !i2c_of_match_device(dev->driver->of_match_table, client)) 359 - return -ENODEV; 356 + !i2c_of_match_device(dev->driver->of_match_table, client)) { 357 + status = -ENODEV; 358 + goto put_sync_adapter; 359 + } 360 360 361 361 if (client->flags & I2C_CLIENT_WAKE) { 362 362 int wakeirq; 363 363 364 364 wakeirq = of_irq_get_byname(dev->of_node, "wakeup"); 365 - if (wakeirq == -EPROBE_DEFER) 366 - return wakeirq; 365 + if (wakeirq == -EPROBE_DEFER) { 366 + status = wakeirq; 367 + goto put_sync_adapter; 368 + } 367 369 368 370 device_init_wakeup(&client->dev, true); 369 371 ··· 414 408 err_clear_wakeup_irq: 415 409 dev_pm_clear_wake_irq(&client->dev); 416 410 device_init_wakeup(&client->dev, false); 411 + put_sync_adapter: 412 + if (client->flags & I2C_CLIENT_HOST_NOTIFY) 413 + pm_runtime_put_sync(&client->adapter->dev); 414 + 417 415 return status; 418 416 } 419 417
+1 -1
drivers/i2c/i2c-core-of.c
··· 5 5 * Copyright (C) 2008 Jochen Friedrich <jochen@scram.de> 6 6 * based on a previous patch from Jon Smirl <jonsmirl@gmail.com> 7 7 * 8 - * Copyright (C) 2013, 2018 Wolfram Sang <wsa@the-dreams.de> 8 + * Copyright (C) 2013, 2018 Wolfram Sang <wsa@kernel.org> 9 9 */ 10 10 11 11 #include <dt-bindings/i2c/i2c.h>
+1
drivers/i2c/muxes/i2c-demux-pinctrl.c
··· 272 272 err_rollback_available: 273 273 device_remove_file(&pdev->dev, &dev_attr_available_masters); 274 274 err_rollback: 275 + i2c_demux_deactivate_master(priv); 275 276 for (j = 0; j < i; j++) { 276 277 of_node_put(priv->chan[j].parent_np); 277 278 of_changeset_destroy(&priv->chan[j].chgset);
+1 -1
include/linux/i2c-mux.h
··· 29 29 30 30 int num_adapters; 31 31 int max_adapters; 32 - struct i2c_adapter *adapter[0]; 32 + struct i2c_adapter *adapter[]; 33 33 }; 34 34 35 35 struct i2c_mux_core *i2c_mux_alloc(struct i2c_adapter *parent,
+1 -1
include/linux/i2c.h
··· 2 2 /* 3 3 * i2c.h - definitions for the Linux i2c bus interface 4 4 * Copyright (C) 1995-2000 Simon G. Vogl 5 - * Copyright (C) 2013-2019 Wolfram Sang <wsa@the-dreams.de> 5 + * Copyright (C) 2013-2019 Wolfram Sang <wsa@kernel.org> 6 6 * 7 7 * With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and 8 8 * Frodo Looijaard <frodol@dds.nl>