drm/rockchip: lvds: add pinctrl for rk3288 rgb output
authorSandy Huang <hjc@rock-chips.com>
Mon, 7 Aug 2017 09:53:30 +0000 (17:53 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Wed, 9 Aug 2017 08:12:47 +0000 (16:12 +0800)
Change-Id: I4c483eb269d021860fe4249a3d25bcfb6c4f3f5f
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Documentation/devicetree/bindings/display/rockchip/rockchip-lvds.txt
arch/arm/boot/dts/rk3288.dtsi
drivers/gpu/drm/rockchip/rockchip_lvds.c

index 1f436f2261ec32039b66f6e615f00ea0d7cc2b52..5be5b5a96d2b1c62e73f751e208cb17c3b2c0e78 100644 (file)
@@ -23,17 +23,9 @@ Required properties:
 
 - rockchip,grf: phandle to the general register files syscon
 
-- rockchip,data-mapping: should be "vesa" or "jeida",
-       This describes how the color bits are laid out in the
-       serialized LVDS signal.
-- rockchip,data-width : should be <18> or <24>;
-- rockchip,output: should be "rgb", "lvds" or "duallvds",
-       This describes the output face.
-
 Optional properties
-- pinctrl-names: must contain a "default" entry.
+- pinctrl-names: must contain a "lcdc" entry.
 - pinctrl-0: pin control group to be used for this controller.
-- pinctrl-1: pin control group to be used for gpio.
 
 Required nodes:
 
@@ -45,8 +37,35 @@ Their connections are modeled using the OF graph bindings specified in
 - video port 0 for the VOP inputs
 - video port 1 for either a panel or subsequent encoder
 
+the lvds panel described by
+       Documentation/devicetree/bindings/display/panel/simple-panel.txt
+
+- rockchip,data-mapping: should be "vesa" or "jeida",
+       This describes how the color bits are laid out in the
+       serialized LVDS signal.
+- rockchip,data-width : should be <18> or <24>;
+- rockchip,output: should be "rgb", "lvds" or "duallvds",
+       This describes the output face.
+- ports for remote LVDS output
+
 Example:
 
+lvds_panel: lvds-panel {
+       status = "okay";
+       compatible = "simple-panel";
+       enable-gpios = <&gpio7 21 GPIO_ACTIVE_HIGH>;
+       rockchip,data-mapping = "jeida";
+       rockchip,data-width = <24>;
+       rockchip,output = "rgb";
+
+       ports {
+               panel_in_lvds: endpoint {
+                       remote-endpoint = <&lvds_out_panel>;
+               };
+       };
+};
+
+
 For Rockchip RK3288:
 
        lvds: lvds@ff96c000 {
@@ -55,6 +74,8 @@ For Rockchip RK3288:
                reg = <0xff96c000 0x4000>;
                clocks = <&cru PCLK_LVDS_PHY>;
                clock-names = "pclk_lvds";
+               pinctrl-names = "lcdc";
+               pinctrl-0 = <&lcdc_ctl>;
                avdd1v0-supply = <&vdd10_lcd>;
                avdd1v8-supply = <&vcc18_lcd>;
                avdd3v3-supply = <&vcca_33>;
@@ -98,9 +119,8 @@ For Rockchip RK3368:
                clock-names = "pclk_lvds", "pclk_lvds_ctl";
                power-domains = <&power RK3368_PD_VIO>;
                rockchip,grf = <&grf>;
-               pinctrl-names = "lcdc", "gpio";
+               pinctrl-names = "lcdc";
                pinctrl-0 = <&lcdc_lcdc>;
-               pinctrl-1 = <&lcdc_gpio>;
 
                ports {
 
index e49268c477c07dd6a3eb65789e7f093052c0a817..18e68974c33664d78a2ae5391d709f351e71ae06 100644 (file)
                reg = <0x0 0xff96c000 0x0 0x4000>;
                clocks = <&cru PCLK_LVDS_PHY>;
                clock-names = "pclk_lvds";
-               pinctrl-names = "default";
-               pinctrl-0 = <&lcdc0_ctl>;
+               pinctrl-names = "lcdc";
+               pinctrl-0 = <&lcdc_ctl>;
                power-domains = <&power RK3288_PD_VIO>;
                rockchip,grf = <&grf>;
                status = "disabled";
                        };
                };
 
-               lcdc0 {
-                       lcdc0_ctl: lcdc0-ctl {
+               lcdc {
+                       lcdc_ctl: lcdc-ctl {
                                rockchip,pins = <1 24 RK_FUNC_1 &pcfg_pull_none>,
                                                <1 25 RK_FUNC_1 &pcfg_pull_none>,
                                                <1 26 RK_FUNC_1 &pcfg_pull_none>,
index ff23c68cfa351c5c94c099f7aa1b4dc822687d5e..7a0a27c97f880b40e12a5fa402cdc3d5bcf8314a 100644 (file)
@@ -506,6 +506,11 @@ static void rockchip_lvds_grf_config(struct drm_encoder *encoder,
        u32 val;
        int ret;
 
+       /* iomux to LCD data/sync mode */
+       if (lvds->output == DISPLAY_OUTPUT_RGB)
+               if (lvds->pins && !IS_ERR(lvds->pins->default_state))
+                       pinctrl_select_state(lvds->pins->p,
+                                            lvds->pins->default_state);
        if (LVDS_CHIP(lvds) == RK3288_LVDS) {
                val = lvds->format;
                if (lvds->output == DISPLAY_OUTPUT_DUAL_LVDS)
@@ -527,11 +532,6 @@ static void rockchip_lvds_grf_config(struct drm_encoder *encoder,
                }
        } else if (LVDS_CHIP(lvds) == RK336X_LVDS) {
                if (lvds->output == DISPLAY_OUTPUT_RGB) {
-                       /* iomux to lcdc */
-                       if (lvds->pins && !IS_ERR(lvds->pins->default_state))
-                               pinctrl_select_state(lvds->pins->p,
-                                                    lvds->pins->default_state);
-
                        /* enable lvds mode */
                        val = v_RK336X_LVDSMODE_EN(0) |
                                v_RK336X_MIPIPHY_TTL_EN(1) |
@@ -933,31 +933,33 @@ static int rockchip_lvds_probe(struct platform_device *pdev)
                        dev_err(dev, "could not get pclk_ctrl\n");
                        lvds->pclk_ctrl = NULL;
                }
-               lvds->pins = devm_kzalloc(lvds->dev, sizeof(*lvds->pins),
-                                         GFP_KERNEL);
-               if (!lvds->pins)
-                       return -ENOMEM;
-
-               lvds->pins->p = devm_pinctrl_get(lvds->dev);
-               if (IS_ERR(lvds->pins->p)) {
-                       dev_info(lvds->dev, "no pinctrl handle\n");
-                       devm_kfree(lvds->dev, lvds->pins);
-                       lvds->pins = NULL;
-               } else {
-                       lvds->pins->default_state =
-                               pinctrl_lookup_state(lvds->pins->p, "lcdc");
-                       if (IS_ERR(lvds->pins->default_state)) {
-                               dev_info(lvds->dev, "no default pinctrl state\n");
-                               devm_kfree(lvds->dev, lvds->pins);
-                               lvds->pins = NULL;
-                       }
-               }
        }
        lvds->pclk = devm_clk_get(&pdev->dev, "pclk_lvds");
        if (IS_ERR(lvds->pclk)) {
                dev_err(dev, "could not get pclk_lvds\n");
                return PTR_ERR(lvds->pclk);
        }
+
+       lvds->pins = devm_kzalloc(lvds->dev, sizeof(*lvds->pins),
+                                 GFP_KERNEL);
+       if (!lvds->pins)
+               return -ENOMEM;
+
+       lvds->pins->p = devm_pinctrl_get(lvds->dev);
+       if (IS_ERR(lvds->pins->p)) {
+               dev_info(lvds->dev, "no pinctrl handle\n");
+               devm_kfree(lvds->dev, lvds->pins);
+               lvds->pins = NULL;
+       } else {
+               lvds->pins->default_state =
+                       pinctrl_lookup_state(lvds->pins->p, "lcdc");
+               if (IS_ERR(lvds->pins->default_state)) {
+                       dev_info(lvds->dev, "no lcdc pinctrl state\n");
+                       devm_kfree(lvds->dev, lvds->pins);
+                       lvds->pins = NULL;
+               }
+       }
+
        lvds->grf = syscon_regmap_lookup_by_phandle(dev->of_node,
                                                    "rockchip,grf");
        if (IS_ERR(lvds->grf)) {