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

Pull i2c fixes from Wolfram Sang:
"Mostly driver bugfixes, but also a few cleanups which are nice to have
out of the way"

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
i2c: rk3x: Restore clock settings at resume time
i2c: Spelling s/acknowedge/acknowledge/
i2c: designware: save the preset value of DW_IC_SDA_HOLD
Documentation: i2c: slave-interface: add note for driver development
i2c: mux: demux-pinctrl: run properly with multiple instances
i2c: bcm-kona: fix inconsistent indenting
i2c: rcar: use proper device with dma_mapping_error
i2c: sh_mobile: use proper device with dma_mapping_error
i2c: mux: demux-pinctrl: invalidate properly when switching fails

+43 -15
+5
Documentation/i2c/slave-interface
··· 145 145 146 146 * Catch the slave interrupts and send appropriate i2c_slave_events to the backend. 147 147 148 + Note that most hardware supports being master _and_ slave on the same bus. So, 149 + if you extend a bus driver, please make sure that the driver supports that as 150 + well. In almost all cases, slave support does not need to disable the master 151 + functionality. 152 + 148 153 Check the i2c-rcar driver as an example. 149 154 150 155
+1 -1
drivers/i2c/busses/i2c-bcm-kona.c
··· 643 643 if (rc < 0) { 644 644 dev_err(dev->device, 645 645 "restart cmd failed rc = %d\n", rc); 646 - goto xfer_send_stop; 646 + goto xfer_send_stop; 647 647 } 648 648 } 649 649
+1 -1
drivers/i2c/busses/i2c-cadence.c
··· 767 767 * depending on the scaling direction. 768 768 * 769 769 * Return: NOTIFY_STOP if the rate change should be aborted, NOTIFY_OK 770 - * to acknowedge the change, NOTIFY_DONE if the notification is 770 + * to acknowledge the change, NOTIFY_DONE if the notification is 771 771 * considered irrelevant. 772 772 */ 773 773 static int cdns_i2c_clk_notifier_cb(struct notifier_block *nb, unsigned long
+10 -6
drivers/i2c/busses/i2c-designware-core.c
··· 367 367 dev_dbg(dev->dev, "Fast-mode HCNT:LCNT = %d:%d\n", hcnt, lcnt); 368 368 369 369 /* Configure SDA Hold Time if required */ 370 - if (dev->sda_hold_time) { 371 - reg = dw_readl(dev, DW_IC_COMP_VERSION); 372 - if (reg >= DW_IC_SDA_HOLD_MIN_VERS) 370 + reg = dw_readl(dev, DW_IC_COMP_VERSION); 371 + if (reg >= DW_IC_SDA_HOLD_MIN_VERS) { 372 + if (dev->sda_hold_time) { 373 373 dw_writel(dev, dev->sda_hold_time, DW_IC_SDA_HOLD); 374 - else 375 - dev_warn(dev->dev, 376 - "Hardware too old to adjust SDA hold time."); 374 + } else { 375 + /* Keep previous hold time setting if no one set it */ 376 + dev->sda_hold_time = dw_readl(dev, DW_IC_SDA_HOLD); 377 + } 378 + } else { 379 + dev_warn(dev->dev, 380 + "Hardware too old to adjust SDA hold time.\n"); 377 381 } 378 382 379 383 /* Configure Tx/Rx FIFO threshold levels */
+1 -1
drivers/i2c/busses/i2c-rcar.c
··· 378 378 } 379 379 380 380 dma_addr = dma_map_single(chan->device->dev, buf, len, dir); 381 - if (dma_mapping_error(dev, dma_addr)) { 381 + if (dma_mapping_error(chan->device->dev, dma_addr)) { 382 382 dev_dbg(dev, "dma map failed, using PIO\n"); 383 383 return; 384 384 }
+13 -1
drivers/i2c/busses/i2c-rk3x.c
··· 918 918 * Code adapted from i2c-cadence.c. 919 919 * 920 920 * Return: NOTIFY_STOP if the rate change should be aborted, NOTIFY_OK 921 - * to acknowedge the change, NOTIFY_DONE if the notification is 921 + * to acknowledge the change, NOTIFY_DONE if the notification is 922 922 * considered irrelevant. 923 923 */ 924 924 static int rk3x_i2c_clk_notifier_cb(struct notifier_block *nb, unsigned long ··· 1109 1109 spin_unlock_irqrestore(&i2c->lock, flags); 1110 1110 1111 1111 return ret < 0 ? ret : num; 1112 + } 1113 + 1114 + static __maybe_unused int rk3x_i2c_resume(struct device *dev) 1115 + { 1116 + struct rk3x_i2c *i2c = dev_get_drvdata(dev); 1117 + 1118 + rk3x_i2c_adapt_div(i2c, clk_get_rate(i2c->clk)); 1119 + 1120 + return 0; 1112 1121 } 1113 1122 1114 1123 static u32 rk3x_i2c_func(struct i2c_adapter *adap) ··· 1343 1334 return 0; 1344 1335 } 1345 1336 1337 + static SIMPLE_DEV_PM_OPS(rk3x_i2c_pm_ops, NULL, rk3x_i2c_resume); 1338 + 1346 1339 static struct platform_driver rk3x_i2c_driver = { 1347 1340 .probe = rk3x_i2c_probe, 1348 1341 .remove = rk3x_i2c_remove, 1349 1342 .driver = { 1350 1343 .name = "rk3x-i2c", 1351 1344 .of_match_table = rk3x_i2c_match, 1345 + .pm = &rk3x_i2c_pm_ops, 1352 1346 }, 1353 1347 }; 1354 1348
+1 -1
drivers/i2c/busses/i2c-sh_mobile.c
··· 610 610 return; 611 611 612 612 dma_addr = dma_map_single(chan->device->dev, pd->msg->buf, pd->msg->len, dir); 613 - if (dma_mapping_error(pd->dev, dma_addr)) { 613 + if (dma_mapping_error(chan->device->dev, dma_addr)) { 614 614 dev_dbg(pd->dev, "dma map failed, using PIO\n"); 615 615 return; 616 616 }
+11 -4
drivers/i2c/muxes/i2c-demux-pinctrl.c
··· 37 37 struct i2c_demux_pinctrl_chan chan[]; 38 38 }; 39 39 40 - static struct property status_okay = { .name = "status", .length = 3, .value = "ok" }; 41 - 42 40 static int i2c_demux_master_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) 43 41 { 44 42 struct i2c_demux_pinctrl_priv *priv = adap->algo_data; ··· 105 107 of_changeset_revert(&priv->chan[new_chan].chgset); 106 108 err: 107 109 dev_err(priv->dev, "failed to setup demux-adapter %d (%d)\n", new_chan, ret); 110 + priv->cur_chan = -EINVAL; 108 111 return ret; 109 112 } 110 113 ··· 191 192 { 192 193 struct device_node *np = pdev->dev.of_node; 193 194 struct i2c_demux_pinctrl_priv *priv; 195 + struct property *props; 194 196 int num_chan, i, j, err; 195 197 196 198 num_chan = of_count_phandle_with_args(np, "i2c-parent", NULL); ··· 202 202 203 203 priv = devm_kzalloc(&pdev->dev, sizeof(*priv) 204 204 + num_chan * sizeof(struct i2c_demux_pinctrl_chan), GFP_KERNEL); 205 - if (!priv) 205 + 206 + props = devm_kcalloc(&pdev->dev, num_chan, sizeof(*props), GFP_KERNEL); 207 + 208 + if (!priv || !props) 206 209 return -ENOMEM; 207 210 208 211 err = of_property_read_string(np, "i2c-bus-name", &priv->bus_name); ··· 223 220 } 224 221 priv->chan[i].parent_np = adap_np; 225 222 223 + props[i].name = devm_kstrdup(&pdev->dev, "status", GFP_KERNEL); 224 + props[i].value = devm_kstrdup(&pdev->dev, "ok", GFP_KERNEL); 225 + props[i].length = 3; 226 + 226 227 of_changeset_init(&priv->chan[i].chgset); 227 - of_changeset_update_property(&priv->chan[i].chgset, adap_np, &status_okay); 228 + of_changeset_update_property(&priv->chan[i].chgset, adap_np, &props[i]); 228 229 } 229 230 230 231 priv->num_chan = num_chan;