[media] v4l: Switch from V4L2 OF not V4L2 fwnode API
Switch users of the v4l2_of_ APIs to the more generic v4l2_fwnode_ APIs. Async OF matching is replaced by fwnode matching and OF matching support is removed. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Benoit Parrot <bparrot@ti.com> # i2c/ov2569.c, am437x/am437x-vpfe.c and ti-vpe/cal.c Tested-by: Hans Verkuil <hans.verkuil@cisco.com> # Atmel sama5d3 board + ov2640 sensor Tested-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
此提交包含在:
@@ -55,6 +55,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/omap-iommu.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/sched.h>
|
||||
@@ -63,9 +64,9 @@
|
||||
#include <asm/dma-iommu.h>
|
||||
|
||||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-fwnode.h>
|
||||
#include <media/v4l2-device.h>
|
||||
#include <media/v4l2-mc.h>
|
||||
#include <media/v4l2-of.h>
|
||||
|
||||
#include "isp.h"
|
||||
#include "ispreg.h"
|
||||
@@ -2007,20 +2008,20 @@ enum isp_of_phy {
|
||||
ISP_OF_PHY_CSIPHY2,
|
||||
};
|
||||
|
||||
static int isp_of_parse_node(struct device *dev, struct device_node *node,
|
||||
struct isp_async_subdev *isd)
|
||||
static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode,
|
||||
struct isp_async_subdev *isd)
|
||||
{
|
||||
struct isp_bus_cfg *buscfg = &isd->bus;
|
||||
struct v4l2_of_endpoint vep;
|
||||
struct v4l2_fwnode_endpoint vep;
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
ret = v4l2_of_parse_endpoint(node, &vep);
|
||||
ret = v4l2_fwnode_endpoint_parse(fwnode, &vep);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
dev_dbg(dev, "parsing endpoint %s, interface %u\n", node->full_name,
|
||||
vep.base.port);
|
||||
dev_dbg(dev, "parsing endpoint %s, interface %u\n",
|
||||
to_of_node(fwnode)->full_name, vep.base.port);
|
||||
|
||||
switch (vep.base.port) {
|
||||
case ISP_OF_PHY_PARALLEL:
|
||||
@@ -2077,18 +2078,18 @@ static int isp_of_parse_node(struct device *dev, struct device_node *node,
|
||||
break;
|
||||
|
||||
default:
|
||||
dev_warn(dev, "%s: invalid interface %u\n", node->full_name,
|
||||
vep.base.port);
|
||||
dev_warn(dev, "%s: invalid interface %u\n",
|
||||
to_of_node(fwnode)->full_name, vep.base.port);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int isp_of_parse_nodes(struct device *dev,
|
||||
struct v4l2_async_notifier *notifier)
|
||||
static int isp_fwnodes_parse(struct device *dev,
|
||||
struct v4l2_async_notifier *notifier)
|
||||
{
|
||||
struct device_node *node = NULL;
|
||||
struct fwnode_handle *fwnode = NULL;
|
||||
|
||||
notifier->subdevs = devm_kcalloc(
|
||||
dev, ISP_MAX_SUBDEVS, sizeof(*notifier->subdevs), GFP_KERNEL);
|
||||
@@ -2096,7 +2097,8 @@ static int isp_of_parse_nodes(struct device *dev,
|
||||
return -ENOMEM;
|
||||
|
||||
while (notifier->num_subdevs < ISP_MAX_SUBDEVS &&
|
||||
(node = of_graph_get_next_endpoint(dev->of_node, node))) {
|
||||
(fwnode = fwnode_graph_get_next_endpoint(
|
||||
of_fwnode_handle(dev->of_node), fwnode))) {
|
||||
struct isp_async_subdev *isd;
|
||||
|
||||
isd = devm_kzalloc(dev, sizeof(*isd), GFP_KERNEL);
|
||||
@@ -2105,23 +2107,24 @@ static int isp_of_parse_nodes(struct device *dev,
|
||||
|
||||
notifier->subdevs[notifier->num_subdevs] = &isd->asd;
|
||||
|
||||
if (isp_of_parse_node(dev, node, isd))
|
||||
if (isp_fwnode_parse(dev, fwnode, isd))
|
||||
goto error;
|
||||
|
||||
isd->asd.match.of.node = of_graph_get_remote_port_parent(node);
|
||||
if (!isd->asd.match.of.node) {
|
||||
isd->asd.match.fwnode.fwnode =
|
||||
fwnode_graph_get_remote_port_parent(fwnode);
|
||||
if (!isd->asd.match.fwnode.fwnode) {
|
||||
dev_warn(dev, "bad remote port parent\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
isd->asd.match_type = V4L2_ASYNC_MATCH_OF;
|
||||
isd->asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
|
||||
notifier->num_subdevs++;
|
||||
}
|
||||
|
||||
return notifier->num_subdevs;
|
||||
|
||||
error:
|
||||
of_node_put(node);
|
||||
fwnode_handle_put(fwnode);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -2192,8 +2195,8 @@ static int isp_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ret = of_property_read_u32(pdev->dev.of_node, "ti,phy-type",
|
||||
&isp->phy_type);
|
||||
ret = fwnode_property_read_u32(of_fwnode_handle(pdev->dev.of_node),
|
||||
"ti,phy-type", &isp->phy_type);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -2202,12 +2205,12 @@ static int isp_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(isp->syscon))
|
||||
return PTR_ERR(isp->syscon);
|
||||
|
||||
ret = of_property_read_u32_index(pdev->dev.of_node, "syscon", 1,
|
||||
&isp->syscon_offset);
|
||||
ret = of_property_read_u32_index(pdev->dev.of_node,
|
||||
"syscon", 1, &isp->syscon_offset);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = isp_of_parse_nodes(&pdev->dev, &isp->notifier);
|
||||
ret = isp_fwnodes_parse(&pdev->dev, &isp->notifier);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
新增問題並參考
封鎖使用者