DCMI BT656 parallel bus mode support
Subsystems (4)
v5 cover DCMI BT656 parallel bus mode support
Add support of BT656 embedded synchronization bus.
This mode allows to save hardware synchro lines hsync & vsync by replacing them with synchro codes embedded in data stream. Add "bus-type" property and make it required so that there is no ambiguity between parallel mode (bus-type=5) and BT656 mode (bus-type=6).
===========
= history =
===========
version 5:
- Add revisited bindings and devicetree with explicit use of "bus-type"
version 4:
- Fix typo in commit message
version 3:
- Fix bus_width print to %u as per Sakari comment
version 2:
- As per Sakari remark, revisit commit message and document BT656 parallel bus mode in bindings
version 1:
- Initial submission
Hugues Fruchet (4):
media: stm32-dcmi: add support of BT656 bus
media: dt-bindings: media: st,stm32-dcmi: add support of BT656 bus
ARM: dts: stm32: set bus-type in DCMI endpoint for stm32mp157c-ev1
board
ARM: dts: stm32: set bus-type in DCMI endpoint for stm32429i-eval
board
.../devicetree/bindings/media/st,stm32-dcmi.yaml | 38 ++++++++++++++++++++++ arch/arm/boot/dts/stm32429i-eval.dts | 1 + arch/arm/boot/dts/stm32mp157c-ev1.dts | 1 + drivers/media/platform/stm32/stm32-dcmi.c | 37 +++++++++++++++++++-- 4 files changed, 75 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
PATCH v5 1/4 media: stm32-dcmi: add support of BT656 bus
Add support of BT656 embedded synchronization bus.
This mode allows to save hardware synchro lines hsync & vsync by replacing them with synchro codes embedded in data stream.
This bus type is only compatible with 8 bits width data bus. Due to reserved values 0x00 & 0xff used for synchro codes, valid data vary from 0x1 to 0xfe, this is up to sensor to clip accordingly pixel data. As a consequence of this clipping, JPEG is not supported with this bus type. DCMI crop feature is also not available with this bus type.
--- drivers/media/platform/stm32/stm32-dcmi.c | 37 +++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-)
drivers/media/platform/stm32/stm32-dcmi.c +35 -2
@@ -157,6 +157,7 @@ struct stm32_dcmi {struct vb2_queue queue;struct v4l2_fwnode_bus_parallel bus; +enum v4l2_mbus_type bus_type;struct completion complete;struct clk *mclk;enum state state;
@@ -777,6 +778,23 @@ static int dcmi_start_streaming(struct vb2_queue *vq, unsigned int count)if (dcmi->bus.flags &V4L2_MBUS_PCLK_SAMPLE_RISING ) val |=CR_PCKPOL ; +/* +* BT656 embedded synchronisation bus mode. +* +* Default SAV/EAV mode is supported here with default codes +* SAV=0xff000080 & EAV=0xff00009d. +* With DCMI this means LSC=SAV=0x80 & LEC=EAV=0x9d. +*/ +if (dcmi->bus_type ==V4L2_MBUS_BT656 ) { + val |=CR_ESS ; + +/* Unmask all codes */ +reg_write (dcmi->regs,DCMI_ESUR ,0xffffffff );/* FEC:LEC:LSC:FSC */ + +/* Trig on LSC=0x80 & LEC=0x9d codes, ignore FSC and FEC */ +reg_write (dcmi->regs,DCMI_ESCR ,0xff9d80ff );/* FEC:LEC:LSC:FSC */ + } +reg_write (dcmi->regs,DCMI_CR , val);/* Set crop */
@@ -1067,8 +1085,9 @@ static int dcmi_set_fmt(struct stm32_dcmi *dcmi, struct v4l2_format *f)if (ret)return ret; -/* Disable crop if JPEG is requested */ -if (pix->pixelformat ==V4L2_PIX_FMT_JPEG ) +/* Disable crop if JPEG is requested or BT656 bus is selected */ +if (pix->pixelformat ==V4L2_PIX_FMT_JPEG && + dcmi->bus_type !=V4L2_MBUS_BT656 ) dcmi->do_crop = false;/* pix to mbus format */
@@ -1592,6 +1611,11 @@ static int dcmi_formats_init(struct stm32_dcmi *dcmi)if (dcmi_formats[i].mbus_code != mbus_code.code)continue ; +/* Exclude JPEG if BT656 bus is selected */ +if (dcmi_formats[i].fourcc ==V4L2_PIX_FMT_JPEG && + dcmi->bus_type ==V4L2_MBUS_BT656 ) +continue ; +/* Code supported, have we got this fourcc yet? */ for (j =0 ; j < num_fmts; j++) if (sd_fmts[j]->fourcc ==
@@ -1873,9 +1897,18 @@ static int dcmi_probe(struct platform_device *pdev)dev_err (&pdev->dev,"CSI bus not supported\n" );return -ENODEV ; } + +if (ep.bus_type ==V4L2_MBUS_BT656 && + ep.bus.parallel.bus_width !=8 ) { +dev_err (&pdev->dev,"BT656 bus conflicts with %u bits bus width (8 bits required)\n" , + ep.bus.parallel.bus_width); +return -ENODEV ; + } + dcmi->bus.flags = ep.bus.parallel.flags; dcmi->bus.bus_width = ep.bus.parallel.bus_width; dcmi->bus.data_shift = ep.bus.parallel.data_shift; + dcmi->bus_type = ep.bus_type; irq =platform_get_irq (pdev,0 );if (irq <=0 )
Signature · 1 line
2.7.4
PATCH v5 2/4 media: dt-bindings: media: st,stm32-dcmi: add support of BT656 bus
In reply to Hugues FruchetAdd support of BT656 embedded synchronization bus mode in DCMI driver. Add "bus-type" property and make it required so that there is no ambiguity between parallel mode (bus-type=5) and BT656 mode (bus-type=6). BT656 mode allows to save hardware synchro lines hsync & vsync by replacing them with synchro codes embedded in data stream, hence hsync-active & vsync-active properties are useless in this mode.
With DCMI, BT656 bus mode is only compatible with 8 bits width data bus.
--- .../devicetree/bindings/media/st,stm32-dcmi.yaml | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+)
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +38 -0
@@ -44,6 +44,43 @@ properties: bindings defined in Documentation/devicetree/bindings/media/video-interfaces.txt. + properties: + endpoint: + type: object + + properties: + bus-type: + enum: [5, 6] + default: 5 + + bus-width: + enum: [8, 10, 12, 14] + default: 8 + + remote-endpoint: true + + allOf: + - if: + properties: + bus-type: + const: 6 + + then: + properties: + hsync-active: false + vsync-active: false + bus-width: + enum: [8] + + required: + - remote-endpoint + - bus-type + - pclk-sample + + unevaluatedProperties: false + + additionalProperties: false + required: - compatible - reg
@@ -75,6 +112,7 @@ examples: port { dcmi_0: endpoint { remote-endpoint = <&ov5640_0>; + bus-type = <5>; bus-width = <8>; hsync-active = <0>; vsync-active = <0>;
Signature · 1 line
2.7.4
Re: [PATCH v5 2/4] media: dt-bindings: media: st, stm32-dcmi: add support of BT656 bus
Quoted 8 lines · Hugues Fruchet
Add support of BT656 embedded synchronization bus mode in DCMI driver. Add "bus-type" property and make it required so that there is no ambiguity between parallel mode (bus-type=5) and BT656 mode (bus-type=6). BT656 mode allows to save hardware synchro lines hsync & vsync by replacing them with synchro codes embedded in data stream, hence hsync-active & vsync-active properties are useless in this mode.
With DCMI, BT656 bus mode is only compatible with 8 bits width data bus.
Quoted 5 lines
Signed-off-by Hugues Fruchet <[email protected]>--- .../devicetree/bindings/media/st,stm32-dcmi.yaml | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+)
PATCH v5 3/4 ARM: dts: stm32: set bus-type in DCMI endpoint for stm32mp157c-ev1 board
In reply to Hugues FruchetExplicitly set bus-type to parallel mode in DCMI endpoint (bus-type=5).
--- arch/arm/boot/dts/stm32mp157c-ev1.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/stm32mp157c-ev1.dts +1 -0
@@ -90,6 +90,7 @@ port { dcmi_0: endpoint { remote-endpoint = <&ov5640_0>; + bus-type = <5>; bus-width = <8>; hsync-active = <0>; vsync-active = <0>;
Signature · 1 line
2.7.4
PATCH v5 4/4 ARM: dts: stm32: set bus-type in DCMI endpoint for stm32429i-eval board
In reply to Hugues FruchetExplicitly set bus-type to parallel mode in DCMI endpoint (bus-type=5).
--- arch/arm/boot/dts/stm32429i-eval.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/stm32429i-eval.dts +1 -0
@@ -188,6 +188,7 @@ port { dcmi_0: endpoint { remote-endpoint = <&ov2640_0>; + bus-type = <5>; bus-width = <8>; hsync-active = <0>; vsync-active = <0>;
Signature · 1 line
2.7.4
Hi Hugues,
Quoted 5 lines · Hugues Fruchet
Add support of BT656 embedded synchronization bus.
This mode allows to save hardware synchro lines hsync & vsync by replacing them with synchro codes embedded in data stream. Add "bus-type" property and make it required so that there is no ambiguity between parallel mode (bus-type=5) and BT656 mode (bus-type=6).
Thanks for the update.
Regarding the two last patches, which tree they're intended to go to? Something else than media? I can also take them if it's ok for the maintainer of the "right" tree.
Signature · 3 lines
Kind regards, Sakari Ailus
Hi Huges
Quoted 33 lines · Hugues Fruchet
Add support of BT656 embedded synchronization bus.
This mode allows to save hardware synchro lines hsync & vsync by replacing them with synchro codes embedded in data stream. Add "bus-type" property and make it required so that there is no ambiguity between parallel mode (bus-type=5) and BT656 mode (bus-type=6).===========
= history =
===========
version 5:
- Add revisited bindings and devicetree with explicit use of "bus-type"version 4:
- Fix typo in commit messageversion 3:
- Fixbus_widthprint to %u as per Sakari commentversion 2:
- As per Sakari remark, revisit commit message and document BT656 parallel bus mode in bindingsversion 1:
- Initial submissionHugues Fruchet (4):
media: stm32-dcmi: add support of BT656 bus
media: dt-bindings: media: st,stm32-dcmi: add support of BT656 bus
ARM: dts: stm32: set bus-type in DCMI endpoint for stm32mp157c-ev1
board
ARM: dts: stm32: set bus-type in DCMI endpoint for stm32429i-eval
board
Quoted 6 lines
.../devicetree/bindings/media/st,stm32-dcmi.yaml | 38 ++++++++++++++++++++++ arch/arm/boot/dts/stm32429i-eval.dts | 1 + arch/arm/boot/dts/stm32mp157c-ev1.dts | 1 + drivers/media/platform/stm32/stm32-dcmi.c | 37 +++++++++++++++++++-- 4 files changed, 75 insertions(+), 2 deletions(-)
I'll take DT patches on stm32-next tree.
regards
alex
Hi Alexandre,
Quoted 36 lines · Alexandre Torgue
Hi Huges
Quoted 33 lines · Hugues Fruchet
Add support of BT656 embedded synchronization bus.
This mode allows to save hardware synchro lines hsync & vsync by replacing them with synchro codes embedded in data stream. Add "bus-type" property and make it required so that there is no ambiguity between parallel mode (bus-type=5) and BT656 mode (bus-type=6).===========
= history =
===========
version 5:
- Add revisited bindings and devicetree with explicit use of "bus-type"version 4:
- Fix typo in commit messageversion 3:
- Fixbus_widthprint to %u as per Sakari commentversion 2:
- As per Sakari remark, revisit commit message and document BT656 parallel bus mode in bindingsversion 1:
- Initial submissionHugues Fruchet (4):
media: stm32-dcmi: add support of BT656 bus
media: dt-bindings: media: st,stm32-dcmi: add support of BT656 bus
ARM: dts: stm32: set bus-type in DCMI endpoint for stm32mp157c-ev1
board
ARM: dts: stm32: set bus-type in DCMI endpoint for stm32429i-eval
board
Quoted 8 lines
Quoted 6 lines
.../devicetree/bindings/media/st,stm32-dcmi.yaml | 38 ++++++++++++++++++++++ arch/arm/boot/dts/stm32429i-eval.dts | 1 + arch/arm/boot/dts/stm32mp157c-ev1.dts | 1 + drivers/media/platform/stm32/stm32-dcmi.c | 37 +++++++++++++++++++-- 4 files changed, 75 insertions(+), 2 deletions(-)I'll take DT patches on stm32-next tree.
Just checking: that is only the two last patches in the set, or also the binding patch?
Signature · 3 lines
Regards, Sakari Ailus
Hi Sakari
Quoted 46 lines · Sakari Ailus
Hi Alexandre,
Quoted 43 lines · Alexandre Torgue
Hi Huges
Quoted 39 lines · Hugues Fruchet
Add support of BT656 embedded synchronization bus.
This mode allows to save hardware synchro lines hsync & vsync by replacing them with synchro codes embedded in data stream. Add "bus-type" property and make it required so that there is no ambiguity between parallel mode (bus-type=5) and BT656 mode (bus-type=6).===========
= history =
===========
version 5:
- Add revisited bindings and devicetree with explicit use of "bus-type"version 4:
- Fix typo in commit messageversion 3:
- Fixbus_widthprint to %u as per Sakari commentversion 2:
- As per Sakari remark, revisit commit message and document BT656 parallel bus mode in bindingsversion 1:
- Initial submissionHugues Fruchet (4):
media: stm32-dcmi: add support of BT656 bus
media: dt-bindings: media: st,stm32-dcmi: add support of BT656 bus
ARM: dts: stm32: set bus-type in DCMI endpoint for stm32mp157c-ev1
board
ARM: dts: stm32: set bus-type in DCMI endpoint for stm32429i-eval
board.../devicetree/bindings/media/st,stm32-dcmi.yaml | 38 ++++++++++++++++++++++ arch/arm/boot/dts/stm32429i-eval.dts | 1 + arch/arm/boot/dts/stm32mp157c-ev1.dts | 1 + drivers/media/platform/stm32/stm32-dcmi.c | 37 +++++++++++++++++++-- 4 files changed, 75 insertions(+), 2 deletions(-)
Quoted 4 lines
Quoted 1 line
I'll take DT patches on stm32-next tree.
Just checking: that is only the two last patches in the set, or also the binding patch?
Usually I let drivers/subsystem maintainer taking dt-bindings patches with drivers patches. (If binding changes come only with dts(i) patches I take them in my tree)
-->So yes I'll take only the last two patches.
Regards
alex
Quoted 51 lines · Alexandre Torgue
Hi Sakari
Quoted 48 lines · Sakari Ailus
Hi Alexandre,
Quoted 44 lines · Alexandre Torgue
Hi Huges
Quoted 33 lines · Hugues Fruchet
Add support of BT656 embedded synchronization bus.
This mode allows to save hardware synchro lines hsync & vsync by replacing them with synchro codes embedded in data stream. Add "bus-type" property and make it required so that there is no ambiguity between parallel mode (bus-type=5) and BT656 mode (bus-type=6).===========
= history =
===========
version 5:
- Add revisited bindings and devicetree with explicit use of "bus-type"version 4:
- Fix typo in commit messageversion 3:
- Fixbus_widthprint to %u as per Sakari commentversion 2:
- As per Sakari remark, revisit commit message and document BT656 parallel bus mode in bindingsversion 1:
- Initial submissionHugues Fruchet (4):
media: stm32-dcmi: add support of BT656 bus
media: dt-bindings: media: st,stm32-dcmi: add support of BT656 bus
ARM: dts: stm32: set bus-type in DCMI endpoint for stm32mp157c-ev1
board
ARM: dts: stm32: set bus-type in DCMI endpoint for stm32429i-eval
boardQuoted 6 lines
.../devicetree/bindings/media/st,stm32-dcmi.yaml | 38 ++++++++++++++++++++++ arch/arm/boot/dts/stm32429i-eval.dts | 1 + arch/arm/boot/dts/stm32mp157c-ev1.dts | 1 + drivers/media/platform/stm32/stm32-dcmi.c | 37 +++++++++++++++++++-- 4 files changed, 75 insertions(+), 2 deletions(-)I'll take DT patches on stm32-next tree.
Quoted 8 lines
Quoted 2 lines
Just checking: that is only the two last patches in the set, or also the binding patch?
Usually I let
drivers/subsystemmaintainer taking dt-bindings patches with drivers patches.
(If binding changes come only with dts(i) patches I take them in my tree)-->So yes I'll take only the last two patches.
Ack, thanks!
Signature · 1 line
Sakari Ailus
Hi Hugues
Quoted 33 lines · Hugues Fruchet
Add support of BT656 embedded synchronization bus.
This mode allows to save hardware synchro lines hsync & vsync by replacing them with synchro codes embedded in data stream. Add "bus-type" property and make it required so that there is no ambiguity between parallel mode (bus-type=5) and BT656 mode (bus-type=6).===========
= history =
===========
version 5:
- Add revisited bindings and devicetree with explicit use of "bus-type"version 4:
- Fix typo in commit messageversion 3:
- Fixbus_widthprint to %u as per Sakari commentversion 2:
- As per Sakari remark, revisit commit message and document BT656 parallel bus mode in bindingsversion 1:
- Initial submissionHugues Fruchet (4):
media: stm32-dcmi: add support of BT656 bus
media: dt-bindings: media: st,stm32-dcmi: add support of BT656 bus
ARM: dts: stm32: set bus-type in DCMI endpoint for stm32mp157c-ev1
board
ARM: dts: stm32: set bus-type in DCMI endpoint for stm32429i-eval
board
Quoted 6 lines
.../devicetree/bindings/media/st,stm32-dcmi.yaml | 38 ++++++++++++++++++++++ arch/arm/boot/dts/stm32429i-eval.dts | 1 + arch/arm/boot/dts/stm32mp157c-ev1.dts | 1 + drivers/media/platform/stm32/stm32-dcmi.c | 37 +++++++++++++++++++-- 4 files changed, 75 insertions(+), 2 deletions(-)
DT patches applied on stm32-next.
Cheers
Alex