platform/kernel/linux-rpi.git
2 years agodt-bindings: media: i2c: Add IMX519 CMOS sensor binding
Lee Jackson [Fri, 27 Aug 2021 06:36:55 +0000 (14:36 +0800)]
dt-bindings: media: i2c: Add IMX519 CMOS sensor binding

Add YAML device tree binding for IMX519 CMOS image sensor, and
the relevant MAINTAINERS entries.

Signed-off-by: Lee Jackson <info@arducam.com>
2 years agommc: sdhci-iproc: Fix vmmc regulators (pre-bcm2711)
Juerg Haefliger [Wed, 29 Sep 2021 09:42:23 +0000 (11:42 +0200)]
mmc: sdhci-iproc: Fix vmmc regulators (pre-bcm2711)

The Linux support for controlling card power via regulators appears to
be contentious. I would argue that the default behaviour is contrary to
the SDHCI spec - turning off the power writes a reserved value to the
SD Bus Voltage Select field of the Power Control Register, which
seems to kill the Arasan/iProc controller - but fortunately there is a
hook in sdhci_ops to override the behaviour.

Signed-off-by: Juerg Haefliger <juergh@canonical.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agoRevert "mmc: sdhci-iproc: Fix vmmc regulators on iProc"
Juerg Haefliger [Wed, 29 Sep 2021 09:39:46 +0000 (11:39 +0200)]
Revert "mmc: sdhci-iproc: Fix vmmc regulators on iProc"

This reverts commit aed19399a01733dbad9be8bf026a4f7dd823b04f.

Commit 6c92ae1e452f ("mmc: sdhci: Introduce sdhci_set_power_and_bus_voltage()")
introduced a generic helper that does the same thing so use that instead in
the following commit.

Signed-off-by: Juerg Haefliger <juergh@canonical.com>
2 years agobcm2835_smi_dev: Fix handling of word-odd lengths
madimario [Tue, 28 Sep 2021 08:20:06 +0000 (04:20 -0400)]
bcm2835_smi_dev: Fix handling of word-odd lengths

The read and write functions did not use the correct pointer offset
when dealing with an odd number of bytes after a DMA transfer. Also,
only handle the remaining odd bytes if the DMA transfer completed
successfully.

Submitted-by: @madimario (GitHub)
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agoregulator: rpi-panel: Remove get_brightness hook
Dave Stevenson [Tue, 21 Sep 2021 14:32:50 +0000 (15:32 +0100)]
regulator: rpi-panel: Remove get_brightness hook

The driver was implementing a get_brightness function that
tried to read back the PWM setting of the display to report
as the current brightness.
The controller on the display does not support that, therefore
we end up reporting a brightness of 0, and that confuses
systemd's backlight service.

Remove the hook so that the framework returns the current
brightness automatically.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agooverlays: Add generic mcp2515 overlay
GabyPCgeeK [Mon, 27 Sep 2021 08:43:21 +0000 (04:43 -0400)]
overlays: Add generic mcp2515 overlay

Can configure mcp2515 on spi0/1/2 without the need for multiple overlays.

2 years agooverlays: add support for the MLX90640 thermal camera
Guennadi Liakhovetski [Sun, 19 Sep 2021 11:30:43 +0000 (13:30 +0200)]
overlays: add support for the MLX90640 thermal camera

This allows using the video-i2c camera driver with MLX90640 thermal
infrared sensors, connected to Raspberry Pi. CONFIG_VIDEO_V4L2_I2C
has to be selected to use the camera.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
2 years agostaging: bcm2835-codec: Add support for H&V Flips to ISP
Dave Stevenson [Mon, 20 Sep 2021 13:37:17 +0000 (14:37 +0100)]
staging: bcm2835-codec: Add support for H&V Flips to ISP

The ISP can do H & V flips whilst resizing or converting
the image, so expose that via V4L2_CID_[H|V]FLIP.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging: bcm2835-codec: Ensure all ctrls are set on streamon
Dave Stevenson [Mon, 20 Sep 2021 14:00:51 +0000 (15:00 +0100)]
staging: bcm2835-codec: Ensure all ctrls are set on streamon

Currently the code was only setting some controls from
bcm2835_codec_set_ctrls, but it's simpler to use
v4l2_ctrl_handler_setup to avoid forgetting to adding new
controls to the list.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging: bcm2835_codec: Correct flushing code for refcounting
Dave Stevenson [Wed, 22 Sep 2021 15:42:49 +0000 (16:42 +0100)]
staging: bcm2835_codec: Correct flushing code for refcounting

Completions don't reference count, so setting the completion
on the first buffer returned and then not reinitialising it
means that the flush function doesn't behave as intended.

Signal the completion when the last buffer is returned.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging: mmal-vchiq: Reset buffers_with_vpu on port_enable
Dave Stevenson [Tue, 21 Sep 2021 16:17:57 +0000 (17:17 +0100)]
staging: mmal-vchiq: Reset buffers_with_vpu on port_enable

Should we go through the timeout failure case with port_disable
not returning all buffers for whatever reason, the
buffers_with_vpu counter gets left at a non-zero value, which
will cause reference counting issues should the instance be
reused.

Reset the count when the port is enabled again, but before
any buffers have been sent to the VPU.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging: bcm2835-codec: Queue flushed buffers instead of completing
Dave Stevenson [Thu, 16 Sep 2021 15:46:58 +0000 (16:46 +0100)]
staging: bcm2835-codec: Queue flushed buffers instead of completing

When a buffer is returned on a port that is disabled, return it
to the videobuf2 QUEUED state instead of DONE which returns it
to the client.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging/mmal-vchiq: Add module parameter to enable logging.
Dave Stevenson [Wed, 15 Sep 2021 16:54:11 +0000 (17:54 +0100)]
staging/mmal-vchiq: Add module parameter to enable logging.

Adds a module parameter "debug" to enable various logging levels.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging: bcm2835-codec: Signal the firmware to stop on all changes
Dave Stevenson [Thu, 16 Sep 2021 15:39:07 +0000 (16:39 +0100)]
staging: bcm2835-codec: Signal the firmware to stop on all changes

The firmware defaults to not stopping video decode if only the
pixel aspect ratio or colourspace change. V4L2 requires us
to stop decoding on any change, therefore tell the firmware
of the desire for this alternate behaviour.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging: bcm2835-codec: Format changed should trigger drain
Dave Stevenson [Thu, 16 Sep 2021 15:32:53 +0000 (16:32 +0100)]
staging: bcm2835-codec: Format changed should trigger drain

When a format changed event occurs, the spec says that it
triggers an implicit drain, and that needs to be signalled
via -EPIPE.

For BCM2835, the format changed event happens at the point
the format change occurs, so no further buffers exist from
before the resolution changed point. We therefore signal the
last buffer immediately.
We don't have a V4L2 available to us at this point, so set
the videobuf2 queue last_buffer_dequeued flag directly.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging/mmal-vchiq: Rationalise included headers
Dave Stevenson [Wed, 15 Sep 2021 16:49:41 +0000 (17:49 +0100)]
staging/mmal-vchiq: Rationalise included headers

The list of includes was slightly over generic, and wasn't
in alphabetical order. Clean it up.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging/bcm2835-codec: Do not send buffers to the VPU unless streaming
Dave Stevenson [Wed, 15 Sep 2021 16:44:19 +0000 (17:44 +0100)]
staging/bcm2835-codec: Do not send buffers to the VPU unless streaming

With video decode we now enable both input and output ports on
the component. This means that buffers will get passed to the VPU
earlier than desired if they are queued befoer STREAMON.

Check that the queue is streaming before sending buffers to the VPU.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging: bcm2835-codec: Allow decode res changed before STREAMON(CAPTURE)
Dave Stevenson [Fri, 9 Oct 2020 09:40:27 +0000 (10:40 +0100)]
staging: bcm2835-codec: Allow decode res changed before STREAMON(CAPTURE)

The V4L2 stateful video decoder API requires that you can STREAMON
on only the OUTPUT queue, feed in buffers, and wait for the
SOURCE_CHANGE event.
This requires that we enable the MMAL output port at the same time
as the input port, because the output port is the one that creates
the SOURCE_CHANGED event.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agomedia: rpivid: Ensure IRQs have completed before uniniting context
John Cox [Wed, 22 Sep 2021 18:05:30 +0000 (19:05 +0100)]
media: rpivid: Ensure IRQs have completed before uniniting context

Before uniniting the decode context sync with the IRQ queues to ensure
that decode no longer has any buffers in use.  This fixes a problem that
manifested as ffmpeg leaking CMA buffers when it did a stream off on
OUTPUT before CAPTURE, though in reality it was probably much more
dangerous than that.

Signed-off-by: John Cox <jc@kynesim.co.uk>
2 years agomedia: rpivid: Remove unused ctx state variable and defines
John Cox [Wed, 22 Sep 2021 17:57:19 +0000 (18:57 +0100)]
media: rpivid: Remove unused ctx state variable and defines

Remove unused ctx state tracking variable and associated defines.
Their presence implies they might be used, but they aren't.

Signed-off-by: John Cox <jc@kynesim.co.uk>
2 years agonet: phy: lan87xx: Allow more time for link detect
Phil Elwell [Wed, 22 Sep 2021 14:38:13 +0000 (15:38 +0100)]
net: phy: lan87xx: Allow more time for link detect

With EDPWRDOWN set in idle, it must be cleared before checking for
ENERGYON going high, indicating that a link is being established.
The existing code allows 640ms for ENERGYON to go high, but on
Raspberry Pis that appears not to be enough, causing link detection
to fail.

Increase the polling timeout to 1500ms - with a polling interval of
10ms it shouldn't cause unnecessary delays.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agomedia: rpivid: Avoid returning EINVAL to a G_FMT ioctl
John Cox [Wed, 1 Sep 2021 15:34:50 +0000 (16:34 +0100)]
media: rpivid: Avoid returning EINVAL to a G_FMT ioctl

V4L2 spec says that G/S/TRY_FMT IOCTLs should never return errors for
anything other than wrong buffer types. Improve the capture format
function such that this is so and unsupported values get converted
to supported ones properly.

Signed-off-by: John Cox <jc@kynesim.co.uk>
2 years agoARM: dts: Restore downstream dtbs to Makefile
Phil Elwell [Wed, 22 Sep 2021 08:16:46 +0000 (09:16 +0100)]
ARM: dts: Restore downstream dtbs to Makefile

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agoconfigs: Add CAN_PEAK_USB=m
Phil Elwell [Fri, 17 Sep 2021 14:18:51 +0000 (15:18 +0100)]
configs: Add CAN_PEAK_USB=m

Add the driver for the PEAK Systems USB CAN interface.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agoAdd Raspberry Pi PoE+ HAT support
Serge Schneider [Mon, 2 Dec 2019 14:48:05 +0000 (14:48 +0000)]
Add Raspberry Pi PoE+ HAT support

Signed-off-by: Serge Schneider <serge@raspberrypi.com>
2 years agostaging/bcm2835-v4l2_codec: Fix for encode selection API
Dom Cobley [Tue, 14 Sep 2021 15:44:18 +0000 (16:44 +0100)]
staging/bcm2835-v4l2_codec: Fix for encode selection API

Matches correct behaviour from DECODE and DEINTERLACE

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
2 years agostaging/bcm2835_codec: Add support for image_fx to deinterlace
Dom Cobley [Fri, 6 Aug 2021 14:37:16 +0000 (15:37 +0100)]
staging/bcm2835_codec: Add support for image_fx to deinterlace

Adds another /dev/video node wrapping image_fx doing deinterlace.

Co-developed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
2 years agostaging/vchiq-mmal: Add the deinterlace image effects enums
Dave Stevenson [Fri, 6 Aug 2021 14:44:21 +0000 (15:44 +0100)]
staging/vchiq-mmal: Add the deinterlace image effects enums

As we're wanting to wrap the image_fx component for deinterlacing,
add the deinterlace algorithm values to enum mmal_parameter_imagefx

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging: bcm2835-codec: Allow custom specified strides/bytesperline.
Dave Stevenson [Sat, 11 Sep 2021 16:21:07 +0000 (17:21 +0100)]
staging: bcm2835-codec: Allow custom specified strides/bytesperline.

If the client provides a bytesperline value in try_fmt/s_fmt then
validate it and correct if necessary.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging/bcm2835_codec: Log MMAL flags in hex
Dave Stevenson [Fri, 6 Aug 2021 12:43:48 +0000 (13:43 +0100)]
staging/bcm2835_codec: Log MMAL flags in hex

The flags is a bitmask, so it's far easier to interpret as hex
data instead of decimal.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging/bcm2835-codec: Return buffers to QUEUED not ERROR state
Dave Stevenson [Thu, 5 Aug 2021 15:46:42 +0000 (16:46 +0100)]
staging/bcm2835-codec: Return buffers to QUEUED not ERROR state

Should start_streaming fail, or buffers be queued during
stop_streaming, they should be returned to the core as QUEUED
and not (as currently) as ERROR.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging/bcm2835-codec: Correct ENUM_FRAMESIZES stepsize to 2
Dave Stevenson [Thu, 5 Aug 2021 14:11:23 +0000 (15:11 +0100)]
staging/bcm2835-codec: Correct ENUM_FRAMESIZES stepsize to 2

Being YUV420 formats, the step size is always 2 to avoid part
chroma subsampling.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging/bcm2835-codec: Add support for decoding interlaced streams
Dave Stevenson [Fri, 18 Dec 2020 19:56:31 +0000 (19:56 +0000)]
staging/bcm2835-codec: Add support for decoding interlaced streams

The video decoder can support decoding interlaced streams, so add
the required plumbing to signal this correctly.

The encoder and ISP do NOT support interlaced data, so trying to
configure an interlaced format on those nodes will be rejected.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging/vchiq-mmal: Add parameters for interlaced video support
Dave Stevenson [Thu, 5 Aug 2021 15:38:34 +0000 (16:38 +0100)]
staging/vchiq-mmal: Add parameters for interlaced video support

Adds enum mmal_interlace_type and struct
mmal_parameter_video_interlace_type to allow for querying the
interlacing mode on decoders.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging/vchiq-mmal: Add buffer flags for interlaced video
Dave Stevenson [Sun, 10 Jan 2021 19:05:17 +0000 (19:05 +0000)]
staging/vchiq-mmal: Add buffer flags for interlaced video

Add the buffer flags that the firmware uses to identify fields
on interlaced video

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging/bcm2835-codec: Change the default codec res to 32x32
Dave Stevenson [Thu, 13 May 2021 10:56:21 +0000 (11:56 +0100)]
staging/bcm2835-codec: Change the default codec res to 32x32

In order to effectively guarantee that a V4L2_EVENT_SOURCE_CHANGE
event occurs, adopt a default resolution of 32x32 so that it
is incredibly unlikely to be decoding a stream of that resolution
and therefore failing to note a "change" requiring the event.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agoregulator: rpi-panel: Add GPIO control for panel and touch resets
Dave Stevenson [Fri, 10 Sep 2021 12:50:28 +0000 (13:50 +0100)]
regulator: rpi-panel: Add GPIO control for panel and touch resets

We need independent control of the resets for the panel&bridge,
vs the touch controller.

Expose the reset lines that are on the Atmel's port C via the GPIO
API so that they can be controlled appropriately.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agoregulator: rpi-panel: Convert to drive lines directly
Dave Stevenson [Thu, 9 Sep 2021 17:24:57 +0000 (18:24 +0100)]
regulator: rpi-panel: Convert to drive lines directly

The Atmel was doing a load of automatic sequencing of
control lines, however it was combining the touch controller's
reset with the bridge/panel control.

Change to control the control signals directly rather than
through the automatic POWERON control.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agoregulator: rpi-panel: Ensure the backlight is off during probe.
Dave Stevenson [Wed, 8 Sep 2021 14:41:18 +0000 (15:41 +0100)]
regulator: rpi-panel: Ensure the backlight is off during probe.

The initial state of the Atmel is not defined, so ensure the
backlight PWM is set to 0 by default.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agoregulator: rpi-panel: Serialise operations.
Dave Stevenson [Wed, 8 Sep 2021 14:02:05 +0000 (15:02 +0100)]
regulator: rpi-panel: Serialise operations.

The driver was using the regmap lock to serialise the
individual accesses, but we really need to protect the
timings of enabling the regulators, including any communication
with the Atmel.

Use a mutex within the driver to control overall accesses to
the Atmel, instead of the regmap lock.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agoregulator: rpi-panel: Handle I2C errors/timing to the Atmel
Dave Stevenson [Wed, 8 Sep 2021 13:56:03 +0000 (14:56 +0100)]
regulator: rpi-panel: Handle I2C errors/timing to the Atmel

The Atmel is doing some things in the I2C ISR, during which
period it will not respond to further commands. This is
particularly true of the POWERON command.

Increase delays appropriately, and retry should I2C errors be
reported.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agoregulator: rpi-panel: Register with a unique backlight name
Dave Stevenson [Thu, 11 Feb 2021 18:46:06 +0000 (18:46 +0000)]
regulator: rpi-panel: Register with a unique backlight name

There's no reason why 2 Raspberry Pi DSI displays can't be
attached to a Pi Compute Module, so the backlight names need to
be unique.

Use the parent dev_name. It's not as readable, but is unique.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agoInput: edt-ft54x6: Clean up timer and workqueue on remove
Dave Stevenson [Wed, 8 Sep 2021 13:46:17 +0000 (14:46 +0100)]
Input: edt-ft54x6: Clean up timer and workqueue on remove

If no interrupt is defined then a timer and workqueue are used
to poll the controller.
On remove these were not being cleaned up correctly.

Fixes: ca61fdaba79f "Input: edt-ft5x06: Poll the device if no interrupt is
configured."

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodrm/panel-simple: Add a timing for the Raspberry Pi 7" panel
Dave Stevenson [Fri, 26 Mar 2021 17:06:36 +0000 (17:06 +0000)]
drm/panel-simple: Add a timing for the Raspberry Pi 7" panel

The Raspberry Pi 7" 800x480 panel uses a Toshiba TC358762 DSI
to DPI bridge chip, so there is a requirement for the timings
to be specified for the end panel. Add such a definition.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodrm/panel/raspberrypi-touchscreen: Handle I2C errors.
Dave Stevenson [Wed, 8 Sep 2021 13:21:38 +0000 (14:21 +0100)]
drm/panel/raspberrypi-touchscreen: Handle I2C errors.

rpi_touchscreen_i2c_read returns any errors from i2c_transfer,
or the 8 bit received value.
Check for error values before trying to process the data as
valid.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodrm/panel/raspberrypi-touchscreen: Initialise the bridge in prepare
Dave Stevenson [Fri, 3 Sep 2021 16:52:59 +0000 (17:52 +0100)]
drm/panel/raspberrypi-touchscreen: Initialise the bridge in prepare

The panel has a prepare call which is before video starts, and an
enable call which is after.
The Toshiba bridge should be configured before video, so move
the relevant power and initialisation calls to prepare.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodrm/panel/raspberrypi-touchscreen: Avoid NULL deref if not initialised
Dave Stevenson [Fri, 3 Sep 2021 16:47:37 +0000 (17:47 +0100)]
drm/panel/raspberrypi-touchscreen: Avoid NULL deref if not initialised

If a call to rpi_touchscreen_i2c_write from rpi_touchscreen_probe
fails before mipi_dsi_device_register_full is called, then
in trying to log the error message if uses ts->dsi->dev when
it is still NULL.

Use ts->i2c->dev instead, which is initialised earlier in probe.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodrm/vc4: Correct DSI divider calculations
Dave Stevenson [Fri, 18 Jun 2021 20:52:28 +0000 (21:52 +0100)]
drm/vc4: Correct DSI divider calculations

The divider calculations tried to find the divider
just faster than the clock requested. However if
it required a divider of 7 then the for loop
aborted without handling the "error" case, and could
end up with a clock lower than requested.

Correct the loop so that we always have a clock greater
than requested.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodrm/vc4: Release workaround buffer and DMA in error paths and unbind
Dave Stevenson [Tue, 6 Jul 2021 17:53:28 +0000 (18:53 +0100)]
drm/vc4: Release workaround buffer and DMA in error paths and unbind

On Pi0-3 the driver allocates a buffer and requests a DMA channel
because the ARM can't write to DSI1's registers directly.
However unbind and the error paths in bind don't release the buffer or
the DMA channel.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodrm/vc4: Reset HDMI MISC_CONTROL register.
Dave Stevenson [Mon, 13 Sep 2021 16:30:18 +0000 (17:30 +0100)]
drm/vc4: Reset HDMI MISC_CONTROL register.

The HDMI block can repeat pixels for double clocked modes,
and the firmware is now configuring the block to do this as
the PV is doing it incorrectly when at 2pixels/clock.
If the kernel doesn't reset it then we end up with strange
modes.

Reset MISC_CONTROL.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging: vchiq_arm: Usa a DMA pool for small bulks
detule [Tue, 2 Oct 2018 08:10:08 +0000 (04:10 -0400)]
staging: vchiq_arm: Usa a DMA pool for small bulks

During a bulk transfer we request a DMA allocation to hold the
scatter-gather list.  Most of the time, this allocation is small
(<< PAGE_SIZE), however it can be requested at a high enough frequency
to cause fragmentation and/or stress the CMA allocator (think time
spent in compaction here, or during allocations elsewhere).

Implement a pool to serve up small DMA allocations, falling back
to a coherent allocation if the request is greater than
VCHIQ_DMA_POOL_SIZE.

Signed-off-by: Oliver Gjoneski <ogjoneski@gmail.com>
2 years agostaging: vchiq_arm: children inherit DMA config
Phil Elwell [Tue, 21 Jul 2020 16:34:09 +0000 (17:34 +0100)]
staging: vchiq_arm: children inherit DMA config

Although it is no longer necessary for vchiq's children to have a
different DMA configuration to the parent, they do still need to
explicitly to have their DMA configuration set - to be that of the
parent.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agostaging: vchiq_arm: Add 36-bit address support
Phil Elwell [Thu, 1 Nov 2018 17:31:37 +0000 (17:31 +0000)]
staging: vchiq_arm: Add 36-bit address support

Conditional on a new compatible string, change the pagelist encoding
such that the top 24 bits are the pfn, leaving 8 bits for run length
(-1), giving a 36-bit address range.

Manage the split between addresses for the VPU and addresses for the
40-bit DMA controller with a dedicated DMA device pointer that on non-
BCM2711 platforms is the same as the main VCHIQ device. This allows
the VCHIQ node to stay in the usual place in the DT.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agobrcmfmac: Try product-specific clm_blob names first
Phil Elwell [Thu, 22 Jul 2021 13:34:42 +0000 (14:34 +0100)]
brcmfmac: Try product-specific clm_blob names first

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agosound/usb: call usb_autopm_get_interface() for devices that should not
Jonathan Bell [Wed, 15 Sep 2021 16:56:45 +0000 (17:56 +0100)]
sound/usb: call usb_autopm_get_interface() for devices that should not
be suspended

Webcams with microphones are composite devices, and autosuspend is set
at the device level. If uvcvideo is probed after snd-usb-audio, the effect
of the quirk applied by snd-usb-audio is undone by uvcvideo's global
application of autosuspend.

Incrementing the interface's PM refcount in such cases prevents runtime PM
from happening, thus the device is left active.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2 years agosound/usb: add device quirks for A4Tech FHD 1080p webcams
Jonathan Bell [Thu, 15 Apr 2021 12:15:14 +0000 (13:15 +0100)]
sound/usb: add device quirks for A4Tech FHD 1080p webcams

These devices use a type of Sonix chipset that produces broken microphone
data if suspended/resumed.

They also don't support readback of the sample rate.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2 years agomedia: i2c: imx477: Allow control of on-sensor DPC
David Plowman [Wed, 8 Sep 2021 13:15:17 +0000 (14:15 +0100)]
media: i2c: imx477: Allow control of on-sensor DPC

A module parameter "dpc_enable" is added to allow the control of the
sensor's on-board DPC (Defective Pixel Correction) function.

This is a global setting to be configured before using the sensor;
there is no intention that this would ever be changed on-the-fly.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
2 years agousb: xhci: workaround for bogus SET_DEQ_PENDING endpoint state
Jonathan Bell [Wed, 11 Aug 2021 14:33:57 +0000 (15:33 +0100)]
usb: xhci: workaround for bogus SET_DEQ_PENDING endpoint state

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

An unknown unsafe memory access can result in the ep_state variable
in xhci_virt_ep being trampled with a stuck SET_DEQ_PENDING state
despite successful completion of a Set TR Deq Pointer command.

All URB enqueue/dequeue calls for the endpoint will fail in this state
so no transfers are possible until the device is reconnected.

As a workaround, clear the flag if we see it set and issue a new Set
TR Deq command anyway - this should be harmless, as a prior Set TR Deq
command will only have been issued in the Stopped state, and if the
endpoint is Running then the controller is required to ignore it and
respond with a Context State Error event TRB.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2 years agomedia: rpivid: Only create aux entries for H265 if needed
John Cox [Thu, 6 May 2021 12:48:05 +0000 (13:48 +0100)]
media: rpivid: Only create aux entries for H265 if needed

Only create aux entries of mv info for frames where that info might
be used by a later frame.  This saves some memory bandwidth and
potentially some memory.

Signed-off-by: John Cox <jc@kynesim.co.uk>
2 years agomedia: rpivid: Make slice ctrl dynamic
John Cox [Thu, 29 Apr 2021 18:17:06 +0000 (19:17 +0100)]
media: rpivid: Make slice ctrl dynamic

Allows the user to submit a whole frames worth of slice headers in
one lump along with a single bitstream dmabuf for the whole lot.
This saves potentially a lot of bitstream copying.

Signed-off-by: John Cox <jc@kynesim.co.uk>
2 years agov4l2-ctrls: add support for dynamically allocated arrays.
Hans Verkuil [Thu, 15 Apr 2021 11:56:53 +0000 (13:56 +0200)]
v4l2-ctrls: add support for dynamically allocated arrays.

Implement support for dynamically allocated arrays.

Most of the changes concern keeping track of the number of elements
of the array and the number of elements allocated for the array and
reallocating memory if needed.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
(cherry picked from commit fd5d45e6561f6f8c406b81aeddecaa11f0bd15af)

2 years agovideodev2.h: add V4L2_CTRL_FLAG_DYNAMIC_ARRAY
Hans Verkuil [Wed, 14 Apr 2021 13:01:16 +0000 (15:01 +0200)]
videodev2.h: add V4L2_CTRL_FLAG_DYNAMIC_ARRAY

Add a new flag that indicates that this control is a dynamically sized
array. Also document this flag.

Currently dynamically sized arrays are limited to one dimensional arrays,
but that might change in the future if there is a need for it.

The initial use-case of dynamic arrays are stateless codecs. A frame
can be divided in many slices, so you want to provide an array containing
slice information for each slice. Typically the number of slices is small,
but the standard allow for hundreds or thousands of slices. Dynamic arrays
are a good solution since sizing the array for the worst case would waste
substantial amounts of memory.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
(cherry picked from commit c095ad310b223b9de38d491c9f66533d05586b45)

2 years agomedia: v4l2: Add Greyworld AWB control name
John Cox [Fri, 6 Aug 2021 13:32:44 +0000 (14:32 +0100)]
media: v4l2: Add Greyworld AWB control name

Add name for greyworld to white_balance preset names.
This patch previously applied to v4l2-ctrl.c but that was split
and deleted.

Signed-off-by: John Cox <jc@kynesim.co.uk>
2 years agomedia: rpivid: Update to compile with new hevc decode params
John Cox [Thu, 5 Aug 2021 14:18:50 +0000 (15:18 +0100)]
media: rpivid: Update to compile with new hevc decode params

DPB entries have moved from slice params to the new decode params
attribute - update to deal with this.  Also fixes fallthrough
warnings which seem to be new in 5.14.

Signed-off-by: John Cox <jc@kynesim.co.uk>
2 years agomedia: v4l2: Add HEVC_SCALING_MATRIX attribute to v4l2-ctrl-*
John Cox [Fri, 6 Aug 2021 09:53:50 +0000 (10:53 +0100)]
media: v4l2: Add HEVC_SCALING_MATRIX attribute to v4l2-ctrl-*

Add code to support V4L2_CID_MPEG_VIDEO_HEVC_SCALING_MATRIX to
v4l2-ctrl-*. This change was in the unsplit v4l2-ctrl.c but failed
to make it through the split.

Signed-off-by: John Cox <jc@kynesim.co.uk>
2 years agomedia: v4l2: Remove v4l2-ctrls.c
John Cox [Fri, 6 Aug 2021 09:47:11 +0000 (10:47 +0100)]
media: v4l2: Remove v4l2-ctrls.c

v4l2-ctrls.c has been split into 4 files v4l2-ctrls-*.c, the original
is redundant, confusing and probably should have been removed by a
previous patch.

Signed-off-by: John Cox <jc@kynesim.co.uk>
2 years agomedia: i2c: ov7251: Add fwnode properties controls
Dave Stevenson [Tue, 3 Aug 2021 10:33:33 +0000 (11:33 +0100)]
media: i2c: ov7251: Add fwnode properties controls

Add call to v4l2_ctrl_new_fwnode_properties to read and
create the fwnode based controls.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agomedia: i2c: ov9281: Add fwnode properties controls
Dave Stevenson [Tue, 3 Aug 2021 10:30:58 +0000 (11:30 +0100)]
media: i2c: ov9281: Add fwnode properties controls

Add call to v4l2_ctrl_new_fwnode_properties to read and
create the fwnode based controls.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agomedia: i2c: imx290: Add fwnode properties controls
Dave Stevenson [Tue, 3 Aug 2021 10:25:59 +0000 (11:25 +0100)]
media: i2c: imx290: Add fwnode properties controls

Add call to v4l2_ctrl_new_fwnode_properties to read and
create the fwnode based controls.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agoASoC: bcm: Add chipdip-dac driver
chipdip.lab [Mon, 26 Jul 2021 11:45:59 +0000 (14:45 +0300)]
ASoC: bcm: Add chipdip-dac driver

Driver chipdip-dac.c added into sound/soc/bcm/, files
sound/soc/bcm/Kconfig and sound/soc/bcm/Makefile updated.

Signed-off-by: Evgenij Sapunov <evgenij.sapunov@chipdip.ru>
2 years agomedia: i2c: tc358743: Fix compiler warning
Phil Elwell [Tue, 27 Jul 2021 10:17:08 +0000 (11:17 +0100)]
media: i2c: tc358743: Fix compiler warning

Avoid a compiler warning by using the "fallthrough" pseudo-keyword in
place of the old "/* fall through */" comment convention.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agoASoC: bcm: Compiler warnings in audioinjector-octo
Phil Elwell [Tue, 27 Jul 2021 08:27:49 +0000 (09:27 +0100)]
ASoC: bcm: Compiler warnings in audioinjector-octo

Avoid compiler warnings by using the "fallthrough" pseudo-keyword in
place of the old "/* fall through */" comment convention.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agomedia: i2c: imx477: Fix framerates for 1332x990 mode
David Plowman [Tue, 20 Jul 2021 14:10:03 +0000 (15:10 +0100)]
media: i2c: imx477: Fix framerates for 1332x990 mode

The imx477 driver's line length for this mode had not been updated to
the value supplied to us by the sensor manufacturer. With this
correction the sensor delivers the framerates that are expected.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
2 years agodrm/vc4: Add firmware-kms mode
Dave Stevenson [Mon, 7 Sep 2020 16:32:27 +0000 (17:32 +0100)]
drm/vc4: Add firmware-kms mode

This is a squash of all firmware-kms related patches from previous
branches, up to and including
"drm/vc4: Set the possible crtcs mask correctly for planes with FKMS"
plus a couple of minor fixups for the 5.9 branch.
Please refer to earlier branches for full history.

This patch includes work by Eric Anholt, James Hughes, Phil Elwell,
Dave Stevenson, Dom Cobley, and Jonathon Bell.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drm/vc4: Fixup firmware-kms after "drm/atomic: Pass the full state to CRTC atomic enable/disable"

Prototype for those calls changed, so amend fkms (which isn't
upstream) to match.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drm/vc4: Fixup fkms for API change

Atomic flush and check changed API, so fix up the downstream-only
FKMS driver.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drm/vc4: Make normalize_zpos conditional on using fkms

Eric's view was that there was no point in having zpos
support on vc4 as all the planes had the same functionality.

Can be later squashed into (and fixes):
drm/vc4: Add firmware-kms mode

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
drm/vc4: FKMS: Change of Broadcast RGB mode needs a mode change

The Broadcast RGB (aka HDMI limited/full range) property is only
notified to the firmware on mode change, so this needs to be
signalled when set.

https://github.com/raspberrypi/firmware/issues/1580

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
vc4/drv: Only notify firmware of display done with kms

fkms driver still wants firmware display to be active

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
ydrm/vc4: fkms: Fix margin calculations for the right/bottom edges

The calculations clipped the right/bottom edge of the clipped
range based on the left/top margins.

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

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drm/vc4: fkms: Use new devm_rpi_firmware_get api

drm/kms: Add allow_fb_modifiers

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
2 years agodrm/vc4: Refactor mode checking logic
Mateusz Kwiatkowski [Wed, 14 Jul 2021 23:08:05 +0000 (01:08 +0200)]
drm/vc4: Refactor mode checking logic

Replace drm_encoder_helper_funcs::atomic_check with
drm_connector_helper_funcs::atomic_check - the former is not called
during drm_mode_obj_set_property_ioctl(). Set crtc_state->mode_changed
if TV norm changes even without explicit mode change. This makes things
like "xrandr --output Composite-1 --set mode PAL-M" work properly.

Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
2 years agodrm/vc4: Allow setting the TV norm via module parameter
Mateusz Kwiatkowski [Wed, 14 Jul 2021 23:08:01 +0000 (01:08 +0200)]
drm/vc4: Allow setting the TV norm via module parameter

Similar to the ch7006 and nouveau drivers, introduce a "tv_mode" module
parameter that allow setting the TV norm by specifying vc4.tv_norm= on
the kernel command line.

If that is not specified, try inferring one of the most popular norms
(PAL or NTSC) from the video mode specified on the command line. On
Raspberry Pis, this causes the most common cases of the sdtv_mode
setting in config.txt to be respected.

Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
2 years agodrm/vc4: Add support for more analog TV standards
Mateusz Kwiatkowski [Wed, 14 Jul 2021 23:07:58 +0000 (01:07 +0200)]
drm/vc4: Add support for more analog TV standards

Add support for the following composite output modes (all of them are
somewhat more obscure than the previously defined ones):

- NTSC_443 - NTSC-style signal with the chroma subcarrier shifted to
  4.43361875 MHz (the PAL subcarrier frequency). Never used for
  broadcasting, but sometimes used as a hack to play NTSC content in PAL
  regions (e.g. on VCRs).
- PAL_N - PAL with alternative chroma subcarrier frequency,
  3.58205625 MHz. Used as a broadcast standard in Argentina, Paraguay
  and Uruguay to fit 576i50 with colour in 6 MHz channel raster.
- PAL60 - 480i60 signal with PAL-style color at normal European PAL
  frequency. Another non-standard, non-broadcast mode, used in similar
  contexts as NTSC_443. Some displays support one but not the other.
- SECAM - French frequency-modulated analog color standard; also have
  been broadcast in Eastern Europe and various parts of Africa and Asia.
  Uses the same 576i50 timings as PAL.

Also added some comments explaining color subcarrier frequency
registers.

Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
2 years agodrm/vc4: Fix definition of PAL-M mode
Mateusz Kwiatkowski [Wed, 14 Jul 2021 23:07:53 +0000 (01:07 +0200)]
drm/vc4: Fix definition of PAL-M mode

PAL-M is a Brazilian analog TV standard that uses a PAL-style chroma
subcarrier at 3.575611[888111] MHz on top of 525-line (480i60) timings.
This commit makes the driver actually use the proper VEC preset for this
mode instead of just changing PAL subcarrier frequency.

DRM mode constant names have also been changed, as they no longer
correspond to the "NTSC" or "PAL" terms.

Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
2 years agodrm/vc4: Refactor VEC TV mode setting
Mateusz Kwiatkowski [Wed, 14 Jul 2021 23:07:49 +0000 (01:07 +0200)]
drm/vc4: Refactor VEC TV mode setting

Change the mode_set function pointer logic to declarative config0,
config1 and custom_freq fields, to make TV mode setting logic more
concise and uniform.

Additionally, remove the superfluous tv_mode field, which was redundant
with the mode field in struct drm_tv_connector_state.

Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
2 years agodrm/vc4: Fix timings for VEC modes
Mateusz Kwiatkowski [Wed, 14 Jul 2021 23:07:30 +0000 (01:07 +0200)]
drm/vc4: Fix timings for VEC modes

This commit fixes vertical timings of the VEC (composite output) modes
to accurately represent the 525-line ("NTSC") and 625-line ("PAL") ITU-R
standards.

Previous timings were actually defined as 502 and 601 lines, resulting
in non-standard 62.69 Hz and 52 Hz signals being generated,
respectively.

Changes to vc4_crtc.c have also been made, to make the PixelValve
vertical timings accurately correspond to the DRM modeline in interlaced
modes. The resulting VERTA/VERTB register values have been verified
against the reference values set by the Raspberry Pi firmware.

Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
2 years agodrm/vc4: Fix margin calculations for the right/bottom edges
Dave Stevenson [Mon, 12 Jul 2021 11:27:59 +0000 (12:27 +0100)]
drm/vc4: Fix margin calculations for the right/bottom edges

The calculations clipped the right/bottom edge of the clipped
range based on the left/top margins.

Fixes: 666e73587f90 ("drm/vc4: Take margin setup into account when updating planes")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodwc_otg: Update NetBSD usb.h header licence
Phil Elwell [Mon, 5 Jul 2021 18:38:21 +0000 (19:38 +0100)]
dwc_otg: Update NetBSD usb.h header licence

NetBSD have changed their licensing requirements such that the 2-clause
licence is preferred. Update usb.h in the downstream dwc_otg code
accordingly.

See https://www.netbsd.org/about/redistribution.html for more
information.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agodrm/vc4: Fix timings for interlaced modes
kFYatek [Tue, 22 Jun 2021 23:11:26 +0000 (01:11 +0200)]
drm/vc4: Fix timings for interlaced modes

Increase the number of post-sync blanking lines on odd fields instead of
decreasing it on even fields. This makes the total number of lines
properly match the modelines.

Additionally fix the value of PV_VCONTROL_ODD_DELAY, which did not take
pixels_per_clock into account, causing some displays to invert the
fields when driven by bcm2711.

Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
2 years agodrm/vc4: hdmi: Simplify the connector state retrieval
Maxime Ripard [Wed, 27 Oct 2021 13:38:50 +0000 (14:38 +0100)]
drm/vc4: hdmi: Simplify the connector state retrieval

When we have the entire DRM state, retrieving the connector state only
requires the drm_connector pointer. Fortunately for us, we have
allocated it as a part of the vc4_hdmi structure, so we can retrieve get
a pointer by simply accessing our field in that structure.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
2 years agodrm/vc4: Increase the core clock based on HVS load
Maxime Ripard [Wed, 26 May 2021 14:13:02 +0000 (16:13 +0200)]
drm/vc4: Increase the core clock based on HVS load

Depending on a given HVS output (HVS to PixelValves) and input (planes
attached to a channel) load, the HVS needs for the core clock to be
raised above its boot time default.

Failing to do so will result in a vblank timeout and a stalled display
pipeline.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
2 years agoclk: Always clamp the rounded rate
Maxime Ripard [Wed, 5 May 2021 13:35:34 +0000 (15:35 +0200)]
clk: Always clamp the rounded rate

The current core while setting the min and max rate properly in the
clk_request structure will not make sure that the requested rate is
within these boundaries, leaving it to each and every driver to make
sure it is.

Add a clamp call to make sure it's always done.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
2 years agodrm/atomic: Don't fixup modes that haven't been reset
Dave Stevenson [Thu, 7 Jan 2021 16:30:55 +0000 (16:30 +0000)]
drm/atomic: Don't fixup modes that haven't been reset

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodrm/vc4: Add correct stop condition to vc4_dsi_encoder_disable iteration
Dave Stevenson [Thu, 15 Apr 2021 15:18:16 +0000 (16:18 +0100)]
drm/vc4: Add correct stop condition to vc4_dsi_encoder_disable iteration

vc4_dsi_encoder_disable is partially an open coded version of
drm_bridge_chain_disable, but it missed a termination condition
in the loop for ->disable which meant that no post_disable
calls were made.

Add in the termination clause.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodrm/vc4: Fix dsi0 interrupt support.
Dave Stevenson [Wed, 10 Feb 2021 18:46:22 +0000 (18:46 +0000)]
drm/vc4: Fix dsi0 interrupt support.

DSI0 seemingly had very little or no testing as a load of
the register mappings were incorrect/missing, so host
transfers always timed out due to enabling/checking incorrect
bits in the interrupt enable and status registers.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodrm/vc4: Register dsi0 as the correct vc4 encoder type
Dave Stevenson [Mon, 8 Feb 2021 11:22:01 +0000 (11:22 +0000)]
drm/vc4: Register dsi0 as the correct vc4 encoder type

vc4_dsi was registering both dsi0 and dsi1 as VC4_ENCODER_TYPE_DSI1
which seemed to work OK for a single DSI display, but fails
if there are two DSI displays connected.

Update to register the correct type.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodrm/vc4: Correct pixel order for DSI0
Dave Stevenson [Thu, 11 Feb 2021 18:37:04 +0000 (18:37 +0000)]
drm/vc4: Correct pixel order for DSI0

For slightly unknown reasons, dsi0 takes a different pixel format
to dsi1, and that has to be set in the pixel valve.

Amend the setup accordingly.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodrm/vc4: hdmi: Convert to the new clock request API
Dom Cobley [Tue, 13 Apr 2021 13:10:03 +0000 (14:10 +0100)]
drm/vc4: hdmi: Convert to the new clock request API

The new clock request API allows us to increase the rate of the
core clock as required during mode set while decreasing it when
we're done, resulting in a better power-efficiency.

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
2 years agovc4/drm: vc4_plane: Remove subpixel positioning check
Dom Cobley [Mon, 15 Mar 2021 13:28:06 +0000 (13:28 +0000)]
vc4/drm: vc4_plane: Remove subpixel positioning check

There is little harm in ignoring fractional coordinates
(they just get truncated).

Without this:
modetest -M vc4 -F tiles,gradient -s 32:1920x1080-60 -P89@74:1920x1080*.1.1@XR24

is rejected. We have the same issue in Kodi when trying to
use zoom options on video.

Note: even if all coordinates are fully integer. e.g.
src:[0,0,1920,1080] dest:[-10,-10,1940,1100]

it will still get rejected as drm_atomic_helper_check_plane_state
uses drm_rect_clip_scaled which transforms this to fractional src coords

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
2 years agovc4/drm: Avoid full hdmi audio fifo writes
Dom Cobley [Sun, 24 Jan 2021 15:44:10 +0000 (15:44 +0000)]
vc4/drm: Avoid full hdmi audio fifo writes

We are getting occasional VC4_HD_MAI_CTL_ERRORF in
HDMI_MAI_CTL which seem to correspond with audio dropouts.

Reduce the threshold where we deassert DREQ to avoid the fifo overfilling

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
2 years agodrm/vc4: Change the default DPI format to being 18bpp, not 24.
Dave Stevenson [Fri, 12 Feb 2021 17:31:37 +0000 (17:31 +0000)]
drm/vc4: Change the default DPI format to being 18bpp, not 24.

DPI hasn't really been used up until now, so the default has
been meaningless.
In theory we should be able to pass the desired format for the
adjacent bridge chip through, but framework seems to be missing
for that.

As the main device to use DPI is the VGA666 or Adafruit Kippah,
both of which use RGB666, change the default to being RGB666 instead
of RGB888.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agovc4: Clear unused infoframe packet RAM registers
Dom Cobley [Tue, 10 Nov 2020 20:04:08 +0000 (20:04 +0000)]
vc4: Clear unused infoframe packet RAM registers

Using a hdmi analyser the bytes in packet ram
registers beyond the length were visible in the
infoframes and it flagged the checksum as invalid.

Zeroing unused words of packet RAM avoids this

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
2 years agovc4_hdmi: Report that 3d/stereo is allowed
Dom Cobley [Mon, 9 Nov 2020 19:49:32 +0000 (19:49 +0000)]
vc4_hdmi: Report that 3d/stereo is allowed

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
2 years agodrm/vc4: Add the 2711 HVS as a suitable DMA node
Dave Stevenson [Mon, 26 Oct 2020 12:38:27 +0000 (12:38 +0000)]
drm/vc4: Add the 2711 HVS as a suitable DMA node

With vc4-drv node not being under /soc on Pi4, we need to
adopt the correct DMA parameters from a suitable sub-component.
Add "brcm,bcm2711-hvs" to that list of components.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodrm/vc4: Add all the HDMI registers into the debugfs dumps
Dave Stevenson [Wed, 21 Oct 2020 17:34:56 +0000 (18:34 +0100)]
drm/vc4: Add all the HDMI registers into the debugfs dumps

The vc5 HDMI registers hadn't been added into the debugfs
register sets, therefore weren't dumped on request.
Add them in.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodrm/vc4: Add debugfs node that dumps the current display lists
Dave Stevenson [Tue, 6 Oct 2020 17:44:42 +0000 (18:44 +0100)]
drm/vc4: Add debugfs node that dumps the current display lists

This allows easy analysis of display lists when debugging.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>