diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-04-22 10:21:30 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-07-03 11:24:46 -0400 |
commit | 3ecea269959afaae50b001deb294cfb9539dbea3 (patch) | |
tree | b42981b9f3226d2fa76d20482436da40b0e8e5b2 | |
parent | d016540722bb412ffa8376a9db0de757ce915bfb (diff) |
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>
-rw-r--r-- | drivers/gpu/drm/armada/armada_510.c | 19 | ||||
-rw-r--r-- | drivers/gpu/drm/armada/armada_crtc.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/armada/armada_crtc.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/armada/armada_drm.h | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/armada/armada_drv.c | 4 |
5 files changed, 12 insertions, 20 deletions
diff --git a/drivers/gpu/drm/armada/armada_510.c b/drivers/gpu/drm/armada/armada_510.c index 59948eff6095..a9dabcaef92e 100644 --- a/drivers/gpu/drm/armada/armada_510.c +++ b/drivers/gpu/drm/armada/armada_510.c | |||
@@ -15,20 +15,19 @@ | |||
15 | #include "armada_drm.h" | 15 | #include "armada_drm.h" |
16 | #include "armada_hw.h" | 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) | 22 | clk = devm_clk_get(dev, "ext_ref_clk_1"); |
23 | priv->extclk[0] = ERR_PTR(-EPROBE_DEFER); | 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 | dcrtc->extclk[0] = clk; |
26 | } | ||
27 | 27 | ||
28 | static int armada510_crtc_init(struct armada_crtc *dcrtc) | ||
29 | { | ||
30 | /* Lower the watermark so to eliminate jitter at higher bandwidths */ | 28 | /* Lower the watermark so to eliminate jitter at higher bandwidths */ |
31 | armada_updatel(0x20, (1 << 11) | 0xff, dcrtc->base + LCD_CFG_RDREG4F); | 29 | armada_updatel(0x20, (1 << 11) | 0xff, dcrtc->base + LCD_CFG_RDREG4F); |
30 | |||
32 | return 0; | 31 | return 0; |
33 | } | 32 | } |
34 | 33 | ||
@@ -45,8 +44,7 @@ static int armada510_crtc_init(struct armada_crtc *dcrtc) | |||
45 | static int armada510_crtc_compute_clock(struct armada_crtc *dcrtc, | 44 | static int armada510_crtc_compute_clock(struct armada_crtc *dcrtc, |
46 | const struct drm_display_mode *mode, uint32_t *sclk) | 45 | const struct drm_display_mode *mode, uint32_t *sclk) |
47 | { | 46 | { |
48 | struct armada_private *priv = dcrtc->crtc.dev->dev_private; | 47 | struct clk *clk = dcrtc->extclk[0]; |
49 | struct clk *clk = priv->extclk[0]; | ||
50 | int ret; | 48 | int ret; |
51 | 49 | ||
52 | if (dcrtc->num == 1) | 50 | if (dcrtc->num == 1) |
@@ -81,7 +79,6 @@ static int armada510_crtc_compute_clock(struct armada_crtc *dcrtc, | |||
81 | const struct armada_variant armada510_ops = { | 79 | const struct armada_variant armada510_ops = { |
82 | .has_spu_adv_reg = true, | 80 | .has_spu_adv_reg = true, |
83 | .spu_adv_reg = ADV_HWC32ENABLE | ADV_HWC32ARGB | ADV_HWC32BLEND, | 81 | .spu_adv_reg = ADV_HWC32ENABLE | ADV_HWC32ARGB | ADV_HWC32BLEND, |
84 | .init = armada510_init, | ||
85 | .crtc_init = armada510_crtc_init, | 82 | .crtc_init = armada510_crtc_init, |
86 | .crtc_compute_clock = armada510_crtc_compute_clock, | 83 | .crtc_compute_clock = armada510_crtc_compute_clock, |
87 | }; | 84 | }; |
diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c index 4336dfd3585d..3adddabc3626 100644 --- a/drivers/gpu/drm/armada/armada_crtc.c +++ b/drivers/gpu/drm/armada/armada_crtc.c | |||
@@ -1108,7 +1108,7 @@ int armada_drm_crtc_create(struct drm_device *dev, struct resource *res, | |||
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | if (priv->variant->crtc_init) { | 1110 | if (priv->variant->crtc_init) { |
1111 | ret = priv->variant->crtc_init(dcrtc); | 1111 | ret = priv->variant->crtc_init(dcrtc, dev->dev); |
1112 | if (ret) { | 1112 | if (ret) { |
1113 | kfree(dcrtc); | 1113 | kfree(dcrtc); |
1114 | return ret; | 1114 | return ret; |
diff --git a/drivers/gpu/drm/armada/armada_crtc.h b/drivers/gpu/drm/armada/armada_crtc.h index 531a9b0bdcfb..3f0e70bb2e9c 100644 --- a/drivers/gpu/drm/armada/armada_crtc.h +++ b/drivers/gpu/drm/armada/armada_crtc.h | |||
@@ -38,6 +38,7 @@ struct armada_crtc { | |||
38 | unsigned num; | 38 | unsigned num; |
39 | void __iomem *base; | 39 | void __iomem *base; |
40 | struct clk *clk; | 40 | struct clk *clk; |
41 | struct clk *extclk[2]; | ||
41 | struct { | 42 | struct { |
42 | uint32_t spu_v_h_total; | 43 | uint32_t spu_v_h_total; |
43 | uint32_t spu_v_porch; | 44 | uint32_t spu_v_porch; |
diff --git a/drivers/gpu/drm/armada/armada_drm.h b/drivers/gpu/drm/armada/armada_drm.h index a72cae03b99b..a5452ae883d1 100644 --- a/drivers/gpu/drm/armada/armada_drm.h +++ b/drivers/gpu/drm/armada/armada_drm.h | |||
@@ -59,10 +59,9 @@ void armada_drm_vbl_event_remove_unlocked(struct armada_crtc *, | |||
59 | struct armada_private; | 59 | struct armada_private; |
60 | 60 | ||
61 | struct armada_variant { | 61 | struct armada_variant { |
62 | bool has_spu_adv_reg; | 62 | bool has_spu_adv_reg; |
63 | uint32_t spu_adv_reg; | 63 | uint32_t spu_adv_reg; |
64 | int (*init)(struct armada_private *, struct device *); | 64 | int (*crtc_init)(struct armada_crtc *, struct device *); |
65 | int (*crtc_init)(struct armada_crtc *); | ||
66 | int (*crtc_compute_clock)(struct armada_crtc *, | 65 | int (*crtc_compute_clock)(struct armada_crtc *, |
67 | const struct drm_display_mode *, | 66 | const struct drm_display_mode *, |
68 | uint32_t *); | 67 | uint32_t *); |
@@ -78,7 +77,6 @@ struct armada_private { | |||
78 | struct drm_fb_helper *fbdev; | 77 | struct drm_fb_helper *fbdev; |
79 | struct armada_crtc *dcrtc[2]; | 78 | struct armada_crtc *dcrtc[2]; |
80 | struct drm_mm linear; | 79 | struct drm_mm linear; |
81 | struct clk *extclk[2]; | ||
82 | struct drm_property *csc_yuv_prop; | 80 | struct drm_property *csc_yuv_prop; |
83 | struct drm_property *csc_rgb_prop; | 81 | struct drm_property *csc_rgb_prop; |
84 | struct drm_property *colorkey_prop; | 82 | struct drm_property *colorkey_prop; |
diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c index add8b101fa9e..4939a86a2afc 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c | |||
@@ -130,10 +130,6 @@ static int armada_drm_load(struct drm_device *dev, unsigned long flags) | |||
130 | 130 | ||
131 | priv->variant = (struct armada_variant *)id->driver_data; | 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 | INIT_WORK(&priv->fb_unref_work, armada_drm_unref_work); | 133 | INIT_WORK(&priv->fb_unref_work, armada_drm_unref_work); |
138 | INIT_KFIFO(priv->fb_unref); | 134 | INIT_KFIFO(priv->fb_unref); |
139 | 135 | ||