Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Sakari Ailus and committed by
Mauro Carvalho Chehab
859969b3 048ea05b

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