Skip to content

KMS patches - RGB range - #3535

Closed
6by9 wants to merge 717 commits into
raspberrypi:rpi-5.4.yfrom
6by9:rpi-5.4.y-kms
Closed

6by9 wants to merge 717 commits into
raspberrypi:rpi-5.4.yfrom
6by9:rpi-5.4.y-kms

Conversation

@6by9

@6by9 6by9 commented Apr 8, 2020

Copy link
Copy Markdown
Contributor

3 minor patches from @popcornmix (I've dropped the ones that limit the pixel rate as they shouldn't be needed)
1 from me adding "Broadcast RGB" as a DRM property on HDMI connectors.

pelwell and others added 30 commits April 1, 2020 11:24
With the possible exception of bcm2711* files where there is a name
clash, we should not be modifying upstream DTS files.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
This adds minimal support for the new Raspberry Pi 4 without the
fancy stuff like GENET, PCIe, xHCI, 40 bit DMA and V3D. The RPi 4 is
available in 3 different variants (1, 2 and 4 GB RAM), so leave the memory
size to zero and let the bootloader take care of it. The DWC2 is still
usable as peripheral via the USB-C port.

Other differences to the Raspberry Pi 3:
- additional GIC 400 Interrupt controller
- new thermal IP and HWRNG
- additional MMC interface (emmc2)
- additional UART, I2C, SPI and PWM interfaces
- clock stretching bug in I2C IP has been fixed

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Acked-by: Eric Anholt <eric@anholt.net>
Acked-by: Florian Fanelli <f.fainelli@gmail.com>
arm64 places the CMA in ZONE_DMA32, which is not good enough for the
Raspberry Pi 4 since it contains peripherals that can only address the
first GB of memory. Explicitly place the CMA into that area.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <wahrenst@gmx.net>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
This enables the Gigabit Ethernet support on the Raspberry Pi 4.
The defined PHY mode is equivalent to the default register settings
in the downstream tree.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Raspberry Pi's firmware has a feature to select how much memory to
reserve for its GPU called 'gpu_mem'. The possible values go from 16MB
to 944MB, with a default of 64MB. This memory resides in the topmost
part of the lower 1GB memory area and grows bigger expanding towards the
begging of memory.

It turns out that with low 'gpu_mem' values (16MB and 32MB) the size of
the memory available to the system in the lower 1GB area can outgrow the
interconnect's dma-range as its size was selected based on the maximum
system memory available given the default gpu_mem configuration. This
makes that memory slice unavailable for DMA. And may cause nasty kernel
warnings if CMA happens to include it.

Change soc's dma-ranges to really reflect it's HW limitation, which is
being able to only DMA to the lower 1GB area.

Fixes: 7dbe8c6 ("ARM: dts: Add minimal Raspberry Pi 4 support")
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Phil Elwell <phil@raspberrypi.org>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Refactor the tree of downstream DTS files to achieve approximately the
same end result but wihout modifying upstream files (except for
bcm2711-rpi-4-b.dts).

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Fixes: "vchiq: Add 36-bit address support"

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
The Pi 4 SoC is called BCM2711, not BCM2838.

Fixes: "bcm2835-dma: Add proper 40-bit DMA support"
The Pi 4 SoC is called BCM2711, not BCM2838.

Fixes: "thermal: brcmstb_thermal: Add BCM2838 support"

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
The Pi 4 SoC is called BCM2711, not BCM2838.

Fixes: "hwrng: iproc-rng200: Add BCM2838 support"

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
The Pi 4 SoC is called BCM2711, not BCM2838.

Fixes: "bcm2835-dma: Add proper 40-bit DMA support"
Fixes: "Ported pcie-brcmstb bounce buffer implementation to ARM64."

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
The Pi 4 SoC is called BCM2711, not BCM2838.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
The 5.5 tree includes a patch to disable the CMA command line
parameter and replace it with properties from a DT node.
The upstream Pi 4 .dts, now used downstream with modifications,
includes the "linux,cma" node, but only reserves 32MB which is
often not enough.

Temporarily remove the "linux,cma" node to reenable the command line
parameter.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Following Eric's commit 37b7b30 ("staging/vc04_services: Register a
platform device for the camera driver.") this register the audio driver as
a platform device, too.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
vchiq kernel clients are now instantiated as platform drivers rather
than using DT, but the children of the vchiq interface may still
benefit from access to DT properties. Give them the option of a
a sub-node of the vchiq parent for configuration and to allow
them to be disabled.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
All the registered children of vchiq have a corresponding call to
platform_device_unregister except bcm2835_audio. Fix that.

Fixes: 25c7597 ("staging: vchiq_arm: Register a platform device for audio")

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
VCHIQ kernel clients are now instantiated as platform drivers rather
than using DT, but the children of the vchiq device can optionally be
given a sub-node of the vchiq parent for configuration and to disable
them.

Move the existing audio node beneath the vchiq parent, to prevent
multiple instantiation and unpleasant warnings. Note that the node
name has to match the module name - "bcm2835_audio".

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Commit [1] ([2] upstream) removed the "simple-bus" compatible string,
"#address-cells" and "#size-cells" to fix some DT scheme warnings. In
doing so it prevented the child clocks from being instantiated - the
node might as well be absent.

Fix the problem (at least with regards to functionality) by restoring
"simple-bus" and the sizes.

See: raspberrypi#3481
Fixes: [1] 238506e ("ARM: dts: bcm283x: Remove simple-bus from fixed clocks")
Fixes: [2] 4b2d246 ("ARM: dts: bcm283x: Remove simple-bus from fixed clocks")

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Change [1] removes the simple-bus compatible string from the "/clocks"
node, preventing any custom clocks placed there from being initialised.
Rather than reinstate the compatible string and trigger DT warnings at
kernel build time, change the overlays to instantiate those clocks under
the root node ("/").

See: raspberrypi#3481

Signed-off-by: Phil Elwell <phil@raspberrypi.com>

[1] 4b2d246 ("ARM: dts: bcm283x: Remove simple-bus from fixed clocks")
The response block and local state were using u16 and u32 respectively
to represent transaction id.  When the former would wrap, there is a
mismatch and subsequent transactions will be marked as failures.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
The timeout_ms parameter specifies in milliseconds how long the kernel
waits for power-down before issuing a WARN. The default value is 3000 ms.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
This enables support for IR decoding via BPF programs.

Signed-off-by: Matthias Reichl <hias@horus.com>
Signed-off-by: Matthias Reichl <hias@horus.com>
When symbols from overlays are added to the live tree their paths must
be rebased. The translated symbol is normally the result of joining
the fragment-relative path (with a leading "/") to the target path
(either copied directly from the "target-path" property or resolved
from the phandle). This translation fails when the target is the root
node (a common case for Raspberry Pi overlays) because the resulting
path starts with a double slash. For example, if target-path is "/" and
the fragment adds a node called "newnode", the label associated with
that node will be assigned the path "//newnode", which can't be found
in the tree.

Fix the failure case by explicitly replacing a target path of "/" with
an empty string.

Fixes: d1651b0 ("of: overlay: add overlay symbols to live device tree")

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
See: raspberrypi#3344

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Enable EXT4 encryption support for all configurations except those
based on the original BCM2835, i.e. not on B+, Zero, etc. This
exception is because it would consume at least an additional 68KB,
which is a lot on a platform that may only have 128MB.

See: raspberrypi#2486

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
See: raspberrypi#3035

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
@6by9 6by9 changed the title KMS patches - audio and RGB range KMS patches - RGB range Apr 8, 2020
@6by9

6by9 commented Apr 8, 2020

Copy link
Copy Markdown
Contributor Author

Dropping the audio patches if popcornmix is working on them.

You get a DRM property on the HDMI connector. For me from modetest I get

Connectors:
id      encoder status          name            size (mm)       modes   encoders
32      31      connected       HDMI-A-1        520x320         40      31
  modes:
        index name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
  #0 1920x1200 59.95 1920 1968 2000 2080 1200 1203 1209 1235 154000 flags: phsync, pvsync; type: preferred, driver
...
  props:
        1 EDID:
                flags: immutable blob
...
        37 Broadcast RGB:
                flags: enum
                enums: Automatic=0 Full=1 Limited 16:235=2
                value: 1

and the same for HDMI-A-2.
~/drm/build/tests/modetest/modetest -M vc4 -w 32:"Broadcast RGB":1 will set it to Full, or ~/drm/build/tests/modetest/modetest -M vc4 -w 32:"Broadcast RGB":2 will set it to limited.
If you're implementing a DRM app (which you are), then you can query for the property and change it as you wish.

@popcornmix

Copy link
Copy Markdown
Collaborator

What about X? Presumably the same users will have wrong colours in Chromium, VLC etc?

@6by9

6by9 commented Apr 8, 2020

Copy link
Copy Markdown
Contributor Author

What about X? Presumably the same users will have wrong colours in Chromium, VLC etc?

Once set the property persists.

You can also set it via xrandr - xrandr --output HDMI1 --set "Broadcast RGB" "Full" or similar.

I seem to recall a patch that allowed drm properties to be set from the kernel command line too, but I don't recall whether those have been merged as yet (I suspect not).

@popcornmix

Copy link
Copy Markdown
Collaborator

Command line seems a convenient method for users (as they'll presumably want it for all applications).

@6by9

6by9 commented Apr 8, 2020

Copy link
Copy Markdown
Contributor Author

Command line seems a convenient method for users (as they'll presumably want it for all applications).

I seem to remember discussion, not sure about patches implementing it. I'll have a hunt for patches.

@6by9

6by9 commented Apr 8, 2020

Copy link
Copy Markdown
Contributor Author

Hmm, nothing on the lists, and all the parsing stuff at present is tied in to setting the mode.

I'll rework this to move broadcast_rgb out into the common code, and then we'll be in a better place to add it as a cmdline thing. It'll be extra baggage to carry around within the core code though, unless we can upstream it.

@6by9

6by9 commented Apr 9, 2020

Copy link
Copy Markdown
Contributor Author

Actually looking at it, trying to make this a common property is a bad idea, so the PR is complete as it is.

I have asked Maxime if he has any good ideas about how to support it on the command line, so we'll see what he comes back with. That can be addressed in a later patch.

@pelwell
pelwell force-pushed the rpi-5.4.y branch 2 times, most recently from 7d6e241 to 9daf453 Compare April 24, 2020 09:15
@pelwell
pelwell force-pushed the rpi-5.4.y branch 2 times, most recently from 83784a1 to 971a2bb Compare May 20, 2020 13:50
@popcornmix
popcornmix force-pushed the rpi-5.4.y branch 2 times, most recently from efe0abe to 9be502d Compare June 10, 2020 13:22
@popcornmix
popcornmix force-pushed the rpi-5.4.y branch 2 times, most recently from 964dedc to ec8bbdc Compare July 1, 2020 15:37
@6by9
6by9 force-pushed the rpi-5.4.y-kms branch 2 times, most recently from 8e5e496 to 5693b8e Compare July 28, 2020 12:22
@6by9

6by9 commented Feb 7, 2022

Copy link
Copy Markdown
Contributor Author

Alternate implementation pushed by popcornmix.

@6by9 6by9 closed this Feb 7, 2022
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.