platform/kernel/linux-rpi.git
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>
4 years agodrm/vc4: crtc: Enable and disable the PV in atomic_enable / disable
Maxime Ripard [Fri, 21 Feb 2020 13:34:31 +0000 (14:34 +0100)]
drm/vc4: crtc: Enable and disable the PV in atomic_enable / disable

The VIDEN bit in the pixelvalve currently being used to enable or disable
the pixelvalve seems to not be enough in some situations, which whill end
up with the pixelvalve stalling.

In such a case, even re-enabling VIDEN doesn't bring it back and we need to
clear the FIFO. This can only be done if the pixelvalve is disabled though.

In order to overcome this, we can configure the pixelvalve during
mode_set_no_fb, but only enable it in atomic_enable and flush the FIFO
there, and in atomic_disable disable the pixelvalve again.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: crtc: Use local chan variable
Maxime Ripard [Tue, 14 Jan 2020 12:37:27 +0000 (13:37 +0100)]
drm/vc4: crtc: Use local chan variable

The vc4_crtc_handle_page_flip already has a local variable holding the
value of vc4_crtc->channel, so let's use it instead.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: crtc: Rename HVS channel to output
Maxime Ripard [Thu, 26 Dec 2019 12:49:17 +0000 (13:49 +0100)]
drm/vc4: crtc: Rename HVS channel to output

In vc5, the HVS has 6 outputs and 3 FIFOs (or channels), with
pixelvalves each being assigned to a given output, but each output can
then be muxed to feed from multiple FIFOs.

Since vc4 had that entirely static, both were probably equivalent, but
since that changes, let's rename hvs_channel to hvs_output in the
vc4_crtc_data, since a pixelvalve is really connected to an output, and
not to a FIFO.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: crtc: Move the cob allocation outside of bind
Maxime Ripard [Thu, 26 Dec 2019 14:48:09 +0000 (15:48 +0100)]
drm/vc4: crtc: Move the cob allocation outside of bind

The COB allocation depends on the HVS channel used for a given
pixelvalve.

While the channel allocation was entirely static in vc4, vc5 changes
that and at bind time, a pixelvalve can be assigned to multiple
HVS channels.

Let's prepare that rework by allocating the COB when it's actually
needed.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: crtc: Turn static const variable into a define
Maxime Ripard [Mon, 13 Jan 2020 12:39:32 +0000 (13:39 +0100)]
drm/vc4: crtc: Turn static const variable into a define

The hvs_latency_pix variable doesn't need to be a variable and can just be
defined.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: crtc: Use a shared interrupt
Maxime Ripard [Thu, 9 Jan 2020 17:40:49 +0000 (18:40 +0100)]
drm/vc4: crtc: Use a shared interrupt

Some pixelvalves in vc5 use the same interrupt line so let's register our
interrupt handler as a shared one.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: crtc: Deal with different number of pixel per clock
Maxime Ripard [Thu, 26 Dec 2019 10:36:50 +0000 (11:36 +0100)]
drm/vc4: crtc: Deal with different number of pixel per clock

Some of the HDMI pixelvalves in vc5 output two pixels per clock cycle.
Let's put the number of pixel output per clock cycle in the CRTC data and
update the various calculations to reflect that.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: crtc: Move crtc state to common header
Maxime Ripard [Thu, 26 Dec 2019 14:45:04 +0000 (15:45 +0100)]
drm/vc4: crtc: Move crtc state to common header

We'll need to access the crtc_state from outside of vc4_crtc.c, so let's
move it to vc4_drv.h

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: crtc: Rename SoC data structures
Maxime Ripard [Thu, 26 Dec 2019 10:45:04 +0000 (11:45 +0100)]
drm/vc4: crtc: Rename SoC data structures

Since we're going to introduce pixelvalve data structures for other SoCs
than the BCM2835, let's rename the structures defined in the code to
make it obvious which SoC we're targetting.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: plane: Create more planes
Maxime Ripard [Thu, 6 Feb 2020 13:52:42 +0000 (14:52 +0100)]
drm/vc4: plane: Create more planes

Let's now create more planes that can be affected to all the CRTCs.

vc4 has 3 CRTCs, 1 primary and 1 cursor each, and was having 24 (8
planes per CRTC) overlays.

However, vc5 has 5 CRTCs, so keeping the same logic would put us at 50
planes which is well above the 32 planes limit imposed by DRM.

Using 16 seems like a good tradeoff between staying under 32 and yet
providing enough planes.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: plane: Create overlays for any CRTC
Maxime Ripard [Thu, 6 Feb 2020 13:50:06 +0000 (14:50 +0100)]
drm/vc4: plane: Create overlays for any CRTC

Now that we have everything in place, we can now register all the overlay
planes that can be assigned to all the CRTCs.

This has two side effects:

  - The number of overlay planes is reduced from 24 to 8. This is temporary
    and will be increased again in the next patch.

  - The ID of the various planes is changed again, and we will now have all
    the primary planes, then all the overlay planes and finally the cursor
    planes. This shouldn't cause any issue since the ordering between
    primary, overlay and cursor planes is preserved.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: plane: Register all the planes at once
Maxime Ripard [Thu, 6 Feb 2020 13:46:14 +0000 (14:46 +0100)]
drm/vc4: plane: Register all the planes at once

Instead of creating planes for each CRTC, we eventually want to create all
the planes for each CRTCs.

In order to make that more convenient, let's iterate on the CRTCs in the
plane creation function instead of its caller.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: plane: Move additional planes creation to driver
Maxime Ripard [Thu, 6 Feb 2020 13:41:41 +0000 (14:41 +0100)]
drm/vc4: plane: Move additional planes creation to driver

So far the plane creation was done when each CRTC was bound, and those
planes were only tied to the CRTC that was registering them.

This causes two main issues:
  - The planes in the vc4 hardware are actually not tied to any CRTC, but
    can be used with every combination

  - More importantly, so far, we allocate 10 planes per CRTC, with 3 CRTCs.
    However, the next generation of hardware will have 5 CRTCs, putting us
    well above the maximum of 32 planes currently allowed by DRM.

This patch is the first one in a series of patches that will take down both
of these issues so that we can support the next generation of hardware
while keeping a good amount of planes.

We start by changing the way the planes are registered to first registering
the primary planes for each CRTC in the CRTC bind function as we used to,
but moving the overlay and cursor creation to the main driver bind
function, after all the CRTCs have been bound.

This will slightly change the ID order of the planes, since the primary
planes of all CRTCs will be first, and then a pattern of 8 overlays, 1
cursor plane for each CRTC.

This shouldn't cause any trouble since the ordering between the planes is
preserved though.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: plane: Move planes creation to its own function
Maxime Ripard [Thu, 6 Feb 2020 13:32:57 +0000 (14:32 +0100)]
drm/vc4: plane: Move planes creation to its own function

The planes so far were created as part of the CRTC binding code with
each planes created associated only to one CRTC. However, the hardware
in the vc4 doesn't really have such constraint and can be used with any
CRTC.

In order to rework this, let's first move the overlay and cursor planes
creation to a function of its own.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: plane: Improve LBM usage
Dave Stevenson [Tue, 11 Feb 2020 16:55:02 +0000 (16:55 +0000)]
drm/vc4: plane: Improve LBM usage

LBM allocations were always taking the worst case sizing of
max(src_width, dst_width) * 16. This is significantly over
the required sizing, and stops us rendering multiple 4k images
to the screen.

Add some of the additional constraints to more accurately
describe the LBM requirements.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: drv: Add support for the BCM2711 HVS5
Dave Stevenson [Thu, 8 Aug 2019 16:51:07 +0000 (17:51 +0100)]
drm/vc4: drv: Add support for the BCM2711 HVS5

The HVS found in the BCM2711 is slightly different from the previous
generations.

Most notably, the display list layout changes a bit, the LBM doesn't have
the same size and the formats ordering for some formats is swapped.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: drv: Support BCM2711
Maxime Ripard [Thu, 6 Feb 2020 14:40:34 +0000 (15:40 +0100)]
drm/vc4: drv: Support BCM2711

The BCM2711 has a reworked display pipeline, and the load tracker needs
some adjustement to operate properly. Let's add a compatible for BCM2711
and disable the load tracker until properly supported.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodrm/vc4: drv: Add include guards
Maxime Ripard [Thu, 19 Dec 2019 17:08:48 +0000 (18:08 +0100)]
drm/vc4: drv: Add include guards

vc4_drv.h doesn't have any include guards which prevents it from being
included twice. Let's add them.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodt-bindings: display: vc4: Document BCM2711 VC5
Maxime Ripard [Thu, 13 Feb 2020 16:40:56 +0000 (17:40 +0100)]
dt-bindings: display: vc4: Document BCM2711 VC5

The BCM2711 comes with a new VideoCore. Add a compatible for it.

Cc: devicetree@vger.kernel.org
Reviewed-by: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodt-bindings: display: vc4: hdmi: Add missing clock-names property
Maxime Ripard [Thu, 13 Feb 2020 14:47:18 +0000 (15:47 +0100)]
dt-bindings: display: vc4: hdmi: Add missing clock-names property

While the device tree and the driver expected a clock-names property, it
wasn't explicitly documented in the previous binding. The documented order
was wrong too, so make sure clock-names is there and in the proper order.

Cc: devicetree@vger.kernel.org
Reviewed-by: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodt-bindings: display: vc4: dsi: Add missing clock properties
Maxime Ripard [Thu, 13 Feb 2020 14:47:18 +0000 (15:47 +0100)]
dt-bindings: display: vc4: dsi: Add missing clock properties

While the device tree and the driver expected a clock-names and a
clock-cells properties, it wasn't explicitly documented in the previous
binding. Make sure it is now.

Cc: devicetree@vger.kernel.org
Reviewed-by: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodt-bindings: display: vc4: dpi: Add missing clock-names property
Maxime Ripard [Thu, 13 Feb 2020 14:47:18 +0000 (15:47 +0100)]
dt-bindings: display: vc4: dpi: Add missing clock-names property

While the device tree and the driver expected a clock-names property, it
wasn't explicitly documented in the previous binding. Make sure it is now.

Cc: devicetree@vger.kernel.org
Reviewed-by: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodt-bindings: display: Convert VC4 bindings to schemas
Maxime Ripard [Thu, 13 Feb 2020 14:42:05 +0000 (15:42 +0100)]
dt-bindings: display: Convert VC4 bindings to schemas

The BCM283x SoCs have a display pipeline composed of several controllers
with device tree bindings that are supported by Linux.

Now that we have the DT validation in place, let's split into separate
files and convert the device tree bindings for those controllers to
schemas.

This is just a 1:1 conversion though, and some bindings were incomplete so
it results in example validation warnings that are going to be addressed in
the following patches.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoARM: dts: bcm2711: Add HDMI DVP
Maxime Ripard [Tue, 28 Jan 2020 08:37:06 +0000 (09:37 +0100)]
ARM: dts: bcm2711: Add HDMI DVP

Now that we have a driver for the DVP, let's add its DT node.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: Add BCM2711 DVP driver
Maxime Ripard [Tue, 28 Jan 2020 08:36:27 +0000 (09:36 +0100)]
clk: bcm: Add BCM2711 DVP driver

The HDMI block has a block that controls clocks and reset signals to the
HDMI0 and HDMI1 controllers.

Let's expose that through a clock driver implementing a clock and reset
provider.

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>
4 years agodt-bindings: clock: Add BCM2711 DVP binding
Maxime Ripard [Thu, 13 Feb 2020 16:50:31 +0000 (17:50 +0100)]
dt-bindings: clock: Add BCM2711 DVP binding

The BCM2711 has a unit controlling the HDMI0 and HDMI1 clock and reset
signals. Let's add a binding for it.

Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
Reviewed-by: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoreset: simple: Add reset callback
Maxime Ripard [Tue, 28 Jan 2020 15:22:20 +0000 (16:22 +0100)]
reset: simple: Add reset callback

The reset-simple code lacks a reset callback that is still pretty easy to
implement. The only real thing to consider is the delay needed for a device
to be reset, so let's expose that as part of the reset-simple driver data.

Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoreset: Move reset-simple header out of drivers/reset
Maxime Ripard [Tue, 28 Jan 2020 08:33:52 +0000 (09:33 +0100)]
reset: Move reset-simple header out of drivers/reset

The reset-simple code can be useful for drivers outside of drivers/reset
that have a few reset controls as part of their features. Let's move it to
include/linux/reset.

Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoARM: dts: bcm2711: Add firmware clocks node
Maxime Ripard [Mon, 23 Dec 2019 18:58:30 +0000 (19:58 +0100)]
ARM: dts: bcm2711: Add firmware clocks node

Now that we have a clock driver for the clocks exposed by the firmware,
let's add the device tree nodes for it.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Discover the firmware clocks
Maxime Ripard [Mon, 10 Feb 2020 13:06:09 +0000 (14:06 +0100)]
clk: bcm: rpi: Discover the firmware clocks

The RaspberryPi4 firmware actually exposes more clocks than are currently
handled by the driver and we will need to change some of them directly
based on the pixel rate for the display related clocks, or the load for the
GPU.

This rate change can have a number of side-effects, including adjusting the
various PLL voltages or the PLL parents. The firmware will also update
those clocks by itself for example if the SoC runs too hot.

In order to make Linux play as nice as possible with those constraints, it
makes sense to rely on the firmware clocks as much as possible.

Fortunately,t he firmware has an interface to discover the clocks it
exposes.

Let's use it to discover, register the clocks in the clocks framework and
then expose them through the device tree for consumers to use them.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: linux-clk@vger.kernel.org
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Add DT provider for the clocks
Maxime Ripard [Fri, 7 Feb 2020 16:03:46 +0000 (17:03 +0100)]
clk: bcm: rpi: Add DT provider for the clocks

For the upcoming registration of the clocks provided by the firmware, make
sure it's exposed to the device tree providers.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: linux-clk@vger.kernel.org
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Make the PLLB registration function return a clk_hw
Maxime Ripard [Fri, 7 Feb 2020 15:30:01 +0000 (16:30 +0100)]
clk: bcm: rpi: Make the PLLB registration function return a clk_hw

The raspberrypi_register_pllb has been returning an integer so far to
notify whether the functions has exited successfully or not.

However, the OF provider functions in the clock framework require access to
the clk_hw structure so that we can expose those clocks to device tree
consumers.

Since we'll want that for the future clocks, let's return a clk_hw pointer
instead of the return code.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: linux-clk@vger.kernel.org
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Split pllb clock hooks
Maxime Ripard [Fri, 7 Feb 2020 15:14:18 +0000 (16:14 +0100)]
clk: bcm: rpi: Split pllb clock hooks

The driver only supports the pllb for now and all the clock framework hooks
are a mix of the generic firmware interface and the specifics of the pllb.
Since we will support more clocks in the future let's split the generic and
specific hooks

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: linux-clk@vger.kernel.org
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Rename is_prepared function
Maxime Ripard [Thu, 20 Feb 2020 11:45:47 +0000 (12:45 +0100)]
clk: bcm: rpi: Rename is_prepared function

The raspberrypi_fw_pll_is_on function doesn't only apply to PLL
registered in the driver, but any clock exposed by the firmware.

Since we also implement the is_prepared hook, make the function
consistent with the other function names.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: linux-clk@vger.kernel.org
Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Pass the clocks data to the firmware function
Maxime Ripard [Fri, 7 Feb 2020 15:08:17 +0000 (16:08 +0100)]
clk: bcm: rpi: Pass the clocks data to the firmware function

The raspberry_clock_property only takes the clock ID as an argument, but
now that we have a clock data structure it makes more sense to just pass
that structure instead.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: linux-clk@vger.kernel.org
Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Add clock id to data
Maxime Ripard [Fri, 7 Feb 2020 15:04:16 +0000 (16:04 +0100)]
clk: bcm: rpi: Add clock id to data

The driver has really only supported one clock so far and has hardcoded the
ID used in communications with the firmware in all the functions
implementing the clock framework hooks. Let's store that in the clock data
structure so that we can support more clocks later on.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: linux-clk@vger.kernel.org
Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Create a data structure for the clocks
Maxime Ripard [Fri, 7 Feb 2020 15:01:33 +0000 (16:01 +0100)]
clk: bcm: rpi: Create a data structure for the clocks

So far the driver has really only been providing a single clock, and stored
both the data associated to that clock in particular with the data
associated to the "controller".

Since we will change that in the future, let's decouple the clock data from
the provider data.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: linux-clk@vger.kernel.org
Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Make sure the clkdev lookup is removed
Maxime Ripard [Fri, 7 Feb 2020 14:47:13 +0000 (15:47 +0100)]
clk: bcm: rpi: Make sure the clkdev lookup is removed

The clkdev lookup created for the cpufreq device is never removed if
there's an issue later in probe or at module removal time.

Let's convert to the managed variant of the clk_hw_register_clkdev function
to make sure it happens.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: linux-clk@vger.kernel.org
Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Switch to clk_hw_register_clkdev
Maxime Ripard [Wed, 12 Feb 2020 13:21:45 +0000 (14:21 +0100)]
clk: bcm: rpi: Switch to clk_hw_register_clkdev

Since we don't care about retrieving the clk_lookup structure pointer
returned by clkdev_hw_create, we can just use the clk_hw_register_clkdev
function.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: linux-clk@vger.kernel.org
Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Remove pllb_arm_lookup global pointer
Maxime Ripard [Fri, 7 Feb 2020 14:46:24 +0000 (15:46 +0100)]
clk: bcm: rpi: Remove pllb_arm_lookup global pointer

The pllb_arm_lookup pointer in the struct raspberrypi_clk is not used for
anything but to store the returned pointer to clkdev_hw_create, and is not
used anywhere else in the driver.

Let's remove that global pointer from the structure.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: linux-clk@vger.kernel.org
Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Make sure pllb_arm is removed
Maxime Ripard [Fri, 7 Feb 2020 14:42:40 +0000 (15:42 +0100)]
clk: bcm: rpi: Make sure pllb_arm is removed

The pllb_arm clock was created at probe time, but was never removed if
something went wrong later in probe, or if the driver was ever removed from
the system.

Now that we are using clk_hw_register, we can just use its managed variant
to take care of that for us.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: linux-clk@vger.kernel.org
Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Remove global pllb_arm clock pointer
Maxime Ripard [Fri, 7 Feb 2020 14:41:37 +0000 (15:41 +0100)]
clk: bcm: rpi: Remove global pllb_arm clock pointer

The pllb_arm clk_hw pointer in the raspberry_clk structure isn't used
anywhere but in the raspberrypi_register_pllb_arm.

Let's remove it, this will make our lives easier in future patches.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: linux-clk@vger.kernel.org
Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Use clk_hw_register for pllb_arm
Maxime Ripard [Fri, 7 Feb 2020 14:40:00 +0000 (15:40 +0100)]
clk: bcm: rpi: Use clk_hw_register for pllb_arm

The pllb_arm clock is defined as a fixed factor clock with the pllb clock
as a parent. However, all its configuration is entirely static, and thus we
don't really need to call clk_hw_register_fixed_factor() but can simply call
clk_hw_register() with a static clk_fixed_factor structure.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: linux-clk@vger.kernel.org
Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Statically init clk_init_data
Maxime Ripard [Fri, 7 Feb 2020 13:17:54 +0000 (14:17 +0100)]
clk: bcm: rpi: Statically init clk_init_data

Instead of declaring the clk_init_data and then calling memset on it, just
initialise properly.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: linux-clk@vger.kernel.org
Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Allow the driver to be probed by DT
Maxime Ripard [Mon, 23 Dec 2019 18:58:08 +0000 (19:58 +0100)]
clk: bcm: rpi: Allow the driver to be probed by DT

The current firmware clock driver for the RaspberryPi can only be probed by
manually registering an associated platform_device.

While this works fine for cpufreq where the device gets attached a clkdev
lookup, it would be tedious to maintain a table of all the devices using
one of the clocks exposed by the firmware.

Since the DT on the other hand is the perfect place to store those
associations, make the firmware clocks driver probe-able through the device
tree so that we can represent it as a node.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: linux-clk@vger.kernel.org
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 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>
4 years agoi2c: brcmstb: Allow to compile it on BCM2835
Maxime Ripard [Tue, 14 Jan 2020 12:36:42 +0000 (13:36 +0100)]
i2c: brcmstb: Allow to compile it on BCM2835

The BCM2711, supported by ARCH_BCM2835, also has a controller by the
brcmstb driver so let's allow it to be compiled on that platform.

Cc: Kamal Dasu <kdasu.kdev@gmail.com>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: linux-i2c@vger.kernel.org
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoi2c: brcmstb: Support BCM2711 HDMI BSC controllers
Maxime Ripard [Tue, 17 Dec 2019 08:58:34 +0000 (09:58 +0100)]
i2c: brcmstb: Support BCM2711 HDMI BSC controllers

The HDMI blocks in the BCM2771 have an i2c controller to retrieve the
EDID. This block is split into two parts, the BSC and the AUTO_I2C,
lying in two separate register areas.

The AUTO_I2C block has a mailbox-like interface and will take away the
BSC control from the CPU if enabled. However, the BSC is the actually
the same controller than the one supported by the brcmstb driver, and
the AUTO_I2C doesn't really bring any immediate benefit.

Let's use the BSC then, but let's also tie the AUTO_I2C registers with a
separate compatible so that we can enable AUTO_I2C if needed in the
future.

The AUTO_I2C is enabled by default at boot though, so we first need to
release the BSC from the AUTO_I2C control.

Cc: Kamal Dasu <kdasu.kdev@gmail.com>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: linux-i2c@vger.kernel.org
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodt-bindings: i2c: brcmstb: Add BCM2711 BSC/AUTO-I2C binding
Maxime Ripard [Tue, 17 Dec 2019 08:58:34 +0000 (09:58 +0100)]
dt-bindings: i2c: brcmstb: Add BCM2711 BSC/AUTO-I2C binding

The HDMI blocks in the BCM2771 have an i2c controller to retrieve the
EDID. This block is split into two parts, the BSC and the AUTO_I2C,
lying in two separate register areas.

The AUTO_I2C block has a mailbox-like interface and will take away the
BSC control from the CPU if enabled. However, the BSC is the actually
the same controller than the one supported by the brcmstb driver, and
the AUTO_I2C doesn't really bring any immediate benefit.

We can model it in the DT as a single device with two register range,
which will allow us to use or or the other in the driver without
changing anything in the DT.

Cc: Kamal Dasu <kdasu.kdev@gmail.com>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: linux-i2c@vger.kernel.org
Cc: devicetree@vger.kernel.org
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodt-bindings: i2c: brcmstb: Convert the BRCMSTB binding to a schema
Maxime Ripard [Thu, 13 Feb 2020 15:55:01 +0000 (16:55 +0100)]
dt-bindings: i2c: brcmstb: Convert the BRCMSTB binding to a schema

Switch the DT binding to a YAML schema to enable the DT validation.

Cc: Kamal Dasu <kdasu.kdev@gmail.com>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: linux-i2c@vger.kernel.org
Cc: devicetree@vger.kernel.org
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoRevert "clk-raspberrypi: Allow cpufreq driver to also adjust gpu clocks"
Maxime Ripard [Wed, 12 Feb 2020 08:33:59 +0000 (09:33 +0100)]
Revert "clk-raspberrypi: Allow cpufreq driver to also adjust gpu clocks"

This reverts commit 60dc4841efc8fe97b710b49d37d50bd719e8ca07.

4 years agoRevert "clk-raspberrypi: Also support v3d clock"
Maxime Ripard [Wed, 12 Feb 2020 08:33:51 +0000 (09:33 +0100)]
Revert "clk-raspberrypi: Also support v3d clock"

This reverts commit 54354f31352ca1e058b029abd384819435c9ef47.

4 years agoRevert "v3d_drv: Allow clock retrieval by name"
Maxime Ripard [Mon, 17 Feb 2020 15:20:27 +0000 (16:20 +0100)]
Revert "v3d_drv: Allow clock retrieval by name"

This reverts commit 229fbb896ca6e0a40272cc846e41eeb0c29a551f.

4 years agommc: sdhci: Silence MMC warnings
Maxime Ripard [Fri, 6 Dec 2019 12:05:27 +0000 (13:05 +0100)]
mmc: sdhci: Silence MMC warnings

When the MMC isn't plugged in, the driver will spam the console which is
pretty annoying when using NFS.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agodefconfig: Add V4L2 HEVC driver to bcm2711_defconfig
Dave Stevenson [Fri, 13 Mar 2020 16:55:32 +0000 (16:55 +0000)]
defconfig: Add V4L2 HEVC driver to bcm2711_defconfig

This replaces the register mapped driver.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodtoverlays: Add overlay to enable the HEVC V4L2 driver
Dave Stevenson [Fri, 13 Mar 2020 16:52:55 +0000 (16:52 +0000)]
dtoverlays: Add overlay to enable the HEVC V4L2 driver

This replaces the rpivid_mem register mapping driver.
When the driver is complete, these DT changes should be
merged into the base DT instead of being an overlay.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 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>
4 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>
4 years agomedia: v4l2-mem2mem: allow request job buffer processing after job finish
John Cox [Thu, 5 Mar 2020 14:46:54 +0000 (14:46 +0000)]
media: v4l2-mem2mem: allow request job buffer processing after job finish

Allow the capture buffer to be detached from a v4l2 request job such
that another job can start before the capture buffer is returned. This
allows h/w codecs that can process multiple requests at the same time
to operate more efficiently.

Signed-off-by: John Cox <jc@kynesim.co.uk>
4 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>
4 years agomedia: uapi: Add hevc ctrls for WPP decoding
Dave Stevenson [Mon, 23 Mar 2020 19:00:17 +0000 (19:00 +0000)]
media: uapi: Add hevc ctrls for WPP decoding

WPP can allow greater parallelism within the decode, but needs
offset information to be passed in.

Adds num_entry_point_offsets and entry_point_offset_minus1 to
v4l2_ctrl_hevc_slice_params.

This is based on Jernej Skrabec's patches for cedrus which
implement the same feature.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agomedia: hevc_ctrls: Add slice param dependent slice segment
Dave Stevenson [Mon, 23 Mar 2020 18:34:01 +0000 (18:34 +0000)]
media: hevc_ctrls: Add slice param dependent slice segment

Adds V4L2_HEVC_SLICE_PARAMS_FLAG_DEPENDENT_SLICE_SEGMENT define.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 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>
4 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>
4 years agomedia: pixfmt: Document the HEVC slice pixel format
Paul Kocialkowski [Tue, 22 Oct 2019 15:26:53 +0000 (12:26 -0300)]
media: pixfmt: Document the HEVC slice pixel format

Commit de06f289283298e2938445019999cec46435375c upstream.

Document the current state of the HEVC slice pixel format.
The format will need to evolve in the future, which is why it is
not part of the public API.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>