platform/kernel/linux-rpi.git
3 years agowatchdog: bcm2835: Ignore params after the partition number
Tim Gover [Thu, 22 Oct 2020 14:30:55 +0000 (15:30 +0100)]
watchdog: bcm2835: Ignore params after the partition number

Use sscanf to extract the partition number and ignore extra parameters
which are only relevant to other reboot notifiers.

3 years agobcm2835-pcm: Fix up multichannel pcm audio
Dom Cobley [Tue, 27 Oct 2020 12:24:14 +0000 (12:24 +0000)]
bcm2835-pcm: Fix up multichannel pcm audio

Fixes: a9c1660ff5f02d048c5f31abf1fd1108ccf9ef87
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agoPiFi-40 driver, Makefile and Kconfig
David Knell [Wed, 28 Oct 2020 14:21:37 +0000 (14:21 +0000)]
PiFi-40 driver, Makefile and Kconfig

Signed-off-by: David Knell <david.knell@gmail.com>
3 years agoPiFi-40 Devicetree files
David Knell [Wed, 28 Oct 2020 14:20:56 +0000 (14:20 +0000)]
PiFi-40 Devicetree files

Signed-off-by: David Knell <david.knell@gmail.com>
3 years agoPiFi-40 defconfigs
David Knell [Wed, 28 Oct 2020 14:18:42 +0000 (14:18 +0000)]
PiFi-40 defconfigs

Signed-off-by: David Knell <david.knell@gmail.com>
3 years agobcm2708_fb: Fix a build warning
Phil Elwell [Tue, 27 Oct 2020 12:12:22 +0000 (12:12 +0000)]
bcm2708_fb: Fix a build warning

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agorpivid_h625: Fix build warnings
Phil Elwell [Tue, 27 Oct 2020 12:10:40 +0000 (12:10 +0000)]
rpivid_h625: Fix build warnings

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agogpio-fsm: Fix a build warning
Phil Elwell [Tue, 27 Oct 2020 12:10:04 +0000 (12:10 +0000)]
gpio-fsm: Fix a build warning

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agodwc_otg: Minimise header and fix build warnings
Phil Elwell [Tue, 27 Oct 2020 09:59:49 +0000 (09:59 +0000)]
dwc_otg: Minimise header and fix build warnings

Delete a large amount of unused declaration from "usb.h", some of which
were causing build warnings, and get the module building cleanly.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoconfigs: Set RASPBERRYPI_FIRMWARE for arm64 bcm2711
Phil Elwell [Mon, 26 Oct 2020 21:51:29 +0000 (21:51 +0000)]
configs: Set RASPBERRYPI_FIRMWARE for arm64 bcm2711

RASPBERRYPI_FIRMWARE was missing from the arm64 bcm2711_defconfig.
bcmrpi3_defconfig was also missing a few options. Add the misssing
settings and regenerate all the Pi defconfigs.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoARM: dts: Expand PCIe space on BCM2711
Phil Elwell [Mon, 26 Oct 2020 10:35:43 +0000 (10:35 +0000)]
ARM: dts: Expand PCIe space on BCM2711

Attempts to connect external GPUs to Compute Module 4's PCIe bus have
highlighted that the existing "outbound window" - the fraction of the
PCI address base that is appears in the host's memory map - is
restrictively small. Expand the window to a full 1GB.

See: https://www.raspberrypi.org/forums/viewtopic.php?f=98&t=288902

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agorpisense-fb: Set pseudo_pallete to prevent crash on fbcon takeover
Serge Schneider [Mon, 26 Oct 2020 16:38:21 +0000 (16:38 +0000)]
rpisense-fb: Set pseudo_pallete to prevent crash on fbcon takeover

Signed-off-by: Serge Schneider <serge@raspberrypi.com>
3 years agooverlays: Enable headphone audio in audremap
Phil Elwell [Mon, 26 Oct 2020 10:21:23 +0000 (10:21 +0000)]
overlays: Enable headphone audio in audremap

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoARM: dts: Disable headphone audio on Zeroes, CM4
Phil Elwell [Mon, 26 Oct 2020 10:18:50 +0000 (10:18 +0000)]
ARM: dts: Disable headphone audio on Zeroes, CM4

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agostaging: bcm2835-audio: Add disable-headphones flag
Phil Elwell [Mon, 26 Oct 2020 10:23:22 +0000 (10:23 +0000)]
staging: bcm2835-audio: Add disable-headphones flag

Add a property to allow the headphone output to be disabled. Use an
integer property rather than a boolean so that an overlay can clear it.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agodts: Tidy the Raspberry Pi Makefile entries
Phil Elwell [Mon, 26 Oct 2020 15:01:21 +0000 (15:01 +0000)]
dts: Tidy the Raspberry Pi Makefile entries

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoxhci: quirks: add link TRB quirk for VL805
Jonathan Bell [Mon, 26 Oct 2020 14:03:35 +0000 (14:03 +0000)]
xhci: quirks: add link TRB quirk for VL805

The VL805 controller can't cope with the TR Dequeue Pointer for an endpoint
being set to a Link TRB. The hardware-maintained endpoint context ends up
stuck at the address of the Link TRB, leading to erroneous ring expansion
events whenever the enqueue pointer wraps to the dequeue position.

If the search for the end of the current TD and ring cycle state lands on
a Link TRB, move to the next segment.

See: https://github.com/raspberrypi/linux/issues/3919

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
3 years agodrm/vc4: Add the 2711 HVS as a suitable DMA node
Dave Stevenson [Mon, 26 Oct 2020 12:38:27 +0000 (12:38 +0000)]
drm/vc4: Add the 2711 HVS as a suitable DMA node

With vc4-drv node not being under /soc on Pi4, we need to
adopt the correct DMA parameters from a suitable sub-component.
Add "brcm,bcm2711-hvs" to that list of components.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodts: Add CM4 to arm64 dt files
Dave Stevenson [Fri, 23 Oct 2020 14:45:11 +0000 (15:45 +0100)]
dts: Add CM4 to arm64 dt files

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agooverlays: imx219: Correct link frequency to match the upstream driver
Dave Stevenson [Wed, 11 Mar 2020 12:07:57 +0000 (12:07 +0000)]
overlays: imx219: Correct link frequency to match the upstream driver

The upstream driver is checking the link frequency parameter, and
the overlay had the wrong value.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agooverlays: Add option to disable composite to vc4-kms-v3d
Dave Stevenson [Fri, 23 Oct 2020 13:15:41 +0000 (14:15 +0100)]
overlays: Add option to disable composite to vc4-kms-v3d

Composite gets enabled automatically if HDMI isn't detected,
which can cause some grief in X should it be not connected
and touchscreens are in use.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agoARM: dts: bcm271x: Use a53 pmu, drop RPI364
Phil Elwell [Thu, 19 Mar 2020 10:04:46 +0000 (10:04 +0000)]
ARM: dts: bcm271x: Use a53 pmu, drop RPI364

The upstream bcm2837.dtsi uses cortex-a53-pmu, so we can do the same
but with a fallback to the cortex-a7-pmu which is supported by the
32-bit kernel.

Now that we're using the natural fallback mechanism of compatible
strings, the RPI364 macro no longer serves any purpose - remove it.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agodrm/vc4: Add all the HDMI registers into the debugfs dumps
Dave Stevenson [Wed, 21 Oct 2020 17:34:56 +0000 (18:34 +0100)]
drm/vc4: Add all the HDMI registers into the debugfs dumps

The vc5 HDMI registers hadn't been added into the debugfs
register sets, therefore weren't dumped on request.
Add them in.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodrm/vc4: Reading the hotplug register is only valid if no GPIO defined
Dave Stevenson [Thu, 22 Oct 2020 11:05:43 +0000 (12:05 +0100)]
drm/vc4: Reading the hotplug register is only valid if no GPIO defined

The order of precedence should be:
- hotplug GPIO being defined
- DDC probe
- hotplug register

In particular the hotplug register is not valid if a GPIO is defined
(eg on Pi0-3), but was being checked.

Fixes "943f078 vc4: cec: Restore cec physical address on reconnect"

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agogpio: Add gpio-fsm driver
Phil Elwell [Wed, 30 Sep 2020 11:00:54 +0000 (12:00 +0100)]
gpio: Add gpio-fsm driver

The gpio-fsm driver implements simple state machines that allow GPIOs
to be controlled in response to inputs from other GPIOs - real and
soft/virtual - and time delays. It can:
+ create dummy GPIOs for drivers that demand them,
+ drive multiple GPIOs from a single input, with optional delays,
+ add a debounce circuit to an input,
+ drive pattern sequences onto LEDs
etc.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agodrm/vc4: Add debugfs node that dumps the current display lists
Dave Stevenson [Tue, 6 Oct 2020 17:44:42 +0000 (18:44 +0100)]
drm/vc4: Add debugfs node that dumps the current display lists

This allows easy analysis of display lists when debugging.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodrm/vc4: A present but empty dmas disables audio
Phil Elwell [Wed, 31 Jul 2019 16:36:34 +0000 (17:36 +0100)]
drm/vc4: A present but empty dmas disables audio

Overlays are unable to remove properties in the base DTB, but they
can overwrite them. Allow a present but empty 'dmas' property
to also disable the HDMI audio interface.

See: https://github.com/raspberrypi/linux/issues/2489

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
3 years agostaging: vc04_services: ISP: Add a more complex ISP processing component
Naushir Patuck [Thu, 23 Apr 2020 09:17:37 +0000 (10:17 +0100)]
staging: vc04_services: ISP: Add a more complex ISP processing component

Driver for the BCM2835 ISP hardware block.  This driver uses the MMAL
component to program the ISP hardware through the VC firmware.

The ISP component can produce two video stream outputs, and Bayer
image statistics. This can't be encompassed in a simple V4L2
M2M device, so create a new device that registers 4 video nodes.

This patch squashes all the development patches from the earlier
rpi-5.4.y branch into one

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
3 years agouapi: bcm2835-isp: Add bcm2835-isp uapi header file
Dave Stevenson [Mon, 12 Oct 2020 16:03:14 +0000 (17:03 +0100)]
uapi: bcm2835-isp: Add bcm2835-isp uapi header file

This file defines the userland interface to the bcm2835-isp driver
that will follow in a separate commit.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agobcm2835-dma: only reserve channel 0 if legacy dma driver is enabled
Matthias Reichl [Sat, 10 Oct 2020 22:48:55 +0000 (00:48 +0200)]
bcm2835-dma: only reserve channel 0 if legacy dma driver is enabled

If CONFIG_DMA_BCM2708 isn't enabled there's no need to mask out
one of the already scarce DMA channels.

Signed-off-by: Matthias Reichl <hias@horus.com>
3 years agostaging: vc04_services: Add a V4L2 M2M codec driver
Dave Stevenson [Thu, 8 Oct 2020 19:24:12 +0000 (20:24 +0100)]
staging: vc04_services: Add a V4L2 M2M codec driver

This adds a V4L2 memory to memory device that wraps the MMAL
video decode and video_encode components for H264 and MJPEG encode
and decode, MPEG4, H263, and VP8 decode (and MPEG2 decode
if the appropriate licence has been purchased).

This patch squashes all the work done in developing the driver
on the Raspberry Pi rpi-5.4.y kernel branch.
Thanks to Kieran Bingham, Aman Gupta, Chen-Yu Tsai, and
Marek BehĂșn for their contributions. Please refer to the
rpi-5.4.y branch for the full history.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agostaging: mmal-vchiq: Use vc-sm-cma to support zero copy
Dave Stevenson [Tue, 25 Sep 2018 15:07:55 +0000 (16:07 +0100)]
staging: mmal-vchiq: Use vc-sm-cma to support zero copy

With the vc-sm-cma driver we can support zero copy of buffers between
the kernel and VPU. Add this support to mmal-vchiq.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agostaging: mmal-vchiq: Add monochrome image formats
Dave Stevenson [Wed, 6 May 2020 17:11:14 +0000 (18:11 +0100)]
staging: mmal-vchiq: Add monochrome image formats

Adds support for monochrome image formats in the various
MIPI packings.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agostaging: vchiq-mmal: Add support for 14bit Bayer
Dave Stevenson [Wed, 6 May 2020 17:09:04 +0000 (18:09 +0100)]
staging: vchiq-mmal: Add support for 14bit Bayer

Add in the missing defines.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agostaging: vc04_services: Add new vc-sm-cma driver
Dave Stevenson [Thu, 8 Oct 2020 17:49:52 +0000 (18:49 +0100)]
staging: vc04_services: Add new vc-sm-cma driver

Add Broadcom VideoCore Shared Memory support.

This new driver allows contiguous memory blocks to be imported
into the VideoCore VPU memory map, and manages the lifetime of
those objects, only releasing the source dmabuf once the VPU has
confirmed it has finished with it.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agostaging: bcm2835-camera: Replace deprecated V4L2_PIX_FMT_BGR32
Dave Stevenson [Thu, 8 Oct 2020 14:35:14 +0000 (15:35 +0100)]
staging: bcm2835-camera: Replace deprecated V4L2_PIX_FMT_BGR32

V4L2_PIX_FMT_BGR32 is deprecated as it is ambiguous over where
the alpha byte is. Cheese/GStreamer appear to get it wrong for
one, and qv4l2 gets red and blue swapped.

Swap to the newer V4L2_PIX_FMT_BGRX32 format.

https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=267736&p=1738912

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodwc_otg: initialise sched_frame for periodic QHs that were parked
Jonathan Bell [Wed, 7 Oct 2020 14:09:29 +0000 (15:09 +0100)]
dwc_otg: initialise sched_frame for periodic QHs that were parked

If a periodic QH has no remaining QTDs, then it is removed from all
periodic schedules. When re-adding, initialise the sched_frame and
start_split_frame from the current value of the frame counter.

See https://bugs.launchpad.net/raspbian/+bug/1819560
and
 https://github.com/raspberrypi/linux/issues/3883

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
3 years agoUSB: gadget: f_hid: avoid crashes and log spam
Phil Elwell [Wed, 30 Sep 2020 18:23:43 +0000 (19:23 +0100)]
USB: gadget: f_hid: avoid crashes and log spam

Disconnecting and reconnecting the USB cable can lead to crashes and a
variety of kernel log spam. Try to fix or minimise both.

See: https://github.com/raspberrypi/linux/issues/3870

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agochar: Add broadcom char drivers back to build files
popcornmix [Mon, 28 Sep 2020 19:23:30 +0000 (20:23 +0100)]
char: Add broadcom char drivers back to build files

See: https://github.com/raspberrypi/linux/issues/3875
Signed-off-by: popcornmix <popcornmix@gmail.com>
3 years agonet: bcmgenet: Reset RBUF on first open
Phil Elwell [Fri, 25 Sep 2020 14:07:23 +0000 (15:07 +0100)]
net: bcmgenet: Reset RBUF on first open

If the RBUF logic is not reset when the kernel starts then there
may be some data left over from any network boot loader. If the
64-byte packet headers are enabled then this can be fatal.

Extend bcmgenet_dma_disable to do perform the reset, but not when
called from bcmgenet_resume in order to preserve a wake packet.

N.B. This different handling of resume is just based on a hunch -
why else wouldn't one reset the RBUF as well as the TBUF? If this
isn't the case then it's easy to change the patch to make the RBUF
reset unconditional.

See: https://github.com/raspberrypi/linux/issues/3850

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agorpivid_h265: Fix width/height typo
popcornmix [Mon, 21 Sep 2020 13:02:44 +0000 (14:02 +0100)]
rpivid_h265: Fix width/height typo

Signed-off-by: popcornmix <popcornmix@gmail.com>
3 years agobrcmfmac: Increase power saving delay to 2s
Phil Elwell [Mon, 3 Feb 2020 09:32:22 +0000 (09:32 +0000)]
brcmfmac: Increase power saving delay to 2s

Increase the delay before entering the lower power state to 2 seconds
(the maximum allowed) in order to reduce the packet latencies,
particularly for inbound packets.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agostaging/fbtft: Add support for display variants
Phil Elwell [Tue, 1 Sep 2020 17:15:27 +0000 (18:15 +0100)]
staging/fbtft: Add support for display variants

Display variants are intended as a replacement for the now-deleted
fbtft_device drivers. Drivers can register additional compatible
strings with a custom callback that can make the required changes
to the fbtft_display structure.

Start the ball rolling by adding adafruit18, adafruit18_green and
sainsmart18 displays.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agomedia: bcm2835-unicam: change minimum number of vb2_queue buffers to 1
David Plowman [Thu, 28 May 2020 10:09:48 +0000 (11:09 +0100)]
media: bcm2835-unicam: change minimum number of vb2_queue buffers to 1

Since the unicam driver was modified to write to a dummy buffer when no
user-supplied buffer is available, it can now write to and return a
buffer even when there's only a single one. Enable this by changing the
min_buffers_needed in the vb2_queue; it will be useful for enabling
still captures without allocating more memory than absolutely necessary.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
3 years agomedia: bcm2835-unicam: Retain packing information on G_FMT
Dave Stevenson [Tue, 19 May 2020 10:46:47 +0000 (11:46 +0100)]
media: bcm2835-unicam: Retain packing information on G_FMT

The change to retrieve the pixel format always on g_fmt didn't
check whether the native or unpacked version of the format
had been requested, and always returned the packed one.
Correct this so that the packing setting is retained whereever
possible.

Fixes "9d59e89 media: bcm2835-unicam: Re-fetch mbus code from subdev
on a g_fmt call"

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agomedia: bcm2835-unicam: Fixup review comments from Hans.
Dave Stevenson [Tue, 23 Jun 2020 14:14:05 +0000 (15:14 +0100)]
media: bcm2835-unicam: Fixup review comments from Hans.

Updates the driver based on the upstream review comments from
Hans Verkuil at https://patchwork.linuxtv.org/patch/63531/

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agomedia: bcm2835: unicam: Fix uninitialized warning
Jacko Dirks [Tue, 5 May 2020 12:33:31 +0000 (14:33 +0200)]
media: bcm2835: unicam: Fix uninitialized warning

Signed-off-by: Jacko Dirks <jdirks.linuxdev@gmail.com>
3 years agomedia: bcm2835-unicam: Always service interrupts
Dave Stevenson [Wed, 13 May 2020 17:28:27 +0000 (18:28 +0100)]
media: bcm2835-unicam: Always service interrupts

From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

https://github.com/raspberrypi/linux/issues/3602

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agomedia: i2c: imx477: Parse and register properties
Laurent Pinchart [Fri, 3 Jul 2020 22:45:08 +0000 (01:45 +0300)]
media: i2c: imx477: Parse and register properties

Parse device properties and register controls for them using the V4L2
fwnode properties helpers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
3 years agomedia: i2c: imx477: Return correct result on sensor id verification
Naushir Patuck [Tue, 19 May 2020 15:56:33 +0000 (16:56 +0100)]
media: i2c: imx477: Return correct result on sensor id verification

The test should return -EIO if the register read id does not match
the expected sensor id.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
3 years agomedia: i2c: imx477: Add support for adaptive frame control
Naushir Patuck [Fri, 8 May 2020 08:41:17 +0000 (09:41 +0100)]
media: i2c: imx477: Add support for adaptive frame control

Use V4L2_CID_EXPOSURE_AUTO_PRIORITY to control if the driver should
automatically adjust the sensor frame length based on exposure time,
allowing variable frame rates and longer exposures.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
3 years agomedia: i2c: Add driver for Sony IMX477 sensor
Naushir Patuck [Fri, 8 May 2020 09:00:12 +0000 (10:00 +0100)]
media: i2c: Add driver for Sony IMX477 sensor

Adds a driver for the 12MPix Sony IMX477 CSI2 sensor.
Whilst the sensor supports 2 or 4 CSI2 data lanes, this driver
currently only supports 2 lanes.

The following Bayer modes are currently available:

4056x3040 12-bit @ 10fps
2028x1520 12-bit (binned) @ 40fps
2028x1050 12-bit (cropped/binned) @ 50fps
1012x760 10-bit (scaled) @ 120 fps

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
3 years agodrm/vc4: Add FKMS as an acceptable node for dma ranges.
Dave Stevenson [Tue, 19 May 2020 15:20:30 +0000 (16:20 +0100)]
drm/vc4: Add FKMS as an acceptable node for dma ranges.

Under FKMS, the firmware (via FKMS) also requires the VideoCore cache
aliases for image planes, as defined by the dma-ranges under /soc.

Add rpi-firmware-kms to the list of acceptable nodes to look for
to copy dma config from.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodrm/vc4: Add firmware-kms mode
Dave Stevenson [Mon, 7 Sep 2020 16:32:27 +0000 (17:32 +0100)]
drm/vc4: Add firmware-kms mode

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>
3 years agodrm/vc4: Add support for YUV color encodings and ranges
Dave Stevenson [Tue, 17 Sep 2019 17:28:17 +0000 (18:28 +0100)]
drm/vc4: Add support for YUV color encodings and ranges

The BT601/BT709 color encoding and limited vs full
range properties were not being exposed, defaulting
always to BT601 limited range.

Expose the parameters and set the registers appropriately.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 years agodrm/vc4: Add support for DRM_FORMAT_P030 to vc4 planes
Dave Stevenson [Fri, 24 Jan 2020 14:25:41 +0000 (14:25 +0000)]
drm/vc4: Add support for DRM_FORMAT_P030 to vc4 planes

This currently doesn't handle non-zero source rectangles correctly,
but add support for DRM_FORMAT_P030 with DRM_FORMAT_MOD_BROADCOM_SAND128
modifier to planes when running on HVS5.

WIP still for source cropping SAND/P030 formats

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agovc4: cec: Restore cec physical address on reconnect
Dom Cobley [Wed, 3 Jun 2020 11:20:19 +0000 (12:20 +0100)]
vc4: cec: Restore cec physical address on reconnect

Currently we call cec_phys_addr_invalidate on a hotplug deassert.
That may be due to a TV power cycling, or an AVR being switched
on (and switching edid). This makes CEC unusable.

Set it back up again on the hotplug assert.

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agovc4: Report channel mapping back to userspace
popcornmix [Mon, 20 Apr 2020 17:00:38 +0000 (18:00 +0100)]
vc4: Report channel mapping back to userspace

This follows logic in hdmi-codec.c to use speaker layout
from ELD to choose a suitable speaker mapping based on
number of channels requested and signal that in audio
infoframe  and report this back to userspace.

This allows apps like speaker-test and kodi to get the
output to the right speakers.

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agovc_hdmi: Set VC4_HDMI_MAI_CONFIG_FORMAT_REVERSE
Dom Cobley [Tue, 30 Jun 2020 10:23:49 +0000 (11:23 +0100)]
vc_hdmi: Set VC4_HDMI_MAI_CONFIG_FORMAT_REVERSE

Without this bit set, HDMI_MAI_FORMAT doesn't pick up
the format and samplerate from DVP_CFG_MAI0_FMT and you
can't get HDMI_HDMI_13_AUDIO_STATUS_1 to indicate HBR mode

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agovc4_hdmi: Remove firmware logic for MAI threshold setting
Dom Cobley [Thu, 25 Jun 2020 17:48:40 +0000 (18:48 +0100)]
vc4_hdmi: Remove firmware logic for MAI threshold setting

This was a workaround for bugs in hardware on earlier Pi models
and wasn't totally successful.

It makes audio quality worse on a Pi4 at the higher sample rates

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agodrm/vc4: enable HBR MAI format on HBR streams
Dom Cobley [Fri, 10 Jul 2020 10:51:16 +0000 (11:51 +0100)]
drm/vc4: enable HBR MAI format on HBR streams

Signed-off-by: Matthias Reichl <hias@horus.com>
3 years agodrm/vc4: move setup from hw_params to prepare
Matthias Reichl [Thu, 19 Mar 2020 19:00:35 +0000 (20:00 +0100)]
drm/vc4: move setup from hw_params to prepare

Configuring HDMI audio registers in prepare allows us to take
IEC958 bits into account which are set by the alsa hook after
the hw_params call.

Signed-off-by: Matthias Reichl <hias@horus.com>
3 years agodrm/vc4: add iec958 controls to vc4_hdmi
Matthias Reichl [Tue, 17 Mar 2020 11:12:22 +0000 (12:12 +0100)]
drm/vc4: add iec958 controls to vc4_hdmi

Although vc4 get an IEC958 formatted stream passed in from userspace
the driver needs the info from the channel status bits to properly
set up the hardware, eg for HBR passthrough.

Add iec958 controls so the channel status bits can be passed in
from userspace.

Signed-off-by: Matthias Reichl <hias@horus.com>
3 years agovc4_hdmi: Set HDMI_MAI_FMT
popcornmix [Tue, 10 Mar 2020 22:21:15 +0000 (22:21 +0000)]
vc4_hdmi: Set HDMI_MAI_FMT

The hardware uses this for generating the right audio
data island packets when using formats other than PCM

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agovc4_hdmi: Set HD_CTL_WHOLSMP and HD_CTL_CHALIGN_SET
Dom Cobley [Tue, 23 Jun 2020 17:37:01 +0000 (18:37 +0100)]
vc4_hdmi: Set HD_CTL_WHOLSMP and HD_CTL_CHALIGN_SET

Symptom is random switching of speakers when using multichannel.

Repeatedly running speakertest -c8 occasionally starts with
channels jumbled. This is fixed with HD_CTL_WHOLSMP.

The other bit looks beneficial and apears harmless in testing so
I'd suggest adding it too.

Documentation says: HD_CTL_WHILSMP_SET
Wait for whole sample. When this bit is set MAI transmit will start
only when there is at least one whole sample available in the fifo.

Documentation says: HD_CTL_CHALIGN_SET
Channel Align When Overflow. This bit is used to realign the audio
channels in case of an overflow.
If this bit is set, after the detection of an overflow, equal
amount of dummy words to the missing words will be written to fifo,
filling up the broken sample and maintaining alignment.

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agodrm/vc4: Adopt the dma configuration from the HVS or V3D component
Dave Stevenson [Tue, 19 May 2020 13:54:28 +0000 (14:54 +0100)]
drm/vc4: Adopt the dma configuration from the HVS or V3D component

vc4_drv isn't necessarily under the /soc node in DT as it is a
virtual device, but it is the one that does the allocations.
The DMA addresses are consumed by primarily the HVS or V3D, and
those require VideoCore cache alias address mapping, and so will be
under /soc.

During probe find the a suitable device node for HVS or V3D,
and adopt the DMA configuration of that node.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agovc4_hdmi: Remove cec_available flag as always supported
Dom Cobley [Thu, 7 May 2020 17:16:09 +0000 (18:16 +0100)]
vc4_hdmi: Remove cec_available flag as always supported

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agovc4_hdmi: Adjust CEC ref clock based on its input clock
Dom Cobley [Thu, 7 May 2020 17:16:08 +0000 (18:16 +0100)]
vc4_hdmi: Adjust CEC ref clock based on its input clock

2711 uses a fixed 27MHz input, earlier models use the HSM clock

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agovc4_hdmi: Make irq shared
Dom Cobley [Thu, 7 May 2020 17:16:08 +0000 (18:16 +0100)]
vc4_hdmi: Make irq shared

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agovc4_hdmi_regs: Make interrupt mask variant specific
Dom Cobley [Thu, 7 May 2020 17:16:08 +0000 (18:16 +0100)]
vc4_hdmi_regs: Make interrupt mask variant specific

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agovc4_hdmi_regs: Add Intr2 register block
Dom Cobley [Thu, 7 May 2020 17:16:07 +0000 (18:16 +0100)]
vc4_hdmi_regs: Add Intr2 register block

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agovc4_hdmi: Fix up CEC registers
Dom Cobley [Thu, 7 May 2020 17:16:07 +0000 (18:16 +0100)]
vc4_hdmi: Fix up CEC registers

Fix an incorrect register address, add a
missing one and reorder into address order

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agovc4_hdmi: Fix register offset when sending longer CEC messages
Dom Cobley [Thu, 7 May 2020 17:16:07 +0000 (18:16 +0100)]
vc4_hdmi: Fix register offset when sending longer CEC messages

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agovc4_hdmi: BCM2835 requires a fixed hsm clock for CEC to work
popcornmix [Mon, 27 Apr 2020 18:07:50 +0000 (19:07 +0100)]
vc4_hdmi: BCM2835 requires a fixed hsm clock for CEC to work

Signed-off-by: popcornmix <popcornmix@gmail.com>
3 years agoinclude/firmware: Add enum for RPI_FIRMWARE_FRAMEBUFFER_GET_DISPLAY_ID
Dave Stevenson [Thu, 3 Sep 2020 16:09:07 +0000 (17:09 +0100)]
include/firmware: Add enum for RPI_FIRMWARE_FRAMEBUFFER_GET_DISPLAY_ID

Used by audio and FKMS.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agovchiq_2835_arm: Implement a DMA pool for small bulk transfers (#2699)
detule [Tue, 2 Oct 2018 08:10:08 +0000 (04:10 -0400)]
vchiq_2835_arm: Implement a DMA pool for small bulk transfers (#2699)

During a bulk transfer we request a DMA allocation to hold the
scatter-gather list.  Most of the time, this allocation is small
(<< PAGE_SIZE), however it can be requested at a high enough frequency
to cause fragmentation and/or stress the CMA allocator (think time
spent in compaction here, or during allocations elsewhere).

Implement a pool to serve up small DMA allocations, falling back
to a coherent allocation if the request is greater than
VCHIQ_DMA_POOL_SIZE.

Signed-off-by: Oliver Gjoneski <ogjoneski@gmail.com>
3 years agodwc_otg: whitelist_table is now productlist_table
popcornmix [Thu, 3 Sep 2020 13:02:41 +0000 (14:02 +0100)]
dwc_otg: whitelist_table is now productlist_table

3 years agobcm2835-mmc: uninitialized_var is no more
popcornmix [Thu, 3 Sep 2020 13:02:21 +0000 (14:02 +0100)]
bcm2835-mmc: uninitialized_var is no more

3 years agomedia: i2c: ov9281: Add support for 8 bit readout
Dave Stevenson [Tue, 7 Jul 2020 17:29:10 +0000 (18:29 +0100)]
media: i2c: ov9281: Add support for 8 bit readout

The sensor supports 8 bit mode as well as 10bit, so add the
relevant code to allow selection of this.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agomedia: i2c: tc358743: Only allow supported pixel fmts in set_fmt
Dave Stevenson [Fri, 10 Jul 2020 11:40:50 +0000 (12:40 +0100)]
media: i2c: tc358743: Only allow supported pixel fmts in set_fmt

Fix commit "media: tc358743: Return an appropriate colorspace from
tc358743_set_fmt" to ensure that the format passed in to set_fmt
is checked to be valid, and reset to the current format if not.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agomedia: bcm2835-unicam: Drop WARN on uing direct cache alias
Dave Stevenson [Thu, 27 Aug 2020 15:30:26 +0000 (16:30 +0100)]
media: bcm2835-unicam: Drop WARN on uing direct cache alias

Pi 0&1 pass all ARM accesses through the VPU L2 cache, therefore
the dma-ranges property sets the cache alias bits to other
than the direct alias, hence this WARN was firing.

It was overprotective coding, so assume that everything is OK
with the dma-ranges, and remove the WARN.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agostaging: media: rpivid: Select MEDIA_CONTROLLER and MEDIA_CONTROLLER_REQUEST_API
Hristo Venev [Wed, 19 Aug 2020 14:05:53 +0000 (17:05 +0300)]
staging: media: rpivid: Select MEDIA_CONTROLLER and MEDIA_CONTROLLER_REQUEST_API

MEDIA_CONTROLLER_REQUEST_API is a hidden option. If rpivid depends on it,
the user would need to first enable another driver that selects
MEDIA_CONTROLLER_REQUEST_API, and only then rpivid would become available.

By selecting it instead of depending on it, it becomes possible to enable
rpivid without having to enable other potentially unnecessary drivers.

Signed-off-by: Hristo Venev <hristo@venev.name>
3 years agomedia: bcm2835: unicam: Select MEDIA_CONTROLLER and VIDEO_V4L2_SUBDEV_API
Hristo Venev [Wed, 19 Aug 2020 14:02:22 +0000 (17:02 +0300)]
media: bcm2835: unicam: Select MEDIA_CONTROLLER and VIDEO_V4L2_SUBDEV_API

That is what almost all other drivers appear to be doing.

Signed-off-by: Hristo Venev <hristo@venev.name>
3 years agoARM: proc-v7: Force misalignment of early stmia
Phil Elwell [Wed, 29 Jul 2020 12:47:55 +0000 (13:47 +0100)]
ARM: proc-v7: Force misalignment of early stmia

In an attempt to prevent the problem of CPUn not starting, explicitly
misalign the scratch space used to save registers acros the cache
invalidation.

Notes:
At this stage in the boot process the core is running with its cache
disabled. Before enabling the cache its contents must be explicitly
invalidated, a process that requires quite a few registers that the
caller must preserve. Evidence suggests that something is writing a
block of zeroes over that space at a time when all other cores should
be idle, possibly some kind of write-combiner, and the misalignment is
designed to disrupt any write-coalescing.

In truth, I don't understand why this patch works, and when the failure
is so random it is hard to be certain that this isn't just rolling the
dice again. One interesting test would be to change the "addeq r12, #4"s
to "addeq r12, #0"s determine see if the offset itself is significant or
just the additional code.

See: https://github.com/Hexxeh/rpi-firmware/issues/232

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agobcm2835-dma: Advertise the full DMA range
Phil Elwell [Wed, 22 Jul 2020 16:59:31 +0000 (17:59 +0100)]
bcm2835-dma: Advertise the full DMA range

Unless the DMA mask is set wider than 32 bits, DMA mapping will use a
bounce buffer.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agostaging: vchiq_arm: children inherit DMA config
Phil Elwell [Tue, 21 Jul 2020 16:34:09 +0000 (17:34 +0100)]
staging: vchiq_arm: children inherit DMA config

Although it is no longer necessary for vchiq's children to have a
different DMA configuration to the parent, they do still need to
explicitly to have their DMA configuration set - to be that of the
parent.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoleds: Add the actpwr trigger
Phil Elwell [Mon, 13 Jul 2020 09:33:19 +0000 (10:33 +0100)]
leds: Add the actpwr trigger

The actpwr trigger is a meta trigger that cycles between an inverted
mmc0 and default-on. It is written in a way that could fairly easily
be generalised to support alternative sets of source triggers.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agomedia: i2c: ov5647: Parse and register properties
Laurent Pinchart [Fri, 3 Jul 2020 22:45:08 +0000 (01:45 +0300)]
media: i2c: ov5647: Parse and register properties

Parse device properties and register controls for them using the V4L2
fwnode properties helpers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
3 years agodt-bindings: bcm2835-unicam: Update documentation with new clock params
Naushir Patuck [Mon, 11 May 2020 12:06:27 +0000 (13:06 +0100)]
dt-bindings: bcm2835-unicam: Update documentation with new clock params

Update the documentation to reflect the new "VPU" clock needed
by the bcm2835-unicam driver.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
3 years agomedia: bcm2835: unicam: Set VPU min clock freq to 250Mhz.
Naushir Patuck [Mon, 11 May 2020 12:02:22 +0000 (13:02 +0100)]
media: bcm2835: unicam: Set VPU min clock freq to 250Mhz.

When streaming with Unicam, the VPU must have a clock frequency of at
least 250Mhz.  Otherwise, the input fifos could overrun, causing
image corruption.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
3 years agomedia: bcm2835-unicam: Ensure type is VIDEO_CAPTURE in [g|s]_selection
Dave Stevenson [Tue, 7 Jul 2020 13:52:43 +0000 (14:52 +0100)]
media: bcm2835-unicam: Ensure type is VIDEO_CAPTURE in [g|s]_selection

[g|s]_selection pass in a buffer type that needs to be validated
before passing on to the sensor subdev.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agomedia: bcm2835-unicam: Reinstate V4L2_CAP_READWRITE in the caps
Dave Stevenson [Tue, 7 Jul 2020 13:23:40 +0000 (14:23 +0100)]
media: bcm2835-unicam: Reinstate V4L2_CAP_READWRITE in the caps

v4l2-compliance throws a failure if the device doesn't advertise
V4L2_CAP_READWRITE but allows read or write operations.
We do support read, so reinstate the flag.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agomedia: i2c: imx290: Set the colorspace fields in the format
Dave Stevenson [Tue, 7 Jul 2020 10:51:26 +0000 (11:51 +0100)]
media: i2c: imx290: Set the colorspace fields in the format

The colorspace fields were left untouched in imx290_set_fmt
which lead to a v4l2-compliance failure.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agomedia: i2c: imx290: Add support for g_selection to report cropping
Dave Stevenson [Tue, 7 Jul 2020 10:23:48 +0000 (11:23 +0100)]
media: i2c: imx290: Add support for g_selection to report cropping

Userspace needs to know the cropping arrangements for each mode,
so expose this through g_selection.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agomedia: i2c: imx290: Explicitly set v&h blank on mode change
Dave Stevenson [Tue, 7 Jul 2020 09:31:53 +0000 (10:31 +0100)]
media: i2c: imx290: Explicitly set v&h blank on mode change

__v4l2_ctrl_modify_range only updates the current value should
it be invalid within the new range. That can leave modes producing
odd frame rates.

Explicitly update the HBLANK and VBLANK values so that on mode
change we revert to the default frame rate for the mode.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agomedia: i2c: ov9281: Read chip ID via 2 reads
Dave Stevenson [Mon, 6 Jul 2020 16:51:32 +0000 (17:51 +0100)]
media: i2c: ov9281: Read chip ID via 2 reads

Vision Components have made an OV9281 module which blocks reading
back the majority of registers to comply with NDAs, and in doing
so doesn't allow auto-increment register reading as used when
reading the chip ID.

Use two reads and manually combine the results.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agomedia: i2c: ov9281: Fixup for recent kernel releases, and remove custom code
Dave Stevenson [Tue, 14 Apr 2020 15:12:33 +0000 (16:12 +0100)]
media: i2c: ov9281: Fixup for recent kernel releases, and remove custom code

The Rockchip driver was based on a 4.4 kernel, and had several custom
Rockchip parts.

Update to 5.4 kernel APIs, with the relevant controls required by
libcamera, and remove custom Rockchip parts.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agomedia: i2c: ov9281: add enum_frame_interval function for iq tool 2.2 and hal3
Dave Stevenson [Tue, 14 Apr 2020 14:51:50 +0000 (15:51 +0100)]
media: i2c: ov9281: add enum_frame_interval function for iq tool 2.2 and hal3

Adds the ov9281 parts of the Rockchip patch adding enum_frame_interval to
a large number of drivers.

Change-Id: I03344cd6cf278dd7c18fce8e97479089ef185a5c
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
3 years agomedia: i2c: ov9281: fix mclk issue when probe multiple camera.
Dave Stevenson [Tue, 14 Apr 2020 14:47:09 +0000 (15:47 +0100)]
media: i2c: ov9281: fix mclk issue when probe multiple camera.

Takes the ov9281 part only from the Rockchip's patch.

Change-Id: I30e833baf2c1bb07d6d87ddb3b00759ab45a90e4
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
3 years agomedia: i2c: add ov9281 driver.
Zefa Chen [Fri, 17 May 2019 10:23:03 +0000 (18:23 +0800)]
media: i2c: add ov9281 driver.

Change-Id: I7b77250bbc56d2f861450cf77271ad15f9b88ab1
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>