forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/gpu/drm/armada/armada_fbdev.c
....@@ -1,22 +1,22 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2012 Russell King
34 * Written from the i915 driver.
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License version 2 as
7
- * published by the Free Software Foundation.
85 */
6
+
97 #include <linux/errno.h>
108 #include <linux/kernel.h>
119 #include <linux/module.h>
1210
1311 #include <drm/drm_fb_helper.h>
12
+#include <drm/drm_fourcc.h>
13
+
1414 #include "armada_crtc.h"
1515 #include "armada_drm.h"
1616 #include "armada_fb.h"
1717 #include "armada_gem.h"
1818
19
-static /*const*/ struct fb_ops armada_fb_ops = {
19
+static const struct fb_ops armada_fb_ops = {
2020 .owner = THIS_MODULE,
2121 DRM_FB_HELPER_DEFAULT_OPS,
2222 .fb_fillrect = drm_fb_helper_cfb_fillrect,
....@@ -51,13 +51,13 @@
5151
5252 ret = armada_gem_linear_back(dev, obj);
5353 if (ret) {
54
- drm_gem_object_put_unlocked(&obj->obj);
54
+ drm_gem_object_put(&obj->obj);
5555 return ret;
5656 }
5757
5858 ptr = armada_gem_map_object(dev, obj);
5959 if (!ptr) {
60
- drm_gem_object_put_unlocked(&obj->obj);
60
+ drm_gem_object_put(&obj->obj);
6161 return -ENOMEM;
6262 }
6363
....@@ -67,7 +67,7 @@
6767 * A reference is now held by the framebuffer object if
6868 * successful, otherwise this drops the ref for the error path.
6969 */
70
- drm_gem_object_put_unlocked(&obj->obj);
70
+ drm_gem_object_put(&obj->obj);
7171
7272 if (IS_ERR(dfb))
7373 return PTR_ERR(dfb);
....@@ -78,8 +78,6 @@
7878 goto err_fballoc;
7979 }
8080
81
- strlcpy(info->fix.id, "armada-drmfb", sizeof(info->fix.id));
82
- info->par = fbh;
8381 info->fbops = &armada_fb_ops;
8482 info->fix.smem_start = obj->phys_addr;
8583 info->fix.smem_len = obj->obj.size;
....@@ -87,9 +85,7 @@
8785 info->screen_base = ptr;
8886 fbh->fb = &dfb->fb;
8987
90
- drm_fb_helper_fill_fix(info, dfb->fb.pitches[0],
91
- dfb->fb.format->depth);
92
- drm_fb_helper_fill_var(info, fbh, sizes->fb_width, sizes->fb_height);
88
+ drm_fb_helper_fill_info(info, fbh, sizes);
9389
9490 DRM_DEBUG_KMS("allocated %dx%d %dbpp fb: 0x%08llx\n",
9591 dfb->fb.width, dfb->fb.height, dfb->fb.format->cpp[0] * 8,
....@@ -121,7 +117,7 @@
121117
122118 int armada_fbdev_init(struct drm_device *dev)
123119 {
124
- struct armada_private *priv = dev->dev_private;
120
+ struct armada_private *priv = drm_to_armada_dev(dev);
125121 struct drm_fb_helper *fbh;
126122 int ret;
127123
....@@ -133,16 +129,10 @@
133129
134130 drm_fb_helper_prepare(dev, fbh, &armada_fb_helper_funcs);
135131
136
- ret = drm_fb_helper_init(dev, fbh, 1);
132
+ ret = drm_fb_helper_init(dev, fbh);
137133 if (ret) {
138134 DRM_ERROR("failed to initialize drm fb helper\n");
139135 goto err_fb_helper;
140
- }
141
-
142
- ret = drm_fb_helper_single_add_all_connectors(fbh);
143
- if (ret) {
144
- DRM_ERROR("failed to add fb connectors\n");
145
- goto err_fb_setup;
146136 }
147137
148138 ret = drm_fb_helper_initial_config(fbh, 32);
....@@ -161,7 +151,7 @@
161151
162152 void armada_fbdev_fini(struct drm_device *dev)
163153 {
164
- struct armada_private *priv = dev->dev_private;
154
+ struct armada_private *priv = drm_to_armada_dev(dev);
165155 struct drm_fb_helper *fbh = priv->fbdev;
166156
167157 if (fbh) {