platform/kernel/linux-rpi.git
4 years agodts: Add DTS for Pi 2B rev 1.2 with BCM2837 (#3235)
Phil Elwell [Wed, 18 Sep 2019 08:02:10 +0000 (09:02 +0100)]
dts: Add DTS for Pi 2B rev 1.2 with BCM2837 (#3235)

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agoconfigs: Regenerate defconfigs
Phil Elwell [Thu, 19 Sep 2019 12:39:15 +0000 (13:39 +0100)]
configs: Regenerate defconfigs

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agodrm/v3d: Delete pm_runtime support
Phil Elwell [Wed, 18 Sep 2019 16:22:36 +0000 (17:22 +0100)]
drm/v3d: Delete pm_runtime support

The pm_runtime was blocking changelist submission, so delete it as a
temporary workaround.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agostaging: bcm2835-codec: Correct g/s_selection API MPLANE support
Dave Stevenson [Fri, 13 Sep 2019 14:11:47 +0000 (15:11 +0100)]
staging: bcm2835-codec: Correct g/s_selection API MPLANE support

The g_selection and s_selection API is messed up and requires
the driver to expect the non-MPLANE buffer types, not the MPLANE
ones even if they are supported. The V4L2 core will convert the
MPLANE ones to non-MPLANE should they be passed in

Fixes: 5e484a3 staging: bcm2835-codec: switch to multi-planar API
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: bcm2835-codec: Allow height of 1920.
Dave Stevenson [Fri, 6 Sep 2019 16:24:55 +0000 (17:24 +0100)]
staging: bcm2835-codec: Allow height of 1920.

The codec is happy with video up to 1920 high if the width
is suitably reduced to stay within level limits. eg 1080x1920
is OK to decode.

Increase the height limit accordingly.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agoAdd Hifiberry DAC+DSP soundcard driver (#3224)
Jörg Schambacher [Thu, 12 Sep 2019 12:57:32 +0000 (14:57 +0200)]
Add Hifiberry DAC+DSP soundcard driver (#3224)

Adds the driver for the Hifiberry DAC+DSP. It supports capture and
playback depending on the DSP firmware.

Signed-off-by: Joerg Schambacher <joerg@i2audio.com>
4 years agodrm/vc4: Fix for margins in composite/SDTV mode (#3223)
James Hughes [Wed, 11 Sep 2019 13:57:18 +0000 (14:57 +0100)]
drm/vc4: Fix for margins in composite/SDTV mode (#3223)

Margins were incorrectly assumed to be setup in SDTV mode, but were
not actually done, so this make the setup non-conditional on mode.

Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
4 years agostaging: bcm2835-camera: Add greyworld AWB mode
Dave Stevenson [Fri, 6 Sep 2019 14:13:06 +0000 (15:13 +0100)]
staging: bcm2835-camera: Add greyworld AWB mode

This is mainly used for the NoIR camera which has no IR
filter and can completely confuse normal AWB presets.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agov4l2: Add a Greyworld AWB mode.
Dave Stevenson [Fri, 6 Sep 2019 14:04:51 +0000 (15:04 +0100)]
v4l2: Add a Greyworld AWB mode.

Adds a simple greyworld white balance preset, mainly for use
with cameras without an IR filter (eg Raspberry Pi NoIR)

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: bcm2835-codec: add media controller support
Kieran Bingham [Wed, 20 Mar 2019 12:54:15 +0000 (12:54 +0000)]
staging: bcm2835-codec: add media controller support

Provide a single media device to contain all of the bcm2835_codec
devices created.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
4 years agostaging: bcm2835-codec: Pass driver context to create entities
Kieran Bingham [Wed, 20 Mar 2019 11:35:26 +0000 (11:35 +0000)]
staging: bcm2835-codec: Pass driver context to create entities

Pass the bcm2835_codec_driver driver context directly into the
bcm2835_codec_create() so that it can be used to store driver global
state. Pass the struct platform_device *pdev by adding it to the driver
global state.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
4 years agostaging: bcm2835-codec: Add role to device name
Kieran Bingham [Wed, 20 Mar 2019 11:55:43 +0000 (11:55 +0000)]
staging: bcm2835-codec: Add role to device name

Three entities are created, Decode, Encode and ISP but all of the video
nodes use the same video name string "bcm2835-codec" which makes it
difficult to identify each role.

Append the role-name to the video name to facilitate identifying a
specific instance from userspace.

The Card-Type is also extended with the role name to support identifying
the device context from within QUERY_CAP operations.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
4 years agostaging: bcm2835-codec: Fix declaration of roles
Kieran Bingham [Wed, 20 Mar 2019 11:42:39 +0000 (11:42 +0000)]
staging: bcm2835-codec: Fix declaration of roles

The static role text is declared incorrectly. The static should be
first, and the roles should also be constified.

Convert from "const static char *" to "static const char * const".

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
4 years agostaging: bcm2835-codec: Fix non-documentation comment block
Kieran Bingham [Sun, 28 Apr 2019 10:15:35 +0000 (12:15 +0200)]
staging: bcm2835-codec: Fix non-documentation comment block

The job_ready comment is incorrectly using the documentation prefix
(/**) which causes a warning at build time.

Simplify it.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
4 years agomedia: i2c: Add driver for Sony IMX219 sensor
Dave Stevenson [Wed, 28 Aug 2019 12:34:49 +0000 (13:34 +0100)]
media: i2c: Add driver for Sony IMX219 sensor

Adds a driver for the 8MPix Sony IMX219 CSI2 sensor.
Whilst the sensor supports 2 or 4 CSI2 data lanes, this driver
currently only supports 2 lanes.
8MPix @ 15fps, 1080P @ 30fps (cropped FOV), and 1640x1232 (2x2 binned)
@ 30fps are currently supported.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
4 years agomedia: dt-bindings: Add binding for the Sony IMX219 sensor
Dave Stevenson [Wed, 28 Aug 2019 12:34:30 +0000 (13:34 +0100)]
media: dt-bindings: Add binding for the Sony IMX219 sensor

The IMX219 is an 8MPix CSI2 sensor, supporting 2 or 4 data lanes.
Document the binding for this device.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agoarch/arm64: Add Revision, Serial, Model to cpuinfo
Phil Elwell [Tue, 3 Sep 2019 17:17:25 +0000 (18:17 +0100)]
arch/arm64: Add Revision, Serial, Model to cpuinfo

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agoarch/arm: Add model string to cpuinfo
Phil Elwell [Tue, 3 Sep 2019 17:16:56 +0000 (18:16 +0100)]
arch/arm: Add model string to cpuinfo

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agostaging: bcm2835-codec: remove unnecessary padding on encoder input
Aman Gupta [Fri, 23 Aug 2019 23:29:07 +0000 (16:29 -0700)]
staging: bcm2835-codec: remove unnecessary padding on encoder input

The ISP and ENCODE roles have the same underlying hardware. Neither requires vertical alignment.

Signed-off-by: Aman Gupta <aman@tmm1.net>
4 years agostaging: bcm2835-codec: add support for V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME
Aman Gupta [Thu, 22 Aug 2019 22:31:37 +0000 (22:31 +0000)]
staging: bcm2835-codec: add support for V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME

fixes #3171

Signed-off-by: Aman Gupta <aman@tmm1.net>
4 years agoconfigs: arm64/bcm2711: Enable V3D
Phil Elwell [Thu, 15 Aug 2019 11:02:34 +0000 (12:02 +0100)]
configs: arm64/bcm2711: Enable V3D

Enable the V3D driver, which depends on BCM2835_POWER.

Originally submitted by GitHub user 'phire' in a slightly different
form.

See: https://github.com/raspberrypi/linux/pull/3063

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agoxhci: Use more event ring segment table entries
Jonathan Bell [Tue, 13 Aug 2019 14:53:29 +0000 (15:53 +0100)]
xhci: Use more event ring segment table entries

Users have reported log spam created by "Event Ring Full" xHC event
TRBs. These are caused by interrupt latency in conjunction with a very
busy set of devices on the bus. The errors are benign, but throughput
will suffer as the xHC will pause processing of transfers until the
event ring is drained by the kernel. Expand the number of event TRB slots
available by increasing the number of event ring segments in the ERST.

Controllers have a hardware-defined limit as to the number of ERST
entries they can process, so make the actual number in use
min(ERST_MAX_SEGS, hw_max).

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
4 years agonet: bcmgenet: Workaround #2 for Pi4 Ethernet fail
Phil Elwell [Fri, 9 Aug 2019 07:51:43 +0000 (08:51 +0100)]
net: bcmgenet: Workaround #2 for Pi4 Ethernet fail

Some combinations of Pi 4Bs and Ethernet switches don't reliably get a
DCHP-assigned IP address, leaving the unit with a self=assigned 169.254
address. In the failure case, the Pi is left able to receive packets
but not send them, suggesting that the MAC<->PHY link is getting into
a bad state.

It has been found empirically that skipping a reset step by the genet
driver prevents the failures. No downsides have been discovered yet,
and unlike the forced renegotiation it doesn't increase the time to
get an IP address, so the workaround is enabled by default; add

  genet.skip_umac_reset=n

to the command line to disable it.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agodrm/vc4: Add missing NULL check to vc4_crtc_consume_event
Dave Stevenson [Wed, 7 Aug 2019 10:31:08 +0000 (11:31 +0100)]
drm/vc4: Add missing NULL check to vc4_crtc_consume_event

vc4_crtc_consume_event wasn't checking crtc->state->event was
set before dereferencing it, leading to an OOPS.

Fixes "a5b534b drm/vc4: Resolve the vblank warnings on mode switching"

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: bcm2835-codec: Correct bytesperline on format changed
Dave Stevenson [Thu, 11 Jul 2019 13:58:35 +0000 (14:58 +0100)]
staging: bcm2835-codec: Correct bytesperline on format changed

The handling of format changed events incorrectly set bytesperline
to the cropped width, which ignored padding and formats with
more than 8bpp.
Fix these.

Reported by: zillevdr <zillevdr@gmx.de>
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging:bcm2835-codec: Expand logging on format setting
Dave Stevenson [Thu, 11 Jul 2019 13:57:09 +0000 (14:57 +0100)]
staging:bcm2835-codec: Expand logging on format setting

Adds some more useful logging during format changed events and
s_fmt.

Reported by: zillevdr <zillevdr@gmx.de>
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm/vc4: Remove unused mode variable
Dave Stevenson [Thu, 25 Jul 2019 16:34:29 +0000 (17:34 +0100)]
drm/vc4: Remove unused mode variable

"89d1376 drm/vc4: Add support for margins to fkms" removed
the requirement for having the mode structure from vc4_plane_to_mb,
but didn't remove it as a local to the function, causing a
compiler warning.

Remove the unused variable.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm/vc4: Resolve the vblank warnings on mode switching
Dave Stevenson [Thu, 25 Jul 2019 16:27:44 +0000 (17:27 +0100)]
drm/vc4: Resolve the vblank warnings on mode switching

The details over when and how a driver is to service the
vblank events are sketchy, and the fkms driver was triggering
a kernel warning every time the crtc was enabled or disabled.

Copy the event handling as used by the vc4-kms driver slightly
more closely, and we avoid the warnings.

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

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agoAdd HDMI1 facility to the driver.
James Hughes [Tue, 16 Jul 2019 11:18:21 +0000 (12:18 +0100)]
Add HDMI1 facility to the driver.

For generic ALSA, all you need is the bcm2835.h change, but
have also added structures for IEC958 HDMI. Not sure how to
test those.

4 years agostaging: bcm2835-codec: set device_caps in struct video_device
Chen-Yu Tsai [Mon, 22 Jul 2019 14:20:55 +0000 (22:20 +0800)]
staging: bcm2835-codec: set device_caps in struct video_device

Instead of filling in the struct v4l2_capability device_caps
field, fill in the struct video_device device_caps field.

That way the V4L2 core knows what the capabilities of the
video device are.

This is similar to a cleanup series by Hans Verkuil [1].

[1] https://www.spinics.net/lists/linux-media/msg153313.html

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agostaging: bcm2835-codec: implement V4L2_CID_MIN_BUFFERS_FOR_CAPTURE
Chen-Yu Tsai [Mon, 22 Jul 2019 14:13:30 +0000 (22:13 +0800)]
staging: bcm2835-codec: implement V4L2_CID_MIN_BUFFERS_FOR_CAPTURE

The stateful decoder specification shows an optional step for retrieving
the miminum number of capture buffers required for the decoder to
proceed. While not a required parameter, having it makes some
applications happy.

bcm2835-codec is a little different from other decoder implementations
in that there is an intermediate format conversion between the hardware
and V4L2 buffers. The number of capture buffers required is therefore
independent of the stream and DPB etc.

There are plans to remove the conversion, but it requires a fair amount
of rework within the firmware. Until that is done, simply return a value
of 1.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agostaging: bcm2835-codec: switch to multi-planar API
Chen-Yu Tsai [Thu, 18 Jul 2019 09:07:05 +0000 (17:07 +0800)]
staging: bcm2835-codec: switch to multi-planar API

There are two APIs for mem2mem devices, the older single-planar API and
the newer multi-planar one. Without making things overly complex, the
driver can only support one or the other. However the userspace libv4l2
library has a plugin that allows multi-planar API devices to service
single-planar consumers.

Chromium supports the multi-planar API exclusively, though this is
currently limited to ChromiumOS. It would be possible to add support
for generic Linux.

Switching to the multi-planar API would allow usage of both APIs from
userspace.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agodrm/vc4: fkms: Set default state margin at reset
Dave Stevenson [Tue, 23 Jul 2019 10:09:26 +0000 (11:09 +0100)]
drm/vc4: fkms: Set default state margin at reset

Now that the TV margins are properly parsed and filled into
drm_cmdline_mode, we just need to initialise the first state at reset to
get those values and start using them.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm/vc4: Add "Broadcast RGB" connector property
Dave Stevenson [Fri, 14 Jun 2019 09:12:07 +0000 (10:12 +0100)]
drm/vc4: Add "Broadcast RGB" connector property

Some HDMI monitors do not abide by the full or limited
(16-235) range RGB flags in the AVI infoframe. This can
result in images looking washed out (if given limited and
interpreting as full), or detail disappearing at the extremes
(given full and interpreting as limited).

Copy the Intel i915 driver's approach of adding an override
property ("Broadcast RGB") to force one mode or the other.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agohid: usb: Add device quirks for Freeway Airmouse T3 and MX3
Jonathan Bell [Thu, 1 Aug 2019 15:41:20 +0000 (16:41 +0100)]
hid: usb: Add device quirks for Freeway Airmouse T3 and MX3

These wireless mouse/keyboard combo remote control devices specify
multiple "wheel" events in their report descriptors. The wheel events
are incorrectly defined and apparently map to accelerometer data, leading
to spurious mouse scroll events being generated at an extreme rate when
the device is moved.

As a workaround, use HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE to mask
feeding the extra wheel events to the input subsystem.

See: https://github.com/raspberrypi/firmware/issues/1189

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
4 years agodrivers: char: add chardev for mmap'ing the RPiVid control registers
Jonathan Bell [Thu, 9 May 2019 13:30:37 +0000 (14:30 +0100)]
drivers: char: add chardev for mmap'ing the RPiVid control registers

Based on the gpiomem driver, allow mapping of the decoder register
spaces such that userspace can access control/status registers.
This driver is intended for use with a custom ffmpeg backend accelerator
prior to a v4l2 driver being written.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
4 years agoFixup FKMS interrupt handing for non-existent display
James Hughes [Mon, 29 Jul 2019 11:02:59 +0000 (12:02 +0100)]
Fixup FKMS interrupt handing for non-existent display

If an errant interrupt flag was received from a non-existent display,
a NULL pointer access was made. Protect against this by checking if a
second display is present prior to checking the interrupt flags.

4 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>
4 years agoadds the Hifiberry DAC+ADC PRO version
Joerg Schambacher [Tue, 23 Jul 2019 14:57:35 +0000 (16:57 +0200)]
adds the Hifiberry DAC+ADC PRO version

This adds the driver for the DAC+ADC PRO version of the Hifiberry soundcard with software controlled PCM1863 ADC
Signed-off-by: Joerg Schambacher joerg@i2audio.com
4 years agodrm/vc4: Ensure zpos is always initialised
Dave Stevenson [Fri, 19 Jul 2019 16:49:00 +0000 (17:49 +0100)]
drm/vc4: Ensure zpos is always initialised

The compiler is warning that default_zpos can be used
uninitialised as there is no default case to catch all plane
types.
No other plane types should ever be presented to vc4_fkms_plane_init,
but add a default case regardless.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm/vc4: Add support for margins to fkms
Dave Stevenson [Fri, 19 Jul 2019 14:35:13 +0000 (15:35 +0100)]
drm/vc4: Add support for margins to fkms

Allows for overscan to be configured under FKMS.
NB This is rescaling the planes, not reducing the size of the
display mode.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm/vc4: Pass the drm vrefresh to the firmware on mode set
Dave Stevenson [Thu, 11 Jul 2019 14:12:05 +0000 (15:12 +0100)]
drm/vc4: Pass the drm vrefresh to the firmware on mode set

More for completeness than need, but use drm_mode_vrefresh
to compute the vrefresh value, and pass that down to the
firmware on mode set.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm/vc4: Query firmware for custom HDMI mode
Dave Stevenson [Wed, 3 Jul 2019 16:44:53 +0000 (17:44 +0100)]
drm/vc4: Query firmware for custom HDMI mode

Allow custom HDMI modes to be specified from config.txt,
and these then override EDID parsing.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agoPorted pcie-brcmstb bounce buffer implementation to ARM64. (#3144)
yaroslavros [Wed, 14 Aug 2019 14:22:55 +0000 (15:22 +0100)]
Ported pcie-brcmstb bounce buffer implementation to ARM64. (#3144)

Ported pcie-brcmstb bounce buffer implementation to ARM64.
This enables full 4G RAM usage on Raspberry Pi in 64-bit mode.

Signed-off-by: Yaroslav Rosomakho <yaroslavros@gmail.com>
4 years agostaging: bcm2835_camera: Ensure all buffers are returned on disable
Dave Stevenson [Thu, 28 Jun 2018 14:57:25 +0000 (15:57 +0100)]
staging: bcm2835_camera: Ensure all buffers are returned on disable

With the recent change to match MMAL and V4L2 buffers there
is a need to wait for all MMAL buffers to be returned during
stop_streaming.

Fixes: 9384167 "staging: bcm2835-camera: Remove V4L2/MMAL buffer remapping"
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agoAccording to 5713 pdf doc CLOCK_CTRL is a readonly status register, and it behaves...
Hermann Lauer [Thu, 8 Aug 2019 13:40:37 +0000 (15:40 +0200)]
According to 5713 pdf doc CLOCK_CTRL is a readonly status register, and it behaves so. Remove useless setting

4 years agodrm/v3d: Clock V3D down when not in use.
Eric Anholt [Thu, 2 May 2019 20:22:53 +0000 (13:22 -0700)]
drm/v3d: Clock V3D down when not in use.

My various attempts at re-enabling runtime PM have failed, so just
crank the clock down when V3D is idle to reduce power consumption.

Signed-off-by: Eric Anholt <eric@anholt.net>
4 years agodrm/v3d: HACK: gut runtime pm for now.
Eric Anholt [Mon, 14 Jan 2019 23:13:17 +0000 (15:13 -0800)]
drm/v3d: HACK: gut runtime pm for now.

Something is still unstable -- on starting a new glxgears from an idle
X11, I get an MMU violation in high addresses.  The CTS also failed
quite quickly.  With this, CTS progresses for an hour before OOMing
(allocating some big buffers when my board only has 600MB available to
Linux)

Signed-off-by: Eric Anholt <eric@anholt.net>
4 years agortl8192cu: Let it support to build in the non-src folder
Hui Wang [Thu, 22 Aug 2019 15:32:46 +0000 (23:32 +0800)]
rtl8192cu: Let it support to build in the non-src folder

If we build the kernel with "-O=$non-src-folder", this driver will
introdcue a building error because of the header's location.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agodrm/vc4: Prevent load tracking from breaking FKMS
Phil Elwell [Thu, 15 Aug 2019 07:39:08 +0000 (08:39 +0100)]
drm/vc4: Prevent load tracking from breaking FKMS

Firmware KMS uses a mixture of VC4 processing and dedicated code. The
load tracking support in VC4 assumes it is dealing with vc4_plane_state
objects when up-casting with container_of, but FKMS uses unadorned
drm_plane_state structures causing the VC4 code to read off the end
into random portions of memory. Work around the problem in a minimally-
invasive way by over-allocating the FKMS plane state structures to be
large enough to contain a vc4_plane_state, filling the remainder with
zeroes.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agopcie-brcmstb: Don't set DMA ops for root complex
Phil Elwell [Wed, 7 Aug 2019 16:19:33 +0000 (17:19 +0100)]
pcie-brcmstb: Don't set DMA ops for root complex

A change to arm_get_dma_map_ops has stopped get_dma_ops from working
on the root complex, causing an error to be logged. However, there is
no need to override the DMA ops in that case, so skip it and
eliminate the error message.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agoclk-bcm2835: Avoid null pointer exception
popcornmix [Tue, 6 Aug 2019 14:23:14 +0000 (15:23 +0100)]
clk-bcm2835: Avoid null pointer exception

clk_desc_array[BCM2835_PLLB] doesn't exist so we dereference null when iterating

Signed-off-by: popcornmix <popcornmix@gmail.com>
4 years agobcm2835-dma: Add proper 40-bit DMA support
Phil Elwell [Thu, 4 Apr 2019 12:33:47 +0000 (13:33 +0100)]
bcm2835-dma: Add proper 40-bit DMA support

The 40-bit additions are not fully tested, but it should be
capable of supporting both 40-bit memcpy on BCM2711 and regular
Lite channels on BCM2835.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agostaging: vc04_services: fix compiling in separate directory
Marek Behún [Sat, 3 Aug 2019 12:34:59 +0000 (14:34 +0200)]
staging: vc04_services: fix compiling in separate directory

The vc04_services Makefiles do not respect the O=path argument
correctly: include paths in CFLAGS are given relatively to object path,
not source path. Compiling in a separate directory yields #include
errors.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
4 years agoarm64/mm: Limit the DMA zone for arm64
Andrei Gherzan [Tue, 16 Jul 2019 12:28:22 +0000 (13:28 +0100)]
arm64/mm: Limit the DMA zone for arm64

On RaspberryPi, only the first 1Gb can be used for DMA[1].

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2019-July/665986.html

Signed-off-by: Andrei Gherzan <andrei@balena.io>
4 years agoi2c: bcm2835: Set clock-stretch timeout to 35ms
Phil Elwell [Fri, 12 Jul 2019 14:38:35 +0000 (15:38 +0100)]
i2c: bcm2835: Set clock-stretch timeout to 35ms

The BCM2835 I2C blocks have a register to set the clock-stretch
timeout - how long the device is allowed to hold SCL low - in bus
cycles. The current driver doesn't write to the register, therefore
the default value of 64 cycles is being used for all devices.

Set the timeout to the value recommended for SMBus - 35ms.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agoxhci: add quirk for host controllers that don't update endpoint DCS
Jonathan Bell [Thu, 11 Jul 2019 16:55:43 +0000 (17:55 +0100)]
xhci: add quirk for host controllers that don't update endpoint DCS

Seen on a VLI VL805 PCIe to USB controller. For non-stream endpoints
at least, if the xHC halts on a particular TRB due to an error then
the DCS field in the Out Endpoint Context maintained by the hardware
is not updated with the current cycle state.

Using the quirk XHCI_EP_CTX_BROKEN_DCS and instead fetch the DCS bit
from the TRB that the xHC stopped on.

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

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
4 years agotty: amba-pl011: Make TX optimisation conditional
Phil Elwell [Thu, 11 Jul 2019 12:13:39 +0000 (13:13 +0100)]
tty: amba-pl011: Make TX optimisation conditional

pl011_tx_chars takes a "from_irq" parameter to reduce the number of
register accesses. When from_irq is true the function assumes that the
FIFO is half empty and writes up to half a FIFO's worth of bytes
without polling the FIFO status register, the reasoning being that
the function is being called as a result of the TX interrupt being
raised. This logic would work were it not for the fact that
pl011_rx_chars, called from pl011_int before pl011_tx_chars, releases
the spinlock before calling tty_flip_buffer_push.

A user thread writing to the UART claims the spinlock and ultimately
calls pl011_tx_chars with from_irq set to false. This reverts to the
older logic that polls the FIFO status register before sending every
byte. If this happen on an SMP system during the section of the IRQ
handler where the spinlock has been released, then by the time the TX
interrupt handler is called, the FIFO may already be full, and any
further writes are likely to be lost.

The fix involves adding a per-port flag that is true iff running from
within the interrupt handler and the spinlock has not yet been released.
This flag is then used as the value for the from_irq parameter of
pl011_tx_chars, causing polling to be used in the unsafe case.

Fixes: 1e84d22322ce ("serial/amba-pl011: Refactor and simplify TX FIFO handling")

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agodrm/vc4: Add support for color encoding on YUV planes
Dave Stevenson [Mon, 24 Jun 2019 01:29:40 +0000 (02:29 +0100)]
drm/vc4: Add support for color encoding on YUV planes

Adds signalling for BT601/709/2020, and limited/full range
(on BT601).

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4_dsi: Fix DMA channel and memory leak in vc4 (#3012)
Chris Miller [Wed, 26 Jun 2019 09:40:30 +0000 (10:40 +0100)]
drm: vc4_dsi: Fix DMA channel and memory leak in vc4 (#3012)

Signed-off-by: Chris G Miller <chris@creative-electronics.net>
4 years agodrm/vc4: Ignore HVS unless initialised
Phil Elwell [Fri, 19 Jul 2019 13:29:28 +0000 (14:29 +0100)]
drm/vc4: Ignore HVS unless initialised

An upstream commit to report HVS underruns causes VC4 in firmware KMS
mode to cross into the HVS side, where it crashes due to a NULL hvs
pointer.

Make the underrun masking conditional on the hvs pointer being
initialised.

Fixes: 531a1b622da9 ("drm/vc4: Report HVS underrun errors")

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agodrm/vc4: Limit fkms to modes <= 85Hz
Dave Stevenson [Tue, 18 Jun 2019 20:37:45 +0000 (21:37 +0100)]
drm/vc4: Limit fkms to modes <= 85Hz

Selecting 1080p100 and 120 has very limited gain, but don't want
to block VGA85 and similar.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm/vc4: In FKMS look at the modifiers correctly for SAND
Dave Stevenson [Wed, 12 Jun 2019 16:13:21 +0000 (17:13 +0100)]
drm/vc4: In FKMS look at the modifiers correctly for SAND

Incorrect masking was used in the switch for the modifier,
therefore for SAND (which puts the column pitch in the
modifier) it didn't match.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4: Add status of which display is updated through vblank
Dave Stevenson [Tue, 4 Jun 2019 11:14:30 +0000 (12:14 +0100)]
drm: vc4: Add status of which display is updated through vblank

Previously multiple  displays were slaved off the same SMI
interrupt, triggered by HVS channel 1 (HDMI0).
This doesn't work if you only have a DPI or DSI screen (HVS channel
0), and gives slightly erroneous results with dual HDMI as the
events for HDMI1 are incorrect.

Use SMIDSW0 and SMIDSW1 registers to denote which display has
triggered the vblank.
Handling should be backwards compatible with older firmware.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm/vc4: Remove 340MHz clock limit from FKMS now scrambling issues resolved
Dave Stevenson [Mon, 10 Jun 2019 15:32:51 +0000 (16:32 +0100)]
drm/vc4: Remove 340MHz clock limit from FKMS now scrambling issues resolved

Firmware TMDS scrambling is now being correctly configured, so
we can use it.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm/vc4: Fix T-format modifiers in FKMS.
Dave Stevenson [Fri, 7 Jun 2019 10:31:21 +0000 (11:31 +0100)]
drm/vc4: Fix T-format modifiers in FKMS.

The wrong vc_image formats were being checked for in the switch
statement. Correct these.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm/vc4: Max resolution of 7680 is conditional on being Pi4
Dave Stevenson [Thu, 30 May 2019 14:55:15 +0000 (15:55 +0100)]
drm/vc4: Max resolution of 7680 is conditional on being Pi4

The max resolution had been increased from 2048 to 7680 for all
platforms. This code is common with Pi0-3 which have a max render
target for GL of 2048, therefore the increased resolution has to
be conditional on the platform.
Switch based on whether the bcm2835-v3d node is found, as that is
not present on Pi4. (There is a potential configuration on Pi0-3
with no v3d, but this is very unlikely).

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm/vc4: fkms to query the VPU for HDMI clock limits
Dave Stevenson [Thu, 30 May 2019 12:56:15 +0000 (13:56 +0100)]
drm/vc4: fkms to query the VPU for HDMI clock limits

The VPU has configured clocks for 4k (or not) via config.txt,
and will limit the choice of video modes based on that.
Make fkms query it for these limits too to avoid selecting modes
that can not be handled by the current clock setup.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm/vc4: Correct SAND support for FKMS.
Dave Stevenson [Wed, 29 May 2019 14:44:11 +0000 (15:44 +0100)]
drm/vc4: Correct SAND support for FKMS.

It was accepting NV21 which doesn't map through, but
also wasn't advertising the modifier so nothing would know
to request it.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4: Fixup typo when setting HDMI aspect ratio
Dave Stevenson [Tue, 7 May 2019 14:00:02 +0000 (15:00 +0100)]
drm: vc4: Fixup typo when setting HDMI aspect ratio

Assignment was to the wrong structure.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm/vc4: Support the VEC in FKMS
Dave Stevenson [Fri, 24 May 2019 16:59:01 +0000 (17:59 +0100)]
drm/vc4: Support the VEC in FKMS

Extends the DPI/DSI support to also report the VEC output
which supports interlacing too.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4: handle the case where there are no available displays
Jonathan Bell [Tue, 28 May 2019 12:56:06 +0000 (13:56 +0100)]
drm: vc4: handle the case where there are no available displays

It's reasonable for the firmware to return zero as the number of
attached displays. Handle this case as otherwise drm thinks that
the DSI panel is attached, which is nonsense.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
4 years agodrm: vc4: Probe DPI/DSI timings from the firmware
Dave Stevenson [Tue, 21 May 2019 10:50:00 +0000 (11:50 +0100)]
drm: vc4: Probe DPI/DSI timings from the firmware

For DPI and DSI displays query the firmware as to the configuration
and add it as the only mode for DRM.

In theory we can add plumbing for setting the DPI/DSI mode from
KMS, but this is not being added at present as the support frameworks
aren't present in the firmware.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4-firmware-kms: Fix DSI display support
Dave Stevenson [Thu, 16 May 2019 16:49:42 +0000 (17:49 +0100)]
drm: vc4-firmware-kms: Fix DSI display support

The mode was incorrectly listed as interlaced, which was then
rejected.
Correct this and FKMS works with the DSI display.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4: Log flags in fkms mode set
Dave Stevenson [Tue, 7 May 2019 11:13:34 +0000 (12:13 +0100)]
drm: vc4: Log flags in fkms mode set

The flags contain info such as limited/full range RGB, aspect
ratio, and a fwe other useful things.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4-firmware-kms: Remove incorrect overscan support.
Dave Stevenson [Fri, 3 May 2019 12:58:03 +0000 (13:58 +0100)]
drm: vc4-firmware-kms: Remove incorrect overscan support.

The overscan support was required for the old mailbox API
in order to match up the cursor and frame buffer planes.
With the newer API directly talking to dispmanx there is no
difference, therefore FKMS does not need to make any
adjustments.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4: FKMS reads the EDID from fw, and supports mode setting
Dave Stevenson [Tue, 9 Apr 2019 17:23:41 +0000 (18:23 +0100)]
drm: vc4: FKMS reads the EDID from fw, and supports mode setting

This extends FKMS to read the EDID from the display, and support
requesting a particular mode via KMS.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4: Increase max_width/height to 7680.
Dave Stevenson [Mon, 29 Apr 2019 17:45:00 +0000 (18:45 +0100)]
drm: vc4: Increase max_width/height to 7680.

There are some limits still being investigated that stop
us going up to 8192, but 7680 is sufficient for dual 4k
displays.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4: Bring fkms into line with kms in blocking doublescan modes
Dave Stevenson [Wed, 10 Apr 2019 16:43:57 +0000 (17:43 +0100)]
drm: vc4: Bring fkms into line with kms in blocking doublescan modes

Implement vc4_crtc_mode_valid so that it blocks doublescan modes

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4: Iterate over all planes in vc4_crtc_[dis|en]able
Dave Stevenson [Wed, 10 Apr 2019 16:42:37 +0000 (17:42 +0100)]
drm: vc4: Iterate over all planes in vc4_crtc_[dis|en]able

Fixes a FIXME where the overlay plane wouldn't be restored.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4: Remove unused vc4_fkms_cancel_page_flip function
Dave Stevenson [Wed, 10 Apr 2019 16:35:05 +0000 (17:35 +0100)]
drm: vc4: Remove unused vc4_fkms_cancel_page_flip function

"32a3dbe drm/vc4: Nuke preclose hook" removed vc4_cancel_page_flip,
but vc4_fkms_cancel_page_flip was still be added to with the
fkms driver, even though it was never called.
Nuke it too.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4: Add support for H & V flips on each plane for FKMS
Dave Stevenson [Tue, 9 Apr 2019 16:19:51 +0000 (17:19 +0100)]
drm: vc4: Add support for H & V flips on each plane for FKMS

They are near zero cost options for the HVS, therefore they
may as well be implemented, and it allows us to invert the
DSI display.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4: Need to call drm_crtc_vblank_[on|off] from vc4_crtc_[en|dis]able
Dave Stevenson [Tue, 9 Apr 2019 17:14:44 +0000 (18:14 +0100)]
drm: vc4: Need to call drm_crtc_vblank_[on|off] from vc4_crtc_[en|dis]able

vblank needs to be enabled and disabled by the driver to avoid the
DRM framework complaining in the kernel log.

vc4_fkms_disable_vblank needs to signal that we don't want vblank
callbacks too.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm/vc4: Set the display number when querying the display resolution
Dave Stevenson [Tue, 9 Apr 2019 13:00:07 +0000 (14:00 +0100)]
drm/vc4: Set the display number when querying the display resolution

Without this the two displays got set to the same resolution.
(Requires a firmware bug fix to work).

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4: Query the display ID for each display in FKMS
Dave Stevenson [Tue, 9 Apr 2019 11:37:28 +0000 (12:37 +0100)]
drm: vc4: Query the display ID for each display in FKMS

Replace the hard coded list of display IDs for a mailbox call
that returns the display ID for each display that has been
detected.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4: Remove now unused structure.
Dave Stevenson [Fri, 5 Apr 2019 16:24:20 +0000 (17:24 +0100)]
drm: vc4: Remove now unused structure.

Cleaning up structure that was unused after
fbb59a2 drm: vc4: Add an overlay plane to vc4-firmware-kms

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4: Select display to blank during initialisation
Dave Stevenson [Fri, 5 Apr 2019 16:23:15 +0000 (17:23 +0100)]
drm: vc4: Select display to blank during initialisation

Otherwise the rainbow splash screen remained in the display list

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4: Fix build warning
Dave Stevenson [Fri, 5 Apr 2019 16:21:56 +0000 (17:21 +0100)]
drm: vc4: Fix build warning

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4: Add support for multiple displays to fkms
Dave Stevenson [Wed, 3 Apr 2019 16:15:45 +0000 (17:15 +0100)]
drm: vc4: Add support for multiple displays to fkms

There is a slightly nasty hack in that all crtcs share the
same SMI interrupt from the firmware. This seems to currently
work well enough, but ought to be fixed at a later date.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4: Increase max screen size to 4096x4096.
Dave Stevenson [Wed, 3 Apr 2019 14:20:05 +0000 (15:20 +0100)]
drm: vc4: Increase max screen size to 4096x4096.

We now should support 4k screens, therefore this limit needs to
be increased.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm: vc4: Add an overlay plane to vc4-firmware-kms
Dave Stevenson [Wed, 27 Mar 2019 17:45:01 +0000 (17:45 +0000)]
drm: vc4: Add an overlay plane to vc4-firmware-kms

This uses a new API that is exposed via the mailbox service
to stick an element straight on the screen using DispmanX.

The primary and cursor planes have also been switched to using
the new plane API, and it supports layering based on the DRM
zpos parameter.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agogpu: vc4-fkms: Switch to the newer mailbox frame buffer API.
Dave Stevenson [Tue, 26 Mar 2019 14:43:06 +0000 (14:43 +0000)]
gpu: vc4-fkms: Switch to the newer mailbox frame buffer API.

The old mailbox FB API was ideally deprecated but still used by
the FKMS driver.
Update to the newer API.

NB This needs current firmware that accepts ARM allocated buffers
through the newer API.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agodrm/vc4: Fix vblank timestamping for firmwarekms.
Eric Anholt [Tue, 2 Apr 2019 20:29:00 +0000 (13:29 -0700)]
drm/vc4: Fix vblank timestamping for firmwarekms.

The core doesn't expect a false return from the scanoutpos function in
normal usage, so we were doing the precise vblank timestamping path
and thus "immediate" vblank disables (even though firmwarekms can't
actually disable vblanks interrupts, sigh), and the kernel would get
confused when getting timestamp info when also turning vblanks back
on.

Signed-off-by: Eric Anholt <eric@anholt.net>
4 years agodrm/vc4: Expose the format modifiers for firmware kms.
Eric Anholt [Mon, 18 Mar 2019 23:38:32 +0000 (16:38 -0700)]
drm/vc4: Expose the format modifiers for firmware kms.

This should technically not expose VC4_T_TILED on pi4.  However, if we
don't expose anything, then userspace will assume that display can
handle whatever modifiers 3d can do (UIF on 2711).  By exposing a
list, that will get intersected with what 3D can do so that we get T
tiling for display on 2710 and linear on 2711.

Signed-off-by: Eric Anholt <eric@anholt.net>
4 years agodrm/vc4: Fix synchronization firmwarekms against GL rendering.
Eric Anholt [Thu, 28 Mar 2019 18:58:51 +0000 (11:58 -0700)]
drm/vc4: Fix synchronization firmwarekms against GL rendering.

We would present the framebuffer immediately without waiting for
rendering to finish first, resulting in stuttering and flickering as a
window was dragged around when the GPU was busy enough to not just win
the race.

Signed-off-by: Eric Anholt <eric@anholt.net>
4 years agodrm/v3d: Hook up the runtime PM ops.
Eric Anholt [Mon, 14 Jan 2019 22:47:57 +0000 (14:47 -0800)]
drm/v3d: Hook up the runtime PM ops.

In translating the runtime PM code from vc4, I missed the ".pm"
assignment to actually connect them up.  Fixes missing MMU setup if
runtime PM resets V3D.

Signed-off-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit ca197699af29baa8236c74c53d4904ca8957ee06)

4 years agodrm/v3d: Skip MMU flush if the device is currently off.
Eric Anholt [Mon, 14 Jan 2019 20:35:43 +0000 (12:35 -0800)]
drm/v3d: Skip MMU flush if the device is currently off.

If it's off, we know it will be reset on poweron, so the MMU won't
have any TLB cached from before this point.  Avoids failed waits for
MMU flush to reply.

Signed-off-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 3ee4e2e0a9e9587eacbb69b067bbc72ab2cdc47b)

4 years agodrm/v3d: Add support for 2711.
Eric Anholt [Fri, 5 Oct 2018 00:22:43 +0000 (17:22 -0700)]
drm/v3d: Add support for 2711.

Signed-off-by: Eric Anholt <eric@anholt.net>
4 years agodrm/vc4: Fix oops at boot with firmwarekms on 4.19.
Eric Anholt [Mon, 4 Mar 2019 19:59:34 +0000 (11:59 -0800)]
drm/vc4: Fix oops at boot with firmwarekms on 4.19.

Signed-off-by: Eric Anholt <eric@anholt.net>
4 years agoarm: bcm2835: Add bcm2838 compatible string.
Phil Elwell [Tue, 11 Jun 2019 16:38:28 +0000 (17:38 +0100)]
arm: bcm2835: Add bcm2838 compatible string.

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