platform/kernel/linux-rpi.git
2 years agomedia: bcm2835-unicam: Driver for CCP2/CSI2 camera interface
Naushir Patuck [Mon, 4 May 2020 09:25:41 +0000 (12:25 +0300)]
media: bcm2835-unicam: Driver for CCP2/CSI2 camera interface

Add a driver for the Unicam camera receiver block on BCM283x processors.
Compared to the bcm2835-camera driver present in staging, this driver
handles the Unicam block only (CSI-2 receiver), and doesn't depend on
the VC4 firmware running on the VPU.

The commit is made up of a series of changes cherry-picked from the
rpi-5.4.y branch of https://github.com/raspberrypi/linux/ with
additional enhancements, forward-ported to the mainline kernel.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reported-by: kbuild test robot <lkp@intel.com>
2 years agodrivers: media: Remove the downstream version of bcm2835-unicam
Dave Stevenson [Tue, 23 Jun 2020 09:05:57 +0000 (10:05 +0100)]
drivers: media: Remove the downstream version of bcm2835-unicam

About to be replaced by the upstream version.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agobrcmfmac: Prefer a ccode from OTP over nvram file
Phil Elwell [Fri, 26 Jun 2020 10:51:05 +0000 (11:51 +0100)]
brcmfmac: Prefer a ccode from OTP over nvram file

Allow the nvram file to set a default ccode (regulatory domain) without
overriding one set in OTP.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agostaging: bcm2835-audio: Add missing MODULE_ALIAS
Maxim Mikityanskiy [Sat, 20 Jun 2020 12:40:00 +0000 (15:40 +0300)]
staging: bcm2835-audio: Add missing MODULE_ALIAS

Commit 8353fe6f1e0f ("Revert "staging: bcm2835-audio: Drop DT
dependency"") reverts the upstream change and makes bcm2835-audio use
device tree again, however, it also removes the MODULE_ALIAS for the
platform device. This MODULE_ALIAS is needed, because VCHIQ registers
bcm2835-audio as a child platform device since commit 25c7597af20d
("staging: vchiq_arm: Register a platform device for audio"), and this
mechanism is adopted also in the downstream kernel.

This commit puts back that MODULE_ALIAS to make bcm2835-audio
autoprobing work again. The rest of VCHIQ children have their
MODULE_ALIASes in place.

Fixes: 8353fe6f1e0f ("Revert "staging: bcm2835-audio: Drop DT dependency"")
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
2 years agomedia: irs1125: Keep HW in sync after imager reset
Markus Proeller [Tue, 16 Jun 2020 11:33:56 +0000 (13:33 +0200)]
media: irs1125: Keep HW in sync after imager reset

When closing the video device, the irs1125 is put in power down state.
To keep V4L2 ctrls and the HW in sync, v4l2_ctrl_handler_setup is
called after power up.

The compound ctrl IRS1125_CID_MOD_PLL however has a default value
of all zeros, which puts the imager into a non responding state.
Thus, this ctrl is not written by the driver into HW after power up.
The userspace has to take care to write senseful data.

Signed-off-by: Markus Proeller <markus.proeller@pieye.org>
2 years agomedia: irs1125: Atomic access to imager reconfiguration
Markus Proeller [Tue, 16 Jun 2020 11:31:36 +0000 (13:31 +0200)]
media: irs1125: Atomic access to imager reconfiguration

Instead of changing the exposure and framerate settings for all sequences,
they can be changed for every sequence individually now. Therefore the
IRS1125_CID_SAFE_RECONFIG ctrl has been removed and replaced by
IRS1125_CID_SAFE_RECONFIG_S<seq_num>_EXPO and *_FRAME ctrls.

The consistency check in the sequence ctrl IRS1125_CID_SEQ_CONFIG
is removed.

Signed-off-by: Markus Proeller <markus.proeller@pieye.org>
2 years agomedia: irs1125: Refactoring and debug messages
Markus Proeller [Tue, 16 Jun 2020 11:27:42 +0000 (13:27 +0200)]
media: irs1125: Refactoring and debug messages

Changed some variable names to comply with checkpatch --strict mode.
Debug messages added.

Signed-off-by: Markus Proeller <markus.proeller@pieye.org>
2 years agomedia: irs1125: Using i2c_transfer for ic2 reads
Markus Proeller [Tue, 16 Jun 2020 11:24:31 +0000 (13:24 +0200)]
media: irs1125: Using i2c_transfer for ic2 reads

Reading data over i2c is done by using i2c_transfer to ensure that this
operation can't be interrupted.

Signed-off-by: Markus Proeller <markus.proeller@pieye.org>
2 years agoPCI: brcmstb: Add DT property to control L1SS
Phil Elwell [Thu, 11 Jun 2020 08:57:03 +0000 (09:57 +0100)]
PCI: brcmstb: Add DT property to control L1SS

The BRCM PCIe block has controls to enable control of the CLKREQ#
signal by the L1SS, and to gate the refclk with the CLKREQ# input.
These controls are mutually exclusive - the upstream code sets the
latter, but some use cases require the former.

Add a Device Tree property - brcm,enable-l1ss - to switch to the
L1SS configuration.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agogpiolib: Don't prevent IRQ usage of output GPIOs
Phil Elwell [Tue, 24 Apr 2018 13:42:27 +0000 (14:42 +0100)]
gpiolib: Don't prevent IRQ usage of output GPIOs

Upstream Linux deems using output GPIOs to generate IRQs as a bogus
use case, even though the BCM2835 GPIO controller is capable of doing
so. A number of users would like to make use of this facility, so
disable the checks.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2 years agosnd_bcm2835: disable HDMI audio when vc4 is used (#3640)
Hristo Venev [Fri, 5 Jun 2020 09:22:49 +0000 (09:22 +0000)]
snd_bcm2835: disable HDMI audio when vc4 is used (#3640)

Things don't work too well when both the vc4 driver and the firmware
driver are trying to control the same audio output:

[  763.569406] bcm2835_audio bcm2835_audio: vchi message timeout, msg=5

Hence, when the vc4 HDMI driver is used, let it control audio. This is done
by introducing a new device tree property to the audio node, and
extending the vc4-kms-v3d overlays to set it appropriately.

Signed-off-by: Hristo Venev <hristo@venev.name>
2 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>
2 years agozswap: Defer zswap initialisation
Phil Elwell [Tue, 5 May 2020 14:23:32 +0000 (15:23 +0100)]
zswap: Defer zswap initialisation

Enabling zswap support in the kernel configuration costs about 1.5MB
of RAM, even when zswap is not enabled at runtime. This cost can be
reduced significantly by deferring initialisation (including pool
creation) until the "enabled" parameter is set to true. There is a
small cost to this in that some initialisation code has to remain in
memory after the init phase, just in case they are needed later,
but the total size increase is negligible.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 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>
2 years agostaging:vc04_services: bcm2835-camera: Request headers with I-frame
Dave Stevenson [Fri, 15 May 2020 12:48:59 +0000 (13:48 +0100)]
staging:vc04_services: bcm2835-camera: Request headers with I-frame

V4L2 wishes to have the codec header bytes in the same buffer as the
first encoded frame, so it does become 1-in 1-out for encoding.
The firmware now has an option to do this, so enable it.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging: vc04_services: mmal-vchiq: Update parameters list
Dave Stevenson [Fri, 15 May 2020 12:42:10 +0000 (13:42 +0100)]
staging: vc04_services: mmal-vchiq: Update parameters list

Adds in a couple of new MMAL parameter defines.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agosc16is7xx: Fix for hardware flow control
Phil Elwell [Wed, 13 May 2020 19:10:15 +0000 (20:10 +0100)]
sc16is7xx: Fix for hardware flow control

The SC16IS7XX hardware flow control is mishandled by the driver in
a number of ways:

  1. The set_baud method accidentally clears it when setting EFR bit.
  2. Even though hardware flow control is enabled, it isn't indicated
     back to the serial framework.
  3. Applying the flow control clears the EFR bit.
  4. The CTS support is not indicated in the return from
     sc16is7xx_get_mctrl.

Address all of those issues using a mixture of patches found on the
linked pages.

See: https://github.com/raspberrypi/linux/issues/2542
See: https://www.spinics.net/lists/linux-serial/msg21794.html

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 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>
2 years agodt-bindings: media: i2c: Add IMX477 CMOS sensor binding
Naushir Patuck [Thu, 7 May 2020 14:50:54 +0000 (15:50 +0100)]
dt-bindings: media: i2c: Add IMX477 CMOS sensor binding

Add YAML device tree binding for IMX477 CMOS image sensor.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 years agovideo: bcm2708_fb: Disable FB if no displays found
Phil Elwell [Tue, 5 May 2020 18:45:41 +0000 (19:45 +0100)]
video: bcm2708_fb: Disable FB if no displays found

If the firmware hasn't detected a display, the driver would assume
one display was available, but because it had failed to retrieve the
display size it would try to allocate a zero-sized buffer.

Avoid the allocation failure by bailing out early if no display is
found.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 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>
2 years agomedia: i2c: tc358743: Fix fallthrough warning
Jacko Dirks [Tue, 5 May 2020 12:28:14 +0000 (14:28 +0200)]
media: i2c: tc358743: Fix fallthrough warning

Signed-off-by: Jacko Dirks <jdirks.linuxdev@gmail.com>
2 years agomedia: bcm2835-unicam: Fix reference counting in unicam_open
Dave Stevenson [Thu, 30 Apr 2020 08:52:50 +0000 (09:52 +0100)]
media: bcm2835-unicam: Fix reference counting in unicam_open

The reference counting of node->open was only incremented after
a check that the node was v4l2_fh_is_singular_file, which resulted
in the counting going wrong and s_power not being called at an
appropriate time.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agomedia: bcm2835-unicam: Do not stop streaming in unicam_release
Dave Stevenson [Wed, 29 Apr 2020 21:05:09 +0000 (22:05 +0100)]
media: bcm2835-unicam: Do not stop streaming in unicam_release

unicam_release calls _vb2_fop_release, which will call stop_streaming
if that particular node was streaming. Calling it unconditionally (as
the code was) means that if a second handle was opened eg to alter
a setting, on closing that connection it also stopped Unicam.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agomedia: bcm2835-unicam: Add support for VIDIOC_[S|G]_SELECTION
Dave Stevenson [Wed, 29 Apr 2020 15:45:02 +0000 (16:45 +0100)]
media: bcm2835-unicam: Add support for VIDIOC_[S|G]_SELECTION

Sensors are now reflecting cropping and scaling parameters through
the selection API, therefore Unicam needs to forward the requests
through to the subdev.

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

BCM2711 has 4 DMA channels with a 40-bit address range, allowing them
to access the full 4GB of memory on a Pi 4.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2 years agostaging: vchiq: Load bcm2835_isp driver from vchiq
Naushir Patuck [Wed, 22 Apr 2020 07:32:32 +0000 (08:32 +0100)]
staging: vchiq: Load bcm2835_isp driver from vchiq

bcmn2835_isp is a platform driver dependent on vchiq,
therefore add the load/unload functions for it to vchiq.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: uapi: v4l-ctrls: Add CID base for the bcm2835-isp driver
Naushir Patuck [Tue, 21 Apr 2020 14:06:19 +0000 (15:06 +0100)]
media: uapi: v4l-ctrls: Add CID base for the bcm2835-isp driver

We are reserving controls for the new bcm2835-isp driver.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: uapi: v4l2-core: Add ISP statistics output V4L2 fourcc type
Naushir Patuck [Thu, 23 Apr 2020 09:20:26 +0000 (10:20 +0100)]
media: uapi: v4l2-core: Add ISP statistics output V4L2 fourcc type

Add V4L2_META_FMT_BCM2835_ISP_STATS V4L2 format type.

This new format will be used by the BCM2835 ISP device to return
out ISP statistics for 3A.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: bcm2835-unicam: Re-fetch mbus code from subdev on a g_fmt call
Naushir Patuck [Tue, 21 Apr 2020 15:26:03 +0000 (16:26 +0100)]
media: bcm2835-unicam: Re-fetch mbus code from subdev on a g_fmt call

The sensor subdevice may change the Bayer order if a H/V flip is
requested after a s_fmt call.  Unicam g_fmt must call the subdev get_fmt
in case this has happened and return out the correct format 4cc.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: bcm2835-unicam: Add support for the FRAME_SYNC event
Laurent Pinchart [Tue, 24 Mar 2020 21:13:02 +0000 (23:13 +0200)]
media: bcm2835-unicam: Add support for the FRAME_SYNC event

The FRAME_SYNC event is useful for userspace image processing algorithms
to program the camera sensor as early as possible after frame start.
Support it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: bcm2835-unicam: Disable event-related ioctls on metadata node
Laurent Pinchart [Tue, 24 Mar 2020 21:13:02 +0000 (23:13 +0200)]
media: bcm2835-unicam: Disable event-related ioctls on metadata node

The unicam driver supports both the SOURCE_CHANGE and CTRL events. Both
events are only generated on the image video node, so the event-related
ioctls are useless on the medatada node. Disable them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: bcm2835-unicam: Use dummy buffer if none have been queued
Naushir Patuck [Thu, 2 Apr 2020 15:08:51 +0000 (16:08 +0100)]
media: bcm2835-unicam: Use dummy buffer if none have been queued

If no buffer has been queued by a userland application, we use an
internal dummy buffer for the hardware to spin in. This will allow
the driver to release the existing userland buffer back to the
application for processing.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: bcm2835-unicam: Add embedded data node.
Naushir Patuck [Thu, 16 Apr 2020 10:35:41 +0000 (11:35 +0100)]
media: bcm2835-unicam: Add embedded data node.

This patch adds a new node in the bcm2835-unicam driver to support
CSI-2 embedded data streams.  The subdevice is queried to see if
embedded data is available from the sensor.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: bcm2835-unicam: Add support for mulitple device nodes.
Naushir Patuck [Tue, 7 Apr 2020 09:42:14 +0000 (10:42 +0100)]
media: bcm2835-unicam: Add support for mulitple device nodes.

Move device node specific state out of the device state structure and
into a new node structure.  This separation will be needed for future
changes where we will add an embedded data node to the driver to work
alongside the existing image data node.

Currently only use a single image node, so this commit does not add
any functional changes.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: uapi: Add MEDIA_BUS_FMT_SENSOR_DATA media bus format
Naushir Patuck [Tue, 21 Jan 2020 14:06:47 +0000 (14:06 +0000)]
media: uapi: Add MEDIA_BUS_FMT_SENSOR_DATA media bus format

This patch adds MEDIA_BUS_FMT_SENSOR_DATA used by the bcm2835-unicam
driver to support CSI-2 embedded data streams from camera sensors.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: uapi: v4l2-core: Add sensor ancillary data V4L2 foucc type.
Naushir Patuck [Wed, 1 Apr 2020 07:46:29 +0000 (08:46 +0100)]
media: uapi: v4l2-core: Add sensor ancillary data V4L2 foucc type.

Add V4L2_META_FMT_SENSOR_DATA format 4CC.

This new format will be used by the BCM2835 Unicam device to return
out camera sensor embedded data.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: bcm2835-unicam: Driver for CCP2/CSI2 camera interface
Naushir Patuck [Wed, 1 Apr 2020 07:39:49 +0000 (08:39 +0100)]
media: bcm2835-unicam: Driver for CCP2/CSI2 camera interface

Add driver for the Unicam camera receiver block on
BCM283x processors.

This commit is made up of a series of changes cherry-picked from the
rpi-4.19.y branch.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 years agodriver: char: rpivid: Don't map more than wanted
Phil Elwell [Tue, 21 Apr 2020 10:30:23 +0000 (11:30 +0100)]
driver: char: rpivid: Don't map more than wanted

Limit mappings to the permitted range, but don't map more than asked
for otherwise we walk off the end of the allocated VMA.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agospi: Force CS_HIGH if GPIO descriptors are used
Phil Elwell [Fri, 17 Apr 2020 09:46:19 +0000 (10:46 +0100)]
spi: Force CS_HIGH if GPIO descriptors are used

Commit f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs")
amended of_spi_parse_dt() to always set SPI_CS_HIGH for SPI slaves whose
Chip Select is defined by a "cs-gpios" devicetree property.

This change breaks drivers whose probe functions set the mode field of
the spi_device because in doing so they clear the SPI_CS_HIGH flag.

Fix by setting SPI_CS_HIGH in spi_setup (under the same conditions as
in of_spi_parse_dt()).

See also: 83b2a8fe43bd ("spi: spidev: Fix CS polarity if GPIO descriptors are used")

Fixes: f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs")
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
SQUASH: spi: Demote SPI_CS_HIGH warning to KERN_DEBUG

This warning is unavoidable from a client's perspective and
doesn't indicate anything wrong (just surprising).

SQUASH with "spi: use_gpio_descriptor fixup moved to spi_setup"

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agodriver: char: rpivid: Remove legacy name support
Phil Elwell [Mon, 20 Apr 2020 21:18:52 +0000 (22:18 +0100)]
driver: char: rpivid: Remove legacy name support

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agodrm: Checking of the pitch is only valid for linear formats
Dave Stevenson [Mon, 27 Jan 2020 10:22:44 +0000 (10:22 +0000)]
drm: Checking of the pitch is only valid for linear formats

framebuffer_check was computing a minimum pitch value and ensuring
that the provided value was greater than this.
That check is only valid if the format is linear.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodt-bindings: display: vc4: hdmi: Add BCM2711 HDMI controllers bindings
Maxime Ripard [Thu, 13 Feb 2020 15:45:24 +0000 (16:45 +0100)]
dt-bindings: display: vc4: hdmi: Add BCM2711 HDMI controllers bindings

The HDMI controllers found in the BCM2711 SoC need some adjustments to the
bindings, especially since the registers have been shuffled around in more
register ranges.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
2 years agodt-bindings: clock: Add a binding for the RPi Firmware clocks
Maxime Ripard [Thu, 13 Feb 2020 16:51:09 +0000 (17:51 +0100)]
dt-bindings: clock: Add a binding for the RPi Firmware clocks

The firmare running on the RPi VideoCore can be used to discover and
change the various clocks running in the BCM2711. Since devices will
need to use them through the DT, let's add a pretty simple binding.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: linux-clk@vger.kernel.org
Cc: devicetree@vger.kernel.org
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
2 years agostaging: media: Add Raspberry Pi V4L2 H265 decoder
John Cox [Thu, 5 Mar 2020 18:30:41 +0000 (18:30 +0000)]
staging: media: Add Raspberry Pi V4L2 H265 decoder

This driver is for the HEVC/H265 decoder block on the Raspberry
Pi 4, and conforms to the V4L2 stateless decoder API.

Signed-off-by: John Cox <jc@kynesim.co.uk>
2 years agomedia: dt-bindings: media: Add binding for the Raspberry PI HEVC decoder
Dave Stevenson [Tue, 17 Mar 2020 10:53:16 +0000 (10:53 +0000)]
media: dt-bindings: media: Add binding for the Raspberry PI HEVC decoder

Adds a binding for the HEVC decoder found on the BCM2711 / Raspberry Pi 4.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agomedia: videodev2.h: Add a format for column YUV4:2:0 modes
Dave Stevenson [Fri, 24 Jan 2020 14:28:21 +0000 (14:28 +0000)]
media: videodev2.h: Add a format for column YUV4:2:0 modes

Some of the Broadcom codec blocks use a column based YUV4:2:0 image
format, so add the documentation and defines for both 8 and 10 bit
versions.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agomedia: uapi: hevc: Add segment address field
Jernej Skrabec [Fri, 13 Dec 2019 16:04:27 +0000 (17:04 +0100)]
media: uapi: hevc: Add segment address field

From https://patchwork.linuxtv.org/patch/60725/
Changes requested, but mainly docs.

If HEVC frame consists of multiple slices, segment address has to be
known in order to properly decode it.

Add segment address field to slice parameters.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
2 years agomedia: uapi: hevc: Add scaling matrix control
Jernej Skrabec [Fri, 13 Dec 2019 16:04:25 +0000 (17:04 +0100)]
media: uapi: hevc: Add scaling matrix control

Taken from https://patchwork.linuxtv.org/patch/60728/
Changes (mainly documentation) have been requested.

HEVC has a scaling matrix concept. Add support for it.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
2 years agodrm/fourcc: Add packed 10bit YUV 4:2:0 format
Dave Stevenson [Fri, 24 Jan 2020 14:22:06 +0000 (14:22 +0000)]
drm/fourcc: Add packed 10bit YUV 4:2:0 format

Adds a format that is 3 10bit YUV 4:2:0 samples packed into
a 32bit work (with 2 spare bits).

Supported on Broadcom BCM2711 chips.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agobcmgenet: Disable skip_umac_reset by default
popcornmix [Wed, 1 Apr 2020 10:22:44 +0000 (11:22 +0100)]
bcmgenet: Disable skip_umac_reset by default

Possible fixed upstream by 'net: bcmgenet: keep MAC in reset until PHY is up'

Signed-off-by: popcornmix <popcornmix@gmail.com>
2 years agodt-bindings: pci: Add DT docs for Brcmstb PCIe device
Jim Quinlan [Mon, 15 Jan 2018 23:28:39 +0000 (18:28 -0500)]
dt-bindings: pci: Add DT docs for Brcmstb PCIe device

The DT bindings description of the Brcmstb PCIe device is described.  This
node can be used by almost all Broadcom settop box chips, using
ARM, ARM64, or MIPS CPU architectures.

Signed-off-by: Jim Quinlan <jim2101024@gmail.com>
2 years agoof: overlay: Correct symbol path fixups
Phil Elwell [Thu, 6 Feb 2020 12:23:15 +0000 (12:23 +0000)]
of: overlay: Correct symbol path fixups

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

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

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agovideo: fbdev: bcm2708_fb: Use common compat header
Phil Elwell [Mon, 2 Mar 2020 14:42:23 +0000 (14:42 +0000)]
video: fbdev: bcm2708_fb: Use common compat header

The definition of compat_ptr is now common for most platforms, but
requires the inclusion of <linux/compat.h>.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agodrivers: char: vcio: Use common compat header
Phil Elwell [Mon, 2 Mar 2020 14:40:19 +0000 (14:40 +0000)]
drivers: char: vcio: Use common compat header

The definition of compat_ptr is now common for most platforms, but
requires the inclusion of <linux/compat.h>.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agopinctrl: bcm2835: Remove gpiochip on error
Phil Elwell [Mon, 6 Jan 2020 16:04:30 +0000 (16:04 +0000)]
pinctrl: bcm2835: Remove gpiochip on error

A failure in gpiochip_irqchip_add leads to a leak of a gpiochip. Fix
the leak with the use of devm_gpiochip_add_data.

Fixes: 85ae9e512f43 ("pinctrl: bcm2835: switch to GPIOLIB_IRQCHIP")
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2 years agostaging: vchiq_arm: Give vchiq children DT nodes
Phil Elwell [Mon, 3 Feb 2020 17:30:46 +0000 (17:30 +0000)]
staging: vchiq_arm: Give vchiq children DT nodes

vchiq kernel clients are now instantiated as platform drivers rather
than using DT, but the children of the vchiq interface may still
benefit from access to DT properties. Give them the option of a
a sub-node of the vchiq parent for configuration and to allow
them to be disabled.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agoInitialise rpi-firmware before clk-bcm2835
Luke Hinds [Wed, 22 Jan 2020 16:03:00 +0000 (16:03 +0000)]
Initialise rpi-firmware before clk-bcm2835

The IMA (Integrity Measurement Architecture) looks for a TPM (Trusted
Platform Module) having been registered when it initialises; otherwise
it assumes there is no TPM. It has been observed on BCM2835 that IMA
is initialised before TPM, and that initialising the BCM2835 clock
driver before the firmware driver has the effect of reversing this
order.

Change the firmware driver to initialise at core_initcall, delaying the
BCM2835 clock driver to postcore_initcall.

See: https://github.com/raspberrypi/linux/issues/3291
     https://github.com/raspberrypi/linux/pull/3297

Signed-off-by: Luke Hinds <lhinds@redhat.com>
Co-authored-by: Phil Elwell <phil@raspberrypi.org>
2 years agoARM: bcm: Backport BCM2711 support from upstream
Stefan Wahren [Fri, 27 Dec 2019 10:40:56 +0000 (11:40 +0100)]
ARM: bcm: Backport BCM2711 support from upstream

Make the BCM2711 a different machine, but keep it in board_bcm2835.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
2 years agostaging: vchiq: Use the old dma controller for OF config on platform devices
Dave Stevenson [Tue, 18 Jun 2019 11:15:50 +0000 (12:15 +0100)]
staging: vchiq: Use the old dma controller for OF config on platform devices

vchiq on Pi4 is no longer under the soc node, therefore it
doesn't get the dma-ranges for the VPU.

Switch to using the configuration of the old dma controller as
that will set the dma-ranges correctly.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agostaging: vchiq_arm: Set up dma ranges on child devices
Dave Stevenson [Tue, 29 Jan 2019 16:13:25 +0000 (16:13 +0000)]
staging: vchiq_arm: Set up dma ranges on child devices

The VCHIQ driver now loads the audio, camera, codec, and vc-sm
drivers as platform drivers. However they were not being given
the correct DMA configuration.

Call of_dma_configure with the parent (VCHIQ) parameters to be
inherited by the child.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agoclk-bcm2835: Disable v3d clock
popcornmix [Tue, 3 Sep 2019 19:28:00 +0000 (20:28 +0100)]
clk-bcm2835: Disable v3d clock

This is controlled by firmware, see clk-raspberrypi.c

Signed-off-by: popcornmix <popcornmix@gmail.com>
2 years agoclk-raspberrypi: Allow cpufreq driver to also adjust gpu clocks
popcornmix [Mon, 9 Sep 2019 14:49:56 +0000 (15:49 +0100)]
clk-raspberrypi: Allow cpufreq driver to also adjust gpu clocks

For performance/power it is beneficial to adjust gpu clocks with arm clock.
This is how the downstream cpufreq driver works

Signed-off-by: popcornmix <popcornmix@gmail.com>
2 years agov3d_gem: Kick the clock so firmware knows we are using firmware clock interface
popcornmix [Thu, 5 Sep 2019 16:59:14 +0000 (17:59 +0100)]
v3d_gem: Kick the clock so firmware knows we are using firmware clock interface

Setting the v3d clock to low value allows firmware to handle dvfs in case
where v3d hardware is not being actively used (e.g. console use).

Signed-off-by: popcornmix <popcornmix@gmail.com>
2 years agov3d_drv: Handle missing clock more gracefully
popcornmix [Fri, 23 Aug 2019 15:34:38 +0000 (16:34 +0100)]
v3d_drv: Handle missing clock more gracefully

Signed-off-by: popcornmix <popcornmix@gmail.com>
2 years agonet:phy:2711 Allow ethernet LED mode to be set via device tree
James Hughes [Thu, 31 Oct 2019 14:39:44 +0000 (14:39 +0000)]
net:phy:2711 Allow ethernet LED mode to be set via device tree

Add device tree entries and code to allow the specification of
the lighting modes for the LED's on the ethernet connector.

Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
net:phy:2711 Change the default ethernet LED actions

This should return default behaviour back to that of previous
releases.

2 years agostaging: vchiq_arm: Register bcm2835-codec as a platform driver
Dave Stevenson [Wed, 6 Nov 2019 13:57:58 +0000 (13:57 +0000)]
staging: vchiq_arm: Register bcm2835-codec as a platform driver

Following the same pattern as bcm2835-camera and bcm2835-audio,
register the V4L2 codec driver as a platform driver

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging: vchiq_arm: Register vcsm-cma as a platform driver
Dave Stevenson [Wed, 6 Nov 2019 13:57:48 +0000 (13:57 +0000)]
staging: vchiq_arm: Register vcsm-cma as a platform driver

Following the same pattern as bcm2835-camera and bcm2835-audio,
register the vcsm-cma driver as a platform driver

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodrm/v3d: Plug dma_fence leak
Phil Elwell [Tue, 12 Nov 2019 16:41:21 +0000 (16:41 +0000)]
drm/v3d: Plug dma_fence leak

The irq_fence and done_fence are given a reference that is never
released. The necessary dma_fence_put()s seem to have been
deleted in error in an earlier commit.

Fixes: 0b73676836b2 ("drm/v3d: Clock V3D down when not in use.")

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2 years agodrm/v3d: Suppress all but the first MMU error
Phil Elwell [Mon, 11 Nov 2019 20:18:08 +0000 (20:18 +0000)]
drm/v3d: Suppress all but the first MMU error

The v3d driver currently encounters a lot of MMU PTE exceptions, so
only log the first to avoid swamping the kernel log.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2 years agomedia: i2c: Add a driver for the Infineon IRS1125 depth sensor
Markus Proeller [Thu, 10 Oct 2019 17:12:36 +0000 (19:12 +0200)]
media: i2c: Add a driver for the Infineon IRS1125 depth sensor

The Infineon IRS1125 is a time of flight depth sensor that
has a CSI-2 interface.

Add a V4L2 subdevice driver for this device.

Signed-off-by: Markus Proeller <markus.proeller@pieye.org>
2 years agodt-bindings: Add binding for the Infineon IRS1125 sensor
Markus Proeller [Thu, 10 Oct 2019 17:12:08 +0000 (19:12 +0200)]
dt-bindings: Add binding for the Infineon IRS1125 sensor

Adds a binding for the Infineon IRS1125 time-of-flight depth
sensor.

Signed-off-by: Markus Proeller <markus.proeller@pieye.org>
2 years agoRename HDMI ALSA device names, check for enable state
James Hughes [Tue, 24 Sep 2019 17:26:55 +0000 (18:26 +0100)]
Rename HDMI ALSA device names, check for enable state

HDMI Alsa devices renamed to match names used by DRM, to
HDMI 1 and HDMI 2

Check for which HDMI devices are connected and only create
devices for those that are present.

The rename of the devices might cause some backwards compatibility
issues, but since this particular part of the driver needs to be
specifically enabled, I suspect the number of people who will see
the problem will be very small.

Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
2 years agoARM: bcm: Switch board, clk and pinctrl to bcm2711 compatible
Stefan Wahren [Thu, 19 Sep 2019 18:45:30 +0000 (20:45 +0200)]
ARM: bcm: Switch board, clk and pinctrl to bcm2711 compatible

After the decision to use bcm2711 compatible for upstream, we should
switch all accepted compatibles to bcm2711. So we can boot with
one DTB the down- and the upstream kernel.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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.

2 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>
2 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>
driver: char: rpivid: Destroy the legacy device on remove

The legacy name support created a new device that was never destroyed.
If the driver was unloaded and reloaded, it failed due to the
device already existing.

Fixes: "75f1d14 driver: char: rpivid - also support legacy name"
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
driver: char: rpivid: Clean up error handling use of ERR_PTR/IS_ERR

The driver used an unnecessary intermediate void* variable so it
only called ERR_PTR once to convert to the error value.

Switch to converting as the error arises to remove these intermediate
variables.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
driver: char: rpivid: Add error handling to the legacy device load

The return value from device_create for the legacy device was never
checked or handled. Add the required error handling.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
driver: char: rpivid: Fix coding style whitespace issues.

Makes checkpatch happier.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
driver: char: rpimem: Add SPDX licence header.

Stops checkpatch complaining.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
driver: char: rpivid: Fix access to freed memory

The error path during probe frees the private memory block, and
then promptly dereferences it to log an error message.

Use the base device instead of the pointer to it in the private
structure.

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

2 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)

2 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>
2 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>
2 years agousbhid: call usb_fixup_endpoint after mangling intervals
Jonathan Bell [Tue, 11 Jun 2019 10:42:03 +0000 (11:42 +0100)]
usbhid: call usb_fixup_endpoint after mangling intervals

Lets the mousepoll override mechanism work with xhci.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
2 years agoxhci: implement xhci_fixup_endpoint for interval adjustments
Jonathan Bell [Tue, 11 Jun 2019 10:33:39 +0000 (11:33 +0100)]
xhci: implement xhci_fixup_endpoint for interval adjustments

Must be called in a non-atomic context, after the endpoint
has been registered with the hardware via xhci_add_endpoint
and before the first URB is submitted for the endpoint.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
2 years agousb: add plumbing for updating interrupt endpoint interval state
Jonathan Bell [Tue, 11 Jun 2019 09:55:00 +0000 (10:55 +0100)]
usb: add plumbing for updating interrupt endpoint interval state

xHCI caches device and endpoint data after the interface is configured,
so an explicit command needs to be issued for any device driver wanting
to alter the polling interval of an endpoint.

Add usb_fixup_endpoint() to allow drivers to do this. The fixup must be
called after calculating endpoint bandwidth requirements but before any
URBs are submitted.

If polling intervals are shortened, any bandwidth reservations are no
longer valid but in practice polling intervals are only ever relaxed.

Limit the scope to interrupt transfers for now.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
2 years agoclk: bcm2835: Allow reparenting leaf clocks while they're running.
Eric Anholt [Thu, 2 May 2019 22:24:04 +0000 (15:24 -0700)]
clk: bcm2835: Allow reparenting leaf clocks while they're running.

This falls under the same "we can reprogram glitch-free as long as we
pause generation" rule as updating the div/frac fields.  This can be
used for runtime reclocking of V3D to manage power leakage.

Signed-off-by: Eric Anholt <eric@anholt.net>
2 years agoclk: bcm2835: Add support for setting leaf clock rates while running.
Eric Anholt [Thu, 2 May 2019 22:11:05 +0000 (15:11 -0700)]
clk: bcm2835: Add support for setting leaf clock rates while running.

As long as you wait for !BUSY, you can do glitch-free updates of clock
rate while the clock is running.

Signed-off-by: Eric Anholt <eric@anholt.net>
2 years agosoc: bcm: bcm2835-pm: Add support for 2711.
Eric Anholt [Sat, 12 Jan 2019 01:31:07 +0000 (17:31 -0800)]
soc: bcm: bcm2835-pm: Add support for 2711.

Without the actual power management part any more, there's a lot less
to set up for V3D.  We just need to clear the RSTN field for the power
domain, and expose the reset controller for toggling it again.

This is definitely incomplete -- the old ISP and H264 is in the old
bridge, but since we have no consumers of it I've just done the
minimum to get V3D working.

Signed-off-by: Eric Anholt <eric@anholt.net>