Skip to content

Commit ebbd1c9

Browse files
author
Jyri Sarha
committed
drm/tilcdc: Remove obsolete crtc helper functions
commit 6b4736d upstream. Remove obsolete crtc helper functions. These are not needed when atomic modeset is used. Note that the drm_crtc_helper_funcs mode_fixup() is still needed. The crtc's check() callback can not do its job here. The plane's check() callback needs to set drm_crtc_state's ->mode_changed to true if the pixel format for the framebuffer changes. Because of this drm_mode_config_funcs atomic_check() callback needs to call drm_atomic_helper_check_modeset() once more after it has called drm_atomic_helper_check_planes(). If the fixing of the adjusted_mode would be done in drm_crtc_helper_funcs atomic_check() callback, it would get over written by the extra drm_atomic_helper_check_modeset() call. Signed-off-by: Jyri Sarha <[email protected]>
1 parent 83822fb commit ebbd1c9

File tree

1 file changed

+0
-208
lines changed

1 file changed

+0
-208
lines changed

drivers/gpu/drm/tilcdc/tilcdc_crtc.c

Lines changed: 0 additions & 208 deletions
Original file line numberDiff line numberDiff line change
@@ -501,209 +501,6 @@ static int tilcdc_crtc_atomic_check(struct drm_crtc *crtc,
501501
return 0;
502502
}
503503

504-
static int tilcdc_crtc_mode_set(struct drm_crtc *crtc,
505-
struct drm_display_mode *mode,
506-
struct drm_display_mode *adjusted_mode,
507-
int x, int y,
508-
struct drm_framebuffer *old_fb)
509-
{
510-
struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc);
511-
struct drm_device *dev = crtc->dev;
512-
struct tilcdc_drm_private *priv = dev->dev_private;
513-
const struct tilcdc_panel_info *info = tilcdc_crtc->info;
514-
uint32_t reg, hbp, hfp, hsw, vbp, vfp, vsw;
515-
int ret;
516-
517-
ret = tilcdc_crtc_mode_valid(crtc, mode);
518-
if (WARN_ON(ret))
519-
return ret;
520-
521-
if (WARN_ON(!info))
522-
return -EINVAL;
523-
524-
ret = tilcdc_verify_fb(crtc, crtc->primary->fb);
525-
if (ret)
526-
return ret;
527-
528-
pm_runtime_get_sync(dev->dev);
529-
530-
/* Configure the Burst Size and fifo threshold of DMA: */
531-
reg = tilcdc_read(dev, LCDC_DMA_CTRL_REG) & ~0x00000770;
532-
switch (info->dma_burst_sz) {
533-
case 1:
534-
reg |= LCDC_DMA_BURST_SIZE(LCDC_DMA_BURST_1);
535-
break;
536-
case 2:
537-
reg |= LCDC_DMA_BURST_SIZE(LCDC_DMA_BURST_2);
538-
break;
539-
case 4:
540-
reg |= LCDC_DMA_BURST_SIZE(LCDC_DMA_BURST_4);
541-
break;
542-
case 8:
543-
reg |= LCDC_DMA_BURST_SIZE(LCDC_DMA_BURST_8);
544-
break;
545-
case 16:
546-
reg |= LCDC_DMA_BURST_SIZE(LCDC_DMA_BURST_16);
547-
break;
548-
default:
549-
return -EINVAL;
550-
}
551-
reg |= (info->fifo_th << 8);
552-
tilcdc_write(dev, LCDC_DMA_CTRL_REG, reg);
553-
554-
/* Configure timings: */
555-
hbp = mode->htotal - mode->hsync_end;
556-
hfp = mode->hsync_start - mode->hdisplay;
557-
hsw = mode->hsync_end - mode->hsync_start;
558-
vbp = mode->vtotal - mode->vsync_end;
559-
vfp = mode->vsync_start - mode->vdisplay;
560-
vsw = mode->vsync_end - mode->vsync_start;
561-
562-
DBG("%dx%d, hbp=%u, hfp=%u, hsw=%u, vbp=%u, vfp=%u, vsw=%u",
563-
mode->hdisplay, mode->vdisplay, hbp, hfp, hsw, vbp, vfp, vsw);
564-
565-
/* Configure the AC Bias Period and Number of Transitions per Interrupt: */
566-
reg = tilcdc_read(dev, LCDC_RASTER_TIMING_2_REG) & ~0x000fff00;
567-
reg |= LCDC_AC_BIAS_FREQUENCY(info->ac_bias) |
568-
LCDC_AC_BIAS_TRANSITIONS_PER_INT(info->ac_bias_intrpt);
569-
570-
/*
571-
* subtract one from hfp, hbp, hsw because the hardware uses
572-
* a value of 0 as 1
573-
*/
574-
if (priv->rev == 2) {
575-
/* clear bits we're going to set */
576-
reg &= ~0x78000033;
577-
reg |= ((hfp-1) & 0x300) >> 8;
578-
reg |= ((hbp-1) & 0x300) >> 4;
579-
reg |= ((hsw-1) & 0x3c0) << 21;
580-
}
581-
tilcdc_write(dev, LCDC_RASTER_TIMING_2_REG, reg);
582-
583-
reg = (((mode->hdisplay >> 4) - 1) << 4) |
584-
(((hbp-1) & 0xff) << 24) |
585-
(((hfp-1) & 0xff) << 16) |
586-
(((hsw-1) & 0x3f) << 10);
587-
if (priv->rev == 2)
588-
reg |= (((mode->hdisplay >> 4) - 1) & 0x40) >> 3;
589-
tilcdc_write(dev, LCDC_RASTER_TIMING_0_REG, reg);
590-
591-
reg = ((mode->vdisplay - 1) & 0x3ff) |
592-
((vbp & 0xff) << 24) |
593-
((vfp & 0xff) << 16) |
594-
(((vsw-1) & 0x3f) << 10);
595-
tilcdc_write(dev, LCDC_RASTER_TIMING_1_REG, reg);
596-
597-
/*
598-
* be sure to set Bit 10 for the V2 LCDC controller,
599-
* otherwise limited to 1024 pixels width, stopping
600-
* 1920x1080 being suppoted.
601-
*/
602-
if (priv->rev == 2) {
603-
if ((mode->vdisplay - 1) & 0x400) {
604-
tilcdc_set(dev, LCDC_RASTER_TIMING_2_REG,
605-
LCDC_LPP_B10);
606-
} else {
607-
tilcdc_clear(dev, LCDC_RASTER_TIMING_2_REG,
608-
LCDC_LPP_B10);
609-
}
610-
}
611-
612-
/* Configure display type: */
613-
reg = tilcdc_read(dev, LCDC_RASTER_CTRL_REG) &
614-
~(LCDC_TFT_MODE | LCDC_MONO_8BIT_MODE | LCDC_MONOCHROME_MODE |
615-
LCDC_V2_TFT_24BPP_MODE | LCDC_V2_TFT_24BPP_UNPACK | 0x000ff000);
616-
reg |= LCDC_TFT_MODE; /* no monochrome/passive support */
617-
if (info->tft_alt_mode)
618-
reg |= LCDC_TFT_ALT_ENABLE;
619-
if (priv->rev == 2) {
620-
unsigned int depth, bpp;
621-
622-
drm_fb_get_bpp_depth(crtc->primary->fb->pixel_format, &depth, &bpp);
623-
switch (bpp) {
624-
case 16:
625-
break;
626-
case 32:
627-
reg |= LCDC_V2_TFT_24BPP_UNPACK;
628-
/* fallthrough */
629-
case 24:
630-
reg |= LCDC_V2_TFT_24BPP_MODE;
631-
break;
632-
default:
633-
dev_err(dev->dev, "invalid pixel format\n");
634-
return -EINVAL;
635-
}
636-
}
637-
reg |= info->fdd < 12;
638-
tilcdc_write(dev, LCDC_RASTER_CTRL_REG, reg);
639-
640-
if (info->invert_pxl_clk)
641-
tilcdc_set(dev, LCDC_RASTER_TIMING_2_REG, LCDC_INVERT_PIXEL_CLOCK);
642-
else
643-
tilcdc_clear(dev, LCDC_RASTER_TIMING_2_REG, LCDC_INVERT_PIXEL_CLOCK);
644-
645-
if (info->sync_ctrl)
646-
tilcdc_set(dev, LCDC_RASTER_TIMING_2_REG, LCDC_SYNC_CTRL);
647-
else
648-
tilcdc_clear(dev, LCDC_RASTER_TIMING_2_REG, LCDC_SYNC_CTRL);
649-
650-
if (info->sync_edge)
651-
tilcdc_set(dev, LCDC_RASTER_TIMING_2_REG, LCDC_SYNC_EDGE);
652-
else
653-
tilcdc_clear(dev, LCDC_RASTER_TIMING_2_REG, LCDC_SYNC_EDGE);
654-
655-
/*
656-
* use value from adjusted_mode here as this might have been
657-
* changed as part of the fixup for slave encoders to solve the
658-
* issue where tilcdc timings are not VESA compliant
659-
*/
660-
if (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC)
661-
tilcdc_set(dev, LCDC_RASTER_TIMING_2_REG, LCDC_INVERT_HSYNC);
662-
else
663-
tilcdc_clear(dev, LCDC_RASTER_TIMING_2_REG, LCDC_INVERT_HSYNC);
664-
665-
if (mode->flags & DRM_MODE_FLAG_NVSYNC)
666-
tilcdc_set(dev, LCDC_RASTER_TIMING_2_REG, LCDC_INVERT_VSYNC);
667-
else
668-
tilcdc_clear(dev, LCDC_RASTER_TIMING_2_REG, LCDC_INVERT_VSYNC);
669-
670-
if (info->raster_order)
671-
tilcdc_set(dev, LCDC_RASTER_CTRL_REG, LCDC_RASTER_ORDER);
672-
else
673-
tilcdc_clear(dev, LCDC_RASTER_CTRL_REG, LCDC_RASTER_ORDER);
674-
675-
drm_framebuffer_reference(crtc->primary->fb);
676-
677-
set_scanout(crtc, crtc->primary->fb);
678-
679-
tilcdc_crtc_update_clk(crtc);
680-
681-
pm_runtime_put_sync(dev->dev);
682-
683-
return 0;
684-
}
685-
686-
static int tilcdc_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
687-
struct drm_framebuffer *old_fb)
688-
{
689-
struct drm_device *dev = crtc->dev;
690-
int r;
691-
692-
r = tilcdc_verify_fb(crtc, crtc->primary->fb);
693-
if (r)
694-
return r;
695-
696-
drm_framebuffer_reference(crtc->primary->fb);
697-
698-
pm_runtime_get_sync(dev->dev);
699-
700-
set_scanout(crtc, crtc->primary->fb);
701-
702-
pm_runtime_put_sync(dev->dev);
703-
704-
return 0;
705-
}
706-
707504
static const struct drm_crtc_funcs tilcdc_crtc_funcs = {
708505
.destroy = tilcdc_crtc_destroy,
709506
.set_config = drm_atomic_helper_set_config,
@@ -714,12 +511,7 @@ static const struct drm_crtc_funcs tilcdc_crtc_funcs = {
714511
};
715512

716513
static const struct drm_crtc_helper_funcs tilcdc_crtc_helper_funcs = {
717-
.dpms = tilcdc_crtc_dpms,
718514
.mode_fixup = tilcdc_crtc_mode_fixup,
719-
.prepare = tilcdc_crtc_disable,
720-
.commit = tilcdc_crtc_enable,
721-
.mode_set = tilcdc_crtc_mode_set,
722-
.mode_set_base = tilcdc_crtc_mode_set_base,
723515
.enable = tilcdc_crtc_enable,
724516
.disable = tilcdc_crtc_disable,
725517
.atomic_check = tilcdc_crtc_atomic_check,

0 commit comments

Comments
 (0)