From 21c38316b33b3dad91dba329c78433ff80a89641 Mon Sep 17 00:00:00 2001 From: Algea Cao Date: Thu, 25 Jan 2018 11:01:50 +0800 Subject: [PATCH] drm/rockchip: Support tve uboot logo Add tve connector port. If uboot logo is enabled, dac will not be disabled when tve bind. Change-Id: I5d87f9d1afc05481968dc34b0bd09dd82719a933 Signed-off-by: Algea Cao --- drivers/gpu/drm/rockchip/rockchip_drm_tve.c | 31 ++++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_tve.c b/drivers/gpu/drm/rockchip/rockchip_drm_tve.c index 4f91c7e9cc4c..23f2ad73b7bc 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_tve.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_tve.c @@ -366,6 +366,31 @@ static int tve_parse_dt(struct device_node *np, return 0; } +static void check_uboot_logo(struct rockchip_tve *tve) +{ + int lumafilter0, lumafilter1, lumafilter2, vdac; + + vdac = tve_dac_readl(VDAC_VDAC1); + /* Whether the dac power has been turned down. */ + if (vdac & m_DR_PWR_DOWN) + return; + + lumafilter0 = tve_readl(TV_LUMA_FILTER0); + lumafilter1 = tve_readl(TV_LUMA_FILTER1); + lumafilter2 = tve_readl(TV_LUMA_FILTER2); + + /* + * The default lumafilter value is 0. If lumafilter value + * is equal to the dts value, uboot logo is enabled. + */ + if (lumafilter0 == tve->lumafilter0 && + lumafilter1 == tve->lumafilter1 && + lumafilter2 == tve->lumafilter2) + return; + + dac_init(tve); +} + static const struct of_device_id rockchip_tve_dt_ids[] = { { .compatible = "rockchip,rk3328-tve", @@ -434,10 +459,8 @@ static int rockchip_tve_bind(struct device *dev, struct device *master, return PTR_ERR(tve->vdacbase); } - dac_init(tve); - mutex_init(&tve->suspend_lock); - + check_uboot_logo(tve); tve->tv_format = TVOUT_CVBS_PAL; encoder = &tve->encoder; encoder->possible_crtcs = drm_of_find_possible_crtcs(drm_dev, @@ -455,7 +478,7 @@ static int rockchip_tve_bind(struct device *dev, struct device *master, connector = &tve->connector; connector->dpms = DRM_MODE_DPMS_OFF; - + connector->port = dev->of_node; connector->interlace_allowed = 1; ret = drm_connector_init(drm_dev, connector, &rockchip_tve_connector_funcs,