platform/kernel/linux-rpi.git
4 years agomedia: i2c: imx219: Fix a bug in imx219_enum_frame_size
Dafna Hirschfeld [Tue, 31 Mar 2020 18:06:30 +0000 (20:06 +0200)]
media: i2c: imx219: Fix a bug in imx219_enum_frame_size

https://patchwork.linuxtv.org/patch/62740/

When enumerating the frame sizes, the value sent to
imx219_get_format_code should be fse->code
(the code from the ioctl) and not imx219->fmt.code
which is the code set currently in the driver.

Fixes: 22da1d56e ("media: i2c: imx219: Add support for RAW8 bit bayer format")

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Helen Koike <helen.koike@collabora.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
4 years agomedia: i2c: imx219: Add support for cropped 640x480 resolution
Lad Prabhakar [Tue, 10 Mar 2020 13:17:09 +0000 (14:17 +0100)]
media: i2c: imx219: Add support for cropped 640x480 resolution

Commit 25130b8ad409d5532f3763bcf891af74f550a70d upstream.

This patch adds mode table entry for capturing cropped 640x480 resolution

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Acked-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: imx219: Add support for RAW8 bit bayer format
Lad Prabhakar [Tue, 10 Mar 2020 13:17:08 +0000 (14:17 +0100)]
media: i2c: imx219: Add support for RAW8 bit bayer format

Commit 22da1d56e982151e0bdfafe9de6fe94098a51356 upstream.

IMX219 sensor is capable for RAW8/RAW10 modes. This commit adds support
for RAW8 bayer format.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: imx219: Fix power sequence
Lad Prabhakar [Tue, 10 Mar 2020 13:17:07 +0000 (14:17 +0100)]
media: i2c: imx219: Fix power sequence

Commit ca45448a56659c6df6e0436188e97f6cc65dea8a upstream.

When supporting Rpi Camera v2 Module on the RZ/G2E, found the driver had
some issues with rcar mipi-csi driver. The sensor never entered into LP-11
state.

The powerup sequence in the datasheet[1] shows the sensor entering into
LP-11 in streaming mode, so to fix this issue transitions are performed
from "streaming -> standby" in the probe() after power up.

With this commit the sensor is able to enter LP-11 mode during power up,
as expected by some CSI-2 controllers.

[1] https://publiclab.org/system/images/photos/000/023/294/original/
RASPBERRY_PI_CAMERA_V2_DATASHEET_IMX219PQH5_7.0.0_Datasheet_XXX.PDF

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Acked-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 years agodefconfig: Add bcm2835-unicam to platform defconfigs.
Naushir Patuck [Wed, 1 Apr 2020 07:46:29 +0000 (08:46 +0100)]
defconfig: Add bcm2835-unicam to platform defconfigs.

This commit enables the bcm2835-unicam driver in the following
defconfigs:

bcm2709_defconfig
bcm2711_defconfig
bcmrpi_defconfig

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
4 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>
4 years agomedia: v4l2-dev: Add v4l2_device_register_ro_subdev_node()
Jacopo Mondi [Tue, 7 Apr 2020 15:21:57 +0000 (17:21 +0200)]
media: v4l2-dev: Add v4l2_device_register_ro_subdev_node()

Add to the V4L2 core a function to register device nodes for video
subdevices in read-only mode.

Registering a device node in read-only mode is useful to expose to
userspace the current sub-device configuration, without allowing
application to change it by using the V4L2 subdevice ioctls.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
4 years agoDocumentation: media: Document read-only subdevice
Jacopo Mondi [Tue, 7 Apr 2020 15:21:56 +0000 (17:21 +0200)]
Documentation: media: Document read-only subdevice

Document a new kAPI function to register subdev device nodes in read only
mode and for each affected ioctl report how access is restricted.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
4 years agoDocumentation: media: Update sub-device API intro
Jacopo Mondi [Tue, 7 Apr 2020 15:21:55 +0000 (17:21 +0200)]
Documentation: media: Update sub-device API intro

Update the V4L2 sub-device userspace API introduction to provide more
details on why complex devices might want to register devnodes for the
connected subdevices.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
4 years agoFixes a problem with clock settings of HiFiBerry DAC+ADC PRO (#3545)
Jörg Schambacher [Wed, 15 Apr 2020 09:48:29 +0000 (11:48 +0200)]
Fixes a problem with clock settings of HiFiBerry DAC+ADC PRO (#3545)

This patch fixes a problem of the re-calculation of
i2s-clock and -parameter settings when only the ADC is activated.

Signed-off-by: Joerg Schambacher <joerg@i2audio.com>
4 years agodrm/vc4: hdmi: Silence pixel clock error on -EPROBE_DEFER
James Hilliard [Sat, 11 Apr 2020 01:24:40 +0000 (19:24 -0600)]
drm/vc4: hdmi: Silence pixel clock error on -EPROBE_DEFER

If the vc4 hdmi driver loads before the pixel clock is available we
see a spurious "*ERROR* Failed to get pixel clock" error.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
4 years agodts: bcm2711: Move emmc2 to its own "bus"
Phil Elwell [Thu, 5 Dec 2019 18:02:08 +0000 (18:02 +0000)]
dts: bcm2711: Move emmc2 to its own "bus"

Moving the EMMC2 controller under a dedicated bus allows the firmware
to patch the dma-ranges property for different memory sizes without
affecting anything else.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agoARM: dts: Extend SCB bus address range
Phil Elwell [Tue, 4 Feb 2020 12:51:56 +0000 (12:51 +0000)]
ARM: dts: Extend SCB bus address range

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agoconfigs: Restore CONFIG_GPIO_SYSFS
Phil Elwell [Thu, 27 Feb 2020 12:00:42 +0000 (12:00 +0000)]
configs: Restore CONFIG_GPIO_SYSFS

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agoARM: dts: bcm2711: Restrict CMA to first 768MB
Phil Elwell [Tue, 14 Apr 2020 14:25:02 +0000 (15:25 +0100)]
ARM: dts: bcm2711: Restrict CMA to first 768MB

The downstream 32-bit 2711 kernel configuration enables HIGHMEM for
access to more physical RAM. The HIGHMEM zone starts at 0x30000000
(768MB), and allowing the CMA zone to overlap that area causes a
failure during CMA activation.

Avoid the overlap by limiting CMA to the first 768MB. This is overly
restrictive on a 64-bit kernel, but shouldn't cause any practical
problems.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agoARM: dts: bcm283x: Fix vc4's firmware bus DMA limitations
Nicolas Saenz Julienne [Thu, 19 Mar 2020 19:00:13 +0000 (20:00 +0100)]
ARM: dts: bcm283x: Fix vc4's firmware bus DMA limitations

The bus is virtual and devices have to inherit their DMA constraints
from the underlying interconnect. So add an empty dma-ranges property to
the bus node, implying the firmware bus' DMA constraints are identical to
its parent's.

Fixes: 7dbe8c62ceeb ("ARM: dts: Add minimal Raspberry Pi 4 support")
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
4 years agoARM: dts: overlays: Unify overlay CMA handling
Nicolas Saenz Julienne [Thu, 2 Apr 2020 17:54:33 +0000 (19:54 +0200)]
ARM: dts: overlays: Unify overlay CMA handling

Now that we don't have to abuse the kernel command line to change CMA's
size we can clean-up and centralize CMA usage in overlays.

A new file, cma-overlay.dts is created to be used as a standalone
overlay or included on other overlays. All CMA users are converted to
this scheme. Ultimately upstream-overlay.dts is also updated to use the
default CMA size provided by upstream.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
4 years agoARM: dts: Use upstream CMA configuration
Nicolas Saenz Julienne [Thu, 2 Apr 2020 17:22:46 +0000 (19:22 +0200)]
ARM: dts: Use upstream CMA configuration

Now that the kernel command line has precedence over the device tree,
we can use the upstream CMA setup without breaking backward
compatibility.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
4 years agodma-contiguous: CMA: give precedence to cmdline
Nicolas Saenz Julienne [Fri, 10 Jan 2020 17:19:33 +0000 (18:19 +0100)]
dma-contiguous: CMA: give precedence to cmdline

commit 8c8c5a4994a306c217fd061cbfc5903399fd4c1c upstream.

Although the device tree might contain a reserved-memory DT node
dedicated as the default CMA pool, users might want to change CMA's
parameters using the kernel command line for debugging purposes and
whatnot. Honor this by bypassing the reserved memory CMA setup, which
will ultimately end up freeing the memblock and allow the command line
CMA configuration routine to run.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Phil Elwell <phil@raspberrypi.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
4 years agoARM: dts: bcm283x: Unify CMA configuration
Nicolas Saenz Julienne [Fri, 10 Jan 2020 17:29:35 +0000 (18:29 +0100)]
ARM: dts: bcm283x: Unify CMA configuration

commit c5a1e5375d19bd4001c59dc5d482ac5b1ba51cbf upstream.

With the introduction of the Raspberry Pi 4 we were forced to explicitly
configure CMA's location, since arm64 defaults it into the ZONE_DMA32
memory area, which is not good enough to perform DMA operations on that
device. To bypass this limitation a dedicated CMA DT node was created,
explicitly indicating the acceptable memory range and size.

That said, compatibility between boards is a must on the Raspberry Pi
ecosystem so this creates a common CMA DT node so as for DT overlays to
be able to update CMA's properties regardless of the board being used.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Phil Elwell <phil@raspberrypi.org>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
4 years agoarm64: mm: Fix initialisation of DMA zones on non-NUMA systems
Will Deacon [Tue, 3 Dec 2019 12:10:13 +0000 (12:10 +0000)]
arm64: mm: Fix initialisation of DMA zones on non-NUMA systems

commit 93b90414c33f59b7960bc8d607da0ce83377e021 upstream.

John reports that the recently merged commit 1a8e1cef7603 ("arm64: use
both ZONE_DMA and ZONE_DMA32") breaks the boot on his DB845C board:

  | Booting Linux on physical CPU 0x0000000000 [0x517f803c]
  | Linux version 5.4.0-mainline-10675-g957a03b9e38f
  | Machine model: Thundercomm Dragonboard 845c
  | [...]
  | Built 1 zonelists, mobility grouping on.  Total pages: -188245
  | Kernel command line: earlycon
  | firmware_class.path=/vendor/firmware/ androidboot.hardware=db845c
  | init=/init androidboot.boot_devices=soc/1d84000.ufshc
  | printk.devkmsg=on buildvariant=userdebug root=/dev/sda2
  | androidboot.bootdevice=1d84000.ufshc androidboot.serialno=c4e1189c
  | androidboot.baseband=sda
  | msm_drm.dsi_display0=dsi_lt9611_1080_video_display:
  | androidboot.slot_suffix=_a skip_initramfs rootwait ro init=/init
  |
  | <hangs indefinitely here>

This is because, when CONFIG_NUMA=n, zone_sizes_init() fails to handle
memblocks that fall entirely within the ZONE_DMA region and erroneously ends up
trying to add a negatively-sized region into the following ZONE_DMA32, which is
later interpreted as a large unsigned region by the core MM code.

Rework the non-NUMA implementation of zone_sizes_init() so that the start
address of the memblock being processed is adjusted according to the end of the
previous zone, which is then range-checked before updating the hole information
of subsequent zones.

Cc: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/lkml/CALAqxLVVcsmFrDKLRGRq7GewcW405yTOxG=KR3csVzQ6bXutkA@mail.gmail.com
Fixes: 1a8e1cef7603 ("arm64: use both ZONE_DMA and ZONE_DMA32")
Reported-by: John Stultz <john.stultz@linaro.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
4 years agoarm64: mm: reserve CMA and crashkernel in ZONE_DMA32
Nicolas Saenz Julienne [Thu, 7 Nov 2019 09:56:11 +0000 (10:56 +0100)]
arm64: mm: reserve CMA and crashkernel in ZONE_DMA32

commit bff3b04460a80f425442fe8e5c6ee8c3ebef611f upstream.

With the introduction of ZONE_DMA in arm64 we moved the default CMA and
crashkernel reservation into that area. This caused a regression on big
machines that need big CMA and crashkernel reservations. Note that
ZONE_DMA is only 1GB big.

Restore the previous behavior as the wide majority of devices are OK
with reserving these in ZONE_DMA32. The ones that need them in ZONE_DMA
will configure it explicitly.

Fixes: 1a8e1cef7603 ("arm64: use both ZONE_DMA and ZONE_DMA32")
Reported-by: Qian Cai <cai@lca.pw>
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
4 years agoASoC: ma120x0p: Add 96KHz rate support
AMuszkat [Wed, 8 Apr 2020 08:04:49 +0000 (10:04 +0200)]
ASoC: ma120x0p: Add 96KHz rate support

Add 96KHz rate support to MA120X0P codec and make enable and mute gpio
pins optional.

Signed-off-by: AMuszkat <ariel.muszkat@gmail.com>
4 years agoconfigs: add MA120X0P codec
AMuszkat [Wed, 8 Apr 2020 07:31:39 +0000 (09:31 +0200)]
configs: add MA120X0P codec

Signed-off-by: AMuszkat <ariel.muszkat@gmail.com>
4 years agokbuild: Disable gcc plugins
Phil Elwell [Wed, 8 Apr 2020 14:23:56 +0000 (15:23 +0100)]
kbuild: Disable gcc plugins

The GCC plugin feature leads to different kernel configurations on what
ought to be equivalent build systems because they depend on the build
hosts native compilers rather than the cross compilers needed for the
target. This causes problems with module symbol version mismatches.

Disable GCC plugins for all build hosts.

Advanced build script hackery borrowed from a patch by milhouse.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agooverlays: Fix dtc warnings in i2c-gpio
Phil Elwell [Wed, 8 Apr 2020 10:59:39 +0000 (11:59 +0100)]
overlays: Fix dtc warnings in i2c-gpio

Better late than never.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agoAdd support for the AudioInjector.net Isolated sound card
Matt Flax [Wed, 8 Apr 2020 10:00:30 +0000 (20:00 +1000)]
Add support for the AudioInjector.net Isolated sound card

This patch adds support for the Audio Injector Isolated sound card.

Signed-off-by: Matt Flax <flatmax@flatmax.org>
4 years agoconfigs: FS_ENCRYPTION replaces EXT4_ENCRYPTION
Phil Elwell [Wed, 8 Apr 2020 08:48:29 +0000 (09:48 +0100)]
configs: FS_ENCRYPTION replaces EXT4_ENCRYPTION

The filesystem-specific encryption options have been replaced by a
generic FS_ENCRYPTION option.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 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>
4 years agoAdd upstream and upstream-pi4 to overlay_map
Phil Elwell [Mon, 6 Apr 2020 08:47:42 +0000 (09:47 +0100)]
Add upstream and upstream-pi4 to overlay_map

Because the upstream overlay applies vc4-kms-v3d, of which Pi 4 has its
own version, there also needs to be a Pi 4 version - vc4-kms-v3d-pi4.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agooverlays: Add vc4-kms-v3d-pi4 to overlay_map
Phil Elwell [Wed, 1 Apr 2020 14:51:56 +0000 (15:51 +0100)]
overlays: Add vc4-kms-v3d-pi4 to overlay_map

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agooverlays: Formally rename/deprecate old overlays
Phil Elwell [Wed, 1 Apr 2020 16:24:15 +0000 (17:24 +0100)]
overlays: Formally rename/deprecate old overlays

Take advantage of the overlay_map to rename or deprecate some obsolete
overlays.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agooverlays: Add overlay_map
Phil Elwell [Wed, 1 Apr 2020 14:09:42 +0000 (15:09 +0100)]
overlays: Add overlay_map

The overlay map permits platform-specific overlays, with deprecation
and renaming.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agovc4_hdmi_phy: Fix offset calculation
popcornmix [Thu, 2 Apr 2020 15:46:31 +0000 (16:46 +0100)]
vc4_hdmi_phy: Fix offset calculation

The original firmware code worked with float and did
   offset = ((vco_freq / fref * 2) * (1 << 22));
   offset >>= 2;

In this code it's all integer so doing the integer divide before the shift loses lots of precision

This fixes the issue of 1080p59.94 mode having 59.64 fps

Signed-off-by: popcornmix <popcornmix@gmail.com>
4 years agooverlays: Add missing rpi-poe parameters
Phil Elwell [Fri, 27 Mar 2020 13:49:25 +0000 (13:49 +0000)]
overlays: Add missing rpi-poe parameters

The rpi-poe fan overlay has gained two more fan speeds and adjusted
the thresholds and hystereses.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agodt: Drop I2C for Pi4 HDMI interfaces to 97.5kHz.
Dave Stevenson [Tue, 31 Mar 2020 16:54:08 +0000 (17:54 +0100)]
dt: Drop I2C for Pi4 HDMI interfaces to 97.5kHz.

It was set to 390kHz, which is outside of the required spec for
reading HDMI (max 100kHz). The i2c-brcmstb driver only supports
a number of fixed bus speeds, of which 97.5kHz is the closest to
100kHz without exceeding it.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agoi2c: brcmstb: The interrupt line is optional, so use platform_get_irq_optional
Dave Stevenson [Tue, 31 Mar 2020 15:23:11 +0000 (16:23 +0100)]
i2c: brcmstb: The interrupt line is optional, so use platform_get_irq_optional

If there is no interrupt defined then an error is logged due
to the use of platform_get_irq. The driver handles not having
the interrupt by falling back to polling, therefore make
the appropriate call when claiming it.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodrm/vc4-hdmi: Give the HDMI audio instances different names
Dave Stevenson [Tue, 31 Mar 2020 15:21:45 +0000 (16:21 +0100)]
drm/vc4-hdmi: Give the HDMI audio instances different names

The debugfs usage within asoc gets confused if multiple interfaces
have the same card name, therefore use unique names when
initialising them.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodrm/vc4: Fixup plane init within firmware-kms
Dave Stevenson [Mon, 30 Mar 2020 17:25:10 +0000 (18:25 +0100)]
drm/vc4: Fixup plane init within firmware-kms

"drm/vc4: plane: Move additional planes creation to driver" moved
overlay and cursor plane creation to a global function thata was
unconditionally run, when it is not wanted in firmware KMS mode.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodrm/vc4: Fixup for firmware KMS
Dave Stevenson [Mon, 30 Mar 2020 11:52:26 +0000 (12:52 +0100)]
drm/vc4: Fixup for firmware KMS

Fix up "drm/vc4: Kick the core clock up during a mode change" for
firmware KMS mode where we don't have the HVS or core clock
configured.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodrm/vc4: Kick the core clock up during a mode change
Dave Stevenson [Thu, 26 Mar 2020 15:32:19 +0000 (15:32 +0000)]
drm/vc4: Kick the core clock up during a mode change

Experimental commit to kick the core clock up during mode
switching. This makes mode switching far more reliable, and
mimics what the firmware does.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodtoverlays: Remove comment about vc4-kms-v3d locking up X from README
Dave Stevenson [Thu, 26 Mar 2020 11:51:55 +0000 (11:51 +0000)]
dtoverlays: Remove comment about vc4-kms-v3d locking up X from README

Using vc4-kms-v3d with X has worked for quite a while, and essentially
required not using fbturbo and having an up to date MESA library.
Remove the comment that says otherwise.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodrm/vc4: Alter the HDMI state machine clock calc to allow for 1920x1200
Dave Stevenson [Wed, 25 Mar 2020 18:22:40 +0000 (18:22 +0000)]
drm/vc4: Alter the HDMI state machine clock calc to allow for 1920x1200

Whilst the documentation for BCM2835 states that the HDMI state machine
clock needs to be 108% of the pixel clock, other documentation says
that it only has to be greater than the pixel clock. The firmware
uses 101%, and that allows 1920x1200@60Hz to work within the
constraint of the HSM clock being < 163.68MHz.

Adopt 101%, and increase the maximum pixel clock for vc4 to 162MHz
so that it too supports 1920x1200@60.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodrm/vc4: Enable audio on Pi4.
Dave Stevenson [Wed, 25 Mar 2020 18:18:45 +0000 (18:18 +0000)]
drm/vc4: Enable audio on Pi4.

This could be a revert of "drm/vc4: hdmi: Add an audio support flag"
as it is no longer needed.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodrm/vc4: Add audio initialisation for Pi4.
Dave Stevenson [Wed, 25 Mar 2020 18:16:14 +0000 (18:16 +0000)]
drm/vc4: Add audio initialisation for Pi4.

The audio configuration has changed for Pi4, so support the
configuration functions via the variant tables.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodrm/vc4: Use reg-names to configure HDMI audio.
Dave Stevenson [Wed, 25 Mar 2020 18:11:41 +0000 (18:11 +0000)]
drm/vc4: Use reg-names to configure HDMI audio.

HDMI audio configuration was using fixed index numbers to
load in DT register settings.
Switch to using reg-names for flexibility and to match Pi4.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodt: Add HDMI audio dma values to bcm2711.dtsi
Dave Stevenson [Wed, 25 Mar 2020 18:08:39 +0000 (18:08 +0000)]
dt: Add HDMI audio dma values to bcm2711.dtsi

Adds the relevant DMA settings for HDMI audio to work.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodts: Add reg-names for the HDMI registers on bcm2835
Dave Stevenson [Wed, 25 Mar 2020 18:07:19 +0000 (18:07 +0000)]
dts: Add reg-names for the HDMI registers on bcm2835

Pi4 is requiring many more register configs in the HDMI
block, and has switched to using reg-names instead of fixed index
values.

Switch bc2835-common to match.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodrm/vc4: Set the b-frame marker to the match ALSA's default.
Dave Stevenson [Wed, 25 Mar 2020 18:03:42 +0000 (18:03 +0000)]
drm/vc4: Set the b-frame marker to the match ALSA's default.

ALSA's iec958 plugin by default sets the block start preamble
to 8, whilst this driver was programming the hardware to expect
0xF.
Amend the hardware config to match ALSA.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodrm/vc4: Reset audio infoframe on encoder_enable if previously streaming
Dave Stevenson [Wed, 25 Mar 2020 18:01:04 +0000 (18:01 +0000)]
drm/vc4: Reset audio infoframe on encoder_enable if previously streaming

If the encoder is disabled and re-enabled (eg mode change) all infoframes
are reset, whilst the audio subsystem know nothing about this change.
The driver therefore needs to reinstate the audio infoframe for
itself.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodt: Update v3d to use firmware_clocks.
Dave Stevenson [Mon, 17 Feb 2020 11:37:21 +0000 (11:37 +0000)]
dt: Update v3d to use firmware_clocks.

Use the updated DT clock-names property to map the v3d clock
to the firmware_clocks driver, instead of the older clkdev API.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodrm/vc4: The check for assigned HVS channels is not applicable firmware_kms
Dave Stevenson [Tue, 11 Feb 2020 15:36:59 +0000 (15:36 +0000)]
drm/vc4: The check for assigned HVS channels is not applicable firmware_kms

Channel assignments is only in full KMS, so skip the check
if in firmware kms mode.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agoFixup P030 support
Dave Stevenson [Tue, 25 Feb 2020 17:35:10 +0000 (17:35 +0000)]
Fixup P030 support

I got the logic wrong for enabling pixel formats, resulting in
Pi0-3 only getting a single, invalid, format (P030 SAND).

Fixes: e07ef1d drm/vc4: Add support for DRM_FORMAT_P030 to vc4 planes

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 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>
4 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>
4 years agodtoverlays: Add Pi4 version of vc4-kms-v3d
Dave Stevenson [Fri, 20 Sep 2019 16:20:01 +0000 (17:20 +0100)]
dtoverlays: Add Pi4 version of vc4-kms-v3d

The Pi4 version of the KMS drivers is a work in progress, some
blocks need alternate configuration, and some blocks currently
need to remain disabled (eg the VEC).

Add a new overlay (vc4-kms-v3d-pi4) that loads the parts of
vc4-kms that do work on Pi4.
This has been tested with DPI and HDMI (not 100% reliable on mode
switching)

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years ago[DOWNSTREAM] ARM: dts: rpi4: Disable KMS driver by default
Maxime Ripard [Fri, 21 Feb 2020 16:10:45 +0000 (17:10 +0100)]
[DOWNSTREAM] ARM: dts: rpi4: Disable KMS driver by default

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoARM: dts: bcm2711: Enable the display pipeline
Maxime Ripard [Wed, 12 Feb 2020 11:26:40 +0000 (12:26 +0100)]
ARM: dts: bcm2711: Enable the display pipeline

Now that all the drivers have been adjusted for it, let's bring in the
necessary device tree changes.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 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>
4 years agodrm/vc4: hdmi: Support the BCM2711 HDMI controllers
Maxime Ripard [Tue, 17 Dec 2019 10:48:37 +0000 (11:48 +0100)]
drm/vc4: hdmi: Support the BCM2711 HDMI controllers

Now that the driver is ready for it, let's bring in the HDMI controllers
variants for the BCM2711.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Adjust HSM clock rate depending on pixel rate
Maxime Ripard [Mon, 10 Feb 2020 14:23:06 +0000 (15:23 +0100)]
drm/vc4: hdmi: Adjust HSM clock rate depending on pixel rate

The HSM clock needs to be setup at around 110% of the pixel rate. This
was done previously by setting the clock rate to 148.5MHz * 108% at
probe time and only check in mode_valid whether the mode pixel clock was
under 148.5MHz or not.

However, with 4k we need to change that frequency to a higher frequency
than 148.5MHz.

Let's change that logic a bit by setting the clock rate of the HSM clock
to the pixel rate at encoder_enable time. This would work for the
BCM2711 that support 4k resolutions and has a clock that can provide it,
but we still have to take care of a 4k panel plugged on a BCM283x SoCs
that wouldn't be able to use those modes, so let's define the limit in
the variant.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Rename drm_encoder pointer in mode_valid
Maxime Ripard [Thu, 13 Feb 2020 11:31:09 +0000 (12:31 +0100)]
drm/vc4: hdmi: Rename drm_encoder pointer in mode_valid

The mode_valid hook on the encoder uses a pointer to a drm_encoder called
crtc, which is pretty confusing. Let's rename it to encoder to make it
clear what it is.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Remove unused CEC_CLOCK_DIV define
Maxime Ripard [Mon, 10 Feb 2020 14:15:47 +0000 (15:15 +0100)]
drm/vc4: hdmi: Remove unused CEC_CLOCK_DIV define

The CEC_CLOCK_DIV define is not used anywhere in the driver, let's remove
it.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Add CEC support flag
Maxime Ripard [Thu, 6 Feb 2020 15:22:50 +0000 (16:22 +0100)]
drm/vc4: hdmi: Add CEC support flag

Similarly to the audio support, CEC support is not there yet for the
BCM2711, so let's skip entirely the CEC initialization through a variant
flag.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Move CEC init to its own function
Maxime Ripard [Thu, 6 Feb 2020 15:22:13 +0000 (16:22 +0100)]
drm/vc4: hdmi: Move CEC init to its own function

The CEC init code was put directly into the bind function, which was quite
inconsistent with how the audio support was done, and would prevent us from
further changes to skip that initialisation entirely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Add an audio support flag
Maxime Ripard [Thu, 6 Feb 2020 15:21:45 +0000 (16:21 +0100)]
drm/vc4: hdmi: Add an audio support flag

The BCM2711 audio support doesn't work yet, so let's add a boolean to
indicate whether or not it's supported, and only register a sound card if
that boolean is set.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Deal with multiple debugfs files
Maxime Ripard [Thu, 16 Jan 2020 13:27:56 +0000 (14:27 +0100)]
drm/vc4: hdmi: Deal with multiple debugfs files

The HDMI driver was registering a single debugfs file so far with the name
hdmi_regs.

Obviously, this is not going to work anymore when will have multiple HDMI
controllers since we will end up trying to register two files with the same
name.

Let's use the ID to avoid that name conflict.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Add HDMI ID
Maxime Ripard [Tue, 7 Jan 2020 12:14:07 +0000 (13:14 +0100)]
drm/vc4: hdmi: Add HDMI ID

Some operations will need us to have the raw ID of the HDMI controller
in the BCM2711, such as the encoder type to register, the name of the
debugfs files, etc.

Let's add it to our variant structure.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Add a set_timings callback
Maxime Ripard [Mon, 6 Jan 2020 12:43:27 +0000 (13:43 +0100)]
drm/vc4: hdmi: Add a set_timings callback

Similarly to the previous patches, the timings setup in the HDMI controller
of the BCM2711 is slightly different, mostly because it supports higher
resolutions and thus needed more spaces for the various timings, resulting
in the register layout changing.

Let's add a callback for that as well.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Add a CSC setup callback
Maxime Ripard [Thu, 26 Dec 2019 17:41:53 +0000 (18:41 +0100)]
drm/vc4: hdmi: Add a CSC setup callback

Similarly to the previous patches, the CSC setup is slightly different in
the BCM2711 than in the previous generations. Let's add a callback for it.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Add PHY RNG enable / disable function
Maxime Ripard [Thu, 19 Dec 2019 16:22:24 +0000 (17:22 +0100)]
drm/vc4: hdmi: Add PHY RNG enable / disable function

Let's continue the implementation of hooks for the parts that change in the
BCM2711 SoC with the PHY RNG setup.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Add PHY init and disable function
Maxime Ripard [Thu, 19 Dec 2019 15:53:33 +0000 (16:53 +0100)]
drm/vc4: hdmi: Add PHY init and disable function

The HDMI PHY in the BCM2711 HDMI controller is significantly more
complicated to setup than in the older BCM283x SoCs.

Let's add hooks to enable and disable the PHY.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Add reset callback
Maxime Ripard [Thu, 19 Dec 2019 15:25:26 +0000 (16:25 +0100)]
drm/vc4: hdmi: Add reset callback

The BCM2711 and BCM283x HDMI controllers use a slightly different reset
sequence, so let's add a callback to reset the controller.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Implement a register layout abstraction
Maxime Ripard [Wed, 18 Dec 2019 18:15:08 +0000 (19:15 +0100)]
drm/vc4: hdmi: Implement a register layout abstraction

The HDMI controllers found in the BCM2711 have most of the registers
reorganized in multiple registers areas and at different offsets than
previously found.

The logic however remains pretty much the same, so it doesn't really make
sense to create a whole new driver and we should share the code as much as
possible.

Let's implement some indirection to wrap around a register and depending on
the variant will lookup the associated register on that particular variant.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Introduce resource init and variant
Maxime Ripard [Wed, 18 Dec 2019 10:30:54 +0000 (11:30 +0100)]
drm/vc4: hdmi: Introduce resource init and variant

The HDMI controllers found in the BCM2711 has a pretty different clock and
registers areas than found in the older BCM283x SoCs.

Let's create a variant structure to store the various adjustments we'll
need later on, and a function to get the resources needed for one
particular version.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Remove vc4_hdmi_connector
Maxime Ripard [Mon, 6 Jan 2020 17:57:16 +0000 (18:57 +0100)]
drm/vc4: hdmi: Remove vc4_hdmi_connector

The vc4_hdmi_connector was only used to switch between drm_connector to
drm_encoder. However, we can now use vc4_hdmi to do the switch, so that
structure is redundant.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Remove vc4_dev hdmi pointer
Maxime Ripard [Mon, 6 Jan 2020 17:49:11 +0000 (18:49 +0100)]
drm/vc4: hdmi: Remove vc4_dev hdmi pointer

Now that we don't have any users anymore, we can kill that pointer.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Pass vc4_hdmi to CEC code
Maxime Ripard [Mon, 6 Jan 2020 17:47:53 +0000 (18:47 +0100)]
drm/vc4: hdmi: Pass vc4_hdmi to CEC code

Our CEC code also retrieves the associated vc4_hdmi by setting the
vc4_dev pointer as its private data, and then dereferences its vc4_hdmi
pointer.

In order to eventually get rid of that pointer, we can simply pass the
vc4_hdmi pointer directly.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Add container_of macros for encoders and connectors
Maxime Ripard [Mon, 6 Jan 2020 17:45:46 +0000 (18:45 +0100)]
drm/vc4: hdmi: Add container_of macros for encoders and connectors

Whenever the code needs to access the vc4_hdmi structure from a DRM
connector or encoder, it first accesses the drm_device associated to the
connector, then retrieve the drm_dev private data which gives it a
pointer to our vc4_dev, and will finally follow the vc4_hdmi pointer in
that structure.

That will also give us some trouble when having multiple controllers,
but now that we have our encoder and connector structures that are part
of vc4_hdmi, we can simply call container_of on the DRM connector or
encoder and retrieve the vc4_hdmi structure directly.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Use local vc4_hdmi directly
Maxime Ripard [Mon, 6 Jan 2020 17:44:36 +0000 (18:44 +0100)]
drm/vc4: hdmi: Use local vc4_hdmi directly

The function vc4_hdmi_connector_detect access its vc4_hdmi struct by
dereferencing the pointer in the structure vc4_dev. This will cause some
issues when we will have multiple HDMI controllers, so let's just use the
local variable for now instead of dereferencing that pointer all the time,
and we'll fix the local variable later.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Move accessors to vc4_hdmi
Maxime Ripard [Mon, 6 Jan 2020 17:21:44 +0000 (18:21 +0100)]
drm/vc4: hdmi: Move accessors to vc4_hdmi

The current driver only supports a single HDMI controller, and part of
the issue is that the main vc4_dev structure holds a pointer to its
(only) HDMI controller, and the HDMI registers accessors will use it to
retrieve the mapped addresses.

Let's modify those accessors to use directly the vc4_hdmi structure so
that we can eventually get rid of that single global pointer.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Rename hdmi to vc4_hdmi
Maxime Ripard [Mon, 6 Jan 2020 17:07:05 +0000 (18:07 +0100)]
drm/vc4: hdmi: Rename hdmi to vc4_hdmi

The driver isn't consistent with the name given to the vc4_hdmi
structure pointer in its functions. Make sure to use a consistent name.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: rework connectors and encoders
Maxime Ripard [Mon, 6 Jan 2020 16:17:29 +0000 (17:17 +0100)]
drm/vc4: hdmi: rework connectors and encoders

the vc4_hdmi driver has some custom structures to hold the data it needs to
associate with the drm_encoder and drm_connector structures.

However, it allocates them separately from the vc4_hdmi structure which
makes it more complicated than it needs to be.

Move those structures to be contained by vc4_hdmi and update the code
accordingly.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Move structure to header
Maxime Ripard [Wed, 18 Dec 2019 17:35:12 +0000 (18:35 +0100)]
drm/vc4: hdmi: Move structure to header

We will need to share the vc4_hdmi and related structures with multiple
files, so let's create a header for it.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: hdmi: Use debugfs private field
Maxime Ripard [Tue, 14 Jan 2020 16:24:32 +0000 (17:24 +0100)]
drm/vc4: hdmi: Use debugfs private field

We're calling vc4_debugfs_add_file with our struct vc4_hdmi pointer set
in the private field, but we don't use that field and go through the
main struct vc4_dev to get it.

Let's use the private field directly, that will save us some trouble
later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: crtc: Add BCM2711 pixelvalves
Maxime Ripard [Thu, 26 Dec 2019 10:35:58 +0000 (11:35 +0100)]
drm/vc4: crtc: Add BCM2711 pixelvalves

The BCM2711 has 5 pixelvalves, so now that our driver is ready, let's add
support for them.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodt-bindings: display: vc4: pv: Add BCM2711 pixel valves
Maxime Ripard [Thu, 13 Feb 2020 16:07:02 +0000 (17:07 +0100)]
dt-bindings: display: vc4: pv: Add BCM2711 pixel valves

The BCM2711 comes with other pixelvalves that have different requirements
and capabilities. Let's document their compatible.

Cc: devicetree@vger.kernel.org
Reviewed-by: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: crtc: Disable color management for HVS5
Maxime Ripard [Fri, 21 Feb 2020 15:54:21 +0000 (16:54 +0100)]
drm/vc4: crtc: Disable color management for HVS5

The HVS5 uses different color matrices. Disable color management support
for now.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: crtc: Remove redundant call to drm_crtc_enable_color_mgmt
Maxime Ripard [Fri, 21 Feb 2020 15:48:19 +0000 (16:48 +0100)]
drm/vc4: crtc: Remove redundant call to drm_crtc_enable_color_mgmt

The driver calls the helper to add the color management properties twice,
which is redundant. Remove the first one.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: crtc: Add HDMI1 encoder type
Maxime Ripard [Thu, 9 Jan 2020 17:39:30 +0000 (18:39 +0100)]
drm/vc4: crtc: Add HDMI1 encoder type

The BCM2711 sports a second HDMI controller, so let's add that second HDMI
encoder type.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: crtc: Rename HDMI encoder type to HDMI0
Maxime Ripard [Thu, 9 Jan 2020 17:35:13 +0000 (18:35 +0100)]
drm/vc4: crtc: Rename HDMI encoder type to HDMI0

The previous generations were only supporting a single HDMI controller, but
that's about to change, so put an index as well to differentiate between
the two controllers.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: crtc: Add function to compute FIFO level bits
Maxime Ripard [Mon, 13 Jan 2020 12:40:37 +0000 (13:40 +0100)]
drm/vc4: crtc: Add function to compute FIFO level bits

The longer FIFOs in vc5 pixelvalves means that the FIFO full level
doesn't fit in the original register field and that we also have a
secondary field. In order to prepare for this, let's move the registers
fill part to a helper function.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: crtc: Add FIFO depth to vc4_crtc_data
Maxime Ripard [Mon, 13 Jan 2020 12:39:20 +0000 (13:39 +0100)]
drm/vc4: crtc: Add FIFO depth to vc4_crtc_data

Not all pixelvalve FIFOs in vc5 have the same depth, so we need to add that
to our vc4_crtc_data structure to be able to compute the fill level
properly later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: crtc: Assign output to channel automatically
Maxime Ripard [Thu, 26 Dec 2019 16:53:18 +0000 (17:53 +0100)]
drm/vc4: crtc: Assign output to channel automatically

The HVS found in the BCM2711 has 6 outputs and 3 FIFOs, with each output
being connected to a pixelvalve, and some muxing between the FIFOs and
outputs.

Any output cannot feed from any FIFO though, and they all have a bunch of
constraints.

In order to support this, let's store the possible FIFOs each output can be
assigned to in the vc4_crtc_data, and use that information at atomic_check
time to iterate over all the CRTCs enabled and assign them FIFOs.

The channel assigned is then set in the vc4_crtc_state so that the rest of
the driver can use it.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>