platform/kernel/linux-rpi.git
3 years agoRevert "media: videobuf2: Fix length check for single plane dmabuf queueing"
Naushir Patuck [Tue, 15 Dec 2020 14:51:55 +0000 (14:51 +0000)]
Revert "media: videobuf2: Fix length check for single plane dmabuf queueing"

This reverts commit 961d3b27a2aff52dda0b97d35085a743a27c2f46.

The updated length check for dmabuf types broke existing usage in v4l2
userland clients.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
3 years agostaging/bcm2835-codec: Ensure OUTPUT timestamps are always forwarded
Dave Stevenson [Wed, 4 Nov 2020 18:31:02 +0000 (18:31 +0000)]
staging/bcm2835-codec: Ensure OUTPUT timestamps are always forwarded

The firmware by default tries to ensure that decoded frame
timestamps always increment. This is counter to the V4L2 API
which wants exactly the OUTPUT queue timestamps passed to the
CAPTURE queue buffers.

Disable the firmware option.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agooverlays: Fix cut-and-paste error in README
Phil Elwell [Mon, 7 Dec 2020 17:18:39 +0000 (17:18 +0000)]
overlays: Fix cut-and-paste error in README

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agooverlays: Add PCF85063 and PCF85063A to i2c-rtc
Phil Elwell [Mon, 7 Dec 2020 08:49:53 +0000 (08:49 +0000)]
overlays: Add PCF85063 and PCF85063A to i2c-rtc

Add support for the PCF85063 and PCF85063A RTC devices to the
i2c-rtc overlay.

Also enable the device to be used on i2c0 (i2c_vc) on GPIOs 0&1 (use
parameter "i2c0") and GPIOs 44 & 45 (use parameter "i2c_csi_dsi").

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoconfigs: Add RTC_DRV_PCF85063=m
Phil Elwell [Mon, 7 Dec 2020 08:33:19 +0000 (08:33 +0000)]
configs: Add RTC_DRV_PCF85063=m

Include the driver module for the PCF85063 and PCF85063A RTC devices.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoARM: dts: CM4 audio pins are not connected
Phil Elwell [Mon, 7 Dec 2020 09:35:57 +0000 (09:35 +0000)]
ARM: dts: CM4 audio pins are not connected

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoPCI: brcmstb: Advertise MSI-X support
Phil Elwell [Thu, 3 Dec 2020 13:44:42 +0000 (13:44 +0000)]
PCI: brcmstb: Advertise MSI-X support

Although the BRCMSTB PCIe interface doesn't technically support the
MSI-X spec, in practise it seems to work provided no more than 32
MSI-Xs are required. Add the required flag to the driver to allow
experimentation with devices that demand MSI-X support.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agomedia: bcm2835-unicam: Clear clock state when stopping streaming
Naushir Patuck [Wed, 2 Dec 2020 16:48:41 +0000 (16:48 +0000)]
media: bcm2835-unicam: Clear clock state when stopping streaming

Commit 65e08c465020d4c5b51afb452efc2246d80fd66f failed to clear the
clock state when the device stopped streaming. Fix this, as it might
again cause the same problems when doing an unprepare.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
3 years agomedia: bcm2835-unicam: Return early from stop_streaming() if stopped
Naushir Patuck [Wed, 2 Dec 2020 15:26:09 +0000 (15:26 +0000)]
media: bcm2835-unicam: Return early from stop_streaming() if stopped

clk_disable_unprepare() is called unconditionally in stop_streaming().
This is incorrect in the cases where start_streaming() fails, and
unprepares all clocks as part of the failure cleanup. To avoid this,
ensure that clk_disable_unprepare() is only called in stop_streaming()
if the clocks are in a prepared state.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
3 years agomedia: bcm2835-unicam: Correctly handle error propagation for stream on
Naushir Patuck [Wed, 2 Dec 2020 15:22:23 +0000 (15:22 +0000)]
media: bcm2835-unicam: Correctly handle error propagation for stream on

On a failure in start_streaming(), the error code would not propagate to
the calling function on all conditions. This would cause the userland
caller to not know of the failure.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
3 years agoOverlay: Update Allo Piano Plus dac driver for 5.4.y kernels.
paul-1 [Thu, 5 Nov 2020 00:17:48 +0000 (19:17 -0500)]
Overlay: Update Allo Piano Plus dac driver for 5.4.y kernels.

Create unique names for the two instances of the codec driver.

Signed-off-by: Paul Hermann <paul@picoreplayer.org>
3 years agoAdd allo boss2 config
Sudeep [Fri, 23 Oct 2020 10:22:38 +0000 (15:52 +0530)]
Add allo boss2 config

Signed-off-by: Sudeep <sudeepkumar@cem-solutions.net>
3 years agoAdd allo boss2 overlay
Sudeep [Fri, 23 Oct 2020 10:21:15 +0000 (15:51 +0530)]
Add allo boss2 overlay

Signed-off-by: Sudeep <sudeepkumar@cem-solutions.net>
3 years agoAllo boss2 driver
Sudeep [Fri, 23 Oct 2020 10:17:17 +0000 (15:47 +0530)]
Allo boss2 driver

Signed-off-by: Sudeep <sudeepkumar@cem-solutions.net>
3 years agodrm/vc4: Correct DSI register definition
Dave Stevenson [Mon, 30 Nov 2020 16:16:03 +0000 (16:16 +0000)]
drm/vc4: Correct DSI register definition

The DSI1_PHY_AFEC0_PD_DLANE1 and DSI1_PHY_AFEC0_PD_DLANE3 register
definitions were swapped, so trying to use more than a single data
lane failed as lane 1 would get powered down.
(In theory a 4 lane device would work as all lanes would remain
powered).

Correct the definitions.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agovc4_hdmi: Move hdmi reset to bind
Dom Cobley [Thu, 22 Oct 2020 18:07:24 +0000 (19:07 +0100)]
vc4_hdmi: Move hdmi reset to bind

The hdmi reset got moved to a later point in
"drm/vc4: hdmi: Add reset callback"

which now occurs after vc4_hdmi_cec_init
and so tramples the setup of registers like
HDMI_CEC_CNTRL_1

This only affects pi0-3 as on pi4 the cec
resgisters are in a separate block

Fixes: ed9a1f6eb4402b25b8a983dc4bfe40f025176e03
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agodt: Use compatible string for BCM2711 DSI1
Dave Stevenson [Thu, 12 Nov 2020 18:42:30 +0000 (18:42 +0000)]
dt: Use compatible string for BCM2711 DSI1

Updates the compatible string for DSI1 on BCM2711 to
differentiate it from BCM2835.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodrm/vc4: Add configuration for BCM2711 DSI1.
Dave Stevenson [Thu, 12 Nov 2020 17:18:13 +0000 (17:18 +0000)]
drm/vc4: Add configuration for BCM2711 DSI1.

BCM2711 DSI1 doesn't have the issue with the ARM not being
able to write to the registers, therefore remove the DMA
workaround for that compatible string.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodt-bindings: Add compatible for BCM2711 DSI1
Dave Stevenson [Thu, 12 Nov 2020 17:01:52 +0000 (17:01 +0000)]
dt-bindings: Add compatible for BCM2711 DSI1

DSI1 on BCM2711 doesn't require the DMA workaround that is used
on BCM2835/6/7, therefore it needs a new compatible string.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodrm/vc4: Add support for DSI0
Dave Stevenson [Wed, 11 Nov 2020 17:18:01 +0000 (17:18 +0000)]
drm/vc4: Add support for DSI0

DSI0 was partially supported, but didn't register with the main
driver, and the code was inconsistent as to whether it checked
port == 0 or port == 1.

Add compatible string and other support to make it consistent.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agomedia: ov9281: Add 1280x720 and 640x480 modes
Dave Stevenson [Sun, 22 Nov 2020 11:01:08 +0000 (11:01 +0000)]
media: ov9281: Add 1280x720 and 640x480 modes

Breaks out common register set and adds the different registers
for 1280x720 (cropped) and 640x480 (skipped) modes

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agoconfigs: Enable WireGuard kernel module on armhf configs
MichaIng [Mon, 23 Nov 2020 15:17:31 +0000 (16:17 +0100)]
configs: Enable WireGuard kernel module on armhf configs

CONFIG_WIREGUARD=m implies CONFIG_ARM_CRYPTO=y, hence the latter is removed.

Signed-off-by: MichaIng <micha@dietpi.com>
3 years agoconfigs: Restore BRIDGE_NETFILTER=m
Phil Elwell [Mon, 23 Nov 2020 14:56:18 +0000 (14:56 +0000)]
configs: Restore BRIDGE_NETFILTER=m

CONFIG_BRIDGE_NETFILTER=m used to be the default when CONFIG_NETFILTER
was enabled, but that was removed in 5.9. The way that defconfigs work
caused this wanted setting to be lost in rpi-5.9.y and rpi-5.10.y -
restore it now.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoconfigs: Regenerate the defconfigs
Phil Elwell [Mon, 23 Nov 2020 14:53:14 +0000 (14:53 +0000)]
configs: Regenerate the defconfigs

The CAN_ISOTP setting was in the wrong position, and it's better for
bisecting and reverting if this doesn't get rolled into the next
config-changing commit.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agomcp251xfd: add overlay
Marc Kleine-Budde [Thu, 14 Nov 2019 23:54:07 +0000 (00:54 +0100)]
mcp251xfd: add overlay

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agoAdd devicetree support for RaspberryPi 7" panel over DSI I2C
Dave Stevenson [Tue, 10 Nov 2020 17:49:35 +0000 (17:49 +0000)]
Add devicetree support for RaspberryPi 7" panel over DSI I2C

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
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>