Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'drm/next/du' of git://linuxtv.org/pinchartl/fbdev into drm-next

rcar misc changes.

* 'drm/next/du' of git://linuxtv.org/pinchartl/fbdev:
drm/rcar-du: Add support for the r8a7791 DU
drm/rcar-du: Add LVDS_LANES quirk
drm/rcar-du: Split features and quirks
drm/rcar-du: Update plane pitch in .mode_set_base() operation
drm/rcar-du: Don't cast crtc to rcrtc twice in the same function
drm/rcar-du: fix return value check in rcar_du_lvdsenc_get_resources()

+58 -23
+1 -2
drivers/gpu/drm/rcar-du/rcar_du_crtc.c
··· 371 371 goto error; 372 372 373 373 rcrtc->plane->format = format; 374 - rcrtc->plane->pitch = crtc->fb->pitches[0]; 375 374 376 375 rcrtc->plane->src_x = x; 377 376 rcrtc->plane->src_y = y; ··· 412 413 rcrtc->plane->src_x = x; 413 414 rcrtc->plane->src_y = y; 414 415 415 - rcar_du_crtc_update_base(to_rcar_crtc(crtc)); 416 + rcar_du_crtc_update_base(rcrtc); 416 417 417 418 return 0; 418 419 }
+22 -2
drivers/gpu/drm/rcar-du/rcar_du_drv.c
··· 251 251 }; 252 252 253 253 static const struct rcar_du_device_info rcar_du_r8a7790_info = { 254 - .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK | RCAR_DU_FEATURE_ALIGN_128B 255 - | RCAR_DU_FEATURE_DEFR8, 254 + .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK | RCAR_DU_FEATURE_DEFR8, 255 + .quirks = RCAR_DU_QUIRK_ALIGN_128B | RCAR_DU_QUIRK_LVDS_LANES, 256 256 .num_crtcs = 3, 257 257 .routes = { 258 258 /* R8A7790 has one RGB output, two LVDS outputs and one ··· 274 274 .num_lvds = 2, 275 275 }; 276 276 277 + static const struct rcar_du_device_info rcar_du_r8a7791_info = { 278 + .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK | RCAR_DU_FEATURE_DEFR8, 279 + .num_crtcs = 2, 280 + .routes = { 281 + /* R8A7791 has one RGB output, one LVDS output and one 282 + * (currently unsupported) TCON output. 283 + */ 284 + [RCAR_DU_OUTPUT_DPAD0] = { 285 + .possible_crtcs = BIT(1), 286 + .encoder_type = DRM_MODE_ENCODER_NONE, 287 + }, 288 + [RCAR_DU_OUTPUT_LVDS0] = { 289 + .possible_crtcs = BIT(0), 290 + .encoder_type = DRM_MODE_ENCODER_LVDS, 291 + }, 292 + }, 293 + .num_lvds = 1, 294 + }; 295 + 277 296 static const struct platform_device_id rcar_du_id_table[] = { 278 297 { "rcar-du-r8a7779", (kernel_ulong_t)&rcar_du_r8a7779_info }, 279 298 { "rcar-du-r8a7790", (kernel_ulong_t)&rcar_du_r8a7790_info }, 299 + { "rcar-du-r8a7791", (kernel_ulong_t)&rcar_du_r8a7791_info }, 280 300 { } 281 301 }; 282 302
+12 -2
drivers/gpu/drm/rcar-du/rcar_du_drv.h
··· 28 28 struct rcar_du_lvdsenc; 29 29 30 30 #define RCAR_DU_FEATURE_CRTC_IRQ_CLOCK (1 << 0) /* Per-CRTC IRQ and clock */ 31 - #define RCAR_DU_FEATURE_ALIGN_128B (1 << 1) /* Align pitches to 128 bytes */ 32 - #define RCAR_DU_FEATURE_DEFR8 (1 << 2) /* Has DEFR8 register */ 31 + #define RCAR_DU_FEATURE_DEFR8 (1 << 1) /* Has DEFR8 register */ 32 + 33 + #define RCAR_DU_QUIRK_ALIGN_128B (1 << 0) /* Align pitches to 128 bytes */ 34 + #define RCAR_DU_QUIRK_LVDS_LANES (1 << 1) /* LVDS lanes 1 and 3 inverted */ 33 35 34 36 /* 35 37 * struct rcar_du_output_routing - Output routing specification ··· 50 48 /* 51 49 * struct rcar_du_device_info - DU model-specific information 52 50 * @features: device features (RCAR_DU_FEATURE_*) 51 + * @quirks: device quirks (RCAR_DU_QUIRK_*) 53 52 * @num_crtcs: total number of CRTCs 54 53 * @routes: array of CRTC to output routes, indexed by output (RCAR_DU_OUTPUT_*) 55 54 * @num_lvds: number of internal LVDS encoders 56 55 */ 57 56 struct rcar_du_device_info { 58 57 unsigned int features; 58 + unsigned int quirks; 59 59 unsigned int num_crtcs; 60 60 struct rcar_du_output_routing routes[RCAR_DU_OUTPUT_MAX]; 61 61 unsigned int num_lvds; ··· 86 82 unsigned int feature) 87 83 { 88 84 return rcdu->info->features & feature; 85 + } 86 + 87 + static inline bool rcar_du_needs(struct rcar_du_device *rcdu, 88 + unsigned int quirk) 89 + { 90 + return rcdu->info->quirks & quirk; 89 91 } 90 92 91 93 static inline u32 rcar_du_read(struct rcar_du_device *rcdu, u32 reg)
+2 -2
drivers/gpu/drm/rcar-du/rcar_du_kms.c
··· 119 119 /* The R8A7779 DU requires a 16 pixels pitch alignment as documented, 120 120 * but the R8A7790 DU seems to require a 128 bytes pitch alignment. 121 121 */ 122 - if (rcar_du_has(rcdu, RCAR_DU_FEATURE_ALIGN_128B)) 122 + if (rcar_du_needs(rcdu, RCAR_DU_QUIRK_ALIGN_128B)) 123 123 align = 128; 124 124 else 125 125 align = 16 * args->bpp / 8; ··· 144 144 return ERR_PTR(-EINVAL); 145 145 } 146 146 147 - if (rcar_du_has(rcdu, RCAR_DU_FEATURE_ALIGN_128B)) 147 + if (rcar_du_needs(rcdu, RCAR_DU_QUIRK_ALIGN_128B)) 148 148 align = 128; 149 149 else 150 150 align = 16 * format->bpp / 8;
+10 -5
drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c
··· 44 44 const struct drm_display_mode *mode = &rcrtc->crtc.mode; 45 45 unsigned int freq = mode->clock; 46 46 u32 lvdcr0; 47 + u32 lvdhcr; 47 48 u32 pllcr; 48 49 int ret; 49 50 ··· 73 72 * VSYNC -> CTRL1 74 73 * DISP -> CTRL2 75 74 * 0 -> CTRL3 76 - * 77 - * Channels 1 and 3 are switched on ES1. 78 75 */ 79 76 rcar_lvds_write(lvds, LVDCTRCR, LVDCTRCR_CTR3SEL_ZERO | 80 77 LVDCTRCR_CTR2SEL_DISP | LVDCTRCR_CTR1SEL_VSYNC | 81 78 LVDCTRCR_CTR0SEL_HSYNC); 82 - rcar_lvds_write(lvds, LVDCHCR, 83 - LVDCHCR_CHSEL_CH(0, 0) | LVDCHCR_CHSEL_CH(1, 3) | 84 - LVDCHCR_CHSEL_CH(2, 2) | LVDCHCR_CHSEL_CH(3, 1)); 79 + 80 + if (rcar_du_needs(lvds->dev, RCAR_DU_QUIRK_LVDS_LANES)) 81 + lvdhcr = LVDCHCR_CHSEL_CH(0, 0) | LVDCHCR_CHSEL_CH(1, 3) 82 + | LVDCHCR_CHSEL_CH(2, 2) | LVDCHCR_CHSEL_CH(3, 1); 83 + else 84 + lvdhcr = LVDCHCR_CHSEL_CH(0, 0) | LVDCHCR_CHSEL_CH(1, 1) 85 + | LVDCHCR_CHSEL_CH(2, 2) | LVDCHCR_CHSEL_CH(3, 3); 86 + 87 + rcar_lvds_write(lvds, LVDCHCR, lvdhcr); 85 88 86 89 /* Select the input, hardcode mode 0, enable LVDS operation and turn 87 90 * bias circuitry on.
+11 -10
drivers/gpu/drm/rcar-du/rcar_du_plane.c
··· 104 104 { 105 105 struct rcar_du_group *rgrp = plane->group; 106 106 unsigned int index = plane->hwindex; 107 + u32 mwr; 108 + 109 + /* Memory pitch (expressed in pixels) */ 110 + if (plane->format->planes == 2) 111 + mwr = plane->pitch; 112 + else 113 + mwr = plane->pitch * 8 / plane->format->bpp; 114 + 115 + rcar_du_plane_write(rgrp, index, PnMWR, mwr); 107 116 108 117 /* The Y position is expressed in raster line units and must be doubled 109 118 * for 32bpp formats, according to the R8A7790 datasheet. No mention of ··· 141 132 struct drm_framebuffer *fb) 142 133 { 143 134 struct drm_gem_cma_object *gem; 135 + 136 + plane->pitch = fb->pitches[0]; 144 137 145 138 gem = drm_fb_cma_get_gem_obj(fb, 0); 146 139 plane->dma[0] = gem->paddr + fb->offsets[0]; ··· 220 209 struct rcar_du_group *rgrp = plane->group; 221 210 u32 ddcr2 = PnDDCR2_CODE; 222 211 u32 ddcr4; 223 - u32 mwr; 224 212 225 213 /* Data format 226 214 * ··· 249 239 250 240 rcar_du_plane_write(rgrp, index, PnDDCR2, ddcr2); 251 241 rcar_du_plane_write(rgrp, index, PnDDCR4, ddcr4); 252 - 253 - /* Memory pitch (expressed in pixels) */ 254 - if (plane->format->planes == 2) 255 - mwr = plane->pitch; 256 - else 257 - mwr = plane->pitch * 8 / plane->format->bpp; 258 - 259 - rcar_du_plane_write(rgrp, index, PnMWR, mwr); 260 242 261 243 /* Destination position and size */ 262 244 rcar_du_plane_write(rgrp, index, PnDSXR, plane->width); ··· 311 309 312 310 rplane->crtc = crtc; 313 311 rplane->format = format; 314 - rplane->pitch = fb->pitches[0]; 315 312 316 313 rplane->src_x = src_x >> 16; 317 314 rplane->src_y = src_y >> 16;