Dave Airlie | 5320918 | 2010-12-15 07:14:24 +1000 | [diff] [blame] | 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 | |
David Howells | 760285e | 2012-10-02 18:01:07 +0100 | [diff] [blame] | 13 | #include <drm/drmP.h> |
| 14 | #include <drm/drm_crtc.h> |
| 15 | #include <drm/drm_crtc_helper.h> |
Dave Airlie | 5320918 | 2010-12-15 07:14:24 +1000 | [diff] [blame] | 16 | #include "udl_drv.h" |
| 17 | |
| 18 | /* dummy encoder */ |
Sachin Kamat | 9278006 | 2012-09-22 06:47:39 +0000 | [diff] [blame] | 19 | static void udl_enc_destroy(struct drm_encoder *encoder) |
Dave Airlie | 5320918 | 2010-12-15 07:14:24 +1000 | [diff] [blame] | 20 | { |
| 21 | drm_encoder_cleanup(encoder); |
| 22 | kfree(encoder); |
| 23 | } |
| 24 | |
| 25 | static void udl_encoder_disable(struct drm_encoder *encoder) |
| 26 | { |
| 27 | } |
| 28 | |
| 29 | static bool udl_mode_fixup(struct drm_encoder *encoder, |
Laurent Pinchart | e811f5a | 2012-07-17 17:56:50 +0200 | [diff] [blame] | 30 | const struct drm_display_mode *mode, |
Dave Airlie | 5320918 | 2010-12-15 07:14:24 +1000 | [diff] [blame] | 31 | struct drm_display_mode *adjusted_mode) |
| 32 | { |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | static void udl_encoder_prepare(struct drm_encoder *encoder) |
| 37 | { |
| 38 | } |
| 39 | |
| 40 | static void udl_encoder_commit(struct drm_encoder *encoder) |
| 41 | { |
| 42 | } |
| 43 | |
| 44 | static void udl_encoder_mode_set(struct drm_encoder *encoder, |
| 45 | struct drm_display_mode *mode, |
| 46 | struct drm_display_mode *adjusted_mode) |
| 47 | { |
| 48 | } |
| 49 | |
| 50 | static void |
| 51 | udl_encoder_dpms(struct drm_encoder *encoder, int mode) |
| 52 | { |
| 53 | } |
| 54 | |
| 55 | static const struct drm_encoder_helper_funcs udl_helper_funcs = { |
| 56 | .dpms = udl_encoder_dpms, |
| 57 | .mode_fixup = udl_mode_fixup, |
| 58 | .prepare = udl_encoder_prepare, |
| 59 | .mode_set = udl_encoder_mode_set, |
| 60 | .commit = udl_encoder_commit, |
| 61 | .disable = udl_encoder_disable, |
| 62 | }; |
| 63 | |
| 64 | static const struct drm_encoder_funcs udl_enc_funcs = { |
| 65 | .destroy = udl_enc_destroy, |
| 66 | }; |
| 67 | |
| 68 | struct drm_encoder *udl_encoder_init(struct drm_device *dev) |
| 69 | { |
| 70 | struct drm_encoder *encoder; |
| 71 | |
| 72 | encoder = kzalloc(sizeof(struct drm_encoder), GFP_KERNEL); |
| 73 | if (!encoder) |
| 74 | return NULL; |
| 75 | |
Ville Syrjälä | 13a3d91 | 2015-12-09 16:20:18 +0200 | [diff] [blame] | 76 | drm_encoder_init(dev, encoder, &udl_enc_funcs, DRM_MODE_ENCODER_TMDS, |
| 77 | NULL); |
Dave Airlie | 5320918 | 2010-12-15 07:14:24 +1000 | [diff] [blame] | 78 | drm_encoder_helper_add(encoder, &udl_helper_funcs); |
| 79 | encoder->possible_crtcs = 1; |
| 80 | return encoder; |
| 81 | } |