Commit f8a52af9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull i2c updates from Wolfram Sang:
 "Only driver updates for 5.19.

  Bigger changes are for Meson, NPCM, and R-Car, but there are also
  changes all over the place"

* tag 'i2c-for-5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (34 commits)
  i2c: meson: fix typo in comment
  i2c: rcar: use flags instead of atomic_xfer
  i2c: rcar: REP_AFTER_RD is not a persistent flag
  i2c: rcar: use BIT macro consistently
  i2c: qcom-geni: remove unnecessary conditions
  i2c: mt7621: Use devm_platform_get_and_ioremap_resource()
  i2c: rcar: refactor handling of first message
  i2c: rcar: avoid race condition with SMIs
  i2c: xiic: Correct the datatype for rx_watermark
  i2c: rcar: fix PM ref counts in probe error paths
  i2c: npcm: Handle spurious interrupts
  i2c: npcm: Correct register access width
  i2c: npcm: Add tx complete counter
  i2c: npcm: Fix timeout calculation
  i2c: npcm: Remove unused variable clk_regmap
  i2c: npcm: Change the way of getting GCR regmap
  i2c: xiic: Fix Tx Interrupt path for grouped messages
  i2c: xiic: Fix coding style issues
  i2c: xiic: return value of xiic_reinit
  i2c: cadence: Increase timeout per message if necessary
  ...
parents 35b51afd 3cd4030d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -46,11 +46,11 @@ properties:
              - renesas,i2c-r8a77980     # R-Car V3H
              - renesas,i2c-r8a77990     # R-Car E3
              - renesas,i2c-r8a77995     # R-Car D3
              - renesas,i2c-r8a779a0     # R-Car V3U
          - const: renesas,rcar-gen3-i2c # R-Car Gen3 and RZ/G2

      - items:
          - enum:
              - renesas,i2c-r8a779a0     # R-Car V3U
              - renesas,i2c-r8a779f0     # R-Car S4-8
          - const: renesas,rcar-gen4-i2c # R-Car Gen4

+8 −5
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ driver model device node, and its I2C address.
	},

	.id_table	= foo_idtable,
	.probe		= foo_probe,
	.probe_new	= foo_probe,
	.remove		= foo_remove,
	/* if device autodetection is needed: */
	.class		= I2C_CLASS_SOMETHING,
@@ -155,8 +155,7 @@ those devices, and a remove() method to unbind.

::

	static int foo_probe(struct i2c_client *client,
			     const struct i2c_device_id *id);
	static int foo_probe(struct i2c_client *client);
	static int foo_remove(struct i2c_client *client);

Remember that the i2c_driver does not create those client handles.  The
@@ -165,8 +164,12 @@ handle may be used during foo_probe(). If foo_probe() reports success
foo_remove() returns.  That binding model is used by most Linux drivers.

The probe function is called when an entry in the id_table name field
matches the device's name. It is passed the entry that was matched so
the driver knows which one in the table matched.
matches the device's name. If the probe function needs that entry, it
can retrieve it using

::

	const struct i2c_device_id *id = i2c_match_id(foo_idtable, client);


Device Creation
+11 −0
Original line number Diff line number Diff line
@@ -656,6 +656,7 @@ static int at91_twi_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num)
	unsigned int_addr_flag = 0;
	struct i2c_msg *m_start = msg;
	bool is_read;
	u8 *dma_buf = NULL;

	dev_dbg(&adap->dev, "at91_xfer: processing %d messages:\n", num);

@@ -703,7 +704,17 @@ static int at91_twi_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num)
	dev->msg = m_start;
	dev->recv_len_abort = false;

	if (dev->use_dma) {
		dma_buf = i2c_get_dma_safe_msg_buf(m_start, 1);
		if (!dma_buf) {
			ret = -ENOMEM;
			goto out;
		}
		dev->buf = dma_buf;
	}

	ret = at91_do_twi_transfer(dev);
	i2c_put_dma_safe_msg_buf(dma_buf, m_start, !ret);

	ret = (ret < 0) ? ret : num;
out:
+10 −2
Original line number Diff line number Diff line
@@ -760,7 +760,7 @@ static void cdns_i2c_master_reset(struct i2c_adapter *adap)
static int cdns_i2c_process_msg(struct cdns_i2c *id, struct i2c_msg *msg,
		struct i2c_adapter *adap)
{
	unsigned long time_left;
	unsigned long time_left, msg_timeout;
	u32 reg;

	id->p_msg = msg;
@@ -785,8 +785,16 @@ static int cdns_i2c_process_msg(struct cdns_i2c *id, struct i2c_msg *msg,
	else
		cdns_i2c_msend(id);

	/* Minimal time to execute this message */
	msg_timeout = msecs_to_jiffies((1000 * msg->len * BITS_PER_BYTE) / id->i2c_clk);
	/* Plus some wiggle room */
	msg_timeout += msecs_to_jiffies(500);

	if (msg_timeout < adap->timeout)
		msg_timeout = adap->timeout;

	/* Wait for the signal of completion */
	time_left = wait_for_completion_timeout(&id->xfer_done, adap->timeout);
	time_left = wait_for_completion_timeout(&id->xfer_done, msg_timeout);
	if (time_left == 0) {
		cdns_i2c_master_reset(adap);
		dev_err(id->adap.dev.parent,
+4 −8
Original line number Diff line number Diff line
@@ -539,10 +539,9 @@ i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)

	dev_dbg(dev->dev, "%s: msgs: %d\n", __func__, num);

	ret = pm_runtime_get_sync(dev->dev);
	ret = pm_runtime_resume_and_get(dev->dev);
	if (ret < 0) {
		dev_err(dev->dev, "Failed to runtime_get device: %d\n", ret);
		pm_runtime_put_noidle(dev->dev);
		return ret;
	}

@@ -821,10 +820,9 @@ static int davinci_i2c_probe(struct platform_device *pdev)

	pm_runtime_enable(dev->dev);

	r = pm_runtime_get_sync(dev->dev);
	r = pm_runtime_resume_and_get(dev->dev);
	if (r < 0) {
		dev_err(dev->dev, "failed to runtime_get device: %d\n", r);
		pm_runtime_put_noidle(dev->dev);
		return r;
	}

@@ -898,11 +896,9 @@ static int davinci_i2c_remove(struct platform_device *pdev)

	i2c_del_adapter(&dev->adapter);

	ret = pm_runtime_get_sync(&pdev->dev);
	if (ret < 0) {
		pm_runtime_put_noidle(&pdev->dev);
	ret = pm_runtime_resume_and_get(&pdev->dev);
	if (ret < 0)
		return ret;
	}

	davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0);

Loading