Re: [PATCH v2 4/4] i2c: i2c-qcom-geni: Enable i2c controller sharing between two subsystems

From: Mukesh Kumar Savaliya
Date: Tue Sep 10 2024 - 09:43:06 EST


Hi Andi, Sorry for late reply on this.

On 9/7/2024 1:26 PM, Andi Shyti wrote:
Hi Mukesh,

On Sat, Sep 07, 2024 at 12:44:38AM GMT, Mukesh Kumar Savaliya wrote:
Add support to share I2C SE by two Subsystems in a mutually exclusive way.
Use "qcom,shared-se" flag in a particular i2c instance node if the
usecase requires i2c controller to be shared.

I2C driver just need to mark first_msg and last_msg flag to help indicate
GPI driver to take lock and unlock TRE there by protecting from concurrent
access from other EE or Subsystem.

gpi_create_i2c_tre() function at gpi.c will take care of adding Lock and
Unlock TRE for the respective transfer operations.

Since the GPIOs are also shared for the i2c bus between two SS, do not
touch GPIO configuration during runtime suspend and only turn off the
clocks. This will allow other SS to continue to transfer the data
without any disturbance over the IO lines.

if I remember correctly, someone already commented on your
patches to explain and expand the achronyms you are using. Please
improve the commit log so that people who don't know this device
can understand.

Sure, Andi. Noted and addressed over comment. Will add full form for the acronyms.
...

@@ -631,8 +636,11 @@ static int geni_i2c_gpi_xfer(struct geni_i2c_dev *gi2c, struct i2c_msg msgs[], i
dma_async_issue_pending(gi2c->tx_c);
time_left = wait_for_completion_timeout(&gi2c->done, XFER_TIMEOUT);
- if (!time_left)
+ if (!time_left) {
+ dev_err(gi2c->se.dev, "I2C timeout gpi flags:%d addr:0x%x\n",
+ gi2c->cur->flags, gi2c->cur->addr);

Please, don't print out here. The user doesn't really need to
know, let the upper levels decide what to do.
Sure, can remove this completely and user can handle , print it.


gi2c->err = -ETIMEDOUT;
+ }
if (gi2c->err) {
ret = gi2c->err;
@@ -800,6 +808,11 @@ static int geni_i2c_probe(struct platform_device *pdev)
gi2c->clk_freq_out = KHZ(100);
}
+ if (of_property_read_bool(pdev->dev.of_node, "qcom,shared-se")) {
+ gi2c->is_shared = true;
+ dev_dbg(&pdev->dev, "Shared SE Usecase\n");

Please, improve this debug message.

"I2C is shared between subsystems" ?
The rest looks good to me.

Thanks,
Andi