summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/sysfb/simpledrm.c
AgeCommit message (Collapse)Author
2025-04-14drm/sysfb: Share helpers for integer validationThomas Zimmermann
Provide sysfb helpers for validating framebuffer integer values against limits. Update drivers. If a driver did not specify a limit for a certain value, use INT_MAX. v2: - declare module information near EOF (Javier) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20250410083834.10810-3-tzimmermann@suse.de
2025-04-08drm/sysfb: simpledrm: Remove unused helper simpledrm_device_of_dev()Thomas Zimmermann
After moving most of the mode-setting pipeline into drm_sysfb_helper.c, simpledrm_device_of_dev() is no longer being used. Remove it. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reported-by: Jocelyn Falempe <jfalempe@redhat.com> Closes: https://lore.kernel.org/dri-devel/20250407131344.139878-1-jfalempe@redhat.com/ Fixes: 177dfbdb7e67 ("drm/sysfb: Merge primary-plane functions") Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://lore.kernel.org/r/20250407134753.985925-3-tzimmermann@suse.de
2025-04-08drm/simpledrm: Do not upcast in release helpersThomas Zimmermann
The res pointer passed to simpledrm_device_release_clocks() and simpledrm_device_release_regulators() points to an instance of struct simpledrm_device. No need to upcast from struct drm_device. The upcast is harmless, as DRM device is the first field in struct simpledrm_device. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Fixes: 11e8f5fd223b ("drm: Add simpledrm driver") Cc: <stable@vger.kernel.org> # v5.14+ Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://lore.kernel.org/r/20250407134753.985925-2-tzimmermann@suse.de
2025-04-07drm/sysfb: Merge primary-plane functionsThomas Zimmermann
Merge the primary plane code of ofdrm and simpledrm. Replace the plane implementation in each driver with the shared helpers. Set up driver callbacks and format modifiers with initializer macros. The plane code in ofdrm and simpledrm is very similar. Ofdrm has a more sophisticated implementation of atomic_disable, which clears individual scanlines. The code in simpledrm clears the whole buffer at once. Take the ofdrm version. Simpledrm supports get_scanout_buffer. Import it into the shared helpers, which makes it available in ofdrm. The supported formats are all native formats plus an optional enulated XRGB8888 if that's not already a native format. Provide an initializer macro that computes the size of the formats array. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20250401094056.32904-12-tzimmermann@suse.de
2025-04-07drm/sysfb: Merge CRTC functionsThomas Zimmermann
Merge the CRTC functions of ofdrm and simpledrm. Replace the code in each driver with the shared helpers. Set up callbacks with initializer macros. Ofdrm supports a gamma LUT, while simpledrm does not. So far ofdrm's LUT size has been hard-coded in the driver CRTC's atomic_check helper. Now pass the size of the LUT to the sysfb device. Ofdrm's custom atomic_flush is still required to apply changes to the LUT. Simpledrm passes a LUT size of 0, which disables the gamma LUT. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20250401094056.32904-11-tzimmermann@suse.de
2025-04-07drm/sysfb: Maintain CRTC state in struct drm_sysfb_crtc_stateThomas Zimmermann
Move ofdrm's struct ofdrm_crtc_state plus functions to sysfb helpers and rename everything to drm_sysfb_crtc_state. The sysfb CRTC state is a regular CRTC state with information on the primary plane's color format, as required for color management. Helpers for sysfb planes will later set this up automatically. In ofdrm and simpledrm, replace existing code with the new helpers. Ofdrm continues to use the CRTC state for color management. This has no effect on simpledrm. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20250401094056.32904-10-tzimmermann@suse.de
2025-04-07drm/sysfb: Merge connector functionsThomas Zimmermann
Merge the connector functions of ofdrm and simpledrm. Replace the code in each driver with the shared helpers. Set up callbacks with initializer macros. No effective code changes. The sysfb connector only returns the preconfigured display mode. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20250401094056.32904-9-tzimmermann@suse.de
2025-04-07drm/sysfb: Merge mode-config functionsThomas Zimmermann
Provide initializer to set struct drm_mode_config_funcs. Convert ofdrm and simpledrm. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20250401094056.32904-8-tzimmermann@suse.de
2025-04-07drm/sysfb: Provide single mode-init helperThomas Zimmermann
Merge the mode-init functions of ofdrm and simpledrm to the new helper drm_sysfb_mode(). Also implement the DPI defaults there. Replace the code in each driver with the shared helper. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20250401094056.32904-7-tzimmermann@suse.de
2025-04-07drm/sysfb: Add struct drm_sysfb_deviceThomas Zimmermann
Add struct drm_sysfb_device that stores the system display's hardware settings. Further helpers for the mode-setting pipeline will use these fields. Convert ofdrm and simpledrm by embedding the sysfb device in their device structs. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20250401094056.32904-6-tzimmermann@suse.de
2025-04-07drm: Move sysfb drivers into separate subdirectoryThomas Zimmermann
The ofdrm and simpledrm drivers are special as they operate on externally provided framebuffers. Move them into their own sub- directory. Will let them share common code. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20250401094056.32904-5-tzimmermann@suse.de