forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/gpu/drm/sun4i/sun4i_tv.c
....@@ -1,26 +1,25 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (C) 2015 Free Electrons
34 * Copyright (C) 2015 NextThing Co
45 *
56 * Maxime Ripard <maxime.ripard@free-electrons.com>
6
- *
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU General Public License as
9
- * published by the Free Software Foundation; either version 2 of
10
- * the License, or (at your option) any later version.
117 */
128
139 #include <linux/clk.h>
1410 #include <linux/component.h>
11
+#include <linux/module.h>
1512 #include <linux/of_address.h>
13
+#include <linux/platform_device.h>
1614 #include <linux/regmap.h>
1715 #include <linux/reset.h>
1816
19
-#include <drm/drmP.h>
2017 #include <drm/drm_atomic_helper.h>
21
-#include <drm/drm_crtc_helper.h>
2218 #include <drm/drm_of.h>
2319 #include <drm/drm_panel.h>
20
+#include <drm/drm_print.h>
21
+#include <drm/drm_probe_helper.h>
22
+#include <drm/drm_simple_kms_helper.h>
2423
2524 #include "sun4i_crtc.h"
2625 #include "sun4i_drv.h"
....@@ -469,19 +468,10 @@
469468 regmap_write(tv->regs, SUN4I_TVE_SLAVE_REG, 0);
470469 }
471470
472
-static struct drm_encoder_helper_funcs sun4i_tv_helper_funcs = {
471
+static const struct drm_encoder_helper_funcs sun4i_tv_helper_funcs = {
473472 .disable = sun4i_tv_disable,
474473 .enable = sun4i_tv_enable,
475474 .mode_set = sun4i_tv_mode_set,
476
-};
477
-
478
-static void sun4i_tv_destroy(struct drm_encoder *encoder)
479
-{
480
- drm_encoder_cleanup(encoder);
481
-}
482
-
483
-static struct drm_encoder_funcs sun4i_tv_funcs = {
484
- .destroy = sun4i_tv_destroy,
485475 };
486476
487477 static int sun4i_tv_comp_get_modes(struct drm_connector *connector)
....@@ -514,7 +504,7 @@
514504 return MODE_OK;
515505 }
516506
517
-static struct drm_connector_helper_funcs sun4i_tv_comp_connector_helper_funcs = {
507
+static const struct drm_connector_helper_funcs sun4i_tv_comp_connector_helper_funcs = {
518508 .get_modes = sun4i_tv_comp_get_modes,
519509 .mode_valid = sun4i_tv_comp_mode_valid,
520510 };
....@@ -533,7 +523,7 @@
533523 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
534524 };
535525
536
-static struct regmap_config sun4i_tv_regmap_config = {
526
+static const struct regmap_config sun4i_tv_regmap_config = {
537527 .reg_bits = 32,
538528 .val_bits = 32,
539529 .reg_stride = 4,
....@@ -594,11 +584,8 @@
594584
595585 drm_encoder_helper_add(&tv->encoder,
596586 &sun4i_tv_helper_funcs);
597
- ret = drm_encoder_init(drm,
598
- &tv->encoder,
599
- &sun4i_tv_funcs,
600
- DRM_MODE_ENCODER_TVDAC,
601
- NULL);
587
+ ret = drm_simple_encoder_init(drm, &tv->encoder,
588
+ DRM_MODE_ENCODER_TVDAC);
602589 if (ret) {
603590 dev_err(dev, "Couldn't initialise the TV encoder\n");
604591 goto err_disable_clk;