[PATCH v3 07/14] drm: rockchip/dp: add rockchip platform dp driver
Rockchip have three clocks for dp controller, we leave pclk_edp to analogix_dp driver control, and keep the sclk_edp_24m and sclk_edp in platform driver. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: - Take Thierry Reding and Heiko suggest, leave sclk_edp_24m to rockchip dp phy driver which name to 24m, and leave sclk_edp to analogix dp core driver which name to dp, and leave pclk_edp to rockchip dp platform driver which name to pclk. - Take Heiko suggest, add devicetree binding document. - Take Heiko suggest, remove rockchip,panel DT property, take use of remote point to get panel node. - Add the new function point analogix_dp_platdata.get_modes init. Changes in v2: - Take Heiko suggest, get panel node with remote-endpoint method, and create devicetree binding for driver. - Remove the clock enable/disbale with sclk_edp sclk_edp_24m, leave those clock to rockchip dp phy driver. .../bindings/video/analogix_dp-rockchip.txt| 82 + drivers/gpu/drm/rockchip/Kconfig | 9 + drivers/gpu/drm/rockchip/Makefile | 1 + drivers/gpu/drm/rockchip/analogix_dp-rockchip.c| 389 + 4 files changed, 481 insertions(+) create mode 100644 Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt create mode 100644 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c diff --git a/Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt b/Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt new file mode 100644 index 000..99fd421 --- /dev/null +++ b/Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt @@ -0,0 +1,82 @@ +Rockchip RK3288 specific extensions to the Analogix Display Port + + +Required properties: +- compatible: rockchip,rk3288-edp; + +- reg: physical base address of the controller and length +- clocks: from common clock binding: handle to dp clock. + of memory mapped region. +- clock-names: from common clock binding: + Required elements: dp pclk +- resets: Must contain an entry for each entry in reset-names. + See ../reset/reset.txt for details. +- reset-names: Must include the name dp + +- rockchip,grf: this soc should set GRF regs, so need get grf here. + +- ports: contain a port node with endpoint definitions as defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. + + +For the below properties, please refer to Analogix DP binding document: + * Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt +- phys (required) +- phy-names (required) +- analogix,color-space (required) +- analogix,color-depth (required) +- analogix,link-rate (required) +- analogix,lane-count (required) +- analogix,hpd-gpio (optional) +- video interfaces (optional) +--- + +Example: + dp-controller: dp@ff97 { + compatible = rockchip,rk3288-dp; + reg = 0xff97 0x4000; + interrupts = GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH; + clocks = cru SCLK_EDP, cru PCLK_EDP_CTRL; + clock-names = dp, pclk; + phys = dp_phy; + phy-names = dp; + + rockchip,grf = grf; + resets = cru 111; + reset-names = dp; + + hsync-active-high = 0; + vsync-active-high = 0; + interlaced = 0; + analogix,color-space = 0; + analogix,color-depth = 1; + analogix,link-rate = 0x0a; + analogix,lane-count = 4; + status = disabled; + + ports { + edp_in: port { + #address-cells = 1; + #size-cells = 0; + edp_in_vopb: endpoint@0 { + reg = 0; + remote-endpoint = vopb_out_edp; + }; + edp_in_vopl: endpoint@1 { + reg = 1; + remote-endpoint = vopl_out_edp; + }; + }; + + edp_out: port@1 { + reg = 1; + #address-cells = 1; + #size-cells = 0; + edp_out_panel: endpoint { + reg = 0; + remote-endpoint = panel_in_edp + }; + }; + }; + }; + diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig index 35215f6..c2ba945 100644 --- a/drivers/gpu/drm/rockchip/Kconfig +++ b/drivers/gpu/drm/rockchip/Kconfig @@ -25,3 +25,12 @@ config ROCKCHIP_DW_HDMI
[PATCH v3 08/14] phy: Add driver for rockchip Display Port PHY
Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: - Take Heiko suggest, add rockchip dp phy driver, collect the phy clocks and power control. Changes in v2: None .../devicetree/bindings/phy/rockchip-dp-phy.txt| 26 +++ drivers/phy/Kconfig| 7 + drivers/phy/Makefile | 1 + drivers/phy/phy-rockchip-dp.c | 185 + 4 files changed, 219 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt create mode 100644 drivers/phy/phy-rockchip-dp.c diff --git a/Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt new file mode 100644 index 000..5de1088 --- /dev/null +++ b/Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt @@ -0,0 +1,26 @@ +Rockchip Soc Seroes Display Port PHY + + +Required properties: +- compatible : should be one of the following supported values: +- rockchip.rk3288-dp-phy + +- reg : a list of registers used by phy driver +- clocks: from common clock binding: handle to dp clock. + of memory mapped region. +- clock-names: from common clock binding: + Required elements: sclk_dp sclk_dp_24m + +- rockchip,grf: this soc should set GRF regs, so need get grf here. +- #phy-cells : from the generic PHY bindings, must be 0; + +Example: + +edp_phy: phy@ff770274 { + compatilble = rockchip,rk3288-dp-phy; + reg = 0xff770274 4; + rockchip,grf = grf; + clocks = cru SCLK_EDP_24M; + clock-names = 24m; + #phy-cells = 0; +} diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 6b8dd16..da00440 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -297,6 +297,13 @@ config PHY_ROCKCHIP_USB help Enable this to support the Rockchip USB 2.0 PHY. +config PHY_ROCKCHIP_DP + tristate Rockchip Display Port PHY Driver + depends on ARCH_ROCKCHIP OF + select GENERIC_PHY + help + Enable this to support the Rockchip Display Port PHY. + config PHY_ST_SPEAR1310_MIPHY tristate ST SPEAR1310-MIPHY driver select GENERIC_PHY diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index f344e1b..35e3ce6 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -33,6 +33,7 @@ phy-exynos-usb2-$(CONFIG_PHY_S5PV210_USB2)+= phy-s5pv210-usb2.o obj-$(CONFIG_PHY_EXYNOS5_USBDRD) += phy-exynos5-usbdrd.o obj-$(CONFIG_PHY_QCOM_APQ8064_SATA)+= phy-qcom-apq8064-sata.o obj-$(CONFIG_PHY_ROCKCHIP_USB) += phy-rockchip-usb.o +obj-$(CONFIG_PHY_ROCKCHIP_DP) += phy-rockchip-dp.o obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA)+= phy-qcom-ipq806x-sata.o obj-$(CONFIG_PHY_ST_SPEAR1310_MIPHY) += phy-spear1310-miphy.o obj-$(CONFIG_PHY_ST_SPEAR1340_MIPHY) += phy-spear1340-miphy.o diff --git a/drivers/phy/phy-rockchip-dp.c b/drivers/phy/phy-rockchip-dp.c new file mode 100644 index 000..4759111 --- /dev/null +++ b/drivers/phy/phy-rockchip-dp.c @@ -0,0 +1,185 @@ +/* + * Rockchip DP PHY driver + * + * Copyright (C) 2015 FuZhou Rockchip Co., Ltd. + * Author: Yakir Yang ykk@@rock-chips.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License. + */ + +#include linux/io.h +#include linux/kernel.h +#include linux/module.h +#include linux/of.h +#include linux/of_address.h +#include linux/clk.h +#include linux/phy/phy.h +#include linux/regmap.h +#include linux/mfd/syscon.h +#include linux/platform_device.h + +#define GRF_SOC_CON12 0x0274 +#define GRF_EDP_REF_CLK_SEL_INTER BIT(4) + +#define DP_PHY_SIDDQ_WRITE_EN BIT(21) +#define DP_PHY_SIDDQ_ON 0 +#define DP_PHY_SIDDQ_OFFBIT(5) + +struct rockchip_dp_phy { + struct device *dev; + struct regmap *grf; + void __iomem *regs; + struct clk *phy_24m; +}; + +static int rockchip_dp_phy_clk_enable(struct rockchip_dp_phy *dp) +{ + int ret = 0; + + ret = clk_set_rate(dp-phy_24m, 2400); + if (ret 0) { + dev_err(dp-dev, cannot set clock phy_24m %d\n, ret); + return ret; + } + + ret = clk_prepare_enable(dp-phy_24m); + if (ret 0) { + dev_err(dp-dev, cannot enable clock phy_24m %d\n, ret); + return ret; + } + + return 0; +} + +static int rockchip_dp_phy_clk_disable(struct rockchip_dp_phy *dp) +{ + clk_disable_unprepare(dp-phy_24m); + + return 0; +} + +static int rockchip_set_phy_state(struct phy *phy, bool enable) +{ + struct rockchip_dp_phy *dp = phy_get_drvdata(phy); + + if (enable) { + rockchip_dp_phy_clk_enable(dp); + writel(DP_PHY_SIDDQ_WRITE_EN | DP_PHY_SIDDQ_ON, dp-regs
[PATCH v3 05/14] drm: bridge/analogix_dp: fix link_rate lane_count bug
link_rate and lane_count already configed in analogix_dp_set_link_train(), so we don't need to config those repeatly after training finished, just remove them out. Beside Display Port 1.2 already support 5.4Gbps link rate, the maximum sets would change from {1.62Gbps, 2.7Gbps} to {1.62Gbps, 2.7Gbps, 5.4Gbps}. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: - Take Thierry Reding suggest, link_rate and lane_count shouldn't config to the DT property value directly, but we can take those as hardware limite. For example, RK3288 only support 4 physical lanes of 2.7/1.62 Gbps/lane, so DT property would like link-rate = 0x0a lane-count = 4. Changes in v2: None drivers/gpu/drm/bridge/analogix_dp_core.c | 16 drivers/gpu/drm/bridge/analogix_dp_core.h | 9 + 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix_dp_core.c index 480cc13..1778e0a 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix_dp_core.c @@ -635,6 +635,8 @@ static void analogix_dp_get_max_rx_bandwidth(struct analogix_dp_device *dp, /* * For DP rev.1.1, Maximum link rate of Main Link lanes * 0x06 = 1.62 Gbps, 0x0a = 2.7 Gbps +* For DP rev.1.2, Maximum link rate of Main Link lanes +* 0x06 = 1.62 Gbps, 0x0a = 2.7 Gbps, 0x14 = 5.4Gbps */ analogix_dp_read_byte_from_dpcd(dp, DP_MAX_LINK_RATE, data); *bandwidth = data; @@ -668,7 +670,8 @@ static void analogix_dp_init_training(struct analogix_dp_device *dp, analogix_dp_get_max_rx_lane_count(dp, dp-link_train.lane_count); if ((dp-link_train.link_rate != LINK_RATE_1_62GBPS) - (dp-link_train.link_rate != LINK_RATE_2_70GBPS)) { + (dp-link_train.link_rate != LINK_RATE_2_70GBPS) + (dp-link_train.link_rate != LINK_RATE_5_40GBPS)) { dev_err(dp-dev, Rx Max Link Rate is abnormal :%x !\n, dp-link_train.link_rate); dp-link_train.link_rate = LINK_RATE_1_62GBPS; @@ -901,8 +904,8 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) return; } - ret = analogix_dp_set_link_train(dp, dp-video_info-lane_count, -dp-video_info-link_rate); + ret = analogix_dp_set_link_train(dp, dp-video_info-max_lane_count, +dp-video_info-max_link_rate); if (ret) { dev_err(dp-dev, unable to do link train\n); return; @@ -912,9 +915,6 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) analogix_dp_enable_rx_to_enhanced_mode(dp, 1); analogix_dp_enable_enhanced_mode(dp, 1); - analogix_dp_set_lane_count(dp, dp-video_info-lane_count); - analogix_dp_set_link_bandwidth(dp, dp-video_info-link_rate); - analogix_dp_init_video(dp); ret = analogix_dp_config_video(dp); if (ret) @@ -1198,13 +1198,13 @@ static struct video_info *analogix_dp_dt_parse_pdata(struct device *dev) } if (of_property_read_u32(dp_node, analogix,link-rate, -dp_video_config-link_rate)) { +dp_video_config-max_link_rate)) { dev_err(dev, failed to get link-rate\n); return ERR_PTR(-EINVAL); } if (of_property_read_u32(dp_node, analogix,lane-count, -dp_video_config-lane_count)) { +dp_video_config-max_lane_count)) { dev_err(dev, failed to get lane-count\n); return ERR_PTR(-EINVAL); } diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix_dp_core.h index 2cefde9..941b34f 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_core.h +++ b/drivers/gpu/drm/bridge/analogix_dp_core.h @@ -21,8 +21,9 @@ #define MAX_EQ_LOOP 5 enum link_rate_type { - LINK_RATE_1_62GBPS = 0x06, - LINK_RATE_2_70GBPS = 0x0a + LINK_RATE_1_62GBPS = DP_LINK_BW_1_62, + LINK_RATE_2_70GBPS = DP_LINK_BW_2_7, + LINK_RATE_5_40GBPS = DP_LINK_BW_5_4, }; enum link_lane_count_type { @@ -128,8 +129,8 @@ struct video_info { enum color_coefficient ycbcr_coeff; enum color_depth color_depth; - enum link_rate_type link_rate; - enum link_lane_count_type lane_count; + enum link_rate_type max_link_rate; + enum link_lane_count_type max_lane_count; }; struct link_train { -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 10/14] drm: bridge: analogix_dp: add some rk3288 special registers setting
RK3288 need some special registers setting, we can separate them out by the dev_type of plat_data. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: None Changes in v2: - Fix compile failed dut to phy_pd_addr variable misspell error drivers/gpu/drm/bridge/analogix_dp_reg.c | 76 drivers/gpu/drm/bridge/analogix_dp_reg.h | 12 + 2 files changed, 60 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix_dp_reg.c index cc5cdbf..a0fc1fb 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_reg.c +++ b/drivers/gpu/drm/bridge/analogix_dp_reg.c @@ -15,6 +15,8 @@ #include linux/delay.h #include linux/gpio.h +#include drm/bridge/analogix_dp.h + #include analogix_dp_core.h #include analogix_dp_reg.h @@ -72,6 +74,14 @@ void analogix_dp_init_analog_param(struct analogix_dp_device *dp) reg = SEL_24M | TX_DVDD_BIT_1_0625V; writel(reg, dp-reg_base + ANALOGIX_DP_ANALOG_CTL_2); + if (dp-plat_data (dp-plat_data-dev_type == RK3288_DP)) { + writel(REF_CLK_24M, dp-reg_base + ANALOGIX_DP_PLL_REG_1); + writel(0x95, dp-reg_base + ANALOGIX_DP_PLL_REG_2); + writel(0x40, dp-reg_base + ANALOGIX_DP_PLL_REG_3); + writel(0x58, dp-reg_base + ANALOGIX_DP_PLL_REG_4); + writel(0x22, dp-reg_base + ANALOGIX_DP_PLL_REG_5); + } + reg = DRIVE_DVDD_BIT_1_0625V | VCO_BIT_600_MICRO; writel(reg, dp-reg_base + ANALOGIX_DP_ANALOG_CTL_3); @@ -206,81 +216,85 @@ void analogix_dp_set_analog_power_down(struct analogix_dp_device *dp, bool enable) { u32 reg; + u32 phy_pd_addr = ANALOGIX_DP_PHY_PD; + + if (dp-plat_data (dp-plat_data-dev_type == RK3288_DP)) + phy_pd_addr = ANALOGIX_DP_PD; switch (block) { case AUX_BLOCK: if (enable) { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_pd_addr); reg |= AUX_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_pd_addr); } else { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_pd_addr); reg = ~AUX_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_pd_addr); } break; case CH0_BLOCK: if (enable) { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_pd_addr); reg |= CH0_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_pd_addr); } else { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_pd_addr); reg = ~CH0_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_pd_addr); } break; case CH1_BLOCK: if (enable) { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_pd_addr); reg |= CH1_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_pd_addr); } else { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_pd_addr); reg = ~CH1_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_pd_addr); } break; case CH2_BLOCK: if (enable) { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_pd_addr); reg |= CH2_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_pd_addr); } else { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_pd_addr); reg = ~CH2_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_pd_addr); } break; case CH3_BLOCK: if (enable) { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD
[PATCH v3 0/14] Add Analogix Core Display Port Driver
Hi all, The Samsung Exynos eDP controller and Rockchip RK3288 eDP controller share the same IP, so a lot of parts can be re-used. I split the common code into bridge directory, then rk3288 and exynos only need to keep some platform code. Cause I can't find the exact IP name of exynos dp controller, so I decide to name dp core driver with analogix which I find in rk3288 eDP TRM ;) Beyond that, there are three light registers setting differents bewteen exynos and rk3288. 1. RK3288 have five special pll resigters which not indicata in exynos dp controller. 2. The address of DP_PHY_PD(dp phy power manager register) are different between rk3288 and exynos. 3. Rk3288 and exynos have different setting with AUX_HW_RETRY_CTL(dp debug register). I have verified this series on two kinds of rockchip platform board, one is rk3288 sdk board which connect with a 2K display port monitor, the other is google jerry chromebook which connect with a eDP screen cnm,n116bgeea2, both of them works rightlly. I haven't verified the dp function on samsung platform, cause I haven't got exynos boards. I can only ensure that there are no build error on samsung platform, wish some samsung guys help to test. ;) Thanks, - Yakir Changes in v3: - Take Thierry Reding suggest, move exynos's video_timing code to analogix_dp-exynos platform driver, add get_modes method to struct analogix_dp_plat_data. - Take Heiko suggest, rename some samsung* dts propery to analogix*. - Take Thierry Reding suggest, dynamic parse video timing info from struct drm_display_mode and struct drm_display_info. - Take Thierry Reding suggest, link_rate and lane_count shouldn't config to the DT property value directly, but we can take those as hardware limite. For example, RK3288 only support 4 physical lanes of 2.7/1.62 Gbps/lane, so DT property would like link-rate = 0x0a lane-count = 4. - Take Heiko suggest, add devicetree binding documents. - Take Thierry Reding suggest, remove sync pol colorimetry properies from the new analogix dp driver devicetree binding. - Update the exist exynos dtsi file with the latest DP DT properies. - Take Thierry Reding and Heiko suggest, leave sclk_edp_24m to rockchip dp phy driver which name to 24m, and leave sclk_edp to analogix dp core driver which name to dp, and leave pclk_edp to rockchip dp platform driver which name to pclk. - Take Heiko suggest, add devicetree binding document. - Take Heiko suggest, remove rockchip,panel DT property, take use of remote point to get panel node. - Add the new function point analogix_dp_platdata.get_modes init. - Take Heiko suggest, add rockchip dp phy driver, collect the phy clocks and power control. - Add analogix,need-force-hpd to indicate whether driver need foce hpd when hpd detect failed. - move dp hpd detect to connector detect function. - Add edid modes parse support Changes in v2: - Take Joe Preches advise, improved commit message more readable, and avoid using some uncommon style like bellow: - retval = exynos_dp_read_bytes_from_i2c(... ...) + retval = + exynos_dp_read_bytes_from_i2c(..); - Take Jingoo Han suggest, just remove my name from author list. - Take Jingoo Han suggest, remove new copyright - Fix compiled failed dut to analogix_dp_device misspell - Take Heiko suggest, get panel node with remote-endpoint method, and create devicetree binding for driver. - Remove the clock enable/disbale with sclk_edp sclk_edp_24m, leave those clock to rockchip dp phy driver. - Add GNU license v2 declared and samsung copyright - Fix compile failed dut to phy_pd_addr variable misspell error Yakir Yang (14): drm: exynos/dp: fix code style drm: exynos/dp: convert to drm bridge mode drm: bridge: analogix_dp: split exynos dp driver to bridge dir drm: bridge/analogix_dp: dynamic parse sync_pol interlace colorimetry drm: bridge/analogix_dp: fix link_rate lane_count bug Documentation: drm/bridge: add document for analogix_dp drm: rockchip/dp: add rockchip platform dp driver phy: Add driver for rockchip Display Port PHY drm: bridge/analogix_dp: add platform device type support drm: bridge: analogix_dp: add some rk3288 special registers setting drm: bridge: analogix_dp: try force hpd after plug in lookup failed drm: bridge/analogix_dp: expand the delay time for hpd detect drm: bridge/analogix_dp: move hpd detect to connector detect function drm: bridge/analogix_dp: add edid modes parse in get_modes method .../devicetree/bindings/drm/bridge/analogix_dp.txt | 73 + .../devicetree/bindings/phy/rockchip-dp-phy.txt| 26 + .../bindings/video/analogix_dp-rockchip.txt| 83 ++ .../devicetree/bindings/video/exynos_dp.txt| 51 +- arch/arm/boot/dts/exynos5250-arndale.dts | 10 +- arch/arm/boot/dts/exynos5250-smdk5250.dts | 10 +- arch/arm/boot/dts/exynos5250-snow.dts | 12 +- arch/arm/boot/dts/exynos5250-spring.dts
[PATCH v3 01/14] drm: exynos/dp: fix code style
After run checkpatch.pl -f --subjective command, I see there are lots of alignment problem in exynos_dp driver, so let just fix them. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: None Changes in v2: - Take Joe Preches advise, improved commit message more readable, and avoid using some uncommon style like bellow: - retval = exynos_dp_read_bytes_from_i2c(... ...) + retval = + exynos_dp_read_bytes_from_i2c(..); drivers/gpu/drm/exynos/exynos_dp_core.c | 219 drivers/gpu/drm/exynos/exynos_dp_core.h | 53 drivers/gpu/drm/exynos/exynos_dp_reg.c | 100 +++ 3 files changed, 182 insertions(+), 190 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 172b800..562f4a8 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -114,8 +114,8 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) /* Read Extension Flag, Number of 128-byte EDID extension blocks */ retval = exynos_dp_read_byte_from_i2c(dp, I2C_EDID_DEVICE_ADDR, - EDID_EXTENSION_FLAG, - extend_block); + EDID_EXTENSION_FLAG, + extend_block); if (retval) return retval; @@ -123,10 +123,11 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) dev_dbg(dp-dev, EDID data includes a single extension!\n); /* Read EDID data */ - retval = exynos_dp_read_bytes_from_i2c(dp, I2C_EDID_DEVICE_ADDR, - EDID_HEADER_PATTERN, - EDID_BLOCK_LENGTH, - edid[EDID_HEADER_PATTERN]); + retval = exynos_dp_read_bytes_from_i2c( + dp, I2C_EDID_DEVICE_ADDR, + EDID_HEADER_PATTERN, + EDID_BLOCK_LENGTH, + edid[EDID_HEADER_PATTERN]); if (retval != 0) { dev_err(dp-dev, EDID Read failed!\n); return -EIO; @@ -138,11 +139,11 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) } /* Read additional EDID data */ - retval = exynos_dp_read_bytes_from_i2c(dp, - I2C_EDID_DEVICE_ADDR, - EDID_BLOCK_LENGTH, - EDID_BLOCK_LENGTH, - edid[EDID_BLOCK_LENGTH]); + retval = exynos_dp_read_bytes_from_i2c( + dp, I2C_EDID_DEVICE_ADDR, + EDID_BLOCK_LENGTH, + EDID_BLOCK_LENGTH, + edid[EDID_BLOCK_LENGTH]); if (retval != 0) { dev_err(dp-dev, EDID Read failed!\n); return -EIO; @@ -154,24 +155,22 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) } exynos_dp_read_byte_from_dpcd(dp, DP_TEST_REQUEST, - test_vector); + test_vector); if (test_vector DP_TEST_LINK_EDID_READ) { - exynos_dp_write_byte_to_dpcd(dp, - DP_TEST_EDID_CHECKSUM, + exynos_dp_write_byte_to_dpcd( + dp, DP_TEST_EDID_CHECKSUM, edid[EDID_BLOCK_LENGTH + EDID_CHECKSUM]); - exynos_dp_write_byte_to_dpcd(dp, - DP_TEST_RESPONSE, + exynos_dp_write_byte_to_dpcd( + dp, DP_TEST_RESPONSE, DP_TEST_EDID_CHECKSUM_WRITE); } } else { dev_info(dp-dev, EDID data does not include any extensions.\n); /* Read EDID data */ - retval = exynos_dp_read_bytes_from_i2c(dp, - I2C_EDID_DEVICE_ADDR, - EDID_HEADER_PATTERN, - EDID_BLOCK_LENGTH, - edid[EDID_HEADER_PATTERN]); + retval = exynos_dp_read_bytes_from_i2c( + dp, I2C_EDID_DEVICE_ADDR, EDID_HEADER_PATTERN, + EDID_BLOCK_LENGTH, edid[EDID_HEADER_PATTERN]); if (retval != 0) { dev_err(dp-dev, EDID Read failed!\n); return -EIO; @@ -182,16 +181,15 @@ static int
[PATCH v3 04/14] drm: bridge/analogix_dp: dynamic parse sync_pol interlace colorimetry
Both hsync/vsync polarity and interlace mode can be parsed from drm display mode, and dynamic_range and ycbcr_coeff can be judge by the video code. But presumably Exynos still relaies on the DT properties, so take good use of mode_fixup() in to achieve the compatibility hacks. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: - Take Thierry Reding suggest, dynamic parse video timing info from struct drm_display_mode and struct drm_display_info. Changes in v2: None drivers/gpu/drm/bridge/analogix_dp_core.c | 50 -- drivers/gpu/drm/exynos/analogix_dp-exynos.c | 65 ++--- 2 files changed, 89 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix_dp_core.c index 6c15e20..480cc13 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix_dp_core.c @@ -1110,11 +1110,40 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge) dp-dpms_mode = DRM_MODE_DPMS_OFF; } +static void analogix_dp_bridge_mode_set(struct drm_bridge *bridge, + struct drm_display_mode *orig_mode, + struct drm_display_mode *mode) +{ + struct analogix_dp_device *dp = bridge-driver_private; + struct video_info *video_info = dp-video_info; + int vic; + + /* interlaces hsync pol vsync pol */ + video_info-interlaced = !!(mode-flags DRM_MODE_FLAG_INTERLACE); + video_info-v_sync_polarity = !!(mode-flags DRM_MODE_FLAG_NVSYNC); + video_info-h_sync_polarity = !!(mode-flags DRM_MODE_FLAG_NHSYNC); + + /* dynamic_range colorimetry */ + vic = drm_match_cea_mode(mode); + if ((vic == 6) || (vic == 7) || (vic == 21) || (vic == 22) || + (vic == 2) || (vic == 3) || (vic == 17) || (vic == 18)) { + video_info-dynamic_range = CEA; + video_info-ycbcr_coeff = COLOR_YCBCR601; + } else if (vic) { + video_info-dynamic_range = CEA; + video_info-ycbcr_coeff = COLOR_YCBCR709; + } else { + video_info-dynamic_range = VESA; + video_info-ycbcr_coeff = COLOR_YCBCR709; + } +} + static const struct drm_bridge_funcs analogix_dp_bridge_funcs = { .enable = analogix_dp_bridge_enable, .disable = analogix_dp_bridge_disable, .pre_enable = analogix_dp_bridge_nop, .post_disable = analogix_dp_bridge_nop, + .mode_set = analogix_dp_bridge_mode_set, .attach = analogix_dp_bridge_attach, }; @@ -1156,33 +1185,12 @@ static struct video_info *analogix_dp_dt_parse_pdata(struct device *dev) if (!dp_video_config) return ERR_PTR(-ENOMEM); - dp_video_config-h_sync_polarity = - of_property_read_bool(dp_node, hsync-active-high); - - dp_video_config-v_sync_polarity = - of_property_read_bool(dp_node, vsync-active-high); - - dp_video_config-interlaced = - of_property_read_bool(dp_node, interlaced); - if (of_property_read_u32(dp_node, analogix,color-space, dp_video_config-color_space)) { dev_err(dev, failed to get color-space\n); return ERR_PTR(-EINVAL); } - if (of_property_read_u32(dp_node, analogix,dynamic-range, -dp_video_config-dynamic_range)) { - dev_err(dev, failed to get dynamic-range\n); - return ERR_PTR(-EINVAL); - } - - if (of_property_read_u32(dp_node, analogix,ycbcr-coeff, -dp_video_config-ycbcr_coeff)) { - dev_err(dev, failed to get ycbcr-coeff\n); - return ERR_PTR(-EINVAL); - } - if (of_property_read_u32(dp_node, analogix,color-depth, dp_video_config-color_depth)) { dev_err(dev, failed to get color-depth\n); diff --git a/drivers/gpu/drm/exynos/analogix_dp-exynos.c b/drivers/gpu/drm/exynos/analogix_dp-exynos.c index d5631c2..17da2c8 100644 --- a/drivers/gpu/drm/exynos/analogix_dp-exynos.c +++ b/drivers/gpu/drm/exynos/analogix_dp-exynos.c @@ -26,11 +26,17 @@ #include drm/exynos_drm.h #include exynos_drm_drv.h -#define plat_data_to_dp(pd) \ - container_of(pd, struct exynos_dp_device, plat_data) +#define to_dp(nm) container_of(nm, struct exynos_dp_device, nm) + +struct video_info { + bool h_sync_polarity; + bool v_sync_polarity; + bool interlaced; +}; struct exynos_dp_device { struct exynos_drm_display display; + struct video_info video_info; struct drm_bridge *ptn_bridge; struct drm_device *drm_dev; struct device *dev; @@ -42,7 +48,7 @@ struct exynos_dp_device { int exynos_dp_crtc_clock_enable(struct analogix_dp_plat_data
[PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp
Analogix dp driver is split from exynos dp driver, so we just make an copy of exynos_dp.txt, and then simplify exynos_dp.txt Beside update some exynos dtsi file with the latest change according to the devicetree binding documents. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: - Take Heiko suggest, add devicetree binding documents. - Take Thierry Reding suggest, remove sync pol colorimetry properies from the new analogix dp driver devicetree binding. - Update the exist exynos dtsi file with the latest DP DT properies. Changes in v2: None .../devicetree/bindings/drm/bridge/analogix_dp.txt | 70 ++ .../devicetree/bindings/video/exynos_dp.txt| 50 ++-- arch/arm/boot/dts/exynos5250-arndale.dts | 10 ++-- arch/arm/boot/dts/exynos5250-smdk5250.dts | 10 ++-- arch/arm/boot/dts/exynos5250-snow.dts | 12 ++-- arch/arm/boot/dts/exynos5250-spring.dts| 12 ++-- arch/arm/boot/dts/exynos5420-peach-pit.dts | 12 ++-- arch/arm/boot/dts/exynos5420-smdk5420.dts | 10 ++-- arch/arm/boot/dts/exynos5800-peach-pi.dts | 12 ++-- 9 files changed, 119 insertions(+), 79 deletions(-) create mode 100644 Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt diff --git a/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt b/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt new file mode 100644 index 000..6127018 --- /dev/null +++ b/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt @@ -0,0 +1,70 @@ +Analogix Display Port bridge bindings + +Required properties for dp-controller: + -compatible: + platform specific such as: +* samsung,exynos5-dp +* rockchip,rk3288-dp + -reg: + physical base address of the controller and length + of memory mapped region. + -interrupts: + interrupt combiner values. + -clocks: + from common clock binding: handle to dp clock. + -clock-names: + from common clock binding: Shall be dp. + -interrupt-parent: + phandle to Interrupt combiner node. + -phys: + from general PHY binding: the phandle for the PHY device. + -phy-names: + from general PHY binding: Should be dp. + -analogix,color-space: + input video data format. + COLOR_RGB = 0, COLOR_YCBCR422 = 1, COLOR_YCBCR444 = 2 + -analogix,color-depth: + number of bits per colour component. + COLOR_6 = 0, COLOR_8 = 1, COLOR_10 = 2, COLOR_12 = 3 + -analogix,link-rate: + max link rate supported by the eDP controller. + LINK_RATE_1_62GBPS = 0x6, LINK_RATE_2_70GBPS = 0x0A, + LINK_RATE_5_40GBPS = 0x14 + -analogix,lane-count: + max number of lanes supported by the eDP contoller. + LANE_COUNT1 = 1, LANE_COUNT2 = 2, LANE_COUNT4 = 4 + -port@[X]: SoC specific port nodes with endpoint definitions as defined + in Documentation/devicetree/bindings/media/video-interfaces.txt, + please refer to the SoC specific binding document: + * Documentation/devicetree/bindings/video/exynos_dp.txt + * Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt + +Optional properties for dp-controller: + -analogix,hpd-gpio: + Hotplug detect GPIO. + Indicates which GPIO should be used for hotplug + detection + -video interfaces: Device node can contain video interface port + nodes according to [1]. + +[1]: Documentation/devicetree/bindings/media/video-interfaces.txt +--- + +Example: + + dp-controller { + compatible = samsung,exynos5-dp; + reg = 0x145b 0x1; + interrupts = 10 3; + interrupt-parent = combiner; + clocks = clock 342; + clock-names = dp; + + phys = dp_phy; + phy-names = dp; + + analogix,color-space = 0; + analogix,color-depth = 1; + analogix,link-rate = 0x0a; + analogix,lane-count = 4; + }; diff --git a/Documentation/devicetree/bindings/video/exynos_dp.txt b/Documentation/devicetree/bindings/video/exynos_dp.txt index 7a3a9cd..177506f 100644 --- a/Documentation/devicetree/bindings/video/exynos_dp.txt +++ b/Documentation/devicetree/bindings/video/exynos_dp.txt @@ -31,28 +31,10 @@ Required properties for dp-controller: from general PHY binding: the phandle for the PHY device. -phy-names: from general PHY binding: Should be dp. - -samsung,color-space
[PATCH v3 02/14] drm: exynos/dp: convert to drm bridge mode
In order to move exynos dp code to bridge directory, we need to convert driver drm bridge mode first. As dp driver already have a ptn3460 bridge, so we need to move ptn bridge to the next bridge of dp bridge. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: None Changes in v2: - Take Jingoo Han suggest, just remove my name from author list. drivers/gpu/drm/exynos/exynos_dp_core.c | 194 drivers/gpu/drm/exynos/exynos_dp_core.h | 1 + 2 files changed, 123 insertions(+), 72 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 562f4a8..2b87406 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -997,59 +997,6 @@ static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = { .best_encoder = exynos_dp_best_encoder, }; -/* returns the number of bridges attached */ -static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, - struct drm_encoder *encoder) -{ - int ret; - - encoder-bridge = dp-bridge; - dp-bridge-encoder = encoder; - ret = drm_bridge_attach(encoder-dev, dp-bridge); - if (ret) { - DRM_ERROR(Failed to attach bridge to drm\n); - return ret; - } - - return 0; -} - -static int exynos_dp_create_connector(struct exynos_drm_display *display, - struct drm_encoder *encoder) -{ - struct exynos_dp_device *dp = display_to_dp(display); - struct drm_connector *connector = dp-connector; - int ret; - - dp-encoder = encoder; - - /* Pre-empt DP connector creation if there's a bridge */ - if (dp-bridge) { - ret = exynos_drm_attach_lcd_bridge(dp, encoder); - if (!ret) - return 0; - } - - connector-polled = DRM_CONNECTOR_POLL_HPD; - - ret = drm_connector_init(dp-drm_dev, connector, -exynos_dp_connector_funcs, -DRM_MODE_CONNECTOR_eDP); - if (ret) { - DRM_ERROR(Failed to initialize connector with drm\n); - return ret; - } - - drm_connector_helper_add(connector, exynos_dp_connector_helper_funcs); - drm_connector_register(connector); - drm_mode_connector_attach_encoder(connector, encoder); - - if (dp-panel) - ret = drm_panel_attach(dp-panel, dp-connector); - - return ret; -} - static void exynos_dp_phy_init(struct exynos_dp_device *dp) { if (dp-phy) @@ -1114,23 +1061,126 @@ static void exynos_dp_poweroff(struct exynos_dp_device *dp) } } -static void exynos_dp_dpms(struct exynos_drm_display *display, int mode) +/* returns the number of bridges attached */ +static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, + struct drm_encoder *encoder) +{ + int ret; + + dp-bridge-next = dp-ptn_bridge; + dp-bridge-encoder = encoder; + ret = drm_bridge_attach(encoder-dev, dp-bridge); + if (ret) { + DRM_ERROR(Failed to attach ptn bridge to drm\n); + return ret; + } + + return 0; +} + +static int exynos_dp_bridge_attach(struct drm_bridge *bridge) +{ + + struct exynos_dp_device *dp = bridge-driver_private; + struct drm_encoder *encoder = dp-encoder; + struct drm_connector *connector = dp-connector; + int ret; + + if (!bridge-encoder) { + DRM_ERROR(Parent encoder object not found); + return -ENODEV; + } + + encoder-bridge = bridge; + + /* Pre-empt DP connector creation if there's a bridge */ + if (dp-ptn_bridge) { + ret = exynos_drm_attach_lcd_bridge(dp, encoder); + if (ret) + return -ENODEV; + } + + connector-polled = DRM_CONNECTOR_POLL_HPD; + + ret = drm_connector_init(dp-drm_dev, connector, + exynos_dp_connector_funcs, DRM_MODE_CONNECTOR_eDP); + if (ret) { + DRM_ERROR(Failed to initialize connector with drm\n); + return ret; + } + + drm_connector_helper_add(connector, exynos_dp_connector_helper_funcs); + drm_connector_register(connector); + drm_mode_connector_attach_encoder(connector, encoder); + + if (dp-panel) + ret = drm_panel_attach(dp-panel, dp-connector); + + return ret; +} + +static void exynos_dp_bridge_nop(struct drm_bridge *bridge) +{ + /* do nothing */ +} + +static void exynos_dp_bridge_enable(struct drm_bridge *bridge) +{ + struct exynos_dp_device *dp = bridge-driver_private; + + exynos_dp_poweron(dp); + dp-dpms_mode = DRM_MODE_DPMS_ON; +} + +static void exynos_dp_bridge_disable(struct drm_bridge *bridge) +{ + struct exynos_dp_device *dp
[PATCH v3 11/14] drm: bridge: analogix_dp: try force hpd after plug in lookup failed
Some edp screen do not have hpd signal, so we can't just return failed when hpd plug in detect failed. This is an hardware property, so we need add a devicetree property analogix,need-force-hpd to indicate this sutiation. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: - Add analogix,need-force-hpd to indicate whether driver need foce hpd when hpd detect failed. Changes in v2: None .../devicetree/bindings/drm/bridge/analogix_dp.txt | 3 ++ .../bindings/video/analogix_dp-rockchip.txt| 1 + .../devicetree/bindings/video/exynos_dp.txt| 1 + drivers/gpu/drm/bridge/analogix_dp_core.c | 36 +++--- drivers/gpu/drm/bridge/analogix_dp_core.h | 2 ++ drivers/gpu/drm/bridge/analogix_dp_reg.c | 9 ++ 6 files changed, 47 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt b/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt index 6127018..b043200 100644 --- a/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt +++ b/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt @@ -40,6 +40,9 @@ Required properties for dp-controller: * Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt Optional properties for dp-controller: + -analogix,need-force-hpd: + Indicate driver need force hpd when hpd detect failed, this + is used for some eDP screen which don't have hpd signal. -analogix,hpd-gpio: Hotplug detect GPIO. Indicates which GPIO should be used for hotplug diff --git a/Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt b/Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt index 99fd421..752005e 100644 --- a/Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt +++ b/Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt @@ -27,6 +27,7 @@ For the below properties, please refer to Analogix DP binding document: - analogix,color-depth (required) - analogix,link-rate (required) - analogix,lane-count (required) +- analogix,need-force-hpd (optional) - analogix,hpd-gpio (optional) - video interfaces (optional) --- diff --git a/Documentation/devicetree/bindings/video/exynos_dp.txt b/Documentation/devicetree/bindings/video/exynos_dp.txt index 177506f..ba20416 100644 --- a/Documentation/devicetree/bindings/video/exynos_dp.txt +++ b/Documentation/devicetree/bindings/video/exynos_dp.txt @@ -53,6 +53,7 @@ For the below properties, please refer to Analogix DP binding document: -analogix,color-depth (required) -analogix,link-rate (required) -analogix,lane-count (required) + -analogix,need-force-hpd (optional) -analogix,hpd-gpio (optional) -video interfaces (optional) --- diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix_dp_core.c index 1778e0a..99870f7 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix_dp_core.c @@ -63,15 +63,38 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device *dp) { int timeout_loop = 0; - while (analogix_dp_get_plug_in_status(dp) != 0) { + while (timeout_loop DP_TIMEOUT_LOOP_COUNT) { + if (analogix_dp_get_plug_in_status(dp) == 0) + return 0; + timeout_loop++; - if (DP_TIMEOUT_LOOP_COUNT timeout_loop) { - dev_err(dp-dev, failed to get hpd plug status\n); - return -ETIMEDOUT; - } usleep_range(10, 11); } + /* +* Some edp screen do not have hpd signal, so we can't just +* return failed when hpd plug in detect failed, DT property +* need-force-hpd would indicate whether driver need this. +*/ + if (!dp-need_force_hpd) + return -ETIMEDOUT; + + /* +* The eDP TRM indicate that if HPD_STATUS(RO) is 0, AUX CH +* will not work, so we need to give a force hpd action to +* set HPD_STATUS manually. +*/ + dev_dbg(dp-dev, failed to get hpd plug status, try to force hpd\n); + + analogix_dp_force_hpd(dp); + + if (analogix_dp_get_plug_in_status(dp) != 0) { + dev_err(dp-dev, failed to get hpd plug in status\n); + return -EINVAL; + } + + dev_dbg(dp-dev, success to get plug in status after force hpd\n); + return 0; } @@ -1272,6 +1295,9 @@ int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, if (IS_ERR(dp-reg_base)) return PTR_ERR(dp-reg_base); + dp-need_force_hpd = + of_property_read_bool(dev-of_node, analogix,need
[PATCH v3 13/14] drm: bridge/analogix_dp: move hpd detect to connector detect function
Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: - move dp hpd detect to connector detect function. Changes in v2: None drivers/gpu/drm/bridge/analogix_dp_core.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix_dp_core.c index 75dd44a..052b9b3 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix_dp_core.c @@ -915,12 +915,6 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) DRM_ERROR(failed to disable the panel\n); } - ret = analogix_dp_detect_hpd(dp); - if (ret) { - /* Cable has been disconnected, we're done */ - return; - } - ret = analogix_dp_handle_edid(dp); if (ret) { dev_err(dp-dev, unable to handle edid\n); @@ -953,6 +947,12 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) static enum drm_connector_status analogix_dp_detect( struct drm_connector *connector, bool force) { + struct analogix_dp_device *dp = connector_to_dp(connector); + + if (analogix_dp_detect_hpd(dp)) + /* Cable has been disconnected, we're done */ + return connector_status_disconnected; + return connector_status_connected; } -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 14/14] drm: bridge/analogix_dp: add edid modes parse in get_modes method
Display Port monitor could support kinds of mode which indicate in monitor edid, not just one single display resolution which defined in panel or devivetree property display timing. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: - Add edid modes parse support Changes in v2: None drivers/gpu/drm/bridge/analogix_dp_core.c | 17 +++- drivers/gpu/drm/bridge/analogix_dp_core.h | 45 --- 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix_dp_core.c index 052b9b3..83698c6 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix_dp_core.c @@ -111,7 +111,7 @@ static unsigned char analogix_dp_calc_edid_check_sum(unsigned char *edid_data) static int analogix_dp_read_edid(struct analogix_dp_device *dp) { - unsigned char edid[EDID_BLOCK_LENGTH * 2]; + unsigned char *edid = dp-edid; unsigned int extend_block = 0; unsigned char sum; unsigned char test_vector; @@ -915,12 +915,6 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) DRM_ERROR(failed to disable the panel\n); } - ret = analogix_dp_handle_edid(dp); - if (ret) { - dev_err(dp-dev, unable to handle edid\n); - return; - } - ret = analogix_dp_set_link_train(dp, dp-video_info-max_lane_count, dp-video_info-max_link_rate); if (ret) { @@ -976,8 +970,17 @@ static int analogix_dp_get_modes(struct drm_connector *connector) { struct analogix_dp_device *dp = connector_to_dp(connector); struct analogix_dp_plat_data *plat_data = dp-plat_data; + struct edid *edid = (struct edid *)dp-edid; int num_modes = 0; + if (analogix_dp_handle_edid(dp)) { + dev_err(dp-dev, unable to handle edid\n); + return -EINVAL; + } + + drm_mode_connector_update_edid_property(connector, edid); + num_modes += drm_add_edid_modes(connector, edid); + if (plat_data plat_data-panel) num_modes += drm_panel_get_modes(plat_data-panel); diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix_dp_core.h index 2405155..950b6ca 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_core.h +++ b/drivers/gpu/drm/bridge/analogix_dp_core.h @@ -20,6 +20,28 @@ #define MAX_CR_LOOP 5 #define MAX_EQ_LOOP 5 +/* I2C EDID Chip ID, Slave Address */ +#define I2C_EDID_DEVICE_ADDR 0x50 +#define I2C_E_EDID_DEVICE_ADDR 0x30 + +#define EDID_BLOCK_LENGTH 0x80 +#define EDID_HEADER_PATTERN0x00 +#define EDID_EXTENSION_FLAG0x7e +#define EDID_CHECKSUM 0x7f + +/* DP_MAX_LANE_COUNT */ +#define DPCD_ENHANCED_FRAME_CAP(x) (((x) 7) 0x1) +#define DPCD_MAX_LANE_COUNT(x) ((x) 0x1f) + +/* DP_LANE_COUNT_SET */ +#define DPCD_LANE_COUNT_SET(x) ((x) 0x1f) + +/* DP_TRAINING_LANE0_SET */ +#define DPCD_PRE_EMPHASIS_SET(x) (((x) 0x3) 3) +#define DPCD_PRE_EMPHASIS_GET(x) (((x) 3) 0x3) +#define DPCD_VOLTAGE_SWING_SET(x) (((x) 0x3) 0) +#define DPCD_VOLTAGE_SWING_GET(x) (((x) 0) 0x3) + enum link_rate_type { LINK_RATE_1_62GBPS = DP_LINK_BW_1_62, LINK_RATE_2_70GBPS = DP_LINK_BW_2_7, @@ -161,6 +183,7 @@ struct analogix_dp_device { int dpms_mode; int hpd_gpio; boolneed_force_hpd; + unsigned char edid[EDID_BLOCK_LENGTH * 2]; struct analogix_dp_plat_data *plat_data; }; @@ -260,26 +283,4 @@ void analogix_dp_config_video_slave_mode(struct analogix_dp_device *dp); void analogix_dp_enable_scrambling(struct analogix_dp_device *dp); void analogix_dp_disable_scrambling(struct analogix_dp_device *dp); -/* I2C EDID Chip ID, Slave Address */ -#define I2C_EDID_DEVICE_ADDR 0x50 -#define I2C_E_EDID_DEVICE_ADDR 0x30 - -#define EDID_BLOCK_LENGTH 0x80 -#define EDID_HEADER_PATTERN0x00 -#define EDID_EXTENSION_FLAG0x7e -#define EDID_CHECKSUM 0x7f - -/* DP_MAX_LANE_COUNT */ -#define DPCD_ENHANCED_FRAME_CAP(x) (((x) 7) 0x1) -#define DPCD_MAX_LANE_COUNT(x) ((x) 0x1f) - -/* DP_LANE_COUNT_SET */ -#define DPCD_LANE_COUNT_SET(x) ((x) 0x1f) - -/* DP_TRAINING_LANE0_SET */ -#define DPCD_PRE_EMPHASIS_SET(x) (((x) 0x3) 3) -#define DPCD_PRE_EMPHASIS_GET(x) (((x) 3) 0x3) -#define DPCD_VOLTAGE_SWING_SET(x) (((x) 0x3) 0) -#define DPCD_VOLTAGE_SWING_GET(x) (((x) 0) 0x3) - #endif /* _ANALOGIX_DP_CORE_H
[PATCH v3 09/14] drm: bridge/analogix_dp: add platform device type support
Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: None Changes in v2: - Add GNU license v2 declared and samsung copyright drivers/gpu/drm/exynos/analogix_dp-exynos.c | 1 + drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 1 + include/drm/bridge/analogix_dp.h| 16 3 files changed, 18 insertions(+) diff --git a/drivers/gpu/drm/exynos/analogix_dp-exynos.c b/drivers/gpu/drm/exynos/analogix_dp-exynos.c index 17da2c8..b160159 100644 --- a/drivers/gpu/drm/exynos/analogix_dp-exynos.c +++ b/drivers/gpu/drm/exynos/analogix_dp-exynos.c @@ -220,6 +220,7 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) dp-dev = dev; dp-drm_dev = drm_dev; + dp-plat_data.dev_type = EXYNOS_DP; dp-plat_data.power_on = exynos_dp_poweron; dp-plat_data.power_off = exynos_dp_poweroff; dp-plat_data.get_modes = exynos_dp_get_modes; diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index cebff9e..f2c5c26 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -267,6 +267,7 @@ static int rockchip_dp_bind(struct device *dev, struct device *master, return ret; } + dp-plat_data.dev_type = RK3288_DP; dp-plat_data.attach = NULL; dp-plat_data.get_modes = NULL; dp-plat_data.power_on = rockchip_dp_poweron; diff --git a/include/drm/bridge/analogix_dp.h b/include/drm/bridge/analogix_dp.h index 8b4ffad..7209a64 100644 --- a/include/drm/bridge/analogix_dp.h +++ b/include/drm/bridge/analogix_dp.h @@ -1,9 +1,25 @@ +/* + * Analogix Core DP (Display Port) interface driver. + * + * Copyright (C) 2012 Samsung Electronics Co., Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ #ifndef _ANALOGIX_DP_H_ #define _ANALOGIX_DP_H_ #include drm/drm_crtc.h +enum analogix_dp_devtype { + EXYNOS_DP, + RK3288_DP, +}; + struct analogix_dp_plat_data { + enum analogix_dp_devtype dev_type; struct drm_panel *panel; int (*power_on)(struct analogix_dp_plat_data *); -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 12/14] drm: bridge/analogix_dp: expand the delay time for hpd detect
Some edp screen with no hpd signal would need some delay time to ensure that screen would be ready for work, so we can expand the delay time in hpd detect function, it works prefectly on my rk3288 sdk board. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: None Changes in v2: None drivers/gpu/drm/bridge/analogix_dp_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix_dp_core.c index 99870f7..75dd44a 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix_dp_core.c @@ -68,7 +68,7 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device *dp) return 0; timeout_loop++; - usleep_range(10, 11); + usleep_range(100, 110); } /* -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 0/14] Add Analogix Core Display Port Driver
Hi Dave, On 08/19/2015 06:54 PM, Dave Airlie wrote: On 20 August 2015 at 00:48, Yakir Yang y...@rock-chips.com wrote: Hi all, The Samsung Exynos eDP controller and Rockchip RK3288 eDP controller share the same IP, so a lot of parts can be re-used. I split the common code into bridge directory, then rk3288 and exynos only need to keep some platform code. Cause I can't find the exact IP name of exynos dp controller, so I decide to name dp core driver with analogix which I find in rk3288 eDP TRM ;) Beyond that, there are three light registers setting differents bewteen exynos and rk3288. 1. RK3288 have five special pll resigters which not indicata in exynos dp controller. 2. The address of DP_PHY_PD(dp phy power manager register) are different between rk3288 and exynos. 3. Rk3288 and exynos have different setting with AUX_HW_RETRY_CTL(dp debug register). I have verified this series on two kinds of rockchip platform board, one is rk3288 sdk board which connect with a 2K display port monitor, the other is google jerry chromebook which connect with a eDP screen cnm,n116bgeea2, both of them works rightlly. I haven't verified the dp function on samsung platform, cause I haven't got exynos boards. I can only ensure that there are no build error on samsung platform, wish some samsung guys help to test. ;) I'd like to pull this in, but it probably needs an ack from Samsung, Inki can you guys find some time to test this? Dave. Wow, thanks a lots :-) Still waiting for some reviews and acks. Best regards, - Yakir -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 05/14] drm: bridge/analogix_dp: fix link_rate lane_count bug
Hi Jingoo, On 08/20/2015 02:22 AM, Jingoo Han wrote: On 2015. 8. 19., at PM 11:50, Yakir Yang y...@rock-chips.com wrote: link_rate and lane_count already configed in analogix_dp_set_link_train(), s/configed/configured Also, the commit name such as fix ... bug is not good. How about following? drm: bridge/analogix_dp: remove duplicate configuration of link rate and link count Thanks, done, it's more readable. - Yakir Best regards, Jingoo Han so we don't need to config those repeatly after training finished, just remove them out. Beside Display Port 1.2 already support 5.4Gbps link rate, the maximum sets would change from {1.62Gbps, 2.7Gbps} to {1.62Gbps, 2.7Gbps, 5.4Gbps}. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: - Take Thierry Reding suggest, link_rate and lane_count shouldn't config to the DT property value directly, but we can take those as hardware limite. For example, RK3288 only support 4 physical lanes of 2.7/1.62 Gbps/lane, so DT property would like link-rate = 0x0a lane-count = 4. Changes in v2: None drivers/gpu/drm/bridge/analogix_dp_core.c | 16 drivers/gpu/drm/bridge/analogix_dp_core.h | 9 + 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix_dp_core.c index 480cc13..1778e0a 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix_dp_core.c @@ -635,6 +635,8 @@ static void analogix_dp_get_max_rx_bandwidth(struct analogix_dp_device *dp, /* * For DP rev.1.1, Maximum link rate of Main Link lanes * 0x06 = 1.62 Gbps, 0x0a = 2.7 Gbps + * For DP rev.1.2, Maximum link rate of Main Link lanes + * 0x06 = 1.62 Gbps, 0x0a = 2.7 Gbps, 0x14 = 5.4Gbps */ analogix_dp_read_byte_from_dpcd(dp, DP_MAX_LINK_RATE, data); *bandwidth = data; @@ -668,7 +670,8 @@ static void analogix_dp_init_training(struct analogix_dp_device *dp, analogix_dp_get_max_rx_lane_count(dp, dp-link_train.lane_count); if ((dp-link_train.link_rate != LINK_RATE_1_62GBPS) -(dp-link_train.link_rate != LINK_RATE_2_70GBPS)) { +(dp-link_train.link_rate != LINK_RATE_2_70GBPS) +(dp-link_train.link_rate != LINK_RATE_5_40GBPS)) { dev_err(dp-dev, Rx Max Link Rate is abnormal :%x !\n, dp-link_train.link_rate); dp-link_train.link_rate = LINK_RATE_1_62GBPS; @@ -901,8 +904,8 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) return; } -ret = analogix_dp_set_link_train(dp, dp-video_info-lane_count, - dp-video_info-link_rate); +ret = analogix_dp_set_link_train(dp, dp-video_info-max_lane_count, + dp-video_info-max_link_rate); if (ret) { dev_err(dp-dev, unable to do link train\n); return; @@ -912,9 +915,6 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) analogix_dp_enable_rx_to_enhanced_mode(dp, 1); analogix_dp_enable_enhanced_mode(dp, 1); -analogix_dp_set_lane_count(dp, dp-video_info-lane_count); -analogix_dp_set_link_bandwidth(dp, dp-video_info-link_rate); - analogix_dp_init_video(dp); ret = analogix_dp_config_video(dp); if (ret) @@ -1198,13 +1198,13 @@ static struct video_info *analogix_dp_dt_parse_pdata(struct device *dev) } if (of_property_read_u32(dp_node, analogix,link-rate, - dp_video_config-link_rate)) { + dp_video_config-max_link_rate)) { dev_err(dev, failed to get link-rate\n); return ERR_PTR(-EINVAL); } if (of_property_read_u32(dp_node, analogix,lane-count, - dp_video_config-lane_count)) { + dp_video_config-max_lane_count)) { dev_err(dev, failed to get lane-count\n); return ERR_PTR(-EINVAL); } diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix_dp_core.h index 2cefde9..941b34f 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_core.h +++ b/drivers/gpu/drm/bridge/analogix_dp_core.h @@ -21,8 +21,9 @@ #define MAX_EQ_LOOP 5 enum link_rate_type { -LINK_RATE_1_62GBPS = 0x06, -LINK_RATE_2_70GBPS = 0x0a +LINK_RATE_1_62GBPS = DP_LINK_BW_1_62, +LINK_RATE_2_70GBPS = DP_LINK_BW_2_7, +LINK_RATE_5_40GBPS = DP_LINK_BW_5_4, }; enum link_lane_count_type { @@ -128,8 +129,8 @@ struct video_info { enum color_coefficient ycbcr_coeff; enum color_depth color_depth; -enum link_rate_type link_rate; -enum link_lane_count_type lane_count; +enum link_rate_type max_link_rate; +enum link_lane_count_type max_lane_count; }; struct link_train { -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp
Hi Jingoo, 在 08/24/2015 03:40 PM, Jingoo Han 写道: On 2015. 8. 24., at AM 9:43, Krzysztof Kozlowski k.kozlow...@samsung.com wrote: 2015-08-24 8:23 GMT+09:00 Rob Herring robherri...@gmail.com: On Wed, Aug 19, 2015 at 9:50 AM, Yakir Yang y...@rock-chips.com wrote: Analogix dp driver is split from exynos dp driver, so we just make an copy of exynos_dp.txt, and then simplify exynos_dp.txt Beside update some exynos dtsi file with the latest change according to the devicetree binding documents. You can't just change the exynos bindings and break compatibility. Is there some agreement with exynos folks to do this? No, there is no agreement. This wasn't even sent to Exynos maintainers. Additionally the patchset did not look interesting to me because of misleading subject - Documentation instead of ARM: dts:. Yakir, please: 1. Provide backward compatibility. Mark old properties as deprecated but still support them. 2. Separate all DTS changes to a separate patch, unless bisectability would be hurt. Anyway you should prepare it in a such way that separation would be possible without breaking bisectability. 3. Use proper subject for the patch changing DTS. This is not documentation change! 4. Please use script get_maintainers to obtain list of valid maintainers and CC-them with at least cover letter and patches requiring their attention. To Yakir Yang, Please be careful when you CC people. I don't find the reason why you CC'ed the following people. Of course, they look to be one of the talented developers. However, they look to be unrelated to your patchset. Takashi Iwai Vincent Palatin Fabio Estevam Philipp Zabel Yeah, actually I just got those people from patman tools. Thanks for your remind, I would pay more attention in next version :-) Also, please add Exynos Architecture maintainers to CC list. I don't understand why you removed them from CC list. Kukjin Kim Krzysztof Kozlowski Without their Ack, you will not change the codes of ARM Exynos Architecture. Wow, thanks a lot, it's a serious mistaken ;) Thanks, - Yakir Best regards, Jingoo Han Best regards, Krzysztof Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: - Take Heiko suggest, add devicetree binding documents. - Take Thierry Reding suggest, remove sync pol colorimetry properies from the new analogix dp driver devicetree binding. - Update the exist exynos dtsi file with the latest DP DT properies. Changes in v2: None .../devicetree/bindings/drm/bridge/analogix_dp.txt | 70 ++ .../devicetree/bindings/video/exynos_dp.txt| 50 ++-- arch/arm/boot/dts/exynos5250-arndale.dts | 10 ++-- arch/arm/boot/dts/exynos5250-smdk5250.dts | 10 ++-- arch/arm/boot/dts/exynos5250-snow.dts | 12 ++-- arch/arm/boot/dts/exynos5250-spring.dts| 12 ++-- arch/arm/boot/dts/exynos5420-peach-pit.dts | 12 ++-- arch/arm/boot/dts/exynos5420-smdk5420.dts | 10 ++-- arch/arm/boot/dts/exynos5800-peach-pi.dts | 12 ++-- 9 files changed, 119 insertions(+), 79 deletions(-) create mode 100644 Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt diff --git a/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt b/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt new file mode 100644 index 000..6127018 --- /dev/null +++ b/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt @@ -0,0 +1,70 @@ +Analogix Display Port bridge bindings + +Required properties for dp-controller: + -compatible: + platform specific such as: +* samsung,exynos5-dp +* rockchip,rk3288-dp + -reg: + physical base address of the controller and length + of memory mapped region. + -interrupts: + interrupt combiner values. + -clocks: + from common clock binding: handle to dp clock. + -clock-names: + from common clock binding: Shall be dp. + -interrupt-parent: + phandle to Interrupt combiner node. + -phys: + from general PHY binding: the phandle for the PHY device. + -phy-names: + from general PHY binding: Should be dp. + -analogix,color-space: + input video data format. + COLOR_RGB = 0, COLOR_YCBCR422 = 1, COLOR_YCBCR444 = 2 + -analogix,color-depth: + number of bits per colour component. + COLOR_6 = 0, COLOR_8 = 1, COLOR_10 = 2, COLOR_12 = 3 This seems pretty generic. Just use 6, 8, 10, or 12 for values. And drop the vendor prefix. + -analogix,link-rate: + max link rate supported by the eDP controller. + LINK_RATE_1_62GBPS = 0x6, LINK_RATE_2_70GBPS = 0x0A, + LINK_RATE_5_40GBPS = 0x14 Same here. I'd rather see something like link-rate-mbps and use the actual rate
Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp
Hi Krzysztof, 在 08/24/2015 12:20 PM, Krzysztof Kozlowski 写道: On 24.08.2015 11:42, Yakir Yang wrote: Hi Krzysztof, 在 08/23/2015 07:43 PM, Krzysztof Kozlowski 写道: 2015-08-24 8:23 GMT+09:00 Rob Herring robherri...@gmail.com: On Wed, Aug 19, 2015 at 9:50 AM, Yakir Yang y...@rock-chips.com wrote: Analogix dp driver is split from exynos dp driver, so we just make an copy of exynos_dp.txt, and then simplify exynos_dp.txt Beside update some exynos dtsi file with the latest change according to the devicetree binding documents. You can't just change the exynos bindings and break compatibility. Is there some agreement with exynos folks to do this? No, there is no agreement. This wasn't even sent to Exynos maintainers. Sorry about this one, actually I have add Exynos maintainers in version 1 version 2, but lose some maintainers in version 3, I would fix it in bellow versions. Additionally the patchset did not look interesting to me because of misleading subject - Documentation instead of ARM: dts:. Yakir, please: 1. Provide backward compatibility. Mark old properties as deprecated but still support them. Do you mean that I should keep the old properties declare in exynos-dp.txt, but just mark them as deprecated flag. That is one of ways how to do this. However more important is that driver should still support old bindings so such code: - if (of_property_read_u32(dp_node, samsung,color-space, + if (of_property_read_u32(dp_node, analogix,color-space, is probably wrong. Will the driver support old DTB in the same way as it was supporting before the change? Okay, I got your means. So document is not the focus, the most important is that driver should support the old dts prop. If so the new analogix dp driver should keep the samsung,color-space, rather then just mark it with [DEPRECATED] flag. But from your follow suggest, I think you agree to update driver code, and just mark old prop with deprecated flag. If so I think such code would not be wrong - if (of_property_read_u32(dp_node, samsung,color-space, + if (of_property_read_u32(dp_node, analogix,color-space, And actually @Rob have suggest me to remove the prefix, just use color-space here. Let me show same examples, make me understand your suggest rightly. exynos-dp already contains deprecated properties. Other ways of doing this would be: Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt Documentation/devicetree/bindings/rtc/s3c-rtc.txt It depends up to you. The touchscreen looks good because it organizes old properties in a common section. In case of exynos-dp.txt you can add at beginning of file information about new bindings and mark everything deprecated. Whoops, thanks for your remind, I prefer the touchscreen style. 1. samsung,ycbcr-coeff is abandoned in latest analogix-dp driver, absolutely I should not carry this to analogix-dp.txt document. But I should keep this in exynos-dp.txt document, and mark them with an little deprecated flag. [Documentation/devicetree/bindings/video/exynos_dp.txt] Required properties for dp-controller: [...] -samsung,ycbcr-coeff (DEPRECATED): YCbCr co-efficients for input video. COLOR_YCBCR601 = 0, COLOR_YCBCR709 = 1 Is it right ? Yes, this is right. 2. Separate all DTS changes to a separate patch, unless bisectability would be hurt. Anyway you should prepare it in a such way that separation would be possible without breaking bisectability. So I should separate this patch into two parts, one is name Document:, the other is ARM: dts: . Yes. Honestly, I don't understand what the bisectability means in this case. I was referring to bisectability in general. The patchset should be fully bisectable which means that it does not introduce any issues during git bisect. This effectively means that at each intermediate step (after applying each patch, one by one) every existing stuff works the same as previously without any regression. Including booting with old DTB. Oh, thanks for your careful explain, so I guess your first comment is talking about the bisectability that if I only apply the 01 - 05 patches, kernel could not bootup normally, cause driver need analogix,color-space but DTB only have samsung,color-space. 3. Use proper subject for the patch changing DTS. This is not documentation change! Hmm... when I separate this patch into two parts, I though I can keep Documentation proper subject in this patch, and the other is the ARM: dts proper subject. Am I right ? Yes, you're right. 4. Please use script get_maintainers to obtain list of valid maintainers and CC-them with at least cover letter and patches requiring their attention. Yeah, thanks. Sure. Now I found older versions of the patchset but previously there were no changes to the bindings. Again the prefix in subject is important to easily filter out and find necessary emails. BTW, I like the patchset because I like in general works
Re: [PATCH v3 0/14] Add Analogix Core Display Port Driver
Hi Jingoo, On 08/20/2015 01:55 AM, Jingoo Han wrote: On 2015. 8. 20., at PM 3:23, Yakir Yang y...@rock-chips.com wrote: Hi Jingoo Archit, On 08/20/2015 12:54 AM, Jingoo Han wrote: On 2015. 8. 20., at PM 1:29, Archit Taneja arch...@codeaurora.org wrote: Hi, On 08/19/2015 08:18 PM, Yakir Yang wrote: Hi all, The Samsung Exynos eDP controller and Rockchip RK3288 eDP controller share the same IP, so a lot of parts can be re-used. I split the common code into bridge directory, then rk3288 and exynos only need to keep some platform code. Cause I can't find the exact IP name of exynos dp controller, so I decide to name dp core driver with analogix which I find in rk3288 eDP TRM ;) Beyond that, there are three light registers setting differents bewteen exynos and rk3288. 1. RK3288 have five special pll resigters which not indicata in exynos dp controller. 2. The address of DP_PHY_PD(dp phy power manager register) are different between rk3288 and exynos. 3. Rk3288 and exynos have different setting with AUX_HW_RETRY_CTL(dp debug register). I have verified this series on two kinds of rockchip platform board, one is rk3288 sdk board which connect with a 2K display port monitor, the other is google jerry chromebook which connect with a eDP screen cnm,n116bgeea2, both of them works rightlly. I haven't verified the dp function on samsung platform, cause I haven't got exynos boards. I can only ensure that there are no build error on samsung platform, wish some samsung guys help to test. ;) Thanks, - Yakir Changes in v3: - Take Thierry Reding suggest, move exynos's video_timing code to analogix_dp-exynos platform driver, add get_modes method to struct analogix_dp_plat_data. - Take Heiko suggest, rename some samsung* dts propery to analogix*. - Take Thierry Reding suggest, dynamic parse video timing info from struct drm_display_mode and struct drm_display_info. - Take Thierry Reding suggest, link_rate and lane_count shouldn't config to the DT property value directly, but we can take those as hardware limite. For example, RK3288 only support 4 physical lanes of 2.7/1.62 Gbps/lane, so DT property would like link-rate = 0x0a lane-count = 4. - Take Heiko suggest, add devicetree binding documents. - Take Thierry Reding suggest, remove sync pol colorimetry properies from the new analogix dp driver devicetree binding. - Update the exist exynos dtsi file with the latest DP DT properies. - Take Thierry Reding and Heiko suggest, leave sclk_edp_24m to rockchip dp phy driver which name to 24m, and leave sclk_edp to analogix dp core driver which name to dp, and leave pclk_edp to rockchip dp platform driver which name to pclk. - Take Heiko suggest, add devicetree binding document. - Take Heiko suggest, remove rockchip,panel DT property, take use of remote point to get panel node. - Add the new function point analogix_dp_platdata.get_modes init. - Take Heiko suggest, add rockchip dp phy driver, collect the phy clocks and power control. - Add analogix,need-force-hpd to indicate whether driver need foce hpd when hpd detect failed. - move dp hpd detect to connector detect function. - Add edid modes parse support Changes in v2: - Take Joe Preches advise, improved commit message more readable, and avoid using some uncommon style like bellow: - retval = exynos_dp_read_bytes_from_i2c(... ...) + retval = + exynos_dp_read_bytes_from_i2c(..); - Take Jingoo Han suggest, just remove my name from author list. - Take Jingoo Han suggest, remove new copyright - Fix compiled failed dut to analogix_dp_device misspell - Take Heiko suggest, get panel node with remote-endpoint method, and create devicetree binding for driver. - Remove the clock enable/disbale with sclk_edp sclk_edp_24m, leave those clock to rockchip dp phy driver. - Add GNU license v2 declared and samsung copyright - Fix compile failed dut to phy_pd_addr variable misspell error Yakir Yang (14): drm: exynos/dp: fix code style drm: exynos/dp: convert to drm bridge mode drm: bridge: analogix_dp: split exynos dp driver to bridge dir drm: bridge/analogix_dp: dynamic parse sync_pol interlace colorimetry drm: bridge/analogix_dp: fix link_rate lane_count bug Documentation: drm/bridge: add document for analogix_dp drm: rockchip/dp: add rockchip platform dp driver phy: Add driver for rockchip Display Port PHY drm: bridge/analogix_dp: add platform device type support drm: bridge: analogix_dp: add some rk3288 special registers setting drm: bridge: analogix_dp: try force hpd after plug in lookup failed drm: bridge/analogix_dp: expand the delay time for hpd detect drm: bridge/analogix_dp: move hpd detect to connector detect function drm: bridge/analogix_dp: add edid modes parse in get_modes method .../devicetree/bindings/drm/bridge/analogix_dp.txt | 73 + .../devicetree/bindings/phy/rockchip-dp-phy.txt| 26 + .../bindings/video
Re: [PATCH v3 13/14] drm: bridge/analogix_dp: move hpd detect to connector detect function
Hi Jingoo, On 08/20/2015 02:49 AM, Jingoo Han wrote: On 2015. 8. 19., at PM 11:52, Yakir Yang y...@rock-chips.com wrote: What is the reason to make this patch? Please make commit message including the reason. Okay, I think the below words would be okay :) This change just make a little clean to make code more like drm core expect, move hdp detect code from bridge-enable(), and place them into connector-detect(). Thanks, - Yakir Best regards, Jingoo Han Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: - move dp hpd detect to connector detect function. Changes in v2: None drivers/gpu/drm/bridge/analogix_dp_core.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix_dp_core.c index 75dd44a..052b9b3 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix_dp_core.c @@ -915,12 +915,6 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) DRM_ERROR(failed to disable the panel\n); } -ret = analogix_dp_detect_hpd(dp); -if (ret) { -/* Cable has been disconnected, we're done */ -return; -} - ret = analogix_dp_handle_edid(dp); if (ret) { dev_err(dp-dev, unable to handle edid\n); @@ -953,6 +947,12 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) static enum drm_connector_status analogix_dp_detect( struct drm_connector *connector, bool force) { +struct analogix_dp_device *dp = connector_to_dp(connector); + +if (analogix_dp_detect_hpd(dp)) +/* Cable has been disconnected, we're done */ +return connector_status_disconnected; + return connector_status_connected; } -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 12/14] drm: bridge/analogix_dp: expand the delay time for hpd detect
Hi Jingoo, On 08/20/2015 01:11 AM, Jingoo Han wrote: On 2015. 8. 19., at PM 11:52, Yakir Yang y...@rock-chips.com wrote: Some edp screen with no hpd signal would need some delay time to ensure that screen would be ready for work, so we can expand the delay time in hpd detect function, it works prefectly on my rk3288 sdk board. Then, this delay has a dependency on the rk3288 sdk board. Also, if the delay time is expanded, the booting time of some Exybos boards will be increased unnecessarily. :-( So, please add new DT property such as 'hpd-delay' that can be added to board DT files. If there is not that DT property in DT files, the default value '10' will written to a variable such as 'unsigned int hpd_delay'. If there is the DT property in DT files, the delay value will written to the variable when parsing DT values and will be used in analogix_dp_detect_hpd(). What I want to say is that there should not be harmful effect on the existing Exynos boards, due to unrelated reasons. Yeah, you are right, I made an mistake here. And I want to put this delay to need-force-hpd code, cause this property is for the no-hpd-signal eDP screen. But strangely, with my this series, I don't need the expand delay any more, I am not sure which change improved this, I guess those delay time should come from drm core ? Whatever seems we don't need this delay for now, and if I can find the exact reason and realize I still need this delay, I prefer to add those delay in need-force-hpd code. Thanks, - Yakir Best regards, Jingoo Han Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: None Changes in v2: None drivers/gpu/drm/bridge/analogix_dp_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix_dp_core.c index 99870f7..75dd44a 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix_dp_core.c @@ -68,7 +68,7 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device *dp) return 0; timeout_loop++; -usleep_range(10, 11); +usleep_range(100, 110); } /* -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 0/14] Add Analogix Core Display Port Driver
Hi Jingoo Archit, On 08/20/2015 12:54 AM, Jingoo Han wrote: On 2015. 8. 20., at PM 1:29, Archit Taneja arch...@codeaurora.org wrote: Hi, On 08/19/2015 08:18 PM, Yakir Yang wrote: Hi all, The Samsung Exynos eDP controller and Rockchip RK3288 eDP controller share the same IP, so a lot of parts can be re-used. I split the common code into bridge directory, then rk3288 and exynos only need to keep some platform code. Cause I can't find the exact IP name of exynos dp controller, so I decide to name dp core driver with analogix which I find in rk3288 eDP TRM ;) Beyond that, there are three light registers setting differents bewteen exynos and rk3288. 1. RK3288 have five special pll resigters which not indicata in exynos dp controller. 2. The address of DP_PHY_PD(dp phy power manager register) are different between rk3288 and exynos. 3. Rk3288 and exynos have different setting with AUX_HW_RETRY_CTL(dp debug register). I have verified this series on two kinds of rockchip platform board, one is rk3288 sdk board which connect with a 2K display port monitor, the other is google jerry chromebook which connect with a eDP screen cnm,n116bgeea2, both of them works rightlly. I haven't verified the dp function on samsung platform, cause I haven't got exynos boards. I can only ensure that there are no build error on samsung platform, wish some samsung guys help to test. ;) Thanks, - Yakir Changes in v3: - Take Thierry Reding suggest, move exynos's video_timing code to analogix_dp-exynos platform driver, add get_modes method to struct analogix_dp_plat_data. - Take Heiko suggest, rename some samsung* dts propery to analogix*. - Take Thierry Reding suggest, dynamic parse video timing info from struct drm_display_mode and struct drm_display_info. - Take Thierry Reding suggest, link_rate and lane_count shouldn't config to the DT property value directly, but we can take those as hardware limite. For example, RK3288 only support 4 physical lanes of 2.7/1.62 Gbps/lane, so DT property would like link-rate = 0x0a lane-count = 4. - Take Heiko suggest, add devicetree binding documents. - Take Thierry Reding suggest, remove sync pol colorimetry properies from the new analogix dp driver devicetree binding. - Update the exist exynos dtsi file with the latest DP DT properies. - Take Thierry Reding and Heiko suggest, leave sclk_edp_24m to rockchip dp phy driver which name to 24m, and leave sclk_edp to analogix dp core driver which name to dp, and leave pclk_edp to rockchip dp platform driver which name to pclk. - Take Heiko suggest, add devicetree binding document. - Take Heiko suggest, remove rockchip,panel DT property, take use of remote point to get panel node. - Add the new function point analogix_dp_platdata.get_modes init. - Take Heiko suggest, add rockchip dp phy driver, collect the phy clocks and power control. - Add analogix,need-force-hpd to indicate whether driver need foce hpd when hpd detect failed. - move dp hpd detect to connector detect function. - Add edid modes parse support Changes in v2: - Take Joe Preches advise, improved commit message more readable, and avoid using some uncommon style like bellow: - retval = exynos_dp_read_bytes_from_i2c(... ...) + retval = + exynos_dp_read_bytes_from_i2c(..); - Take Jingoo Han suggest, just remove my name from author list. - Take Jingoo Han suggest, remove new copyright - Fix compiled failed dut to analogix_dp_device misspell - Take Heiko suggest, get panel node with remote-endpoint method, and create devicetree binding for driver. - Remove the clock enable/disbale with sclk_edp sclk_edp_24m, leave those clock to rockchip dp phy driver. - Add GNU license v2 declared and samsung copyright - Fix compile failed dut to phy_pd_addr variable misspell error Yakir Yang (14): drm: exynos/dp: fix code style drm: exynos/dp: convert to drm bridge mode drm: bridge: analogix_dp: split exynos dp driver to bridge dir drm: bridge/analogix_dp: dynamic parse sync_pol interlace colorimetry drm: bridge/analogix_dp: fix link_rate lane_count bug Documentation: drm/bridge: add document for analogix_dp drm: rockchip/dp: add rockchip platform dp driver phy: Add driver for rockchip Display Port PHY drm: bridge/analogix_dp: add platform device type support drm: bridge: analogix_dp: add some rk3288 special registers setting drm: bridge: analogix_dp: try force hpd after plug in lookup failed drm: bridge/analogix_dp: expand the delay time for hpd detect drm: bridge/analogix_dp: move hpd detect to connector detect function drm: bridge/analogix_dp: add edid modes parse in get_modes method .../devicetree/bindings/drm/bridge/analogix_dp.txt | 73 + .../devicetree/bindings/phy/rockchip-dp-phy.txt| 26 + .../bindings/video/analogix_dp-rockchip.txt| 83 ++ .../devicetree/bindings/video/exynos_dp.txt| 51 +- arch/arm/boot/dts
Re: HOW TO MAKE SAMPLES DIR IN THE MAINLINE KERNEL TO BE COMPILED AND CREATED .KO FILE IN THE SAME DIRECTORY
Hi Ravi, I'm wondering is your e-mail come from eDP thread ? cause I see lots of cc guys some as eDP emails :) And for your question, I am not sure I understand rightly. Do you mean that your .ko module not in the same directory with driver source code? If it's your question, I think you can fix it by add SUBDIRS flag in your driver makefile. I test it on kernel 3.14, but I think it would be okay on mainline kernel, it works good in my side, I see hello.ko in my hello/ [~/work/kernel-3.14/hello] 7392h41m $ ls hello.c hello.ko hello.mod.c hello.mod.o hello.o Makefile modules.order Module.symvers # My test makefile obj-m := hello.o KERNEL_DIR := ~/work/kernel-3.14 PWD := $(shell pwd) all: make -C $(KERNEL_DIR) SUBDIRS=$(PWD) modules clean: rm *.o *.ko *.mod.c .PHONY:clean Wish can help, - Yakir On 08/20/2015 03:45 AM, ravi ranjan Mishra wrote: Hi , i did make in the kernel directory but sample directory is not able to compiled and generating .ko file in the same directory. can you please tell. Thanks, Ravi -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp
Hi Krzysztof, 在 08/23/2015 07:43 PM, Krzysztof Kozlowski 写道: 2015-08-24 8:23 GMT+09:00 Rob Herring robherri...@gmail.com: On Wed, Aug 19, 2015 at 9:50 AM, Yakir Yang y...@rock-chips.com wrote: Analogix dp driver is split from exynos dp driver, so we just make an copy of exynos_dp.txt, and then simplify exynos_dp.txt Beside update some exynos dtsi file with the latest change according to the devicetree binding documents. You can't just change the exynos bindings and break compatibility. Is there some agreement with exynos folks to do this? No, there is no agreement. This wasn't even sent to Exynos maintainers. Sorry about this one, actually I have add Exynos maintainers in version 1 version 2, but lose some maintainers in version 3, I would fix it in bellow versions. Additionally the patchset did not look interesting to me because of misleading subject - Documentation instead of ARM: dts:. Yakir, please: 1. Provide backward compatibility. Mark old properties as deprecated but still support them. Do you mean that I should keep the old properties declare in exynos-dp.txt, but just mark them as deprecated flag. Let me show same examples, make me understand your suggest rightly. 1. samsung,ycbcr-coeff is abandoned in latest analogix-dp driver, absolutely I should not carry this to analogix-dp.txt document. But I should keep this in exynos-dp.txt document, and mark them with an little deprecated flag. [Documentation/devicetree/bindings/video/exynos_dp.txt] Required properties for dp-controller: [...] -samsung,ycbcr-coeff (DEPRECATED): YCbCr co-efficients for input video. COLOR_YCBCR601 = 0, COLOR_YCBCR709 = 1 Is it right ? 2. Separate all DTS changes to a separate patch, unless bisectability would be hurt. Anyway you should prepare it in a such way that separation would be possible without breaking bisectability. So I should separate this patch into two parts, one is name Document:, the other is ARM: dts: . Honestly, I don't understand what the bisectability means in this case. 3. Use proper subject for the patch changing DTS. This is not documentation change! Hmm... when I separate this patch into two parts, I though I can keep Documentation proper subject in this patch, and the other is the ARM: dts proper subject. Am I right ? 4. Please use script get_maintainers to obtain list of valid maintainers and CC-them with at least cover letter and patches requiring their attention. Yeah, thanks. Thanks a lot, - Yakir Best regards, Krzysztof Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: - Take Heiko suggest, add devicetree binding documents. - Take Thierry Reding suggest, remove sync pol colorimetry properies from the new analogix dp driver devicetree binding. - Update the exist exynos dtsi file with the latest DP DT properies. Changes in v2: None .../devicetree/bindings/drm/bridge/analogix_dp.txt | 70 ++ .../devicetree/bindings/video/exynos_dp.txt| 50 ++-- arch/arm/boot/dts/exynos5250-arndale.dts | 10 ++-- arch/arm/boot/dts/exynos5250-smdk5250.dts | 10 ++-- arch/arm/boot/dts/exynos5250-snow.dts | 12 ++-- arch/arm/boot/dts/exynos5250-spring.dts| 12 ++-- arch/arm/boot/dts/exynos5420-peach-pit.dts | 12 ++-- arch/arm/boot/dts/exynos5420-smdk5420.dts | 10 ++-- arch/arm/boot/dts/exynos5800-peach-pi.dts | 12 ++-- 9 files changed, 119 insertions(+), 79 deletions(-) create mode 100644 Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt diff --git a/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt b/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt new file mode 100644 index 000..6127018 --- /dev/null +++ b/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt @@ -0,0 +1,70 @@ +Analogix Display Port bridge bindings + +Required properties for dp-controller: + -compatible: + platform specific such as: +* samsung,exynos5-dp +* rockchip,rk3288-dp + -reg: + physical base address of the controller and length + of memory mapped region. + -interrupts: + interrupt combiner values. + -clocks: + from common clock binding: handle to dp clock. + -clock-names: + from common clock binding: Shall be dp. + -interrupt-parent: + phandle to Interrupt combiner node. + -phys: + from general PHY binding: the phandle for the PHY device. + -phy-names: + from general PHY binding: Should be dp. + -analogix,color-space: + input video data format. + COLOR_RGB = 0, COLOR_YCBCR422 = 1, COLOR_YCBCR444 = 2 + -analogix,color-depth: + number of bits per colour component. + COLOR_6 = 0, COLOR_8
Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp
Hi Rob, 在 08/23/2015 06:23 PM, Rob Herring 写道: On Wed, Aug 19, 2015 at 9:50 AM, Yakir Yang y...@rock-chips.com wrote: Analogix dp driver is split from exynos dp driver, so we just make an copy of exynos_dp.txt, and then simplify exynos_dp.txt Beside update some exynos dtsi file with the latest change according to the devicetree binding documents. You can't just change the exynos bindings and break compatibility. Is there some agreement with exynos folks to do this? Yeah, this change only start to introduce in version 3 series, so there is no agreement or discuss before. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v3: - Take Heiko suggest, add devicetree binding documents. - Take Thierry Reding suggest, remove sync pol colorimetry properies from the new analogix dp driver devicetree binding. - Update the exist exynos dtsi file with the latest DP DT properies. Changes in v2: None .../devicetree/bindings/drm/bridge/analogix_dp.txt | 70 ++ .../devicetree/bindings/video/exynos_dp.txt| 50 ++-- arch/arm/boot/dts/exynos5250-arndale.dts | 10 ++-- arch/arm/boot/dts/exynos5250-smdk5250.dts | 10 ++-- arch/arm/boot/dts/exynos5250-snow.dts | 12 ++-- arch/arm/boot/dts/exynos5250-spring.dts| 12 ++-- arch/arm/boot/dts/exynos5420-peach-pit.dts | 12 ++-- arch/arm/boot/dts/exynos5420-smdk5420.dts | 10 ++-- arch/arm/boot/dts/exynos5800-peach-pi.dts | 12 ++-- 9 files changed, 119 insertions(+), 79 deletions(-) create mode 100644 Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt diff --git a/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt b/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt new file mode 100644 index 000..6127018 --- /dev/null +++ b/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt @@ -0,0 +1,70 @@ +Analogix Display Port bridge bindings + +Required properties for dp-controller: + -compatible: + platform specific such as: +* samsung,exynos5-dp +* rockchip,rk3288-dp + -reg: + physical base address of the controller and length + of memory mapped region. + -interrupts: + interrupt combiner values. + -clocks: + from common clock binding: handle to dp clock. + -clock-names: + from common clock binding: Shall be dp. + -interrupt-parent: + phandle to Interrupt combiner node. + -phys: + from general PHY binding: the phandle for the PHY device. + -phy-names: + from general PHY binding: Should be dp. + -analogix,color-space: + input video data format. + COLOR_RGB = 0, COLOR_YCBCR422 = 1, COLOR_YCBCR444 = 2 + -analogix,color-depth: + number of bits per colour component. + COLOR_6 = 0, COLOR_8 = 1, COLOR_10 = 2, COLOR_12 = 3 This seems pretty generic. Just use 6, 8, 10, or 12 for values. And drop the vendor prefix. Okay, thanks + -analogix,link-rate: + max link rate supported by the eDP controller. + LINK_RATE_1_62GBPS = 0x6, LINK_RATE_2_70GBPS = 0x0A, + LINK_RATE_5_40GBPS = 0x14 Same here. I'd rather see something like link-rate-mbps and use the actual rate. Like link-rate-mbps = 162000, so I need of_property_read_u32() for this prop. Okay, done. + -analogix,lane-count: + max number of lanes supported by the eDP contoller. + LANE_COUNT1 = 1, LANE_COUNT2 = 2, LANE_COUNT4 = 4 And drop the vendor prefix here. Done + -port@[X]: SoC specific port nodes with endpoint definitions as defined + in Documentation/devicetree/bindings/media/video-interfaces.txt, + please refer to the SoC specific binding document: + * Documentation/devicetree/bindings/video/exynos_dp.txt + * Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt + +Optional properties for dp-controller: + -analogix,hpd-gpio: + Hotplug detect GPIO. + Indicates which GPIO should be used for hotplug + detection We should align with hpd-gpios used by HDMI connector binding. Or do we need a DP connector binding that this should be defined in? Probably so. The DRM related bindings are such a cluster f*ck with everyone picking their own way to do things. Just grep hpd in bindings for starters. That is just the tip. Hmm... I don't understand how the HDMI connector binding works, there are no driver that name with hdmi-connector compatible, does it just an sample case for all HDMI dts node? But I'm okay with your suggest here, change analogix,hpd-gpio to hpd-gpios ;) + -video interfaces: Device node
Re: [RFC PATCH 2/8] drm: exynos/dp: convert to drm bridge mode
Daniel, 在 2015/8/7 19:25, Daniel Vetter 写道: On Thu, Aug 06, 2015 at 10:29:29PM +0800, Yakir Yang wrote: Hi Jingoo, 在 2015/8/6 22:19, Jingoo Han 写道: On Thursday, August 06, 2015 11:07 PM, Yakir Yang wrote: In order to move exynos dp code to bridge directory, we need to convert driver drm bridge mode first. As dp driver already have a ptn3460 bridge, so we need to move ptn bridge to the next bridge of dp bridge. Signed-off-by: Yakir Yang y...@rock-chips.com --- drivers/gpu/drm/exynos/exynos_dp_core.c | 196 drivers/gpu/drm/exynos/exynos_dp_core.h | 2 + 2 files changed, 126 insertions(+), 72 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index a8097a4..aa99e23 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -3,6 +3,7 @@ * * Copyright (C) 2012 Samsung Electronics Co., Ltd. * Author: Jingoo Han jg1@samsung.com + * Yakir Yang y...@rock-chips.com Please don't add this. You just fixed some parts of this code. I don't find the reason why you have to be added to author for this file. If you want the title for an author, please send the patch for a new IP, instead of modifying the exiting codes. Okay, thanks for your remind ;) tbh the author lines are completely irrelevant, git blame/log is the authoritative source for that. Copyright is a bit a different matter entirely, but in general we seem to be not too good at updating. Thanks for your good explain ;) - Yakir Really if that's all you have to comment and no substantial technical concerns or questions then just can such a bikeshed mail. -Daniel -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 0/8] Add Analogix Core Display Port Driver
Hi all, The Samsung Exynos eDP controller and Rockchip RK3288 eDP controller share the same IP, so a lot of parts can be re-used. I split the common code into bridge directory, then rk3288 and exynos only need to keep some platform code. Cause I can't find the exact IP name of exynos dp controller, so I decide to name dp core driver with analogix which I find in rk3288 eDP TRM ;) Beyond that, there are three light registers setting differents bewteen exynos and rk3288. 1. RK3288 have five special pll resigters which not indicata in exynos dp controller. 2. The address of DP_PHY_PD(dp phy power manager register) are different between rk3288 and exynos. 3. Rk3288 and exynos have different setting with AUX_HW_RETRY_CTL(dp debug register). My series patches can be divider into two parts: One for spliting the analogix_dp code from exynos dp driver. Another are trying to add rk3288 platform special code. Thanks, - Yakir Changes in v2: - Take Joe Preches advise, improved commit message more readable, and avoid using some uncommon style like bellow: - retval = exynos_dp_read_bytes_from_i2c(... ...) + retval = + exynos_dp_read_bytes_from_i2c(..); - Take Jingoo Han suggest, cause I jsut improve parts of the code, so just remove my name from author list. - Take Jingoo Han suggest, remove new copyright - Fix compiled failed dut to analogix_dp_device misspell - Add GNU license v2 declared and samsung copyright - Fix compile failed dut to phy_pd_addr variable misspell error Yakir Yang (8): drm: exynos/dp: fix code style drm: exynos/dp: convert to drm bridge mode drm: bridge: analogix_dp: split exynos dp driver to bridge dir drm: rockchip/dp: add rockchip platform dp driver drm: bridge/analogix_dp: add platform device type support drm: bridge: analogix_dp: add some rk3288 special registers setting drm: bridge: analogix_dp: try force hpd after plug in lookup failed drm: bridge/analogix_dp: expand the delay time for hpd detect drivers/gpu/drm/bridge/Kconfig |5 + drivers/gpu/drm/bridge/Makefile|1 + drivers/gpu/drm/bridge/analogix_dp_core.c | 1397 +++ drivers/gpu/drm/bridge/analogix_dp_core.h | 286 drivers/gpu/drm/bridge/analogix_dp_reg.c | 1294 ++ .../exynos_dp_reg.h = bridge/analogix_dp_reg.h} | 270 ++-- drivers/gpu/drm/exynos/Kconfig |5 +- drivers/gpu/drm/exynos/Makefile|2 +- drivers/gpu/drm/exynos/analogix_dp-exynos.c| 238 drivers/gpu/drm/exynos/exynos_dp_core.c| 1416 drivers/gpu/drm/exynos/exynos_dp_core.h| 282 drivers/gpu/drm/exynos/exynos_dp_reg.c | 1263 - drivers/gpu/drm/rockchip/Kconfig | 10 + drivers/gpu/drm/rockchip/Makefile |1 + drivers/gpu/drm/rockchip/analogix_dp-rockchip.c| 420 ++ include/drm/bridge/analogix_dp.h | 38 + 16 files changed, 3835 insertions(+), 3093 deletions(-) create mode 100644 drivers/gpu/drm/bridge/analogix_dp_core.c create mode 100644 drivers/gpu/drm/bridge/analogix_dp_core.h create mode 100644 drivers/gpu/drm/bridge/analogix_dp_reg.c rename drivers/gpu/drm/{exynos/exynos_dp_reg.h = bridge/analogix_dp_reg.h} (62%) create mode 100644 drivers/gpu/drm/exynos/analogix_dp-exynos.c delete mode 100644 drivers/gpu/drm/exynos/exynos_dp_core.c delete mode 100644 drivers/gpu/drm/exynos/exynos_dp_core.h delete mode 100644 drivers/gpu/drm/exynos/exynos_dp_reg.c create mode 100644 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c create mode 100644 include/drm/bridge/analogix_dp.h -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 1/8] drm: exynos/dp: fix code style
After run checkpatch.pl -f --subjective command, I see there are lots of alignment problem in exynos_dp driver, so let just fix them. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v2: - Take Joe Preches advise, improved commit message more readable, and avoid using some uncommon style like bellow: - retval = exynos_dp_read_bytes_from_i2c(... ...) + retval = + exynos_dp_read_bytes_from_i2c(..); drivers/gpu/drm/exynos/exynos_dp_core.c | 219 drivers/gpu/drm/exynos/exynos_dp_core.h | 53 drivers/gpu/drm/exynos/exynos_dp_reg.c | 100 +++ 3 files changed, 182 insertions(+), 190 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 172b800..562f4a8 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -114,8 +114,8 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) /* Read Extension Flag, Number of 128-byte EDID extension blocks */ retval = exynos_dp_read_byte_from_i2c(dp, I2C_EDID_DEVICE_ADDR, - EDID_EXTENSION_FLAG, - extend_block); + EDID_EXTENSION_FLAG, + extend_block); if (retval) return retval; @@ -123,10 +123,11 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) dev_dbg(dp-dev, EDID data includes a single extension!\n); /* Read EDID data */ - retval = exynos_dp_read_bytes_from_i2c(dp, I2C_EDID_DEVICE_ADDR, - EDID_HEADER_PATTERN, - EDID_BLOCK_LENGTH, - edid[EDID_HEADER_PATTERN]); + retval = exynos_dp_read_bytes_from_i2c( + dp, I2C_EDID_DEVICE_ADDR, + EDID_HEADER_PATTERN, + EDID_BLOCK_LENGTH, + edid[EDID_HEADER_PATTERN]); if (retval != 0) { dev_err(dp-dev, EDID Read failed!\n); return -EIO; @@ -138,11 +139,11 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) } /* Read additional EDID data */ - retval = exynos_dp_read_bytes_from_i2c(dp, - I2C_EDID_DEVICE_ADDR, - EDID_BLOCK_LENGTH, - EDID_BLOCK_LENGTH, - edid[EDID_BLOCK_LENGTH]); + retval = exynos_dp_read_bytes_from_i2c( + dp, I2C_EDID_DEVICE_ADDR, + EDID_BLOCK_LENGTH, + EDID_BLOCK_LENGTH, + edid[EDID_BLOCK_LENGTH]); if (retval != 0) { dev_err(dp-dev, EDID Read failed!\n); return -EIO; @@ -154,24 +155,22 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) } exynos_dp_read_byte_from_dpcd(dp, DP_TEST_REQUEST, - test_vector); + test_vector); if (test_vector DP_TEST_LINK_EDID_READ) { - exynos_dp_write_byte_to_dpcd(dp, - DP_TEST_EDID_CHECKSUM, + exynos_dp_write_byte_to_dpcd( + dp, DP_TEST_EDID_CHECKSUM, edid[EDID_BLOCK_LENGTH + EDID_CHECKSUM]); - exynos_dp_write_byte_to_dpcd(dp, - DP_TEST_RESPONSE, + exynos_dp_write_byte_to_dpcd( + dp, DP_TEST_RESPONSE, DP_TEST_EDID_CHECKSUM_WRITE); } } else { dev_info(dp-dev, EDID data does not include any extensions.\n); /* Read EDID data */ - retval = exynos_dp_read_bytes_from_i2c(dp, - I2C_EDID_DEVICE_ADDR, - EDID_HEADER_PATTERN, - EDID_BLOCK_LENGTH, - edid[EDID_HEADER_PATTERN]); + retval = exynos_dp_read_bytes_from_i2c( + dp, I2C_EDID_DEVICE_ADDR, EDID_HEADER_PATTERN, + EDID_BLOCK_LENGTH, edid[EDID_HEADER_PATTERN]); if (retval != 0) { dev_err(dp-dev, EDID Read failed!\n); return -EIO; @@ -182,16 +181,15 @@ static int exynos_dp_read_edid
[PATCH v2 8/8] drm: bridge/analogix_dp: expand the delay time for hpd detect
Some edp screen with no hpd signal would need some delay time to ensure that screen would be ready for work, so we can expand the delay time in hpd detect function, it works prefectly on my rk3288 sdk board. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v2: None drivers/gpu/drm/bridge/analogix_dp_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix_dp_core.c index efd810c..3ba10fa2 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix_dp_core.c @@ -71,7 +71,7 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device *dp) return 0; timeout_loop++; - usleep_range(10, 11); + usleep_range(100, 110); } /* -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/8] drm: exynos/dp: convert to drm bridge mode
In order to move exynos dp code to bridge directory, we need to convert driver drm bridge mode first. As dp driver already have a ptn3460 bridge, so we need to move ptn bridge to the next bridge of dp bridge. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v2: - Take Jingoo Han suggest, cause I jsut improve parts of the code, so just remove my name from author list. drivers/gpu/drm/exynos/exynos_dp_core.c | 194 drivers/gpu/drm/exynos/exynos_dp_core.h | 1 + 2 files changed, 123 insertions(+), 72 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 562f4a8..2b87406 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -997,59 +997,6 @@ static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = { .best_encoder = exynos_dp_best_encoder, }; -/* returns the number of bridges attached */ -static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, - struct drm_encoder *encoder) -{ - int ret; - - encoder-bridge = dp-bridge; - dp-bridge-encoder = encoder; - ret = drm_bridge_attach(encoder-dev, dp-bridge); - if (ret) { - DRM_ERROR(Failed to attach bridge to drm\n); - return ret; - } - - return 0; -} - -static int exynos_dp_create_connector(struct exynos_drm_display *display, - struct drm_encoder *encoder) -{ - struct exynos_dp_device *dp = display_to_dp(display); - struct drm_connector *connector = dp-connector; - int ret; - - dp-encoder = encoder; - - /* Pre-empt DP connector creation if there's a bridge */ - if (dp-bridge) { - ret = exynos_drm_attach_lcd_bridge(dp, encoder); - if (!ret) - return 0; - } - - connector-polled = DRM_CONNECTOR_POLL_HPD; - - ret = drm_connector_init(dp-drm_dev, connector, -exynos_dp_connector_funcs, -DRM_MODE_CONNECTOR_eDP); - if (ret) { - DRM_ERROR(Failed to initialize connector with drm\n); - return ret; - } - - drm_connector_helper_add(connector, exynos_dp_connector_helper_funcs); - drm_connector_register(connector); - drm_mode_connector_attach_encoder(connector, encoder); - - if (dp-panel) - ret = drm_panel_attach(dp-panel, dp-connector); - - return ret; -} - static void exynos_dp_phy_init(struct exynos_dp_device *dp) { if (dp-phy) @@ -1114,23 +1061,126 @@ static void exynos_dp_poweroff(struct exynos_dp_device *dp) } } -static void exynos_dp_dpms(struct exynos_drm_display *display, int mode) +/* returns the number of bridges attached */ +static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, + struct drm_encoder *encoder) +{ + int ret; + + dp-bridge-next = dp-ptn_bridge; + dp-bridge-encoder = encoder; + ret = drm_bridge_attach(encoder-dev, dp-bridge); + if (ret) { + DRM_ERROR(Failed to attach ptn bridge to drm\n); + return ret; + } + + return 0; +} + +static int exynos_dp_bridge_attach(struct drm_bridge *bridge) +{ + + struct exynos_dp_device *dp = bridge-driver_private; + struct drm_encoder *encoder = dp-encoder; + struct drm_connector *connector = dp-connector; + int ret; + + if (!bridge-encoder) { + DRM_ERROR(Parent encoder object not found); + return -ENODEV; + } + + encoder-bridge = bridge; + + /* Pre-empt DP connector creation if there's a bridge */ + if (dp-ptn_bridge) { + ret = exynos_drm_attach_lcd_bridge(dp, encoder); + if (ret) + return -ENODEV; + } + + connector-polled = DRM_CONNECTOR_POLL_HPD; + + ret = drm_connector_init(dp-drm_dev, connector, + exynos_dp_connector_funcs, DRM_MODE_CONNECTOR_eDP); + if (ret) { + DRM_ERROR(Failed to initialize connector with drm\n); + return ret; + } + + drm_connector_helper_add(connector, exynos_dp_connector_helper_funcs); + drm_connector_register(connector); + drm_mode_connector_attach_encoder(connector, encoder); + + if (dp-panel) + ret = drm_panel_attach(dp-panel, dp-connector); + + return ret; +} + +static void exynos_dp_bridge_nop(struct drm_bridge *bridge) +{ + /* do nothing */ +} + +static void exynos_dp_bridge_enable(struct drm_bridge *bridge) +{ + struct exynos_dp_device *dp = bridge-driver_private; + + exynos_dp_poweron(dp); + dp-dpms_mode = DRM_MODE_DPMS_ON; +} + +static void exynos_dp_bridge_disable(struct drm_bridge *bridge) +{ + struct
[PATCH v2 7/8] drm: bridge: analogix_dp: try force hpd after plug in lookup failed
Some edp screen do not have hpd signal, so we can't just return failed when hpd plug in detect failed. Besides TRM indicate that if HPD_STATUS(RO) is 0, AUX CH will not work, so we need to give a force hpd action to set HPD_STATUS manually. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v2: None drivers/gpu/drm/bridge/analogix_dp_core.c | 28 +++- drivers/gpu/drm/bridge/analogix_dp_core.h | 1 + drivers/gpu/drm/bridge/analogix_dp_reg.c | 9 + 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix_dp_core.c index 44be01d..efd810c 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix_dp_core.c @@ -66,15 +66,33 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device *dp) { int timeout_loop = 0; - while (analogix_dp_get_plug_in_status(dp) != 0) { + while (timeout_loop DP_TIMEOUT_LOOP_COUNT) { + if (analogix_dp_get_plug_in_status(dp) == 0) + return 0; + timeout_loop++; - if (DP_TIMEOUT_LOOP_COUNT timeout_loop) { - dev_err(dp-dev, failed to get hpd plug status\n); - return -ETIMEDOUT; - } usleep_range(10, 11); } + /* +* Some edp screen do not have hpd signal, so we can't just +* return failed when hpd plug in detect failed. +* +* Besides TRM indicate that if HPD_STATUS(RO) is 0, AUX CH +* will not work, so we need to give a force hpd action to +* set HPD_STATUS manually. +*/ + dev_dbg(dp-dev, failed to get hpd plug status, try to force hpd\n); + + analogix_dp_force_hpd(dp); + + if (analogix_dp_get_plug_in_status(dp) != 0) { + dev_err(dp-dev, failed to get hpd plug in status\n); + return -ETIMEDOUT; + } + + dev_dbg(dp-dev, success to get plug in status after force hpd\n); + return 0; } diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix_dp_core.h index 713c57f..53f3973 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_core.h +++ b/drivers/gpu/drm/bridge/analogix_dp_core.h @@ -182,6 +182,7 @@ void analogix_dp_set_analog_power_down(struct analogix_dp_device *dp, bool enable); void analogix_dp_init_analog_func(struct analogix_dp_device *dp); void analogix_dp_init_hpd(struct analogix_dp_device *dp); +void analogix_dp_force_hpd(struct analogix_dp_device *dp); enum dp_irq_type analogix_dp_get_irq_type(struct analogix_dp_device *dp); void analogix_dp_clear_hotplug_interrupts(struct analogix_dp_device *dp); void analogix_dp_reset_aux(struct analogix_dp_device *dp); diff --git a/drivers/gpu/drm/bridge/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix_dp_reg.c index a0fc1fb..bf7cee1 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_reg.c +++ b/drivers/gpu/drm/bridge/analogix_dp_reg.c @@ -365,6 +365,15 @@ void analogix_dp_init_hpd(struct analogix_dp_device *dp) writel(reg, dp-reg_base + ANALOGIX_DP_SYS_CTL_3); } +void analogix_dp_force_hpd(struct analogix_dp_device *dp) +{ + u32 reg; + + reg = readl(dp-reg_base + ANALOGIX_DP_SYS_CTL_3); + reg = (F_HPD | HPD_CTRL); + writel(reg, dp-reg_base + ANALOGIX_DP_SYS_CTL_3); +} + enum dp_irq_type analogix_dp_get_irq_type(struct analogix_dp_device *dp) { u32 reg; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 4/8] drm: rockchip/dp: add rockchip platform dp driver
Rockchip have three clocks for dp controller, we leave pclk_edp to analogix_dp driver control, and keep the sclk_edp_24m and sclk_edp in platform driver. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v2: None drivers/gpu/drm/rockchip/Kconfig| 10 + drivers/gpu/drm/rockchip/Makefile | 1 + drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 419 3 files changed, 430 insertions(+) create mode 100644 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig index 35215f6..096ed77 100644 --- a/drivers/gpu/drm/rockchip/Kconfig +++ b/drivers/gpu/drm/rockchip/Kconfig @@ -25,3 +25,13 @@ config ROCKCHIP_DW_HDMI for the Synopsys DesignWare HDMI driver. If you want to enable HDMI on RK3288 based SoC, you should selet this option. + + +config ROCKCHIP_ANALOGIX_DP +tristate Rockchip specific extensions for Analogix DP driver +depends on DRM_ROCKCHIP +select DRM_ANALOGIX_DP +help + This selects support for Rockchip SoC specific extensions + for the Analogix Core DP driver. If you want to enable DP + on RK3288 based SoC, you should selet this option. diff --git a/drivers/gpu/drm/rockchip/Makefile b/drivers/gpu/drm/rockchip/Makefile index f3d8a19..8ad01fb 100644 --- a/drivers/gpu/drm/rockchip/Makefile +++ b/drivers/gpu/drm/rockchip/Makefile @@ -6,5 +6,6 @@ rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o rockchip_drm_fbdev.o \ rockchip_drm_gem.o obj-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o +obj-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o rockchip_drm_vop.o diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c new file mode 100644 index 000..2f86e5e --- /dev/null +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -0,0 +1,419 @@ +/* + * Rockchip SoC DP (Display Port) interface driver. + * + * Copyright (C) Fuzhou Rockchip Electronics Co., Ltd. + * Author: Andy Yan andy@rock-chips.com + * Yakir Yang y...@rock-chips.com + * Jeff Chen jeff.c...@rock-chips.com + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ +#include drm/drmP.h +#include drm/drm_crtc_helper.h +#include drm/drm_panel.h +#include drm/drm_of.h +#include drm/drm_dp_helper.h + +#include linux/component.h +#include linux/clk.h +#include linux/mfd/syscon.h +#include linux/regmap.h +#include linux/reset.h + +#include video/of_videomode.h +#include video/videomode.h + +#include drm/bridge/analogix_dp.h + +#include rockchip_drm_drv.h +#include rockchip_drm_vop.h + +#define encoder_to_dp(c) \ + container_of(c, struct rockchip_dp_device, encoder) + +#define plat_data_to_dp(pd) \ + container_of(pd, struct rockchip_dp_device, plat_data) + +/* dp grf register offset */ +#define DP_VOP_SEL 0x025c /* grf_soc_con6 */ +#define DP_REF_CLK_SEL 0x0274 /* grf_soc_con12 */ + +#define GRF_DP_REF_CLK_SEL_INTERBIT(4) +#define DP_SEL_VOP_LIT BIT(5) + +struct rockchip_dp_device { + struct drm_device*drm_dev; + struct device*dev; + struct drm_encoder encoder; + struct drm_display_mode mode; + + struct clk *clk_dp; + struct clk *clk_24m_parent; + struct clk *clk_24m; + struct regmap*grf; + struct reset_control *rst; + + struct analogix_dp_plat_data plat_data; +}; + +static int rockchip_dp_clk_enable(struct rockchip_dp_device *dp) +{ + int ret = 0; + + ret = clk_prepare_enable(dp-clk_dp); + if (ret 0) { + dev_err(dp-dev, cannot enable clk_dp %d\n, ret); + goto err_clk_dp; + } + + ret = clk_set_rate(dp-clk_24m, 2400); + if (ret 0) { + dev_err(dp-dev, cannot set dp clk_24m %d\n, + ret); + goto err_clk_24m; + } + + ret = clk_prepare_enable(dp-clk_24m); + if (ret 0) { + dev_err(dp-dev, cannot enable dp clk_24m %d\n, + ret); + goto err_clk_24m; + } + + return 0; + +err_clk_24m: + clk_disable_unprepare(dp-clk_dp); +err_clk_dp: + return ret; +} + +static int rockchip_dp_clk_disable(struct rockchip_dp_device *dp) +{ + clk_disable_unprepare(dp-clk_dp); + clk_disable_unprepare(dp-clk_24m); + + return 0; +} + +static int rockchip_dp_pre_init(struct rockchip_dp_device *dp) +{ + u32 val
[PATCH v2 5/8] drm: bridge/analogix_dp: add platform device type support
Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v2: - Add GNU license v2 declared and samsung copyright drivers/gpu/drm/exynos/analogix_dp-exynos.c | 1 + drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 1 + include/drm/bridge/analogix_dp.h| 16 3 files changed, 18 insertions(+) diff --git a/drivers/gpu/drm/exynos/analogix_dp-exynos.c b/drivers/gpu/drm/exynos/analogix_dp-exynos.c index 1468ce7..5a2027d 100644 --- a/drivers/gpu/drm/exynos/analogix_dp-exynos.c +++ b/drivers/gpu/drm/exynos/analogix_dp-exynos.c @@ -122,6 +122,7 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) dp-dev = dev; dp-drm_dev = drm_dev; + dp-plat_data.dev_type = EXYNOS_DP; dp-plat_data.power_on = exynos_dp_poweron; dp-plat_data.power_off = exynos_dp_poweroff; dp-plat_data.attach = exynos_dp_bridge_attach; diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index 2f86e5e..e7cf9ab 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -312,6 +312,7 @@ static int rockchip_dp_bind(struct device *dev, struct device *master, return ret; } + dp-plat_data.dev_type = RK3288_DP; dp-plat_data.attach = NULL; dp-plat_data.power_on = rockchip_dp_poweron; dp-plat_data.power_off = rockchip_dp_poweroff; diff --git a/include/drm/bridge/analogix_dp.h b/include/drm/bridge/analogix_dp.h index 9a207f8..d5f9a5b 100644 --- a/include/drm/bridge/analogix_dp.h +++ b/include/drm/bridge/analogix_dp.h @@ -1,9 +1,25 @@ +/* + * Analogix Core DP (Display Port) interface driver. + * + * Copyright (C) 2012 Samsung Electronics Co., Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ #ifndef _ANALOGIX_DP_H_ #define _ANALOGIX_DP_H_ #include drm/drm_crtc.h +enum analogix_dp_devtype { + EXYNOS_DP, + RK3288_DP, +}; + struct analogix_dp_plat_data { + enum analogix_dp_devtype dev_type; struct drm_panel *panel; int (*power_on)(struct analogix_dp_plat_data *); -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 6/8] drm: bridge: analogix_dp: add some rk3288 special registers setting
RK3288 need some special registers setting, we can separate them out by the dev_type of plat_data. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v2: - Fix compile failed dut to phy_pd_addr variable misspell error drivers/gpu/drm/bridge/analogix_dp_reg.c | 76 drivers/gpu/drm/bridge/analogix_dp_reg.h | 12 + 2 files changed, 60 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix_dp_reg.c index cc5cdbf..a0fc1fb 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_reg.c +++ b/drivers/gpu/drm/bridge/analogix_dp_reg.c @@ -15,6 +15,8 @@ #include linux/delay.h #include linux/gpio.h +#include drm/bridge/analogix_dp.h + #include analogix_dp_core.h #include analogix_dp_reg.h @@ -72,6 +74,14 @@ void analogix_dp_init_analog_param(struct analogix_dp_device *dp) reg = SEL_24M | TX_DVDD_BIT_1_0625V; writel(reg, dp-reg_base + ANALOGIX_DP_ANALOG_CTL_2); + if (dp-plat_data (dp-plat_data-dev_type == RK3288_DP)) { + writel(REF_CLK_24M, dp-reg_base + ANALOGIX_DP_PLL_REG_1); + writel(0x95, dp-reg_base + ANALOGIX_DP_PLL_REG_2); + writel(0x40, dp-reg_base + ANALOGIX_DP_PLL_REG_3); + writel(0x58, dp-reg_base + ANALOGIX_DP_PLL_REG_4); + writel(0x22, dp-reg_base + ANALOGIX_DP_PLL_REG_5); + } + reg = DRIVE_DVDD_BIT_1_0625V | VCO_BIT_600_MICRO; writel(reg, dp-reg_base + ANALOGIX_DP_ANALOG_CTL_3); @@ -206,81 +216,85 @@ void analogix_dp_set_analog_power_down(struct analogix_dp_device *dp, bool enable) { u32 reg; + u32 phy_pd_addr = ANALOGIX_DP_PHY_PD; + + if (dp-plat_data (dp-plat_data-dev_type == RK3288_DP)) + phy_pd_addr = ANALOGIX_DP_PD; switch (block) { case AUX_BLOCK: if (enable) { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_pd_addr); reg |= AUX_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_pd_addr); } else { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_pd_addr); reg = ~AUX_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_pd_addr); } break; case CH0_BLOCK: if (enable) { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_pd_addr); reg |= CH0_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_pd_addr); } else { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_pd_addr); reg = ~CH0_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_pd_addr); } break; case CH1_BLOCK: if (enable) { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_pd_addr); reg |= CH1_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_pd_addr); } else { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_pd_addr); reg = ~CH1_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_pd_addr); } break; case CH2_BLOCK: if (enable) { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_pd_addr); reg |= CH2_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_pd_addr); } else { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_pd_addr); reg = ~CH2_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_pd_addr); } break; case CH3_BLOCK: if (enable) { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl
Re: [PATCH v2 4/8] drm: rockchip/dp: add rockchip platform dp driver
Hi Thierry, 在 2015/8/10 21:17, Thierry Reding 写道: On Mon, Aug 10, 2015 at 08:59:44PM +0800, Yakir Yang wrote: Hi Thierry, 在 2015/8/10 18:00, Thierry Reding 写道: On Sat, Aug 08, 2015 at 11:54:38AM +0800, Yakir Yang wrote: [...] edp: edp@ff97 { [...] hsync-active-high = 0; vsync-active-high = 0; interlaced = 0; These look like they should come from the display mode definition (EDID) rather than device tree. I do think so, those numbers can parse from struct drm_mode. But I haven't send those changes yet, cause I want to merge the split analogix_dp first, and then send some patches to improve it. If you think it's better to imptoved those now, I would like to do it , please let me know ;) samsung,color-space = 0; samsung,dynamic-range = 0; samsung,ycbcr-coeff = 0; I think these should also come from EDID, though I'm not sure if we store this in internal data structures yet. Same to previous reply samsung,color-depth = 1; This is probably drm_display_info.bpc. Same to previous reply samsung,link-rate = 0x0a; samsung,lane-count = 1; And these should really be derived from values in the DPCD and adjusted (if necessary) during link training. Why would you ever want to hard-code the above? Yes, I do meet the problem that my eDP screen need lane-count to 4, but my DP TV need lane-count to 1. Just like previous reply, if you think I should improved them in this series, I would rather to do it. The problem with these is that if you keep them in for your initial submission, you can never (or only under extreme pain) remove them. Anything in DTB needs to be effectively supported forever. Also since these don't make sense to hard-code, just improve the code and get rid of the need for these DT properties. Mind you that you still need to keep the code to parse them, because presumably Exynos relies on them. But depending on how you split up the driver you might be able to restrict these compatibility hacks to Exynos and not carry them forward into your new driver. Okay, thanks for your remind ;) + dp-clk_24m = devm_clk_get(dev, clk_dp_24m); Same here, maybe dp_24m. Like my previous reply. And actually as those two clocks all have a common prefix SCLK in rk3288 clock tree, I thinkt we can name them to sclk_dp sclk_dp_24m, is it okay ? I don't think there's a need for these common prefixes. The names here are identifiers in the context of the IP block, so any SoC-specific prefixes are irrelevant. Also they do appear, in DT and in code, in the context of clocks already, so sclk_ or clk_ is completely redundant in these names. The sclk_dp sclk_dp_24m is not IP common ask, it's only exist in RK3288 SoC (Like exynos only got one dp clock), and actually I add this to rockchip platform dp driver not analogix dp driver. So I think it's okay to add some platform some common prefixes. And I got a better idea for those clock. sclk_dp sclk_dp_24m is provided for the eDP phy, and I just take Heiko suggest that add an new phy-rockchip-dp.c driver, so it's better to move those clock to phy driver, and rename them to dp-phy dp-phy-24m. I agree that dealing with these in a PHY driver sounds like the better option. However, I still think that the dp-phy prefix is redundant. The names are in a per-driver scope, so dp-phy is implied by the device tree binding and driver already. You could simply use shorter names such as phy and 24m for example. Also note that the clock provider will already have the proper names for these, so the clock tree will end up showing the provider names. The names in the binding are merely the consumer names. Agree, thanks - Yakir Thierry -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 4/8] drm: rockchip/dp: add rockchip platform dp driver
Hi Thierry, 在 2015/8/10 18:00, Thierry Reding 写道: On Sat, Aug 08, 2015 at 11:54:38AM +0800, Yakir Yang wrote: [...] edp: edp@ff97 { [...] hsync-active-high = 0; vsync-active-high = 0; interlaced = 0; These look like they should come from the display mode definition (EDID) rather than device tree. I do think so, those numbers can parse from struct drm_mode. But I haven't send those changes yet, cause I want to merge the split analogix_dp first, and then send some patches to improve it. If you think it's better to imptoved those now, I would like to do it , please let me know ;) samsung,color-space = 0; samsung,dynamic-range = 0; samsung,ycbcr-coeff = 0; I think these should also come from EDID, though I'm not sure if we store this in internal data structures yet. Same to previous reply samsung,color-depth = 1; This is probably drm_display_info.bpc. Same to previous reply samsung,link-rate = 0x0a; samsung,lane-count = 1; And these should really be derived from values in the DPCD and adjusted (if necessary) during link training. Why would you ever want to hard-code the above? Yes, I do meet the problem that my eDP screen need lane-count to 4, but my DP TV need lane-count to 1. Just like previous reply, if you think I should improved them in this series, I would rather to do it. + dp-clk_24m = devm_clk_get(dev, clk_dp_24m); Same here, maybe dp_24m. Like my previous reply. And actually as those two clocks all have a common prefix SCLK in rk3288 clock tree, I thinkt we can name them to sclk_dp sclk_dp_24m, is it okay ? I don't think there's a need for these common prefixes. The names here are identifiers in the context of the IP block, so any SoC-specific prefixes are irrelevant. Also they do appear, in DT and in code, in the context of clocks already, so sclk_ or clk_ is completely redundant in these names. The sclk_dp sclk_dp_24m is not IP common ask, it's only exist in RK3288 SoC (Like exynos only got one dp clock), and actually I add this to rockchip platform dp driver not analogix dp driver. So I think it's okay to add some platform some common prefixes. And I got a better idea for those clock. sclk_dp sclk_dp_24m is provided for the eDP phy, and I just take Heiko suggest that add an new phy-rockchip-dp.c driver, so it's better to move those clock to phy driver, and rename them to dp-phy dp-phy-24m. Thanks, - Yakir Thierry -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 4/8] drm: rockchip/dp: add rockchip platform dp driver
Hi Heiko, 在 2015/8/10 20:08, Heiko Stübner 写道: Hi Yakir, Am Samstag, 8. August 2015, 11:54:38 schrieb Yakir Yang: +static int rockchip_dp_init(struct rockchip_dp_device *dp) +{ + struct device *dev = dp-dev; + struct device_node *np = dev-of_node; + int ret; + + dp-grf = syscon_regmap_lookup_by_phandle(np, rockchip,grf); + if (IS_ERR(dp-grf)) { + dev_err(dev, + rk3288-dp needs rockchip,grf property\n); + return PTR_ERR(dp-grf); + } + + dp-clk_dp = devm_clk_get(dev, clk_dp); I've looked at the manual, but couldn't find an actual clock-name used there. Is it really clk_dp or should it just be dp? This should be clk_dp, not dp. Cause analogix_dp_core would need a clock name with dp, so I would rather to pasted my rockchip-dp node here before I add dt-bindings in next version ;) The clock we name PCLK_EDP_CTRL in the clock controller is probably the clock supplying the APB interface and named pclk already in the Figure 3-2 DP_TXclock domain diagram on page 19 of the manual. So your clk_dp should actually be pclk. So you would have dp, dp_24m and pclk for the 3 supplying clocks. Oh, yes, pclk is for APB interface, and sclk_edp for IP controller, and sclk_edp_24m for DP PHY, thanks for your explain. So for now, I would pass sclk_edp to edp in analogix_dp, and sclk_edp_24m to dp-phy_24m in phy-rockchip-dp.c, and pclk_edp to pclk in analogix_dp-rockchip.c. edp: edp@ff97 { compatible = rockchip,rk3288-dp; reg = 0xff97 0x4000; interrupts = GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH; clocks = cru SCLK_EDP, cru SCLK_EDP_24M, cru PCLK_EDP_CTRL; clock-names = clk_dp, clk_dp_24m, dp; rockchip,grf = grf; resets = cru 111; reset-names = dp; power-domains = power RK3288_PD_VIO; status = disabled; hsync-active-high = 0; vsync-active-high = 0; interlaced = 0; samsung,color-space = 0; samsung,dynamic-range = 0; samsung,ycbcr-coeff = 0; samsung,color-depth = 1; samsung,link-rate = 0x0a; samsung,lane-count = 1; Thierry already said, that these should probably be somehow auto-detected. Properties needing to stay around should probably also be analogix,... with a fallback to not break Samsung devicetrees, so look for analogix,foo!, if not found try samsung,foo Okay, it's better to rename to analogxi..., done. ports { edp_in: port { #address-cells = 1; #size-cells = 0; edp_in_vopb: endpoint@0 { reg = 0; remote-endpoint = vopb_out_edp; }; }; }; + + dp-clk_24m = devm_clk_get(dev, clk_dp_24m); Same here, maybe dp_24m. Like my previous reply. And actually as those two clocks all have a common prefix SCLK in rk3288 clock tree, I thinkt we can name them to sclk_dp sclk_dp_24m, is it okay ? As Thierry said, please don't add prefixes. Okay, so is it okay to rename them to dp, dp-phy-24m, pclk ? + if (IS_ERR(dp-clk_24m)) { + dev_err(dev, cannot get clk_dp_24m\n); + return PTR_ERR(dp-clk_24m); + } I think you're missing the pclk here (PCLK_EDP_CTRL) or is this part of something else? Whops, as I refered in commit message I leave pclk_dp to analogix_dp_core driver ;-) The reason why I want to leave pclk is I thought this clock is more like analogix dp core driver want, like a IP controller clock (whatever analogix_dp do need a clock named with dp). Hmm, I'd think what the core (and Samsung) driver use as dp clock is probably the generic clock for the IP and not the pclk for the APB interface. So I think it still should be dp for the core and dp_24m + pclk for the rockchip part? Yes, I think you are right, thanks ;) + + dp-rst = devm_reset_control_get(dev, dp); + if (IS_ERR(dp-rst)) { + dev_err(dev, failed to get reset\n); + return PTR_ERR(dp-rst); + } + + ret = rockchip_dp_clk_enable(dp); + if (ret 0) { + dev_err(dp-dev, cannot enable dp clk %d\n, ret); + return ret; + } + + ret = rockchip_dp_pre_init(dp); + if (ret 0) { + dev_err(dp-dev, failed to pre init %d\n, ret); + return ret; + } + + return 0; +} [...] +static int rockchip_dp_probe(struct platform_device *pdev) +{ + struct device *dev = pdev-dev; + struct device_node *panel_node
Re: [PATCH v2 4/8] drm: rockchip/dp: add rockchip platform dp driver
Hi Hekio, 在 2015/8/8 6:46, Heiko Stübner 写道: Hi Yakir, I think this Rockchip portion is missing a devicetree binding. Oh, thanks, I would complete it in next ;) You have the ability to power down the actual edp phy by using grf_edp_iddq_en from GRF_SOC_CON12. This is similar to how the rk3288 usb-phy gets put into a deeper state. So maybe you could provide a phy driver (drivers/phy) for this similar to what the exynos-dp does. Okay, so I need to add a new phy-rockchip-dp.c, include power_on/power_off ops, thanks. Some more stuff inline. But I guess by no means complete, as I'm still trying to integrate this into my development-tree. Am Freitag, 7. August 2015, 05:46:20 schrieb Yakir Yang: Rockchip have three clocks for dp controller, we leave pclk_edp to analogix_dp driver control, and keep the sclk_edp_24m and sclk_edp in platform driver. Signed-off-by: Yakir Yang y...@rock-chips.com --- Changes in v2: None drivers/gpu/drm/rockchip/Kconfig| 10 + drivers/gpu/drm/rockchip/Makefile | 1 + drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 419 3 files changed, 430 insertions(+) create mode 100644 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig index 35215f6..096ed77 100644 --- a/drivers/gpu/drm/rockchip/Kconfig +++ b/drivers/gpu/drm/rockchip/Kconfig @@ -25,3 +25,13 @@ config ROCKCHIP_DW_HDMI for the Synopsys DesignWare HDMI driver. If you want to enable HDMI on RK3288 based SoC, you should selet this option. + + nit: double blank line Done, +config ROCKCHIP_ANALOGIX_DP +tristate Rockchip specific extensions for Analogix DP driver +depends on DRM_ROCKCHIP +select DRM_ANALOGIX_DP +help + This selects support for Rockchip SoC specific extensions + for the Analogix Core DP driver. If you want to enable DP + on RK3288 based SoC, you should selet this option. [...] diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c new file mode 100644 index 000..2f86e5e --- /dev/null +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -0,0 +1,419 @@ +/* + * Rockchip SoC DP (Display Port) interface driver. + * + * Copyright (C) Fuzhou Rockchip Electronics Co., Ltd. + * Author: Andy Yan andy@rock-chips.com + * Yakir Yang y...@rock-chips.com + * Jeff Chen jeff.c...@rock-chips.com + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ +#include drm/drmP.h +#include drm/drm_crtc_helper.h +#include drm/drm_panel.h +#include drm/drm_of.h +#include drm/drm_dp_helper.h + +#include linux/component.h +#include linux/clk.h +#include linux/mfd/syscon.h +#include linux/regmap.h +#include linux/reset.h + +#include video/of_videomode.h +#include video/videomode.h + +#include drm/bridge/analogix_dp.h + +#include rockchip_drm_drv.h +#include rockchip_drm_vop.h + +#define encoder_to_dp(c) \ + container_of(c, struct rockchip_dp_device, encoder) + +#define plat_data_to_dp(pd) \ + container_of(pd, struct rockchip_dp_device, plat_data) + +/* dp grf register offset */ +#define DP_VOP_SEL 0x025c /* grf_soc_con6 */ +#define DP_REF_CLK_SEL 0x0274 /* grf_soc_con12 */ + +#define GRF_DP_REF_CLK_SEL_INTERBIT(4) +#define DP_SEL_VOP_LIT BIT(5) + +struct rockchip_dp_device { + struct drm_device*drm_dev; + struct device*dev; + struct drm_encoder encoder; + struct drm_display_mode mode; + + struct clk *clk_dp; + struct clk *clk_24m_parent; this clk_24m_parent does not seem used at all Done, + struct clk *clk_24m; + struct regmap*grf; + struct reset_control *rst; + + struct analogix_dp_plat_data plat_data; +}; + [...] +static int rockchip_dp_init(struct rockchip_dp_device *dp) +{ + struct device *dev = dp-dev; + struct device_node *np = dev-of_node; + int ret; + + dp-grf = syscon_regmap_lookup_by_phandle(np, rockchip,grf); + if (IS_ERR(dp-grf)) { + dev_err(dev, + rk3288-dp needs rockchip,grf property\n); + return PTR_ERR(dp-grf); + } + + dp-clk_dp = devm_clk_get(dev, clk_dp); I've looked at the manual, but couldn't find an actual clock-name used there. Is it really clk_dp or should it just be dp? This should be clk_dp, not dp. Cause analogix_dp_core would need a clock name with dp, so I would rather to pasted my rockchip-dp node here before I add dt
[RFC PATCH 5/8] drm: bridge/analogix_dp: add platform device type support
Signed-off-by: Yakir Yang y...@rock-chips.com --- drivers/gpu/drm/exynos/analogix_dp-exynos.c | 1 + drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 1 + include/drm/bridge/analogix_dp.h| 6 ++ 3 files changed, 8 insertions(+) diff --git a/drivers/gpu/drm/exynos/analogix_dp-exynos.c b/drivers/gpu/drm/exynos/analogix_dp-exynos.c index b8d09d4..0668e77 100644 --- a/drivers/gpu/drm/exynos/analogix_dp-exynos.c +++ b/drivers/gpu/drm/exynos/analogix_dp-exynos.c @@ -124,6 +124,7 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) dp-dev = dev; dp-drm_dev = drm_dev; + dp-plat_data.dev_type = EXYNOS_DP; dp-plat_data.power_on = exynos_dp_poweron; dp-plat_data.power_off = exynos_dp_poweroff; dp-plat_data.attach = exynos_dp_bridge_attach; diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index 804048c..b532c21 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -312,6 +312,7 @@ static int rockchip_dp_bind(struct device *dev, struct device *master, return ret; } + dp-plat_data.dev_type = RK3288_DP; dp-plat_data.attach = NULL; dp-plat_data.power_on = rockchip_dp_poweron; dp-plat_data.power_off = rockchip_dp_poweroff; diff --git a/include/drm/bridge/analogix_dp.h b/include/drm/bridge/analogix_dp.h index 9a207f8..f317003 100644 --- a/include/drm/bridge/analogix_dp.h +++ b/include/drm/bridge/analogix_dp.h @@ -3,7 +3,13 @@ #include drm/drm_crtc.h +enum analogix_dp_devtype { + EXYNOS_DP, + RK3288_DP, +}; + struct analogix_dp_plat_data { + enum analogix_dp_devtype dev_type; struct drm_panel *panel; int (*power_on)(struct analogix_dp_plat_data *); -- 2.1.2 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 7/8] drm: bridge: analogix_dp: try force hpd after plug in lookup failed
Some edp screen do not have hpd signal, so we can't just return failed when hpd plug in detect failed. Besides TRM indicate that if HPD_STATUS(RO) is 0, AUX CH will not work, so we need to give a force hpd action to set HPD_STATUS manually. Signed-off-by: Yakir Yang y...@rock-chips.com --- drivers/gpu/drm/bridge/analogix_dp_core.c | 28 +++- drivers/gpu/drm/bridge/analogix_dp_core.h | 1 + drivers/gpu/drm/bridge/analogix_dp_reg.c | 9 + 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix_dp_core.c index 28724d4..7e67f19 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix_dp_core.c @@ -68,15 +68,33 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device *dp) { int timeout_loop = 0; - while (analogix_dp_get_plug_in_status(dp) != 0) { + while (timeout_loop DP_TIMEOUT_LOOP_COUNT) { + if (analogix_dp_get_plug_in_status(dp) == 0) + return 0; + timeout_loop++; - if (DP_TIMEOUT_LOOP_COUNT timeout_loop) { - dev_err(dp-dev, failed to get hpd plug status\n); - return -ETIMEDOUT; - } usleep_range(10, 11); } + /* +* Some edp screen do not have hpd signal, so we can't just +* return failed when hpd plug in detect failed. +* +* Besides TRM indicate that if HPD_STATUS(RO) is 0, AUX CH +* will not work, so we need to give a force hpd action to +* set HPD_STATUS manually. +*/ + dev_dbg(dp-dev, failed to get hpd plug status, try to force hpd\n); + + analogix_dp_force_hpd(dp); + + if (analogix_dp_get_plug_in_status(dp) != 0) { + dev_err(dp-dev, failed to get hpd plug in status\n); + return -ETIMEDOUT; + } + + dev_dbg(dp-dev, success to get plug in status after force hpd\n); + return 0; } diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix_dp_core.h index fe72695..43cec77 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_core.h +++ b/drivers/gpu/drm/bridge/analogix_dp_core.h @@ -183,6 +183,7 @@ void analogix_dp_set_analog_power_down(struct analogix_dp_device *dp, bool enable); void analogix_dp_init_analog_func(struct analogix_dp_device *dp); void analogix_dp_init_hpd(struct analogix_dp_device *dp); +void analogix_dp_force_hpd(struct analogix_dp_device *dp); enum dp_irq_type analogix_dp_get_irq_type(struct analogix_dp_device *dp); void analogix_dp_clear_hotplug_interrupts(struct analogix_dp_device *dp); void analogix_dp_reset_aux(struct analogix_dp_device *dp); diff --git a/drivers/gpu/drm/bridge/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix_dp_reg.c index 4d6e08a..3fb215b 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_reg.c +++ b/drivers/gpu/drm/bridge/analogix_dp_reg.c @@ -366,6 +366,15 @@ void analogix_dp_init_hpd(struct analogix_dp_device *dp) writel(reg, dp-reg_base + ANALOGIX_DP_SYS_CTL_3); } +void analogix_dp_force_hpd(struct analogix_dp_device *dp) +{ + u32 reg; + + reg = readl(dp-reg_base + ANALOGIX_DP_SYS_CTL_3); + reg = (F_HPD | HPD_CTRL); + writel(reg, dp-reg_base + ANALOGIX_DP_SYS_CTL_3); +} + enum dp_irq_type analogix_dp_get_irq_type(struct analogix_dp_device *dp) { u32 reg; -- 2.1.2 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 0/8] Add Analogix Core Display Port Driver
Hi all, Samsung exynos and Rockchip rk3288 almost share same dp controller, so I split the common code out, then rk3288 and exynos can re-used the same dp core driver. Cause I can't find the exact IP name of exynos dp controller, so I decide to name dp core driver with analogix which I find in rk3288 eDP TRM ;) Beyond that, there are three light registers setting differents bewteen exynos and rk3288. 1. RK3288 have five special pll resigters which not indicata in exynos dp controller. 2. The address of DP_PHY_PD(dp phy power manager register) are different between rk3288 and exynos. 3. Rk3288 and exynos have different setting with AUX_HW_RETRY_CTL(dp debug register). My series patches can be divider into two parts: One for spliting the analogix_dp code from exynos dp driver. Another are trying to add rk3288 dp driver support. Best regards, - Yakir Yakir Yang (8): drm: exynos/dp: fix code style drm: exynos/dp: convert to drm bridge mode drm: bridge: analogix_dp: split exynos dp driver to bridge dir drm: rockchip/dp: add rockchip platform dp driver drm: bridge/analogix_dp: add platform device type support drm: bridge: analogix_dp: add some rk3288 special registers setting drm: bridge: analogix_dp: try force hpd after plug in lookup failed drm: bridge/analogix_dp: expand the delay time for hpd detect drivers/gpu/drm/bridge/Kconfig |5 + drivers/gpu/drm/bridge/Makefile|1 + drivers/gpu/drm/bridge/analogix_dp_core.c | 1397 +++ drivers/gpu/drm/bridge/analogix_dp_core.h | 287 drivers/gpu/drm/bridge/analogix_dp_reg.c | 1295 ++ .../exynos_dp_reg.h = bridge/analogix_dp_reg.h} | 272 ++-- drivers/gpu/drm/exynos/Kconfig |5 +- drivers/gpu/drm/exynos/Makefile|2 +- drivers/gpu/drm/exynos/analogix_dp-exynos.c| 241 drivers/gpu/drm/exynos/exynos_dp_core.c| 1416 drivers/gpu/drm/exynos/exynos_dp_core.h| 282 drivers/gpu/drm/exynos/exynos_dp_reg.c | 100 +- drivers/gpu/drm/rockchip/Kconfig | 10 + drivers/gpu/drm/rockchip/Makefile |1 + drivers/gpu/drm/rockchip/analogix_dp-rockchip.c| 420 ++ include/drm/bridge/analogix_dp.h | 28 + 16 files changed, 3880 insertions(+), 1882 deletions(-) create mode 100644 drivers/gpu/drm/bridge/analogix_dp_core.c create mode 100644 drivers/gpu/drm/bridge/analogix_dp_core.h create mode 100644 drivers/gpu/drm/bridge/analogix_dp_reg.c rename drivers/gpu/drm/{exynos/exynos_dp_reg.h = bridge/analogix_dp_reg.h} (62%) create mode 100644 drivers/gpu/drm/exynos/analogix_dp-exynos.c delete mode 100644 drivers/gpu/drm/exynos/exynos_dp_core.c delete mode 100644 drivers/gpu/drm/exynos/exynos_dp_core.h create mode 100644 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c create mode 100644 include/drm/bridge/analogix_dp.h -- 2.1.2 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 1/8] drm: exynos/dp: fix code style
make checkpatch.pl script happy Signed-off-by: Yakir Yang y...@rock-chips.com --- drivers/gpu/drm/exynos/exynos_dp_core.c | 224 drivers/gpu/drm/exynos/exynos_dp_core.h | 53 drivers/gpu/drm/exynos/exynos_dp_reg.c | 100 +++--- 3 files changed, 185 insertions(+), 192 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 172b800..a8097a4 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -114,8 +114,8 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) /* Read Extension Flag, Number of 128-byte EDID extension blocks */ retval = exynos_dp_read_byte_from_i2c(dp, I2C_EDID_DEVICE_ADDR, -EDID_EXTENSION_FLAG, -extend_block); + EDID_EXTENSION_FLAG, + extend_block); if (retval) return retval; @@ -123,10 +123,11 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) dev_dbg(dp-dev, EDID data includes a single extension!\n); /* Read EDID data */ -retval = exynos_dp_read_bytes_from_i2c(dp, I2C_EDID_DEVICE_ADDR, -EDID_HEADER_PATTERN, -EDID_BLOCK_LENGTH, -edid[EDID_HEADER_PATTERN]); +retval = +exynos_dp_read_bytes_from_i2c(dp, I2C_EDID_DEVICE_ADDR, + EDID_HEADER_PATTERN, + EDID_BLOCK_LENGTH, + edid[EDID_HEADER_PATTERN]); if (retval != 0) { dev_err(dp-dev, EDID Read failed!\n); return -EIO; @@ -138,11 +139,11 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) } /* Read additional EDID data */ -retval = exynos_dp_read_bytes_from_i2c(dp, -I2C_EDID_DEVICE_ADDR, -EDID_BLOCK_LENGTH, -EDID_BLOCK_LENGTH, -edid[EDID_BLOCK_LENGTH]); +retval = +exynos_dp_read_bytes_from_i2c(dp, I2C_EDID_DEVICE_ADDR, + EDID_BLOCK_LENGTH, + EDID_BLOCK_LENGTH, + edid[EDID_BLOCK_LENGTH]); if (retval != 0) { dev_err(dp-dev, EDID Read failed!\n); return -EIO; @@ -154,24 +155,22 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) } exynos_dp_read_byte_from_dpcd(dp, DP_TEST_REQUEST, -test_vector); + test_vector); if (test_vector DP_TEST_LINK_EDID_READ) { -exynos_dp_write_byte_to_dpcd(dp, -DP_TEST_EDID_CHECKSUM, +exynos_dp_write_byte_to_dpcd( +dp, DP_TEST_EDID_CHECKSUM, edid[EDID_BLOCK_LENGTH + EDID_CHECKSUM]); -exynos_dp_write_byte_to_dpcd(dp, -DP_TEST_RESPONSE, +exynos_dp_write_byte_to_dpcd( +dp, DP_TEST_RESPONSE, DP_TEST_EDID_CHECKSUM_WRITE); } } else { dev_info(dp-dev, EDID data does not include any extensions.\n); /* Read EDID data */ -retval = exynos_dp_read_bytes_from_i2c(dp, -I2C_EDID_DEVICE_ADDR, -EDID_HEADER_PATTERN, -EDID_BLOCK_LENGTH, -edid[EDID_HEADER_PATTERN]); +retval = exynos_dp_read_bytes_from_i2c( +dp, I2C_EDID_DEVICE_ADDR, EDID_HEADER_PATTERN, +EDID_BLOCK_LENGTH, edid[EDID_HEADER_PATTERN]); if (retval != 0) { dev_err(dp-dev, EDID Read failed!\n); return -EIO; @@ -182,16 +181,15 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) return -EIO; } -exynos_dp_read_byte_from_dpcd(dp, -DP_TEST_REQUEST, -test_vector); +exynos_dp_read_byte_from_dpcd(dp, DP_TEST_REQUEST, + test_vector); if (test_vector DP_TEST_LINK_EDID_READ) { -exynos_dp_write_byte_to_dpcd(dp, -DP_TEST_EDID_CHECKSUM, -edid[EDID_CHECKSUM]); -exynos_dp_write_byte_to_dpcd(dp, -DP_TEST_RESPONSE, -DP_TEST_EDID_CHECKSUM_WRITE); +exynos_dp_write_byte_to_dpcd( +dp, DP_TEST_EDID_CHECKSUM, +edid[EDID_CHECKSUM]); +exynos_dp_write_byte_to_dpcd( +dp, DP_TEST_RESPONSE, +DP_TEST_EDID_CHECKSUM_WRITE); } } @@ -206,8 +204,7 @@ static int exynos_dp_handle_edid(struct exynos_dp_device *dp) int retval; /* Read DPCD DP_DPCD_REV~RECEIVE_PORT1_CAP_1 */ -retval = exynos_dp_read_bytes_from_dpcd(dp, DP_DPCD_REV, -12, buf); +retval = exynos_dp_read_bytes_from_dpcd(dp, DP_DPCD_REV, 12, buf); if (retval
[RFC PATCH 1/8] drm: exynos/dp: fix code style
make checkpatch.pl script happy Signed-off-by: Yakir Yang y...@rock-chips.com --- drivers/gpu/drm/exynos/exynos_dp_core.c | 224 drivers/gpu/drm/exynos/exynos_dp_core.h | 53 drivers/gpu/drm/exynos/exynos_dp_reg.c | 100 +++--- 3 files changed, 185 insertions(+), 192 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 172b800..a8097a4 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -114,8 +114,8 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) /* Read Extension Flag, Number of 128-byte EDID extension blocks */ retval = exynos_dp_read_byte_from_i2c(dp, I2C_EDID_DEVICE_ADDR, - EDID_EXTENSION_FLAG, - extend_block); + EDID_EXTENSION_FLAG, + extend_block); if (retval) return retval; @@ -123,10 +123,11 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) dev_dbg(dp-dev, EDID data includes a single extension!\n); /* Read EDID data */ - retval = exynos_dp_read_bytes_from_i2c(dp, I2C_EDID_DEVICE_ADDR, - EDID_HEADER_PATTERN, - EDID_BLOCK_LENGTH, - edid[EDID_HEADER_PATTERN]); + retval = + exynos_dp_read_bytes_from_i2c(dp, I2C_EDID_DEVICE_ADDR, + EDID_HEADER_PATTERN, + EDID_BLOCK_LENGTH, + edid[EDID_HEADER_PATTERN]); if (retval != 0) { dev_err(dp-dev, EDID Read failed!\n); return -EIO; @@ -138,11 +139,11 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) } /* Read additional EDID data */ - retval = exynos_dp_read_bytes_from_i2c(dp, - I2C_EDID_DEVICE_ADDR, - EDID_BLOCK_LENGTH, - EDID_BLOCK_LENGTH, - edid[EDID_BLOCK_LENGTH]); + retval = + exynos_dp_read_bytes_from_i2c(dp, I2C_EDID_DEVICE_ADDR, + EDID_BLOCK_LENGTH, + EDID_BLOCK_LENGTH, + edid[EDID_BLOCK_LENGTH]); if (retval != 0) { dev_err(dp-dev, EDID Read failed!\n); return -EIO; @@ -154,24 +155,22 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) } exynos_dp_read_byte_from_dpcd(dp, DP_TEST_REQUEST, - test_vector); + test_vector); if (test_vector DP_TEST_LINK_EDID_READ) { - exynos_dp_write_byte_to_dpcd(dp, - DP_TEST_EDID_CHECKSUM, + exynos_dp_write_byte_to_dpcd( + dp, DP_TEST_EDID_CHECKSUM, edid[EDID_BLOCK_LENGTH + EDID_CHECKSUM]); - exynos_dp_write_byte_to_dpcd(dp, - DP_TEST_RESPONSE, + exynos_dp_write_byte_to_dpcd( + dp, DP_TEST_RESPONSE, DP_TEST_EDID_CHECKSUM_WRITE); } } else { dev_info(dp-dev, EDID data does not include any extensions.\n); /* Read EDID data */ - retval = exynos_dp_read_bytes_from_i2c(dp, - I2C_EDID_DEVICE_ADDR, - EDID_HEADER_PATTERN, - EDID_BLOCK_LENGTH, - edid[EDID_HEADER_PATTERN]); + retval = exynos_dp_read_bytes_from_i2c( + dp, I2C_EDID_DEVICE_ADDR, EDID_HEADER_PATTERN, + EDID_BLOCK_LENGTH, edid[EDID_HEADER_PATTERN]); if (retval != 0) { dev_err(dp-dev, EDID Read failed!\n); return -EIO; @@ -182,16 +181,15 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) return -EIO; } - exynos_dp_read_byte_from_dpcd(dp, - DP_TEST_REQUEST, - test_vector); + exynos_dp_read_byte_from_dpcd(dp, DP_TEST_REQUEST, + test_vector); if (test_vector
[RFC PATCH 4/8] drm: rockchip/dp: add rockchip platform dp driver
Rockchip have three clocks for dp controller, we leave pclk_edp to analogix_dp driver control, and keep the sclk_edp_24m and sclk_edp in platform driver. Signed-off-by: Yakir Yang y...@rock-chips.com --- drivers/gpu/drm/rockchip/Kconfig| 10 + drivers/gpu/drm/rockchip/Makefile | 1 + drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 419 3 files changed, 430 insertions(+) create mode 100644 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig index 35215f6..096ed77 100644 --- a/drivers/gpu/drm/rockchip/Kconfig +++ b/drivers/gpu/drm/rockchip/Kconfig @@ -25,3 +25,13 @@ config ROCKCHIP_DW_HDMI for the Synopsys DesignWare HDMI driver. If you want to enable HDMI on RK3288 based SoC, you should selet this option. + + +config ROCKCHIP_ANALOGIX_DP +tristate Rockchip specific extensions for Analogix DP driver +depends on DRM_ROCKCHIP +select DRM_ANALOGIX_DP +help + This selects support for Rockchip SoC specific extensions + for the Analogix Core DP driver. If you want to enable DP + on RK3288 based SoC, you should selet this option. diff --git a/drivers/gpu/drm/rockchip/Makefile b/drivers/gpu/drm/rockchip/Makefile index f3d8a19..8ad01fb 100644 --- a/drivers/gpu/drm/rockchip/Makefile +++ b/drivers/gpu/drm/rockchip/Makefile @@ -6,5 +6,6 @@ rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o rockchip_drm_fbdev.o \ rockchip_drm_gem.o obj-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o +obj-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o rockchip_drm_vop.o diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c new file mode 100644 index 000..804048c --- /dev/null +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -0,0 +1,419 @@ +/* + * Rockchip SoC DP (Display Port) interface driver. + * + * Copyright (C) Fuzhou Rockchip Electronics Co., Ltd. + * Author: Andy Yan andy@rock-chips.com + * Jeff Chen jeff.c...@rock-chips.com + * Yakir Yang y...@rock-chips.com + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ +#include drm/drmP.h +#include drm/drm_crtc_helper.h +#include drm/drm_panel.h +#include drm/drm_of.h +#include drm/drm_dp_helper.h + +#include linux/component.h +#include linux/clk.h +#include linux/mfd/syscon.h +#include linux/regmap.h +#include linux/reset.h + +#include video/of_videomode.h +#include video/videomode.h + +#include drm/bridge/analogix_dp.h + +#include rockchip_drm_drv.h +#include rockchip_drm_vop.h + +#define encoder_to_dp(c) \ + container_of(c, struct rockchip_dp_device, encoder) + +#define plat_data_to_dp(pd) \ + container_of(pd, struct rockchip_dp_device, plat_data) + +/* dp grf register offset */ +#define DP_VOP_SEL 0x025c /* grf_soc_con6 */ +#define DP_REF_CLK_SEL 0x0274 /* grf_soc_con12 */ + +#define GRF_DP_REF_CLK_SEL_INTERBIT(4) +#define DP_SEL_VOP_LIT BIT(5) + +struct rockchip_dp_device { + struct drm_device*drm_dev; + struct device*dev; + struct drm_encoder encoder; + struct drm_display_mode mode; + + struct clk *clk_dp; + struct clk *clk_24m_parent; + struct clk *clk_24m; + struct regmap*grf; + struct reset_control *rst; + + struct analogix_dp_plat_data plat_data; +}; + +static int rockchip_dp_clk_enable(struct rockchip_dp_device *dp) +{ + int ret = 0; + + ret = clk_prepare_enable(dp-clk_dp); + if (ret 0) { + dev_err(dp-dev, cannot enable clk_dp %d\n, ret); + goto err_clk_dp; + } + + ret = clk_set_rate(dp-clk_24m, 2400); + if (ret 0) { + dev_err(dp-dev, cannot set dp clk_24m %d\n, + ret); + goto err_clk_24m; + } + + ret = clk_prepare_enable(dp-clk_24m); + if (ret 0) { + dev_err(dp-dev, cannot enable dp clk_24m %d\n, + ret); + goto err_clk_24m; + } + + return 0; + +err_clk_24m: + clk_disable_unprepare(dp-clk_dp); +err_clk_dp: + return ret; +} + +static int rockchip_dp_clk_disable(struct rockchip_dp_device *dp) +{ + clk_disable_unprepare(dp-clk_dp); + clk_disable_unprepare(dp-clk_24m); + + return 0; +} + +static int rockchip_dp_pre_init(struct rockchip_dp_device *dp) +{ + u32 val; + int ret
[RFC PATCH 6/8] drm: bridge: analogix_dp: add some rk3288 special registers setting
RK3288 need some special registers setting, we can separate them out by the dev_type of plat_data. Signed-off-by: Yakir Yang y...@rock-chips.com --- drivers/gpu/drm/bridge/analogix_dp_reg.c | 76 drivers/gpu/drm/bridge/analogix_dp_reg.h | 12 + 2 files changed, 60 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix_dp_reg.c index dfbbde7..4d6e08a 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_reg.c +++ b/drivers/gpu/drm/bridge/analogix_dp_reg.c @@ -16,6 +16,8 @@ #include linux/delay.h #include linux/gpio.h +#include drm/bridge/analogix_dp.h + #include analogix_dp_core.h #include analogix_dp_reg.h @@ -73,6 +75,14 @@ void analogix_dp_init_analog_param(struct analogix_dp_device *dp) reg = SEL_24M | TX_DVDD_BIT_1_0625V; writel(reg, dp-reg_base + ANALOGIX_DP_ANALOG_CTL_2); + if (dp-plat_data (dp-plat_data-dev_type == RK3288_DP)) { + writel(REF_CLK_24M, dp-reg_base + ANALOGIX_DP_PLL_REG_1); + writel(0x95, dp-reg_base + ANALOGIX_DP_PLL_REG_2); + writel(0x40, dp-reg_base + ANALOGIX_DP_PLL_REG_3); + writel(0x58, dp-reg_base + ANALOGIX_DP_PLL_REG_4); + writel(0x22, dp-reg_base + ANALOGIX_DP_PLL_REG_5); + } + reg = DRIVE_DVDD_BIT_1_0625V | VCO_BIT_600_MICRO; writel(reg, dp-reg_base + ANALOGIX_DP_ANALOG_CTL_3); @@ -207,81 +217,85 @@ void analogix_dp_set_analog_power_down(struct analogix_dp_device *dp, bool enable) { u32 reg; + u32 phy_pd_addr = ANALOGIX_DP_PHY_PD; + + if (dp-plat_data (dp-plat_data-dev_type == RK3288_DP)) + phy_pd_addr = ANALOGIX_DP_PD; switch (block) { case AUX_BLOCK: if (enable) { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_dp_addr); reg |= AUX_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_dp_addr); } else { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_dp_addr); reg = ~AUX_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_dp_addr); } break; case CH0_BLOCK: if (enable) { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_dp_addr); reg |= CH0_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_dp_addr); } else { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_dp_addr); reg = ~CH0_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_dp_addr); } break; case CH1_BLOCK: if (enable) { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_dp_addr); reg |= CH1_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_dp_addr); } else { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_dp_addr); reg = ~CH1_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_dp_addr); } break; case CH2_BLOCK: if (enable) { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_dp_addr); reg |= CH2_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_dp_addr); } else { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_dp_addr); reg = ~CH2_PD; - writel(reg, dp-reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp-reg_base + phy_dp_addr); } break; case CH3_BLOCK: if (enable) { - reg = readl(dp-reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp-reg_base + phy_dp_addr); reg |= CH3_PD
[RFC PATCH 2/8] drm: exynos/dp: convert to drm bridge mode
In order to move exynos dp code to bridge directory, we need to convert driver drm bridge mode first. As dp driver already have a ptn3460 bridge, so we need to move ptn bridge to the next bridge of dp bridge. Signed-off-by: Yakir Yang y...@rock-chips.com --- drivers/gpu/drm/exynos/exynos_dp_core.c | 196 drivers/gpu/drm/exynos/exynos_dp_core.h | 2 + 2 files changed, 126 insertions(+), 72 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index a8097a4..aa99e23 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -3,6 +3,7 @@ * * Copyright (C) 2012 Samsung Electronics Co., Ltd. * Author: Jingoo Han jg1@samsung.com + * Yakir Yang y...@rock-chips.com * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -998,59 +999,6 @@ static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = { .best_encoder = exynos_dp_best_encoder, }; -/* returns the number of bridges attached */ -static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, - struct drm_encoder *encoder) -{ - int ret; - - encoder-bridge = dp-bridge; - dp-bridge-encoder = encoder; - ret = drm_bridge_attach(encoder-dev, dp-bridge); - if (ret) { - DRM_ERROR(Failed to attach bridge to drm\n); - return ret; - } - - return 0; -} - -static int exynos_dp_create_connector(struct exynos_drm_display *display, - struct drm_encoder *encoder) -{ - struct exynos_dp_device *dp = display_to_dp(display); - struct drm_connector *connector = dp-connector; - int ret; - - dp-encoder = encoder; - - /* Pre-empt DP connector creation if there's a bridge */ - if (dp-bridge) { - ret = exynos_drm_attach_lcd_bridge(dp, encoder); - if (!ret) - return 0; - } - - connector-polled = DRM_CONNECTOR_POLL_HPD; - - ret = drm_connector_init(dp-drm_dev, connector, -exynos_dp_connector_funcs, -DRM_MODE_CONNECTOR_eDP); - if (ret) { - DRM_ERROR(Failed to initialize connector with drm\n); - return ret; - } - - drm_connector_helper_add(connector, exynos_dp_connector_helper_funcs); - drm_connector_register(connector); - drm_mode_connector_attach_encoder(connector, encoder); - - if (dp-panel) - ret = drm_panel_attach(dp-panel, dp-connector); - - return ret; -} - static void exynos_dp_phy_init(struct exynos_dp_device *dp) { if (dp-phy) @@ -1115,23 +1063,126 @@ static void exynos_dp_poweroff(struct exynos_dp_device *dp) } } -static void exynos_dp_dpms(struct exynos_drm_display *display, int mode) +/* returns the number of bridges attached */ +static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, + struct drm_encoder *encoder) +{ + int ret; + + dp-bridge-next = dp-ptn_bridge; + dp-bridge-encoder = encoder; + ret = drm_bridge_attach(encoder-dev, dp-bridge); + if (ret) { + DRM_ERROR(Failed to attach ptn bridge to drm\n); + return ret; + } + + return 0; +} + +static int exynos_dp_bridge_attach(struct drm_bridge *bridge) +{ + + struct exynos_dp_device *dp = bridge-driver_private; + struct drm_encoder *encoder = dp-encoder; + struct drm_connector *connector = dp-connector; + int ret; + + if (!bridge-encoder) { + DRM_ERROR(Parent encoder object not found); + return -ENODEV; + } + + encoder-bridge = bridge; + + /* Pre-empt DP connector creation if there's a bridge */ + if (dp-ptn_bridge) { + ret = exynos_drm_attach_lcd_bridge(dp, encoder); + if (ret) + return -ENODEV; + } + + connector-polled = DRM_CONNECTOR_POLL_HPD; + + ret = drm_connector_init(dp-drm_dev, connector, + exynos_dp_connector_funcs, DRM_MODE_CONNECTOR_eDP); + if (ret) { + DRM_ERROR(Failed to initialize connector with drm\n); + return ret; + } + + drm_connector_helper_add(connector, exynos_dp_connector_helper_funcs); + drm_connector_register(connector); + drm_mode_connector_attach_encoder(connector, encoder); + + if (dp-panel) + ret = drm_panel_attach(dp-panel, dp-connector); + + return ret; +} + +static void exynos_dp_bridge_nop(struct drm_bridge *bridge) +{ + /* do nothing */ +} + +static void exynos_dp_bridge_enable(struct drm_bridge *bridge) +{ + struct exynos_dp_device *dp
Re: [RFC PATCH 2/8] drm: exynos/dp: convert to drm bridge mode
Hi Jingoo, 在 2015/8/6 22:19, Jingoo Han 写道: On Thursday, August 06, 2015 11:07 PM, Yakir Yang wrote: In order to move exynos dp code to bridge directory, we need to convert driver drm bridge mode first. As dp driver already have a ptn3460 bridge, so we need to move ptn bridge to the next bridge of dp bridge. Signed-off-by: Yakir Yang y...@rock-chips.com --- drivers/gpu/drm/exynos/exynos_dp_core.c | 196 drivers/gpu/drm/exynos/exynos_dp_core.h | 2 + 2 files changed, 126 insertions(+), 72 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index a8097a4..aa99e23 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -3,6 +3,7 @@ * * Copyright (C) 2012 Samsung Electronics Co., Ltd. * Author: Jingoo Han jg1@samsung.com + * Yakir Yang y...@rock-chips.com Please don't add this. You just fixed some parts of this code. I don't find the reason why you have to be added to author for this file. If you want the title for an author, please send the patch for a new IP, instead of modifying the exiting codes. Okay, thanks for your remind ;) [...] MODULE_AUTHOR(Jingoo Han jg1@samsung.com); +MODULE_AUTHOR(Yakir Yang y...@rock-chips.com); The same as above. Done MODULE_DESCRIPTION(Samsung SoC DP Driver); MODULE_LICENSE(GPL v2); diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h index c321ad5..f2584b8 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.h +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h @@ -3,6 +3,7 @@ * * Copyright (C) 2012 Samsung Electronics Co., Ltd. * Author: Jingoo Han jg1@samsung.com + * Yakir Yang y...@rock-chips.com The same as above. Here, you just added 1 line. If we add someone to author in this way, a lot of people should be added to author. Done - Yakir Best regards, Jingoo Han -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH 8/8] drm: bridge/analogix_dp: expand the delay time for hpd detect
Some edp screen with no hpd signal would need some delay time to ensure that screen would be ready for work, so we can expand the delay time in hpd detect function, it works prefectly on my rk3288 sdk board. Signed-off-by: Yakir Yang y...@rock-chips.com --- drivers/gpu/drm/bridge/analogix_dp_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix_dp_core.c index 7e67f19..447c94d 100644 --- a/drivers/gpu/drm/bridge/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix_dp_core.c @@ -73,7 +73,7 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device *dp) return 0; timeout_loop++; - usleep_range(10, 11); + usleep_range(100, 110); } /* -- 2.1.2 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH 3/8] drm: bridge: analogix_dp: split exynos dp driver to bridge dir
Jingoo, 在 2015/8/6 22:33, Jingoo Han 写道: On Thursday, August 06, 2015 11:19 PM, Yakir Yang wrote: Split the dp core driver from exynos directory to bridge directory, and rename the core driver to analogix_dp_*, leave the platform code to analogix_dp-exynos. Signed-off-by: Yakir Yang y...@rock-chips.com --- drivers/gpu/drm/bridge/Kconfig |5 + drivers/gpu/drm/bridge/Makefile|1 + .../exynos_dp_core.c = bridge/analogix_dp_core.c} | 751 +--- drivers/gpu/drm/bridge/analogix_dp_core.h | 286 + drivers/gpu/drm/bridge/analogix_dp_reg.c | 1266 .../exynos_dp_reg.h = bridge/analogix_dp_reg.h} | 260 ++-- drivers/gpu/drm/exynos/Kconfig |5 +- drivers/gpu/drm/exynos/Makefile|2 +- drivers/gpu/drm/exynos/analogix_dp-exynos.c| 240 drivers/gpu/drm/exynos/exynos_dp_core.h| 283 - include/drm/bridge/analogix_dp.h | 22 + 11 files changed, 2287 insertions(+), 834 deletions(-) rename drivers/gpu/drm/{exynos/exynos_dp_core.c = bridge/analogix_dp_core.c} (54%) create mode 100644 drivers/gpu/drm/bridge/analogix_dp_core.h create mode 100644 drivers/gpu/drm/bridge/analogix_dp_reg.c rename drivers/gpu/drm/{exynos/exynos_dp_reg.h = bridge/analogix_dp_reg.h} (63%) create mode 100644 drivers/gpu/drm/exynos/analogix_dp-exynos.c delete mode 100644 drivers/gpu/drm/exynos/exynos_dp_core.h create mode 100644 include/drm/bridge/analogix_dp.h [...] rename from drivers/gpu/drm/exynos/exynos_dp_core.c rename to drivers/gpu/drm/bridge/analogix_dp_core.c index aa99e23..28724d4 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix_dp_core.c @@ -1,7 +1,8 @@ /* - * Samsung SoC DP (Display Port) interface driver. + * Analogix Core DP (Display Port) interface driver. * * Copyright (C) 2012 Samsung Electronics Co., Ltd. + * Copyright (C) FuZhou Rockchip Electronics Co., Ltd. What is the reason to add this copyright? You just replace 'exynos' prefix with 'analogix' prefix. I cannot find the reason to add the copyright. Oh! Thanks for your point out, sorry for this one - Yakir * -- 2.1.2 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH 0/8] Add Analogix Core Display Port Driver
Jingoo, 在 2015/8/6 22:41, Jingoo Han 写道: On Thursday, August 06, 2015 10:49 PM, Yakir Yang wrote: Hi all, Samsung exynos and Rockchip rk3288 almost share same dp controller, so I split the common code out, then rk3288 and exynos can re-used the same dp core driver. Cause I can't find the exact IP name of exynos dp controller, so I decide to name dp core driver with analogix which I find in rk3288 eDP TRM ;) OK, I see. The Samsung Exynos eDP contoller and Rockchip rk3288 eDP contoller share the same IP. So, a lot of parts can be re-used. I agree with this. However, we have to review the code carefully, as others did. Yeah, feel happy to be reviewed ;) I also cannot find the exact IP name. The analogix may be the vendor name of this IP. Okay, so analogix is okay for now Thanks, - Yakir Best regards, Jingoo Han Beyond that, there are three light registers setting differents bewteen exynos and rk3288. 1. RK3288 have five special pll resigters which not indicata in exynos dp controller. 2. The address of DP_PHY_PD(dp phy power manager register) are different between rk3288 and exynos. 3. Rk3288 and exynos have different setting with AUX_HW_RETRY_CTL(dp debug register). My series patches can be divider into two parts: One for spliting the analogix_dp code from exynos dp driver. Another are trying to add rk3288 dp driver support. Best regards, - Yakir -- 2.1.2 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH 1/8] drm: exynos/dp: fix code style
Joe, 在 2015/8/6 23:05, Joe Perches 写道: On Thu, 2015-08-06 at 09:04 -0500, Yakir Yang wrote: make checkpatch.pl script happy That should not be the primary reason to submit a patch. Making it easier for human code reader to understand what the code does should be though. Thanks for your reply, but I do think that fix code style and make checkpatch.pl passed is my primary reason to submit this patch. I can't think out more directly words ;( , diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c [] @@ -123,10 +123,11 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) dev_dbg(dp-dev, EDID data includes a single extension!\n); /* Read EDID data */ - retval = exynos_dp_read_bytes_from_i2c(dp, I2C_EDID_DEVICE_ADDR, - EDID_HEADER_PATTERN, - EDID_BLOCK_LENGTH, - edid[EDID_HEADER_PATTERN]); + retval = + exynos_dp_read_bytes_from_i2c(dp, I2C_EDID_DEVICE_ADDR, + EDID_HEADER_PATTERN, + EDID_BLOCK_LENGTH, + edid[EDID_HEADER_PATTERN]); This is a relatively uncommon style. Because the code uses relatively long variable and function names as well as longish macro #defines, prefer to ignore the 80 column limit. Okay, I think it would be better to modify like those: retval = exynos_dp_read_bytes_from_i2c( dp, I2C_EDID_DEVICE_ADDR, EDID_HEADER_PATTERN, EDID_BLOCK_LENGTH, edid[EDID_HEADER_PATTERN]); Is it okay ? - Yakir -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp
在 2015/8/24 22:48, Rob Herring 写道: On Mon, Aug 24, 2015 at 7:57 AM, Russell King - ARM Linux li...@arm.linux.org.uk wrote: On Sun, Aug 23, 2015 at 06:23:14PM -0500, Rob Herring wrote: On Wed, Aug 19, 2015 at 9:50 AM, Yakir Yang y...@rock-chips.com wrote: + -analogix,color-depth: + number of bits per colour component. + COLOR_6 = 0, COLOR_8 = 1, COLOR_10 = 2, COLOR_12 = 3 This seems pretty generic. Just use 6, 8, 10, or 12 for values. And drop the vendor prefix. Please think about this some more. What does color-depth mean? Does it mean the number of bits per colour _component_, or does it mean the total number of bits to represent a particular colour. It's confusing as it stands. Then component-color-bpp perhaps? Actually this color-bpp should come from crtc driver, maybe should come from struct drm_crtc {. Like rockchip stuffs, analogix_dp-rockchip call an mode_config from rockchip_drm_vop driver and set output mode to RGB[10:10:10], then vop driver just store the output mode type to the private struct vop-connecot_out_mode. do think that this outmode should store into crtc, not just come from DT prop. - Yakir -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp
Hi Heiko, 在 2015/8/24 21:03, Heiko Stuebner 写道: Hi Yakir, Am Montag, 24. August 2015, 20:48:01 schrieb Yakir Yang: 在 08/24/2015 12:20 PM, Krzysztof Kozlowski 写道: On 24.08.2015 11:42, Yakir Yang wrote: Hi Krzysztof, 在 08/23/2015 07:43 PM, Krzysztof Kozlowski 写道: 2015-08-24 8:23 GMT+09:00 Rob Herring robherri...@gmail.com: On Wed, Aug 19, 2015 at 9:50 AM, Yakir Yang y...@rock-chips.com wrote: Analogix dp driver is split from exynos dp driver, so we just make an copy of exynos_dp.txt, and then simplify exynos_dp.txt Beside update some exynos dtsi file with the latest change according to the devicetree binding documents. You can't just change the exynos bindings and break compatibility. Is there some agreement with exynos folks to do this? No, there is no agreement. This wasn't even sent to Exynos maintainers. Sorry about this one, actually I have add Exynos maintainers in version 1 version 2, but lose some maintainers in version 3, I would fix it in bellow versions. Additionally the patchset did not look interesting to me because of misleading subject - Documentation instead of ARM: dts:. Yakir, please: 1. Provide backward compatibility. Mark old properties as deprecated but still support them. Do you mean that I should keep the old properties declare in exynos-dp.txt, but just mark them as deprecated flag. That is one of ways how to do this. However more important is that driver should still support old bindings so such code: - if (of_property_read_u32(dp_node, samsung,color-space, + if (of_property_read_u32(dp_node, analogix,color-space, is probably wrong. Will the driver support old DTB in the same way as it was supporting before the change? Okay, I got your means. So document is not the focus, the most important is that driver should support the old dts prop. If so the new analogix dp driver should keep the samsung,color-space, rather then just mark it with [DEPRECATED] flag. But from your follow suggest, I think you agree to update driver code, and just mark old prop with deprecated flag. If so I think such code would not be wrong - if (of_property_read_u32(dp_node, samsung,color-space, + if (of_property_read_u32(dp_node, analogix,color-space, In a generic driver, the property should have either none, or the analogix prefix. But DT-properties need to be backwards compatible, meaning an older Exynos devicetree should run unmodified with a newer kernel. So the common course of action is to mark the old one as deprecated but still test for both, so something like: if (of_property_read_u32(dp_node, analogix,color-space, dp_video_config-color_space)) if (of_property_read_u32(dp_node, samsung,color-space, dp_video_config-color_space)) { dev_err(dev, failed to get color-space\n); return ERR_PTR(-EINVAL); } Wow, thanks a lot for your explain and code, it do help me to understand this suggest rightly :-) Thanks, - Yakir -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp
Hi Krzysztof, 在 2015/8/25 7:49, Krzysztof Kozlowski 写道: On 24.08.2015 21:48, Yakir Yang wrote: Hi Krzysztof, 在 08/24/2015 12:20 PM, Krzysztof Kozlowski 写道: On 24.08.2015 11:42, Yakir Yang wrote: Hi Krzysztof, 在 08/23/2015 07:43 PM, Krzysztof Kozlowski 写道: 2015-08-24 8:23 GMT+09:00 Rob Herring robherri...@gmail.com: On Wed, Aug 19, 2015 at 9:50 AM, Yakir Yang y...@rock-chips.com wrote: Analogix dp driver is split from exynos dp driver, so we just make an copy of exynos_dp.txt, and then simplify exynos_dp.txt Beside update some exynos dtsi file with the latest change according to the devicetree binding documents. You can't just change the exynos bindings and break compatibility. Is there some agreement with exynos folks to do this? No, there is no agreement. This wasn't even sent to Exynos maintainers. Sorry about this one, actually I have add Exynos maintainers in version 1 version 2, but lose some maintainers in version 3, I would fix it in bellow versions. Additionally the patchset did not look interesting to me because of misleading subject - Documentation instead of ARM: dts:. Yakir, please: 1. Provide backward compatibility. Mark old properties as deprecated but still support them. Do you mean that I should keep the old properties declare in exynos-dp.txt, but just mark them as deprecated flag. That is one of ways how to do this. However more important is that driver should still support old bindings so such code: - if (of_property_read_u32(dp_node, samsung,color-space, + if (of_property_read_u32(dp_node, analogix,color-space, is probably wrong. Will the driver support old DTB in the same way as it was supporting before the change? Okay, I got your means. So document is not the focus, the most important is that driver should support the old dts prop. Right, the focus is on the driver. If so the new analogix dp driver should keep the samsung,color-space, rather then just mark it with [DEPRECATED] flag. If you are replacing a binding/property then it should be marked deprecated. This means that the old property is still working but new users of it should not be added. Okay, so just quote Heiko's reply, such code would be need in analogix dp driver. if (of_property_read_u32(dp_node, analogix,color-space, dp_video_config-color_space)) if (of_property_read_u32(dp_node, samsung,color-space, dp_video_config-color_space)) { dev_err(dev, failed to get color-space\n); return ERR_PTR(-EINVAL); } But from your follow suggest, I think you agree to update driver code, and just mark old prop with deprecated flag. If so I think such code would not be wrong - if (of_property_read_u32(dp_node, samsung,color-space, + if (of_property_read_u32(dp_node, analogix,color-space, It looks wrong because it breaks backward compatibility with existing DTB. As I said before: 1. Provide backward compatibility. Mark old properties as deprecated but still support them. And actually @Rob have suggest me to remove the prefix, just use color-space here. For new bindings I don't mind. But please remember about existing users, existing DTB and bisectability. Let me show same examples, make me understand your suggest rightly. exynos-dp already contains deprecated properties. Other ways of doing this would be: Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt Documentation/devicetree/bindings/rtc/s3c-rtc.txt It depends up to you. The touchscreen looks good because it organizes old properties in a common section. In case of exynos-dp.txt you can add at beginning of file information about new bindings and mark everything deprecated. Whoops, thanks for your remind, I prefer the touchscreen style. 1. samsung,ycbcr-coeff is abandoned in latest analogix-dp driver, absolutely I should not carry this to analogix-dp.txt document. But I should keep this in exynos-dp.txt document, and mark them with an little deprecated flag. [Documentation/devicetree/bindings/video/exynos_dp.txt] Required properties for dp-controller: [...] -samsung,ycbcr-coeff (DEPRECATED): YCbCr co-efficients for input video. COLOR_YCBCR601 = 0, COLOR_YCBCR709 = 1 Is it right ? Yes, this is right. 2. Separate all DTS changes to a separate patch, unless bisectability would be hurt. Anyway you should prepare it in a such way that separation would be possible without breaking bisectability. So I should separate this patch into two parts, one is name Document:, the other is ARM: dts: . Yes. Honestly, I don't understand what the bisectability means in this case. I was referring to bisectability in general. The patchset should be fully bisectable which means that it does not introduce any issues during git bisect. This effectively means that at each intermediate step (after applying
Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp
Hi Thierry, 在 2015/8/25 22:16, Thierry Reding 写道: On Tue, Aug 25, 2015 at 09:48:01PM +0800, Yakir Yang wrote: Hi Thierry Rob, 在 2015/8/25 21:27, Rob Herring 写道: On Tue, Aug 25, 2015 at 4:15 AM, Thierry Reding tred...@nvidia.com wrote: On Sun, Aug 23, 2015 at 06:23:14PM -0500, Rob Herring wrote: On Wed, Aug 19, 2015 at 9:50 AM, Yakir Yang y...@rock-chips.com wrote: [...] + -analogix,link-rate: + max link rate supported by the eDP controller. + LINK_RATE_1_62GBPS = 0x6, LINK_RATE_2_70GBPS = 0x0A, + LINK_RATE_5_40GBPS = 0x14 Same here. I'd rather see something like link-rate-mbps and use the actual rate. There is no need whatsoever to hard-code this in DT. (e)DP provides the means to detect what rate the link supports and the specification provides guidance on how to select an appropriate one. Good, even better. I do think we still need keep this DT prop yet. I think drm_dp_help.c could get the panel max link-rate and lane-count, but it's not enough, we still need knew the eDP controller max link-rate and lane-count. Let me show the exact example that happened in my side. When I connect my board to my 2K DP-1.2 TV. Analogix dp driver would get the max link-rate from dpcd, and the max link-rate is 5.4Gbps. So if I just set eDP controller link-rate to 5.4Gbps, the DP TV just broken, do not light up normally. This reason why TV broken is the max link-rate which support by RK3288 eDP controller is 2.7Gbps. Here are the exact words that RK3288 eDP TRM said: *Compliant with DisplayPortTM Specification, Version 1.2. Compliant with eDPTM Specification, Version 1.3. HDCP v1.3 amendment for DisplayPortTM Revision 1.0. Main link containing 4 physical lanes of 2.7/1.62 Gbps/lane * ** Beside I haven't found there are some registers would indicate the eDP controller max link-rate and lane-count, so this is why I still instance that we need this DT prop to indicata Max rate controller support. So, I wish you could agree with me on this point. Your driver should know what link rates it supports and restrict itself to use those. This is implied by the compatible string and doesn't need to be duplicated into device tree. Oh, yeah, good idea :-D Thanks for your point out. - Yakir Thierry -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp
Hi Thierry, 在 2015/8/25 17:58, Thierry Reding 写道: On Wed, Aug 19, 2015 at 09:50:34AM -0500, Yakir Yang wrote: [...] + -analogix,color-space: + input video data format. + COLOR_RGB = 0, COLOR_YCBCR422 = 1, COLOR_YCBCR444 = 2 I don't think DT is an appropriate place to set this. To my knowledge this depends on the display and/or mode, so I don't think hard-coding it here is the right thing to do. Yeah, same question with my previous reply ;) Thanks, - Yakir Thierry -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp
Hi Thierry, 在 2015/8/25 18:06, Thierry Reding 写道: On Tue, Aug 25, 2015 at 05:41:19PM +0800, Yakir Yang wrote: Hi Thierry, 在 2015/8/25 17:12, Thierry Reding 写道: On Mon, Aug 24, 2015 at 09:48:27AM -0500, Rob Herring wrote: On Mon, Aug 24, 2015 at 7:57 AM, Russell King - ARM Linux li...@arm.linux.org.uk wrote: On Sun, Aug 23, 2015 at 06:23:14PM -0500, Rob Herring wrote: On Wed, Aug 19, 2015 at 9:50 AM, Yakir Yang y...@rock-chips.com wrote: + -analogix,color-depth: + number of bits per colour component. + COLOR_6 = 0, COLOR_8 = 1, COLOR_10 = 2, COLOR_12 = 3 This seems pretty generic. Just use 6, 8, 10, or 12 for values. And drop the vendor prefix. Please think about this some more. What does color-depth mean? Does it mean the number of bits per colour _component_, or does it mean the total number of bits to represent a particular colour. It's confusing as it stands. Then component-color-bpp perhaps? There should be no need to have this in DT at all. The BPC is a property of the attached panel and it should come from the panel (either the panel driver or parsed from EDID if available). Actually I have send an email about this one to you in version 2, just past from that email: samsung,color_space and samsung,color-depth The drm_display_info's color_formats and bpc indicate the monitor display ability, but the edp driver could not take it as input video format directly. For example, with my DP TV I would found RGB444 YCRCB422 YCRCB444 support in drm_display_info.color_formats and 16bit bpc support, but RK3288 crtc driver could only output RGB ITU formats, so finally analogix_dp-rockchip driver config crtc to RGBaaa 10bpc mode. In this sutiation, the analogix_dp core driver would pazzled by the drm_display_info, can't chose the right color_space and bpc. And this is the place that confused me, wish you could give some ideas about this one :-) Your display driver should choose whatever it is capable of outputting. If the display reports that it can do 16 bits-per-color, but your display driver can't do it, then it should choose a configuration that it supports. Similarily for the color encodings. If you can't generate YCrCb444 with your hardware, then it's the driver's job to know about that and select the next appropriate configuration. But hard-coding this is not the right solution because the value in DT may end up conflicting with what the display reports. Yeah, thanks for your explain, you are right. It's the best way to get color-depth and color-space from display driver, not to hard-code in DT prop. But if the common analogix-dp driver want to get those values, then those values should come from the common drm struct data. Personally I think struct drm_crtc is the best place that should indicate the output ability of SoC vop/lcdc. But I haven't find out there are some place to store those message for now (I don't think it's good to modify the original color-space and color-bpc which parsed from monitor edid). So could you share sme ideas about this, and I would rather to talk with Mark (Author of rockchip drm driver) to find out the better way to fix this one. Besides, I would appreciate very much if you can share some ideas about how Exynos handler with this problem ;) Thanks, - Yakir Thierry -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v7 0/17] Add Analogix Core Display Port Driver
,grf explain in document, and correct the clock required elemets in document. (Rob & Heiko) - Fix compiled error (Heiko) - Using the connector display info message to configure eDP driver input video mode, but hard code CRTC video output mode to RGBaaa. Changes in v4: - Update "analogix,hpd-gpios" to "hpd-gpios" DT propery. (Rob) - Rename "analogix_dp-exynos.c" file name to "exynos_dp.c" (Jingoo) - Create a separate folder for analogix code in bridge/ (Archit) - Update commit message more readable. (Jingoo) - Adjust the order from 05 to 04 - Provide backword compatibility with samsung. (Krzysztof) - Split all DTS changes, and provide backward compatibility. Mark old properties as deprecated but still support them. (Krzysztof) - Update "analogix,hpd-gpio" to "hpd-gpios" prop name. (Rob) - Deprecated some properties which could parsed from Edid/Mode/DPCD. (Thierry) "analogix,color-space" & "analogix,color-depth" & "analogix,link-rate" & "analogix,lane-count"& "analogix,ycbcr-coeff" & "analogix,dynamic-range" & "vsync-active-high"& "hsync-active-high" & "interlaces" - Separate all DTS changes to a separate patch. (Krzysztof) - Remove some deprecated DT properties in rockchip dp document. - Add commit message, and remove the redundant rockchip_dp_phy_init() function, move those code to probe() method. And remove driver .owner number. (Kishon) - Seprate the link-rate and lane-count limit out with the device_type flag. (Thierry) - Take Jingoo suggest, add commit messages. - Call drm_panel_prepare() in .get_modes function, ensure panel should power on before driver try to read edid message. Changes in v3: - Move exynos's video_timing code to analogix_dp-exynos platform driver, add get_modes method to struct analogix_dp_plat_data. (Thierry) - Rename some "samsung*" dts propery to "analogix*". (Heiko) - The link_rate and lane_count shouldn't config to the DT property value directly, but we can take those as hardware limite. For example, RK3288 only support 4 physical lanes of 2.7/1.62 Gbps/lane, so DT property would like "link-rate = 0x0a" "lane-count = 4". (Thierry) - Dynamic parse video timing info from struct drm_display_mode and struct drm_display_info. (Thierry) - Add devicetree binding documents. (Heiko) - Remove sync pol & colorimetry properies from the new analogix dp driver devicetree binding. (Thierry) - Update the exist exynos dtsi file with the latest DP DT properies. - Leave "sclk_edp_24m" to rockchip dp phy driver which name to "24m", and leave "sclk_edp" to analogix dp core driver which name to "dp", and leave "pclk_edp" to rockchip dp platform driver which name to "pclk". (Thierry & Heiko) - Add devicetree binding document. (Heiko) - Remove "rockchip,panel" DT property, take use of remote point to get panel node. (Heiko) - Add the new function point dp_platdata->get_modes() init. - Suggest, add rockchip dp phy driver, collect the phy clocks and power control. (Heiko) - Add "analogix,need-force-hpd" to indicate whether driver need foce hpd when hpd detect failed. - move dp hpd detect to connector detect function. - Add edid modes parse support Changes in v2: - Keep author name list no changed (Jingoo) - Remove new copyright (Jingoo) - Fix compiled failed due to analogix_dp_device misspell - Improved commit message more readable, and avoid using some uncommon style like bellow: (Joe Preches) - retval = exynos_dp_read_bytes_from_i2c(... ...); + retval = + exynos_dp_read_bytes_from_i2c(..); - Get panel node with remote-endpoint method, and create devicetree binding for driver. (Heiko) - Remove the clock enable/disbale with "sclk_edp" & "sclk_edp_24m", leave those clock to rockchip dp phy driver. - Fix compile failed dut to phy_pd_addr variable misspell error Mark Yao (1): drm: rockchip: vop: add bpc and color mode setting Yakir Yang (16): drm: exynos: dp: convert to drm bridge mode drm: bridge: analogix/dp: split exynos dp driver to bridge directory drm: bridge: analogix/dp: fix some obvious code style drm: bridge: analogix/dp: remove duplicate configuration of link rate and link count drm: bridge: analogix/dp: dynamic parse sync_pol & interlace & dynamic_range Documentation: drm/bridge: add document for analogix_dp ARM: dts: exynos/dp: remove some properties that deprecated by analogix_dp driver drm: rockchip: dp: add rockchip platform dp driver Documentation: drm/bridge: add document for analogix_dp phy: Add driver for rockchip Display Port PHY Documentation: phy: add document for rockc
[PATCH v7 04/17] drm: bridge: analogix/dp: remove duplicate configuration of link rate and link count
link_rate and lane_count already configured in analogix_dp_set_link_train(), so we don't need to config those repeatly after training finished, just remove them out. Beside Display Port 1.2 already support 5.4Gbps link rate, the maximum sets would change from {1.62Gbps, 2.7Gbps} to {1.62Gbps, 2.7Gbps, 5.4Gbps}. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: - Update commit message more readable. (Jingoo) - Adjust the order from 05 to 04 Changes in v3: - The link_rate and lane_count shouldn't config to the DT property value directly, but we can take those as hardware limite. For example, RK3288 only support 4 physical lanes of 2.7/1.62 Gbps/lane, so DT property would like "link-rate = 0x0a" "lane-count = 4". (Thierry) Changes in v2: None drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 8 drivers/gpu/drm/bridge/analogix/analogix_dp_core.h | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 334181c..96afb67 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -624,6 +624,8 @@ static void analogix_dp_get_max_rx_bandwidth(struct analogix_dp_device *dp, /* * For DP rev.1.1, Maximum link rate of Main Link lanes * 0x06 = 1.62 Gbps, 0x0a = 2.7 Gbps +* For DP rev.1.2, Maximum link rate of Main Link lanes +* 0x06 = 1.62 Gbps, 0x0a = 2.7 Gbps, 0x14 = 5.4Gbps */ analogix_dp_read_byte_from_dpcd(dp, DP_MAX_LINK_RATE, ); *bandwidth = data; @@ -657,7 +659,8 @@ static void analogix_dp_init_training(struct analogix_dp_device *dp, analogix_dp_get_max_rx_lane_count(dp, >link_train.lane_count); if ((dp->link_train.link_rate != LINK_RATE_1_62GBPS) && - (dp->link_train.link_rate != LINK_RATE_2_70GBPS)) { + (dp->link_train.link_rate != LINK_RATE_2_70GBPS) && + (dp->link_train.link_rate != LINK_RATE_5_40GBPS)) { dev_err(dp->dev, "Rx Max Link Rate is abnormal :%x !\n", dp->link_train.link_rate); dp->link_train.link_rate = LINK_RATE_1_62GBPS; @@ -898,9 +901,6 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) analogix_dp_enable_rx_to_enhanced_mode(dp, 1); analogix_dp_enable_enhanced_mode(dp, 1); - analogix_dp_set_lane_count(dp, dp->video_info->lane_count); - analogix_dp_set_link_bandwidth(dp, dp->video_info->link_rate); - analogix_dp_init_video(dp); ret = analogix_dp_config_video(dp); if (ret) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h index 14d20be..9a90a18 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h @@ -21,8 +21,9 @@ #define MAX_EQ_LOOP 5 enum link_rate_type { - LINK_RATE_1_62GBPS = 0x06, - LINK_RATE_2_70GBPS = 0x0a + LINK_RATE_1_62GBPS = DP_LINK_BW_1_62, + LINK_RATE_2_70GBPS = DP_LINK_BW_2_7, + LINK_RATE_5_40GBPS = DP_LINK_BW_5_4, }; enum link_lane_count_type { -- 2.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v7 05/17] drm: bridge: analogix/dp: dynamic parse sync_pol & interlace & dynamic_range
Both hsync/vsync polarity and interlace mode can be parsed from drm display mode, and dynamic_range and ycbcr_coeff can be judge by the video code. But presumably Exynos still relies on the DT properties, so take good use of mode_fixup() in to achieve the compatibility hacks. Reviewed-by: Krzysztof Kozlowski <k.kozlow...@samsung.com> Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v7: - Back to use the of_property_read_bool() interfacs to provoid backward compatibility of "hsync-active-high" "vsync-active-high" "interlaced" to avoid -EOVERFLOW error (Krzysztof) Changes in v6: None Changes in v5: - Switch video timing type to "u32", so driver could use "of_property_read_u32" to get the backword timing values. Krzysztof suggest me that driver could use the "of_property_read_bool" to get backword timing values, but that interfacs would modify the original drm_display_mode timing directly (whether those properties exists or not). Changes in v4: - Provide backword compatibility with samsung. (Krzysztof) Changes in v3: - Dynamic parse video timing info from struct drm_display_mode and struct drm_display_info. (Thierry) Changes in v2: None drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 148 + drivers/gpu/drm/bridge/analogix/analogix_dp_core.h | 2 +- drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 14 +- 3 files changed, 103 insertions(+), 61 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 96afb67..6307060 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -890,8 +890,8 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) return; } - ret = analogix_dp_set_link_train(dp, dp->video_info->lane_count, -dp->video_info->link_rate); + ret = analogix_dp_set_link_train(dp, dp->video_info.lane_count, +dp->video_info.link_rate); if (ret) { dev_err(dp->dev, "unable to do link train\n"); return; @@ -1030,6 +1030,85 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge) dp->dpms_mode = DRM_MODE_DPMS_OFF; } +static void analogix_dp_bridge_mode_set(struct drm_bridge *bridge, + struct drm_display_mode *orig_mode, + struct drm_display_mode *mode) +{ + struct analogix_dp_device *dp = bridge->driver_private; + struct drm_display_info *display_info = >connector->display_info; + struct video_info *video = >video_info; + struct device_node *dp_node = dp->dev->of_node; + int vic; + + /* Input video interlaces & hsync pol & vsync pol */ + video->interlaced = !!(mode->flags & DRM_MODE_FLAG_INTERLACE); + video->v_sync_polarity = !!(mode->flags & DRM_MODE_FLAG_NVSYNC); + video->h_sync_polarity = !!(mode->flags & DRM_MODE_FLAG_NHSYNC); + + /* Input video dynamic_range & colorimetry */ + vic = drm_match_cea_mode(mode); + if ((vic == 6) || (vic == 7) || (vic == 21) || (vic == 22) || + (vic == 2) || (vic == 3) || (vic == 17) || (vic == 18)) { + video->dynamic_range = CEA; + video->ycbcr_coeff = COLOR_YCBCR601; + } else if (vic) { + video->dynamic_range = CEA; + video->ycbcr_coeff = COLOR_YCBCR709; + } else { + video->dynamic_range = VESA; + video->ycbcr_coeff = COLOR_YCBCR709; + } + + /* Input vide bpc and color_formats */ + switch (display_info->bpc) { + case 12: + video->color_depth = COLOR_12; + break; + case 10: + video->color_depth = COLOR_10; + break; + case 8: + video->color_depth = COLOR_8; + break; + case 6: + video->color_depth = COLOR_6; + break; + default: + video->color_depth = COLOR_8; + break; + } + if (display_info->color_formats & DRM_COLOR_FORMAT_YCRCB444) + video->color_space = COLOR_YCBCR444; + else if (display_info->color_formats & DRM_COLOR_FORMAT_YCRCB422) + video->color_space = COLOR_YCBCR422; + else if (display_info->color_formats & DRM_COLOR_FORMAT_RGB444) + video->color_space = COLOR_RGB; + else + video->color_space = COLOR_RGB; + + /* +* NOTE: those propert
[PATCH v7 01/17] drm: exynos: dp: convert to drm bridge mode
In order to move exynos dp code to bridge directory, we need to convert driver drm bridge mode first. As dp driver already have a ptn3460 bridge, so we need to move ptn bridge to the next bridge of dp bridge. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v7: None Changes in v6: - Fix the wrong code in previous series, and test on Samsung snow Chromebook successfully, here are the detail changes: => - if (!dp->panel && !dp->bridge) { + if (!dp->panel && !dp->ptn_bridge) { ret = exynos_dp_dt_parse_panel(dp); if (ret) => + encoder->bridge = bridge; bridge->driver_private = dp; bridge->encoder = encoder; bridge->funcs = _dp_bridge_funcs; ret = drm_bridge_attach(drm_dev, bridge); Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: - Keep author name list no changed (Jingoo) drivers/gpu/drm/exynos/exynos_dp_core.c | 103 drivers/gpu/drm/exynos/exynos_dp_core.h | 1 + 2 files changed, 78 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 124fb9a..aedd074 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -1009,9 +1009,9 @@ static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, { int ret; - encoder->bridge = dp->bridge; - dp->bridge->encoder = encoder; - ret = drm_bridge_attach(encoder->dev, dp->bridge); + encoder->bridge->next = dp->ptn_bridge; + dp->ptn_bridge->encoder = encoder; + ret = drm_bridge_attach(encoder->dev, dp->ptn_bridge); if (ret) { DRM_ERROR("Failed to attach bridge to drm\n"); return ret; @@ -1020,14 +1020,15 @@ static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, return 0; } -static int exynos_dp_create_connector(struct drm_encoder *encoder) +static int exynos_dp_bridge_attach(struct drm_bridge *bridge) { - struct exynos_dp_device *dp = encoder_to_dp(encoder); + struct exynos_dp_device *dp = bridge->driver_private; + struct drm_encoder *encoder = >encoder; struct drm_connector *connector = >connector; int ret; /* Pre-empt DP connector creation if there's a bridge */ - if (dp->bridge) { + if (dp->ptn_bridge) { ret = exynos_drm_attach_lcd_bridge(dp, encoder); if (!ret) return 0; @@ -1052,22 +1053,9 @@ static int exynos_dp_create_connector(struct drm_encoder *encoder) return ret; } -static bool exynos_dp_mode_fixup(struct drm_encoder *encoder, -const struct drm_display_mode *mode, -struct drm_display_mode *adjusted_mode) -{ - return true; -} - -static void exynos_dp_mode_set(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ -} - -static void exynos_dp_enable(struct drm_encoder *encoder) +static void exynos_dp_bridge_enable(struct drm_bridge *bridge) { - struct exynos_dp_device *dp = encoder_to_dp(encoder); + struct exynos_dp_device *dp = bridge->driver_private; struct exynos_drm_crtc *crtc = dp_to_crtc(dp); if (dp->dpms_mode == DRM_MODE_DPMS_ON) @@ -1092,9 +1080,9 @@ static void exynos_dp_enable(struct drm_encoder *encoder) dp->dpms_mode = DRM_MODE_DPMS_ON; } -static void exynos_dp_disable(struct drm_encoder *encoder) +static void exynos_dp_bridge_disable(struct drm_bridge *bridge) { - struct exynos_dp_device *dp = encoder_to_dp(encoder); + struct exynos_dp_device *dp = bridge->driver_private; struct exynos_drm_crtc *crtc = dp_to_crtc(dp); if (dp->dpms_mode != DRM_MODE_DPMS_ON) @@ -1123,6 +,69 @@ static void exynos_dp_disable(struct drm_encoder *encoder) dp->dpms_mode = DRM_MODE_DPMS_OFF; } +static void exynos_dp_bridge_nop(struct drm_bridge *bridge) +{ + /* do nothing */ +} + +static const struct drm_bridge_funcs exynos_dp_bridge_funcs = { + .enable = exynos_dp_bridge_enable, + .disable = exynos_dp_bridge_disable, + .pre_enable = exynos_dp_bridge_nop, + .post_disable = exynos_dp_bridge_nop, + .attach = exynos_dp_bridge_attach, +}; + +static int exynos_dp_create_connector(struct drm_encoder *encoder) +{ + struct exynos_dp_device *dp = encoder_to_dp(encoder); + struct drm_device *drm_dev = dp->drm_dev; + struct drm_bridge *bridge; + int ret; + + bridge = devm_kzalloc(drm_dev->dev, siz
[PATCH v9 15/17] drm: bridge: analogix/dp: try force hpd after plug in lookup failed
Some edp screen do not have hpd signal, so we can't just return failed when hpd plug in detect failed. This is an hardware property, so we need add a devicetree property "analogix,need-force-hpd" to indicate this sutiation. Tested-by: Heiko Stuebner <he...@sntech.de> Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v9: None Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: - Add "analogix,need-force-hpd" to indicate whether driver need foce hpd when hpd detect failed. Changes in v2: None .../bindings/display/bridge/analogix_dp.txt| 4 ++- .../bindings/display/exynos/exynos_dp.txt | 1 + .../display/rockchip/analogix_dp-rockchip.txt | 1 + drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 36 +++--- drivers/gpu/drm/bridge/analogix/analogix_dp_core.h | 2 ++ drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 9 ++ 6 files changed, 47 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt index 7659a7a..74f0e80 100644 --- a/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt +++ b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt @@ -22,6 +22,9 @@ Required properties for dp-controller: from general PHY binding: Should be "dp". Optional properties for dp-controller: + -analogix,need-force-hpd: + Indicate driver need force hpd when hpd detect failed, this + is used for some eDP screen which don't have hpd signal. -hpd-gpios: Hotplug detect GPIO. Indicates which GPIO should be used for hotplug detection @@ -31,7 +34,6 @@ Optional properties for dp-controller: * Documentation/devicetree/bindings/display/exynos/exynos_dp.txt * Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt - [1]: Documentation/devicetree/bindings/media/video-interfaces.txt --- diff --git a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt index 9905081..8800164 100644 --- a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt +++ b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt @@ -41,6 +41,7 @@ For the below properties, please refer to Analogix DP binding document: -phys (required) -phy-names (required) -hpd-gpios (optional) + -analogix,need-force-hpd (optional) -video interfaces (optional) Deprecated properties for DisplayPort: diff --git a/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt index ec93917..be18388 100644 --- a/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt +++ b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt @@ -31,6 +31,7 @@ For the below properties, please refer to Analogix DP binding document: - phys (required) - phy-names (required) - hpd-gpios (optional) +- analogix,need-force-hpd (optional) --- Example: diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 563ffb1d..3842dbd 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -59,15 +59,38 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device *dp) { int timeout_loop = 0; - while (analogix_dp_get_plug_in_status(dp) != 0) { + while (timeout_loop < DP_TIMEOUT_LOOP_COUNT) { + if (analogix_dp_get_plug_in_status(dp) == 0) + return 0; + timeout_loop++; - if (timeout_loop > DP_TIMEOUT_LOOP_COUNT) { - dev_err(dp->dev, "failed to get hpd plug status\n"); - return -ETIMEDOUT; - } usleep_range(10, 11); } + /* +* Some edp screen do not have hpd signal, so we can't just +* return failed when hpd plug in detect failed, DT property +* "need-force-hpd" would indicate whether driver need this. +*/ + if (!dp->need_force_hpd) + return -ETIMEDOUT; + + /* +* The eDP TRM indicate that if HPD_STATUS(RO) is 0, AUX CH +* will not work, so we need to give a force hpd action to +* set HPD_STATUS manually. +*/ + dev_dbg(dp->dev, "
[PATCH v7 14/17] drm: bridge: analogix/dp: add max link rate and lane count limit for RK3288
There are some IP limit on rk3288 that only support 4 physical lanes of 2.7/1.6 Gbps/lane, so seprate them out by device_type flag. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: - Seprate the link-rate and lane-count limit out with the device_type flag. (Thierry) Changes in v3: None Changes in v2: None drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 33 ++ drivers/gpu/drm/bridge/analogix/analogix_dp_core.h | 4 +-- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 6307060..563ffb1d 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -890,8 +890,8 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) return; } - ret = analogix_dp_set_link_train(dp, dp->video_info.lane_count, -dp->video_info.link_rate); + ret = analogix_dp_set_link_train(dp, dp->video_info.max_lane_count, +dp->video_info.max_link_rate); if (ret) { dev_err(dp->dev, "unable to do link train\n"); return; @@ -1156,16 +1156,25 @@ static int analogix_dp_dt_parse_pdata(struct analogix_dp_device *dp) struct device_node *dp_node = dp->dev->of_node; struct video_info *video_info = >video_info; - if (of_property_read_u32(dp_node, "samsung,link-rate", -_info->link_rate)) { - dev_err(dp->dev, "failed to get link-rate\n"); - return -EINVAL; - } - - if (of_property_read_u32(dp_node, "samsung,lane-count", -_info->lane_count)) { - dev_err(dp->dev, "failed to get lane-count\n"); - return -EINVAL; + switch (dp->plat_data && dp->plat_data->dev_type) { + case RK3288_DP: + /* +* Like Rk3288 DisplayPort TRM indicate that "Main link +* containing 4 physical lanes of 2.7/1.62 Gbps/lane". +*/ + video_info->max_link_rate = 0x0A; + video_info->max_lane_count = 0x04; + break; + case EXYNOS_DP: + /* +* NOTE: those property parseing code is used for +* providing backward compatibility for samsung platform. +*/ + of_property_read_u32(dp_node, "samsung,link-rate", +_info->max_link_rate); + of_property_read_u32(dp_node, "samsung,lane-count", +_info->max_lane_count); + break; } return 0; diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h index e37cef6..e6f8243 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h @@ -129,8 +129,8 @@ struct video_info { enum color_coefficient ycbcr_coeff; enum color_depth color_depth; - enum link_rate_type link_rate; - enum link_lane_count_type lane_count; + enum link_rate_type max_link_rate; + enum link_lane_count_type max_lane_count; }; struct link_train { -- 2.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v7 13/17] drm: bridge: analogix/dp: add some rk3288 special registers setting
RK3288 need some special registers setting, we can separate them out by the dev_type of plat_data. Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: - Fix compile failed dut to phy_pd_addr variable misspell error drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 76 ++- drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h | 12 2 files changed, 60 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c index 861097a..21a3287 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c @@ -15,6 +15,8 @@ #include #include +#include + #include "analogix_dp_core.h" #include "analogix_dp_reg.h" @@ -72,6 +74,14 @@ void analogix_dp_init_analog_param(struct analogix_dp_device *dp) reg = SEL_24M | TX_DVDD_BIT_1_0625V; writel(reg, dp->reg_base + ANALOGIX_DP_ANALOG_CTL_2); + if (dp->plat_data && (dp->plat_data->dev_type == RK3288_DP)) { + writel(REF_CLK_24M, dp->reg_base + ANALOGIX_DP_PLL_REG_1); + writel(0x95, dp->reg_base + ANALOGIX_DP_PLL_REG_2); + writel(0x40, dp->reg_base + ANALOGIX_DP_PLL_REG_3); + writel(0x58, dp->reg_base + ANALOGIX_DP_PLL_REG_4); + writel(0x22, dp->reg_base + ANALOGIX_DP_PLL_REG_5); + } + reg = DRIVE_DVDD_BIT_1_0625V | VCO_BIT_600_MICRO; writel(reg, dp->reg_base + ANALOGIX_DP_ANALOG_CTL_3); @@ -206,81 +216,85 @@ void analogix_dp_set_analog_power_down(struct analogix_dp_device *dp, bool enable) { u32 reg; + u32 phy_pd_addr = ANALOGIX_DP_PHY_PD; + + if (dp->plat_data && (dp->plat_data->dev_type == RK3288_DP)) + phy_pd_addr = ANALOGIX_DP_PD; switch (block) { case AUX_BLOCK: if (enable) { - reg = readl(dp->reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp->reg_base + phy_pd_addr); reg |= AUX_PD; - writel(reg, dp->reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp->reg_base + phy_pd_addr); } else { - reg = readl(dp->reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp->reg_base + phy_pd_addr); reg &= ~AUX_PD; - writel(reg, dp->reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp->reg_base + phy_pd_addr); } break; case CH0_BLOCK: if (enable) { - reg = readl(dp->reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp->reg_base + phy_pd_addr); reg |= CH0_PD; - writel(reg, dp->reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp->reg_base + phy_pd_addr); } else { - reg = readl(dp->reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp->reg_base + phy_pd_addr); reg &= ~CH0_PD; - writel(reg, dp->reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp->reg_base + phy_pd_addr); } break; case CH1_BLOCK: if (enable) { - reg = readl(dp->reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp->reg_base + phy_pd_addr); reg |= CH1_PD; - writel(reg, dp->reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp->reg_base + phy_pd_addr); } else { - reg = readl(dp->reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp->reg_base + phy_pd_addr); reg &= ~CH1_PD; - writel(reg, dp->reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp->reg_base + phy_pd_addr); } break; case CH2_BLOCK: if (enable) { - reg = readl(dp->reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp->reg_base + phy_pd_addr); reg |= CH2_PD; - writel(reg, dp->reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp->reg_base + phy_pd_addr); } else { - reg = readl(dp->reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp->reg_base + phy_pd_addr); reg &
[PATCH v7 15/17] drm: bridge: analogix/dp: try force hpd after plug in lookup failed
Some edp screen do not have hpd signal, so we can't just return failed when hpd plug in detect failed. This is an hardware property, so we need add a devicetree property "analogix,need-force-hpd" to indicate this sutiation. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: - Add "analogix,need-force-hpd" to indicate whether driver need foce hpd when hpd detect failed. Changes in v2: None .../bindings/display/bridge/analogix_dp.txt| 4 ++- .../bindings/display/exynos/exynos_dp.txt | 1 + .../display/rockchip/analogix_dp-rockchip.txt | 1 + drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 36 +++--- drivers/gpu/drm/bridge/analogix/analogix_dp_core.h | 2 ++ drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 9 ++ 6 files changed, 47 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt index 7659a7a..74f0e80 100644 --- a/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt +++ b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt @@ -22,6 +22,9 @@ Required properties for dp-controller: from general PHY binding: Should be "dp". Optional properties for dp-controller: + -analogix,need-force-hpd: + Indicate driver need force hpd when hpd detect failed, this + is used for some eDP screen which don't have hpd signal. -hpd-gpios: Hotplug detect GPIO. Indicates which GPIO should be used for hotplug detection @@ -31,7 +34,6 @@ Optional properties for dp-controller: * Documentation/devicetree/bindings/display/exynos/exynos_dp.txt * Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt - [1]: Documentation/devicetree/bindings/media/video-interfaces.txt --- diff --git a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt index 9e47357..e9b0548 100644 --- a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt +++ b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt @@ -41,6 +41,7 @@ For the below properties, please refer to Analogix DP binding document: -phys (required) -phy-names (required) -hpd-gpios (optional) + -analogix,need-force-hpd (optional) -video interfaces (optional) Deprecated properties for DisplayPort: diff --git a/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt index ec93917..be18388 100644 --- a/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt +++ b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt @@ -31,6 +31,7 @@ For the below properties, please refer to Analogix DP binding document: - phys (required) - phy-names (required) - hpd-gpios (optional) +- analogix,need-force-hpd (optional) --- Example: diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 563ffb1d..3842dbd 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -59,15 +59,38 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device *dp) { int timeout_loop = 0; - while (analogix_dp_get_plug_in_status(dp) != 0) { + while (timeout_loop < DP_TIMEOUT_LOOP_COUNT) { + if (analogix_dp_get_plug_in_status(dp) == 0) + return 0; + timeout_loop++; - if (timeout_loop > DP_TIMEOUT_LOOP_COUNT) { - dev_err(dp->dev, "failed to get hpd plug status\n"); - return -ETIMEDOUT; - } usleep_range(10, 11); } + /* +* Some edp screen do not have hpd signal, so we can't just +* return failed when hpd plug in detect failed, DT property +* "need-force-hpd" would indicate whether driver need this. +*/ + if (!dp->need_force_hpd) + return -ETIMEDOUT; + + /* +* The eDP TRM indicate that if HPD_STATUS(RO) is 0, AUX CH +* will not work, so we need to give a force hpd action to +* set HPD_STATUS manually. +*/ + dev_dbg(dp->dev, "failed to get hpd plug status, try to force hpd\n"); + + analogix_dp_force_hpd(dp); + +
[PATCH v7 11/17] Documentation: phy: add document for rockchip dp phy
Add dt binding documentation for rockchip display port PHY. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v7: None Changes in v6: None Changes in v5: - Split binding doc's from driver changes. (Rob) - Update the rockchip,grf explain in document, and correct the clock required elemets in document. (Rob & Heiko) Changes in v4: None Changes in v3: None Changes in v2: None .../devicetree/bindings/phy/rockchip-dp-phy.txt| 22 ++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt diff --git a/Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt new file mode 100644 index 000..505194e --- /dev/null +++ b/Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt @@ -0,0 +1,22 @@ +Rockchip Soc Seroes Display Port PHY + + +Required properties: +- compatible : should be one of the following supported values: +- "rockchip.rk3288-dp-phy" +- clocks: from common clock binding: handle to dp clock. + of memory mapped region. +- clock-names: from common clock binding: + Required elements: "24m" +- rockchip,grf: phandle to the syscon managing the "general register files" +- #phy-cells : from the generic PHY bindings, must be 0; + +Example: + +edp_phy: edp-phy@ff770274 { + compatible = "rockchip,rk3288-dp-phy"; + rockchip,grf = <>; + clocks = < SCLK_EDP_24M>; + clock-names = "24m"; + #phy-cells = <0>; +}; -- 2.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v7 17/17] drm: bridge: analogix/dp: add edid modes parse in get_modes method
Display Port monitor could support kinds of mode which indicate in monitor edid, not just one single display resolution which defined in panel or devivetree property display timing. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: - Call drm_panel_prepare() in .get_modes function, ensure panel should power on before driver try to read edid message. Changes in v3: - Add edid modes parse support Changes in v2: None drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 24 +++ drivers/gpu/drm/bridge/analogix/analogix_dp_core.h | 46 +++--- 2 files changed, 40 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 216d33d..4fa5f69 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -107,7 +107,7 @@ static unsigned char analogix_dp_calc_edid_check_sum(unsigned char *edid_data) static int analogix_dp_read_edid(struct analogix_dp_device *dp) { - unsigned char edid[EDID_BLOCK_LENGTH * 2]; + unsigned char *edid = dp->edid; unsigned int extend_block = 0; unsigned char sum; unsigned char test_vector; @@ -901,12 +901,6 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) DRM_ERROR("failed to disable the panel\n"); } - ret = analogix_dp_handle_edid(dp); - if (ret) { - dev_err(dp->dev, "unable to handle edid\n"); - return; - } - ret = analogix_dp_set_link_train(dp, dp->video_info.max_lane_count, dp->video_info.max_link_rate); if (ret) { @@ -947,8 +941,24 @@ EXPORT_SYMBOL_GPL(analogix_dp_detect); int analogix_dp_get_modes(struct device *dev) { struct analogix_dp_device *dp = dev_get_drvdata(dev); + struct edid *edid = (struct edid *)dp->edid; int num_modes = 0; + if (dp->plat_data && dp->plat_data->panel) { + if (drm_panel_prepare(dp->plat_data->panel)) { + DRM_ERROR("failed to setup the panel\n"); + return -EINVAL; + } + } + + if (analogix_dp_handle_edid(dp)) { + dev_err(dp->dev, "unable to handle edid\n"); + return -EINVAL; + } + + drm_mode_connector_update_edid_property(dp->connector, edid); + num_modes += drm_add_edid_modes(dp->connector, edid); + if (dp->plat_data->panel) num_modes += drm_panel_get_modes(dp->plat_data->panel); diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h index d3c7e0a..2bd2e0d 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h @@ -20,6 +20,28 @@ #define MAX_CR_LOOP 5 #define MAX_EQ_LOOP 5 +/* I2C EDID Chip ID, Slave Address */ +#define I2C_EDID_DEVICE_ADDR 0x50 +#define I2C_E_EDID_DEVICE_ADDR 0x30 + +#define EDID_BLOCK_LENGTH 0x80 +#define EDID_HEADER_PATTERN0x00 +#define EDID_EXTENSION_FLAG0x7e +#define EDID_CHECKSUM 0x7f + +/* DP_MAX_LANE_COUNT */ +#define DPCD_ENHANCED_FRAME_CAP(x) (((x) >> 7) & 0x1) +#define DPCD_MAX_LANE_COUNT(x) ((x) & 0x1f) + +/* DP_LANE_COUNT_SET */ +#define DPCD_LANE_COUNT_SET(x) ((x) & 0x1f) + +/* DP_TRAINING_LANE0_SET */ +#define DPCD_PRE_EMPHASIS_SET(x) (((x) & 0x3) << 3) +#define DPCD_PRE_EMPHASIS_GET(x) (((x) >> 3) & 0x3) +#define DPCD_VOLTAGE_SWING_SET(x) (((x) & 0x3) << 0) +#define DPCD_VOLTAGE_SWING_GET(x) (((x) >> 0) & 0x3) + enum link_rate_type { LINK_RATE_1_62GBPS = DP_LINK_BW_1_62, LINK_RATE_2_70GBPS = DP_LINK_BW_2_7, @@ -161,6 +183,7 @@ struct analogix_dp_device { int dpms_mode; int hpd_gpio; boolneed_force_hpd; + unsigned char edid[EDID_BLOCK_LENGTH * 2]; struct analogix_dp_plat_data *plat_data; }; @@ -260,27 +283,4 @@ int analogix_dp_is_video_stream_on(struct analogix_dp_device *dp); void analogix_dp_config_video_slave_mode(struct analogix_dp_device *dp); void analogix_dp_enable_scrambling(struct analogix_dp_device *dp); void analogix_dp_disable_scrambling(struct analogix_dp_device *dp); - -/* I2C EDID Chip ID, Slave Address */ -#define I2C_EDID_DEVICE_ADDR 0x50
[PATCH v7 16/17] drm: bridge: analogix/dp: move hpd detect to connector detect function
This change just make a little clean to make code more like drm core expect, move hdp detect code from bridge->enable(), and place them into connector->detect(). Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: - Take Jingoo suggest, add commit messages. Changes in v3: - move dp hpd detect to connector detect function. Changes in v2: None drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 3842dbd..216d33d 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -901,12 +901,6 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) DRM_ERROR("failed to disable the panel\n"); } - ret = analogix_dp_detect_hpd(dp); - if (ret) { - /* Cable has been disconnected, we're done */ - return; - } - ret = analogix_dp_handle_edid(dp); if (ret) { dev_err(dp->dev, "unable to handle edid\n"); @@ -941,6 +935,11 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) enum drm_connector_status analogix_dp_detect(struct device *dev, bool force) { + struct analogix_dp_device *dp = dev_get_drvdata(dev); + + if (analogix_dp_detect_hpd(dp)) + return connector_status_disconnected; + return connector_status_connected; } EXPORT_SYMBOL_GPL(analogix_dp_detect); -- 2.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v7 10/17] phy: Add driver for rockchip Display Port PHY
Add phy driver for the Rockchip DisplayPort PHY module. This is required to get DisplayPort working in Rockchip SoCs. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v7: None Changes in v6: - Simply the commit message. (Kishon) - Symmetrical enable/disbale the phy clock and power. (Kishon) Changes in v5: - Remove "reg" DT property, cause driver could poweron/poweroff phy via the exist "grf" syscon already. And rename the example DT node from "edp_phy: phy@ff770274" to "edp_phy: edp-phy" directly. (Heiko) - Add deivce_node at the front of driver, update phy_ops type from "static struct" to "static const struct". And correct the input paramters of devm_phy_create() interfaces. (Heiko) Changes in v4: - Add commit message, and remove the redundant rockchip_dp_phy_init() function, move those code to probe() method. And remove driver .owner number. (Kishon) Changes in v3: - Suggest, add rockchip dp phy driver, collect the phy clocks and power control. (Heiko) Changes in v2: None drivers/phy/Kconfig | 7 ++ drivers/phy/Makefile | 1 + drivers/phy/phy-rockchip-dp.c | 153 ++ 3 files changed, 161 insertions(+) create mode 100644 drivers/phy/phy-rockchip-dp.c diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 7eb5859d..7355819 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -319,6 +319,13 @@ config PHY_ROCKCHIP_USB help Enable this to support the Rockchip USB 2.0 PHY. +config PHY_ROCKCHIP_DP + tristate "Rockchip Display Port PHY Driver" + depends on ARCH_ROCKCHIP && OF + select GENERIC_PHY + help + Enable this to support the Rockchip Display Port PHY. + config PHY_ST_SPEAR1310_MIPHY tristate "ST SPEAR1310-MIPHY driver" select GENERIC_PHY diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index 075db1a..b1700cd 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -35,6 +35,7 @@ phy-exynos-usb2-$(CONFIG_PHY_S5PV210_USB2)+= phy-s5pv210-usb2.o obj-$(CONFIG_PHY_EXYNOS5_USBDRD) += phy-exynos5-usbdrd.o obj-$(CONFIG_PHY_QCOM_APQ8064_SATA)+= phy-qcom-apq8064-sata.o obj-$(CONFIG_PHY_ROCKCHIP_USB) += phy-rockchip-usb.o +obj-$(CONFIG_PHY_ROCKCHIP_DP) += phy-rockchip-dp.o obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA)+= phy-qcom-ipq806x-sata.o obj-$(CONFIG_PHY_ST_SPEAR1310_MIPHY) += phy-spear1310-miphy.o obj-$(CONFIG_PHY_ST_SPEAR1340_MIPHY) += phy-spear1340-miphy.o diff --git a/drivers/phy/phy-rockchip-dp.c b/drivers/phy/phy-rockchip-dp.c new file mode 100644 index 000..4af19af --- /dev/null +++ b/drivers/phy/phy-rockchip-dp.c @@ -0,0 +1,153 @@ +/* + * Rockchip DP PHY driver + * + * Copyright (C) 2015 FuZhou Rockchip Co., Ltd. + * Author: Yakir Yang <ykk@@rock-chips.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define GRF_SOC_CON12 0x0274 +#define GRF_EDP_REF_CLK_SEL_INTER BIT(4) +#define GRF_EDP_PHY_SIDDQ_WRITE_EN BIT(21) +#define GRF_EDP_PHY_SIDDQ_ON0 +#define GRF_EDP_PHY_SIDDQ_OFF BIT(5) + +struct rockchip_dp_phy { + struct device *dev; + struct regmap *grf; + struct clk *phy_24m; +}; + +static int rockchip_set_phy_state(struct phy *phy, bool enable) +{ + struct rockchip_dp_phy *dp = phy_get_drvdata(phy); + int ret; + + if (enable) { + ret = regmap_write(dp->grf, GRF_SOC_CON12, + GRF_EDP_PHY_SIDDQ_WRITE_EN | + GRF_EDP_PHY_SIDDQ_ON); + if (ret < 0) { + dev_err(dp->dev, "Can't enable PHY power %d\n", ret); + return ret; + } + + ret = clk_prepare_enable(dp->phy_24m); + + } else { + clk_disable_unprepare(dp->phy_24m); + + ret = regmap_write(dp->grf, GRF_SOC_CON12, + GRF_EDP_PHY_SIDDQ_WRITE_EN | + GRF_EDP_PHY_SIDDQ_OFF); + } + + return ret; +} + +static int rockchip_dp_phy_power_on(struct phy *phy) +{ + return rockchip_set_phy_state(phy, true); +} + +static int rockchip_dp_phy_power_off(struct phy *phy) +{ + return rockchip_set_phy_state(phy, false); +} + +static const struct phy_ops rockchip_dp_phy_ops = { + .power_on = rockchip_dp_phy_power_on, + .power_off = rockchip_dp_phy_power_off, + .ow
[PATCH v7 09/17] Documentation: drm/bridge: add document for analogix_dp
Rockchip DP driver is a helper driver of analogix_dp coder driver, so most of the DT property should be descriped in analogix_dp document. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v7: None Changes in v6: None Changes in v5: - Split binding doc's from driver changes. (Rob) - Add eDP hotplug pinctrl property. (Heiko) Changes in v4: None Changes in v3: None Changes in v2: None .../display/rockchip/analogix_dp-rockchip.txt | 90 ++ 1 file changed, 90 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt diff --git a/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt new file mode 100644 index 000..ec93917 --- /dev/null +++ b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt @@ -0,0 +1,90 @@ +Rockchip RK3288 specific extensions to the Analogix Display Port + + +Required properties: +- compatible: "rockchip,rk3288-edp"; + +- reg: physical base address of the controller and length + +- clocks: from common clock binding: handle to dp clock. + of memory mapped region. + +- clock-names: from common clock binding: + Required elements: "dp" "pclk" + +- resets: Must contain an entry for each entry in reset-names. + See ../reset/reset.txt for details. + +- pinctrl-names: Names corresponding to the chip hotplug pinctrl states. +- pinctrl-0: pin-control mode. should be <_hpd> + +- reset-names: Must include the name "dp" + +- rockchip,grf: this soc should set GRF regs, so need get grf here. + +- ports: contain a port node with endpoint definitions as defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. + + +For the below properties, please refer to Analogix DP binding document: + * Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt +- phys (required) +- phy-names (required) +- hpd-gpios (optional) +--- + +Example: + dp-controller: dp@ff97 { + compatible = "rockchip,rk3288-dp"; + reg = <0xff97 0x4000>; + interrupts = ; + clocks = < SCLK_EDP>, < PCLK_EDP_CTRL>; + clock-names = "dp", "pclk"; + phys = <_phy>; + phy-names = "dp"; + + rockchip,grf = <>; + resets = < 111>; + reset-names = "dp"; + + pinctrl-names = "default"; + pinctrl-0 = <_hpd>; + + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + edp_in: port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + edp_in_vopb: endpoint@0 { + reg = <0>; + remote-endpoint = <_out_edp>; + }; + edp_in_vopl: endpoint@1 { + reg = <1>; + remote-endpoint = <_out_edp>; + }; + }; + + edp_out: port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + edp_out_panel: endpoint { + reg = <0>; + remote-endpoint = <_in_edp> + }; + }; + }; + }; + + pinctrl { + edp { + edp_hpd: edp-hpd { + rockchip,pins = <7 11 RK_FUNC_2 _pull_none>; + }; + }; + }; -- 2.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v7 06/17] Documentation: drm/bridge: add document for analogix_dp
Analogix dp driver is split from exynos dp driver, so we just make an copy of exynos_dp.txt, and then simplify exynos_dp.txt Beside update some exynos dtsi file with the latest change according to the devicetree binding documents. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: - Split all DTS changes, and provide backward compatibility. Mark old properties as deprecated but still support them. (Krzysztof) - Update "analogix,hpd-gpio" to "hpd-gpios" prop name. (Rob) - Deprecated some properties which could parsed from Edid/Mode/DPCD. (Thierry) "analogix,color-space" & "analogix,color-depth" & "analogix,link-rate" & "analogix,lane-count"& "analogix,ycbcr-coeff" & "analogix,dynamic-range" & "vsync-active-high"& "hsync-active-high" & "interlaces" Changes in v3: - Add devicetree binding documents. (Heiko) - Remove sync pol & colorimetry properies from the new analogix dp driver devicetree binding. (Thierry) - Update the exist exynos dtsi file with the latest DP DT properies. Changes in v2: None .../bindings/display/bridge/analogix_dp.txt| 50 + .../bindings/display/exynos/exynos_dp.txt | 63 -- 2 files changed, 71 insertions(+), 42 deletions(-) create mode 100644 Documentation/devicetree/bindings/display/bridge/analogix_dp.txt diff --git a/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt new file mode 100644 index 000..7659a7a --- /dev/null +++ b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt @@ -0,0 +1,50 @@ +Analogix Display Port bridge bindings + +Required properties for dp-controller: + -compatible: + platform specific such as: +* "samsung,exynos5-dp" +* "rockchip,rk3288-dp" + -reg: + physical base address of the controller and length + of memory mapped region. + -interrupts: + interrupt combiner values. + -clocks: + from common clock binding: handle to dp clock. + -clock-names: + from common clock binding: Shall be "dp". + -interrupt-parent: + phandle to Interrupt combiner node. + -phys: + from general PHY binding: the phandle for the PHY device. + -phy-names: + from general PHY binding: Should be "dp". + +Optional properties for dp-controller: + -hpd-gpios: + Hotplug detect GPIO. + Indicates which GPIO should be used for hotplug detection + -port@[X]: SoC specific port nodes with endpoint definitions as defined + in Documentation/devicetree/bindings/media/video-interfaces.txt, + please refer to the SoC specific binding document: + * Documentation/devicetree/bindings/display/exynos/exynos_dp.txt + * Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt + + +[1]: Documentation/devicetree/bindings/media/video-interfaces.txt +--- + +Example: + + dp-controller { + compatible = "samsung,exynos5-dp"; + reg = <0x145b 0x1>; + interrupts = <10 3>; + interrupt-parent = <>; + clocks = < 342>; + clock-names = "dp"; + + phys = <_phy>; + phy-names = "dp"; + }; diff --git a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt index 7a3a9cd..9e47357 100644 --- a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt +++ b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt @@ -31,45 +31,31 @@ Required properties for dp-controller: from general PHY binding: the phandle for the PHY device. -phy-names: from general PHY binding: Should be "dp". - -samsung,color-space: - input video data format. - COLOR_RGB = 0, COLOR_YCBCR422 = 1, COLOR_YCBCR444 = 2 - -samsung,dynamic-range: - dynamic range for input video data. - VESA = 0, CEA = 1 - -samsung,ycbcr-coeff: - YCbCr co-efficients for input video. - COLOR_YCBCR601 = 0, COLOR_YCBCR709 = 1 - -samsung,color-depth: - number of bits per colour component. - COLOR_6 =
[PATCH v7 12/17] drm: rockchip: vop: add bpc and color mode setting
From: Mark Yao <y...@rock-chips.com> Add bpc and color mode setting in rockchip_drm_vop driver, so connector could try to use the edid drm_display_info to config vop output mode. Signed-off-by: Mark Yao <y...@rock-chips.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v7: None Changes in v6: None Changes in v5: - Fix compiled error (Heiko) - Using the connector display info message to configure eDP driver input video mode, but hard code CRTC video output mode to RGBaaa. Changes in v4: None Changes in v3: None Changes in v2: None drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 25 +++ drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 32 ++--- 4 files changed, 51 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index 2c82a9a..3990951 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -180,14 +180,29 @@ static void rockchip_dp_drm_encoder_mode_set(struct drm_encoder *encoder, static void rockchip_dp_drm_encoder_prepare(struct drm_encoder *encoder) { struct rockchip_dp_device *dp = to_dp(encoder); + struct drm_connector *cn = >connector; + int ret = -1; u32 val; - int ret; - ret = rockchip_drm_crtc_mode_config(encoder->crtc, - DRM_MODE_CONNECTOR_eDP, - ROCKCHIP_OUT_MODE_); + /* +* FIXME(Yakir): driver should configure the CRTC output video +* mode with the display information which indicated the monitor +* support colorimetry. +* +* But don't know why the CRTC driver seems could only output the +* RGBaaa rightly. For example, if connect the "innolux,n116bge" +* eDP screen, EDID would indicated that screen only accepted the +* 6bpc mode. But if I configure CRTC to RGB666 output, then eDP +* screen would show a blue picture (RGB888 show a green picture). +* But if I configure CTRC to RGBaaa, and eDP driver still keep +* RGB666 input video mode, then screen would works prefect. +*/ + if (cn->display_info.color_formats & DRM_COLOR_FORMAT_RGB444) + ret = rockchip_drm_crtc_mode_config(encoder->crtc, + DRM_MODE_CONNECTOR_eDP, + 10, DRM_COLOR_FORMAT_RGB444); if (ret < 0) { - dev_err(dp->dev, "Could not set crtc mode config: %d.\n", ret); + dev_err(dp->dev, "Could not set crtc mode config (%d)\n", ret); return; } diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index 80d6fc8..428a3c1 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -215,7 +215,7 @@ static void dw_hdmi_rockchip_encoder_commit(struct drm_encoder *encoder) static void dw_hdmi_rockchip_encoder_prepare(struct drm_encoder *encoder) { rockchip_drm_crtc_mode_config(encoder->crtc, DRM_MODE_CONNECTOR_HDMIA, - ROCKCHIP_OUT_MODE_); + 10, DRM_COLOR_FORMAT_RGB444); } static struct drm_encoder_helper_funcs dw_hdmi_rockchip_encoder_helper_funcs = { diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h index dc4e5f0..ef1d7fb 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h @@ -59,7 +59,7 @@ void rockchip_unregister_crtc_funcs(struct drm_device *dev, int pipe); int rockchip_drm_encoder_get_mux_id(struct device_node *node, struct drm_encoder *encoder); int rockchip_drm_crtc_mode_config(struct drm_crtc *crtc, int connector_type, - int out_mode); + int bpc, int color); int rockchip_drm_dma_attach_device(struct drm_device *drm_dev, struct device *dev); void rockchip_drm_dma_detach_device(struct drm_device *drm_dev, diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 5d8ae5e..9ef4a1f 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1062,14 +1062,40 @@ static const struct drm_plane_funcs vop_plane_funcs = { int rockchip_drm_crtc_mode_config(struct drm_crtc *crtc, int connector_type, - int out_mode) +
[PATCH v7 08/17] drm: rockchip: dp: add rockchip platform dp driver
Rockchip have three clocks for dp controller, we leave pclk_edp to analogix_dp driver control, and keep the sclk_edp_24m and sclk_edp in platform driver. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v7: None Changes in v6: None Changes in v5: - Remove the empty line at the end of document, and correct the endpoint numbers in the example DT node, and remove the regulator iomux setting in driver code while using the pinctl in devicetree instead. (Heiko) - Add device type declared, cause the previous "platform device type support (v4 11/16)" already merge into (v5 02/14). - Implement connector registration code. (Thierry) Changes in v4: - Remove some deprecated DT properties in rockchip dp document. Changes in v3: - Leave "sclk_edp_24m" to rockchip dp phy driver which name to "24m", and leave "sclk_edp" to analogix dp core driver which name to "dp", and leave "pclk_edp" to rockchip dp platform driver which name to "pclk". (Thierry & Heiko) - Add devicetree binding document. (Heiko) - Remove "rockchip,panel" DT property, take use of remote point to get panel node. (Heiko) - Add the new function point dp_platdata->get_modes() init. Changes in v2: - Get panel node with remote-endpoint method, and create devicetree binding for driver. (Heiko) - Remove the clock enable/disbale with "sclk_edp" & "sclk_edp_24m", leave those clock to rockchip dp phy driver. drivers/gpu/drm/rockchip/Kconfig| 9 + drivers/gpu/drm/rockchip/Makefile | 1 + drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 442 include/drm/bridge/analogix_dp.h| 1 + 4 files changed, 453 insertions(+) create mode 100644 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig index 35215f6..c2ba945 100644 --- a/drivers/gpu/drm/rockchip/Kconfig +++ b/drivers/gpu/drm/rockchip/Kconfig @@ -25,3 +25,12 @@ config ROCKCHIP_DW_HDMI for the Synopsys DesignWare HDMI driver. If you want to enable HDMI on RK3288 based SoC, you should selet this option. + +config ROCKCHIP_ANALOGIX_DP +tristate "Rockchip specific extensions for Analogix DP driver" +depends on DRM_ROCKCHIP +select DRM_ANALOGIX_DP +help + This selects support for Rockchip SoC specific extensions + for the Analogix Core DP driver. If you want to enable DP + on RK3288 based SoC, you should selet this option. diff --git a/drivers/gpu/drm/rockchip/Makefile b/drivers/gpu/drm/rockchip/Makefile index f3d8a19..8ad01fb 100644 --- a/drivers/gpu/drm/rockchip/Makefile +++ b/drivers/gpu/drm/rockchip/Makefile @@ -6,5 +6,6 @@ rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o rockchip_drm_fbdev.o \ rockchip_drm_gem.o obj-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o +obj-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o rockchip_drm_vop.o diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c new file mode 100644 index 000..2c82a9a --- /dev/null +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -0,0 +1,442 @@ +/* + * Rockchip SoC DP (Display Port) interface driver. + * + * Copyright (C) Fuzhou Rockchip Electronics Co., Ltd. + * Author: Andy Yan <andy@rock-chips.com> + * Yakir Yang <y...@rock-chips.com> + * Jeff Chen <jeff.c...@rock-chips.com> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include "rockchip_drm_drv.h" +#include "rockchip_drm_vop.h" + +#define to_dp(nm) container_of(nm, struct rockchip_dp_device, nm) + +/* dp grf register offset */ +#define GRF_SOC_CON60x025c +#define GRF_EDP_LCD_SEL_MASKBIT(5) +#define GRF_EDP_SEL_VOP_LIT BIT(5) +#define GRF_EDP_SEL_VOP_BIG 0 + +struct rockchip_dp_device { + struct drm_device*drm_dev; + struct device*dev; + struct drm_encoder encoder; + struct drm_connector connector; + struct drm_display_mode mode; + + struct clk *pclk; + struct regmap*grf; + struct reset_control *rst; + + struct analogix_dp_plat_data plat_data; +}; + +st
[PATCH v7 07/17] ARM: dts: exynos/dp: remove some properties that deprecated by analogix_dp driver
After exynos_dp have been split the common IP code into analogix_dp driver, the analogix_dp driver have deprecated some Samsung platform properties which could be dynamically parsed from EDID/MODE/DPCD message, so this is an update for Exynos DTS file for dp-controller. Beside the backward compatibility is fully preserved, so there are no bisectability break that make this change in a separate patch. Reviewed-by: Krzysztof Kozlowski <k.kozlow...@samsung.com> Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v7: None Changes in v6: - Fix Peach Pit hpd property name error: - hpd-gpio = < 6 0>; + hpd-gpios = < 6 0>; Changes in v5: - Correct the misspell in commit message. (Krzysztof) Changes in v4: - Separate all DTS changes to a separate patch. (Krzysztof) Changes in v3: None Changes in v2: None arch/arm/boot/dts/exynos5250-arndale.dts | 2 -- arch/arm/boot/dts/exynos5250-smdk5250.dts | 2 -- arch/arm/boot/dts/exynos5250-snow-common.dtsi | 4 +--- arch/arm/boot/dts/exynos5250-spring.dts | 4 +--- arch/arm/boot/dts/exynos5420-peach-pit.dts| 4 +--- arch/arm/boot/dts/exynos5420-smdk5420.dts | 2 -- arch/arm/boot/dts/exynos5800-peach-pi.dts | 4 +--- 7 files changed, 4 insertions(+), 18 deletions(-) diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts index c000532..b1790cf 100644 --- a/arch/arm/boot/dts/exynos5250-arndale.dts +++ b/arch/arm/boot/dts/exynos5250-arndale.dts @@ -124,8 +124,6 @@ { status = "okay"; samsung,color-space = <0>; - samsung,dynamic-range = <0>; - samsung,ycbcr-coeff = <0>; samsung,color-depth = <1>; samsung,link-rate = <0x0a>; samsung,lane-count = <4>; diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts index 0f5dcd4..f30c2db 100644 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts @@ -80,8 +80,6 @@ { samsung,color-space = <0>; - samsung,dynamic-range = <0>; - samsung,ycbcr-coeff = <0>; samsung,color-depth = <1>; samsung,link-rate = <0x0a>; samsung,lane-count = <4>; diff --git a/arch/arm/boot/dts/exynos5250-snow-common.dtsi b/arch/arm/boot/dts/exynos5250-snow-common.dtsi index 0a7f408..ee94110 100644 --- a/arch/arm/boot/dts/exynos5250-snow-common.dtsi +++ b/arch/arm/boot/dts/exynos5250-snow-common.dtsi @@ -236,12 +236,10 @@ pinctrl-names = "default"; pinctrl-0 = <_hpd>; samsung,color-space = <0>; - samsung,dynamic-range = <0>; - samsung,ycbcr-coeff = <0>; samsung,color-depth = <1>; samsung,link-rate = <0x0a>; samsung,lane-count = <2>; - samsung,hpd-gpio = < 7 GPIO_ACTIVE_HIGH>; + hpd-gpios = < 7 GPIO_ACTIVE_HIGH>; ports { port@0 { diff --git a/arch/arm/boot/dts/exynos5250-spring.dts b/arch/arm/boot/dts/exynos5250-spring.dts index c1edd6d..91881d7 100644 --- a/arch/arm/boot/dts/exynos5250-spring.dts +++ b/arch/arm/boot/dts/exynos5250-spring.dts @@ -74,12 +74,10 @@ pinctrl-names = "default"; pinctrl-0 = <_hpd_gpio>; samsung,color-space = <0>; - samsung,dynamic-range = <0>; - samsung,ycbcr-coeff = <0>; samsung,color-depth = <1>; samsung,link-rate = <0x0a>; samsung,lane-count = <1>; - samsung,hpd-gpio = < 0 GPIO_ACTIVE_HIGH>; + hpd-gpios = < 0 GPIO_ACTIVE_HIGH>; }; { diff --git a/arch/arm/boot/dts/exynos5420-peach-pit.dts b/arch/arm/boot/dts/exynos5420-peach-pit.dts index 72ba6f0..8baf40a 100644 --- a/arch/arm/boot/dts/exynos5420-peach-pit.dts +++ b/arch/arm/boot/dts/exynos5420-peach-pit.dts @@ -148,12 +148,10 @@ pinctrl-names = "default"; pinctrl-0 = <_hpd_gpio>; samsung,color-space = <0>; - samsung,dynamic-range = <0>; - samsung,ycbcr-coeff = <0>; samsung,color-depth = <1>; samsung,link-rate = <0x06>; samsung,lane-count = <2>; - samsung,hpd-gpio = < 6 GPIO_ACTIVE_HIGH>; + hpd-gpios = < 6 GPIO_ACTIVE_HIGH>; ports { port@0 { diff --git a/arch/arm/boot/dts/exynos5420-smdk5420.dts b/arch/arm/boot/dts/exynos5420-smdk5420.dts index ac35aef..f67344f 100644 --- a/arch/arm/boot/dts/exynos5420-smdk5420.dts +++ b/arch/arm/boot/dts/exynos5420-smdk5420.dts @@ -93,8 +93,6 @@ pinctrl-names = "default"; pinctrl-0 = <_hpd>; samsung,color-space = <0>; - samsung,dynamic-range = <0>; - samsung,ycbcr-coeff = <
Re: [PATCH v7 10/17] phy: Add driver for rockchip Display Port PHY
On 10/28/2015 05:23 AM, Heiko Stuebner wrote: Am Samstag, 24. Oktober 2015, 11:06:04 schrieb Yakir Yang: Add phy driver for the Rockchip DisplayPort PHY module. This is required to get DisplayPort working in Rockchip SoCs. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- diff --git a/drivers/phy/phy-rockchip-dp.c b/drivers/phy/phy-rockchip-dp.c new file mode 100644 index 000..4af19af --- /dev/null +++ b/drivers/phy/phy-rockchip-dp.c @@ -0,0 +1,153 @@ +/* + * Rockchip DP PHY driver + * + * Copyright (C) 2015 FuZhou Rockchip Co., Ltd. + * Author: Yakir Yang <ykk@@rock-chips.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define GRF_SOC_CON12 0x0274 +#define GRF_EDP_REF_CLK_SEL_INTER BIT(4) +#define GRF_EDP_PHY_SIDDQ_WRITE_EN BIT(21) +#define GRF_EDP_PHY_SIDDQ_ON0 +#define GRF_EDP_PHY_SIDDQ_OFF BIT(5) mixed spacers (tabs and spaces), please use either tabs if you want to align stuff or a single space. Also you're mixing the handling here, for SIDDQ you're defining both the actual bit as well as the write-enable bit, but for CLK_SEL_INTR you're hard-coding the 16-bit shift down in the code. You could also just use/copy the HIWORD_MASK macro we use for example in the clock controller. Great, thanks. - Yakir + +struct rockchip_dp_phy { + struct device *dev; + struct regmap *grf; + struct clk *phy_24m; +}; + +static int rockchip_set_phy_state(struct phy *phy, bool enable) +{ + struct rockchip_dp_phy *dp = phy_get_drvdata(phy); + int ret; + + if (enable) { + ret = regmap_write(dp->grf, GRF_SOC_CON12, + GRF_EDP_PHY_SIDDQ_WRITE_EN | + GRF_EDP_PHY_SIDDQ_ON); + if (ret < 0) { + dev_err(dp->dev, "Can't enable PHY power %d\n", ret); + return ret; + } + + ret = clk_prepare_enable(dp->phy_24m); + unnecessary empty line after clk_prepare_enable with these things fixed, Reviewed-by: Heiko Stuebner <he...@sntech.de> Cheers, Heiko -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v7 10/17] phy: Add driver for rockchip Display Port PHY
On 10/28/2015 05:23 AM, Heiko Stuebner wrote: Am Samstag, 24. Oktober 2015, 11:06:04 schrieb Yakir Yang: Add phy driver for the Rockchip DisplayPort PHY module. This is required to get DisplayPort working in Rockchip SoCs. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- diff --git a/drivers/phy/phy-rockchip-dp.c b/drivers/phy/phy-rockchip-dp.c new file mode 100644 index 000..4af19af --- /dev/null +++ b/drivers/phy/phy-rockchip-dp.c @@ -0,0 +1,153 @@ +/* + * Rockchip DP PHY driver + * + * Copyright (C) 2015 FuZhou Rockchip Co., Ltd. + * Author: Yakir Yang <ykk@@rock-chips.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define GRF_SOC_CON12 0x0274 +#define GRF_EDP_REF_CLK_SEL_INTER BIT(4) +#define GRF_EDP_PHY_SIDDQ_WRITE_EN BIT(21) +#define GRF_EDP_PHY_SIDDQ_ON0 +#define GRF_EDP_PHY_SIDDQ_OFF BIT(5) mixed spacers (tabs and spaces), please use either tabs if you want to align stuff or a single space. Also you're mixing the handling here, for SIDDQ you're defining both the actual bit as well as the write-enable bit, but for CLK_SEL_INTR you're hard-coding the 16-bit shift down in the code. You could also just use/copy the HIWORD_MASK macro we use for example in the clock controller. + +struct rockchip_dp_phy { + struct device *dev; + struct regmap *grf; + struct clk *phy_24m; +}; + +static int rockchip_set_phy_state(struct phy *phy, bool enable) +{ + struct rockchip_dp_phy *dp = phy_get_drvdata(phy); + int ret; + + if (enable) { + ret = regmap_write(dp->grf, GRF_SOC_CON12, + GRF_EDP_PHY_SIDDQ_WRITE_EN | + GRF_EDP_PHY_SIDDQ_ON); + if (ret < 0) { + dev_err(dp->dev, "Can't enable PHY power %d\n", ret); + return ret; + } + + ret = clk_prepare_enable(dp->phy_24m); + unnecessary empty line after clk_prepare_enable with these things fixed, Reviewed-by: Heiko Stuebner <he...@sntech.de> Oops, thanks - Yakir Cheers, Heiko -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 06/17] dt-bindings: add document for analogix display port driver
Analogix dp driver is split from exynos dp driver, so we just make an copy of exynos_dp.txt, and then simplify exynos_dp.txt Beside update some exynos dtsi file with the latest change according to the devicetree binding documents. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v8: - Correct the right document path of display-timing.txt (Heiko) - Correct the misspell of 'from' to 'frm'. (Heiko) Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: - Split all DTS changes, and provide backward compatibility. Mark old properties as deprecated but still support them. (Krzysztof) - Update "analogix,hpd-gpio" to "hpd-gpios" prop name. (Rob) - Deprecated some properties which could parsed from Edid/Mode/DPCD. (Thierry) "analogix,color-space" & "analogix,color-depth" & "analogix,link-rate" & "analogix,lane-count"& "analogix,ycbcr-coeff" & "analogix,dynamic-range" & "vsync-active-high"& "hsync-active-high" & "interlaces" Changes in v3: - Add devicetree binding documents. (Heiko) - Remove sync pol & colorimetry properies from the new analogix dp driver devicetree binding. (Thierry) - Update the exist exynos dtsi file with the latest DP DT properies. Changes in v2: None .../bindings/display/bridge/analogix_dp.txt| 50 + .../bindings/display/exynos/exynos_dp.txt | 65 -- 2 files changed, 72 insertions(+), 43 deletions(-) create mode 100644 Documentation/devicetree/bindings/display/bridge/analogix_dp.txt diff --git a/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt new file mode 100644 index 000..7659a7a --- /dev/null +++ b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt @@ -0,0 +1,50 @@ +Analogix Display Port bridge bindings + +Required properties for dp-controller: + -compatible: + platform specific such as: +* "samsung,exynos5-dp" +* "rockchip,rk3288-dp" + -reg: + physical base address of the controller and length + of memory mapped region. + -interrupts: + interrupt combiner values. + -clocks: + from common clock binding: handle to dp clock. + -clock-names: + from common clock binding: Shall be "dp". + -interrupt-parent: + phandle to Interrupt combiner node. + -phys: + from general PHY binding: the phandle for the PHY device. + -phy-names: + from general PHY binding: Should be "dp". + +Optional properties for dp-controller: + -hpd-gpios: + Hotplug detect GPIO. + Indicates which GPIO should be used for hotplug detection + -port@[X]: SoC specific port nodes with endpoint definitions as defined + in Documentation/devicetree/bindings/media/video-interfaces.txt, + please refer to the SoC specific binding document: + * Documentation/devicetree/bindings/display/exynos/exynos_dp.txt + * Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt + + +[1]: Documentation/devicetree/bindings/media/video-interfaces.txt +--- + +Example: + + dp-controller { + compatible = "samsung,exynos5-dp"; + reg = <0x145b 0x1>; + interrupts = <10 3>; + interrupt-parent = <>; + clocks = < 342>; + clock-names = "dp"; + + phys = <_phy>; + phy-names = "dp"; + }; diff --git a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt index 7a3a9cd..9905081 100644 --- a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt +++ b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt @@ -31,45 +31,31 @@ Required properties for dp-controller: from general PHY binding: the phandle for the PHY device. -phy-names: from general PHY binding: Should be "dp". - -samsung,color-space: - input video data format. - COLOR_RGB = 0, COLOR_YCBCR422 = 1, COLOR_YCBCR444 = 2 - -samsung,dynamic-range: - dynamic range for input video data. - VESA = 0, CEA = 1 - -samsung,ycbcr-coeff: - YCbCr co-efficients for input video. - COLOR_Y
[PATCH v8 05/17] drm: bridge: analogix/dp: dynamic parse sync_pol & interlace & dynamic_range
Both hsync/vsync polarity and interlace mode can be parsed from drm display mode, and dynamic_range and ycbcr_coeff can be judge by the video code. But presumably Exynos still relies on the DT properties, so take good use of mode_fixup() in to achieve the compatibility hacks. Reviewed-by: Krzysztof Kozlowski <k.kozlow...@samsung.com> Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v8: None Changes in v7: - Back to use the of_property_read_bool() interfacs to provoid backward compatibility of "hsync-active-high" "vsync-active-high" "interlaced" to avoid -EOVERFLOW error (Krzysztof) Changes in v6: None Changes in v5: - Switch video timing type to "u32", so driver could use "of_property_read_u32" to get the backword timing values. Krzysztof suggest me that driver could use the "of_property_read_bool" to get backword timing values, but that interfacs would modify the original drm_display_mode timing directly (whether those properties exists or not). Changes in v4: - Provide backword compatibility with samsung. (Krzysztof) Changes in v3: - Dynamic parse video timing info from struct drm_display_mode and struct drm_display_info. (Thierry) Changes in v2: None drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 148 + drivers/gpu/drm/bridge/analogix/analogix_dp_core.h | 2 +- drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 14 +- 3 files changed, 103 insertions(+), 61 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 96afb67..6307060 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -890,8 +890,8 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) return; } - ret = analogix_dp_set_link_train(dp, dp->video_info->lane_count, -dp->video_info->link_rate); + ret = analogix_dp_set_link_train(dp, dp->video_info.lane_count, +dp->video_info.link_rate); if (ret) { dev_err(dp->dev, "unable to do link train\n"); return; @@ -1030,6 +1030,85 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge) dp->dpms_mode = DRM_MODE_DPMS_OFF; } +static void analogix_dp_bridge_mode_set(struct drm_bridge *bridge, + struct drm_display_mode *orig_mode, + struct drm_display_mode *mode) +{ + struct analogix_dp_device *dp = bridge->driver_private; + struct drm_display_info *display_info = >connector->display_info; + struct video_info *video = >video_info; + struct device_node *dp_node = dp->dev->of_node; + int vic; + + /* Input video interlaces & hsync pol & vsync pol */ + video->interlaced = !!(mode->flags & DRM_MODE_FLAG_INTERLACE); + video->v_sync_polarity = !!(mode->flags & DRM_MODE_FLAG_NVSYNC); + video->h_sync_polarity = !!(mode->flags & DRM_MODE_FLAG_NHSYNC); + + /* Input video dynamic_range & colorimetry */ + vic = drm_match_cea_mode(mode); + if ((vic == 6) || (vic == 7) || (vic == 21) || (vic == 22) || + (vic == 2) || (vic == 3) || (vic == 17) || (vic == 18)) { + video->dynamic_range = CEA; + video->ycbcr_coeff = COLOR_YCBCR601; + } else if (vic) { + video->dynamic_range = CEA; + video->ycbcr_coeff = COLOR_YCBCR709; + } else { + video->dynamic_range = VESA; + video->ycbcr_coeff = COLOR_YCBCR709; + } + + /* Input vide bpc and color_formats */ + switch (display_info->bpc) { + case 12: + video->color_depth = COLOR_12; + break; + case 10: + video->color_depth = COLOR_10; + break; + case 8: + video->color_depth = COLOR_8; + break; + case 6: + video->color_depth = COLOR_6; + break; + default: + video->color_depth = COLOR_8; + break; + } + if (display_info->color_formats & DRM_COLOR_FORMAT_YCRCB444) + video->color_space = COLOR_YCBCR444; + else if (display_info->color_formats & DRM_COLOR_FORMAT_YCRCB422) + video->color_space = COLOR_YCBCR422; + else if (display_info->color_formats & DRM_COLOR_FORMAT_RGB444) + video->color_space = COLOR_RGB; + else + video->color_space = COLOR_RGB; + + /* +* NOTE:
[PATCH v8 0/17] Add Analogix Core Display Port Driver
correct the input paramters of devm_phy_create() interfaces. (Heiko) - Split binding doc's from driver changes. (Rob) - Update the rockchip,grf explain in document, and correct the clock required elemets in document. (Rob & Heiko) - Fix compiled error (Heiko) - Using the connector display info message to configure eDP driver input video mode, but hard code CRTC video output mode to RGBaaa. Changes in v4: - Update "analogix,hpd-gpios" to "hpd-gpios" DT propery. (Rob) - Rename "analogix_dp-exynos.c" file name to "exynos_dp.c" (Jingoo) - Create a separate folder for analogix code in bridge/ (Archit) - Update commit message more readable. (Jingoo) - Adjust the order from 05 to 04 - Provide backword compatibility with samsung. (Krzysztof) - Split all DTS changes, and provide backward compatibility. Mark old properties as deprecated but still support them. (Krzysztof) - Update "analogix,hpd-gpio" to "hpd-gpios" prop name. (Rob) - Deprecated some properties which could parsed from Edid/Mode/DPCD. (Thierry) "analogix,color-space" & "analogix,color-depth" & "analogix,link-rate" & "analogix,lane-count"& "analogix,ycbcr-coeff" & "analogix,dynamic-range" & "vsync-active-high"& "hsync-active-high" & "interlaces" - Separate all DTS changes to a separate patch. (Krzysztof) - Remove some deprecated DT properties in rockchip dp document. - Add commit message, and remove the redundant rockchip_dp_phy_init() function, move those code to probe() method. And remove driver .owner number. (Kishon) - Seprate the link-rate and lane-count limit out with the device_type flag. (Thierry) - Take Jingoo suggest, add commit messages. - Call drm_panel_prepare() in .get_modes function, ensure panel should power on before driver try to read edid message. Changes in v3: - Move exynos's video_timing code to analogix_dp-exynos platform driver, add get_modes method to struct analogix_dp_plat_data. (Thierry) - Rename some "samsung*" dts propery to "analogix*". (Heiko) - The link_rate and lane_count shouldn't config to the DT property value directly, but we can take those as hardware limite. For example, RK3288 only support 4 physical lanes of 2.7/1.62 Gbps/lane, so DT property would like "link-rate = 0x0a" "lane-count = 4". (Thierry) - Dynamic parse video timing info from struct drm_display_mode and struct drm_display_info. (Thierry) - Add devicetree binding documents. (Heiko) - Remove sync pol & colorimetry properies from the new analogix dp driver devicetree binding. (Thierry) - Update the exist exynos dtsi file with the latest DP DT properies. - Leave "sclk_edp_24m" to rockchip dp phy driver which name to "24m", and leave "sclk_edp" to analogix dp core driver which name to "dp", and leave "pclk_edp" to rockchip dp platform driver which name to "pclk". (Thierry & Heiko) - Add devicetree binding document. (Heiko) - Remove "rockchip,panel" DT property, take use of remote point to get panel node. (Heiko) - Add the new function point dp_platdata->get_modes() init. - Suggest, add rockchip dp phy driver, collect the phy clocks and power control. (Heiko) - Add "analogix,need-force-hpd" to indicate whether driver need foce hpd when hpd detect failed. - move dp hpd detect to connector detect function. - Add edid modes parse support Changes in v2: - Keep author name list no changed (Jingoo) - Remove new copyright (Jingoo) - Fix compiled failed due to analogix_dp_device misspell - Improved commit message more readable, and avoid using some uncommon style like bellow: (Joe Preches) - retval = exynos_dp_read_bytes_from_i2c(... ...); + retval = + exynos_dp_read_bytes_from_i2c(..); - Get panel node with remote-endpoint method, and create devicetree binding for driver. (Heiko) - Remove the clock enable/disbale with "sclk_edp" & "sclk_edp_24m", leave those clock to rockchip dp phy driver. - Fix compile failed dut to phy_pd_addr variable misspell error Mark Yao (1): drm: rockchip: vop: add bpc and color mode setting Yakir Yang (16): drm: exynos: dp: convert to drm bridge mode drm: bridge: analogix/dp: split exynos dp driver to bridge directory drm: bridge: analogix/dp: fix some obvious code style drm: bridge: analogix/dp: remove duplicate configuration of link rate and link count drm: bridge: analogix/dp: dynamic parse sync_pol & interlace & dynamic_range dt-bindings: add document for analogix display port driver ARM: dts: exynos/dp: remove some properties that deprecated by analogix_dp driver drm: rockchip: dp: add rockchip platform dp driver dt-binding
[PATCH v8 04/17] drm: bridge: analogix/dp: remove duplicate configuration of link rate and link count
link_rate and lane_count already configured in analogix_dp_set_link_train(), so we don't need to config those repeatly after training finished, just remove them out. Beside Display Port 1.2 already support 5.4Gbps link rate, the maximum sets would change from {1.62Gbps, 2.7Gbps} to {1.62Gbps, 2.7Gbps, 5.4Gbps}. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: - Update commit message more readable. (Jingoo) - Adjust the order from 05 to 04 Changes in v3: - The link_rate and lane_count shouldn't config to the DT property value directly, but we can take those as hardware limite. For example, RK3288 only support 4 physical lanes of 2.7/1.62 Gbps/lane, so DT property would like "link-rate = 0x0a" "lane-count = 4". (Thierry) Changes in v2: None drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 8 drivers/gpu/drm/bridge/analogix/analogix_dp_core.h | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 334181c..96afb67 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -624,6 +624,8 @@ static void analogix_dp_get_max_rx_bandwidth(struct analogix_dp_device *dp, /* * For DP rev.1.1, Maximum link rate of Main Link lanes * 0x06 = 1.62 Gbps, 0x0a = 2.7 Gbps +* For DP rev.1.2, Maximum link rate of Main Link lanes +* 0x06 = 1.62 Gbps, 0x0a = 2.7 Gbps, 0x14 = 5.4Gbps */ analogix_dp_read_byte_from_dpcd(dp, DP_MAX_LINK_RATE, ); *bandwidth = data; @@ -657,7 +659,8 @@ static void analogix_dp_init_training(struct analogix_dp_device *dp, analogix_dp_get_max_rx_lane_count(dp, >link_train.lane_count); if ((dp->link_train.link_rate != LINK_RATE_1_62GBPS) && - (dp->link_train.link_rate != LINK_RATE_2_70GBPS)) { + (dp->link_train.link_rate != LINK_RATE_2_70GBPS) && + (dp->link_train.link_rate != LINK_RATE_5_40GBPS)) { dev_err(dp->dev, "Rx Max Link Rate is abnormal :%x !\n", dp->link_train.link_rate); dp->link_train.link_rate = LINK_RATE_1_62GBPS; @@ -898,9 +901,6 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) analogix_dp_enable_rx_to_enhanced_mode(dp, 1); analogix_dp_enable_enhanced_mode(dp, 1); - analogix_dp_set_lane_count(dp, dp->video_info->lane_count); - analogix_dp_set_link_bandwidth(dp, dp->video_info->link_rate); - analogix_dp_init_video(dp); ret = analogix_dp_config_video(dp); if (ret) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h index 14d20be..9a90a18 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h @@ -21,8 +21,9 @@ #define MAX_EQ_LOOP 5 enum link_rate_type { - LINK_RATE_1_62GBPS = 0x06, - LINK_RATE_2_70GBPS = 0x0a + LINK_RATE_1_62GBPS = DP_LINK_BW_1_62, + LINK_RATE_2_70GBPS = DP_LINK_BW_2_7, + LINK_RATE_5_40GBPS = DP_LINK_BW_5_4, }; enum link_lane_count_type { -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 10/17] phy: Add driver for rockchip Display Port PHY
Add phy driver for the Rockchip DisplayPort PHY module. This is required to get DisplayPort working in Rockchip SoCs. Reviewed-by: Heiko Stuebner <he...@sntech.de> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v8: - Fix the mixed spacers on macro definitions. (Heiko) - Remove the unnecessary empty line after clk_prepare_enable. (Heiko) Changes in v7: - Simply the commit message. (Kishon) - Symmetrical enable/disbale the phy clock and power. (Kishon) Changes in v6: None Changes in v5: - Remove "reg" DT property, cause driver could poweron/poweroff phy via the exist "grf" syscon already. And rename the example DT node from "edp_phy: phy@ff770274" to "edp_phy: edp-phy" directly. (Heiko) - Add deivce_node at the front of driver, update phy_ops type from "static struct" to "static const struct". And correct the input paramters of devm_phy_create() interfaces. (Heiko) Changes in v4: - Add commit message, and remove the redundant rockchip_dp_phy_init() function, move those code to probe() method. And remove driver .owner number. (Kishon) Changes in v3: - Suggest, add rockchip dp phy driver, collect the phy clocks and power control. (Heiko) Changes in v2: None drivers/phy/Kconfig | 7 ++ drivers/phy/Makefile | 1 + drivers/phy/phy-rockchip-dp.c | 155 ++ 3 files changed, 163 insertions(+) create mode 100644 drivers/phy/phy-rockchip-dp.c diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 7eb5859d..7355819 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -319,6 +319,13 @@ config PHY_ROCKCHIP_USB help Enable this to support the Rockchip USB 2.0 PHY. +config PHY_ROCKCHIP_DP + tristate "Rockchip Display Port PHY Driver" + depends on ARCH_ROCKCHIP && OF + select GENERIC_PHY + help + Enable this to support the Rockchip Display Port PHY. + config PHY_ST_SPEAR1310_MIPHY tristate "ST SPEAR1310-MIPHY driver" select GENERIC_PHY diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index 075db1a..b1700cd 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -35,6 +35,7 @@ phy-exynos-usb2-$(CONFIG_PHY_S5PV210_USB2)+= phy-s5pv210-usb2.o obj-$(CONFIG_PHY_EXYNOS5_USBDRD) += phy-exynos5-usbdrd.o obj-$(CONFIG_PHY_QCOM_APQ8064_SATA)+= phy-qcom-apq8064-sata.o obj-$(CONFIG_PHY_ROCKCHIP_USB) += phy-rockchip-usb.o +obj-$(CONFIG_PHY_ROCKCHIP_DP) += phy-rockchip-dp.o obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA)+= phy-qcom-ipq806x-sata.o obj-$(CONFIG_PHY_ST_SPEAR1310_MIPHY) += phy-spear1310-miphy.o obj-$(CONFIG_PHY_ST_SPEAR1340_MIPHY) += phy-spear1340-miphy.o diff --git a/drivers/phy/phy-rockchip-dp.c b/drivers/phy/phy-rockchip-dp.c new file mode 100644 index 000..c82c22f --- /dev/null +++ b/drivers/phy/phy-rockchip-dp.c @@ -0,0 +1,155 @@ +/* + * Rockchip DP PHY driver + * + * Copyright (C) 2015 FuZhou Rockchip Co., Ltd. + * Author: Yakir Yang <ykk@@rock-chips.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define GRF_SOC_CON12 0x0274 + +#define GRF_EDP_REF_CLK_SEL_INTER_HIWORD_MASK BIT(4) +#define GRF_EDP_REF_CLK_SEL_INTER BIT(4) + +#define GRF_EDP_PHY_SIDDQ_HIWORD_MASK BIT(21) +#define GRF_EDP_PHY_SIDDQ_ON0 +#define GRF_EDP_PHY_SIDDQ_OFF BIT(5) + +struct rockchip_dp_phy { + struct device *dev; + struct regmap *grf; + struct clk *phy_24m; +}; + +static int rockchip_set_phy_state(struct phy *phy, bool enable) +{ + struct rockchip_dp_phy *dp = phy_get_drvdata(phy); + int ret; + + if (enable) { + ret = regmap_write(dp->grf, GRF_SOC_CON12, + GRF_EDP_PHY_SIDDQ_HIWORD_MASK | + GRF_EDP_PHY_SIDDQ_ON); + if (ret < 0) { + dev_err(dp->dev, "Can't enable PHY power %d\n", ret); + return ret; + } + + ret = clk_prepare_enable(dp->phy_24m); + } else { + clk_disable_unprepare(dp->phy_24m); + + ret = regmap_write(dp->grf, GRF_SOC_CON12, + GRF_EDP_PHY_SIDDQ_HIWORD_MASK | + GRF_EDP_PHY_SIDDQ_OFF); + } + + return ret; +} + +static int rockchip_dp_phy_power_on(struct phy *phy) +{ + return rockchip_set_phy_state(phy, true); +} + +static int rockchip_dp_phy_power_off(struct phy *
[PATCH v8 01/17] drm: exynos: dp: convert to drm bridge mode
In order to move exynos dp code to bridge directory, we need to convert driver drm bridge mode first. As dp driver already have a ptn3460 bridge, so we need to move ptn bridge to the next bridge of dp bridge. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v8: None Changes in v7: None Changes in v6: - Fix the wrong code in previous series, and test on Samsung snow Chromebook successfully, here are the detail changes: => - if (!dp->panel && !dp->bridge) { + if (!dp->panel && !dp->ptn_bridge) { ret = exynos_dp_dt_parse_panel(dp); if (ret) => + encoder->bridge = bridge; bridge->driver_private = dp; bridge->encoder = encoder; bridge->funcs = _dp_bridge_funcs; ret = drm_bridge_attach(drm_dev, bridge); Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: - Keep author name list no changed (Jingoo) drivers/gpu/drm/exynos/exynos_dp_core.c | 103 drivers/gpu/drm/exynos/exynos_dp_core.h | 1 + 2 files changed, 78 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 124fb9a..aedd074 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -1009,9 +1009,9 @@ static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, { int ret; - encoder->bridge = dp->bridge; - dp->bridge->encoder = encoder; - ret = drm_bridge_attach(encoder->dev, dp->bridge); + encoder->bridge->next = dp->ptn_bridge; + dp->ptn_bridge->encoder = encoder; + ret = drm_bridge_attach(encoder->dev, dp->ptn_bridge); if (ret) { DRM_ERROR("Failed to attach bridge to drm\n"); return ret; @@ -1020,14 +1020,15 @@ static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, return 0; } -static int exynos_dp_create_connector(struct drm_encoder *encoder) +static int exynos_dp_bridge_attach(struct drm_bridge *bridge) { - struct exynos_dp_device *dp = encoder_to_dp(encoder); + struct exynos_dp_device *dp = bridge->driver_private; + struct drm_encoder *encoder = >encoder; struct drm_connector *connector = >connector; int ret; /* Pre-empt DP connector creation if there's a bridge */ - if (dp->bridge) { + if (dp->ptn_bridge) { ret = exynos_drm_attach_lcd_bridge(dp, encoder); if (!ret) return 0; @@ -1052,22 +1053,9 @@ static int exynos_dp_create_connector(struct drm_encoder *encoder) return ret; } -static bool exynos_dp_mode_fixup(struct drm_encoder *encoder, -const struct drm_display_mode *mode, -struct drm_display_mode *adjusted_mode) -{ - return true; -} - -static void exynos_dp_mode_set(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ -} - -static void exynos_dp_enable(struct drm_encoder *encoder) +static void exynos_dp_bridge_enable(struct drm_bridge *bridge) { - struct exynos_dp_device *dp = encoder_to_dp(encoder); + struct exynos_dp_device *dp = bridge->driver_private; struct exynos_drm_crtc *crtc = dp_to_crtc(dp); if (dp->dpms_mode == DRM_MODE_DPMS_ON) @@ -1092,9 +1080,9 @@ static void exynos_dp_enable(struct drm_encoder *encoder) dp->dpms_mode = DRM_MODE_DPMS_ON; } -static void exynos_dp_disable(struct drm_encoder *encoder) +static void exynos_dp_bridge_disable(struct drm_bridge *bridge) { - struct exynos_dp_device *dp = encoder_to_dp(encoder); + struct exynos_dp_device *dp = bridge->driver_private; struct exynos_drm_crtc *crtc = dp_to_crtc(dp); if (dp->dpms_mode != DRM_MODE_DPMS_ON) @@ -1123,6 +,69 @@ static void exynos_dp_disable(struct drm_encoder *encoder) dp->dpms_mode = DRM_MODE_DPMS_OFF; } +static void exynos_dp_bridge_nop(struct drm_bridge *bridge) +{ + /* do nothing */ +} + +static const struct drm_bridge_funcs exynos_dp_bridge_funcs = { + .enable = exynos_dp_bridge_enable, + .disable = exynos_dp_bridge_disable, + .pre_enable = exynos_dp_bridge_nop, + .post_disable = exynos_dp_bridge_nop, + .attach = exynos_dp_bridge_attach, +}; + +static int exynos_dp_create_connector(struct drm_encoder *encoder) +{ + struct exynos_dp_device *dp = encoder_to_dp(encoder); + struct drm_device *drm_dev = dp->drm_dev; + struct drm_bridge *bridge; + int ret; + + bridge = devm_kzalloc(drm_dev->
[PATCH v8 03/17] drm: bridge: analogix/dp: fix some obvious code style
Fix some obvious alignment problems, like alignment and line over 80 characters problems, make this easy to be maintained later. Reviewed-by: Krzysztof Kozlowski <k.kozlow...@samsung.com> Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: - Resequence this patch after analogix_dp driver have been split from exynos_dp code, and rephrase reasonable commit message, and remove some controversial style (Krzysztof) - analogix_dp_write_byte_to_dpcd( - dp, DP_TEST_RESPONSE, + analogix_dp_write_byte_to_dpcd(dp, + DP_TEST_RESPONSE, DP_TEST_EDID_CHECKSUM_WRITE); Changes in v4: None Changes in v3: None Changes in v2: - Improved commit message more readable, and avoid using some uncommon style like bellow: (Joe Preches) - retval = exynos_dp_read_bytes_from_i2c(... ...); + retval = + exynos_dp_read_bytes_from_i2c(..); drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 129 ++--- drivers/gpu/drm/bridge/analogix/analogix_dp_core.h | 72 ++-- drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 124 ++-- 3 files changed, 163 insertions(+), 162 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index e561590..334181c 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -61,7 +61,7 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device *dp) while (analogix_dp_get_plug_in_status(dp) != 0) { timeout_loop++; - if (DP_TIMEOUT_LOOP_COUNT < timeout_loop) { + if (timeout_loop > DP_TIMEOUT_LOOP_COUNT) { dev_err(dp->dev, "failed to get hpd plug status\n"); return -ETIMEDOUT; } @@ -98,8 +98,8 @@ static int analogix_dp_read_edid(struct analogix_dp_device *dp) /* Read Extension Flag, Number of 128-byte EDID extension blocks */ retval = analogix_dp_read_byte_from_i2c(dp, I2C_EDID_DEVICE_ADDR, - EDID_EXTENSION_FLAG, - _block); + EDID_EXTENSION_FLAG, + _block); if (retval) return retval; @@ -107,7 +107,8 @@ static int analogix_dp_read_edid(struct analogix_dp_device *dp) dev_dbg(dp->dev, "EDID data includes a single extension!\n"); /* Read EDID data */ - retval = analogix_dp_read_bytes_from_i2c(dp, I2C_EDID_DEVICE_ADDR, + retval = analogix_dp_read_bytes_from_i2c(dp, + I2C_EDID_DEVICE_ADDR, EDID_HEADER_PATTERN, EDID_BLOCK_LENGTH, [EDID_HEADER_PATTERN]); @@ -138,7 +139,7 @@ static int analogix_dp_read_edid(struct analogix_dp_device *dp) } analogix_dp_read_byte_from_dpcd(dp, DP_TEST_REQUEST, - _vector); + _vector); if (test_vector & DP_TEST_LINK_EDID_READ) { analogix_dp_write_byte_to_dpcd(dp, DP_TEST_EDID_CHECKSUM, @@ -152,10 +153,8 @@ static int analogix_dp_read_edid(struct analogix_dp_device *dp) /* Read EDID data */ retval = analogix_dp_read_bytes_from_i2c(dp, - I2C_EDID_DEVICE_ADDR, - EDID_HEADER_PATTERN, - EDID_BLOCK_LENGTH, - [EDID_HEADER_PATTERN]); + I2C_EDID_DEVICE_ADDR, EDID_HEADER_PATTERN, + EDID_BLOCK_LENGTH, [EDID_HEADER_PATTERN]); if (retval != 0) { dev_err(dp->dev, "EDID Read failed!\n"); return -EIO; @@ -166,16 +165,13 @@ static int analogix_dp_read_edid(struct analogix_dp_device *dp) return -EIO; } - analogix_dp_read_byte_from_dpcd(dp, - DP_TEST_REQUEST, - _vector); + analogix_dp_read_byte_from_dpcd(dp, DP_TEST_REQUEST, + _vector); if (test_vector & DP_TEST_LINK_EDID_READ) { analogix_dp_write
[PATCH v8 08/17] drm: rockchip: dp: add rockchip platform dp driver
Rockchip have three clocks for dp controller, we leave pclk_edp to analogix_dp driver control, and keep the sclk_edp_24m and sclk_edp in platform driver. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: - Remove the empty line at the end of document, and correct the endpoint numbers in the example DT node, and remove the regulator iomux setting in driver code while using the pinctl in devicetree instead. (Heiko) - Add device type declared, cause the previous "platform device type support (v4 11/16)" already merge into (v5 02/14). - Implement connector registration code. (Thierry) Changes in v4: - Remove some deprecated DT properties in rockchip dp document. Changes in v3: - Leave "sclk_edp_24m" to rockchip dp phy driver which name to "24m", and leave "sclk_edp" to analogix dp core driver which name to "dp", and leave "pclk_edp" to rockchip dp platform driver which name to "pclk". (Thierry & Heiko) - Add devicetree binding document. (Heiko) - Remove "rockchip,panel" DT property, take use of remote point to get panel node. (Heiko) - Add the new function point dp_platdata->get_modes() init. Changes in v2: - Get panel node with remote-endpoint method, and create devicetree binding for driver. (Heiko) - Remove the clock enable/disbale with "sclk_edp" & "sclk_edp_24m", leave those clock to rockchip dp phy driver. drivers/gpu/drm/rockchip/Kconfig| 9 + drivers/gpu/drm/rockchip/Makefile | 1 + drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 442 include/drm/bridge/analogix_dp.h| 1 + 4 files changed, 453 insertions(+) create mode 100644 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig index 35215f6..c2ba945 100644 --- a/drivers/gpu/drm/rockchip/Kconfig +++ b/drivers/gpu/drm/rockchip/Kconfig @@ -25,3 +25,12 @@ config ROCKCHIP_DW_HDMI for the Synopsys DesignWare HDMI driver. If you want to enable HDMI on RK3288 based SoC, you should selet this option. + +config ROCKCHIP_ANALOGIX_DP +tristate "Rockchip specific extensions for Analogix DP driver" +depends on DRM_ROCKCHIP +select DRM_ANALOGIX_DP +help + This selects support for Rockchip SoC specific extensions + for the Analogix Core DP driver. If you want to enable DP + on RK3288 based SoC, you should selet this option. diff --git a/drivers/gpu/drm/rockchip/Makefile b/drivers/gpu/drm/rockchip/Makefile index f3d8a19..8ad01fb 100644 --- a/drivers/gpu/drm/rockchip/Makefile +++ b/drivers/gpu/drm/rockchip/Makefile @@ -6,5 +6,6 @@ rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o rockchip_drm_fbdev.o \ rockchip_drm_gem.o obj-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o +obj-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o rockchip_drm_vop.o diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c new file mode 100644 index 000..2c82a9a --- /dev/null +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -0,0 +1,442 @@ +/* + * Rockchip SoC DP (Display Port) interface driver. + * + * Copyright (C) Fuzhou Rockchip Electronics Co., Ltd. + * Author: Andy Yan <andy@rock-chips.com> + * Yakir Yang <y...@rock-chips.com> + * Jeff Chen <jeff.c...@rock-chips.com> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include "rockchip_drm_drv.h" +#include "rockchip_drm_vop.h" + +#define to_dp(nm) container_of(nm, struct rockchip_dp_device, nm) + +/* dp grf register offset */ +#define GRF_SOC_CON60x025c +#define GRF_EDP_LCD_SEL_MASKBIT(5) +#define GRF_EDP_SEL_VOP_LIT BIT(5) +#define GRF_EDP_SEL_VOP_BIG 0 + +struct rockchip_dp_device { + struct drm_device*drm_dev; + struct device*dev; + struct drm_encoder encoder; + struct drm_connector connector; + struct drm_display_mode mode; + + struct clk *pclk; + struct regmap*grf; + struct reset_control *rst; + + struct a
[PATCH v8 07/17] ARM: dts: exynos/dp: remove some properties that deprecated by analogix_dp driver
After exynos_dp have been split the common IP code into analogix_dp driver, the analogix_dp driver have deprecated some Samsung platform properties which could be dynamically parsed from EDID/MODE/DPCD message, so this is an update for Exynos DTS file for dp-controller. Beside the backward compatibility is fully preserved, so there are no bisectability break that make this change in a separate patch. Reviewed-by: Krzysztof Kozlowski <k.kozlow...@samsung.com> Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v8: None Changes in v7: None Changes in v6: - Fix Peach Pit hpd property name error: - hpd-gpio = < 6 0>; + hpd-gpios = < 6 0>; Changes in v5: - Correct the misspell in commit message. (Krzysztof) Changes in v4: - Separate all DTS changes to a separate patch. (Krzysztof) Changes in v3: None Changes in v2: None arch/arm/boot/dts/exynos5250-arndale.dts | 2 -- arch/arm/boot/dts/exynos5250-smdk5250.dts | 2 -- arch/arm/boot/dts/exynos5250-snow-common.dtsi | 4 +--- arch/arm/boot/dts/exynos5250-spring.dts | 4 +--- arch/arm/boot/dts/exynos5420-peach-pit.dts| 4 +--- arch/arm/boot/dts/exynos5420-smdk5420.dts | 2 -- arch/arm/boot/dts/exynos5800-peach-pi.dts | 4 +--- 7 files changed, 4 insertions(+), 18 deletions(-) diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts index c000532..b1790cf 100644 --- a/arch/arm/boot/dts/exynos5250-arndale.dts +++ b/arch/arm/boot/dts/exynos5250-arndale.dts @@ -124,8 +124,6 @@ { status = "okay"; samsung,color-space = <0>; - samsung,dynamic-range = <0>; - samsung,ycbcr-coeff = <0>; samsung,color-depth = <1>; samsung,link-rate = <0x0a>; samsung,lane-count = <4>; diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts index 0f5dcd4..f30c2db 100644 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts @@ -80,8 +80,6 @@ { samsung,color-space = <0>; - samsung,dynamic-range = <0>; - samsung,ycbcr-coeff = <0>; samsung,color-depth = <1>; samsung,link-rate = <0x0a>; samsung,lane-count = <4>; diff --git a/arch/arm/boot/dts/exynos5250-snow-common.dtsi b/arch/arm/boot/dts/exynos5250-snow-common.dtsi index 0a7f408..ee94110 100644 --- a/arch/arm/boot/dts/exynos5250-snow-common.dtsi +++ b/arch/arm/boot/dts/exynos5250-snow-common.dtsi @@ -236,12 +236,10 @@ pinctrl-names = "default"; pinctrl-0 = <_hpd>; samsung,color-space = <0>; - samsung,dynamic-range = <0>; - samsung,ycbcr-coeff = <0>; samsung,color-depth = <1>; samsung,link-rate = <0x0a>; samsung,lane-count = <2>; - samsung,hpd-gpio = < 7 GPIO_ACTIVE_HIGH>; + hpd-gpios = < 7 GPIO_ACTIVE_HIGH>; ports { port@0 { diff --git a/arch/arm/boot/dts/exynos5250-spring.dts b/arch/arm/boot/dts/exynos5250-spring.dts index c1edd6d..91881d7 100644 --- a/arch/arm/boot/dts/exynos5250-spring.dts +++ b/arch/arm/boot/dts/exynos5250-spring.dts @@ -74,12 +74,10 @@ pinctrl-names = "default"; pinctrl-0 = <_hpd_gpio>; samsung,color-space = <0>; - samsung,dynamic-range = <0>; - samsung,ycbcr-coeff = <0>; samsung,color-depth = <1>; samsung,link-rate = <0x0a>; samsung,lane-count = <1>; - samsung,hpd-gpio = < 0 GPIO_ACTIVE_HIGH>; + hpd-gpios = < 0 GPIO_ACTIVE_HIGH>; }; { diff --git a/arch/arm/boot/dts/exynos5420-peach-pit.dts b/arch/arm/boot/dts/exynos5420-peach-pit.dts index 72ba6f0..8baf40a 100644 --- a/arch/arm/boot/dts/exynos5420-peach-pit.dts +++ b/arch/arm/boot/dts/exynos5420-peach-pit.dts @@ -148,12 +148,10 @@ pinctrl-names = "default"; pinctrl-0 = <_hpd_gpio>; samsung,color-space = <0>; - samsung,dynamic-range = <0>; - samsung,ycbcr-coeff = <0>; samsung,color-depth = <1>; samsung,link-rate = <0x06>; samsung,lane-count = <2>; - samsung,hpd-gpio = < 6 GPIO_ACTIVE_HIGH>; + hpd-gpios = < 6 GPIO_ACTIVE_HIGH>; ports { port@0 { diff --git a/arch/arm/boot/dts/exynos5420-smdk5420.dts b/arch/arm/boot/dts/exynos5420-smdk5420.dts index ac35aef..f67344f 100644 --- a/arch/arm/boot/dts/exynos5420-smdk5420.dts +++ b/arch/arm/boot/dts/exynos5420-smdk5420.dts @@ -93,8 +93,6 @@ pinctrl-names = "default"; pinctrl-0 = <_hpd>; samsung,color-space = <0>; - samsung,dynamic-range = <0>; - samsung,ycbc
[PATCH v8 09/17] dt-bindings: add document for rockchip variant of analogix_dp
Rockchip DP driver is a helper driver of analogix_dp coder driver, so most of the DT property should be descriped in analogix_dp document. Reviewed-by: Heiko Stuebner <he...@sntech.de> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v8: - Modify the commit subject name. (Heiko) Changes in v7: None Changes in v6: None Changes in v5: - Split binding doc's from driver changes. (Rob) - Add eDP hotplug pinctrl property. (Heiko) Changes in v4: None Changes in v3: None Changes in v2: None .../display/rockchip/analogix_dp-rockchip.txt | 90 ++ 1 file changed, 90 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt diff --git a/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt new file mode 100644 index 000..ec93917 --- /dev/null +++ b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt @@ -0,0 +1,90 @@ +Rockchip RK3288 specific extensions to the Analogix Display Port + + +Required properties: +- compatible: "rockchip,rk3288-edp"; + +- reg: physical base address of the controller and length + +- clocks: from common clock binding: handle to dp clock. + of memory mapped region. + +- clock-names: from common clock binding: + Required elements: "dp" "pclk" + +- resets: Must contain an entry for each entry in reset-names. + See ../reset/reset.txt for details. + +- pinctrl-names: Names corresponding to the chip hotplug pinctrl states. +- pinctrl-0: pin-control mode. should be <_hpd> + +- reset-names: Must include the name "dp" + +- rockchip,grf: this soc should set GRF regs, so need get grf here. + +- ports: contain a port node with endpoint definitions as defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. + + +For the below properties, please refer to Analogix DP binding document: + * Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt +- phys (required) +- phy-names (required) +- hpd-gpios (optional) +--- + +Example: + dp-controller: dp@ff97 { + compatible = "rockchip,rk3288-dp"; + reg = <0xff97 0x4000>; + interrupts = ; + clocks = < SCLK_EDP>, < PCLK_EDP_CTRL>; + clock-names = "dp", "pclk"; + phys = <_phy>; + phy-names = "dp"; + + rockchip,grf = <>; + resets = < 111>; + reset-names = "dp"; + + pinctrl-names = "default"; + pinctrl-0 = <_hpd>; + + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + edp_in: port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + edp_in_vopb: endpoint@0 { + reg = <0>; + remote-endpoint = <_out_edp>; + }; + edp_in_vopl: endpoint@1 { + reg = <1>; + remote-endpoint = <_out_edp>; + }; + }; + + edp_out: port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + edp_out_panel: endpoint { + reg = <0>; + remote-endpoint = <_in_edp> + }; + }; + }; + }; + + pinctrl { + edp { + edp_hpd: edp-hpd { + rockchip,pins = <7 11 RK_FUNC_2 _pull_none>; + }; + }; + }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 11/17] dt-bindings: add document for rockchip dp phy
Add dt binding documentation for rockchip display port PHY. Reviewed-by: Heiko Stuebner <he...@sntech.de> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v8: - Remove the specific address in the example node name. (Heiko) Changes in v7: - Simplify the commit message. (Kishon) Changes in v6: None Changes in v5: - Split binding doc's from driver changes. (Rob) - Update the rockchip,grf explain in document, and correct the clock required elemets in document. (Rob & Heiko) Changes in v4: None Changes in v3: None Changes in v2: None .../devicetree/bindings/phy/rockchip-dp-phy.txt| 22 ++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt diff --git a/Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt new file mode 100644 index 000..00902cb --- /dev/null +++ b/Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt @@ -0,0 +1,22 @@ +Rockchip Soc Seroes Display Port PHY + + +Required properties: +- compatible : should be one of the following supported values: +- "rockchip.rk3288-dp-phy" +- clocks: from common clock binding: handle to dp clock. + of memory mapped region. +- clock-names: from common clock binding: + Required elements: "24m" +- rockchip,grf: phandle to the syscon managing the "general register files" +- #phy-cells : from the generic PHY bindings, must be 0; + +Example: + +edp_phy: edp-phy { + compatible = "rockchip,rk3288-dp-phy"; + rockchip,grf = <>; + clocks = < SCLK_EDP_24M>; + clock-names = "24m"; + #phy-cells = <0>; +}; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v9 10/17] phy: Add driver for rockchip Display Port PHY
Add phy driver for the Rockchip DisplayPort PHY module. This is required to get DisplayPort working in Rockchip SoCs. Reviewed-by: Heiko Stuebner <he...@sntech.de> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v9: - Removed the unused the variable "res" in probe function. (Heiko) - Removed the unused head file. Changes in v8: - Fix the mixed spacers on macro definitions. (Heiko) - Remove the unnecessary empty line after clk_prepare_enable. (Heiko) Changes in v7: - Simply the commit message. (Kishon) - Symmetrical enable/disbale the phy clock and power. (Kishon) Changes in v6: None Changes in v5: - Remove "reg" DT property, cause driver could poweron/poweroff phy via the exist "grf" syscon already. And rename the example DT node from "edp_phy: phy@ff770274" to "edp_phy: edp-phy" directly. (Heiko) - Add deivce_node at the front of driver, update phy_ops type from "static struct" to "static const struct". And correct the input paramters of devm_phy_create() interfaces. (Heiko) Changes in v4: - Add commit message, and remove the redundant rockchip_dp_phy_init() function, move those code to probe() method. And remove driver .owner number. (Kishon) Changes in v3: - Suggest, add rockchip dp phy driver, collect the phy clocks and power control. (Heiko) Changes in v2: None drivers/phy/Kconfig | 7 ++ drivers/phy/Makefile | 1 + drivers/phy/phy-rockchip-dp.c | 151 ++ 3 files changed, 159 insertions(+) create mode 100644 drivers/phy/phy-rockchip-dp.c diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 7eb5859d..7355819 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -319,6 +319,13 @@ config PHY_ROCKCHIP_USB help Enable this to support the Rockchip USB 2.0 PHY. +config PHY_ROCKCHIP_DP + tristate "Rockchip Display Port PHY Driver" + depends on ARCH_ROCKCHIP && OF + select GENERIC_PHY + help + Enable this to support the Rockchip Display Port PHY. + config PHY_ST_SPEAR1310_MIPHY tristate "ST SPEAR1310-MIPHY driver" select GENERIC_PHY diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index 075db1a..b1700cd 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -35,6 +35,7 @@ phy-exynos-usb2-$(CONFIG_PHY_S5PV210_USB2)+= phy-s5pv210-usb2.o obj-$(CONFIG_PHY_EXYNOS5_USBDRD) += phy-exynos5-usbdrd.o obj-$(CONFIG_PHY_QCOM_APQ8064_SATA)+= phy-qcom-apq8064-sata.o obj-$(CONFIG_PHY_ROCKCHIP_USB) += phy-rockchip-usb.o +obj-$(CONFIG_PHY_ROCKCHIP_DP) += phy-rockchip-dp.o obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA)+= phy-qcom-ipq806x-sata.o obj-$(CONFIG_PHY_ST_SPEAR1310_MIPHY) += phy-spear1310-miphy.o obj-$(CONFIG_PHY_ST_SPEAR1340_MIPHY) += phy-spear1340-miphy.o diff --git a/drivers/phy/phy-rockchip-dp.c b/drivers/phy/phy-rockchip-dp.c new file mode 100644 index 000..f3e0058 --- /dev/null +++ b/drivers/phy/phy-rockchip-dp.c @@ -0,0 +1,151 @@ +/* + * Rockchip DP PHY driver + * + * Copyright (C) 2015 FuZhou Rockchip Co., Ltd. + * Author: Yakir Yang <ykk@@rock-chips.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License. + */ + +#include +#include +#include +#include +#include +#include +#include + +#define GRF_SOC_CON12 0x0274 + +#define GRF_EDP_REF_CLK_SEL_INTER_HIWORD_MASK BIT(4) +#define GRF_EDP_REF_CLK_SEL_INTER BIT(4) + +#define GRF_EDP_PHY_SIDDQ_HIWORD_MASK BIT(21) +#define GRF_EDP_PHY_SIDDQ_ON0 +#define GRF_EDP_PHY_SIDDQ_OFF BIT(5) + +struct rockchip_dp_phy { + struct device *dev; + struct regmap *grf; + struct clk *phy_24m; +}; + +static int rockchip_set_phy_state(struct phy *phy, bool enable) +{ + struct rockchip_dp_phy *dp = phy_get_drvdata(phy); + int ret; + + if (enable) { + ret = regmap_write(dp->grf, GRF_SOC_CON12, + GRF_EDP_PHY_SIDDQ_HIWORD_MASK | + GRF_EDP_PHY_SIDDQ_ON); + if (ret < 0) { + dev_err(dp->dev, "Can't enable PHY power %d\n", ret); + return ret; + } + + ret = clk_prepare_enable(dp->phy_24m); + } else { + clk_disable_unprepare(dp->phy_24m); + + ret = regmap_write(dp->grf, GRF_SOC_CON12, + GRF_EDP_PHY_SIDDQ_HIWORD_MASK | + GRF_EDP_PHY_SIDDQ_OFF); + } + + return ret; +} + +static int rockchip_dp_phy_power_on(struct phy *phy) +{ + return ro
[PATCH v8 17/17] drm: bridge: analogix/dp: add edid modes parse in get_modes method
Display Port monitor could support kinds of mode which indicate in monitor edid, not just one single display resolution which defined in panel or devivetree property display timing. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: - Call drm_panel_prepare() in .get_modes function, ensure panel should power on before driver try to read edid message. Changes in v3: - Add edid modes parse support Changes in v2: None drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 24 +++ drivers/gpu/drm/bridge/analogix/analogix_dp_core.h | 46 +++--- 2 files changed, 40 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 216d33d..4fa5f69 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -107,7 +107,7 @@ static unsigned char analogix_dp_calc_edid_check_sum(unsigned char *edid_data) static int analogix_dp_read_edid(struct analogix_dp_device *dp) { - unsigned char edid[EDID_BLOCK_LENGTH * 2]; + unsigned char *edid = dp->edid; unsigned int extend_block = 0; unsigned char sum; unsigned char test_vector; @@ -901,12 +901,6 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) DRM_ERROR("failed to disable the panel\n"); } - ret = analogix_dp_handle_edid(dp); - if (ret) { - dev_err(dp->dev, "unable to handle edid\n"); - return; - } - ret = analogix_dp_set_link_train(dp, dp->video_info.max_lane_count, dp->video_info.max_link_rate); if (ret) { @@ -947,8 +941,24 @@ EXPORT_SYMBOL_GPL(analogix_dp_detect); int analogix_dp_get_modes(struct device *dev) { struct analogix_dp_device *dp = dev_get_drvdata(dev); + struct edid *edid = (struct edid *)dp->edid; int num_modes = 0; + if (dp->plat_data && dp->plat_data->panel) { + if (drm_panel_prepare(dp->plat_data->panel)) { + DRM_ERROR("failed to setup the panel\n"); + return -EINVAL; + } + } + + if (analogix_dp_handle_edid(dp)) { + dev_err(dp->dev, "unable to handle edid\n"); + return -EINVAL; + } + + drm_mode_connector_update_edid_property(dp->connector, edid); + num_modes += drm_add_edid_modes(dp->connector, edid); + if (dp->plat_data->panel) num_modes += drm_panel_get_modes(dp->plat_data->panel); diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h index d3c7e0a..2bd2e0d 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h @@ -20,6 +20,28 @@ #define MAX_CR_LOOP 5 #define MAX_EQ_LOOP 5 +/* I2C EDID Chip ID, Slave Address */ +#define I2C_EDID_DEVICE_ADDR 0x50 +#define I2C_E_EDID_DEVICE_ADDR 0x30 + +#define EDID_BLOCK_LENGTH 0x80 +#define EDID_HEADER_PATTERN0x00 +#define EDID_EXTENSION_FLAG0x7e +#define EDID_CHECKSUM 0x7f + +/* DP_MAX_LANE_COUNT */ +#define DPCD_ENHANCED_FRAME_CAP(x) (((x) >> 7) & 0x1) +#define DPCD_MAX_LANE_COUNT(x) ((x) & 0x1f) + +/* DP_LANE_COUNT_SET */ +#define DPCD_LANE_COUNT_SET(x) ((x) & 0x1f) + +/* DP_TRAINING_LANE0_SET */ +#define DPCD_PRE_EMPHASIS_SET(x) (((x) & 0x3) << 3) +#define DPCD_PRE_EMPHASIS_GET(x) (((x) >> 3) & 0x3) +#define DPCD_VOLTAGE_SWING_SET(x) (((x) & 0x3) << 0) +#define DPCD_VOLTAGE_SWING_GET(x) (((x) >> 0) & 0x3) + enum link_rate_type { LINK_RATE_1_62GBPS = DP_LINK_BW_1_62, LINK_RATE_2_70GBPS = DP_LINK_BW_2_7, @@ -161,6 +183,7 @@ struct analogix_dp_device { int dpms_mode; int hpd_gpio; boolneed_force_hpd; + unsigned char edid[EDID_BLOCK_LENGTH * 2]; struct analogix_dp_plat_data *plat_data; }; @@ -260,27 +283,4 @@ int analogix_dp_is_video_stream_on(struct analogix_dp_device *dp); void analogix_dp_config_video_slave_mode(struct analogix_dp_device *dp); void analogix_dp_enable_scrambling(struct analogix_dp_device *dp); void analogix_dp_disable_scrambling(struct analogix_dp_device *dp); - -/* I2C EDID Chip ID, Slave Address */ -#define I2C_EDID_DEVICE_ADDR
[PATCH v8 16/17] drm: bridge: analogix/dp: move hpd detect to connector detect function
This change just make a little clean to make code more like drm core expect, move hdp detect code from bridge->enable(), and place them into connector->detect(). Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: - Take Jingoo suggest, add commit messages. Changes in v3: - move dp hpd detect to connector detect function. Changes in v2: None drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 3842dbd..216d33d 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -901,12 +901,6 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) DRM_ERROR("failed to disable the panel\n"); } - ret = analogix_dp_detect_hpd(dp); - if (ret) { - /* Cable has been disconnected, we're done */ - return; - } - ret = analogix_dp_handle_edid(dp); if (ret) { dev_err(dp->dev, "unable to handle edid\n"); @@ -941,6 +935,11 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) enum drm_connector_status analogix_dp_detect(struct device *dev, bool force) { + struct analogix_dp_device *dp = dev_get_drvdata(dev); + + if (analogix_dp_detect_hpd(dp)) + return connector_status_disconnected; + return connector_status_connected; } EXPORT_SYMBOL_GPL(analogix_dp_detect); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 13/17] drm: bridge: analogix/dp: add some rk3288 special registers setting
RK3288 need some special registers setting, we can separate them out by the dev_type of plat_data. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: - Fix compile failed dut to phy_pd_addr variable misspell error drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 76 ++- drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h | 12 2 files changed, 60 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c index 861097a..21a3287 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c @@ -15,6 +15,8 @@ #include #include +#include + #include "analogix_dp_core.h" #include "analogix_dp_reg.h" @@ -72,6 +74,14 @@ void analogix_dp_init_analog_param(struct analogix_dp_device *dp) reg = SEL_24M | TX_DVDD_BIT_1_0625V; writel(reg, dp->reg_base + ANALOGIX_DP_ANALOG_CTL_2); + if (dp->plat_data && (dp->plat_data->dev_type == RK3288_DP)) { + writel(REF_CLK_24M, dp->reg_base + ANALOGIX_DP_PLL_REG_1); + writel(0x95, dp->reg_base + ANALOGIX_DP_PLL_REG_2); + writel(0x40, dp->reg_base + ANALOGIX_DP_PLL_REG_3); + writel(0x58, dp->reg_base + ANALOGIX_DP_PLL_REG_4); + writel(0x22, dp->reg_base + ANALOGIX_DP_PLL_REG_5); + } + reg = DRIVE_DVDD_BIT_1_0625V | VCO_BIT_600_MICRO; writel(reg, dp->reg_base + ANALOGIX_DP_ANALOG_CTL_3); @@ -206,81 +216,85 @@ void analogix_dp_set_analog_power_down(struct analogix_dp_device *dp, bool enable) { u32 reg; + u32 phy_pd_addr = ANALOGIX_DP_PHY_PD; + + if (dp->plat_data && (dp->plat_data->dev_type == RK3288_DP)) + phy_pd_addr = ANALOGIX_DP_PD; switch (block) { case AUX_BLOCK: if (enable) { - reg = readl(dp->reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp->reg_base + phy_pd_addr); reg |= AUX_PD; - writel(reg, dp->reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp->reg_base + phy_pd_addr); } else { - reg = readl(dp->reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp->reg_base + phy_pd_addr); reg &= ~AUX_PD; - writel(reg, dp->reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp->reg_base + phy_pd_addr); } break; case CH0_BLOCK: if (enable) { - reg = readl(dp->reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp->reg_base + phy_pd_addr); reg |= CH0_PD; - writel(reg, dp->reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp->reg_base + phy_pd_addr); } else { - reg = readl(dp->reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp->reg_base + phy_pd_addr); reg &= ~CH0_PD; - writel(reg, dp->reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp->reg_base + phy_pd_addr); } break; case CH1_BLOCK: if (enable) { - reg = readl(dp->reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp->reg_base + phy_pd_addr); reg |= CH1_PD; - writel(reg, dp->reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp->reg_base + phy_pd_addr); } else { - reg = readl(dp->reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp->reg_base + phy_pd_addr); reg &= ~CH1_PD; - writel(reg, dp->reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp->reg_base + phy_pd_addr); } break; case CH2_BLOCK: if (enable) { - reg = readl(dp->reg_base + ANALOGIX_DP_PHY_PD); + reg = readl(dp->reg_base + phy_pd_addr); reg |= CH2_PD; - writel(reg, dp->reg_base + ANALOGIX_DP_PHY_PD); + writel(reg, dp->reg_base + phy_pd_addr); } else { - reg = readl(dp->reg_base + ANALOGIX_DP_PHY_PD); +
[PATCH v8 12/17] drm: rockchip: vop: add bpc and color mode setting
From: Mark Yao <y...@rock-chips.com> Add bpc and color mode setting in rockchip_drm_vop driver, so connector could try to use the edid drm_display_info to config vop output mode. Signed-off-by: Mark Yao <y...@rock-chips.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: - Fix compiled error (Heiko) - Using the connector display info message to configure eDP driver input video mode, but hard code CRTC video output mode to RGBaaa. Changes in v4: None Changes in v3: None Changes in v2: None drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 25 +++ drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 32 ++--- 4 files changed, 51 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index 2c82a9a..3990951 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -180,14 +180,29 @@ static void rockchip_dp_drm_encoder_mode_set(struct drm_encoder *encoder, static void rockchip_dp_drm_encoder_prepare(struct drm_encoder *encoder) { struct rockchip_dp_device *dp = to_dp(encoder); + struct drm_connector *cn = >connector; + int ret = -1; u32 val; - int ret; - ret = rockchip_drm_crtc_mode_config(encoder->crtc, - DRM_MODE_CONNECTOR_eDP, - ROCKCHIP_OUT_MODE_); + /* +* FIXME(Yakir): driver should configure the CRTC output video +* mode with the display information which indicated the monitor +* support colorimetry. +* +* But don't know why the CRTC driver seems could only output the +* RGBaaa rightly. For example, if connect the "innolux,n116bge" +* eDP screen, EDID would indicated that screen only accepted the +* 6bpc mode. But if I configure CRTC to RGB666 output, then eDP +* screen would show a blue picture (RGB888 show a green picture). +* But if I configure CTRC to RGBaaa, and eDP driver still keep +* RGB666 input video mode, then screen would works prefect. +*/ + if (cn->display_info.color_formats & DRM_COLOR_FORMAT_RGB444) + ret = rockchip_drm_crtc_mode_config(encoder->crtc, + DRM_MODE_CONNECTOR_eDP, + 10, DRM_COLOR_FORMAT_RGB444); if (ret < 0) { - dev_err(dp->dev, "Could not set crtc mode config: %d.\n", ret); + dev_err(dp->dev, "Could not set crtc mode config (%d)\n", ret); return; } diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index 80d6fc8..428a3c1 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -215,7 +215,7 @@ static void dw_hdmi_rockchip_encoder_commit(struct drm_encoder *encoder) static void dw_hdmi_rockchip_encoder_prepare(struct drm_encoder *encoder) { rockchip_drm_crtc_mode_config(encoder->crtc, DRM_MODE_CONNECTOR_HDMIA, - ROCKCHIP_OUT_MODE_); + 10, DRM_COLOR_FORMAT_RGB444); } static struct drm_encoder_helper_funcs dw_hdmi_rockchip_encoder_helper_funcs = { diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h index dc4e5f0..ef1d7fb 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h @@ -59,7 +59,7 @@ void rockchip_unregister_crtc_funcs(struct drm_device *dev, int pipe); int rockchip_drm_encoder_get_mux_id(struct device_node *node, struct drm_encoder *encoder); int rockchip_drm_crtc_mode_config(struct drm_crtc *crtc, int connector_type, - int out_mode); + int bpc, int color); int rockchip_drm_dma_attach_device(struct drm_device *drm_dev, struct device *dev); void rockchip_drm_dma_detach_device(struct drm_device *drm_dev, diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 5d8ae5e..9ef4a1f 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1062,14 +1062,40 @@ static const struct drm_plane_funcs vop_plane_funcs = { int rockchip_drm_crtc_mode_config(struct drm_crtc *crtc, int connector_type, - int out_mode) +
[PATCH v8 14/17] drm: bridge: analogix/dp: add max link rate and lane count limit for RK3288
There are some IP limit on rk3288 that only support 4 physical lanes of 2.7/1.6 Gbps/lane, so seprate them out by device_type flag. Tested-by: Javier Martinez Canillas <jav...@osg.samsung.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: - Seprate the link-rate and lane-count limit out with the device_type flag. (Thierry) Changes in v3: None Changes in v2: None drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 33 ++ drivers/gpu/drm/bridge/analogix/analogix_dp_core.h | 4 +-- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 6307060..563ffb1d 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -890,8 +890,8 @@ static void analogix_dp_commit(struct analogix_dp_device *dp) return; } - ret = analogix_dp_set_link_train(dp, dp->video_info.lane_count, -dp->video_info.link_rate); + ret = analogix_dp_set_link_train(dp, dp->video_info.max_lane_count, +dp->video_info.max_link_rate); if (ret) { dev_err(dp->dev, "unable to do link train\n"); return; @@ -1156,16 +1156,25 @@ static int analogix_dp_dt_parse_pdata(struct analogix_dp_device *dp) struct device_node *dp_node = dp->dev->of_node; struct video_info *video_info = >video_info; - if (of_property_read_u32(dp_node, "samsung,link-rate", -_info->link_rate)) { - dev_err(dp->dev, "failed to get link-rate\n"); - return -EINVAL; - } - - if (of_property_read_u32(dp_node, "samsung,lane-count", -_info->lane_count)) { - dev_err(dp->dev, "failed to get lane-count\n"); - return -EINVAL; + switch (dp->plat_data && dp->plat_data->dev_type) { + case RK3288_DP: + /* +* Like Rk3288 DisplayPort TRM indicate that "Main link +* containing 4 physical lanes of 2.7/1.62 Gbps/lane". +*/ + video_info->max_link_rate = 0x0A; + video_info->max_lane_count = 0x04; + break; + case EXYNOS_DP: + /* +* NOTE: those property parseing code is used for +* providing backward compatibility for samsung platform. +*/ + of_property_read_u32(dp_node, "samsung,link-rate", +_info->max_link_rate); + of_property_read_u32(dp_node, "samsung,lane-count", +_info->max_lane_count); + break; } return 0; diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h index e37cef6..e6f8243 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h @@ -129,8 +129,8 @@ struct video_info { enum color_coefficient ycbcr_coeff; enum color_depth color_depth; - enum link_rate_type link_rate; - enum link_lane_count_type lane_count; + enum link_rate_type max_link_rate; + enum link_lane_count_type max_lane_count; }; struct link_train { -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v8 0/17] Add Analogix Core Display Port Driver
Hi Jingoo & Exynos DRM Maintainers (Inki & Andrzej & Joonyoung) & Bridge Maintainers (Thierry?): Ping... The front part of this series (exynos_dp to analogix_dp) haven't received more comments in the pasted several months. Is it difficult to carry those patches without new changes but rebased on the latest kernel again and again. If you thought those patches is fine, it would be very grateful to give some ACKs to those changes. Thanks, - Yakir On 10/28/2015 04:15 PM, Yakir Yang wrote: Hi all, The Samsung Exynos eDP controller and Rockchip RK3288 eDP controller share the same IP, so a lot of parts can be re-used. I split the common code into bridge directory, then rk3288 and exynos only need to keep some platform code. Cause I can't find the exact IP name of exynos dp controller, so I decide to name dp core driver with "analogix" which I find in rk3288 eDP TRM But there are still three light registers setting differents bewteen exynos and rk3288. 1. RK3288 have five special pll resigters which not indicata in exynos dp controller. 2. The address of DP_PHY_PD(dp phy power manager register) are different between rk3288 and exynos. 3. Rk3288 and exynos have different setting with AUX_HW_RETRY_CTL(dp debug register). This series have been well tested on Rockchip platform with eDP panel on Jerry Chromebook and Display Port Monitor on RK3288 board. Also I have tested on Samsung Snow and Peach Pit Chromebooks, and thanks to Javier@Samsung help to retest the whole series on Samsung Exynos5800 Peach Pi Chromebook, glad to say that things works rightlly. Thanks, - Yakir Changes in v8: - Correct the right document path of display-timing.txt (Heiko) - Correct the misspell of 'from' to 'frm'. (Heiko) - Modify the commit subject name. (Heiko) - Fix the mixed spacers on macro definitions. (Heiko) - Remove the unnecessary empty line after clk_prepare_enable. (Heiko) - Remove the specific address in the example node name. (Heiko) Changes in v7: - Back to use the of_property_read_bool() interfacs to provoid backward compatibility of "hsync-active-high" "vsync-active-high" "interlaced" to avoid -EOVERFLOW error (Krzysztof) - Simply the commit message. (Kishon) - Symmetrical enable/disbale the phy clock and power. (Kishon) - Simplify the commit message. (Kishon) Changes in v6: - Fix the wrong code in previous series, and test on Samsung snow Chromebook successfully, here are the detail changes: => - if (!dp->panel && !dp->bridge) { + if (!dp->panel && !dp->ptn_bridge) { ret = exynos_dp_dt_parse_panel(dp); if (ret) => + encoder->bridge = bridge; bridge->driver_private = dp; bridge->encoder = encoder; bridge->funcs = _dp_bridge_funcs; ret = drm_bridge_attach(drm_dev, bridge); - Fix the Kconfig recursive dependency (Javier) - Fix Peach Pit hpd property name error: - hpd-gpio = < 6 0>; + hpd-gpios = < 6 0>; Changes in v5: - Correct the check condition of gpio_is_valid when driver try to get the "hpd-gpios" DT propery. (Heiko) - Move the platform attach callback in the front of core driver bridge attch function. Cause once platform failed at attach, core driver should still failed, so no need to init connector before platform attached (Krzysztof) - Keep code style no changes with the previous exynos_dp_code.c in this patch, and update commit message about the new export symbol (Krzysztof) - Gather the device type patch (v4 11/16) into this one. (Krzysztof) - leave out the connector registration to analogix platform driver. (Thierry) - Resequence this patch after analogix_dp driver have been split from exynos_dp code, and rephrase reasonable commit message, and remove some controversial style (Krzysztof) - analogix_dp_write_byte_to_dpcd( - dp, DP_TEST_RESPONSE, + analogix_dp_write_byte_to_dpcd(dp, + DP_TEST_RESPONSE, DP_TEST_EDID_CHECKSUM_WRITE); - Switch video timing type to "u32", so driver could use "of_property_read_u32" to get the backword timing values. Krzysztof suggest me that driver could use the "of_property_read_bool" to get backword timing values, but that interfacs would modify the original drm_display_mode timing directly (whether those properties exists or not). - Correct the misspell in commit message. (Krzysztof) - Remove the empty line at the end of document, and correct the endpoint numbers in the example DT node, and remove the regulator iomux setting in driver code while using the pinctl in devicetree instead. (Heiko) - Add device type declared, cause the previous "platform device type support (v4 11/16)" already merge into
[PATCH v10 10/17] phy: Add driver for rockchip Display Port PHY
Add phy driver for the Rockchip DisplayPort PHY module. This is required to get DisplayPort working in Rockchip SoCs. Reviewed-by: Heiko Stuebner <he...@sntech.de> Signed-off-by: Yakir Yang <y...@rock-chips.com> --- Changes in v10: - Fix the wrong macro value of GRF_EDP_REF_CLK_SEL_INTER_HIWORD_MASK (Brian) BIT(4) -> BIT(20) Changes in v9: - Removed the unused the variable "res" in probe function. (Heiko) - Removed the unused head file. Changes in v8: - Fix the mixed spacers on macro definitions. (Heiko) - Remove the unnecessary empty line after clk_prepare_enable. (Heiko) Changes in v7: - Simply the commit message. (Kishon) - Symmetrical enable/disbale the phy clock and power. (Kishon) Changes in v6: None Changes in v5: - Remove "reg" DT property, cause driver could poweron/poweroff phy via the exist "grf" syscon already. And rename the example DT node from "edp_phy: phy@ff770274" to "edp_phy: edp-phy" directly. (Heiko) - Add deivce_node at the front of driver, update phy_ops type from "static struct" to "static const struct". And correct the input paramters of devm_phy_create() interfaces. (Heiko) Changes in v4: - Add commit message, and remove the redundant rockchip_dp_phy_init() function, move those code to probe() method. And remove driver .owner number. (Kishon) Changes in v3: - Suggest, add rockchip dp phy driver, collect the phy clocks and power control. (Heiko) Changes in v2: None drivers/phy/Kconfig | 7 ++ drivers/phy/Makefile | 1 + drivers/phy/phy-rockchip-dp.c | 151 ++ 3 files changed, 159 insertions(+) create mode 100644 drivers/phy/phy-rockchip-dp.c diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 7eb5859d..7355819 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -319,6 +319,13 @@ config PHY_ROCKCHIP_USB help Enable this to support the Rockchip USB 2.0 PHY. +config PHY_ROCKCHIP_DP + tristate "Rockchip Display Port PHY Driver" + depends on ARCH_ROCKCHIP && OF + select GENERIC_PHY + help + Enable this to support the Rockchip Display Port PHY. + config PHY_ST_SPEAR1310_MIPHY tristate "ST SPEAR1310-MIPHY driver" select GENERIC_PHY diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index 075db1a..b1700cd 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -35,6 +35,7 @@ phy-exynos-usb2-$(CONFIG_PHY_S5PV210_USB2)+= phy-s5pv210-usb2.o obj-$(CONFIG_PHY_EXYNOS5_USBDRD) += phy-exynos5-usbdrd.o obj-$(CONFIG_PHY_QCOM_APQ8064_SATA)+= phy-qcom-apq8064-sata.o obj-$(CONFIG_PHY_ROCKCHIP_USB) += phy-rockchip-usb.o +obj-$(CONFIG_PHY_ROCKCHIP_DP) += phy-rockchip-dp.o obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA)+= phy-qcom-ipq806x-sata.o obj-$(CONFIG_PHY_ST_SPEAR1310_MIPHY) += phy-spear1310-miphy.o obj-$(CONFIG_PHY_ST_SPEAR1340_MIPHY) += phy-spear1340-miphy.o diff --git a/drivers/phy/phy-rockchip-dp.c b/drivers/phy/phy-rockchip-dp.c new file mode 100644 index 000..3cb3bf8 --- /dev/null +++ b/drivers/phy/phy-rockchip-dp.c @@ -0,0 +1,151 @@ +/* + * Rockchip DP PHY driver + * + * Copyright (C) 2015 FuZhou Rockchip Co., Ltd. + * Author: Yakir Yang <ykk@@rock-chips.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License. + */ + +#include +#include +#include +#include +#include +#include +#include + +#define GRF_SOC_CON12 0x0274 + +#define GRF_EDP_REF_CLK_SEL_INTER_HIWORD_MASK BIT(20) +#define GRF_EDP_REF_CLK_SEL_INTER BIT(4) + +#define GRF_EDP_PHY_SIDDQ_HIWORD_MASK BIT(21) +#define GRF_EDP_PHY_SIDDQ_ON0 +#define GRF_EDP_PHY_SIDDQ_OFF BIT(5) + +struct rockchip_dp_phy { + struct device *dev; + struct regmap *grf; + struct clk *phy_24m; +}; + +static int rockchip_set_phy_state(struct phy *phy, bool enable) +{ + struct rockchip_dp_phy *dp = phy_get_drvdata(phy); + int ret; + + if (enable) { + ret = regmap_write(dp->grf, GRF_SOC_CON12, + GRF_EDP_PHY_SIDDQ_HIWORD_MASK | + GRF_EDP_PHY_SIDDQ_ON); + if (ret < 0) { + dev_err(dp->dev, "Can't enable PHY power %d\n", ret); + return ret; + } + + ret = clk_prepare_enable(dp->phy_24m); + } else { + clk_disable_unprepare(dp->phy_24m); + + ret = regmap_write(dp->grf, GRF_SOC_CON12, + GRF_EDP_PHY_SIDDQ_HIWORD_MASK | + GRF_EDP_PHY_SIDDQ_
Re: [PATCH v9 10/17] phy: Add driver for rockchip Display Port PHY
Hi Brian, Thank you for debugging, and fell sorry for the delay reply On 11/06/2015 07:45 AM, Brian Norris wrote: Hi, A few updates: On Tue, Nov 03, 2015 at 05:13:48PM -0800, Brian Norris wrote: On Wed, Nov 04, 2015 at 08:48:38AM +0800, Yakir Yang wrote: On 11/03/2015 12:38 PM, Brian Norris wrote: On Thu, Oct 29, 2015 at 09:58:38AM +0800, Yakir Yang wrote: (FYI, I came across this by inspection when comparing Heiko's 'somewhat-stable' branch [1] with this series. The former brings up eDP fine on veyron-jaq, whereas this one doesn't yet, even with the above change. Still debugging the issue.) Some time after the above comment, I managed to kill the panel on my Jaq :( I think the wiring around the hinge was a bit flaky, and it finally went out for good. Hmm... I'm not sure whether your eDP screen have the hotplug signal, so I I believe hotplug is hooked up but... think you can try to add "analogix,force-hpd" flag into rk3288-veyron-jaq.dts { analogix,need-force-hpd; } ...already tried, just in case. No luck. However, now when testing a different Jaq device, now this series + Heiko's DTS updates + the "analogix,force-hpd" (i.e., [1]) works fine, modulo a few log warnings, some of which are probably expected (for instance, I believe the EDID is known not-so-helpful). Snippets: [3.170176] rockchip-dp ff97.dp: AUX CH command reply failed! [3.178058] rockchip-dp ff97.dp: AUX CH command reply failed! [3.184166] rockchip-dp ff97.dp: unable to handle edid and later: [3.953300] rockchip-dp ff97.dp: EDID data does not include any extensions. [3.966731] rockchip-dp ff97.dp: EDID data does not include any extensions. [3.979409] rockchip-dp ff97.dp: EDID data does not include any extensions. [3.998730] rockchip-dp ff97.dp: Link Training Clock Recovery success [4.007046] rockchip-dp ff97.dp: Link Training success! [4.115040] rockchip-dp ff97.dp: Timeout of video streamclk ok [4.121211] rockchip-dp ff97.dp: unable to config video [4.127616] rockchip-dp ff97.dp: EDID data does not include any extensions. So, I'll chalk that earlier failure up to a hardware failure (or possibly a still yet-undiagnosed hardware difference; my new Jaq has some small differences from the previous unit). Yeah, I have saw this failed on some chromebook too, but finally it transmit successfully, so I guess this maybe caused by hardware different. Also, it's still not real clear why HPD isn't working upstream (and we have to use the "force-hpd" property), when it appears to work on our downstream Chrome OS tree. I have tested that driver do receive the hpd interrupt when i plugged/unplugged the eDP screen, and at that time driver would read the HPD connected status rightly. But I haven't fingered out why driver couldn't get the right HPD status in the early time, need debug more... Finally, I'll leave you with some small bits I've noticed from exploring this issue on Jaq: * The Chrome OS driver for this IP has a much longer timeout in (the equivalent of) analogix_dp_detect_hpd; it polls in 10-20 ms intervals (rather than 10-11 us) and takes something around 60 to 120 ms to notice the panel. Thanks, I have noticed it too, also I try to expand the hotplug timeout, but Jingoo suggested not to do that, cause it would bring external delay on Exynos platform. Besides from what Heiko reply, expand this delay time wouldn't give any help on those Jaq no display case, delay the panel power up time would be the right way to fix that, so maybe no need to expand the hotpulg timeout. - Thanks * AFAICT, the Chrome OS driver never actually used the HPD interrupt; it was only polling the HPD status bit. So I can't claim that the functionality that Yakir is supporting here has ever been tested on these platforms. (Now, I'm not sure this is extremely important, since we still can fall back to polled status checks; see drm_kms_helper_poll_init().) That's all I've got for now. Regards, Brian [1] https://github.com/mmind/linux-rockchip/commits/tmp/analogixdp-veyron plus this diff: diff --git a/arch/arm/boot/dts/rk3288-veyron-jaq.dts b/arch/arm/boot/dts/rk3288-veyron-jaq.dts index 5c97e3153526..e77ae4c5531e 100644 --- a/arch/arm/boot/dts/rk3288-veyron-jaq.dts +++ b/arch/arm/boot/dts/rk3288-veyron-jaq.dts @@ -88,6 +88,18 @@ }; }; + { + power-supply = <_regulator>; +}; + + { + power-supply = <_regulator>; +}; + + { + analogix,need-force-hpd; +}; + { pinctrl-names = "default"; pinctrl-0 = <_int_l _1 _2>; diff --git a/drivers/phy/phy-rockchip-dp.c b/drivers/phy/phy-rockchip-dp.c index c82c22f3d0e1..994189f49db5 100644 --- a/drivers/phy/phy-rockchip-dp.c +++ b/drivers/phy/phy-rockchip-dp.c @@ -22,7 +22,7 @@ #define GRF_SOC_CON12 0x0274 -#defin
Re: [PATCH v10 09/17] dt-bindings: add document for rockchip variant of analogix_dp
On 11/01/2015 02:37 AM, Rob Herring wrote: On Sat, Oct 31, 2015 at 1:42 AM, Yakir Yang <y...@rock-chips.com> wrote: Rockchip DP driver is a helper driver of analogix_dp coder driver, so most of the DT property should be descriped in analogix_dp document. Reviewed-by: Heiko Stuebner <he...@sntech.de> Signed-off-by: Yakir Yang <y...@rock-chips.com> Acked-by: Rob Herring <r...@kernel.org> Thanks, - Yakir --- Changes in v10: - Removed the duplicated signed-of. Changes in v9: - Document more details for 'ports' property. Changes in v8: - Modify the commit subject name. (Heiko) Changes in v7: None Changes in v6: None Changes in v5: - Split binding doc's from driver changes. (Rob) - Add eDP hotplug pinctrl property. (Heiko) Changes in v4: None Changes in v3: None Changes in v2: None .../display/rockchip/analogix_dp-rockchip.txt | 91 ++ 1 file changed, 91 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt diff --git a/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt new file mode 100644 index 000..dae86c4 --- /dev/null +++ b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt @@ -0,0 +1,91 @@ +Rockchip RK3288 specific extensions to the Analogix Display Port + + +Required properties: +- compatible: "rockchip,rk3288-edp"; + +- reg: physical base address of the controller and length + +- clocks: from common clock binding: handle to dp clock. + of memory mapped region. + +- clock-names: from common clock binding: + Required elements: "dp" "pclk" + +- resets: Must contain an entry for each entry in reset-names. + See ../reset/reset.txt for details. + +- pinctrl-names: Names corresponding to the chip hotplug pinctrl states. +- pinctrl-0: pin-control mode. should be <_hpd> + +- reset-names: Must include the name "dp" + +- rockchip,grf: this soc should set GRF regs, so need get grf here. + +- ports: there are 2 port nodes with endpoint definitions as defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. +Port 0: contained 2 endpoints, connecting to the ouput of vop. +Port 1: contained 1 endpoint, connecting to the input of panel. + +For the below properties, please refer to Analogix DP binding document: + * Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt +- phys (required) +- phy-names (required) +- hpd-gpios (optional) +--- + +Example: + dp-controller: dp@ff97 { + compatible = "rockchip,rk3288-dp"; + reg = <0xff97 0x4000>; + interrupts = ; + clocks = < SCLK_EDP>, < PCLK_EDP_CTRL>; + clock-names = "dp", "pclk"; + phys = <_phy>; + phy-names = "dp"; + + rockchip,grf = <>; + resets = < 111>; + reset-names = "dp"; + + pinctrl-names = "default"; + pinctrl-0 = <_hpd>; + + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + edp_in: port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + edp_in_vopb: endpoint@0 { + reg = <0>; + remote-endpoint = <_out_edp>; + }; + edp_in_vopl: endpoint@1 { + reg = <1>; + remote-endpoint = <_out_edp>; + }; + }; + + edp_out: port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + edp_out_panel: endpoint { + reg = <0>; + remote-endpoint = <_in_edp> + }; + }; + }; + }; + + pinctrl { + edp { + edp_hpd: edp-hpd { + rockchip,pins = <7 11 RK_FUNC_2 _pull_none>; + }; + }; + }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v9 09/17] dt-bindings: add document for rockchip variant of analogix_dp
Rockchip DP driver is a helper driver of analogix_dp coder driver, so most of the DT property should be descriped in analogix_dp document. Signed-off-by: Yakir Yang <y...@rock-chips.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> Reviewed-by: Heiko Stuebner <he...@sntech.de> --- Changes in v9: - Document more details for 'ports' property. Changes in v8: - Modify the commit subject name. (Heiko) Changes in v7: None Changes in v6: None Changes in v5: - Split binding doc's from driver changes. (Rob) - Add eDP hotplug pinctrl property. (Heiko) Changes in v4: None Changes in v3: None Changes in v2: None .../display/rockchip/analogix_dp-rockchip.txt | 91 ++ 1 file changed, 91 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt diff --git a/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt new file mode 100644 index 000..dae86c4 --- /dev/null +++ b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt @@ -0,0 +1,91 @@ +Rockchip RK3288 specific extensions to the Analogix Display Port + + +Required properties: +- compatible: "rockchip,rk3288-edp"; + +- reg: physical base address of the controller and length + +- clocks: from common clock binding: handle to dp clock. + of memory mapped region. + +- clock-names: from common clock binding: + Required elements: "dp" "pclk" + +- resets: Must contain an entry for each entry in reset-names. + See ../reset/reset.txt for details. + +- pinctrl-names: Names corresponding to the chip hotplug pinctrl states. +- pinctrl-0: pin-control mode. should be <_hpd> + +- reset-names: Must include the name "dp" + +- rockchip,grf: this soc should set GRF regs, so need get grf here. + +- ports: there are 2 port nodes with endpoint definitions as defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. +Port 0: contained 2 endpoints, connecting to the ouput of vop. +Port 1: contained 1 endpoint, connecting to the input of panel. + +For the below properties, please refer to Analogix DP binding document: + * Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt +- phys (required) +- phy-names (required) +- hpd-gpios (optional) +--- + +Example: + dp-controller: dp@ff97 { + compatible = "rockchip,rk3288-dp"; + reg = <0xff97 0x4000>; + interrupts = ; + clocks = < SCLK_EDP>, < PCLK_EDP_CTRL>; + clock-names = "dp", "pclk"; + phys = <_phy>; + phy-names = "dp"; + + rockchip,grf = <>; + resets = < 111>; + reset-names = "dp"; + + pinctrl-names = "default"; + pinctrl-0 = <_hpd>; + + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + edp_in: port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + edp_in_vopb: endpoint@0 { + reg = <0>; + remote-endpoint = <_out_edp>; + }; + edp_in_vopl: endpoint@1 { + reg = <1>; + remote-endpoint = <_out_edp>; + }; + }; + + edp_out: port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + edp_out_panel: endpoint { + reg = <0>; + remote-endpoint = <_in_edp> + }; + }; + }; + }; + + pinctrl { + edp { + edp_hpd: edp-hpd { + rockchip,pins = <7 11 RK_FUNC_2 _pull_none>; + }; + }; + }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v8 11/17] dt-bindings: add document for rockchip dp phy
On 10/31/2015 12:42 AM, Rob Herring wrote: On Wed, Oct 28, 2015 at 3:31 AM, Yakir Yang <y...@rock-chips.com> wrote: Add dt binding documentation for rockchip display port PHY. Reviewed-by: Heiko Stuebner <he...@sntech.de> Signed-off-by: Yakir Yang <y...@rock-chips.com> Acked-by: Rob Herring <r...@kernel.org> Thanks, - Yakir --- Changes in v8: - Remove the specific address in the example node name. (Heiko) Changes in v7: - Simplify the commit message. (Kishon) Changes in v6: None Changes in v5: - Split binding doc's from driver changes. (Rob) - Update the rockchip,grf explain in document, and correct the clock required elemets in document. (Rob & Heiko) Changes in v4: None Changes in v3: None Changes in v2: None .../devicetree/bindings/phy/rockchip-dp-phy.txt| 22 ++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt diff --git a/Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt new file mode 100644 index 000..00902cb --- /dev/null +++ b/Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt @@ -0,0 +1,22 @@ +Rockchip Soc Seroes Display Port PHY + + +Required properties: +- compatible : should be one of the following supported values: +- "rockchip.rk3288-dp-phy" +- clocks: from common clock binding: handle to dp clock. + of memory mapped region. +- clock-names: from common clock binding: + Required elements: "24m" +- rockchip,grf: phandle to the syscon managing the "general register files" +- #phy-cells : from the generic PHY bindings, must be 0; + +Example: + +edp_phy: edp-phy { + compatible = "rockchip,rk3288-dp-phy"; + rockchip,grf = <>; + clocks = < SCLK_EDP_24M>; + clock-names = "24m"; + #phy-cells = <0>; +}; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v9 09/17] dt-bindings: add document for rockchip variant of analogix_dp
On 10/31/2015 02:30 PM, Yakir Yang wrote: Rockchip DP driver is a helper driver of analogix_dp coder driver, so most of the DT property should be descriped in analogix_dp document. Signed-off-by: Yakir Yang <y...@rock-chips.com> Signed-off-by: Yakir Yang <y...@rock-chips.com> Reviewed-by: Heiko Stuebner <he...@sntech.de> Sorry about the duplicate signed-off, I would send a new version now. --- Changes in v9: - Document more details for 'ports' property. Changes in v8: - Modify the commit subject name. (Heiko) Changes in v7: None Changes in v6: None Changes in v5: - Split binding doc's from driver changes. (Rob) - Add eDP hotplug pinctrl property. (Heiko) Changes in v4: None Changes in v3: None Changes in v2: None .../display/rockchip/analogix_dp-rockchip.txt | 91 ++ 1 file changed, 91 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt diff --git a/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt new file mode 100644 index 000..dae86c4 --- /dev/null +++ b/Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt @@ -0,0 +1,91 @@ +Rockchip RK3288 specific extensions to the Analogix Display Port + + +Required properties: +- compatible: "rockchip,rk3288-edp"; + +- reg: physical base address of the controller and length + +- clocks: from common clock binding: handle to dp clock. + of memory mapped region. + +- clock-names: from common clock binding: + Required elements: "dp" "pclk" + +- resets: Must contain an entry for each entry in reset-names. + See ../reset/reset.txt for details. + +- pinctrl-names: Names corresponding to the chip hotplug pinctrl states. +- pinctrl-0: pin-control mode. should be <_hpd> + +- reset-names: Must include the name "dp" + +- rockchip,grf: this soc should set GRF regs, so need get grf here. + +- ports: there are 2 port nodes with endpoint definitions as defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. +Port 0: contained 2 endpoints, connecting to the ouput of vop. +Port 1: contained 1 endpoint, connecting to the input of panel. + +For the below properties, please refer to Analogix DP binding document: + * Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt +- phys (required) +- phy-names (required) +- hpd-gpios (optional) +--- + +Example: + dp-controller: dp@ff97 { + compatible = "rockchip,rk3288-dp"; + reg = <0xff97 0x4000>; + interrupts = ; + clocks = < SCLK_EDP>, < PCLK_EDP_CTRL>; + clock-names = "dp", "pclk"; + phys = <_phy>; + phy-names = "dp"; + + rockchip,grf = <>; + resets = < 111>; + reset-names = "dp"; + + pinctrl-names = "default"; + pinctrl-0 = <_hpd>; + + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + edp_in: port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + edp_in_vopb: endpoint@0 { + reg = <0>; + remote-endpoint = <_out_edp>; + }; + edp_in_vopl: endpoint@1 { + reg = <1>; + remote-endpoint = <_out_edp>; + }; + }; + + edp_out: port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + edp_out_panel: endpoint { + reg = <0>; + remote-endpoint = <_in_edp> + }; + }; + }; + }; + + pinctrl { + edp { + edp_hpd: edp-hpd { + rockchip,pins = <7 11 RK_FUNC_2 _pull_none>; + }; + }; + }; -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html