Distinguish between releasing the watchdog without requesting that it is
stopped, and failing to stop it when requested. The former is standard
behaviour for systemd, while the latter may be unexpected.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
A conditional had been left as == GEN_6_C, when it also applied
to GEN_6_D, resulting in an invalid change to the dlist on async
updates.
Fixes: b7b14b31c8 ("drm/vc4: plane: Add support for 2712 D-step.")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Support vertical flip by setting REG_VREVERSE.
Additional registers also needs to be set per mode, according
to the readout direction (normal/inverted) as mentioned in the
data sheet.
Since the register IMX335_REG_AREA3_ST_ADR_1 is based on the
flip (and is set via vflip related registers), it has been
moved out of the 2592x1944 mode regs.
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Tommaso Merciai <tomm.merciai@gmail.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
In commit 81495a59ba ("media: imx335: Fix active area height discrepency")
the height for the mode struct was rectified to '1944'. However, the
name of mode struct is still reflecting to '1940'. Update it.
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Tommaso Merciai <tomm.merciai@gmail.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
The existing driver claims AHT20 support in i2c_device_id, but fails to:
1. Use the correct init command (0xBE for AHT20 vs 0xE1 for AHT10)
2. Omit AHT10_MODE_CYC which AHT20 doesn't support/require
Add proper initialization sequence and include "aosong,aht20" in the
device tree match table to fully support the AHT20.
Signed-off-by: Josh Martinez <8892161+joshermar@users.noreply.github.com>
As a follow-up to commit ef79eea9e4 ("drm/vc4: plane: Enable scaler
for YUV444 on GEN6"), the image looks a little soft when rendering at
1:1 due to the scaling filter being enabled.
Switch to using the nearest neighbour filter automatically when
not scaling in YUV444 to compensate.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
GEN6 requires the luma scaler to be enabled for YUV444 to
be rendered at 1:1, otherwise the source plane isn't rendered.
Fixes: 076eedaf76 ("drm/vc4: hvs: Add support for BCM2712 HVS")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
YUV444 support isn't officially supported by the hardware, but
worked if you told it the image was YUV422 with double the width
and altered chroma scaling.
Adding BCM2712 support gained a fetcher memory (UPM). The code
handling UPM allocations didn't have a case for YUV444, so only
allocated based on the base width, and therefore underflowed.
Increase the UPM allocation size for the luma plane of YUV444
to match.
Fixes: 076eedaf76 ("drm/vc4: hvs: Add support for BCM2712 HVS")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
At a high FPS with RAW10, there is frame corruption for 480p because the
rate_factor of 2 is used with the normal 2x2 bining [1]. This commit
ties the rate_factor to the selected binning mode. For the 480p mode,
analog 2x2 binning mode with a rate_factor of 2 is always used. For the
1232p mode the normal 2x2 binning mode is used for RAW10 while analog
2x2 binning mode is used for RAW8.
[1] raspberrypi#5493
Signed-off-by: Vinay Varma <varmavinaym@gmail.com>
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reworked due to upstream changes
The enum binning_mode is redundant, it only uses values from the earlier
defined binning modes. Remove it.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Commit 0af46fbc33 ("media: i2c: imx219: Calculate crop rectangle
dynamically") meant that the 1920x1080 switched from using no binning
to using vertical binning but no horizontal binning.
Restore the original behaviour by ensuring the two binning settings
are the same.
Fixes: 0af46fbc33 ("media: i2c: imx219: Calculate crop rectangle dynamically")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
By default, the System Exit Latency and Maximum Exit Latency are used to
calculate hub port U1 and U2 timeout values. This has the effect of
aggressively power-managing a SuperSpeed link but devices are known to
report unfeasibly short device exit latencies in their descriptors,
which under certain usage conditions can significantly degrade
throughput as the link spends longer retraining than being in a useable
state.
The Intel heuristic approach calculates a reasonably large
endpoint-dependent U1 timeout, and uses a minimum U2 timeout that is
several multiples of typical U2 exit latencies.
Add a module parameter that defaults to using this scheme.
This should have the effect of squelching interop edge-cases where LPM
noticeably degrades performance, and avoid the usual workaround where
userspace manually disables it.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
Certain versions of the VL805 firmware manipulate the endpoint Link
Control register to toggle ASPM on/off based on workload, but these
versions also report 0 in the Device Capability Acceptable Latency field
leaving the RC with ASPM disabled.
As it turns out, this EP has a broken L0s implementation so a) override
L1 latency to a sensible value and b) mask L0s.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
The existing implementation for clkreq-mode="safe" leaves the HARD_DEBUG
with both control bits clear. This can cause link failure if L1
sub-states are enabled and if either of these conditions occurrs:
- The platform does not connect the CLRKEQ# signal to the EP, and a
pull-up is present on the line
- The platform connects the signal to the EP, and the EP enters an L1.x
or ClkPM state
Additional register bits in the HARD_DEBUG register can be used to force
the RC to drive CLKREQ# low. Also, un-advertise L1ss as a) additional
power savings can't be realised and b) enabling L1ss may incur
additional wake latency from L1.0.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
The number of words to fetch for SAND formats on vc6 needs to account
for all pixels requested by width.
If cropping fractional pixels, then the width was being increased, but
fetch_count had already been computed. That led to insufficient words
being fetched, and the HVS locked up solid.
Apply the fixup for fractional pixel source cropping before computing
fetch_count.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
BCM2712/vc6 uses 256bit words when reading in P030/SAND128,
increased from 128bit on BCM2711/vc5.
Update the code for cropping the read area to handle the correct
word length.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Add two features that assist in diagnosing link instability issues.
The debugfs additions allow for snapshots of the Physical Layer
statistics registers to be taken, during either free-running capture or
after a hardware-controlled capture interval.
To arm the capture engine (and reset the stats counters), write an
integer N to:
/sys/kernel/debug/pcie@<addr>/stats_trigger
The engine will run forever with a value of 0, or disarm after N
microseconds.
To snapshot the hardware stats counters, write to:
/sys/kernel/debug/pcie@<addr>/stats_snapshot
Reading this file will return the snapshot. If no writes have occurred
since boot, the snapshot will be of the initial link training period.
The ltssm_trace module parameter printk's the states during initial link
startup, in situations where failure to establish the link is a fatal
error.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
Remove a bogus memory alignment check - transfers will be run bytewise
if needed - and add a check that the overall length is multiple of the
register size, otherwise there is residue.
See: https://github.com/raspberrypi/linux/issues/6733
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Commit 69dbba71ac ("drm/vc4: Add algorithmic handling for SAND")
lost a multiplication by the tile width when doing the pointer arithmetic
for cropping off columns for vc6.
Correct that computation.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The Ilitek ILI9806E driver is used in the Pimoroni HyperPixel4
and potentially other displays. Whilst it can support multiple
interfaces, this driver only accounts for SPI configuration and
DPI video data.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
This property can be used to delay deassertion of external fundamental
reset, which may be useful for endpoints that require an extended time for
internal setup to complete.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
Some endpoints need longer than the minimum Tperst_clk time of 100us
that the PCIe specification allows for, as they may need to sequence
internal resets off the stable output of internal PLLs prior to removal
of fundamental reset. PCIe switches are an especially bad case, in some
cases requiring up to 100 milliseconds for stable downstream link
behaviour.
Parse the DT property brcm,tperst-clk-ms and use this to hold PERST# low
during brcm_pcie_start_link().
The BRCM RC typically outputs 200us of stable refclk before deasserting
PERST#. By masking/forcing the output signal while deasserting the
internal reset, the effect is to extend the length of time that the
refclk is active and stable before PERST# is released.
The TX lanes will enter the Polling state before PERST# is released, but
this appears to be harmless.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
Some platforms may require an extended time with refclk active before
PERST# is released. Add a property to let the RC driver know how long to
wait.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
The BCM2712 root complexes can interpret priority signalling in two
different ways, based on the incoming Traffic Class of a TLP.
The TLP TCs are assigned to separate internal request/response queues,
and assigned different AXI IDs. These queues can have outgoing AXI
transactions tagged based on:
- Static QoS values
- Dynamic QoS through internal backpressure
- Dynamic QoS with elevation based on Vendor Messages received by the RC
The VDM mechanism is of limited use due to implementation bugs, but the
implicit reordering due to separate ID assignment allows higher-priority
traffic from an EP to overtake other traffic in the RC and rest of the
system.
RP1 assigns TCs based on its internal bus managers, and internally tags
read requests to allow out-of-order completions, so these two features
operate in concert to provide priority service to e.g. MIPI camera or
display traffic.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
There is configurable priority forwarding hardware in this variant of the
Root Complex controller. Add optional properties to configure FIFO
backpressure or Vendor-Defined Message priority forwarding.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
The PHY MDIO register map is different on BCM2712, and as the PHY input
clock is 54MHz not 100MHz, enabling refclk SSC is both broken and
unfixable.
Mask out attempts to enable SSC with a controller quirk.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
It appears that bits in the Root Control Register are reset with
perst_n, which means the PCI layer's call to enable CRS prior to
adding/scanning the bus has no effect. Open-code the enable in
brcm_pcie_start_link as a workaround.
Without CRS visibility, configuration reads issued by the CPU don't
retire if the endpoint returns a CRS response - the RC will poll until a
(large) timeout is reached. This means the core can stall for a long
time during boot.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
These chips use a UBUS-AXI bridge component that has configurable
timeout and error response handling.
Suppress AXI error responses to CPU requests, otherwise these are fatal
if they reach the ARM cluster, and set reasonably large timeouts for
both Mem and Cfg requests.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
Pitch has no meaning if the modifier isn't DRM_FORMAT_MOD_LINEAR
as there is no guarantee that the value passed follows the
pattern that pitch * height = size.
Remove that check from framebuffer_check.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The SAND modifier with height 0 is now using the provided pitch as
the column stride, but the UBM allocation needs to be done based
on the plane width.
Recompute the width in these conditions.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The SAND handling had been using what was believed to be a runtime
parameter in the modifier, however that has been clarified that
all permitted variants of the modifier must be advertised, so
making it variable wasn't practical.
With a rationalisation of how the producers of this format are
configured, we can switch to a variant that doesn't have as much
variation, and can be configured such that only 2 options are
required.
Add a modifier with value 0 to denote that the height of the luma
column matches the buffer height, and chroma column will be half
that due to YUV420.
A modifier of 1 denotes that the height of the luma column still
matches the buffer height, but the chroma column height is the same.
This can be used to replicate the previous behaviour.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
vc4's debugfs support was updated with drm_debugfs_entry whilst
BCM2712 support was in progress, and missed that the lookup
in vc6_hvs_debugfs_dlist still followed the old pattern.
Correct that lookup to avoid an invalid dereference.
Fixes: f7af8ae9d3 ("drm/vc4: hvs: Add support for BCM2712 HVS")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Supporting GL rendering of the new HEVC decoder pixel formats requires
Mesa 24.2.5 or later. There are a couple of minor issues holding up
switching to Mesa 24.
Drop the new pixel formats from enum_fmt so that FFMpeg will use
the older ones that earlier versions of Mesa do support.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The BCM2711 and BCM2712 SoCs used on Rapsberry Pi 4 and Raspberry
Pi 5 boards include an HEVC decoder block. Add a driver for it.
Signed-off-by: John Cox <john.cox@raspberrypi.com>
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
media: hevc_dec: Add in downstream single planar SAND variant
Upstream will take the multi-planar SAND format, but add back
in the downstream single planar variant for backwards compatibility
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
media: hevc_dec: Add module parameter for video_nr
To avoid user complaints that /dev/video0 isn't their USB
webcam, add downstream patch that allows setting the preferred
video device number.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Adds a binding for the HEVC decoder found on the BCM2711 / Raspberry Pi 4,
and BCM2712 / Raspberry Pi 5.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Add V4L2_PIXFMT_NV12MT_COL128 and V4L2_PIXFMT_NV12MT_10_COL128
to describe the Raspberry Pi HEVC decoder NV12 multiplanar formats.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The Raspberry Pi HEVC decoder uses a tiled format based on
columns for 8 and 10 bit YUV images, so document them as
NV12MT_COL128 and NV12MT_10_COL128.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Keep track of the number of requests and request objects of a media
device. Helps to verify that all request-related memory is freed.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
By default when the last request object is completed, the whole
request completes as well.
But sometimes you want to manually complete a request in a driver,
so add a manual complete mode for this.
In req_queue the driver marks the request for manual completion by
calling media_request_mark_manual_completion, and when the driver
wants to manually complete the request it calls
media_request_manual_complete().
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
commit 59ac702a93 ("drm/vc4: Get the rid of DRM_ERROR()") converted
all calls to DRM_ERROR into drm_err, but also converted one DRM_DEBUG
into a drm_err.
Switch it back to drm_dbg.
Fixes: 59ac702a93 ("drm/vc4: Get the rid of DRM_ERROR()")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
If an HDMI connector has no EDID and the mode is set via the
kernel command line, then drm_reset_display_info() is the only
thing that will have set up any of connector->display_info.
With commit 26ff1c38fc ("drm/connector: hdmi: Compute bpc
and format automatically"), it is now checked that
DRM_COLOR_FORMAT_RGB444 is supported. Whilst it doesn't fail
the request, it does log dev_warn for every commit, spamming
the log.
For HDMI connectors initialise the color_format field to say
it supports RGB444.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
It was noted that if PV1 was in use to drive DSI1, then the
writeback connector could not be used as HVS channel 2 was
already in use.
The HVS allows PV1 (HVS output 2) to be driven by any HVS
channel via the DSP3_MUX setting, but that was hardcoded to be
either 2 (for PV1) or disabled for TXP.
Expand the available channels field for PV1, and configure
DSP3_MUX accordingly.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Slave addresses for DMA are meant to be supplied as physical addresses
(contrary to what struct snd_dmaengine_dai_dma_data does).
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Add ALSA jack detection to the vc4-hdmi audio driver so userspace knows
when to add/remove HDMI audio devices.
Signed-off-by: David Turner <david.turner@raspberrypi.com>
bcm2835_dma_suspend_late is only used if CONFIG_PM_SLEEP is defined,
so make it's presence similarly conditional to avoid a build warning
(and hence error).
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
These fields should not be set by either the user or the kernel driver
so remove them. Replace them with padding bytes to maintain backward
compatibility with existing userland applications.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>