summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2016-08-26 19:17:25 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-06-06 08:58:16 -0400
commit859969b38e2e9352f0227e1ef0be1dff4a3b7299 (patch)
tree694b94a4bb36b24f84ebe2f16620e8b18b374433
parent048ea05b4f4c8f8cf0a9d4c5fc7d16f867160764 (diff)
[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>
-rw-r--r--drivers/media/i2c/Kconfig11
-rw-r--r--drivers/media/i2c/adv7604.c7
-rw-r--r--drivers/media/i2c/mt9v032.c7
-rw-r--r--drivers/media/i2c/ov2659.c8
-rw-r--r--drivers/media/i2c/ov5645.c7
-rw-r--r--drivers/media/i2c/ov5647.c7
-rw-r--r--drivers/media/i2c/s5c73m3/s5c73m3-core.c7
-rw-r--r--drivers/media/i2c/s5k5baf.c6
-rw-r--r--drivers/media/i2c/smiapp/Kconfig1
-rw-r--r--drivers/media/i2c/smiapp/smiapp-core.c29
-rw-r--r--drivers/media/i2c/tc358743.c11
-rw-r--r--drivers/media/i2c/tvp514x.c6
-rw-r--r--drivers/media/i2c/tvp5150.c7
-rw-r--r--drivers/media/i2c/tvp7002.c6
-rw-r--r--drivers/media/platform/Kconfig4
-rw-r--r--drivers/media/platform/am437x/Kconfig1
-rw-r--r--drivers/media/platform/am437x/am437x-vpfe.c15
-rw-r--r--drivers/media/platform/atmel/Kconfig2
-rw-r--r--drivers/media/platform/atmel/atmel-isc.c13
-rw-r--r--drivers/media/platform/atmel/atmel-isi.c11
-rw-r--r--drivers/media/platform/exynos4-is/Kconfig2
-rw-r--r--drivers/media/platform/exynos4-is/media-dev.c13
-rw-r--r--drivers/media/platform/exynos4-is/mipi-csis.c6
-rw-r--r--drivers/media/platform/omap3isp/isp.c49
-rw-r--r--drivers/media/platform/pxa_camera.c11
-rw-r--r--drivers/media/platform/rcar-vin/Kconfig1
-rw-r--r--drivers/media/platform/rcar-vin/rcar-core.c19
-rw-r--r--drivers/media/platform/soc_camera/soc_camera.c7
-rw-r--r--drivers/media/platform/stm32/stm32-dcmi.c13
-rw-r--r--drivers/media/platform/ti-vpe/cal.c15
-rw-r--r--drivers/media/platform/xilinx/Kconfig1
-rw-r--r--drivers/media/platform/xilinx/xilinx-vipp.c63
-rw-r--r--drivers/media/v4l2-core/v4l2-async.c14
-rw-r--r--include/media/v4l2-async.h5
-rw-r--r--include/media/v4l2-subdev.h2
35 files changed, 212 insertions, 175 deletions
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index fd181c99ce11..7c23b7a1fd05 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -209,6 +209,7 @@ config VIDEO_ADV7604
209 depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API 209 depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
210 depends on GPIOLIB || COMPILE_TEST 210 depends on GPIOLIB || COMPILE_TEST
211 select HDMI 211 select HDMI
212 select V4L2_FWNODE
212 ---help--- 213 ---help---
213 Support for the Analog Devices ADV7604 video decoder. 214 Support for the Analog Devices ADV7604 video decoder.
214 215
@@ -322,6 +323,7 @@ config VIDEO_TC358743
322 tristate "Toshiba TC358743 decoder" 323 tristate "Toshiba TC358743 decoder"
323 depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API 324 depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
324 select HDMI 325 select HDMI
326 select V4L2_FWNODE
325 ---help--- 327 ---help---
326 Support for the Toshiba TC358743 HDMI to MIPI CSI-2 bridge. 328 Support for the Toshiba TC358743 HDMI to MIPI CSI-2 bridge.
327 329
@@ -331,6 +333,7 @@ config VIDEO_TC358743
331config VIDEO_TVP514X 333config VIDEO_TVP514X
332 tristate "Texas Instruments TVP514x video decoder" 334 tristate "Texas Instruments TVP514x video decoder"
333 depends on VIDEO_V4L2 && I2C 335 depends on VIDEO_V4L2 && I2C
336 select V4L2_FWNODE
334 ---help--- 337 ---help---
335 This is a Video4Linux2 sensor-level driver for the TI TVP5146/47 338 This is a Video4Linux2 sensor-level driver for the TI TVP5146/47
336 decoder. It is currently working with the TI OMAP3 camera 339 decoder. It is currently working with the TI OMAP3 camera
@@ -342,6 +345,7 @@ config VIDEO_TVP514X
342config VIDEO_TVP5150 345config VIDEO_TVP5150
343 tristate "Texas Instruments TVP5150 video decoder" 346 tristate "Texas Instruments TVP5150 video decoder"
344 depends on VIDEO_V4L2 && I2C 347 depends on VIDEO_V4L2 && I2C
348 select V4L2_FWNODE
345 ---help--- 349 ---help---
346 Support for the Texas Instruments TVP5150 video decoder. 350 Support for the Texas Instruments TVP5150 video decoder.
347 351
@@ -351,6 +355,7 @@ config VIDEO_TVP5150
351config VIDEO_TVP7002 355config VIDEO_TVP7002
352 tristate "Texas Instruments TVP7002 video decoder" 356 tristate "Texas Instruments TVP7002 video decoder"
353 depends on VIDEO_V4L2 && I2C 357 depends on VIDEO_V4L2 && I2C
358 select V4L2_FWNODE
354 ---help--- 359 ---help---
355 Support for the Texas Instruments TVP7002 video decoder. 360 Support for the Texas Instruments TVP7002 video decoder.
356 361
@@ -532,6 +537,7 @@ config VIDEO_OV2659
532 tristate "OmniVision OV2659 sensor support" 537 tristate "OmniVision OV2659 sensor support"
533 depends on VIDEO_V4L2 && I2C 538 depends on VIDEO_V4L2 && I2C
534 depends on MEDIA_CAMERA_SUPPORT 539 depends on MEDIA_CAMERA_SUPPORT
540 select V4L2_FWNODE
535 ---help--- 541 ---help---
536 This is a Video4Linux2 sensor-level driver for the OmniVision 542 This is a Video4Linux2 sensor-level driver for the OmniVision
537 OV2659 camera. 543 OV2659 camera.
@@ -544,6 +550,7 @@ config VIDEO_OV5645
544 depends on OF 550 depends on OF
545 depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API 551 depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
546 depends on MEDIA_CAMERA_SUPPORT 552 depends on MEDIA_CAMERA_SUPPORT
553 select V4L2_FWNODE
547 ---help--- 554 ---help---
548 This is a Video4Linux2 sensor-level driver for the OmniVision 555 This is a Video4Linux2 sensor-level driver for the OmniVision
549 OV5645 camera. 556 OV5645 camera.
@@ -555,6 +562,7 @@ config VIDEO_OV5647
555 tristate "OmniVision OV5647 sensor support" 562 tristate "OmniVision OV5647 sensor support"
556 depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API 563 depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
557 depends on MEDIA_CAMERA_SUPPORT 564 depends on MEDIA_CAMERA_SUPPORT
565 select V4L2_FWNODE
558 ---help--- 566 ---help---
559 This is a Video4Linux2 sensor-level driver for the OmniVision 567 This is a Video4Linux2 sensor-level driver for the OmniVision
560 OV5647 camera. 568 OV5647 camera.
@@ -647,6 +655,7 @@ config VIDEO_MT9V032
647 depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API 655 depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
648 depends on MEDIA_CAMERA_SUPPORT 656 depends on MEDIA_CAMERA_SUPPORT
649 select REGMAP_I2C 657 select REGMAP_I2C
658 select V4L2_FWNODE
650 ---help--- 659 ---help---
651 This is a Video4Linux2 sensor-level driver for the Micron 660 This is a Video4Linux2 sensor-level driver for the Micron
652 MT9V032 752x480 CMOS sensor. 661 MT9V032 752x480 CMOS sensor.
@@ -694,6 +703,7 @@ config VIDEO_S5K4ECGX
694config VIDEO_S5K5BAF 703config VIDEO_S5K5BAF
695 tristate "Samsung S5K5BAF sensor support" 704 tristate "Samsung S5K5BAF sensor support"
696 depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API 705 depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
706 select V4L2_FWNODE
697 ---help--- 707 ---help---
698 This is a V4L2 sensor-level driver for Samsung S5K5BAF 2M 708 This is a V4L2 sensor-level driver for Samsung S5K5BAF 2M
699 camera sensor with an embedded SoC image signal processor. 709 camera sensor with an embedded SoC image signal processor.
@@ -704,6 +714,7 @@ source "drivers/media/i2c/et8ek8/Kconfig"
704config VIDEO_S5C73M3 714config VIDEO_S5C73M3
705 tristate "Samsung S5C73M3 sensor support" 715 tristate "Samsung S5C73M3 sensor support"
706 depends on I2C && SPI && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API 716 depends on I2C && SPI && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
717 select V4L2_FWNODE
707 ---help--- 718 ---help---
708 This is a V4L2 sensor-level driver for Samsung S5C73M3 719 This is a V4L2 sensor-level driver for Samsung S5C73M3
709 8 Mpixel camera. 720 8 Mpixel camera.
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index f1fa9cec489f..660bacb8f7d9 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -33,6 +33,7 @@
33#include <linux/i2c.h> 33#include <linux/i2c.h>
34#include <linux/kernel.h> 34#include <linux/kernel.h>
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/of_graph.h>
36#include <linux/slab.h> 37#include <linux/slab.h>
37#include <linux/v4l2-dv-timings.h> 38#include <linux/v4l2-dv-timings.h>
38#include <linux/videodev2.h> 39#include <linux/videodev2.h>
@@ -45,7 +46,7 @@
45#include <media/v4l2-device.h> 46#include <media/v4l2-device.h>
46#include <media/v4l2-event.h> 47#include <media/v4l2-event.h>
47#include <media/v4l2-dv-timings.h> 48#include <media/v4l2-dv-timings.h>
48#include <media/v4l2-of.h> 49#include <media/v4l2-fwnode.h>
49 50
50static int debug; 51static int debug;
51module_param(debug, int, 0644); 52module_param(debug, int, 0644);
@@ -3069,7 +3070,7 @@ MODULE_DEVICE_TABLE(of, adv76xx_of_id);
3069 3070
3070static int adv76xx_parse_dt(struct adv76xx_state *state) 3071static int adv76xx_parse_dt(struct adv76xx_state *state)
3071{ 3072{
3072 struct v4l2_of_endpoint bus_cfg; 3073 struct v4l2_fwnode_endpoint bus_cfg;
3073 struct device_node *endpoint; 3074 struct device_node *endpoint;
3074 struct device_node *np; 3075 struct device_node *np;
3075 unsigned int flags; 3076 unsigned int flags;
@@ -3083,7 +3084,7 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
3083 if (!endpoint) 3084 if (!endpoint)
3084 return -EINVAL; 3085 return -EINVAL;
3085 3086
3086 ret = v4l2_of_parse_endpoint(endpoint, &bus_cfg); 3087 ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint), &bus_cfg);
3087 if (ret) { 3088 if (ret) {
3088 of_node_put(endpoint); 3089 of_node_put(endpoint);
3089 return ret; 3090 return ret;
diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
index 2e7a6e62a358..8a430640c85d 100644
--- a/drivers/media/i2c/mt9v032.c
+++ b/drivers/media/i2c/mt9v032.c
@@ -19,6 +19,7 @@
19#include <linux/log2.h> 19#include <linux/log2.h>
20#include <linux/mutex.h> 20#include <linux/mutex.h>
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/of_graph.h>
22#include <linux/regmap.h> 23#include <linux/regmap.h>
23#include <linux/slab.h> 24#include <linux/slab.h>
24#include <linux/videodev2.h> 25#include <linux/videodev2.h>
@@ -28,7 +29,7 @@
28#include <media/i2c/mt9v032.h> 29#include <media/i2c/mt9v032.h>
29#include <media/v4l2-ctrls.h> 30#include <media/v4l2-ctrls.h>
30#include <media/v4l2-device.h> 31#include <media/v4l2-device.h>
31#include <media/v4l2-of.h> 32#include <media/v4l2-fwnode.h>
32#include <media/v4l2-subdev.h> 33#include <media/v4l2-subdev.h>
33 34
34/* The first four rows are black rows. The active area spans 753x481 pixels. */ 35/* The first four rows are black rows. The active area spans 753x481 pixels. */
@@ -979,7 +980,7 @@ static struct mt9v032_platform_data *
979mt9v032_get_pdata(struct i2c_client *client) 980mt9v032_get_pdata(struct i2c_client *client)
980{ 981{
981 struct mt9v032_platform_data *pdata = NULL; 982 struct mt9v032_platform_data *pdata = NULL;
982 struct v4l2_of_endpoint endpoint; 983 struct v4l2_fwnode_endpoint endpoint;
983 struct device_node *np; 984 struct device_node *np;
984 struct property *prop; 985 struct property *prop;
985 986
@@ -990,7 +991,7 @@ mt9v032_get_pdata(struct i2c_client *client)
990 if (!np) 991 if (!np)
991 return NULL; 992 return NULL;
992 993
993 if (v4l2_of_parse_endpoint(np, &endpoint) < 0) 994 if (v4l2_fwnode_endpoint_parse(of_fwnode_handle(np), &endpoint) < 0)
994 goto done; 995 goto done;
995 996
996 pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); 997 pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c
index 58615f836fb7..122dd6c5eb38 100644
--- a/drivers/media/i2c/ov2659.c
+++ b/drivers/media/i2c/ov2659.c
@@ -42,9 +42,9 @@
42#include <media/v4l2-ctrls.h> 42#include <media/v4l2-ctrls.h>
43#include <media/v4l2-device.h> 43#include <media/v4l2-device.h>
44#include <media/v4l2-event.h> 44#include <media/v4l2-event.h>
45#include <media/v4l2-fwnode.h>
45#include <media/v4l2-image-sizes.h> 46#include <media/v4l2-image-sizes.h>
46#include <media/v4l2-mediabus.h> 47#include <media/v4l2-mediabus.h>
47#include <media/v4l2-of.h>
48#include <media/v4l2-subdev.h> 48#include <media/v4l2-subdev.h>
49 49
50#define DRIVER_NAME "ov2659" 50#define DRIVER_NAME "ov2659"
@@ -1347,7 +1347,7 @@ static struct ov2659_platform_data *
1347ov2659_get_pdata(struct i2c_client *client) 1347ov2659_get_pdata(struct i2c_client *client)
1348{ 1348{
1349 struct ov2659_platform_data *pdata; 1349 struct ov2659_platform_data *pdata;
1350 struct v4l2_of_endpoint *bus_cfg; 1350 struct v4l2_fwnode_endpoint *bus_cfg;
1351 struct device_node *endpoint; 1351 struct device_node *endpoint;
1352 1352
1353 if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node) 1353 if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
@@ -1357,7 +1357,7 @@ ov2659_get_pdata(struct i2c_client *client)
1357 if (!endpoint) 1357 if (!endpoint)
1358 return NULL; 1358 return NULL;
1359 1359
1360 bus_cfg = v4l2_of_alloc_parse_endpoint(endpoint); 1360 bus_cfg = v4l2_fwnode_endpoint_alloc_parse(of_fwnode_handle(endpoint));
1361 if (IS_ERR(bus_cfg)) { 1361 if (IS_ERR(bus_cfg)) {
1362 pdata = NULL; 1362 pdata = NULL;
1363 goto done; 1363 goto done;
@@ -1377,7 +1377,7 @@ ov2659_get_pdata(struct i2c_client *client)
1377 pdata->link_frequency = bus_cfg->link_frequencies[0]; 1377 pdata->link_frequency = bus_cfg->link_frequencies[0];
1378 1378
1379done: 1379done:
1380 v4l2_of_free_endpoint(bus_cfg); 1380 v4l2_fwnode_endpoint_free(bus_cfg);
1381 of_node_put(endpoint); 1381 of_node_put(endpoint);
1382 return pdata; 1382 return pdata;
1383} 1383}
diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c
index 57bd591ea54b..d1e844f7f03f 100644
--- a/drivers/media/i2c/ov5645.c
+++ b/drivers/media/i2c/ov5645.c
@@ -39,7 +39,7 @@
39#include <linux/slab.h> 39#include <linux/slab.h>
40#include <linux/types.h> 40#include <linux/types.h>
41#include <media/v4l2-ctrls.h> 41#include <media/v4l2-ctrls.h>
42#include <media/v4l2-of.h> 42#include <media/v4l2-fwnode.h>
43#include <media/v4l2-subdev.h> 43#include <media/v4l2-subdev.h>
44 44
45#define OV5645_VOLTAGE_ANALOG 2800000 45#define OV5645_VOLTAGE_ANALOG 2800000
@@ -87,7 +87,7 @@ struct ov5645 {
87 struct device *dev; 87 struct device *dev;
88 struct v4l2_subdev sd; 88 struct v4l2_subdev sd;
89 struct media_pad pad; 89 struct media_pad pad;
90 struct v4l2_of_endpoint ep; 90 struct v4l2_fwnode_endpoint ep;
91 struct v4l2_mbus_framefmt fmt; 91 struct v4l2_mbus_framefmt fmt;
92 struct v4l2_rect crop; 92 struct v4l2_rect crop;
93 struct clk *xclk; 93 struct clk *xclk;
@@ -1102,7 +1102,8 @@ static int ov5645_probe(struct i2c_client *client,
1102 return -EINVAL; 1102 return -EINVAL;
1103 } 1103 }
1104 1104
1105 ret = v4l2_of_parse_endpoint(endpoint, &ov5645->ep); 1105 ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint),
1106 &ov5645->ep);
1106 if (ret < 0) { 1107 if (ret < 0) {
1107 dev_err(dev, "parsing endpoint node failed\n"); 1108 dev_err(dev, "parsing endpoint node failed\n");
1108 return ret; 1109 return ret;
diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c
index f57a0b354cf6..95ce90fdb876 100644
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -25,12 +25,13 @@
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/io.h> 26#include <linux/io.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/of_graph.h>
28#include <linux/slab.h> 29#include <linux/slab.h>
29#include <linux/videodev2.h> 30#include <linux/videodev2.h>
30#include <media/v4l2-device.h> 31#include <media/v4l2-device.h>
32#include <media/v4l2-fwnode.h>
31#include <media/v4l2-image-sizes.h> 33#include <media/v4l2-image-sizes.h>
32#include <media/v4l2-mediabus.h> 34#include <media/v4l2-mediabus.h>
33#include <media/v4l2-of.h>
34 35
35#define SENSOR_NAME "ov5647" 36#define SENSOR_NAME "ov5647"
36 37
@@ -510,7 +511,7 @@ static const struct v4l2_subdev_internal_ops ov5647_subdev_internal_ops = {
510 511
511static int ov5647_parse_dt(struct device_node *np) 512static int ov5647_parse_dt(struct device_node *np)
512{ 513{
513 struct v4l2_of_endpoint bus_cfg; 514 struct v4l2_fwnode_endpoint bus_cfg;
514 struct device_node *ep; 515 struct device_node *ep;
515 516
516 int ret; 517 int ret;
@@ -519,7 +520,7 @@ static int ov5647_parse_dt(struct device_node *np)
519 if (!ep) 520 if (!ep)
520 return -EINVAL; 521 return -EINVAL;
521 522
522 ret = v4l2_of_parse_endpoint(ep, &bus_cfg); 523 ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &bus_cfg);
523 524
524 of_node_put(ep); 525 of_node_put(ep);
525 return ret; 526 return ret;
diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
index 3844853ab0a0..f434fb2ee6fc 100644
--- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c
+++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
@@ -24,6 +24,7 @@
24#include <linux/media.h> 24#include <linux/media.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/of_gpio.h> 26#include <linux/of_gpio.h>
27#include <linux/of_graph.h>
27#include <linux/regulator/consumer.h> 28#include <linux/regulator/consumer.h>
28#include <linux/sizes.h> 29#include <linux/sizes.h>
29#include <linux/slab.h> 30#include <linux/slab.h>
@@ -35,7 +36,7 @@
35#include <media/v4l2-subdev.h> 36#include <media/v4l2-subdev.h>
36#include <media/v4l2-mediabus.h> 37#include <media/v4l2-mediabus.h>
37#include <media/i2c/s5c73m3.h> 38#include <media/i2c/s5c73m3.h>
38#include <media/v4l2-of.h> 39#include <media/v4l2-fwnode.h>
39 40
40#include "s5c73m3.h" 41#include "s5c73m3.h"
41 42
@@ -1602,7 +1603,7 @@ static int s5c73m3_get_platform_data(struct s5c73m3 *state)
1602 const struct s5c73m3_platform_data *pdata = dev->platform_data; 1603 const struct s5c73m3_platform_data *pdata = dev->platform_data;
1603 struct device_node *node = dev->of_node; 1604 struct device_node *node = dev->of_node;
1604 struct device_node *node_ep; 1605 struct device_node *node_ep;
1605 struct v4l2_of_endpoint ep; 1606 struct v4l2_fwnode_endpoint ep;
1606 int ret; 1607 int ret;
1607 1608
1608 if (!node) { 1609 if (!node) {
@@ -1639,7 +1640,7 @@ static int s5c73m3_get_platform_data(struct s5c73m3 *state)
1639 return 0; 1640 return 0;
1640 } 1641 }
1641 1642
1642 ret = v4l2_of_parse_endpoint(node_ep, &ep); 1643 ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(node_ep), &ep);
1643 of_node_put(node_ep); 1644 of_node_put(node_ep);
1644 if (ret) 1645 if (ret)
1645 return ret; 1646 return ret;
diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c
index db82ed05792e..962051b9939d 100644
--- a/drivers/media/i2c/s5k5baf.c
+++ b/drivers/media/i2c/s5k5baf.c
@@ -30,7 +30,7 @@
30#include <media/v4l2-device.h> 30#include <media/v4l2-device.h>
31#include <media/v4l2-subdev.h> 31#include <media/v4l2-subdev.h>
32#include <media/v4l2-mediabus.h> 32#include <media/v4l2-mediabus.h>
33#include <media/v4l2-of.h> 33#include <media/v4l2-fwnode.h>
34 34
35static int debug; 35static int debug;
36module_param(debug, int, 0644); 36module_param(debug, int, 0644);
@@ -1841,7 +1841,7 @@ static int s5k5baf_parse_device_node(struct s5k5baf *state, struct device *dev)
1841{ 1841{
1842 struct device_node *node = dev->of_node; 1842 struct device_node *node = dev->of_node;
1843 struct device_node *node_ep; 1843 struct device_node *node_ep;
1844 struct v4l2_of_endpoint ep; 1844 struct v4l2_fwnode_endpoint ep;
1845 int ret; 1845 int ret;
1846 1846
1847 if (!node) { 1847 if (!node) {
@@ -1868,7 +1868,7 @@ static int s5k5baf_parse_device_node(struct s5k5baf *state, struct device *dev)
1868 return -EINVAL; 1868 return -EINVAL;
1869 } 1869 }
1870 1870
1871 ret = v4l2_of_parse_endpoint(node_ep, &ep); 1871 ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(node_ep), &ep);
1872 of_node_put(node_ep); 1872 of_node_put(node_ep);
1873 if (ret) 1873 if (ret)
1874 return ret; 1874 return ret;
diff --git a/drivers/media/i2c/smiapp/Kconfig b/drivers/media/i2c/smiapp/Kconfig
index 3149cda1d0db..f59718d8e51e 100644
--- a/drivers/media/i2c/smiapp/Kconfig
+++ b/drivers/media/i2c/smiapp/Kconfig
@@ -3,5 +3,6 @@ config VIDEO_SMIAPP
3 depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAVE_CLK 3 depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAVE_CLK
4 depends on MEDIA_CAMERA_SUPPORT 4 depends on MEDIA_CAMERA_SUPPORT
5 select VIDEO_SMIAPP_PLL 5 select VIDEO_SMIAPP_PLL
6 select V4L2_FWNODE
6 ---help--- 7 ---help---
7 This is a generic driver for SMIA++/SMIA camera modules. 8 This is a generic driver for SMIA++/SMIA camera modules.
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index f4e92bdfe192..e0b0c032c4ac 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -27,12 +27,13 @@
27#include <linux/gpio/consumer.h> 27#include <linux/gpio/consumer.h>
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/pm_runtime.h> 29#include <linux/pm_runtime.h>
30#include <linux/property.h>
30#include <linux/regulator/consumer.h> 31#include <linux/regulator/consumer.h>
31#include <linux/slab.h> 32#include <linux/slab.h>
32#include <linux/smiapp.h> 33#include <linux/smiapp.h>
33#include <linux/v4l2-mediabus.h> 34#include <linux/v4l2-mediabus.h>
35#include <media/v4l2-fwnode.h>
34#include <media/v4l2-device.h> 36#include <media/v4l2-device.h>
35#include <media/v4l2-of.h>
36 37
37#include "smiapp.h" 38#include "smiapp.h"
38 39
@@ -2784,19 +2785,20 @@ static int __maybe_unused smiapp_resume(struct device *dev)
2784static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev) 2785static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
2785{ 2786{
2786 struct smiapp_hwconfig *hwcfg; 2787 struct smiapp_hwconfig *hwcfg;
2787 struct v4l2_of_endpoint *bus_cfg; 2788 struct v4l2_fwnode_endpoint *bus_cfg;
2788 struct device_node *ep; 2789 struct fwnode_handle *ep;
2790 struct fwnode_handle *fwnode = dev_fwnode(dev);
2789 int i; 2791 int i;
2790 int rval; 2792 int rval;
2791 2793
2792 if (!dev->of_node) 2794 if (!fwnode)
2793 return dev->platform_data; 2795 return dev->platform_data;
2794 2796
2795 ep = of_graph_get_next_endpoint(dev->of_node, NULL); 2797 ep = fwnode_graph_get_next_endpoint(fwnode, NULL);
2796 if (!ep) 2798 if (!ep)
2797 return NULL; 2799 return NULL;
2798 2800
2799 bus_cfg = v4l2_of_alloc_parse_endpoint(ep); 2801 bus_cfg = v4l2_fwnode_endpoint_alloc_parse(ep);
2800 if (IS_ERR(bus_cfg)) 2802 if (IS_ERR(bus_cfg))
2801 goto out_err; 2803 goto out_err;
2802 2804
@@ -2817,11 +2819,10 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
2817 dev_dbg(dev, "lanes %u\n", hwcfg->lanes); 2819 dev_dbg(dev, "lanes %u\n", hwcfg->lanes);
2818 2820
2819 /* NVM size is not mandatory */ 2821 /* NVM size is not mandatory */
2820 of_property_read_u32(dev->of_node, "nokia,nvm-size", 2822 fwnode_property_read_u32(fwnode, "nokia,nvm-size", &hwcfg->nvm_size);
2821 &hwcfg->nvm_size);
2822 2823
2823 rval = of_property_read_u32(dev->of_node, "clock-frequency", 2824 rval = fwnode_property_read_u32(fwnode, "clock-frequency",
2824 &hwcfg->ext_clk); 2825 &hwcfg->ext_clk);
2825 if (rval) { 2826 if (rval) {
2826 dev_warn(dev, "can't get clock-frequency\n"); 2827 dev_warn(dev, "can't get clock-frequency\n");
2827 goto out_err; 2828 goto out_err;
@@ -2846,13 +2847,13 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
2846 dev_dbg(dev, "freq %d: %lld\n", i, hwcfg->op_sys_clock[i]); 2847 dev_dbg(dev, "freq %d: %lld\n", i, hwcfg->op_sys_clock[i]);
2847 } 2848 }
2848 2849
2849 v4l2_of_free_endpoint(bus_cfg); 2850 v4l2_fwnode_endpoint_free(bus_cfg);
2850 of_node_put(ep); 2851 fwnode_handle_put(ep);
2851 return hwcfg; 2852 return hwcfg;
2852 2853
2853out_err: 2854out_err:
2854 v4l2_of_free_endpoint(bus_cfg); 2855 v4l2_fwnode_endpoint_free(bus_cfg);
2855 of_node_put(ep); 2856 fwnode_handle_put(ep);
2856 return NULL; 2857 return NULL;
2857} 2858}
2858 2859
diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index 3251cba89e8f..3e5b09030303 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -33,6 +33,7 @@
33#include <linux/delay.h> 33#include <linux/delay.h>
34#include <linux/gpio/consumer.h> 34#include <linux/gpio/consumer.h>
35#include <linux/interrupt.h> 35#include <linux/interrupt.h>
36#include <linux/of_graph.h>
36#include <linux/videodev2.h> 37#include <linux/videodev2.h>
37#include <linux/workqueue.h> 38#include <linux/workqueue.h>
38#include <linux/v4l2-dv-timings.h> 39#include <linux/v4l2-dv-timings.h>
@@ -41,7 +42,7 @@
41#include <media/v4l2-device.h> 42#include <media/v4l2-device.h>
42#include <media/v4l2-ctrls.h> 43#include <media/v4l2-ctrls.h>
43#include <media/v4l2-event.h> 44#include <media/v4l2-event.h>
44#include <media/v4l2-of.h> 45#include <media/v4l2-fwnode.h>
45#include <media/i2c/tc358743.h> 46#include <media/i2c/tc358743.h>
46 47
47#include "tc358743_regs.h" 48#include "tc358743_regs.h"
@@ -76,7 +77,7 @@ static const struct v4l2_dv_timings_cap tc358743_timings_cap = {
76 77
77struct tc358743_state { 78struct tc358743_state {
78 struct tc358743_platform_data pdata; 79 struct tc358743_platform_data pdata;
79 struct v4l2_of_bus_mipi_csi2 bus; 80 struct v4l2_fwnode_bus_mipi_csi2 bus;
80 struct v4l2_subdev sd; 81 struct v4l2_subdev sd;
81 struct media_pad pad; 82 struct media_pad pad;
82 struct v4l2_ctrl_handler hdl; 83 struct v4l2_ctrl_handler hdl;
@@ -1695,7 +1696,7 @@ static void tc358743_gpio_reset(struct tc358743_state *state)
1695static int tc358743_probe_of(struct tc358743_state *state) 1696static int tc358743_probe_of(struct tc358743_state *state)
1696{ 1697{
1697 struct device *dev = &state->i2c_client->dev; 1698 struct device *dev = &state->i2c_client->dev;
1698 struct v4l2_of_endpoint *endpoint; 1699 struct v4l2_fwnode_endpoint *endpoint;
1699 struct device_node *ep; 1700 struct device_node *ep;
1700 struct clk *refclk; 1701 struct clk *refclk;
1701 u32 bps_pr_lane; 1702 u32 bps_pr_lane;
@@ -1715,7 +1716,7 @@ static int tc358743_probe_of(struct tc358743_state *state)
1715 return -EINVAL; 1716 return -EINVAL;
1716 } 1717 }
1717 1718
1718 endpoint = v4l2_of_alloc_parse_endpoint(ep); 1719 endpoint = v4l2_fwnode_endpoint_alloc_parse(of_fwnode_handle(ep));
1719 if (IS_ERR(endpoint)) { 1720 if (IS_ERR(endpoint)) {
1720 dev_err(dev, "failed to parse endpoint\n"); 1721 dev_err(dev, "failed to parse endpoint\n");
1721 return PTR_ERR(endpoint); 1722 return PTR_ERR(endpoint);
@@ -1803,7 +1804,7 @@ static int tc358743_probe_of(struct tc358743_state *state)
1803disable_clk: 1804disable_clk:
1804 clk_disable_unprepare(refclk); 1805 clk_disable_unprepare(refclk);
1805free_endpoint: 1806free_endpoint:
1806 v4l2_of_free_endpoint(endpoint); 1807 v4l2_fwnode_endpoint_free(endpoint);
1807 return ret; 1808 return ret;
1808} 1809}
1809#else 1810#else
diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c
index 07853d2252aa..ad2df998f9c5 100644
--- a/drivers/media/i2c/tvp514x.c
+++ b/drivers/media/i2c/tvp514x.c
@@ -38,7 +38,7 @@
38#include <media/v4l2-device.h> 38#include <media/v4l2-device.h>
39#include <media/v4l2-common.h> 39#include <media/v4l2-common.h>
40#include <media/v4l2-mediabus.h> 40#include <media/v4l2-mediabus.h>
41#include <media/v4l2-of.h> 41#include <media/v4l2-fwnode.h>
42#include <media/v4l2-ctrls.h> 42#include <media/v4l2-ctrls.h>
43#include <media/i2c/tvp514x.h> 43#include <media/i2c/tvp514x.h>
44#include <media/media-entity.h> 44#include <media/media-entity.h>
@@ -998,7 +998,7 @@ static struct tvp514x_platform_data *
998tvp514x_get_pdata(struct i2c_client *client) 998tvp514x_get_pdata(struct i2c_client *client)
999{ 999{
1000 struct tvp514x_platform_data *pdata = NULL; 1000 struct tvp514x_platform_data *pdata = NULL;
1001 struct v4l2_of_endpoint bus_cfg; 1001 struct v4l2_fwnode_endpoint bus_cfg;
1002 struct device_node *endpoint; 1002 struct device_node *endpoint;
1003 unsigned int flags; 1003 unsigned int flags;
1004 1004
@@ -1009,7 +1009,7 @@ tvp514x_get_pdata(struct i2c_client *client)
1009 if (!endpoint) 1009 if (!endpoint)
1010 return NULL; 1010 return NULL;
1011 1011
1012 if (v4l2_of_parse_endpoint(endpoint, &bus_cfg)) 1012 if (v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint), &bus_cfg))
1013 goto done; 1013 goto done;
1014 1014
1015 pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); 1015 pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 04e96b3057bb..9da4bf4f2c7a 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -12,10 +12,11 @@
12#include <linux/delay.h> 12#include <linux/delay.h>
13#include <linux/gpio/consumer.h> 13#include <linux/gpio/consumer.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/of_graph.h>
15#include <media/v4l2-async.h> 16#include <media/v4l2-async.h>
16#include <media/v4l2-device.h> 17#include <media/v4l2-device.h>
17#include <media/v4l2-ctrls.h> 18#include <media/v4l2-ctrls.h>
18#include <media/v4l2-of.h> 19#include <media/v4l2-fwnode.h>
19#include <media/v4l2-mc.h> 20#include <media/v4l2-mc.h>
20 21
21#include "tvp5150_reg.h" 22#include "tvp5150_reg.h"
@@ -1358,7 +1359,7 @@ static int tvp5150_init(struct i2c_client *c)
1358 1359
1359static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np) 1360static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np)
1360{ 1361{
1361 struct v4l2_of_endpoint bus_cfg; 1362 struct v4l2_fwnode_endpoint bus_cfg;
1362 struct device_node *ep; 1363 struct device_node *ep;
1363#ifdef CONFIG_MEDIA_CONTROLLER 1364#ifdef CONFIG_MEDIA_CONTROLLER
1364 struct device_node *connectors, *child; 1365 struct device_node *connectors, *child;
@@ -1373,7 +1374,7 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np)
1373 if (!ep) 1374 if (!ep)
1374 return -EINVAL; 1375 return -EINVAL;
1375 1376
1376 ret = v4l2_of_parse_endpoint(ep, &bus_cfg); 1377 ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &bus_cfg);
1377 if (ret) 1378 if (ret)
1378 goto err; 1379 goto err;
1379 1380
diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index 4c1190127c85..a26c1a3f7183 100644
--- a/drivers/media/i2c/tvp7002.c
+++ b/drivers/media/i2c/tvp7002.c
@@ -33,7 +33,7 @@
33#include <media/v4l2-device.h> 33#include <media/v4l2-device.h>
34#include <media/v4l2-common.h> 34#include <media/v4l2-common.h>
35#include <media/v4l2-ctrls.h> 35#include <media/v4l2-ctrls.h>
36#include <media/v4l2-of.h> 36#include <media/v4l2-fwnode.h>
37 37
38#include "tvp7002_reg.h" 38#include "tvp7002_reg.h"
39 39
@@ -889,7 +889,7 @@ static const struct v4l2_subdev_ops tvp7002_ops = {
889static struct tvp7002_config * 889static struct tvp7002_config *
890tvp7002_get_pdata(struct i2c_client *client) 890tvp7002_get_pdata(struct i2c_client *client)
891{ 891{
892 struct v4l2_of_endpoint bus_cfg; 892 struct v4l2_fwnode_endpoint bus_cfg;
893 struct tvp7002_config *pdata = NULL; 893 struct tvp7002_config *pdata = NULL;
894 struct device_node *endpoint; 894 struct device_node *endpoint;
895 unsigned int flags; 895 unsigned int flags;
@@ -901,7 +901,7 @@ tvp7002_get_pdata(struct i2c_client *client)
901 if (!endpoint) 901 if (!endpoint)
902 return NULL; 902 return NULL;
903 903
904 if (v4l2_of_parse_endpoint(endpoint, &bus_cfg)) 904 if (v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint), &bus_cfg))
905 goto done; 905 goto done;
906 906
907 pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); 907 pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index f125f471076f..a4b7cefbde32 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -82,6 +82,7 @@ config VIDEO_OMAP3
82 select ARM_DMA_USE_IOMMU 82 select ARM_DMA_USE_IOMMU
83 select VIDEOBUF2_DMA_CONTIG 83 select VIDEOBUF2_DMA_CONTIG
84 select MFD_SYSCON 84 select MFD_SYSCON
85 select V4L2_FWNODE
85 ---help--- 86 ---help---
86 Driver for an OMAP 3 camera controller. 87 Driver for an OMAP 3 camera controller.
87 88
@@ -97,6 +98,7 @@ config VIDEO_PXA27x
97 depends on PXA27x || COMPILE_TEST 98 depends on PXA27x || COMPILE_TEST
98 select VIDEOBUF2_DMA_SG 99 select VIDEOBUF2_DMA_SG
99 select SG_SPLIT 100 select SG_SPLIT
101 select V4L2_FWNODE
100 ---help--- 102 ---help---
101 This is a v4l2 driver for the PXA27x Quick Capture Interface 103 This is a v4l2 driver for the PXA27x Quick Capture Interface
102 104
@@ -119,6 +121,7 @@ config VIDEO_STM32_DCMI
119 depends on VIDEO_V4L2 && OF && HAS_DMA 121 depends on VIDEO_V4L2 && OF && HAS_DMA
120 depends on ARCH_STM32 || COMPILE_TEST 122 depends on ARCH_STM32 || COMPILE_TEST
121 select VIDEOBUF2_DMA_CONTIG 123 select VIDEOBUF2_DMA_CONTIG
124 select V4L2_FWNODE
122 ---help--- 125 ---help---
123 This module makes the STM32 Digital Camera Memory Interface (DCMI) 126 This module makes the STM32 Digital Camera Memory Interface (DCMI)
124 available as a v4l2 device. 127 available as a v4l2 device.
@@ -139,6 +142,7 @@ config VIDEO_TI_CAL
139 depends on SOC_DRA7XX || COMPILE_TEST 142 depends on SOC_DRA7XX || COMPILE_TEST
140 depends on HAS_DMA 143 depends on HAS_DMA
141 select VIDEOBUF2_DMA_CONTIG 144 select VIDEOBUF2_DMA_CONTIG
145 select V4L2_FWNODE
142 default n 146 default n
143 ---help--- 147 ---help---
144 Support for the TI CAL (Camera Adaptation Layer) block 148 Support for the TI CAL (Camera Adaptation Layer) block
diff --git a/drivers/media/platform/am437x/Kconfig b/drivers/media/platform/am437x/Kconfig
index 42d9c186710a..160e77e9a0fb 100644
--- a/drivers/media/platform/am437x/Kconfig
+++ b/drivers/media/platform/am437x/Kconfig
@@ -3,6 +3,7 @@ config VIDEO_AM437X_VPFE
3 depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAS_DMA 3 depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAS_DMA
4 depends on SOC_AM43XX || COMPILE_TEST 4 depends on SOC_AM43XX || COMPILE_TEST
5 select VIDEOBUF2_DMA_CONTIG 5 select VIDEOBUF2_DMA_CONTIG
6 select V4L2_FWNODE
6 help 7 help
7 Support for AM437x Video Processing Front End based Video 8 Support for AM437x Video Processing Front End based Video
8 Capture Driver. 9 Capture Driver.
diff --git a/drivers/media/platform/am437x/am437x-vpfe.c b/drivers/media/platform/am437x/am437x-vpfe.c
index 05489a401c5c..466aba8b0e00 100644
--- a/drivers/media/platform/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/am437x/am437x-vpfe.c
@@ -26,6 +26,7 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/of_graph.h>
29#include <linux/pinctrl/consumer.h> 30#include <linux/pinctrl/consumer.h>
30#include <linux/platform_device.h> 31#include <linux/platform_device.h>
31#include <linux/pm_runtime.h> 32#include <linux/pm_runtime.h>
@@ -36,7 +37,7 @@
36#include <media/v4l2-common.h> 37#include <media/v4l2-common.h>
37#include <media/v4l2-ctrls.h> 38#include <media/v4l2-ctrls.h>
38#include <media/v4l2-event.h> 39#include <media/v4l2-event.h>
39#include <media/v4l2-of.h> 40#include <media/v4l2-fwnode.h>
40 41
41#include "am437x-vpfe.h" 42#include "am437x-vpfe.h"
42 43
@@ -2303,7 +2304,8 @@ vpfe_async_bound(struct v4l2_async_notifier *notifier,
2303 vpfe_dbg(1, vpfe, "vpfe_async_bound\n"); 2304 vpfe_dbg(1, vpfe, "vpfe_async_bound\n");
2304 2305
2305 for (i = 0; i < ARRAY_SIZE(vpfe->cfg->asd); i++) { 2306 for (i = 0; i < ARRAY_SIZE(vpfe->cfg->asd); i++) {
2306 if (vpfe->cfg->asd[i]->match.of.node == asd[i].match.of.node) { 2307 if (vpfe->cfg->asd[i]->match.fwnode.fwnode ==
2308 asd[i].match.fwnode.fwnode) {
2307 sdinfo = &vpfe->cfg->sub_devs[i]; 2309 sdinfo = &vpfe->cfg->sub_devs[i];
2308 vpfe->sd[i] = subdev; 2310 vpfe->sd[i] = subdev;
2309 vpfe->sd[i]->grp_id = sdinfo->grp_id; 2311 vpfe->sd[i]->grp_id = sdinfo->grp_id;
@@ -2419,7 +2421,7 @@ static struct vpfe_config *
2419vpfe_get_pdata(struct platform_device *pdev) 2421vpfe_get_pdata(struct platform_device *pdev)
2420{ 2422{
2421 struct device_node *endpoint = NULL; 2423 struct device_node *endpoint = NULL;
2422 struct v4l2_of_endpoint bus_cfg; 2424 struct v4l2_fwnode_endpoint bus_cfg;
2423 struct vpfe_subdev_info *sdinfo; 2425 struct vpfe_subdev_info *sdinfo;
2424 struct vpfe_config *pdata; 2426 struct vpfe_config *pdata;
2425 unsigned int flags; 2427 unsigned int flags;
@@ -2463,7 +2465,8 @@ vpfe_get_pdata(struct platform_device *pdev)
2463 sdinfo->vpfe_param.if_type = VPFE_RAW_BAYER; 2465 sdinfo->vpfe_param.if_type = VPFE_RAW_BAYER;
2464 } 2466 }
2465 2467
2466 err = v4l2_of_parse_endpoint(endpoint, &bus_cfg); 2468 err = v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint),
2469 &bus_cfg);
2467 if (err) { 2470 if (err) {
2468 dev_err(&pdev->dev, "Could not parse the endpoint\n"); 2471 dev_err(&pdev->dev, "Could not parse the endpoint\n");
2469 goto done; 2472 goto done;
@@ -2501,8 +2504,8 @@ vpfe_get_pdata(struct platform_device *pdev)
2501 goto done; 2504 goto done;
2502 } 2505 }
2503 2506
2504 pdata->asd[i]->match_type = V4L2_ASYNC_MATCH_OF; 2507 pdata->asd[i]->match_type = V4L2_ASYNC_MATCH_FWNODE;
2505 pdata->asd[i]->match.of.node = rem; 2508 pdata->asd[i]->match.fwnode.fwnode = of_fwnode_handle(rem);
2506 of_node_put(rem); 2509 of_node_put(rem);
2507 } 2510 }
2508 2511
diff --git a/drivers/media/platform/atmel/Kconfig b/drivers/media/platform/atmel/Kconfig
index 9bd0f19b127f..55de751e5f51 100644
--- a/drivers/media/platform/atmel/Kconfig
+++ b/drivers/media/platform/atmel/Kconfig
@@ -4,6 +4,7 @@ config VIDEO_ATMEL_ISC
4 depends on ARCH_AT91 || COMPILE_TEST 4 depends on ARCH_AT91 || COMPILE_TEST
5 select VIDEOBUF2_DMA_CONTIG 5 select VIDEOBUF2_DMA_CONTIG
6 select REGMAP_MMIO 6 select REGMAP_MMIO
7 select V4L2_FWNODE
7 help 8 help
8 This module makes the ATMEL Image Sensor Controller available 9 This module makes the ATMEL Image Sensor Controller available
9 as a v4l2 device. 10 as a v4l2 device.
@@ -13,6 +14,7 @@ config VIDEO_ATMEL_ISI
13 depends on VIDEO_V4L2 && OF && HAS_DMA 14 depends on VIDEO_V4L2 && OF && HAS_DMA
14 depends on ARCH_AT91 || COMPILE_TEST 15 depends on ARCH_AT91 || COMPILE_TEST
15 select VIDEOBUF2_DMA_CONTIG 16 select VIDEOBUF2_DMA_CONTIG
17 select V4L2_FWNODE
16 ---help--- 18 ---help---
17 This module makes the ATMEL Image Sensor Interface available 19 This module makes the ATMEL Image Sensor Interface available
18 as a v4l2 device. 20 as a v4l2 device.
diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c
index 78d966233f80..d6534252cdcd 100644
--- a/drivers/media/platform/atmel/atmel-isc.c
+++ b/drivers/media/platform/atmel/atmel-isc.c
@@ -32,6 +32,7 @@
32#include <linux/math64.h> 32#include <linux/math64.h>
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/of.h> 34#include <linux/of.h>
35#include <linux/of_graph.h>
35#include <linux/platform_device.h> 36#include <linux/platform_device.h>
36#include <linux/pm_runtime.h> 37#include <linux/pm_runtime.h>
37#include <linux/regmap.h> 38#include <linux/regmap.h>
@@ -42,7 +43,7 @@
42#include <media/v4l2-event.h> 43#include <media/v4l2-event.h>
43#include <media/v4l2-image-sizes.h> 44#include <media/v4l2-image-sizes.h>
44#include <media/v4l2-ioctl.h> 45#include <media/v4l2-ioctl.h>
45#include <media/v4l2-of.h> 46#include <media/v4l2-fwnode.h>
46#include <media/v4l2-subdev.h> 47#include <media/v4l2-subdev.h>
47#include <media/videobuf2-dma-contig.h> 48#include <media/videobuf2-dma-contig.h>
48 49
@@ -1685,7 +1686,7 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
1685{ 1686{
1686 struct device_node *np = dev->of_node; 1687 struct device_node *np = dev->of_node;
1687 struct device_node *epn = NULL, *rem; 1688 struct device_node *epn = NULL, *rem;
1688 struct v4l2_of_endpoint v4l2_epn; 1689 struct v4l2_fwnode_endpoint v4l2_epn;
1689 struct isc_subdev_entity *subdev_entity; 1690 struct isc_subdev_entity *subdev_entity;
1690 unsigned int flags; 1691 unsigned int flags;
1691 int ret; 1692 int ret;
@@ -1704,7 +1705,8 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
1704 continue; 1705 continue;
1705 } 1706 }
1706 1707
1707 ret = v4l2_of_parse_endpoint(epn, &v4l2_epn); 1708 ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
1709 &v4l2_epn);
1708 if (ret) { 1710 if (ret) {
1709 of_node_put(rem); 1711 of_node_put(rem);
1710 ret = -EINVAL; 1712 ret = -EINVAL;
@@ -1739,8 +1741,9 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
1739 if (flags & V4L2_MBUS_PCLK_SAMPLE_FALLING) 1741 if (flags & V4L2_MBUS_PCLK_SAMPLE_FALLING)
1740 subdev_entity->pfe_cfg0 |= ISC_PFE_CFG0_PPOL_LOW; 1742 subdev_entity->pfe_cfg0 |= ISC_PFE_CFG0_PPOL_LOW;
1741 1743
1742 subdev_entity->asd->match_type = V4L2_ASYNC_MATCH_OF; 1744 subdev_entity->asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
1743 subdev_entity->asd->match.of.node = rem; 1745 subdev_entity->asd->match.fwnode.fwnode =
1746 of_fwnode_handle(rem);
1744 list_add_tail(&subdev_entity->list, &isc->subdev_entities); 1747 list_add_tail(&subdev_entity->list, &isc->subdev_entities);
1745 } 1748 }
1746 1749
diff --git a/drivers/media/platform/atmel/atmel-isi.c b/drivers/media/platform/atmel/atmel-isi.c
index e4867f84514c..ef482cc704fe 100644
--- a/drivers/media/platform/atmel/atmel-isi.c
+++ b/drivers/media/platform/atmel/atmel-isi.c
@@ -19,6 +19,7 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/of_graph.h>
22#include <linux/platform_device.h> 23#include <linux/platform_device.h>
23#include <linux/pm_runtime.h> 24#include <linux/pm_runtime.h>
24#include <linux/slab.h> 25#include <linux/slab.h>
@@ -30,7 +31,7 @@
30#include <media/v4l2-dev.h> 31#include <media/v4l2-dev.h>
31#include <media/v4l2-ioctl.h> 32#include <media/v4l2-ioctl.h>
32#include <media/v4l2-event.h> 33#include <media/v4l2-event.h>
33#include <media/v4l2-of.h> 34#include <media/v4l2-fwnode.h>
34#include <media/videobuf2-dma-contig.h> 35#include <media/videobuf2-dma-contig.h>
35#include <media/v4l2-image-sizes.h> 36#include <media/v4l2-image-sizes.h>
36 37
@@ -801,7 +802,7 @@ static int atmel_isi_parse_dt(struct atmel_isi *isi,
801 struct platform_device *pdev) 802 struct platform_device *pdev)
802{ 803{
803 struct device_node *np = pdev->dev.of_node; 804 struct device_node *np = pdev->dev.of_node;
804 struct v4l2_of_endpoint ep; 805 struct v4l2_fwnode_endpoint ep;
805 int err; 806 int err;
806 807
807 /* Default settings for ISI */ 808 /* Default settings for ISI */
@@ -814,7 +815,7 @@ static int atmel_isi_parse_dt(struct atmel_isi *isi,
814 return -EINVAL; 815 return -EINVAL;
815 } 816 }
816 817
817 err = v4l2_of_parse_endpoint(np, &ep); 818 err = v4l2_fwnode_endpoint_parse(of_fwnode_handle(np), &ep);
818 of_node_put(np); 819 of_node_put(np);
819 if (err) { 820 if (err) {
820 dev_err(&pdev->dev, "Could not parse the endpoint\n"); 821 dev_err(&pdev->dev, "Could not parse the endpoint\n");
@@ -1126,8 +1127,8 @@ static int isi_graph_parse(struct atmel_isi *isi, struct device_node *node)
1126 1127
1127 /* Remote node to connect */ 1128 /* Remote node to connect */
1128 isi->entity.node = remote; 1129 isi->entity.node = remote;
1129 isi->entity.asd.match_type = V4L2_ASYNC_MATCH_OF; 1130 isi->entity.asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
1130 isi->entity.asd.match.of.node = remote; 1131 isi->entity.asd.match.fwnode.fwnode = of_fwnode_handle(remote);
1131 return 0; 1132 return 0;
1132 } 1133 }
1133} 1134}
diff --git a/drivers/media/platform/exynos4-is/Kconfig b/drivers/media/platform/exynos4-is/Kconfig
index 57d42c6172c5..c480efb755f5 100644
--- a/drivers/media/platform/exynos4-is/Kconfig
+++ b/drivers/media/platform/exynos4-is/Kconfig
@@ -4,6 +4,7 @@ config VIDEO_SAMSUNG_EXYNOS4_IS
4 depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API 4 depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
5 depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST 5 depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
6 depends on OF && COMMON_CLK 6 depends on OF && COMMON_CLK
7 select V4L2_FWNODE
7 help 8 help
8 Say Y here to enable camera host interface devices for 9 Say Y here to enable camera host interface devices for
9 Samsung S5P and EXYNOS SoC series. 10 Samsung S5P and EXYNOS SoC series.
@@ -32,6 +33,7 @@ config VIDEO_S5P_MIPI_CSIS
32 tristate "S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver" 33 tristate "S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver"
33 depends on REGULATOR 34 depends on REGULATOR
34 select GENERIC_PHY 35 select GENERIC_PHY
36 select V4L2_FWNODE
35 help 37 help
36 This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2 38 This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2
37 receiver (MIPI-CSIS) devices. 39 receiver (MIPI-CSIS) devices.
diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
index e82450e90a67..7d1cf78846c4 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -29,7 +29,7 @@
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <media/v4l2-async.h> 30#include <media/v4l2-async.h>
31#include <media/v4l2-ctrls.h> 31#include <media/v4l2-ctrls.h>
32#include <media/v4l2-of.h> 32#include <media/v4l2-fwnode.h>
33#include <media/media-device.h> 33#include <media/media-device.h>
34#include <media/drv-intf/exynos-fimc.h> 34#include <media/drv-intf/exynos-fimc.h>
35 35
@@ -388,7 +388,7 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
388{ 388{
389 struct fimc_source_info *pd = &fmd->sensor[index].pdata; 389 struct fimc_source_info *pd = &fmd->sensor[index].pdata;
390 struct device_node *rem, *ep, *np; 390 struct device_node *rem, *ep, *np;
391 struct v4l2_of_endpoint endpoint; 391 struct v4l2_fwnode_endpoint endpoint;
392 int ret; 392 int ret;
393 393
394 /* Assume here a port node can have only one endpoint node. */ 394 /* Assume here a port node can have only one endpoint node. */
@@ -396,7 +396,7 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
396 if (!ep) 396 if (!ep)
397 return 0; 397 return 0;
398 398
399 ret = v4l2_of_parse_endpoint(ep, &endpoint); 399 ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &endpoint);
400 if (ret) { 400 if (ret) {
401 of_node_put(ep); 401 of_node_put(ep);
402 return ret; 402 return ret;
@@ -453,8 +453,8 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
453 return -EINVAL; 453 return -EINVAL;
454 } 454 }
455 455
456 fmd->sensor[index].asd.match_type = V4L2_ASYNC_MATCH_OF; 456 fmd->sensor[index].asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
457 fmd->sensor[index].asd.match.of.node = rem; 457 fmd->sensor[index].asd.match.fwnode.fwnode = of_fwnode_handle(rem);
458 fmd->async_subdevs[index] = &fmd->sensor[index].asd; 458 fmd->async_subdevs[index] = &fmd->sensor[index].asd;
459 459
460 fmd->num_sensors++; 460 fmd->num_sensors++;
@@ -1361,7 +1361,8 @@ static int subdev_notifier_bound(struct v4l2_async_notifier *notifier,
1361 1361
1362 /* Find platform data for this sensor subdev */ 1362 /* Find platform data for this sensor subdev */
1363 for (i = 0; i < ARRAY_SIZE(fmd->sensor); i++) 1363 for (i = 0; i < ARRAY_SIZE(fmd->sensor); i++)
1364 if (fmd->sensor[i].asd.match.of.node == subdev->dev->of_node) 1364 if (fmd->sensor[i].asd.match.fwnode.fwnode ==
1365 of_fwnode_handle(subdev->dev->of_node))
1365 si = &fmd->sensor[i]; 1366 si = &fmd->sensor[i];
1366 1367
1367 if (si == NULL) 1368 if (si == NULL)
diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c b/drivers/media/platform/exynos4-is/mipi-csis.c
index f819b29efc38..98c89873c2dc 100644
--- a/drivers/media/platform/exynos4-is/mipi-csis.c
+++ b/drivers/media/platform/exynos4-is/mipi-csis.c
@@ -30,7 +30,7 @@
30#include <linux/spinlock.h> 30#include <linux/spinlock.h>
31#include <linux/videodev2.h> 31#include <linux/videodev2.h>
32#include <media/drv-intf/exynos-fimc.h> 32#include <media/drv-intf/exynos-fimc.h>
33#include <media/v4l2-of.h> 33#include <media/v4l2-fwnode.h>
34#include <media/v4l2-subdev.h> 34#include <media/v4l2-subdev.h>
35 35
36#include "mipi-csis.h" 36#include "mipi-csis.h"
@@ -718,7 +718,7 @@ static int s5pcsis_parse_dt(struct platform_device *pdev,
718 struct csis_state *state) 718 struct csis_state *state)
719{ 719{
720 struct device_node *node = pdev->dev.of_node; 720 struct device_node *node = pdev->dev.of_node;
721 struct v4l2_of_endpoint endpoint; 721 struct v4l2_fwnode_endpoint endpoint;
722 int ret; 722 int ret;
723 723
724 if (of_property_read_u32(node, "clock-frequency", 724 if (of_property_read_u32(node, "clock-frequency",
@@ -735,7 +735,7 @@ static int s5pcsis_parse_dt(struct platform_device *pdev,
735 return -EINVAL; 735 return -EINVAL;
736 } 736 }
737 /* Get port node and validate MIPI-CSI channel id. */ 737 /* Get port node and validate MIPI-CSI channel id. */
738 ret = v4l2_of_parse_endpoint(node, &endpoint); 738 ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(node), &endpoint);
739 if (ret) 739 if (ret)
740 goto err; 740 goto err;
741 741
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index 0d984a28a003..9df64c189883 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -55,6 +55,7 @@
55#include <linux/module.h> 55#include <linux/module.h>
56#include <linux/omap-iommu.h> 56#include <linux/omap-iommu.h>
57#include <linux/platform_device.h> 57#include <linux/platform_device.h>
58#include <linux/property.h>
58#include <linux/regulator/consumer.h> 59#include <linux/regulator/consumer.h>
59#include <linux/slab.h> 60#include <linux/slab.h>
60#include <linux/sched.h> 61#include <linux/sched.h>
@@ -63,9 +64,9 @@
63#include <asm/dma-iommu.h> 64#include <asm/dma-iommu.h>
64 65
65#include <media/v4l2-common.h> 66#include <media/v4l2-common.h>
67#include <media/v4l2-fwnode.h>
66#include <media/v4l2-device.h> 68#include <media/v4l2-device.h>
67#include <media/v4l2-mc.h> 69#include <media/v4l2-mc.h>
68#include <media/v4l2-of.h>
69 70
70#include "isp.h" 71#include "isp.h"
71#include "ispreg.h" 72#include "ispreg.h"
@@ -2007,20 +2008,20 @@ enum isp_of_phy {
2007 ISP_OF_PHY_CSIPHY2, 2008 ISP_OF_PHY_CSIPHY2,
2008}; 2009};
2009 2010
2010static int isp_of_parse_node(struct device *dev, struct device_node *node, 2011static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode,
2011 struct isp_async_subdev *isd) 2012 struct isp_async_subdev *isd)
2012{ 2013{
2013 struct isp_bus_cfg *buscfg = &isd->bus; 2014 struct isp_bus_cfg *buscfg = &isd->bus;
2014 struct v4l2_of_endpoint vep; 2015 struct v4l2_fwnode_endpoint vep;
2015 unsigned int i; 2016 unsigned int i;
2016 int ret; 2017 int ret;
2017 2018
2018 ret = v4l2_of_parse_endpoint(node, &vep); 2019 ret = v4l2_fwnode_endpoint_parse(fwnode, &vep);
2019 if (ret) 2020 if (ret)
2020 return ret; 2021 return ret;
2021 2022
2022 dev_dbg(dev, "parsing endpoint %s, interface %u\n", node->full_name, 2023 dev_dbg(dev, "parsing endpoint %s, interface %u\n",
2023 vep.base.port); 2024 to_of_node(fwnode)->full_name, vep.base.port);
2024 2025
2025 switch (vep.base.port) { 2026 switch (vep.base.port) {
2026 case ISP_OF_PHY_PARALLEL: 2027 case ISP_OF_PHY_PARALLEL:
@@ -2077,18 +2078,18 @@ static int isp_of_parse_node(struct device *dev, struct device_node *node,
2077 break; 2078 break;
2078 2079
2079 default: 2080 default:
2080 dev_warn(dev, "%s: invalid interface %u\n", node->full_name, 2081 dev_warn(dev, "%s: invalid interface %u\n",
2081 vep.base.port); 2082 to_of_node(fwnode)->full_name, vep.base.port);
2082 break; 2083 break;
2083 } 2084 }
2084 2085
2085 return 0; 2086 return 0;
2086} 2087}
2087 2088
2088static int isp_of_parse_nodes(struct device *dev, 2089static int isp_fwnodes_parse(struct device *dev,
2089 struct v4l2_async_notifier *notifier) 2090 struct v4l2_async_notifier *notifier)
2090{ 2091{
2091 struct device_node *node = NULL; 2092 struct fwnode_handle *fwnode = NULL;
2092 2093
2093 notifier->subdevs = devm_kcalloc( 2094 notifier->subdevs = devm_kcalloc(
2094 dev, ISP_MAX_SUBDEVS, sizeof(*notifier->subdevs), GFP_KERNEL); 2095 dev, ISP_MAX_SUBDEVS, sizeof(*notifier->subdevs), GFP_KERNEL);
@@ -2096,7 +2097,8 @@ static int isp_of_parse_nodes(struct device *dev,
2096 return -ENOMEM; 2097 return -ENOMEM;
2097 2098
2098 while (notifier->num_subdevs < ISP_MAX_SUBDEVS && 2099 while (notifier->num_subdevs < ISP_MAX_SUBDEVS &&
2099 (node = of_graph_get_next_endpoint(dev->of_node, node))) { 2100 (fwnode = fwnode_graph_get_next_endpoint(
2101 of_fwnode_handle(dev->of_node), fwnode))) {
2100 struct isp_async_subdev *isd; 2102 struct isp_async_subdev *isd;
2101 2103
2102 isd = devm_kzalloc(dev, sizeof(*isd), GFP_KERNEL); 2104 isd = devm_kzalloc(dev, sizeof(*isd), GFP_KERNEL);
@@ -2105,23 +2107,24 @@ static int isp_of_parse_nodes(struct device *dev,
2105 2107
2106 notifier->subdevs[notifier->num_subdevs] = &isd->asd; 2108 notifier->subdevs[notifier->num_subdevs] = &isd->asd;
2107 2109
2108 if (isp_of_parse_node(dev, node, isd)) 2110 if (isp_fwnode_parse(dev, fwnode, isd))
2109 goto error; 2111 goto error;
2110 2112
2111 isd->asd.match.of.node = of_graph_get_remote_port_parent(node); 2113 isd->asd.match.fwnode.fwnode =
2112 if (!isd->asd.match.of.node) { 2114 fwnode_graph_get_remote_port_parent(fwnode);
2115 if (!isd->asd.match.fwnode.fwnode) {
2113 dev_warn(dev, "bad remote port parent\n"); 2116 dev_warn(dev, "bad remote port parent\n");
2114 goto error; 2117 goto error;
2115 } 2118 }
2116 2119
2117 isd->asd.match_type = V4L2_ASYNC_MATCH_OF; 2120 isd->asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
2118 notifier->num_subdevs++; 2121 notifier->num_subdevs++;
2119 } 2122 }
2120 2123
2121 return notifier->num_subdevs; 2124 return notifier->num_subdevs;
2122 2125
2123error: 2126error:
2124 of_node_put(node); 2127 fwnode_handle_put(fwnode);
2125 return -EINVAL; 2128 return -EINVAL;
2126} 2129}
2127 2130
@@ -2192,8 +2195,8 @@ static int isp_probe(struct platform_device *pdev)
2192 return -ENOMEM; 2195 return -ENOMEM;
2193 } 2196 }
2194 2197
2195 ret = of_property_read_u32(pdev->dev.of_node, "ti,phy-type", 2198 ret = fwnode_property_read_u32(of_fwnode_handle(pdev->dev.of_node),
2196 &isp->phy_type); 2199 "ti,phy-type", &isp->phy_type);
2197 if (ret) 2200 if (ret)
2198 return ret; 2201 return ret;
2199 2202
@@ -2202,12 +2205,12 @@ static int isp_probe(struct platform_device *pdev)
2202 if (IS_ERR(isp->syscon)) 2205 if (IS_ERR(isp->syscon))
2203 return PTR_ERR(isp->syscon); 2206 return PTR_ERR(isp->syscon);
2204 2207
2205 ret = of_property_read_u32_index(pdev->dev.of_node, "syscon", 1, 2208 ret = of_property_read_u32_index(pdev->dev.of_node,
2206 &isp->syscon_offset); 2209 "syscon", 1, &isp->syscon_offset);
2207 if (ret) 2210 if (ret)
2208 return ret; 2211 return ret;
2209 2212
2210 ret = isp_of_parse_nodes(&pdev->dev, &isp->notifier); 2213 ret = isp_fwnodes_parse(&pdev->dev, &isp->notifier);
2211 if (ret < 0) 2214 if (ret < 0)
2212 return ret; 2215 return ret;
2213 2216
diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c
index 25e538bf0df7..399095170b6e 100644
--- a/drivers/media/platform/pxa_camera.c
+++ b/drivers/media/platform/pxa_camera.c
@@ -25,6 +25,7 @@
25#include <linux/mm.h> 25#include <linux/mm.h>
26#include <linux/moduleparam.h> 26#include <linux/moduleparam.h>
27#include <linux/of.h> 27#include <linux/of.h>
28#include <linux/of_graph.h>
28#include <linux/time.h> 29#include <linux/time.h>
29#include <linux/platform_device.h> 30#include <linux/platform_device.h>
30#include <linux/clk.h> 31#include <linux/clk.h>
@@ -41,7 +42,7 @@
41#include <media/v4l2-device.h> 42#include <media/v4l2-device.h>
42#include <media/v4l2-event.h> 43#include <media/v4l2-event.h>
43#include <media/v4l2-ioctl.h> 44#include <media/v4l2-ioctl.h>
44#include <media/v4l2-of.h> 45#include <media/v4l2-fwnode.h>
45 46
46#include <media/videobuf2-dma-sg.h> 47#include <media/videobuf2-dma-sg.h>
47 48
@@ -2270,7 +2271,7 @@ static int pxa_camera_pdata_from_dt(struct device *dev,
2270{ 2271{
2271 u32 mclk_rate; 2272 u32 mclk_rate;
2272 struct device_node *remote, *np = dev->of_node; 2273 struct device_node *remote, *np = dev->of_node;
2273 struct v4l2_of_endpoint ep; 2274 struct v4l2_fwnode_endpoint ep;
2274 int err = of_property_read_u32(np, "clock-frequency", 2275 int err = of_property_read_u32(np, "clock-frequency",
2275 &mclk_rate); 2276 &mclk_rate);
2276 if (!err) { 2277 if (!err) {
@@ -2284,7 +2285,7 @@ static int pxa_camera_pdata_from_dt(struct device *dev,
2284 return -EINVAL; 2285 return -EINVAL;
2285 } 2286 }
2286 2287
2287 err = v4l2_of_parse_endpoint(np, &ep); 2288 err = v4l2_fwnode_endpoint_parse(of_fwnode_handle(np), &ep);
2288 if (err) { 2289 if (err) {
2289 dev_err(dev, "could not parse endpoint\n"); 2290 dev_err(dev, "could not parse endpoint\n");
2290 goto out; 2291 goto out;
@@ -2321,10 +2322,10 @@ static int pxa_camera_pdata_from_dt(struct device *dev,
2321 if (ep.bus.parallel.flags & V4L2_MBUS_PCLK_SAMPLE_FALLING) 2322 if (ep.bus.parallel.flags & V4L2_MBUS_PCLK_SAMPLE_FALLING)
2322 pcdev->platform_flags |= PXA_CAMERA_PCLK_EN; 2323 pcdev->platform_flags |= PXA_CAMERA_PCLK_EN;
2323 2324
2324 asd->match_type = V4L2_ASYNC_MATCH_OF; 2325 asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
2325 remote = of_graph_get_remote_port(np); 2326 remote = of_graph_get_remote_port(np);
2326 if (remote) { 2327 if (remote) {
2327 asd->match.of.node = remote; 2328 asd->match.fwnode.fwnode = of_fwnode_handle(remote);
2328 of_node_put(remote); 2329 of_node_put(remote);
2329 } else { 2330 } else {
2330 dev_notice(dev, "no remote for %s\n", of_node_full_name(np)); 2331 dev_notice(dev, "no remote for %s\n", of_node_full_name(np));
diff --git a/drivers/media/platform/rcar-vin/Kconfig b/drivers/media/platform/rcar-vin/Kconfig
index 111d2a151f6a..af4c98b44d2e 100644
--- a/drivers/media/platform/rcar-vin/Kconfig
+++ b/drivers/media/platform/rcar-vin/Kconfig
@@ -3,6 +3,7 @@ config VIDEO_RCAR_VIN
3 depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && OF && HAS_DMA && MEDIA_CONTROLLER 3 depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && OF && HAS_DMA && MEDIA_CONTROLLER
4 depends on ARCH_RENESAS || COMPILE_TEST 4 depends on ARCH_RENESAS || COMPILE_TEST
5 select VIDEOBUF2_DMA_CONTIG 5 select VIDEOBUF2_DMA_CONTIG
6 select V4L2_FWNODE
6 ---help--- 7 ---help---
7 Support for Renesas R-Car Video Input (VIN) driver. 8 Support for Renesas R-Car Video Input (VIN) driver.
8 Supports R-Car Gen2 SoCs. 9 Supports R-Car Gen2 SoCs.
diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c
index 098a0b1cc10a..264604a9bcf8 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -21,7 +21,7 @@
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/pm_runtime.h> 22#include <linux/pm_runtime.h>
23 23
24#include <media/v4l2-of.h> 24#include <media/v4l2-fwnode.h>
25 25
26#include "rcar-vin.h" 26#include "rcar-vin.h"
27 27
@@ -104,7 +104,8 @@ static int rvin_digital_notify_bound(struct v4l2_async_notifier *notifier,
104 104
105 v4l2_set_subdev_hostdata(subdev, vin); 105 v4l2_set_subdev_hostdata(subdev, vin);
106 106
107 if (vin->digital.asd.match.of.node == subdev->dev->of_node) { 107 if (vin->digital.asd.match.fwnode.fwnode ==
108 of_fwnode_handle(subdev->dev->of_node)) {
108 vin_dbg(vin, "bound digital subdev %s\n", subdev->name); 109 vin_dbg(vin, "bound digital subdev %s\n", subdev->name);
109 vin->digital.subdev = subdev; 110 vin->digital.subdev = subdev;
110 return 0; 111 return 0;
@@ -118,10 +119,10 @@ static int rvin_digitial_parse_v4l2(struct rvin_dev *vin,
118 struct device_node *ep, 119 struct device_node *ep,
119 struct v4l2_mbus_config *mbus_cfg) 120 struct v4l2_mbus_config *mbus_cfg)
120{ 121{
121 struct v4l2_of_endpoint v4l2_ep; 122 struct v4l2_fwnode_endpoint v4l2_ep;
122 int ret; 123 int ret;
123 124
124 ret = v4l2_of_parse_endpoint(ep, &v4l2_ep); 125 ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &v4l2_ep);
125 if (ret) { 126 if (ret) {
126 vin_err(vin, "Could not parse v4l2 endpoint\n"); 127 vin_err(vin, "Could not parse v4l2 endpoint\n");
127 return -EINVAL; 128 return -EINVAL;
@@ -151,7 +152,7 @@ static int rvin_digital_graph_parse(struct rvin_dev *vin)
151 struct device_node *ep, *np; 152 struct device_node *ep, *np;
152 int ret; 153 int ret;
153 154
154 vin->digital.asd.match.of.node = NULL; 155 vin->digital.asd.match.fwnode.fwnode = NULL;
155 vin->digital.subdev = NULL; 156 vin->digital.subdev = NULL;
156 157
157 /* 158 /*
@@ -175,8 +176,8 @@ static int rvin_digital_graph_parse(struct rvin_dev *vin)
175 if (ret) 176 if (ret)
176 return ret; 177 return ret;
177 178
178 vin->digital.asd.match.of.node = np; 179 vin->digital.asd.match.fwnode.fwnode = of_fwnode_handle(np);
179 vin->digital.asd.match_type = V4L2_ASYNC_MATCH_OF; 180 vin->digital.asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
180 181
181 return 0; 182 return 0;
182} 183}
@@ -190,7 +191,7 @@ static int rvin_digital_graph_init(struct rvin_dev *vin)
190 if (ret) 191 if (ret)
191 return ret; 192 return ret;
192 193
193 if (!vin->digital.asd.match.of.node) { 194 if (!vin->digital.asd.match.fwnode.fwnode) {
194 vin_dbg(vin, "No digital subdevice found\n"); 195 vin_dbg(vin, "No digital subdevice found\n");
195 return -ENODEV; 196 return -ENODEV;
196 } 197 }
@@ -203,7 +204,7 @@ static int rvin_digital_graph_init(struct rvin_dev *vin)
203 subdevs[0] = &vin->digital.asd; 204 subdevs[0] = &vin->digital.asd;
204 205
205 vin_dbg(vin, "Found digital subdevice %s\n", 206 vin_dbg(vin, "Found digital subdevice %s\n",
206 of_node_full_name(subdevs[0]->match.of.node)); 207 of_node_full_name(to_of_node(subdevs[0]->match.fwnode.fwnode)));
207 208
208 vin->notifier.num_subdevs = 1; 209 vin->notifier.num_subdevs = 1;
209 vin->notifier.subdevs = subdevs; 210 vin->notifier.subdevs = subdevs;
diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c
index 3c9421f4d8e3..45a0429d75bb 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -23,6 +23,7 @@
23#include <linux/list.h> 23#include <linux/list.h>
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/of_graph.h>
26#include <linux/platform_device.h> 27#include <linux/platform_device.h>
27#include <linux/pm_runtime.h> 28#include <linux/pm_runtime.h>
28#include <linux/regulator/consumer.h> 29#include <linux/regulator/consumer.h>
@@ -36,7 +37,7 @@
36#include <media/v4l2-common.h> 37#include <media/v4l2-common.h>
37#include <media/v4l2-ioctl.h> 38#include <media/v4l2-ioctl.h>
38#include <media/v4l2-dev.h> 39#include <media/v4l2-dev.h>
39#include <media/v4l2-of.h> 40#include <media/v4l2-fwnode.h>
40#include <media/videobuf2-v4l2.h> 41#include <media/videobuf2-v4l2.h>
41 42
42/* Default to VGA resolution */ 43/* Default to VGA resolution */
@@ -1512,8 +1513,8 @@ static int soc_of_bind(struct soc_camera_host *ici,
1512 if (!info) 1513 if (!info)
1513 return -ENOMEM; 1514 return -ENOMEM;
1514 1515
1515 info->sasd.asd.match.of.node = remote; 1516 info->sasd.asd.match.fwnode.fwnode = of_fwnode_handle(remote);
1516 info->sasd.asd.match_type = V4L2_ASYNC_MATCH_OF; 1517 info->sasd.asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
1517 info->subdev = &info->sasd.asd; 1518 info->subdev = &info->sasd.asd;
1518 1519
1519 /* Or shall this be managed by the soc-camera device? */ 1520 /* Or shall this be managed by the soc-camera device? */
diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
index 348f025d5270..83d32a5d0f40 100644
--- a/drivers/media/platform/stm32/stm32-dcmi.c
+++ b/drivers/media/platform/stm32/stm32-dcmi.c
@@ -21,6 +21,7 @@
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/of.h> 22#include <linux/of.h>
23#include <linux/of_device.h> 23#include <linux/of_device.h>
24#include <linux/of_graph.h>
24#include <linux/platform_device.h> 25#include <linux/platform_device.h>
25#include <linux/reset.h> 26#include <linux/reset.h>
26#include <linux/videodev2.h> 27#include <linux/videodev2.h>
@@ -29,9 +30,9 @@
29#include <media/v4l2-dev.h> 30#include <media/v4l2-dev.h>
30#include <media/v4l2-device.h> 31#include <media/v4l2-device.h>
31#include <media/v4l2-event.h> 32#include <media/v4l2-event.h>
33#include <media/v4l2-fwnode.h>
32#include <media/v4l2-image-sizes.h> 34#include <media/v4l2-image-sizes.h>
33#include <media/v4l2-ioctl.h> 35#include <media/v4l2-ioctl.h>
34#include <media/v4l2-of.h>
35#include <media/videobuf2-dma-contig.h> 36#include <media/videobuf2-dma-contig.h>
36 37
37#define DRV_NAME "stm32-dcmi" 38#define DRV_NAME "stm32-dcmi"
@@ -139,7 +140,7 @@ struct stm32_dcmi {
139 struct mutex lock; 140 struct mutex lock;
140 struct vb2_queue queue; 141 struct vb2_queue queue;
141 142
142 struct v4l2_of_bus_parallel bus; 143 struct v4l2_fwnode_bus_parallel bus;
143 struct completion complete; 144 struct completion complete;
144 struct clk *mclk; 145 struct clk *mclk;
145 enum state state; 146 enum state state;
@@ -1143,8 +1144,8 @@ static int dcmi_graph_parse(struct stm32_dcmi *dcmi, struct device_node *node)
1143 1144
1144 /* Remote node to connect */ 1145 /* Remote node to connect */
1145 dcmi->entity.node = remote; 1146 dcmi->entity.node = remote;
1146 dcmi->entity.asd.match_type = V4L2_ASYNC_MATCH_OF; 1147 dcmi->entity.asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
1147 dcmi->entity.asd.match.of.node = remote; 1148 dcmi->entity.asd.match.fwnode.fwnode = of_fwnode_handle(remote);
1148 return 0; 1149 return 0;
1149 } 1150 }
1150} 1151}
@@ -1190,7 +1191,7 @@ static int dcmi_probe(struct platform_device *pdev)
1190{ 1191{
1191 struct device_node *np = pdev->dev.of_node; 1192 struct device_node *np = pdev->dev.of_node;
1192 const struct of_device_id *match = NULL; 1193 const struct of_device_id *match = NULL;
1193 struct v4l2_of_endpoint ep; 1194 struct v4l2_fwnode_endpoint ep;
1194 struct stm32_dcmi *dcmi; 1195 struct stm32_dcmi *dcmi;
1195 struct vb2_queue *q; 1196 struct vb2_queue *q;
1196 struct dma_chan *chan; 1197 struct dma_chan *chan;
@@ -1222,7 +1223,7 @@ static int dcmi_probe(struct platform_device *pdev)
1222 return -ENODEV; 1223 return -ENODEV;
1223 } 1224 }
1224 1225
1225 ret = v4l2_of_parse_endpoint(np, &ep); 1226 ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(np), &ep);
1226 if (ret) { 1227 if (ret) {
1227 dev_err(&pdev->dev, "Could not parse the endpoint\n"); 1228 dev_err(&pdev->dev, "Could not parse the endpoint\n");
1228 of_node_put(np); 1229 of_node_put(np);
diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c
index 7a058b6e03d0..177faa36bc16 100644
--- a/drivers/media/platform/ti-vpe/cal.c
+++ b/drivers/media/platform/ti-vpe/cal.c
@@ -21,7 +21,7 @@
21#include <linux/of_device.h> 21#include <linux/of_device.h>
22#include <linux/of_graph.h> 22#include <linux/of_graph.h>
23 23
24#include <media/v4l2-of.h> 24#include <media/v4l2-fwnode.h>
25#include <media/v4l2-async.h> 25#include <media/v4l2-async.h>
26#include <media/v4l2-common.h> 26#include <media/v4l2-common.h>
27#include <media/v4l2-ctrls.h> 27#include <media/v4l2-ctrls.h>
@@ -270,7 +270,7 @@ struct cal_ctx {
270 struct video_device vdev; 270 struct video_device vdev;
271 struct v4l2_async_notifier notifier; 271 struct v4l2_async_notifier notifier;
272 struct v4l2_subdev *sensor; 272 struct v4l2_subdev *sensor;
273 struct v4l2_of_endpoint endpoint; 273 struct v4l2_fwnode_endpoint endpoint;
274 274
275 struct v4l2_async_subdev asd; 275 struct v4l2_async_subdev asd;
276 struct v4l2_async_subdev *asd_list[1]; 276 struct v4l2_async_subdev *asd_list[1];
@@ -608,7 +608,8 @@ static void csi2_lane_config(struct cal_ctx *ctx)
608 u32 val = reg_read(ctx->dev, CAL_CSI2_COMPLEXIO_CFG(ctx->csi2_port)); 608 u32 val = reg_read(ctx->dev, CAL_CSI2_COMPLEXIO_CFG(ctx->csi2_port));
609 u32 lane_mask = CAL_CSI2_COMPLEXIO_CFG_CLOCK_POSITION_MASK; 609 u32 lane_mask = CAL_CSI2_COMPLEXIO_CFG_CLOCK_POSITION_MASK;
610 u32 polarity_mask = CAL_CSI2_COMPLEXIO_CFG_CLOCK_POL_MASK; 610 u32 polarity_mask = CAL_CSI2_COMPLEXIO_CFG_CLOCK_POL_MASK;
611 struct v4l2_of_bus_mipi_csi2 *mipi_csi2 = &ctx->endpoint.bus.mipi_csi2; 611 struct v4l2_fwnode_bus_mipi_csi2 *mipi_csi2 =
612 &ctx->endpoint.bus.mipi_csi2;
612 int lane; 613 int lane;
613 614
614 set_field(&val, mipi_csi2->clock_lane + 1, lane_mask); 615 set_field(&val, mipi_csi2->clock_lane + 1, lane_mask);
@@ -1643,7 +1644,7 @@ static int of_cal_create_instance(struct cal_ctx *ctx, int inst)
1643 struct platform_device *pdev = ctx->dev->pdev; 1644 struct platform_device *pdev = ctx->dev->pdev;
1644 struct device_node *ep_node, *port, *remote_ep, 1645 struct device_node *ep_node, *port, *remote_ep,
1645 *sensor_node, *parent; 1646 *sensor_node, *parent;
1646 struct v4l2_of_endpoint *endpoint; 1647 struct v4l2_fwnode_endpoint *endpoint;
1647 struct v4l2_async_subdev *asd; 1648 struct v4l2_async_subdev *asd;
1648 u32 regval = 0; 1649 u32 regval = 0;
1649 int ret, index, found_port = 0, lane; 1650 int ret, index, found_port = 0, lane;
@@ -1698,15 +1699,15 @@ static int of_cal_create_instance(struct cal_ctx *ctx, int inst)
1698 ctx_dbg(3, ctx, "can't get remote parent\n"); 1699 ctx_dbg(3, ctx, "can't get remote parent\n");
1699 goto cleanup_exit; 1700 goto cleanup_exit;
1700 } 1701 }
1701 asd->match_type = V4L2_ASYNC_MATCH_OF; 1702 asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
1702 asd->match.of.node = sensor_node; 1703 asd->match.fwnode.fwnode = of_fwnode_handle(sensor_node);
1703 1704
1704 remote_ep = of_parse_phandle(ep_node, "remote-endpoint", 0); 1705 remote_ep = of_parse_phandle(ep_node, "remote-endpoint", 0);
1705 if (!remote_ep) { 1706 if (!remote_ep) {
1706 ctx_dbg(3, ctx, "can't get remote-endpoint\n"); 1707 ctx_dbg(3, ctx, "can't get remote-endpoint\n");
1707 goto cleanup_exit; 1708 goto cleanup_exit;
1708 } 1709 }
1709 v4l2_of_parse_endpoint(remote_ep, endpoint); 1710 v4l2_fwnode_endpoint_parse(of_fwnode_handle(remote_ep), endpoint);
1710 1711
1711 if (endpoint->bus_type != V4L2_MBUS_CSI2) { 1712 if (endpoint->bus_type != V4L2_MBUS_CSI2) {
1712 ctx_err(ctx, "Port:%d sub-device %s is not a CSI2 device\n", 1713 ctx_err(ctx, "Port:%d sub-device %s is not a CSI2 device\n",
diff --git a/drivers/media/platform/xilinx/Kconfig b/drivers/media/platform/xilinx/Kconfig
index 84bae795b70d..a5d21b7c6e0b 100644
--- a/drivers/media/platform/xilinx/Kconfig
+++ b/drivers/media/platform/xilinx/Kconfig
@@ -2,6 +2,7 @@ config VIDEO_XILINX
2 tristate "Xilinx Video IP (EXPERIMENTAL)" 2 tristate "Xilinx Video IP (EXPERIMENTAL)"
3 depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && OF && HAS_DMA 3 depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && OF && HAS_DMA
4 select VIDEOBUF2_DMA_CONTIG 4 select VIDEOBUF2_DMA_CONTIG
5 select V4L2_FWNODE
5 ---help--- 6 ---help---
6 Driver for Xilinx Video IP Pipelines 7 Driver for Xilinx Video IP Pipelines
7 8
diff --git a/drivers/media/platform/xilinx/xilinx-vipp.c b/drivers/media/platform/xilinx/xilinx-vipp.c
index feb3b2f1d874..ac4704388920 100644
--- a/drivers/media/platform/xilinx/xilinx-vipp.c
+++ b/drivers/media/platform/xilinx/xilinx-vipp.c
@@ -22,7 +22,7 @@
22#include <media/v4l2-async.h> 22#include <media/v4l2-async.h>
23#include <media/v4l2-common.h> 23#include <media/v4l2-common.h>
24#include <media/v4l2-device.h> 24#include <media/v4l2-device.h>
25#include <media/v4l2-of.h> 25#include <media/v4l2-fwnode.h>
26 26
27#include "xilinx-dma.h" 27#include "xilinx-dma.h"
28#include "xilinx-vipp.h" 28#include "xilinx-vipp.h"
@@ -74,7 +74,7 @@ static int xvip_graph_build_one(struct xvip_composite_device *xdev,
74 struct media_pad *local_pad; 74 struct media_pad *local_pad;
75 struct media_pad *remote_pad; 75 struct media_pad *remote_pad;
76 struct xvip_graph_entity *ent; 76 struct xvip_graph_entity *ent;
77 struct v4l2_of_link link; 77 struct v4l2_fwnode_link link;
78 struct device_node *ep = NULL; 78 struct device_node *ep = NULL;
79 struct device_node *next; 79 struct device_node *next;
80 int ret = 0; 80 int ret = 0;
@@ -92,7 +92,7 @@ static int xvip_graph_build_one(struct xvip_composite_device *xdev,
92 92
93 dev_dbg(xdev->dev, "processing endpoint %s\n", ep->full_name); 93 dev_dbg(xdev->dev, "processing endpoint %s\n", ep->full_name);
94 94
95 ret = v4l2_of_parse_link(ep, &link); 95 ret = v4l2_fwnode_parse_link(of_fwnode_handle(ep), &link);
96 if (ret < 0) { 96 if (ret < 0) {
97 dev_err(xdev->dev, "failed to parse link for %s\n", 97 dev_err(xdev->dev, "failed to parse link for %s\n",
98 ep->full_name); 98 ep->full_name);
@@ -103,9 +103,10 @@ static int xvip_graph_build_one(struct xvip_composite_device *xdev,
103 * the link. 103 * the link.
104 */ 104 */
105 if (link.local_port >= local->num_pads) { 105 if (link.local_port >= local->num_pads) {
106 dev_err(xdev->dev, "invalid port number %u on %s\n", 106 dev_err(xdev->dev, "invalid port number %u for %s\n",
107 link.local_port, link.local_node->full_name); 107 link.local_port,
108 v4l2_of_put_link(&link); 108 to_of_node(link.local_node)->full_name);
109 v4l2_fwnode_put_link(&link);
109 ret = -EINVAL; 110 ret = -EINVAL;
110 break; 111 break;
111 } 112 }
@@ -114,25 +115,28 @@ static int xvip_graph_build_one(struct xvip_composite_device *xdev,
114 115
115 if (local_pad->flags & MEDIA_PAD_FL_SINK) { 116 if (local_pad->flags & MEDIA_PAD_FL_SINK) {
116 dev_dbg(xdev->dev, "skipping sink port %s:%u\n", 117 dev_dbg(xdev->dev, "skipping sink port %s:%u\n",
117 link.local_node->full_name, link.local_port); 118 to_of_node(link.local_node)->full_name,
118 v4l2_of_put_link(&link); 119 link.local_port);
120 v4l2_fwnode_put_link(&link);
119 continue; 121 continue;
120 } 122 }
121 123
122 /* Skip DMA engines, they will be processed separately. */ 124 /* Skip DMA engines, they will be processed separately. */
123 if (link.remote_node == xdev->dev->of_node) { 125 if (link.remote_node == of_fwnode_handle(xdev->dev->of_node)) {
124 dev_dbg(xdev->dev, "skipping DMA port %s:%u\n", 126 dev_dbg(xdev->dev, "skipping DMA port %s:%u\n",
125 link.local_node->full_name, link.local_port); 127 to_of_node(link.local_node)->full_name,
126 v4l2_of_put_link(&link); 128 link.local_port);
129 v4l2_fwnode_put_link(&link);
127 continue; 130 continue;
128 } 131 }
129 132
130 /* Find the remote entity. */ 133 /* Find the remote entity. */
131 ent = xvip_graph_find_entity(xdev, link.remote_node); 134 ent = xvip_graph_find_entity(xdev,
135 to_of_node(link.remote_node));
132 if (ent == NULL) { 136 if (ent == NULL) {
133 dev_err(xdev->dev, "no entity found for %s\n", 137 dev_err(xdev->dev, "no entity found for %s\n",
134 link.remote_node->full_name); 138 to_of_node(link.remote_node)->full_name);
135 v4l2_of_put_link(&link); 139 v4l2_fwnode_put_link(&link);
136 ret = -ENODEV; 140 ret = -ENODEV;
137 break; 141 break;
138 } 142 }
@@ -141,15 +145,16 @@ static int xvip_graph_build_one(struct xvip_composite_device *xdev,
141 145
142 if (link.remote_port >= remote->num_pads) { 146 if (link.remote_port >= remote->num_pads) {
143 dev_err(xdev->dev, "invalid port number %u on %s\n", 147 dev_err(xdev->dev, "invalid port number %u on %s\n",
144 link.remote_port, link.remote_node->full_name); 148 link.remote_port,
145 v4l2_of_put_link(&link); 149 to_of_node(link.remote_node)->full_name);
150 v4l2_fwnode_put_link(&link);
146 ret = -EINVAL; 151 ret = -EINVAL;
147 break; 152 break;
148 } 153 }
149 154
150 remote_pad = &remote->pads[link.remote_port]; 155 remote_pad = &remote->pads[link.remote_port];
151 156
152 v4l2_of_put_link(&link); 157 v4l2_fwnode_put_link(&link);
153 158
154 /* Create the media link. */ 159 /* Create the media link. */
155 dev_dbg(xdev->dev, "creating %s:%u -> %s:%u link\n", 160 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)
194 struct media_pad *source_pad; 199 struct media_pad *source_pad;
195 struct media_pad *sink_pad; 200 struct media_pad *sink_pad;
196 struct xvip_graph_entity *ent; 201 struct xvip_graph_entity *ent;
197 struct v4l2_of_link link; 202 struct v4l2_fwnode_link link;
198 struct device_node *ep = NULL; 203 struct device_node *ep = NULL;
199 struct device_node *next; 204 struct device_node *next;
200 struct xvip_dma *dma; 205 struct xvip_dma *dma;
@@ -213,7 +218,7 @@ static int xvip_graph_build_dma(struct xvip_composite_device *xdev)
213 218
214 dev_dbg(xdev->dev, "processing endpoint %s\n", ep->full_name); 219 dev_dbg(xdev->dev, "processing endpoint %s\n", ep->full_name);
215 220
216 ret = v4l2_of_parse_link(ep, &link); 221 ret = v4l2_fwnode_parse_link(of_fwnode_handle(ep), &link);
217 if (ret < 0) { 222 if (ret < 0) {
218 dev_err(xdev->dev, "failed to parse link for %s\n", 223 dev_err(xdev->dev, "failed to parse link for %s\n",
219 ep->full_name); 224 ep->full_name);
@@ -225,7 +230,7 @@ static int xvip_graph_build_dma(struct xvip_composite_device *xdev)
225 if (dma == NULL) { 230 if (dma == NULL) {
226 dev_err(xdev->dev, "no DMA engine found for port %u\n", 231 dev_err(xdev->dev, "no DMA engine found for port %u\n",
227 link.local_port); 232 link.local_port);
228 v4l2_of_put_link(&link); 233 v4l2_fwnode_put_link(&link);
229 ret = -EINVAL; 234 ret = -EINVAL;
230 break; 235 break;
231 } 236 }
@@ -234,19 +239,21 @@ static int xvip_graph_build_dma(struct xvip_composite_device *xdev)
234 dma->video.name); 239 dma->video.name);
235 240
236 /* Find the remote entity. */ 241 /* Find the remote entity. */
237 ent = xvip_graph_find_entity(xdev, link.remote_node); 242 ent = xvip_graph_find_entity(xdev,
243 to_of_node(link.remote_node));
238 if (ent == NULL) { 244 if (ent == NULL) {
239 dev_err(xdev->dev, "no entity found for %s\n", 245 dev_err(xdev->dev, "no entity found for %s\n",
240 link.remote_node->full_name); 246 to_of_node(link.remote_node)->full_name);
241 v4l2_of_put_link(&link); 247 v4l2_fwnode_put_link(&link);
242 ret = -ENODEV; 248 ret = -ENODEV;
243 break; 249 break;
244 } 250 }
245 251
246 if (link.remote_port >= ent->entity->num_pads) { 252 if (link.remote_port >= ent->entity->num_pads) {
247 dev_err(xdev->dev, "invalid port number %u on %s\n", 253 dev_err(xdev->dev, "invalid port number %u on %s\n",
248 link.remote_port, link.remote_node->full_name); 254 link.remote_port,
249 v4l2_of_put_link(&link); 255 to_of_node(link.remote_node)->full_name);
256 v4l2_fwnode_put_link(&link);
250 ret = -EINVAL; 257 ret = -EINVAL;
251 break; 258 break;
252 } 259 }
@@ -263,7 +270,7 @@ static int xvip_graph_build_dma(struct xvip_composite_device *xdev)
263 sink_pad = &dma->pad; 270 sink_pad = &dma->pad;
264 } 271 }
265 272
266 v4l2_of_put_link(&link); 273 v4l2_fwnode_put_link(&link);
267 274
268 /* Create the media link. */ 275 /* Create the media link. */
269 dev_dbg(xdev->dev, "creating %s:%u -> %s:%u link\n", 276 dev_dbg(xdev->dev, "creating %s:%u -> %s:%u link\n",
@@ -383,8 +390,8 @@ static int xvip_graph_parse_one(struct xvip_composite_device *xdev,
383 } 390 }
384 391
385 entity->node = remote; 392 entity->node = remote;
386 entity->asd.match_type = V4L2_ASYNC_MATCH_OF; 393 entity->asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
387 entity->asd.match.of.node = remote; 394 entity->asd.match.fwnode.fwnode = of_fwnode_handle(remote);
388 list_add_tail(&entity->list, &xdev->entities); 395 list_add_tail(&entity->list, &xdev->entities);
389 xdev->num_subdevs++; 396 xdev->num_subdevs++;
390 } 397 }
diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index ff32f95d94f0..cbd919d4edd2 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -41,12 +41,6 @@ static bool match_devname(struct v4l2_subdev *sd,
41 return !strcmp(asd->match.device_name.name, dev_name(sd->dev)); 41 return !strcmp(asd->match.device_name.name, dev_name(sd->dev));
42} 42}
43 43
44static bool match_of(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
45{
46 return !of_node_cmp(of_node_full_name(sd->of_node),
47 of_node_full_name(asd->match.of.node));
48}
49
50static bool match_fwnode(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd) 44static bool match_fwnode(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
51{ 45{
52 if (!is_of_node(sd->fwnode) || !is_of_node(asd->match.fwnode.fwnode)) 46 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 *
88 case V4L2_ASYNC_MATCH_I2C: 82 case V4L2_ASYNC_MATCH_I2C:
89 match = match_i2c; 83 match = match_i2c;
90 break; 84 break;
91 case V4L2_ASYNC_MATCH_OF:
92 match = match_of;
93 break;
94 case V4L2_ASYNC_MATCH_FWNODE: 85 case V4L2_ASYNC_MATCH_FWNODE:
95 match = match_fwnode; 86 match = match_fwnode;
96 break; 87 break;
@@ -171,7 +162,6 @@ int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,
171 case V4L2_ASYNC_MATCH_CUSTOM: 162 case V4L2_ASYNC_MATCH_CUSTOM:
172 case V4L2_ASYNC_MATCH_DEVNAME: 163 case V4L2_ASYNC_MATCH_DEVNAME:
173 case V4L2_ASYNC_MATCH_I2C: 164 case V4L2_ASYNC_MATCH_I2C:
174 case V4L2_ASYNC_MATCH_OF:
175 case V4L2_ASYNC_MATCH_FWNODE: 165 case V4L2_ASYNC_MATCH_FWNODE:
176 break; 166 break;
177 default: 167 default:
@@ -295,8 +285,8 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd)
295 * (struct v4l2_subdev.dev), and async sub-device does not 285 * (struct v4l2_subdev.dev), and async sub-device does not
296 * exist independently of the device at any point of time. 286 * exist independently of the device at any point of time.
297 */ 287 */
298 if (!sd->of_node && sd->dev) 288 if (!sd->fwnode && sd->dev)
299 sd->of_node = sd->dev->of_node; 289 sd->fwnode = dev_fwnode(sd->dev);
300 290
301 mutex_lock(&list_lock); 291 mutex_lock(&list_lock);
302 292
diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
index c3695fa2c903..c69d8c8a66d0 100644
--- a/include/media/v4l2-async.h
+++ b/include/media/v4l2-async.h
@@ -31,7 +31,6 @@ struct v4l2_async_notifier;
31 * v4l2_async_subdev.match ops 31 * v4l2_async_subdev.match ops
32 * @V4L2_ASYNC_MATCH_DEVNAME: Match will use the device name 32 * @V4L2_ASYNC_MATCH_DEVNAME: Match will use the device name
33 * @V4L2_ASYNC_MATCH_I2C: Match will check for I2C adapter ID and address 33 * @V4L2_ASYNC_MATCH_I2C: Match will check for I2C adapter ID and address
34 * @V4L2_ASYNC_MATCH_OF: Match will use OF node
35 * @V4L2_ASYNC_MATCH_FWNODE: Match will use firmware node 34 * @V4L2_ASYNC_MATCH_FWNODE: Match will use firmware node
36 * 35 *
37 * This enum is used by the asyncrhronous sub-device logic to define the 36 * This enum is used by the asyncrhronous sub-device logic to define the
@@ -41,7 +40,6 @@ enum v4l2_async_match_type {
41 V4L2_ASYNC_MATCH_CUSTOM, 40 V4L2_ASYNC_MATCH_CUSTOM,
42 V4L2_ASYNC_MATCH_DEVNAME, 41 V4L2_ASYNC_MATCH_DEVNAME,
43 V4L2_ASYNC_MATCH_I2C, 42 V4L2_ASYNC_MATCH_I2C,
44 V4L2_ASYNC_MATCH_OF,
45 V4L2_ASYNC_MATCH_FWNODE, 43 V4L2_ASYNC_MATCH_FWNODE,
46}; 44};
47 45
@@ -57,9 +55,6 @@ struct v4l2_async_subdev {
57 enum v4l2_async_match_type match_type; 55 enum v4l2_async_match_type match_type;
58 union { 56 union {
59 struct { 57 struct {
60 const struct device_node *node;
61 } of;
62 struct {
63 struct fwnode_handle *fwnode; 58 struct fwnode_handle *fwnode;
64 } fwnode; 59 } fwnode;
65 struct { 60 struct {
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 5f1669c45642..a40760174797 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -787,7 +787,6 @@ struct v4l2_subdev_platform_data {
787 * is attached. 787 * is attached.
788 * @devnode: subdev device node 788 * @devnode: subdev device node
789 * @dev: pointer to the physical device, if any 789 * @dev: pointer to the physical device, if any
790 * @of_node: The device_node of the subdev, usually the same as dev->of_node.
791 * @fwnode: The fwnode_handle of the subdev, usually the same as 790 * @fwnode: The fwnode_handle of the subdev, usually the same as
792 * either dev->of_node->fwnode or dev->fwnode (whichever is non-NULL). 791 * either dev->of_node->fwnode or dev->fwnode (whichever is non-NULL).
793 * @async_list: Links this subdev to a global subdev_list or @notifier->done 792 * @async_list: Links this subdev to a global subdev_list or @notifier->done
@@ -820,7 +819,6 @@ struct v4l2_subdev {
820 void *host_priv; 819 void *host_priv;
821 struct video_device *devnode; 820 struct video_device *devnode;
822 struct device *dev; 821 struct device *dev;
823 struct device_node *of_node;
824 struct fwnode_handle *fwnode; 822 struct fwnode_handle *fwnode;
825 struct list_head async_list; 823 struct list_head async_list;
826 struct v4l2_async_subdev *asd; 824 struct v4l2_async_subdev *asd;