diff mbox series

[3/4] drm/armada: Initialize fbdev DRM client

Message ID 20230330073046.7150-4-tzimmermann@suse.de (mailing list archive)
State New, archived
Headers show
Series drm/armada: Convert fbdev to DRM client | expand

Commit Message

Thomas Zimmermann March 30, 2023, 7:30 a.m. UTC
Initialize the fbdev client in the fbdev code with empty helper
functions. Also clean up the client. The helpers will later
implement various functionality of the DRM client. No functional
changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/armada/armada_fbdev.c | 43 ++++++++++++++++++++++++---
 1 file changed, 39 insertions(+), 4 deletions(-)

Comments

Javier Martinez Canillas April 17, 2023, 2:04 p.m. UTC | #1
Hello Thomas,

Thomas Zimmermann <tzimmermann@suse.de> writes:

> Initialize the fbdev client in the fbdev code with empty helper
> functions. Also clean up the client. The helpers will later
> implement various functionality of the DRM client. No functional
> changes.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/armada/armada_fbdev.c b/drivers/gpu/drm/armada/armada_fbdev.c
index 0e44f53e9fa4..303c55704225 100644
--- a/drivers/gpu/drm/armada/armada_fbdev.c
+++ b/drivers/gpu/drm/armada/armada_fbdev.c
@@ -117,6 +117,32 @@  static const struct drm_fb_helper_funcs armada_fb_helper_funcs = {
 	.fb_probe	= armada_fb_probe,
 };
 
+/*
+ * Fbdev client and struct drm_client_funcs
+ */
+
+static void armada_fbdev_client_unregister(struct drm_client_dev *client)
+{ }
+
+static int armada_fbdev_client_restore(struct drm_client_dev *client)
+{
+	drm_fb_helper_lastclose(client->dev);
+
+	return 0;
+}
+
+static int armada_fbdev_client_hotplug(struct drm_client_dev *client)
+{
+	return 0;
+}
+
+static const struct drm_client_funcs armada_fbdev_client_funcs = {
+	.owner		= THIS_MODULE,
+	.unregister	= armada_fbdev_client_unregister,
+	.restore	= armada_fbdev_client_restore,
+	.hotplug	= armada_fbdev_client_hotplug,
+};
+
 int armada_fbdev_init(struct drm_device *dev)
 {
 	struct armada_private *priv = drm_to_armada_dev(dev);
@@ -131,22 +157,30 @@  int armada_fbdev_init(struct drm_device *dev)
 
 	drm_fb_helper_prepare(dev, fbh, 32, &armada_fb_helper_funcs);
 
+	ret = drm_client_init(dev, &fbh->client, "armada-fbdev",
+			      &armada_fbdev_client_funcs);
+	if (ret)
+		goto err_drm_fb_helper_unprepare;
+
 	ret = drm_fb_helper_init(dev, fbh);
 	if (ret) {
 		DRM_ERROR("failed to initialize drm fb helper\n");
-		goto err_fb_helper;
+		goto err_drm_client_release;
 	}
 
 	ret = drm_fb_helper_initial_config(fbh);
 	if (ret) {
 		DRM_ERROR("failed to set initial config\n");
-		goto err_fb_setup;
+		goto err_drm_fb_helper_fini;
 	}
 
 	return 0;
- err_fb_setup:
+
+err_drm_fb_helper_fini:
 	drm_fb_helper_fini(fbh);
- err_fb_helper:
+err_drm_client_release:
+	drm_client_release(&fbh->client);
+err_drm_fb_helper_unprepare:
 	drm_fb_helper_unprepare(fbh);
 	priv->fbdev = NULL;
 	return ret;
@@ -161,6 +195,7 @@  void armada_fbdev_fini(struct drm_device *dev)
 		drm_fb_helper_unregister_info(fbh);
 
 		drm_fb_helper_fini(fbh);
+		drm_client_release(&fbh->client);
 
 		if (fbh->fb)
 			fbh->fb->funcs->destroy(fbh->fb);