public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: "Nirujogi, Pratap" <pnirujog@amd.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Pratap Nirujogi <pratap.nirujogi@amd.com>,
	andi.shyti@kernel.org
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	benjamin.chan@amd.com, bin.du@amd.com,
	gjorgji.rosikopulos@amd.com, king.li@amd.com,
	dominic.antony@amd.com
Subject: Re: [PATCH] i2c: amd-isp: Add ISP i2c-designware driver
Date: Tue, 22 Apr 2025 12:07:01 -0400	[thread overview]
Message-ID: <bd1c7964-8f53-4493-9abc-19d990b63d54@amd.com> (raw)
In-Reply-To: <0c714314-c5b0-4815-9e74-47d2402e8852@wanadoo.fr>

Hi CJ,

Please accept my apologies for the delayed response to your review comments.

Thanks,
Pratap

On 3/1/2025 3:32 AM, Christophe JAILLET wrote:
> Caution: This message originated from an External Source. Use proper 
> caution when opening attachments, clicking links, or responding.
> 
> 
> Le 28/02/2025 à 17:45, Pratap Nirujogi a écrit :
>> The camera sensor is connected via ISP I2C bus in AMD SOC
>> architectures. Add new I2C designware driver to support
>> new camera sensors on AMD HW.
>>
>> Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com>
> 
> ...
> 
>> diff --git a/drivers/i2c/busses/i2c-designware-amdisp.c b/drivers/i2c/ 
>> busses/i2c-designware-amdisp.c
>> new file mode 100644
>> index 000000000000..dc90510a440b
>> --- /dev/null
>> +++ b/drivers/i2c/busses/i2c-designware-amdisp.c
>> @@ -0,0 +1,266 @@
>> +/* SPDX-License-Identifier: MIT */
> 
> I think that this should be // comment style for SPDX-License-Identifier
> en c files.
> 
Thanks. Will update in V2.

>> +/*
>> + * Copyright 2024-2025 Advanced Micro Devices, Inc.
>> + *
> 
> ...
> 
>> +static int amd_isp_dw_i2c_plat_probe(struct platform_device *pdev)
>> +{
>> +     struct i2c_adapter *adap;
>> +     struct amd_isp_i2c_dev *isp_i2c_dev;
>> +     struct dw_i2c_dev *dev;
>> +     int ret;
>> +
>> +     isp_i2c_dev = devm_kzalloc(&pdev->dev, sizeof(struct 
>> amd_isp_i2c_dev),
> 
> sizeof(*isp_i2c_dev) maybe?
> 
Thanks. Will update in V2.

>> +                                GFP_KERNEL);
>> +     if (!isp_i2c_dev)
>> +             return -ENOMEM;
>> +
>> +     dev = &isp_i2c_dev->dw_dev;
>> +     dev->dev = &pdev->dev;
>> +
>> +     /**
> 
> Just /*
> 
Thanks. Will fix this in V2.

>> +      * Use the polling mode to send/receive the data, because
>> +      * no IRQ connection from ISP I2C
>> +      */
>> +     dev->flags |= ACCESS_POLLING;
>> +     platform_set_drvdata(pdev, dev);
>> +
>> +     dev->base = devm_platform_ioremap_resource(pdev, 0);
>> +     if (IS_ERR(dev->base))
>> +             return PTR_ERR(dev->base);
>> +
>> +     ret = isp_power_set(true);
>> +     if (ret) {
>> +             dev_err(dev->dev, "unable to turn on the amdisp i2c 
>> power:%d\n", ret);
> 
> return dev_err_probe() would make code slightly simpler.
> 
Thanks. Will update in V2.

>> +             return ret;
>> +     }
>> +
>> +     dev->get_clk_rate_khz = amd_isp_dw_i2c_get_clk_rate;
>> +     ret = i2c_dw_fw_parse_and_configure(dev);
>> +     if (ret)
>> +             goto exit;
>> +
>> +     i2c_dw_configure(dev);
>> +
>> +     adap = &dev->adapter;
>> +     adap->owner = THIS_MODULE;
>> +     ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev));
>> +     adap->dev.of_node = pdev->dev.of_node;
>> +     /* arbitrary large number to avoid any conflicts */
>> +     adap->nr = 99;
>> +
>> +     if (dev->flags & ACCESS_NO_IRQ_SUSPEND) {
>> +             dev_pm_set_driver_flags(&pdev->dev,
>> +                                     DPM_FLAG_SMART_PREPARE);
>> +     } else {
>> +             dev_pm_set_driver_flags(&pdev->dev,
>> +                                     DPM_FLAG_SMART_PREPARE |
>> +                                     DPM_FLAG_SMART_SUSPEND);
>> +     }
> 
> Unneeded { } in both branches.
> 
Thanks. Will remove them in V2.

>> +
>> +     device_enable_async_suspend(&pdev->dev);
>> +
>> +     /* The code below assumes runtime PM to be disabled. */
>> +     WARN_ON(pm_runtime_enabled(&pdev->dev));
>> +
>> +     pm_runtime_dont_use_autosuspend(&pdev->dev);
>> +     pm_runtime_set_active(&pdev->dev);
>> +
>> +     if (dev->shared_with_punit)
>> +             pm_runtime_get_noresume(&pdev->dev);
>> +
>> +     pm_runtime_enable(&pdev->dev);
>> +
>> +     ret = i2c_dw_probe(dev);
>> +     if (ret) {
>> +             dev_err(dev->dev, "i2c_dw_probe failed %d\n", ret);
> 
> dev_err_probe() would make code slightly simpler.
> 
Thanks. Will update in V2.

>> +             goto exit_probe;
>> +     }
>> +
>> +     isp_power_set(false);
>> +     return ret;
>> +
>> +exit_probe:
>> +     amd_isp_dw_i2c_plat_pm_cleanup(dev);
>> +     isp_power_set(false);
>> +exit:
>> +     isp_power_set(false);
>> +     return ret;
>> +}
>> +
>> +static void amd_isp_dw_i2c_plat_remove(struct platform_device *pdev)
>> +{
>> +     struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
>> +
>> +     pm_runtime_get_sync(&pdev->dev);
>> +
>> +     i2c_del_adapter(&dev->adapter);
>> +
>> +     i2c_dw_disable(dev);
>> +
>> +     pm_runtime_dont_use_autosuspend(&pdev->dev);
>> +     pm_runtime_put_sync(&pdev->dev);
>> +     amd_isp_dw_i2c_plat_pm_cleanup(dev);
>> +
>> +     reset_control_assert(dev->rst);
> 
> Is it needed? (there is apparently no reset_control_deassert() in this
> driver)
> 
Thanks. Its not needed, will remove it in V2.

>> +}
> 
> ...
> 
>> +MODULE_AUTHOR("Venkata Narendra Kumar Gutta <vengutta@amd.com>");
>> +MODULE_AUTHOR("Pratap Nirujogi <pratap.nirujogi@amd.com>");
>> +MODULE_DESCRIPTION("Synopsys DesignWare I2C bus adapter in AMD ISP");
>> +MODULE_LICENSE("GPL");
> 
> MIT is stated in SPDX-License-Identifier
> 
Thanks. Will update the license info.

>> +MODULE_IMPORT_NS("I2C_DW");
>> +MODULE_IMPORT_NS("I2C_DW_COMMON");
>> +MODULE_LICENSE("GPL and additional rights");
> 
> Is it allowed to have several MODULE_LICENSE?
> 
Thanks. Will use GPL alone in V2.

> ...
> 
> CJ


  reply	other threads:[~2025-04-22 16:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-28 16:45 [PATCH] i2c: amd-isp: Add ISP i2c-designware driver Pratap Nirujogi
2025-03-01  3:33 ` Mario Limonciello
2025-03-03  5:27   ` Nirujogi, Pratap
2025-04-22 15:59   ` Nirujogi, Pratap
2025-03-01  8:32 ` Christophe JAILLET
2025-04-22 16:07   ` Nirujogi, Pratap [this message]
2025-03-01 13:26 ` Krzysztof Kozlowski
2025-04-22 16:12   ` Nirujogi, Pratap
2025-03-01 13:33 ` Krzysztof Kozlowski
2025-04-22 16:14   ` Nirujogi, Pratap
2025-03-03  9:49 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bd1c7964-8f53-4493-9abc-19d990b63d54@amd.com \
    --to=pnirujog@amd.com \
    --cc=andi.shyti@kernel.org \
    --cc=benjamin.chan@amd.com \
    --cc=bin.du@amd.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dominic.antony@amd.com \
    --cc=gjorgji.rosikopulos@amd.com \
    --cc=king.li@amd.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pratap.nirujogi@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox