DCMI BT656 parallel bus mode support
Subsystems (4)
v4 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. This mode is enabled when hsync-active & vsync-active fields are not specified in devicetree.
===========
= history =
===========
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 (2):
media: stm32-dcmi: add support of BT656 bus
media: dt-bindings: media: st,stm32-dcmi: Add support of BT656
.../devicetree/bindings/media/st,stm32-dcmi.yaml | 30 ++++++++++++++++++ drivers/media/platform/stm32/stm32-dcmi.c | 37 ++++++++++++++++++++-- 2 files changed, 65 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
PATCH v4 1/2 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 v4 2/2 media: dt-bindings: media: st,stm32-dcmi: Add support of BT656
In reply to Hugues FruchetAdd support of BT656 parallel bus mode in DCMI. This mode is enabled when hsync-active & vsync-active fields are not specified.
--- .../devicetree/bindings/media/st,stm32-dcmi.yaml | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+)
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +30 -0
@@ -44,6 +44,36 @@ properties: bindings defined in Documentation/devicetree/bindings/media/video-interfaces.txt. + properties: + endpoint: + type: object + + properties: + bus-width: true + + hsync-active: + description: + If both HSYNC and VSYNC polarities are not specified, BT656 + embedded synchronization is selected. + default: 0 + + vsync-active: + description: + If both HSYNC and VSYNC polarities are not specified, BT656 + embedded synchronization is selected. + default: 0 + + pclk-sample: true + + remote-endpoint: true + + required: + - remote-endpoint + + additionalProperties: false + + additionalProperties: false + required: - compatible - reg
Signature · 1 line
2.7.4
Re: [PATCH v4 2/2] media: dt-bindings: media: st,stm32-dcmi: Add support of BT656
Hi Hugues,
Quoted 25 lines · Hugues Fruchet
Add support of BT656 parallel bus mode in DCMI. This mode is enabled when hsync-active & vsync-active fields are not specified.
Signed-off-by Hugues Fruchet <[email protected]>--- .../devicetree/bindings/media/st,stm32-dcmi.yaml | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+)Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +8
-0@@ -44,6 +44,36 @@ properties: bindings defined in Documentation/devicetree/bindings/media/video-interfaces.txt. + properties: + endpoint: + type: object + + properties: + bus-width: true + + hsync-active:
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml properties: · line 64
Quoted 10 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +10
-0+ description: + If both HSYNC and VSYNC polarities are not specified, BT656 + embedded synchronization is selected. + default: 0 + + vsync-active: + description: + If both HSYNC and VSYNC polarities are not specified, BT656 + embedded synchronization is selected. + default: 0
Should I understand this as if the polarities were not specified, BT.656 will be used? The bindings previously documented BT.601 (parallel) only, so it was somewhat ambigious to begin with. Is there a risk of interpreting old BT.601 bindings as BT.656? With bus-type property, I believe you could avoid at least that risk.
Also not specifying at least one of the default values leads to BT.656 without bus-type. That could be addressed by removing the defaults.
Quoted 15 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +12
-0+ + pclk-sample: true + + remote-endpoint: true + + required: + - remote-endpoint + + additionalProperties: false + + additionalProperties: false + required: - compatible - reg
Signature · 3 lines
Regards, Sakari Ailus
Re: [PATCH v4 2/2] media: dt-bindings: media: st,stm32-dcmi: Add support of BT656
Hi Sakari,
Quoted 33 lines · Sakari Ailus
Hi Hugues,
Quoted 30 lines · Hugues Fruchet
Add support of BT656 parallel bus mode in DCMI. This mode is enabled when hsync-active & vsync-active fields are not specified.
Signed-off-by Hugues Fruchet <[email protected]>--- .../devicetree/bindings/media/st,stm32-dcmi.yaml | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+)Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +13
-0@@ -44,6 +44,36 @@ properties: bindings defined in Documentation/devicetree/bindings/media/video-interfaces.txt. + properties: + endpoint: + type: object + + properties: + bus-width: true + + hsync-active: + description: + If both HSYNC and VSYNC polarities are not specified, BT656 + embedded synchronization is selected. + default: 0 +
Quoted 8 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml properties: · line 64
Quoted 5 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +5
-0+ vsync-active: + description: + If both HSYNC and VSYNC polarities are not specified, BT656 + embedded synchronization is selected. + default: 0Should I understand this as if the polarities were not specified, BT.656 will be used?
Yes, this is what is documented in video-interfaces.txt:
"
Note, that if HSYNC and VSYNC polarities are not specified, embedded synchronization may be required, where supported.
"
and
"
/* If hsync-active/vsync-active are missing, embedded BT.656 sync is used */ hsync-active = <0>; /* Active low */ vsync-active = <0>; /* Active low */
"
and I found also this in Documentation/devicetree/bindings/media/renesas,vin.yaml "
hsync-active:
description:
If both HSYNC and VSYNC polarities are not specified,
embedded
synchronization is selected.
default: 1
vsync-active:
description:
If both HSYNC and VSYNC polarities are not specified,
embedded
synchronization is selected.
default: 1
"
In the other hand I've found few occurences of "bus-type" (marvell,mmp2-ccic.yaml), it is why I asked you if "bus-type" is the new way to go versus previous way to signal BT656 (without hsync/vsync) ? As explained previously, I prefer this last way for backward compatibility.
The bindings previously documented BT.601 (parallel) only, so
Quoted 2 lines
it was somewhat ambigious to begin with. Is there a risk of interpreting old BT.601 bindings as BT.656?
I don't think so.
With bus-type property, I believe you could
Quoted 1 line
avoid at least that risk.
yes but as explained, I'll prefer not to amend current boards device tree files.
Quoted 4 lines
Also not specifying at least one of the default values leads to BT.656 without bus-type. That could be addressed by removing the defaults.
I'm new to yaml, I've taken that from renesas,vin.yaml. Should I just drop the "default: 1" lines ?
Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +7
-0+ + pclk-sample: true + + remote-endpoint: true + + required: + - remote-endpoint
Quoted 9 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml properties: · line 79
Quoted 8 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +5
-0+ + additionalProperties: false + + additionalProperties: false + required: - compatible - reg
BR,
Hugues.
Re: [PATCH v4 2/2] media: dt-bindings: media: st,stm32-dcmi: Add support of BT656
Hi Hugues,
Quoted 67 lines · Hugues FRUCHET
Hi Sakari,
Quoted 33 lines · Sakari Ailus
Hi Hugues,
Quoted 30 lines · Hugues Fruchet
Add support of BT656 parallel bus mode in DCMI. This mode is enabled when hsync-active & vsync-active fields are not specified.
Signed-off-by Hugues Fruchet <[email protected]>--- .../devicetree/bindings/media/st,stm32-dcmi.yaml | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+)Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +13
-0@@ -44,6 +44,36 @@ properties: bindings defined in Documentation/devicetree/bindings/media/video-interfaces.txt. + properties: + endpoint: + type: object + + properties: + bus-width: true + + hsync-active: + description: + If both HSYNC and VSYNC polarities are not specified, BT656 + embedded synchronization is selected. + default: 0 +Quoted 8 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml properties: · line 64
Quoted 5 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +5
-0+ vsync-active: + description: + If both HSYNC and VSYNC polarities are not specified, BT656 + embedded synchronization is selected. + default: 0Should I understand this as if the polarities were not specified, BT.656 will be used?
Yes, this is what is documented in video-interfaces.txt:
"
Note, that if HSYNC and VSYNC polarities are not specified, embedded synchronization may be required, where supported.
"
and
"/* If hsync-active/vsync-active are missing, embedded BT.656 sync is used */ hsync-active = <0>; /* Active low */ vsync-active = <0>; /* Active low */"
and I found also this inDocumentation/devicetree/bindings/media/renesas,vin.yaml"
hsync-active:
description:
If both HSYNC and VSYNC polarities are not specified,
embedded
synchronization is selected.
default: 1
Quoted 6 lines
vsync-active:
description:
If both HSYNC and VSYNC polarities are not specified,
embedded
synchronization is selected.
default: 1
Having the defaults leads to somewhat weird behaviour: specifying the default value on either property changes the bus type.
Quoted 6 lines
"
In the other hand I've found few occurences of "bus-type" (marvell,mmp2-ccic.yaml), it is why I asked you if "bus-type" is the new way to go versus previous way to signal BT656 (without hsync/vsync) ? As explained previously, I prefer this last way for backward compatibility.
If you have a default for bus-type (BT.601), this won't be a problem.
The old DT bindings were somewhat, well, opportunistic. The v4l2-of framework-let did its best and sometimes it worked. The behaviour is still supported but not encouraged in new bindings.
Quoted 11 lines
The bindings previously documented BT.601 (parallel) only, so
Quoted 2 lines
it was somewhat ambigious to begin with. Is there a risk of interpreting old BT.601 bindings as BT.656?
I don't think so.
With bus-type property, I believe you could
Quoted 1 line
avoid at least that risk.
yes but as explained, I'll prefer not to amend current boards device tree files.
I don't think it matters from this point of view --- you can have a default bus-type.
Quoted 7 lines
Quoted 5 lines
Also not specifying at least one of the default values leads to BT.656 without bus-type. That could be addressed by removing the defaults.
I'm new to yaml, I've taken that from renesas,vin.yaml. Should I just drop the "default: 1" lines ?
That's one option, yes. Then you have to have those for BT.601 and it's no longer ambiguous.
Signature · 3 lines
Regards, Sakari Ailus
Re: [PATCH v4 2/2] media: dt-bindings: media: st,stm32-dcmi: Add support of BT656
Hi Sakari,
+ Jacopo for his work on ov772x binding related to BT656
Quoted 87 lines · Sakari Ailus
Hi Hugues,
Quoted 67 lines · Hugues FRUCHET
Hi Sakari,
Quoted 33 lines · Sakari Ailus
Hi Hugues,
Quoted 30 lines · Hugues Fruchet
Add support of BT656 parallel bus mode in DCMI. This mode is enabled when hsync-active & vsync-active fields are not specified.
Signed-off-by Hugues Fruchet <[email protected]>--- .../devicetree/bindings/media/st,stm32-dcmi.yaml | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+)Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +13
-0@@ -44,6 +44,36 @@ properties: bindings defined in Documentation/devicetree/bindings/media/video-interfaces.txt. + properties: + endpoint: + type: object + + properties: + bus-width: true + + hsync-active: + description: + If both HSYNC and VSYNC polarities are not specified, BT656 + embedded synchronization is selected. + default: 0 +Quoted 8 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml properties: · line 64
Quoted 5 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +5
-0+ vsync-active: + description: + If both HSYNC and VSYNC polarities are not specified, BT656 + embedded synchronization is selected. + default: 0Should I understand this as if the polarities were not specified, BT.656 will be used?
Yes, this is what is documented in video-interfaces.txt:
"
Note, that if HSYNC and VSYNC polarities are not specified, embedded synchronization may be required, where supported.
"
and
"/* If hsync-active/vsync-active are missing, embedded BT.656 sync is used */ hsync-active = <0>; /* Active low */ vsync-active = <0>; /* Active low */"
and I found also this inDocumentation/devicetree/bindings/media/renesas,vin.yaml
"
hsync-active:
description:
If both HSYNC and VSYNC polarities are not specified,
embedded
synchronization is selected.
default: 1Quoted 6 lines
vsync-active:
description:
If both HSYNC and VSYNC polarities are not specified,
embedded
synchronization is selected.
default: 1Having the defaults leads to somewhat weird behaviour: specifying the default value on either property changes the bus type.
Quoted 6 lines
"
In the other hand I've found few occurences of "bus-type" (marvell,mmp2-ccic.yaml), it is why I asked you if "bus-type" is the new way to go versus previous way to signal BT656 (without hsync/vsync) ? As explained previously, I prefer this last way for backward compatibility.
Quoted 6 lines
If you have a default for bus-type (BT.601), this won't be a problem.
The old DT bindings were somewhat, well, opportunistic. The v4l2-of framework-let did its best and sometimes it worked. The behaviour is still supported but not encouraged in new bindings.
OK, so let's go for the new way.
I've found an interesting patch from Jacopo that is of great help:
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/
Here is a draft proposal before I push a new version, please comment:
properties:
bus-type:
enum: [5, 6]
default: 5
bus-width:
enum: [8, 10, 12, 14]
default: 8
hsync-active:
enum: [0, 1]
default: 0
vsync-active:
enum: [0, 1]
default: 0
pclk-sample:
enum: [0, 1]
default: 0
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
unevaluatedProperties: falseUnfortunately, the "default: 5" for bus-type is not working !! If we don't specify "bus-type" in example, dt_binding_check is failing as if default was 6, it's hardly understandable (see below) !
port {
dcmi_0: endpoint {
remote-endpoint = <&ov5640_0>;
bus-width = <10>;
hsync-active = <0>;
vsync-active = <0>;
pclk-sample = <1>;
};=> this should be OK but error claimed:
DTCDocumentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yaml
CHECKDocumentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yaml Documentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yaml:
dcmi@4c006000: port:endpoint:vsync-active: False schema does not allow [[0]] dcmi@4c006000: port:endpoint:hsync-active: False schema does not allow [[0]] dcmi@4c006000: port:endpoint:bus-width:0:0: 10 is not one of [8]
From schema: Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
=> if "bus-type" is explicitly set to 5, all is fine (see below) !
port {
dcmi_0: endpoint {
remote-endpoint = <&ov5640_0>;
bus-type = <5>;
bus-width = <10>;
hsync-active = <0>;
vsync-active = <0>;
pclk-sample = <1>;
};
}; DTCDocumentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yaml
CHECKDocumentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yaml ~/.../media_tree$
Quoted 17 lines
Quoted 11 lines
The bindings previously documented BT.601 (parallel) only, so
Quoted 2 lines
it was somewhat ambigious to begin with. Is there a risk of interpreting old BT.601 bindings as BT.656?
I don't think so.
With bus-type property, I believe you could
Quoted 1 line
avoid at least that risk.
yes but as explained, I'll prefer not to amend current boards device tree files.
I don't think it matters from this point of view --- you can have a default bus-type.
Quoted 2 lines
Quoted 2 lines
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Also not specifying at least one of the default values leads to BT.656 without bus-type. That could be addressed by removing the defaults.
I'm new to yaml, I've taken that from renesas,vin.yaml. Should I just drop the "default: 1" lines ?
That's one option, yes. Then you have to have those for BT.601 and it's no longer ambiguous.
BR,
Hugues.
Rob Herring
maintainerRe: [PATCH v4 2/2] media: dt-bindings: media: st,stm32-dcmi: Add support of BT656
Quoted 105 lines · Hugues FRUCHET
Hi Sakari,
+ Jacopo for his work on ov772x binding related to BT656
Quoted 87 lines · Sakari Ailus
Hi Hugues,
Quoted 67 lines · Hugues FRUCHET
Hi Sakari,
Quoted 33 lines · Sakari Ailus
Hi Hugues,
Quoted 30 lines · Hugues Fruchet
Add support of BT656 parallel bus mode in DCMI. This mode is enabled when hsync-active & vsync-active fields are not specified.
Signed-off-by Hugues Fruchet <[email protected]>--- .../devicetree/bindings/media/st,stm32-dcmi.yaml | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+)Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +13
-0@@ -44,6 +44,36 @@ properties: bindings defined in Documentation/devicetree/bindings/media/video-interfaces.txt. + properties: + endpoint: + type: object + + properties: + bus-width: true + + hsync-active: + description: + If both HSYNC and VSYNC polarities are not specified, BT656 + embedded synchronization is selected. + default: 0 +Quoted 8 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml properties: · line 64
Quoted 5 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +5
-0+ vsync-active: + description: + If both HSYNC and VSYNC polarities are not specified, BT656 + embedded synchronization is selected. + default: 0Should I understand this as if the polarities were not specified, BT.656 will be used?
Yes, this is what is documented in video-interfaces.txt:
"
Note, that if HSYNC and VSYNC polarities are not specified, embedded synchronization may be required, where supported.
"
and
"/* If hsync-active/vsync-active are missing, embedded BT.656 sync is used */ hsync-active = <0>; /* Active low */ vsync-active = <0>; /* Active low */"
and I found also this inDocumentation/devicetree/bindings/media/renesas,vin.yaml
"
hsync-active:
description:
If both HSYNC and VSYNC polarities are not specified,
embedded
synchronization is selected.
default: 1Quoted 6 lines
vsync-active:
description:
If both HSYNC and VSYNC polarities are not specified,
embedded
synchronization is selected.
default: 1Having the defaults leads to somewhat weird behaviour: specifying the default value on either property changes the bus type.
Quoted 6 lines
"
In the other hand I've found few occurences of "bus-type" (marvell,mmp2-ccic.yaml), it is why I asked you if "bus-type" is the new way to go versus previous way to signal BT656 (without hsync/vsync) ? As explained previously, I prefer this last way for backward compatibility.
Quoted 6 lines
If you have a default for bus-type (BT.601), this won't be a problem.
The old DT bindings were somewhat, well, opportunistic. The v4l2-of framework-let did its best and sometimes it worked. The behaviour is still supported but not encouraged in new bindings.
OK, so let's go for the new way.
I've found an interesting patch from Jacopo that is of great help:
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/Here is a draft proposal before I push a new version, please comment:
Quoted 11 lines
properties:
bus-type:
enum: [5, 6]
default: 5
bus-width:
enum: [8, 10, 12, 14]
default: 8
hsync-active:
enum: [0, 1]For common properties, you can assume there's a common schema. As 0 and 1 are the only possible values, you don't need to define them here unless only a subset is valid for this device.
Quoted 10 lines
default: 0
vsync-active:
enum: [0, 1]
default: 0
pclk-sample:
enum: [0, 1]
default: 0Quoted 7 lines
remote-endpoint: true
allOf:
- if:
properties:
bus-type:
const: 6To fix the error, you need:
required:
- bus-type
The problem is the above schema is also true if the property is not present.
Quoted 83 lines
then:
properties:
hsync-active: false
vsync-active: false
bus-width:
enum: [8]required:
- remote-endpointunevaluatedProperties: false
Unfortunately, the "default: 5" for bus-type is not working !! If we don't specify "bus-type" in example,
dt_binding_checkis failing as if default was 6, it's hardly understandable (see below) !port { dcmi_0: endpoint { remote-endpoint = <&ov5640_0>; bus-width = <10>; hsync-active = <0>; vsync-active = <0>; pclk-sample = <1>; };=> this should be OK but error claimed:
DTCDocumentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yaml
CHECKDocumentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yamlDocumentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yaml:
dcmi@4c006000: port:endpoint:vsync-active: False schema does not allow [[0]] dcmi@4c006000: port:endpoint:hsync-active: False schema does not allow [[0]] dcmi@4c006000: port:endpoint:bus-width:0:0: 10 is not one of [8]
From schema:Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml=> if "bus-type" is explicitly set to 5, all is fine (see below) !
port { dcmi_0: endpoint { remote-endpoint = <&ov5640_0>; bus-type = <5>; bus-width = <10>; hsync-active = <0>; vsync-active = <0>; pclk-sample = <1>; }; };DTC
Documentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yaml
CHECKDocumentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yaml~/.../media_tree$Quoted 17 lines
Quoted 11 lines
The bindings previously documented BT.601 (parallel) only, so
Quoted 2 lines
it was somewhat ambigious to begin with. Is there a risk of interpreting old BT.601 bindings as BT.656?
I don't think so.
With bus-type property, I believe you could
Quoted 1 line
avoid at least that risk.
yes but as explained, I'll prefer not to amend current boards device tree files.
I don't think it matters from this point of view --- you can have a default bus-type.
Quoted 2 lines
Quoted 2 lines
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Also not specifying at least one of the default values leads to BT.656 without bus-type. That could be addressed by removing the defaults.
I'm new to yaml, I've taken that from renesas,vin.yaml. Should I just drop the "default: 1" lines ?
That's one option, yes. Then you have to have those for BT.601 and it's no longer ambiguous.
BR,
Hugues.
Re: [PATCH v4 2/2] media: dt-bindings: media: st,stm32-dcmi: Add support of BT656
Hi Rob,
Quoted 95 lines · Rob Herring
Quoted 94 lines · Hugues FRUCHET
Hi Sakari,
+ Jacopo for his work on ov772x binding related to BT656
Quoted 89 lines · Sakari Ailus
Hi Hugues,
Quoted 67 lines · Hugues FRUCHET
Hi Sakari,
Quoted 33 lines · Sakari Ailus
Hi Hugues,
Quoted 30 lines · Hugues Fruchet
Add support of BT656 parallel bus mode in DCMI. This mode is enabled when hsync-active & vsync-active fields are not specified.
Signed-off-by Hugues Fruchet <[email protected]>--- .../devicetree/bindings/media/st,stm32-dcmi.yaml | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+)Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +13
-0@@ -44,6 +44,36 @@ properties: bindings defined in Documentation/devicetree/bindings/media/video-interfaces.txt. + properties: + endpoint: + type: object + + properties: + bus-width: true + + hsync-active: + description: + If both HSYNC and VSYNC polarities are not specified, BT656 + embedded synchronization is selected. + default: 0 +Quoted 8 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml properties: · line 64
Quoted 5 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +5
-0+ vsync-active: + description: + If both HSYNC and VSYNC polarities are not specified, BT656 + embedded synchronization is selected. + default: 0Should I understand this as if the polarities were not specified, BT.656 will be used?
Yes, this is what is documented in video-interfaces.txt:
"
Note, that if HSYNC and VSYNC polarities are not specified, embedded synchronization may be required, where supported.
"
and
"/* If hsync-active/vsync-active are missing, embedded BT.656 sync is used */ hsync-active = <0>; /* Active low */ vsync-active = <0>; /* Active low */"
and I found also this inDocumentation/devicetree/bindings/media/renesas,vin.yaml
"
hsync-active:
description:
If both HSYNC and VSYNC polarities are not specified,
embedded
synchronization is selected.
default: 1Quoted 6 lines
vsync-active:
description:
If both HSYNC and VSYNC polarities are not specified,
embedded
synchronization is selected.
default: 1Having the defaults leads to somewhat weird behaviour: specifying the default value on either property changes the bus type.
Quoted 6 lines
"
In the other hand I've found few occurences of "bus-type" (marvell,mmp2-ccic.yaml), it is why I asked you if "bus-type" is the new way to go versus previous way to signal BT656 (without hsync/vsync) ? As explained previously, I prefer this last way for backward compatibility.
If you have a default for bus-type (BT.601), this won't be a problem.
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
The old DT bindings were somewhat, well, opportunistic. The v4l2-of framework-let did its best and sometimes it worked. The behaviour is still supported but not encouraged in new bindings.
OK, so let's go for the new way.
I've found an interesting patch from Jacopo that is of great help:
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/
I wonder if Jacopo tested it. The idea seems interesting nonetheless.
Quoted 37 lines
Quoted 14 lines
Here is a draft proposal before I push a new version, please comment:
properties: bus-type: enum: [5, 6] default: 5 bus-width: enum: [8, 10, 12, 14] default: 8 hsync-active: enum: [0, 1]For common properties, you can assume there's a common schema. As 0 and 1 are the only possible values, you don't need to define them here unless only a subset is valid for this device.
Quoted 10 lines
default: 0 vsync-active: enum: [0, 1] default: 0 pclk-sample: enum: [0, 1] default: 0Quoted 7 lines
remote-endpoint: true allOf: - if: properties: bus-type: const: 6
Quoted 7 lines
To fix the error, you need:
required:
- bus-typeThe problem is the above schema is also true if the property is not present.
Hmm. The idea was that we could keep this consistent with old bindings that only documented parallel mode, and thus didn't need bus-type. This is actually quite common --- adding support for something that wasn't known or cared for during the original review.
I guess this could be done in the driver, too, adding a comment that the bindings earlier did not require it.
Quoted 84 lines
Quoted 84 lines
then:
properties:
hsync-active: false
vsync-active: false
bus-width:
enum: [8]required:
- remote-endpointunevaluatedProperties: false
Unfortunately, the "default: 5" for bus-type is not working !! If we don't specify "bus-type" in example,
dt_binding_checkis failing as if default was 6, it's hardly understandable (see below) !port { dcmi_0: endpoint { remote-endpoint = <&ov5640_0>; bus-width = <10>; hsync-active = <0>; vsync-active = <0>; pclk-sample = <1>; };=> this should be OK but error claimed:
DTCDocumentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yaml
CHECKDocumentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yamlDocumentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yaml:
dcmi@4c006000: port:endpoint:vsync-active: False schema does not allow [[0]] dcmi@4c006000: port:endpoint:hsync-active: False schema does not allow [[0]] dcmi@4c006000: port:endpoint:bus-width:0:0: 10 is not one of [8]
From schema:Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml=> if "bus-type" is explicitly set to 5, all is fine (see below) !
port { dcmi_0: endpoint { remote-endpoint = <&ov5640_0>; bus-type = <5>; bus-width = <10>; hsync-active = <0>; vsync-active = <0>; pclk-sample = <1>; }; };DTC
Documentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yaml
CHECKDocumentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yaml~/.../media_tree$Quoted 17 lines
Quoted 11 lines
The bindings previously documented BT.601 (parallel) only, so
Quoted 2 lines
it was somewhat ambigious to begin with. Is there a risk of interpreting old BT.601 bindings as BT.656?
I don't think so.
With bus-type property, I believe you could
Quoted 1 line
avoid at least that risk.
yes but as explained, I'll prefer not to amend current boards device tree files.
I don't think it matters from this point of view --- you can have a default bus-type.
Quoted 2 lines
Quoted 2 lines
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Also not specifying at least one of the default values leads to BT.656 without bus-type. That could be addressed by removing the defaults.
I'm new to yaml, I've taken that from renesas,vin.yaml. Should I just drop the "default: 1" lines ?
That's one option, yes. Then you have to have those for BT.601 and it's no longer ambiguous.
BR,
Hugues.
Signature · 3 lines
Kind regards, Sakari Ailus
Re: [PATCH v4 2/2] media: dt-bindings: media: st,stm32-dcmi: Add support of BT656
Hi Sakari,
Quoted 103 lines · Sakari Ailus
Hi Rob,
Quoted 100 lines · Rob Herring
Quoted 99 lines · Hugues FRUCHET
Hi Sakari,
+ Jacopo for his work on ov772x binding related to BT656
Quoted 93 lines · Sakari Ailus
Hi Hugues,
Quoted 67 lines · Hugues FRUCHET
Hi Sakari,
Quoted 33 lines · Sakari Ailus
Hi Hugues,
Quoted 30 lines · Hugues Fruchet
Add support of BT656 parallel bus mode in DCMI. This mode is enabled when hsync-active & vsync-active fields are not specified.
Signed-off-by Hugues Fruchet <[email protected]>--- .../devicetree/bindings/media/st,stm32-dcmi.yaml | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+)Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +13
-0@@ -44,6 +44,36 @@ properties: bindings defined in Documentation/devicetree/bindings/media/video-interfaces.txt. + properties: + endpoint: + type: object + + properties: + bus-width: true + + hsync-active: + description: + If both HSYNC and VSYNC polarities are not specified, BT656 + embedded synchronization is selected. + default: 0 +Quoted 8 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml properties: · line 64
Quoted 5 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +5
-0+ vsync-active: + description: + If both HSYNC and VSYNC polarities are not specified, BT656 + embedded synchronization is selected. + default: 0Should I understand this as if the polarities were not specified, BT.656 will be used?
Yes, this is what is documented in video-interfaces.txt:
"
Note, that if HSYNC and VSYNC polarities are not specified, embedded synchronization may be required, where supported.
"
and
"/* If hsync-active/vsync-active are missing, embedded BT.656 sync is used */ hsync-active = <0>; /* Active low */ vsync-active = <0>; /* Active low */"
and I found also this inDocumentation/devicetree/bindings/media/renesas,vin.yaml
"
hsync-active:
description:
If both HSYNC and VSYNC polarities are not specified,
embedded
synchronization is selected.
default: 1Quoted 6 lines
vsync-active:
description:
If both HSYNC and VSYNC polarities are not specified,
embedded
synchronization is selected.
default: 1Having the defaults leads to somewhat weird behaviour: specifying the default value on either property changes the bus type.
Quoted 6 lines
"
In the other hand I've found few occurences of "bus-type" (marvell,mmp2-ccic.yaml), it is why I asked you if "bus-type" is the new way to go versus previous way to signal BT656 (without hsync/vsync) ? As explained previously, I prefer this last way for backward compatibility.
If you have a default for bus-type (BT.601), this won't be a problem.
The old DT bindings were somewhat, well, opportunistic. The v4l2-of framework-let did its best and sometimes it worked. The behaviour is still supported but not encouraged in new bindings.
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
OK, so let's go for the new way.
I've found an interesting patch from Jacopo that is of great help:
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/I wonder if Jacopo tested it. The idea seems interesting nonetheless.
I think I did, but in my series bus-type was required so I guess I don't get bitten by the bus-type mismatch, if I got the below error right
Quoted 142 lines
Quoted 37 lines
Quoted 14 lines
Here is a draft proposal before I push a new version, please comment:
properties: bus-type: enum: [5, 6] default: 5 bus-width: enum: [8, 10, 12, 14] default: 8 hsync-active: enum: [0, 1]For common properties, you can assume there's a common schema. As 0 and 1 are the only possible values, you don't need to define them here unless only a subset is valid for this device.
Quoted 10 lines
default: 0 vsync-active: enum: [0, 1] default: 0 pclk-sample: enum: [0, 1] default: 0Quoted 7 lines
remote-endpoint: true allOf: - if: properties: bus-type: const: 6Quoted 7 lines
To fix the error, you need:
required:
- bus-typeThe problem is the above schema is also true if the property is not present.
Hmm. The idea was that we could keep this consistent with old bindings that only documented parallel mode, and thus didn't need bus-type. This is actually quite common --- adding support for something that wasn't known or cared for during the original review.
I guess this could be done in the driver, too, adding a comment that the bindings earlier did not require it.
Quoted 78 lines
Quoted 78 lines
then:
properties:
hsync-active: false
vsync-active: false
bus-width:
enum: [8]required:
- remote-endpointunevaluatedProperties: false
Unfortunately, the "default: 5" for bus-type is not working !! If we don't specify "bus-type" in example,
dt_binding_checkis failing as if default was 6, it's hardly understandable (see below) !port { dcmi_0: endpoint { remote-endpoint = <&ov5640_0>; bus-width = <10>; hsync-active = <0>; vsync-active = <0>; pclk-sample = <1>; };=> this should be OK but error claimed:
DTCDocumentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yaml
CHECKDocumentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yamlDocumentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yaml:
dcmi@4c006000: port:endpoint:vsync-active: False schema does not allow [[0]] dcmi@4c006000: port:endpoint:hsync-active: False schema does not allow [[0]] dcmi@4c006000: port:endpoint:bus-width:0:0: 10 is not one of [8]
From schema:Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml=> if "bus-type" is explicitly set to 5, all is fine (see below) !
port { dcmi_0: endpoint { remote-endpoint = <&ov5640_0>; bus-type = <5>; bus-width = <10>; hsync-active = <0>; vsync-active = <0>; pclk-sample = <1>; }; };DTC
Documentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yaml
CHECKDocumentation/devicetree/bindings/media/st,stm32-dcmi.example.dt.yaml~/.../media_tree$Quoted 23 lines
Quoted 11 lines
The bindings previously documented BT.601 (parallel) only, so
Quoted 2 lines
it was somewhat ambigious to begin with. Is there a risk of interpreting old BT.601 bindings as BT.656?
I don't think so.
With bus-type property, I believe you could
Quoted 1 line
avoid at least that risk.
yes but as explained, I'll prefer not to amend current boards device tree files.
I don't think it matters from this point of view --- you can have a default bus-type.
Quoted 7 lines
Quoted 5 lines
Also not specifying at least one of the default values leads to BT.656 without bus-type. That could be addressed by removing the defaults.
I'm new to yaml, I've taken that from renesas,vin.yaml. Should I just drop the "default: 1" lines ?
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
That's one option, yes. Then you have to have those for BT.601 and it's no longer ambiguous.
BR,
Hugues.--
Kind regards,Sakari Ailus
Rob Herring
maintainerRe: [PATCH v4 2/2] media: dt-bindings: media: st,stm32-dcmi: Add support of BT656
In reply to Sakari AilusQuoted 152 lines · Sakari Ailus
Hi Rob,
Quoted 95 lines · Rob Herring
Quoted 94 lines · Hugues FRUCHET
Hi Sakari,
+ Jacopo for his work on ov772x binding related to BT656
Quoted 89 lines · Sakari Ailus
Hi Hugues,
Quoted 67 lines · Hugues FRUCHET
Hi Sakari,
Quoted 33 lines · Sakari Ailus
Hi Hugues,
Quoted 30 lines · Hugues Fruchet
Add support of BT656 parallel bus mode in DCMI. This mode is enabled when hsync-active & vsync-active fields are not specified.
Signed-off-by Hugues Fruchet <[email protected]>--- .../devicetree/bindings/media/st,stm32-dcmi.yaml | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+)Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +13
-0@@ -44,6 +44,36 @@ properties: bindings defined in Documentation/devicetree/bindings/media/video-interfaces.txt. + properties: + endpoint: + type: object + + properties: + bus-width: true + + hsync-active: + description: + If both HSYNC and VSYNC polarities are not specified, BT656 + embedded synchronization is selected. + default: 0 +Quoted 8 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml properties: · line 64
Quoted 5 lines
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml +5
-0+ vsync-active: + description: + If both HSYNC and VSYNC polarities are not specified, BT656 + embedded synchronization is selected. + default: 0Should I understand this as if the polarities were not specified, BT.656 will be used?
Yes, this is what is documented in video-interfaces.txt:
"
Note, that if HSYNC and VSYNC polarities are not specified, embedded synchronization may be required, where supported.
"
and
"
/* If hsync-active/vsync-active are missing,
embedded BT.656 sync is used */
hsync-active = <0>; /* Active low */
vsync-active = <0>; /* Active low */
"
and I found also this inDocumentation/devicetree/bindings/media/renesas,vin.yaml
"
hsync-active:
description:
If both HSYNC and VSYNC polarities are not specified,
embedded
synchronization is selected.
default: 1Quoted 6 lines
vsync-active:
description:
If both HSYNC and VSYNC polarities are not specified,
embedded
synchronization is selected.
default: 1Having the defaults leads to somewhat weird behaviour: specifying the default value on either property changes the bus type.
Quoted 6 lines
"
In the other hand I've found few occurences of "bus-type" (marvell,mmp2-ccic.yaml), it is why I asked you if "bus-type" is the new way to go versus previous way to signal BT656 (without hsync/vsync) ? As explained previously, I prefer this last way for backward compatibility.
If you have a default for bus-type (BT.601), this won't be a problem.
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
The old DT bindings were somewhat, well, opportunistic. The v4l2-of framework-let did its best and sometimes it worked. The behaviour is still supported but not encouraged in new bindings.
OK, so let's go for the new way.
I've found an interesting patch from Jacopo that is of great help:
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/I wonder if Jacopo tested it. The idea seems interesting nonetheless.
Quoted 42 lines
Quoted 14 lines
Here is a draft proposal before I push a new version, please comment:
properties: bus-type: enum: [5, 6] default: 5 bus-width: enum: [8, 10, 12, 14] default: 8 hsync-active: enum: [0, 1]For common properties, you can assume there's a common schema. As 0 and 1 are the only possible values, you don't need to define them here unless only a subset is valid for this device.
Quoted 10 lines
default: 0 vsync-active: enum: [0, 1] default: 0 pclk-sample: enum: [0, 1] default: 0Quoted 7 lines
remote-endpoint: true allOf: - if: properties: bus-type: const: 6To fix the error, you need:
required:
- bus-type
Quoted 7 lines
Quoted 2 lines
The problem is the above schema is also true if the property is not present.
Hmm. The idea was that we could keep this consistent with old bindings that only documented parallel mode, and thus didn't need bus-type. This is actually quite common --- adding support for something that wasn't known or cared for during the original review.
TBC, the 'required' here is required for the 'if' in the if/then schema to work as you want. It's not making 'bus-type' a required property.
Rob