Commit 16844fb1e612e44cdda7043238230b12bdb68437
Committed by
Inki Dae
1 parent
725ddead50
Exists in
master
and in
20 other branches
drm/exynos: hdmi: use drm_display_mode to check the supported modes
This patch renames check_timing to check_mode and removes the unnecessary conversion of drm_display_mode to/from fb_videomode in the hdmi driver. v4: 1) Changed the commit message to add information related to renaming the callbacks to check_mode. 2) Changed debug message to print 1/0 for interlace mode. v3: 1) Replaced check_timing callbacks with check_mode. 2) Change the type of second parameter of check_mode callback from void pointer paramenter to struct drm_display_mode pointer. v2: 1) Removed convert_to_video_timing(). 2) Corrected DRM_DEBUG_KMS to print the resolution properly. Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
Showing 8 changed files with 41 additions and 76 deletions Side-by-side Diff
- drivers/gpu/drm/exynos/exynos_drm_connector.c
- drivers/gpu/drm/exynos/exynos_drm_drv.h
- drivers/gpu/drm/exynos/exynos_drm_fimd.c
- drivers/gpu/drm/exynos/exynos_drm_hdmi.c
- drivers/gpu/drm/exynos/exynos_drm_hdmi.h
- drivers/gpu/drm/exynos/exynos_drm_vidi.c
- drivers/gpu/drm/exynos/exynos_hdmi.c
- drivers/gpu/drm/exynos/exynos_mixer.c
drivers/gpu/drm/exynos/exynos_drm_connector.c
... | ... | @@ -58,37 +58,6 @@ |
58 | 58 | mode->flags |= DRM_MODE_FLAG_DBLSCAN; |
59 | 59 | } |
60 | 60 | |
61 | -/* convert drm_display_mode to exynos_video_timings */ | |
62 | -static inline void | |
63 | -convert_to_video_timing(struct fb_videomode *timing, | |
64 | - struct drm_display_mode *mode) | |
65 | -{ | |
66 | - DRM_DEBUG_KMS("%s\n", __FILE__); | |
67 | - | |
68 | - memset(timing, 0, sizeof(*timing)); | |
69 | - | |
70 | - timing->pixclock = mode->clock * 1000; | |
71 | - timing->refresh = drm_mode_vrefresh(mode); | |
72 | - | |
73 | - timing->xres = mode->hdisplay; | |
74 | - timing->right_margin = mode->hsync_start - mode->hdisplay; | |
75 | - timing->hsync_len = mode->hsync_end - mode->hsync_start; | |
76 | - timing->left_margin = mode->htotal - mode->hsync_end; | |
77 | - | |
78 | - timing->yres = mode->vdisplay; | |
79 | - timing->lower_margin = mode->vsync_start - mode->vdisplay; | |
80 | - timing->vsync_len = mode->vsync_end - mode->vsync_start; | |
81 | - timing->upper_margin = mode->vtotal - mode->vsync_end; | |
82 | - | |
83 | - if (mode->flags & DRM_MODE_FLAG_INTERLACE) | |
84 | - timing->vmode = FB_VMODE_INTERLACED; | |
85 | - else | |
86 | - timing->vmode = FB_VMODE_NONINTERLACED; | |
87 | - | |
88 | - if (mode->flags & DRM_MODE_FLAG_DBLSCAN) | |
89 | - timing->vmode |= FB_VMODE_DOUBLE; | |
90 | -} | |
91 | - | |
92 | 61 | static int exynos_drm_connector_get_modes(struct drm_connector *connector) |
93 | 62 | { |
94 | 63 | struct exynos_drm_connector *exynos_connector = |
95 | 64 | |
... | ... | @@ -168,15 +137,12 @@ |
168 | 137 | to_exynos_connector(connector); |
169 | 138 | struct exynos_drm_manager *manager = exynos_connector->manager; |
170 | 139 | struct exynos_drm_display_ops *display_ops = manager->display_ops; |
171 | - struct fb_videomode timing; | |
172 | 140 | int ret = MODE_BAD; |
173 | 141 | |
174 | 142 | DRM_DEBUG_KMS("%s\n", __FILE__); |
175 | 143 | |
176 | - convert_to_video_timing(&timing, mode); | |
177 | - | |
178 | - if (display_ops && display_ops->check_timing) | |
179 | - if (!display_ops->check_timing(manager->dev, (void *)&timing)) | |
144 | + if (display_ops && display_ops->check_mode) | |
145 | + if (!display_ops->check_mode(manager->dev, mode)) | |
180 | 146 | ret = MODE_OK; |
181 | 147 | |
182 | 148 | return ret; |
drivers/gpu/drm/exynos/exynos_drm_drv.h
... | ... | @@ -142,7 +142,7 @@ |
142 | 142 | * @is_connected: check for that display is connected or not. |
143 | 143 | * @get_edid: get edid modes from display driver. |
144 | 144 | * @get_panel: get panel object from display driver. |
145 | - * @check_timing: check if timing is valid or not. | |
145 | + * @check_mode: check if mode is valid or not. | |
146 | 146 | * @power_on: display device on or off. |
147 | 147 | */ |
148 | 148 | struct exynos_drm_display_ops { |
... | ... | @@ -151,7 +151,7 @@ |
151 | 151 | struct edid *(*get_edid)(struct device *dev, |
152 | 152 | struct drm_connector *connector); |
153 | 153 | void *(*get_panel)(struct device *dev); |
154 | - int (*check_timing)(struct device *dev, void *timing); | |
154 | + int (*check_mode)(struct device *dev, struct drm_display_mode *mode); | |
155 | 155 | int (*power_on)(struct device *dev, int mode); |
156 | 156 | }; |
157 | 157 |
drivers/gpu/drm/exynos/exynos_drm_fimd.c
... | ... | @@ -166,7 +166,7 @@ |
166 | 166 | return ctx->panel; |
167 | 167 | } |
168 | 168 | |
169 | -static int fimd_check_timing(struct device *dev, void *timing) | |
169 | +static int fimd_check_mode(struct device *dev, struct drm_display_mode *mode) | |
170 | 170 | { |
171 | 171 | DRM_DEBUG_KMS("%s\n", __FILE__); |
172 | 172 | |
... | ... | @@ -188,7 +188,7 @@ |
188 | 188 | .type = EXYNOS_DISPLAY_TYPE_LCD, |
189 | 189 | .is_connected = fimd_display_is_connected, |
190 | 190 | .get_panel = fimd_get_panel, |
191 | - .check_timing = fimd_check_timing, | |
191 | + .check_mode = fimd_check_mode, | |
192 | 192 | .power_on = fimd_display_power_on, |
193 | 193 | }; |
194 | 194 |
drivers/gpu/drm/exynos/exynos_drm_hdmi.c
... | ... | @@ -127,7 +127,8 @@ |
127 | 127 | return NULL; |
128 | 128 | } |
129 | 129 | |
130 | -static int drm_hdmi_check_timing(struct device *dev, void *timing) | |
130 | +static int drm_hdmi_check_mode(struct device *dev, | |
131 | + struct drm_display_mode *mode) | |
131 | 132 | { |
132 | 133 | struct drm_hdmi_context *ctx = to_context(dev); |
133 | 134 | int ret = 0; |
134 | 135 | |
... | ... | @@ -139,14 +140,14 @@ |
139 | 140 | * If any of the two fails, return mode as BAD. |
140 | 141 | */ |
141 | 142 | |
142 | - if (mixer_ops && mixer_ops->check_timing) | |
143 | - ret = mixer_ops->check_timing(ctx->mixer_ctx->ctx, timing); | |
143 | + if (mixer_ops && mixer_ops->check_mode) | |
144 | + ret = mixer_ops->check_mode(ctx->mixer_ctx->ctx, mode); | |
144 | 145 | |
145 | 146 | if (ret) |
146 | 147 | return ret; |
147 | 148 | |
148 | - if (hdmi_ops && hdmi_ops->check_timing) | |
149 | - return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx, timing); | |
149 | + if (hdmi_ops && hdmi_ops->check_mode) | |
150 | + return hdmi_ops->check_mode(ctx->hdmi_ctx->ctx, mode); | |
150 | 151 | |
151 | 152 | return 0; |
152 | 153 | } |
... | ... | @@ -167,7 +168,7 @@ |
167 | 168 | .type = EXYNOS_DISPLAY_TYPE_HDMI, |
168 | 169 | .is_connected = drm_hdmi_is_connected, |
169 | 170 | .get_edid = drm_hdmi_get_edid, |
170 | - .check_timing = drm_hdmi_check_timing, | |
171 | + .check_mode = drm_hdmi_check_mode, | |
171 | 172 | .power_on = drm_hdmi_power_on, |
172 | 173 | }; |
173 | 174 | |
... | ... | @@ -218,7 +219,7 @@ |
218 | 219 | |
219 | 220 | drm_mode_set_crtcinfo(adjusted_mode, 0); |
220 | 221 | |
221 | - mode_ok = drm_hdmi_check_timing(subdrv_dev, adjusted_mode); | |
222 | + mode_ok = drm_hdmi_check_mode(subdrv_dev, adjusted_mode); | |
222 | 223 | |
223 | 224 | /* just return if user desired mode exists. */ |
224 | 225 | if (mode_ok == 0) |
... | ... | @@ -229,7 +230,7 @@ |
229 | 230 | * to adjusted_mode. |
230 | 231 | */ |
231 | 232 | list_for_each_entry(m, &connector->modes, head) { |
232 | - mode_ok = drm_hdmi_check_timing(subdrv_dev, m); | |
233 | + mode_ok = drm_hdmi_check_mode(subdrv_dev, m); | |
233 | 234 | |
234 | 235 | if (mode_ok == 0) { |
235 | 236 | struct drm_mode_object base; |
drivers/gpu/drm/exynos/exynos_drm_hdmi.h
... | ... | @@ -32,11 +32,11 @@ |
32 | 32 | bool (*is_connected)(void *ctx); |
33 | 33 | struct edid *(*get_edid)(void *ctx, |
34 | 34 | struct drm_connector *connector); |
35 | - int (*check_timing)(void *ctx, struct fb_videomode *timing); | |
35 | + int (*check_mode)(void *ctx, struct drm_display_mode *mode); | |
36 | 36 | int (*power_on)(void *ctx, int mode); |
37 | 37 | |
38 | 38 | /* manager */ |
39 | - void (*mode_set)(void *ctx, void *mode); | |
39 | + void (*mode_set)(void *ctx, struct drm_display_mode *mode); | |
40 | 40 | void (*get_max_resol)(void *ctx, unsigned int *width, |
41 | 41 | unsigned int *height); |
42 | 42 | void (*commit)(void *ctx); |
... | ... | @@ -57,7 +57,7 @@ |
57 | 57 | void (*win_disable)(void *ctx, int zpos); |
58 | 58 | |
59 | 59 | /* display */ |
60 | - int (*check_timing)(void *ctx, struct fb_videomode *timing); | |
60 | + int (*check_mode)(void *ctx, struct drm_display_mode *mode); | |
61 | 61 | }; |
62 | 62 | |
63 | 63 | void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx); |
drivers/gpu/drm/exynos/exynos_drm_vidi.c
... | ... | @@ -135,7 +135,7 @@ |
135 | 135 | return NULL; |
136 | 136 | } |
137 | 137 | |
138 | -static int vidi_check_timing(struct device *dev, void *timing) | |
138 | +static int vidi_check_mode(struct device *dev, struct drm_display_mode *mode) | |
139 | 139 | { |
140 | 140 | DRM_DEBUG_KMS("%s\n", __FILE__); |
141 | 141 | |
... | ... | @@ -158,7 +158,7 @@ |
158 | 158 | .is_connected = vidi_display_is_connected, |
159 | 159 | .get_edid = vidi_get_edid, |
160 | 160 | .get_panel = vidi_get_panel, |
161 | - .check_timing = vidi_check_timing, | |
161 | + .check_mode = vidi_check_mode, | |
162 | 162 | .power_on = vidi_display_power_on, |
163 | 163 | }; |
164 | 164 |
drivers/gpu/drm/exynos/exynos_hdmi.c
... | ... | @@ -796,18 +796,17 @@ |
796 | 796 | return -EINVAL; |
797 | 797 | } |
798 | 798 | |
799 | -static int hdmi_check_timing(void *ctx, struct fb_videomode *timing) | |
799 | +static int hdmi_check_mode(void *ctx, struct drm_display_mode *mode) | |
800 | 800 | { |
801 | 801 | struct hdmi_context *hdata = ctx; |
802 | 802 | int ret; |
803 | 803 | |
804 | - DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | |
804 | + DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%d clock=%d\n", | |
805 | + mode->hdisplay, mode->vdisplay, mode->vrefresh, | |
806 | + (mode->flags & DRM_MODE_FLAG_INTERLACE) ? true : | |
807 | + false, mode->clock * 1000); | |
805 | 808 | |
806 | - DRM_DEBUG_KMS("[%d]x[%d] [%d]Hz [%x]\n", timing->xres, | |
807 | - timing->yres, timing->refresh, | |
808 | - timing->vmode); | |
809 | - | |
810 | - ret = hdmi_find_phy_conf(hdata, timing->pixclock); | |
809 | + ret = hdmi_find_phy_conf(hdata, mode->clock * 1000); | |
811 | 810 | if (ret < 0) |
812 | 811 | return ret; |
813 | 812 | return 0; |
... | ... | @@ -1042,7 +1041,7 @@ |
1042 | 1041 | } |
1043 | 1042 | } |
1044 | 1043 | |
1045 | -static void hdmi_v13_timing_apply(struct hdmi_context *hdata) | |
1044 | +static void hdmi_v13_mode_apply(struct hdmi_context *hdata) | |
1046 | 1045 | { |
1047 | 1046 | const struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v13_conf.tg; |
1048 | 1047 | const struct hdmi_v13_core_regs *core = |
... | ... | @@ -1131,7 +1130,7 @@ |
1131 | 1130 | hdmi_reg_writemask(hdata, HDMI_TG_CMD, ~0, HDMI_TG_EN); |
1132 | 1131 | } |
1133 | 1132 | |
1134 | -static void hdmi_v14_timing_apply(struct hdmi_context *hdata) | |
1133 | +static void hdmi_v14_mode_apply(struct hdmi_context *hdata) | |
1135 | 1134 | { |
1136 | 1135 | const struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v14_conf.tg; |
1137 | 1136 | const struct hdmi_v14_core_regs *core = |
1138 | 1137 | |
1139 | 1138 | |
... | ... | @@ -1298,12 +1297,12 @@ |
1298 | 1297 | hdmi_reg_writemask(hdata, HDMI_TG_CMD, ~0, HDMI_TG_EN); |
1299 | 1298 | } |
1300 | 1299 | |
1301 | -static void hdmi_timing_apply(struct hdmi_context *hdata) | |
1300 | +static void hdmi_mode_apply(struct hdmi_context *hdata) | |
1302 | 1301 | { |
1303 | 1302 | if (hdata->type == HDMI_TYPE13) |
1304 | - hdmi_v13_timing_apply(hdata); | |
1303 | + hdmi_v13_mode_apply(hdata); | |
1305 | 1304 | else |
1306 | - hdmi_v14_timing_apply(hdata); | |
1305 | + hdmi_v14_mode_apply(hdata); | |
1307 | 1306 | } |
1308 | 1307 | |
1309 | 1308 | static void hdmiphy_conf_reset(struct hdmi_context *hdata) |
... | ... | @@ -1423,7 +1422,7 @@ |
1423 | 1422 | hdmi_audio_init(hdata); |
1424 | 1423 | |
1425 | 1424 | /* setting core registers */ |
1426 | - hdmi_timing_apply(hdata); | |
1425 | + hdmi_mode_apply(hdata); | |
1427 | 1426 | hdmi_audio_control(hdata, true); |
1428 | 1427 | |
1429 | 1428 | hdmi_regs_dump(hdata, "start"); |
... | ... | @@ -1642,7 +1641,7 @@ |
1642 | 1641 | hdmi_set_reg(tg->tg_3d, 1, 0x0); |
1643 | 1642 | } |
1644 | 1643 | |
1645 | -static void hdmi_mode_set(void *ctx, void *mode) | |
1644 | +static void hdmi_mode_set(void *ctx, struct drm_display_mode *mode) | |
1646 | 1645 | { |
1647 | 1646 | struct hdmi_context *hdata = ctx; |
1648 | 1647 | struct drm_display_mode *m = mode; |
... | ... | @@ -1767,7 +1766,7 @@ |
1767 | 1766 | /* display */ |
1768 | 1767 | .is_connected = hdmi_is_connected, |
1769 | 1768 | .get_edid = hdmi_get_edid, |
1770 | - .check_timing = hdmi_check_timing, | |
1769 | + .check_mode = hdmi_check_mode, | |
1771 | 1770 | |
1772 | 1771 | /* manager */ |
1773 | 1772 | .mode_set = hdmi_mode_set, |
drivers/gpu/drm/exynos/exynos_mixer.c
... | ... | @@ -820,17 +820,16 @@ |
820 | 820 | mixer_ctx->win_data[win].enabled = false; |
821 | 821 | } |
822 | 822 | |
823 | -static int mixer_check_timing(void *ctx, struct fb_videomode *timing) | |
823 | +static int mixer_check_mode(void *ctx, struct drm_display_mode *mode) | |
824 | 824 | { |
825 | 825 | u32 w, h; |
826 | 826 | |
827 | - w = timing->xres; | |
828 | - h = timing->yres; | |
827 | + w = mode->hdisplay; | |
828 | + h = mode->vdisplay; | |
829 | 829 | |
830 | - DRM_DEBUG_KMS("%s : xres=%d, yres=%d, refresh=%d, intl=%d\n", | |
831 | - __func__, timing->xres, timing->yres, | |
832 | - timing->refresh, (timing->vmode & | |
833 | - FB_VMODE_INTERLACED) ? true : false); | |
830 | + DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%d\n", | |
831 | + mode->hdisplay, mode->vdisplay, mode->vrefresh, | |
832 | + (mode->flags & DRM_MODE_FLAG_INTERLACE) ? 1 : 0); | |
834 | 833 | |
835 | 834 | if ((w >= 464 && w <= 720 && h >= 261 && h <= 576) || |
836 | 835 | (w >= 1024 && w <= 1280 && h >= 576 && h <= 720) || |
... | ... | @@ -978,7 +977,7 @@ |
978 | 977 | .win_disable = mixer_win_disable, |
979 | 978 | |
980 | 979 | /* display */ |
981 | - .check_timing = mixer_check_timing, | |
980 | + .check_mode = mixer_check_mode, | |
982 | 981 | }; |
983 | 982 | |
984 | 983 | static irqreturn_t mixer_irq_handler(int irq, void *arg) |