platform/kernel/linux-rpi.git
8 months agoLinux 6.6.15-rt22 22/306422/1
Jaehoon Chung [Wed, 21 Feb 2024 02:28:54 +0000 (11:28 +0900)]
Linux 6.6.15-rt22

Apply Linux 6.6.15-rt22 patches.
This is based on patche-6.6.15-rt22.patch.gz.

Change-Id: Ia5490167dbc54c5c42f7ff46b9df536af528f61a
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
8 months agovc4/hvs: Fix lbm size calculation for yuv
Dom Cobley [Fri, 16 Feb 2024 15:57:41 +0000 (15:57 +0000)]
vc4/hvs: Fix lbm size calculation for yuv

The code was reducing the number of components by one when we were not
blending with alpha. But that only makes sense if the components include
alpha.

For YUV, we were reducing the number of components for Y from one to zero
which resulted in no lbm space being allocated.

Fixes: https://github.com/raspberrypi/linux/issues/5912
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
8 months agooverlays: adau1977-adc: Replace use of i2c label
Phil Elwell [Sun, 18 Feb 2024 15:31:50 +0000 (15:31 +0000)]
overlays: adau1977-adc: Replace use of i2c label

The label 'i2c' is no longer created by the firmware - i2c_arm or
i2c1 should be used instead. Replace the last occurrence of &i2c with
&i2c1.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
8 months agoAdd overlays needed for Interlude Audio Digital and Analog hats
Ben Payne [Tue, 13 Feb 2024 22:56:28 +0000 (14:56 -0800)]
Add overlays needed for Interlude Audio Digital and Analog hats

Adding 2 new overlays for use with
Interlude Audio's Digital and Analog hats
adding descriptions for both in README
adding changes to Makefile to include both DT's

8 months agoImpliment driver support for Interlude Audio Digital Hat
Ben Payne [Tue, 13 Feb 2024 22:55:14 +0000 (14:55 -0800)]
Impliment driver support for Interlude Audio Digital Hat

Implementing driver support for
Interlude audio's WM8805 based digital hat
by leveraging existing drivers

8 months agobrcmfmac: support external SAE authentication in station mode
Chung-Hsien Hsu [Fri, 9 Apr 2021 07:48:51 +0000 (02:48 -0500)]
brcmfmac: support external SAE authentication in station mode

Firmware has SME functionality but would like the userspace to handle
SAE authentication. This patch adds support for such an external SAE
authentication mechanism in station mode.

Signed-off-by: Chung-Hsien Hsu <chung-hsien.hsu@infineon.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@infineon.com>
8 months agobrcmfmac: Fix interoperating DPP and other encryption network access
Kurt Lee [Thu, 20 Aug 2020 08:07:02 +0000 (03:07 -0500)]
brcmfmac: Fix interoperating DPP and other encryption network access

1. If firmware supports 4-way handshake offload but not supports DPP
4-way offload, when user first connects encryption network, driver will
set "sup_wpa 1" to firmware, but it will further result in DPP
connection failure since firmware won't send EAPOL frame to host.

2. Fix DPP AP mode handling action frames.

3. For some firmware without fwsup support, the join procedure will be
skipped due to "sup_wpa" iovar returning not-support. Check the fwsup
feature before do such iovar.

Signed-off-by: Kurt Lee <kurt.lee@cypress.com>
Signed-off-by: Double Lo <double.lo@cypress.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@cypress.com>
8 months agonon-upstream: support DS1 exit firmware re-download
Praveen Babu C [Tue, 9 Jan 2018 06:03:10 +0000 (11:33 +0530)]
non-upstream: support DS1 exit firmware re-download

In deep sleep mode (DS1) ARM is off and once exit trigger comes than
mailbox Interrupt comes to host and whole reinitiation should be done
in the ARM to start TX/RX.

Also fix below issus for DS1 exit:
1. Sent Tx Control frame only after firmware redownload complete (check
F2 Ready before sending Tx Control frame to Firmware)
2. intermittent High DS1 TX Exit latency time (almost 3sec) ==> This is
fixed by skipping host Mailbox interrupt Multiple times (ulp state
mechanism)
3. RX GlOM save/restore in Firmware
4. Add ULP event enable & event_msgs_ext iovar configuration in FMAC
5. Add ULP_EVENT_RECV state machine for sbwad support
6. Support 2 Byte Shared memory read for DS1 Exit HUDI implementation

Signed-off-by: Praveen Babu C <pucn@cypress.com>
Signed-off-by: Naveen Gupta <nagu@cypress.com>
[Merge from 4.14.77 to 5.4.18; set BRCMF_SDIO_MAX_ACCESS_ERRORS to 20]
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@cypress.com>
JIRA: SWWLAN-135583
JIRA: SWWLAN-136577

8 months agoPCI: brcmstb: Set new flags to avoid QOS "holes" on BCM2712D0
Nick Hollinghurst [Tue, 13 Feb 2024 17:09:47 +0000 (17:09 +0000)]
PCI: brcmstb: Set new flags to avoid QOS "holes" on BCM2712D0

Set some flags present (and recommended) in 2712D0, but missing
(and harmless) in 2712C1. In particular, EN_QOS_UPDATE_TIMING_FIX
must be set to avoid spurious QOS=0 when the queue changes from
empty to non-empty, to make D0 match the existing C1 behaviour.

Not enabling "QOS forwarding", which still seems not to help.

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
8 months agoarm: dt: bcm2712: Reduce DDC frequency to 97.5kHz from 200kHz.
Dave Stevenson [Tue, 13 Feb 2024 15:33:37 +0000 (15:33 +0000)]
arm: dt: bcm2712: Reduce DDC frequency to 97.5kHz from 200kHz.

The I2C spec says the DDC link should run at 100kHz or less, however
Pi5/BCM2712 had been configured for 200kHz.
Reduce it to comply with the spec, and match Pi4.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
8 months agoARM: dts: Add CM5 DTS support
Phil Elwell [Fri, 26 Jan 2024 16:27:28 +0000 (16:27 +0000)]
ARM: dts: Add CM5 DTS support

The CM5 is a platform that will appear in multiple boards, each of
which may have different connectivity. Split the CM5 DTS into a common
cm5.dtsi and board-specific dts files, where the CM5 DTS file (the one
loaded by the firmware by default) is an alias for the CM5IO DTS file.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
8 months agodrivers: pinctrl: add BCM2712D0 EMMC pins
Jonathan Bell [Mon, 12 Feb 2024 13:45:09 +0000 (13:45 +0000)]
drivers: pinctrl: add BCM2712D0 EMMC pins

The pad control registers are concatenated onto the GPIO pad control
registers, as with previous steppings.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
8 months agodrivers: mmc: sdhci-brcmstb: fix usage of SD_PIN_SEL on BCM2712
Jonathan Bell [Fri, 9 Feb 2024 13:47:23 +0000 (13:47 +0000)]
drivers: mmc: sdhci-brcmstb: fix usage of SD_PIN_SEL on BCM2712

The SDIO_CFG register SD_PIN_SEL conflates two settings - whether eMMC
HS or SD UHS timings are applied to the interface, and whether or not
the card-detect line is functional. SD_PIN_SEL can only be changed when
the SD clock isn't running, so add a bcm2712-specific clock setup.

Toggling SD_PIN_SEL at runtime means the integrated card-detect feature
can't be used, so this controller needs a cd-gpios property.

Also fix conditionals for usage of the delay-line PHY - no-1-8-v will
imply no bits set in hsemmc_mask or uhs_mask, so remove it.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
8 months agodts: bcm2712: update sdio1 on Pi 5
Jonathan Bell [Fri, 9 Feb 2024 13:32:38 +0000 (13:32 +0000)]
dts: bcm2712: update sdio1 on Pi 5

Switch to using card-detection via GPIO, and add missing emmc_cmd pin.
Also, "emmc_*" isn't the name of the respective function, but the name
of the pin. These pins are single-function, but need pulls set
accordingly.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
8 months agoPCI: brcmstb: Enable CRS software visibility after linkup
Jonathan Bell [Wed, 24 Jan 2024 13:55:45 +0000 (13:55 +0000)]
PCI: brcmstb: Enable CRS software visibility after linkup

It appears that bits in the Root Control Register are reset with
perst_n, which means the PCI layer's call to enable CRS prior to
adding/scanning the bus has no effect. Open-code the enable in
brcm_pcie_start_link as a workaround.

Without CRS visibility, configuration reads issued by the CPU don't
retire if the endpoint returns a CRS response - the RC will poll until a
(large) timeout is reached. This means the core can stall for a long
time during boot.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
8 months agomedia: rp1: cfe: Actually use the number of lanes configured
Dave Stevenson [Fri, 9 Feb 2024 18:52:02 +0000 (18:52 +0000)]
media: rp1: cfe: Actually use the number of lanes configured

The driver was calling get_mbus_config to ask the sensor subdev
how many CSI2 data lanes it wished to use and with what other
properties, but then failed to pass that to the DPHY configuration.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
8 months agodrivers: thermal: step_wise: add support for hysteresis
Ram Chandrasekar [Mon, 7 May 2018 17:54:08 +0000 (11:54 -0600)]
drivers: thermal: step_wise: add support for hysteresis

Step wise governor increases the mitigation level when the temperature
goes above a threshold and will decrease the mitigation when the
temperature falls below the threshold. If it were a case, where the
temperature hovers around a threshold, the mitigation will be applied
and removed at every iteration. This reaction to the temperature is
inefficient for performance.

The use of hysteresis temperature could avoid this ping-pong of
mitigation by relaxing the mitigation to happen only when the
temperature goes below this lower hysteresis value.

Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
Signed-off-by: Lina Iyer <ilina@codeaurora.org>
drivers: thermal: step_wise: avoid throttling at hysteresis temperature after dropping below it

Signed-off-by: Serge Schneider <serge@raspberrypi.com>
8 months agodrm/vc4: Disable overrun interrupts
Dave Stevenson [Wed, 24 Jan 2024 16:35:11 +0000 (16:35 +0000)]
drm/vc4: Disable overrun interrupts

We have a read-modify-write race when updating SCALER_DISPCTRL for
underrun and end-of-frame interrupts.
Ideally it would be fixed via a spinlock or similar, but that will
require a reasonable amount of study to ensure we don't get deadlocks.

The underrun reporting is only for debug, so disable it for now.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
8 months agovc4/hvs: Support fixed alpha correctly on 2712D0
Dom Cobley [Tue, 6 Feb 2024 19:59:13 +0000 (19:59 +0000)]
vc4/hvs: Support fixed alpha correctly on 2712D0

2712D0 removed alpha_mode from control word 2 for choosing fixed alpha
and replaced it with the previously reserved value of 3 in alpha_mask.

Handle this to fix corrupt desktop when using X on 2712D0

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
8 months agodrm/vc4: Drop planes that have 0 destination size
Dave Stevenson [Tue, 6 Feb 2024 17:52:49 +0000 (17:52 +0000)]
drm/vc4: Drop planes that have 0 destination size

There is no point in trying to create a dlist entry for planes
that have a 0 crtc size, and it can also cause grief in the vc6
dlist generation as it takes width-1 and height-1, causing wrap
around.
Drop these planes.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
8 months agodrm: rp1: VEC and DPI drivers: Fix bug #5901
Nick Hollinghurst [Sat, 3 Feb 2024 12:04:00 +0000 (12:04 +0000)]
drm: rp1: VEC and DPI drivers: Fix bug #5901

Rework probe() to use devm_drm_dev_alloc(), embedding the DRM
device in the DPI or VEC device as now seems to be recommended.

Change order of resource allocation and driver initialization.
This prevents it trying to write to an unmapped register during
clean-up, which previously could crash.

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
8 months agodrivers: media: cfe: Increase default size of embedded buffer
Naushir Patuck [Mon, 5 Feb 2024 12:12:17 +0000 (12:12 +0000)]
drivers: media: cfe: Increase default size of embedded buffer

Increase the size of the default embedded buffer to 16k. This is done to
match what is advertised by the IMX219 driver and workaround a problem
where the embedded stream is not actually used. Without full streams API
support, the media pipeline validation will fail in these circumstances.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
8 months agooverlays: Delete deprecated overlay mpu6050
Phil Elwell [Fri, 2 Feb 2024 14:14:47 +0000 (14:14 +0000)]
overlays: Delete deprecated overlay mpu6050

The mpu6050 overlay has been deprecated for a year (when we were still
shipping rpi-5.15.y). Delete it.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
8 months agooverlays: Correct some compatible strings
Phil Elwell [Fri, 2 Feb 2024 14:08:14 +0000 (14:08 +0000)]
overlays: Correct some compatible strings

More thorough overlay testing has identified some Pi 4-specific
overlays that has "brcm,bcm2835" compatible strings. Correct them.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
8 months agoASoC: DACplusADCPro - fix 16bit sample support in clock consumer mode
Joerg Schambacher [Fri, 2 Feb 2024 07:51:06 +0000 (08:51 +0100)]
ASoC: DACplusADCPro - fix 16bit sample support in clock consumer mode

The former code did not adjust the physical sample width when in
clock consumer mode and has taken the fixed 32 bit default. This
has caused the audio to be played at half its frequency due to
the fixed bclk_ratio of 64.

Problem appears only on PI5 as on the former PIs the I2S module
did simply run at fixed 64x rate.

Signed-off-by: Joerg Schambacher <joerg@hifiberry.com>
8 months agoDT-overlays: adds support for Hifiberry AMP4 Pro
Joerg Schambacher [Fri, 19 Jan 2024 09:44:22 +0000 (10:44 +0100)]
DT-overlays: adds support for Hifiberry AMP4 Pro

The AMP4 Pro uses a TI TAS5756 amplifier in master mode
and requires the DAC Plus card driver and the
pcm512x component driver with TAS support.

Signed-off-by: Joerg Schambacher <joerg@hifiberry.com>
8 months agoASoC: adds support for AMP4 Pro to the DAC Plus driver
Joerg Schambacher [Fri, 19 Jan 2024 09:58:39 +0000 (10:58 +0100)]
ASoC: adds support for AMP4 Pro to the DAC Plus driver

The AMP4 Pro is a I2S master mode capable amplifier with
clean onboard clock generators.
We can share the card driver between TAS575x amplifiers
and the PCM512x DACs as they are SW compatible.
From a HW perspective though we need to limit the sample
rates to the standard audio rates to avoid running the
onboard clocks through the PLL. Using the PLL would require
even a different HW.
DAI/stream name are also set accordingly to allow the user
a convenient identification of the soundcard

Needs the pcm512x driver with TAS575x support (already in
upstream kernel).

Signed-off-by: Joerg Schambacher <joerg@hifiberry.com>
8 months agoASoC: DACplus - fix 16bit sample support in clock consumer mode
Joerg Schambacher [Thu, 1 Feb 2024 16:32:44 +0000 (17:32 +0100)]
ASoC: DACplus - fix 16bit sample support in clock consumer mode

The former code did not adjust the physical sample width when
in clock consumer mode and has taken the fixed 32 bit default.
This has caused the audio to be played at half its frequency due to
the fixed bclk_ratio of 64.

Signed-off-by: Joerg Schambacher <joerg@hifiberry.com>
8 months agoUpdate touch PiTFT overlays
Melissa LeBlanc-Williams [Fri, 26 Jan 2024 22:41:42 +0000 (14:41 -0800)]
Update touch PiTFT overlays

Expose the invert and swap touch parameters on 2.8" and 3.5" resistive touchscreens. Add
the DRM parameter to the PiTFT 2.2" and 2.8" Capacitive overlay in the same
way it is on the resistive overlays. Change the DRM driver to `adafruit,yx240qv29`
because the rotations are consistent with the FBTFT Driver. Fix the override size parameters
on the 2.8" capacitive PiTFT.

Signed-off-by: Melissa LeBlanc-Williams <melissa@adafruit.com>
8 months agodrm: rp1: Use tv_mode from the command line and fix for Linux 6.6
Nick Hollinghurst [Tue, 23 Jan 2024 18:45:51 +0000 (18:45 +0000)]
drm: rp1: Use tv_mode from the command line and fix for Linux 6.6

Use the standard enum drm_connector_tv_mode instead of a private
enum and switch from the legacy to the standard tv_mode property.

Remove the module parameter "tv_norm". Instead, get tv_mode from
the command line and make this the connector's default TV mode.

Don't restrict the choice of modes based on tv_mode, but interpret
nonstandard combinations as NTSC or PAL, depending on resolution.
Thus the default tv_mode=NTSC effectively means "Auto".

Tweak the advertised horizontal timings for 625/50 to match Rec.601

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
8 months agoARM: dts: rp1: Add a safe I2C SDA hold time
Phil Elwell [Wed, 31 Jan 2024 17:44:02 +0000 (17:44 +0000)]
ARM: dts: rp1: Add a safe I2C SDA hold time

Failing to set a reasonable SDA hold time can cause SDA to change too
close to the falling edge of SCL. 300ns is the recommended minimum
interval between the two at 100kHz and 400kHz, and also seems to
work at 1MHz, so use that.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
8 months agoARM: dts: rp1: Boost the I2C drive strength
Phil Elwell [Wed, 31 Jan 2024 17:20:07 +0000 (17:20 +0000)]
ARM: dts: rp1: Boost the I2C drive strength

Boosting the drive strength on I2C pins allows SCL to achieve safe
voltage swings, even at 1MHz.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
8 months agoARM: dts: bcm2712-rpi-5-b: Add act_led_gpio
Phil Elwell [Thu, 1 Feb 2024 10:03:09 +0000 (10:03 +0000)]
ARM: dts: bcm2712-rpi-5-b: Add act_led_gpio

The Pi 5 DTB was lacking the act_led_gpio parameter, and
act_led_activelow as implemented the old way. Fix both.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
8 months agoARM: dts: Standardise downstream Pi GPIO pin names
Phil Elwell [Fri, 26 Jan 2024 17:03:35 +0000 (17:03 +0000)]
ARM: dts: Standardise downstream Pi GPIO pin names

Standardise the names of the pins on the 40-pin GPIO header. This makes
it easier to use libgpiod (and the gpiod tools) for cross-platform GPIO
manipulation.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
8 months agoconfigs: Enable RTW88 USB devices
Phil Elwell [Tue, 30 Jan 2024 16:46:09 +0000 (16:46 +0000)]
configs: Enable RTW88 USB devices

Add the config settings to build the drivers for 4 RTW88*-based USB
wireless cards.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
8 months agodrm/rp1: depends on, instead of select, MFD_RP1
Ratchanan Srirattanamet [Fri, 26 Jan 2024 11:49:42 +0000 (18:49 +0700)]
drm/rp1: depends on, instead of select, MFD_RP1

According to kconfig-language.txt [1], select should be used only for
"non-visible symbols ... and for symbols with no dependencies". Since
MFD_RP1 both is visible and has a dependency, "select" should not be
used and "depends on" should be used instead.

In particular, this fixes the build of this kernel tree on NixOS, where
its kernel config system will try to answer 'M' to as many config as
possible.

[1] https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html

Signed-off-by: Ratchanan Srirattanamet <peathot@hotmail.com>
8 months agoiommu/bcm2712: don't allow building as module
Ratchanan Srirattanamet [Tue, 30 Jan 2024 07:09:00 +0000 (14:09 +0700)]
iommu/bcm2712: don't allow building as module

Since bcm2712-iommu{,-cache}.c doesn't have usual module descriptors
such as `MODULE_LICENSE`, configuring this as 'M' fails the build with
`ERROR: modpost: missing MODULE_LICENSE() in <...>/bcm2712-iommu.o`.
Since it seems like the code is not intended to be built as a module
anyway (it registers the driver with `builtin_platform_driver()`), don't
allow building this code as a module.

Signed-off-by: Ratchanan Srirattanamet <peathot@hotmail.com>
8 months agoconfigs: Add NVME_HWMON=y to the Pi 5 kernels
Phil Elwell [Tue, 30 Jan 2024 13:26:58 +0000 (13:26 +0000)]
configs: Add NVME_HWMON=y to the Pi 5 kernels

Enabling NVME_HWMON gives access to the temperature of an NVME drive,
something which could be useful on a Pi 5. Enable the option in the
arm64 configs bcm2712_defconfig and bcm2711_defconfig.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
8 months agoARM: dts: rp1: Add I2C timings
Phil Elwell [Tue, 16 Jan 2024 16:05:18 +0000 (16:05 +0000)]
ARM: dts: rp1: Add I2C timings

Add SCL rise and fall times, to allow the derivation of timings at
arbitrary speeds.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
8 months agoi2c: designware: Support non-standard bus speeds
Phil Elwell [Tue, 16 Jan 2024 16:03:14 +0000 (16:03 +0000)]
i2c: designware: Support non-standard bus speeds

Add support for non-standard bus speeds by treating them as detuned
versions of the slowest standard speed not less than the requested
speed.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
8 months agoi2c: designware: Use SCL rise and fall times in DT
Phil Elwell [Tue, 16 Jan 2024 15:54:22 +0000 (15:54 +0000)]
i2c: designware: Use SCL rise and fall times in DT

Calculate the HCNT and LCNT values for all modes using the rise and
fall times of SCL, the aim being a 50/50 mark/space ratio.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
8 months agoRevert "i2c: designware: Look for *CNT values in DT"
Phil Elwell [Mon, 29 Jan 2024 17:50:56 +0000 (17:50 +0000)]
Revert "i2c: designware: Look for *CNT values in DT"

This reverts commit 78bb16b5d255f7ca88cf79388caa8f1b3f4aa681.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
8 months agoRevert "dts: rp1: Add I2C timings"
Phil Elwell [Mon, 29 Jan 2024 17:50:14 +0000 (17:50 +0000)]
Revert "dts: rp1: Add I2C timings"

This reverts commit bcbbe211335fcb603c64fe444e7372176a9e67ec.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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

8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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

8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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

8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>