aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorJoonyoung Shim <jy0922.shim@samsung.com>2012-06-27 01:27:11 -0400
committerInki Dae <inki.dae@samsung.com>2012-07-26 22:13:54 -0400
commit3b8d1cf818c2cbd20573d121ec08c7c5147f1302 (patch)
tree8ebfe97ae4982f07b5bca428873af8f6210fdd14 /drivers/gpu
parenta365d9eba36f387a3976d28f2fd153dfe1824556 (diff)
drm/exynos: add property for crtc mode
This patch adds exynos specific property for crtc mode. The crtc mode property has tow modes - normal and blank. The normal mode is default mode and can use crtc normally. The blank mode turns off the private plane of crtc, so we don't see crtc screen but can see other plane screens. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_crtc.c72
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.h1
2 files changed, 73 insertions, 0 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 047257bf9be0..abb1e2f8227f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -36,6 +36,11 @@
36#define to_exynos_crtc(x) container_of(x, struct exynos_drm_crtc,\ 36#define to_exynos_crtc(x) container_of(x, struct exynos_drm_crtc,\
37 drm_crtc) 37 drm_crtc)
38 38
39enum exynos_crtc_mode {
40 CRTC_MODE_NORMAL, /* normal mode */
41 CRTC_MODE_BLANK, /* The private plane of crtc is blank */
42};
43
39/* 44/*
40 * Exynos specific crtc structure. 45 * Exynos specific crtc structure.
41 * 46 *
@@ -49,12 +54,14 @@
49 * we can refer to the crtc to current hardware interrupt occured through 54 * we can refer to the crtc to current hardware interrupt occured through
50 * this pipe value. 55 * this pipe value.
51 * @dpms: store the crtc dpms value 56 * @dpms: store the crtc dpms value
57 * @mode: store the crtc mode value
52 */ 58 */
53struct exynos_drm_crtc { 59struct exynos_drm_crtc {
54 struct drm_crtc drm_crtc; 60 struct drm_crtc drm_crtc;
55 struct drm_plane *plane; 61 struct drm_plane *plane;
56 unsigned int pipe; 62 unsigned int pipe;
57 unsigned int dpms; 63 unsigned int dpms;
64 enum exynos_crtc_mode mode;
58}; 65};
59 66
60static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) 67static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
@@ -255,12 +262,75 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
255 kfree(exynos_crtc); 262 kfree(exynos_crtc);
256} 263}
257 264
265static int exynos_drm_crtc_set_property(struct drm_crtc *crtc,
266 struct drm_property *property,
267 uint64_t val)
268{
269 struct drm_device *dev = crtc->dev;
270 struct exynos_drm_private *dev_priv = dev->dev_private;
271 struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
272
273 DRM_DEBUG_KMS("%s\n", __func__);
274
275 if (property == dev_priv->crtc_mode_property) {
276 enum exynos_crtc_mode mode = val;
277
278 if (mode == exynos_crtc->mode)
279 return 0;
280
281 exynos_crtc->mode = mode;
282
283 switch (mode) {
284 case CRTC_MODE_NORMAL:
285 exynos_drm_crtc_commit(crtc);
286 break;
287 case CRTC_MODE_BLANK:
288 exynos_plane_dpms(exynos_crtc->plane,
289 DRM_MODE_DPMS_OFF);
290 break;
291 default:
292 break;
293 }
294
295 return 0;
296 }
297
298 return -EINVAL;
299}
300
258static struct drm_crtc_funcs exynos_crtc_funcs = { 301static struct drm_crtc_funcs exynos_crtc_funcs = {
259 .set_config = drm_crtc_helper_set_config, 302 .set_config = drm_crtc_helper_set_config,
260 .page_flip = exynos_drm_crtc_page_flip, 303 .page_flip = exynos_drm_crtc_page_flip,
261 .destroy = exynos_drm_crtc_destroy, 304 .destroy = exynos_drm_crtc_destroy,
305 .set_property = exynos_drm_crtc_set_property,
306};
307
308static const struct drm_prop_enum_list mode_names[] = {
309 { CRTC_MODE_NORMAL, "normal" },
310 { CRTC_MODE_BLANK, "blank" },
262}; 311};
263 312
313static void exynos_drm_crtc_attach_mode_property(struct drm_crtc *crtc)
314{
315 struct drm_device *dev = crtc->dev;
316 struct exynos_drm_private *dev_priv = dev->dev_private;
317 struct drm_property *prop;
318
319 DRM_DEBUG_KMS("%s\n", __func__);
320
321 prop = dev_priv->crtc_mode_property;
322 if (!prop) {
323 prop = drm_property_create_enum(dev, 0, "mode", mode_names,
324 ARRAY_SIZE(mode_names));
325 if (!prop)
326 return;
327
328 dev_priv->crtc_mode_property = prop;
329 }
330
331 drm_object_attach_property(&crtc->base, prop, 0);
332}
333
264int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr) 334int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr)
265{ 335{
266 struct exynos_drm_crtc *exynos_crtc; 336 struct exynos_drm_crtc *exynos_crtc;
@@ -290,6 +360,8 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr)
290 drm_crtc_init(dev, crtc, &exynos_crtc_funcs); 360 drm_crtc_init(dev, crtc, &exynos_crtc_funcs);
291 drm_crtc_helper_add(crtc, &exynos_crtc_helper_funcs); 361 drm_crtc_helper_add(crtc, &exynos_crtc_helper_funcs);
292 362
363 exynos_drm_crtc_attach_mode_property(crtc);
364
293 return 0; 365 return 0;
294} 366}
295 367
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 1c90a9a933c7..e22704b249d7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -238,6 +238,7 @@ struct exynos_drm_private {
238 */ 238 */
239 struct drm_crtc *crtc[MAX_CRTC]; 239 struct drm_crtc *crtc[MAX_CRTC];
240 struct drm_property *plane_zpos_property; 240 struct drm_property *plane_zpos_property;
241 struct drm_property *crtc_mode_property;
241}; 242};
242 243
243/* 244/*