]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ENGR00323271-02 hdmi: Add mipi core clock to hdmi drivers
authorSandor Yu <R01008@freescale.com>
Wed, 23 Jul 2014 03:01:08 +0000 (11:01 +0800)
committerNitin Garg <nitin.garg@freescale.com>
Fri, 16 Jan 2015 03:18:29 +0000 (21:18 -0600)
HDMI isfr clock source from video 27M clock.

There are one clock gate control of video27m_root in CCM,
ccm_video27m_root_cg = ((lpcg_mipi_core_cfg_clk_enable_clock_root
| lpcg_mipi_core_pll_refclk_enable_clock_root) | lpcg_vpu_rclk_enable_clock_root);
The video 27M clock depend on vpu clock or mipi core clock.

In mx6 chip, vpu can been disabled by fuse,
so for vpu disabled case, mipi core clock should enabled and make sure
27M clock on.

Add mipi core clock management in hdmi drivers to support vpu disabled
case.

Signed-off-by: Sandor Yu <R01008@freescale.com>
(cherry picked from commit 32c8b60e0509300b504795ec96488242bbb11d3b)

drivers/mfd/mxc-hdmi-core.c
drivers/video/mxc/mxc_hdmi.c

index 29d43f9a085c311428d135f793c04b482439f43a..4cdf2dc153004b9734614a93c2b6df129e8e8af9 100644 (file)
@@ -51,6 +51,7 @@ struct mxc_hdmi_data {
 static void __iomem *hdmi_base;
 static struct clk *isfr_clk;
 static struct clk *iahb_clk;
+static struct clk *mipi_core_clk;
 static spinlock_t irq_spinlock;
 static spinlock_t edid_spinlock;
 static unsigned int sample_rate;
@@ -666,18 +667,32 @@ static int mxc_hdmi_core_probe(struct platform_device *pdev)
        hdmi_abort_state = 0;
        spin_unlock_irqrestore(&hdmi_audio_lock, flags);
 
+       mipi_core_clk = clk_get(&hdmi_data->pdev->dev, "mipi_core");
+       if (IS_ERR(mipi_core_clk)) {
+               ret = PTR_ERR(mipi_core_clk);
+               dev_err(&hdmi_data->pdev->dev,
+                       "Unable to get mipi core clk: %d\n", ret);
+               goto eclkg;
+       }
+
+       ret = clk_prepare_enable(mipi_core_clk);
+       if (ret < 0) {
+               dev_err(&pdev->dev, "Cannot enable mipi core clock: %d\n", ret);
+               goto eclke;
+       }
+
        isfr_clk = clk_get(&hdmi_data->pdev->dev, "hdmi_isfr");
        if (IS_ERR(isfr_clk)) {
                ret = PTR_ERR(isfr_clk);
                dev_err(&hdmi_data->pdev->dev,
                        "Unable to get HDMI isfr clk: %d\n", ret);
-               goto eclkg;
+               goto eclkg1;
        }
 
        ret = clk_prepare_enable(isfr_clk);
        if (ret < 0) {
                dev_err(&pdev->dev, "Cannot enable HDMI clock: %d\n", ret);
-               goto eclke;
+               goto eclke1;
        }
 
        pr_debug("%s isfr_clk:%d\n", __func__,
@@ -720,6 +735,7 @@ static int mxc_hdmi_core_probe(struct platform_device *pdev)
        /* Disable HDMI clocks until video/audio sub-drivers are initialized */
        clk_disable_unprepare(isfr_clk);
        clk_disable_unprepare(iahb_clk);
+       clk_disable_unprepare(mipi_core_clk);
 
        /* Replace platform data coming in with a local struct */
        platform_set_drvdata(pdev, hdmi_data);
@@ -734,8 +750,12 @@ eclke2:
        clk_put(iahb_clk);
 eclkg2:
        clk_disable_unprepare(isfr_clk);
-eclke:
+eclke1:
        clk_put(isfr_clk);
+eclkg1:
+       clk_disable_unprepare(mipi_core_clk);
+eclke:
+       clk_put(mipi_core_clk);
 eclkg:
        return ret;
 }
index bcd031df5b9dd2808b532e1fcd0fa1e38ec1d006..51869988ff3ce74878a3e082017f375eb4ef8f54 100644 (file)
@@ -154,6 +154,7 @@ struct mxc_hdmi {
        struct fb_info *fbi;
        struct clk *hdmi_isfr_clk;
        struct clk *hdmi_iahb_clk;
+       struct clk *mipi_core_clk;
        struct delayed_work hotplug_work;
        struct delayed_work hdcp_hdp_work;
 
@@ -2340,6 +2341,7 @@ static int mxc_hdmi_fb_event(struct notifier_block *nb,
                        mxc_hdmi_phy_disable(hdmi);
                        clk_disable(hdmi->hdmi_iahb_clk);
                        clk_disable(hdmi->hdmi_isfr_clk);
+                       clk_disable(hdmi->mipi_core_clk);
                }
                break;
 
@@ -2348,6 +2350,7 @@ static int mxc_hdmi_fb_event(struct notifier_block *nb,
                        "event=FB_EVENT_RESUME\n");
 
                if (hdmi->blank == FB_BLANK_UNBLANK) {
+                       clk_enable(hdmi->mipi_core_clk);
                        clk_enable(hdmi->hdmi_iahb_clk);
                        clk_enable(hdmi->hdmi_isfr_clk);
                        mxc_hdmi_phy_init(hdmi);
@@ -2482,6 +2485,21 @@ static int mxc_hdmi_disp_init(struct mxc_dispdrv_handle *disp,
 
        hdmi_init_route(hdmi);
 
+       hdmi->mipi_core_clk = clk_get(&hdmi->pdev->dev, "mipi_core");
+       if (IS_ERR(hdmi->mipi_core_clk)) {
+               ret = PTR_ERR(hdmi->mipi_core_clk);
+               dev_err(&hdmi->pdev->dev,
+                       "Unable to get mipi core clk: %d\n", ret);
+               goto egetclk;
+       }
+
+       ret = clk_prepare_enable(hdmi->mipi_core_clk);
+       if (ret < 0) {
+               dev_err(&hdmi->pdev->dev,
+                               "Cannot enable mipi core clock: %d\n", ret);
+               goto erate;
+       }
+
        hdmi->hdmi_isfr_clk = clk_get(&hdmi->pdev->dev, "hdmi_isfr");
        if (IS_ERR(hdmi->hdmi_isfr_clk)) {
                ret = PTR_ERR(hdmi->hdmi_isfr_clk);
@@ -2647,6 +2665,10 @@ egetclk2:
 erate1:
        clk_put(hdmi->hdmi_isfr_clk);
 egetclk1:
+       clk_disable_unprepare(hdmi->mipi_core_clk);
+erate:
+       clk_put(hdmi->mipi_core_clk);
+egetclk:
        dev_dbg(&hdmi->pdev->dev, "%s error exit\n", __func__);
 
        return ret;
@@ -2664,6 +2686,8 @@ static void mxc_hdmi_disp_deinit(struct mxc_dispdrv_handle *disp)
        clk_put(hdmi->hdmi_isfr_clk);
        clk_disable_unprepare(hdmi->hdmi_iahb_clk);
        clk_put(hdmi->hdmi_iahb_clk);
+       clk_disable_unprepare(hdmi->mipi_core_clk);
+       clk_put(hdmi->mipi_core_clk);
 
        platform_device_unregister(hdmi->pdev);