MLK-17215-3 video: fbdev: mipi_dsi_northwest: refine 'phy-ref-clkfreq' get to support...
authorFancy Fang <chen.fang@nxp.com>
Thu, 14 Dec 2017 07:21:31 +0000 (15:21 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Tue, 20 Mar 2018 19:51:43 +0000 (14:51 -0500)
Move the code slice of getting 'phy-ref-clkfreq' property
to probe function to support arm32 socs besides arm64.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
drivers/video/fbdev/mxc/mipi_dsi_northwest.c

index 2b9061c..77b3cc3 100644 (file)
@@ -1166,7 +1166,6 @@ static irqreturn_t mipi_dsi_irq_handler(int irq, void *data)
 static int dsi_clks_init(struct mipi_dsi_info *minfo)
 {
        int ret = 0;
-       uint32_t phy_ref_clkfreq;
        struct platform_device *pdev = minfo->pdev;
        struct device_node *np = pdev->dev.of_node;
 
@@ -1185,20 +1184,8 @@ static int dsi_clks_init(struct mipi_dsi_info *minfo)
        minfo->dbi_clk = devm_clk_get(&pdev->dev, "dbi");
        BUG_ON(IS_ERR(minfo->dbi_clk));
 
-       ret = of_property_read_u32(np, "phy-ref-clkfreq",
-                                  &phy_ref_clkfreq);
-       if (ret < 0) {
-               dev_err(&pdev->dev, "failed to get phy reference clock rate\n");
-               return -EINVAL;
-       }
 
-       if (phy_ref_clkfreq < 24000000 || phy_ref_clkfreq > 200000000) {
-               dev_err(&pdev->dev, "invalid phy reference clock rate\n");
-               return -EINVAL;
-       }
-       minfo->phy_ref_clkfreq = phy_ref_clkfreq;
-
-       ret = clk_set_rate(minfo->phy_ref_clk, phy_ref_clkfreq);
+       ret = clk_set_rate(minfo->phy_ref_clk, minfo->phy_ref_clkfreq);
        if (ret < 0) {
                dev_err(&pdev->dev, "set phy_ref clock rate failed\n");
                goto out;
@@ -1245,6 +1232,7 @@ static int mipi_dsi_probe(struct platform_device *pdev)
        const char *lcd_panel;
        int ret = 0;
        u32 vmode_index;
+       uint32_t phy_ref_clkfreq;
 
        mipi_dsi = devm_kzalloc(&pdev->dev, sizeof(*mipi_dsi), GFP_KERNEL);
        if (!mipi_dsi)
@@ -1275,6 +1263,19 @@ static int mipi_dsi_probe(struct platform_device *pdev)
                return ret;
        }
 
+       ret = of_property_read_u32(np, "phy-ref-clkfreq",
+                                  &phy_ref_clkfreq);
+       if (ret < 0) {
+               dev_err(&pdev->dev, "failed to get phy reference clock rate\n");
+               return -EINVAL;
+       }
+
+       if (phy_ref_clkfreq < 24000000 || phy_ref_clkfreq > 200000000) {
+               dev_err(&pdev->dev, "invalid phy reference clock rate\n");
+               return -EINVAL;
+       }
+       mipi_dsi->phy_ref_clkfreq = phy_ref_clkfreq;
+
 #ifdef CONFIG_FB_IMX64
        dsi_clks_init(mipi_dsi);