BACKPORT: [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>
(cherry picked from commit 859969b38e)
Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu@intel.com>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>

Conflicts:
Nathan: context, comment and include deltas, as well as deleting files
that don't apply to ChromeOS-4.4 yet
	drivers/media/i2c/Kconfig
	drivers/media/i2c/mt9v032.c
	drivers/media/i2c/ov5645.c
	drivers/media/i2c/ov5647.c
	drivers/media/i2c/s5c73m3/s5c73m3-core.c
	drivers/media/i2c/smiapp/smiapp-core.c
	drivers/media/i2c/tc358743.c
	drivers/media/i2c/tvp514x.c
	drivers/media/i2c/tvp5150.c
	drivers/media/i2c/tvp7002.c
	drivers/media/platform/Kconfig
	drivers/media/platform/atmel/Kconfig
	drivers/media/platform/atmel/atmel-isc.c
	drivers/media/platform/atmel/atmel-isi.c
	drivers/media/platform/exynos4-is/mipi-csis.c
	drivers/media/platform/omap3isp/isp.c
	drivers/media/platform/pxa_camera.c
	drivers/media/platform/rcar-vin/Kconfig
	drivers/media/platform/rcar-vin/rcar-core.c
	drivers/media/platform/soc_camera/soc_camera.c
	drivers/media/platform/stm32/stm32-dcmi.c
	drivers/media/platform/ti-vpe/cal.c
	include/media/v4l2-subdev.h

BUG=b:62359918
TEST=No regression in camera functionality
TEST=Kernel builds and boots

Change-Id: If338e2ab0c68c72f242988f34202e0449642734c
Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/528621
Commit-Ready: Nathan D Ciobanu <nathan.d.ciobanu@intel.com>
Tested-by: Yong Zhi <yong.zhi@intel.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
This commit is contained in:
Sakari Ailus 2016-08-26 20:17:25 -03:00 committed by Huang, Tao
parent aed4e07a75
commit cd40430ed3
25 changed files with 179 additions and 135 deletions

View File

@ -199,6 +199,7 @@ config VIDEO_ADV7604
depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
depends on GPIOLIB || COMPILE_TEST
select HDMI
select V4L2_FWNODE
---help---
Support for the Analog Devices ADV7604 video decoder.
@ -291,6 +292,7 @@ config VIDEO_TC358743
tristate "Toshiba TC358743 decoder"
depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
select HDMI
select V4L2_FWNODE
---help---
Support for the Toshiba TC358743 HDMI to MIPI CSI-2 bridge.
@ -300,6 +302,7 @@ config VIDEO_TC358743
config VIDEO_TVP514X
tristate "Texas Instruments TVP514x video decoder"
depends on VIDEO_V4L2 && I2C
select V4L2_FWNODE
---help---
This is a Video4Linux2 sensor-level driver for the TI TVP5146/47
decoder. It is currently working with the TI OMAP3 camera
@ -311,6 +314,7 @@ config VIDEO_TVP514X
config VIDEO_TVP5150
tristate "Texas Instruments TVP5150 video decoder"
depends on VIDEO_V4L2 && I2C
select V4L2_FWNODE
---help---
Support for the Texas Instruments TVP5150 video decoder.
@ -320,6 +324,7 @@ config VIDEO_TVP5150
config VIDEO_TVP7002
tristate "Texas Instruments TVP7002 video decoder"
depends on VIDEO_V4L2 && I2C
select V4L2_FWNODE
---help---
Support for the Texas Instruments TVP7002 video decoder.
@ -483,6 +488,7 @@ config VIDEO_OV2659
tristate "OmniVision OV2659 sensor support"
depends on VIDEO_V4L2 && I2C
depends on MEDIA_CAMERA_SUPPORT
select V4L2_FWNODE
---help---
This is a Video4Linux2 sensor-level driver for the OmniVision
OV2659 camera.
@ -568,6 +574,7 @@ config VIDEO_MT9V032
depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
depends on MEDIA_CAMERA_SUPPORT
select REGMAP_I2C
select V4L2_FWNODE
---help---
This is a Video4Linux2 sensor-level driver for the Micron
MT9V032 752x480 CMOS sensor.
@ -615,6 +622,7 @@ config VIDEO_S5K4ECGX
config VIDEO_S5K5BAF
tristate "Samsung S5K5BAF sensor support"
depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
select V4L2_FWNODE
---help---
This is a V4L2 sensor-level driver for Samsung S5K5BAF 2M
camera sensor with an embedded SoC image signal processor.
@ -624,6 +632,7 @@ source "drivers/media/i2c/smiapp/Kconfig"
config VIDEO_S5C73M3
tristate "Samsung S5C73M3 sensor support"
depends on I2C && SPI && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
select V4L2_FWNODE
---help---
This is a V4L2 sensor-level driver for Samsung S5C73M3
8 Mpixel camera.

View File

@ -33,6 +33,7 @@
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of_graph.h>
#include <linux/slab.h>
#include <linux/v4l2-dv-timings.h>
#include <linux/videodev2.h>
@ -44,7 +45,7 @@
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
#include <media/v4l2-dv-timings.h>
#include <media/v4l2-of.h>
#include <media/v4l2-fwnode.h>
static int debug;
module_param(debug, int, 0644);
@ -2794,10 +2795,11 @@ MODULE_DEVICE_TABLE(of, adv76xx_of_id);
static int adv76xx_parse_dt(struct adv76xx_state *state)
{
struct v4l2_of_endpoint bus_cfg;
struct v4l2_fwnode_endpoint bus_cfg;
struct device_node *endpoint;
struct device_node *np;
unsigned int flags;
int ret;
u32 v;
np = state->i2c_clients[ADV76XX_PAGE_IO]->dev.of_node;
@ -2807,7 +2809,11 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
if (!endpoint)
return -EINVAL;
v4l2_of_parse_endpoint(endpoint, &bus_cfg);
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint), &bus_cfg);
if (ret) {
of_node_put(endpoint);
return ret;
}
if (!of_property_read_u32(endpoint, "default-input", &v))
state->pdata.default_input = v;

View File

@ -19,6 +19,7 @@
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/of_graph.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/videodev2.h>
@ -28,7 +29,7 @@
#include <media/mt9v032.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-of.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-subdev.h>
/* The first four rows are black rows. The active area spans 753x481 pixels. */
@ -883,7 +884,7 @@ static struct mt9v032_platform_data *
mt9v032_get_pdata(struct i2c_client *client)
{
struct mt9v032_platform_data *pdata = NULL;
struct v4l2_of_endpoint endpoint;
struct v4l2_fwnode_endpoint endpoint;
struct device_node *np;
struct property *prop;
@ -894,7 +895,7 @@ mt9v032_get_pdata(struct i2c_client *client)
if (!np)
return NULL;
if (v4l2_of_parse_endpoint(np, &endpoint) < 0)
if (v4l2_fwnode_endpoint_parse(of_fwnode_handle(np), &endpoint) < 0)
goto done;
pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);

View File

@ -42,9 +42,9 @@
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-image-sizes.h>
#include <media/v4l2-mediabus.h>
#include <media/v4l2-of.h>
#include <media/v4l2-subdev.h>
#define DRIVER_NAME "ov2659"
@ -1349,7 +1349,7 @@ static struct ov2659_platform_data *
ov2659_get_pdata(struct i2c_client *client)
{
struct ov2659_platform_data *pdata;
struct v4l2_of_endpoint *bus_cfg;
struct v4l2_fwnode_endpoint *bus_cfg;
struct device_node *endpoint;
if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
@ -1359,7 +1359,7 @@ ov2659_get_pdata(struct i2c_client *client)
if (!endpoint)
return NULL;
bus_cfg = v4l2_of_alloc_parse_endpoint(endpoint);
bus_cfg = v4l2_fwnode_endpoint_alloc_parse(of_fwnode_handle(endpoint));
if (IS_ERR(bus_cfg)) {
pdata = NULL;
goto done;
@ -1379,7 +1379,7 @@ ov2659_get_pdata(struct i2c_client *client)
pdata->link_frequency = bus_cfg->link_frequencies[0];
done:
v4l2_of_free_endpoint(bus_cfg);
v4l2_fwnode_endpoint_free(bus_cfg);
of_node_put(endpoint);
return pdata;
}

View File

@ -24,6 +24,7 @@
#include <linux/media.h>
#include <linux/module.h>
#include <linux/of_gpio.h>
#include <linux/of_graph.h>
#include <linux/regulator/consumer.h>
#include <linux/sizes.h>
#include <linux/slab.h>
@ -35,7 +36,7 @@
#include <media/v4l2-subdev.h>
#include <media/v4l2-mediabus.h>
#include <media/s5c73m3.h>
#include <media/v4l2-of.h>
#include <media/v4l2-fwnode.h>
#include "s5c73m3.h"
@ -1602,7 +1603,7 @@ static int s5c73m3_get_platform_data(struct s5c73m3 *state)
const struct s5c73m3_platform_data *pdata = dev->platform_data;
struct device_node *node = dev->of_node;
struct device_node *node_ep;
struct v4l2_of_endpoint ep;
struct v4l2_fwnode_endpoint ep;
int ret;
if (!node) {
@ -1639,8 +1640,10 @@ static int s5c73m3_get_platform_data(struct s5c73m3 *state)
return 0;
}
v4l2_of_parse_endpoint(node_ep, &ep);
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(node_ep), &ep);
of_node_put(node_ep);
if (ret)
return ret;
if (ep.bus_type != V4L2_MBUS_CSI2) {
dev_err(dev, "unsupported bus type\n");

View File

@ -30,7 +30,7 @@
#include <media/v4l2-device.h>
#include <media/v4l2-subdev.h>
#include <media/v4l2-mediabus.h>
#include <media/v4l2-of.h>
#include <media/v4l2-fwnode.h>
static int debug;
module_param(debug, int, 0644);
@ -1841,7 +1841,7 @@ static int s5k5baf_parse_device_node(struct s5k5baf *state, struct device *dev)
{
struct device_node *node = dev->of_node;
struct device_node *node_ep;
struct v4l2_of_endpoint ep;
struct v4l2_fwnode_endpoint ep;
int ret;
if (!node) {
@ -1868,8 +1868,11 @@ static int s5k5baf_parse_device_node(struct s5k5baf *state, struct device *dev)
return -EINVAL;
}
v4l2_of_parse_endpoint(node_ep, &ep);
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(node_ep), &ep);
of_node_put(node_ep);
if (ret)
return ret;
state->bus_type = ep.bus_type;
switch (state->bus_type) {

View File

@ -3,5 +3,6 @@ config VIDEO_SMIAPP
depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAVE_CLK
depends on MEDIA_CAMERA_SUPPORT
select VIDEO_SMIAPP_PLL
select V4L2_FWNODE
---help---
This is a generic driver for SMIA++/SMIA camera modules.

View File

@ -26,12 +26,13 @@
#include <linux/gpio.h>
#include <linux/module.h>
#include <linux/of_gpio.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/smiapp.h>
#include <linux/v4l2-mediabus.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-device.h>
#include <media/v4l2-of.h>
#include "smiapp.h"
@ -2975,19 +2976,20 @@ static int smiapp_resume(struct device *dev)
static struct smiapp_platform_data *smiapp_get_pdata(struct device *dev)
{
struct smiapp_platform_data *pdata;
struct v4l2_of_endpoint *bus_cfg;
struct device_node *ep;
struct v4l2_fwnode_endpoint *bus_cfg;
struct fwnode_handle *ep;
struct fwnode_handle *fwnode = dev_fwnode(dev);
int i;
int rval;
if (!dev->of_node)
if (!fwnode)
return dev->platform_data;
ep = of_graph_get_next_endpoint(dev->of_node, NULL);
ep = fwnode_graph_get_next_endpoint(fwnode, NULL);
if (!ep)
return NULL;
bus_cfg = v4l2_of_alloc_parse_endpoint(ep);
bus_cfg = v4l2_fwnode_endpoint_alloc_parse(ep);
if (IS_ERR(bus_cfg))
goto out_err;
@ -3042,13 +3044,13 @@ static struct smiapp_platform_data *smiapp_get_pdata(struct device *dev)
dev_dbg(dev, "freq %d: %lld\n", i, pdata->op_sys_clock[i]);
}
v4l2_of_free_endpoint(bus_cfg);
of_node_put(ep);
v4l2_fwnode_endpoint_free(bus_cfg);
fwnode_handle_put(ep);
return pdata;
out_err:
v4l2_of_free_endpoint(bus_cfg);
of_node_put(ep);
v4l2_fwnode_endpoint_free(bus_cfg);
fwnode_handle_put(ep);
return NULL;
}

View File

@ -33,6 +33,7 @@
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/interrupt.h>
#include <linux/of_graph.h>
#include <linux/videodev2.h>
#include <linux/workqueue.h>
#include <linux/v4l2-dv-timings.h>
@ -41,7 +42,7 @@
#include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-event.h>
#include <media/v4l2-of.h>
#include <media/v4l2-fwnode.h>
#include <media/tc358743.h>
#include "tc358743_regs.h"
@ -77,7 +78,7 @@ static const struct v4l2_dv_timings_cap tc358743_timings_cap = {
struct tc358743_state {
struct tc358743_platform_data pdata;
struct v4l2_of_bus_mipi_csi2 bus;
struct v4l2_fwnode_bus_mipi_csi2 bus;
struct v4l2_subdev sd;
struct media_pad pad;
struct v4l2_ctrl_handler hdl;
@ -1692,7 +1693,7 @@ static void tc358743_gpio_reset(struct tc358743_state *state)
static int tc358743_probe_of(struct tc358743_state *state)
{
struct device *dev = &state->i2c_client->dev;
struct v4l2_of_endpoint *endpoint;
struct v4l2_fwnode_endpoint *endpoint;
struct device_node *ep;
struct clk *refclk;
u32 bps_pr_lane;
@ -1712,7 +1713,7 @@ static int tc358743_probe_of(struct tc358743_state *state)
return -EINVAL;
}
endpoint = v4l2_of_alloc_parse_endpoint(ep);
endpoint = v4l2_fwnode_endpoint_alloc_parse(of_fwnode_handle(ep));
if (IS_ERR(endpoint)) {
dev_err(dev, "failed to parse endpoint\n");
return PTR_ERR(endpoint);
@ -1800,7 +1801,7 @@ static int tc358743_probe_of(struct tc358743_state *state)
disable_clk:
clk_disable_unprepare(refclk);
free_endpoint:
v4l2_of_free_endpoint(endpoint);
v4l2_fwnode_endpoint_free(endpoint);
return ret;
}
#else

View File

@ -42,7 +42,7 @@
#include <media/v4l2-device.h>
#include <media/v4l2-common.h>
#include <media/v4l2-mediabus.h>
#include <media/v4l2-of.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-ctrls.h>
#include <media/tvp514x.h>
#include <media/media-entity.h>
@ -1002,7 +1002,7 @@ static struct tvp514x_platform_data *
tvp514x_get_pdata(struct i2c_client *client)
{
struct tvp514x_platform_data *pdata;
struct v4l2_of_endpoint bus_cfg;
struct v4l2_fwnode_endpoint bus_cfg;
struct device_node *endpoint;
unsigned int flags;
@ -1017,7 +1017,7 @@ tvp514x_get_pdata(struct i2c_client *client)
if (!pdata)
goto done;
v4l2_of_parse_endpoint(endpoint, &bus_cfg);
v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint), &bus_cfg);
flags = bus_cfg.bus.parallel.flags;
if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)

View File

@ -10,10 +10,12 @@
#include <linux/videodev2.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/of_graph.h>
#include <media/v4l2-async.h>
#include <media/v4l2-device.h>
#include <media/tvp5150.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-fwnode.h>
#include "tvp5150_reg.h"

View File

@ -37,7 +37,7 @@
#include <media/v4l2-device.h>
#include <media/v4l2-common.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-of.h>
#include <media/v4l2-fwnode.h>
#include "tvp7002_reg.h"
@ -893,7 +893,7 @@ static const struct v4l2_subdev_ops tvp7002_ops = {
static struct tvp7002_config *
tvp7002_get_pdata(struct i2c_client *client)
{
struct v4l2_of_endpoint bus_cfg;
struct v4l2_fwnode_endpoint bus_cfg;
struct tvp7002_config *pdata;
struct device_node *endpoint;
unsigned int flags;
@ -905,11 +905,12 @@ tvp7002_get_pdata(struct i2c_client *client)
if (!endpoint)
return NULL;
pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
goto done;
v4l2_of_parse_endpoint(endpoint, &bus_cfg);
v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint), &bus_cfg);
flags = bus_cfg.bus.parallel.flags;
if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)

View File

@ -92,6 +92,7 @@ config VIDEO_OMAP3
select ARM_DMA_USE_IOMMU
select VIDEOBUF2_DMA_CONTIG
select MFD_SYSCON
select V4L2_FWNODE
---help---
Driver for an OMAP 3 camera controller.

View File

@ -3,6 +3,7 @@ config VIDEO_AM437X_VPFE
depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAS_DMA
depends on SOC_AM43XX || COMPILE_TEST
select VIDEOBUF2_DMA_CONTIG
select V4L2_FWNODE
help
Support for AM437x Video Processing Front End based Video
Capture Driver.

View File

@ -26,6 +26,7 @@
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of_graph.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
@ -36,7 +37,7 @@
#include <media/v4l2-common.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-event.h>
#include <media/v4l2-of.h>
#include <media/v4l2-fwnode.h>
#include "am437x-vpfe.h"
@ -2303,7 +2304,8 @@ vpfe_async_bound(struct v4l2_async_notifier *notifier,
vpfe_dbg(1, vpfe, "vpfe_async_bound\n");
for (i = 0; i < ARRAY_SIZE(vpfe->cfg->asd); i++) {
if (vpfe->cfg->asd[i]->match.of.node == asd[i].match.of.node) {
if (vpfe->cfg->asd[i]->match.fwnode.fwnode ==
asd[i].match.fwnode.fwnode) {
sdinfo = &vpfe->cfg->sub_devs[i];
vpfe->sd[i] = subdev;
vpfe->sd[i]->grp_id = sdinfo->grp_id;
@ -2426,7 +2428,7 @@ static struct vpfe_config *
vpfe_get_pdata(struct platform_device *pdev)
{
struct device_node *endpoint = NULL;
struct v4l2_of_endpoint bus_cfg;
struct v4l2_fwnode_endpoint bus_cfg;
struct vpfe_subdev_info *sdinfo;
struct vpfe_config *pdata;
unsigned int flags;
@ -2470,7 +2472,8 @@ vpfe_get_pdata(struct platform_device *pdev)
sdinfo->vpfe_param.if_type = VPFE_RAW_BAYER;
}
err = v4l2_of_parse_endpoint(endpoint, &bus_cfg);
err = v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint),
&bus_cfg);
if (err) {
dev_err(&pdev->dev, "Could not parse the endpoint\n");
goto done;
@ -2508,8 +2511,8 @@ vpfe_get_pdata(struct platform_device *pdev)
goto done;
}
pdata->asd[i]->match_type = V4L2_ASYNC_MATCH_OF;
pdata->asd[i]->match.of.node = rem;
pdata->asd[i]->match_type = V4L2_ASYNC_MATCH_FWNODE;
pdata->asd[i]->match.fwnode.fwnode = of_fwnode_handle(rem);
of_node_put(rem);
}

View File

@ -4,6 +4,7 @@ config VIDEO_SAMSUNG_EXYNOS4_IS
depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
depends on OF && COMMON_CLK
select V4L2_FWNODE
help
Say Y here to enable camera host interface devices for
Samsung S5P and EXYNOS SoC series.
@ -32,6 +33,7 @@ config VIDEO_S5P_MIPI_CSIS
tristate "S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver"
depends on REGULATOR
select GENERIC_PHY
select V4L2_FWNODE
help
This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2
receiver (MIPI-CSIS) devices.

View File

@ -29,7 +29,7 @@
#include <linux/slab.h>
#include <media/v4l2-async.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-of.h>
#include <media/v4l2-fwnode.h>
#include <media/media-device.h>
#include <media/exynos-fimc.h>
@ -332,14 +332,20 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
{
struct fimc_source_info *pd = &fmd->sensor[index].pdata;
struct device_node *rem, *ep, *np;
struct v4l2_of_endpoint endpoint;
struct v4l2_fwnode_endpoint endpoint;
int ret;
/* Assume here a port node can have only one endpoint node. */
ep = of_get_next_child(port, NULL);
if (!ep)
return 0;
v4l2_of_parse_endpoint(ep, &endpoint);
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &endpoint);
if (ret) {
of_node_put(ep);
return ret;
}
if (WARN_ON(endpoint.base.port == 0) || index >= FIMC_MAX_SENSORS)
return -EINVAL;
@ -387,8 +393,8 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
if (WARN_ON(index >= ARRAY_SIZE(fmd->sensor)))
return -EINVAL;
fmd->sensor[index].asd.match_type = V4L2_ASYNC_MATCH_OF;
fmd->sensor[index].asd.match.of.node = rem;
fmd->sensor[index].asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
fmd->sensor[index].asd.match.fwnode.fwnode = of_fwnode_handle(rem);
fmd->async_subdevs[index] = &fmd->sensor[index].asd;
fmd->num_sensors++;
@ -1277,7 +1283,8 @@ static int subdev_notifier_bound(struct v4l2_async_notifier *notifier,
/* Find platform data for this sensor subdev */
for (i = 0; i < ARRAY_SIZE(fmd->sensor); i++)
if (fmd->sensor[i].asd.match.of.node == subdev->dev->of_node)
if (fmd->sensor[i].asd.match.fwnode.fwnode ==
of_fwnode_handle(subdev->dev->of_node))
si = &fmd->sensor[i];
if (si == NULL)

View File

@ -30,7 +30,7 @@
#include <linux/spinlock.h>
#include <linux/videodev2.h>
#include <media/exynos-fimc.h>
#include <media/v4l2-of.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-subdev.h>
#include "mipi-csis.h"
@ -735,7 +735,8 @@ static int s5pcsis_parse_dt(struct platform_device *pdev,
struct csis_state *state)
{
struct device_node *node = pdev->dev.of_node;
struct v4l2_of_endpoint endpoint;
struct v4l2_fwnode_endpoint endpoint;
int ret;
if (of_property_read_u32(node, "clock-frequency",
&state->clk_frequency))
@ -751,7 +752,9 @@ static int s5pcsis_parse_dt(struct platform_device *pdev,
return -EINVAL;
}
/* Get port node and validate MIPI-CSI channel id. */
v4l2_of_parse_endpoint(node, &endpoint);
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(node), &endpoint);
if (ret)
goto err;
state->index = endpoint.base.port - FIMC_INPUT_MIPI_CSI2_0;
if (state->index >= CSIS_MAX_ENTITIES)
@ -764,9 +767,10 @@ static int s5pcsis_parse_dt(struct platform_device *pdev,
"samsung,csis-wclk");
state->num_lanes = endpoint.bus.mipi_csi2.num_data_lanes;
of_node_put(node);
return 0;
err:
of_node_put(node);
return ret;
}
static int s5pcsis_pm_resume(struct device *dev, bool runtime);

View File

@ -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,8 +64,8 @@
#include <asm/dma-iommu.h>
#include <media/v4l2-common.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-device.h>
#include <media/v4l2-of.h>
#include "isp.h"
#include "ispreg.h"
@ -2158,17 +2159,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;
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:
@ -2225,18 +2229,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);
@ -2244,34 +2248,35 @@ 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);
if (!isd) {
of_node_put(node);
return -ENOMEM;
}
if (!isd)
goto error;
notifier->subdevs[notifier->num_subdevs] = &isd->asd;
if (isp_of_parse_node(dev, node, isd)) {
of_node_put(node);
return -EINVAL;
}
if (isp_fwnode_parse(dev, fwnode, isd))
goto error;
isd->asd.match.of.node = of_graph_get_remote_port_parent(node);
of_node_put(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");
return -EINVAL;
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:
fwnode_handle_put(fwnode);
return -EINVAL;
}
static int isp_subdev_notifier_bound(struct v4l2_async_notifier *async,
@ -2326,8 +2331,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;
@ -2336,12 +2341,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;

View File

@ -23,6 +23,7 @@
#include <linux/list.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of_graph.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
@ -36,7 +37,7 @@
#include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-dev.h>
#include <media/v4l2-of.h>
#include <media/v4l2-fwnode.h>
#include <media/videobuf-core.h>
#include <media/videobuf2-v4l2.h>
@ -1640,8 +1641,8 @@ static int soc_of_bind(struct soc_camera_host *ici,
if (!info)
return -ENOMEM;
info->sasd.asd.match.of.node = remote;
info->sasd.asd.match_type = V4L2_ASYNC_MATCH_OF;
info->sasd.asd.match.fwnode.fwnode = of_fwnode_handle(remote);
info->sasd.asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
info->subdev = &info->sasd.asd;
/* Or shall this be managed by the soc-camera device? */

View File

@ -2,6 +2,7 @@ config VIDEO_XILINX
tristate "Xilinx Video IP (EXPERIMENTAL)"
depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && OF && HAS_DMA
select VIDEOBUF2_DMA_CONTIG
select V4L2_FWNODE
---help---
Driver for Xilinx Video IP Pipelines

View File

@ -22,7 +22,7 @@
#include <media/v4l2-async.h>
#include <media/v4l2-common.h>
#include <media/v4l2-device.h>
#include <media/v4l2-of.h>
#include <media/v4l2-fwnode.h>
#include "xilinx-dma.h"
#include "xilinx-vipp.h"
@ -74,7 +74,7 @@ static int xvip_graph_build_one(struct xvip_composite_device *xdev,
struct media_pad *local_pad;
struct media_pad *remote_pad;
struct xvip_graph_entity *ent;
struct v4l2_of_link link;
struct v4l2_fwnode_link link;
struct device_node *ep = NULL;
struct device_node *next;
int ret = 0;
@ -92,7 +92,7 @@ static int xvip_graph_build_one(struct xvip_composite_device *xdev,
dev_dbg(xdev->dev, "processing endpoint %s\n", ep->full_name);
ret = v4l2_of_parse_link(ep, &link);
ret = v4l2_fwnode_parse_link(of_fwnode_handle(ep), &link);
if (ret < 0) {
dev_err(xdev->dev, "failed to parse link for %s\n",
ep->full_name);
@ -103,9 +103,10 @@ static int xvip_graph_build_one(struct xvip_composite_device *xdev,
* the link.
*/
if (link.local_port >= local->num_pads) {
dev_err(xdev->dev, "invalid port number %u on %s\n",
link.local_port, link.local_node->full_name);
v4l2_of_put_link(&link);
dev_err(xdev->dev, "invalid port number %u for %s\n",
link.local_port,
to_of_node(link.local_node)->full_name);
v4l2_fwnode_put_link(&link);
ret = -EINVAL;
break;
}
@ -114,25 +115,28 @@ static int xvip_graph_build_one(struct xvip_composite_device *xdev,
if (local_pad->flags & MEDIA_PAD_FL_SINK) {
dev_dbg(xdev->dev, "skipping sink port %s:%u\n",
link.local_node->full_name, link.local_port);
v4l2_of_put_link(&link);
to_of_node(link.local_node)->full_name,
link.local_port);
v4l2_fwnode_put_link(&link);
continue;
}
/* Skip DMA engines, they will be processed separately. */
if (link.remote_node == xdev->dev->of_node) {
if (link.remote_node == of_fwnode_handle(xdev->dev->of_node)) {
dev_dbg(xdev->dev, "skipping DMA port %s:%u\n",
link.local_node->full_name, link.local_port);
v4l2_of_put_link(&link);
to_of_node(link.local_node)->full_name,
link.local_port);
v4l2_fwnode_put_link(&link);
continue;
}
/* Find the remote entity. */
ent = xvip_graph_find_entity(xdev, link.remote_node);
ent = xvip_graph_find_entity(xdev,
to_of_node(link.remote_node));
if (ent == NULL) {
dev_err(xdev->dev, "no entity found for %s\n",
link.remote_node->full_name);
v4l2_of_put_link(&link);
to_of_node(link.remote_node)->full_name);
v4l2_fwnode_put_link(&link);
ret = -ENODEV;
break;
}
@ -141,15 +145,16 @@ static int xvip_graph_build_one(struct xvip_composite_device *xdev,
if (link.remote_port >= remote->num_pads) {
dev_err(xdev->dev, "invalid port number %u on %s\n",
link.remote_port, link.remote_node->full_name);
v4l2_of_put_link(&link);
link.remote_port,
to_of_node(link.remote_node)->full_name);
v4l2_fwnode_put_link(&link);
ret = -EINVAL;
break;
}
remote_pad = &remote->pads[link.remote_port];
v4l2_of_put_link(&link);
v4l2_fwnode_put_link(&link);
/* Create the media link. */
dev_dbg(xdev->dev, "creating %s:%u -> %s:%u link\n",
@ -194,7 +199,7 @@ static int xvip_graph_build_dma(struct xvip_composite_device *xdev)
struct media_pad *source_pad;
struct media_pad *sink_pad;
struct xvip_graph_entity *ent;
struct v4l2_of_link link;
struct v4l2_fwnode_link link;
struct device_node *ep = NULL;
struct device_node *next;
struct xvip_dma *dma;
@ -213,7 +218,7 @@ static int xvip_graph_build_dma(struct xvip_composite_device *xdev)
dev_dbg(xdev->dev, "processing endpoint %s\n", ep->full_name);
ret = v4l2_of_parse_link(ep, &link);
ret = v4l2_fwnode_parse_link(of_fwnode_handle(ep), &link);
if (ret < 0) {
dev_err(xdev->dev, "failed to parse link for %s\n",
ep->full_name);
@ -225,7 +230,7 @@ static int xvip_graph_build_dma(struct xvip_composite_device *xdev)
if (dma == NULL) {
dev_err(xdev->dev, "no DMA engine found for port %u\n",
link.local_port);
v4l2_of_put_link(&link);
v4l2_fwnode_put_link(&link);
ret = -EINVAL;
break;
}
@ -234,19 +239,21 @@ static int xvip_graph_build_dma(struct xvip_composite_device *xdev)
dma->video.name);
/* Find the remote entity. */
ent = xvip_graph_find_entity(xdev, link.remote_node);
ent = xvip_graph_find_entity(xdev,
to_of_node(link.remote_node));
if (ent == NULL) {
dev_err(xdev->dev, "no entity found for %s\n",
link.remote_node->full_name);
v4l2_of_put_link(&link);
to_of_node(link.remote_node)->full_name);
v4l2_fwnode_put_link(&link);
ret = -ENODEV;
break;
}
if (link.remote_port >= ent->entity->num_pads) {
dev_err(xdev->dev, "invalid port number %u on %s\n",
link.remote_port, link.remote_node->full_name);
v4l2_of_put_link(&link);
link.remote_port,
to_of_node(link.remote_node)->full_name);
v4l2_fwnode_put_link(&link);
ret = -EINVAL;
break;
}
@ -263,7 +270,7 @@ static int xvip_graph_build_dma(struct xvip_composite_device *xdev)
sink_pad = &dma->pad;
}
v4l2_of_put_link(&link);
v4l2_fwnode_put_link(&link);
/* Create the media link. */
dev_dbg(xdev->dev, "creating %s:%u -> %s:%u link\n",
@ -387,8 +394,8 @@ static int xvip_graph_parse_one(struct xvip_composite_device *xdev,
}
entity->node = remote;
entity->asd.match_type = V4L2_ASYNC_MATCH_OF;
entity->asd.match.of.node = remote;
entity->asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
entity->asd.match.fwnode.fwnode = of_fwnode_handle(remote);
list_add_tail(&entity->list, &xdev->entities);
xdev->num_subdevs++;
}

View File

@ -41,12 +41,6 @@ static bool match_devname(struct v4l2_subdev *sd,
return !strcmp(asd->match.device_name.name, dev_name(sd->dev));
}
static bool match_of(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
{
return !of_node_cmp(of_node_full_name(sd->of_node),
of_node_full_name(asd->match.of.node));
}
static bool match_fwnode(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
{
if (!is_of_node(sd->fwnode) || !is_of_node(asd->match.fwnode.fwnode))
@ -88,9 +82,6 @@ static struct v4l2_async_subdev *v4l2_async_belongs(struct v4l2_async_notifier *
case V4L2_ASYNC_MATCH_I2C:
match = match_i2c;
break;
case V4L2_ASYNC_MATCH_OF:
match = match_of;
break;
case V4L2_ASYNC_MATCH_FWNODE:
match = match_fwnode;
break;
@ -171,7 +162,6 @@ int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,
case V4L2_ASYNC_MATCH_CUSTOM:
case V4L2_ASYNC_MATCH_DEVNAME:
case V4L2_ASYNC_MATCH_I2C:
case V4L2_ASYNC_MATCH_OF:
case V4L2_ASYNC_MATCH_FWNODE:
break;
default:
@ -295,8 +285,8 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd)
* (struct v4l2_subdev.dev), and async sub-device does not
* exist independently of the device at any point of time.
*/
if (!sd->of_node && sd->dev)
sd->of_node = sd->dev->of_node;
if (!sd->fwnode && sd->dev)
sd->fwnode = dev_fwnode(sd->dev);
mutex_lock(&list_lock);

View File

@ -31,7 +31,6 @@ struct v4l2_async_notifier;
* v4l2_async_subdev.match ops
* @V4L2_ASYNC_MATCH_DEVNAME: Match will use the device name
* @V4L2_ASYNC_MATCH_I2C: Match will check for I2C adapter ID and address
* @V4L2_ASYNC_MATCH_OF: Match will use OF node
* @V4L2_ASYNC_MATCH_FWNODE: Match will use firmware node
*
* This enum is used by the asyncrhronous sub-device logic to define the
@ -41,7 +40,6 @@ enum v4l2_async_match_type {
V4L2_ASYNC_MATCH_CUSTOM,
V4L2_ASYNC_MATCH_DEVNAME,
V4L2_ASYNC_MATCH_I2C,
V4L2_ASYNC_MATCH_OF,
V4L2_ASYNC_MATCH_FWNODE,
};
@ -56,9 +54,6 @@ enum v4l2_async_match_type {
struct v4l2_async_subdev {
enum v4l2_async_match_type match_type;
union {
struct {
const struct device_node *node;
} of;
struct {
struct fwnode_handle *fwnode;
} fwnode;

View File

@ -724,8 +724,6 @@ struct v4l2_subdev {
struct video_device *devnode;
/* pointer to the physical device, if any */
struct device *dev;
/* The device_node of the subdev, usually the same as dev->of_node. */
struct device_node *of_node;
struct fwnode_handle *fwnode;
/* Links this subdev to a global subdev_list or @notifier->done list. */
struct list_head async_list;