Re: [PATCH 1/3] drm/simpledrm: Bind to OF framebuffers in /chosen

From: Thomas Zimmermann
Date: Tue Nov 30 2021 - 03:31:51 EST


Hi

Am 30.11.21 um 07:44 schrieb Javier Martinez Canillas:

Simpledrm is just a driver, but this is platform setup code. Why is this
code located here and not under arch/ or drivers/firmware/?


Agreed. Creating platform devices is something for platform code and
not really a DRM driver.

I know that other drivers do similar things, it doesn't seem to belong here.


Yeah, the simplefb driver does this but that seems like something that
should be changed.

This definitely doesn't belong in either of those, since it is not arch-
or firmware-specific. It is implementing support for the standard
simple-framebuffer OF binding, which specifies that it must be located
within the /chosen node (and thus the default OF setup code won't do the
matching for you); this applies to all OF platforms [1]

Adding Rob; do you think this should move from simplefb/simpledrm to
common OF code? (where?)

of_platform_default_populate_init() should work.

That should work but I still wonder if it is the correct place to add
this logic.

I think that instead it could be done in the sysfb_create_simplefb()
function [0], which already creates the "simple-framebuffer" device
for x86 legacy BIOS and x86/arm64/riscv EFI so it makes sense to do
the same for OF. That way the simplefb platform device registration
code could also be dropped from the driver and users would just need
to enable CONFIG_SYSFB and CONFIG_SYSFB_SIMPLEFB to have the same.

I have a couple of boards with a bootloader that populates a
"simple-framebuffer" in the /chosen node so I could attempt to write
the patches. But probably won't happen until next week.

IMHO it's better to keep the OF-related setup in the OF code. The sysfb code is for screen_info. We can try to find common code for OF and sysfb that then lives in a shared location.

Using a single global screen_info variable is somewhat awkward these days. In the long term, I can think of pushing sysfb code into architectures. Each architecture would then setup the platform devices that it supports. But that's not really important right now.

Best regards
Thomas


[0]: https://elixir.bootlin.com/linux/v5.16-rc3/source/drivers/firmware/sysfb_simplefb.c#L60

Best regards,
Javier


--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

Attachment: OpenPGP_signature
Description: OpenPGP digital signature