* [PATCH] drm/tegra: vic: Export module device table
@ 2019-11-22 13:32 Thierry Reding
2019-11-25 9:56 ` Daniel Vetter
0 siblings, 1 reply; 3+ messages in thread
From: Thierry Reding @ 2019-11-22 13:32 UTC (permalink / raw)
To: Thierry Reding; +Cc: linux-tegra, dri-devel, Jon Hunter
From: Thierry Reding <treding@nvidia.com>
Export the module device table to ensure the VIC compatible strings are
listed in the module's aliases table. This in turn causes the driver to
be automatically loaded on boot if VIC is the only enabled subdevice of
the logical host1x DRM device.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/gpu/drm/tegra/vic.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c
index 9444ba183990..c4d82b8b3065 100644
--- a/drivers/gpu/drm/tegra/vic.c
+++ b/drivers/gpu/drm/tegra/vic.c
@@ -386,13 +386,14 @@ static const struct vic_config vic_t194_config = {
.supports_sid = true,
};
-static const struct of_device_id vic_match[] = {
+static const struct of_device_id tegra_vic_of_match[] = {
{ .compatible = "nvidia,tegra124-vic", .data = &vic_t124_config },
{ .compatible = "nvidia,tegra210-vic", .data = &vic_t210_config },
{ .compatible = "nvidia,tegra186-vic", .data = &vic_t186_config },
{ .compatible = "nvidia,tegra194-vic", .data = &vic_t194_config },
{ },
};
+MODULE_DEVICE_TABLE(of, tegra_vic_of_match);
static int vic_probe(struct platform_device *pdev)
{
@@ -516,7 +517,7 @@ static const struct dev_pm_ops vic_pm_ops = {
struct platform_driver tegra_vic_driver = {
.driver = {
.name = "tegra-vic",
- .of_match_table = vic_match,
+ .of_match_table = tegra_vic_of_match,
.pm = &vic_pm_ops
},
.probe = vic_probe,
--
2.23.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] drm/tegra: vic: Export module device table
2019-11-22 13:32 [PATCH] drm/tegra: vic: Export module device table Thierry Reding
@ 2019-11-25 9:56 ` Daniel Vetter
2019-11-25 10:45 ` Thierry Reding
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Vetter @ 2019-11-25 9:56 UTC (permalink / raw)
To: Thierry Reding; +Cc: linux-tegra, dri-devel, Jon Hunter
On Fri, Nov 22, 2019 at 02:32:15PM +0100, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> Export the module device table to ensure the VIC compatible strings are
> listed in the module's aliases table. This in turn causes the driver to
> be automatically loaded on boot if VIC is the only enabled subdevice of
> the logical host1x DRM device.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
I noticed that the drm subdev driver also lacks the matches. How does that
work? Just by getting loaded when any of the subdev drivers match?
-Daniel
> ---
> drivers/gpu/drm/tegra/vic.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c
> index 9444ba183990..c4d82b8b3065 100644
> --- a/drivers/gpu/drm/tegra/vic.c
> +++ b/drivers/gpu/drm/tegra/vic.c
> @@ -386,13 +386,14 @@ static const struct vic_config vic_t194_config = {
> .supports_sid = true,
> };
>
> -static const struct of_device_id vic_match[] = {
> +static const struct of_device_id tegra_vic_of_match[] = {
> { .compatible = "nvidia,tegra124-vic", .data = &vic_t124_config },
> { .compatible = "nvidia,tegra210-vic", .data = &vic_t210_config },
> { .compatible = "nvidia,tegra186-vic", .data = &vic_t186_config },
> { .compatible = "nvidia,tegra194-vic", .data = &vic_t194_config },
> { },
> };
> +MODULE_DEVICE_TABLE(of, tegra_vic_of_match);
>
> static int vic_probe(struct platform_device *pdev)
> {
> @@ -516,7 +517,7 @@ static const struct dev_pm_ops vic_pm_ops = {
> struct platform_driver tegra_vic_driver = {
> .driver = {
> .name = "tegra-vic",
> - .of_match_table = vic_match,
> + .of_match_table = tegra_vic_of_match,
> .pm = &vic_pm_ops
> },
> .probe = vic_probe,
> --
> 2.23.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] drm/tegra: vic: Export module device table
2019-11-25 9:56 ` Daniel Vetter
@ 2019-11-25 10:45 ` Thierry Reding
0 siblings, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2019-11-25 10:45 UTC (permalink / raw)
To: Daniel Vetter; +Cc: linux-tegra, dri-devel, Jon Hunter
[-- Attachment #1.1: Type: text/plain, Size: 3078 bytes --]
On Mon, Nov 25, 2019 at 10:56:29AM +0100, Daniel Vetter wrote:
> On Fri, Nov 22, 2019 at 02:32:15PM +0100, Thierry Reding wrote:
> > From: Thierry Reding <treding@nvidia.com>
> >
> > Export the module device table to ensure the VIC compatible strings are
> > listed in the module's aliases table. This in turn causes the driver to
> > be automatically loaded on boot if VIC is the only enabled subdevice of
> > the logical host1x DRM device.
> >
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>
> I noticed that the drm subdev driver also lacks the matches. How does that
> work? Just by getting loaded when any of the subdev drivers match?
Yeah, basically the host1x DRM driver registration causes a logical
device to be created. The driver will then finally bind to the device
after all the subdevices have been registered. Since all the subdevice
drivers are linked into a single module, all the module device tables
end up in that kernel module and that's enough to trigger the whole
process.
I ran into this issue when I was trying to run the Tegra DRM driver in
a "headless" configuration where all the display-related devices were
disabled via DT. Without exporting the VIC module device table, there
were no entries in the module's aliases list that would match the set
of devices registered to the system and the driver wouldn't load.
Thierry
> -Daniel
>
> > ---
> > drivers/gpu/drm/tegra/vic.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c
> > index 9444ba183990..c4d82b8b3065 100644
> > --- a/drivers/gpu/drm/tegra/vic.c
> > +++ b/drivers/gpu/drm/tegra/vic.c
> > @@ -386,13 +386,14 @@ static const struct vic_config vic_t194_config = {
> > .supports_sid = true,
> > };
> >
> > -static const struct of_device_id vic_match[] = {
> > +static const struct of_device_id tegra_vic_of_match[] = {
> > { .compatible = "nvidia,tegra124-vic", .data = &vic_t124_config },
> > { .compatible = "nvidia,tegra210-vic", .data = &vic_t210_config },
> > { .compatible = "nvidia,tegra186-vic", .data = &vic_t186_config },
> > { .compatible = "nvidia,tegra194-vic", .data = &vic_t194_config },
> > { },
> > };
> > +MODULE_DEVICE_TABLE(of, tegra_vic_of_match);
> >
> > static int vic_probe(struct platform_device *pdev)
> > {
> > @@ -516,7 +517,7 @@ static const struct dev_pm_ops vic_pm_ops = {
> > struct platform_driver tegra_vic_driver = {
> > .driver = {
> > .name = "tegra-vic",
> > - .of_match_table = vic_match,
> > + .of_match_table = tegra_vic_of_match,
> > .pm = &vic_pm_ops
> > },
> > .probe = vic_probe,
> > --
> > 2.23.0
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-11-25 10:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-22 13:32 [PATCH] drm/tegra: vic: Export module device table Thierry Reding
2019-11-25 9:56 ` Daniel Vetter
2019-11-25 10:45 ` Thierry Reding
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).