Skip to contentSkip to conversation

How to specify panel bit order in driver?

DISCUSSION John Watts 3 participants 4 messages Jun 28, 2024 – Jul 2, 2024

lore
Share & tools
lore

John Watts

author
#0 lore raw

Hello there,

A while ago I added support for the FS035VG158 panel to the kernel, with its use case being on a Allwinner T113 board.

While troubleshooting some other issue (I will be posting about that this weekend) I found that I need to tell the panel controller to use a bit depth of 18-bit in order for the panel to work correctly.

I plan to add another panel to the kernel that also requires setting the bit depth, but has more configurations than just 24, 18, 16, it also supports packing 18 of the bits together.

How all of this is configured depends on how the board and panel are wired together, it can't be determined at runtime based on pixel formats or anything like that. It seems to me that this needs to be specified in the device tree.

My question is: How would I represent this? A property like 'bit-depth'? 'color-mapping'? Or is there already some subsystem or convention designed for this?

John.

#1 lore raw
Quoted 4 lines · John Watts

Hello there,

A while ago I added support for the FS035VG158 panel to the kernel, with its use case being on a Allwinner T113 board.

Might be helpful to actually point at the source code or commits or something.

Quoted 8 lines

While troubleshooting some other issue (I will be posting about that this weekend) I found that I need to tell the panel controller to use a bit depth of 18-bit in order for the panel to work correctly.

I plan to add another panel to the kernel that also requires setting the bit depth, but has more configurations than just 24, 18, 16, it also supports packing 18 of the bits together.

Quoted 7 lines

How all of this is configured depends on how the board and panel are wired together, it can't be determined at runtime based on pixel formats or anything like that. It seems to me that this needs to be specified in the device tree.

My question is: How would I represent this? A property like 'bit-depth'? 'color-mapping'? Or is there already some subsystem or convention designed for this?

Maybe look at include/uapi/drm/drm_fourcc.h, and how the DRM_FORMAT_* macros are used.

Can't help you with device tree, but maybe this gives you pointers to other places for examples.

HTH,
Jani.

Signature · 1 line
Jani Nikula, Intel
author
#2 lore raw

Hi Jani,

Quoted 2 lines · Jani Nikula

Might be helpful to actually point at the source code or commits or something.

The source code is here: drivers/gpu/drm/panel/panel-newvision-nv3052c.c It's just a standard MIPI DBI panel. It reports using an RGB888 bus format.

Quoted 5 lines

Maybe look at include/uapi/drm/drm_fourcc.h, and how the DRM_FORMAT_* macros are used.

Can't help you with device tree, but maybe this gives you pointers to other places for examples.

Currently it works like this:

- DRM uses 24-bit depth
- CRTC puts out a 24-bit signal
- This gets output over LCD pins
- The PCB drops 2 bits per channel by wiring 6 pins to GND
- The panel is told to only use 18 bits

Getting DRM to use MEDIA_BUS_FMT_RGB666_1X18 would be nice and allow the panel to auto-detect which bits to use. But the bus format is set in the panel :(

Where is the bus format usually set for cases where a board only supports a physical format?

Quoted 6 lines

HTH,
Jani.

Signature · 1 line
Jani Nikula, Intel

John.

#3 lore raw
Quoted 23 lines · John Watts

Hi Jani,

Quoted 2 lines · Jani Nikula

Might be helpful to actually point at the source code or commits or something.

The source code is here: drivers/gpu/drm/panel/panel-newvision-nv3052c.c It's just a standard MIPI DBI panel. It reports using an RGB888 bus format.

Quoted 5 lines

Maybe look at include/uapi/drm/drm_fourcc.h, and how the DRM_FORMAT_* macros are used.

Can't help you with device tree, but maybe this gives you pointers to other places for examples.

Currently it works like this:

- DRM uses 24-bit depth
- CRTC puts out a 24-bit signal
- This gets output over LCD pins
- The PCB drops 2 bits per channel by wiring 6 pins to GND
- The panel is told to only use 18 bits

Quoted 5 lines

Getting DRM to use MEDIA_BUS_FMT_RGB666_1X18 would be nice and allow the panel to auto-detect which bits to use. But the bus format is set in the panel :(

Where is the bus format usually set for cases where a board only supports a physical format?

This is usally the panel driver.

We have been discussing adding a proper atomic_* support to the drm_panel. This should allow panel drivers to actually negotiate what is going on. Marijn started looking at it, but the patches never hit the ML.

So, if the static configuration fits you, then just set it in the panel config. If not, you might have either to implement some hacks (like having a DT property describing how the panel is actually wired).

Quoted 9 lines
Quoted 7 lines

HTH,
Jani.

Signature · 1 line
Jani Nikula, Intel

John.

Signature · 2 lines
With best wishes
Dmitry