23
23
#include <drm/drm_simple_kms_helper.h>
24
24
#include <drm/drm_vblank.h>
25
25
26
+ #include <video/videomode.h>
27
+
26
28
#include "shmob_drm_crtc.h"
27
29
#include "shmob_drm_drv.h"
28
30
#include "shmob_drm_kms.h"
@@ -41,18 +43,16 @@ static void shmob_drm_crtc_setup_geometry(struct shmob_drm_crtc *scrtc)
41
43
{
42
44
struct drm_crtc * crtc = & scrtc -> crtc ;
43
45
struct shmob_drm_device * sdev = to_shmob_device (crtc -> dev );
44
- const struct shmob_drm_interface_data * idata = & sdev -> pdata -> iface ;
46
+ enum display_flags dpy_flags = sdev -> connector . mode -> flags ;
45
47
const struct drm_display_mode * mode = & crtc -> mode ;
46
48
u32 value ;
47
49
48
50
value = sdev -> ldmt1r
49
51
| ((mode -> flags & DRM_MODE_FLAG_PVSYNC ) ? 0 : LDMT1R_VPOL )
50
52
| ((mode -> flags & DRM_MODE_FLAG_PHSYNC ) ? 0 : LDMT1R_HPOL )
51
- | ((idata -> flags & SHMOB_DRM_IFACE_FL_DWPOL ) ? LDMT1R_DWPOL : 0 )
52
- | ((idata -> flags & SHMOB_DRM_IFACE_FL_DIPOL ) ? LDMT1R_DIPOL : 0 )
53
- | ((idata -> flags & SHMOB_DRM_IFACE_FL_DAPOL ) ? LDMT1R_DAPOL : 0 )
54
- | ((idata -> flags & SHMOB_DRM_IFACE_FL_HSCNT ) ? LDMT1R_HSCNT : 0 )
55
- | ((idata -> flags & SHMOB_DRM_IFACE_FL_DWCNT ) ? LDMT1R_DWCNT : 0 );
53
+ | ((dpy_flags & DISPLAY_FLAGS_PIXDATA_POSEDGE ) ? LDMT1R_DWPOL : 0 )
54
+ | ((dpy_flags & DISPLAY_FLAGS_DE_LOW ) ? LDMT1R_DIPOL : 0 );
55
+
56
56
lcdc_write (sdev , LDMT1R , value );
57
57
58
58
value = ((mode -> hdisplay / 8 ) << 16 ) /* HDCN */
@@ -548,26 +548,17 @@ static inline struct shmob_drm_connector *to_shmob_connector(struct drm_connecto
548
548
549
549
static int shmob_drm_connector_get_modes (struct drm_connector * connector )
550
550
{
551
- struct shmob_drm_device * sdev = to_shmob_device (connector -> dev );
551
+ struct shmob_drm_connector * scon = to_shmob_connector (connector );
552
552
struct drm_display_mode * mode ;
553
553
554
554
mode = drm_mode_create (connector -> dev );
555
555
if (mode == NULL )
556
556
return 0 ;
557
557
558
558
mode -> type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER ;
559
- mode -> clock = sdev -> pdata -> panel .mode .clock ;
560
- mode -> hdisplay = sdev -> pdata -> panel .mode .hdisplay ;
561
- mode -> hsync_start = sdev -> pdata -> panel .mode .hsync_start ;
562
- mode -> hsync_end = sdev -> pdata -> panel .mode .hsync_end ;
563
- mode -> htotal = sdev -> pdata -> panel .mode .htotal ;
564
- mode -> vdisplay = sdev -> pdata -> panel .mode .vdisplay ;
565
- mode -> vsync_start = sdev -> pdata -> panel .mode .vsync_start ;
566
- mode -> vsync_end = sdev -> pdata -> panel .mode .vsync_end ;
567
- mode -> vtotal = sdev -> pdata -> panel .mode .vtotal ;
568
- mode -> flags = sdev -> pdata -> panel .mode .flags ;
569
-
570
- drm_mode_set_name (mode );
559
+
560
+ drm_display_mode_from_videomode (scon -> mode , mode );
561
+
571
562
drm_mode_probed_add (connector , mode );
572
563
573
564
return 1 ;
@@ -601,10 +592,12 @@ static const struct drm_connector_funcs connector_funcs = {
601
592
int shmob_drm_connector_create (struct shmob_drm_device * sdev ,
602
593
struct drm_encoder * encoder )
603
594
{
604
- struct drm_connector * connector = & sdev -> connector .connector ;
595
+ struct shmob_drm_connector * scon = & sdev -> connector ;
596
+ struct drm_connector * connector = & scon -> connector ;
605
597
int ret ;
606
598
607
- sdev -> connector .encoder = encoder ;
599
+ scon -> encoder = encoder ;
600
+ scon -> mode = & sdev -> pdata -> panel .mode ;
608
601
609
602
connector -> display_info .width_mm = sdev -> pdata -> panel .width_mm ;
610
603
connector -> display_info .height_mm = sdev -> pdata -> panel .height_mm ;
0 commit comments