Re: [PATCH v7 4/8] i2c: amd-asf: Add ACPI support for AMD ASF Controller

Shyam Sundar S K
2024-09-23T09:01:55Z

On 9/23/2024 14:14, Andy Shevchenko wrote:
> On Mon, Sep 23, 2024 at 01:33:57PM +0530, Shyam Sundar S K wrote:
>> The AMD ASF controller is presented to the operating system as an ACPI
>> device. The AMD ASF driver can use ACPI to obtain information about the
>> ASF controller's attributes, such as the ASF address space and interrupt
>> number, and to handle ASF interrupts.
>>
>> Currently, the piix4 driver assumes that a specific port address is
>> designated for AUX operations. However, with the introduction of ASF, the
>> same port address may also be used by the ASF controller. Therefore, a
>> check needs to be added to ensure that if ASF is advertised and enabled in
>> ACPI, the AUX port should not be configured.
>
> ...
>
>> +static int amd_asf_probe(struct platform_device *pdev)
>> +{
>> + struct device *dev = &pdev->dev;
>> + struct amd_asf_dev *asf_dev;
>> +
>> + asf_dev = devm_kzalloc(dev, sizeof(*asf_dev), GFP_KERNEL);
>> + if (!asf_dev)
>> + return dev_err_probe(dev, -ENOMEM, "Failed to allocate memory\n");
>> +
>> + asf_dev->mmio_cfg.use_mmio = true;
>> + asf_dev->port_addr = platform_get_resource(pdev, IORESOURCE_IO, 0);
>> + if (!asf_dev->port_addr)
>> + return dev_err_probe(dev, -EINVAL, "missing IO resources\n");
>> +
>> + asf_dev->adap.owner = THIS_MODULE;
>
>> + asf_dev->adap.dev.parent = &pdev->dev;
>
> Now can also be
>
> asf_dev->adap.dev.parent = dev;
>
> (no need to resend for this only thing, perhaps Andi can amend whilst applying).
>

OK. Thank you for all the valuable feedback and time in reviewing this
series.

Hi Andi,

Please let me if the series needs a respin if the amend fails for you.

Thanks,
Shyam

>> + i2c_set_adapdata(&asf_dev->adap, asf_dev);
>> + snprintf(asf_dev->adap.name, sizeof(asf_dev->adap.name), "AMD ASF adapter");
>> +
>> + return devm_i2c_add_adapter(dev, &asf_dev->adap);
>> +}
>