1 /*
2  * Copyright (C) 2012 Red Hat
3  * based in parts on udlfb.c:
4  * Copyright (C) 2009 Roberto De Ioris <roberto@unbit.it>
5  * Copyright (C) 2009 Jaya Kumar <jayakumar.lkml@gmail.com>
6  * Copyright (C) 2009 Bernie Thompson <bernie@plugable.com>
7  *
8  * This file is subject to the terms and conditions of the GNU General Public
9  * License v2. See the file COPYING in the main directory of this archive for
10  * more details.
11  */
12 
13 #include <drm/drmP.h>
14 #include <drm/drm_crtc.h>
15 #include <drm/drm_crtc_helper.h>
16 #include "udl_drv.h"
17 
18 /* dummy encoder */
udl_enc_destroy(struct drm_encoder * encoder)19 static void udl_enc_destroy(struct drm_encoder *encoder)
20 {
21 	drm_encoder_cleanup(encoder);
22 	kfree(encoder);
23 }
24 
udl_encoder_disable(struct drm_encoder * encoder)25 static void udl_encoder_disable(struct drm_encoder *encoder)
26 {
27 }
28 
udl_encoder_prepare(struct drm_encoder * encoder)29 static void udl_encoder_prepare(struct drm_encoder *encoder)
30 {
31 }
32 
udl_encoder_commit(struct drm_encoder * encoder)33 static void udl_encoder_commit(struct drm_encoder *encoder)
34 {
35 }
36 
udl_encoder_mode_set(struct drm_encoder * encoder,struct drm_display_mode * mode,struct drm_display_mode * adjusted_mode)37 static void udl_encoder_mode_set(struct drm_encoder *encoder,
38 				 struct drm_display_mode *mode,
39 				 struct drm_display_mode *adjusted_mode)
40 {
41 }
42 
43 static void
udl_encoder_dpms(struct drm_encoder * encoder,int mode)44 udl_encoder_dpms(struct drm_encoder *encoder, int mode)
45 {
46 }
47 
48 static const struct drm_encoder_helper_funcs udl_helper_funcs = {
49 	.dpms = udl_encoder_dpms,
50 	.prepare = udl_encoder_prepare,
51 	.mode_set = udl_encoder_mode_set,
52 	.commit = udl_encoder_commit,
53 	.disable = udl_encoder_disable,
54 };
55 
56 static const struct drm_encoder_funcs udl_enc_funcs = {
57 	.destroy = udl_enc_destroy,
58 };
59 
udl_encoder_init(struct drm_device * dev)60 struct drm_encoder *udl_encoder_init(struct drm_device *dev)
61 {
62 	struct drm_encoder *encoder;
63 
64 	encoder = kzalloc(sizeof(struct drm_encoder), GFP_KERNEL);
65 	if (!encoder)
66 		return NULL;
67 
68 	drm_encoder_init(dev, encoder, &udl_enc_funcs, DRM_MODE_ENCODER_TMDS,
69 			 NULL);
70 	drm_encoder_helper_add(encoder, &udl_helper_funcs);
71 	encoder->possible_crtcs = 1;
72 	return encoder;
73 }
74