Commit 4bb206bf authored by Jonathan Liu's avatar Jonathan Liu Committed by Maxime Ripard

drm/sun4i: tcon: Add support for A10 TCON

The A10 has two TCONs that are similar to the ones found on other SoCs.
Like the A31, TCON0 has a register used to mux the TCON outputs to the
downstream encoders. The bit fields are slightly different.
Signed-off-by: default avatarJonathan Liu <net147@gmail.com>
[wens@csie.org: Reworked for A10 and fixed up commit message]
Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171017121807.2994-3-wens@csie.org
parent f55c83d3
...@@ -86,6 +86,7 @@ The TCON acts as a timing controller for RGB, LVDS and TV interfaces. ...@@ -86,6 +86,7 @@ The TCON acts as a timing controller for RGB, LVDS and TV interfaces.
Required properties: Required properties:
- compatible: value must be either: - compatible: value must be either:
* allwinner,sun4i-a10-tcon
* allwinner,sun5i-a13-tcon * allwinner,sun5i-a13-tcon
* allwinner,sun6i-a31-tcon * allwinner,sun6i-a31-tcon
* allwinner,sun6i-a31s-tcon * allwinner,sun6i-a31s-tcon
......
...@@ -185,7 +185,8 @@ static bool sun4i_drv_node_is_frontend(struct device_node *node) ...@@ -185,7 +185,8 @@ static bool sun4i_drv_node_is_frontend(struct device_node *node)
static bool sun4i_drv_node_is_tcon(struct device_node *node) static bool sun4i_drv_node_is_tcon(struct device_node *node)
{ {
return of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") || return of_device_is_compatible(node, "allwinner,sun4i-a10-tcon") ||
of_device_is_compatible(node, "allwinner,sun5i-a13-tcon") ||
of_device_is_compatible(node, "allwinner,sun6i-a31-tcon") || of_device_is_compatible(node, "allwinner,sun6i-a31-tcon") ||
of_device_is_compatible(node, "allwinner,sun6i-a31s-tcon") || of_device_is_compatible(node, "allwinner,sun6i-a31s-tcon") ||
of_device_is_compatible(node, "allwinner,sun8i-a33-tcon") || of_device_is_compatible(node, "allwinner,sun8i-a33-tcon") ||
......
...@@ -800,6 +800,30 @@ static int sun4i_tcon_remove(struct platform_device *pdev) ...@@ -800,6 +800,30 @@ static int sun4i_tcon_remove(struct platform_device *pdev)
} }
/* platform specific TCON muxing callbacks */ /* platform specific TCON muxing callbacks */
static int sun4i_a10_tcon_set_mux(struct sun4i_tcon *tcon,
const struct drm_encoder *encoder)
{
struct sun4i_tcon *tcon0 = sun4i_get_tcon0(encoder->dev);
u32 shift;
if (!tcon0)
return -EINVAL;
switch (encoder->encoder_type) {
case DRM_MODE_ENCODER_TMDS:
/* HDMI */
shift = 8;
break;
default:
return -EINVAL;
}
regmap_update_bits(tcon0->regs, SUN4I_TCON_MUX_CTRL_REG,
0x3 << shift, tcon->id << shift);
return 0;
}
static int sun5i_a13_tcon_set_mux(struct sun4i_tcon *tcon, static int sun5i_a13_tcon_set_mux(struct sun4i_tcon *tcon,
const struct drm_encoder *encoder) const struct drm_encoder *encoder)
{ {
...@@ -841,6 +865,11 @@ static int sun6i_tcon_set_mux(struct sun4i_tcon *tcon, ...@@ -841,6 +865,11 @@ static int sun6i_tcon_set_mux(struct sun4i_tcon *tcon,
return 0; return 0;
} }
static const struct sun4i_tcon_quirks sun4i_a10_quirks = {
.has_channel_1 = true,
.set_mux = sun4i_a10_tcon_set_mux,
};
static const struct sun4i_tcon_quirks sun5i_a13_quirks = { static const struct sun4i_tcon_quirks sun5i_a13_quirks = {
.has_channel_1 = true, .has_channel_1 = true,
.set_mux = sun5i_a13_tcon_set_mux, .set_mux = sun5i_a13_tcon_set_mux,
...@@ -866,6 +895,7 @@ static const struct sun4i_tcon_quirks sun8i_v3s_quirks = { ...@@ -866,6 +895,7 @@ static const struct sun4i_tcon_quirks sun8i_v3s_quirks = {
}; };
static const struct of_device_id sun4i_tcon_of_table[] = { static const struct of_device_id sun4i_tcon_of_table[] = {
{ .compatible = "allwinner,sun4i-a10-tcon", .data = &sun4i_a10_quirks },
{ .compatible = "allwinner,sun5i-a13-tcon", .data = &sun5i_a13_quirks }, { .compatible = "allwinner,sun5i-a13-tcon", .data = &sun5i_a13_quirks },
{ .compatible = "allwinner,sun6i-a31-tcon", .data = &sun6i_a31_quirks }, { .compatible = "allwinner,sun6i-a31-tcon", .data = &sun6i_a31_quirks },
{ .compatible = "allwinner,sun6i-a31s-tcon", .data = &sun6i_a31s_quirks }, { .compatible = "allwinner,sun6i-a31s-tcon", .data = &sun6i_a31s_quirks },
......
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