## Understanding custom frequency setting in VEC

bootrino
Posts: 6
Joined: Mon Apr 20, 2020 3:37 am

### Understanding custom frequency setting in VEC

My goal is to control the frequency of the signal transmitted out of the composite TV OUT port.

I have been studying the Linux drivers to see how I can do this. There are some hints that it is possible.

I can see that this function refers to VEC_CONFIG1_CUSTOM_FREQ
https://github.com/torvalds/linux/blob/ ... vec.c#L269

That function includes these two lines, which I have not managed to find any more detailed explanation of anywhere.
VEC_WRITE(VEC_FREQ3_2, 0x223b);
VEC_WRITE(VEC_FREQ1_0, 0x61d1);

Is anyone able to help me:

1: understand what VEC_FREQ3_2 and VEC_FREQ1_0 are exactly?
2: and what is the significant of the values 0x223b (8763 decimal) and 0x61d1 (25041) that are being set into them? I looked up their decimal values and they don't seem to mean anything that I know of - not apparently commonly used frequencies.

Can anyone help with more specific information please?

thanks

6by9
Raspberry Pi Engineer & Forum Moderator
Posts: 13009
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

### Re: Understanding custom frequency setting in VEC

Datasheet (sorry, not public) lists it as the colour subcarrier frequency.
f = 13.5 * FREQ / 2^31 in MHz
0x223b61d1 is decimal 574317009.
574317009 * 13.5 / 2147483648 = 3.610MHz, so in about the right ballpark for NTSC's subcarrier (3.58MHz).
Default is 0x29c7 1c72, which gives me 6.365MHz.
I have no idea why this was stored as the least significant 16bits in two 32bit words, instead of just as one 32bit word.

I have no idea whether to trust it or not as it is disabled, but there is code in the firmware

Code: Select all

``````      case SDTV_MODE_PAL :
/* PAL-B,G offset : 4.43361875 MHz. Clock is 13538462. */
VEC_REG[vec_freq3_2] = 0x000029ea; // MSB
VEC_REG[vec_freq1_0] = 0x0000f81f; // LSB
break;

case SDTV_MODE_PAL_M :
/* Colour subcarrier - 3.575611 MHz. Clock is 13369909. */
VEC_REG[vec_freq3_2] = 0x0000223b; // MSB
VEC_REG[vec_freq1_0] = 0x000061d1; // LSB
break;

case SDTV_MODE_NTSC :
case SDTV_MODE_NTSC_J :
/* Colour subcarrier - 3.579545 MHz. Clock is 13369909. */
VEC_REG[vec_freq3_2] = 0x00002245; // MSB
VEC_REG[vec_freq1_0] = 0x0000061b; // LSB
``````
So it looks like the number you're seeing is for PAL_M, and the comment about the clock always being 13.5MHz is incorrect (don't ask me exactly where it is set).
Note that you also need to select the custom frequency
VEC_WRITE(VEC_CONFIG1,
VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ);
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

bootrino
Posts: 6
Joined: Mon Apr 20, 2020 3:37 am

### Re: Understanding custom frequency setting in VEC

Interesting thank you that really clears up the mystery.

So this is the mechanism via which to set a custom color subcarrier frequency.

I wonder then is there also a mechanism to set the primary video signal frequency?

Presumably I can see no such option because typically no other video frequency is needed except for PAL or NTSC.

But given there is the ability to define the color frequency then presumably there is also something very similar for setting the video frequency? It seems unlikely that the PAL and NTSC frequencies would be hard coded.

May I ask if you can see how the video frequency is set somewhere?

thanks.

6by9
Raspberry Pi Engineer & Forum Moderator
Posts: 13009
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

### Re: Understanding custom frequency setting in VEC

It doesn't look like it.
Textual description states
Standard Definition Output in
o PAL-BGHID,
o NTSC, NTSC-J
o PAL-M, PAL-N
And you have the following defined for register CONFIG0 bits 1:0

Code: Select all

``````1:0 STD Video Standard Select
0 = NTSC (pedestal enabled separately above)
1 = PAL_BDGHI
2 = Reserved
3 = PAL_N``````
There are a couple of registers for SECAM config, but again that seems to be only colour subcarrier freq and chroma gains, not the base frequency.

Although what exactly are you meaning by the video frequency? (This may show up deficiencies in my knowledge)
Presumably you're meaning the luma, so that's baseband with no carrier. The pixel rate of that is determined by either the clock being fed into the VEC, or the incoming pixels with timing determined by the pixel valve (most likely the latter).

So looking at vc4_vec.c, you have

Code: Select all

``````static const struct drm_display_mode ntsc_mode = {
DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER, 13500,
720, 720 + 14, 720 + 14 + 64, 720 + 14 + 64 + 60, 0,
480, 480 + 3, 480 + 3 + 3, 480 + 3 + 3 + 16, 0,
DRM_MODE_FLAG_INTERLACE)
};
...
static const struct drm_display_mode pal_mode = {
DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 13500,
720, 720 + 20, 720 + 20 + 64, 720 + 20 + 64 + 60, 0,
576, 576 + 2, 576 + 2 + 3, 576 + 2 + 3 + 20, 0,
DRM_MODE_FLAG_INTERLACE)
};
``````
The 13500 is 13500kHz / 13.5MHz as the pixel clock. Tweak as you see fit.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

nickcis
Posts: 7
Joined: Tue Aug 21, 2012 1:59 pm

### Re: Understanding custom frequency setting in VEC

Hi, I'm trying to support pal-n instead of pal-m and came with this post.

I was thinking to change the following lines:

Code: Select all

`````` static void vc4_vec_pal_m_mode_set(struct vc4_vec *vec)
{
-       VEC_WRITE(VEC_CONFIG0, VEC_CONFIG0_PAL_BDGHI_STD);
+       VEC_WRITE(VEC_CONFIG0, VEC_CONFIG0_PAL_N_STD);
VEC_WRITE(VEC_CONFIG1,
VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ);
-       VEC_WRITE(VEC_FREQ3_2, 0x223b);
-       VEC_WRITE(VEC_FREQ1_0, 0x61d1);
+       VEC_WRITE(VEC_FREQ3_2, 0x21F6);
+       VEC_WRITE(VEC_FREQ1_0, 0x937E);
``````
In order to support it.

Do I have to take anything else into account?.

6by9
Raspberry Pi Engineer & Forum Moderator
Posts: 13009
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

### Re: Understanding custom frequency setting in VEC

nickcis wrote:
Wed Aug 26, 2020 11:11 pm
Hi, I'm trying to support pal-n instead of pal-m and came with this post.
The default is PAL-B/G/D/K/I (625 line 50Hz), not PAL-M (525 line 60Hz).
nickcis wrote:I was thinking to change the following lines:

Code: Select all

`````` static void vc4_vec_pal_m_mode_set(struct vc4_vec *vec)
{
-       VEC_WRITE(VEC_CONFIG0, VEC_CONFIG0_PAL_BDGHI_STD);
+       VEC_WRITE(VEC_CONFIG0, VEC_CONFIG0_PAL_N_STD);
VEC_WRITE(VEC_CONFIG1,
VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ);
-       VEC_WRITE(VEC_FREQ3_2, 0x223b);
-       VEC_WRITE(VEC_FREQ1_0, 0x61d1);
+       VEC_WRITE(VEC_FREQ3_2, 0x21F6);
+       VEC_WRITE(VEC_FREQ1_0, 0x937E);
``````
In order to support it.

Do I have to take anything else into account?.
PAL-N - 625 line 50Hz, 3.58205625 MHz colour subcarrier.

The VEC has a preset for PAL-N (same as PAL BDGH, and NTSC), so I don't think you need to do anything odd. It makes more sense to add it as a new mode than replace PAL-M.
Untested:

Code: Select all

``````--- a/drivers/gpu/drm/vc4/vc4_vec.c
+++ b/drivers/gpu/drm/vc4/vc4_vec.c
@@ -207,6 +207,7 @@ enum vc4_vec_tv_mode_id {
VC4_VEC_TV_MODE_NTSC_J,
VC4_VEC_TV_MODE_PAL,
VC4_VEC_TV_MODE_PAL_M,
+       VC4_VEC_TV_MODE_PAL_N,
};

struct vc4_vec_tv_mode {
@@ -275,6 +276,12 @@ static void vc4_vec_pal_m_mode_set(struct vc4_vec *vec)
VEC_WRITE(VEC_FREQ1_0, 0x61d1);
}

+static void vc4_vec_pal_n_mode_set(struct vc4_vec *vec)
+{
+       VEC_WRITE(VEC_CONFIG0, VEC_CONFIG0_PAL_N_STD);
+       VEC_WRITE(VEC_CONFIG1, VEC_CONFIG1_C_CVBS_CVBS);
+}
+
static const struct drm_display_mode pal_mode = {
DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 13500,
720, 720 + 20, 720 + 20 + 64, 720 + 20 + 64 + 60, 0,
@@ -299,6 +306,10 @@ static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = {
.mode = &pal_mode,
.mode_set = vc4_vec_pal_m_mode_set,
},
+       [VC4_VEC_TV_MODE_PAL_N] = {
+               .mode = &pal_mode,
+               .mode_set = vc4_vec_pal_n_mode_set,
+       },
};

static enum drm_connector_status
@@ -520,6 +531,7 @@ static const char * const tv_mode_names[] = {
[VC4_VEC_TV_MODE_NTSC_J] = "NTSC-J",
[VC4_VEC_TV_MODE_PAL] = "PAL",
[VC4_VEC_TV_MODE_PAL_M] = "PAL-M",
+       [VC4_VEC_TV_MODE_PAL_N] = "PAL-N",
};

static int vc4_vec_bind(struct device *dev, struct device *master, void *data)
``````
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

nickcis
Posts: 7
Joined: Tue Aug 21, 2012 1:59 pm

### Re: Understanding custom frequency setting in VEC

Hi, thanks for the reply!, I will apply the patch to the kernel, recompile and test it.

(Yes, I was too hackish just renaming the pal-m, I should go for the correct approach of creating a new mode!)

One extra question, how should I select the mode in VEC?.

I know that I need to use the `dtoverlay=vc4-kms-v3d` under `/boot/config.txt`, but how I choose the new `PAL-N` mode?. It should be set with the `sdtv_mode` config or should I add something on `/boot/cmdline.txt`?.

Again, thanks!

6by9
Raspberry Pi Engineer & Forum Moderator
Posts: 13009
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

### Re: Understanding custom frequency setting in VEC

The crtc under KMS has a property "mode"

Code: Select all

``````	39 mode:
flags: enum
enums: NTSC=0 NTSC-J=1 PAL=2 PAL-M=3
value: 0
``````
You should gain an enum "PAL-N=4". I don't know if there is an easy way to set that from the kernel command line, but otherwise modetest can set it.

Note it is NOT supported from config.txt as that only configures the firmware.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

nickcis
Posts: 7
Joined: Tue Aug 21, 2012 1:59 pm

### Re: Understanding custom frequency setting in VEC

I managed to compile the kernel and modetest:

Code: Select all

``````# ./tests/modetest/modetest
trying to open device 'i915'...failed
trying to open device 'amdgpu'...failed
trying to open device 'radeon'...failed
trying to open device 'nouveau'...failed
trying to open device 'vmwgfx'...failed
trying to open device 'omapdrm'...failed
trying to open device 'exynos'...failed
trying to open device 'tilcdc'...failed
trying to open device 'msm'...failed
trying to open device 'sti'...failed
trying to open device 'tegra'...failed
trying to open device 'imx-drm'...failed
trying to open device 'rockchip'...failed
trying to open device 'atmel-hlcdc'...failed
trying to open device 'fsl-dcu-drm'...failed
trying to open device 'vc4'...done
Encoders:
id	crtc	type	possible crtcs	possible clones
28	0	TMDS	0x00000004	0x00000000
43	116	TVDAC	0x00000004	0x00000000
49	0	Virtual	0x00000002	0x00000000

Connectors:
id	encoder	status		name		size (mm)	modes	encoders
29	0	disconnected	HDMI-A-1       	0x0		0	28
props:
1 EDID:
flags: immutable blob
blobs:

value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0
flags: enum
value: 0
6 non-desktop:
flags: immutable range
values: 0 1
value: 0
30 left margin:
flags: range
values: 0 100
value: 0
31 right margin:
flags: range
values: 0 100
value: 0
32 top margin:
flags: range
values: 0 100
value: 0
33 bottom margin:
flags: range
values: 0 100
value: 0
44	43	unknown	composite-1    	0x0		1	43
modes:
name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
720x480 63 720 734 798 858 480 483 486 502 13500 flags: interlace; type: driver
props:
1 EDID:
flags: immutable blob
blobs:

value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0
flags: enum
value: 0
6 non-desktop:
flags: immutable range
values: 0 1
value: 0
36 mode:
flags: enum
enums: NTSC=0 NTSC-J=1 PAL=2 PAL-M=3 PAL-N=4
value: 0

CRTCs:
id	fb	pos	size
54	0	(0,0)	(0x0)
0 0 0 0 0 0 0 0 0 0 flags: ; type:
props:
25 GAMMA_LUT:
flags: blob
blobs:

value:
26 GAMMA_LUT_SIZE:
flags: immutable range
values: 0 4294967295
value: 256
24 CTM:
flags: blob
blobs:

value:
25 GAMMA_LUT:
flags: blob
blobs:

value:
26 GAMMA_LUT_SIZE:
flags: immutable range
values: 0 4294967295
value: 256
85	0	(0,0)	(0x0)
0 0 0 0 0 0 0 0 0 0 flags: ; type:
props:
25 GAMMA_LUT:
flags: blob
blobs:

value:
26 GAMMA_LUT_SIZE:
flags: immutable range
values: 0 4294967295
value: 256
24 CTM:
flags: blob
blobs:

value:
25 GAMMA_LUT:
flags: blob
blobs:

value:
26 GAMMA_LUT_SIZE:
flags: immutable range
values: 0 4294967295
value: 256
116	146	(0,0)	(720x480)
720x480 63 720 734 798 858 480 483 486 502 13500 flags: interlace; type: driver
props:
25 GAMMA_LUT:
flags: blob
blobs:

value:
26 GAMMA_LUT_SIZE:
flags: immutable range
values: 0 4294967295
value: 256
24 CTM:
flags: blob
blobs:

value:
25 GAMMA_LUT:
flags: blob
blobs:

value:
26 GAMMA_LUT_SIZE:
flags: immutable range
values: 0 4294967295
value: 256

Planes:
id	crtc	fb	CRTC x,y	x,y	gamma size	possible crtcs
51	0	0	0,0		0,0	0       	0x00000001
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 1
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
53 alpha:
flags: range
values: 0 65535
value: 65535
55	0	0	0,0		0,0	0       	0x00000001
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
57 alpha:
flags: range
values: 0 65535
value: 65535
58	0	0	0,0		0,0	0       	0x00000001
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
60 alpha:
flags: range
values: 0 65535
value: 65535
61	0	0	0,0		0,0	0       	0x00000001
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
63 alpha:
flags: range
values: 0 65535
value: 65535
64	0	0	0,0		0,0	0       	0x00000001
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
66 alpha:
flags: range
values: 0 65535
value: 65535
67	0	0	0,0		0,0	0       	0x00000001
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
69 alpha:
flags: range
values: 0 65535
value: 65535
70	0	0	0,0		0,0	0       	0x00000001
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
72 alpha:
flags: range
values: 0 65535
value: 65535
73	0	0	0,0		0,0	0       	0x00000001
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
75 alpha:
flags: range
values: 0 65535
value: 65535
76	0	0	0,0		0,0	0       	0x00000001
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
78 alpha:
flags: range
values: 0 65535
value: 65535
79	0	0	0,0		0,0	0       	0x00000001
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 2
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000000a00000018000000
05000000400000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
ff000000000000000000000000000000
0100000000000007ff00000000000000
00000000000000000400000000000007
ff000000000000000000000000000000
03000000000000070000000000000000
00000000000000000500000000000007
ff030000000000000000000000000000
0000000000000000
81 alpha:
flags: range
values: 0 65535
value: 65535
82	0	0	0,0		0,0	0       	0x00000002
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 1
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
84 alpha:
flags: range
values: 0 65535
value: 65535
86	0	0	0,0		0,0	0       	0x00000002
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
88 alpha:
flags: range
values: 0 65535
value: 65535
89	0	0	0,0		0,0	0       	0x00000002
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
91 alpha:
flags: range
values: 0 65535
value: 65535
92	0	0	0,0		0,0	0       	0x00000002
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
94 alpha:
flags: range
values: 0 65535
value: 65535
95	0	0	0,0		0,0	0       	0x00000002
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
97 alpha:
flags: range
values: 0 65535
value: 65535
98	0	0	0,0		0,0	0       	0x00000002
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
100 alpha:
flags: range
values: 0 65535
value: 65535
101	0	0	0,0		0,0	0       	0x00000002
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
103 alpha:
flags: range
values: 0 65535
value: 65535
104	0	0	0,0		0,0	0       	0x00000002
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
106 alpha:
flags: range
values: 0 65535
value: 65535
107	0	0	0,0		0,0	0       	0x00000002
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
109 alpha:
flags: range
values: 0 65535
value: 65535
110	0	0	0,0		0,0	0       	0x00000002
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 2
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000000a00000018000000
05000000400000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
ff000000000000000000000000000000
0100000000000007ff00000000000000
00000000000000000400000000000007
ff000000000000000000000000000000
03000000000000070000000000000000
00000000000000000500000000000007
ff030000000000000000000000000000
0000000000000000
112 alpha:
flags: range
values: 0 65535
value: 65535
113	116	146	0,0		0,0	0       	0x00000004
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 1
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
115 alpha:
flags: range
values: 0 65535
value: 65535
117	0	0	0,0		0,0	0       	0x00000004
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
119 alpha:
flags: range
values: 0 65535
value: 65535
120	0	0	0,0		0,0	0       	0x00000004
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
122 alpha:
flags: range
values: 0 65535
value: 65535
123	0	0	0,0		0,0	0       	0x00000004
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
125 alpha:
flags: range
values: 0 65535
value: 65535
126	0	0	0,0		0,0	0       	0x00000004
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
128 alpha:
flags: range
values: 0 65535
value: 65535
129	0	0	0,0		0,0	0       	0x00000004
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
131 alpha:
flags: range
values: 0 65535
value: 65535
132	0	0	0,0		0,0	0       	0x00000004
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
134 alpha:
flags: range
values: 0 65535
value: 65535
135	0	0	0,0		0,0	0       	0x00000004
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
137 alpha:
flags: range
values: 0 65535
value: 65535
138	0	0	0,0		0,0	0       	0x00000004
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000001200000018000000
05000000600000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
59553136595631365955313259563132
4e5631324e5632314e5631364e563631
ff000000000000000000000000000000
0100000000000007ffc0000000000000
00000000000000000400000000000007
ffc00000000000000000000000000000
030000000000000700c0000000000000
00000000000000000500000000000007
ffff0300000000000000000000000000
0000000000000000
140 alpha:
flags: range
values: 0 65535
value: 65535
141	0	0	0,0		0,0	0       	0x00000004
formats: XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24
props:
7 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 2
27 IN_FORMATS:
flags: immutable blob
blobs:

value:
01000000000000000a00000018000000
05000000400000005852323441523234
41423234584232345247313642473136
41523135585231355247323442473234
ff000000000000000000000000000000
0100000000000007ff00000000000000
00000000000000000400000000000007
ff000000000000000000000000000000
03000000000000070000000000000000
00000000000000000500000000000007
ff030000000000000000000000000000
0000000000000000
143 alpha:
flags: range
values: 0 65535
value: 65535

Frame buffers:
id	size	pitch
``````
If I try to set the mode to any other (non ntsc mode, ie: 0 and 1) I get the following error:

Code: Select all

``````# ./tests/modetest/modetest -w 44:mode:4
trying to open device 'i915'...failed
trying to open device 'amdgpu'...failed
trying to open device 'radeon'...failed
trying to open device 'nouveau'...failed
trying to open device 'vmwgfx'...failed
trying to open device 'omapdrm'...failed
trying to open device 'exynos'...failed
trying to open device 'tilcdc'...failed
trying to open device 'msm'...failed
trying to open device 'sti'...failed
trying to open device 'tegra'...failed
trying to open device 'imx-drm'...failed
trying to open device 'rockchip'...failed
trying to open device 'atmel-hlcdc'...failed
trying to open device 'fsl-dcu-drm'...failed
trying to open device 'vc4'...done
failed to set CONNECTOR 44 property mode to 4: Invalid argument
``````
I have add some logs in order to get what is happening:

Code: Select all

``````[  671.804565]  vc4: vc4_vec_encoder_atomic_check 0
[  671.810169]  vc4: vc4_vec_encoder_atomic_check 0
[  671.828392]  vc4: vc4_vec_encoder_atomic_check 0
[  671.841985]  vc4: vc4_vec_encoder_atomic_check 0
[  671.860516]  vc4: vc4_vec_encoder_atomic_check 0
[  671.873815]  vc4: vc4_vec_encoder_atomic_check 0
[  671.892042]  vc4: vc4_vec_encoder_atomic_check 0
[  671.905668]  vc4: vc4_vec_encoder_atomic_check 0
[  671.923920]  vc4: vc4_vec_encoder_atomic_check 0
[  671.937510]  vc4: vc4_vec_encoder_atomic_check 0
[  671.955717]  vc4: vc4_vec_encoder_atomic_check 0
[  671.969347]  vc4: vc4_vec_encoder_atomic_check 0
[  671.987552]  vc4: vc4_vec_encoder_atomic_check 0
[  672.001201]  vc4: vc4_vec_encoder_atomic_check 0
[  672.019487]  vc4: vc4_vec_encoder_atomic_check 0
[  672.033038]  vc4: vc4_vec_encoder_atomic_check 0
[  672.051286]  vc4: vc4_vec_encoder_atomic_check 0
[  672.064868]  vc4: vc4_vec_encoder_atomic_check 0
[  672.083103]  vc4: vc4_vec_encoder_atomic_check 0
[  672.096726]  vc4: vc4_vec_encoder_atomic_check 0
[  672.114945]  vc4: vc4_vec_encoder_atomic_check 0
[  672.128854]  vc4: vc4_vec_encoder_atomic_check 0
[  672.146760]  vc4: vc4_vec_encoder_atomic_check 0
[  672.160404]  vc4: vc4_vec_encoder_atomic_check 0
[  672.178734]  vc4: vc4_vec_encoder_atomic_check 0
[  672.192241]  vc4: vc4_vec_encoder_atomic_check 0
[  672.210806]  vc4: vc4_vec_encoder_atomic_check 0
[  672.224074]  vc4: vc4_vec_encoder_atomic_check 0
[  672.242298]  vc4: vc4_vec_encoder_atomic_check 0
[  672.255922]  vc4: vc4_vec_encoder_atomic_check 0
[  672.274135]  vc4: vc4_vec_encoder_atomic_check 0
[  672.288153]  vc4: vc4_vec_connector_detect
[  672.288167]  vc4: vc4_vec_connector_get_modes 0
[  672.292495]  vc4: vc4_vec_encoder_atomic_check 4
[  672.293535]  vc4: vc4_vec_encoder_atomic_check 0
``````
Does this error has something to do with the fact that the function `vc4_vec_encoder_atomic_check` returns `-EINVAL` when drm modes aren't equal? ( https://github.com/raspberrypi/linux/bl ... vec.c#L499 ).

6by9
Raspberry Pi Engineer & Forum Moderator
Posts: 13009
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

### Re: Understanding custom frequency setting in VEC

Shouldn't be. Can you switch to any of the other values?
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

nickcis
Posts: 7
Joined: Tue Aug 21, 2012 1:59 pm

### Re: Understanding custom frequency setting in VEC

I've repeated the tests with `mode`, still having the invalid argument error. On dmesg, it never calls any mode_set (it was only called at boot time for ntsc).

Code: Select all

``````# modetest -M vc4 -c
Connectors:
id	encoder	status		name		size (mm)	modes	encoders
29	0	disconnected	HDMI-A-1       	0x0		0	28
props:
1 EDID:
flags: immutable blob
blobs:

value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0
flags: enum
value: 0
6 non-desktop:
flags: immutable range
values: 0 1
value: 0
30 left margin:
flags: range
values: 0 100
value: 0
31 right margin:
flags: range
values: 0 100
value: 0
32 top margin:
flags: range
values: 0 100
value: 0
33 bottom margin:
flags: range
values: 0 100
value: 0
44	43	unknown	composite-1    	0x0		1	43
modes:
name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
720x480 63 720 734 798 858 480 483 486 502 13500 flags: interlace; type: driver
props:
1 EDID:
flags: immutable blob
blobs:

value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0
flags: enum
value: 0
6 non-desktop:
flags: immutable range
values: 0 1
value: 0
36 mode:
flags: enum
enums: NTSC=0 NTSC-J=1 PAL=2 PAL-M=3 PAL-N=4
value: 0

# modetest -M vc4 -w 44:mode:4
failed to set CONNECTOR 44 property mode to 4: Invalid argument
# modetest -M vc4 -c
Connectors:
id	encoder	status		name		size (mm)	modes	encoders
29	0	disconnected	HDMI-A-1       	0x0		0	28
props:
1 EDID:
flags: immutable blob
blobs:

value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0
flags: enum
value: 0
6 non-desktop:
flags: immutable range
values: 0 1
value: 0
30 left margin:
flags: range
values: 0 100
value: 0
31 right margin:
flags: range
values: 0 100
value: 0
32 top margin:
flags: range
values: 0 100
value: 0
33 bottom margin:
flags: range
values: 0 100
value: 0
44	43	unknown	composite-1    	0x0		1	43
modes:
name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
720x480 63 720 734 798 858 480 483 486 502 13500 flags: interlace; type: driver
props:
1 EDID:
flags: immutable blob
blobs:

value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0
flags: enum
value: 0
6 non-desktop:
flags: immutable range
values: 0 1
value: 0
36 mode:
flags: enum
enums: NTSC=0 NTSC-J=1 PAL=2 PAL-M=3 PAL-N=4
value: 0

# modetest -M vc4 -w 44:mode:3
failed to set CONNECTOR 44 property mode to 3: Invalid argument
# modetest -M vc4 -w 44:mode:2
failed to set CONNECTOR 44 property mode to 2: Invalid argument
# modetest -M vc4 -w 44:mode:1
``````
Dmesg output (with logs):

Code: Select all

``````[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.19.66-v7+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1253 SMP Thu Aug 15 11:49:46 BST 2019
[    0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: Raspberry Pi 3 Model B Rev 1.2
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] cma: Reserved 256 MiB at 0x1ec00000
[    0.000000] On node 0 totalpages: 242688
[    0.000000]   Normal zone: 2133 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 242688 pages, LIFO batch:63
[    0.000000] random: get_random_bytes called from start_kernel+0xac/0x4b4 with crng_init=0
[    0.000000] percpu: Embedded 17 pages/cpu s39488 r8192 d21952 u69632
[    0.000000] pcpu-alloc: s39488 r8192 d21952 u69632 alloc=17*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 240555
[    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 cma=256M  vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty3 root=PARTUUID=80a9759b-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait nosplash logo.nologo vt.global_cursor_default=0 systemd.show_status=0
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 684640K/970752K available (8192K kernel code, 629K rwdata, 2176K rodata, 1024K init, 821K bss, 23968K reserved, 262144K cma-reserved)
[    0.000000] Virtual kernel memory layout:
vector  : 0xffff0000 - 0xffff1000   (   4 kB)
fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
vmalloc : 0xbb800000 - 0xff800000   (1088 MB)
lowmem  : 0x80000000 - 0xbb400000   ( 948 MB)
modules : 0x7f000000 - 0x80000000   (  16 MB)
.text : 0x(ptrval) - 0x(ptrval)   (9184 kB)
.init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
.data : 0x(ptrval) - 0x(ptrval)   ( 630 kB)
.bss : 0x(ptrval) - 0x(ptrval)   ( 822 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] ftrace: allocating 26394 entries in 78 pages
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] arch_timer: cp15 timer(s) running at 19.20MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[    0.000007] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[    0.000023] Switching to timer-based delay loop, resolution 52ns
[    0.000290] Console: colour dummy device 80x30
[    0.000915] console [tty3] enabled
[    0.000974] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
[    0.001019] pid_max: default: 32768 minimum: 301
[    0.001369] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.001406] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.002332] CPU: Testing write buffer coherency: ok
[    0.002817] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.003484] Setting up static identity map for 0x100000 - 0x10003c
[    0.003649] rcu: Hierarchical SRCU implementation.
[    0.004463] smp: Bringing up secondary CPUs ...
[    0.005322] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.006249] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.007122] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.007244] smp: Brought up 1 node, 4 CPUs
[    0.007325] SMP: Total of 4 processors activated (153.60 BogoMIPS).
[    0.007349] CPU: All CPU(s) started in HYP mode.
[    0.007369] CPU: Virtualization extensions available.
[    0.008352] devtmpfs: initialized
[    0.021540] VFP support v0.3: implementor 41 architecture 3 part 40 variant 3 rev 4
[    0.021814] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.021863] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    0.032452] pinctrl core: initialized pinctrl subsystem
[    0.033426] NET: Registered protocol family 16
[    0.036554] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[    0.042349] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.042386] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.042606] Serial: AMBA PL011 UART driver
[    0.045234] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[    0.082221] bcm2835-dma 3f007000.dma: DMA legacy API manager at (ptrval), dmachans=0x1
[    0.083924] SCSI subsystem initialized
[    0.084168] usbcore: registered new interface driver usbfs
[    0.084244] usbcore: registered new interface driver hub
[    0.084358] usbcore: registered new device driver usb
[    0.100377] raspberrypi-firmware soc:firmware: Attached to firmware from 2019-08-15 12:06, variant start
[    0.110176] raspberrypi-firmware soc:firmware: Firmware hash is 0e6daa5106dd4164474616408e0dc24f997ffcf3
[    0.121992] clocksource: Switched to clocksource arch_sys_counter
[    0.211176] VFS: Disk quotas dquot_6.6.0
[    0.211287] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.211497] FS-Cache: Loaded
[    0.211722] CacheFiles: Loaded
[    0.212278] simple-framebuffer 3eb75000.framebuffer: framebuffer at 0x3eb75000, 0x85400 bytes, mapped to 0x(ptrval)
[    0.212323] simple-framebuffer 3eb75000.framebuffer: format=r5g6b5, mode=656x416x16, linelength=1312
[    0.215232] Console: switching to colour frame buffer device 82x26
[    0.219632] simple-framebuffer 3eb75000.framebuffer: fb0: simplefb registered!
[    0.231344] NET: Registered protocol family 2
[    0.234115] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes)
[    0.238087] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.240258] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    0.242536] TCP: Hash tables configured (established 8192 bind 8192)
[    0.244706] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.246798] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.249191] NET: Registered protocol family 1
[    0.251851] RPC: Registered named UNIX socket transport module.
[    0.254036] RPC: Registered udp transport module.
[    0.256123] RPC: Registered tcp transport module.
[    0.258126] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.261888] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 7 counters available
[    0.268863] Initialise system trusted keyrings
[    0.271017] workingset: timestamp_bits=14 max_order=18 bucket_order=4
[    0.283034] FS-Cache: Netfs 'nfs' registered for caching
[    0.285575] NFS: Registering the id_resolver key type
[    0.287590] Key type id_resolver registered
[    0.289538] Key type id_legacy registered
[    0.291434] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.295692] Key type asymmetric registered
[    0.297565] Asymmetric key parser 'x509' registered
[    0.299448] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
[    0.303320] io scheduler noop registered
[    0.305127] io scheduler deadline registered (default)
[    0.307074] io scheduler cfq registered
[    0.308775] io scheduler mq-deadline registered (default)
[    0.310463] io scheduler kyber registered
[    0.317495] bcm2835-rng 3f104000.rng: hwrng registered
[    0.319546] vc-mem: phys_addr:0x00000000 mem_base=0x3ec00000 mem_size:0x40000000(1024 MiB)
[    0.323413] vc-sm: Videocore shared memory driver
[    0.325443] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
[    0.339698] brd: module loaded
[    0.351548] loop: module loaded
[    0.353964] Loading iSCSI transport class v2.0-870.
[    0.356339] libphy: Fixed MDIO Bus: probed
[    0.358131] usbcore: registered new interface driver lan78xx
[    0.359885] usbcore: registered new interface driver smsc95xx
[    0.361540] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    0.391106] dwc_otg 3f980000.usb: base=(ptrval)
[    0.592974] Core Release: 2.80a
[    0.594617] Setting default values for core params
[    0.596273] Finished setting default values for core params
[    0.798197] Using Buffer DMA mode
[    0.799808] Periodic Transfer Interrupt Enhancement - disabled
[    0.801431] Multiprocessor Interrupt Enhancement - disabled
[    0.803046] OTG VER PARAM: 0, OTG VER FLAG: 0
[    0.804646] Dedicated Tx FIFOs mode
[    0.806629] WARN::dwc_otg_hcd_init:1045: FIQ DMA bounce buffers: virt = 9ed04000 dma = 0xded04000 len=9024
[    0.809973] FIQ FSM acceleration enabled for :
Non-periodic Split Transactions
Periodic Split Transactions
High-Speed Isochronous Endpoints
Interrupt/Control Split Transaction hack enabled
[    0.818142] dwc_otg: Microframe scheduler enabled
[    0.818199] WARN::hcd_init_fiq:457: FIQ on core 1
[    0.819777] WARN::hcd_init_fiq:458: FIQ ASM at 80654f4c length 36
[    0.821313] WARN::hcd_init_fiq:497: MPHI regs_base at bb810000
[    0.822855] dwc_otg 3f980000.usb: DWC OTG Controller
[    0.824439] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
[    0.826063] dwc_otg 3f980000.usb: irq 56, io mem 0x00000000
[    0.827682] Init: Port Power? op_state=1
[    0.829234] Init: Power Port (0)
[    0.831027] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
[    0.834265] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.835985] usb usb1: Product: DWC OTG Controller
[    0.837687] usb usb1: Manufacturer: Linux 4.19.66-v7+ dwc_otg_hcd
[    0.839403] usb usb1: SerialNumber: 3f980000.usb
[    0.841696] hub 1-0:1.0: USB hub found
[    0.843427] hub 1-0:1.0: 1 port detected
[    0.845623] dwc_otg: FIQ enabled
[    0.845629] dwc_otg: NAK holdoff enabled
[    0.845635] dwc_otg: FIQ split-transaction FSM enabled
[    0.845645] Module dwc_common_port init
[    0.845897] usbcore: registered new interface driver usb-storage
[    0.847731] mousedev: PS/2 mouse device common for all mice
[    0.850322] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[    0.852251] bcm2835-cpufreq: min=600000 max=1200000
[    0.854368] sdhci: Secure Digital Host Controller Interface driver
[    0.856013] sdhci: Copyright(c) Pierre Ossman
[    0.858045] mmc-bcm2835 3f300000.mmcnr: could not get clk, deferring probe
[    0.860143] sdhost-bcm2835 3f202000.mmc: could not get clk, deferring probe
[    0.862068] sdhci-pltfm: SDHCI platform and OF driver helper
[    0.865384] ledtrig-cpu: registered to indicate activity on CPUs
[    0.867342] hidraw: raw HID events driver (C) Jiri Kosina
[    0.869311] usbcore: registered new interface driver usbhid
[    0.871111] usbhid: USB HID core driver
[    0.873673] vchiq: vchiq_init_state: slot_zero = (ptrval), is_master = 0
[    0.876994] [vc_sm_connected_init]: start
[    0.883863] [vc_sm_connected_init]: end - returning 0
[    0.886742] Initializing XFRM netlink socket
[    0.888561] NET: Registered protocol family 17
[    0.890430] Key type dns_resolver registered
[    0.892717] Registering SWP/SWPB emulation handler
[    0.895045] registered taskstats version 1
[    0.905504] uart-pl011 3f201000.serial: cts_event_workaround enabled
[    0.907282] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 81, base_baud = 0) is a PL011 rev2
[    0.912664] mmc-bcm2835 3f300000.mmcnr: mmc_debug:0 mmc_debug2:0
[    0.914469] mmc-bcm2835 3f300000.mmcnr: DMA channel allocated
[    0.942390] sdhost: log_buf @ (ptrval) (ded07000)
[    0.978946] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[    0.982284] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    0.985547] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    0.990015] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[    0.993260] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[    0.996086] of_cfs_init
[    0.997669] of_cfs_init: OK
[    1.000170] Waiting for root device PARTUUID=80a9759b-02...
[    1.054122] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.060035] mmc0: new high speed SDHC card at address 59b4
[    1.062814] mmcblk0: mmc0:59b4 00000 14.9 GiB
[    1.066396]  mmcblk0: p1 p2
[    1.072164] Indeed it is in host mode hprt0 = 00021501
[    1.094724] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.097927] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    1.134373] random: fast init done
[    1.140038] devtmpfs: mounted
[    1.147077] Freeing unused kernel memory: 1024K
[    1.172411] Run /sbin/init as init process
[    1.178997] mmc1: new high speed SDIO card at address 0001
[    1.282040] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    1.283787] Indeed it is in host mode hprt0 = 00001101
[    1.522346] usb 1-1: New USB device found, idVendor=0424, idProduct=9514, bcdDevice= 2.00
[    1.525665] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    1.528081] hub 1-1:1.0: USB hub found
[    1.529968] hub 1-1:1.0: 5 ports detected
[    1.752606] systemd[1]: System time before build time, advancing clock.
[    1.852043] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[    1.947395] NET: Registered protocol family 10
[    1.950639] Segment Routing with IPv6
[    1.984511] random: systemd: uninitialized urandom read (16 bytes read)
[    1.989159] random: systemd: uninitialized urandom read (16 bytes read)
[    1.992390] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00, bcdDevice= 2.00
[    1.996077] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    2.000961] smsc95xx v1.0.6
[    2.004516] systemd[1]: systemd 232 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN)
[    2.011031] systemd[1]: Detected architecture arm.
[    2.014564] systemd[1]: Set hostname to <ciscdeco>.
[    2.063189] random: systemd-sysv-ge: uninitialized urandom read (16 bytes read)
[    2.096857] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:12:9d:5e
[    2.591056] systemd[1]: Listening on udev Control Socket.
[    2.594562] systemd[1]: Created slice System Slice.
[    2.596912] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
[    2.619875] systemd[1]: Listening on udev Kernel Socket.
[    2.622380] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[    2.627085] systemd[1]: Created slice User and Session Slice.
[    2.629225] systemd[1]: Reached target Slices.
[    2.758447] i2c /dev entries driver
[    3.232763] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[    3.469669] systemd-journald[98]: Received request to flush runtime journal from PID 1
[    3.779462] vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned.
[    3.782274] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[    3.782290] [vc_sm_connected_init]: start
[    3.792617] [vc_sm_connected_init]: installed successfully
[    3.877553] media: Linux media interface: v0.10
[    3.936552] videodev: Linux video capture interface: v2.00
[    3.981301] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    3.981333] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    3.996274] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[    4.084385] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[    4.100431] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    4.102257] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[    4.102270] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
[    4.112994] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[    4.113009] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
[    4.117155] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[    4.117169] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
[    4.173134] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    4.254501] brcmfmac: F1 signature read @0x18000000=0x1541a9a6
[    4.262347] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    4.262592] usbcore: registered new interface driver brcmfmac
[    4.455272] vc4_hdmi 3f902000.hdmi: ASoC: Failed to create component debugfs directory
[    4.457810] vc4_hdmi 3f902000.hdmi: vc4-hdmi-hifi <-> 3f902000.hdmi mapping ok
[    4.463412] vc4-drm soc:gpu: bound 3f902000.hdmi (ops vc4_hdmi_ops [vc4])
[    4.463568]  vc4: vc4_vec_connector_init
[    4.463662] vc4-drm soc:gpu: bound 3f806000.vec (ops vc4_vec_ops [vc4])
[    4.463869] vc4-drm soc:gpu: bound 3f004000.txp (ops vc4_txp_ops [vc4])
[    4.463979] vc4-drm soc:gpu: bound 3f400000.hvs (ops vc4_hvs_ops [vc4])
[    4.464422] vc4-drm soc:gpu: bound 3f206000.pixelvalve (ops vc4_crtc_ops [vc4])
[    4.464805] vc4-drm soc:gpu: bound 3f207000.pixelvalve (ops vc4_crtc_ops [vc4])
[    4.465182] vc4-drm soc:gpu: bound 3f807000.pixelvalve (ops vc4_crtc_ops [vc4])
[    4.496013] vc4-drm soc:gpu: bound 3fc00000.v3d (ops vc4_v3d_ops [vc4])
[    4.496036] checking generic (3eb75000 85400) vs hw (0 ffffffff)
[    4.496043] fb: switching to vc4drmfb from simple
[    4.496258] Console: switching to colour dummy device 80x30
[    4.498721] [drm] Initialized vc4 0.0.0 20140616 for soc:gpu on minor 0
[    4.498736] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    4.498742] [drm] Driver supports precise vblank timestamp query.
[    4.501413]  vc4: vc4_vec_connector_detect
[    4.501429]  vc4: vc4_vec_connector_get_modes 0
[    4.507276] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    4.507398] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available
[    4.508228] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Oct 23 2017 03:55:53 version 7.45.98.38 (r674442 CY) FWID 01-e58d219f
[    4.520877]  vc4: vc4_vec_encoder_atomic_check 0
[    4.521047]  vc4: vc4_vec_encoder_atomic_mode_set 0
[    4.521083]  vc4: vc4_vec_encoder_enable
[    4.521207]  vc4: vc4_vec_ntsc_mode_set
[    4.537585] Console: switching to colour frame buffer device 90x30
[    4.537846]  vc4: vc4_vec_encoder_atomic_check 0
[    4.560061] vc4-drm soc:gpu: fb0: DRM emulated frame buffer device
[    5.653929] uart-pl011 3f201000.serial: no DMA platform data
[    5.675202]  vc4: vc4_vec_connector_detect
[    5.675224]  vc4: vc4_vec_connector_get_modes 0
[    5.675723]  vc4: vc4_vec_encoder_atomic_check 0
[    6.081718] brcmfmac: power management disabled
[    6.383267] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[    7.899585] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
[   10.401318] Bluetooth: Core ver 2.22
[   10.401463] NET: Registered protocol family 31
[   10.401478] Bluetooth: HCI device and connection manager initialized
[   10.403351] Bluetooth: HCI socket layer initialized
[   10.403373] Bluetooth: L2CAP socket layer initialized
[   10.403421] Bluetooth: SCO socket layer initialized
[   10.419330] Bluetooth: HCI UART driver ver 2.3
[   10.419344] Bluetooth: HCI UART protocol H4 registered
[   10.419430] Bluetooth: HCI UART protocol Three-wire (H5) registered
[   10.419666] Bluetooth: HCI UART protocol Broadcom registered
[   10.768655] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   10.768664] Bluetooth: BNEP filters: protocol multicast
[   10.768681] Bluetooth: BNEP socket layer initialized
[   10.881279] Bluetooth: RFCOMM TTY layer initialized
[   10.881305] Bluetooth: RFCOMM socket layer initialized
[   10.881328] Bluetooth: RFCOMM ver 1.11
[   48.146259]  vc4: vc4_vec_encoder_atomic_check 0
[   48.160447]  vc4: vc4_vec_connector_detect
[   48.160461]  vc4: vc4_vec_connector_get_modes 0
[   48.166995]  vc4: vc4_vec_encoder_atomic_check 0
[   60.525021]  vc4: vc4_vec_encoder_atomic_check 0
[   60.530701]  vc4: vc4_vec_connector_detect
[   60.530711]  vc4: vc4_vec_connector_get_modes 0
[   60.534353]  vc4: vc4_vec_encoder_atomic_check 4
[   60.534364]  vc4: vc4_vec_encoder_atomic_check -> EINVAL
[   60.535393]  vc4: vc4_vec_encoder_atomic_check 0
[   63.312436]  vc4: vc4_vec_encoder_atomic_check 0
[   63.316584]  vc4: vc4_vec_connector_detect
[   63.316589]  vc4: vc4_vec_connector_get_modes 0
[   63.322928]  vc4: vc4_vec_encoder_atomic_check 0
[   67.195934]  vc4: vc4_vec_encoder_atomic_check 0
[   67.201873]  vc4: vc4_vec_connector_detect
[   67.201882]  vc4: vc4_vec_connector_get_modes 0
[   67.206006]  vc4: vc4_vec_encoder_atomic_check 3
[   67.206019]  vc4: vc4_vec_encoder_atomic_check -> EINVAL
[   67.207036]  vc4: vc4_vec_encoder_atomic_check 0
[   69.400795]  vc4: vc4_vec_encoder_atomic_check 0
[   69.414540]  vc4: vc4_vec_connector_detect
[   69.414553]  vc4: vc4_vec_connector_get_modes 0
[   69.418091]  vc4: vc4_vec_encoder_atomic_check 2
[   69.418097]  vc4: vc4_vec_encoder_atomic_check -> EINVAL
[   69.419074]  vc4: vc4_vec_encoder_atomic_check 0
[   71.488937]  vc4: vc4_vec_encoder_atomic_check 0
[   71.499887]  vc4: vc4_vec_connector_detect
[   71.499895]  vc4: vc4_vec_connector_get_modes 0
[   71.501704]  vc4: vc4_vec_encoder_atomic_check 1
[   71.515852]  vc4: vc4_vec_encoder_atomic_check 1

``````
Trying to change DPMS doesn't fail, but it doesn't show the new value on modetest (I really don't know what dpms should do, so I can't check if there was an actual change).

Code: Select all

``````# modetest -M vc4 -c
Connectors:
id	encoder	status		name		size (mm)	modes	encoders
29	0	disconnected	HDMI-A-1       	0x0		0	28
props:
1 EDID:
flags: immutable blob
blobs:

value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0
flags: enum
value: 0
6 non-desktop:
flags: immutable range
values: 0 1
value: 0
30 left margin:
flags: range
values: 0 100
value: 0
31 right margin:
flags: range
values: 0 100
value: 0
32 top margin:
flags: range
values: 0 100
value: 0
33 bottom margin:
flags: range
values: 0 100
value: 0
44	43	unknown	composite-1    	0x0		1	43
modes:
name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
720x480 63 720 734 798 858 480 483 486 502 13500 flags: interlace; type: driver
props:
1 EDID:
flags: immutable blob
blobs:

value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0
flags: enum
value: 0
6 non-desktop:
flags: immutable range
values: 0 1
value: 0
36 mode:
flags: enum
enums: NTSC=0 NTSC-J=1 PAL=2 PAL-M=3 PAL-N=4
value: 1

# modetest -M vc4 -w 44:DPMS:1
# modetest -M vc4 -c
Connectors:
id	encoder	status		name		size (mm)	modes	encoders
29	0	disconnected	HDMI-A-1       	0x0		0	28
props:
1 EDID:
flags: immutable blob
blobs:

value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0
flags: enum
value: 0
6 non-desktop:
flags: immutable range
values: 0 1
value: 0
30 left margin:
flags: range
values: 0 100
value: 0
31 right margin:
flags: range
values: 0 100
value: 0
32 top margin:
flags: range
values: 0 100
value: 0
33 bottom margin:
flags: range
values: 0 100
value: 0
44	43	unknown	composite-1    	0x0		1	43
modes:
name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
720x480 63 720 734 798 858 480 483 486 502 13500 flags: interlace; type: driver
props:
1 EDID:
flags: immutable blob
blobs:

value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0
flags: enum
value: 0
6 non-desktop:
flags: immutable range
values: 0 1
value: 0
36 mode:
flags: enum
enums: NTSC=0 NTSC-J=1 PAL=2 PAL-M=3 PAL-N=4
value: 1

``````
Dmesg output:

Code: Select all

``````[  323.237746]  vc4: vc4_vec_encoder_atomic_check 1
[  323.253669]  vc4: vc4_vec_connector_detect
[  323.253682]  vc4: vc4_vec_connector_get_modes 1
[  323.280614]  vc4: vc4_vec_encoder_atomic_check 1
[  331.450606]  vc4: vc4_vec_encoder_atomic_check 1
[  331.452650]  vc4: vc4_vec_connector_detect
[  331.452659]  vc4: vc4_vec_connector_get_modes 1
[  331.456156]  vc4: vc4_vec_encoder_atomic_check 1
[  331.456194]  vc4: vc4_vec_encoder_disable
[  331.457148]  vc4: vc4_vec_encoder_atomic_check 1
[  331.457261]  vc4: vc4_vec_encoder_enable
[  331.457465]  vc4: vc4_vec_ntsc_mode_set
``````
The video output is always NTSC.

Should I try to comment out that -EINVAL?. Is there a way to change the initial mode at boot time?

6by9
Raspberry Pi Engineer & Forum Moderator
Posts: 13009
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

### Re: Understanding custom frequency setting in VEC

I'd need to try tracing through as to what and why that doesn't update. The PAL mode isn't listed, therefore a mode change to that I'd expect it to fail. The atomic API does allow changing properties and modes and planes atomically, so that may be required.

Default is set at https://github.com/torvalds/linux/blob/ ... #L368-L371
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

nickcis
Posts: 7
Joined: Tue Aug 21, 2012 1:59 pm

### Re: Understanding custom frequency setting in VEC

Thanks for the quick reply, I've tried modifying that default value in order to change the default mode, but, it doesnt' work. Although, the initial value is PAL N, the output video is NTSC (modetest reports the value is 0, so it's correct, it's ntsc). And the dmesg logs show that someone is setting the mode to 0 (ntsc) before enabling the conector.

Modetest output:

Code: Select all

``````44	43	unknown	composite-1    	0x0		1	43
modes:
name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
720x480 63 720 734 798 858 480 483 486 502 13500 flags: interlace; type: driver
props:
1 EDID:
flags: immutable blob
blobs:

value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0
flags: enum
value: 0
6 non-desktop:
flags: immutable range
values: 0 1
value: 0
36 mode:
flags: enum
enums: NTSC=0 NTSC-J=1 PAL=2 PAL-M=3 PAL-N=4
value: 0

``````
Dmesg output (all vc4_vec function log a `vc 4: <function name>`):

Code: Select all

``````dmesg -w
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.19.66-v7+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1253 SMP Thu Aug 15 11:49:46 BST 2019
[    0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: Raspberry Pi 3 Model B Rev 1.2
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] cma: Reserved 256 MiB at 0x1ec00000
[    0.000000] On node 0 totalpages: 242688
[    0.000000]   Normal zone: 2133 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 242688 pages, LIFO batch:63
[    0.000000] random: get_random_bytes called from start_kernel+0xac/0x4b4 with crng_init=0
[    0.000000] percpu: Embedded 17 pages/cpu s39488 r8192 d21952 u69632
[    0.000000] pcpu-alloc: s39488 r8192 d21952 u69632 alloc=17*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 240555
[    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 cma=256M  vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty3 root=PARTUUID=80a9759b-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait nosplash logo.nologo vt.global_cursor_default=0 systemd.show_status=0
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 684640K/970752K available (8192K kernel code, 629K rwdata, 2176K rodata, 1024K init, 821K bss, 23968K reserved, 262144K cma-reserved)
[    0.000000] Virtual kernel memory layout:
vector  : 0xffff0000 - 0xffff1000   (   4 kB)
fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
vmalloc : 0xbb800000 - 0xff800000   (1088 MB)
lowmem  : 0x80000000 - 0xbb400000   ( 948 MB)
modules : 0x7f000000 - 0x80000000   (  16 MB)
.text : 0x(ptrval) - 0x(ptrval)   (9184 kB)
.init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
.data : 0x(ptrval) - 0x(ptrval)   ( 630 kB)
.bss : 0x(ptrval) - 0x(ptrval)   ( 822 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] ftrace: allocating 26394 entries in 78 pages
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] arch_timer: cp15 timer(s) running at 19.20MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[    0.000007] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[    0.000023] Switching to timer-based delay loop, resolution 52ns
[    0.000290] Console: colour dummy device 80x30
[    0.000915] console [tty3] enabled
[    0.000973] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
[    0.001017] pid_max: default: 32768 minimum: 301
[    0.001366] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.001402] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.002335] CPU: Testing write buffer coherency: ok
[    0.002821] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.003487] Setting up static identity map for 0x100000 - 0x10003c
[    0.003655] rcu: Hierarchical SRCU implementation.
[    0.004471] smp: Bringing up secondary CPUs ...
[    0.005334] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.006264] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.007139] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.007260] smp: Brought up 1 node, 4 CPUs
[    0.007341] SMP: Total of 4 processors activated (153.60 BogoMIPS).
[    0.007365] CPU: All CPU(s) started in HYP mode.
[    0.007386] CPU: Virtualization extensions available.
[    0.008372] devtmpfs: initialized
[    0.021570] VFP support v0.3: implementor 41 architecture 3 part 40 variant 3 rev 4
[    0.021843] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.021892] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    0.032489] pinctrl core: initialized pinctrl subsystem
[    0.033466] NET: Registered protocol family 16
[    0.036599] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[    0.042403] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.042439] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.042658] Serial: AMBA PL011 UART driver
[    0.045281] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[    0.082259] bcm2835-dma 3f007000.dma: DMA legacy API manager at (ptrval), dmachans=0x1
[    0.083963] SCSI subsystem initialized
[    0.084208] usbcore: registered new interface driver usbfs
[    0.084284] usbcore: registered new interface driver hub
[    0.084397] usbcore: registered new device driver usb
[    0.100379] raspberrypi-firmware soc:firmware: Attached to firmware from 2019-08-15 12:06, variant start
[    0.110176] raspberrypi-firmware soc:firmware: Firmware hash is 0e6daa5106dd4164474616408e0dc24f997ffcf3
[    0.121990] clocksource: Switched to clocksource arch_sys_counter
[    0.211231] VFS: Disk quotas dquot_6.6.0
[    0.211342] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.211551] FS-Cache: Loaded
[    0.211778] CacheFiles: Loaded
[    0.212339] simple-framebuffer 3eb75000.framebuffer: framebuffer at 0x3eb75000, 0x85400 bytes, mapped to 0x(ptrval)
[    0.212383] simple-framebuffer 3eb75000.framebuffer: format=r5g6b5, mode=656x416x16, linelength=1312
[    0.215287] Console: switching to colour frame buffer device 82x26
[    0.219688] simple-framebuffer 3eb75000.framebuffer: fb0: simplefb registered!
[    0.231398] NET: Registered protocol family 2
[    0.234166] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes)
[    0.238143] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.240318] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    0.242599] TCP: Hash tables configured (established 8192 bind 8192)
[    0.244771] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.246866] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.249261] NET: Registered protocol family 1
[    0.251927] RPC: Registered named UNIX socket transport module.
[    0.254112] RPC: Registered udp transport module.
[    0.256204] RPC: Registered tcp transport module.
[    0.258211] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.262030] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 7 counters available
[    0.268985] Initialise system trusted keyrings
[    0.271145] workingset: timestamp_bits=14 max_order=18 bucket_order=4
[    0.283177] FS-Cache: Netfs 'nfs' registered for caching
[    0.285726] NFS: Registering the id_resolver key type
[    0.287742] Key type id_resolver registered
[    0.289693] Key type id_legacy registered
[    0.291591] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.295849] Key type asymmetric registered
[    0.297723] Asymmetric key parser 'x509' registered
[    0.299611] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
[    0.303490] io scheduler noop registered
[    0.305299] io scheduler deadline registered (default)
[    0.307245] io scheduler cfq registered
[    0.308948] io scheduler mq-deadline registered (default)
[    0.310637] io scheduler kyber registered
[    0.317674] bcm2835-rng 3f104000.rng: hwrng registered
[    0.319727] vc-mem: phys_addr:0x00000000 mem_base=0x3ec00000 mem_size:0x40000000(1024 MiB)
[    0.323595] vc-sm: Videocore shared memory driver
[    0.325624] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
[    0.339894] brd: module loaded
[    0.351726] loop: module loaded
[    0.354145] Loading iSCSI transport class v2.0-870.
[    0.356520] libphy: Fixed MDIO Bus: probed
[    0.358314] usbcore: registered new interface driver lan78xx
[    0.360067] usbcore: registered new interface driver smsc95xx
[    0.361724] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    0.391298] dwc_otg 3f980000.usb: base=(ptrval)
[    0.593203] Core Release: 2.80a
[    0.594849] Setting default values for core params
[    0.596506] Finished setting default values for core params
[    0.798430] Using Buffer DMA mode
[    0.800044] Periodic Transfer Interrupt Enhancement - disabled
[    0.801671] Multiprocessor Interrupt Enhancement - disabled
[    0.803287] OTG VER PARAM: 0, OTG VER FLAG: 0
[    0.804889] Dedicated Tx FIFOs mode
[    0.806878] WARN::dwc_otg_hcd_init:1045: FIQ DMA bounce buffers: virt = 9ed04000 dma = 0xded04000 len=9024
[    0.810230] FIQ FSM acceleration enabled for :
Non-periodic Split Transactions
Periodic Split Transactions
High-Speed Isochronous Endpoints
Interrupt/Control Split Transaction hack enabled
[    0.818420] dwc_otg: Microframe scheduler enabled
[    0.818477] WARN::hcd_init_fiq:457: FIQ on core 1
[    0.820056] WARN::hcd_init_fiq:458: FIQ ASM at 80654f4c length 36
[    0.821596] WARN::hcd_init_fiq:497: MPHI regs_base at bb810000
[    0.823138] dwc_otg 3f980000.usb: DWC OTG Controller
[    0.824723] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
[    0.826348] dwc_otg 3f980000.usb: irq 56, io mem 0x00000000
[    0.827967] Init: Port Power? op_state=1
[    0.829518] Init: Power Port (0)
[    0.831309] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
[    0.834550] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.836271] usb usb1: Product: DWC OTG Controller
[    0.837975] usb usb1: Manufacturer: Linux 4.19.66-v7+ dwc_otg_hcd
[    0.839692] usb usb1: SerialNumber: 3f980000.usb
[    0.842009] hub 1-0:1.0: USB hub found
[    0.843715] hub 1-0:1.0: 1 port detected
[    0.845907] dwc_otg: FIQ enabled
[    0.845913] dwc_otg: NAK holdoff enabled
[    0.845919] dwc_otg: FIQ split-transaction FSM enabled
[    0.845929] Module dwc_common_port init
[    0.846183] usbcore: registered new interface driver usb-storage
[    0.848019] mousedev: PS/2 mouse device common for all mice
[    0.850618] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[    0.852544] bcm2835-cpufreq: min=600000 max=1200000
[    0.854659] sdhci: Secure Digital Host Controller Interface driver
[    0.856305] sdhci: Copyright(c) Pierre Ossman
[    0.858337] mmc-bcm2835 3f300000.mmcnr: could not get clk, deferring probe
[    0.860438] sdhost-bcm2835 3f202000.mmc: could not get clk, deferring probe
[    0.862369] sdhci-pltfm: SDHCI platform and OF driver helper
[    0.865669] ledtrig-cpu: registered to indicate activity on CPUs
[    0.867627] hidraw: raw HID events driver (C) Jiri Kosina
[    0.869596] usbcore: registered new interface driver usbhid
[    0.871395] usbhid: USB HID core driver
[    0.873960] vchiq: vchiq_init_state: slot_zero = (ptrval), is_master = 0
[    0.877295] [vc_sm_connected_init]: start
[    0.884128] [vc_sm_connected_init]: end - returning 0
[    0.887014] Initializing XFRM netlink socket
[    0.888835] NET: Registered protocol family 17
[    0.890713] Key type dns_resolver registered
[    0.893001] Registering SWP/SWPB emulation handler
[    0.895326] registered taskstats version 1
[    0.905794] uart-pl011 3f201000.serial: cts_event_workaround enabled
[    0.907577] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 81, base_baud = 0) is a PL011 rev2
[    0.912961] mmc-bcm2835 3f300000.mmcnr: mmc_debug:0 mmc_debug2:0
[    0.914764] mmc-bcm2835 3f300000.mmcnr: DMA channel allocated
[    0.942677] sdhost: log_buf @ (ptrval) (ded07000)
[    0.981606] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[    0.984961] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    0.988225] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    0.992414] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[    0.994042] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[    0.996921] of_cfs_init
[    0.998545] of_cfs_init: OK
[    1.001086] Waiting for root device PARTUUID=80a9759b-02...
[    1.054911] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.060920] mmc0: new high speed SDHC card at address 59b4
[    1.063745] mmcblk0: mmc0:59b4 00000 14.9 GiB
[    1.067357]  mmcblk0: p1 p2
[    1.072182] Indeed it is in host mode hprt0 = 00021501
[    1.104700] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.107992] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    1.135312] random: fast init done
[    1.150140] devtmpfs: mounted
[    1.157242] Freeing unused kernel memory: 1024K
[    1.172403] Run /sbin/init as init process
[    1.181701] mmc1: new high speed SDIO card at address 0001
[    1.282042] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    1.283842] Indeed it is in host mode hprt0 = 00001101
[    1.522355] usb 1-1: New USB device found, idVendor=0424, idProduct=9514, bcdDevice= 2.00
[    1.525760] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    1.528234] hub 1-1:1.0: USB hub found
[    1.530217] hub 1-1:1.0: 5 ports detected
[    1.704041] systemd[1]: System time before build time, advancing clock.
[    1.852050] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[    1.883674] NET: Registered protocol family 10
[    1.886887] Segment Routing with IPv6
[    1.921428] random: systemd: uninitialized urandom read (16 bytes read)
[    1.926001] random: systemd: uninitialized urandom read (16 bytes read)
[    1.933874] systemd[1]: systemd 232 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN)
[    1.940166] systemd[1]: Detected architecture arm.
[    1.943590] systemd[1]: Set hostname to <ciscdeco>.
[    1.982515] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00, bcdDevice= 2.00
[    1.986395] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    1.989982] random: systemd-sysv-ge: uninitialized urandom read (16 bytes read)
[    1.993612] smsc95xx v1.0.6
[    2.086253] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:12:9d:5e
[    2.501263] systemd[1]: Listening on fsck to fsckd communication Socket.
[    2.504845] systemd[1]: Created slice System Slice.
[    2.507824] systemd[1]: Created slice system-getty.slice.
[    2.513821] systemd[1]: Mounting RPC Pipe File System...
[    2.516566] systemd[1]: Listening on udev Control Socket.
[    2.519080] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[    2.527336] systemd[1]: Mounting Debug File System...
[    2.676300] i2c /dev entries driver
[    3.112460] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[    3.386578] systemd-journald[102]: Received request to flush runtime journal from PID 1
[    3.666756] vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned.
[    3.669709] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[    3.669732] [vc_sm_connected_init]: start
[    3.678473] [vc_sm_connected_init]: installed successfully
[    3.762590] media: Linux media interface: v0.10
[    3.812213] videodev: Linux video capture interface: v2.00
[    3.890326] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    3.892800] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    3.955836] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[    3.968265] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    3.971144] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[    3.985281] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[    3.985298] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
[    3.992477] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[    3.992490] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
[    3.999728] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[    3.999741] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
[    4.050715] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    4.162745] brcmfmac: F1 signature read @0x18000000=0x1541a9a6
[    4.171491] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    4.171836] usbcore: registered new interface driver brcmfmac
[    4.248317]  vc4: vc4_vec_dev_probe
[    4.261593] vc4_hdmi 3f902000.hdmi: ASoC: Failed to create component debugfs directory
[    4.265848] vc4_hdmi 3f902000.hdmi: vc4-hdmi-hifi <-> 3f902000.hdmi mapping ok
[    4.266823] vc4-drm soc:gpu: bound 3f902000.hdmi (ops vc4_hdmi_ops [vc4])
[    4.266836]  vc4: vc4_vec_bind
[    4.266968]  vc4: vc4_vec_connector_init
[    4.267059] vc4-drm soc:gpu: bound 3f806000.vec (ops vc4_vec_ops [vc4])
[    4.267261] vc4-drm soc:gpu: bound 3f004000.txp (ops vc4_txp_ops [vc4])
[    4.267368] vc4-drm soc:gpu: bound 3f400000.hvs (ops vc4_hvs_ops [vc4])
[    4.267774] vc4-drm soc:gpu: bound 3f206000.pixelvalve (ops vc4_crtc_ops [vc4])
[    4.268145] vc4-drm soc:gpu: bound 3f207000.pixelvalve (ops vc4_crtc_ops [vc4])
[    4.268516] vc4-drm soc:gpu: bound 3f807000.pixelvalve (ops vc4_crtc_ops [vc4])
[    4.289398] vc4-drm soc:gpu: bound 3fc00000.v3d (ops vc4_v3d_ops [vc4])
[    4.289420] checking generic (3eb75000 85400) vs hw (0 ffffffff)
[    4.289427] fb: switching to vc4drmfb from simple
[    4.289647] Console: switching to colour dummy device 80x30
[    4.291109] [drm] Initialized vc4 0.0.0 20140616 for soc:gpu on minor 0
[    4.291124] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    4.291130] [drm] Driver supports precise vblank timestamp query.
[    4.292118]  vc4: vc4_vec_connector_detect
[    4.292143]  vc4: vc4_vec_connector_get_modes 0
[    4.296880]  vc4: vc4_vec_encoder_atomic_check 0
[    4.297083]  vc4: vc4_vec_encoder_atomic_mode_set 0
[    4.297122]  vc4: vc4_vec_encoder_enable
[    4.297255]  vc4: vc4_vec_ntsc_mode_set
[    4.314440] Console: switching to colour frame buffer device 90x30
[    4.314667]  vc4: vc4_vec_encoder_atomic_check 0
[    4.335961] vc4-drm soc:gpu: fb0: DRM emulated frame buffer device
[    4.402217] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    4.402305] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available
[    4.403015] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Oct 23 2017 03:55:53 version 7.45.98.38 (r674442 CY) FWID 01-e58d219f
[    5.392800] uart-pl011 3f201000.serial: no DMA platform data
[    5.441362]  vc4: vc4_vec_connector_detect
[    5.441378]  vc4: vc4_vec_connector_get_modes 0
[    5.441679]  vc4: vc4_vec_encoder_atomic_check 0
``````
(Sorry for the long paste, relevant lines start from `4.248317` time).

I'll try changing the `enum vc4_tv_mode_id` order, so I have the PAL N mode as 0. But, how can I check who is doing the `vc4_vec_encoder_atomic_mode_set` to 0 before the `vc4_vec_encoder_enable`? (If you can guide me in order to understand a bit more, I'll be happy to research for the answer)

(I'm not a kernel developer expert, sorry if I make some dumb comments / questions).

As far as the modeset error, I really couldn't understand your answer. What I'm understanding (please bare in mind the drm topic is something new to me), before doing an atomic mode set (in terms of vc4, the callback will be `vc4_vec_encoder_atomic_mode_set`) drm checks if the mode setting is valid by calling the `atomic_check` callback (talking in terms of the problem, it calls `vc4_vec_encoder_atomic_check`). This check will return an invalid argument error (-EINVAL), if the drm_connector_state has a crtc (if I'm not mistaken, this will always be the case because I'm already running the driver) and the `adjusted_mode` (this is a `struct drm_display_mode`, all ntsc modes share one and all pal share another) is different from the new mode. This explains why I can change to the other NTSC mode, but no to a PAL. I'll only be able to modeset to the desire mode when there is no `conn_state->crtc`. (Does this last condition only happen at initialization, ie, before enable is called?).

Again, thanks for you help and quick replies

6by9
Raspberry Pi Engineer & Forum Moderator
Posts: 13009
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

### Re: Understanding custom frequency setting in VEC

I've just been looking at the 4.19 kernel driver and comparing to the Intel i915 driver and there appears to be a bit missing.
You are totally correct that you can't switch to a mode with an alternate resolution at present. Switching between NTSC and NTSC-J works fine.

i915 checks the mode via a connector helper "intel_tv_atomic_check" and signals "connectors_changed" should the mode or overscan have changed. vc4 didn't have that, but adding that seems to resolve the issue.

The full patch becomes

Code: Select all

``````diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c
index 8e7facb..7924d72 100644
--- a/drivers/gpu/drm/vc4/vc4_vec.c
+++ b/drivers/gpu/drm/vc4/vc4_vec.c
@@ -216,6 +216,7 @@ enum vc4_vec_tv_mode_id {
VC4_VEC_TV_MODE_NTSC_J,
VC4_VEC_TV_MODE_PAL,
VC4_VEC_TV_MODE_PAL_M,
+       VC4_VEC_TV_MODE_PAL_N,
};

struct vc4_vec_tv_mode {
@@ -310,6 +311,13 @@ static void vc4_vec_pal_m_mode_set(struct vc4_vec *vec)
VEC_WRITE(VEC_FREQ1_0, 0x61d1);
}

+static void vc4_vec_pal_n_mode_set(struct vc4_vec *vec)
+{
+       printk(KERN_ERR " vc4: vc4_vec_pal_n_mode_set\n");
+       VEC_WRITE(VEC_CONFIG0, VEC_CONFIG0_PAL_N_STD);
+       VEC_WRITE(VEC_CONFIG1, VEC_CONFIG1_C_CVBS_CVBS);
+}
+
static const struct drm_display_mode pal_mode = {
DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 13500,
720, 720 + 20, 720 + 20 + 64, 720 + 20 + 64 + 60, 0,
@@ -334,6 +342,10 @@ static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = {
.mode = &pal_mode,
.mode_set = vc4_vec_pal_m_mode_set,
},
+       [VC4_VEC_TV_MODE_PAL_N] = {
+               .mode = &pal_mode,
+               .mode_set = vc4_vec_pal_n_mode_set,
+       },
};

static enum drm_connector_status
@@ -348,6 +360,28 @@ static void vc4_vec_connector_destroy(struct drm_connector *connector)
drm_connector_cleanup(connector);
}
+static const struct vc4_vec_tv_mode *
+vc4_vec_mode_find(const struct drm_connector_state *conn_state)
+{
+       int format = conn_state->tv.mode;
+
+       return &vc4_vec_tv_modes[format];
+}
+
+static enum drm_mode_status
+vc4_vec_mode_valid(struct drm_connector *connector,
+                  struct drm_display_mode *mode)
+{
+       const struct vc4_vec_tv_mode *tv_mode =
+                               vc4_vec_mode_find(connector->state);
+
+       /* Ensure TV refresh is close to desired refresh */
+       if (tv_mode)
+               return MODE_OK;
+
+       return MODE_CLOCK_RANGE;
+}
+
static int vc4_vec_connector_get_modes(struct drm_connector *connector)
{
struct drm_connector_state *state = connector->state;
@@ -365,6 +399,36 @@ static int vc4_vec_connector_get_modes(struct drm_connector *connector)
return 1;
}

+//static int vc4_vec_atomic_check(struct drm_connector *connector,
+//                             struct drm_atomic_state *state)
+static int vc4_vec_atomic_check(struct drm_connector *connector,
+                               struct drm_connector_state *new_state)
+{
+//     struct drm_connector_state *new_state;
+       struct drm_crtc_state *new_crtc_state;
+       struct drm_connector_state *old_state;
+
+//     new_state = drm_atomic_get_new_connector_state(state, connector);
+       if (!new_state->crtc)
+               return 0;

+//     old_state = drm_atomic_get_old_connector_state(state, connector);
+//     new_crtc_state = drm_atomic_get_new_crtc_state(state, new_state->crtc);
+       old_state = drm_atomic_get_old_connector_state(new_state->state, connector);
+       new_crtc_state = drm_atomic_get_new_crtc_state(new_state->state, new_state->crtc);
+
+       if (old_state->tv.mode != new_state->tv.mode ||
+           old_state->tv.margins.left != new_state->tv.margins.left ||
+           old_state->tv.margins.right != new_state->tv.margins.right ||
+           old_state->tv.margins.top != new_state->tv.margins.top ||
+           old_state->tv.margins.bottom != new_state->tv.margins.bottom) {
+               /* Force a modeset. */
+               new_crtc_state->connectors_changed = true;
+       }
+
+       return 0;
+}
+
static const struct drm_connector_funcs vc4_vec_connector_funcs = {
.detect = vc4_vec_connector_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
@@ -376,6 +440,8 @@ static const struct drm_connector_funcs vc4_vec_connector_funcs = {

static const struct drm_connector_helper_funcs vc4_vec_connector_helper_funcs = {
.get_modes = vc4_vec_connector_get_modes,
+       .mode_valid = vc4_vec_mode_valid,
+       .atomic_check = vc4_vec_atomic_check,
};

static struct drm_connector *vc4_vec_connector_init(struct drm_device *dev,
@@ -531,6 +597,7 @@ static int vc4_vec_encoder_atomic_check(struct drm_encoder *encoder,
vec_mode = &vc4_vec_tv_modes[conn_state->tv.mode];

if (conn_state->crtc &&
+           !crtc_state->connectors_changed &&
return -EINVAL;

@@ -555,6 +622,7 @@ static const char * const tv_mode_names[] = {
[VC4_VEC_TV_MODE_NTSC_J] = "NTSC-J",
[VC4_VEC_TV_MODE_PAL] = "PAL",
[VC4_VEC_TV_MODE_PAL_M] = "PAL-M",
+       [VC4_VEC_TV_MODE_PAL_N] = "PAL-N",
};

static int vc4_vec_bind(struct device *dev, struct device *master, void *data)
``````
Apologies for the commented out code, but the prototype for atomic_check has changed between 4.19 and 5.4, but I wanted to keep the 5.4 syntax to hand for when I try it out there.

I haven't been able to test that it actually switches the output format (cable woes still), but it changes the reported mode in the expected manner.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

6by9
Raspberry Pi Engineer & Forum Moderator
Posts: 13009
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

### Re: Understanding custom frequency setting in VEC

6by9 wrote:
Wed Sep 02, 2020 2:05 pm
I've just been looking at the 4.19 kernel driver and comparing to the Intel i915 driver and there appears to be a bit missing.
You are totally correct that you can't switch to a mode with an alternate resolution at present. Switching between NTSC and NTSC-J works fine.

...
I haven't been able to test that it actually switches the output format (cable woes still), but it changes the reported mode in the expected manner.
Still not right. It doesn't switch the resolution in the way I'd expect. I need to refer this to the person who understands DRM/KMS better than I do.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.