summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/sun4i/sun4i_tcon.c
diff options
context:
space:
mode:
authorIcenowy Zheng <icenowy@aosc.io>2017-05-17 22:47:17 +0800
committerMaxime Ripard <maxime.ripard@free-electrons.com>2017-06-01 09:47:23 +0200
commit87969338436710638076d8083dda8b0de703f4a5 (patch)
tree9157bb21d79e5a8297a3964f84d41c8b5a9bc82e /drivers/gpu/drm/sun4i/sun4i_tcon.c
parent7921e1477a5327ff22cc38a0ec74ace5d26dbba9 (diff)
downloadlinux-stable-87969338436710638076d8083dda8b0de703f4a5.tar.gz
linux-stable-87969338436710638076d8083dda8b0de703f4a5.tar.bz2
linux-stable-87969338436710638076d8083dda8b0de703f4a5.zip
drm/sun4i: abstract a engine type
As we are going to add support for the Allwinner DE2 engine in sun4i-drm driver, we will finally have two types of display engines -- the DE1 backend and the DE2 mixer. They both do some display blending and feed graphics data to TCON, and is part of the "Display Engine" called by Allwinner, so I choose to call them both "engine" here. Abstract the engine type to a new struct with an ops struct, which contains functions that should be called outside the engine-specified code (in TCON, CRTC or TV Encoder code). In order to preserve bisectability, we also switch the backend and layer code in its own module. Signed-off-by: Icenowy Zheng <icenowy@aosc.io> Reviewed-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Diffstat (limited to 'drivers/gpu/drm/sun4i/sun4i_tcon.c')
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_tcon.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 8b6aaa60037d..990c973c0334 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -25,12 +25,12 @@
#include <linux/regmap.h>
#include <linux/reset.h>
-#include "sun4i_backend.h"
#include "sun4i_crtc.h"
#include "sun4i_dotclock.h"
#include "sun4i_drv.h"
#include "sun4i_rgb.h"
#include "sun4i_tcon.h"
+#include "sunxi_engine.h"
void sun4i_tcon_disable(struct sun4i_tcon *tcon)
{
@@ -419,12 +419,16 @@ static int sun4i_tcon_init_regmap(struct device *dev,
* means maintaining a large list of them. Or, since the backend is
* registered and binded before the TCON, we can just go through the
* list of registered backends and compare the device node.
+ *
+ * As the structures now store engines instead of backends, here this
+ * function in fact searches the corresponding engine, and the ID is
+ * requested via the get_id function of the engine.
*/
-static struct sun4i_backend *sun4i_tcon_find_backend(struct sun4i_drv *drv,
- struct device_node *node)
+static struct sunxi_engine *sun4i_tcon_find_engine(struct sun4i_drv *drv,
+ struct device_node *node)
{
struct device_node *port, *ep, *remote;
- struct sun4i_backend *backend;
+ struct sunxi_engine *engine;
port = of_graph_get_port_by_id(node, 0);
if (!port)
@@ -435,21 +439,21 @@ static struct sun4i_backend *sun4i_tcon_find_backend(struct sun4i_drv *drv,
if (!remote)
continue;
- /* does this node match any registered backends? */
- list_for_each_entry(backend, &drv->backend_list, list) {
- if (remote == backend->node) {
+ /* does this node match any registered engines? */
+ list_for_each_entry(engine, &drv->engine_list, list) {
+ if (remote == engine->node) {
of_node_put(remote);
of_node_put(port);
- return backend;
+ return engine;
}
}
/* keep looking through upstream ports */
- backend = sun4i_tcon_find_backend(drv, remote);
- if (!IS_ERR(backend)) {
+ engine = sun4i_tcon_find_engine(drv, remote);
+ if (!IS_ERR(engine)) {
of_node_put(remote);
of_node_put(port);
- return backend;
+ return engine;
}
}
@@ -461,13 +465,13 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
{
struct drm_device *drm = data;
struct sun4i_drv *drv = drm->dev_private;
- struct sun4i_backend *backend;
+ struct sunxi_engine *engine;
struct sun4i_tcon *tcon;
int ret;
- backend = sun4i_tcon_find_backend(drv, dev->of_node);
- if (IS_ERR(backend)) {
- dev_err(dev, "Couldn't find matching backend\n");
+ engine = sun4i_tcon_find_engine(drv, dev->of_node);
+ if (IS_ERR(engine)) {
+ dev_err(dev, "Couldn't find matching engine\n");
return -EPROBE_DEFER;
}
@@ -477,7 +481,7 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
dev_set_drvdata(dev, tcon);
tcon->drm = drm;
tcon->dev = dev;
- tcon->id = backend->id;
+ tcon->id = engine->id;
tcon->quirks = of_device_get_match_data(dev);
tcon->lcd_rst = devm_reset_control_get(dev, "lcd");
@@ -520,7 +524,7 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
goto err_free_dotclock;
}
- tcon->crtc = sun4i_crtc_init(drm, backend, tcon);
+ tcon->crtc = sun4i_crtc_init(drm, engine, tcon);
if (IS_ERR(tcon->crtc)) {
dev_err(dev, "Couldn't create our CRTC\n");
ret = PTR_ERR(tcon->crtc);