* [PATCH 0/2] media: m2m-deinterlace: add device-tree support @ 2025-02-12 17:08 Matthew Majewski 2025-02-12 17:09 ` [PATCH 1/2] media: dt-bindings: Add dt bindings for m2m-deinterlace device Matthew Majewski 2025-02-12 17:09 ` [PATCH 2/2] media: m2m-deinterlace: add device-tree support Matthew Majewski 0 siblings, 2 replies; 8+ messages in thread From: Matthew Majewski @ 2025-02-12 17:08 UTC (permalink / raw) To: Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Hans Verkuil, Dr. David Alan Gilbert, Neil Armstrong, Uwe Kleine-Konig, Andrzej Pietrasiewicz Cc: devicetree, linux-media, linux-kernel, Matthew Majewski Hello all, this patch series adds device-tree support for the generic m2m-deinterlace driver. A specific dma controller channel can now be provided to the driver via the dt, but the driver still supports the original dma query if an of_node is not present. This should preserve backwards compatibility with platform drivers that directly instantiate the device. Probing the m2m-deinterlace device via device-tree was tested on the BeagleBone Black with an m2m-appropriate edma channel. Best, Matthew Majewski Matthew Majewski (2): media: dt-bindings: Add dt bindings for m2m-deinterlace device media: m2m-deinterlace: add device-tree support .../bindings/media/m2m-deinterlace.yaml | 41 +++++++++++++++++++ drivers/media/platform/m2m-deinterlace.c | 25 ++++++++--- 2 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/m2m-deinterlace.yaml -- 2.25.1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] media: dt-bindings: Add dt bindings for m2m-deinterlace device 2025-02-12 17:08 [PATCH 0/2] media: m2m-deinterlace: add device-tree support Matthew Majewski @ 2025-02-12 17:09 ` Matthew Majewski 2025-02-12 17:22 ` Krzysztof Kozlowski 2025-02-12 19:26 ` Rob Herring (Arm) 2025-02-12 17:09 ` [PATCH 2/2] media: m2m-deinterlace: add device-tree support Matthew Majewski 1 sibling, 2 replies; 8+ messages in thread From: Matthew Majewski @ 2025-02-12 17:09 UTC (permalink / raw) To: Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Hans Verkuil, Dr. David Alan Gilbert, Neil Armstrong, Uwe Kleine-Konig, Andrzej Pietrasiewicz Cc: devicetree, linux-media, linux-kernel, Matthew Majewski Create a new yaml schema file to describe the device tree bindings for the generic m2m-deinterlace driver. Signed-off-by: Matthew Majewski <mattwmajewski@gmail.com> --- .../bindings/media/m2m-deinterlace.yaml | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/m2m-deinterlace.yaml diff --git a/Documentation/devicetree/bindings/media/m2m-deinterlace.yaml b/Documentation/devicetree/bindings/media/m2m-deinterlace.yaml new file mode 100644 index 000000000000..3ac9c1e7be88 --- /dev/null +++ b/Documentation/devicetree/bindings/media/m2m-deinterlace.yaml @@ -0,0 +1,41 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/m2m-deinterlace.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: M2M Deinterlacer + +maintainers: + - Mauro Carvalho Chehab <mchehab@kernel.org> + +description: | + A generic memory2memory device for deinterlacing video + using dmaengine. + +properties: + compatible: + const: m2m-deinterlace + + dma-names: + items: + - const: rxtx + + dmas: + items: + - description: mem-to-mem capable DMA channel + +required: + - compatible + - dma-names + - dmas + +additionalProperties: false + +examples: + - | + m2m-deinterlace { + compatible = "m2m-deinterlace"; + dma-names = "rxtx"; + dmas = <&edma 20 0>; + }; -- 2.25.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] media: dt-bindings: Add dt bindings for m2m-deinterlace device 2025-02-12 17:09 ` [PATCH 1/2] media: dt-bindings: Add dt bindings for m2m-deinterlace device Matthew Majewski @ 2025-02-12 17:22 ` Krzysztof Kozlowski 2025-02-12 22:29 ` Matthew Majewski 2025-02-12 19:26 ` Rob Herring (Arm) 1 sibling, 1 reply; 8+ messages in thread From: Krzysztof Kozlowski @ 2025-02-12 17:22 UTC (permalink / raw) To: Matthew Majewski, Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Hans Verkuil, Dr. David Alan Gilbert, Neil Armstrong, Uwe Kleine-Konig, Andrzej Pietrasiewicz Cc: devicetree, linux-media, linux-kernel On 12/02/2025 18:09, Matthew Majewski wrote: > Create a new yaml schema file to describe the device tree bindings for > the generic m2m-deinterlace driver. Bindings are for hardware, not drivers, and usually not generic. Please describe here exemplary devices. > > Signed-off-by: Matthew Majewski <mattwmajewski@gmail.com> > --- > .../bindings/media/m2m-deinterlace.yaml | 41 +++++++++++++++++++ > 1 file changed, 41 insertions(+) > create mode 100644 Documentation/devicetree/bindings/media/m2m-deinterlace.yaml > > diff --git a/Documentation/devicetree/bindings/media/m2m-deinterlace.yaml b/Documentation/devicetree/bindings/media/m2m-deinterlace.yaml > new file mode 100644 > index 000000000000..3ac9c1e7be88 > --- /dev/null > +++ b/Documentation/devicetree/bindings/media/m2m-deinterlace.yaml > @@ -0,0 +1,41 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/media/m2m-deinterlace.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: M2M Deinterlacer > + > +maintainers: > + - Mauro Carvalho Chehab <mchehab@kernel.org> > + > +description: | > + A generic memory2memory device for deinterlacing video > + using dmaengine. And what is this generic device supposed to do? What fits to generic device? > + > +properties: > + compatible: > + const: m2m-deinterlace > + > + dma-names: > + items: > + - const: rxtx > + > + dmas: > + items: > + - description: mem-to-mem capable DMA channel > + > +required: > + - compatible > + - dma-names > + - dmas > + > +additionalProperties: false > + > +examples: > + - | > + m2m-deinterlace { > + compatible = "m2m-deinterlace"; > + dma-names = "rxtx"; > + dmas = <&edma 20 0>; This all looks rather like bindings for driver and not even quite generic because looks quite simple. I guess media folks will provide more input, but anyway it looks a bit not-DT-enough. > + }; Best regards, Krzysztof ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] media: dt-bindings: Add dt bindings for m2m-deinterlace device 2025-02-12 17:22 ` Krzysztof Kozlowski @ 2025-02-12 22:29 ` Matthew Majewski 2025-02-18 8:34 ` Krzysztof Kozlowski 0 siblings, 1 reply; 8+ messages in thread From: Matthew Majewski @ 2025-02-12 22:29 UTC (permalink / raw) To: Krzysztof Kozlowski, Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Hans Verkuil, Dr. David Alan Gilbert, Neil Armstrong, Uwe Kleine-Konig, Andrzej Pietrasiewicz Cc: devicetree, linux-media, linux-kernel Hi Krzysztof, thanks for the quick feedback. On Wed, 2025-02-12 at 18:22 +0100, Krzysztof Kozlowski wrote: > On 12/02/2025 18:09, Matthew Majewski wrote: > > Create a new yaml schema file to describe the device tree bindings > > for > > the generic m2m-deinterlace driver. > > > Bindings are for hardware, not drivers, and usually not generic. > Ok, I'll change the wording from "driver" to "device" in V2. > Please describe here exemplary devices. The m2m-deinterlace device can be used on any hardware that provides a MEM_TO_MEM and interleaved capable dma channel. I'll note that in the commit message for V2 as well. > > > > +description: | > > + A generic memory2memory device for deinterlacing video > > + using dmaengine. > > And what is this generic device supposed to do? What fits to generic > device? > The term "generic" was taken from the driver description. It's generic insofar as it only relies on the dmaengine API for processing (and hence is relatively platform agnostic). I will add more information about the device in the description for V2. I'll also mention that it's intended for converting between interlaced and non-interlaced formats by line-doubling. > > + > > +properties: > > + compatible: > > + const: m2m-deinterlace > > + > > + dma-names: > > + items: > > + - const: rxtx > > + > > + dmas: > > + items: > > + - description: mem-to-mem capable DMA channel > > + > > +required: > > + - compatible > > + - dma-names > > + - dmas > > + > > +additionalProperties: false > > + > > +examples: > > + - | > > + m2m-deinterlace { > > + compatible = "m2m-deinterlace"; > > + dma-names = "rxtx"; > > + dmas = <&edma 20 0>; > > > This all looks rather like bindings for driver and not even quite > generic because looks quite simple. I guess media folks will provide > more input, but anyway it looks a bit not-DT-enough. > > > + }; Yes, the bindings are much simpler than a typical media device, but that is because the m2m-deinterlace device only needs to be provided a handle to a dma channel to function properly. My reasoning for adding dt-bindings for this device is because it is a consumer of a dma- channel and the dt bindings are a platform-agnostic way to be able to provide a specific dma channel to the device. As an example, say on an embedded device I have a dma controller which provides multiple interleaved MEM_TO_MEM capable channels. I want the m2m-deinterlace device to consume one particular channel because it is higher-priority than the others. With these dt-bindings I can simply specify the correct dma channel that should be used. Without the device-tree bindings I would have to manually edit the driver to filter for the correct dma channel to be used, but then the device is no longer "generic". It would be helpful to hear what the media people have to say about it. The m2m-deinterlace device is a bit of an edge-case since it's not quite a "virtual" device since it relies on the presence of specific dma hardware. However, it doesn't follow the typical conventions of any other in-tree media driver that consumes a dma channel, which all seem to have dt-bindings. Best, Matthew ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] media: dt-bindings: Add dt bindings for m2m-deinterlace device 2025-02-12 22:29 ` Matthew Majewski @ 2025-02-18 8:34 ` Krzysztof Kozlowski 0 siblings, 0 replies; 8+ messages in thread From: Krzysztof Kozlowski @ 2025-02-18 8:34 UTC (permalink / raw) To: Matthew Majewski, Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Hans Verkuil, Dr. David Alan Gilbert, Neil Armstrong, Uwe Kleine-Konig, Andrzej Pietrasiewicz Cc: devicetree, linux-media, linux-kernel On 12/02/2025 23:29, Matthew Majewski wrote: > Hi Krzysztof, thanks for the quick feedback. > > On Wed, 2025-02-12 at 18:22 +0100, Krzysztof Kozlowski wrote: >> On 12/02/2025 18:09, Matthew Majewski wrote: >>> Create a new yaml schema file to describe the device tree bindings >>> for >>> the generic m2m-deinterlace driver. >> >> >> Bindings are for hardware, not drivers, and usually not generic. >> > > Ok, I'll change the wording from "driver" to "device" in V2. > >> Please describe here exemplary devices. > > The m2m-deinterlace device can be used on any hardware that provides a > MEM_TO_MEM and interleaved capable dma channel. I'll note that in the > commit message for V2 as well. I asked to give names of actual hardware you are writing bindings for. > >>> >>> +description: | >>> + A generic memory2memory device for deinterlacing video >>> + using dmaengine. >> >> And what is this generic device supposed to do? What fits to generic >> device? >> > > The term "generic" was taken from the driver description. It's generic > insofar as it only relies on the dmaengine API for processing (and > hence is relatively platform agnostic). > > I will add more information about the device in the description for V2. > I'll also mention that it's intended for converting between interlaced > and non-interlaced formats by line-doubling. > >>> + >>> +properties: >>> + compatible: >>> + const: m2m-deinterlace >>> + >>> + dma-names: >>> + items: >>> + - const: rxtx >>> + >>> + dmas: >>> + items: >>> + - description: mem-to-mem capable DMA channel >>> + >>> +required: >>> + - compatible >>> + - dma-names >>> + - dmas >>> + >>> +additionalProperties: false >>> + >>> +examples: >>> + - | >>> + m2m-deinterlace { >>> + compatible = "m2m-deinterlace"; >>> + dma-names = "rxtx"; >>> + dmas = <&edma 20 0>; >> >> >> This all looks rather like bindings for driver and not even quite >> generic because looks quite simple. I guess media folks will provide >> more input, but anyway it looks a bit not-DT-enough. >> >>> + }; > > Yes, the bindings are much simpler than a typical media device, but > that is because the m2m-deinterlace device only needs to be provided a > handle to a dma channel to function properly. My reasoning for adding Really only this? How do you reset the device? How do you clock it (or does it come with internal oscillator?) How do you program anything there if there are no resources? > dt-bindings for this device is because it is a consumer of a dma- > channel and the dt bindings are a platform-agnostic way to be able to > provide a specific dma channel to the device. > > As an example, say on an embedded device I have a dma controller which > provides multiple interleaved MEM_TO_MEM capable channels. I want the I asked about the names already, still nothing. > m2m-deinterlace device to consume one particular channel because it is > higher-priority than the others. With these dt-bindings I can simply > specify the correct dma channel that should be used. Without the > device-tree bindings I would have to manually edit the driver to filter > for the correct dma channel to be used, but then the device is no > longer "generic". > > It would be helpful to hear what the media people have to say about it. Then wait before sending new version. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] media: dt-bindings: Add dt bindings for m2m-deinterlace device 2025-02-12 17:09 ` [PATCH 1/2] media: dt-bindings: Add dt bindings for m2m-deinterlace device Matthew Majewski 2025-02-12 17:22 ` Krzysztof Kozlowski @ 2025-02-12 19:26 ` Rob Herring (Arm) 2025-02-13 19:48 ` Matthew Majewski 1 sibling, 1 reply; 8+ messages in thread From: Rob Herring (Arm) @ 2025-02-12 19:26 UTC (permalink / raw) To: Matthew Majewski Cc: Conor Dooley, Uwe Kleine-Konig, Neil Armstrong, Dr. David Alan Gilbert, Mauro Carvalho Chehab, linux-media, Krzysztof Kozlowski, linux-kernel, Andrzej Pietrasiewicz, devicetree, Hans Verkuil On Wed, 12 Feb 2025 12:09:00 -0500, Matthew Majewski wrote: > Create a new yaml schema file to describe the device tree bindings for > the generic m2m-deinterlace driver. > > Signed-off-by: Matthew Majewski <mattwmajewski@gmail.com> > --- > .../bindings/media/m2m-deinterlace.yaml | 41 +++++++++++++++++++ > 1 file changed, 41 insertions(+) > create mode 100644 Documentation/devicetree/bindings/media/m2m-deinterlace.yaml > My bot found errors running 'make dt_binding_check' on your patch: yamllint warnings/errors: ./Documentation/devicetree/bindings/media/m2m-deinterlace.yaml:10:2: [warning] wrong indentation: expected 2 but found 1 (indentation) dtschema/dtc warnings/errors: doc reference errors (make refcheckdocs): See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250212170901.3881838-2-mattwmajewski@gmail.com The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch. If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date: pip3 install dtschema --upgrade Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] media: dt-bindings: Add dt bindings for m2m-deinterlace device 2025-02-12 19:26 ` Rob Herring (Arm) @ 2025-02-13 19:48 ` Matthew Majewski 0 siblings, 0 replies; 8+ messages in thread From: Matthew Majewski @ 2025-02-13 19:48 UTC (permalink / raw) To: Rob Herring (Arm) Cc: Conor Dooley, Uwe Kleine-Konig, Neil Armstrong, Dr. David Alan Gilbert, Mauro Carvalho Chehab, linux-media, Krzysztof Kozlowski, linux-kernel, Andrzej Pietrasiewicz, devicetree, Hans Verkuil Hi Rob, thanks for the feedback. On Wed, 2025-02-12 at 13:26 -0600, Rob Herring (Arm) wrote: > > If you already ran 'make dt_binding_check' and didn't see the above > error(s), then make sure 'yamllint' is installed and dt-schema is up > to > date: > Yup, I missed a yaml syntax error and didn't notice because I was missing yamllint and dt_binding_check came back ok. Will fix for V2... thanks again. Best, Matthew ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] media: m2m-deinterlace: add device-tree support 2025-02-12 17:08 [PATCH 0/2] media: m2m-deinterlace: add device-tree support Matthew Majewski 2025-02-12 17:09 ` [PATCH 1/2] media: dt-bindings: Add dt bindings for m2m-deinterlace device Matthew Majewski @ 2025-02-12 17:09 ` Matthew Majewski 1 sibling, 0 replies; 8+ messages in thread From: Matthew Majewski @ 2025-02-12 17:09 UTC (permalink / raw) To: Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Hans Verkuil, Dr. David Alan Gilbert, Neil Armstrong, Uwe Kleine-Konig, Andrzej Pietrasiewicz Cc: devicetree, linux-media, linux-kernel, Matthew Majewski Add support for loading the m2m-deinterlace driver through the device-tree. Prefer to query the dma device through dma_request_chan(), which will get the dma device information from the device-tree node if present. Otherwise, fall back to the original dma_request_channel() to preserve backwards compatibility. Signed-off-by: Matthew Majewski <mattwmajewski@gmail.com> --- drivers/media/platform/m2m-deinterlace.c | 25 ++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platform/m2m-deinterlace.c index 5188f3189096..ba4e4ee6ad34 100644 --- a/drivers/media/platform/m2m-deinterlace.c +++ b/drivers/media/platform/m2m-deinterlace.c @@ -11,6 +11,7 @@ #include <linux/interrupt.h> #include <linux/dmaengine.h> #include <linux/platform_device.h> +#include <linux/module.h> #include <media/v4l2-mem2mem.h> #include <media/v4l2-device.h> @@ -914,7 +915,6 @@ static int deinterlace_probe(struct platform_device *pdev) { struct deinterlace_dev *pcdev; struct video_device *vfd; - dma_cap_mask_t mask; int ret = 0; pcdev = devm_kzalloc(&pdev->dev, sizeof(*pcdev), GFP_KERNEL); @@ -923,9 +923,16 @@ static int deinterlace_probe(struct platform_device *pdev) spin_lock_init(&pcdev->irqlock); - dma_cap_zero(mask); - dma_cap_set(DMA_INTERLEAVE, mask); - pcdev->dma_chan = dma_request_channel(mask, NULL, pcdev); + if (pdev->dev.of_node) { + pcdev->dma_chan = dma_request_chan(&pdev->dev, "rxtx"); + } else { + dma_cap_mask_t mask; + + dma_cap_zero(mask); + dma_cap_set(DMA_INTERLEAVE, mask); + pcdev->dma_chan = dma_request_channel(mask, NULL, pcdev); + } + if (!pcdev->dma_chan) return -ENODEV; @@ -989,12 +996,18 @@ static void deinterlace_remove(struct platform_device *pdev) dma_release_channel(pcdev->dma_chan); } +static const struct of_device_id deinterlace_dt_match[] = { + { .compatible = "m2m-deinterlace" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, deinterlace_dt_match); + static struct platform_driver deinterlace_pdrv = { .probe = deinterlace_probe, .remove = deinterlace_remove, .driver = { - .name = MEM2MEM_NAME, + .name = MEM2MEM_NAME, + .of_match_table = deinterlace_dt_match, }, }; module_platform_driver(deinterlace_pdrv); - -- 2.25.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-02-18 8:34 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-02-12 17:08 [PATCH 0/2] media: m2m-deinterlace: add device-tree support Matthew Majewski 2025-02-12 17:09 ` [PATCH 1/2] media: dt-bindings: Add dt bindings for m2m-deinterlace device Matthew Majewski 2025-02-12 17:22 ` Krzysztof Kozlowski 2025-02-12 22:29 ` Matthew Majewski 2025-02-18 8:34 ` Krzysztof Kozlowski 2025-02-12 19:26 ` Rob Herring (Arm) 2025-02-13 19:48 ` Matthew Majewski 2025-02-12 17:09 ` [PATCH 2/2] media: m2m-deinterlace: add device-tree support Matthew Majewski
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox