From: Linus Torvalds Date: Sun, 4 Feb 2018 18:57:43 +0000 (-0800) Subject: Merge branch 'i2c/for-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa... X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=4141cf676b9e345d3ddeb1710dd3156a09c50244;p=openwrt%2Fstaging%2Fblogic.git Merge branch 'i2c/for-4.16' of git://git./linux/kernel/git/wsa/linux Pull i2c updates from Wolfram Sang: "I2C has the following changes for you: - new flag to mark DMA safe buffers in i2c_msg. Also, some infrastructure around it. And docs. - huge refactoring of the at24 driver led by the new maintainer Bartosz - update I2C bus recovery to send STOP after recovery - conversion from gpio to gpiod for I2C bus recovery - adding a fault-injector to the i2c-gpio driver - lots of small driver improvements, and bigger ones to i2c-sh_mobile" * 'i2c/for-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (99 commits) i2c: mv64xxx: Add myself as maintainer for this driver i2c: mv64xxx: Fix clock resource by adding an optional bus clock i2c: mv64xxx: Remove useless test before clk_disable_unprepare i2c: mxs: use true and false for boolean values i2c: meson: update doc description to fix build warnings i2c: meson: add configurable divider factors dt-bindings: i2c: update documentation for the Meson-AXG i2c: imx-lpi2c: add runtime pm support i2c: rcar: fix some trivial typos in comments i2c: davinci: fix the cpufreq transition i2c: rk3x: add proper kerneldoc header i2c: rk3x: account for const type of of_device_id.data i2c: acorn: remove outdated path from file header i2c: acorn: add MODULE_LICENSE tag i2c: rcar: implement bus recovery i2c: send STOP after successful bus recovery i2c: ensure SDA is released in recovery if SDA is controllable i2c: add 'set_sda' to bus_recovery_info i2c: add identifier in declarations for i2c_bus_recovery i2c: make kerneldoc about bus recovery more precise ... --- 4141cf676b9e345d3ddeb1710dd3156a09c50244 diff --cc MAINTAINERS index f3bac2a8c6d6,1635fb91335c..e15f4e201471 --- a/MAINTAINERS +++ b/MAINTAINERS @@@ -6580,6 -6520,6 +6582,12 @@@ F: drivers/i2c/i2c-mux. F: drivers/i2c/muxes/ F: include/linux/i2c-mux.h ++I2C MV64XXX MARVELL AND ALLWINNER DRIVER ++M: Gregory CLEMENT ++L: linux-i2c@vger.kernel.org ++S: Maintained ++F: drivers/i2c/busses/i2c-mv64xxx.c ++ I2C OVER PARALLEL PORT M: Jean Delvare L: linux-i2c@vger.kernel.org diff --cc drivers/i2c/busses/i2c-designware-platdrv.c index 153b947702c5,6e0fd94faba1..5660daf6c92e --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@@ -471,9 -430,16 +448,9 @@@ static int dw_i2c_plat_suspend(struct d { struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); - if (i_dev->suspended) { - i_dev->skip_resume = true; - return 0; - } - i_dev->disable(i_dev); - i2c_dw_plat_prepare_clk(i_dev, false); + i2c_dw_prepare_clk(i_dev, false); - i_dev->suspended = true; - return 0; } @@@ -481,9 -447,19 +458,9 @@@ static int dw_i2c_plat_resume(struct de { struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); - i2c_dw_plat_prepare_clk(i_dev, true); - if (!i_dev->suspended) - return 0; - - if (i_dev->skip_resume) { - i_dev->skip_resume = false; - return 0; - } - + i2c_dw_prepare_clk(i_dev, true); i_dev->init(i_dev); - i_dev->suspended = false; - return 0; } diff --cc drivers/i2c/i2c-core-smbus.c index a1082c04ac5c,1238c94fe5a1..59d5cf376f6a --- a/drivers/i2c/i2c-core-smbus.c +++ b/drivers/i2c/i2c-core-smbus.c @@@ -395,21 -418,24 +418,25 @@@ static s32 i2c_smbus_xfer_emulated(stru msg[1].flags |= I2C_M_RECV_LEN; msg[1].len = 1; /* block length will be added by the underlying bus driver */ + i2c_smbus_try_get_dmabuf(&msg[1], 0); break; case I2C_SMBUS_I2C_BLOCK_DATA: + if (data->block[0] > I2C_SMBUS_BLOCK_MAX) { + dev_err(&adapter->dev, "Invalid block %s size %d\n", + read_write == I2C_SMBUS_READ ? "read" : "write", + data->block[0]); + return -EINVAL; + } + if (read_write == I2C_SMBUS_READ) { msg[1].len = data->block[0]; + i2c_smbus_try_get_dmabuf(&msg[1], 0); } else { msg[0].len = data->block[0] + 1; - if (msg[0].len > I2C_SMBUS_BLOCK_MAX + 1) { - dev_err(&adapter->dev, - "Invalid block write size %d\n", - data->block[0]); - return -EINVAL; - } + + i2c_smbus_try_get_dmabuf(&msg[0], command); for (i = 1; i <= data->block[0]; i++) - msgbuf0[i] = data->block[i]; + msg[0].buf[i] = data->block[i]; } break; default: