platform/kernel/linux-rpi.git
2 months agoAdd pcie-32bit-dma-overlay-pi5 to enable 32bit DMA on the Pi 5's external PCIe
Rodrigo Rosmaninho [Tue, 23 Jan 2024 18:50:19 +0000 (18:50 +0000)]
Add pcie-32bit-dma-overlay-pi5 to enable 32bit DMA on the Pi 5's external PCIe

Changes dma-ranges in the pcie1 component of the bcm2712 dts in order to ensure that the DMA addressing space is 32bits, at the expense of having to bounce buffers.

Signed-off-by: Rodrigo Rosmaninho <r.rosmaninho@ua.pt>
2 months agoHarmonizing the improvement on backup-switchover-mode overlay value definitions
Tiago Freire [Wed, 24 Jan 2024 10:03:03 +0000 (10:03 +0000)]
Harmonizing the improvement on backup-switchover-mode overlay value definitions

On the followup of https://github.com/raspberrypi/linux/pull/5884, I missed a second duplicate definition. Now, harmonized the entire document.

Signed-off-by: Tiago Freire <41837236+tiagofreire-pt@users.noreply.github.com>
2 months agodrivers: media: pisp_be: Update seqeuence numbers of the buffers
Naushir Patuck [Mon, 29 Jan 2024 09:02:03 +0000 (09:02 +0000)]
drivers: media: pisp_be: Update seqeuence numbers of the buffers

Add a framebuffer sequence counter and increment on every completed job.
This counter is then used to update the VB2 buffer sequence count before
calling vb2_buffer_done().

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 months agodrm/vc4: Initialise the tv_mode property default from cmdline_mode.
Dave Stevenson [Thu, 25 Jan 2024 17:27:42 +0000 (17:27 +0000)]
drm/vc4: Initialise the tv_mode property default from cmdline_mode.

With the command line parser now providing the information about
the tv mode, use that as the preferred choice for initialising the
default of the tv_mode property.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 months agodrm/vc4: Do not reset tv mode as this is already handled by framework
Dave Stevenson [Thu, 25 Jan 2024 16:18:14 +0000 (16:18 +0000)]
drm/vc4: Do not reset tv mode as this is already handled by framework

In vc4_vec_connector_reset, the tv mode is already reset to the
property default by drm_atomic_helper_connector_tv_reset, so there
is no need for a local fixup to potentially some other default.

Fixes: 96922af14473 ("drm/vc4: Allow setting the TV norm via module parameter")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 months agoRevert "drm/vc4: Relax VEC modeline requirements and add progressive mode support"
Dave Stevenson [Thu, 25 Jan 2024 17:59:52 +0000 (17:59 +0000)]
Revert "drm/vc4: Relax VEC modeline requirements and add progressive mode support"

This reverts commit 2ef74e9687c92e26d4b047c2499c96b215ec7f00.

The mode that is now generated by the DRM core doesn't validate against
these criteria

2 months agodts: rp1: nobble HS and FS/LS park mode for dwc3 xhci
Jonathan Bell [Wed, 24 Jan 2024 16:32:13 +0000 (16:32 +0000)]
dts: rp1: nobble HS and FS/LS park mode for dwc3 xhci

Synopsys have recommended that we disable this feature entirely, as
Superspeed park mode can hang the controller, and Hs/FS/LS park mode can
cause performance degradation with bursty devices.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2 months agodrivers: usb: dwc3: add FS/LS bus instance parkmode disable bit
Jonathan Bell [Wed, 24 Jan 2024 16:28:19 +0000 (16:28 +0000)]
drivers: usb: dwc3: add FS/LS bus instance parkmode disable bit

There are three parkmode disable bits, one for each bus instance type.
Add FS/LS and parse the quirk out of DT. Also update the slightly
mangled quirk descriptions.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2 months agodt-bindings: usb: update dwc3 bindings for parkmode-disable quirks
Jonathan Bell [Wed, 24 Jan 2024 16:26:37 +0000 (16:26 +0000)]
dt-bindings: usb: update dwc3 bindings for parkmode-disable quirks

There are three disable bits, one for each bus-instance type. Add a
quirk to cover the FS/LS type, and update the slightly mangled quirk
descriptions in the process.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2 months agodrivers: w1-gpio: Fixup uninitialised variable use in w1_gpio_probe
Jonathan Bell [Wed, 24 Jan 2024 11:13:19 +0000 (11:13 +0000)]
drivers: w1-gpio: Fixup uninitialised variable use in w1_gpio_probe

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2 months agoarm: dts: overlays: add Pi 5 variants for w1-gpio overlays
Jonathan Bell [Mon, 22 Jan 2024 16:21:04 +0000 (16:21 +0000)]
arm: dts: overlays: add Pi 5 variants for w1-gpio overlays

Make use of the latency-busting read-poll feature on Pi 5 only.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2 months agodrivers: w1-gpio: add flag to force read-polling while delaying
Jonathan Bell [Thu, 11 Jan 2024 16:33:22 +0000 (16:33 +0000)]
drivers: w1-gpio: add flag to force read-polling while delaying

On Pi 5, the link to RP1 will bounce in and out of L1 depending on
inactivity timers at both the RC and EP end. Unfortunately for
bitbashing 1-wire, this means that on an otherwise idle Pi 5 many of the
reads/writes to GPIO registers are delayed by up to 8us which causes
mis-sampling of read data and trashes write bits.

By issuing dummy reads at a rate greater than the link inactivity
timeout while spinning on a delay, PCIe stays in L0 which does not incur
additional latency.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2 months agoPCI: brcmstb: fix broken brcm_pcie_mdio_write() polling
Jonathan Bell [Tue, 23 Jan 2024 14:37:12 +0000 (14:37 +0000)]
PCI: brcmstb: fix broken brcm_pcie_mdio_write() polling

MDIO_WR_DONE() tests bit 31, which is always 0 (==done) as
readw_poll_timeout_atomic does a 16-bit read. Replace with the readl
variant.

Fixes: ca5dcc76314d ("PCI: brcmstb: Replace status loops with read_poll_timeout_atomic()")
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2 months agoImprovement on backup-switchover-mode overlay value definitions (#5884)
Tiago Freire [Tue, 23 Jan 2024 12:10:24 +0000 (12:10 +0000)]
Improvement on backup-switchover-mode overlay value definitions (#5884)

For the RV3028 RTC, the definitions for its `backup-switchover-mode` overlay
were not intelligible neither complete/exhaustive.

Accordingly to the https://github.com/raspberrypi/linux/issues/2912#issuecomment-477670051
these one here proposed should be correct.

`/boot/config.txt` should be as a configuration example, for rv3028, on a
 Uputronics GPS Extension HAT:

    # For GPS Expansion Board from Uputronics
    dtparam=i2c_arm=on
    dtoverlay=i2c-rtc,rv3028,backup-switchover-mode=3
    dtoverlay=pps-gpio,gpiopin=18
    init_uart_baud=115200

From my tests (`sudo rmmod rtc_rv3028 && sudo i2cget -y 1 0x52 0x37`):

`Default from factory`: `0x10`
`Mode 0`: `0x10`
`Mode 1`: `0x14`
`Mode 2`: `0x18`
`Mode 3`: `0x1c`

`Mode 3`: `0x1c` is consistent with the manufacturer configuration script: http://store.uputronics.com/files/configure-rv3028.sh

2 months agoPisound: Set the spi-speed-hz for Pisound in the Device Tree overlay, and specify...
Giedrius [Mon, 22 Jan 2024 13:29:24 +0000 (13:29 +0000)]
Pisound: Set the spi-speed-hz for Pisound in the Device Tree overlay, and specify spi-speed-hz override for Pi 5.

Signed-off-by: Giedrius Trainavičius <giedrius@blokas.io>
2 months agoPisound: Read out the SPI speed to use from the Device Tree.
Giedrius [Mon, 22 Jan 2024 13:26:58 +0000 (13:26 +0000)]
Pisound: Read out the SPI speed to use from the Device Tree.

Signed-off-by: Giedrius Trainavičius <giedrius@blokas.io>
2 months agoPisound: Don't export the button GPIO via sysfs GPIO class.
Giedrius [Fri, 19 Jan 2024 10:55:55 +0000 (10:55 +0000)]
Pisound: Don't export the button GPIO via sysfs GPIO class.

Signed-off-by: Giedrius Trainavičius <giedrius@blokas.io>
2 months agommc: bcm2835-sdhost: use Host Software Queueing mechanism
Jonathan Bell [Thu, 18 Jan 2024 14:32:16 +0000 (14:32 +0000)]
mmc: bcm2835-sdhost: use Host Software Queueing mechanism

See commit 511ce378e16f ("mmc: Add MMC host software queue support")

Introduced in 5.8, this feature lets the block layer issue up to 2
pending requests to the MMC layer which in certain cases can improve
throughput, but in the case of this driver can significantly reduce
context switching when performing random reads.

On bcm2837 with a performant class A1 card, context switches under FIO
random 4k reads go from ~8800 per second to ~5800, with a reduction in
hardIRQs per second from ~5800 to ~4000. There is no appreciable
difference in throughput.

For bcm2835, and for workloads other than random read, HSQ is a wash in
terms of throughput and CPU load.

So, use it by default.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2 months agoARM: pl011: Add rs485 to the RP1 support
Phil Elwell [Thu, 18 Jan 2024 11:08:03 +0000 (11:08 +0000)]
ARM: pl011: Add rs485 to the RP1 support

pl011_axi_probe, added for RP1 support, lacks the rs485 additions that
appeared during its development.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agodrm: rp1: rp1-vec: Allow non-standard modes with various crops
Nick Hollinghurst [Thu, 11 Jan 2024 12:13:03 +0000 (12:13 +0000)]
drm: rp1: rp1-vec: Allow non-standard modes with various crops

Tweak sync timings in the advertised modelines.

Accept other, custom modes, provided they fit within the active
area of one of the existing hardware-supported TV modes.

Instead of always padding symmetrically, try to respect the user's
[hv]sync_start values, allowing the image to be shifted around
the screen (to fine-tune overscan correction).

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
2 months agoAdding Pi 5 as a device to bug_report.yml
Phil Elwell [Thu, 18 Jan 2024 12:01:58 +0000 (12:01 +0000)]
Adding Pi 5 as a device to bug_report.yml

2 months ago drivers/gpu/drm/panel:Modified the timing of 11.9inch to fix the issue that 11.9inch...
eng33 [Wed, 3 Jan 2024 03:46:50 +0000 (11:46 +0800)]
 drivers/gpu/drm/panel:Modified the timing of 11.9inch to fix the issue that 11.9inch was displayed abnormally

Signed-off-by: eng33 <eng33@waveshare.com>
2 months ago drivers/gpu/drm/panel:Modify the DSI mode to fix the problem that 7.9inch cannot...
eng33 [Wed, 3 Jan 2024 03:45:04 +0000 (11:45 +0800)]
 drivers/gpu/drm/panel:Modify the DSI mode to fix the problem that 7.9inch cannot be displayed

Signed-off-by: eng33 <eng33@waveshare.com>
2 months agodrm/vc4: Flush stale dlist entries if allocation fails
Dave Stevenson [Wed, 17 Jan 2024 18:36:11 +0000 (18:36 +0000)]
drm/vc4: Flush stale dlist entries if allocation fails

This is largely for debug at present.
For reasons unknown we are not getting the end of frame interrupts
that should trigger a sweep of stale dlist entries.

On allocation failure clear out ALL stale entries, and retry the
allocation. Log the interrupt status so we have debug regarding
whether the HVS believes the interrupt is enabled.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 months agodrm/vc4: Optimise vc4_hvs_dlist_free_work to only read frcnt and active once
Dave Stevenson [Thu, 4 Jan 2024 12:39:33 +0000 (12:39 +0000)]
drm/vc4: Optimise vc4_hvs_dlist_free_work to only read frcnt and active once

vc4_hvs_dlist_free_work was iterating through the list of stale
dlist entries and reading the frame count and active flags from
the hardware for each one.

Read the frame count and active flags once, and then use the
cached value in the loop.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 months agommc: sdhci-brcmstb: remove 32-bit accessors for BCM2712
Jonathan Bell [Mon, 8 Jan 2024 17:10:44 +0000 (17:10 +0000)]
mmc: sdhci-brcmstb: remove 32-bit accessors for BCM2712

The reason for adding these are lost to the mists of time (and for a
previous chip revision). Removing these accessors appears to have no ill
effect on production chips, so get rid of the unnecessary RMW cycles.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2 months agodrm/vc4: Fix atomic_async_check to call the right mode_set function
Dave Stevenson [Wed, 17 Jan 2024 17:00:35 +0000 (17:00 +0000)]
drm/vc4: Fix atomic_async_check to call the right mode_set function

vc4_plane_atomic_async_check was always calling vc4_plane_mode_set
to validate and generate the dlist for the check. If async_check
decided it had to fall back to a sync commit, then this GEN4/5
dlist could get used on GEN6.

Call either vc4_plane_mode_set or vc6_plane_mode_set as appropriate.

Fixes: 1ab1fbbb7e76 ("drm/vc4: hvs: Support BCM2712 HVS")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 months agodrm/vc4: Add 2712 support to vc4_plane_async_set_fb
Dave Stevenson [Thu, 4 Jan 2024 15:02:42 +0000 (15:02 +0000)]
drm/vc4: Add 2712 support to vc4_plane_async_set_fb

vc4_plane_async_set_fb directly overwrites the plane address in
the dlist entry, but hadn't been updated for the GEN6 / 2712
dlist format, corrupting the address in the process.

Add support for the 2712 dlist format to the function.

Fixes: 1ab1fbbb7e76 ("drm/vc4: hvs: Support BCM2712 HVS")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 months agor8169: add support for LED's on RTL8168/RTL8101
Heiner Kallweit [Sat, 16 Dec 2023 19:58:10 +0000 (20:58 +0100)]
r8169: add support for LED's on RTL8168/RTL8101

commit 18764b883e157e28126b54e7d4ba9dd487d5bf54 upstream.

This adds support for the LED's on most chip versions. Excluded are
the old non-PCIe versions and RTL8125. RTL8125 has a different LED
register layout, support for it will follow later.

LED's can be controlled from userspace using the netdev LED trigger.

Tested on RTL8168h.

Note: The driver can't know which LED's are actually physically
wired. Therefore not every LED device may represent a physically
available LED.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 months agovc4/hdmi: Update MAI_THR for D0
Dom Cobley [Thu, 16 Nov 2023 14:39:30 +0000 (14:39 +0000)]
vc4/hdmi: Update MAI_THR for D0

2712D0 has increased the fifo sizes of MAI_THR blocks,
resulting in adjusted bit offsets. Handle that.

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
2 months agovc4/hvs: Updates to support D0 alpha and csc changes
Dom Cobley [Fri, 12 Jan 2024 15:48:14 +0000 (15:48 +0000)]
vc4/hvs: Updates to support D0 alpha and csc changes

2712D0 has a simpler colourspace conversion matrix block
so set that up.

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
2 months agovc4/hvs: Add support for D0 register changes
Dom Cobley [Tue, 14 Nov 2023 16:43:03 +0000 (16:43 +0000)]
vc4/hvs: Add support for D0 register changes

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
2 months agopinctrl: bcm2712: Fix for the first valid GPIO
Phil Elwell [Thu, 30 Nov 2023 12:57:03 +0000 (12:57 +0000)]
pinctrl: bcm2712: Fix for the first valid GPIO

A non-zero mux bit number is used to detect a valid entry in the
pin_regs tables, but GPIO 0 (GPIO 1 on D0) is a valid GPIO with a mux
bit number of zero, so add a high-bit on all valid entries to
distinguish this from an uninitialised row in the table.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agopinctrl: bcm2712: Fix for sparse GPIOs
Phil Elwell [Wed, 15 Nov 2023 14:49:55 +0000 (14:49 +0000)]
pinctrl: bcm2712: Fix for sparse GPIOs

BCM2712D0's sparse GPIO map revealed that it is not safe to treat
group_selector as the GPIO number - it is an index into the array of
pinctrl_pin_descs, and the "number" member says which GPIO it refers to.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agoARM: dts: overlays: Add a bcm2712d0 overlay
Phil Elwell [Thu, 16 Nov 2023 15:18:29 +0000 (15:18 +0000)]
ARM: dts: overlays: Add a bcm2712d0 overlay

The bcm2712d0 overlay encapsulates the differences between BCM2712C0/1
and D0.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agoARM: dts: Add BCM2712 D0 dts
Phil Elwell [Wed, 15 Nov 2023 14:48:43 +0000 (14:48 +0000)]
ARM: dts: Add BCM2712 D0 dts

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agoARM: dts: bcm2712: Prune the non-D0 hardware
Phil Elwell [Thu, 16 Nov 2023 16:03:47 +0000 (16:03 +0000)]
ARM: dts: bcm2712: Prune the non-D0 hardware

There is no point describing hardware blocks in C0/1 that aren't also
in D0, so delete them.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agodrivers: media: arducam_64mp: Add V4L2_CID_LINK_FREQ control
Lee Jackson [Wed, 10 Jan 2024 01:06:16 +0000 (09:06 +0800)]
drivers: media: arducam_64mp: Add V4L2_CID_LINK_FREQ control

Add V4L2_CID_LINK_FREQ as a read-only control with a value of 456 Mhz.
This will be used by the CFE driver to corretly setup the DPHY timing
parameters in the CSI-2 block.

Signed-off-by: Lee Jackson <lee.jackson@arducam.com>
2 months agodrivers: media: imx519: Add V4L2_CID_LINK_FREQ control
Lee Jackson [Wed, 10 Jan 2024 00:52:54 +0000 (08:52 +0800)]
drivers: media: imx519: Add V4L2_CID_LINK_FREQ control

Add V4L2_CID_LINK_FREQ as a read-only control with a value of 408 Mhz.
This will be used by the CFE driver to corretly setup the DPHY timing
parameters in the CSI-2 block.

Signed-off-by: Lee Jackson <lee.jackson@arducam.com>
2 months agospi: bcm2835: Support spi0-0cs and SPI_NO_CS mode
Phil Elwell [Mon, 8 Jan 2024 11:42:57 +0000 (11:42 +0000)]
spi: bcm2835: Support spi0-0cs and SPI_NO_CS mode

The forced conversion of native CS lines into software CS lines is done
whether or not the controller has been given any CS lines to use. This
breaks the use of the spi0-0cs overlay to prevent SPI from claiming any
CS lines, particularly with spidev which doesn't pass in the SPI_NO_CS
flag at creation.

Use the presence of an empty cs-gpios property as an indication that no
CS lines should be used, bypassing the native CS conversion code.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agoARM: dts: bcm2712-rpi-5-b: Use common LED labels
Phil Elwell [Mon, 8 Jan 2024 08:45:21 +0000 (08:45 +0000)]
ARM: dts: bcm2712-rpi-5-b: Use common LED labels

As of 6.6, the names of the labels on the Pi LEDs was swapped to match
the upstream code, i.e. led_act rather than act_led.

Apply the same change to Pi 5.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agodrm/vc4: don't check if plane->state->fb == state->fb
Maíra Canal [Fri, 5 Jan 2024 18:07:34 +0000 (15:07 -0300)]
drm/vc4: don't check if plane->state->fb == state->fb

Currently, when using non-blocking commits, we can see the following
kernel warning:

[  110.908514] ------------[ cut here ]------------
[  110.908529] refcount_t: underflow; use-after-free.
[  110.908620] WARNING: CPU: 0 PID: 1866 at lib/refcount.c:87 refcount_dec_not_one+0xb8/0xc0
[  110.908664] Modules linked in: rfcomm snd_seq_dummy snd_hrtimer snd_seq snd_seq_device cmac algif_hash aes_arm64 aes_generic algif_skcipher af_alg bnep hid_logitech_hidpp vc4 brcmfmac hci_uart btbcm brcmutil bluetooth snd_soc_hdmi_codec cfg80211 cec drm_display_helper drm_dma_helper drm_kms_helper snd_soc_core snd_compress snd_pcm_dmaengine fb_sys_fops sysimgblt syscopyarea sysfillrect raspberrypi_hwmon ecdh_generic ecc rfkill libaes i2c_bcm2835 binfmt_misc joydev snd_bcm2835(C) bcm2835_codec(C) bcm2835_isp(C) v4l2_mem2mem videobuf2_dma_contig snd_pcm bcm2835_v4l2(C) raspberrypi_gpiomem bcm2835_mmal_vchiq(C) videobuf2_v4l2 snd_timer videobuf2_vmalloc videobuf2_memops videobuf2_common snd videodev vc_sm_cma(C) mc hid_logitech_dj uio_pdrv_genirq uio i2c_dev drm fuse dm_mod drm_panel_orientation_quirks backlight ip_tables x_tables ipv6
[  110.909086] CPU: 0 PID: 1866 Comm: kodi.bin Tainted: G         C         6.1.66-v8+ #32
[  110.909104] Hardware name: Raspberry Pi 3 Model B Rev 1.2 (DT)
[  110.909114] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[  110.909132] pc : refcount_dec_not_one+0xb8/0xc0
[  110.909152] lr : refcount_dec_not_one+0xb4/0xc0
[  110.909170] sp : ffffffc00913b9c0
[  110.909177] x29: ffffffc00913b9c0 x28: 000000556969bbb0 x27: 000000556990df60
[  110.909205] x26: 0000000000000002 x25: 0000000000000004 x24: ffffff8004448480
[  110.909230] x23: ffffff800570b500 x22: ffffff802e03a7bc x21: ffffffecfca68c78
[  110.909257] x20: ffffff8002b42000 x19: ffffff802e03a600 x18: 0000000000000000
[  110.909283] x17: 0000000000000011 x16: ffffffffffffffff x15: 0000000000000004
[  110.909308] x14: 0000000000000fff x13: ffffffed577e47e0 x12: 0000000000000003
[  110.909333] x11: 0000000000000000 x10: 0000000000000027 x9 : c912d0d083728c00
[  110.909359] x8 : c912d0d083728c00 x7 : 65646e75203a745f x6 : 746e756f63666572
[  110.909384] x5 : ffffffed579f62ee x4 : ffffffed579eb01e x3 : 0000000000000000
[  110.909409] x2 : 0000000000000000 x1 : ffffffc00913b750 x0 : 0000000000000001
[  110.909434] Call trace:
[  110.909441]  refcount_dec_not_one+0xb8/0xc0
[  110.909461]  vc4_bo_dec_usecnt+0x4c/0x1b0 [vc4]
[  110.909903]  vc4_cleanup_fb+0x44/0x50 [vc4]
[  110.910315]  drm_atomic_helper_cleanup_planes+0x88/0xa4 [drm_kms_helper]
[  110.910669]  vc4_atomic_commit_tail+0x390/0x9dc [vc4]
[  110.911079]  commit_tail+0xb0/0x164 [drm_kms_helper]
[  110.911397]  drm_atomic_helper_commit+0x1d0/0x1f0 [drm_kms_helper]
[  110.911716]  drm_atomic_commit+0xb0/0xdc [drm]
[  110.912569]  drm_mode_atomic_ioctl+0x348/0x4b8 [drm]
[  110.913330]  drm_ioctl_kernel+0xec/0x15c [drm]
[  110.914091]  drm_ioctl+0x24c/0x3b0 [drm]
[  110.914850]  __arm64_sys_ioctl+0x9c/0xd4
[  110.914873]  invoke_syscall+0x4c/0x114
[  110.914897]  el0_svc_common+0xd0/0x118
[  110.914917]  do_el0_svc+0x38/0xd0
[  110.914936]  el0_svc+0x30/0x8c
[  110.914958]  el0t_64_sync_handler+0x84/0xf0
[  110.914979]  el0t_64_sync+0x18c/0x190
[  110.914996] ---[ end trace 0000000000000000 ]---

This happens because, although `prepare_fb` and `cleanup_fb` are
perfectly balanced, we cannot guarantee consistency in the check
plane->state->fb == state->fb. This means that sometimes we can increase
the refcount in `prepare_fb` and don't decrease it in `cleanup_fb`. The
opposite can also be true.

In fact, the struct drm_plane .state shouldn't be accessed directly
but instead, the `drm_atomic_get_new_plane_state()` helper function should
be used. So, we could stick to this check, but using
`drm_atomic_get_new_plane_state()`. But actually, this check is not really
needed. We can increase and decrease the refcount symmetrically without
problems.

This is going to make the code more simple and consistent.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
2 months agoARM: dts: bcm2712-rpi-5-b: Add fan speed dtparams
Phil Elwell [Thu, 4 Jan 2024 12:09:10 +0000 (12:09 +0000)]
ARM: dts: bcm2712-rpi-5-b: Add fan speed dtparams

Add dtparams for adjusting the Pi 5 cooling fan speeds and temperature
thresholds.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agoARM: dts: bcm2712-rpi-5-b: Add eth_ledx parameters
Phil Elwell [Thu, 4 Jan 2024 13:56:39 +0000 (13:56 +0000)]
ARM: dts: bcm2712-rpi-5-b: Add eth_ledx parameters

Include the dtparams controlling the Ethernet jack LEDs, as used on
other Pis.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agomedia: rp1: cfe: Add a csi_dt value for 16bit formats
Dave Stevenson [Fri, 22 Dec 2023 11:53:52 +0000 (11:53 +0000)]
media: rp1: cfe: Add a csi_dt value for 16bit formats

Raw 16bit formats didn't have a csi_dt value defined, which
presumably would trip the WARN_ON(!fmt->csi_dt); in
cfe_start_channel.

The value is defined in CSI2 v2.0 as 0x2e, so set it accordingly.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 months agomedia: rp1: cfe: Use the MIPI_CSI2_DT_xxx defines for csi_dt
Dave Stevenson [Fri, 22 Dec 2023 11:50:38 +0000 (11:50 +0000)]
media: rp1: cfe: Use the MIPI_CSI2_DT_xxx defines for csi_dt

Seeing as we now have the CSI2 data types defined, make use of
them instead of hardcoding the values.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 months agomedia: i2c: adv7180: Add support for V4L2_CID_LINK_FREQ
Dave Stevenson [Thu, 21 Dec 2023 18:03:34 +0000 (18:03 +0000)]
media: i2c: adv7180: Add support for V4L2_CID_LINK_FREQ

For CSI2 receivers that need to know the link frequency,
add it as a control to the driver.
Interlaced modes are 216Mbp/s or 108MHz, whilst going through
the I2P to deinterlace gives 432Mb/s or 216MHz.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 months agomedia: i2c: adv7180: Use MEDIA_BUS_FMT_UYVY8_1X16 for CSI2 output
Dave Stevenson [Thu, 21 Dec 2023 18:01:59 +0000 (18:01 +0000)]
media: i2c: adv7180: Use MEDIA_BUS_FMT_UYVY8_1X16 for CSI2 output

CSI2 devices are meant to use the 1Xnn formats rather than 2Xnn
such as MEDIA_BUS_FMT_UYVY8_2X8.

For devices with ADV7180_FLAG_MIPI_CSI2 set, use
MEDIA_BUS_FMT_UYVY8_1X16.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 months agomedia: rp1: cfe: Fix error paths in cfe_start_streaming
Dave Stevenson [Thu, 21 Dec 2023 17:59:15 +0000 (17:59 +0000)]
media: rp1: cfe: Fix error paths in cfe_start_streaming

Noted that if we get "node link is not enabled", then we also
get the videobuf2 splat for the driver not cleaning up correctly
on a failed start_streaming, and indeed we weren't returning the
buffers.

Checking the other error paths, noted that the "FE enabled, but
FE_CONFIG node is not" path was not calling pm_runtime_put.

Fix both paths.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 months agodrm/vc4: Fixup of patches adding debugfs functions
Dave Stevenson [Tue, 2 Jan 2024 19:32:25 +0000 (19:32 +0000)]
drm/vc4: Fixup of patches adding debugfs functions

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 months agodrm/vc4: Fix reading of frame count on GEN5 / Pi4
Dave Stevenson [Thu, 4 Jan 2024 12:02:43 +0000 (12:02 +0000)]
drm/vc4: Fix reading of frame count on GEN5 / Pi4

The frame count values moved within registers DISPSTAT1 and
DISPSTAT2 with GEN5, so update the accessor function to
accommodate that.

Fixes: b51cd7ad143d ("drm/vc4: hvs: Fix frame count register readout")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 months agoASoC: dwc: Defer bclk_ratio handling to hw_params
Phil Elwell [Wed, 3 Jan 2024 14:43:43 +0000 (14:43 +0000)]
ASoC: dwc: Defer bclk_ratio handling to hw_params

bclk_ratio is only a factor in clock producer mode, and needs to
override the default value of num_channels * sample_size.
Move the bclk_ratio handling into the hw_params method, only latching
the value in set_bclk_ratio, to address both of those matters.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agoconfigs: rpi: Disable CONFIG_IRQSOFF_TRACER by default
Yangyu Chen [Mon, 18 Dec 2023 15:26:59 +0000 (23:26 +0800)]
configs: rpi: Disable CONFIG_IRQSOFF_TRACER by default

This configuration hindered performance by ~74% measured from RPI 4B
from ~680Mbps to ~390Mbps when benchmarking wireguard locally using
netns and iperf3. Remove it by default for better performance.

Signed-off-by: Yangyu Chen <cyy@cyyself.name>
2 months agodts: rp1: Add I2C timings
Phil Elwell [Tue, 19 Dec 2023 11:27:20 +0000 (11:27 +0000)]
dts: rp1: Add I2C timings

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agoi2c: designware: Look for *CNT values in DT
Phil Elwell [Tue, 19 Dec 2023 11:16:25 +0000 (11:16 +0000)]
i2c: designware: Look for *CNT values in DT

The i2c-designware driver supports reading precise timing values from
ACPI, but the Device Tree support relies on a combination of standard
rise and fall times and hard-coded minimum timings. The result of this
is that it is difficult to get optimum timings, particularly given that
the values are bus speed-specific and only one set can be stored in
DT at a time.

Add support for initialisation from DT that is similar to that for
ACPI.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agoARM: dts: bcm2712-rpi-5-b: Allow RTC to be disabled
Phil Elwell [Tue, 19 Dec 2023 14:55:21 +0000 (14:55 +0000)]
ARM: dts: bcm2712-rpi-5-b: Allow RTC to be disabled

Add a dtparam "rtc", so that "dtparam=rtc=off" can be used to disable
the Pi 5's onboard RTC.

See: https://forums.raspberrypi.com/viewtopic.php?t=361813

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agofixup downstream patch post driver conversion to CCI_REG
Dave Stevenson [Wed, 27 Dec 2023 19:51:45 +0000 (19:51 +0000)]
fixup downstream patch post driver conversion to CCI_REG

HTS was still using the raw register ID.

Fixes: dd26d43ddb7f ("media: i2c: imx219: make HBLANK r/w to allow longer exposures")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 months agodts: bcm271-rpi-3-b: Make brcmvirt-gpio a firmware child
Phil Elwell [Thu, 21 Dec 2023 15:52:42 +0000 (15:52 +0000)]
dts: bcm271-rpi-3-b: Make brcmvirt-gpio a firmware child

The driver makes use of the fact that the firmware node is its parent,
so we'd better make it so.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agobcm2835-virtgpio: Update for Linux 6.6
Phil Elwell [Thu, 21 Dec 2023 15:13:37 +0000 (15:13 +0000)]
bcm2835-virtgpio: Update for Linux 6.6

The gpio subsystem is happier if the gpiochip is given a parent, and
if it doesn't have a fixed base gpio number. While we're in here,
use the fact that the firmware node is the parent to locate it,
and use the devm_ version of rpi_firmware_get.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agodrivers: media: cfe: Add more robust ISR handlers
Naushir Patuck [Mon, 18 Dec 2023 09:52:45 +0000 (09:52 +0000)]
drivers: media: cfe: Add more robust ISR handlers

Update the ISR logic to be more robust to sensors in problematic states
where interrupts may start arriving overlapped and/or missing.

1) Test for cur_frame in the FE handler, and if present, dequeue it in
an error state so that it does not get orphaned.

2) Move the sequence counter and timestamp variables to the node
structures.  This allows the ISR to track channels running ahead when
interrupts arrive unordered.

3) Add a test to ensure we don't have a spurios (but harmlesS) call to
the FE handler in some circumstances.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 months agodrivers: media: pisp_be: pisp_fe: Update UAPI header licenses
Naushir Patuck [Wed, 29 Nov 2023 13:09:05 +0000 (13:09 +0000)]
drivers: media: pisp_be: pisp_fe: Update UAPI header licenses

Update the license tags on the pisp UAPI header files with the
"Linux-syscall-note" clause.  Also replace the "GPL-2.0" tag with the
preferred "GPL-2.0-only" tag.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 months agoinput: edt-ft5x06: Correct prefix length in snprintf
Dave Stevenson [Mon, 18 Dec 2023 11:49:36 +0000 (11:49 +0000)]
input: edt-ft5x06: Correct prefix length in snprintf

snprintf takes the length of the array that we can print into,
and has to fit the NULL terminator in there too.
Printing the prefix is generally "12-3456 " which is 8 desired
characters (the length of EDT_NAME_PREFIX_LEN) and the NULL.
The space is therefore being truncated to fit the NULL in.

Increase the length snprintf is allowed to use.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 months agooverlays: Add "always-on" parameter to imx477 and imx296
Nick Hollinghurst [Wed, 6 Dec 2023 14:38:03 +0000 (14:38 +0000)]
overlays: Add "always-on" parameter to imx477 and imx296

Leave the camera's power supplies up, to prevent the camera
clamping its 1.8V digital I/Os to ground. This may be useful
when synchronizing multiple camera systems using XVS or XTRIG.

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
2 months agodrivers: media: i2c: imx296,imx477: Configure tigger_mode every time
Nick Hollinghurst [Wed, 6 Dec 2023 14:27:57 +0000 (14:27 +0000)]
drivers: media: i2c: imx296,imx477: Configure tigger_mode every time

Don't assume the camera has been reset each time we start streaming,
but always write registers relating to trigger_mode, even in mode 0.

IMX477: Stop driving XVS on stop streaming, to avoid spurious pulses.

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
2 months agodts: rp1: add SNPS quirk to USB3 host controllers
Jonathan Bell [Wed, 13 Dec 2023 14:28:22 +0000 (14:28 +0000)]
dts: rp1: add SNPS quirk to USB3 host controllers

Set snps,parkmode-disable-ss-quirk for usb0 and usb1.

Enabling this test/debug feature seems to prevent controller lockups
with bidirectional SS bulk endpoints active.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2 months agoARM: dts: bcm2711-rpi-400: Don't delete the ACT LED
Phil Elwell [Wed, 13 Dec 2023 10:26:19 +0000 (10:26 +0000)]
ARM: dts: bcm2711-rpi-400: Don't delete the ACT LED

The Pi 400 only has one user-accessible LED (green), which is intended
to be used as a power indication. Therefore there is no activity LED.
However, a user may wish to remap the activity LED functionality to a
GPIO in the 40-way header, so preserve the led-act node in a disabled
state.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agodts: bcm2712-rpi-5-b: Enable warm reboot mode
Phil Elwell [Mon, 11 Dec 2023 17:00:56 +0000 (17:00 +0000)]
dts: bcm2712-rpi-5-b: Enable warm reboot mode

Switch to warm reboot mode so that the partition number is preserved.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agofirmware/psci: Pass given partition number through
Phil Elwell [Mon, 11 Dec 2023 16:58:07 +0000 (16:58 +0000)]
firmware/psci: Pass given partition number through

Pi 5 uses BL31 as its armstub file, so the reset goes via PSCI. Parse
any "reboot" parameter as a partition number to reboot into.
N.B. This code path is only used if reboot mode has been set to warm
or soft.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agodrivers/gpu/drm/panel:fix waveshare panel software restart/shutdown display is abnormal
eng33 [Mon, 11 Dec 2023 07:06:45 +0000 (15:06 +0800)]
drivers/gpu/drm/panel:fix waveshare panel software restart/shutdown display is abnormal
Fixed the screen stays white when the user restarts or shuts down

Signed-off-by: eng33 <eng33@waveshare.com>
2 months agoconfigs: Add XILLYBUS support modules
Phil Elwell [Tue, 12 Dec 2023 13:45:20 +0000 (13:45 +0000)]
configs: Add XILLYBUS support modules

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agodrivers/pinctrl/bcm/Kconfig: Fix BCM2712 help
Leon Anavi [Tue, 12 Dec 2023 11:53:37 +0000 (13:53 +0200)]
drivers/pinctrl/bcm/Kconfig: Fix BCM2712 help

Replace "Broadcom BCM2835 GPIO" with "Broadcom BCM2712 PINCONF"
in the help message. This work was sponsored by GOVCERT.LU.

Signed-off-by: Leon Anavi <leon.anavi@konsulko.com>
2 months agobcm2835-sdhost: Fail gracefully with bad dtb
Phil Elwell [Mon, 11 Dec 2023 11:20:28 +0000 (11:20 +0000)]
bcm2835-sdhost: Fail gracefully with bad dtb

The logging timestamps depend on the existence of a bcm2835-system-timer
node. If this node doesn't exist, leave the logging disabled rather than
crashing.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agoARM: dts: bcm2712: PWM references include polarity
Phil Elwell [Fri, 8 Dec 2023 15:29:38 +0000 (15:29 +0000)]
ARM: dts: bcm2712: PWM references include polarity

Increase #pwm-cells to 3 to allow for the extra polarity word.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agooverlays: rpi-poe: Add PWM polarity value
Phil Elwell [Fri, 8 Dec 2023 15:16:39 +0000 (15:16 +0000)]
overlays: rpi-poe: Add PWM polarity value

Newer kernels expect PWM references to include a polarity value as the
third parameter.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agodwc_otg: Avoid the use of align_buf for short packets
Dom Cobley [Thu, 7 Dec 2023 17:30:53 +0000 (17:30 +0000)]
dwc_otg: Avoid the use of align_buf for short packets

Recent kernels (from 6.5) fail to boot on Pi0-3.

This has been tracked down to the call to:
ret = usb_get_std_status(hdev, USB_RECIP_DEVICE, 0, &hubstatus);

returning garbage in hubstatus (it gets the uninitialised contents of
a kmalloc buffer that is not overwritten as expected).

As we don't have strong evidence that this code path has ever worked,
and it is causing a clear problem currently, lets disable it to
allow wider use of newer kernels.

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
2 months agoconfigs: rpi: Compile TSC2007 as module
Timon [Thu, 7 Dec 2023 21:31:52 +0000 (22:31 +0100)]
configs: rpi: Compile TSC2007 as module

Compile the TSC2007 touchscreen driver as a module
and enable the optional IIO module.

Signed-off-by: Timon Skerutsch <kernel@diodes-delight.com>
2 months agomedia: rp1: cfe: Improve link validation for metadata
Tomi Valkeinen [Tue, 3 Oct 2023 11:29:44 +0000 (14:29 +0300)]
media: rp1: cfe: Improve link validation for metadata

Improve the link validation for metadata by:
- Allowing capture buffers that are larger than the incoming frame
  (instead of requiring exact match).

- Instead of assuming that a metadata unit ("pixel") is 8 bits, use
  find_format_by_code() to get the format and use the bit depth from
  there. E.g. bit depth for RAW10 metadata will be 10 bits, when we
  move to the upstream metadata formats.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
2 months agomedia: rp1: fe: Use standard link_validate
Tomi Valkeinen [Tue, 3 Oct 2023 11:34:43 +0000 (14:34 +0300)]
media: rp1: fe: Use standard link_validate

The current pisp_fe_link_validate() skips some important checks. Let's
rather use the standard v4l2_subdev_link_validate_default() as the
link_validate hook.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
2 months agomedia: rp1: csi2: Use standard link_validate
Tomi Valkeinen [Tue, 3 Oct 2023 10:59:02 +0000 (13:59 +0300)]
media: rp1: csi2: Use standard link_validate

The current csi2_link_validate() skips some important checks. Let's
rather use the standard v4l2_subdev_link_validate_default() as the
link_validate hook.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
2 months agomedia: rp1: Drop LE handling
Tomi Valkeinen [Tue, 16 May 2023 12:51:54 +0000 (15:51 +0300)]
media: rp1: Drop LE handling

The driver registers for line-end interrupts, but never uses them. This
just causes extra interrupt load, with more complexity in the driver.

Drop the LE handling. It can easily be added back if later needed.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
2 months agomedia: rp1: cfe: Dual purpose video nodes
Tomi Valkeinen [Wed, 27 Sep 2023 14:18:09 +0000 (17:18 +0300)]
media: rp1: cfe: Dual purpose video nodes

The RP1 CSI-2 DMA can capture both video and metadata just fine, but at
the moment the video nodes are only set to support either video or
metadata.

Make the changes to support both video and metadata. This mostly means
tracking both video format and metadata format separately for each video
node, and using vb2_queue_change_type() to change the vb2 queue type
when needed.

Briefly, this means that the user can get/set both video and meta
formats to a single video node. The vb2 queue buffer type will be
changed when the user calls REQBUFS or CREATE_BUFS ioctls. This buffer
type will be then used as the "mode" for the video node when the user
starts the streaming, and based on that either the video or the meta
format will be used.

A bunch of macros are added (node_supports_xxx()), which tell if a node
can support a particular mode, whereas the existing macros
(is_xxx_node()) will tell if the node is currently in a particular mode.
Note that the latter will only work correctly between the start of the
streaming and the end of the streaming, and thus should be only used in
those code paths.

However, as the userspace (libcamera) does not support dual purpose
video nodes, for the time being let's keep the second video node as
V4L2_CAP_META_CAPTURE only to keep the userspace working.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
2 months agomedia: rp1: cfe: Add is_image_node()
Tomi Valkeinen [Fri, 22 Sep 2023 10:47:10 +0000 (13:47 +0300)]
media: rp1: cfe: Add is_image_node()

The hardware supports streaming from memory (in addition to streaming
from the CSI-2 RX), but the driver does not support this at the moment.

There are multiple places in the driver which uses
is_image_output_node(), even if the "output" part is not relevant. Thus,
in a minor preparation for the possible support for streaming from
memory, and to make it more obvious that the pieces of code are not
about the "output", add is_image_node() which will return true for both
input and output video nodes.

While at it, reformat also the metadata related macros to fit inside 80
columns.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
2 months agomedia: rp1: csi2: Use get_frame_desc to get CSI-2 VC and DT
Tomi Valkeinen [Thu, 21 Sep 2023 12:28:20 +0000 (15:28 +0300)]
media: rp1: csi2: Use get_frame_desc to get CSI-2 VC and DT

Use get_frame_desc pad op for asking the CSI-2 VC and DT from the source
device driver, instead of hardcoding to VC 0, and getting the DT from a
formats table. To keep backward compatibility with sources that do not
implement get_frame_desc, implement a fallback mechanism that always
uses VC 0, and gets the DT from the formats table, based on the CSI2's
sink pad's format.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
2 months agomedia: rp1: fe: Fix pisp_fe_pad_set_fmt()
Tomi Valkeinen [Fri, 29 Sep 2023 14:15:20 +0000 (17:15 +0300)]
media: rp1: fe: Fix pisp_fe_pad_set_fmt()

pisp_fe_pad_set_fmt() allows setting the pad formats quite freely. This
is not correct, and the function should only allow formats as supported
by the hardware. Fix this by:

Allow no format changes for FE_CONFIG_PAD and FE_STATS_PAD. They should
always be the hardcoded initial ones.

Allow setting FE_STREAM_PAD freely (but the mbus code must be
supported), and propagate the format to the FE_OUTPUT0_PAD and
FE_OUTPUT1_PAD pads.

Allow changing the mbus code for FE_OUTPUT0_PAD and FE_OUTPUT1_PAD pads
only if the mbus code is the compressed version of the sink side code.

TODO: FE supports scaling and cropping. This should be represented here
too?

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
2 months agomedia: rp1: csi2: Fix csi2_pad_set_fmt()
Tomi Valkeinen [Fri, 29 Sep 2023 13:25:10 +0000 (16:25 +0300)]
media: rp1: csi2: Fix csi2_pad_set_fmt()

The CSI-2 subdev's set_fmt currently allows setting the source and sink
pad formats quite freely. This is not right, as the CSI-2 block can only
do one of the following when processing the stream: 1) pass through as
is, 2) expand to 16-bits, 3) compress.

The csi2_pad_set_fmt() should take this into account, and only allow
changing the source side mbus code, compared to the sink side format.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
2 months agomedia: rp1: cfe: Add cfe_find_16bit_code() and cfe_find_compressed_code()
Tomi Valkeinen [Fri, 29 Sep 2023 14:14:11 +0000 (17:14 +0300)]
media: rp1: cfe: Add cfe_find_16bit_code() and cfe_find_compressed_code()

Add helper functions which, given an mbus code, return the 16-bit
remapped mbus code or the compressed mbus code.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
2 months agomedia: rp1: cfe: Add missing compressed remaps
Tomi Valkeinen [Fri, 29 Sep 2023 14:14:31 +0000 (17:14 +0300)]
media: rp1: cfe: Add missing compressed remaps

16-bit bayer formats are missing compressed remap definitions. Add them.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
2 months agomedia: rp1: cfe: Add missing remaps
Tomi Valkeinen [Fri, 29 Sep 2023 13:24:14 +0000 (16:24 +0300)]
media: rp1: cfe: Add missing remaps

8-bit bayer formats are missing remap definitions. Add them.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
2 months agomedia: rp1: cfe: Expose find_format_by_pix()
Tomi Valkeinen [Fri, 29 Sep 2023 13:23:58 +0000 (16:23 +0300)]
media: rp1: cfe: Expose find_format_by_pix()

Make find_format_by_pix() accessible to other files in the driver.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
2 months agoconfigs: rpi: Compile OV64A40 and BU64754 as modules
Jacopo Mondi [Tue, 17 Oct 2023 12:41:56 +0000 (14:41 +0200)]
configs: rpi: Compile OV64A40 and BU64754 as modules

Compile both the OV64A40 and the BU64754 drivers used by the Arducam
64MP camera module based as modules in the defconfig files for

- rpi5
- rpi4
- rpi2/3
- rpi1/0

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2 months agooverlays: Add overlay for the OV64A40 Arducam Camera Module
Jacopo Mondi [Thu, 20 Jul 2023 11:18:34 +0000 (13:18 +0200)]
overlays: Add overlay for the OV64A40 Arducam Camera Module

Arducam have integrated an Omnivision OV64A40 with a ROHM BU64754 VCM
with a Raspberry Pi compatible cable pinout.

Provide an overlay to support the module.

Also add support to the camera mux overlays.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2 months agomedia: i2c: Add ROHM BU64754 Camera Autofocus Actuator
Kieran Bingham [Wed, 13 Sep 2023 16:53:54 +0000 (17:53 +0100)]
media: i2c: Add ROHM BU64754 Camera Autofocus Actuator

Add support for the ROHM BU64754 Motor Driver for Camera Autofocus. A
V4L2 Subdevice is registered and provides a single
V4L2_CID_FOCUS_ABSOLUTE control.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2 months agomedia: i2c: Add driver for OmniVision OV64A40
Jacopo Mondi [Thu, 20 Jul 2023 09:44:40 +0000 (11:44 +0200)]
media: i2c: Add driver for OmniVision OV64A40

Add a driver for the OmniVision OV64A40 image sensor.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2 months agomedia: dt-bindings: i2c: Add Rohm BU64754 bindings
Kieran Bingham [Thu, 14 Sep 2023 16:03:24 +0000 (17:03 +0100)]
media: dt-bindings: i2c: Add Rohm BU64754 bindings

Add YAML device tree bindings for the ROHM BU64754 VCM Motor Driver for
Camera Autofocus.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2 months agomedia: dt-bindings: Add OmniVision OV64A40
Jacopo Mondi [Sun, 1 Oct 2023 11:20:12 +0000 (13:20 +0200)]
media: dt-bindings: Add OmniVision OV64A40

Add bindings for OmniVision OV64A40.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2 months agoRevert "overlays: Add Pi 5 version of dwc2"
Phil Elwell [Tue, 5 Dec 2023 20:48:46 +0000 (20:48 +0000)]
Revert "overlays: Add Pi 5 version of dwc2"

This reverts commit 72cd5eef1825f9ab3502d0c5584b13c43ad4c840.

We don't need a special dwc2 overlay for Pi 5, with a node to limit the
DMA zone to the first 1GB, since it turns out that the USB2 controller
has a 4GB range after all.

See https://github.com/raspberrypi/linux/pull/5772

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 months agoarm: dt: bcm2712: Correct the size of the register range for MOP
Dave Stevenson [Tue, 5 Dec 2023 18:31:25 +0000 (18:31 +0000)]
arm: dt: bcm2712: Correct the size of the register range for MOP

The Mop covers 0x28 bytes of registers, so ensure the range is
defined appropriately.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 months agodrm/vc4: Mop and moplet have different register offsets for high addr
Dave Stevenson [Tue, 5 Dec 2023 18:29:34 +0000 (18:29 +0000)]
drm/vc4: Mop and moplet have different register offsets for high addr

MOP uses register offset 0x24 for the high bits of the address,
whilst Moplet uses 0x1c.

Handle this difference between the block types.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 months agodrm/vc4: Correct HVS muxing setup for the moplet
Dave Stevenson [Tue, 5 Dec 2023 18:28:19 +0000 (18:28 +0000)]
drm/vc4: Correct HVS muxing setup for the moplet

The moplet registers as VC4_ENCODER_TYPE_TXP1 and can be
fed from mux output 2 of HVS channel 1.

Correct the option which checked for VC4_ENCODER_TYPE_TXP0

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 months agodts: bcm2712: put usb under /axi not /soc
Jonathan Bell [Tue, 5 Dec 2023 16:55:17 +0000 (16:55 +0000)]
dts: bcm2712: put usb under /axi not /soc

On 2712, the DWC USB controller is no longer attached to the Videocore
30-bit bus with its associated aliases, and can see the bottom 4GB of
RAM directly.

Ideally it should make use of IOMMU6 but for now software bounce buffers
get it working.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>