Commit 10ead694 authored by Icenowy Zheng's avatar Icenowy Zheng Committed by Maxime Ripard

drm: sun4i: add quirks for TCON TOP

Some SoCs, such as H6, doesn't have a full-featured TCON TOP.

Add quirks support for TCON TOP.

Currently the presence of TCON_TV1 and DSI is controlled via the quirks
structure.
Acked-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: default avatarIcenowy Zheng <icenowy@aosc.io>
[Fixed code style and removed unnecessary initialization]
Signed-off-by: default avatarJernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181104182705.18047-25-jernej.skrabec@siol.net
parent c96d6221
...@@ -9,11 +9,17 @@ ...@@ -9,11 +9,17 @@
#include <linux/component.h> #include <linux/component.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_device.h>
#include <linux/of_graph.h> #include <linux/of_graph.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include "sun8i_tcon_top.h" #include "sun8i_tcon_top.h"
struct sun8i_tcon_top_quirks {
bool has_tcon_tv1;
bool has_dsi;
};
static bool sun8i_tcon_top_node_is_tcon_top(struct device_node *node) static bool sun8i_tcon_top_node_is_tcon_top(struct device_node *node)
{ {
return !!of_match_node(sun8i_tcon_top_of_table, node); return !!of_match_node(sun8i_tcon_top_of_table, node);
...@@ -121,10 +127,13 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master, ...@@ -121,10 +127,13 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master,
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct clk_hw_onecell_data *clk_data; struct clk_hw_onecell_data *clk_data;
struct sun8i_tcon_top *tcon_top; struct sun8i_tcon_top *tcon_top;
const struct sun8i_tcon_top_quirks *quirks;
struct resource *res; struct resource *res;
void __iomem *regs; void __iomem *regs;
int ret, i; int ret, i;
quirks = of_device_get_match_data(&pdev->dev);
tcon_top = devm_kzalloc(dev, sizeof(*tcon_top), GFP_KERNEL); tcon_top = devm_kzalloc(dev, sizeof(*tcon_top), GFP_KERNEL);
if (!tcon_top) if (!tcon_top)
return -ENOMEM; return -ENOMEM;
...@@ -187,15 +196,17 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master, ...@@ -187,15 +196,17 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master,
&tcon_top->reg_lock, &tcon_top->reg_lock,
TCON_TOP_TCON_TV0_GATE, 0); TCON_TOP_TCON_TV0_GATE, 0);
clk_data->hws[CLK_TCON_TOP_TV1] = if (quirks->has_tcon_tv1)
sun8i_tcon_top_register_gate(dev, "tcon-tv1", regs, clk_data->hws[CLK_TCON_TOP_TV1] =
&tcon_top->reg_lock, sun8i_tcon_top_register_gate(dev, "tcon-tv1", regs,
TCON_TOP_TCON_TV1_GATE, 1); &tcon_top->reg_lock,
TCON_TOP_TCON_TV1_GATE, 1);
clk_data->hws[CLK_TCON_TOP_DSI] = if (quirks->has_dsi)
sun8i_tcon_top_register_gate(dev, "dsi", regs, clk_data->hws[CLK_TCON_TOP_DSI] =
&tcon_top->reg_lock, sun8i_tcon_top_register_gate(dev, "dsi", regs,
TCON_TOP_TCON_DSI_GATE, 2); &tcon_top->reg_lock,
TCON_TOP_TCON_DSI_GATE, 2);
for (i = 0; i < CLK_NUM; i++) for (i = 0; i < CLK_NUM; i++)
if (IS_ERR(clk_data->hws[i])) { if (IS_ERR(clk_data->hws[i])) {
...@@ -257,9 +268,17 @@ static int sun8i_tcon_top_remove(struct platform_device *pdev) ...@@ -257,9 +268,17 @@ static int sun8i_tcon_top_remove(struct platform_device *pdev)
return 0; return 0;
} }
const struct sun8i_tcon_top_quirks sun8i_r40_tcon_top_quirks = {
.has_tcon_tv1 = true,
.has_dsi = true,
};
/* sun4i_drv uses this list to check if a device node is a TCON TOP */ /* sun4i_drv uses this list to check if a device node is a TCON TOP */
const struct of_device_id sun8i_tcon_top_of_table[] = { const struct of_device_id sun8i_tcon_top_of_table[] = {
{ .compatible = "allwinner,sun8i-r40-tcon-top" }, {
.compatible = "allwinner,sun8i-r40-tcon-top",
.data = &sun8i_r40_tcon_top_quirks
},
{ /* sentinel */ } { /* sentinel */ }
}; };
MODULE_DEVICE_TABLE(of, sun8i_tcon_top_of_table); MODULE_DEVICE_TABLE(of, sun8i_tcon_top_of_table);
......
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