Re: [PATCH v3 1/1] i2c: mediatek: add runtime PM operations and bus regulator control

From: Andi Shyti
Date: Tue Jan 07 2025 - 16:51:02 EST


Hi Zoie,

On Fri, Jan 03, 2025 at 10:32:34PM +0800, Zoie Lin wrote:
> This commit introduces support for runtime PM operations in
> the I2C driver, enabling runtime suspend and resume functionality.

Please, don't start the commit log with "This patch...", please
use the informative form.

> Although in the most platforms, the bus power of i2c are always

/the//
/are/is/

> on, some platforms disable the i2c bus power in order to meet
> low power request.
>
> This implementation includes bus regulator control to facilitate
> proper handling of the bus power based on platform requirements.
>
> Signed-off-by: Zoie Lin <zoie.lin@xxxxxxxxxxxx>

...

> +static int mtk_i2c_runtime_resume(struct device *dev)
> +{
> + int ret = 0;

initialization is not needed.

> + struct mtk_i2c *i2c = dev_get_drvdata(dev);
> +
> + if (i2c->adap.bus_regulator) {
> + ret = regulator_enable(i2c->adap.bus_regulator);
> + if (ret) {
> + dev_err(dev, "enable regulator failed!\n");
> + return ret;
> + }
> + }
> +
> + ret = clk_bulk_enable(I2C_MT65XX_CLK_MAX, i2c->clocks);
> + if (ret) {
> + if (i2c->adap.bus_regulator)
> + regulator_disable(i2c->adap.bus_regulator);
> + return ret;

no need to return here...

> + }

... you can remove the brackets...

> + return 0;

... return ret;

Andi

> +}