From 973b4ed0cce3528d89151a9d78aa66a199975faf Mon Sep 17 00:00:00 2001 From: Zefa Chen Date: Fri, 29 Sep 2023 15:14:37 +0800 Subject: [PATCH] phy: rockchip: mipi csi2 dphy skip unready sensor and lens-focus device for GKI This applies to situations where multiple cameras need to be supported in one DTS, and camera devices need to be registered with GKI Note: phy-rockchip-csi2-dphy.ko must be insmod last Signed-off-by: Zefa Chen Change-Id: If915530d4b982df9500851df89b776e18ed7dd38 --- drivers/phy/rockchip/phy-rockchip-csi2-dphy.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/phy/rockchip/phy-rockchip-csi2-dphy.c b/drivers/phy/rockchip/phy-rockchip-csi2-dphy.c index 0818925bb92f..b02a3a7cbaa5 100644 --- a/drivers/phy/rockchip/phy-rockchip-csi2-dphy.c +++ b/drivers/phy/rockchip/phy-rockchip-csi2-dphy.c @@ -805,6 +805,7 @@ static int rockchip_csi2_dphy_fwnode_parse(struct csi2_dphy *dphy) struct v4l2_fwnode_endpoint vep = { .bus_type = V4L2_MBUS_CSI2_DPHY }; + struct device *remote_dev = NULL; int ret; fwnode_graph_for_each_endpoint(dev_fwnode(dev), ep) { @@ -824,6 +825,18 @@ static int rockchip_csi2_dphy_fwnode_parse(struct csi2_dphy *dphy) continue; } + /* check sensor register state on i2c/spi bus for gki*/ + if (!IS_ENABLED(CONFIG_NO_GKI)) { + remote_dev = bus_find_device_by_fwnode(&i2c_bus_type, remote_ep); + if (!remote_dev || !remote_dev->driver) { + remote_dev = bus_find_device_by_fwnode(&spi_bus_type, remote_ep); + if (!remote_dev || !remote_dev->driver) { + fwnode_handle_put(remote_ep); + continue; + } + } + } + fwnode_handle_put(remote_ep); s_asd = v4l2_async_nf_add_fwnode_remote(&dphy->notifier, ep,