Commit 0fbbb09c authored by Paul Kocialkowski's avatar Paul Kocialkowski Committed by Mauro Carvalho Chehab

media: sun6i-csi: Detect the availability of the ISP

Add a helper to detect whether the ISP is available and connected
and store the indication in the driver-specific device structure.
Signed-off-by: default avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 24e6c88a
...@@ -24,6 +24,36 @@ ...@@ -24,6 +24,36 @@
#include "sun6i_csi_capture.h" #include "sun6i_csi_capture.h"
#include "sun6i_csi_reg.h" #include "sun6i_csi_reg.h"
/* ISP */
static int sun6i_csi_isp_detect(struct sun6i_csi_device *csi_dev)
{
struct device *dev = csi_dev->dev;
struct fwnode_handle *handle;
/*
* ISP is not available if not connected via fwnode graph.
* This will also check that the remote parent node is available.
*/
handle = fwnode_graph_get_endpoint_by_id(dev_fwnode(dev),
SUN6I_CSI_PORT_ISP, 0,
FWNODE_GRAPH_ENDPOINT_NEXT);
if (!handle)
return 0;
fwnode_handle_put(handle);
if (!IS_ENABLED(CONFIG_VIDEO_SUN6I_ISP)) {
dev_warn(dev,
"ISP link is detected but not enabled in kernel config!");
return 0;
}
csi_dev->isp_available = true;
return 0;
}
/* Media */ /* Media */
static const struct media_device_ops sun6i_csi_media_ops = { static const struct media_device_ops sun6i_csi_media_ops = {
...@@ -289,6 +319,10 @@ static int sun6i_csi_probe(struct platform_device *platform_dev) ...@@ -289,6 +319,10 @@ static int sun6i_csi_probe(struct platform_device *platform_dev)
if (ret) if (ret)
return ret; return ret;
ret = sun6i_csi_isp_detect(csi_dev);
if (ret)
goto error_resources;
ret = sun6i_csi_v4l2_setup(csi_dev); ret = sun6i_csi_v4l2_setup(csi_dev);
if (ret) if (ret)
goto error_resources; goto error_resources;
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
enum sun6i_csi_port { enum sun6i_csi_port {
SUN6I_CSI_PORT_PARALLEL = 0, SUN6I_CSI_PORT_PARALLEL = 0,
SUN6I_CSI_PORT_MIPI_CSI2 = 1, SUN6I_CSI_PORT_MIPI_CSI2 = 1,
SUN6I_CSI_PORT_ISP = 2,
}; };
struct sun6i_csi_buffer { struct sun6i_csi_buffer {
...@@ -44,6 +45,8 @@ struct sun6i_csi_device { ...@@ -44,6 +45,8 @@ struct sun6i_csi_device {
struct clk *clock_mod; struct clk *clock_mod;
struct clk *clock_ram; struct clk *clock_ram;
struct reset_control *reset; struct reset_control *reset;
bool isp_available;
}; };
struct sun6i_csi_variant { struct sun6i_csi_variant {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment