Commit Graph

977925 Commits

Author SHA1 Message Date
Phil Elwell
7136c8f9c8 ARM: dts: Add Pi Zero 2 support
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
oldstable_20211118 stable_20211118
2021-11-18 15:52:35 +00:00
Jonathan Bell
abff5012ab dwc_otg: pay attention to qh->interval when rescheduling periodic queues
A regression introduced in https://github.com/raspberrypi/linux/pull/3887
meant that if the newly scheduled transfer immediately returned data, and
the driver resubmitted a single URB after every transfer, then the effective
polling interval would end up being approx 1ms.

Use the larger of SCHEDULE_SLOP or the configured endpoint interval.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
1.20211029 1.20211007
2021-10-06 16:30:47 +01:00
Dave Stevenson
6237d09759 dtoverlays: Add overlay for ST7735R (160x128) TinyDRM driver
Adds an overlay to configure the TinyDRM driver for ST7735R
based 160x128 and 128x128 (untested) displays such as the
Adafruit 1.8" display.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2021-10-04 16:30:53 +01:00
Lee Jackson
1faafd963e overlays: Add imx519-overlay.dts
Added overlays for enabling IMX519 and add the
relevant information to the README.

Signed-off-by: Lee Jackson <info@arducam.com>
2021-09-30 16:47:22 +01:00
Lee Jackson
e19e774ee6 configs: Add CONFIG_VIDEO_IMX519=m
Include the driver module for the IMX519.

Signed-off-by: Lee Jackson <info@arducam.com>
2021-09-30 16:47:22 +01:00
Arducam
7ef59137fe media: i2c: imx519: Advertise embedded data node on media pad 1
This commit updates the imx519 driver to adverise support for embedded
data streams.

The imx519 sensor subdevice overloads the media pad to differentiate
between image stream (pad 0) and embedded data stream (pad 1) when
performing the v4l2_subdev_pad_ops functions.

Signed-off-by: Lee Jackson <info@arducam.com>
2021-09-30 16:47:22 +01:00
Lee Jackson
61b7a5240c media: i2c: Add driver for IMX519 sensor
Adds a driver for the 16MPix IMX519 CSI2 sensor.
Whilst the sensor supports 2 or 4 CSI2 data lanes, this driver
currently only supports 2 lanes.

The following Bayer modes are currently available:

4656x3496 10-bit @ 10fps
3840x2160 10-bit (cropped) @ 21fps
2328x1748 10-bit (binned) @ 30fps
1920x1080 10-bit (cropped/binned) @ 60fps
1280x720 10-bit (cropped/binned) @ 120fps

Signed-off-by: Lee Jackson <info@arducam.com>
2021-09-30 16:47:22 +01:00
Lee Jackson
dd23e9e071 media: 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>
2021-09-30 16:47:22 +01:00
Juerg Haefliger
5ab0b197d5 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>
2021-09-29 11:20:23 +01:00
Juerg Haefliger
00e7121838 Revert "mmc: sdhci-iproc: Fix vmmc regulators on iProc"
This reverts commit aed19399a0.

Commit 6c92ae1e45 ("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>
2021-09-29 11:20:23 +01:00
Juerg Haefliger
7c9c402b0c drm/vc4: hdmi: Fix bvb clock enable error checking
Check for errors only if we actually tried to enable the bvb clock.

Fixes: 01a6d727b4 ("vc4/drm: hdmi: Handle case when bvb clock is null")
Signed-off-by: Juerg Haefliger <juergh@canonical.com>
2021-09-29 11:20:23 +01:00
Maxime Ripard
f694d1cfee drm/vc4: Fix out of order frames during asynchronous page flips
When doing an asynchronous page flip (PAGE_FLIP ioctl with the
DRM_MODE_PAGE_FLIP_ASYNC flag set), the current code waits for the
possible GPU buffer being rendered through a call to
vc4_queue_seqno_cb().

On the BCM2835-37, the GPU driver is part of the vc4 driver and that
function is defined in vc4_gem.c to wait for the buffer to be rendered,
and once it's done, call a callback.

However, on the BCM2711 used on the RaspberryPi4, the GPU driver is
separate (v3d) and that function won't do anything. This was working
because we were going into a path, due to uninitialized variables, that
was always scheduling the callback.

However, we were never actually waiting for the buffer to be rendered
which was resulting in frames being displayed out of order.

The generic API to signal those kind of completion in the kernel are the
DMA fences, and fortunately the v3d drivers supports them and signal
when its job is done. That API also provides an equivalent function that
allows to have a callback being executed when the fence is signalled as
done.

Let's change our driver a bit to rely on the previous function for the
older SoCs, and on DMA fences for the BCM2711.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
2021-09-28 15:05:51 +01:00
Dom Cobley
6fc5285c39 Revert "firmware: Updated mailbox header"
This reverts commit 02038a75fb.
2021-09-28 13:49:52 +01:00
Dom Cobley
2b33debb8b Revert "raspberrypi-firmware: Export the general transaction function."
This reverts commit 121592a1f507d2b5900db5f7c6510b532563dc09.
2021-09-28 13:49:52 +01:00
madimario
ab7e4aee56 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>
1.20210928
2021-09-28 09:20:06 +01:00
Dave Stevenson
ce646f7446 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>
2021-09-27 10:16:39 +01:00
GabyPCgeeK
b7c3c9ab20 overlays: Add generic mcp2515 overlay
Can configure mcp2515 on spi0/1/2 without the need for multiple overlays.
2021-09-27 09:43:21 +01:00
Guennadi Liakhovetski
6fd719a261 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>
2021-09-27 08:35:07 +01:00
Dave Stevenson
edded5e023 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>
2021-09-23 14:53:43 +01:00
Dave Stevenson
81a0dd879c 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>
2021-09-23 14:53:43 +01:00
Dave Stevenson
4e428b8095 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>
2021-09-23 14:53:43 +01:00
Dave Stevenson
618b1b9023 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>
2021-09-23 14:53:43 +01:00
Dave Stevenson
10e3ca474c 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>
2021-09-23 14:53:43 +01:00
Dave Stevenson
c284110996 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>
2021-09-23 14:53:43 +01:00
Dave Stevenson
a1f7bcf44d 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>
2021-09-23 14:53:43 +01:00
Dave Stevenson
b7e6b495ef 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>
2021-09-23 14:53:43 +01:00
Dave Stevenson
63ac2c7280 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>
2021-09-23 14:53:43 +01:00
Dave Stevenson
a39fab70b5 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>
2021-09-23 14:53:43 +01:00
Dave Stevenson
7792edd663 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>
2021-09-23 14:53:43 +01:00
John Cox
6ab953939b 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>
2021-09-23 13:38:58 +01:00
John Cox
562ee106ce 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>
2021-09-23 13:38:58 +01:00
Phil Elwell
094e36e10c 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>
2021-09-23 13:37:27 +01:00
John Cox
a5d2df01fe 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>
2021-09-22 15:32:17 +01:00
Phil Elwell
3e1698ed50 ARM: proc-v7: Retry uncached stmia if necessary
A failure of some CPU cores to come online has been traced to the
failure of a stm instruction while the cache is disabled. The symptom
is that the saved values read back as zeroes, a catastrophic error since
one of the values is a return address.

This patch forces a readback and retry until the correct value is
returned,

Notes:

At this stage in the boot process the core is running with its cache
disabled. Before enabling the cache its contents must be explicitly
invalidated, a process that requires quite a few registers that the
caller must preserve. Evidence suggests that something is writing a
block of zeroes over that space at a time when all other cores should
be idle, possibly some kind of write-combiner, and retrying is an
attempt to avoid the problem.

The previous attempted fix (forcing the accesses to only be 4-byte
aligned) appears to have only worked for a while and likely for less
obvious reasons such as a change in code alignment.

See: https://github.com/Hexxeh/rpi-firmware/issues/232

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2021-09-20 17:06:58 +01:00
Phil Elwell
36d449a94f Revert "ARM: proc-v7: Force misalignment of early stmia"
This reverts commit fe4cc0ed59.

The speculative patch that this commit reverts is proving to not be
effective any more, so revert it and try a new approach.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2021-09-20 17:06:58 +01:00
Phil Elwell
27f5c22ebb 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>
2021-09-17 15:20:41 +01:00
Jeff Geerling
4117cba235 drm/amdgpu: Add missing conversion of is_hdr_metadata_different for amdgpu 2021-09-16 21:32:19 +01:00
Dom Cobley
150072b5ec staging/bcm2835-v4l2_codec: Fix for encode selection API
Matches correct behaviour from DECODE and DEINTERLACE

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
2021-09-15 16:17:29 +01:00
Dom Cobley
43c62cbb9d 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>
2021-09-15 16:17:29 +01:00
Dave Stevenson
316ca31e50 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>
2021-09-15 16:17:29 +01:00
Dave Stevenson
3cae59f7ae 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>
2021-09-14 17:03:59 +01:00
Dave Stevenson
523baefd5e 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>
2021-09-14 17:03:59 +01:00
Dave Stevenson
5d9368e4ae 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>
2021-09-14 17:03:59 +01:00
Dave Stevenson
fd1b596106 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>
2021-09-14 17:03:59 +01:00
Dave Stevenson
44a21e3580 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>
2021-09-14 17:03:59 +01:00
Dave Stevenson
8ef103e0e9 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>
2021-09-14 17:03:59 +01:00
Dave Stevenson
8d6056ed9b 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>
2021-09-14 17:03:59 +01:00
Dave Stevenson
78303b7313 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>
2021-09-14 17:03:59 +01:00
Maxime Ripard
c5def07660 drm/vc4: hdmi: Simplify exit path of vc4_hdmi_encoder_pre_crtc_configure
The exit path of vc4_hdmi_encoder_pre_crtc_configure() is fairly hard to
maintain given its numerous error conditions.

Switch to a goto based approach to simplify it.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
2021-09-14 14:52:01 +01:00
Maxime Ripard
f8d389e25f drm/vc4: hdmi: Remove unnecessary pm_runtime_put
Unlike pm_runtime_get_sync(), pm_runtime_resume_and_get() doesn't take a
reference on failure, so we don't need to call pm_runtime_put() on
failure.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
2021-09-14 14:52:01 +01:00