Skip to content

V4L2 fwnode rework; support for default configuration

Sakari Ailus dri-devel linux-devicetree linux-media 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest23 patches 8 repliesIn review
  2. v223 patches 7 repliesSuperseded
  3. v121 patches 7 repliesSuperseded

Changes in v3 from the cover letter

- Rename V4L2_MBUS_CSI2 to V4L2_MBUS_CSI2_DPHY also in drivers/gpu/ipu-v3/ipu-csi.c.

- Use 0 instead of V4L2_MBUS_UNKNOWN in v4l2_async_notifier_fwnode_parse_endpoint(). This is partially due to V4L2_MBUS_UNKNOWN being introduced after the change is done.

- Initialise bus_type to zero in quite a few V4L2 fwnode endpoints in drivers/staging/media/imx/imx-media-csi.c (thanks to Steve for the changes).

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/23v4l: fwnode: Add debug prints for V4L2 endpoint property parsingdrivers/media/v4l2-core/v4l2-fwnode.c+85 -230 replies
2/23v4l: fwnode: Use fwnode_graph_for_each_endpointdrivers/media/v4l2-core/v4l2-fwnode.c+1 -20 replies
3/23v4l: fwnode: The CSI-2 clock is continuous if it's not non-continuousdrivers/media/v4l2-core/v4l2-fwnode.c+1 -10 replies
4/23dt-bindings: media: Specify bus type for MIPI D-PHY, others, explicitlyDocumentation/devicetree/bindings/media/video-interfaces.txt+3 -10 replies
5/23v4l: fwnode: Add definitions for CSI-2 D-PHY, parallel and Bt.656 bussesdrivers/media/v4l2-core/v4l2-fwnode.c+3 -00 replies
6/23v4l: mediabus: Recognise CSI-2 D-PHY and C-PHYdrivers/gpu/ipu-v3/ipu-csi.c drivers/media/i2c/adv7180.c drivers/media/i2c/ov5640.c +24 more+37 -350 replies
7/23v4l: fwnode: Let the caller provide V4L2 fwnode endpointdrivers/media/i2c/ov2659.c drivers/media/i2c/smiapp/smiapp-core.c drivers/media/i2c/tc358743.c +2 more+60 -650 replies
8/23v4l: fwnode: Detect bus type correctlydrivers/media/v4l2-core/v4l2-fwnode.c include/media/v4l2-mediabus.h+19 -140 replies
9/23v4l: fwnode: Make use of newly specified bus typesdrivers/media/v4l2-core/v4l2-fwnode.c+43 -101 reply
9/23v4l: fwnode: Make use of newly specified bus typesdrivers/media/v4l2-core/v4l2-fwnode.c+38 -100 replies
10/23v4l: fwnode: Read lane inversion information despite lane numberingdrivers/media/v4l2-core/v4l2-fwnode.c+35 -300 replies
11/23v4l: fwnode: Only assign configuration if there is no errordrivers/media/v4l2-core/v4l2-fwnode.c+18 -120 replies
12/23v4l: fwnode: Support driver-defined lane mapping defaultsdrivers/media/v4l2-core/v4l2-fwnode.c+12 -80 replies
13/23v4l: fwnode: Support default CSI-2 lane mapping for driversdrivers/media/v4l2-core/v4l2-fwnode.c+46 -140 replies
14/23v4l: fwnode: Parse the graph endpoint as lastdrivers/media/v4l2-core/v4l2-fwnode.c+7 -10 replies
15/23v4l: fwnode: Use default parallel flagsdrivers/media/v4l2-core/v4l2-fwnode.c+19 -01 reply
16/23v4l: fwnode: Initialise the V4L2 fwnode endpoints to zerodrivers/media/i2c/adv7604.c drivers/media/i2c/mt9v032.c drivers/media/i2c/ov5647.c +21 more+30 -264 replies
17/23v4l: fwnode: Only zero the struct if bus type is set to V4L2_MBUS_UNKNOWNdrivers/media/v4l2-core/v4l2-fwnode.c+6 -40 replies
18/23v4l: fwnode: Use media bus type for bus parser selectiondrivers/media/v4l2-core/v4l2-fwnode.c+80 -200 replies
19/23v4l: fwnode: Print bus typedrivers/media/v4l2-core/v4l2-fwnode.c+38 -00 replies
20/23v4l: fwnode: Use V4L2 fwnode endpoint media bus type if setdrivers/media/v4l2-core/v4l2-fwnode.c+19 -80 replies
21/23v4l: fwnode: Support parsing of CSI-2 C-PHY endpointsdrivers/media/v4l2-core/v4l2-fwnode.c+7 -30 replies
22/23v4l: fwnode: Update V4L2 fwnode endpoint parsing documentationinclude/media/v4l2-fwnode.h+37 -190 replies
23/23smiapp: Query the V4L2 endpoint for a specific bus typedrivers/media/i2c/smiapp/smiapp-core.c+6 -00 replies

Reviews trailers per patch

6 of 24 patches have a Reviewed-by or Acked-by.

PatchNiklas SöderlundSteve LongerbeamRob HerringJacopo Mondi
SeriesT-b
1/23R-b T-b
2/23R-b T-b
3/23T-b
4/23R-b
5/23T-b
6/23T-b
7/23T-b
8/23T-b
9/23T-b T-b R-b R-b
9/23T-b T-b R-b R-b
10/23T-b
11/23T-b
12/23T-b
13/23T-b
14/23T-b
15/23T-b R-b
16/23T-b
17/23T-b
18/23T-b
19/23T-b
20/23T-b
21/23T-b
22/23T-b
23/23T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v3 thread

Cover letter [PATCH v3 00/23] V4L2 fwnode rework; support for default configuration

Hello everyone,

I've long thought the V4L2 fwnode framework requires some work (it's buggy and it does not adequately serve common needs). This set should address in particular these matters:

- Most devices support a particular media bus type but the V4L2 fwnode framework was not able to use such information, but instead tried to guess the bus type with varying levels of success while drivers generally ignored the results. This patchset makes that possible --- setting a bus type enables parsing configuration for only that bus. Failing that check results in returning -ENXIO to be returned.

- Support specifying default configuration. If the endpoint has no configuration, the defaults set by the driver (as documented in DT bindings) will prevail. Any available configuration will still be read from the endpoint as one could expect. A common use case for this is e.g. the number of CSI-2 lanes. Few devices support lane mapping, and default 1:1 mapping is provided in absence of a valid default or configuration read OF.

- Debugging information is greatly improved.

- Recognition of the differences between CSI-2 D-PHY and C-PHY. All currently supported hardware (or at least drivers) is D-PHY only, so this change is still easy.

The smiapp driver is converted to use the new functionality. This patchset does not address remaining issues such as supporting setting defaults for e.g. bridge drivers with multiple ports, but with Steve Longerbeam's patchset we're much closer to that goal. I've rebased this set on top of Steve's. Albeit the two deal with the same files, there were only a few trivial conflicts.

Note that I've only tested parsing endpoints for the CSI-2 bus (no parallel IF hardware). Jacopo has tested an earlier version of the set with a few changes to the parallel bus handling compared to this one.

Comments are welcome.

I've pushed the patches (including Steve's) here:

<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=v4l2-fwnode-next>

since v1:

- Rebase it all on current media tree master --- there was a conflict in drivers/media/platform/qcom/camss/camss.c in Steve's patch "media:
platform: Switch to v4l2_async_notifier_add_subdev"; I hope the resolution was fine.

- Default to Bt.656 bus in guessing the bus type if no properties suggesting otherwise are set. In v1 and error was returned, which would have been troublesome for the existing drivers.

- Set the bus_type field to zero (i.e. guess) for existing callers of v4l2_fwnode_endpoint_(alloc_)parse.

- Improved documentation for v4l2_fwnode_endpoint_parse and v4l2_fwnode_endpoint_alloc_parse.

since v2:

- Rename V4L2_MBUS_CSI2 to V4L2_MBUS_CSI2_DPHY also in drivers/gpu/ipu-v3/ipu-csi.c.

- Use 0 instead of V4L2_MBUS_UNKNOWN in v4l2_async_notifier_fwnode_parse_endpoint(). This is partially due to V4L2_MBUS_UNKNOWN being introduced after the change is done.

- Initialise bus_type to zero in quite a few V4L2 fwnode endpoints in drivers/staging/media/imx/imx-media-csi.c (thanks to Steve for the changes).

Sakari Ailus (23):
v4l: fwnode: Add debug prints for V4L2 endpoint property parsing
v4l: fwnode: Use fwnode_graph_for_each_endpoint
v4l: fwnode: The CSI-2 clock is continuous if it's not non-continuous
dt-bindings: media: Specify bus type for MIPI D-PHY, others,
explicitly
v4l: fwnode: Add definitions for CSI-2 D-PHY, parallel and Bt.656
busses
v4l: mediabus: Recognise CSI-2 D-PHY and C-PHY
v4l: fwnode: Let the caller provide V4L2 fwnode endpoint
v4l: fwnode: Detect bus type correctly
v4l: fwnode: Make use of newly specified bus types
v4l: fwnode: Read lane inversion information despite lane numbering
v4l: fwnode: Only assign configuration if there is no error
v4l: fwnode: Support driver-defined lane mapping defaults
v4l: fwnode: Support default CSI-2 lane mapping for drivers
v4l: fwnode: Parse the graph endpoint as last
v4l: fwnode: Use default parallel flags
v4l: fwnode: Initialise the V4L2 fwnode endpoints to zero
v4l: fwnode: Only zero the struct if bus type is set to
V4L2_MBUS_UNKNOWN
v4l: fwnode: Use media bus type for bus parser selection
v4l: fwnode: Print bus type
v4l: fwnode: Use V4L2 fwnode endpoint media bus type if set
v4l: fwnode: Support parsing of CSI-2 C-PHY endpoints
v4l: fwnode: Update V4L2 fwnode endpoint parsing documentation
smiapp: Query the V4L2 endpoint for a specific bus type

 .../devicetree/bindings/media/video-interfaces.txt |   4 +-
 drivers/gpu/ipu-v3/ipu-csi.c                       |   6 +-
 drivers/media/i2c/adv7180.c                        |   2 +-
 drivers/media/i2c/adv7604.c                        |   2 +-
 drivers/media/i2c/mt9v032.c                        |   2 +-
 drivers/media/i2c/ov2659.c                         |  14 +-
 drivers/media/i2c/ov5640.c                         |   4 +-
 drivers/media/i2c/ov5645.c                         |   2 +-
 drivers/media/i2c/ov5647.c                         |   2 +-
 drivers/media/i2c/ov7251.c                         |   4 +-
 drivers/media/i2c/ov7670.c                         |   2 +-
 drivers/media/i2c/s5c73m3/s5c73m3-core.c           |   4 +-
 drivers/media/i2c/s5k5baf.c                        |   6 +-
 drivers/media/i2c/s5k6aa.c                         |   2 +-
 drivers/media/i2c/smiapp/smiapp-core.c             |  34 +-
 drivers/media/i2c/soc_camera/ov5642.c              |   2 +-
 drivers/media/i2c/tc358743.c                       |  28 +-
 drivers/media/i2c/tda1997x.c                       |   2 +-
 drivers/media/i2c/tvp514x.c                        |   2 +-
 drivers/media/i2c/tvp5150.c                        |   2 +-
 drivers/media/i2c/tvp7002.c                        |   2 +-
 drivers/media/pci/intel/ipu3/ipu3-cio2.c           |   2 +-
 drivers/media/platform/am437x/am437x-vpfe.c        |   2 +-
 drivers/media/platform/atmel/atmel-isc.c           |   3 +-
 drivers/media/platform/atmel/atmel-isi.c           |   2 +-
 drivers/media/platform/cadence/cdns-csi2rx.c       |   4 +-
 drivers/media/platform/cadence/cdns-csi2tx.c       |   4 +-
 drivers/media/platform/davinci/vpif_capture.c      |   2 +-
 drivers/media/platform/exynos4-is/media-dev.c      |   2 +-
 drivers/media/platform/exynos4-is/mipi-csis.c      |   2 +-
 drivers/media/platform/marvell-ccic/mcam-core.c    |   4 +-
 drivers/media/platform/marvell-ccic/mmp-driver.c   |   2 +-
 drivers/media/platform/omap3isp/isp.c              |   2 +-
 drivers/media/platform/pxa_camera.c                |   4 +-
 drivers/media/platform/rcar-vin/rcar-csi2.c        |   4 +-
 drivers/media/platform/renesas-ceu.c               |   3 +-
 drivers/media/platform/soc_camera/soc_mediabus.c   |   2 +-
 drivers/media/platform/stm32/stm32-dcmi.c          |   4 +-
 drivers/media/platform/ti-vpe/cal.c                |   2 +-
 drivers/media/v4l2-core/v4l2-fwnode.c              | 508 ++++++++++++++++-----
 drivers/staging/media/imx/imx-media-csi.c          |  10 +-
 drivers/staging/media/imx/imx6-mipi-csi2.c         |   2 +-
 drivers/staging/media/imx074/imx074.c              |   2 +-
 include/media/v4l2-fwnode.h                        |  60 ++-
 include/media/v4l2-mediabus.h                      |   8 +-
 45 files changed, 542 insertions(+), 226 deletions(-)
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel