MLK-22261: media: mipi_csi: add MIPI PHY reset when csi runtime resume
authorGuoniu.Zhou <guoniu.zhou@nxp.com>
Thu, 11 Jul 2019 06:18:11 +0000 (14:18 +0800)
committerGuoniu.Zhou <guoniu.zhou@nxp.com>
Wed, 7 Aug 2019 06:29:03 +0000 (14:29 +0800)
The reset signal of MIPI Slave PHY will drop when dispmix power down,
so driver need to release the signal again when csi resume.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
drivers/media/platform/imx8/mxc-mipi-csi2-sam.c
drivers/media/platform/imx8/mxc-mipi-csi2-sam.h

index 74160ac..71151ef 100644 (file)
@@ -56,8 +56,6 @@ static const struct csis_pix_format mipi_csis_formats[] = {
        }
 };
 
-typedef int (*mipi_csis_phy_reset_t)(struct csi_state *state);
-
 #define mipi_csis_write(__csis, __r, __v) writel(__v, __csis->regs + __r)
 #define mipi_csis_read(__csis, __r) readl(__csis->regs + __r)
 
@@ -1009,6 +1007,7 @@ static int mipi_csis_probe(struct platform_device *pdev)
                return -EINVAL;
        }
        phy_reset_fn = of_id->data;
+       state->phy_reset_fn = phy_reset_fn;
 
        state->gasket = syscon_regmap_lookup_by_phandle(dev->of_node, "csi-gpr");
        if (IS_ERR(state->gasket)) {
@@ -1134,6 +1133,9 @@ static int mipi_csis_runtime_resume(struct device *dev)
        disp_mix_clks_enable(state->clk_enable, true);
        disp_mix_sft_rstn(state->soft_resetn, false);
 
+       if (state->phy_reset_fn)
+               state->phy_reset_fn(state);
+
        return 0;
 }
 
index 28c3615..8d64a38 100644 (file)
@@ -222,6 +222,9 @@ struct mipi_csis_event {
        unsigned int counter;
 };
 
+struct csi_state;
+typedef int (*mipi_csis_phy_reset_t)(struct csi_state *state);
+
 static const struct mipi_csis_event mipi_csis_events[] = {
        /* Errors */
        { MIPI_CSIS_INTSRC_ERR_SOT_HS,  "SOT Error" },
@@ -324,6 +327,8 @@ struct csi_state {
        struct reset_control *soft_resetn;
        struct reset_control *clk_enable;
        struct reset_control *mipi_reset;
+
+       mipi_csis_phy_reset_t phy_reset_fn;
 };
 
 /**