2 * shmob_drm_crtc.c -- SH Mobile DRM CRTCs
4 * Copyright (C) 2012 Renesas Electronics Corporation
6 * Laurent Pinchart (laurent.pinchart@ideasonboard.com)
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
14 #include <linux/backlight.h>
15 #include <linux/clk.h>
18 #include <drm/drm_crtc.h>
19 #include <drm/drm_crtc_helper.h>
20 #include <drm/drm_fb_cma_helper.h>
21 #include <drm/drm_gem_cma_helper.h>
22 #include <drm/drm_plane_helper.h>
24 #include "shmob_drm_backlight.h"
25 #include "shmob_drm_crtc.h"
26 #include "shmob_drm_drv.h"
27 #include "shmob_drm_kms.h"
28 #include "shmob_drm_plane.h"
29 #include "shmob_drm_regs.h"
35 /* -----------------------------------------------------------------------------
39 static int shmob_drm_clk_on(struct shmob_drm_device
*sdev
)
44 ret
= clk_prepare_enable(sdev
->clock
);
52 static void shmob_drm_clk_off(struct shmob_drm_device
*sdev
)
55 clk_disable_unprepare(sdev
->clock
);
58 /* -----------------------------------------------------------------------------
62 static void shmob_drm_crtc_setup_geometry(struct shmob_drm_crtc
*scrtc
)
64 struct drm_crtc
*crtc
= &scrtc
->crtc
;
65 struct shmob_drm_device
*sdev
= crtc
->dev
->dev_private
;
66 const struct shmob_drm_interface_data
*idata
= &sdev
->pdata
->iface
;
67 const struct drm_display_mode
*mode
= &crtc
->mode
;
71 | ((mode
->flags
& DRM_MODE_FLAG_PVSYNC
) ? 0 : LDMT1R_VPOL
)
72 | ((mode
->flags
& DRM_MODE_FLAG_PHSYNC
) ? 0 : LDMT1R_HPOL
)
73 | ((idata
->flags
& SHMOB_DRM_IFACE_FL_DWPOL
) ? LDMT1R_DWPOL
: 0)
74 | ((idata
->flags
& SHMOB_DRM_IFACE_FL_DIPOL
) ? LDMT1R_DIPOL
: 0)
75 | ((idata
->flags
& SHMOB_DRM_IFACE_FL_DAPOL
) ? LDMT1R_DAPOL
: 0)
76 | ((idata
->flags
& SHMOB_DRM_IFACE_FL_HSCNT
) ? LDMT1R_HSCNT
: 0)
77 | ((idata
->flags
& SHMOB_DRM_IFACE_FL_DWCNT
) ? LDMT1R_DWCNT
: 0);
78 lcdc_write(sdev
, LDMT1R
, value
);
80 if (idata
->interface
>= SHMOB_DRM_IFACE_SYS8A
&&
81 idata
->interface
<= SHMOB_DRM_IFACE_SYS24
) {
83 value
= (idata
->sys
.cs_setup
<< LDMT2R_CSUP_SHIFT
)
84 | (idata
->sys
.vsync_active_high
? LDMT2R_RSV
: 0)
85 | (idata
->sys
.vsync_dir_input
? LDMT2R_VSEL
: 0)
86 | (idata
->sys
.write_setup
<< LDMT2R_WCSC_SHIFT
)
87 | (idata
->sys
.write_cycle
<< LDMT2R_WCEC_SHIFT
)
88 | (idata
->sys
.write_strobe
<< LDMT2R_WCLW_SHIFT
);
89 lcdc_write(sdev
, LDMT2R
, value
);
91 value
= (idata
->sys
.read_latch
<< LDMT3R_RDLC_SHIFT
)
92 | (idata
->sys
.read_setup
<< LDMT3R_RCSC_SHIFT
)
93 | (idata
->sys
.read_cycle
<< LDMT3R_RCEC_SHIFT
)
94 | (idata
->sys
.read_strobe
<< LDMT3R_RCLW_SHIFT
);
95 lcdc_write(sdev
, LDMT3R
, value
);
98 value
= ((mode
->hdisplay
/ 8) << 16) /* HDCN */
99 | (mode
->htotal
/ 8); /* HTCN */
100 lcdc_write(sdev
, LDHCNR
, value
);
102 value
= (((mode
->hsync_end
- mode
->hsync_start
) / 8) << 16) /* HSYNW */
103 | (mode
->hsync_start
/ 8); /* HSYNP */
104 lcdc_write(sdev
, LDHSYNR
, value
);
106 value
= ((mode
->hdisplay
& 7) << 24) | ((mode
->htotal
& 7) << 16)
107 | (((mode
->hsync_end
- mode
->hsync_start
) & 7) << 8)
108 | (mode
->hsync_start
& 7);
109 lcdc_write(sdev
, LDHAJR
, value
);
111 value
= ((mode
->vdisplay
) << 16) /* VDLN */
112 | mode
->vtotal
; /* VTLN */
113 lcdc_write(sdev
, LDVLNR
, value
);
115 value
= ((mode
->vsync_end
- mode
->vsync_start
) << 16) /* VSYNW */
116 | mode
->vsync_start
; /* VSYNP */
117 lcdc_write(sdev
, LDVSYNR
, value
);
120 static void shmob_drm_crtc_start_stop(struct shmob_drm_crtc
*scrtc
, bool start
)
122 struct shmob_drm_device
*sdev
= scrtc
->crtc
.dev
->dev_private
;
125 value
= lcdc_read(sdev
, LDCNT2R
);
127 lcdc_write(sdev
, LDCNT2R
, value
| LDCNT2R_DO
);
129 lcdc_write(sdev
, LDCNT2R
, value
& ~LDCNT2R_DO
);
131 /* Wait until power is applied/stopped. */
133 value
= lcdc_read(sdev
, LDPMR
) & LDPMR_LPS
;
134 if ((start
&& value
) || (!start
&& !value
))
141 /* Stop the dot clock. */
142 lcdc_write(sdev
, LDDCKSTPR
, LDDCKSTPR_DCKSTP
);
147 * shmob_drm_crtc_start - Configure and start the LCDC
148 * @scrtc: the SH Mobile CRTC
150 * Configure and start the LCDC device. External devices (clocks, MERAM, panels,
151 * ...) are not touched by this function.
153 static void shmob_drm_crtc_start(struct shmob_drm_crtc
*scrtc
)
155 struct drm_crtc
*crtc
= &scrtc
->crtc
;
156 struct shmob_drm_device
*sdev
= crtc
->dev
->dev_private
;
157 const struct shmob_drm_interface_data
*idata
= &sdev
->pdata
->iface
;
158 const struct shmob_drm_format_info
*format
;
159 struct drm_device
*dev
= sdev
->ddev
;
160 struct drm_plane
*plane
;
167 format
= shmob_drm_format_info(crtc
->primary
->fb
->format
->format
);
168 if (WARN_ON(format
== NULL
))
171 /* Enable clocks before accessing the hardware. */
172 ret
= shmob_drm_clk_on(sdev
);
176 /* Reset and enable the LCDC. */
177 lcdc_write(sdev
, LDCNT2R
, lcdc_read(sdev
, LDCNT2R
) | LDCNT2R_BR
);
178 lcdc_wait_bit(sdev
, LDCNT2R
, LDCNT2R_BR
, 0);
179 lcdc_write(sdev
, LDCNT2R
, LDCNT2R_ME
);
181 /* Stop the LCDC first and disable all interrupts. */
182 shmob_drm_crtc_start_stop(scrtc
, false);
183 lcdc_write(sdev
, LDINTR
, 0);
185 /* Configure power supply, dot clocks and start them. */
186 lcdc_write(sdev
, LDPMR
, 0);
188 value
= sdev
->lddckr
;
189 if (idata
->clk_div
) {
190 /* FIXME: sh7724 can only use 42, 48, 54 and 60 for the divider
193 lcdc_write(sdev
, LDDCKPAT1R
, 0);
194 lcdc_write(sdev
, LDDCKPAT2R
, (1 << (idata
->clk_div
/ 2)) - 1);
196 if (idata
->clk_div
== 1)
197 value
|= LDDCKR_MOSEL
;
199 value
|= idata
->clk_div
;
202 lcdc_write(sdev
, LDDCKR
, value
);
203 lcdc_write(sdev
, LDDCKSTPR
, 0);
204 lcdc_wait_bit(sdev
, LDDCKSTPR
, ~0, 0);
206 /* TODO: Setup SYS panel */
208 /* Setup geometry, format, frame buffer memory and operation mode. */
209 shmob_drm_crtc_setup_geometry(scrtc
);
211 /* TODO: Handle YUV colorspaces. Hardcode REC709 for now. */
212 lcdc_write(sdev
, LDDFR
, format
->lddfr
| LDDFR_CF1
);
213 lcdc_write(sdev
, LDMLSR
, scrtc
->line_size
);
214 lcdc_write(sdev
, LDSA1R
, scrtc
->dma
[0]);
216 lcdc_write(sdev
, LDSA2R
, scrtc
->dma
[1]);
217 lcdc_write(sdev
, LDSM1R
, 0);
219 /* Word and long word swap. */
220 switch (format
->fourcc
) {
221 case DRM_FORMAT_RGB565
:
222 case DRM_FORMAT_NV21
:
223 case DRM_FORMAT_NV61
:
224 case DRM_FORMAT_NV42
:
225 value
= LDDDSR_LS
| LDDDSR_WS
;
227 case DRM_FORMAT_RGB888
:
228 case DRM_FORMAT_NV12
:
229 case DRM_FORMAT_NV16
:
230 case DRM_FORMAT_NV24
:
231 value
= LDDDSR_LS
| LDDDSR_WS
| LDDDSR_BS
;
233 case DRM_FORMAT_ARGB8888
:
238 lcdc_write(sdev
, LDDDSR
, value
);
241 drm_for_each_legacy_plane(plane
, dev
) {
242 if (plane
->crtc
== crtc
)
243 shmob_drm_plane_setup(plane
);
246 /* Enable the display output. */
247 lcdc_write(sdev
, LDCNT1R
, LDCNT1R_DE
);
249 shmob_drm_crtc_start_stop(scrtc
, true);
251 scrtc
->started
= true;
254 static void shmob_drm_crtc_stop(struct shmob_drm_crtc
*scrtc
)
256 struct drm_crtc
*crtc
= &scrtc
->crtc
;
257 struct shmob_drm_device
*sdev
= crtc
->dev
->dev_private
;
263 shmob_drm_crtc_start_stop(scrtc
, false);
265 /* Disable the display output. */
266 lcdc_write(sdev
, LDCNT1R
, 0);
269 shmob_drm_clk_off(sdev
);
271 scrtc
->started
= false;
274 void shmob_drm_crtc_suspend(struct shmob_drm_crtc
*scrtc
)
276 shmob_drm_crtc_stop(scrtc
);
279 void shmob_drm_crtc_resume(struct shmob_drm_crtc
*scrtc
)
281 if (scrtc
->dpms
!= DRM_MODE_DPMS_ON
)
284 shmob_drm_crtc_start(scrtc
);
287 static void shmob_drm_crtc_compute_base(struct shmob_drm_crtc
*scrtc
,
290 struct drm_crtc
*crtc
= &scrtc
->crtc
;
291 struct drm_framebuffer
*fb
= crtc
->primary
->fb
;
292 struct drm_gem_cma_object
*gem
;
295 bpp
= scrtc
->format
->yuv
? 8 : scrtc
->format
->bpp
;
296 gem
= drm_fb_cma_get_gem_obj(fb
, 0);
297 scrtc
->dma
[0] = gem
->paddr
+ fb
->offsets
[0]
298 + y
* fb
->pitches
[0] + x
* bpp
/ 8;
300 if (scrtc
->format
->yuv
) {
301 bpp
= scrtc
->format
->bpp
- 8;
302 gem
= drm_fb_cma_get_gem_obj(fb
, 1);
303 scrtc
->dma
[1] = gem
->paddr
+ fb
->offsets
[1]
304 + y
/ (bpp
== 4 ? 2 : 1) * fb
->pitches
[1]
305 + x
* (bpp
== 16 ? 2 : 1);
309 static void shmob_drm_crtc_update_base(struct shmob_drm_crtc
*scrtc
)
311 struct drm_crtc
*crtc
= &scrtc
->crtc
;
312 struct shmob_drm_device
*sdev
= crtc
->dev
->dev_private
;
314 shmob_drm_crtc_compute_base(scrtc
, crtc
->x
, crtc
->y
);
316 lcdc_write_mirror(sdev
, LDSA1R
, scrtc
->dma
[0]);
317 if (scrtc
->format
->yuv
)
318 lcdc_write_mirror(sdev
, LDSA2R
, scrtc
->dma
[1]);
320 lcdc_write(sdev
, LDRCNTR
, lcdc_read(sdev
, LDRCNTR
) ^ LDRCNTR_MRS
);
323 #define to_shmob_crtc(c) container_of(c, struct shmob_drm_crtc, crtc)
325 static void shmob_drm_crtc_dpms(struct drm_crtc
*crtc
, int mode
)
327 struct shmob_drm_crtc
*scrtc
= to_shmob_crtc(crtc
);
329 if (scrtc
->dpms
== mode
)
332 if (mode
== DRM_MODE_DPMS_ON
)
333 shmob_drm_crtc_start(scrtc
);
335 shmob_drm_crtc_stop(scrtc
);
340 static void shmob_drm_crtc_mode_prepare(struct drm_crtc
*crtc
)
342 shmob_drm_crtc_dpms(crtc
, DRM_MODE_DPMS_OFF
);
345 static int shmob_drm_crtc_mode_set(struct drm_crtc
*crtc
,
346 struct drm_display_mode
*mode
,
347 struct drm_display_mode
*adjusted_mode
,
349 struct drm_framebuffer
*old_fb
)
351 struct shmob_drm_crtc
*scrtc
= to_shmob_crtc(crtc
);
352 struct shmob_drm_device
*sdev
= crtc
->dev
->dev_private
;
353 const struct shmob_drm_format_info
*format
;
355 format
= shmob_drm_format_info(crtc
->primary
->fb
->format
->format
);
356 if (format
== NULL
) {
357 dev_dbg(sdev
->dev
, "mode_set: unsupported format %08x\n",
358 crtc
->primary
->fb
->format
->format
);
362 scrtc
->format
= format
;
363 scrtc
->line_size
= crtc
->primary
->fb
->pitches
[0];
365 shmob_drm_crtc_compute_base(scrtc
, x
, y
);
370 static void shmob_drm_crtc_mode_commit(struct drm_crtc
*crtc
)
372 shmob_drm_crtc_dpms(crtc
, DRM_MODE_DPMS_ON
);
375 static int shmob_drm_crtc_mode_set_base(struct drm_crtc
*crtc
, int x
, int y
,
376 struct drm_framebuffer
*old_fb
)
378 shmob_drm_crtc_update_base(to_shmob_crtc(crtc
));
383 static const struct drm_crtc_helper_funcs crtc_helper_funcs
= {
384 .dpms
= shmob_drm_crtc_dpms
,
385 .prepare
= shmob_drm_crtc_mode_prepare
,
386 .commit
= shmob_drm_crtc_mode_commit
,
387 .mode_set
= shmob_drm_crtc_mode_set
,
388 .mode_set_base
= shmob_drm_crtc_mode_set_base
,
391 void shmob_drm_crtc_finish_page_flip(struct shmob_drm_crtc
*scrtc
)
393 struct drm_pending_vblank_event
*event
;
394 struct drm_device
*dev
= scrtc
->crtc
.dev
;
397 spin_lock_irqsave(&dev
->event_lock
, flags
);
398 event
= scrtc
->event
;
401 drm_crtc_send_vblank_event(&scrtc
->crtc
, event
);
402 drm_crtc_vblank_put(&scrtc
->crtc
);
404 spin_unlock_irqrestore(&dev
->event_lock
, flags
);
407 static int shmob_drm_crtc_page_flip(struct drm_crtc
*crtc
,
408 struct drm_framebuffer
*fb
,
409 struct drm_pending_vblank_event
*event
,
410 uint32_t page_flip_flags
,
411 struct drm_modeset_acquire_ctx
*ctx
)
413 struct shmob_drm_crtc
*scrtc
= to_shmob_crtc(crtc
);
414 struct drm_device
*dev
= scrtc
->crtc
.dev
;
417 spin_lock_irqsave(&dev
->event_lock
, flags
);
418 if (scrtc
->event
!= NULL
) {
419 spin_unlock_irqrestore(&dev
->event_lock
, flags
);
422 spin_unlock_irqrestore(&dev
->event_lock
, flags
);
424 crtc
->primary
->fb
= fb
;
425 shmob_drm_crtc_update_base(scrtc
);
429 drm_crtc_vblank_get(&scrtc
->crtc
);
430 spin_lock_irqsave(&dev
->event_lock
, flags
);
431 scrtc
->event
= event
;
432 spin_unlock_irqrestore(&dev
->event_lock
, flags
);
438 static void shmob_drm_crtc_enable_vblank(struct shmob_drm_device
*sdev
,
444 /* Be careful not to acknowledge any pending interrupt. */
445 spin_lock_irqsave(&sdev
->irq_lock
, flags
);
446 ldintr
= lcdc_read(sdev
, LDINTR
) | LDINTR_STATUS_MASK
;
448 ldintr
|= LDINTR_VEE
;
450 ldintr
&= ~LDINTR_VEE
;
451 lcdc_write(sdev
, LDINTR
, ldintr
);
452 spin_unlock_irqrestore(&sdev
->irq_lock
, flags
);
455 static int shmob_drm_enable_vblank(struct drm_crtc
*crtc
)
457 struct shmob_drm_device
*sdev
= crtc
->dev
->dev_private
;
459 shmob_drm_crtc_enable_vblank(sdev
, true);
464 static void shmob_drm_disable_vblank(struct drm_crtc
*crtc
)
466 struct shmob_drm_device
*sdev
= crtc
->dev
->dev_private
;
468 shmob_drm_crtc_enable_vblank(sdev
, false);
471 static const struct drm_crtc_funcs crtc_funcs
= {
472 .destroy
= drm_crtc_cleanup
,
473 .set_config
= drm_crtc_helper_set_config
,
474 .page_flip
= shmob_drm_crtc_page_flip
,
475 .enable_vblank
= shmob_drm_enable_vblank
,
476 .disable_vblank
= shmob_drm_disable_vblank
,
479 int shmob_drm_crtc_create(struct shmob_drm_device
*sdev
)
481 struct drm_crtc
*crtc
= &sdev
->crtc
.crtc
;
484 sdev
->crtc
.dpms
= DRM_MODE_DPMS_OFF
;
486 ret
= drm_crtc_init(sdev
->ddev
, crtc
, &crtc_funcs
);
490 drm_crtc_helper_add(crtc
, &crtc_helper_funcs
);
495 /* -----------------------------------------------------------------------------
499 #define to_shmob_encoder(e) \
500 container_of(e, struct shmob_drm_encoder, encoder)
502 static void shmob_drm_encoder_dpms(struct drm_encoder
*encoder
, int mode
)
504 struct shmob_drm_encoder
*senc
= to_shmob_encoder(encoder
);
505 struct shmob_drm_device
*sdev
= encoder
->dev
->dev_private
;
506 struct shmob_drm_connector
*scon
= &sdev
->connector
;
508 if (senc
->dpms
== mode
)
511 shmob_drm_backlight_dpms(scon
, mode
);
516 static bool shmob_drm_encoder_mode_fixup(struct drm_encoder
*encoder
,
517 const struct drm_display_mode
*mode
,
518 struct drm_display_mode
*adjusted_mode
)
520 struct drm_device
*dev
= encoder
->dev
;
521 struct shmob_drm_device
*sdev
= dev
->dev_private
;
522 struct drm_connector
*connector
= &sdev
->connector
.connector
;
523 const struct drm_display_mode
*panel_mode
;
525 if (list_empty(&connector
->modes
)) {
526 dev_dbg(dev
->dev
, "mode_fixup: empty modes list\n");
530 /* The flat panel mode is fixed, just copy it to the adjusted mode. */
531 panel_mode
= list_first_entry(&connector
->modes
,
532 struct drm_display_mode
, head
);
533 drm_mode_copy(adjusted_mode
, panel_mode
);
538 static void shmob_drm_encoder_mode_prepare(struct drm_encoder
*encoder
)
540 /* No-op, everything is handled in the CRTC code. */
543 static void shmob_drm_encoder_mode_set(struct drm_encoder
*encoder
,
544 struct drm_display_mode
*mode
,
545 struct drm_display_mode
*adjusted_mode
)
547 /* No-op, everything is handled in the CRTC code. */
550 static void shmob_drm_encoder_mode_commit(struct drm_encoder
*encoder
)
552 /* No-op, everything is handled in the CRTC code. */
555 static const struct drm_encoder_helper_funcs encoder_helper_funcs
= {
556 .dpms
= shmob_drm_encoder_dpms
,
557 .mode_fixup
= shmob_drm_encoder_mode_fixup
,
558 .prepare
= shmob_drm_encoder_mode_prepare
,
559 .commit
= shmob_drm_encoder_mode_commit
,
560 .mode_set
= shmob_drm_encoder_mode_set
,
563 static void shmob_drm_encoder_destroy(struct drm_encoder
*encoder
)
565 drm_encoder_cleanup(encoder
);
568 static const struct drm_encoder_funcs encoder_funcs
= {
569 .destroy
= shmob_drm_encoder_destroy
,
572 int shmob_drm_encoder_create(struct shmob_drm_device
*sdev
)
574 struct drm_encoder
*encoder
= &sdev
->encoder
.encoder
;
577 sdev
->encoder
.dpms
= DRM_MODE_DPMS_OFF
;
579 encoder
->possible_crtcs
= 1;
581 ret
= drm_encoder_init(sdev
->ddev
, encoder
, &encoder_funcs
,
582 DRM_MODE_ENCODER_LVDS
, NULL
);
586 drm_encoder_helper_add(encoder
, &encoder_helper_funcs
);
591 /* -----------------------------------------------------------------------------
595 #define to_shmob_connector(c) \
596 container_of(c, struct shmob_drm_connector, connector)
598 static int shmob_drm_connector_get_modes(struct drm_connector
*connector
)
600 struct shmob_drm_device
*sdev
= connector
->dev
->dev_private
;
601 struct drm_display_mode
*mode
;
603 mode
= drm_mode_create(connector
->dev
);
607 mode
->type
= DRM_MODE_TYPE_PREFERRED
| DRM_MODE_TYPE_DRIVER
;
608 mode
->clock
= sdev
->pdata
->panel
.mode
.clock
;
609 mode
->hdisplay
= sdev
->pdata
->panel
.mode
.hdisplay
;
610 mode
->hsync_start
= sdev
->pdata
->panel
.mode
.hsync_start
;
611 mode
->hsync_end
= sdev
->pdata
->panel
.mode
.hsync_end
;
612 mode
->htotal
= sdev
->pdata
->panel
.mode
.htotal
;
613 mode
->vdisplay
= sdev
->pdata
->panel
.mode
.vdisplay
;
614 mode
->vsync_start
= sdev
->pdata
->panel
.mode
.vsync_start
;
615 mode
->vsync_end
= sdev
->pdata
->panel
.mode
.vsync_end
;
616 mode
->vtotal
= sdev
->pdata
->panel
.mode
.vtotal
;
617 mode
->flags
= sdev
->pdata
->panel
.mode
.flags
;
619 drm_mode_set_name(mode
);
620 drm_mode_probed_add(connector
, mode
);
622 connector
->display_info
.width_mm
= sdev
->pdata
->panel
.width_mm
;
623 connector
->display_info
.height_mm
= sdev
->pdata
->panel
.height_mm
;
628 static struct drm_encoder
*
629 shmob_drm_connector_best_encoder(struct drm_connector
*connector
)
631 struct shmob_drm_connector
*scon
= to_shmob_connector(connector
);
633 return scon
->encoder
;
636 static const struct drm_connector_helper_funcs connector_helper_funcs
= {
637 .get_modes
= shmob_drm_connector_get_modes
,
638 .best_encoder
= shmob_drm_connector_best_encoder
,
641 static void shmob_drm_connector_destroy(struct drm_connector
*connector
)
643 struct shmob_drm_connector
*scon
= to_shmob_connector(connector
);
645 shmob_drm_backlight_exit(scon
);
646 drm_connector_unregister(connector
);
647 drm_connector_cleanup(connector
);
650 static const struct drm_connector_funcs connector_funcs
= {
651 .dpms
= drm_helper_connector_dpms
,
652 .fill_modes
= drm_helper_probe_single_connector_modes
,
653 .destroy
= shmob_drm_connector_destroy
,
656 int shmob_drm_connector_create(struct shmob_drm_device
*sdev
,
657 struct drm_encoder
*encoder
)
659 struct drm_connector
*connector
= &sdev
->connector
.connector
;
662 sdev
->connector
.encoder
= encoder
;
664 connector
->display_info
.width_mm
= sdev
->pdata
->panel
.width_mm
;
665 connector
->display_info
.height_mm
= sdev
->pdata
->panel
.height_mm
;
667 ret
= drm_connector_init(sdev
->ddev
, connector
, &connector_funcs
,
668 DRM_MODE_CONNECTOR_LVDS
);
672 drm_connector_helper_add(connector
, &connector_helper_funcs
);
674 ret
= shmob_drm_backlight_init(&sdev
->connector
);
678 ret
= drm_connector_attach_encoder(connector
, encoder
);
682 drm_helper_connector_dpms(connector
, DRM_MODE_DPMS_OFF
);
683 drm_object_property_set_value(&connector
->base
,
684 sdev
->ddev
->mode_config
.dpms_property
, DRM_MODE_DPMS_OFF
);
689 shmob_drm_backlight_exit(&sdev
->connector
);
691 drm_connector_cleanup(connector
);