Skip to content

Commit 3ecea26

Browse files
author
Russell King
committed
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>
1 parent d016540 commit 3ecea26

5 files changed

Lines changed: 12 additions & 20 deletions

File tree

‎drivers/gpu/drm/armada/armada_510.c‎

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,19 @@
1515
#include "armada_drm.h"
1616
#include "armada_hw.h"
1717

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)
1919
{
20-
priv->extclk[0] = devm_clk_get(dev, "ext_ref_clk_1");
20+
struct clk *clk;
2121

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);
2425

25-
return PTR_RET(priv->extclk[0]);
26-
}
26+
dcrtc->extclk[0] = clk;
2727

28-
static int armada510_crtc_init(struct armada_crtc *dcrtc)
29-
{
3028
/* Lower the watermark so to eliminate jitter at higher bandwidths */
3129
armada_updatel(0x20, (1 << 11) | 0xff, dcrtc->base + LCD_CFG_RDREG4F);
30+
3231
return 0;
3332
}
3433

@@ -45,8 +44,7 @@ static int armada510_crtc_init(struct armada_crtc *dcrtc)
4544
static int armada510_crtc_compute_clock(struct armada_crtc *dcrtc,
4645
const struct drm_display_mode *mode, uint32_t *sclk)
4746
{
48-
struct armada_private *priv = dcrtc->crtc.dev->dev_private;
49-
struct clk *clk = priv->extclk[0];
47+
struct clk *clk = dcrtc->extclk[0];
5048
int ret;
5149

5250
if (dcrtc->num == 1)
@@ -81,7 +79,6 @@ static int armada510_crtc_compute_clock(struct armada_crtc *dcrtc,
8179
const struct armada_variant armada510_ops = {
8280
.has_spu_adv_reg = true,
8381
.spu_adv_reg = ADV_HWC32ENABLE | ADV_HWC32ARGB | ADV_HWC32BLEND,
84-
.init = armada510_init,
8582
.crtc_init = armada510_crtc_init,
8683
.crtc_compute_clock = armada510_crtc_compute_clock,
8784
};

‎drivers/gpu/drm/armada/armada_crtc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ int armada_drm_crtc_create(struct drm_device *dev, struct resource *res,
11081108
}
11091109

11101110
if (priv->variant->crtc_init) {
1111-
ret = priv->variant->crtc_init(dcrtc);
1111+
ret = priv->variant->crtc_init(dcrtc, dev->dev);
11121112
if (ret) {
11131113
kfree(dcrtc);
11141114
return ret;

‎drivers/gpu/drm/armada/armada_crtc.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ struct armada_crtc {
3838
unsigned num;
3939
void __iomem *base;
4040
struct clk *clk;
41+
struct clk *extclk[2];
4142
struct {
4243
uint32_t spu_v_h_total;
4344
uint32_t spu_v_porch;

‎drivers/gpu/drm/armada/armada_drm.h‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@ void armada_drm_vbl_event_remove_unlocked(struct armada_crtc *,
5959
struct armada_private;
6060

6161
struct armada_variant {
62-
bool has_spu_adv_reg;
62+
bool has_spu_adv_reg;
6363
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 *);
6665
int (*crtc_compute_clock)(struct armada_crtc *,
6766
const struct drm_display_mode *,
6867
uint32_t *);
@@ -78,7 +77,6 @@ struct armada_private {
7877
struct drm_fb_helper *fbdev;
7978
struct armada_crtc *dcrtc[2];
8079
struct drm_mm linear;
81-
struct clk *extclk[2];
8280
struct drm_property *csc_yuv_prop;
8381
struct drm_property *csc_rgb_prop;
8482
struct drm_property *colorkey_prop;

‎drivers/gpu/drm/armada/armada_drv.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,6 @@ static int armada_drm_load(struct drm_device *dev, unsigned long flags)
130130

131131
priv->variant = (struct armada_variant *)id->driver_data;
132132

133-
ret = priv->variant->init(priv, dev->dev);
134-
if (ret)
135-
return ret;
136-
137133
INIT_WORK(&priv->fb_unref_work, armada_drm_unref_work);
138134
INIT_KFIFO(priv->fb_unref);
139135

0 commit comments

Comments
 (0)