hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/drivers/gpu/drm/msm/disp/mdp5/mdp5_cmd_encoder.c
....@@ -1,18 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License version 2 and
6
- * only version 2 as published by the Free Software Foundation.
7
- *
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
124 */
135
146 #include <drm/drm_crtc.h>
15
-#include <drm/drm_crtc_helper.h>
7
+#include <drm/drm_probe_helper.h>
168
179 #include "mdp5_kms.h"
1810
....@@ -22,57 +14,36 @@
2214 return to_mdp5_kms(to_mdp_kms(priv->kms));
2315 }
2416
25
-#ifdef DOWNSTREAM_CONFIG_MSM_BUS_SCALING
26
-#include <mach/board.h>
27
-#include <linux/msm-bus.h>
28
-#include <linux/msm-bus-board.h>
29
-
30
-static void bs_set(struct mdp5_encoder *mdp5_cmd_enc, int idx)
31
-{
32
- if (mdp5_cmd_enc->bsc) {
33
- DBG("set bus scaling: %d", idx);
34
- /* HACK: scaling down, and then immediately back up
35
- * seems to leave things broken (underflow).. so
36
- * never disable:
37
- */
38
- idx = 1;
39
- msm_bus_scale_client_update_request(mdp5_cmd_enc->bsc, idx);
40
- }
41
-}
42
-#else
43
-static void bs_set(struct mdp5_encoder *mdp5_cmd_enc, int idx) {}
44
-#endif
45
-
4617 #define VSYNC_CLK_RATE 19200000
4718 static int pingpong_tearcheck_setup(struct drm_encoder *encoder,
4819 struct drm_display_mode *mode)
4920 {
5021 struct mdp5_kms *mdp5_kms = get_kms(encoder);
5122 struct device *dev = encoder->dev->dev;
52
- u32 total_lines_x100, vclks_line, cfg;
23
+ u32 total_lines, vclks_line, cfg;
5324 long vsync_clk_speed;
5425 struct mdp5_hw_mixer *mixer = mdp5_crtc_get_mixer(encoder->crtc);
5526 int pp_id = mixer->pp;
5627
5728 if (IS_ERR_OR_NULL(mdp5_kms->vsync_clk)) {
58
- dev_err(dev, "vsync_clk is not initialized\n");
29
+ DRM_DEV_ERROR(dev, "vsync_clk is not initialized\n");
5930 return -EINVAL;
6031 }
6132
62
- total_lines_x100 = mode->vtotal * mode->vrefresh;
63
- if (!total_lines_x100) {
64
- dev_err(dev, "%s: vtotal(%d) or vrefresh(%d) is 0\n",
65
- __func__, mode->vtotal, mode->vrefresh);
33
+ total_lines = mode->vtotal * drm_mode_vrefresh(mode);
34
+ if (!total_lines) {
35
+ DRM_DEV_ERROR(dev, "%s: vtotal(%d) or vrefresh(%d) is 0\n",
36
+ __func__, mode->vtotal, drm_mode_vrefresh(mode));
6637 return -EINVAL;
6738 }
6839
6940 vsync_clk_speed = clk_round_rate(mdp5_kms->vsync_clk, VSYNC_CLK_RATE);
7041 if (vsync_clk_speed <= 0) {
71
- dev_err(dev, "vsync_clk round rate failed %ld\n",
42
+ DRM_DEV_ERROR(dev, "vsync_clk round rate failed %ld\n",
7243 vsync_clk_speed);
7344 return -EINVAL;
7445 }
75
- vclks_line = vsync_clk_speed * 100 / total_lines_x100;
46
+ vclks_line = vsync_clk_speed / total_lines;
7647
7748 cfg = MDP5_PP_SYNC_CONFIG_VSYNC_COUNTER_EN
7849 | MDP5_PP_SYNC_CONFIG_VSYNC_IN_EN;
....@@ -110,13 +81,13 @@
11081 ret = clk_set_rate(mdp5_kms->vsync_clk,
11182 clk_round_rate(mdp5_kms->vsync_clk, VSYNC_CLK_RATE));
11283 if (ret) {
113
- dev_err(encoder->dev->dev,
84
+ DRM_DEV_ERROR(encoder->dev->dev,
11485 "vsync_clk clk_set_rate failed, %d\n", ret);
11586 return ret;
11687 }
11788 ret = clk_prepare_enable(mdp5_kms->vsync_clk);
11889 if (ret) {
119
- dev_err(encoder->dev->dev,
90
+ DRM_DEV_ERROR(encoder->dev->dev,
12091 "vsync_clk clk_prepare_enable failed, %d\n", ret);
12192 return ret;
12293 }
....@@ -142,14 +113,7 @@
142113 {
143114 mode = adjusted_mode;
144115
145
- DBG("set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x",
146
- mode->base.id, mode->name,
147
- mode->vrefresh, mode->clock,
148
- mode->hdisplay, mode->hsync_start,
149
- mode->hsync_end, mode->htotal,
150
- mode->vdisplay, mode->vsync_start,
151
- mode->vsync_end, mode->vtotal,
152
- mode->type, mode->flags);
116
+ DBG("set mode: " DRM_MODE_FMT, DRM_MODE_ARG(mode));
153117 pingpong_tearcheck_setup(encoder, mode);
154118 mdp5_crtc_set_pipeline(encoder->crtc);
155119 }
....@@ -169,8 +133,6 @@
169133 mdp5_ctl_set_encoder_state(ctl, pipeline, false);
170134 mdp5_ctl_commit(ctl, pipeline, mdp_ctl_flush_mask_encoder(intf), true);
171135
172
- bs_set(mdp5_cmd_enc, 0);
173
-
174136 mdp5_cmd_enc->enabled = false;
175137 }
176138
....@@ -184,7 +146,6 @@
184146 if (WARN_ON(mdp5_cmd_enc->enabled))
185147 return;
186148
187
- bs_set(mdp5_cmd_enc, 1);
188149 if (pingpong_tearcheck_enable(encoder))
189150 return;
190151