Skip to content

Commit 0305189

Browse files
jernejskmripard
authored andcommitted
drm/sun4i: tcon: Add support for R40 TCON
R40 TV TCON is basically the same as on A83T. However, it needs special handling, because it has to set up TCON TOP muxes at runtime. Reviewed-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180710203511.18454-14-jernej.skrabec@siol.net
1 parent cf77d79 commit 0305189

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

drivers/gpu/drm/sun4i/sun4i_tcon.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,40 @@ static int sun6i_tcon_set_mux(struct sun4i_tcon *tcon,
13191319
return 0;
13201320
}
13211321

1322+
static int sun8i_r40_tcon_tv_set_mux(struct sun4i_tcon *tcon,
1323+
const struct drm_encoder *encoder)
1324+
{
1325+
struct device_node *port, *remote;
1326+
struct platform_device *pdev;
1327+
int id, ret;
1328+
1329+
/* find TCON TOP platform device and TCON id */
1330+
1331+
port = of_graph_get_port_by_id(tcon->dev->of_node, 0);
1332+
if (!port)
1333+
return -EINVAL;
1334+
1335+
id = sun4i_tcon_of_get_id_from_port(port);
1336+
of_node_put(port);
1337+
1338+
remote = of_graph_get_remote_node(tcon->dev->of_node, 0, -1);
1339+
if (!remote)
1340+
return -EINVAL;
1341+
1342+
pdev = of_find_device_by_node(remote);
1343+
of_node_put(remote);
1344+
if (!pdev)
1345+
return -EINVAL;
1346+
1347+
if (encoder->encoder_type == DRM_MODE_ENCODER_TMDS) {
1348+
ret = sun8i_tcon_top_set_hdmi_src(&pdev->dev, id);
1349+
if (ret)
1350+
return ret;
1351+
}
1352+
1353+
return sun8i_tcon_top_de_config(&pdev->dev, tcon->id, id);
1354+
}
1355+
13221356
static const struct sun4i_tcon_quirks sun4i_a10_quirks = {
13231357
.has_channel_0 = true,
13241358
.has_channel_1 = true,
@@ -1366,6 +1400,11 @@ static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = {
13661400
.has_channel_1 = true,
13671401
};
13681402

1403+
static const struct sun4i_tcon_quirks sun8i_r40_tv_quirks = {
1404+
.has_channel_1 = true,
1405+
.set_mux = sun8i_r40_tcon_tv_set_mux,
1406+
};
1407+
13691408
static const struct sun4i_tcon_quirks sun8i_v3s_quirks = {
13701409
.has_channel_0 = true,
13711410
};
@@ -1390,6 +1429,7 @@ const struct of_device_id sun4i_tcon_of_table[] = {
13901429
{ .compatible = "allwinner,sun8i-a33-tcon", .data = &sun8i_a33_quirks },
13911430
{ .compatible = "allwinner,sun8i-a83t-tcon-lcd", .data = &sun8i_a83t_lcd_quirks },
13921431
{ .compatible = "allwinner,sun8i-a83t-tcon-tv", .data = &sun8i_a83t_tv_quirks },
1432+
{ .compatible = "allwinner,sun8i-r40-tcon-tv", .data = &sun8i_r40_tv_quirks },
13931433
{ .compatible = "allwinner,sun8i-v3s-tcon", .data = &sun8i_v3s_quirks },
13941434
{ .compatible = "allwinner,sun9i-a80-tcon-lcd", .data = &sun9i_a80_tcon_lcd_quirks },
13951435
{ .compatible = "allwinner,sun9i-a80-tcon-tv", .data = &sun9i_a80_tcon_tv_quirks },

0 commit comments

Comments
 (0)