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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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)
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)
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Phil Elwell [Wed, 31 Jul 2019 16:36:34 +0000 (17:36 +0100)]
drm/vc4: A present but empty dmas disables audio
Overlays are unable to remove properties in the base DTB, but they
can overwrite them. Allow a present but empty 'dmas' property
to also disable the HDMI audio interface.
See: https://github.com/raspberrypi/linux/issues/2489
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Dave Stevenson [Tue, 19 May 2020 15:20:30 +0000 (16:20 +0100)]
drm/vc4: Add FKMS as an acceptable node for dma ranges.
Under FKMS, the firmware (via FKMS) also requires the VideoCore cache
aliases for image planes, as defined by the dma-ranges under /soc.
Add rpi-firmware-kms to the list of acceptable nodes to look for
to copy dma config from.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 15 Dec 2021 09:17:39 +0000 (10:17 +0100)]
drm/vc4: plane: Add support for YUV color encodings and ranges
The BT601/BT709 color encoding and limited vs full
range properties were not being exposed, defaulting
always to BT601 limited range.
Expose the parameters and set the registers appropriately.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://lore.kernel.org/r/20211215091739.135042-4-maxime@cerno.tech
Dave Stevenson [Wed, 15 Dec 2021 09:17:38 +0000 (10:17 +0100)]
drm/vc4: plane: Add support for DRM_FORMAT_P030
The P030 format, used with the DRM_FORMAT_MOD_BROADCOM_SAND128 modifier,
is a format output by the video decoder on the BCM2711.
Add native support to the KMS planes for that format.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://lore.kernel.org/r/20211215091739.135042-3-maxime@cerno.tech
Joerg Quinten [Fri, 18 Jun 2021 11:02:29 +0000 (13:02 +0200)]
Support RPi DPI interface in mode6 for 18-bit color
A matching media bus format was added and an overlay for using it,
both with FB and VC4 was added as well.
Signed-off-by: Joerg Quinten <aBUGSworstnightmare@gmail.com>
Dave Stevenson [Tue, 19 May 2020 13:54:28 +0000 (14:54 +0100)]
drm/vc4: Adopt the dma configuration from the HVS or V3D component
vc4_drv isn't necessarily under the /soc node in DT as it is a
virtual device, but it is the one that does the allocations.
The DMA addresses are consumed by primarily the HVS or V3D, and
those require VideoCore cache alias address mapping, and so will be
under /soc.
During probe find the a suitable device node for HVS or V3D,
and adopt the DMA configuration of that node.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dom Cobley [Thu, 15 Jul 2021 14:55:22 +0000 (15:55 +0100)]
media: v4l2-subdev: add subdev-wide state struct
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Jakub Vaněk [Wed, 7 Jul 2021 20:48:20 +0000 (22:48 +0200)]
media: bcm2835-unicam: Forward input status from subdevice
The vidioc_enum_input() v4l2 ioctl is capable of returning
sensor/input status as well. This is used in current
GStreamer HEAD for signal detection [1].
bcm2835-unicam does handle this syscall, but it didn't ask
the subdevice driver about the input status. The input then
appeared as always present.
This commit adds the necessary query. There is a precedent for
this - the R-Car VIN V4L2 driver does a similar call [2].
[1]: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/blob/
ce0be27caf69aa9d96b73bc2b50737451b6f6936/sys/v4l2/gstv4l2src.c#L553
[2]: https://github.com/raspberrypi/linux/blob/
7fb9d006d3ff3baf2e205e0c85c4e4fd0a64fcd0/drivers/media/platform/rcar-vin/rcar-v4l2.c#L548
Signed-off-by: Jakub Vaněk <linuxtardis@gmail.com>
Dom Cobley [Thu, 8 Jul 2021 12:48:11 +0000 (13:48 +0100)]
bcm2711_thermal: Don't clamp temperature at zero
The temperature sensor is valid below zero and the linux framework is happy with it.
See: https://www.raspberrypi.org/forums/viewtopic.php?f=98&t=315382
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Maxime Ripard [Wed, 23 Jun 2021 09:48:35 +0000 (11:48 +0200)]
dt-bindings: display: vc4: Add phandle to the firmware
The vc4 driver will need to tell the firmware that it takes over the
display for the firmware to free its resources (lower the clock, free
some memory, etc.)
Let's add an optional phandle to our firmware node.
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Maxime Ripard [Wed, 23 Jun 2021 09:47:38 +0000 (11:47 +0200)]
dt-bindings: clk: raspberrypi: Remove unused property
The raspberrypi,firmware property has been documented as required in the
binding but was never actually used in the final version of the binding.
Remove it.
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
David Plowman [Tue, 29 Jun 2021 13:43:01 +0000 (14:43 +0100)]
media: i2c: imx477: Extend driver to support imx378 sensor
The imx378 sensor is almost identical to the imx477 and can be
supported as a "compatible" sensor with just a few extra register
writes.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
David Plowman [Tue, 29 Jun 2021 13:38:23 +0000 (14:38 +0100)]
Documentation: devicetree: Add documentation for imx378 sensor
The imx378 sensor is compatible with the imx477 and shares common
device tree settings.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Naushir Patuck [Tue, 29 Jun 2021 11:50:58 +0000 (12:50 +0100)]
staging: vc04_services: isp: Set the YUV420/YVU420 format stride to 64 bytes
The bcm2835 ISP requires the base address of all input/output planes to have 32
byte alignment. Using a Y stride of 32 bytes would not guarantee that the V
plane would fulfil this, e.g. a height of 650 lines would mean the V plane
buffer is not 32 byte aligned for YUV420 formats.
Having a Y stride of 64 bytes would ensure both U and V planes have a 32 byte
alignment, as the luma height will always be an even number of lines.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Dave Stevenson [Mon, 28 Jun 2021 09:49:04 +0000 (10:49 +0100)]
media: i2c: ov9281: Remove override of subdev name
From the original Rockchip driver, the subdev was renamed
from the default to being "mov9281 <dev_name>" whereas the
default would have been "ov9281 <dev_name>".
Remove the override to drop back to the default rather than
a vendor custom string.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
John Cox [Thu, 24 Jun 2021 13:43:49 +0000 (14:43 +0100)]
media: rpivid: Fix H265 aux ent reuse of the same slot
It is legitimate, though unusual, for an aux ent associated with a slot
to be selected in phase 0 before a previous selection has been used and
released in phase 2. Fix such that if the slot is found to be in use
that the aux ent associated with it is reused rather than an new aux
ent being created. This fixes a problem where when the first aux ent
was released the second was lost track of.
This bug spotted in Nick's testing. It may explain some other occasional,
unreliable decode error reports where dmesg included "Missing DPB AUX
ent" logging.
Signed-off-by: John Cox <jc@kynesim.co.uk>
Dave Stevenson [Thu, 17 Jun 2021 16:27:46 +0000 (17:27 +0100)]
media: i2c: imx290: Fix clock setup register assignments
When the clock setups were added for the alternate external clocks,
the settings for 2 lane 720p and 4 lane 1080p were transposed.
2 lane 720p still worked, but 4 lane 1080p didn't.
Correct the assignments.
Fixes: 6b0c094a5b58 (media: i2c: imx290: Add support for 74.25MHz clock")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 17 Jun 2021 12:00:39 +0000 (13:00 +0100)]
media: i2c: imx290: Fix the pixel rate at 148.5Mpix/s
Whilst the datasheet lists the link frequency changing between
1080p and 720p modes, reality is that with the default blanking
we have
(1920 + 280) * (1080 + 45) * 60fps = 148.5MPix/s
and
(1280 + 2020) * (720 + 30) * 60fps = 148.5MPix/s
and this reflects reality whether in 10 or 12 bit readout modes.
How this relates to link frequency is unclear as it differs
from the datasheet, but all exposure and frame rate calcs need
the pixel rate to be correct, so make it so.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 17 Jun 2021 11:05:25 +0000 (12:05 +0100)]
media: i2c: imx290: Support 60fps in 2 lane operation
Commit "
97589ad61c73 media: i2c: imx290: Add support for 2 data lanes"
added support for running in two lane mode (instead of 4), but
without changing the link frequency that resulted in a max of 30fps.
Commit "
98e0500eadb7 media: i2c: imx290: Add configurable link frequency
and pixel rate" then doubled the link frequency when in 2 lane mode,
but didn't undo the correction for running at only 30fps, just extending
horizontal blanking instead.
It also didn't update the CSI timing registers in accordance with the
datasheet.
Remove the 30fps limit on 2 lane by correcting the register config
in accordance with the datasheet for 60fps operation over 2 lanes.
Frame rate control (via V4L2_CID_VBLANK or HBLANK) can still reduce
the frame rate on 2 lanes back to 30fps.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dom Cobley [Tue, 27 Oct 2020 12:24:14 +0000 (12:24 +0000)]
bcm2835-pcm: Fix up multichannel pcm audio
Fixes: a9c1660ff5f02d048c5f31abf1fd1108ccf9ef87
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
popcornmix [Tue, 30 Apr 2019 18:15:30 +0000 (19:15 +0100)]
bcm2835-pcm.c: Support multichannel audio
Phil Elwell [Thu, 8 Jul 2021 08:37:10 +0000 (09:37 +0100)]
clk: bcm2835: Pass DT node to rpi_firmware_get
The fw_node pointer has already been retrieved, and using it allows
us to remove a downstream patch to the firmware driver.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Naushir Patuck [Fri, 11 Jun 2021 11:47:07 +0000 (12:47 +0100)]
media: i2c: imx477: Fix for long exposure limit calculations
Do not scale IMX477_EXPOSURE_OFFSET with the long exposure factor during
the limit calculations. This allows larger exposure times, and does seem to be
what the sensor is doing internally.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
jc-kynesim [Fri, 11 Jun 2021 14:14:31 +0000 (15:14 +0100)]
bcm2835: Allow compressed frames to set sizeimage (#4386)
Allow the user to set sizeimage in TRY_FMT and S_FMT if the format
flags have V4L2_FMT_FLAG_COMPRESSED set
Signed-off-by: John Cox <jc@kynesim.co.uk>
John Cox [Thu, 8 Apr 2021 17:34:09 +0000 (18:34 +0100)]
media: rpivid: Improve SPS/PPS error handling/validation
Move size and width checking from bitstream processing to control
validation
Signed-off-by: John Cox <jc@kynesim.co.uk>
John Cox [Sat, 3 Apr 2021 15:27:03 +0000 (16:27 +0100)]
media: rpivid: Improve stream_on/off conformance & clock setup
Fix stream on & off such that failures leave the driver in the correct
state. Ensure that the clock is on when we are streaming and off when
all contexts attached to this device have stopped streaming.
Signed-off-by: John Cox <jc@kynesim.co.uk>
John Cox [Thu, 1 Apr 2021 15:20:58 +0000 (16:20 +0100)]
media: rpivid: Improve values returned when setting output format
Guess a better value for the compressed bitstream buffer size
Signed-off-by: John Cox <jc@kynesim.co.uk>
John Cox [Mon, 29 Mar 2021 16:42:16 +0000 (17:42 +0100)]
media: rpivid: Map cmd buffer directly
It is unnecessary to have a separate dmabuf to hold the cmd buffer.
Map it directly from the kmalloc.
Signed-off-by: John Cox <jc@kynesim.co.uk>
John Cox [Thu, 11 Mar 2021 19:08:00 +0000 (19:08 +0000)]
media: rpivid: Add a Pass0 to accumulate slices and rework job finish
Due to overheads in assembling controls and requests it is worth having
the slice assembly phase separate from the h/w pass1 processing. Create
a queue to service pass1 rather than have the pass1 finished callback
trigger the next slice job.
This requires a rework of the logic that splits up the buffer and
request done events. This code contains two ways of doing that, we use
Ezequiel Garcias <ezequiel@collabora.com> solution, but expect that
in the future this will be handled by the framework in a cleaner manner.
Fix up the handling of some of the memory exhaustion crashes uncovered
in the process of writing this code.
Signed-off-by: John Cox <jc@kynesim.co.uk>
Ezequiel Garcia [Sun, 21 Mar 2021 19:38:54 +0000 (16:38 -0300)]
RFC: media: Add media_request_{pin,unpin} API
This is probably not the API we will want to add, but it
should show what semantics are needed by drivers.
The goal is to allow the OUTPUT (aka source) buffer and the
controls associated to a request to be released from the request,
and in particular return the OUTPUT buffer back to userspace,
without signalling the media request fd.
This is useful for devices that are able to pre-process
the OUTPUT buffer, therefore able to release it before
the decoding is finished. These drivers should signal
the media request fd only after the CAPTURE buffer is done.
Tested-by: John Cox <jc@kynesim.co.uk>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
John Cox [Thu, 11 Mar 2021 18:43:15 +0000 (18:43 +0000)]
media: rpivid: Add an enable count to irq claim Qs
Add an enable count to the irq Q structures to allow the irq logic to
block further callbacks if resources associated with the irq are not
yet available.
Signed-off-by: John Cox <jc@kynesim.co.uk>
John Cox [Thu, 11 Mar 2021 12:51:00 +0000 (12:51 +0000)]
media: rpivid: Convert to MPLANE
Use multi-planar interface rather than single plane interface. This
allows dmabufs holding compressed data to be resized.
Signed-off-by: John Cox <jc@kynesim.co.uk>
John Cox [Thu, 21 May 2020 10:49:37 +0000 (11:49 +0100)]
media: rpivid: Remove the need to have num_entry_points set
VAAPI H265 has num entry points but never sets it. Allow a VAAPI
shim to work without requiring rewriting the VAAPI driver.
num_entry_points can be calculated from the slice_segment_addr
of the next slice so delay processing until we have that.
Also includes some minor cosmetics.
Signed-off-by: John Cox <jc@kynesim.co.uk>
David Plowman [Wed, 12 May 2021 06:39:21 +0000 (07:39 +0100)]
media: i2c: ov5647: Fix v4l2-compliance failure subscribing to events
Fixes the following v4l2-compliance failure:
fail: v4l2-test-controls.cpp(871): subscribe event for control 'User Controls' failed test
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
David Plowman [Tue, 11 May 2021 11:57:22 +0000 (12:57 +0100)]
media: i2c: ov5647: Correct minimum VBLANK value
Trial and error reveals that the minimum vblank value appears to be 24
(the OV5647 data sheet does not give any clues). This fixes streaming
lock-ups in full resolution mode.
Fixes: 9b5a5ebedc303 ("media: i2c: ov5647: Add support for V4L2_CID_VBLANK")
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
David Plowman [Tue, 11 May 2021 11:52:26 +0000 (12:52 +0100)]
media: i2c: ov5647: Correct pixel array offset
The top offset in the pixel array is actually 6 (see page 3-1 of the
OV5647 data sheet).
Fixes: f2f7ad5ce5e52 ("media: i2c: ov5647: Selection compliance fixes")
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Phil Elwell [Tue, 27 Apr 2021 07:59:01 +0000 (08:59 +0100)]
gpio-poweroff: Remember the old poweroff handler
Keeping a copy of the old poweroff handler allows it to be restored
should this module be unloaded, but also provides a fallback if the
power hasn't been removed when the timeout elapses.
See: https://github.com/raspberrypi/rpi-eeprom/issues/330
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Fri, 23 Apr 2021 15:16:49 +0000 (16:16 +0100)]
staging/bcm2835-isp: Fix compiler warning
The result of dividing a u32 by a size_t is an unsigned int on arm32
and a long unsigned int on arm64. Use "%zu" (the size_t format) to
remove the build warning for 64-bit builds.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Dave Stevenson [Thu, 15 Apr 2021 10:07:55 +0000 (11:07 +0100)]
staging/bcm2835-codec: Do not update crop from S_FMT after res change
During decode, setting the CAPTURE queue format was setting the crop
rectangle to the requested height before aligning up the format to
cater for simple clients that weren't expecting to deal with cropping
and the SELECTION API.
This caused problems on some resolution change events if the client
didn't also then use the selection API.
Disable the crop update after a resolution change.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>