forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/gpu/drm/zte/zx_vga.c
....@@ -1,20 +1,20 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2017 Sanechips Technology Co., Ltd.
34 * Copyright 2017 Linaro Ltd.
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 */
96
107 #include <linux/clk.h>
118 #include <linux/component.h>
129 #include <linux/mfd/syscon.h>
10
+#include <linux/module.h>
11
+#include <linux/platform_device.h>
1312 #include <linux/regmap.h>
1413
1514 #include <drm/drm_atomic_helper.h>
16
-#include <drm/drm_crtc_helper.h>
17
-#include <drm/drmP.h>
15
+#include <drm/drm_print.h>
16
+#include <drm/drm_probe_helper.h>
17
+#include <drm/drm_simple_kms_helper.h>
1818
1919 #include "zx_drm_drv.h"
2020 #include "zx_vga_regs.h"
....@@ -71,10 +71,6 @@
7171 static const struct drm_encoder_helper_funcs zx_vga_encoder_helper_funcs = {
7272 .enable = zx_vga_encoder_enable,
7373 .disable = zx_vga_encoder_disable,
74
-};
75
-
76
-static const struct drm_encoder_funcs zx_vga_encoder_funcs = {
77
- .destroy = drm_encoder_cleanup,
7874 };
7975
8076 static int zx_vga_connector_get_modes(struct drm_connector *connector)
....@@ -155,23 +151,24 @@
155151
156152 encoder->possible_crtcs = VOU_CRTC_MASK;
157153
158
- ret = drm_encoder_init(drm, encoder, &zx_vga_encoder_funcs,
159
- DRM_MODE_ENCODER_DAC, NULL);
154
+ ret = drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_DAC);
160155 if (ret) {
161156 DRM_DEV_ERROR(dev, "failed to init encoder: %d\n", ret);
162157 return ret;
163
- };
158
+ }
164159
165160 drm_encoder_helper_add(encoder, &zx_vga_encoder_helper_funcs);
166161
167162 vga->connector.polled = DRM_CONNECTOR_POLL_HPD;
168163
169
- ret = drm_connector_init(drm, connector, &zx_vga_connector_funcs,
170
- DRM_MODE_CONNECTOR_VGA);
164
+ ret = drm_connector_init_with_ddc(drm, connector,
165
+ &zx_vga_connector_funcs,
166
+ DRM_MODE_CONNECTOR_VGA,
167
+ &vga->ddc->adap);
171168 if (ret) {
172169 DRM_DEV_ERROR(dev, "failed to init connector: %d\n", ret);
173170 goto clean_encoder;
174
- };
171
+ }
175172
176173 drm_connector_helper_add(connector, &zx_vga_connector_helper_funcs);
177174
....@@ -179,7 +176,7 @@
179176 if (ret) {
180177 DRM_DEV_ERROR(dev, "failed to attach encoder: %d\n", ret);
181178 goto clean_connector;
182
- };
179
+ }
183180
184181 return 0;
185182