platform/kernel/linux-rpi.git
3 years agodrm/panel/raspberrypi-ts: Insert delay before polling for startup state
Dave Stevenson [Tue, 10 Nov 2020 11:21:56 +0000 (11:21 +0000)]
drm/panel/raspberrypi-ts: Insert delay before polling for startup state

In switching to the hardware I2C controller there is an issue
where we seem to not get back the correct state from the Pi
touchscreen.
Insert a delay before polling to avoid this condition.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodrm/panel/raspberrypi-touchscreen: Use independent I2C actions with delay.
Dave Stevenson [Thu, 23 Apr 2020 09:17:18 +0000 (10:17 +0100)]
drm/panel/raspberrypi-touchscreen: Use independent I2C actions with delay.

We now have the hardware I2C controller pinmuxed to the drive the
display I2C, but this controller does not support clock stretching.
The Atmel micro-controller in the panel requires clock stretching
to allow it to prepare any data to be read.

Split the rpi_touchscreen_i2c_read into two independent transactions with
a delay between them for the Atmel to prepare the data.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodtoverlays: Add an overlay for the EDT FT5406 touchscreen
Dave Stevenson [Fri, 6 Nov 2020 18:52:25 +0000 (18:52 +0000)]
dtoverlays: Add an overlay for the EDT FT5406 touchscreen

This touchscreen controller is used by the 7" DSI panel, and
this overlay configures it for when it is NOT being polled by
the firmware.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agoInput: edt-ft5x06: Poll the device if no interrupt is configured.
Dave Stevenson [Fri, 6 Nov 2020 18:45:10 +0000 (18:45 +0000)]
Input: edt-ft5x06: Poll the device if no interrupt is configured.

Not all systems have the interrupt line wired up, so switch to
polling the touchscreen off a timer if no interrupt line is
configured.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agovc4: Clear unused infoframe packet RAM registers
Dom Cobley [Tue, 10 Nov 2020 20:04:08 +0000 (20:04 +0000)]
vc4: Clear unused infoframe packet RAM registers

Using a hdmi analyser the bytes in packet ram
registers beyond the length were visible in the
infoframes and it flagged the checksum as invalid.

Zeroing unused words of packet RAM avoids this

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agoPCI: brcmstb: Restore initial fundamental reset
Phil Elwell [Wed, 11 Nov 2020 17:08:33 +0000 (17:08 +0000)]
PCI: brcmstb: Restore initial fundamental reset

[1] replaced a single reset function with a pointer to one of two
implementations, but also removed the call asserting the reset
at the start of brcm_pcie_setup. Doing so breaks Raspberry Pis with
VL805 XHCI controllers lacking dedicated SPI EEPROMs, which have been
used for USB booting but then need to be reset so that the kernel
can reconfigure them. The lack of a reset causes the firmware's loading
of the EEPROM image to RAM to fail, breaking USB for the kernel.

See: https://www.raspberrypi.org/forums/viewtopic.php?p=1758157#p1758157

Fixes: 04356ac30771 ("PCI: brcmstb: Add bcm7278 PERST# support")

[1] 04356ac30771 ("PCI: brcmstb: Add bcm7278 PERST# support")

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agovc4_hdmi: Report that 3d/stereo is allowed
Dom Cobley [Mon, 9 Nov 2020 19:49:32 +0000 (19:49 +0000)]
vc4_hdmi: Report that 3d/stereo is allowed

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agoconfigs: Add CAN_MCP251XFD=m and CAN_ISOTP=m
menschel [Fri, 6 Nov 2020 22:32:22 +0000 (23:32 +0100)]
configs: Add CAN_MCP251XFD=m and CAN_ISOTP=m

* Add mcp251xfd driver module to the RPi kernel builds.
* Add isotp can protocol module to the RPi kernel builds.

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
3 years agoARM: dts: bcm27xx: Remove enable_headphones setting
Phil Elwell [Thu, 5 Nov 2020 11:39:35 +0000 (11:39 +0000)]
ARM: dts: bcm27xx: Remove enable_headphones setting

The enable_headphones parameter of the snd_bcm2835 module is forced
to 1 if enable_compat_alsa is 0, so setting them both on the kernel
command line is pointless (and, in the case of Pi 400 and Pi Zeroes,
confusing).

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agooverlays: Deprecate and delete the sdtweak overlay
Phil Elwell [Wed, 4 Nov 2020 11:25:02 +0000 (11:25 +0000)]
overlays: Deprecate and delete the sdtweak overlay

The sdtweak overlay has been superseded by the board-specific
sd_* parameters such as sd_poll_once, sd_overclock etc.

For example, replace:

    dtoverlay=sdtweak,poll_once

with:

    dtparam=sd_poll_once

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoARM: dts: Add bcm2711-rpi-400.dts
Phil Elwell [Tue, 14 Jul 2020 13:21:33 +0000 (14:21 +0100)]
ARM: dts: Add bcm2711-rpi-400.dts

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agooverlays: Add MAX31856 support to maxtherm overlay
Phil Elwell [Thu, 22 Oct 2020 16:11:12 +0000 (17:11 +0100)]
overlays: Add MAX31856 support to maxtherm overlay

Extend the maxtherm overlay with support for the MAX31856.
The driver reads the thermocouple type from a property, which is much
more civilised.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoconfigs: Add CONFIG_MAX31856=m
Phil Elwell [Mon, 2 Nov 2020 14:56:18 +0000 (14:56 +0000)]
configs: Add CONFIG_MAX31856=m

Enable support for MAX31856 temperature sensors.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agophy: broadcom: Add bcm54213pe configuration
Phil Elwell [Thu, 29 Oct 2020 14:10:56 +0000 (14:10 +0000)]
phy: broadcom: Add bcm54213pe configuration

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agophy: broadcom: split out the BCM54213PE from the BCM54210E IDs
Jonathan Bell [Tue, 14 May 2019 16:00:41 +0000 (17:00 +0100)]
phy: broadcom: split out the BCM54213PE from the BCM54210E IDs

The last nibble is a revision ID, and the 54213pe is a later rev
than the 54210e. Running the 54210e setup code on a 54213pe results
in a broken RGMII interface.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
3 years agofirmware: raspberrypi: Add support for tryonce reboot flag
Tim Gover [Tue, 20 Oct 2020 10:55:37 +0000 (11:55 +0100)]
firmware: raspberrypi: Add support for tryonce reboot flag

Define a new mailbox (SET_REBOOT_FLAGS) which may be used to
pass optional flags to the Raspberry Pi firmware that changes
the behaviour of the bootloader and firmware during a reboot.

Currently this just defines the 'tryboot' flag which causes
the firmware to load tryboot.txt instead config.txt. This
alternate configuration file can be used to specify the
path of an alternate firmware and kernels allowing a fallback
mechanism to be implemented for OS upgrades.

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>