Skip to content

[RFC | DO NOT MERGE] vchiq_arm: Please fillout comments #6801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 674 commits into
base: rpi-6.15.y
Choose a base branch
from

Conversation

lategoodbye
Copy link
Contributor

There is still an open TODO about some high-level descriptions mostly related to the VideoCore interface (ABI, IOCTL) and the thread architecture. The idea is to document most of them inline, which should be more helpful than a separate document describing VCHIQ. I tried to mark the relevant points.

This branch is not intended for merge.

This is an alternative approach to #2730

@lategoodbye
Copy link
Contributor Author

@pelwell Gentle ping

@pelwell
Copy link
Contributor

pelwell commented Apr 28, 2025

Plenty of people have worked on this driver without such documentation. What practical difference will it make now? Is this the one thing blocking it from coming out of staging?

@kbingham
Copy link
Contributor

kbingham commented Apr 28, 2025

I think this was indeed one of the blocking points for us - as we never got a response from RPi on the Pi side documentation requirements.

If we were to document the vchiq ioctls we'd just be guessing what's happening on the other side and wouldn't be any better than an LLM respnose ;-)

(Clarification - it was blocking points to us completing the documentation - as for the requirement to document in the first place - that came from upstream previously)

@kbingham
Copy link
Contributor

Also - I'm still really looking forward to vchiq being destaged - as this was the key blocker to getting the RPi4 ISP support merged from what I recall.

@lategoodbye
Copy link
Contributor Author

lategoodbye commented Apr 28, 2025

Yes, as a developer i hate documentation, too. But userspace interfaces like IOCTL needs to be documented. Greg Kroah-Hartman was recently a bit uneasy about destaging of VCHIQ. In most cases a short sentences should be enough.

Thanks

popcornmix and others added 22 commits May 6, 2025 14:22
This code:
for_each_sg(sgl, sg, sg_len, i)
  num_sgs += DIV_ROUND_UP(sg_dma_len(sg), axi_block_len);

determines how many hw_desc are allocated.
If sg_dma_len(sg)=0 we don't allocate for this sgl.

However in the next loop, we will increment loop
for this case, and loop gets higher than num_sgs
and we trample memory.

Signed-off-by: Dom Cobley <[email protected]>
"rotation" is listed as a standard property of panels in panel-common.yaml,
therefore it would be logical to process that from within the core
code should a panel driver not implement the get_orientation hook.

Call of_drm_get_panel_orientation from
drm_connector_set_orientation_from_panel to get that information.

This removes the need for any boiler-plate in panel drivers for calling
drm_connector_set_orientation_from_panel or
drm_connector_set_panel_orientation.

Signed-off-by: Dave Stevenson <[email protected]>
The autodetection of resolution/timing by the TC358762 can lead
to the display being shifted by a pixel or two.

Program the TC358762 with the requested mode timing so that
it can reproduce it accurately.

Signed-off-by: Dave Stevenson <[email protected]>
Reverts 8a4b2fc ("drm/bridge: tc358762: Split register programming from pre-enable to enable")
as we want the config commands sent before video starts.

Signed-off-by: Dave Stevenson <[email protected]>
Having accepted the upstream change to add the persist_gpio_outputs
parameter, make it true by default.

See: raspberrypi#6117

Signed-off-by: Phil Elwell <[email protected]>
Even when configured to use only gpiod CS lines, the DW SPI controller
still expects a bit to be set in the SER register, otherwise transfers
stall. For the csgpiod case, nominate bit 0 for the job.

See: raspberrypi#6159

Signed-off-by: Phil Elwell <[email protected]>
Add shutdown and remove hooks so that the panel gets powered
off with the system.

Signed-off-by: Dave Stevenson <[email protected]>
As with many microcontrollers, the panel wants to use clock
stretching during a read so that the appropriate return value
can be generated and programmed into the hardware.
With Pi0-3 really not supporting clock stretching, this resulted
in the panel firmware dying.

Insert a delay between the write and the read to give the firmware
a chance to generate the relevant return value.

Signed-off-by: Dave Stevenson <[email protected]>
The naming of backlight devices is not terribly useful for
associating a backlight controller with a display (assuming
it is attached to one).

Add a sysfs node that will return a display name that can be set
by other subsystems.

Signed-off-by: Dave Stevenson <[email protected]>
Pass the DRM connector name to any configured backlight
device so that userspace can associate the two items.

Ideally this should be in drm_panel, but it is bridge/panel
that creates the drm_connector and therefore knows the name.

Signed-off-by: Dave Stevenson <[email protected]>

drm/bridge: panel: Ensure backlight is reachable

Ensure that the various options of modules vs builtin results
in being able to call into the backlight code.

raspberrypi#6198

Fixes: 573f8fd ("drm/bridge: panel: Name an associated backlight device")
Signed-off-by: Dave Stevenson <[email protected]>
Add version 4.17.1 of the Hailo PCIe device drivers.
Sourced from https://github.com/hailo-ai/hailort-drivers/

Signed-off-by: Naushir Patuck <[email protected]>

drivers: media: pcie: hailo: Fix include paths

An attempt to fix the include paths - they look reasonable, but the
GitHub auto-builds fail.

Signed-off-by: Phil Elwell <[email protected]>

drivers: media: pci: Update Hailo accelerator device driver to v4.18.0

Sourced from https://github.com/hailo-ai/hailort-drivers/

Signed-off-by: Naushir Patuck <[email protected]>

drivers: media: pci: Add wrapper after removal of follow_pfn

drivers: media: pci: Fix Hailo compile warnings

Signed-off-by: Phil Elwell <[email protected]>

drivers: media: pci: Update Hailo accelerator device driver to v4.19

Sourced from https://github.com/hailo-ai/hailort-drivers/

Signed-off-by: Naushir Patuck <[email protected]>

drivers: media: pci: Update Hailo accelerator device driver to v4.20

Sourced from https://github.com/hailo-ai/hailort-drivers

Signed-off-by: Naushir Patuck <[email protected]>
Add helpers to set and get vchiq driver data. vchiq_set_drvdata() and
vchiq_get_drvdata() wraps dev_set_drvdata() and dev_get_drvdata()
respectively.

Signed-off-by: Umang Jain <[email protected]>
Signed-off-by: Kieran Bingham <[email protected]>
The vchiq_connected.h header was removed in f875976 ("staging:
vc04_services: Drop vchiq_connected.[ch] files") to simplify the
implementation.

Update the vc_sm driver accordingly which can still use the same
functions through the vchiq_arm.h header declarations.

Fixes: b1ab7a0 ("staging: vc04_services: Add new vc-sm-cma driver")
Signed-off-by: Kieran Bingham <[email protected]>
Drop the include directive. They can break the build, when one only
wants to build a subdirectory. Replace with "../" for the includes in
the vc_sm files instead.

The fix is equivalent to the four patches between 29d49a7
("staging: vc04_services: bcm2835-audio: Drop include Makefile
directive")...2529ca2 ("staging: vc04_services: interface: Drop
include Makefile directive")

Fixes: b1ab7a0 ("staging: vc04_services: Add new vc-sm-cma driver")
Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Kieran Bingham <[email protected]>
Register the vcsm rive with the vchiq_bus_type instead of useing the
platform driver/device.

Signed-off-by: Kieran Bingham <[email protected]>
Now that V4L2_PIX_FMT_Y12P is defined, allow passing raw 12bit
mono packed data through the peripheral.

Signed-off-by: Dave Stevenson <[email protected]>
Now that V4L2_PIX_FMT_Y14 and V4L2_PIX_FMT_Y14P are defined,
allow passing 14bit mono data through the peripheral.

Signed-off-by: Dave Stevenson <[email protected]>
Now that the 14bit non-packed Bayer formats are defined, add them
into the supported formats lookup table.

Signed-off-by: Dave Stevenson <[email protected]>
Add two new DT properties:
* microchip,eee-enabled  - a boolean to enable EEE
* microchip,tx-lpi-timer - time in microseconds to wait before entering
                           low power state

Signed-off-by: Phil Elwell <[email protected]>
Disabling tx_lpi or eee should not cause the value of tx_lpi_timer to
be lost, even though it is not useful until they are re-enabled.

Signed-off-by: Phil Elwell <[email protected]>
The platform model originally handled the DMA mask. Now that
we are on the vchiq_bus we need to explicitly set this.

Signed-off-by: Kieran Bingham <[email protected]>
Re-introduce multi-context support that was dropped from the
mainline driver version.

Signed-off-by: Jacopo Mondi <[email protected]>
pelwell and others added 18 commits May 6, 2025 14:23
Enable support for the TCS3472 and VEML6040 families of light sensors.

Link: raspberrypi#6446

Signed-off-by: Phil Elwell <[email protected]>
Extend the i2c-sensor overlay with support for the VEML6040 and TCS3472
family of light sensors.

Link: raspberrypi#6446

Signed-off-by: Phil Elwell <[email protected]>
CONFIG_UNICODE enables "UTF-8 normalization and casefolding support".
Enable it for the standard defconfigs as a module, so that it is only
loaded when needed, e.g. to support a case-insensitive filing system.

See: raspberrypi#6808

Signed-off-by: Phil Elwell <[email protected]>
The regulator of the Waveshare DSI-TOUCH series panels is different.
Add a new driver for this regulator.

Signed-off-by: Waveshare_Team <[email protected]>
…ries panels.

the driver are provided for the Waveshare DSI-TOUCH series panels,
modelled after the other Ilitek controller drivers,
but not limited to Ilitek series controllers.
The aim is to offer a more consistent operation and
experience for the Waveshare DSI-TOUCH series panels.

Signed-off-by: Waveshare_Team <[email protected]>
…vice Tree support

Add the device tree for the Waveshare DSI-TOUCH series panels.

Signed-off-by: Waveshare_Team <[email protected]>
Enable the Waveshare DSI-TOUCH series panel driver in the
defconfig files that support the Pi5/Pi4/Pi3 family.

Signed-off-by: Waveshare_Team <[email protected]>
commit 7e0351ae91ed2b6178abbfae96c3c6aaa1652567 upstream.

The vc4-pv-muxing-combinations and vc5-pv-muxing-combinations test
suites use a common test init function which, in part, allocates the
drm atomic state the test will use.

That allocation relies on  drm_kunit_helper_atomic_state_alloc(), and
thus requires a struct drm_modeset_acquire_ctx. This context will then
be stored in the allocated state->acquire_ctx field.

However, the context is local to the test init function, and is cleared
as soon as drm_kunit_helper_atomic_state_alloc() is done. We thus end up
with an dangling pointer to a cleared context in state->acquire_ctx for
our test to consumes.

We should really allocate the context and the state in the test
functions, so we can also control when we're done with it.

Fixes: 30188df ("drm/tests: Drop drm_kunit_helper_acquire_ctx_alloc()")
Reviewed-by: Maíra Canal <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Maxime Ripard <[email protected]>
Following the example of [1], move the state allocation out of the init
function to make it thread safe.

[1] commit 7e0351ae91ed ("drm/vc4: tests: Stop allocating the state in
test init")

Signed-off-by: Phil Elwell <[email protected]>
Distinguish between releasing the watchdog without requesting that it is
stopped, and failing to stop it when requested. The former is standard
behaviour for systemd, while the latter may be unexpected.

Signed-off-by: Phil Elwell <[email protected]>
Upstream's base dts exposes a full-range 32bit MMIO window starting at a
PCI bus address of 0. This causes sufficient interop annoyance to be
worth permanently applying the mmio-hi property of the pciex1-compat-pi5
overlay.

Signed-off-by: Jonathan Bell <[email protected]>
Copying our downstream patch for imx477 that allows configuration
of external synchronisation signals via DT, add the same to imx296.

Signed-off-by: Dave Stevenson <[email protected]>
When a CL/CSD job times out, we check if the GPU has made any progress
since the last timeout. If so, instead of resetting the hardware, we skip
the reset and let the timer get rearmed. This gives long-running jobs a
chance to complete.

However, when `timedout_job()` is called, the job in question is removed
from the pending list, which means it won't be automatically freed through
`free_job()`. Consequently, when we skip the reset and keep the job
running, the job won't be freed when it finally completes.

This situation leads to a memory leak, as exposed in [1].

Similarly to commit 704d3d6 ("drm/etnaviv: don't block scheduler when
GPU is still active"), this patch ensures the job is put back on the
pending list when extending the timeout.

Cc: [email protected] # 6.0
Link: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12227 [1]
Reported-by: Daivik Bhatia <[email protected]>
Signed-off-by: Maíra Canal <[email protected]>
kbingham and others added 7 commits May 6, 2025 16:47
In commit cfa49ff ("media: i2c: imx335: Support 2592x1940 10-bit
mode") the IMX335 driver was extended to support multiple output modes.

This incorrectly extended the frame size enumeration to check against
the supported mbus_codes array instead of the supported mode/frame
array. This has the unwanted side effect of reporting the currently
supported frame size 2592x1944 three times.

Fix the check accordingly to report a frame size for each supported
size, which is presently only a single entry.

Fixes: cfa49ff ("media: i2c: imx335: Support 2592x1940 10-bit mode")
Signed-off-by: Kieran Bingham <[email protected]>
FTRACE_SYSCALLS enables the syscall entry and exit events to be traced.

See: raspberrypi#6752

Signed-off-by: Phil Elwell <[email protected]>
Upstream commit d3976b4 ("drm/v3d: Add clock handling") introduced
clock handling. Therefore, delete the clock handling previously
introduced in downstream.

Signed-off-by: Maíra Canal <[email protected]>
Correcting display dimension typo
It seems that some applications don't work with UART DMA enabled, while
others don't work without it. No DMA seems to be the safer default
choice, but add a dtparam - uart0_dma - to re-enable it.

See: raspberrypi#6365

Signed-off-by: Phil Elwell <[email protected]>
There is still an open TODO about some high-level descriptions
mostly related to the VideoCore interface (ABI, IOCTL) and the
thread architecture. This should be more helpful than a separate
document describing VCHIQ.

Signed-off-by: Stefan Wahren <[email protected]>
Replace the TODO items with explanations largely derived by reading the
code.

Signed-off-by: Phil Elwell <[email protected]>
@pelwell pelwell force-pushed the rpi-6.15.y-vchiq branch from 75cab13 to 6a1caeb Compare May 7, 2025 13:54
@pelwell
Copy link
Contributor

pelwell commented May 7, 2025

Added comments and rebased.

@pelwell pelwell marked this pull request as draft May 7, 2025 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.