[PATCH] i2c: xiic: add ACPI support

Andy Shevchenko andriy.shevchenko at intel.com
Wed Jan 21 00:36:03 PST 2026


On Thu, Jan 15, 2026 at 12:28:46AM +0000, Abdurrahman Hussain wrote:
> Use generic device property accessors.
> Make the clock optional assuming it's managed by firmware.

The generalisation parts are okay in a sense for prototyping, for ACPI-based
platforms, we want to see the proper _HID allocated by a platform vendor
(and maybe accompanied _CID allocated by the IP vendor).

Also you need to reshuffle header inclusions (removing of* and adding proper
headers following IWYU principle).

...

Add

	struct device *dev = &pdev->dev;

to the top of the function and use it everywhere.

>  	i2c->adap.dev.of_node = pdev->dev.of_node;
> +	ACPI_COMPANION_SET(&i2c->adap.dev, ACPI_COMPANION(&pdev->dev));

Instead of two lines, switch to

	device_set_node(...);

...

> -	i2c->clk = devm_clk_get_enabled(&pdev->dev, NULL);
> +	i2c->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
>  	if (IS_ERR(i2c->clk))
>  		return dev_err_probe(&pdev->dev, PTR_ERR(i2c->clk),
>  				     "failed to enable input clock.\n");

This needs to be in the separate change explaining why this is okay to go with.

-- 
With Best Regards,
Andy Shevchenko





More information about the linux-arm-kernel mailing list