tdo_panel: bcm27xx-gpu: Add dsi panel driver;#7318
tdo_panel: bcm27xx-gpu: Add dsi panel driver;#7318flash-fea wants to merge 705 commits intoraspberrypi:rpi-6.18.yfrom
Conversation
flash-fea
commented
Apr 16, 2026
The documentation says that the TPZ filter can not upscale, and requesting a scaling factor > 1:1 will output the original image in the top left, and repeat the right/bottom most pixels thereafter. That fits perfectly with upscaling a 1x1 image which is done a fair amount by some compositors to give solid colour, and it saves a large amount of LBM (TPZ is based on src size, whilst PPF is based on dest size). Select TPZ filter for images with source rectangle <=1. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The register to enable/disable background fill was being set from atomic flush, however that will be applied immediately and can be a while before the vblank. If it was required for the current frame but not for the next one, that can result in corruption for part of the current frame. Store the state in vc4_hvs, and update it on vblank. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The HVS can accept an arbitrary number of planes, provided that the overall pixel read load is within limits, and the display list can fit into the dlist memory. Now that DRM will support 64 planes per device, increase the number of overlay planes from 16 to 48 so that the dlist complexity can be increased (eg 4x4 video wall on each of 3 displays). Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Instead of having 48 generic overlay planes, assign 32 to the writeback connector so that there is no ambiguity in wlroots when trying to find a plane for composition using the writeback connector vs display. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The transposer/writeback connector should be running with a lower priority, so shouldn't be factored into the load calculations. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
As the writeback connector doesn't have the same realtime constraints of a live display, drop the panic priority for it. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The txp block can implement transpose as it writes out the image data, so expose that through the new connector rotation property. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> drm: vc4: txp: Do not allow 24bpp formats when transposing The hardware doesn't support transposing to 24bpp (RGB888/BGR888) formats. There's no way to advertise this through DRM, so block it from atomic_check instead. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Currently, booting with no hdmi connected has: pi@pi4:~ $ vcgencmd measure_clock hdmi pixel frequency(9)=120010256 frequency(29)=74988280 After connecting hdmi we get: pi@pi4:~ $ vcgencmd measure_clock hdmi pixel frequency(9)=300005856 frequency(29)=149989744 and that persists after disconnecting hdmi I can measure this on a power supply as 10mA@5.2V (52mW). We should always remove clk_set_min_rate requests when we no longer need them. Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Whilst BCM2712 does fix using odd horizontal timings, it doesn't work with interlaced modes. Drop the workaround for interlaced modes and revert to the same behaviour as BCM2711. raspberrypi#6281 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
This is a squash of all firmware-kms related patches from previous branches, up to and including "drm/vc4: Set the possible crtcs mask correctly for planes with FKMS" plus a couple of minor fixups for the 5.9 branch. Please refer to earlier branches for full history. This patch includes work by Eric Anholt, James Hughes, Phil Elwell, Dave Stevenson, Dom Cobley, and Jonathon Bell. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> drm/vc4: Fixup firmware-kms after "drm/atomic: Pass the full state to CRTC atomic enable/disable" Prototype for those calls changed, so amend fkms (which isn't upstream) to match. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> drm/vc4: Fixup fkms for API change Atomic flush and check changed API, so fix up the downstream-only FKMS driver. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> drm/vc4: Make normalize_zpos conditional on using fkms Eric's view was that there was no point in having zpos support on vc4 as all the planes had the same functionality. Can be later squashed into (and fixes): drm/vc4: Add firmware-kms mode Signed-off-by: Dom Cobley <popcornmix@gmail.com> drm/vc4: FKMS: Change of Broadcast RGB mode needs a mode change The Broadcast RGB (aka HDMI limited/full range) property is only notified to the firmware on mode change, so this needs to be signalled when set. raspberrypi/firmware#1580 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> vc4/drv: Only notify firmware of display done with kms fkms driver still wants firmware display to be active Signed-off-by: Dom Cobley <popcornmix@gmail.com> ydrm/vc4: fkms: Fix margin calculations for the right/bottom edges The calculations clipped the right/bottom edge of the clipped range based on the left/top margins. raspberrypi#4447 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> drm/vc4: fkms: Use new devm_rpi_firmware_get api drm/kms: Add allow_fb_modifiers Signed-off-by: Dom Cobley <popcornmix@gmail.com> drm/vc4: Add async update support for cursor planes Now that cursors are implemented as regular planes, all cursor movements result in atomic updates. As the firmware-kms driver doesn't support asynchronous updates, these are synchronous, which limits the update rate to the screen refresh rate. Xorg seems unaware of this (or at least of the effect of this), because if the mouse is configured with a higher update rate than the screen then continuous mouse movement results in an increasing backlog of mouse events - cue extreme lag. Add minimal support for asynchronous updates - limited to cursor planes - to eliminate the lag. See: raspberrypi#4971 raspberrypi#4988 Signed-off-by: Phil Elwell <phil@raspberrypi.com> drivers/gpu/drm/vc4: Add missing 32-bit RGB formats The missing 32-bit per pixel ABGR and various "RGB with an X value" formats are added. Change sent by Dave Stevenson. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> drm: vc4: Fixup duplicated macro definition in vc4_firmware_kms Both vc4_drv.h and vc4_firmware_kms.c had definitions for to_vc4_crtc. Rename the fkms one to make it unique, and drop the magic define vc4_crtc vc4_kms_crtc define to_vc4_crtc to_vc4_kms_crtc that renamed half the variable and function names in a slightly unexpected way. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> drm/vc4: Fix FKMS for when the YUV chroma planes are different buffers The code was assuming that it was a single buffer with offsets, when kmstest uses separate buffers and 0 offsets for each plane. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> drm/vc4: fkms: Rename plane related functions The name collide with the Full KMS functions that are going to be made public. Signed-off-by: Maxime Ripard <maxime@cerno.tech> drm/vc4_fkms: Fix up interrupt handler for both 2835/2711 and 2712 2712 has switched from using the SMI peripheral to another interrupt source for the vsync interrupt, so handle both sources cleanly. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> drm/vc4: fkms: No SMI abuse needed on BCM2712 Since we don't use the (absent) SMI block to create interrupts on BCM2712, there's no need to map any registers. Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Testing whether the VideoCore generation we want to mock is vc5 or vc4 worked so far, but will be difficult to extend to support BCM2712 (VC6). Convert to a switch. Signed-off-by: Maxime Ripard <maxime@cerno.tech>
The DRM device pointer and the DRM encoder pointer are redundant, since the latter is attached to the former and we can just follow the drm_encoder->dev pointer. Let's remove the drm_device pointer argument. Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Some tests will need to retrieve the output that was just allocated by vc4_mock_atomic_add_output(). Instead of making them look them up in the DRM device, we can simply make vc4_mock_atomic_add_output() return an error pointer that holds the allocated output instead of the error code. Signed-off-by: Maxime Ripard <maxime@cerno.tech>
The BCM2712 has a simpler pipeline that can only output to a writeback connector and two HDMI controllers. Let's allow our kunit tests to create a mock of that pipeline. Signed-off-by: Maxime Ripard <maxime@cerno.tech>
The BCM2712 has a simpler pipeline than the BCM2711, and thus the muxing requirements are different. Create some tests to make sure we get proper muxing decisions. Signed-off-by: Maxime Ripard <maxime@cerno.tech>
The current mock planes were just using the regular drm_plane_state, while the driver expect struct vc4_plane_state that subclasses drm_plane_state. Hook the proper implementations of reset, duplicate_state, destroy and atomic_check to create vc4_plane_state. Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Some tests will need to find a plane to run a test on for a given CRTC. Let's create a small helper to do that. Signed-off-by: Maxime Ripard <maxime@cerno.tech>
We'll start to add some tests for the plane state logic, so let's create a helper to add a plane to an existing atomic state. Signed-off-by: Maxime Ripard <maxime@cerno.tech>
We'll start testing our planes code in situations where we will use more than XRGB8888, so let's add a few common pixel formats. Signed-off-by: Maxime Ripard <maxime@cerno.tech>
The BCM2712 comes with a different LBM size computation than the previous generations, so let's add the few examples provided as kunit tests to make sure we always satisfy those requirements. Signed-off-by: Maxime Ripard <maxime@cerno.tech>
The tests on vc4 (BCM2835-7) were checking for DSI1 muxing being to restricted channel 2, and therefore muxing with TXP was impossible. As we no longer have that restriction, update the capabilities defined for DSI1, move the tests that used to be impossible to the valid list, and extend for additional combinations that are now possible. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Following the example of [1], move the state allocation out of the init function to make it thread safe. [1] commit 7e0351a ("drm/vc4: tests: Stop allocating the state in test init") Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Get the KUnit tests passing. Signed-off-by: Maíra Canal <mcanal@igalia.com>
LBM is only relevant for each active dlist, so there is no need to double-buffer the allocations. Cache the allocations per plane so that we can ensure the allocations are possible. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Add ALSA jack detection to the vc4-hdmi audio driver so userspace knows when to add/remove HDMI audio devices. Signed-off-by: David Turner <david.turner@raspberrypi.com>
Slave addresses for DMA are meant to be supplied as physical addresses (contrary to what struct snd_dmaengine_dai_dma_data does). Signed-off-by: Phil Elwell <phil@raspberrypi.com>
It was noted that if PV1 was in use to drive DSI1, then the writeback connector could not be used as HVS channel 2 was already in use. The HVS allows PV1 (HVS output 2) to be driven by any HVS channel via the DSP3_MUX setting, but that was hardcoded to be either 2 (for PV1) or disabled for TXP. Expand the available channels field for PV1, and configure DSP3_MUX accordingly. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
If an HDMI connector has no EDID and the mode is set via the kernel command line, then drm_reset_display_info() is the only thing that will have set up any of connector->display_info. With commit 26ff1c3 ("drm/connector: hdmi: Compute bpc and format automatically"), it is now checked that DRM_COLOR_FORMAT_RGB444 is supported. Whilst it doesn't fail the request, it does log dev_warn for every commit, spamming the log. For HDMI connectors initialise the color_format field to say it supports RGB444. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
vc4's debugfs support was updated with drm_debugfs_entry whilst BCM2712 support was in progress, and missed that the lookup in vc6_hvs_debugfs_dlist still followed the old pattern. Correct that lookup to avoid an invalid dereference. Fixes: f7af8ae ("drm/vc4: hvs: Add support for BCM2712 HVS") Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
In raspberrypi#6504 the nvme HMB allocation was found to come from CMA so was restricted to zero on the basis of a superficial amount of testing showing no performance impact. This is not the case for high-density low-capacity DRAM-less drives, where random read can suffer up to 50% degradation. With the addition of commit 6686634 ("nvme-pci: manually allocate Host Memory Buffer segments on arm64") this restriction is no longer necessary. Bump the default to 32MiB, which is a fair compromise for increasing random read performance on smaller drives that typically have less internal parallelism and request smaller HMBs. Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
7a2e2f8 to
840f6f9
Compare
|
whether the addition was successful? |
|
The partitioning of the code looks good, and checkpatch is happy. This isn't my field of expertise so there is limited input I can give regarding the driver itself - perhaps @6by9 has some comments - but there are a few things I have spotted:
|
|
Sorry I had all my review comments pending on the 6.12 version. Now posted. Largely the same as pelwell has commented with regard pr_err debugging and authorship, but also a couple of other points. |
|
yes,some informations need to change,about two dev_err() only use in debug to find by text easyier,but forget to recover. |
| @@ -0,0 +1,69 @@ | |||
| /* | |||
| * Device Tree overlay for Waveshare DSI Touchscreens | |||
| compatible = "tdo,4.0-dsi-tl040wvs17"; | ||
| status = "okay"; | ||
| reg = <0>; | ||
| reset-gpios = <&gpio 47 1>; // Dummy GPIO , Unused or change |
There was a problem hiding this comment.
delete all? reset-gpios maybe use in future,i see these were added also in other dts.
There was a problem hiding this comment.
You can add it at a later stage via an override if it is needed.
As it stands the driver will claim a totally unrelated GPIO for no particular reason. GPIO 47 isn't necessarily unused or even present on all devices, so could actually cause issues if left in.
There was a problem hiding this comment.
some my device's driver need it, as how i write to overlay in use
There was a problem hiding this comment.
For those devices that do require it you can add an additional fragment to configure it which can be enabled by the relevant override.
A similar case is https://github.com/raspberrypi/linux/blob/rpi-6.12.y/arch/arm/boot/dts/overlays/edt-ft5406.dtsi#L11-L16 where we want to add the touchscreen-inverted-x; property on demand, triggered by the invx override
With the driver calling devm_gpiod_get_optional, the driver doesn't need it. It's permitted to call any of the gpiod_ functions with the returned (NULL) handle.
There was a problem hiding this comment.
like this?
reset_pin = <&panel>,"reset-gpios:47";
and modify driver for devm_gpiod_get_optional.
There was a problem hiding this comment.
Close:
reset_pin = <&panel>,"reset-gpios:0=",<&gpio>,
<&panel>,"reset-gpios:4=47",
<&panel>,"reset-gpios:8=1";
will create the reset-gpios property if you use the reset_pin parameter, but 6by9 was suggesting that you would build that into a product declaration:
new_panel_needing_reset = <&panel>, "compatible=tdo,new-panel-needing-reset",
<&panel>,"reset-gpios:0=",<&gpio>,
<&panel>,"reset-gpios:4=47",
<&panel>,"reset-gpios:8=1";
But it might be cleaner to have a dormant fragment that gets enabled as needed.
There was a problem hiding this comment.
The driver is already using
ctx->reset = devm_gpiod_get_optional(&dsi->dev, "reset", GPIOD_OUT_LOW);
That means that ctx->reset will not return an error if reset-gpios is missing.
Add an additional fragment along the lines of:
fragment@10 {
target = <&panel>;
reset_gpio_frag: __dormant__ {
reset-gpios = <&gpio 47 1>;
};
};
__overrides__ {
reset_pin = <0>, "+10",
<&reset_gpio_frag>, "reset-gpios:4";
};
You can then have dtoverlay=vc4-kms-dsi-tdo-panel,reset_pin=47 to enable the reset gpio and set it to 47 (or whatever other GPIO number you wish to use).
Just looking through the various Pi variants, gpio 47 is used for:
- Pi1A/B: SD card detect
- Pi1A+, B+, 2B, 3B, Zero, ZeroW: Activity LED
- Pi 3B+/A+, CM3, CM4, 02W, CM0 : I2C to SMPS
- CM1: EMMC_ENABLE_N
This is why I say it can't be claimed generically by the overlay.
(Pi5 appears to use it for 2712_WAKE)
There was a problem hiding this comment.
this reset pin is not decided yet,can you give me a suggest? now dts add this->
+fragment@4 {
-
target = <&panel>; -
reset_gpio_frag: __dormant__ { -
reset-gpios = <&gpio 47 1>; -
}; - };
dsi0 = <&dsi_frag>, "target:0=",<&dsi0>,
<&i2c_frag>, "target:0=",<&i2c_csi_dsi0>;
- reset_pin = <0>, "+10",
-
<&reset_gpio_frag>, "reset-gpios:4";
There was a problem hiding this comment.
ctx->reset = devm_gpiod_get_optional(&dsi->dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(ctx->reset))
dev_warn(&dsi->dev, "Couldn't get the reset GPIO\n");
| struct drm_display_mode *mode; | ||
|
|
||
| mode = drm_mode_duplicate(connector->dev, ctx->desc->mode); | ||
| dev_info(&ctx->dsi->dev, "%ux,%ux,%ux\n", ctx->desc->mode->hdisplay, |
There was a problem hiding this comment.
No user needs to see this - dev_dbg or delete.
| struct tdo_panel *ctx; | ||
| int ret; | ||
|
|
||
| dev_info(&dsi->dev, "dsi panel: %s\n", |
There was a problem hiding this comment.
It is preferred for successful probing to generate minimal output. Perhaps defer this line to after the number of lanes is available and combine the two?
| struct tdo_panel *ctx = mipi_dsi_get_drvdata(dsi); | ||
|
|
||
| if (ctx->reset) { | ||
| dev_info(&dsi->dev, "shutdown\n"); |
There was a problem hiding this comment.
You really don't need this.
There was a problem hiding this comment.
struct tdo_panel *ctx = mipi_dsi_get_drvdata(dsi);
gpiod_set_value_cansleep(ctx->reset, 0);
like this,is it ok?
There was a problem hiding this comment.
I was referring to the dev_info()
|
my company need only one driver to use all our mipi panel,it seems to add some after this request finish. |
| rotation Display rotation {0,90,180,270} | ||
| dsi0 Use DSI0 and i2c_csi_dsi0 (rather than | ||
| the default DSI1 and i2c_csi_dsi). | ||
| reset_pin GPIO pin for RESET (default 25) |
There was a problem hiding this comment.
This is not true - there is no default value, because you can't enable the reset pin without assigning a value.
| rotation = <&panel>, "rotation:0"; | ||
| dsi0 = <&dsi_frag>, "target:0=",<&dsi0>, | ||
| <&i2c_frag>, "target:0=",<&i2c_csi_dsi0>; | ||
| reset_pin = <0>, "+10", |
There was a problem hiding this comment.
The number after the "+" is the number of the fragment to enable, which in this case should be 4.
… 2.1 Round When porting the code for the Pimoroni HyperPixel 2.1 Round from Linux 6.6 to Linux 6.12, the bus_flags configuration was overlooked. Porting bus_flags resolves the noise issues that were occurring. See: raspberrypi#7194 Signed-off-by: Akira Ouchi <akkiesoft@marokun.net>
You haven't actually answered my questions as to whether you are actually representing TDO as the panel manufacturer, and whether you are creating a product to use this with a Raspberry Pi. You may prefer having a single driver for all displays, but the mainline Linux folks may disagree and wish the panels to be clustered into similar families or by controller IC. |
|
Yes, I work at TDO. The company is currently expanding into the Raspberry Pi market, and in fact, some customers are already using it in a variety of scenarios. Merging into the branch will facilitate future work. |
7aa28c5 to
2677911
Compare
|
I've split the long README line |
panel-tdo-dsi-v1.c as module to driver tdo panel. Signed-off-by: kun_liu <kun_liu@shtdo.com>
__overrides__ parameter can be add in config.txt for customers. README describe the dts config info. Signed-off-by: kun_liu <kun_liu@shtdo.com>
Share panel drivers to bcmxxx_defconfig as module to use in all. Signed-off-by: kun_liu <kun_liu@shtdo.com>