mbox series

[v2,00/13] media: cadence,ti: CSI2RX Multistream Support

Message ID 20240627-multistream-v2-0-6ae96c54c1c3@ti.com (mailing list archive)
Headers show
Series media: cadence,ti: CSI2RX Multistream Support | expand

Message

Jai Luthra June 27, 2024, 1:09 p.m. UTC
This series adds multi-stream support for Cadence CSI2RX and TI CSI2RX
Shim drivers.

PATCH 1:	Runtime Power Management for Cadence CSI2RX
PATCH 2-7:	Support multiple DMA contexts/video nodes in TI CSI2RX
PATCH 8-9:	Use get_frame_desc to propagate virtual channel information
		across Cadence and TI CSI-RX subdevs
PATCH 10-12:	Use new multi-stream APIs across the drivers to support
		multiplexed cameras from sources like UB960 (FPDLink)
PATCH 13:	Optimize stream on by submitting all queued buffers to DMA

This applies on top of today's linux-next (next-20240626)
(also tested rebase with media_stage.git master)

Signed-off-by: Jai Luthra <j-luthra@ti.com>
---
Changes in v2:

- Change the multi-camera capture architecture to be similar to that of
  Tomi's RPi5 FE series, where the driver will wait for userspace to
  start streaming on all "actively routed" video nodes before starting
  streaming on the source. This simplifies things a lot from the HW
  perspective, which might run into deadlocks due to a shared FIFO
  between multiple DMA channels.

- Drop a few fixes that were posted separately and are already merged
- Fix dtschema warnings reported by Rob on [02/13]
- Fix warnings for uninitialized `used_vc` variable in cdns-csi2rx.c
- Return -EBUSY if someone updates routes for j721e-csi2rx subdev while
  streaming
- Only allow single-streams to be routed to the source pads (linked to
  video nodes) of the j721e-csi2rx device
- Squash the patches marked "SQUASH" in the v1 RFC series

- Link to RFC (v1):
  https://lore.kernel.org/r/20240222-multistream-v1-0-1837ed916eeb@ti.com

---
Jai Luthra (8):
      dt-bindings: media: ti,j721e-csi2rx-shim: Support 32 dma chans
      media: ti: j721e-csi2rx: separate out device and context
      media: ti: j721e-csi2rx: add a subdev for the core device
      media: ti: j721e-csi2rx: add support for processing virtual channels
      media: cadence: csi2rx: Use new enable stream APIs
      media: cadence: csi2rx: Enable multi-stream support
      media: ti: j721e-csi2rx: add multistream support
      media: ti: j721e-csi2rx: Submit all available buffers

Jayshri Pawar (1):
      media: cadence: csi2rx: Support runtime PM

Pratyush Yadav (4):
      media: ti: j721e-csi2rx: prepare SHIM code for multiple contexts
      media: ti: j721e-csi2rx: allocate DMA channel based on context index
      media: ti: j721e-csi2rx: get number of contexts from device tree
      media: cadence: csi2rx: add get_frame_desc wrapper

 .../bindings/media/ti,j721e-csi2rx-shim.yaml       |  39 +-
 drivers/media/platform/cadence/cdns-csi2rx.c       | 440 +++++++++--
 .../media/platform/ti/j721e-csi2rx/j721e-csi2rx.c  | 879 ++++++++++++++++-----
 3 files changed, 1071 insertions(+), 287 deletions(-)
---
base-commit: df9574a57d02b265322e77fb8628d4d33641dda9
change-id: 20240221-multistream-fbba6ffe47a3

Best regards,

Comments

Tomi Valkeinen June 28, 2024, 8:26 a.m. UTC | #1
Hi Jai,

On 27/06/2024 16:09, Jai Luthra wrote:
> This series adds multi-stream support for Cadence CSI2RX and TI CSI2RX
> Shim drivers.
> 
> PATCH 1:	Runtime Power Management for Cadence CSI2RX
> PATCH 2-7:	Support multiple DMA contexts/video nodes in TI CSI2RX
> PATCH 8-9:	Use get_frame_desc to propagate virtual channel information
> 		across Cadence and TI CSI-RX subdevs
> PATCH 10-12:	Use new multi-stream APIs across the drivers to support
> 		multiplexed cameras from sources like UB960 (FPDLink)
> PATCH 13:	Optimize stream on by submitting all queued buffers to DMA
> 
> This applies on top of today's linux-next (next-20240626)
> (also tested rebase with media_stage.git master)
> 
> Signed-off-by: Jai Luthra <j-luthra@ti.com>
> ---
> Changes in v2:
> 
> - Change the multi-camera capture architecture to be similar to that of
>    Tomi's RPi5 FE series, where the driver will wait for userspace to
>    start streaming on all "actively routed" video nodes before starting
>    streaming on the source. This simplifies things a lot from the HW
>    perspective, which might run into deadlocks due to a shared FIFO
>    between multiple DMA channels.
> 
> - Drop a few fixes that were posted separately and are already merged
> - Fix dtschema warnings reported by Rob on [02/13]
> - Fix warnings for uninitialized `used_vc` variable in cdns-csi2rx.c
> - Return -EBUSY if someone updates routes for j721e-csi2rx subdev while
>    streaming
> - Only allow single-streams to be routed to the source pads (linked to
>    video nodes) of the j721e-csi2rx device
> - Squash the patches marked "SQUASH" in the v1 RFC series
> 
> - Link to RFC (v1):
>    https://lore.kernel.org/r/20240222-multistream-v1-0-1837ed916eeb@ti.com
> 
> ---
> Jai Luthra (8):
>        dt-bindings: media: ti,j721e-csi2rx-shim: Support 32 dma chans
>        media: ti: j721e-csi2rx: separate out device and context
>        media: ti: j721e-csi2rx: add a subdev for the core device
>        media: ti: j721e-csi2rx: add support for processing virtual channels
>        media: cadence: csi2rx: Use new enable stream APIs
>        media: cadence: csi2rx: Enable multi-stream support
>        media: ti: j721e-csi2rx: add multistream support
>        media: ti: j721e-csi2rx: Submit all available buffers
> 
> Jayshri Pawar (1):
>        media: cadence: csi2rx: Support runtime PM
> 
> Pratyush Yadav (4):
>        media: ti: j721e-csi2rx: prepare SHIM code for multiple contexts
>        media: ti: j721e-csi2rx: allocate DMA channel based on context index
>        media: ti: j721e-csi2rx: get number of contexts from device tree
>        media: cadence: csi2rx: add get_frame_desc wrapper
> 
>   .../bindings/media/ti,j721e-csi2rx-shim.yaml       |  39 +-
>   drivers/media/platform/cadence/cdns-csi2rx.c       | 440 +++++++++--
>   .../media/platform/ti/j721e-csi2rx/j721e-csi2rx.c  | 879 ++++++++++++++++-----
>   3 files changed, 1071 insertions(+), 287 deletions(-)
> ---
> base-commit: df9574a57d02b265322e77fb8628d4d33641dda9
> change-id: 20240221-multistream-fbba6ffe47a3

You have based this series on top of your private branch. Don't do that. 
Base on top of a kernel tag, or a commonly known tree (linux-media-stage 
for example), and preferably mention the base in the cover letter.

Your private branch contains e.g. dtsos needed for testing. If you have 
such a branch, you should point to it in the cover letter as it's 
valuable for reviewers/testers.

Only base on top of a private branch if your patches compile-time depend 
on something from there, and in that case point to the branch and 
mention this dependency clearly in the cover letter.

  Tomi
Jai Luthra June 28, 2024, 9:35 a.m. UTC | #2
Hi Tomi,

On Jun 28, 2024 at 11:26:59 +0300, Tomi Valkeinen wrote:
> Hi Jai,
> 
> On 27/06/2024 16:09, Jai Luthra wrote:
> > This series adds multi-stream support for Cadence CSI2RX and TI CSI2RX
> > Shim drivers.
> > 
> > PATCH 1:	Runtime Power Management for Cadence CSI2RX
> > PATCH 2-7:	Support multiple DMA contexts/video nodes in TI CSI2RX
> > PATCH 8-9:	Use get_frame_desc to propagate virtual channel information
> > 		across Cadence and TI CSI-RX subdevs
> > PATCH 10-12:	Use new multi-stream APIs across the drivers to support
> > 		multiplexed cameras from sources like UB960 (FPDLink)
> > PATCH 13:	Optimize stream on by submitting all queued buffers to DMA
> > 
> > This applies on top of today's linux-next (next-20240626)

This series is based on top of next-20240626 

> > (also tested rebase with media_stage.git master)
> > 
> > Signed-off-by: Jai Luthra <j-luthra@ti.com>
> > ---
> > Changes in v2:
> > 
> > - Change the multi-camera capture architecture to be similar to that of
> >    Tomi's RPi5 FE series, where the driver will wait for userspace to
> >    start streaming on all "actively routed" video nodes before starting
> >    streaming on the source. This simplifies things a lot from the HW
> >    perspective, which might run into deadlocks due to a shared FIFO
> >    between multiple DMA channels.
> > 
> > - Drop a few fixes that were posted separately and are already merged
> > - Fix dtschema warnings reported by Rob on [02/13]
> > - Fix warnings for uninitialized `used_vc` variable in cdns-csi2rx.c
> > - Return -EBUSY if someone updates routes for j721e-csi2rx subdev while
> >    streaming
> > - Only allow single-streams to be routed to the source pads (linked to
> >    video nodes) of the j721e-csi2rx device
> > - Squash the patches marked "SQUASH" in the v1 RFC series
> > 
> > - Link to RFC (v1):
> >    https://lore.kernel.org/r/20240222-multistream-v1-0-1837ed916eeb@ti.com
> > 
> > ---
> > Jai Luthra (8):
> >        dt-bindings: media: ti,j721e-csi2rx-shim: Support 32 dma chans
> >        media: ti: j721e-csi2rx: separate out device and context
> >        media: ti: j721e-csi2rx: add a subdev for the core device
> >        media: ti: j721e-csi2rx: add support for processing virtual channels
> >        media: cadence: csi2rx: Use new enable stream APIs
> >        media: cadence: csi2rx: Enable multi-stream support
> >        media: ti: j721e-csi2rx: add multistream support
> >        media: ti: j721e-csi2rx: Submit all available buffers
> > 
> > Jayshri Pawar (1):
> >        media: cadence: csi2rx: Support runtime PM
> > 
> > Pratyush Yadav (4):
> >        media: ti: j721e-csi2rx: prepare SHIM code for multiple contexts
> >        media: ti: j721e-csi2rx: allocate DMA channel based on context index
> >        media: ti: j721e-csi2rx: get number of contexts from device tree
> >        media: cadence: csi2rx: add get_frame_desc wrapper
> > 
> >   .../bindings/media/ti,j721e-csi2rx-shim.yaml       |  39 +-
> >   drivers/media/platform/cadence/cdns-csi2rx.c       | 440 +++++++++--
> >   .../media/platform/ti/j721e-csi2rx/j721e-csi2rx.c  | 879 ++++++++++++++++-----
> >   3 files changed, 1071 insertions(+), 287 deletions(-)
> > ---
> > base-commit: df9574a57d02b265322e77fb8628d4d33641dda9
> > change-id: 20240221-multistream-fbba6ffe47a3
> 
> You have based this series on top of your private branch. Don't do that.
> Base on top of a kernel tag, or a commonly known tree (linux-media-stage for
> example), and preferably mention the base in the cover letter.

The base commit SHA populated by b4 is the same as next-20240626 as 
mentioned above

https://gitlab.com/linux-kernel/linux-next/-/commits/df9574a57d02b265322e77fb8628d4d33641dda9

I chose to not use media-stage as the base, but this series applies 
cleanly (and compiles) on top of that as well.

> 
> Your private branch contains e.g. dtsos needed for testing. If you have such
> a branch, you should point to it in the cover letter as it's valuable for
> reviewers/testers.

Ah my bad, I missed mentioning my github branch that can be used for 
testing the content of this series. It contains some DTSOs and defconfig 
updates, along with support for FPDLink/V3Link sensors.

https://github.com/jailuthra/linux/commits/b4/multistream/

> 
> Only base on top of a private branch if your patches compile-time depend on
> something from there, and in that case point to the branch and mention this
> dependency clearly in the cover letter.

Makes sense, will take extra care to mention the dependencies and base 
branch from next version.

> 
>  Tomi
>
Tomi Valkeinen June 28, 2024, 9:53 a.m. UTC | #3
On 28/06/2024 12:35, Jai Luthra wrote:
> Hi Tomi,
> 
> On Jun 28, 2024 at 11:26:59 +0300, Tomi Valkeinen wrote:
>> Hi Jai,
>>
>> On 27/06/2024 16:09, Jai Luthra wrote:
>>> This series adds multi-stream support for Cadence CSI2RX and TI CSI2RX
>>> Shim drivers.
>>>
>>> PATCH 1:	Runtime Power Management for Cadence CSI2RX
>>> PATCH 2-7:	Support multiple DMA contexts/video nodes in TI CSI2RX
>>> PATCH 8-9:	Use get_frame_desc to propagate virtual channel information
>>> 		across Cadence and TI CSI-RX subdevs
>>> PATCH 10-12:	Use new multi-stream APIs across the drivers to support
>>> 		multiplexed cameras from sources like UB960 (FPDLink)
>>> PATCH 13:	Optimize stream on by submitting all queued buffers to DMA
>>>
>>> This applies on top of today's linux-next (next-20240626)
> 
> This series is based on top of next-20240626
> 
>>> (also tested rebase with media_stage.git master)
>>>
>>> Signed-off-by: Jai Luthra <j-luthra@ti.com>
>>> ---
>>> Changes in v2:
>>>
>>> - Change the multi-camera capture architecture to be similar to that of
>>>     Tomi's RPi5 FE series, where the driver will wait for userspace to
>>>     start streaming on all "actively routed" video nodes before starting
>>>     streaming on the source. This simplifies things a lot from the HW
>>>     perspective, which might run into deadlocks due to a shared FIFO
>>>     between multiple DMA channels.
>>>
>>> - Drop a few fixes that were posted separately and are already merged
>>> - Fix dtschema warnings reported by Rob on [02/13]
>>> - Fix warnings for uninitialized `used_vc` variable in cdns-csi2rx.c
>>> - Return -EBUSY if someone updates routes for j721e-csi2rx subdev while
>>>     streaming
>>> - Only allow single-streams to be routed to the source pads (linked to
>>>     video nodes) of the j721e-csi2rx device
>>> - Squash the patches marked "SQUASH" in the v1 RFC series
>>>
>>> - Link to RFC (v1):
>>>     https://lore.kernel.org/r/20240222-multistream-v1-0-1837ed916eeb@ti.com
>>>
>>> ---
>>> Jai Luthra (8):
>>>         dt-bindings: media: ti,j721e-csi2rx-shim: Support 32 dma chans
>>>         media: ti: j721e-csi2rx: separate out device and context
>>>         media: ti: j721e-csi2rx: add a subdev for the core device
>>>         media: ti: j721e-csi2rx: add support for processing virtual channels
>>>         media: cadence: csi2rx: Use new enable stream APIs
>>>         media: cadence: csi2rx: Enable multi-stream support
>>>         media: ti: j721e-csi2rx: add multistream support
>>>         media: ti: j721e-csi2rx: Submit all available buffers
>>>
>>> Jayshri Pawar (1):
>>>         media: cadence: csi2rx: Support runtime PM
>>>
>>> Pratyush Yadav (4):
>>>         media: ti: j721e-csi2rx: prepare SHIM code for multiple contexts
>>>         media: ti: j721e-csi2rx: allocate DMA channel based on context index
>>>         media: ti: j721e-csi2rx: get number of contexts from device tree
>>>         media: cadence: csi2rx: add get_frame_desc wrapper
>>>
>>>    .../bindings/media/ti,j721e-csi2rx-shim.yaml       |  39 +-
>>>    drivers/media/platform/cadence/cdns-csi2rx.c       | 440 +++++++++--
>>>    .../media/platform/ti/j721e-csi2rx/j721e-csi2rx.c  | 879 ++++++++++++++++-----
>>>    3 files changed, 1071 insertions(+), 287 deletions(-)
>>> ---
>>> base-commit: df9574a57d02b265322e77fb8628d4d33641dda9
>>> change-id: 20240221-multistream-fbba6ffe47a3
>>
>> You have based this series on top of your private branch. Don't do that.
>> Base on top of a kernel tag, or a commonly known tree (linux-media-stage for
>> example), and preferably mention the base in the cover letter.
> 
> The base commit SHA populated by b4 is the same as next-20240626 as
> mentioned above

Ah, right, my bad. I took your branch 
https://github.com/jailuthra/linux/commits/b4/multistream/, and assumed 
it's the one you used to send these patches. In that branch these 
patches are not based on linux-next.

> https://gitlab.com/linux-kernel/linux-next/-/commits/df9574a57d02b265322e77fb8628d4d33641dda9
> 
> I chose to not use media-stage as the base, but this series applies
> cleanly (and compiles) on top of that as well.

I'd still recommend media-stage, as that's where these patches would be 
merged (or just linux-media). linux-next is good for testing, but I 
wouldn't normally base patches on top of that, or at last send patches 
based on that.

>> Your private branch contains e.g. dtsos needed for testing. If you have such
>> a branch, you should point to it in the cover letter as it's valuable for
>> reviewers/testers.
> 
> Ah my bad, I missed mentioning my github branch that can be used for
> testing the content of this series. It contains some DTSOs and defconfig
> updates, along with support for FPDLink/V3Link sensors.
> 
> https://github.com/jailuthra/linux/commits/b4/multistream/

Jfyi, I've tested this with am62a and arducam's fpdlink board with 
imx219 sensors, and works fine for me.

I only tested with pixel streams, I'd like to also add all the patches 
needed for embedded data and test that (I think all of those have been 
posted to the lists), but I don't think I'll have time for that right now.

  Tomi

>> Only base on top of a private branch if your patches compile-time depend on
>> something from there, and in that case point to the branch and mention this
>> dependency clearly in the cover letter.
> 
> Makes sense, will take extra care to mention the dependencies and base
> branch from next version.
> 
>>
>>   Tomi
>>
>
Jai Luthra June 28, 2024, 10:29 a.m. UTC | #4
On Jun 28, 2024 at 12:53:04 +0300, Tomi Valkeinen wrote:
> On 28/06/2024 12:35, Jai Luthra wrote:
> > Hi Tomi,
> > 
> > On Jun 28, 2024 at 11:26:59 +0300, Tomi Valkeinen wrote:
> > > Hi Jai,
> > > 
> > > On 27/06/2024 16:09, Jai Luthra wrote:
> > > > This series adds multi-stream support for Cadence CSI2RX and TI CSI2RX
> > > > Shim drivers.
> > > > 
> > > > PATCH 1:	Runtime Power Management for Cadence CSI2RX
> > > > PATCH 2-7:	Support multiple DMA contexts/video nodes in TI CSI2RX
> > > > PATCH 8-9:	Use get_frame_desc to propagate virtual channel information
> > > > 		across Cadence and TI CSI-RX subdevs
> > > > PATCH 10-12:	Use new multi-stream APIs across the drivers to support
> > > > 		multiplexed cameras from sources like UB960 (FPDLink)
> > > > PATCH 13:	Optimize stream on by submitting all queued buffers to DMA
> > > > 
> > > > This applies on top of today's linux-next (next-20240626)
> > 
> > This series is based on top of next-20240626
> > 
> > > > (also tested rebase with media_stage.git master)
> > > > 
> > > > Signed-off-by: Jai Luthra <j-luthra@ti.com>
> > > > ---
> > > > Changes in v2:
> > > > 
> > > > - Change the multi-camera capture architecture to be similar to that of
> > > >     Tomi's RPi5 FE series, where the driver will wait for userspace to
> > > >     start streaming on all "actively routed" video nodes before starting
> > > >     streaming on the source. This simplifies things a lot from the HW
> > > >     perspective, which might run into deadlocks due to a shared FIFO
> > > >     between multiple DMA channels.
> > > > 
> > > > - Drop a few fixes that were posted separately and are already merged
> > > > - Fix dtschema warnings reported by Rob on [02/13]
> > > > - Fix warnings for uninitialized `used_vc` variable in cdns-csi2rx.c
> > > > - Return -EBUSY if someone updates routes for j721e-csi2rx subdev while
> > > >     streaming
> > > > - Only allow single-streams to be routed to the source pads (linked to
> > > >     video nodes) of the j721e-csi2rx device
> > > > - Squash the patches marked "SQUASH" in the v1 RFC series
> > > > 
> > > > - Link to RFC (v1):
> > > >     https://lore.kernel.org/r/20240222-multistream-v1-0-1837ed916eeb@ti.com
> > > > 
> > > > ---
> > > > Jai Luthra (8):
> > > >         dt-bindings: media: ti,j721e-csi2rx-shim: Support 32 dma chans
> > > >         media: ti: j721e-csi2rx: separate out device and context
> > > >         media: ti: j721e-csi2rx: add a subdev for the core device
> > > >         media: ti: j721e-csi2rx: add support for processing virtual channels
> > > >         media: cadence: csi2rx: Use new enable stream APIs
> > > >         media: cadence: csi2rx: Enable multi-stream support
> > > >         media: ti: j721e-csi2rx: add multistream support
> > > >         media: ti: j721e-csi2rx: Submit all available buffers
> > > > 
> > > > Jayshri Pawar (1):
> > > >         media: cadence: csi2rx: Support runtime PM
> > > > 
> > > > Pratyush Yadav (4):
> > > >         media: ti: j721e-csi2rx: prepare SHIM code for multiple contexts
> > > >         media: ti: j721e-csi2rx: allocate DMA channel based on context index
> > > >         media: ti: j721e-csi2rx: get number of contexts from device tree
> > > >         media: cadence: csi2rx: add get_frame_desc wrapper
> > > > 
> > > >    .../bindings/media/ti,j721e-csi2rx-shim.yaml       |  39 +-
> > > >    drivers/media/platform/cadence/cdns-csi2rx.c       | 440 +++++++++--
> > > >    .../media/platform/ti/j721e-csi2rx/j721e-csi2rx.c  | 879 ++++++++++++++++-----
> > > >    3 files changed, 1071 insertions(+), 287 deletions(-)
> > > > ---
> > > > base-commit: df9574a57d02b265322e77fb8628d4d33641dda9
> > > > change-id: 20240221-multistream-fbba6ffe47a3
> > > 
> > > You have based this series on top of your private branch. Don't do that.
> > > Base on top of a kernel tag, or a commonly known tree (linux-media-stage for
> > > example), and preferably mention the base in the cover letter.
> > 
> > The base commit SHA populated by b4 is the same as next-20240626 as
> > mentioned above
> 
> Ah, right, my bad. I took your branch
> https://github.com/jailuthra/linux/commits/b4/multistream/, and assumed it's
> the one you used to send these patches. In that branch these patches are not
> based on linux-next.

Ah, yes I cherry-picked them in after posting.

> 
> > https://gitlab.com/linux-kernel/linux-next/-/commits/df9574a57d02b265322e77fb8628d4d33641dda9
> > 
> > I chose to not use media-stage as the base, but this series applies
> > cleanly (and compiles) on top of that as well.
> 
> I'd still recommend media-stage, as that's where these patches would be
> merged (or just linux-media). linux-next is good for testing, but I wouldn't
> normally base patches on top of that, or at last send patches based on that.

Understood, will use media-stage while posting future revisions.

> 
> > > Your private branch contains e.g. dtsos needed for testing. If you have such
> > > a branch, you should point to it in the cover letter as it's valuable for
> > > reviewers/testers.
> > 
> > Ah my bad, I missed mentioning my github branch that can be used for
> > testing the content of this series. It contains some DTSOs and defconfig
> > updates, along with support for FPDLink/V3Link sensors.
> > 
> > https://github.com/jailuthra/linux/commits/b4/multistream/
> 
> Jfyi, I've tested this with am62a and arducam's fpdlink board with imx219
> sensors, and works fine for me.

Neat! Thanks for testing it out.

> 
> I only tested with pixel streams, I'd like to also add all the patches
> needed for embedded data and test that (I think all of those have been
> posted to the lists), but I don't think I'll have time for that right now.

I see, I haven't been following the recent series adding support for 
internal pads and embedded data in IMX219. I will try to merge those in 
and see if I can get something working.

> 
>  Tomi
> 
> > > Only base on top of a private branch if your patches compile-time depend on
> > > something from there, and in that case point to the branch and mention this
> > > dependency clearly in the cover letter.
> > 
> > Makes sense, will take extra care to mention the dependencies and base
> > branch from next version.
> > 
> > > 
> > >   Tomi
> > > 
> > 
>