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

drm/armada: move variant initialisation to CRTC init

Move the variant initialisation entirely to the CRTC init function -
the variant support is really about the CRTC properties than the whole
system, and we want to treat each CRTC individually when we support DT.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

+12 -20
+8 -11
drivers/gpu/drm/armada/armada_510.c
··· 15 15 #include "armada_drm.h" 16 16 #include "armada_hw.h" 17 17 18 - static int armada510_init(struct armada_private *priv, struct device *dev) 18 + static int armada510_crtc_init(struct armada_crtc *dcrtc, struct device *dev) 19 19 { 20 - priv->extclk[0] = devm_clk_get(dev, "ext_ref_clk_1"); 20 + struct clk *clk; 21 21 22 - if (IS_ERR(priv->extclk[0]) && PTR_ERR(priv->extclk[0]) == -ENOENT) 23 - priv->extclk[0] = ERR_PTR(-EPROBE_DEFER); 22 + clk = devm_clk_get(dev, "ext_ref_clk_1"); 23 + if (IS_ERR(clk)) 24 + return PTR_ERR(clk) == -ENOENT ? -EPROBE_DEFER : PTR_ERR(clk); 24 25 25 - return PTR_RET(priv->extclk[0]); 26 - } 26 + dcrtc->extclk[0] = clk; 27 27 28 - static int armada510_crtc_init(struct armada_crtc *dcrtc) 29 - { 30 28 /* Lower the watermark so to eliminate jitter at higher bandwidths */ 31 29 armada_updatel(0x20, (1 << 11) | 0xff, dcrtc->base + LCD_CFG_RDREG4F); 30 + 32 31 return 0; 33 32 } 34 33 ··· 44 45 static int armada510_crtc_compute_clock(struct armada_crtc *dcrtc, 45 46 const struct drm_display_mode *mode, uint32_t *sclk) 46 47 { 47 - struct armada_private *priv = dcrtc->crtc.dev->dev_private; 48 - struct clk *clk = priv->extclk[0]; 48 + struct clk *clk = dcrtc->extclk[0]; 49 49 int ret; 50 50 51 51 if (dcrtc->num == 1) ··· 79 81 const struct armada_variant armada510_ops = { 80 82 .has_spu_adv_reg = true, 81 83 .spu_adv_reg = ADV_HWC32ENABLE | ADV_HWC32ARGB | ADV_HWC32BLEND, 82 - .init = armada510_init, 83 84 .crtc_init = armada510_crtc_init, 84 85 .crtc_compute_clock = armada510_crtc_compute_clock, 85 86 };
+1 -1
drivers/gpu/drm/armada/armada_crtc.c
··· 1108 1108 } 1109 1109 1110 1110 if (priv->variant->crtc_init) { 1111 - ret = priv->variant->crtc_init(dcrtc); 1111 + ret = priv->variant->crtc_init(dcrtc, dev->dev); 1112 1112 if (ret) { 1113 1113 kfree(dcrtc); 1114 1114 return ret;
+1
drivers/gpu/drm/armada/armada_crtc.h
··· 38 38 unsigned num; 39 39 void __iomem *base; 40 40 struct clk *clk; 41 + struct clk *extclk[2]; 41 42 struct { 42 43 uint32_t spu_v_h_total; 43 44 uint32_t spu_v_porch;
+2 -4
drivers/gpu/drm/armada/armada_drm.h
··· 59 59 struct armada_private; 60 60 61 61 struct armada_variant { 62 - bool has_spu_adv_reg; 62 + bool has_spu_adv_reg; 63 63 uint32_t spu_adv_reg; 64 - int (*init)(struct armada_private *, struct device *); 65 - int (*crtc_init)(struct armada_crtc *); 64 + int (*crtc_init)(struct armada_crtc *, struct device *); 66 65 int (*crtc_compute_clock)(struct armada_crtc *, 67 66 const struct drm_display_mode *, 68 67 uint32_t *); ··· 77 78 struct drm_fb_helper *fbdev; 78 79 struct armada_crtc *dcrtc[2]; 79 80 struct drm_mm linear; 80 - struct clk *extclk[2]; 81 81 struct drm_property *csc_yuv_prop; 82 82 struct drm_property *csc_rgb_prop; 83 83 struct drm_property *colorkey_prop;
-4
drivers/gpu/drm/armada/armada_drv.c
··· 130 130 131 131 priv->variant = (struct armada_variant *)id->driver_data; 132 132 133 - ret = priv->variant->init(priv, dev->dev); 134 - if (ret) 135 - return ret; 136 - 137 133 INIT_WORK(&priv->fb_unref_work, armada_drm_unref_work); 138 134 INIT_KFIFO(priv->fb_unref); 139 135