Skip to content

Commit 9611cb9

Browse files
author
Russell King
committed
drm/armada: register crtc with port
Register the CRTC with the port node so that the DRM OF helpers can find the appropriate CRTC. This is important so that encoders can identify their corresponding possible CRTCs. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent d8c9608 commit 9611cb9

3 files changed

Lines changed: 23 additions & 4 deletions

File tree

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,8 @@ static void armada_drm_crtc_destroy(struct drm_crtc *crtc)
910910

911911
writel_relaxed(0, dcrtc->base + LCD_SPU_IRQ_ENA);
912912

913+
of_node_put(dcrtc->crtc.port);
914+
913915
kfree(dcrtc);
914916
}
915917

@@ -1050,7 +1052,8 @@ static int armada_drm_crtc_create_properties(struct drm_device *dev)
10501052
}
10511053

10521054
int armada_drm_crtc_create(struct drm_device *drm, struct device *dev,
1053-
struct resource *res, int irq, const struct armada_variant *variant)
1055+
struct resource *res, int irq, const struct armada_variant *variant,
1056+
struct device_node *port)
10541057
{
10551058
struct armada_private *priv = drm->dev_private;
10561059
struct armada_crtc *dcrtc;
@@ -1123,6 +1126,7 @@ int armada_drm_crtc_create(struct drm_device *drm, struct device *dev,
11231126

11241127
priv->dcrtc[dcrtc->num] = dcrtc;
11251128

1129+
dcrtc->crtc.port = port;
11261130
drm_crtc_init(drm, &dcrtc->crtc, &armada_crtc_funcs);
11271131
drm_crtc_helper_add(&dcrtc->crtc, &armada_crtc_helper_funcs);
11281132

@@ -1142,6 +1146,7 @@ armada_lcd_bind(struct device *dev, struct device *master, void *data)
11421146
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
11431147
int irq = platform_get_irq(pdev, 0);
11441148
const struct armada_variant *variant;
1149+
struct device_node *port = NULL;
11451150

11461151
if (irq < 0)
11471152
return irq;
@@ -1156,15 +1161,27 @@ armada_lcd_bind(struct device *dev, struct device *master, void *data)
11561161
variant = (const struct armada_variant *)id->driver_data;
11571162
} else {
11581163
const struct of_device_id *match;
1164+
struct device_node *np, *parent = dev->of_node;
11591165

11601166
match = of_match_device(dev->driver->of_match_table, dev);
11611167
if (!match)
11621168
return -ENXIO;
11631169

1170+
np = of_get_child_by_name(parent, "ports");
1171+
if (np)
1172+
parent = np;
1173+
port = of_get_child_by_name(parent, "port");
1174+
of_node_put(np);
1175+
if (!port) {
1176+
dev_err(dev, "no port node found in %s\n",
1177+
parent->full_name);
1178+
return -ENXIO;
1179+
}
1180+
11641181
variant = match->data;
11651182
}
11661183

1167-
return armada_drm_crtc_create(drm, dev, res, irq, variant);
1184+
return armada_drm_crtc_create(drm, dev, res, irq, variant, port);
11681185
}
11691186

11701187
static void

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ struct armada_crtc {
7575
};
7676
#define drm_to_armada_crtc(c) container_of(c, struct armada_crtc, crtc)
7777

78+
struct device_node;
7879
int armada_drm_crtc_create(struct drm_device *, struct device *,
79-
struct resource *, int, const struct armada_variant *);
80+
struct resource *, int, const struct armada_variant *,
81+
struct device_node *);
8082
void armada_drm_crtc_gamma_set(struct drm_crtc *, u16, u16, u16, int);
8183
void armada_drm_crtc_gamma_get(struct drm_crtc *, u16 *, u16 *, u16 *, int);
8284
void armada_drm_crtc_disable_irq(struct armada_crtc *, u32);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static int armada_drm_load(struct drm_device *dev, unsigned long flags)
169169
goto err_kms;
170170

171171
ret = armada_drm_crtc_create(dev, dev->dev, res[n], irq,
172-
variant);
172+
variant, NULL);
173173
if (ret)
174174
goto err_kms;
175175
}

0 commit comments

Comments
 (0)