diff options
author | Cai YiWei <cyw@rock-chips.com> | 2019-02-20 18:00:40 +0800 |
---|---|---|
committer | Tao Huang <huangtao@rock-chips.com> | 2019-02-22 11:56:41 +0800 |
commit | ca2856326aa87f35b47e1b92d132c541018a244a (patch) | |
tree | 5491c468bc3ad417ab5e792d8443ea8f0b9526f9 | |
parent | 3cbec52b29863524e1b28e5c52e09fce657bb4f9 (diff) |
phy: rockchip: mipi-dphy-rx: csi_mipidphy add stream off
Change-Id: Ifee3d6fb80425fc505ed716cbcbe6cc48a9e02bb
Signed-off-by: Cai YiWei <cyw@rock-chips.com>
-rw-r--r-- | drivers/phy/rockchip/phy-rockchip-mipi-rx.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/phy/rockchip/phy-rockchip-mipi-rx.c b/drivers/phy/rockchip/phy-rockchip-mipi-rx.c index 7bc219942765..b6c46709404b 100644 --- a/drivers/phy/rockchip/phy-rockchip-mipi-rx.c +++ b/drivers/phy/rockchip/phy-rockchip-mipi-rx.c @@ -479,6 +479,7 @@ struct mipidphy_priv { bool is_streaming; void __iomem *txrx_base_addr; int (*stream_on)(struct mipidphy_priv *priv, struct v4l2_subdev *sd); + int (*stream_off)(struct mipidphy_priv *priv, struct v4l2_subdev *sd); }; static inline struct mipidphy_priv *to_dphy_priv(struct v4l2_subdev *subdev) @@ -671,6 +672,8 @@ static int mipidphy_s_stream_stop(struct v4l2_subdev *sd) if (!priv->is_streaming) return 0; + if (priv->stream_off) + priv->stream_off(priv, sd); priv->is_streaming = false; return 0; @@ -1158,6 +1161,18 @@ static int csi_mipidphy_stream_on(struct mipidphy_priv *priv, return 0; } +static int csi_mipidphy_stream_off(struct mipidphy_priv *priv, + struct v4l2_subdev *sd) +{ + /* disable all lanes */ + write_csiphy_reg(priv, CSIPHY_CTRL_LANE_ENABLE, 0x01); + /* disable pll and ldo */ + write_csiphy_reg(priv, CSIPHY_CTRL_PWRCTL, 0xe3); + usleep_range(500, 1000); + + return 0; +} + static const struct dphy_drv_data rk1808_mipidphy_drv_data = { .clks = rk1808_mipidphy_clks, .num_clks = ARRAY_SIZE(rk1808_mipidphy_clks), @@ -1433,6 +1448,7 @@ static int rockchip_mipidphy_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->csihost_base_addr = devm_ioremap_resource(dev, res); priv->stream_on = csi_mipidphy_stream_on; + priv->stream_off = csi_mipidphy_stream_off; } else { priv->stream_on = mipidphy_txrx_stream_on; priv->txrx_base_addr = NULL; @@ -1440,6 +1456,7 @@ static int rockchip_mipidphy_probe(struct platform_device *pdev) priv->txrx_base_addr = devm_ioremap_resource(dev, res); if (IS_ERR(priv->txrx_base_addr)) priv->stream_on = mipidphy_rx_stream_on; + priv->stream_off = NULL; } sd = &priv->sd; |