Commit 9611cb93 authored by Russell King's avatar Russell King

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: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent d8c96083
...@@ -910,6 +910,8 @@ static void armada_drm_crtc_destroy(struct drm_crtc *crtc) ...@@ -910,6 +910,8 @@ static void armada_drm_crtc_destroy(struct drm_crtc *crtc)
writel_relaxed(0, dcrtc->base + LCD_SPU_IRQ_ENA); writel_relaxed(0, dcrtc->base + LCD_SPU_IRQ_ENA);
of_node_put(dcrtc->crtc.port);
kfree(dcrtc); kfree(dcrtc);
} }
...@@ -1050,7 +1052,8 @@ static int armada_drm_crtc_create_properties(struct drm_device *dev) ...@@ -1050,7 +1052,8 @@ static int armada_drm_crtc_create_properties(struct drm_device *dev)
} }
int armada_drm_crtc_create(struct drm_device *drm, struct device *dev, int armada_drm_crtc_create(struct drm_device *drm, struct device *dev,
struct resource *res, int irq, const struct armada_variant *variant) struct resource *res, int irq, const struct armada_variant *variant,
struct device_node *port)
{ {
struct armada_private *priv = drm->dev_private; struct armada_private *priv = drm->dev_private;
struct armada_crtc *dcrtc; struct armada_crtc *dcrtc;
...@@ -1123,6 +1126,7 @@ int armada_drm_crtc_create(struct drm_device *drm, struct device *dev, ...@@ -1123,6 +1126,7 @@ int armada_drm_crtc_create(struct drm_device *drm, struct device *dev,
priv->dcrtc[dcrtc->num] = dcrtc; priv->dcrtc[dcrtc->num] = dcrtc;
dcrtc->crtc.port = port;
drm_crtc_init(drm, &dcrtc->crtc, &armada_crtc_funcs); drm_crtc_init(drm, &dcrtc->crtc, &armada_crtc_funcs);
drm_crtc_helper_add(&dcrtc->crtc, &armada_crtc_helper_funcs); drm_crtc_helper_add(&dcrtc->crtc, &armada_crtc_helper_funcs);
...@@ -1142,6 +1146,7 @@ armada_lcd_bind(struct device *dev, struct device *master, void *data) ...@@ -1142,6 +1146,7 @@ armada_lcd_bind(struct device *dev, struct device *master, void *data)
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
int irq = platform_get_irq(pdev, 0); int irq = platform_get_irq(pdev, 0);
const struct armada_variant *variant; const struct armada_variant *variant;
struct device_node *port = NULL;
if (irq < 0) if (irq < 0)
return irq; return irq;
...@@ -1156,15 +1161,27 @@ armada_lcd_bind(struct device *dev, struct device *master, void *data) ...@@ -1156,15 +1161,27 @@ armada_lcd_bind(struct device *dev, struct device *master, void *data)
variant = (const struct armada_variant *)id->driver_data; variant = (const struct armada_variant *)id->driver_data;
} else { } else {
const struct of_device_id *match; const struct of_device_id *match;
struct device_node *np, *parent = dev->of_node;
match = of_match_device(dev->driver->of_match_table, dev); match = of_match_device(dev->driver->of_match_table, dev);
if (!match) if (!match)
return -ENXIO; return -ENXIO;
np = of_get_child_by_name(parent, "ports");
if (np)
parent = np;
port = of_get_child_by_name(parent, "port");
of_node_put(np);
if (!port) {
dev_err(dev, "no port node found in %s\n",
parent->full_name);
return -ENXIO;
}
variant = match->data; variant = match->data;
} }
return armada_drm_crtc_create(drm, dev, res, irq, variant); return armada_drm_crtc_create(drm, dev, res, irq, variant, port);
} }
static void static void
......
...@@ -75,8 +75,10 @@ struct armada_crtc { ...@@ -75,8 +75,10 @@ struct armada_crtc {
}; };
#define drm_to_armada_crtc(c) container_of(c, struct armada_crtc, crtc) #define drm_to_armada_crtc(c) container_of(c, struct armada_crtc, crtc)
struct device_node;
int armada_drm_crtc_create(struct drm_device *, struct device *, int armada_drm_crtc_create(struct drm_device *, struct device *,
struct resource *, int, const struct armada_variant *); struct resource *, int, const struct armada_variant *,
struct device_node *);
void armada_drm_crtc_gamma_set(struct drm_crtc *, u16, u16, u16, int); void armada_drm_crtc_gamma_set(struct drm_crtc *, u16, u16, u16, int);
void armada_drm_crtc_gamma_get(struct drm_crtc *, u16 *, u16 *, u16 *, int); void armada_drm_crtc_gamma_get(struct drm_crtc *, u16 *, u16 *, u16 *, int);
void armada_drm_crtc_disable_irq(struct armada_crtc *, u32); void armada_drm_crtc_disable_irq(struct armada_crtc *, u32);
......
...@@ -169,7 +169,7 @@ static int armada_drm_load(struct drm_device *dev, unsigned long flags) ...@@ -169,7 +169,7 @@ static int armada_drm_load(struct drm_device *dev, unsigned long flags)
goto err_kms; goto err_kms;
ret = armada_drm_crtc_create(dev, dev->dev, res[n], irq, ret = armada_drm_crtc_create(dev, dev->dev, res[n], irq,
variant); variant, NULL);
if (ret) if (ret)
goto err_kms; goto err_kms;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment