Skip to content

Commit 74f3f1d

Browse files
committed
Merge tag 'i2c-for-6.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: "A documentation fix and driver fixes for piix4, tegra, and i801" * tag 'i2c-for-6.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: Documentation: devres: add missing I2C helper i2c: i801: add lis3lv02d's I2C address for Vostro 5568 i2c: tegra: Allocate DMA memory for DMA engine i2c: piix4: Fix adapter not be removed in piix4_remove()
2 parents 64c3dd0 + 8e987f1 commit 74f3f1d

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

Documentation/driver-api/driver-model/devres.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ GPIO
279279
devm_gpio_request_one()
280280

281281
I2C
282+
devm_i2c_add_adapter()
282283
devm_i2c_new_dummy_device()
283284

284285
IIO

drivers/i2c/busses/i2c-i801.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,7 @@ static const struct {
12431243
*/
12441244
{ "Latitude 5480", 0x29 },
12451245
{ "Vostro V131", 0x1d },
1246+
{ "Vostro 5568", 0x29 },
12461247
};
12471248

12481249
static void register_dell_lis3lv02d_i2c_device(struct i801_priv *priv)

drivers/i2c/busses/i2c-piix4.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,7 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
10801080
"", &piix4_main_adapters[0]);
10811081
if (retval < 0)
10821082
return retval;
1083+
piix4_adapter_count = 1;
10831084
}
10841085

10851086
/* Check for auxiliary SMBus on some AMD chipsets */

drivers/i2c/busses/i2c-tegra.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ struct tegra_i2c_dev {
284284
struct dma_chan *tx_dma_chan;
285285
struct dma_chan *rx_dma_chan;
286286
unsigned int dma_buf_size;
287+
struct device *dma_dev;
287288
dma_addr_t dma_phys;
288289
void *dma_buf;
289290

@@ -420,7 +421,7 @@ static int tegra_i2c_dma_submit(struct tegra_i2c_dev *i2c_dev, size_t len)
420421
static void tegra_i2c_release_dma(struct tegra_i2c_dev *i2c_dev)
421422
{
422423
if (i2c_dev->dma_buf) {
423-
dma_free_coherent(i2c_dev->dev, i2c_dev->dma_buf_size,
424+
dma_free_coherent(i2c_dev->dma_dev, i2c_dev->dma_buf_size,
424425
i2c_dev->dma_buf, i2c_dev->dma_phys);
425426
i2c_dev->dma_buf = NULL;
426427
}
@@ -472,10 +473,13 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)
472473

473474
i2c_dev->tx_dma_chan = chan;
474475

476+
WARN_ON(i2c_dev->tx_dma_chan->device != i2c_dev->rx_dma_chan->device);
477+
i2c_dev->dma_dev = chan->device->dev;
478+
475479
i2c_dev->dma_buf_size = i2c_dev->hw->quirks->max_write_len +
476480
I2C_PACKET_HEADER_SIZE;
477481

478-
dma_buf = dma_alloc_coherent(i2c_dev->dev, i2c_dev->dma_buf_size,
482+
dma_buf = dma_alloc_coherent(i2c_dev->dma_dev, i2c_dev->dma_buf_size,
479483
&dma_phys, GFP_KERNEL | __GFP_NOWARN);
480484
if (!dma_buf) {
481485
dev_err(i2c_dev->dev, "failed to allocate DMA buffer\n");
@@ -1272,15 +1276,15 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
12721276

12731277
if (i2c_dev->dma_mode) {
12741278
if (i2c_dev->msg_read) {
1275-
dma_sync_single_for_device(i2c_dev->dev,
1279+
dma_sync_single_for_device(i2c_dev->dma_dev,
12761280
i2c_dev->dma_phys,
12771281
xfer_size, DMA_FROM_DEVICE);
12781282

12791283
err = tegra_i2c_dma_submit(i2c_dev, xfer_size);
12801284
if (err)
12811285
return err;
12821286
} else {
1283-
dma_sync_single_for_cpu(i2c_dev->dev,
1287+
dma_sync_single_for_cpu(i2c_dev->dma_dev,
12841288
i2c_dev->dma_phys,
12851289
xfer_size, DMA_TO_DEVICE);
12861290
}
@@ -1293,7 +1297,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
12931297
memcpy(i2c_dev->dma_buf + I2C_PACKET_HEADER_SIZE,
12941298
msg->buf, msg->len);
12951299

1296-
dma_sync_single_for_device(i2c_dev->dev,
1300+
dma_sync_single_for_device(i2c_dev->dma_dev,
12971301
i2c_dev->dma_phys,
12981302
xfer_size, DMA_TO_DEVICE);
12991303

@@ -1344,7 +1348,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
13441348
}
13451349

13461350
if (i2c_dev->msg_read && i2c_dev->msg_err == I2C_ERR_NONE) {
1347-
dma_sync_single_for_cpu(i2c_dev->dev,
1351+
dma_sync_single_for_cpu(i2c_dev->dma_dev,
13481352
i2c_dev->dma_phys,
13491353
xfer_size, DMA_FROM_DEVICE);
13501354

0 commit comments

Comments
 (0)