Re: [PATCH v4 2/3] i2c: tegra: make reset an optional property

From: Akhil R
Date: Thu Jun 12 2025 - 11:39:08 EST


On Thu, 12 Jun 2025 15:55:21 +0300, Andy Shevchenko wrote:

>
>> > static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
>> > {
>> > u32 val, clk_divisor, clk_multiplier, tsu_thd, tlow, thigh, non_hs_mode;
>> > @@ -621,8 +641,10 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
>> > */
>> > if (handle)
>> > err = acpi_evaluate_object(handle, "_RST", NULL, NULL);
>> > - else
>> > + else if (i2c_dev->rst)
>> > err = reset_control_reset(i2c_dev->rst);
>> > + else
>> > + err = tegra_i2c_master_reset(i2c_dev);
>>
>> Can you please take a look here? Should the reset happen in ACPI?
>
> This is a good question. Without seeing all the implementations of _RST method
> for the platforms based on this SoC it's hard to say. Ideally the _RST (which
> is called above) must handle it properly, but firmwares have bugs...
>
> TL;DR: I think the approach is correct, and if any bug in ACPI will be found,
> the workaround (quirk) needs to be added here later on.

As in Thierry's comment, I was in thought of updating the code as below.
Does it make sense or would it be better keep what it is there now?

if (handle && acpi_has_method(handle, "_RST"))
err = acpi_evaluate_object(handle, "_RST", NULL, NULL);
else if (i2c_dev->rst)
err = reset_control_reset(i2c_dev->rst);
else
err = tegra_i2c_master_reset(i2c_dev);

Regards,
Akhil