MLK-18355-6: hdmi_rx: move startup function to probe function
authorSandor Yu <Sandor.yu@nxp.com>
Mon, 21 May 2018 02:45:00 +0000 (10:45 +0800)
committerSandor Yu <Sandor.yu@nxp.com>
Fri, 19 Apr 2019 02:40:50 +0000 (10:40 +0800)
Move startup function from s_power to probe function,
HDMI RX controller keep in running state after driver probe.
The startup function should move to cable plugin handle.
When iMX8QM B0 silicon HDMI RX hot plug function is ready.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
drivers/media/platform/imx8/hdmi/mxc-hdmi-rx.c

index 6cd53c9..844cb97 100644 (file)
@@ -528,22 +528,10 @@ static const struct v4l2_subdev_pad_ops imx_pad_ops_hdmi = {
 static int mxc_hdmi_s_power(struct v4l2_subdev *sd, int on)
 {
        struct mxc_hdmi_rx_dev *hdmi_rx = imx_sd_to_hdmi(sd);
-       state_struct *state = &hdmi_rx->state;
        struct device *dev = &hdmi_rx->pdev->dev;
-       u8 sts;
 
        dev_dbg(dev, "%s\n", __func__);
 
-       if (on) {
-               pm_runtime_get_sync(dev);
-               hdmirx_startup(&hdmi_rx->state);
-       } else {
-               /* Reset HDMI RX PHY */
-               CDN_API_HDMIRX_Stop_blocking(state);
-               CDN_API_MainControl_blocking(state, 0, &sts);
-               pm_runtime_put_sync(dev);
-       }
-
        return 0;
 }
 static struct v4l2_subdev_core_ops imx_core_ops_hdmi = {
@@ -751,11 +739,15 @@ static int mxc_hdmi_probe(struct platform_device *pdev)
        pm_runtime_enable(dev);
        pm_runtime_get_sync(dev);
        ret = mxc_hdmi_init(hdmi_rx);
-       pm_runtime_put_sync(dev);
        if (ret) {
                dev_info(dev, "mxc hdmi rx init failed\n");
                goto failed;
        }
+       ret = hdmirx_startup(&hdmi_rx->state);
+       if (ret) {
+               dev_info(dev, "mxc hdmi rx startup failed\n");
+               goto failed;
+       }
 
        dev_info(dev, "mxc hdmi rx probe successfully\n");
 
@@ -766,19 +758,27 @@ failed:
 
        mxc_hdmi_clock_disable(hdmi_rx);
        pm_runtime_disable(dev);
+       dev_info(dev, "mxc hdmi rx probe failed\n");
        return ret;
 }
 
 static int mxc_hdmi_remove(struct platform_device *pdev)
 {
        struct mxc_hdmi_rx_dev *hdmi_rx = platform_get_drvdata(pdev);
+       state_struct *state = &hdmi_rx->state;
        struct device *dev = &pdev->dev;
+       u8 sts;
 
        dev_dbg(dev, "%s\n", __func__);
        v4l2_async_unregister_subdev(&hdmi_rx->sd);
        media_entity_cleanup(&hdmi_rx->sd.entity);
 
+       /* Reset HDMI RX PHY */
+       CDN_API_HDMIRX_Stop_blocking(state);
+       CDN_API_MainControl_blocking(state, 0, &sts);
+
        mxc_hdmi_clock_disable(hdmi_rx);
+       pm_runtime_put_sync(dev);
        pm_runtime_disable(dev);
 
        return 0;