1. 10 Aug, 2023 19 commits
    • Arnd BergmannArnd Bergmann's avatar
      media: ipu3-cio2: allow ipu_bridge to be a module again · 2545a2c0
      Arnd BergmannArnd Bergmann authored
      This code was previously part of the VIDEO_IPU3_CIO2 driver, which could
      be built-in or a loadable module, but after the move it turned into a
      builtin-only driver. This fails to link when the I2C subsystem is a
      module:
      
      x86_64-linux-ld: drivers/media/pci/intel/ipu-bridge.o: in function `ipu_bridge_unregister_sensors':
      ipu-bridge.c:(.text+0x50): undefined reference to `i2c_unregister_device'
      x86_64-linux-ld: drivers/media/pci/intel/ipu-bridge.o: in function `ipu_bridge_init':
      ipu-bridge.c:(.text+0x9c9): undefined reference to `i2c_acpi_new_device_by_fwnode'
      
      In general, drivers should not have to be built-in, so change the option
      to a tristate with the corresponding dependency. This in turn opens a
      new problem with the dependency, as the IPU bridge can be a loadable module
      while the ipu3 driver itself is built-in, producing a new link failure:
      
      86_64-linux-ld: drivers/media/pci/intel/ipu3/ipu3-cio2.o: in function `cio2_pci_probe':
      ipu3-cio2.c:(.text+0x197e): undefined reference to `ipu_bridge_init'
      
      In order to fix this, restore the old Kconfig option that controlled
      the ipu bridge driver before it was split out, but make it select a
      hidden symbol that now corresponds to the bridge driver.
      
      When other drivers get added that share ipu-bridge, this should cover
      all corner cases, and allow any combination of them to be built-in
      or modular.
      
      Link: https://lore.kernel.org/linux-media/20230727122331.2421453-1-arnd@kernel.org
      
      Fixes: 881ca259 ("media: ipu3-cio2: rename cio2 bridge to ipu bridge and move out of ipu3")'
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      2545a2c0
    • Hans Verkuil's avatar
      media: cec-pin: only enable interrupts when monitoring the CEC pin · 2f4d3718
      Hans Verkuil authored
      The CEC interrupt is only needed if userspace wants to monitor
      the CEC pin for an unconfigured CEC device. That gives it the
      most precise CEC pin debugging results.
      
      This avoids a corner case where the interrupt is enabled for
      a short period when the adapter is about to be configured.
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      2f4d3718
    • Hans Verkuil's avatar
      media: cec-gpio: drop the cec_gpio_free callback · bbe9cfc7
      Hans Verkuil authored
      Since the CEC pin framework now keeps track of the interrupt
      and calls disable_irq when the kthread stops, there is no
      longer any need for the cec-gpio driver to do this in the
      free callback. So drop this code.
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      bbe9cfc7
    • Hans Verkuil's avatar
      media: cec-pin: improve interrupt handling · 9b79d776
      Hans Verkuil authored
      The CEC pin framework needs a bit more control over the interrupt
      handling: make sure that the disable_irq op is called even if the
      device node is unregistered, log the state of the interrupt in
      debugfs, and disable the interrupt when the kernel thread is stopped.
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      9b79d776
    • Hans Verkuil's avatar
      media: cec-gpio: specify IRQF_NO_AUTOEN when requesting irq · 3b7dab49
      Hans Verkuil authored
      Use IRQF_NO_AUTOEN rather than manually disabling the requested
      interrupt.
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      3b7dab49
    • Hans Verkuil's avatar
      media: Documentation: media: cec: describe new callbacks · f807d06c
      Hans Verkuil authored
      Describe the new callbacks and clarify when the adap->lock
      mutex is held or not.
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      f807d06c
    • Hans Verkuil's avatar
      media: cec: core: add adap_unconfigured() callback · 948a77aa
      Hans Verkuil authored
      The adap_configured() callback was called with the adap->lock mutex
      held if the 'configured' argument was false, and without the adap->lock
      mutex held if that argument was true.
      
      That was very confusing, and so split this up in a adap_unconfigured()
      callback and a high-level configured() callback.
      
      This also makes it easier to understand when the mutex is held: all
      low-level adap_* callbacks are called with the mutex held. All other
      callbacks are called without that mutex held.
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Fixes: f1b57164 ("media: cec: add optional adap_configured callback")
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      948a77aa
    • Hans Verkuil's avatar
      media: cec: core: add adap_nb_transmit_canceled() callback · da53c36d
      Hans Verkuil authored
      A potential deadlock was found by Zheng Zhang with a local syzkaller
      instance.
      
      The problem is that when a non-blocking CEC transmit is canceled by calling
      cec_data_cancel, that in turn can call the high-level received() driver
      callback, which can call cec_transmit_msg() to transmit a new message.
      
      The cec_data_cancel() function is called with the adap->lock mutex held,
      and cec_transmit_msg() tries to take that same lock.
      
      The root cause is that the received() callback can either be used to pass
      on a received message (and then adap->lock is not held), or to report a
      canceled transmit (and then adap->lock is held).
      
      This is confusing, so create a new low-level adap_nb_transmit_canceled
      callback that reports back that a non-blocking transmit was canceled.
      
      And the received() callback is only called when a message is received,
      as was the case before commit f9d0ecbf ("media: cec: correctly pass
      on reply results") complicated matters.
      Reported-by: default avatarZheng Zhang <zheng.zhang@email.ucr.edu>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Fixes: f9d0ecbf ("media: cec: correctly pass on reply results")
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      da53c36d
    • Sakari Ailus's avatar
      media: Documentation: v4l: Document sub-device notifiers · 99939bea
      Sakari Ailus authored
      Document that sub-device notifiers are now registered using
      v4l2_async_subdev_nf_init(). No documentation is changed as it seems that
      sub-device notifiers were not documented apart from kernel-doc comments.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      99939bea
    • Sakari Ailus's avatar
      media: v4l: async: Set v4l2_device and subdev in async notifier init · b8ec754a
      Sakari Ailus authored
      Set the v4l2_device already in async notifier init, so struct device
      related to it will be available before the notifier is registered. This
      requires separating notifier initialisation into two functions, one that
      takes v4l2_device as its argument, v4l2_async_nf_init and
      v4l2_async_subdev_nf_init, for sub-device notifiers. Registering the
      notifier will use a single function, v4l2_async_nf_register.
      
      This is done in order to make struct device available earlier, during
      construction of the async connections, for sensible debug prints.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      b8ec754a
    • Sakari Ailus's avatar
      media: qcom: Initialise V4L2 async notifier later · 5651bab6
      Sakari Ailus authored
      Initialise V4L2 async notifier and parse DT for async sub-devices later,
      just before registering the notifier. This way the device can be made
      available to the V4L2 async framework from the notifier init time onwards.
      A subsequent patch will add struct v4l2_device as an argument to
      v4l2_async_nf_init().
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      5651bab6
    • Sakari Ailus's avatar
      media: davinci: Init async notifier after registering V4L2 device · 2c62a9b8
      Sakari Ailus authored
      Initialise the V4L2 async notifier after registering the V4L2 device, just
      before parsing DT for async sub-devices. This way the device can be made
      available to the V4L2 async framework from the notifier init time onwards.
      A subsequent patch will add struct v4l2_device as an argument to
      v4l2_async_nf_init().
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      2c62a9b8
    • Sakari Ailus's avatar
      media: xilinx-vipp: Init async notifier after registering V4L2 device · 7f81d6f0
      Sakari Ailus authored
      Initialise the V4L2 async notifier after registering the V4L2 device, just
      before parsing DT for async sub-devices. This way the device can be made
      available to the V4L2 async framework from the notifier init time onwards.
      A subsequent patch will add struct v4l2_device as an argument to
      v4l2_async_nf_init().
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      7f81d6f0
    • Sakari Ailus's avatar
      media: omap3isp: Initialise V4L2 async notifier later · f6336d89
      Sakari Ailus authored
      Initialise V4L2 async notifier and parse DT for async sub-devices later,
      just before registering the notifier. This way the device can be made
      available to the V4L2 async framework from the notifier init time onwards.
      A subsequent patch will add struct v4l2_device as an argument to
      v4l2_async_nf_init().
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      f6336d89
    • Sakari Ailus's avatar
      media: am437x-vpfe: Register V4L2 device early · 4c50b0a8
      Sakari Ailus authored
      Register V4L2 device before the async notifier.This way the device can be
      made available to the V4L2 async framework from the notifier init time
      onwards. A subsequent patch will add struct v4l2_device as an argument to
      v4l2_async_nf_init().
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      4c50b0a8
    • Sakari Ailus's avatar
      media: marvell: cafe: Register V4L2 device earlier · 4af65141
      Sakari Ailus authored
      Register V4L2 device before the async notifier. This way the device can be
      made available to the V4L2 async framework from the notifier init time
      onwards. A subsequent patch will add struct v4l2_device as an argument to
      v4l2_async_nf_init().
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      4af65141
    • Sakari Ailus's avatar
      media: pxa_camera: Register V4L2 device early · 5073d10c
      Sakari Ailus authored
      Register V4L2 device before initialising the notifier. This way the device
      can be made available to the V4L2 async framework from the notifier init
      time onwards. A subsequent patch will add struct v4l2_device as an
      argument to v4l2_async_nf_init().
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      5073d10c
    • Sakari Ailus's avatar
      media: pxa_camera: Fix probe error handling · 6e1e132e
      Sakari Ailus authored
      Fix and simplify error handling in pxa_camera probe, by moving devm_*()
      functions early in the probe function and then tearing down what was set
      up on error patch.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      6e1e132e
    • Sakari Ailus's avatar
      media: adv748x: Return to endpoint matching · 1e345458
      Sakari Ailus authored
      Return the two CSI-2 transmitters of adv748x to endpoint matching. This
      should make the driver work again as expected.
      
      Fixes: 1029939b ("media: v4l: async: Simplify async sub-device fwnode matching")
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      1e345458
  2. 28 Jul, 2023 21 commits
    • Sakari Ailus's avatar
      media: v4l: async: Support fwnode endpoint list matching for subdevs · e74f7a96
      Sakari Ailus authored
      Support matching V4L2 async sub-devices based on particular fwnode
      endpoint. This makes it possible to instantiate multiple V4L2 sub-devices
      based on given fwnode endpoints from a single device, based on driver
      needs.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      e74f7a96
    • Sakari Ailus's avatar
      media: v4l: async: Try more connections · 765f6056
      Sakari Ailus authored
      When an async sub-device is registered, it used to be that the first one
      of its connections were matched when found. Continue looking for matches
      until a notifier no longer has any.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      765f6056
    • Sakari Ailus's avatar
      media: v4l: async: Drop unneeded list entry initialisation · cb8c9f31
      Sakari Ailus authored
      The list entry is initialised as a head in v4l2_async_register_subdev()
      just before being added to the list. This isn't needed, drop the
      initialisation.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      cb8c9f31
    • Sakari Ailus's avatar
      media: v4l: async: Allow multiple connections between entities · 28a12957
      Sakari Ailus authored
      When the v4l2-async framework was introduced, the use case for it was to
      connect a camera sensor with a parallel receiver. Both tended to be rather
      simple devices with a single connection between them.
      
      The framework has been since improved in multiple ways but there are
      limitations that have remained, for instance the assumption an async
      sub-device is connected towards a single notifier and via a single link
      only.
      
      This patch enables connecting a sub-device to one or more notifiers
      simultaneously, with one or more connections per notifier. The notifier
      information is moved from the sub-device to the connection and the
      connections in sub-device are no longer a pointer but a linked list.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      28a12957
    • Sakari Ailus's avatar
      media: v4l: async: Obtain async connection based on sub-device · c91fd7b7
      Sakari Ailus authored
      Add v4l2_async_connection_unique() function for obtaining a struct
      v4l2_async_connection, typically allocated by drivers together with their
      own information on an external sub-device.
      
      The relation between connections and sub-devices still remains 1:1 but
      this code becomes more complex when the relation soon changes.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      c91fd7b7
    • Sakari Ailus's avatar
      media: v4l: async: Rework internal lists · 9bf19fbf
      Sakari Ailus authored
      This patch re-arranges internal V4L2 async lists for preparation of
      supporting multiple connections per sub-device as well as cleaning up used
      lists.
      
      The list of unbound V4L2 sub-devices shall be maintained for the purpose of
      listing those sub-devices only, not for their bindin status. Also, the V4L2
      async connections now have, instead of two list entries, a single list
      entry in the notifier's list, be that either waiting or done lists, while
      the notifier's asc_list is removed.
      
      The one-to-one relation between a sub-device and a connection is still
      maintained in this patch.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      9bf19fbf
    • Sakari Ailus's avatar
      media: v4l: async: Drop duplicate handling when adding connections · 393cfcc0
      Sakari Ailus authored
      The connections are checked for duplicates already when the notifier is
      registered. This is effectively a sanity check for driver (and possibly
      obscure firmware) bugs. Don't do this when adding the connection.
      
      Retain the int return type for now. It'll be needed very soon again.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      393cfcc0
    • Sakari Ailus's avatar
      media: v4l: async: Clean up error handling in v4l2_async_match_notify · ed59bbe1
      Sakari Ailus authored
      Add labels for error handling instead of doing it all in individual cases.
      Prepare for more functionality in this function.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      ed59bbe1
    • Sakari Ailus's avatar
      media: v4l: async: Rename v4l2_async_subdev as v4l2_async_connection · adb2dcd5
      Sakari Ailus authored
      Rename v4l2_async_subdev as v4l2_async_connection, in order to
      differentiate between the sub-devices and their connections: one
      sub-device can have many connections but the V4L2 async framework has so
      far allowed just a single one. Connections in this context will later
      translate into either MC ancillary or data links.
      
      This patch prepares changing that relation by changing existing users of
      v4l2_async_subdev to switch to v4l2_async_connection. Async sub-devices
      themselves will not be needed anymore
      
      Additionally, __v4l2_async_nf_add_subdev() has been renamed
      __v4l2_async_nf_add_connection().
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      adb2dcd5
    • Sakari Ailus's avatar
      media: v4l: async: Simplify async sub-device fwnode matching · 1029939b
      Sakari Ailus authored
      V4L2 async sub-device matching originally used the device nodes only.
      Endpoint nodes were taken into use instead as using the device nodes was
      problematic for it was in some cases ambiguous which link might have been
      in question.
      
      There is however no need to use endpoint nodes on both sides, as the async
      sub-device's fwnode can always be trivially obtained using
      fwnode_graph_get_remote_endpoint() when needed while what counts is
      whether or not the link is between two device nodes, i.e. the device nodes
      match.
      
      This will briefly break the adv748x driver but it will be fixed later in
      the set, by patch "media: adv748x: Return to endpoint matching".
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      1029939b
    • Sakari Ailus's avatar
      media: v4l: async: Clean up list heads and entries · b6d42c35
      Sakari Ailus authored
      The naming of list heads and list entries is confusing as they're named
      similarly. Use _list for list head and _entry for list entries.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      b6d42c35
    • Sakari Ailus's avatar
      media: v4l: async: Only pass match information for async subdev validation · 9b4d2f37
      Sakari Ailus authored
      Pass only information required for sub-device matching to functions
      checking whether the async sub-device already exists. Do the same for
      debug message printing. This makes further changes to other aspects of
      async sub-devices easier.
      
      Accordingly, also perform further renames:
      
      	asd_equal as v4l2_async_match_equal,
      	v4l2_async_nf_has_async_subdev as v4l2_async_nf_has_async_match,
      	__v4l2_async_nf_has_async_subdev as
      		v4l2_async_nf_has_async_subdev_entry and
      	v4l2_async_nf_asd_valid as v4l2_async_nf_match_valid.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      9b4d2f37
    • Sakari Ailus's avatar
      media: v4l: async: Rename V4L2_ASYNC_MATCH_ macros, add TYPE_ · 7a2259fc
      Sakari Ailus authored
      The async match type is a struct field now, rename V4L2_ASYNC_MATCH_*
      macros as V4L2_ASYNC_MATCH_TYPE_* instead.
      
      This patch has been produced by:
      
      git grep -l V4L2_ASYNC_MATCH_ -- drivers/media/ drivers/staging/media/ \
      	include/ Documentation/|xargs perl -i -pe \
      	's/V4L2_ASYNC_MATCH_\K/TYPE_/g'
      
      so it must be correct.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      7a2259fc
    • Sakari Ailus's avatar
      media: v4l: async: Make V4L2 async match information a struct · f0e10d0a
      Sakari Ailus authored
      Make V4L2 async match information a struct, making it easier to use it
      elsewhere outside the scope of struct v4l2_async_subdev.
      
      Also remove an obsolete comment --- none of these fields are supposed to
      be touched by drivers.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      f0e10d0a
    • Sakari Ailus's avatar
      media: v4l: async: Don't check whether asd is NULL in validity check · 1c5cd3ef
      Sakari Ailus authored
      The callers do pass a non-NULL asd to v4l2_async_nf_asd_valid() already.
      There's no need for the NULL check here.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      1c5cd3ef
    • Sakari Ailus's avatar
      media: v4l: async: Clean up testing for duplicate async subdevs · 506aafba
      Sakari Ailus authored
      There's a need to verify that a single async sub-device isn't being added
      multiple times, this would be an error. This takes place at the time of
      adding the async sub-device to the notifier's list as well as when the
      notifier is added to the global notifier's list.
      
      Use the pointer to the sub-device for testing this instead of an index to
      an array that is long gone. (There was an array of async sub-devices in
      the notifier before it was converted to a linked list by commit
      66beb323 ("media: v4l2: async: Remove notifier subdevs array").)
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      506aafba
    • Sakari Ailus's avatar
      media: v4l: async: Add some debug prints · 48229039
      Sakari Ailus authored
      Just add some debug prints for V4L2 async sub-device matching process.
      These might come useful in figuring out why things don't work as expected.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      48229039
    • Sakari Ailus's avatar
      media: Documentation: v4l: Document v4l2_async_nf_cleanup · f60eccb0
      Sakari Ailus authored
      Document v4l2_async_nf_cleanup() which must be called before releasing an
      unregistered notifier's memory. Also remove the sentence regarding
      v4l2_async_nf_init() arguments --- those are documented in kerneldoc which
      is referred here.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      f60eccb0
    • Sakari Ailus's avatar
      media: Documentation: v4l: Document missing async subdev function · 95a18816
      Sakari Ailus authored
      Also v4l2_async_nf_add_fwnode() may be used to add an async sub-device
      descriptor to a notifier. Document this. Also remove a redundant sentence.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
      Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
      Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      95a18816
    • Sakari Ailus's avatar
      media: Documentation: v4l: Fix async sensor subdev helper documentation · 4232c5df
      Sakari Ailus authored
      Document that the notifier of an async sub-device is, besider
      unregistered, also cleaned up using v4l2_async_unregister_subdev().
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      4232c5df
    • Sakari Ailus's avatar
      media: Documentation: v4l: Add section titles for async · 5202fb58
      Sakari Ailus authored
      Add section titles for async documentation. While the documentation is
      mostly fine as-is, it has grown from its original state but remains
      without internal structure. Add it now.
      
      Also remove an extra newline.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      5202fb58