summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWyon Bi <bivvy.bi@rock-chips.com>2018-12-17 15:45:33 +0800
committerWyon Bi <bivvy.bi@rock-chips.com>2018-12-19 10:45:19 +0800
commitc8f3ab90c08bb6cef70d8fa2472d72cb87b1b223 (patch)
treeb01e5d3c26ebdd3582ca16729f8282571c6891b5
parent08d71ab56561c0df9910797ad2e2a33f4f270482 (diff)
drm/rockchip: rgb: Allow to configure data sync from DT
Change-Id: Id49839dc8885f632287879ec9a86420dc6dcd4de Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
-rw-r--r--Documentation/devicetree/bindings/display/rockchip/rockchip-rgb.txt1
-rw-r--r--drivers/gpu/drm/rockchip/rockchip_rgb.c25
2 files changed, 8 insertions, 18 deletions
diff --git a/Documentation/devicetree/bindings/display/rockchip/rockchip-rgb.txt b/Documentation/devicetree/bindings/display/rockchip/rockchip-rgb.txt
index e2d2c5127f2b..f2012b2d0647 100644
--- a/Documentation/devicetree/bindings/display/rockchip/rockchip-rgb.txt
+++ b/Documentation/devicetree/bindings/display/rockchip/rockchip-rgb.txt
@@ -13,6 +13,7 @@ Optional properties:
- pinctrl-names: the pin control state names; should contain "default"
- pinctrl-0: the default pinctrl state (active)
- pinctrl-1: the "sleep" pinctrl state
+- rockchip,data-sync: boolean to enable data sync
The rgb has two video ports described by:
Documentation/devicetree/bindings/media/video-interfaces.txt
diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.c b/drivers/gpu/drm/rockchip/rockchip_rgb.c
index 1782d0f16454..2da77ab57313 100644
--- a/drivers/gpu/drm/rockchip/rockchip_rgb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_rgb.c
@@ -52,6 +52,7 @@ struct rockchip_rgb {
struct drm_connector connector;
struct drm_encoder encoder;
struct regmap *grf;
+ bool data_sync;
const struct rockchip_rgb_funcs *funcs;
};
@@ -286,6 +287,9 @@ static int rockchip_rgb_probe(struct platform_device *pdev)
rgb->funcs = of_device_get_match_data(dev);
platform_set_drvdata(pdev, rgb);
+ rgb->data_sync = of_property_read_bool(dev->of_node,
+ "rockchip,data-sync");
+
if (dev->parent && dev->parent->of_node) {
rgb->grf = syscon_node_to_regmap(dev->parent->of_node);
if (IS_ERR(rgb->grf)) {
@@ -310,37 +314,22 @@ static void px30_rgb_enable(struct rockchip_rgb *rgb)
int pipe = drm_of_encoder_active_endpoint_id(rgb->dev->of_node,
&rgb->encoder);
- regmap_write(rgb->grf, PX30_GRF_PD_VO_CON1, PX30_RGB_VOP_SEL(pipe));
- regmap_write(rgb->grf, PX30_GRF_PD_VO_CON1,
- PX30_RGB_DATA_SYNC_BYPASS(1));
-}
-
-static void px30_rgb_disable(struct rockchip_rgb *rgb)
-{
- regmap_write(rgb->grf, PX30_GRF_PD_VO_CON1,
- PX30_RGB_DATA_SYNC_BYPASS(0));
+ regmap_write(rgb->grf, PX30_GRF_PD_VO_CON1, PX30_RGB_VOP_SEL(pipe) |
+ PX30_RGB_DATA_SYNC_BYPASS(!rgb->data_sync));
}
static const struct rockchip_rgb_funcs px30_rgb_funcs = {
.enable = px30_rgb_enable,
- .disable = px30_rgb_disable,
};
static void rk1808_rgb_enable(struct rockchip_rgb *rgb)
{
regmap_write(rgb->grf, RK1808_GRF_PD_VO_CON1,
- RK1808_RGB_DATA_SYNC_BYPASS(1));
-}
-
-static void rk1808_rgb_disable(struct rockchip_rgb *rgb)
-{
- regmap_write(rgb->grf, RK1808_GRF_PD_VO_CON1,
- RK1808_RGB_DATA_SYNC_BYPASS(0));
+ RK1808_RGB_DATA_SYNC_BYPASS(!rgb->data_sync));
}
static const struct rockchip_rgb_funcs rk1808_rgb_funcs = {
.enable = rk1808_rgb_enable,
- .disable = rk1808_rgb_disable,
};
static const struct of_device_id rockchip_rgb_dt_ids[] = {