mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: Nhat Tran <nhat.tranminhk2@gmail.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>
Cc: "linux-renesas-soc@vger.kernel.org"
	<linux-renesas-soc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] regulator: renesas-usb-vbus-regulator: Fix module autoloading
Date: Mon, 16 Nov 2026 09:00:11 +0000	[thread overview]
Message-ID: <TYYPR01MB660390413BAEDD7B2475BEBA867C2@TYYPR01MB6603.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <20261116084426.103863-1-nhat.tranminhk2@gmail.com>

Hi Nhat Tran,

Thanks for the patch.

> -----Original Message-----
> From: Nhat Tran <nhat.tranminhk2@gmail.com>
> Sent: 16 November 2026 08:44
> Subject: [PATCH] regulator: renesas-usb-vbus-regulator: Fix module autoloading
> 
> 
> The driver can be built as a module, and Kconfig makes it a module by default when
> RESET_RZG2L_USBPHY_CTRL is a module. However the driver has neither a platform_device_id table nor a
> MODULE_ALIAS(), so no module alias is generated and udev never loads it.
> 
> The device is created by the rzg2l-usbphy-ctrl reset driver with
> platform_device_set_of_node_from_dev(), which marks the OF node as reused, so the uevent carries the
> platform modalias "platform:rzg2l-usb-vbus-regulator" rather than an OF one.
> 
> Without the regulator, the USB0 PHY waits forever for its vbus supply, and the whole USB0 port stays
> unusable. On an RZ/G2L SMARC EVK:
> 
>   # cat /sys/kernel/debug/devices_deferred
>   11c50100.usb    platform: supplier 11c50200.usb-phy not ready
>   11c50000.usb    platform: supplier 11c50200.usb-phy not ready
>   11c60000.usb    platform: supplier 11c50200.usb-phy not ready
>   11c50200.usb-phy
> 
> Loading the module by hand makes all of them probe.
> 
> Add a platform_device_id table and export it with MODULE_DEVICE_TABLE() so that the module is loaded
> automatically.

A patch is already mainlined [1] with these changes as part of RZ/G3L regulator support.

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=e0d3ff3fe71b2773913c43e5f759473cd003c9af

Cheers,
Biju

> 
> Fixes: 84fbd6198766 ("regulator: Add Renesas RZ/G2L USB VBUS regulator driver")
> Signed-off-by: Nhat Tran <nhat.tranminhk2@gmail.com>
> ---
>  drivers/regulator/renesas-usb-vbus-regulator.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/regulator/renesas-usb-vbus-regulator.c b/drivers/regulator/renesas-usb-vbus-
> regulator.c
> index 9ba791bd72ec..65a58bf5ffa4 100644
> --- a/drivers/regulator/renesas-usb-vbus-regulator.c
> +++ b/drivers/regulator/renesas-usb-vbus-regulator.c
> @@ -55,12 +55,19 @@ static int rzg2l_usb_vbus_regulator_probe(struct platform_device *pdev)
>         return 0;
>  }
> 
> +static const struct platform_device_id rzg2l_usb_vbus_regulator_ids[] = {
> +       { .name = "rzg2l-usb-vbus-regulator" },

Have you tested this patch properly? 

I had an issue in probing the device related to id_table match due to string length
restriction in [2]

[2]https://elixir.bootlin.com/linux/v7.1.2/source/include/linux/mod_devicetable.h#L604

Cheers,
Biju

> +       { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(platform, rzg2l_usb_vbus_regulator_ids);
> +
>  static struct platform_driver rzg2l_usb_vbus_regulator_driver = {
>         .probe = rzg2l_usb_vbus_regulator_probe,
>         .driver = {
>                 .name = "rzg2l-usb-vbus-regulator",
>                 .probe_type = PROBE_PREFER_ASYNCHRONOUS,
>         },
> +       .id_table = rzg2l_usb_vbus_regulator_ids,
>  };
>  module_platform_driver(rzg2l_usb_vbus_regulator_driver);
> 
> --
> 2.25.1


  reply	other threads:[~2026-11-16  9:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  8:44 Nhat Tran
2026-11-16  9:00 ` Biju Das [this message]
2026-11-16  9:06 ` Biju Das
2026-11-16  9:17   ` Nhat Tran

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=TYYPR01MB660390413BAEDD7B2475BEBA867C2@TYYPR01MB6603.jpnprd01.prod.outlook.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=nhat.tranminhk2@gmail.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

all inboxes | Powered by JetHome®