bcm27xx: update patches up to Git HEAD as of 2026-11-17

These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.18.y
Patches were generated from the diff between linux kernel branch linux-6.18.y
and rpi-6.18.y from raspberry pi kernel source:

git format-patch -N linux-6.18.y..rpi-6.18.y (HEAD)
(HEAD -> b0b7d2006113562307ade2f6a075b03f3a781346) as of 20261117
"Commit: drm/vc4: Keep the source offset for an async page flip"

Exceptions:
- github workflow patches
- applied and reverted patches
- README patches
- (def)configs
- patches merged upstream
- wireless/wifi patches (net/wireless, net/mac80211 and
  drivers/net/wireless are built from the mac80211 backports
  package, e.g. rtw89, brcmfmac, cfg80211 regdb certificates)

Patches refreshed against current OpenWrt-kernel.

Add the new CONFIG_VIDEO_IMX678 and CONFIG_VIDEO_SONY_STARVIS2 symbols,
disabled by default, to the generic config.

Signed-off-by: Joshua Covington <joshuacov@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26804
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Joshua Covington authored and Robert Marko committed 2026-11-26 10:51:39 +01:00
1 parent f76496253d
commit fef3901d8c
190 files changed
+20258 -6101

No files matched your search

@@ -678,7 +678,6 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
.../boot/dts/broadcom/bcm2710-rpi-zero-2.dts | 1 +
.../boot/dts/broadcom/bcm2711-rpi-cm4.dts | 1 +
.../boot/dts/broadcom/bcm2711-rpi-cm4s.dts | 1 +
.../boot/dts/broadcom/bcm2712-d-rpi-5-b.dts | 8 +
arch/arm64/boot/dts/broadcom/bcm2712-ds.dtsi | 501 ++
.../dts/broadcom/bcm2712-rpi-5-b-ovl-rp1.dts | 254 -
.../boot/dts/broadcom/bcm2712-rpi-5-b.dts | 779 ++-
@@ -701,7 +700,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
include/dt-bindings/gpio/gpio-fsm.h | 21 +
scripts/Makefile.dtbinst | 9 +-
scripts/Makefile.dtbs | 26 +-
462 files changed, 47091 insertions(+), 385 deletions(-)
461 files changed, 47083 insertions(+), 385 deletions(-)
create mode 100644 arch/arm/boot/dts/broadcom/bcm2708-rpi-b-plus.dts
create mode 100644 arch/arm/boot/dts/broadcom/bcm2708-rpi-b-rev1.dts
create mode 100644 arch/arm/boot/dts/broadcom/bcm2708-rpi-b.dts
@@ -45426,20 +45425,6 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
+++ b/arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4s.dts
@@ -0,0 +1 @@
+#include "arm/broadcom/bcm2711-rpi-cm4s.dts"
--- a/arch/arm64/boot/dts/broadcom/bcm2712-d-rpi-5-b.dts
+++ b/arch/arm64/boot/dts/broadcom/bcm2712-d-rpi-5-b.dts
@@ -49,3 +49,11 @@
&uart10 {
interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
};
+
+&pinctrl_aon {
+ compatible = "brcm,bcm2712d0-aon-pinctrl";
+};
+
+&pinctrl {
+ compatible = "brcm,bcm2712c0-aon-pinctrl";
+};
--- /dev/null
+++ b/arch/arm64/boot/dts/broadcom/bcm2712-ds.dtsi
@@ -0,0 +1,501 @@
@@ -1,29 +0,0 @@
From c861a59812426283a3197700c5c27e3114c8e8eb Mon Sep 17 00:00:00 2001
From: Cheong2K <cheong@redbear.cc>
Date: Fri, 26 Feb 2016 18:20:10 +0800
Subject: [PATCH] brcm: adds support for BCM43341 wifi
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -609,6 +609,7 @@ BRCMF_FW_DEF(4329, "brcmfmac4329-sdio");
BRCMF_FW_DEF(4330, "brcmfmac4330-sdio");
BRCMF_FW_DEF(4334, "brcmfmac4334-sdio");
BRCMF_FW_DEF(43340, "brcmfmac43340-sdio");
+BRCMF_FW_DEF(43341, "brcmfmac43341-sdio");
BRCMF_FW_DEF(4335, "brcmfmac4335-sdio");
BRCMF_FW_DEF(43362, "brcmfmac43362-sdio");
BRCMF_FW_DEF(4339, "brcmfmac4339-sdio");
@@ -641,7 +642,7 @@ static const struct brcmf_firmware_mappi
BRCMF_FW_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330),
BRCMF_FW_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334),
BRCMF_FW_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340),
- BRCMF_FW_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43340),
+ BRCMF_FW_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43341),
BRCMF_FW_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335),
BRCMF_FW_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362),
BRCMF_FW_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339),
@@ -1,20 +0,0 @@
From fd2e5044b7d8764e443150a107f8e9253f8012d8 Mon Sep 17 00:00:00 2001
From: Jonathan Bell <jonathan@raspberrypi.org>
Date: Wed, 12 Sep 2018 14:44:53 +0100
Subject: [PATCH] bcmgenet: constrain max DMA burst length
---
drivers/net/ethernet/broadcom/genet/bcmgenet.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
@@ -35,7 +35,7 @@
#define ENET_PAD 8
#define ENET_MAX_MTU_SIZE (ETH_DATA_LEN + ETH_HLEN + VLAN_HLEN + \
ENET_BRCM_TAG_LEN + ETH_FCS_LEN + ENET_PAD)
-#define DMA_MAX_BURST_LENGTH 0x10
+#define DMA_MAX_BURST_LENGTH 0x08
/* misc. configuration */
#define MAX_NUM_OF_FS_RULES 16
@@ -1,51 +0,0 @@
From 6f2dea0830276e2665b4531c4e5eaf489f5cc69d Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Fri, 9 Aug 2019 08:51:43 +0100
Subject: [PATCH] net: bcmgenet: Workaround #2 for Pi4 Ethernet fail
Some combinations of Pi 4Bs and Ethernet switches don't reliably get a
DCHP-assigned IP address, leaving the unit with a self=assigned 169.254
address. In the failure case, the Pi is left able to receive packets
but not send them, suggesting that the MAC<->PHY link is getting into
a bad state.
It has been found empirically that skipping a reset step by the genet
driver prevents the failures. No downsides have been discovered yet,
and unlike the forced renegotiation it doesn't increase the time to
get an IP address, so the workaround is enabled by default; add
genet.skip_umac_reset=n
to the command line to disable it.
See: https://github.com/raspberrypi/linux/issues/3108
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 8 ++++++++
1 file changed, 8 insertions(+)
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -73,6 +73,9 @@
/* Forward declarations */
static void bcmgenet_set_rx_mode(struct net_device *dev);
+static bool skip_umac_reset = true;
+module_param(skip_umac_reset, bool, 0444);
+MODULE_PARM_DESC(skip_umac_reset, "Skip UMAC reset step");
static inline void bcmgenet_writel(u32 value, void __iomem *offset)
{
@@ -2592,6 +2595,11 @@ static void reset_umac(struct bcmgenet_p
bcmgenet_rbuf_ctrl_set(priv, 0);
udelay(10);
+ if (skip_umac_reset) {
+ pr_warn("Skipping UMAC reset\n");
+ return;
+ }
+
/* issue soft reset and disable MAC while updating its registers */
spin_lock_bh(&priv->reg_lock);
bcmgenet_umac_writel(priv, CMD_SW_RESET, UMAC_CMD);
@@ -1,23 +0,0 @@
From 83e04472d2b45b7eb01a80470b5bf3ad4fc9ee66 Mon Sep 17 00:00:00 2001
From: popcornmix <popcornmix@gmail.com>
Date: Wed, 1 Apr 2020 11:22:44 +0100
Subject: [PATCH] bcmgenet: Disable skip_umac_reset by default
Possible fixed upstream by 'net: bcmgenet: keep MAC in reset until PHY is up'
Signed-off-by: popcornmix <popcornmix@gmail.com>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -73,7 +73,7 @@
/* Forward declarations */
static void bcmgenet_set_rx_mode(struct net_device *dev);
-static bool skip_umac_reset = true;
+static bool skip_umac_reset = false;
module_param(skip_umac_reset, bool, 0444);
MODULE_PARM_DESC(skip_umac_reset, "Skip UMAC reset step");
@@ -1,85 +0,0 @@
From 89a64d88e3c762d2666ec5b9bc115c94de764c2c Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Tue, 7 Jun 2022 12:02:10 +0200
Subject: [PATCH] random: do not use jump labels before they are initialized
[ I would like to pursue fixing this more directly first before actually
merging this, but I thought I'd send this to the list now anyway as a
the "backup" plan. If I can't figure out how to make headway on the
main plan in the next few days, it'll be easy to just do this. ]
Stephen reported that a static key warning splat appears during early
boot on systems that credit randomness from device trees that contain an
"rng-seed" property, because because setup_machine_fdt() is called
before jump_label_init() during setup_arch():
static_key_enable_cpuslocked(): static key '0xffffffe51c6fcfc0' used before call to jump_label_init()
WARNING: CPU: 0 PID: 0 at kernel/jump_label.c:166 static_key_enable_cpuslocked+0xb0/0xb8
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 5.18.0+ #224 44b43e377bfc84bc99bb5ab885ff694984ee09ff
pstate: 600001c9 (nZCv dAIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : static_key_enable_cpuslocked+0xb0/0xb8
lr : static_key_enable_cpuslocked+0xb0/0xb8
sp : ffffffe51c393cf0
x29: ffffffe51c393cf0 x28: 000000008185054c x27: 00000000f1042f10
x26: 0000000000000000 x25: 00000000f10302b2 x24: 0000002513200000
x23: 0000002513200000 x22: ffffffe51c1c9000 x21: fffffffdfdc00000
x20: ffffffe51c2f0831 x19: ffffffe51c6fcfc0 x18: 00000000ffff1020
x17: 00000000e1e2ac90 x16: 00000000000000e0 x15: ffffffe51b710708
x14: 0000000000000066 x13: 0000000000000018 x12: 0000000000000000
x11: 0000000000000000 x10: 00000000ffffffff x9 : 0000000000000000
x8 : 0000000000000000 x7 : 61632065726f6665 x6 : 6220646573752027
x5 : ffffffe51c641d25 x4 : ffffffe51c13142c x3 : ffff0a00ffffff05
x2 : 40000000ffffe003 x1 : 00000000000001c0 x0 : 0000000000000065
Call trace:
static_key_enable_cpuslocked+0xb0/0xb8
static_key_enable+0x2c/0x40
crng_set_ready+0x24/0x30
execute_in_process_context+0x80/0x90
_credit_init_bits+0x100/0x154
add_bootloader_randomness+0x64/0x78
early_init_dt_scan_chosen+0x140/0x184
early_init_dt_scan_nodes+0x28/0x4c
early_init_dt_scan+0x40/0x44
setup_machine_fdt+0x7c/0x120
setup_arch+0x74/0x1d8
start_kernel+0x84/0x44c
__primary_switched+0xc0/0xc8
---[ end trace 0000000000000000 ]---
random: crng init done
Machine model: Google Lazor (rev1 - 2) with LTE
A trivial fix went in to address this on arm64, 73e2d827a501 ("arm64:
Initialize jump labels before setup_machine_fdt()"). But it appears that
fixing it on other platforms might not be so trivial. Instead, defer the
setting of the static branch until later in the boot process.
Fixes: f5bda35fba61 ("random: use static branch for crng_ready()")
Reported-by: Stephen Boyd <swboyd@chromium.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Phil Elwell <phil@raspberrypi.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
drivers/char/random.c | 8 ++++++++
1 file changed, 8 insertions(+)
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -859,6 +859,14 @@ void __init random_init_early(const char
unsigned long entropy[BLAKE2S_BLOCK_SIZE / sizeof(long)];
size_t i, longs, arch_bits;
+ /*
+ * If we were initialized by the bootloader before jump labels are
+ * initialized, then we should enable the static branch here, where
+ * it's guaranteed that jump labels have been initialized.
+ */
+ if (!static_branch_likely(&crng_is_ready) && crng_init >= CRNG_READY)
+ crng_set_ready(NULL);
+
#if defined(LATENT_ENTROPY_PLUGIN)
static const u8 compiletime_seed[BLAKE2S_BLOCK_SIZE] __initconst __latent_entropy;
_mix_pool_bytes(compiletime_seed, sizeof(compiletime_seed));
@@ -1,46 +0,0 @@
From 69de04afd679fb5df8ce9094fef13f2b028a8075 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Wed, 14 Dec 2022 15:00:51 +0000
Subject: [PATCH] net: bcmgenet: Add 'eee' module parameter
On some switches, having EEE enabled causes the link to become
unstable. With this patch, adding 'genet.eee=N' to the kernel command
line will cause EEE to be disabled on the link.
See: https://github.com/raspberrypi/linux/issues/4289
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -76,6 +76,9 @@ static void bcmgenet_set_rx_mode(struct
static bool skip_umac_reset = false;
module_param(skip_umac_reset, bool, 0444);
MODULE_PARM_DESC(skip_umac_reset, "Skip UMAC reset step");
+static bool eee = true;
+module_param(eee, bool, 0444);
+MODULE_PARM_DESC(eee, "Enable EEE (default Y)");
static inline void bcmgenet_writel(u32 value, void __iomem *offset)
{
@@ -3449,6 +3452,17 @@ static int bcmgenet_open(struct net_devi
bcmgenet_phy_pause_set(dev, priv->rx_pause, priv->tx_pause);
+ if (!eee) {
+ struct ethtool_keee eee_data;
+
+ ret = bcmgenet_get_eee(dev, &eee_data);
+ if (ret == 0) {
+ eee_data.eee_enabled = 0;
+ bcmgenet_set_eee(dev, &eee_data);
+ netdev_warn(dev, "EEE disabled\n");
+ }
+ }
+
bcmgenet_netif_start(dev);
netif_tx_start_all_queues(dev);
@@ -103,41 +103,32 @@ Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
.compatible = "rockchip,rk3588-dwcmshc",
.data = &sdhci_dwcmshc_rk35xx_pdata,
},
@@ -1430,13 +1460,32 @@ static int dwcmshc_probe(struct platform
@@ -1430,13 +1460,23 @@ static int dwcmshc_probe(struct platform
if (err)
goto err_clk;
}
+
+ pltfm_host->timeout_clk = devm_clk_get(dev, "timeout");
+ if (!IS_ERR(pltfm_host->timeout_clk))
+ if (!IS_ERR(pltfm_host->timeout_clk)) {
+ err = clk_prepare_enable(pltfm_host->timeout_clk);
+ if (err)
+ goto err_bus_clk;
+ if (err)
+ goto err_bus_clk;
+ }
+
+ priv->sdio_clk = devm_clk_get_optional(&pdev->dev, "sdio");
}
- err = mmc_of_parse(host->mmc);
+ pltfm_host->timeout_clk = devm_clk_get(&pdev->dev, "timeout");
+ if (IS_ERR(pltfm_host->timeout_clk)) {
+ err = PTR_ERR(pltfm_host->timeout_clk);
+ dev_err(&pdev->dev, "failed to get timeout clk: %d\n", err);
+ goto err_bus_clk;
+ }
+ err = clk_prepare_enable(pltfm_host->timeout_clk);
err = mmc_of_parse(host->mmc);
if (err)
goto err_bus_clk;
+ err = mmc_of_parse(host->mmc);
+ if (err)
- goto err_bus_clk;
+ goto err_timeout_clk;
+
sdhci_get_of_property(pdev);
+ sdhci_enable_v4_mode(host);
priv->vendor_specific_area1 =
sdhci_readl(host, DWCMSHC_P_VENDOR_AREA1) & DWCMSHC_AREA1_MASK;
@@ -1448,7 +1497,7 @@ static int dwcmshc_probe(struct platform
@@ -1448,7 +1488,7 @@ static int dwcmshc_probe(struct platform
if (pltfm_data->init) {
err = pltfm_data->init(&pdev->dev, host, priv);
if (err)
@@ -146,7 +137,7 @@ Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
}
#ifdef CONFIG_ACPI
@@ -1494,6 +1543,8 @@ err_setup_host:
@@ -1494,6 +1534,8 @@ err_setup_host:
err_rpm:
pm_runtime_disable(dev);
pm_runtime_put_noidle(dev);
@@ -1,720 +0,0 @@
From 8f06fce0e503c1901f7dbee62ec90f5fb3af92e1 Mon Sep 17 00:00:00 2001
From: Praveen Babu C <pucn@cypress.com>
Date: Tue, 9 Jan 2018 11:33:10 +0530
Subject: [PATCH] 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
---
.../broadcom/brcm80211/brcmfmac/bus.h | 2 +-
.../broadcom/brcm80211/brcmfmac/common.c | 39 +++
.../broadcom/brcm80211/brcmfmac/core.c | 12 +-
.../broadcom/brcm80211/brcmfmac/debug.h | 1 +
.../broadcom/brcm80211/brcmfmac/fweh.h | 31 ++-
.../broadcom/brcm80211/brcmfmac/pcie.c | 2 +-
.../broadcom/brcm80211/brcmfmac/sdio.c | 260 +++++++++++++++++-
.../broadcom/brcm80211/brcmfmac/sdio.h | 110 ++++++++
.../broadcom/brcm80211/brcmfmac/usb.c | 4 +-
.../broadcom/brcm80211/include/chipcommon.h | 2 +
10 files changed, 447 insertions(+), 16 deletions(-)
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
@@ -304,7 +304,7 @@ void brcmf_rx_event(struct device *dev,
int brcmf_alloc(struct device *dev, struct brcmf_mp_device *settings);
/* Indication from bus module regarding presence/insertion of dongle. */
-int brcmf_attach(struct device *dev);
+int brcmf_attach(struct device *dev, bool start_bus);
/* Indication from bus module regarding removal/absence of dongle */
void brcmf_detach(struct device *dev);
void brcmf_free(struct device *dev);
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
@@ -20,6 +20,8 @@
#include "of.h"
#include "firmware.h"
#include "chip.h"
+#include "fweh.h"
+#include <brcm_hw_ids.h>
MODULE_AUTHOR("Broadcom Corporation");
MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
@@ -274,6 +276,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
char *clmver;
char *ptr;
s32 err;
+ struct eventmsgs_ext *eventmask_msg = NULL;
+ u8 msglen;
if (is_valid_ether_addr(ifp->mac_addr)) {
/* set mac address */
@@ -433,6 +437,41 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
goto done;
}
+ /* Enable event_msg_ext specific to 43012 chip */
+ if (bus->chip == CY_CC_43012_CHIP_ID) {
+ /* Program event_msg_ext to support event larger than 128 */
+ msglen = (roundup(BRCMF_E_LAST, NBBY) / NBBY) +
+ EVENTMSGS_EXT_STRUCT_SIZE;
+ /* Allocate buffer for eventmask_msg */
+ eventmask_msg = kzalloc(msglen, GFP_KERNEL);
+ if (!eventmask_msg) {
+ err = -ENOMEM;
+ goto done;
+ }
+
+ /* Read the current programmed event_msgs_ext */
+ eventmask_msg->ver = EVENTMSGS_VER;
+ eventmask_msg->len = roundup(BRCMF_E_LAST, NBBY) / NBBY;
+ err = brcmf_fil_iovar_data_get(ifp, "event_msgs_ext",
+ eventmask_msg,
+ msglen);
+
+ /* Enable ULP event */
+ brcmf_dbg(EVENT, "enable event ULP\n");
+ setbit(eventmask_msg->mask, BRCMF_E_ULP);
+
+ /* Write updated Event mask */
+ eventmask_msg->ver = EVENTMSGS_VER;
+ eventmask_msg->command = EVENTMSGS_SET_MASK;
+ eventmask_msg->len = (roundup(BRCMF_E_LAST, NBBY) / NBBY);
+
+ err = brcmf_fil_iovar_data_set(ifp, "event_msgs_ext",
+ eventmask_msg, msglen);
+ if (err) {
+ brcmf_err("Set event_msgs_ext error (%d)\n", err);
+ goto done;
+ }
+ }
/* Setup default scan channel time */
err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
BRCMF_DEFAULT_SCAN_CHANNEL_TIME);
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -1358,7 +1358,7 @@ int brcmf_alloc(struct device *dev, stru
return 0;
}
-int brcmf_attach(struct device *dev)
+int brcmf_attach(struct device *dev, bool start_bus)
{
struct brcmf_bus *bus_if = dev_get_drvdata(dev);
struct brcmf_pub *drvr = bus_if->drvr;
@@ -1401,10 +1401,12 @@ int brcmf_attach(struct device *dev)
brcmf_fwvid_get_cfg80211_ops(drvr);
- ret = brcmf_bus_started(drvr, drvr->ops);
- if (ret != 0) {
- bphy_err(drvr, "dongle is not responding: err=%d\n", ret);
- goto fail;
+ if (start_bus) {
+ ret = brcmf_bus_started(drvr, drvr->ops);
+ if (ret != 0) {
+ bphy_err(drvr, "dongle is not responding: err=%d\n", ret);
+ goto fail;
+ }
}
return 0;
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
@@ -29,6 +29,7 @@
#define BRCMF_MSGBUF_VAL 0x00040000
#define BRCMF_PCIE_VAL 0x00080000
#define BRCMF_FWCON_VAL 0x00100000
+#define BRCMF_ULP_VAL 0x00200000
/* set default print format */
#undef pr_fmt
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h
@@ -98,7 +98,8 @@ struct brcmf_cfg80211_info;
BRCMF_ABSTRACT_ENUM_DEF(EXT_AUTH_REQ, 0) \
BRCMF_ABSTRACT_ENUM_DEF(EXT_AUTH_FRAME_RX, 1) \
BRCMF_ABSTRACT_ENUM_DEF(MGMT_FRAME_TXSTATUS, 2) \
- BRCMF_ABSTRACT_ENUM_DEF(MGMT_FRAME_OFFCHAN_DONE, 3)
+ BRCMF_ABSTRACT_ENUM_DEF(MGMT_FRAME_OFFCHAN_DONE, 3) \
+ BRCMF_ENUM_DEF(ULP, 146)
#define BRCMF_ENUM_DEF(id, val) \
BRCMF_E_##id = (val),
@@ -106,6 +107,12 @@ struct brcmf_cfg80211_info;
/* firmware event codes sent by the dongle */
enum brcmf_fweh_event_code {
BRCMF_FWEH_EVENT_ENUM_DEFLIST
+
+ /* this determines event mask length which must match
+ * minimum length check in device firmware so it is
+ * hard-coded here.
+ */
+ BRCMF_E_LAST
};
#undef BRCMF_ENUM_DEF
@@ -284,6 +291,28 @@ struct brcmf_if_event {
u8 role;
};
+enum event_msgs_ext_command {
+ EVENTMSGS_NONE = 0,
+ EVENTMSGS_SET_BIT = 1,
+ EVENTMSGS_RESET_BIT = 2,
+ EVENTMSGS_SET_MASK = 3
+};
+
+#define EVENTMSGS_VER 1
+#define EVENTMSGS_EXT_STRUCT_SIZE offsetof(struct eventmsgs_ext, mask[0])
+
+/* len- for SET it would be mask size from the application to the firmware */
+/* for GET it would be actual firmware mask size */
+/* maxgetsize - is only used for GET. indicate max mask size that the */
+/* application can read from the firmware */
+struct eventmsgs_ext {
+ u8 ver;
+ u8 command;
+ u8 len;
+ u8 maxgetsize;
+ u8 mask[];
+};
+
typedef int (*brcmf_fweh_handler_t)(struct brcmf_if *ifp,
const struct brcmf_event_msg *evtmsg,
void *data);
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -2218,7 +2218,7 @@ static void brcmf_pcie_setup(struct devi
init_waitqueue_head(&devinfo->mbdata_resp_wait);
- ret = brcmf_attach(&devinfo->pdev->dev);
+ ret = brcmf_attach(&devinfo->pdev->dev, true);
if (ret)
goto fail;
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -35,9 +35,12 @@
#include "core.h"
#include "common.h"
#include "bcdc.h"
+#include "debug.h"
+#include "fwil.h"
#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
#define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
+#define ULP_HUDI_PROC_DONE_TIME msecs_to_jiffies(2500)
/* watermark expressed in number of words */
#define DEFAULT_F2_WATERMARK 0x8
@@ -325,7 +328,16 @@ struct rte_console {
#define KSO_WAIT_US 50
#define MAX_KSO_ATTEMPTS (PMU_MAX_TRANSITION_DLY/KSO_WAIT_US)
-#define BRCMF_SDIO_MAX_ACCESS_ERRORS 5
+#define BRCMF_SDIO_MAX_ACCESS_ERRORS 20
+
+static void brcmf_sdio_firmware_callback(struct device *dev, int err,
+ struct brcmf_fw_request *fwreq);
+static struct brcmf_fw_request *
+ brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus);
+static int brcmf_sdio_f2_ready(struct brcmf_sdio *bus);
+static int brcmf_ulp_event_notify(struct brcmf_if *ifp,
+ const struct brcmf_event_msg *evtmsg,
+ void *data);
#ifdef DEBUG
/* Device console log buffer state */
@@ -1106,7 +1118,7 @@ static void brcmf_sdio_get_console_addr(
}
#endif /* DEBUG */
-static u32 brcmf_sdio_hostmail(struct brcmf_sdio *bus)
+static u32 brcmf_sdio_hostmail(struct brcmf_sdio *bus, u32 *hmbd)
{
struct brcmf_sdio_dev *sdiod = bus->sdiodev;
struct brcmf_core *core = bus->sdio_core;
@@ -1195,6 +1207,9 @@ static u32 brcmf_sdio_hostmail(struct br
HMB_DATA_FCDATA_MASK | HMB_DATA_VERSION_MASK))
brcmf_err("Unknown mailbox data content: 0x%02x\n",
hmb_data);
+ /* Populate hmb_data if argument is passed for DS1 check later */
+ if (hmbd)
+ *hmbd = hmb_data;
return intstatus;
}
@@ -2583,6 +2598,182 @@ static int brcmf_sdio_intr_rstatus(struc
return ret;
}
+/* This Function is used to retrieve important
+ * details from dongle related to ULP mode Mostly
+ * values/SHM details that will be vary depending
+ * on the firmware branches
+ */
+static void
+brcmf_sdio_ulp_preinit(struct device *dev)
+{
+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
+ struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
+ struct brcmf_if *ifp = bus_if->drvr->iflist[0];
+
+ brcmf_dbg(ULP, "Enter\n");
+
+ /* Query ulp_sdioctrl iovar to get the ULP related SHM offsets */
+ brcmf_fil_iovar_data_get(ifp, "ulp_sdioctrl",
+ &sdiodev->fmac_ulp.ulp_shm_offset,
+ sizeof(sdiodev->fmac_ulp.ulp_shm_offset));
+
+ sdiodev->ulp = false;
+
+ brcmf_dbg(ULP, "m_ulp_ctrl_sdio[%x] m_ulp_wakeevt_ind [%x]\n",
+ M_DS1_CTRL_SDIO(sdiodev->fmac_ulp),
+ M_WAKEEVENT_IND(sdiodev->fmac_ulp));
+ brcmf_dbg(ULP, "m_ulp_wakeind [%x]\n",
+ M_ULP_WAKE_IND(sdiodev->fmac_ulp));
+}
+
+/* Reinitialize ARM because In DS1 mode ARM got off */
+static int
+brcmf_sdio_ulp_reinit_fw(struct brcmf_sdio *bus)
+{
+ struct brcmf_sdio_dev *sdiodev = bus->sdiodev;
+ struct brcmf_fw_request *fwreq;
+ int err = 0;
+
+ /* After firmware redownload tx/rx seq are reset accordingly
+ * these values are reset on FMAC side tx_max is initially set to 4,
+ * which later is updated by FW.
+ */
+ bus->tx_seq = 0;
+ bus->rx_seq = 0;
+ bus->tx_max = 4;
+
+ fwreq = brcmf_sdio_prepare_fw_request(bus);
+ if (!fwreq)
+ return -ENOMEM;
+
+ err = brcmf_fw_get_firmwares(sdiodev->dev, fwreq,
+ brcmf_sdio_firmware_callback);
+ if (err != 0) {
+ brcmf_err("async firmware request failed: %d\n", err);
+ kfree(fwreq);
+ }
+
+ return err;
+}
+
+/* Check if device is in DS1 mode and handshake with ULP UCODE */
+static bool
+brcmf_sdio_ulp_pre_redownload_check(struct brcmf_sdio *bus, u32 hmb_data)
+{
+ struct brcmf_sdio_dev *sdiod = bus->sdiodev;
+ int err = 0;
+ u32 value = 0;
+ u32 val32, ulp_wake_ind, wowl_wake_ind;
+ int reg_addr;
+ unsigned long timeout;
+ struct brcmf_ulp *fmac_ulp = &bus->sdiodev->fmac_ulp;
+ int i = 0;
+
+ /* If any host mail box data is present, ignore DS1 exit sequence */
+ if (hmb_data)
+ return false;
+ /* Skip if DS1 Exit is already in progress
+ * This can happen if firmware download is taking more time
+ */
+ if (fmac_ulp->ulp_state == FMAC_ULP_TRIGGERED)
+ return false;
+
+ value = brcmf_sdiod_func0_rb(sdiod, SDIO_CCCR_IOEx, &err);
+
+ if (value == SDIO_FUNC_ENABLE_1) {
+ brcmf_dbg(ULP, "GOT THE INTERRUPT FROM UCODE\n");
+ sdiod->ulp = true;
+ fmac_ulp->ulp_state = FMAC_ULP_TRIGGERED;
+ ulp_wake_ind = D11SHM_RDW(sdiod,
+ M_ULP_WAKE_IND(sdiod->fmac_ulp),
+ &err);
+ wowl_wake_ind = D11SHM_RDW(sdiod,
+ M_WAKEEVENT_IND(sdiod->fmac_ulp),
+ &err);
+
+ brcmf_dbg(ULP, "wowl_wake_ind: 0x%08x, ulp_wake_ind: 0x%08x state %s\n",
+ wowl_wake_ind, ulp_wake_ind, (fmac_ulp->ulp_state) ?
+ "DS1 Exit Triggered" : "IDLE State");
+
+ if (wowl_wake_ind || ulp_wake_ind) {
+ /* RX wake Don't do anything.
+ * Just bail out and re-download firmware.
+ */
+ /* Print out PHY TX error block when bit 9 set */
+ if ((ulp_wake_ind & C_DS1_PHY_TXERR) &&
+ M_DS1_PHYTX_ERR_BLK(sdiod->fmac_ulp)) {
+ brcmf_err("Dump PHY TX Error SHM Locations\n");
+ for (i = 0; i < PHYTX_ERR_BLK_SIZE; i++) {
+ pr_err("0x%x",
+ D11SHM_RDW(sdiod,
+ (M_DS1_PHYTX_ERR_BLK(sdiod->fmac_ulp) +
+ (i * 2)), &err));
+ }
+ brcmf_err("\n");
+ }
+ } else {
+ /* TX wake negotiate with MAC */
+ brcmf_dbg(ULP, "M_DS1_CTRL_SDIO: 0x%08x\n",
+ (u32)D11SHM_RDW(sdiod,
+ M_DS1_CTRL_SDIO(sdiod->fmac_ulp),
+ &err));
+ val32 = D11SHM_RD(sdiod,
+ M_DS1_CTRL_SDIO(sdiod->fmac_ulp),
+ &err);
+ D11SHM_WR(sdiod, M_DS1_CTRL_SDIO(sdiod->fmac_ulp),
+ val32, (C_DS1_CTRL_SDIO_DS1_EXIT |
+ C_DS1_CTRL_REQ_VALID), &err);
+ val32 = D11REG_RD(sdiod, D11_MACCONTROL_REG, &err);
+ val32 = val32 | D11_MACCONTROL_REG_WAKE;
+ D11REG_WR(sdiod, D11_MACCONTROL_REG, val32, &err);
+
+ /* Poll for PROC_DONE to be set by ucode */
+ value = D11SHM_RDW(sdiod,
+ M_DS1_CTRL_SDIO(sdiod->fmac_ulp),
+ &err);
+ /* Wait here (polling) for C_DS1_CTRL_PROC_DONE */
+ timeout = jiffies + ULP_HUDI_PROC_DONE_TIME;
+ while (!(value & C_DS1_CTRL_PROC_DONE)) {
+ value = D11SHM_RDW(sdiod,
+ M_DS1_CTRL_SDIO(sdiod->fmac_ulp),
+ &err);
+ if (time_after(jiffies, timeout))
+ break;
+ usleep_range(1000, 2000);
+ }
+ brcmf_dbg(ULP, "M_DS1_CTRL_SDIO: 0x%08x\n",
+ (u32)D11SHM_RDW(sdiod,
+ M_DS1_CTRL_SDIO(sdiod->fmac_ulp), &err));
+ value = D11SHM_RDW(sdiod,
+ M_DS1_CTRL_SDIO(sdiod->fmac_ulp),
+ &err);
+ if (!(value & C_DS1_CTRL_PROC_DONE)) {
+ brcmf_err("Timeout Failed to enter DS1 Exit state!\n");
+ return false;
+ }
+ }
+
+ ulp_wake_ind = D11SHM_RDW(sdiod,
+ M_ULP_WAKE_IND(sdiod->fmac_ulp),
+ &err);
+ wowl_wake_ind = D11SHM_RDW(sdiod,
+ M_WAKEEVENT_IND(sdiod->fmac_ulp),
+ &err);
+ brcmf_dbg(ULP, "wowl_wake_ind: 0x%08x, ulp_wake_ind: 0x%08x\n",
+ wowl_wake_ind, ulp_wake_ind);
+ reg_addr = CORE_CC_REG(
+ brcmf_chip_get_pmu(bus->ci)->base, min_res_mask);
+ brcmf_sdiod_writel(sdiod, reg_addr,
+ DEFAULT_43012_MIN_RES_MASK, &err);
+ if (err)
+ brcmf_err("min_res_mask failed\n");
+
+ return true;
+ }
+
+ return false;
+}
+
static void brcmf_sdio_dpc(struct brcmf_sdio *bus)
{
struct brcmf_sdio_dev *sdiod = bus->sdiodev;
@@ -2654,8 +2845,11 @@ static void brcmf_sdio_dpc(struct brcmf_
/* Handle host mailbox indication */
if (intstatus & I_HMB_HOST_INT) {
+ u32 hmb_data = 0;
intstatus &= ~I_HMB_HOST_INT;
- intstatus |= brcmf_sdio_hostmail(bus);
+ intstatus |= brcmf_sdio_hostmail(bus, &hmb_data);
+ if (brcmf_sdio_ulp_pre_redownload_check(bus, hmb_data))
+ brcmf_sdio_ulp_reinit_fw(bus);
}
sdio_release_host(bus->sdiodev->func1);
@@ -2700,7 +2894,7 @@ static void brcmf_sdio_dpc(struct brcmf_
brcmf_sdio_clrintr(bus);
if (bus->ctrl_frame_stat && (bus->clkstate == CLK_AVAIL) &&
- txctl_ok(bus)) {
+ txctl_ok(bus) && brcmf_sdio_f2_ready(bus)) {
sdio_claim_host(bus->sdiodev->func1);
if (bus->ctrl_frame_stat) {
err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
@@ -3571,6 +3765,10 @@ static int brcmf_sdio_bus_preinit(struct
if (err < 0)
goto done;
+ /* initialize SHM address from firmware for DS1 */
+ if (!bus->sdiodev->ulp)
+ brcmf_sdio_ulp_preinit(dev);
+
bus->tx_hdrlen = SDPCM_HWHDR_LEN + SDPCM_SWHDR_LEN;
if (sdiodev->sg_support) {
bus->txglom = false;
@@ -4221,7 +4419,7 @@ static void brcmf_sdio_firmware_callback
u8 saveclk, bpreq;
u8 devctl;
- brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err);
+ brcmf_dbg(ULP, "Enter: dev=%s, err=%d\n", dev_name(dev), err);
if (err)
goto fail;
@@ -4399,12 +4597,25 @@ static void brcmf_sdio_firmware_callback
}
/* Attach to the common layer, reserve hdr space */
- err = brcmf_attach(sdiod->dev);
+ err = brcmf_attach(sdiod->dev, !bus->sdiodev->ulp);
if (err != 0) {
brcmf_err("brcmf_attach failed\n");
goto free;
}
+ /* Register for ULP events */
+ if (sdiod->func1->device == SDIO_DEVICE_ID_BROADCOM_CYPRESS_43012)
+ brcmf_fweh_register(bus_if->drvr, BRCMF_E_ULP,
+ brcmf_ulp_event_notify);
+
+ if (bus->sdiodev->ulp) {
+ /* For ULP, after firmware redownload complete
+ * set ULP state to IDLE
+ */
+ if (bus->sdiodev->fmac_ulp.ulp_state == FMAC_ULP_TRIGGERED)
+ bus->sdiodev->fmac_ulp.ulp_state = FMAC_ULP_IDLE;
+ }
+
/* ready */
return;
@@ -4659,3 +4870,40 @@ int brcmf_sdio_sleep(struct brcmf_sdio *
return ret;
}
+
+/* Check F2 Ready bit before sending data to Firmware */
+static int
+brcmf_sdio_f2_ready(struct brcmf_sdio *bus)
+{
+ int ret = -1;
+ int iordy_status = 0;
+
+ sdio_claim_host(bus->sdiodev->func1);
+ /* Read the status of IOR2 */
+ iordy_status = brcmf_sdiod_func0_rb(bus->sdiodev, SDIO_CCCR_IORx, NULL);
+
+ sdio_release_host(bus->sdiodev->func1);
+ ret = iordy_status & SDIO_FUNC_ENABLE_2;
+ return ret;
+}
+
+static int brcmf_ulp_event_notify(struct brcmf_if *ifp,
+ const struct brcmf_event_msg *evtmsg,
+ void *data)
+{
+ int err = 0;
+ struct brcmf_bus *bus_if = ifp->drvr->bus_if;
+ struct brcmf_sdio_dev *sdiodev;
+ struct brcmf_sdio *bus;
+ struct brcmf_ulp_event *ulp_event = (struct brcmf_ulp_event *)data;
+
+ sdiodev = bus_if->bus_priv.sdio;
+ bus = sdiodev->bus;
+
+ brcmf_dbg(ULP, "Chip went to DS1 state : action %d\n",
+ ulp_event->ulp_dongle_action);
+ if (ulp_event->ulp_dongle_action == FMAC_ULP_ENTRY)
+ bus->sdiodev->fmac_ulp.ulp_state = FMAC_ULP_ENTRY_RECV;
+
+ return err;
+}
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
@@ -165,6 +165,35 @@ struct brcmf_sdreg {
struct brcmf_sdio;
struct brcmf_sdiod_freezer;
+/* ULP SHM Offsets info */
+struct ulp_shm_info {
+ u32 m_ulp_ctrl_sdio;
+ u32 m_ulp_wakeevt_ind;
+ u32 m_ulp_wakeind;
+ u32 m_ulp_phytxblk;
+};
+
+/* FMAC ULP state machine */
+#define FMAC_ULP_IDLE (0)
+#define FMAC_ULP_ENTRY_RECV (1)
+#define FMAC_ULP_TRIGGERED (2)
+
+/* BRCMF_E_ULP event data */
+#define FMAC_ULP_EVENT_VERSION 1
+#define FMAC_ULP_DISABLE_CONSOLE 1 /* Disable console */
+#define FMAC_ULP_UCODE_DOWNLOAD 2 /* Download ULP ucode file */
+#define FMAC_ULP_ENTRY 3 /* Inform ulp entry to Host */
+
+struct brcmf_ulp {
+ uint ulp_state;
+ struct ulp_shm_info ulp_shm_offset;
+};
+
+struct brcmf_ulp_event {
+ u16 version;
+ u16 ulp_dongle_action;
+};
+
struct brcmf_sdio_dev {
struct sdio_func *func1;
struct sdio_func *func2;
@@ -193,6 +222,8 @@ struct brcmf_sdio_dev {
enum brcmf_sdiod_state state;
struct brcmf_sdiod_freezer *freezer;
const struct firmware *clm_fw;
+ struct brcmf_ulp fmac_ulp;
+ bool ulp;
};
/* sdio core registers */
@@ -368,4 +399,83 @@ void brcmf_sdio_wowl_config(struct devic
int brcmf_sdio_sleep(struct brcmf_sdio *bus, bool sleep);
void brcmf_sdio_trigger_dpc(struct brcmf_sdio *bus);
+/* SHM offsets */
+#define M_DS1_CTRL_SDIO(ptr) ((ptr).ulp_shm_offset.m_ulp_ctrl_sdio)
+#define M_WAKEEVENT_IND(ptr) ((ptr).ulp_shm_offset.m_ulp_wakeevt_ind)
+#define M_ULP_WAKE_IND(ptr) ((ptr).ulp_shm_offset.m_ulp_wakeind)
+#define M_DS1_PHYTX_ERR_BLK(ptr) ((ptr).ulp_shm_offset.m_ulp_phytxblk)
+
+#define D11_BASE_ADDR 0x18001000
+#define D11_AXI_BASE_ADDR 0xE8000000
+#define D11_SHM_BASE_ADDR (D11_AXI_BASE_ADDR + 0x4000)
+
+#define D11REG_ADDR(offset) (D11_BASE_ADDR + (offset))
+#define D11IHR_ADDR(offset) (D11_AXI_BASE_ADDR + 0x400 + (2 * (offset)))
+#define D11SHM_ADDR(offset) (D11_SHM_BASE_ADDR + (offset))
+
+/* MacControl register */
+#define D11_MACCONTROL_REG D11REG_ADDR(0x120)
+#define D11_MACCONTROL_REG_WAKE 0x4000000
+
+/* HUDI Sequence SHM bits */
+#define C_DS1_CTRL_SDIO_DS1_SLEEP 0x1
+#define C_DS1_CTRL_SDIO_MAC_ON 0x2
+#define C_DS1_CTRL_SDIO_RADIO_PHY_ON 0x4
+#define C_DS1_CTRL_SDIO_DS1_EXIT 0x8
+#define C_DS1_CTRL_PROC_DONE 0x100
+#define C_DS1_CTRL_REQ_VALID 0x200
+
+/* M_ULP_WAKEIND bits */
+#define C_WATCHDOG_EXPIRY BIT(0)
+#define C_FCBS_ERROR BIT(1)
+#define C_RETX_FAILURE BIT(2)
+#define C_HOST_WAKEUP BIT(3)
+#define C_INVALID_FCBS_BLOCK BIT(4)
+#define C_HUDI_DS1_EXIT BIT(5)
+#define C_LOB_SLEEP BIT(6)
+#define C_DS1_PHY_TXERR BIT(9)
+#define C_DS1_WAKE_TIMER BIT(10)
+
+#define PHYTX_ERR_BLK_SIZE 18
+#define D11SHM_FIRST2BYTE_MASK 0xFFFF0000
+#define D11SHM_SECOND2BYTE_MASK 0x0000FFFF
+#define D11SHM_2BYTE_SHIFT 16
+
+#define D11SHM_RD(sdh, offset, ret) \
+ brcmf_sdiod_readl(sdh, D11SHM_ADDR(offset), ret)
+
+/* SHM Read is motified based on SHM 4 byte alignment as SHM size is 2 bytes and
+ * 2 byte is currently not working on FMAC
+ * If SHM address is not 4 byte aligned, then right shift by 16
+ * otherwise, mask the first two MSB bytes
+ * Suppose data in address 7260 is 0x440002 and it is 4 byte aligned
+ * Correct SHM value is 0x2 for this SHM offset and next SHM value is 0x44
+ */
+#define D11SHM_RDW(sdh, offset, ret) \
+ ((offset % 4) ? \
+ (brcmf_sdiod_readl(sdh, D11SHM_ADDR(offset), ret) \
+ >> D11SHM_2BYTE_SHIFT) : \
+ (brcmf_sdiod_readl(sdh, D11SHM_ADDR(offset), ret) \
+ & D11SHM_SECOND2BYTE_MASK))
+
+/* SHM is of size 2 bytes, 4 bytes write will overwrite other SHM's
+ * First read 4 bytes and then clear the required two bytes based on
+ * 4 byte alignment, then update the required value and write the
+ * 4 byte value now
+ */
+#define D11SHM_WR(sdh, offset, val, mask, ret) \
+ do { \
+ if ((offset) % 4) \
+ val = (val & D11SHM_SECOND2BYTE_MASK) | \
+ ((mask) << D11SHM_2BYTE_SHIFT); \
+ else \
+ val = (mask) | (val & D11SHM_FIRST2BYTE_MASK); \
+ brcmf_sdiod_writel(sdh, D11SHM_ADDR(offset), val, ret); \
+ } while (0)
+#define D11REG_WR(sdh, addr, val, ret) \
+ brcmf_sdiod_writel(sdh, addr, val, ret)
+
+#define D11REG_RD(sdh, addr, ret) \
+ brcmf_sdiod_readl(sdh, addr, ret)
+
#endif /* BRCMFMAC_SDIO_H */
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
@@ -1208,7 +1208,7 @@ static void brcmf_usb_probe_phase2(struc
goto error;
/* Attach to the common driver interface */
- ret = brcmf_attach(devinfo->dev);
+ ret = brcmf_attach(devinfo->dev, true);
if (ret)
goto error;
@@ -1289,7 +1289,7 @@ static int brcmf_usb_probe_cb(struct brc
ret = brcmf_alloc(devinfo->dev, devinfo->settings);
if (ret)
goto fail;
- ret = brcmf_attach(devinfo->dev);
+ ret = brcmf_attach(devinfo->dev, true);
if (ret)
goto fail;
/* we are done */
--- a/drivers/net/wireless/broadcom/brcm80211/include/chipcommon.h
+++ b/drivers/net/wireless/broadcom/brcm80211/include/chipcommon.h
@@ -308,4 +308,6 @@ struct chipcregs {
*/
#define PMU_MAX_TRANSITION_DLY 15000
+#define DEFAULT_43012_MIN_RES_MASK 0x0f8bfe77
+
#endif /* _SBCHIPC_H */
@@ -20,7 +20,8 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
drivers/i2c/busses/i2c-designware-common.c | 12 ++++++++++++
drivers/i2c/busses/i2c-designware-core.h | 7 +++++++
drivers/i2c/busses/i2c-designware-master.c | 19 ++++++++++++++++++-
3 files changed, 37 insertions(+), 1 deletion(-)
include/linux/designware_i2c.h | 4 ++++
4 files changed, 41 insertions(+), 1 deletion(-)
--- a/drivers/i2c/busses/i2c-designware-common.c
+++ b/drivers/i2c/busses/i2c-designware-common.c
@@ -136,15 +137,15 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
ret = dev->init(dev);
--- a/include/linux/designware_i2c.h
+++ b/include/linux/designware_i2c.h
@@ -49,6 +49,8 @@
@@ -47,6 +47,8 @@
#define DW_IC_TX_ABRT_SOURCE 0x80
#define DW_IC_ENABLE_STATUS 0x9c
#define DW_IC_CLR_RESTART_DET 0xa8
#define DW_IC_SMBUS_INTR_STAT 0xc8
#define DW_IC_SMBUS_INTR_MASK 0xcc
+#define DW_IC_SCL_STUCK_AT_LOW_TIMEOUT 0xac
+#define DW_IC_SDA_STUCK_AT_LOW_TIMEOUT 0xb0
#define DW_IC_SMBUS_INTR_STAT 0xc8
#define DW_IC_SMBUS_INTR_MASK 0xcc
#define DW_IC_CLR_SMBUS_INTR 0xd4
#define DW_IC_COMP_PARAM_1 0xf4
#define DW_IC_COMP_VERSION 0xf8
@@ -92,6 +94,7 @@
/* DW_IC_ENABLE bits */
#define DW_IC_ENABLE_ENABLE BIT(0)
@@ -1,28 +0,0 @@
From cfa10dd3d123cdfeac37d26411bdee7005306fdb Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Tue, 15 Apr 2025 15:38:55 +0100
Subject: [PATCH] media: i2c: imx219: Restore the 1920x1080 to using a 1:1 PAR
Commit 0af46fbc333d ("media: i2c: imx219: Calculate crop rectangle
dynamically") meant that the 1920x1080 switched from using no binning
to using vertical binning but no horizontal binning.
Restore the original behaviour by ensuring the two binning settings
are the same.
Fixes: 0af46fbc333d ("media: i2c: imx219: Calculate crop rectangle dynamically")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/imx219.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -884,6 +884,7 @@ static int imx219_set_pad_format(struct
*/
bin_h = min(IMX219_PIXEL_ARRAY_WIDTH / format->width, 2U);
bin_v = min(IMX219_PIXEL_ARRAY_HEIGHT / format->height, 2U);
+ binning = min(bin_h, bin_v);
/* Ensure bin_h and bin_v are same to avoid 1:2 or 2:1 stretching */
binning = min(bin_h, bin_v);
@@ -1,118 +0,0 @@
From 5eb74d4887b740880dbe51ad4bcafde5f264d740 Mon Sep 17 00:00:00 2001
From: Naushir Patuck <naush@raspberrypi.com>
Date: Wed, 24 Sep 2025 13:11:19 +0100
Subject: [PATCH] drivers: media: imx219: Remove enum binning_mode
The enum binning_mode is redundant, it only uses values from the earlier
defined binning modes. Remove it.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
drivers/media/i2c/imx219.c | 68 ++++++++++++++++++++++++--------------
1 file changed, 43 insertions(+), 25 deletions(-)
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -402,42 +402,57 @@ static u32 imx219_get_format_bpp(const s
}
}
-static void imx219_get_binning(struct v4l2_subdev_state *state, u8 *bin_h,
- u8 *bin_v)
+static unsigned int imx219_get_binning(struct v4l2_subdev_state *state,
+ u8 *bin_h, u8 *bin_v)
{
const struct v4l2_mbus_framefmt *format =
v4l2_subdev_state_get_format(state, 0);
- const struct v4l2_rect *crop = v4l2_subdev_state_get_crop(state, 0);
- u32 hbin = crop->width / format->width;
- u32 vbin = crop->height / format->height;
+ unsigned int bin_mode = IMX219_BINNING_NONE;
+ const struct imx219_mode *mode =
+ v4l2_find_nearest_size(supported_modes,
+ ARRAY_SIZE(supported_modes),
+ width, height,
+ format->width, format->height);
+ switch (format->code) {
+ case MEDIA_BUS_FMT_SRGGB8_1X8:
+ case MEDIA_BUS_FMT_SGRBG8_1X8:
+ case MEDIA_BUS_FMT_SGBRG8_1X8:
+ case MEDIA_BUS_FMT_SBGGR8_1X8:
+ bin_mode = mode->binning[BINNING_IDX_8_BIT];
+ break;
+
+ case MEDIA_BUS_FMT_SRGGB10_1X10:
+ case MEDIA_BUS_FMT_SGRBG10_1X10:
+ case MEDIA_BUS_FMT_SGBRG10_1X10:
+ case MEDIA_BUS_FMT_SBGGR10_1X10:
+ bin_mode = mode->binning[BINNING_IDX_10_BIT];
+ break;
+ }
*bin_h = IMX219_BINNING_NONE;
*bin_v = IMX219_BINNING_NONE;
- /*
- * Use analog binning only if both dimensions are binned, as it crops
- * the other dimension.
- */
- if (hbin == 2 && vbin == 2) {
- *bin_h = IMX219_BINNING_X2_ANALOG;
- *bin_v = IMX219_BINNING_X2_ANALOG;
-
- return;
- }
-
- if (hbin == 2)
- *bin_h = IMX219_BINNING_X2;
- if (vbin == 2)
- *bin_v = IMX219_BINNING_X2;
+ if (*bin_h == 2 && *bin_v == 2)
+ return IMX219_BINNING_X2_ANALOG;
+ else if (*bin_h == 2 || *bin_v == 2)
+ /*
+ * Don't use analog binning if only one dimension
+ * is binned, as it crops the other dimension
+ */
+ return IMX219_BINNING_X2;
+ else
+ return IMX219_BINNING_NONE;
}
static inline u32 imx219_get_rate_factor(struct v4l2_subdev_state *state)
{
u8 bin_h, bin_v;
+ unsigned int binning = imx219_get_binning(state, &bin_h, &bin_v);
- imx219_get_binning(state, &bin_h, &bin_v);
+ if (binning == IMX219_BINNING_X2_ANALOG)
+ return 2;
- return (bin_h & bin_v) == IMX219_BINNING_X2_ANALOG ? 2 : 1;
+ return 1;
}
/* -----------------------------------------------------------------------------
@@ -678,6 +693,7 @@ static int imx219_set_framefmt(struct im
{
const struct v4l2_mbus_framefmt *format;
const struct v4l2_rect *crop;
+ unsigned int binning;
u8 bin_h, bin_v;
u32 bpp;
int ret = 0;
@@ -695,9 +711,11 @@ static int imx219_set_framefmt(struct im
cci_write(imx219->regmap, IMX219_REG_Y_ADD_END_A,
crop->top - IMX219_PIXEL_ARRAY_TOP + crop->height - 1, &ret);
- imx219_get_binning(state, &bin_h, &bin_v);
- cci_write(imx219->regmap, IMX219_REG_BINNING_MODE_H, bin_h, &ret);
- cci_write(imx219->regmap, IMX219_REG_BINNING_MODE_V, bin_v, &ret);
+ binning = imx219_get_binning(state, &bin_h, &bin_v);
+ cci_write(imx219->regmap, IMX219_REG_BINNING_MODE_H,
+ (bin_h == 2) ? binning : IMX219_BINNING_NONE, &ret);
+ cci_write(imx219->regmap, IMX219_REG_BINNING_MODE_V,
+ (bin_v == 2) ? binning : IMX219_BINNING_NONE, &ret);
cci_write(imx219->regmap, IMX219_REG_X_OUTPUT_SIZE,
format->width, &ret);
@@ -1,103 +0,0 @@
From 002310f6bf7b5d44a81f5f66aba194176462d87c Mon Sep 17 00:00:00 2001
From: Vinay Varma <varmavinaym@gmail.com>
Date: Fri, 22 Sep 2023 18:17:42 +0100
Subject: [PATCH] media: i2c: imx219: fix binning and rate_factor for 480p and
1232p
At a high FPS with RAW10, there is frame corruption for 480p because the
rate_factor of 2 is used with the normal 2x2 bining [1]. This commit
ties the rate_factor to the selected binning mode. For the 480p mode,
analog 2x2 binning mode with a rate_factor of 2 is always used. For the
1232p mode the normal 2x2 binning mode is used for RAW10 while analog
2x2 binning mode is used for RAW8.
[1] raspberrypi#5493
Signed-off-by: Vinay Varma <varmavinaym@gmail.com>
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reworked due to upstream changes
---
drivers/media/i2c/imx219.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -148,6 +148,12 @@
#define IMX219_PIXEL_ARRAY_WIDTH 3280U
#define IMX219_PIXEL_ARRAY_HEIGHT 2464U
+enum binning_bit_depths {
+ BINNING_IDX_8_BIT,
+ BINNING_IDX_10_BIT,
+ BINNING_IDX_MAX
+};
+
/* Mode : resolution and related config&values */
struct imx219_mode {
/* Frame width */
@@ -157,6 +163,10 @@ struct imx219_mode {
/* V-timing */
unsigned int fll_def;
+ unsigned int vts_def;
+
+ /* binning mode based on format code */
+ unsigned int binning[BINNING_IDX_MAX];
};
static const struct cci_reg_sequence imx219_common_regs[] = {
@@ -315,24 +325,44 @@ static const struct imx219_mode supporte
.width = 3280,
.height = 2464,
.fll_def = 3526,
+ .vts_def = 3526,
+ .binning = {
+ [BINNING_IDX_8_BIT] = IMX219_BINNING_NONE,
+ [BINNING_IDX_10_BIT] = IMX219_BINNING_NONE,
+ },
},
{
/* 1080P 30fps cropped */
.width = 1920,
.height = 1080,
.fll_def = 1763,
+ .vts_def = 1763,
+ .binning = {
+ [BINNING_IDX_8_BIT] = IMX219_BINNING_NONE,
+ [BINNING_IDX_10_BIT] = IMX219_BINNING_NONE,
+ },
},
{
/* 2x2 binned 60fps mode */
.width = 1640,
.height = 1232,
.fll_def = 1706,
+ .vts_def = 1763,
+ .binning = {
+ [BINNING_IDX_8_BIT] = IMX219_BINNING_X2_ANALOG,
+ [BINNING_IDX_10_BIT] = IMX219_BINNING_X2,
+ },
},
{
/* 640x480 60fps mode */
.width = 640,
.height = 480,
.fll_def = 1706,
+ .vts_def = 1763,
+ .binning = {
+ [BINNING_IDX_8_BIT] = IMX219_BINNING_X2_ANALOG,
+ [BINNING_IDX_10_BIT] = IMX219_BINNING_X2_ANALOG,
+ },
},
};
@@ -433,7 +463,7 @@ static unsigned int imx219_get_binning(s
*bin_v = IMX219_BINNING_NONE;
if (*bin_h == 2 && *bin_v == 2)
- return IMX219_BINNING_X2_ANALOG;
+ return bin_mode;
else if (*bin_h == 2 || *bin_v == 2)
/*
* Don't use analog binning if only one dimension
@@ -1,139 +0,0 @@
From 3b411a7a60f0c4cba28640375801319292932d24 Mon Sep 17 00:00:00 2001
From: Maxime Ripard <mripard@kernel.org>
Date: Wed, 17 Sep 2025 13:16:13 +0200
Subject: [PATCH] media: tc358743: Fix the RGB MBUS format
Upstream series https://lore.kernel.org/linux-media/20250917-csi-bgr-rgb-v3-0-0145571b3aa4@kernel.org/
The tc358743 is an HDMI to MIPI-CSI2 bridge. It can output all three
HDMI 1.4 video formats: RGB 4:4:4, YCbCr 4:2:2, and YCbCr 4:4:4.
RGB 4:4:4 is converted to the MIPI-CSI2 RGB888 video format, and listed
in the driver as MEDIA_BUS_FMT_RGB888_1X24.
Most CSI2 receiver drivers then map MEDIA_BUS_FMT_RGB888_1X24 to
V4L2_PIX_FMT_RGB24.
However, V4L2_PIX_FMT_RGB24 is defined as having its color components in
the R, G and B order, from left to right. MIPI-CSI2 however defines the
RGB888 format with blue first.
This essentially means that the R and B will be swapped compared to what
V4L2_PIX_FMT_RGB24 defines.
The proper MBUS format would be BGR888, so let's use that.
Fixes: d32d98642de6 ("[media] Driver for Toshiba TC358743 HDMI to CSI-2 bridge")
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
drivers/media/i2c/tc358743.c | 53 ++++++++++++++++++++++++++++++------
1 file changed, 44 insertions(+), 9 deletions(-)
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -756,6 +756,7 @@ static void tc358743_set_ref_clk(struct
static void tc358743_set_csi_color_space(struct v4l2_subdev *sd)
{
struct tc358743_state *state = to_state(sd);
+ struct device *dev = &state->i2c_client->dev;
switch (state->mbus_fmt_code) {
case MEDIA_BUS_FMT_UYVY8_1X16:
@@ -771,7 +772,17 @@ static void tc358743_set_csi_color_space
mutex_unlock(&state->confctl_mutex);
break;
case MEDIA_BUS_FMT_RGB888_1X24:
- v4l2_dbg(2, debug, sd, "%s: RGB 888 24-bit\n", __func__);
+ /*
+ * The driver was initially introduced with RGB888
+ * support, but CSI really means BGR.
+ *
+ * Since we might have applications that would have
+ * hard-coded the RGB888, let's support both.
+ */
+ dev_warn_once(dev, "RGB format isn't actually supported by the hardware. The application should be fixed to use BGR.");
+ fallthrough;
+ case MEDIA_BUS_FMT_BGR888_1X24:
+ v4l2_dbg(2, debug, sd, "%s: BGR 888 24-bit\n", __func__);
i2c_wr8_and_or(sd, VOUT_SET2,
~(MASK_SEL422 | MASK_VOUT_422FIL_100) & 0xff,
0x00);
@@ -1433,11 +1444,26 @@ static int tc358743_log_status(struct v4
v4l2_info(sd, "Stopped: %s\n",
(i2c_rd16(sd, CSI_STATUS) & MASK_S_HLT) ?
"yes" : "no");
- v4l2_info(sd, "Color space: %s\n",
- state->mbus_fmt_code == MEDIA_BUS_FMT_UYVY8_1X16 ?
- "YCbCr 422 16-bit" :
- state->mbus_fmt_code == MEDIA_BUS_FMT_RGB888_1X24 ?
- "RGB 888 24-bit" : "Unsupported");
+
+ switch (state->mbus_fmt_code) {
+ case MEDIA_BUS_FMT_BGR888_1X24:
+ /*
+ * The driver was initially introduced with RGB888
+ * support, but CSI really means BGR.
+ *
+ * Since we might have applications that would have
+ * hard-coded the RGB888, let's support both.
+ */
+ case MEDIA_BUS_FMT_RGB888_1X24:
+ v4l2_info(sd, "Color space: BGR 888 24-bit\n");
+ break;
+ case MEDIA_BUS_FMT_UYVY8_1X16:
+ v4l2_info(sd, "Color space: YCbCr 422 16-bit\n");
+ break;
+ default:
+ v4l2_info(sd, "Color space: Unsupported\n");
+ break;
+ }
v4l2_info(sd, "-----%s status-----\n", is_hdmi(sd) ? "HDMI" : "DVI-D");
v4l2_info(sd, "HDCP encrypted content: %s\n",
@@ -1774,11 +1800,18 @@ static int tc358743_enum_mbus_code(struc
{
switch (code->index) {
case 0:
- code->code = MEDIA_BUS_FMT_RGB888_1X24;
+ code->code = MEDIA_BUS_FMT_BGR888_1X24;
break;
case 1:
code->code = MEDIA_BUS_FMT_UYVY8_1X16;
break;
+ case 2:
+ /*
+ * We need to keep RGB888 for backward compatibility,
+ * but we should list it last for userspace to pick BGR.
+ */
+ code->code = MEDIA_BUS_FMT_RGB888_1X24;
+ break;
default:
return -EINVAL;
}
@@ -1788,6 +1821,7 @@ static int tc358743_enum_mbus_code(struc
static u32 tc358743_g_colorspace(u32 code)
{
switch (code) {
+ case MEDIA_BUS_FMT_BGR888_1X24:
case MEDIA_BUS_FMT_RGB888_1X24:
return V4L2_COLORSPACE_SRGB;
case MEDIA_BUS_FMT_UYVY8_1X16:
@@ -1825,7 +1859,8 @@ static int tc358743_set_fmt(struct v4l2_
u32 code = format->format.code; /* is overwritten by get_fmt */
int ret = tc358743_get_fmt(sd, sd_state, format);
- if (code == MEDIA_BUS_FMT_RGB888_1X24 ||
+ if (code == MEDIA_BUS_FMT_BGR888_1X24 ||
+ code == MEDIA_BUS_FMT_RGB888_1X24 ||
code == MEDIA_BUS_FMT_UYVY8_1X16)
format->format.code = code;
format->format.colorspace = tc358743_g_colorspace(format->format.code);
@@ -2245,7 +2280,7 @@ static int tc358743_probe(struct i2c_cli
if (err < 0)
goto err_hdl;
- state->mbus_fmt_code = MEDIA_BUS_FMT_RGB888_1X24;
+ state->mbus_fmt_code = MEDIA_BUS_FMT_BGR888_1X24;
sd->dev = &client->dev;
@@ -1,264 +0,0 @@
From a9731ff75336f472eca7a94e661d5bbcb1382ae2 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Tue, 11 Feb 2025 16:09:27 +0000
Subject: [PATCH] media: hevc_dec: Add in downstream single planar SAND variant
Upstream will take the multi-planar SAND format, but add back
in the downstream single planar variant for backwards compatibility
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
.../raspberrypi/hevc_dec/hevc_d_h265.c | 79 ++++++++++++--
.../raspberrypi/hevc_dec/hevc_d_video.c | 101 ++++++++++++++----
2 files changed, 149 insertions(+), 31 deletions(-)
--- a/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_h265.c
+++ b/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_h265.c
@@ -1628,24 +1628,40 @@ static int hevc_d_h265_setup(struct hevc
de->cmd_len = 0;
de->dpbno_col = ~0U;
- de->luma_stride = ctx->dst_fmt.height * 128;
- de->frame_luma_addr =
- vb2_dma_contig_plane_dma_addr(&run->dst->vb2_buf, 0);
- de->chroma_stride = de->luma_stride / 2;
- de->frame_chroma_addr =
- vb2_dma_contig_plane_dma_addr(&run->dst->vb2_buf, 1);
+ switch (ctx->dst_fmt.pixelformat) {
+ case V4L2_PIX_FMT_NV12MT_COL128:
+ case V4L2_PIX_FMT_NV12MT_10_COL128:
+ de->luma_stride = ctx->dst_fmt.height * 128;
+ de->frame_luma_addr =
+ vb2_dma_contig_plane_dma_addr(&run->dst->vb2_buf, 0);
+ de->chroma_stride = de->luma_stride / 2;
+ de->frame_chroma_addr =
+ vb2_dma_contig_plane_dma_addr(&run->dst->vb2_buf, 1);
+ break;
+ case V4L2_PIX_FMT_NV12_COL128:
+ case V4L2_PIX_FMT_NV12_10_COL128:
+ de->luma_stride = ctx->dst_fmt.plane_fmt[0].bytesperline * 128;
+ de->frame_luma_addr =
+ vb2_dma_contig_plane_dma_addr(&run->dst->vb2_buf, 0);
+ de->chroma_stride = de->luma_stride;
+ de->frame_chroma_addr = de->frame_luma_addr +
+ (ctx->dst_fmt.height * 128);
+ break;
+ }
+
de->frame_aux = NULL;
if (s->sps.bit_depth_luma_minus8 == 0) {
- if (ctx->dst_fmt.pixelformat != V4L2_PIX_FMT_NV12MT_COL128) {
+ if (ctx->dst_fmt.pixelformat != V4L2_PIX_FMT_NV12MT_COL128 &&
+ ctx->dst_fmt.pixelformat != V4L2_PIX_FMT_NV12_COL128) {
v4l2_err(&dev->v4l2_dev,
"Pixel format %#x != NV12MT_COL128 for 8-bit output",
ctx->dst_fmt.pixelformat);
goto fail;
}
} else {
- if (ctx->dst_fmt.pixelformat !=
- V4L2_PIX_FMT_NV12MT_10_COL128) {
+ if (ctx->dst_fmt.pixelformat != V4L2_PIX_FMT_NV12MT_10_COL128 &&
+ ctx->dst_fmt.pixelformat != V4L2_PIX_FMT_NV12_10_COL128) {
v4l2_err(&dev->v4l2_dev,
"Pixel format %#x != NV12MT_10_COL128 for 10-bit output",
ctx->dst_fmt.pixelformat);
@@ -1664,6 +1680,42 @@ static int hevc_d_h265_setup(struct hevc
goto fail;
}
+ switch (ctx->dst_fmt.pixelformat) {
+ case V4L2_PIX_FMT_NV12MT_COL128:
+ case V4L2_PIX_FMT_NV12MT_10_COL128:
+ if (run->dst->vb2_buf.num_planes != 2) {
+ v4l2_warn(&dev->v4l2_dev, "Capture planes (%d) != 2\n",
+ run->dst->vb2_buf.num_planes);
+ goto fail;
+ }
+ if (run->dst->planes[0].length < ctx->dst_fmt.plane_fmt[0].sizeimage ||
+ run->dst->planes[1].length < ctx->dst_fmt.plane_fmt[1].sizeimage) {
+ v4l2_warn(&dev->v4l2_dev,
+ "Capture planes length (%d/%d) < sizeimage (%d/%d)\n",
+ run->dst->planes[0].length,
+ run->dst->planes[1].length,
+ ctx->dst_fmt.plane_fmt[0].sizeimage,
+ ctx->dst_fmt.plane_fmt[1].sizeimage);
+ goto fail;
+ }
+ break;
+ case V4L2_PIX_FMT_NV12_COL128:
+ case V4L2_PIX_FMT_NV12_10_COL128:
+ if (run->dst->vb2_buf.num_planes != 1) {
+ v4l2_warn(&dev->v4l2_dev, "Capture planes (%d) != 1\n",
+ run->dst->vb2_buf.num_planes);
+ goto fail;
+ }
+ if (run->dst->planes[0].length < ctx->dst_fmt.plane_fmt[0].sizeimage) {
+ v4l2_warn(&dev->v4l2_dev,
+ "Capture planes length (%d) < sizeimage (%d)\n",
+ run->dst->planes[0].length,
+ ctx->dst_fmt.plane_fmt[0].sizeimage);
+ goto fail;
+ }
+ break;
+ }
+
/*
* Fill in ref planes with our address s.t. if we mess up refs
* somehow then we still have a valid address entry
@@ -1833,8 +1885,13 @@ static int hevc_d_h265_setup(struct hevc
de->ref_addrs[i][0] =
vb2_dma_contig_plane_dma_addr(buf, 0);
- de->ref_addrs[i][1] =
- vb2_dma_contig_plane_dma_addr(buf, 1);
+ if (ctx->dst_fmt.pixelformat == V4L2_PIX_FMT_NV12MT_COL128 ||
+ ctx->dst_fmt.pixelformat == V4L2_PIX_FMT_NV12MT_10_COL128)
+ de->ref_addrs[i][1] =
+ vb2_dma_contig_plane_dma_addr(buf, 1);
+ else
+ de->ref_addrs[i][1] = de->ref_addrs[i][0] +
+ (ctx->dst_fmt.height * 128);
}
/* Move DPB from temp */
--- a/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_video.c
+++ b/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_video.c
@@ -140,17 +140,55 @@ static void hevc_d_prepare_dst_format(st
bytesperline = width * 4 / 3;
sizeimage = bytesperline * height;
break;
+
+ case V4L2_PIX_FMT_NV12_COL128:
+ /* Width rounds up to columns */
+ width = ALIGN(width, 128);
+ height = ALIGN(height, 8);
+
+ /* column height
+ * Accept suggested shape if at least min & < 2 * min
+ */
+ bytesperline = constrain2x(bytesperline, height * 3 / 2);
+ sizeimage = bytesperline * width;
+ break;
+
+ case V4L2_PIX_FMT_NV12_10_COL128:
+ /* width in pixels (3 pels = 4 bytes) rounded to 128 byte
+ * columns
+ */
+ width = ALIGN(((width + 2) / 3), 32) * 3;
+ height = ALIGN(height, 8);
+
+ /* column height
+ * Accept suggested shape if at least min & < 2 * min
+ */
+ bytesperline = constrain2x(bytesperline, height * 3 / 2);
+ sizeimage = bytesperline * width * 4 / 3;
+ break;
}
pix_fmt->width = width;
pix_fmt->height = height;
pix_fmt->field = V4L2_FIELD_NONE;
- pix_fmt->plane_fmt[0].bytesperline = bytesperline;
- pix_fmt->plane_fmt[0].sizeimage = sizeimage;
- pix_fmt->plane_fmt[1].bytesperline = bytesperline;
- pix_fmt->plane_fmt[1].sizeimage = sizeimage / 2;
- pix_fmt->num_planes = 2;
+ switch (pix_fmt->pixelformat) {
+ default:
+ case V4L2_PIX_FMT_NV12MT_COL128:
+ case V4L2_PIX_FMT_NV12MT_10_COL128:
+ pix_fmt->plane_fmt[0].bytesperline = bytesperline;
+ pix_fmt->plane_fmt[0].sizeimage = sizeimage;
+ pix_fmt->plane_fmt[1].bytesperline = bytesperline;
+ pix_fmt->plane_fmt[1].sizeimage = sizeimage / 2;
+ pix_fmt->num_planes = 2;
+ break;
+ case V4L2_PIX_FMT_NV12_COL128:
+ case V4L2_PIX_FMT_NV12_10_COL128:
+ pix_fmt->plane_fmt[0].bytesperline = bytesperline;
+ pix_fmt->plane_fmt[0].sizeimage = sizeimage;
+ pix_fmt->num_planes = 1;
+ break;
+ }
}
static int hevc_d_querycap(struct file *file, void *priv,
@@ -235,19 +273,31 @@ static int hevc_d_hevc_validate_sps(cons
static u32 pixelformat_from_sps(const struct v4l2_ctrl_hevc_sps * const sps,
const int index)
{
+ static const u32 all_formats[] = {
+ V4L2_PIX_FMT_NV12MT_COL128,
+ V4L2_PIX_FMT_NV12MT_10_COL128,
+ V4L2_PIX_FMT_NV12_COL128,
+ V4L2_PIX_FMT_NV12_10_COL128,
+ };
u32 pf = 0;
if (!is_sps_set(sps) || !hevc_d_hevc_validate_sps(sps)) {
/* Treat this as an error? For now return both */
- if (index == 0)
- pf = V4L2_PIX_FMT_NV12MT_COL128;
- else if (index == 1)
- pf = V4L2_PIX_FMT_NV12MT_10_COL128;
- } else if (index == 0) {
- if (sps->bit_depth_luma_minus8 == 0)
- pf = V4L2_PIX_FMT_NV12MT_COL128;
- else if (sps->bit_depth_luma_minus8 == 2)
- pf = V4L2_PIX_FMT_NV12MT_10_COL128;
+
+ if (index < ARRAY_SIZE(all_formats))
+ pf = all_formats[index];
+ } else {
+ if (index == 0) {
+ if (sps->bit_depth_luma_minus8 == 0)
+ pf = V4L2_PIX_FMT_NV12MT_COL128;
+ else if (sps->bit_depth_luma_minus8 == 2)
+ pf = V4L2_PIX_FMT_NV12MT_10_COL128;
+ } else if (index == 1) {
+ if (sps->bit_depth_luma_minus8 == 0)
+ pf = V4L2_PIX_FMT_NV12_COL128;
+ else if (sps->bit_depth_luma_minus8 == 2)
+ pf = V4L2_PIX_FMT_NV12_10_COL128;
+ }
}
return pf;
@@ -459,17 +509,28 @@ static int hevc_d_queue_setup(struct vb2
}
if (*nplanes) {
- if (*nplanes != expected_nplanes ||
- sizes[0] < pix_fmt->plane_fmt[0].sizeimage ||
- sizes[1] < pix_fmt->plane_fmt[1].sizeimage)
- return -EINVAL;
+ if (pix_fmt->pixelformat == V4L2_PIX_FMT_NV12MT_COL128 ||
+ pix_fmt->pixelformat == V4L2_PIX_FMT_NV12MT_10_COL128) {
+ if (*nplanes != expected_nplanes ||
+ sizes[0] < pix_fmt->plane_fmt[0].sizeimage ||
+ sizes[1] < pix_fmt->plane_fmt[1].sizeimage)
+ return -EINVAL;
+ } else {
+ if (sizes[0] < pix_fmt->plane_fmt[0].sizeimage)
+ return -EINVAL;
+ }
} else {
sizes[0] = pix_fmt->plane_fmt[0].sizeimage;
if (V4L2_TYPE_IS_OUTPUT(vq->type)) {
*nplanes = 1;
} else {
- sizes[1] = pix_fmt->plane_fmt[1].sizeimage;
- *nplanes = 2;
+ if (pix_fmt->pixelformat == V4L2_PIX_FMT_NV12MT_COL128 ||
+ pix_fmt->pixelformat == V4L2_PIX_FMT_NV12MT_10_COL128) {
+ sizes[1] = pix_fmt->plane_fmt[1].sizeimage;
+ *nplanes = 2;
+ } else {
+ *nplanes = 1;
+ }
}
}
@@ -1,33 +0,0 @@
From 3341dd2bc43865b6424d95623065aff51470c15d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ma=C3=ADra=20Canal?= <mcanal@igalia.com>
Date: Sat, 21 Mar 2026 16:09:45 -0300
Subject: [PATCH] drm/v3d: Increase the autosuspend delay
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The downstream implementation of power management for v3d used a 100ms
delay and it has been tested for many years with success. Use the same
delay with the runtime PM implementation.
Although the shorter 50ms delay is not problematic in RPi 5, it can
cause occasional GPU resets on RPi 4 during intensive workloads, due
to the overhead of negotiating with the ASB bridge during frequent
power domain transitions.
Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
drivers/gpu/drm/v3d/v3d_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -431,7 +431,7 @@ static int v3d_platform_drm_probe(struct
v3d_init_hw_state(v3d);
- pm_runtime_set_autosuspend_delay(dev, 50);
+ pm_runtime_set_autosuspend_delay(dev, 100);
pm_runtime_use_autosuspend(dev);
ret = drm_dev_register(drm, 0);
@@ -1,40 +0,0 @@
From b1a9f9031e09a234349e2616af9e3a41d921b0d0 Mon Sep 17 00:00:00 2001
From: Nicolai Buchwitz <nb@tipi-net.de>
Date: Mon, 30 Mar 2026 16:32:35 +0200
Subject: [PATCH] Revert "net: bcmgenet: Add 'eee' module parameter"
This reverts commit 712989f8e002e8a088f24a6cef4d8c1ed1a74e08.
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 14 --------------
1 file changed, 14 deletions(-)
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -76,9 +76,6 @@ static void bcmgenet_set_rx_mode(struct
static bool skip_umac_reset = false;
module_param(skip_umac_reset, bool, 0444);
MODULE_PARM_DESC(skip_umac_reset, "Skip UMAC reset step");
-static bool eee = true;
-module_param(eee, bool, 0444);
-MODULE_PARM_DESC(eee, "Enable EEE (default Y)");
static inline void bcmgenet_writel(u32 value, void __iomem *offset)
{
@@ -3452,17 +3449,6 @@ static int bcmgenet_open(struct net_devi
bcmgenet_phy_pause_set(dev, priv->rx_pause, priv->tx_pause);
- if (!eee) {
- struct ethtool_keee eee_data;
-
- ret = bcmgenet_get_eee(dev, &eee_data);
- if (ret == 0) {
- eee_data.eee_enabled = 0;
- bcmgenet_set_eee(dev, &eee_data);
- netdev_warn(dev, "EEE disabled\n");
- }
- }
-
bcmgenet_netif_start(dev);
netif_tx_start_all_queues(dev);
@@ -1,21 +0,0 @@
From c0d0d1fcc13ed417141895c283850d853abf6fcb Mon Sep 17 00:00:00 2001
From: Nicolai Buchwitz <nb@tipi-net.de>
Date: Mon, 30 Mar 2026 16:32:35 +0200
Subject: [PATCH] Revert "bcmgenet: Disable skip_umac_reset by default"
This reverts commit 09d1901497ce36a24c62a0befa76dee0418b48ce.
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -73,7 +73,7 @@
/* Forward declarations */
static void bcmgenet_set_rx_mode(struct net_device *dev);
-static bool skip_umac_reset = false;
+static bool skip_umac_reset = true;
module_param(skip_umac_reset, bool, 0444);
MODULE_PARM_DESC(skip_umac_reset, "Skip UMAC reset step");
@@ -1,34 +0,0 @@
From 13c70a0e0bb2f7a99caee54a4c22b0a3cc99b0e1 Mon Sep 17 00:00:00 2001
From: Nicolai Buchwitz <nb@tipi-net.de>
Date: Mon, 30 Mar 2026 16:32:35 +0200
Subject: [PATCH] Revert "net: bcmgenet: Workaround #2 for Pi4 Ethernet fail"
This reverts commit dfad8d6677d4c11a5b6d599f81802486f5c1d973.
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 8 --------
1 file changed, 8 deletions(-)
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -73,9 +73,6 @@
/* Forward declarations */
static void bcmgenet_set_rx_mode(struct net_device *dev);
-static bool skip_umac_reset = true;
-module_param(skip_umac_reset, bool, 0444);
-MODULE_PARM_DESC(skip_umac_reset, "Skip UMAC reset step");
static inline void bcmgenet_writel(u32 value, void __iomem *offset)
{
@@ -2595,11 +2592,6 @@ static void reset_umac(struct bcmgenet_p
bcmgenet_rbuf_ctrl_set(priv, 0);
udelay(10);
- if (skip_umac_reset) {
- pr_warn("Skipping UMAC reset\n");
- return;
- }
-
/* issue soft reset and disable MAC while updating its registers */
spin_lock_bh(&priv->reg_lock);
bcmgenet_umac_writel(priv, CMD_SW_RESET, UMAC_CMD);
@@ -1,96 +0,0 @@
From ff6914e97386f9a7d37468c79996dc6c34172cfb Mon Sep 17 00:00:00 2001
From: Lukasz Raczylo <lukasz@raczylo.com>
Date: Fri, 24 Apr 2026 00:00:00 +0000
Subject: [PATCH] net: macb: re-check ISR after IER re-enable in macb_tx_poll
macb_tx_poll() runs with TCOMP masked, drains the TX ring, then
calls napi_complete_done() and re-enables TCOMP via IER. An
existing comment in the function notes:
/* Packet completions only seem to propagate to raise
* interrupts when interrupts are enabled at the time, so if
* packets were sent while interrupts were disabled,
* they will not cause another interrupt to be generated when
* interrupts are re-enabled.
*/
and mitigates this by calling macb_tx_complete_pending(), which
inspects driver-visible ring state (descriptor->ctrl, after rmb())
and reschedules NAPI if a completion is observable in memory.
On PCIe-attached parts (BCM2712 + RP1 on Raspberry Pi 5 is the
setup we have in front of us), the descriptor DMA write that sets
TX_USED may not have retired to system memory at the point
macb_tx_complete_pending() runs. The rmb() synchronises the CPU
view of earlier CPU writes; it is not sufficient to retire an
in-flight peripheral DMA write. Under that ordering the in-memory
descriptor can still read TX_USED=0 when the hardware has in fact
completed the frame; the check returns false; NAPI exits; the
quirk above prevents the re-enabled IER from re-firing; the ring
goes quiescent.
Add an explicit ISR read after the IER write. The MMIO read
serves two independent purposes:
(1) It is an architected PCIe read barrier for earlier
peripheral-originated DMA writes on the same path, so a
subsequent macb_tx_complete_pending() observes any TX_USED
write that was in flight at the time of the barrier.
(2) It samples the hardware ISR directly, so a TCOMP bit that
the hardware set while TCOMP was masked is visible here,
independently of whether the descriptor DMA has retired.
If either signal indicates pending work, reschedule NAPI via the
same path as the existing check.
This patch addresses one of three candidate races for the silent
TX stall described in the cover letter. Whether it is sufficient
by itself, or whether it requires the PCIe posted-write flush in
patch 1/3 to cover the observed behaviour, we have not yet
verified at runtime.
Link: https://github.com/cilium/cilium/issues/43198
Link: https://bugs.launchpad.net/ubuntu/+source/linux-raspi/+bug/2133877
Signed-off-by: Lukasz Raczylo <lukasz@raczylo.com>
---
drivers/net/ethernet/cadence/macb_main.c | 27 +++++++++++++++---------
1 file changed, 17 insertions(+), 10 deletions(-)
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -2001,17 +2001,24 @@ static int macb_tx_poll(struct napi_stru
if (work_done < budget && napi_complete_done(napi, work_done)) {
queue_writel(queue, IER, MACB_BIT(TCOMP));
- /* Packet completions only seem to propagate to raise
- * interrupts when interrupts are enabled at the time, so if
- * packets were sent while interrupts were disabled,
- * they will not cause another interrupt to be generated when
- * interrupts are re-enabled.
- * Check for this case here to avoid losing a wakeup. This can
- * potentially race with the interrupt handler doing the same
- * actions if an interrupt is raised just after enabling them,
- * but this should be harmless.
+ /* TCOMP events that fire while the interrupt is masked do
+ * not re-fire when IER is re-enabled. Catch this two ways
+ * to avoid losing a wakeup:
+ *
+ * (1) Read ISR -- catches completions the hardware flagged
+ * but that we did not see as an interrupt. The MMIO
+ * read doubles as a PCIe read barrier, flushing any
+ * in-flight descriptor TX_USED DMA writes into memory.
+ * (2) macb_tx_complete_pending() inspects the ring after
+ * that flush, catching a descriptor whose TX_USED is
+ * now visible as a result of the barrier.
+ *
+ * This can race with the interrupt handler taking the same
+ * path if an interrupt fires just after the IER write;
+ * rescheduling NAPI in that case is harmless.
*/
- if (macb_tx_complete_pending(queue)) {
+ if ((queue_readl(queue, ISR) & MACB_BIT(TCOMP)) ||
+ macb_tx_complete_pending(queue)) {
queue_writel(queue, IDR, MACB_BIT(TCOMP));
if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
queue_writel(queue, ISR, MACB_BIT(TCOMP));
@@ -1,177 +0,0 @@
From 79dc190b12f9504d6a1bda1e497f912f24cf54d8 Mon Sep 17 00:00:00 2001
From: Lukasz Raczylo <lukasz@raczylo.com>
Date: Fri, 24 Apr 2026 00:00:00 +0000
Subject: [PATCH] net: macb: add TX stall watchdog as defence-in-depth safety
net
Patches 1/3 and 2/3 address two candidate races that could lead
to a TCOMP completion being missed on PCIe-attached macb
instances. This patch adds a defence-in-depth safety net, in
case a further race remains that we have not identified.
The watchdog is a per-queue delayed_work that runs once per
second. Movement is tracked via a tx_stall_tail_moved boolean:
macb_tx_complete() sets it under tx_ptr_lock whenever tx_tail
advances, and the watchdog clears it under the same lock at
each tick. If the ring is non-empty (tx_head != tx_tail) and
the boolean was still false at the next tick, the watchdog
calls macb_tx_restart().
A boolean is used in preference to snapshotting tx_tail and
comparing across ticks, because per-queue ring indices are
bounded and reused; under sustained load a snapshot comparison
can false-positive when the index happens to land on the same
value between two ticks. Both writes share tx_ptr_lock with the
existing tx_head / tx_tail updates, so no atomic is required.
No new recovery logic is introduced. macb_tx_restart() already
exists in this file, is correctly locked (tx_ptr_lock, bp->lock),
and verifies that the hardware's TBQP is behind the driver's
head index before re-asserting TSTART. On a healthy ring it is
a no-op at the hardware level; the watchdog only supplies the
missing trigger.
On a healthy queue the per-tick cost is one spin_lock_irqsave()
/ spin_unlock_irqrestore(), one branch, and one byte store. The
delayed_work is only scheduled between macb_open() and
macb_close(), and is cancelled synchronously on close.
Context for submission: on our 24-node Raspberry Pi 5 fleet,
before this series, an out-of-band user-space watchdog
(monitoring tx_packets from /sys/class/net/.../statistics and
toggling the link down/up when it froze) was required to keep
nodes usable. We include this kernel-side watchdog as a cleaner
in-kernel equivalent for any residual stall that patches 1 and
2 do not cover. We are willing to drop this patch if the view
is that 1 and 2 should stand alone.
Link: https://github.com/cilium/cilium/issues/43198
Link: https://bugs.launchpad.net/ubuntu/+source/linux-raspi/+bug/2133877
Signed-off-by: Lukasz Raczylo <lukasz@raczylo.com>
---
drivers/net/ethernet/cadence/macb.h | 11 ++++
drivers/net/ethernet/cadence/macb_main.c | 65 ++++++++++++++++++++++++
2 files changed, 76 insertions(+)
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -1294,6 +1294,17 @@ struct macb_queue {
struct work_struct tx_error_task;
bool txubr_pending;
bool tx_pending;
+
+ /* TX stall watchdog -- see macb_tx_stall_watchdog() in macb_main.c.
+ * tx_stall_tail_moved is set by macb_tx_complete() under tx_ptr_lock
+ * whenever tx_tail advances, and cleared by the watchdog tick on the
+ * same lock. A bool avoids the index-aliasing false-positive that a
+ * snapshot-of-tx_tail comparison would have when the ring index space
+ * happens to wrap to the same value between two ticks.
+ */
+ struct delayed_work tx_stall_watchdog_work;
+ bool tx_stall_tail_moved;
+
struct napi_struct napi_tx;
dma_addr_t rx_ring_dma;
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -1507,6 +1507,8 @@ static int macb_tx_complete(struct macb_
packets, bytes);
queue->tx_tail = tail;
+ if (packets)
+ queue->tx_stall_tail_moved = true;
if (__netif_subqueue_stopped(bp->dev, queue_index) &&
CIRC_CNT(queue->tx_head, queue->tx_tail,
bp->tx_ring_size) <= MACB_TX_WAKEUP_THRESH(bp))
@@ -2030,6 +2032,63 @@ static int macb_tx_poll(struct napi_stru
return work_done;
}
+#define MACB_TX_STALL_INTERVAL_MS 1000
+
+/* TX stall watchdog.
+ *
+ * Defence-in-depth against lost TCOMP interrupts. macb already has a
+ * recovery chain (tx_pending -> txubr_pending -> macb_tx_restart())
+ * that fires on TCOMP; if TCOMP itself is lost the TX ring stalls
+ * silently until something else kicks TSTART. This watchdog runs
+ * once per second per queue and calls macb_tx_restart() if the ring
+ * is non-empty and tx_tail has not advanced since the previous tick.
+ *
+ * Movement is tracked via the tx_stall_tail_moved boolean rather
+ * than by snapshotting tx_tail. Per-queue ring indices are bounded
+ * (and reused), so a snapshot comparison can false-positive when the
+ * index happens to land on the same value between two ticks under
+ * sustained load. The boolean is set by macb_tx_complete() whenever
+ * tx_tail advances and cleared by this watchdog after each tick;
+ * both writes are under tx_ptr_lock, so no atomic is required.
+ *
+ * macb_tx_restart() already checks the hardware's TBQP against the
+ * driver's head index before re-asserting TSTART, so on a healthy
+ * ring this is a no-op at the hardware level. The watchdog only
+ * adds the missing trigger.
+ */
+static void macb_tx_stall_watchdog(struct work_struct *work)
+{
+ struct macb_queue *queue = container_of(to_delayed_work(work),
+ struct macb_queue,
+ tx_stall_watchdog_work);
+ struct macb *bp = queue->bp;
+ unsigned int cur_tail, cur_head;
+ bool stalled = false;
+ unsigned long flags;
+
+ if (!netif_running(bp->dev))
+ return;
+
+ spin_lock_irqsave(&queue->tx_ptr_lock, flags);
+ cur_tail = queue->tx_tail;
+ cur_head = queue->tx_head;
+ if (cur_head != cur_tail && !queue->tx_stall_tail_moved)
+ stalled = true;
+ queue->tx_stall_tail_moved = false;
+ spin_unlock_irqrestore(&queue->tx_ptr_lock, flags);
+
+ if (stalled) {
+ netdev_warn_once(bp->dev,
+ "TX stall detected on queue %u (tail=%u head=%u); re-kicking TSTART\n",
+ (unsigned int)(queue - bp->queues),
+ cur_tail, cur_head);
+ macb_tx_restart(queue);
+ }
+
+ schedule_delayed_work(&queue->tx_stall_watchdog_work,
+ msecs_to_jiffies(MACB_TX_STALL_INTERVAL_MS));
+}
+
static void macb_hresp_error_task(struct work_struct *work)
{
struct macb *bp = from_work(bp, work, hresp_err_bh_work);
@@ -3317,6 +3376,9 @@ static int macb_open(struct net_device *
for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
napi_enable(&queue->napi_rx);
napi_enable(&queue->napi_tx);
+ queue->tx_stall_tail_moved = true;
+ schedule_delayed_work(&queue->tx_stall_watchdog_work,
+ msecs_to_jiffies(MACB_TX_STALL_INTERVAL_MS));
}
macb_init_hw(bp);
@@ -3363,6 +3425,7 @@ static int macb_close(struct net_device
for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
napi_disable(&queue->napi_rx);
napi_disable(&queue->napi_tx);
+ cancel_delayed_work_sync(&queue->tx_stall_watchdog_work);
netdev_tx_reset_queue(netdev_get_tx_queue(dev, q));
}
@@ -4969,6 +5032,8 @@ static int macb_init(struct platform_dev
}
INIT_WORK(&queue->tx_error_task, macb_tx_error_task);
+ INIT_DELAYED_WORK(&queue->tx_stall_watchdog_work,
+ macb_tx_stall_watchdog);
q++;
}
@@ -1,24 +0,0 @@
From 7455c3f3a9fa3317b042fb33561072b989de4482 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Mon, 18 May 2026 19:18:17 +0100
Subject: [PATCH] arm64: dts: broadcom: Revert to upstream of
bcm2712-d-rpi-5-b.dts
---
arch/arm64/boot/dts/broadcom/bcm2712-d-rpi-5-b.dts | 8 --------
1 file changed, 8 deletions(-)
--- a/arch/arm64/boot/dts/broadcom/bcm2712-d-rpi-5-b.dts
+++ b/arch/arm64/boot/dts/broadcom/bcm2712-d-rpi-5-b.dts
@@ -49,11 +49,3 @@
&uart10 {
interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
};
-
-&pinctrl_aon {
- compatible = "brcm,bcm2712d0-aon-pinctrl";
-};
-
-&pinctrl {
- compatible = "brcm,bcm2712c0-aon-pinctrl";
-};
@@ -1,32 +0,0 @@
From 5e4b87c385d64503843f0db821d7d7a916fcf6fb Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Mon, 18 May 2026 19:26:19 +0100
Subject: [PATCH] Revert "arm64: dts: broadcom: Revert to upstream of
bcm2712-d-rpi-5-b.dts"
This reverts commit 7455c3f3a9fa3317b042fb33561072b989de4482.
---
arch/arm64/boot/dts/broadcom/bcm2712-d-rpi-5-b.dts | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
--- a/arch/arm64/boot/dts/broadcom/bcm2712-d-rpi-5-b.dts
+++ b/arch/arm64/boot/dts/broadcom/bcm2712-d-rpi-5-b.dts
@@ -36,16 +36,10 @@
"PMIC_SDA"; // AON_SGPIO_05
};
-&pinctrl {
- compatible = "brcm,bcm2712d0-pinctrl";
- reg = <0x7d504100 0x20>;
-};
-
&pinctrl_aon {
compatible = "brcm,bcm2712d0-aon-pinctrl";
- reg = <0x7d510700 0x1c>;
};
-&uart10 {
- interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
+&pinctrl {
+ compatible = "brcm,bcm2712c0-aon-pinctrl";
};
@@ -1,68 +0,0 @@
From 7a41407d9a255b4e36b2e7710bbe7f3e1092fa2e Mon Sep 17 00:00:00 2001
From: John Cox <jc@kynesim.co.uk>
Date: Thu, 14 May 2026 11:48:50 +0100
Subject: [PATCH] media/hevc_d: Fix old-style bit_size handling support
Code to select the old way of setting the bit length of a slice got
lost when we moved to 6.18. This fixes it.
Signed-off-by: John Cox <jc@kynesim.co.uk>
---
.../raspberrypi/hevc_dec/hevc_d_h265.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
--- a/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_h265.c
+++ b/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_h265.c
@@ -1578,6 +1578,8 @@ static int hevc_d_h265_setup(struct hevc
bool slice_temporal_mvp;
unsigned int ctb_size_y;
bool sps_changed = false;
+ /* Old (downstream only) bit size meanings */
+ bool old_bits = false;
de = dec_env_new(ctx);
if (!de) {
@@ -1646,6 +1648,7 @@ static int hevc_d_h265_setup(struct hevc
de->chroma_stride = de->luma_stride;
de->frame_chroma_addr = de->frame_luma_addr +
(ctx->dst_fmt.height * 128);
+ old_bits = true;
break;
}
@@ -1776,15 +1779,24 @@ static int hevc_d_h265_setup(struct hevc
for (i = 0; i != run->h265.slice_ents; ++i) {
const struct v4l2_ctrl_hevc_slice_params *const sh = sh0 + i;
const bool last_slice = i + 1 == run->h265.slice_ents;
- const u32 byte_size = DIV_ROUND_UP(sh->bit_size, 8);
+ unsigned int bit_size = old_bits ? sh->bit_size - 8 * sh->data_byte_offset :
+ sh->bit_size;
+ const u32 byte_size = DIV_ROUND_UP(bit_size, 8);
unsigned int j;
s->sh = sh;
+ if (old_bits && sh->bit_size <= 8 * sh->data_byte_offset) {
+ v4l2_warn(&dev->v4l2_dev,
+ "data_byte_offset %d * 8 >= bits %d\n",
+ sh->data_byte_offset, sh->bit_size);
+ goto fail;
+ }
+
if (sh->data_byte_offset + byte_size > run->src->planes[0].bytesused) {
v4l2_warn(&dev->v4l2_dev,
"data_byte_offset %d + bits %d (= %d bytes) > bytesused %d\n",
- sh->data_byte_offset, sh->bit_size, byte_size,
+ sh->data_byte_offset, bit_size, byte_size,
run->src->planes[0].bytesused);
goto fail;
}
@@ -1794,7 +1806,7 @@ static int hevc_d_h265_setup(struct hevc
* actual size of the buffer (which may well be what is used to set
* bit_size if the caller isn't being very pedantic).
*/
- s->data_len = min(sh->bit_size / 8 + 1,
+ s->data_len = min(bit_size / 8 + 1,
run->src->planes[0].bytesused - sh->data_byte_offset);
s->slice_qp = 26 + s->pps.init_qp_minus26 + sh->slice_qp_delta;
@@ -1,34 +0,0 @@
From 970a68f63bf77fe173006ecc8bfdd7eef676f00e Mon Sep 17 00:00:00 2001
From: John Cox <jc@kynesim.co.uk>
Date: Tue, 19 May 2026 13:35:00 +0100
Subject: [PATCH] media/hevc_d: Fix height rounding for old sand formats
Round old sand format heights to 16 rather than 8 as Pi4 ISP
input requires this (gives EFAULT otherwise). As ISP cannot
take new sand formats do not change them.
Signed-off-by: John Cox <jc@kynesim.co.uk>
---
drivers/media/platform/raspberrypi/hevc_dec/hevc_d_video.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_video.c
+++ b/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_video.c
@@ -144,7 +144,7 @@ static void hevc_d_prepare_dst_format(st
case V4L2_PIX_FMT_NV12_COL128:
/* Width rounds up to columns */
width = ALIGN(width, 128);
- height = ALIGN(height, 8);
+ height = ALIGN(height, 16);
/* column height
* Accept suggested shape if at least min & < 2 * min
@@ -158,7 +158,7 @@ static void hevc_d_prepare_dst_format(st
* columns
*/
width = ALIGN(((width + 2) / 3), 32) * 3;
- height = ALIGN(height, 8);
+ height = ALIGN(height, 16);
/* column height
* Accept suggested shape if at least min & < 2 * min
@@ -1,21 +0,0 @@
From fd096e09fd907d39e8378f6ea5bca47c2e7b1277 Mon Sep 17 00:00:00 2001
From: Nicolai Buchwitz <nb@tipi-net.de>
Date: Tue, 26 May 2026 09:18:51 +0200
Subject: [PATCH] Revert "bcmgenet: constrain max DMA burst length"
This reverts commit fd2e5044b7d8764e443150a107f8e9253f8012d8.
---
drivers/net/ethernet/broadcom/genet/bcmgenet.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
@@ -35,7 +35,7 @@
#define ENET_PAD 8
#define ENET_MAX_MTU_SIZE (ETH_DATA_LEN + ETH_HLEN + VLAN_HLEN + \
ENET_BRCM_TAG_LEN + ETH_FCS_LEN + ENET_PAD)
-#define DMA_MAX_BURST_LENGTH 0x08
+#define DMA_MAX_BURST_LENGTH 0x10
/* misc. configuration */
#define MAX_NUM_OF_FS_RULES 16
@@ -1,91 +0,0 @@
From 28ff98dbdf2b5454d8f51bd3399184b391518fb4 Mon Sep 17 00:00:00 2001
From: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
Date: Fri, 22 May 2026 14:53:28 +0100
Subject: [PATCH] Revert "media: i2c: imx219: fix binning and rate_factor for
480p and 1232p"
This reverts commit 002310f6bf7b5d44a81f5f66aba194176462d87c.
---
drivers/media/i2c/imx219.c | 32 +-------------------------------
1 file changed, 1 insertion(+), 31 deletions(-)
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -148,12 +148,6 @@
#define IMX219_PIXEL_ARRAY_WIDTH 3280U
#define IMX219_PIXEL_ARRAY_HEIGHT 2464U
-enum binning_bit_depths {
- BINNING_IDX_8_BIT,
- BINNING_IDX_10_BIT,
- BINNING_IDX_MAX
-};
-
/* Mode : resolution and related config&values */
struct imx219_mode {
/* Frame width */
@@ -163,10 +157,6 @@ struct imx219_mode {
/* V-timing */
unsigned int fll_def;
- unsigned int vts_def;
-
- /* binning mode based on format code */
- unsigned int binning[BINNING_IDX_MAX];
};
static const struct cci_reg_sequence imx219_common_regs[] = {
@@ -325,44 +315,24 @@ static const struct imx219_mode supporte
.width = 3280,
.height = 2464,
.fll_def = 3526,
- .vts_def = 3526,
- .binning = {
- [BINNING_IDX_8_BIT] = IMX219_BINNING_NONE,
- [BINNING_IDX_10_BIT] = IMX219_BINNING_NONE,
- },
},
{
/* 1080P 30fps cropped */
.width = 1920,
.height = 1080,
.fll_def = 1763,
- .vts_def = 1763,
- .binning = {
- [BINNING_IDX_8_BIT] = IMX219_BINNING_NONE,
- [BINNING_IDX_10_BIT] = IMX219_BINNING_NONE,
- },
},
{
/* 2x2 binned 60fps mode */
.width = 1640,
.height = 1232,
.fll_def = 1706,
- .vts_def = 1763,
- .binning = {
- [BINNING_IDX_8_BIT] = IMX219_BINNING_X2_ANALOG,
- [BINNING_IDX_10_BIT] = IMX219_BINNING_X2,
- },
},
{
/* 640x480 60fps mode */
.width = 640,
.height = 480,
.fll_def = 1706,
- .vts_def = 1763,
- .binning = {
- [BINNING_IDX_8_BIT] = IMX219_BINNING_X2_ANALOG,
- [BINNING_IDX_10_BIT] = IMX219_BINNING_X2_ANALOG,
- },
},
};
@@ -463,7 +433,7 @@ static unsigned int imx219_get_binning(s
*bin_v = IMX219_BINNING_NONE;
if (*bin_h == 2 && *bin_v == 2)
- return bin_mode;
+ return IMX219_BINNING_X2_ANALOG;
else if (*bin_h == 2 || *bin_v == 2)
/*
* Don't use analog binning if only one dimension
@@ -1,115 +0,0 @@
From 27eeaba59b18d655fa3001efb917ef71460faedb Mon Sep 17 00:00:00 2001
From: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
Date: Fri, 22 May 2026 14:53:33 +0100
Subject: [PATCH] Revert "drivers: media: imx219: Remove enum binning_mode"
This reverts commit 5eb74d4887b740880dbe51ad4bcafde5f264d740.
---
drivers/media/i2c/imx219.c | 68 ++++++++++++++------------------------
1 file changed, 25 insertions(+), 43 deletions(-)
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -402,57 +402,42 @@ static u32 imx219_get_format_bpp(const s
}
}
-static unsigned int imx219_get_binning(struct v4l2_subdev_state *state,
- u8 *bin_h, u8 *bin_v)
+static void imx219_get_binning(struct v4l2_subdev_state *state, u8 *bin_h,
+ u8 *bin_v)
{
const struct v4l2_mbus_framefmt *format =
v4l2_subdev_state_get_format(state, 0);
- unsigned int bin_mode = IMX219_BINNING_NONE;
- const struct imx219_mode *mode =
- v4l2_find_nearest_size(supported_modes,
- ARRAY_SIZE(supported_modes),
- width, height,
- format->width, format->height);
- switch (format->code) {
- case MEDIA_BUS_FMT_SRGGB8_1X8:
- case MEDIA_BUS_FMT_SGRBG8_1X8:
- case MEDIA_BUS_FMT_SGBRG8_1X8:
- case MEDIA_BUS_FMT_SBGGR8_1X8:
- bin_mode = mode->binning[BINNING_IDX_8_BIT];
- break;
-
- case MEDIA_BUS_FMT_SRGGB10_1X10:
- case MEDIA_BUS_FMT_SGRBG10_1X10:
- case MEDIA_BUS_FMT_SGBRG10_1X10:
- case MEDIA_BUS_FMT_SBGGR10_1X10:
- bin_mode = mode->binning[BINNING_IDX_10_BIT];
- break;
- }
+ const struct v4l2_rect *crop = v4l2_subdev_state_get_crop(state, 0);
+ u32 hbin = crop->width / format->width;
+ u32 vbin = crop->height / format->height;
*bin_h = IMX219_BINNING_NONE;
*bin_v = IMX219_BINNING_NONE;
- if (*bin_h == 2 && *bin_v == 2)
- return IMX219_BINNING_X2_ANALOG;
- else if (*bin_h == 2 || *bin_v == 2)
- /*
- * Don't use analog binning if only one dimension
- * is binned, as it crops the other dimension
- */
- return IMX219_BINNING_X2;
- else
- return IMX219_BINNING_NONE;
+ /*
+ * Use analog binning only if both dimensions are binned, as it crops
+ * the other dimension.
+ */
+ if (hbin == 2 && vbin == 2) {
+ *bin_h = IMX219_BINNING_X2_ANALOG;
+ *bin_v = IMX219_BINNING_X2_ANALOG;
+
+ return;
+ }
+
+ if (hbin == 2)
+ *bin_h = IMX219_BINNING_X2;
+ if (vbin == 2)
+ *bin_v = IMX219_BINNING_X2;
}
static inline u32 imx219_get_rate_factor(struct v4l2_subdev_state *state)
{
u8 bin_h, bin_v;
- unsigned int binning = imx219_get_binning(state, &bin_h, &bin_v);
- if (binning == IMX219_BINNING_X2_ANALOG)
- return 2;
+ imx219_get_binning(state, &bin_h, &bin_v);
- return 1;
+ return (bin_h & bin_v) == IMX219_BINNING_X2_ANALOG ? 2 : 1;
}
/* -----------------------------------------------------------------------------
@@ -693,7 +678,6 @@ static int imx219_set_framefmt(struct im
{
const struct v4l2_mbus_framefmt *format;
const struct v4l2_rect *crop;
- unsigned int binning;
u8 bin_h, bin_v;
u32 bpp;
int ret = 0;
@@ -711,11 +695,9 @@ static int imx219_set_framefmt(struct im
cci_write(imx219->regmap, IMX219_REG_Y_ADD_END_A,
crop->top - IMX219_PIXEL_ARRAY_TOP + crop->height - 1, &ret);
- binning = imx219_get_binning(state, &bin_h, &bin_v);
- cci_write(imx219->regmap, IMX219_REG_BINNING_MODE_H,
- (bin_h == 2) ? binning : IMX219_BINNING_NONE, &ret);
- cci_write(imx219->regmap, IMX219_REG_BINNING_MODE_V,
- (bin_v == 2) ? binning : IMX219_BINNING_NONE, &ret);
+ imx219_get_binning(state, &bin_h, &bin_v);
+ cci_write(imx219->regmap, IMX219_REG_BINNING_MODE_H, bin_h, &ret);
+ cci_write(imx219->regmap, IMX219_REG_BINNING_MODE_V, bin_v, &ret);
cci_write(imx219->regmap, IMX219_REG_X_OUTPUT_SIZE,
format->width, &ret);
@@ -1,21 +0,0 @@
From 49364b4185deb7daeb39ec38614d42f10d2a814f Mon Sep 17 00:00:00 2001
From: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
Date: Fri, 22 May 2026 14:53:35 +0100
Subject: [PATCH] Revert "media: i2c: imx219: Restore the 1920x1080 to using a
1:1 PAR"
This reverts commit cfa10dd3d123cdfeac37d26411bdee7005306fdb.
---
drivers/media/i2c/imx219.c | 1 -
1 file changed, 1 deletion(-)
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -884,7 +884,6 @@ static int imx219_set_pad_format(struct
*/
bin_h = min(IMX219_PIXEL_ARRAY_WIDTH / format->width, 2U);
bin_v = min(IMX219_PIXEL_ARRAY_HEIGHT / format->height, 2U);
- binning = min(bin_h, bin_v);
/* Ensure bin_h and bin_v are same to avoid 1:2 or 2:1 stretching */
binning = min(bin_h, bin_v);
@@ -1,44 +0,0 @@
From a8548398000fce0174e1b1a45ea94e0b43432835 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ma=C3=ADra=20Canal?= <mcanal@igalia.com>
Date: Tue, 26 May 2026 20:30:58 -0300
Subject: [PATCH] drm/v3d: Wait for pending L2T flush before cleaning caches
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
v3d_clean_caches() starts the cache-clean sequence by writing
V3D_L2TCACTL_TMUWCF to V3D_CTL_L2TCACTL and then polling for that bit to
clear. It does not, however, check for an L2T flush (L2TFLS) that may
still be in flight from a previous operation.
On pre-V3D 7.1 hardware, kicking off the TMU write-combiner flush while an
L2T flush is still pending can clobber bits in L2TCACTL and cause cache
inconsistencies.
Poll for L2TFLS to clear before writing L2TCACTL on V3D < 7.1, ensuring
any pending flush has completed before a new clean is issued.
Cc: stable@vger.kernel.org
Fixes: d223f98f0209 ("drm/v3d: Add support for compute shader dispatch.")
Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
drivers/gpu/drm/v3d/v3d_gem.c | 8 ++++++++
1 file changed, 8 insertions(+)
--- a/drivers/gpu/drm/v3d/v3d_gem.c
+++ b/drivers/gpu/drm/v3d/v3d_gem.c
@@ -228,6 +228,14 @@ v3d_clean_caches(struct v3d_dev *v3d)
}
}
+ /* GFXH-1897: Ensure pending flushes complete before writing L2TCACTL */
+ if (v3d->ver < V3D_GEN_71) {
+ if (wait_for(!(V3D_CORE_READ(core, V3D_CTL_L2TCACTL) &
+ V3D_L2TCACTL_L2TFLS), 100)) {
+ DRM_ERROR("Timeout waiting for L2T clean\n");
+ }
+ }
+
V3D_CORE_WRITE(core, V3D_CTL_L2TCACTL, V3D_L2TCACTL_TMUWCF);
if (wait_for(!(V3D_CORE_READ(core, V3D_CTL_L2TCACTL) &
V3D_L2TCACTL_TMUWCF), 100)) {
@@ -1,35 +0,0 @@
From 046dfc1a48046eac01ba99e54b408c3b6e2a2fee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ma=C3=ADra=20Canal?= <mcanal@igalia.com>
Date: Sat, 30 May 2026 16:58:20 -0300
Subject: [PATCH] Revert "drm/v3d: Increase the autosuspend delay"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 3341dd2bc43865b6424d95623065aff51470c15d.
After #7400, this commit is no longer needed. After further analysis, the
100ms autosuspend delay was only ever a workaround: shorter delays caused
more frequent runtime suspend/resume cycles on the BCM2711, which exposed
the cache and MMU coherency bugs as random GPU hangs.
With those hangs resolved, the inflated delay is no longer necessary.
Reduce it from 100ms to 50ms so the GPU power domain can be released
sooner once the GPU goes idle.
Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
drivers/gpu/drm/v3d/v3d_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -431,7 +431,7 @@ static int v3d_platform_drm_probe(struct
v3d_init_hw_state(v3d);
- pm_runtime_set_autosuspend_delay(dev, 100);
+ pm_runtime_set_autosuspend_delay(dev, 50);
pm_runtime_use_autosuspend(dev);
ret = drm_dev_register(drm, 0);
@@ -1,39 +0,0 @@
From 3152f2d6da5b0a9d393cc64e49fee732dd316118 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Tue, 9 Jun 2026 11:47:05 +0100
Subject: [PATCH] Revert "random: do not use jump labels before they are
initialized"
This reverts commit 89a64d88e3c762d2666ec5b9bc115c94de764c2c.
The commit this is reverting was part of a pre-release fix to an
early 5.19 rc issue. It ended up being replaced by an identically
named commit, but this fragment was unintentionally retained as a
partial duplicate.
Drop the duplicate.
See: https://github.com/raspberrypi/linux/issues/7424
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/char/random.c | 8 --------
1 file changed, 8 deletions(-)
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -859,14 +859,6 @@ void __init random_init_early(const char
unsigned long entropy[BLAKE2S_BLOCK_SIZE / sizeof(long)];
size_t i, longs, arch_bits;
- /*
- * If we were initialized by the bootloader before jump labels are
- * initialized, then we should enable the static branch here, where
- * it's guaranteed that jump labels have been initialized.
- */
- if (!static_branch_likely(&crng_is_ready) && crng_init >= CRNG_READY)
- crng_set_ready(NULL);
-
#if defined(LATENT_ENTROPY_PLUGIN)
static const u8 compiletime_seed[BLAKE2S_BLOCK_SIZE] __initconst __latent_entropy;
_mix_pool_bytes(compiletime_seed, sizeof(compiletime_seed));
@@ -1,122 +0,0 @@
From 308ed83bec327158d2822133e42f99979e978f8f Mon Sep 17 00:00:00 2001
From: Mark Rutland <mark.rutland@arm.com>
Date: Tue, 9 Jun 2026 11:12:03 +0100
Subject: [PATCH] arm64: errata: Mitigate TLBI errata on various Arm CPUs
[ Early port of patch sent to linux-arm-kernel, minus documentation ]
A number of CPUs developed by Arm suffer from errata whereby a broadcast
TLBI;DSB sequence may complete before the global observation of writes
which are translated by an affected TLB entry.
These errata ONLY affect the completion of memory accesses which have
been translated by an invalidated TLB entry, and these errata DO NOT
affect the actual invalidation of TLB entries. TLB entries are removed
correctly.
This issue has been assigned CVE ID CVE-2025-10263.
To mitigate this issue, Arm recommends that software follows any
affected TLBI;DSB sequence with an additional TLBI;DSB, which will
ensure that all memory write effects affected by the first TLBI have
been globally observed. The additional TLBI can use any operation that
is broadcast to affected CPUs, and the additional DSB can use any option
that is sufficient to complete the additional TLBI.
The ARM64_WORKAROUND_REPEAT_TLBI workaround is sufficient to mitigate
the issue. Enable this workaround for affected CPUs, and update the
silicon errata documentation accordingly.
Note that due to the manner in which Arm develops IP and tracks errata,
some CPUs share a common erratum number.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
---
arch/arm64/Kconfig | 36 ++++++++++++++++++++++++++++++++++
arch/arm64/kernel/cpu_errata.c | 30 ++++++++++++++++++++++++++--
2 files changed, 64 insertions(+), 2 deletions(-)
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1236,6 +1236,42 @@ config ARM64_ERRATUM_4118414
If unsure, say Y.
+config ARM64_ERRATUM_4118414
+ bool "Cortex-*/Neoverse-*/C1-*: Completion of affected memory accesses might not be guaranteed by completion of a TLBI"
+ default y
+ select ARM64_WORKAROUND_REPEAT_TLBI
+ help
+ This option adds a workaround for the following errata:
+
+ * ARM C1-Premium erratum 4193780
+ * ARM C1-Ultra erratum 4193780
+ * ARM Cortex-A76 erratum 4193800
+ * ARM Cortex-A76AE erratum 4193801
+ * ARM Cortex-A77 erratum 4193798
+ * ARM Cortex-A78 erratum 4193791
+ * ARM Cortex-A78AE erratum 4193793
+ * ARM Cortex-A78C erratum 4193794
+ * ARM Cortex-A710 erratum 4193788
+ * ARM Cortex-X1 erratum 4193791
+ * ARM Cortex-X1C erratum 4193792
+ * ARM Cortex-X2 erratum 4193788
+ * ARM Cortex-X3 erratum 4193786
+ * ARM Cortex-X4 erratum 4118414
+ * ARM Cortex-X925 erratum 4193781
+ * ARM Neoverse-N1 erratum 4193800
+ * ARM Neoverse-N2 erratum 4193789
+ * ARM Neoverse-V1 erratum 4193790
+ * ARM Neoverse-V2 erratum 4193787
+ * ARM Neoverse-V3 erratum 4193784
+ * ARM Neoverse-V3AE erratum 4193784
+
+ On affected cores, some memory accesses might not be completed by
+ broadcast TLB invalidation.
+
+ This issue is also known as CVE-2025-10263.
+
+ If unsure, say Y.
+
config CAVIUM_ERRATUM_22375
bool "Cavium erratum 22375, 24313"
default y
--- a/arch/arm64/kernel/cpu_errata.c
+++ b/arch/arm64/kernel/cpu_errata.c
@@ -429,7 +429,33 @@ static const struct midr_range workaroun
/* Cortex-A53 r0p[01] : ARM errata 819472 */
MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 1),
#endif
- {},
+#ifdef CONFIG_ARM64_ERRATUM_4118414
+ {
+ ERRATA_MIDR_RANGE_LIST(((const struct midr_range[]) {
+ MIDR_ALL_VERSIONS(MIDR_CORTEX_A76),
+ MIDR_ALL_VERSIONS(MIDR_CORTEX_A76AE),
+ MIDR_ALL_VERSIONS(MIDR_CORTEX_A77),
+ MIDR_ALL_VERSIONS(MIDR_CORTEX_A78),
+ MIDR_ALL_VERSIONS(MIDR_CORTEX_A78AE),
+ MIDR_ALL_VERSIONS(MIDR_CORTEX_A78C),
+ MIDR_ALL_VERSIONS(MIDR_CORTEX_A710),
+ MIDR_ALL_VERSIONS(MIDR_CORTEX_X1),
+ MIDR_ALL_VERSIONS(MIDR_CORTEX_X1C),
+ MIDR_ALL_VERSIONS(MIDR_CORTEX_X2),
+ MIDR_ALL_VERSIONS(MIDR_CORTEX_X3),
+ MIDR_ALL_VERSIONS(MIDR_CORTEX_X4),
+ MIDR_ALL_VERSIONS(MIDR_CORTEX_X925),
+ MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1),
+ MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N2),
+ MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V1),
+ MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V2),
+ MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V3),
+ MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V3AE),
+ {}
+ })),
+ },
+#endif
+ {}
};
#endif
@@ -1,122 +0,0 @@
From 5c83d27e5b49621a4734c046e3c64df50dac4cde Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 28 May 2026 13:20:31 +0100
Subject: [PATCH] Revert "media: tc358743: Fix the RGB MBUS format"
This reverts commit 3b411a7a60f0c4cba28640375801319292932d24.
Upstream changed their minds as to how to solve this problem.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/tc358743.c | 53 ++++++------------------------------
1 file changed, 9 insertions(+), 44 deletions(-)
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -756,7 +756,6 @@ static void tc358743_set_ref_clk(struct
static void tc358743_set_csi_color_space(struct v4l2_subdev *sd)
{
struct tc358743_state *state = to_state(sd);
- struct device *dev = &state->i2c_client->dev;
switch (state->mbus_fmt_code) {
case MEDIA_BUS_FMT_UYVY8_1X16:
@@ -772,17 +771,7 @@ static void tc358743_set_csi_color_space
mutex_unlock(&state->confctl_mutex);
break;
case MEDIA_BUS_FMT_RGB888_1X24:
- /*
- * The driver was initially introduced with RGB888
- * support, but CSI really means BGR.
- *
- * Since we might have applications that would have
- * hard-coded the RGB888, let's support both.
- */
- dev_warn_once(dev, "RGB format isn't actually supported by the hardware. The application should be fixed to use BGR.");
- fallthrough;
- case MEDIA_BUS_FMT_BGR888_1X24:
- v4l2_dbg(2, debug, sd, "%s: BGR 888 24-bit\n", __func__);
+ v4l2_dbg(2, debug, sd, "%s: RGB 888 24-bit\n", __func__);
i2c_wr8_and_or(sd, VOUT_SET2,
~(MASK_SEL422 | MASK_VOUT_422FIL_100) & 0xff,
0x00);
@@ -1444,26 +1433,11 @@ static int tc358743_log_status(struct v4
v4l2_info(sd, "Stopped: %s\n",
(i2c_rd16(sd, CSI_STATUS) & MASK_S_HLT) ?
"yes" : "no");
-
- switch (state->mbus_fmt_code) {
- case MEDIA_BUS_FMT_BGR888_1X24:
- /*
- * The driver was initially introduced with RGB888
- * support, but CSI really means BGR.
- *
- * Since we might have applications that would have
- * hard-coded the RGB888, let's support both.
- */
- case MEDIA_BUS_FMT_RGB888_1X24:
- v4l2_info(sd, "Color space: BGR 888 24-bit\n");
- break;
- case MEDIA_BUS_FMT_UYVY8_1X16:
- v4l2_info(sd, "Color space: YCbCr 422 16-bit\n");
- break;
- default:
- v4l2_info(sd, "Color space: Unsupported\n");
- break;
- }
+ v4l2_info(sd, "Color space: %s\n",
+ state->mbus_fmt_code == MEDIA_BUS_FMT_UYVY8_1X16 ?
+ "YCbCr 422 16-bit" :
+ state->mbus_fmt_code == MEDIA_BUS_FMT_RGB888_1X24 ?
+ "RGB 888 24-bit" : "Unsupported");
v4l2_info(sd, "-----%s status-----\n", is_hdmi(sd) ? "HDMI" : "DVI-D");
v4l2_info(sd, "HDCP encrypted content: %s\n",
@@ -1800,18 +1774,11 @@ static int tc358743_enum_mbus_code(struc
{
switch (code->index) {
case 0:
- code->code = MEDIA_BUS_FMT_BGR888_1X24;
+ code->code = MEDIA_BUS_FMT_RGB888_1X24;
break;
case 1:
code->code = MEDIA_BUS_FMT_UYVY8_1X16;
break;
- case 2:
- /*
- * We need to keep RGB888 for backward compatibility,
- * but we should list it last for userspace to pick BGR.
- */
- code->code = MEDIA_BUS_FMT_RGB888_1X24;
- break;
default:
return -EINVAL;
}
@@ -1821,7 +1788,6 @@ static int tc358743_enum_mbus_code(struc
static u32 tc358743_g_colorspace(u32 code)
{
switch (code) {
- case MEDIA_BUS_FMT_BGR888_1X24:
case MEDIA_BUS_FMT_RGB888_1X24:
return V4L2_COLORSPACE_SRGB;
case MEDIA_BUS_FMT_UYVY8_1X16:
@@ -1859,8 +1825,7 @@ static int tc358743_set_fmt(struct v4l2_
u32 code = format->format.code; /* is overwritten by get_fmt */
int ret = tc358743_get_fmt(sd, sd_state, format);
- if (code == MEDIA_BUS_FMT_BGR888_1X24 ||
- code == MEDIA_BUS_FMT_RGB888_1X24 ||
+ if (code == MEDIA_BUS_FMT_RGB888_1X24 ||
code == MEDIA_BUS_FMT_UYVY8_1X16)
format->format.code = code;
format->format.colorspace = tc358743_g_colorspace(format->format.code);
@@ -2280,7 +2245,7 @@ static int tc358743_probe(struct i2c_cli
if (err < 0)
goto err_hdl;
- state->mbus_fmt_code = MEDIA_BUS_FMT_BGR888_1X24;
+ state->mbus_fmt_code = MEDIA_BUS_FMT_RGB888_1X24;
sd->dev = &client->dev;
@@ -42,7 +42,7 @@ Signed-off-by: Lukasz Raczylo <lukasz@raczylo.com>
#define MACB_CAPS_CLK_HW_CHG 0x04000000
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -1953,12 +1953,13 @@ static void macb_tx_restart(struct macb_
@@ -1951,12 +1951,13 @@ static void macb_tx_restart(struct macb_
spin_lock(&bp->lock);
macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART));
@@ -61,7 +61,7 @@ Signed-off-by: Lukasz Raczylo <lukasz@raczylo.com>
spin_unlock(&bp->lock);
out_tx_ptr_unlock:
@@ -2698,10 +2699,12 @@ static netdev_tx_t macb_start_xmit(struc
@@ -2632,10 +2633,12 @@ static netdev_tx_t macb_start_xmit(struc
queue->tx_pending = 1;
macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART));
@@ -77,7 +77,7 @@ Signed-off-by: Lukasz Raczylo <lukasz@raczylo.com>
spin_unlock(&bp->lock);
if (CIRC_SPACE(queue->tx_head, queue->tx_tail, bp->tx_ring_size) < 1)
@@ -5841,6 +5844,7 @@ static const struct macb_config raspberr
@@ -5769,6 +5772,7 @@ static const struct macb_config raspberr
.caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_CLK_HW_CHG |
MACB_CAPS_JUMBO |
MACB_CAPS_GEM_HAS_PTP |
@@ -1,92 +0,0 @@
From 60fc80b89d134d720fbab7ef504f80a4ae7a998c Mon Sep 17 00:00:00 2001
From: Lukasz Raczylo <lukasz@raczylo.com>
Date: Thu, 14 May 2026 23:31:22 +0100
Subject: [PATCH] net: macb: drop destructive ISR read, use IMR barrier in
macb_tx_poll
Commit ff6914e97386 ("net: macb: re-check ISR after IER re-enable
in macb_tx_poll") added a re-check of ISR with a TCOMP mask after
unmasking the interrupt, intended to catch completions that fired
while masked plus serve as a PCIe read barrier so the descriptor
check sees up-to-date TX_USED.
That ISR read is destructive on silicon where MACB_CAPS_ISR_CLEAR_ON_WRITE
is not set -- raspberrypi_rp1_config is one such case. On read-clear
ISR the queue_readl(queue, ISR) call consumes every set bit, but the
macb_tx_poll() use-site masks the value down to MACB_BIT(TCOMP) and
discards the rest. Any RCOMP / ROVR / TXUBR bit set in ISR at the
moment of the read is silently consumed and never processed by the
primary macb_interrupt() handler. The race window is small (~200-500 ns
per macb_tx_poll completion) but real, and on a level-triggered IRQ the
consumed bit drops the line before GIC delivery, so the IRQ for that
event is never raised at all.
Replace the destructive read with a read of IMR, the read-only
interrupt-mask mirror. IMR has no side effects on either read-clear
or W1C ISR silicon, and the MMIO read still serves as an architected
PCIe read barrier that retires prior peripheral DMA writes before the
following macb_tx_complete_pending() inspects the descriptor. The
"directly sample a latched TCOMP" half of the original change is lost;
the PCIe-barrier half -- which is what the documented race in the
existing rmb() comment requires -- is preserved.
This is the rpi-6.18.y portion of the v2 follow-up to the netdev RFC
submission; the mainline v2 is on lore:
https://lore.kernel.org/netdev/cover.1777064117.git.lukasz@raczylo.com/T/
Fixes: ff6914e97386 ("net: macb: re-check ISR after IER re-enable in macb_tx_poll")
Signed-off-by: Lukasz Raczylo <lukasz@raczylo.com>
---
drivers/net/ethernet/cadence/macb_main.c | 37 ++++++++++++++----------
1 file changed, 22 insertions(+), 15 deletions(-)
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -2004,24 +2004,31 @@ static int macb_tx_poll(struct napi_stru
if (work_done < budget && napi_complete_done(napi, work_done)) {
queue_writel(queue, IER, MACB_BIT(TCOMP));
- /* TCOMP events that fire while the interrupt is masked do
- * not re-fire when IER is re-enabled. Catch this two ways
- * to avoid losing a wakeup:
+ /* TCOMP events that fire while masked don't re-fire when
+ * IER is re-enabled (HW errata), so check in software.
+ * macb_tx_complete_pending() inspects the descriptor at
+ * tx_tail; the rmb() in there orders prior CPU writes but
+ * does not retire in-flight peripheral DMA writes that
+ * may still be racing back to memory on PCIe-attached
+ * parts.
*
- * (1) Read ISR -- catches completions the hardware flagged
- * but that we did not see as an interrupt. The MMIO
- * read doubles as a PCIe read barrier, flushing any
- * in-flight descriptor TX_USED DMA writes into memory.
- * (2) macb_tx_complete_pending() inspects the ring after
- * that flush, catching a descriptor whose TX_USED is
- * now visible as a result of the barrier.
+ * Read a side-effect-free MMIO register (IMR, the
+ * read-only mask mirror) to act as a PCIe read barrier
+ * for prior peripheral DMA writes. After this read, any
+ * in-flight TX_USED descriptor update has retired and
+ * macb_tx_complete_pending() will observe it.
*
- * This can race with the interrupt handler taking the same
- * path if an interrupt fires just after the IER write;
- * rescheduling NAPI in that case is harmless.
+ * Note: an earlier form of this block read ISR directly
+ * to also sample a latched TCOMP bit, but that is
+ * destructive on silicon where MACB_CAPS_ISR_CLEAR_ON_WRITE
+ * is not set (raspberrypi_rp1_config among others): the
+ * read clears every set bit, and a masked check silently
+ * consumes RCOMP / ROVR / TXUBR bits the IRQ handler is
+ * expected to process in one pass. IMR is non-destructive
+ * on both read-clear and W1C silicon.
*/
- if ((queue_readl(queue, ISR) & MACB_BIT(TCOMP)) ||
- macb_tx_complete_pending(queue)) {
+ (void)queue_readl(queue, IMR);
+ if (macb_tx_complete_pending(queue)) {
queue_writel(queue, IDR, MACB_BIT(TCOMP));
if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
queue_writel(queue, ISR, MACB_BIT(TCOMP));
@@ -1,84 +0,0 @@
From b2f7eec2bfff1a7f03e9c2ad81cb4d654079ba79 Mon Sep 17 00:00:00 2001
From: Lukasz Raczylo <lukasz@raczylo.com>
Date: Thu, 14 May 2026 23:31:51 +0100
Subject: [PATCH] net: macb: gate TX stall watchdog on netif_carrier_ok, use
warn_ratelimited
Commit 79dc190b12f9 ("net: macb: add TX stall watchdog as
defence-in-depth safety net") added a per-queue 1 Hz delayed_work
that fires macb_tx_restart() if tx_tail has not advanced. Two
operational follow-ups:
1. Boot-time false positive. Between macb_open() and link autoneg
completion, queue->tx_head can advance from kernel-queued packets
while tx_tail stays at 0 because no TCOMPs have arrived yet. The
first watchdog tick at +1000 ms then trips its head!=tail check
and fires a spurious TX-stall warning + re-kick. Observed at
~25% rate during fleet rolling reboots (6 of 24 nodes, all
tail=0 head=5-7). The re-kick itself is harmless on a healthy
ring (macb_tx_restart() verifies TBQP vs head before re-asserting
TSTART), but the warning is noise and confuses operators who
read it as a real silent-stall event.
Gate the stall check on netif_carrier_ok(). No carrier means no
completion is possible, so skipping the check is safe; the
watchdog still ticks so it picks up immediately once carrier
comes up.
2. netdev_warn_once() limits visibility to one event per netdev
lifetime, which is fine for a warn-once defensive log but defeats
any operator accounting of real stall events on long-running
nodes. Switch to pr_warn_ratelimited() with an explicit
netdev_name() prefix: bounded log noise, the events stay visible
in the journal for accounting, and it avoids
netdev_warn_ratelimited() which is not available in this tree.
This is the rpi-6.18.y portion of the v2 follow-up to the netdev RFC
submission; the mainline v2 is on lore:
https://lore.kernel.org/netdev/cover.1777064117.git.lukasz@raczylo.com/T/
Co-authored-by: John Laur <johnlaur@gmail.com>
Signed-off-by: Lukasz Raczylo <lukasz@raczylo.com>
---
drivers/net/ethernet/cadence/macb_main.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -2077,6 +2077,16 @@ static void macb_tx_stall_watchdog(struc
if (!netif_running(bp->dev))
return;
+ /* No carrier => no completion is possible. Skip the stall
+ * check (otherwise queue->tx_head can advance from kernel-
+ * queued packets between macb_open() and link autoneg
+ * completion while tx_tail stays unchanged, tripping a false
+ * positive), but keep the watchdog ticking so it picks up
+ * once carrier comes up.
+ */
+ if (!netif_carrier_ok(bp->dev))
+ goto reschedule;
+
spin_lock_irqsave(&queue->tx_ptr_lock, flags);
cur_tail = queue->tx_tail;
cur_head = queue->tx_head;
@@ -2086,13 +2096,14 @@ static void macb_tx_stall_watchdog(struc
spin_unlock_irqrestore(&queue->tx_ptr_lock, flags);
if (stalled) {
- netdev_warn_once(bp->dev,
- "TX stall detected on queue %u (tail=%u head=%u); re-kicking TSTART\n",
- (unsigned int)(queue - bp->queues),
- cur_tail, cur_head);
+ pr_warn_ratelimited("%s: TX stall detected on queue %u (tail=%u head=%u); re-kicking TSTART\n",
+ netdev_name(bp->dev),
+ (unsigned int)(queue - bp->queues),
+ cur_tail, cur_head);
macb_tx_restart(queue);
}
+reschedule:
schedule_delayed_work(&queue->tx_stall_watchdog_work,
msecs_to_jiffies(MACB_TX_STALL_INTERVAL_MS));
}
@@ -1,94 +0,0 @@
From 665d7ac2a43ac957fe299af59d3ad92bafc2d585 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Fri, 19 Jun 2026 15:33:09 +0100
Subject: [PATCH] Revert "arm64: errata: Mitigate TLBI errata on various Arm
CPUs"
This reverts commit 308ed83bec327158d2822133e42f99979e978f8f.
---
arch/arm64/Kconfig | 36 ----------------------------------
arch/arm64/kernel/cpu_errata.c | 28 +-------------------------
2 files changed, 1 insertion(+), 63 deletions(-)
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1236,42 +1236,6 @@ config ARM64_ERRATUM_4118414
If unsure, say Y.
-config ARM64_ERRATUM_4118414
- bool "Cortex-*/Neoverse-*/C1-*: Completion of affected memory accesses might not be guaranteed by completion of a TLBI"
- default y
- select ARM64_WORKAROUND_REPEAT_TLBI
- help
- This option adds a workaround for the following errata:
-
- * ARM C1-Premium erratum 4193780
- * ARM C1-Ultra erratum 4193780
- * ARM Cortex-A76 erratum 4193800
- * ARM Cortex-A76AE erratum 4193801
- * ARM Cortex-A77 erratum 4193798
- * ARM Cortex-A78 erratum 4193791
- * ARM Cortex-A78AE erratum 4193793
- * ARM Cortex-A78C erratum 4193794
- * ARM Cortex-A710 erratum 4193788
- * ARM Cortex-X1 erratum 4193791
- * ARM Cortex-X1C erratum 4193792
- * ARM Cortex-X2 erratum 4193788
- * ARM Cortex-X3 erratum 4193786
- * ARM Cortex-X4 erratum 4118414
- * ARM Cortex-X925 erratum 4193781
- * ARM Neoverse-N1 erratum 4193800
- * ARM Neoverse-N2 erratum 4193789
- * ARM Neoverse-V1 erratum 4193790
- * ARM Neoverse-V2 erratum 4193787
- * ARM Neoverse-V3 erratum 4193784
- * ARM Neoverse-V3AE erratum 4193784
-
- On affected cores, some memory accesses might not be completed by
- broadcast TLB invalidation.
-
- This issue is also known as CVE-2025-10263.
-
- If unsure, say Y.
-
config CAVIUM_ERRATUM_22375
bool "Cavium erratum 22375, 24313"
default y
--- a/arch/arm64/kernel/cpu_errata.c
+++ b/arch/arm64/kernel/cpu_errata.c
@@ -429,33 +429,7 @@ static const struct midr_range workaroun
/* Cortex-A53 r0p[01] : ARM errata 819472 */
MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 1),
#endif
-#ifdef CONFIG_ARM64_ERRATUM_4118414
- {
- ERRATA_MIDR_RANGE_LIST(((const struct midr_range[]) {
- MIDR_ALL_VERSIONS(MIDR_CORTEX_A76),
- MIDR_ALL_VERSIONS(MIDR_CORTEX_A76AE),
- MIDR_ALL_VERSIONS(MIDR_CORTEX_A77),
- MIDR_ALL_VERSIONS(MIDR_CORTEX_A78),
- MIDR_ALL_VERSIONS(MIDR_CORTEX_A78AE),
- MIDR_ALL_VERSIONS(MIDR_CORTEX_A78C),
- MIDR_ALL_VERSIONS(MIDR_CORTEX_A710),
- MIDR_ALL_VERSIONS(MIDR_CORTEX_X1),
- MIDR_ALL_VERSIONS(MIDR_CORTEX_X1C),
- MIDR_ALL_VERSIONS(MIDR_CORTEX_X2),
- MIDR_ALL_VERSIONS(MIDR_CORTEX_X3),
- MIDR_ALL_VERSIONS(MIDR_CORTEX_X4),
- MIDR_ALL_VERSIONS(MIDR_CORTEX_X925),
- MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1),
- MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N2),
- MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V1),
- MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V2),
- MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V3),
- MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V3AE),
- {}
- })),
- },
-#endif
- {}
+ {},
};
#endif
@@ -1,28 +0,0 @@
From de7f1638ebdb802cc70e482cd3a014763746f53b Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Fri, 19 Jun 2026 15:33:38 +0100
Subject: [PATCH] Revert "drm/v3d: Wait for pending L2T flush before cleaning
caches"
This reverts commit a8548398000fce0174e1b1a45ea94e0b43432835.
---
drivers/gpu/drm/v3d/v3d_gem.c | 8 --------
1 file changed, 8 deletions(-)
--- a/drivers/gpu/drm/v3d/v3d_gem.c
+++ b/drivers/gpu/drm/v3d/v3d_gem.c
@@ -228,14 +228,6 @@ v3d_clean_caches(struct v3d_dev *v3d)
}
}
- /* GFXH-1897: Ensure pending flushes complete before writing L2TCACTL */
- if (v3d->ver < V3D_GEN_71) {
- if (wait_for(!(V3D_CORE_READ(core, V3D_CTL_L2TCACTL) &
- V3D_L2TCACTL_L2TFLS), 100)) {
- DRM_ERROR("Timeout waiting for L2T clean\n");
- }
- }
-
V3D_CORE_WRITE(core, V3D_CTL_L2TCACTL, V3D_L2TCACTL_TMUWCF);
if (wait_for(!(V3D_CORE_READ(core, V3D_CTL_L2TCACTL) &
V3D_L2TCACTL_TMUWCF), 100)) {
@@ -1,31 +0,0 @@
From dc800a5027d2c4c52314396f1d1fd83cc455644d Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 8 Jul 2026 17:38:06 +0100
Subject: [PATCH] Revert "media/hevc_d: Fix height rounding for old sand
formats"
This reverts commit 970a68f63bf77fe173006ecc8bfdd7eef676f00e.
---
drivers/media/platform/raspberrypi/hevc_dec/hevc_d_video.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_video.c
+++ b/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_video.c
@@ -144,7 +144,7 @@ static void hevc_d_prepare_dst_format(st
case V4L2_PIX_FMT_NV12_COL128:
/* Width rounds up to columns */
width = ALIGN(width, 128);
- height = ALIGN(height, 16);
+ height = ALIGN(height, 8);
/* column height
* Accept suggested shape if at least min & < 2 * min
@@ -158,7 +158,7 @@ static void hevc_d_prepare_dst_format(st
* columns
*/
width = ALIGN(((width + 2) / 3), 32) * 3;
- height = ALIGN(height, 16);
+ height = ALIGN(height, 8);
/* column height
* Accept suggested shape if at least min & < 2 * min
@@ -1,66 +0,0 @@
From 33c5a591e4ea7e62aadab871a905e428cacea07f Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 8 Jul 2026 17:38:08 +0100
Subject: [PATCH] Revert "media/hevc_d: Fix old-style bit_size handling
support"
This reverts commit 7a41407d9a255b4e36b2e7710bbe7f3e1092fa2e.
---
.../raspberrypi/hevc_dec/hevc_d_h265.c | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
--- a/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_h265.c
+++ b/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_h265.c
@@ -1578,8 +1578,6 @@ static int hevc_d_h265_setup(struct hevc
bool slice_temporal_mvp;
unsigned int ctb_size_y;
bool sps_changed = false;
- /* Old (downstream only) bit size meanings */
- bool old_bits = false;
de = dec_env_new(ctx);
if (!de) {
@@ -1648,7 +1646,6 @@ static int hevc_d_h265_setup(struct hevc
de->chroma_stride = de->luma_stride;
de->frame_chroma_addr = de->frame_luma_addr +
(ctx->dst_fmt.height * 128);
- old_bits = true;
break;
}
@@ -1779,24 +1776,15 @@ static int hevc_d_h265_setup(struct hevc
for (i = 0; i != run->h265.slice_ents; ++i) {
const struct v4l2_ctrl_hevc_slice_params *const sh = sh0 + i;
const bool last_slice = i + 1 == run->h265.slice_ents;
- unsigned int bit_size = old_bits ? sh->bit_size - 8 * sh->data_byte_offset :
- sh->bit_size;
- const u32 byte_size = DIV_ROUND_UP(bit_size, 8);
+ const u32 byte_size = DIV_ROUND_UP(sh->bit_size, 8);
unsigned int j;
s->sh = sh;
- if (old_bits && sh->bit_size <= 8 * sh->data_byte_offset) {
- v4l2_warn(&dev->v4l2_dev,
- "data_byte_offset %d * 8 >= bits %d\n",
- sh->data_byte_offset, sh->bit_size);
- goto fail;
- }
-
if (sh->data_byte_offset + byte_size > run->src->planes[0].bytesused) {
v4l2_warn(&dev->v4l2_dev,
"data_byte_offset %d + bits %d (= %d bytes) > bytesused %d\n",
- sh->data_byte_offset, bit_size, byte_size,
+ sh->data_byte_offset, sh->bit_size, byte_size,
run->src->planes[0].bytesused);
goto fail;
}
@@ -1806,7 +1794,7 @@ static int hevc_d_h265_setup(struct hevc
* actual size of the buffer (which may well be what is used to set
* bit_size if the caller isn't being very pedantic).
*/
- s->data_len = min(bit_size / 8 + 1,
+ s->data_len = min(sh->bit_size / 8 + 1,
run->src->planes[0].bytesused - sh->data_byte_offset);
s->slice_qp = 26 + s->pps.init_qp_minus26 + sh->slice_qp_delta;
@@ -1,262 +0,0 @@
From b54d5f9068406d4544b7a7fba9ef3c533b795a79 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 8 Jul 2026 17:38:10 +0100
Subject: [PATCH] Revert "media: hevc_dec: Add in downstream single planar SAND
variant"
This reverts commit a9731ff75336f472eca7a94e661d5bbcb1382ae2.
---
.../raspberrypi/hevc_dec/hevc_d_h265.c | 79 ++------------
.../raspberrypi/hevc_dec/hevc_d_video.c | 101 ++++--------------
2 files changed, 31 insertions(+), 149 deletions(-)
--- a/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_h265.c
+++ b/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_h265.c
@@ -1628,40 +1628,24 @@ static int hevc_d_h265_setup(struct hevc
de->cmd_len = 0;
de->dpbno_col = ~0U;
- switch (ctx->dst_fmt.pixelformat) {
- case V4L2_PIX_FMT_NV12MT_COL128:
- case V4L2_PIX_FMT_NV12MT_10_COL128:
- de->luma_stride = ctx->dst_fmt.height * 128;
- de->frame_luma_addr =
- vb2_dma_contig_plane_dma_addr(&run->dst->vb2_buf, 0);
- de->chroma_stride = de->luma_stride / 2;
- de->frame_chroma_addr =
- vb2_dma_contig_plane_dma_addr(&run->dst->vb2_buf, 1);
- break;
- case V4L2_PIX_FMT_NV12_COL128:
- case V4L2_PIX_FMT_NV12_10_COL128:
- de->luma_stride = ctx->dst_fmt.plane_fmt[0].bytesperline * 128;
- de->frame_luma_addr =
- vb2_dma_contig_plane_dma_addr(&run->dst->vb2_buf, 0);
- de->chroma_stride = de->luma_stride;
- de->frame_chroma_addr = de->frame_luma_addr +
- (ctx->dst_fmt.height * 128);
- break;
- }
-
+ de->luma_stride = ctx->dst_fmt.height * 128;
+ de->frame_luma_addr =
+ vb2_dma_contig_plane_dma_addr(&run->dst->vb2_buf, 0);
+ de->chroma_stride = de->luma_stride / 2;
+ de->frame_chroma_addr =
+ vb2_dma_contig_plane_dma_addr(&run->dst->vb2_buf, 1);
de->frame_aux = NULL;
if (s->sps.bit_depth_luma_minus8 == 0) {
- if (ctx->dst_fmt.pixelformat != V4L2_PIX_FMT_NV12MT_COL128 &&
- ctx->dst_fmt.pixelformat != V4L2_PIX_FMT_NV12_COL128) {
+ if (ctx->dst_fmt.pixelformat != V4L2_PIX_FMT_NV12MT_COL128) {
v4l2_err(&dev->v4l2_dev,
"Pixel format %#x != NV12MT_COL128 for 8-bit output",
ctx->dst_fmt.pixelformat);
goto fail;
}
} else {
- if (ctx->dst_fmt.pixelformat != V4L2_PIX_FMT_NV12MT_10_COL128 &&
- ctx->dst_fmt.pixelformat != V4L2_PIX_FMT_NV12_10_COL128) {
+ if (ctx->dst_fmt.pixelformat !=
+ V4L2_PIX_FMT_NV12MT_10_COL128) {
v4l2_err(&dev->v4l2_dev,
"Pixel format %#x != NV12MT_10_COL128 for 10-bit output",
ctx->dst_fmt.pixelformat);
@@ -1680,42 +1664,6 @@ static int hevc_d_h265_setup(struct hevc
goto fail;
}
- switch (ctx->dst_fmt.pixelformat) {
- case V4L2_PIX_FMT_NV12MT_COL128:
- case V4L2_PIX_FMT_NV12MT_10_COL128:
- if (run->dst->vb2_buf.num_planes != 2) {
- v4l2_warn(&dev->v4l2_dev, "Capture planes (%d) != 2\n",
- run->dst->vb2_buf.num_planes);
- goto fail;
- }
- if (run->dst->planes[0].length < ctx->dst_fmt.plane_fmt[0].sizeimage ||
- run->dst->planes[1].length < ctx->dst_fmt.plane_fmt[1].sizeimage) {
- v4l2_warn(&dev->v4l2_dev,
- "Capture planes length (%d/%d) < sizeimage (%d/%d)\n",
- run->dst->planes[0].length,
- run->dst->planes[1].length,
- ctx->dst_fmt.plane_fmt[0].sizeimage,
- ctx->dst_fmt.plane_fmt[1].sizeimage);
- goto fail;
- }
- break;
- case V4L2_PIX_FMT_NV12_COL128:
- case V4L2_PIX_FMT_NV12_10_COL128:
- if (run->dst->vb2_buf.num_planes != 1) {
- v4l2_warn(&dev->v4l2_dev, "Capture planes (%d) != 1\n",
- run->dst->vb2_buf.num_planes);
- goto fail;
- }
- if (run->dst->planes[0].length < ctx->dst_fmt.plane_fmt[0].sizeimage) {
- v4l2_warn(&dev->v4l2_dev,
- "Capture planes length (%d) < sizeimage (%d)\n",
- run->dst->planes[0].length,
- ctx->dst_fmt.plane_fmt[0].sizeimage);
- goto fail;
- }
- break;
- }
-
/*
* Fill in ref planes with our address s.t. if we mess up refs
* somehow then we still have a valid address entry
@@ -1885,13 +1833,8 @@ static int hevc_d_h265_setup(struct hevc
de->ref_addrs[i][0] =
vb2_dma_contig_plane_dma_addr(buf, 0);
- if (ctx->dst_fmt.pixelformat == V4L2_PIX_FMT_NV12MT_COL128 ||
- ctx->dst_fmt.pixelformat == V4L2_PIX_FMT_NV12MT_10_COL128)
- de->ref_addrs[i][1] =
- vb2_dma_contig_plane_dma_addr(buf, 1);
- else
- de->ref_addrs[i][1] = de->ref_addrs[i][0] +
- (ctx->dst_fmt.height * 128);
+ de->ref_addrs[i][1] =
+ vb2_dma_contig_plane_dma_addr(buf, 1);
}
/* Move DPB from temp */
--- a/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_video.c
+++ b/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_video.c
@@ -140,55 +140,17 @@ static void hevc_d_prepare_dst_format(st
bytesperline = width * 4 / 3;
sizeimage = bytesperline * height;
break;
-
- case V4L2_PIX_FMT_NV12_COL128:
- /* Width rounds up to columns */
- width = ALIGN(width, 128);
- height = ALIGN(height, 8);
-
- /* column height
- * Accept suggested shape if at least min & < 2 * min
- */
- bytesperline = constrain2x(bytesperline, height * 3 / 2);
- sizeimage = bytesperline * width;
- break;
-
- case V4L2_PIX_FMT_NV12_10_COL128:
- /* width in pixels (3 pels = 4 bytes) rounded to 128 byte
- * columns
- */
- width = ALIGN(((width + 2) / 3), 32) * 3;
- height = ALIGN(height, 8);
-
- /* column height
- * Accept suggested shape if at least min & < 2 * min
- */
- bytesperline = constrain2x(bytesperline, height * 3 / 2);
- sizeimage = bytesperline * width * 4 / 3;
- break;
}
pix_fmt->width = width;
pix_fmt->height = height;
pix_fmt->field = V4L2_FIELD_NONE;
- switch (pix_fmt->pixelformat) {
- default:
- case V4L2_PIX_FMT_NV12MT_COL128:
- case V4L2_PIX_FMT_NV12MT_10_COL128:
- pix_fmt->plane_fmt[0].bytesperline = bytesperline;
- pix_fmt->plane_fmt[0].sizeimage = sizeimage;
- pix_fmt->plane_fmt[1].bytesperline = bytesperline;
- pix_fmt->plane_fmt[1].sizeimage = sizeimage / 2;
- pix_fmt->num_planes = 2;
- break;
- case V4L2_PIX_FMT_NV12_COL128:
- case V4L2_PIX_FMT_NV12_10_COL128:
- pix_fmt->plane_fmt[0].bytesperline = bytesperline;
- pix_fmt->plane_fmt[0].sizeimage = sizeimage;
- pix_fmt->num_planes = 1;
- break;
- }
+ pix_fmt->plane_fmt[0].bytesperline = bytesperline;
+ pix_fmt->plane_fmt[0].sizeimage = sizeimage;
+ pix_fmt->plane_fmt[1].bytesperline = bytesperline;
+ pix_fmt->plane_fmt[1].sizeimage = sizeimage / 2;
+ pix_fmt->num_planes = 2;
}
static int hevc_d_querycap(struct file *file, void *priv,
@@ -273,31 +235,19 @@ static int hevc_d_hevc_validate_sps(cons
static u32 pixelformat_from_sps(const struct v4l2_ctrl_hevc_sps * const sps,
const int index)
{
- static const u32 all_formats[] = {
- V4L2_PIX_FMT_NV12MT_COL128,
- V4L2_PIX_FMT_NV12MT_10_COL128,
- V4L2_PIX_FMT_NV12_COL128,
- V4L2_PIX_FMT_NV12_10_COL128,
- };
u32 pf = 0;
if (!is_sps_set(sps) || !hevc_d_hevc_validate_sps(sps)) {
/* Treat this as an error? For now return both */
-
- if (index < ARRAY_SIZE(all_formats))
- pf = all_formats[index];
- } else {
- if (index == 0) {
- if (sps->bit_depth_luma_minus8 == 0)
- pf = V4L2_PIX_FMT_NV12MT_COL128;
- else if (sps->bit_depth_luma_minus8 == 2)
- pf = V4L2_PIX_FMT_NV12MT_10_COL128;
- } else if (index == 1) {
- if (sps->bit_depth_luma_minus8 == 0)
- pf = V4L2_PIX_FMT_NV12_COL128;
- else if (sps->bit_depth_luma_minus8 == 2)
- pf = V4L2_PIX_FMT_NV12_10_COL128;
- }
+ if (index == 0)
+ pf = V4L2_PIX_FMT_NV12MT_COL128;
+ else if (index == 1)
+ pf = V4L2_PIX_FMT_NV12MT_10_COL128;
+ } else if (index == 0) {
+ if (sps->bit_depth_luma_minus8 == 0)
+ pf = V4L2_PIX_FMT_NV12MT_COL128;
+ else if (sps->bit_depth_luma_minus8 == 2)
+ pf = V4L2_PIX_FMT_NV12MT_10_COL128;
}
return pf;
@@ -509,28 +459,17 @@ static int hevc_d_queue_setup(struct vb2
}
if (*nplanes) {
- if (pix_fmt->pixelformat == V4L2_PIX_FMT_NV12MT_COL128 ||
- pix_fmt->pixelformat == V4L2_PIX_FMT_NV12MT_10_COL128) {
- if (*nplanes != expected_nplanes ||
- sizes[0] < pix_fmt->plane_fmt[0].sizeimage ||
- sizes[1] < pix_fmt->plane_fmt[1].sizeimage)
- return -EINVAL;
- } else {
- if (sizes[0] < pix_fmt->plane_fmt[0].sizeimage)
- return -EINVAL;
- }
+ if (*nplanes != expected_nplanes ||
+ sizes[0] < pix_fmt->plane_fmt[0].sizeimage ||
+ sizes[1] < pix_fmt->plane_fmt[1].sizeimage)
+ return -EINVAL;
} else {
sizes[0] = pix_fmt->plane_fmt[0].sizeimage;
if (V4L2_TYPE_IS_OUTPUT(vq->type)) {
*nplanes = 1;
} else {
- if (pix_fmt->pixelformat == V4L2_PIX_FMT_NV12MT_COL128 ||
- pix_fmt->pixelformat == V4L2_PIX_FMT_NV12MT_10_COL128) {
- sizes[1] = pix_fmt->plane_fmt[1].sizeimage;
- *nplanes = 2;
- } else {
- *nplanes = 1;
- }
+ sizes[1] = pix_fmt->plane_fmt[1].sizeimage;
+ *nplanes = 2;
}
}
@@ -1,51 +0,0 @@
From d57db18eddb0398652b95e7bfbffdef55ce0be71 Mon Sep 17 00:00:00 2001
From: Nicolai Buchwitz <nb@tipi-net.de>
Date: Fri, 3 Jul 2026 13:03:14 +0200
Subject: [PATCH] Revert "net: macb: gate TX stall watchdog on
netif_carrier_ok, use warn_ratelimited"
This reverts commit b2f7eec2bfff1a7f03e9c2ad81cb4d654079ba79.
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
drivers/net/ethernet/cadence/macb_main.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -2077,16 +2077,6 @@ static void macb_tx_stall_watchdog(struc
if (!netif_running(bp->dev))
return;
- /* No carrier => no completion is possible. Skip the stall
- * check (otherwise queue->tx_head can advance from kernel-
- * queued packets between macb_open() and link autoneg
- * completion while tx_tail stays unchanged, tripping a false
- * positive), but keep the watchdog ticking so it picks up
- * once carrier comes up.
- */
- if (!netif_carrier_ok(bp->dev))
- goto reschedule;
-
spin_lock_irqsave(&queue->tx_ptr_lock, flags);
cur_tail = queue->tx_tail;
cur_head = queue->tx_head;
@@ -2096,14 +2086,13 @@ static void macb_tx_stall_watchdog(struc
spin_unlock_irqrestore(&queue->tx_ptr_lock, flags);
if (stalled) {
- pr_warn_ratelimited("%s: TX stall detected on queue %u (tail=%u head=%u); re-kicking TSTART\n",
- netdev_name(bp->dev),
- (unsigned int)(queue - bp->queues),
- cur_tail, cur_head);
+ netdev_warn_once(bp->dev,
+ "TX stall detected on queue %u (tail=%u head=%u); re-kicking TSTART\n",
+ (unsigned int)(queue - bp->queues),
+ cur_tail, cur_head);
macb_tx_restart(queue);
}
-reschedule:
schedule_delayed_work(&queue->tx_stall_watchdog_work,
msecs_to_jiffies(MACB_TX_STALL_INTERVAL_MS));
}
@@ -1,62 +0,0 @@
From 86a1889a96337a1b601e5600f3f85e21d7f13ac9 Mon Sep 17 00:00:00 2001
From: Nicolai Buchwitz <nb@tipi-net.de>
Date: Fri, 3 Jul 2026 13:03:14 +0200
Subject: [PATCH] Revert "net: macb: drop destructive ISR read, use IMR barrier
in macb_tx_poll"
This reverts commit 60fc80b89d134d720fbab7ef504f80a4ae7a998c.
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
drivers/net/ethernet/cadence/macb_main.c | 37 ++++++++++--------------
1 file changed, 15 insertions(+), 22 deletions(-)
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -2004,31 +2004,24 @@ static int macb_tx_poll(struct napi_stru
if (work_done < budget && napi_complete_done(napi, work_done)) {
queue_writel(queue, IER, MACB_BIT(TCOMP));
- /* TCOMP events that fire while masked don't re-fire when
- * IER is re-enabled (HW errata), so check in software.
- * macb_tx_complete_pending() inspects the descriptor at
- * tx_tail; the rmb() in there orders prior CPU writes but
- * does not retire in-flight peripheral DMA writes that
- * may still be racing back to memory on PCIe-attached
- * parts.
+ /* TCOMP events that fire while the interrupt is masked do
+ * not re-fire when IER is re-enabled. Catch this two ways
+ * to avoid losing a wakeup:
*
- * Read a side-effect-free MMIO register (IMR, the
- * read-only mask mirror) to act as a PCIe read barrier
- * for prior peripheral DMA writes. After this read, any
- * in-flight TX_USED descriptor update has retired and
- * macb_tx_complete_pending() will observe it.
+ * (1) Read ISR -- catches completions the hardware flagged
+ * but that we did not see as an interrupt. The MMIO
+ * read doubles as a PCIe read barrier, flushing any
+ * in-flight descriptor TX_USED DMA writes into memory.
+ * (2) macb_tx_complete_pending() inspects the ring after
+ * that flush, catching a descriptor whose TX_USED is
+ * now visible as a result of the barrier.
*
- * Note: an earlier form of this block read ISR directly
- * to also sample a latched TCOMP bit, but that is
- * destructive on silicon where MACB_CAPS_ISR_CLEAR_ON_WRITE
- * is not set (raspberrypi_rp1_config among others): the
- * read clears every set bit, and a masked check silently
- * consumes RCOMP / ROVR / TXUBR bits the IRQ handler is
- * expected to process in one pass. IMR is non-destructive
- * on both read-clear and W1C silicon.
+ * This can race with the interrupt handler taking the same
+ * path if an interrupt fires just after the IER write;
+ * rescheduling NAPI in that case is harmless.
*/
- (void)queue_readl(queue, IMR);
- if (macb_tx_complete_pending(queue)) {
+ if ((queue_readl(queue, ISR) & MACB_BIT(TCOMP)) ||
+ macb_tx_complete_pending(queue)) {
queue_writel(queue, IDR, MACB_BIT(TCOMP));
if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
queue_writel(queue, ISR, MACB_BIT(TCOMP));
@@ -1,136 +0,0 @@
From 7f49766f02bbf12ff6459a775a9ccbb1e2087cc7 Mon Sep 17 00:00:00 2001
From: Nicolai Buchwitz <nb@tipi-net.de>
Date: Fri, 3 Jul 2026 13:03:14 +0200
Subject: [PATCH] Revert "net: macb: add TX stall watchdog as defence-in-depth
safety net"
This reverts commit 79dc190b12f9504d6a1bda1e497f912f24cf54d8.
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
drivers/net/ethernet/cadence/macb.h | 11 ----
drivers/net/ethernet/cadence/macb_main.c | 65 ------------------------
2 files changed, 76 deletions(-)
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -1298,17 +1298,6 @@ struct macb_queue {
struct work_struct tx_error_task;
bool txubr_pending;
bool tx_pending;
-
- /* TX stall watchdog -- see macb_tx_stall_watchdog() in macb_main.c.
- * tx_stall_tail_moved is set by macb_tx_complete() under tx_ptr_lock
- * whenever tx_tail advances, and cleared by the watchdog tick on the
- * same lock. A bool avoids the index-aliasing false-positive that a
- * snapshot-of-tx_tail comparison would have when the ring index space
- * happens to wrap to the same value between two ticks.
- */
- struct delayed_work tx_stall_watchdog_work;
- bool tx_stall_tail_moved;
-
struct napi_struct napi_tx;
dma_addr_t rx_ring_dma;
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -1507,8 +1507,6 @@ static int macb_tx_complete(struct macb_
packets, bytes);
queue->tx_tail = tail;
- if (packets)
- queue->tx_stall_tail_moved = true;
if (__netif_subqueue_stopped(bp->dev, queue_index) &&
CIRC_CNT(queue->tx_head, queue->tx_tail,
bp->tx_ring_size) <= MACB_TX_WAKEUP_THRESH(bp))
@@ -2033,63 +2031,6 @@ static int macb_tx_poll(struct napi_stru
return work_done;
}
-#define MACB_TX_STALL_INTERVAL_MS 1000
-
-/* TX stall watchdog.
- *
- * Defence-in-depth against lost TCOMP interrupts. macb already has a
- * recovery chain (tx_pending -> txubr_pending -> macb_tx_restart())
- * that fires on TCOMP; if TCOMP itself is lost the TX ring stalls
- * silently until something else kicks TSTART. This watchdog runs
- * once per second per queue and calls macb_tx_restart() if the ring
- * is non-empty and tx_tail has not advanced since the previous tick.
- *
- * Movement is tracked via the tx_stall_tail_moved boolean rather
- * than by snapshotting tx_tail. Per-queue ring indices are bounded
- * (and reused), so a snapshot comparison can false-positive when the
- * index happens to land on the same value between two ticks under
- * sustained load. The boolean is set by macb_tx_complete() whenever
- * tx_tail advances and cleared by this watchdog after each tick;
- * both writes are under tx_ptr_lock, so no atomic is required.
- *
- * macb_tx_restart() already checks the hardware's TBQP against the
- * driver's head index before re-asserting TSTART, so on a healthy
- * ring this is a no-op at the hardware level. The watchdog only
- * adds the missing trigger.
- */
-static void macb_tx_stall_watchdog(struct work_struct *work)
-{
- struct macb_queue *queue = container_of(to_delayed_work(work),
- struct macb_queue,
- tx_stall_watchdog_work);
- struct macb *bp = queue->bp;
- unsigned int cur_tail, cur_head;
- bool stalled = false;
- unsigned long flags;
-
- if (!netif_running(bp->dev))
- return;
-
- spin_lock_irqsave(&queue->tx_ptr_lock, flags);
- cur_tail = queue->tx_tail;
- cur_head = queue->tx_head;
- if (cur_head != cur_tail && !queue->tx_stall_tail_moved)
- stalled = true;
- queue->tx_stall_tail_moved = false;
- spin_unlock_irqrestore(&queue->tx_ptr_lock, flags);
-
- if (stalled) {
- netdev_warn_once(bp->dev,
- "TX stall detected on queue %u (tail=%u head=%u); re-kicking TSTART\n",
- (unsigned int)(queue - bp->queues),
- cur_tail, cur_head);
- macb_tx_restart(queue);
- }
-
- schedule_delayed_work(&queue->tx_stall_watchdog_work,
- msecs_to_jiffies(MACB_TX_STALL_INTERVAL_MS));
-}
-
static void macb_hresp_error_task(struct work_struct *work)
{
struct macb *bp = from_work(bp, work, hresp_err_bh_work);
@@ -3379,9 +3320,6 @@ static int macb_open(struct net_device *
for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
napi_enable(&queue->napi_rx);
napi_enable(&queue->napi_tx);
- queue->tx_stall_tail_moved = true;
- schedule_delayed_work(&queue->tx_stall_watchdog_work,
- msecs_to_jiffies(MACB_TX_STALL_INTERVAL_MS));
}
macb_init_hw(bp);
@@ -3428,7 +3366,6 @@ static int macb_close(struct net_device
for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
napi_disable(&queue->napi_rx);
napi_disable(&queue->napi_tx);
- cancel_delayed_work_sync(&queue->tx_stall_watchdog_work);
netdev_tx_reset_queue(netdev_get_tx_queue(dev, q));
}
@@ -5035,8 +4972,6 @@ static int macb_init(struct platform_dev
}
INIT_WORK(&queue->tx_error_task, macb_tx_error_task);
- INIT_DELAYED_WORK(&queue->tx_stall_watchdog_work,
- macb_tx_stall_watchdog);
q++;
}
@@ -1,50 +0,0 @@
From 560624d8e8947ad3bc6c0ade6f655535ab83df71 Mon Sep 17 00:00:00 2001
From: Nicolai Buchwitz <nb@tipi-net.de>
Date: Fri, 3 Jul 2026 13:03:14 +0200
Subject: [PATCH] Revert "net: macb: re-check ISR after IER re-enable in
macb_tx_poll"
This reverts commit ff6914e97386f9a7d37468c79996dc6c34172cfb.
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
drivers/net/ethernet/cadence/macb_main.c | 27 +++++++++---------------
1 file changed, 10 insertions(+), 17 deletions(-)
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -2002,24 +2002,17 @@ static int macb_tx_poll(struct napi_stru
if (work_done < budget && napi_complete_done(napi, work_done)) {
queue_writel(queue, IER, MACB_BIT(TCOMP));
- /* TCOMP events that fire while the interrupt is masked do
- * not re-fire when IER is re-enabled. Catch this two ways
- * to avoid losing a wakeup:
- *
- * (1) Read ISR -- catches completions the hardware flagged
- * but that we did not see as an interrupt. The MMIO
- * read doubles as a PCIe read barrier, flushing any
- * in-flight descriptor TX_USED DMA writes into memory.
- * (2) macb_tx_complete_pending() inspects the ring after
- * that flush, catching a descriptor whose TX_USED is
- * now visible as a result of the barrier.
- *
- * This can race with the interrupt handler taking the same
- * path if an interrupt fires just after the IER write;
- * rescheduling NAPI in that case is harmless.
+ /* Packet completions only seem to propagate to raise
+ * interrupts when interrupts are enabled at the time, so if
+ * packets were sent while interrupts were disabled,
+ * they will not cause another interrupt to be generated when
+ * interrupts are re-enabled.
+ * Check for this case here to avoid losing a wakeup. This can
+ * potentially race with the interrupt handler doing the same
+ * actions if an interrupt is raised just after enabling them,
+ * but this should be harmless.
*/
- if ((queue_readl(queue, ISR) & MACB_BIT(TCOMP)) ||
- macb_tx_complete_pending(queue)) {
+ if (macb_tx_complete_pending(queue)) {
queue_writel(queue, IDR, MACB_BIT(TCOMP));
if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
queue_writel(queue, ISR, MACB_BIT(TCOMP));
@@ -1,147 +0,0 @@
From 32d8cce2dd2094e8bfefa982744695742617f2c2 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Mon, 27 Jul 2026 17:11:29 +0100
Subject: [PATCH] nvme/host/pci: Revert to upstream
---
drivers/nvme/host/pci.c | 98 ---------------------------------------
1 file changed, 98 deletions(-)
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -183,11 +183,9 @@ struct nvme_dev {
/* host memory buffer support: */
u64 host_mem_size;
u32 nr_host_mem_descs;
- u32 nr_sgl_ents;
u32 host_mem_descs_size;
dma_addr_t host_mem_descs_dma;
struct nvme_host_mem_buf_desc *host_mem_descs;
- struct scatterlist *host_mem_sgl;
void **host_mem_desc_bufs;
unsigned int nr_allocated_queues;
unsigned int nr_write_queues;
@@ -2342,13 +2340,6 @@ static int nvme_set_host_mem(struct nvme
return ret;
}
-#if IS_ENABLED(CONFIG_ARM64)
-static void nvme_free_host_mem_multi(struct nvme_dev *dev)
-{
- dma_unmap_sg(dev->dev, dev->host_mem_sgl, dev->nr_host_mem_descs, DMA_FROM_DEVICE);
- sgl_free(dev->host_mem_sgl);
-}
-#else
static void nvme_free_host_mem_multi(struct nvme_dev *dev)
{
int i;
@@ -2365,7 +2356,6 @@ static void nvme_free_host_mem_multi(str
kfree(dev->host_mem_desc_bufs);
dev->host_mem_desc_bufs = NULL;
}
-#endif
static void nvme_free_host_mem(struct nvme_dev *dev)
{
@@ -2410,93 +2400,6 @@ static int nvme_alloc_host_mem_single(st
return 0;
}
-#if IS_ENABLED(CONFIG_ARM64)
-static int nvme_alloc_host_mem_multi(struct nvme_dev *dev, u64 preferred,
- u32 chunk_size)
-{
- struct nvme_host_mem_buf_desc *descs;
- u32 max_entries, len, descs_size;
- dma_addr_t descs_dma;
- struct scatterlist *slist;
- struct page *page;
- int i = 0, mapped_nents;
- u64 size, tmp;
-
- tmp = (preferred + chunk_size - 1);
- do_div(tmp, chunk_size);
- max_entries = tmp;
-
- if (dev->ctrl.hmmaxd && dev->ctrl.hmmaxd < max_entries)
- max_entries = dev->ctrl.hmmaxd;
-
- descs_size = max_entries * sizeof(*descs);
- /*
- * Allocate the descriptor table from coherent memory -
- * usually occupies less than/up to a single page.
- */
- descs = dma_alloc_coherent(dev->dev, descs_size, &descs_dma,
- GFP_KERNEL);
- if (!descs)
- goto out;
-
- slist = kcalloc(max_entries, sizeof(struct scatterlist), GFP_KERNEL);
- if (!slist)
- goto out_free_descs;
-
- sg_init_table(slist, max_entries);
-
- dev_dbg(dev->dev, "Allocating HMB pref = %llu max_entries = %u\n",
- preferred, max_entries);
-
- for (size = 0; size < preferred && i < max_entries; size += len) {
- int order;
-
- len = min_t(u64, chunk_size, preferred - size);
- order = get_order(len);
- page = alloc_pages(GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN, order);
- if (!page)
- break;
- sg_set_page(&slist[i], page, len, 0);
- i++;
- }
- if (size < preferred)
- goto out_free_sgl;
-
- mapped_nents = dma_map_sg(dev->dev, slist, i, DMA_FROM_DEVICE);
- if (mapped_nents <= 0)
- goto out_free_pages;
-
- /* Flush in case the CPU has cached any parts of the DMA buffers */
- dma_sync_sg_for_device(dev->dev, slist, i, DMA_FROM_DEVICE);
-
- i = dev->nr_host_mem_descs = mapped_nents;
-
- while (--i >= 0) {
- descs[i].addr = cpu_to_le64(sg_dma_address(&slist[i]));
- WARN_ON_ONCE(sg_dma_len(&slist[i]) & (NVME_CTRL_PAGE_SIZE - 1));
- descs[i].size = cpu_to_le32(sg_dma_len(&slist[i]) / NVME_CTRL_PAGE_SIZE);
- }
-
- dev->host_mem_size = size;
- dev->host_mem_descs = descs;
- dev->host_mem_descs_dma = descs_dma;
- dev->host_mem_descs_size = descs_size;
- dev->host_mem_sgl = slist;
- return 0;
-
-out_free_pages:
- /* Don't use mapped_nents here as it could be incomplete */
- while (--i >= 0)
- __free_pages(sg_page(&slist[i]), get_order(slist[i].length));
-out_free_sgl:
- kfree(slist);
-out_free_descs:
- dma_free_coherent(dev->dev, descs_size, descs, descs_dma);
-out:
- dev->host_mem_descs = NULL;
- return -ENOMEM;
-}
-#else
static int nvme_alloc_host_mem_multi(struct nvme_dev *dev, u64 preferred,
u32 chunk_size)
{
@@ -2557,7 +2460,6 @@ out:
dev->host_mem_descs = NULL;
return -ENOMEM;
}
-#endif
static int nvme_alloc_host_mem(struct nvme_dev *dev, u64 min, u64 preferred)
{
@@ -1,144 +0,0 @@
From c6759b17fdcca5d08b5ae4c17ca5d1df0316d686 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Mon, 27 Jul 2026 17:10:37 +0100
Subject: [PATCH] mmc/host/sdhci-of-dwcmshc: Revert to upstream
---
drivers/mmc/host/sdhci-of-dwcmshc.c | 62 ++---------------------------
1 file changed, 4 insertions(+), 58 deletions(-)
--- a/drivers/mmc/host/sdhci-of-dwcmshc.c
+++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
@@ -221,7 +221,6 @@ struct rk35xx_priv {
struct dwcmshc_priv {
struct clk *bus_clk;
- struct clk *sdio_clk;
int vendor_specific_area1; /* P_VENDOR_SPECIFIC_AREA1 reg */
int vendor_specific_area2; /* P_VENDOR_SPECIFIC_AREA2 reg */
@@ -303,17 +302,6 @@ static void dwcmshc_reset(struct sdhci_h
sdhci_writel(host, SDHCI_INT_RESPONSE, SDHCI_INT_STATUS);
}
-static void dwcmshc_set_clock(struct sdhci_host *host, unsigned int clock)
-{
- struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
- struct dwcmshc_priv *priv = sdhci_pltfm_priv(pltfm_host);
-
- if (priv->sdio_clk)
- clk_set_rate(priv->sdio_clk, clock);
-
- sdhci_set_clock(host, clock);
-}
-
static unsigned int dwcmshc_get_max_clock(struct sdhci_host *host)
{
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -1133,11 +1121,10 @@ static int sg2042_init(struct device *de
}
static const struct sdhci_ops sdhci_dwcmshc_ops = {
- .set_clock = dwcmshc_set_clock,
+ .set_clock = sdhci_set_clock,
.set_bus_width = sdhci_set_bus_width,
.set_uhs_signaling = dwcmshc_set_uhs_signaling,
.get_max_clock = dwcmshc_get_max_clock,
- .get_timeout_clock = sdhci_pltfm_clk_get_timeout_clock,
.reset = dwcmshc_reset,
.adma_write_desc = dwcmshc_adma_write_desc,
.irq = dwcmshc_cqe_irq_handler,
@@ -1210,10 +1197,8 @@ static const struct sdhci_ops sdhci_dwcm
static const struct dwcmshc_pltfm_data sdhci_dwcmshc_pdata = {
.pdata = {
.ops = &sdhci_dwcmshc_ops,
- .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
- SDHCI_QUIRK_BROKEN_CARD_DETECTION,
- .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
- SDHCI_QUIRK2_BROKEN_HS200,
+ .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
+ .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
},
};
@@ -1228,28 +1213,13 @@ static const struct dwcmshc_pltfm_data s
};
#endif
-static const struct dwcmshc_pltfm_data sdhci_dwcmshc_rp1_pdata = {
- .pdata = {
- .ops = &sdhci_dwcmshc_ops,
- .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
- SDHCI_QUIRK_BROKEN_CARD_DETECTION,
- .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
- SDHCI_QUIRK2_BROKEN_HS200 |
- SDHCI_QUIRK2_SPURIOUS_INT_RESP,
- }
-};
-
static const struct dwcmshc_pltfm_data sdhci_dwcmshc_rk35xx_pdata = {
.pdata = {
.ops = &sdhci_dwcmshc_rk35xx_ops,
.quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
- SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN |
- SDHCI_QUIRK2_NO_SDR50 |
- SDHCI_QUIRK2_NO_SDR104 |
- SDHCI_QUIRK2_NO_SDR25,
-
+ SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN,
},
.init = dwcmshc_rk35xx_init,
.postinit = dwcmshc_rk35xx_postinit,
@@ -1362,10 +1332,6 @@ dsbl_cqe_caps:
static const struct of_device_id sdhci_dwcmshc_dt_ids[] = {
{
- .compatible = "raspberrypi,rp1-dwcmshc",
- .data = &sdhci_dwcmshc_rp1_pdata,
- },
- {
.compatible = "rockchip,rk3588-dwcmshc",
.data = &sdhci_dwcmshc_rk35xx_pdata,
},
@@ -1455,37 +1421,15 @@ static int dwcmshc_probe(struct platform
return err;
priv->bus_clk = devm_clk_get(dev, "bus");
- if (!IS_ERR(priv->bus_clk)) {
- err = clk_prepare_enable(priv->bus_clk);
- if (err)
- goto err_clk;
- }
-
- pltfm_host->timeout_clk = devm_clk_get(dev, "timeout");
- if (!IS_ERR(pltfm_host->timeout_clk))
- err = clk_prepare_enable(pltfm_host->timeout_clk);
- if (err)
- goto err_bus_clk;
-
- priv->sdio_clk = devm_clk_get_optional(&pdev->dev, "sdio");
+ if (!IS_ERR(priv->bus_clk))
+ clk_prepare_enable(priv->bus_clk);
}
- pltfm_host->timeout_clk = devm_clk_get(&pdev->dev, "timeout");
- if (IS_ERR(pltfm_host->timeout_clk)) {
- err = PTR_ERR(pltfm_host->timeout_clk);
- dev_err(&pdev->dev, "failed to get timeout clk: %d\n", err);
- goto err_bus_clk;
- }
- err = clk_prepare_enable(pltfm_host->timeout_clk);
- if (err)
- goto err_bus_clk;
-
err = mmc_of_parse(host->mmc);
if (err)
goto err_timeout_clk;
sdhci_get_of_property(pdev);
- sdhci_enable_v4_mode(host);
priv->vendor_specific_area1 =
sdhci_readl(host, DWCMSHC_P_VENDOR_AREA1) & DWCMSHC_AREA1_MASK;
@@ -1,148 +0,0 @@
From 2cb0c4b8f629710c05ed47fcce8c3f6841240c47 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Mon, 27 Jul 2026 17:12:25 +0100
Subject: [PATCH] Revert "nvme/host/pci: Revert to upstream"
This reverts commit 7838cff31a7091c0a9c6b35ca4a961cace361c8b.
---
drivers/nvme/host/pci.c | 98 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 98 insertions(+)
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -183,9 +183,11 @@ struct nvme_dev {
/* host memory buffer support: */
u64 host_mem_size;
u32 nr_host_mem_descs;
+ u32 nr_sgl_ents;
u32 host_mem_descs_size;
dma_addr_t host_mem_descs_dma;
struct nvme_host_mem_buf_desc *host_mem_descs;
+ struct scatterlist *host_mem_sgl;
void **host_mem_desc_bufs;
unsigned int nr_allocated_queues;
unsigned int nr_write_queues;
@@ -2340,6 +2342,13 @@ static int nvme_set_host_mem(struct nvme
return ret;
}
+#if IS_ENABLED(CONFIG_ARM64)
+static void nvme_free_host_mem_multi(struct nvme_dev *dev)
+{
+ dma_unmap_sg(dev->dev, dev->host_mem_sgl, dev->nr_host_mem_descs, DMA_FROM_DEVICE);
+ sgl_free(dev->host_mem_sgl);
+}
+#else
static void nvme_free_host_mem_multi(struct nvme_dev *dev)
{
int i;
@@ -2356,6 +2365,7 @@ static void nvme_free_host_mem_multi(str
kfree(dev->host_mem_desc_bufs);
dev->host_mem_desc_bufs = NULL;
}
+#endif
static void nvme_free_host_mem(struct nvme_dev *dev)
{
@@ -2400,6 +2410,93 @@ static int nvme_alloc_host_mem_single(st
return 0;
}
+#if IS_ENABLED(CONFIG_ARM64)
+static int nvme_alloc_host_mem_multi(struct nvme_dev *dev, u64 preferred,
+ u32 chunk_size)
+{
+ struct nvme_host_mem_buf_desc *descs;
+ u32 max_entries, len, descs_size;
+ dma_addr_t descs_dma;
+ struct scatterlist *slist;
+ struct page *page;
+ int i = 0, mapped_nents;
+ u64 size, tmp;
+
+ tmp = (preferred + chunk_size - 1);
+ do_div(tmp, chunk_size);
+ max_entries = tmp;
+
+ if (dev->ctrl.hmmaxd && dev->ctrl.hmmaxd < max_entries)
+ max_entries = dev->ctrl.hmmaxd;
+
+ descs_size = max_entries * sizeof(*descs);
+ /*
+ * Allocate the descriptor table from coherent memory -
+ * usually occupies less than/up to a single page.
+ */
+ descs = dma_alloc_coherent(dev->dev, descs_size, &descs_dma,
+ GFP_KERNEL);
+ if (!descs)
+ goto out;
+
+ slist = kcalloc(max_entries, sizeof(struct scatterlist), GFP_KERNEL);
+ if (!slist)
+ goto out_free_descs;
+
+ sg_init_table(slist, max_entries);
+
+ dev_dbg(dev->dev, "Allocating HMB pref = %llu max_entries = %u\n",
+ preferred, max_entries);
+
+ for (size = 0; size < preferred && i < max_entries; size += len) {
+ int order;
+
+ len = min_t(u64, chunk_size, preferred - size);
+ order = get_order(len);
+ page = alloc_pages(GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN, order);
+ if (!page)
+ break;
+ sg_set_page(&slist[i], page, len, 0);
+ i++;
+ }
+ if (size < preferred)
+ goto out_free_sgl;
+
+ mapped_nents = dma_map_sg(dev->dev, slist, i, DMA_FROM_DEVICE);
+ if (mapped_nents <= 0)
+ goto out_free_pages;
+
+ /* Flush in case the CPU has cached any parts of the DMA buffers */
+ dma_sync_sg_for_device(dev->dev, slist, i, DMA_FROM_DEVICE);
+
+ i = dev->nr_host_mem_descs = mapped_nents;
+
+ while (--i >= 0) {
+ descs[i].addr = cpu_to_le64(sg_dma_address(&slist[i]));
+ WARN_ON_ONCE(sg_dma_len(&slist[i]) & (NVME_CTRL_PAGE_SIZE - 1));
+ descs[i].size = cpu_to_le32(sg_dma_len(&slist[i]) / NVME_CTRL_PAGE_SIZE);
+ }
+
+ dev->host_mem_size = size;
+ dev->host_mem_descs = descs;
+ dev->host_mem_descs_dma = descs_dma;
+ dev->host_mem_descs_size = descs_size;
+ dev->host_mem_sgl = slist;
+ return 0;
+
+out_free_pages:
+ /* Don't use mapped_nents here as it could be incomplete */
+ while (--i >= 0)
+ __free_pages(sg_page(&slist[i]), get_order(slist[i].length));
+out_free_sgl:
+ kfree(slist);
+out_free_descs:
+ dma_free_coherent(dev->dev, descs_size, descs, descs_dma);
+out:
+ dev->host_mem_descs = NULL;
+ return -ENOMEM;
+}
+#else
static int nvme_alloc_host_mem_multi(struct nvme_dev *dev, u64 preferred,
u32 chunk_size)
{
@@ -2460,6 +2557,7 @@ out:
dev->host_mem_descs = NULL;
return -ENOMEM;
}
+#endif
static int nvme_alloc_host_mem(struct nvme_dev *dev, u64 min, u64 preferred)
{
@@ -1,136 +0,0 @@
From 53a153146333c85f5f1ffb67578c293198fdf771 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Mon, 27 Jul 2026 17:13:42 +0100
Subject: [PATCH] Revert "mmc/host/sdhci-of-dwcmshc: Revert to upstream"
This reverts commit 861299359645d8e26a526db8de9ce3dcd904f5a8.
---
drivers/mmc/host/sdhci-of-dwcmshc.c | 58 ++++++++++++++++++++++++++---
1 file changed, 52 insertions(+), 6 deletions(-)
--- a/drivers/mmc/host/sdhci-of-dwcmshc.c
+++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
@@ -221,6 +221,7 @@ struct rk35xx_priv {
struct dwcmshc_priv {
struct clk *bus_clk;
+ struct clk *sdio_clk;
int vendor_specific_area1; /* P_VENDOR_SPECIFIC_AREA1 reg */
int vendor_specific_area2; /* P_VENDOR_SPECIFIC_AREA2 reg */
@@ -302,6 +303,17 @@ static void dwcmshc_reset(struct sdhci_h
sdhci_writel(host, SDHCI_INT_RESPONSE, SDHCI_INT_STATUS);
}
+static void dwcmshc_set_clock(struct sdhci_host *host, unsigned int clock)
+{
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+ struct dwcmshc_priv *priv = sdhci_pltfm_priv(pltfm_host);
+
+ if (priv->sdio_clk)
+ clk_set_rate(priv->sdio_clk, clock);
+
+ sdhci_set_clock(host, clock);
+}
+
static unsigned int dwcmshc_get_max_clock(struct sdhci_host *host)
{
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -1121,10 +1133,11 @@ static int sg2042_init(struct device *de
}
static const struct sdhci_ops sdhci_dwcmshc_ops = {
- .set_clock = sdhci_set_clock,
+ .set_clock = dwcmshc_set_clock,
.set_bus_width = sdhci_set_bus_width,
.set_uhs_signaling = dwcmshc_set_uhs_signaling,
.get_max_clock = dwcmshc_get_max_clock,
+ .get_timeout_clock = sdhci_pltfm_clk_get_timeout_clock,
.reset = dwcmshc_reset,
.adma_write_desc = dwcmshc_adma_write_desc,
.irq = dwcmshc_cqe_irq_handler,
@@ -1197,8 +1210,10 @@ static const struct sdhci_ops sdhci_dwcm
static const struct dwcmshc_pltfm_data sdhci_dwcmshc_pdata = {
.pdata = {
.ops = &sdhci_dwcmshc_ops,
- .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
- .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
+ .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
+ SDHCI_QUIRK_BROKEN_CARD_DETECTION,
+ .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
+ SDHCI_QUIRK2_BROKEN_HS200,
},
};
@@ -1213,13 +1228,28 @@ static const struct dwcmshc_pltfm_data s
};
#endif
+static const struct dwcmshc_pltfm_data sdhci_dwcmshc_rp1_pdata = {
+ .pdata = {
+ .ops = &sdhci_dwcmshc_ops,
+ .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
+ SDHCI_QUIRK_BROKEN_CARD_DETECTION,
+ .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
+ SDHCI_QUIRK2_BROKEN_HS200 |
+ SDHCI_QUIRK2_SPURIOUS_INT_RESP,
+ }
+};
+
static const struct dwcmshc_pltfm_data sdhci_dwcmshc_rk35xx_pdata = {
.pdata = {
.ops = &sdhci_dwcmshc_rk35xx_ops,
.quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
- SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN,
+ SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN |
+ SDHCI_QUIRK2_NO_SDR50 |
+ SDHCI_QUIRK2_NO_SDR104 |
+ SDHCI_QUIRK2_NO_SDR25,
+
},
.init = dwcmshc_rk35xx_init,
.postinit = dwcmshc_rk35xx_postinit,
@@ -1332,6 +1362,10 @@ dsbl_cqe_caps:
static const struct of_device_id sdhci_dwcmshc_dt_ids[] = {
{
+ .compatible = "raspberrypi,rp1-dwcmshc",
+ .data = &sdhci_dwcmshc_rp1_pdata,
+ },
+ {
.compatible = "rockchip,rk3588-dwcmshc",
.data = &sdhci_dwcmshc_rk35xx_pdata,
},
@@ -1421,8 +1455,20 @@ static int dwcmshc_probe(struct platform
return err;
priv->bus_clk = devm_clk_get(dev, "bus");
- if (!IS_ERR(priv->bus_clk))
- clk_prepare_enable(priv->bus_clk);
+ if (!IS_ERR(priv->bus_clk)) {
+ err = clk_prepare_enable(priv->bus_clk);
+ if (err)
+ goto err_clk;
+ }
+
+ pltfm_host->timeout_clk = devm_clk_get(dev, "timeout");
+ if (!IS_ERR(pltfm_host->timeout_clk)) {
+ err = clk_prepare_enable(pltfm_host->timeout_clk);
+ if (err)
+ goto err_bus_clk;
+ }
+
+ priv->sdio_clk = devm_clk_get_optional(&pdev->dev, "sdio");
}
err = mmc_of_parse(host->mmc);
@@ -1430,6 +1476,7 @@ static int dwcmshc_probe(struct platform
goto err_timeout_clk;
sdhci_get_of_property(pdev);
+ sdhci_enable_v4_mode(host);
priv->vendor_specific_area1 =
sdhci_readl(host, DWCMSHC_P_VENDOR_AREA1) & DWCMSHC_AREA1_MASK;
@@ -1,236 +0,0 @@
From 5d31114d5994a1254c0ac673b8a1050df88e6def Mon Sep 17 00:00:00 2001
From: Goodwill <646689853@qq.com>
Date: Thu, 27 Aug 2026 01:24:36 +0800
Subject: [PATCH] drm/panel: waveshare: Add automatic panel detection support
Add support for Waveshare automatic detection DSI panels which
identify themselves at runtime via I2C registers. The driver reads
screen type, rotation and refresh rate from registers 0xd0-0xd3
to select the appropriate display mode and DSI lane configuration.
Supported configurations include 1200x1920 and 1920x1200 panels
at both 30fps (2 lanes) and 60fps (4 lanes) refresh rates.
Signed-off-by: Goodwill <646689853@qq.com>
---
drivers/gpu/drm/panel/panel-waveshare-dsi.c | 154 +++++++++++++++++++-
1 file changed, 148 insertions(+), 6 deletions(-)
--- a/drivers/gpu/drm/panel/panel-waveshare-dsi.c
+++ b/drivers/gpu/drm/panel/panel-waveshare-dsi.c
@@ -30,6 +30,7 @@ struct ws_panel {
struct i2c_client *i2c;
const struct drm_display_mode *mode;
enum drm_panel_orientation orientation;
+ int lanes;
};
struct ws_panel_data {
@@ -345,6 +346,63 @@ static const struct ws_panel_data ws_pan
.mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
};
+/* 10.1inch DSI LCD (E)
+ * https://www.waveshare.com/10.1inch-dsi-lcd-e.htm
+ */
+static const struct drm_display_mode ws_panel_1200x1920_60fps_mode = {
+ .clock = 166666,
+ .hdisplay = 1200,
+ .hsync_start = 1200 + 28,
+ .hsync_end = 1200 + 28 + 10,
+ .htotal = 1200 + 28 + 10 + 30,
+ .vdisplay = 1920,
+ .vsync_start = 1920 + 238,
+ .vsync_end = 1920 + 238 + 4,
+ .vtotal = 1920 + 238 + 4 + 28,
+};
+
+static const struct drm_display_mode ws_panel_1200x1920_30fps_mode = {
+ .clock = 83333,
+ .hdisplay = 1200,
+ .hsync_start = 1200 + 28,
+ .hsync_end = 1200 + 28 + 10,
+ .htotal = 1200 + 28 + 10 + 30,
+ .vdisplay = 1920,
+ .vsync_start = 1920 + 238,
+ .vsync_end = 1920 + 238 + 4,
+ .vtotal = 1920 + 238 + 4 + 28,
+};
+
+static const struct drm_display_mode ws_panel_1920x1200_60fps_mode = {
+ .clock = 166666,
+ .hdisplay = 1920,
+ .hsync_start = 1920 + 238,
+ .hsync_end = 1920 + 238 + 4,
+ .htotal = 1920 + 238 + 4 + 28,
+ .vdisplay = 1200,
+ .vsync_start = 1200 + 28,
+ .vsync_end = 1200 + 28 + 10,
+ .vtotal = 1200 + 28 + 10 + 30,
+};
+
+static const struct drm_display_mode ws_panel_1920x1200_30fps_mode = {
+ .clock = 83333,
+ .hdisplay = 1920,
+ .hsync_start = 1920 + 238,
+ .hsync_end = 1920 + 238 + 4,
+ .htotal = 1920 + 238 + 4 + 28,
+ .vdisplay = 1200,
+ .vsync_start = 1200 + 28,
+ .vsync_end = 1200 + 28 + 10,
+ .vtotal = 1200 + 28 + 10 + 30,
+};
+
+static const struct ws_panel_data ws_panel_automatic_data = {
+ .mode = NULL,
+ .lanes = 0,
+ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
+};
+
static struct ws_panel *panel_to_ts(struct drm_panel *panel)
{
return container_of(panel, struct ws_panel, base);
@@ -359,6 +417,68 @@ static void ws_panel_i2c_write(struct ws
dev_err(&ts->i2c->dev, "I2C write failed: %d\n", ret);
}
+static int ws_panel_i2c_read(struct ws_panel *ts, u8 reg)
+{
+ int ret;
+
+ ret = i2c_smbus_read_byte_data(ts->i2c, reg);
+ if (ret < 0)
+ dev_err(&ts->i2c->dev, "read reg 0x%02x failed %d\n", reg, ret);
+ return ret;
+}
+
+static int ws_panel_auto_detect(struct ws_panel *ts)
+{
+ int screen_type;
+ int rotate;
+ int fps;
+
+ fps = ws_panel_i2c_read(ts, 0xd0);
+ if (fps < 0)
+ return fps;
+
+ rotate = ws_panel_i2c_read(ts, 0xd1);
+ if (rotate < 0)
+ return rotate;
+
+ screen_type = ws_panel_i2c_read(ts, 0xd3);
+ if (screen_type < 0)
+ return screen_type;
+
+ dev_info(&ts->i2c->dev,
+ "automatic panel detect screen_type=0x%x rotate=0x%x fps=0x%x\n",
+ screen_type, rotate, fps);
+
+ if (screen_type == 0x01) {
+ switch (rotate) {
+ case 0:
+ case 2:
+ dev_info(&ts->i2c->dev, "select 1200x1920 panel\n");
+ ts->mode = fps == 60 ?
+ &ws_panel_1200x1920_60fps_mode :
+ &ws_panel_1200x1920_30fps_mode;
+ break;
+ case 1:
+ case 3:
+ dev_info(&ts->i2c->dev, "select 1920x1200 panel\n");
+ ts->mode = fps == 60 ?
+ &ws_panel_1920x1200_60fps_mode :
+ &ws_panel_1920x1200_30fps_mode;
+ break;
+ default:
+ dev_err(&ts->i2c->dev, "unknown rotate value %d\n", rotate);
+ return -EINVAL;
+ }
+ if (fps == 60)
+ ts->lanes = 4;
+ else
+ ts->lanes = 2;
+ return 0;
+ }
+ dev_err(&ts->i2c->dev, "unsupported panel D3=0x%x\n", screen_type);
+ return -EINVAL;
+}
+
static int ws_panel_disable(struct drm_panel *panel)
{
struct ws_panel *ts = panel_to_ts(panel);
@@ -492,13 +612,23 @@ static int ws_panel_probe(struct i2c_cli
if (!_ws_panel_data)
return -EINVAL;
- ts->mode = _ws_panel_data->mode;
- if (!ts->mode)
- return -EINVAL;
-
+ ts->i2c = i2c;
i2c_set_clientdata(i2c, ts);
+ ts->lanes = _ws_panel_data->lanes;
- ts->i2c = i2c;
+ /* For automatic detection panels, mode is NULL - detect via I2C */
+ if (!_ws_panel_data->mode) {
+ ret = ws_panel_auto_detect(ts);
+ if (ret) {
+ dev_err(dev, "panel auto detect failed\n");
+ return ret;
+ }
+ } else {
+ ts->mode = _ws_panel_data->mode;
+ }
+
+ if (!ts->mode)
+ return -EINVAL;
ws_panel_i2c_write(ts, 0xc0, 0x01);
ws_panel_i2c_write(ts, 0xc2, 0x01);
@@ -556,7 +686,7 @@ static int ws_panel_probe(struct i2c_cli
ts->dsi->mode_flags = _ws_panel_data->mode_flags;
ts->dsi->format = MIPI_DSI_FMT_RGB888;
- ts->dsi->lanes = _ws_panel_data->lanes;
+ ts->dsi->lanes = ts->lanes;
ret = devm_mipi_dsi_attach(dev, ts->dsi);
@@ -570,10 +700,18 @@ error:
return -ENODEV;
}
+static void ws_panel_reset(struct drm_panel *panel)
+{
+ struct ws_panel *ts = panel_to_ts(panel);
+
+ ws_panel_i2c_write(ts, 0xd2, 0x5a);
+}
+
static void ws_panel_remove(struct i2c_client *i2c)
{
struct ws_panel *ts = i2c_get_clientdata(i2c);
+ ws_panel_reset(&ts->base);
ws_panel_disable(&ts->base);
drm_panel_remove(&ts->base);
@@ -583,6 +721,7 @@ static void ws_panel_shutdown(struct i2c
{
struct ws_panel *ts = i2c_get_clientdata(i2c);
+ ws_panel_reset(&ts->base);
ws_panel_disable(&ts->base);
}
@@ -636,6 +775,9 @@ static const struct of_device_id ws_pane
.compatible = "waveshare,7.0inch-h-panel",
.data = &ws_panel_7_0_h_data,
}, {
+ .compatible = "waveshare,automatic-detection-panel",
+ .data = &ws_panel_automatic_data,
+ }, {
/* sentinel */
}
};
@@ -1,40 +0,0 @@
From fd7924c3ab70ec7ac2a7bfd808d505c118e7e3b4 Mon Sep 17 00:00:00 2001
From: Goodwill <646689853@qq.com>
Date: Thu, 27 Aug 2026 01:24:45 +0800
Subject: [PATCH] ARM: dts: overlays: waveshare-dsi: Add auto_detect panel
option
Add the auto_detect overlay parameter to select the automatic detection
panel compatible string (waveshare,automatic-detection-panel). This
enables runtime panel detection via I2C for Waveshare DSI displays
that support automatic identification.
Signed-off-by: Goodwill <646689853@qq.com>
---
arch/arm/boot/dts/overlays/README | 2 ++
.../boot/dts/overlays/vc4-kms-dsi-waveshare-panel-overlay.dts | 3 +++
2 files changed, 5 insertions(+)
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -6195,6 +6195,8 @@ Params: 2_8_inch 2.8" 480
11_9_inch 11.9" 320x1480
13_3_inch_4lane 13.3" 1920x1080 4lane
13_3_inch_2lane 13.3" 1920x1080 2lane
+ auto_detect Automatic panel detection (1200x1920 or
+ 1920x1200 at 30fps/60fps)
i2c1 Use i2c-1 with jumper wires from GPIOs 2&3
disable_touch Disable the touch controller
rotation Set the panel orientation property
--- a/arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-panel-overlay.dts
+++ b/arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-panel-overlay.dts
@@ -136,6 +136,9 @@
7_0_inchH = <&panel>, "compatible=waveshare,7.0inch-h-panel",
<&touch>, "touchscreen-swapped-x-y?",
<&touch>, "touchscreen-inverted-x?";
+ auto_detect = <&panel>, "compatible=waveshare,automatic-detection-panel",
+ <&touch>, "touchscreen-swapped-x-y?",
+ <&touch>, "touchscreen-inverted-x?";
i2c1 = <&i2c_frag>, "target:0=",<&i2c1>,
<0>, "-3-4+5";
disable_touch = <&touch>, "status=disabled";
@@ -0,0 +1,80 @@
From c1a5fac58f028b585ae79bcc2371d0f1f9441bd9 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Mon, 21 Sep 2026 15:34:29 +0100
Subject: [PATCH] drm/vc4: Wire up the panic scanout buffer on the primary
plane
vc4 provided no get_scanout_buffer(), so drm_panic_register() skipped
every plane and nothing was drawn when the kernel panicked - and with
CONFIG_DRM_PANIC_DEBUG the dri/N/drm_panic_plane_x files never appeared
either.
Framebuffers are drm_gem_dma objects, so the generic DMA helper does the
job: it hands the panic handler the already mapped CPU address, without
vmapping in panic context. Imported dmabufs and non-linear modifiers are
rejected by the helper, so a compositor's buffers are still skipped, but
the fbdev console - the case that matters when the machine dies - works.
Only the primary planes get it, as every other user of
drm_fb_dma_get_scanout_buffer() does, which costs a second copy of the
helper funcs per generation.
Tested on a Pi 500: one plane per CRTC registers, and a panic (as well
as the debugfs trigger) paints the panic screen, including the full
backtrace with drm.panic_screen=kmsg.
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
---
drivers/gpu/drm/vc4/vc4_plane.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -2685,6 +2685,16 @@ static const struct drm_plane_helper_fun
.atomic_async_update = vc4_plane_atomic_async_update,
};
+static const struct drm_plane_helper_funcs vc4_primary_plane_helper_funcs = {
+ .atomic_check = vc4_plane_atomic_check,
+ .atomic_update = vc4_plane_atomic_update,
+ .prepare_fb = vc4_prepare_fb,
+ .cleanup_fb = vc4_cleanup_fb,
+ .atomic_async_check = vc4_plane_atomic_async_check,
+ .atomic_async_update = vc4_plane_atomic_async_update,
+ .get_scanout_buffer = drm_fb_dma_get_scanout_buffer,
+};
+
static const struct drm_plane_helper_funcs vc5_plane_helper_funcs = {
.atomic_check = vc4_plane_atomic_check,
.atomic_update = vc4_plane_atomic_update,
@@ -2692,6 +2702,14 @@ static const struct drm_plane_helper_fun
.atomic_async_update = vc4_plane_atomic_async_update,
};
+static const struct drm_plane_helper_funcs vc5_primary_plane_helper_funcs = {
+ .atomic_check = vc4_plane_atomic_check,
+ .atomic_update = vc4_plane_atomic_update,
+ .atomic_async_check = vc4_plane_atomic_async_check,
+ .atomic_async_update = vc4_plane_atomic_async_update,
+ .get_scanout_buffer = drm_fb_dma_get_scanout_buffer,
+};
+
static bool vc4_format_mod_supported(struct drm_plane *plane,
uint32_t format,
uint64_t modifier)
@@ -2810,9 +2828,13 @@ struct drm_plane *vc4_plane_init(struct
plane = &vc4_plane->base;
if (vc4->gen >= VC4_GEN_5)
- drm_plane_helper_add(plane, &vc5_plane_helper_funcs);
+ drm_plane_helper_add(plane, type == DRM_PLANE_TYPE_PRIMARY ?
+ &vc5_primary_plane_helper_funcs :
+ &vc5_plane_helper_funcs);
else
- drm_plane_helper_add(plane, &vc4_plane_helper_funcs);
+ drm_plane_helper_add(plane, type == DRM_PLANE_TYPE_PRIMARY ?
+ &vc4_primary_plane_helper_funcs :
+ &vc4_plane_helper_funcs);
drm_plane_create_alpha_property(plane);
drm_plane_create_blend_mode_property(plane,
@@ -0,0 +1,73 @@
From c2376b915276625f6119799ac64aa17ba161b367 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Mon, 3 Aug 2026 12:12:00 +0100
Subject: [PATCH] ASoC: iqaudio-codec: Add mic-only start-up delay
Prior to this change, every stream start was subject to a 1 second delay
to allow for the microphone circuitry to settle, even if a microphone is
not being used. This blocking delay, as well as being pointless for non-
capture applications, can be problematic for synchronous use-cases such
as alsa_recover() in PipeWire.
Add a dedicated widget to handle the microphone delay, and link it into
the microphone routes.
See: https://github.com/raspberrypi/linux/issues/7525
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
sound/soc/bcm/iqaudio-codec.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
--- a/sound/soc/bcm/iqaudio-codec.c
+++ b/sound/soc/bcm/iqaudio-codec.c
@@ -59,20 +59,15 @@ static int snd_rpi_iqaudio_pll_control(s
return ret;
}
-static int snd_rpi_iqaudio_post_dapm_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol,
- int event)
+static int snd_rpi_iqaudio_mic_bias_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol,
+ int event)
{
- switch (event) {
- case SND_SOC_DAPM_POST_PMU:
- /* Delay for mic bias ramp */
- msleep(1000);
- break;
- default:
- break;
- }
+ if (event == SND_SOC_DAPM_POST_PMU)
+ /* Delay for mic bias ramp */
+ msleep(1000);
- return 0;
+ return 0;
}
static const struct snd_kcontrol_new dapm_controls[] = {
@@ -90,7 +85,9 @@ static const struct snd_soc_dapm_widget
SND_SOC_DAPM_SUPPLY("PLL Control", SND_SOC_NOPM, 0, 0,
snd_rpi_iqaudio_pll_control,
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
- SND_SOC_DAPM_POST("Post Power Up Event", snd_rpi_iqaudio_post_dapm_event),
+ SND_SOC_DAPM_SUPPLY("Mic Bias Ramp", SND_SOC_NOPM, 0, 0,
+ snd_rpi_iqaudio_mic_bias_event,
+ SND_SOC_DAPM_POST_PMU),
};
static const struct snd_soc_dapm_route audio_map[] = {
@@ -105,8 +102,10 @@ static const struct snd_soc_dapm_route a
/* Assume Mic1 is linked to Headset and Mic2 to on-board mic */
{"MIC1", NULL, "MIC Jack"},
{"MIC Jack", NULL, "PLL Control"},
+ {"MIC Jack", NULL, "Mic Bias Ramp"},
{"MIC2", NULL, "Onboard MIC"},
{"Onboard MIC", NULL, "PLL Control"},
+ {"Onboard MIC", NULL, "Mic Bias Ramp"},
};
/* machine stream operations */
@@ -0,0 +1,390 @@
From 113a659b46622e0c099885b98746b1fe5ebc68e7 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Mon, 14 Sep 2026 16:30:40 +0100
Subject: [PATCH] drm/vc4: Don't assume 4:2:0 subsampling in the scaler phase
calculation
vc4_write_ppf() treated anything on channel 1 as being subsampled 2x in
the axis being programmed: it halved the source coordinate, applied a 1/4
chroma-pixel centring offset instead of 1/2, and scaled the chroma siting
by 17 bits rather than 16. That only holds for 4:2:0.
For 4:2:2 the chroma plane is full height - src_h[1] == src_h[0], and the
vertical PPF is force-enabled so that unity-scaled planes render at all -
and for 4:4:4 the chroma plane is full resolution in both axes. In those
cases the chroma phase came out at half the luma phase, displacing chroma
by a quarter of a pixel against the luma.
Take the subsampling for the axis being programmed from the format and
derive the phase from it, rather than from the channel number. The
calculation is now done in luma pixels throughout and converted to the
channel's pixels at the end, which for 4:2:0 gives a bit-identical phase
to before.
Fixes: ac69c01fa825 ("drm/vc4: plane: Handle fractional coordinates using the phase field")
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
---
drivers/gpu/drm/vc4/vc4_plane.c | 73 +++++-----------
.../raspberrypi/hevc_dec/hevc_d_h265.c | 83 ++++++-------------
.../media/platform/raspberrypi/rp1_cfe/cfe.c | 25 ------
3 files changed, 50 insertions(+), 131 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -688,36 +688,18 @@ static void vc4_write_tpz(struct vc4_pla
#define PHASE_BITS 6
static void vc4_write_ppf(struct vc4_plane_state *vc4_state, u32 src, u32 dst,
- u32 xy, int channel, int chroma_offset,
- bool no_interpolate)
+ u32 xy, int channel, unsigned int subsample,
+ int chroma_offset, bool no_interpolate)
{
struct vc4_dev *vc4 = to_vc4_dev(vc4_state->base.plane->dev);
+ unsigned int sub_shift = subsample == 2 ? 1 : 0;
u32 scale = src / dst;
s32 offset, offset2;
s32 phase;
WARN_ON_ONCE(vc4->gen > VC4_GEN_6_D);
- /*
- * Start the phase at 1/2 pixel from the 1st pixel at src_x.
- * 1/4 pixel for YUV, plus the offset for chroma siting.
- */
- if (channel) {
- /*
- * The phase is relative to scale_src->x, so shift it for
- * display list's x value
- */
- offset = (xy & 0x1ffff) >> (16 - PHASE_BITS) >> 1;
- offset -= chroma_offset >> (17 - PHASE_BITS);
- offset += -(1 << PHASE_BITS >> 2);
- } else {
- /*
- * The phase is relative to scale_src->x, so shift it for
- * display list's x value
- */
- offset = (xy & 0xffff) >> (16 - PHASE_BITS);
- offset += -(1 << PHASE_BITS >> 1);
-
+ if (!channel) {
/*
* This is a kludge to make sure the scaling factors are
* consistent with YUV's luma scaling. We lose 1-bit precision
@@ -727,6 +709,18 @@ static void vc4_write_ppf(struct vc4_pla
}
/*
+ * Start the phase at 1/2 pixel from the 1st pixel at src_x, less the
+ * chroma siting offset. The phase is relative to scale_src->x, so
+ * shift it for the display list's x value. Everything is computed in
+ * luma pixels and then converted to this channel's pixels, so that a
+ * subsampled chroma channel lands on the same position as the luma.
+ */
+ offset = (xy & ((0x10000 << sub_shift) - 1)) >> (16 - PHASE_BITS);
+ offset -= chroma_offset >> (16 - PHASE_BITS);
+ offset -= 1 << PHASE_BITS >> 1;
+ offset >>= sub_shift;
+
+ /*
* There may be a also small error introduced by precision of scale.
* Add half of that as a compromise
*/
@@ -930,7 +924,10 @@ static void vc4_write_scaling_parameters
{
struct vc4_dev *vc4 = to_vc4_dev(state->plane->dev);
struct vc4_plane_state *vc4_state = to_vc4_plane_state(state);
+ const struct drm_format_info *info = state->fb->format;
bool no_interpolate = state->scaling_filter == DRM_SCALING_FILTER_NEAREST_NEIGHBOR;
+ unsigned int hsub = channel ? info->hsub : 1;
+ unsigned int vsub = channel ? info->vsub : 1;
if (vc4_state->is_yuv444_unity)
no_interpolate = 1;
@@ -941,16 +938,14 @@ static void vc4_write_scaling_parameters
if (vc4_state->x_scaling[channel] == VC4_SCALING_PPF) {
vc4_write_ppf(vc4_state, vc4_state->src_w[channel],
vc4_state->crtc_w, vc4_state->src_x, channel,
- state->chroma_siting_h,
- no_interpolate);
+ hsub, state->chroma_siting_h, no_interpolate);
}
/* Ch0 V-PPF Words 0-1: Scaling Parameters, Context */
if (vc4_state->y_scaling[channel] == VC4_SCALING_PPF) {
vc4_write_ppf(vc4_state, vc4_state->src_h[channel],
vc4_state->crtc_h, vc4_state->src_y, channel,
- state->chroma_siting_v,
- no_interpolate);
+ vsub, state->chroma_siting_v, no_interpolate);
vc4_dlist_write(vc4_state, 0xc0c0c0c0);
}
@@ -2685,16 +2680,6 @@ static const struct drm_plane_helper_fun
.atomic_async_update = vc4_plane_atomic_async_update,
};
-static const struct drm_plane_helper_funcs vc4_primary_plane_helper_funcs = {
- .atomic_check = vc4_plane_atomic_check,
- .atomic_update = vc4_plane_atomic_update,
- .prepare_fb = vc4_prepare_fb,
- .cleanup_fb = vc4_cleanup_fb,
- .atomic_async_check = vc4_plane_atomic_async_check,
- .atomic_async_update = vc4_plane_atomic_async_update,
- .get_scanout_buffer = drm_fb_dma_get_scanout_buffer,
-};
-
static const struct drm_plane_helper_funcs vc5_plane_helper_funcs = {
.atomic_check = vc4_plane_atomic_check,
.atomic_update = vc4_plane_atomic_update,
@@ -2702,14 +2687,6 @@ static const struct drm_plane_helper_fun
.atomic_async_update = vc4_plane_atomic_async_update,
};
-static const struct drm_plane_helper_funcs vc5_primary_plane_helper_funcs = {
- .atomic_check = vc4_plane_atomic_check,
- .atomic_update = vc4_plane_atomic_update,
- .atomic_async_check = vc4_plane_atomic_async_check,
- .atomic_async_update = vc4_plane_atomic_async_update,
- .get_scanout_buffer = drm_fb_dma_get_scanout_buffer,
-};
-
static bool vc4_format_mod_supported(struct drm_plane *plane,
uint32_t format,
uint64_t modifier)
@@ -2828,13 +2805,9 @@ struct drm_plane *vc4_plane_init(struct
plane = &vc4_plane->base;
if (vc4->gen >= VC4_GEN_5)
- drm_plane_helper_add(plane, type == DRM_PLANE_TYPE_PRIMARY ?
- &vc5_primary_plane_helper_funcs :
- &vc5_plane_helper_funcs);
+ drm_plane_helper_add(plane, &vc5_plane_helper_funcs);
else
- drm_plane_helper_add(plane, type == DRM_PLANE_TYPE_PRIMARY ?
- &vc4_primary_plane_helper_funcs :
- &vc4_plane_helper_funcs);
+ drm_plane_helper_add(plane, &vc4_plane_helper_funcs);
drm_plane_create_alpha_property(plane);
drm_plane_create_blend_mode_property(plane,
--- a/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_h265.c
+++ b/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_h265.c
@@ -259,10 +259,6 @@ struct hevc_d_dec_state {
unsigned int start_ctb_y;
unsigned int prev_ctb_x; /* CTB X,Y of start_ts - 1 */
unsigned int prev_ctb_y;
-
- /* Sanitized copies of the slice header arrays */
- u8 ref_idx_l0[NUM_REF_IDX_ACTIVE_MAX];
- u8 ref_idx_l1[NUM_REF_IDX_ACTIVE_MAX];
};
/* Phase 1 command and bit FIFOs */
@@ -699,7 +695,7 @@ static void program_slicecmds(struct hev
* get NoBackwardPredictionFlag.
*/
static int has_backward(const struct v4l2_hevc_dpb_entry *const dpb,
- const u8 *const idx, const unsigned int n,
+ const __u8 *const idx, const unsigned int n,
const s32 cur_poc)
{
unsigned int i;
@@ -768,9 +764,9 @@ static void pre_slice_decode(struct hevc
if (sh->slice_type == HEVC_SLICE_P || sh->slice_type == HEVC_SLICE_B) {
/* Flag to say all reference pictures are from the past */
const int no_backward_pred_flag =
- has_backward(dec->dpb, s->ref_idx_l0, s->nb_refs[L0],
+ has_backward(dec->dpb, sh->ref_idx_l0, s->nb_refs[L0],
sh->slice_pic_order_cnt) &&
- has_backward(dec->dpb, s->ref_idx_l1, s->nb_refs[L1],
+ has_backward(dec->dpb, sh->ref_idx_l1, s->nb_refs[L1],
sh->slice_pic_order_cnt);
cmd_slice |= no_backward_pred_flag << 10;
msg_slice(de, cmd_slice);
@@ -778,11 +774,11 @@ static void pre_slice_decode(struct hevc
if (s->slice_temporal_mvp)
de->dpbno_col = collocated_from_l0_flag ?
(sh->collocated_ref_idx < s->nb_refs[L0] ?
- s->ref_idx_l0[sh->collocated_ref_idx] :
- s->ref_idx_l0[0]) :
+ sh->ref_idx_l0[sh->collocated_ref_idx] :
+ sh->ref_idx_l0[0]) :
(sh->collocated_ref_idx < s->nb_refs[L1] ?
- s->ref_idx_l1[sh->collocated_ref_idx] :
- s->ref_idx_l1[0]);
+ sh->ref_idx_l1[sh->collocated_ref_idx] :
+ sh->ref_idx_l1[0]);
/* Write reference picture descriptions */
weighted_pred_flag =
@@ -791,7 +787,7 @@ static void pre_slice_decode(struct hevc
!!(s->pps.flags & V4L2_HEVC_PPS_FLAG_WEIGHTED_BIPRED);
for (idx = 0; idx < s->nb_refs[L0]; ++idx) {
- unsigned int dpb_no = s->ref_idx_l0[idx];
+ unsigned int dpb_no = sh->ref_idx_l0[idx];
msg_slice(de,
dpb_no |
@@ -812,7 +808,7 @@ static void pre_slice_decode(struct hevc
}
for (idx = 0; idx < s->nb_refs[L1]; ++idx) {
- unsigned int dpb_no = s->ref_idx_l1[idx];
+ unsigned int dpb_no = sh->ref_idx_l1[idx];
msg_slice(de,
dpb_no |
@@ -1520,37 +1516,6 @@ static u32 mk_config2(const struct hevc_
return c;
}
-static inline bool idx_valid(unsigned int idx)
-{
- return idx < V4L2_HEVC_DPB_ENTRIES_NUM_MAX;
-}
-
-/*
- * Create a ref_idx array that only contains valid values.
- * Fill bad values with the last seen good value.
- * If nothing good then fill with zeros
- */
-static void sanitize_ref_idx(u8 *dst, const __u8 *src, const unsigned int n)
-{
- unsigned int i;
- u8 v = 0;
-
- /* Find the first good value or leave v = 0 if none */
- for (i = 0; i < n; ++i) {
- if (idx_valid(src[i])) {
- v = src[i];
- break;
- }
- }
-
- /* Now fill bad with last seen good */
- for (i = 0; i < n; ++i) {
- if (idx_valid(src[i]))
- v = src[i];
- dst[i] = v;
- }
-}
-
static inline bool is_ref_unit_type(const unsigned int nal_unit_type)
{
/* From Table 7-1
@@ -1811,18 +1776,10 @@ static int hevc_d_h265_setup(struct hevc
0 :
sh->num_ref_idx_l1_active_minus1 + 1;
- /*
- * Fix up idx arrays - some userspace code such as gstreamer
- * adds deliberately bad values to indicate missing frames and
- * expects decode to succeed - deal with that
- */
- sanitize_ref_idx(s->ref_idx_l0, sh->ref_idx_l0, s->nb_refs[0]);
- sanitize_ref_idx(s->ref_idx_l1, sh->ref_idx_l1, s->nb_refs[1]);
-
for (j = 0; j != s->nb_refs[0]; ++j)
- s->idx_inuse |= 1 << s->ref_idx_l0[j];
+ s->idx_inuse |= 1 << sh->ref_idx_l0[j];
for (j = 0; j != s->nb_refs[1]; ++j)
- s->idx_inuse |= 1 << s->ref_idx_l1[j];
+ s->idx_inuse |= 1 << sh->ref_idx_l1[j];
if (s->sps.flags & V4L2_HEVC_SPS_FLAG_SCALING_LIST_ENABLED)
populate_scaling_factors(run, de, s);
@@ -2519,6 +2476,20 @@ const struct v4l2_ctrl_ops hevc_d_hevc_p
.try_ctrl = try_ctrl_pps,
};
+/* Check the DPB indices that decode will use are all in range */
+static bool ref_idx_valid(const __u8 *const ref_idx, const unsigned int n_minus_1)
+{
+ unsigned int i;
+
+ if (n_minus_1 > NUM_REF_IDX_ACTIVE_MAX - 1)
+ return false;
+ for (i = 0; i <= n_minus_1; ++i)
+ if (ref_idx[i] >= V4L2_HEVC_DPB_ENTRIES_NUM_MAX)
+ return false;
+
+ return true;
+}
+
static int try_ctrl_slice_params(struct v4l2_ctrl *ctrl)
{
struct hevc_d_ctx *const ctx = ctrl->priv;
@@ -2547,13 +2518,13 @@ static int try_ctrl_slice_params(struct
}
if (sh->slice_type != HEVC_SLICE_I) {
- if (sh->num_ref_idx_l0_active_minus1 > NUM_REF_IDX_ACTIVE_MAX - 1)
+ if (!ref_idx_valid(sh->ref_idx_l0, sh->num_ref_idx_l0_active_minus1))
return -EINVAL;
if (sh->five_minus_max_num_merge_cand > 4)
return -EINVAL;
}
if (sh->slice_type == HEVC_SLICE_B) {
- if (sh->num_ref_idx_l1_active_minus1 > NUM_REF_IDX_ACTIVE_MAX - 1)
+ if (!ref_idx_valid(sh->ref_idx_l1, sh->num_ref_idx_l1_active_minus1))
return -EINVAL;
}
}
--- a/drivers/media/platform/raspberrypi/rp1_cfe/cfe.c
+++ b/drivers/media/platform/raspberrypi/rp1_cfe/cfe.c
@@ -1915,13 +1915,6 @@ static int cfe_register_node(struct cfe_
struct cfe_node *node = &cfe->node[id];
int ret;
- /*
- * The node may be re-registered after the source subdev has been
- * unbound and rebound. The embedded video_device must be reset before
- * being re-registered.
- */
- memset(&node->video_dev, 0, sizeof(node->video_dev));
-
node->cfe = cfe;
node->id = id;
@@ -2045,7 +2038,6 @@ static void cfe_unregister_nodes(struct
if (check_state(cfe, NODE_REGISTERED, i)) {
clear_state(cfe, NODE_REGISTERED, i);
video_unregister_device(&node->video_dev);
- vb2_queue_release(&node->buffer_queue);
}
}
}
@@ -2176,22 +2168,6 @@ static int cfe_async_bound(struct v4l2_a
return 0;
}
-static void cfe_async_unbind(struct v4l2_async_notifier *notifier,
- struct v4l2_subdev *subdev,
- struct v4l2_async_connection *asd)
-{
- struct cfe_device *cfe = to_cfe_device(notifier->v4l2_dev);
-
- if (cfe->sensor != subdev)
- return;
-
- cfe_unregister_nodes(cfe);
- media_entity_remove_links(&cfe->csi2.sd.entity);
- media_entity_remove_links(&cfe->fe.sd.entity);
-
- cfe->sensor = NULL;
-}
-
static int cfe_async_complete(struct v4l2_async_notifier *notifier)
{
struct cfe_device *cfe = to_cfe_device(notifier->v4l2_dev);
@@ -2201,7 +2177,6 @@ static int cfe_async_complete(struct v4l
static const struct v4l2_async_notifier_operations cfe_async_ops = {
.bound = cfe_async_bound,
- .unbind = cfe_async_unbind,
.complete = cfe_async_complete,
};
@@ -0,0 +1,46 @@
From 268c0eb2935958115f5547a4d8d7d879310f95fb Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Mon, 14 Sep 2026 16:30:57 +0100
Subject: [PATCH] drm/vc4: Ignore chroma siting on a non-subsampled axis
Chroma siting describes where the chroma samples sit relative to the luma
samples, so it only says anything on an axis that is actually subsampled.
On a full-resolution axis - vertically for 4:2:2, both axes for 4:4:4 -
the chroma is by definition cosited with the luma, but the property was
applied there regardless, shifting the chroma away from the luma.
Fixes: b7fcc0d961dd ("vc4/drm:plane: Make use of chroma siting parameter")
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
---
drivers/gpu/drm/vc4/vc4_plane.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -928,6 +928,9 @@ static void vc4_write_scaling_parameters
bool no_interpolate = state->scaling_filter == DRM_SCALING_FILTER_NEAREST_NEIGHBOR;
unsigned int hsub = channel ? info->hsub : 1;
unsigned int vsub = channel ? info->vsub : 1;
+ /* Chroma siting only has any meaning on a subsampled axis */
+ int siting_h = hsub > 1 ? state->chroma_siting_h : 0;
+ int siting_v = vsub > 1 ? state->chroma_siting_v : 0;
if (vc4_state->is_yuv444_unity)
no_interpolate = 1;
@@ -938,14 +941,14 @@ static void vc4_write_scaling_parameters
if (vc4_state->x_scaling[channel] == VC4_SCALING_PPF) {
vc4_write_ppf(vc4_state, vc4_state->src_w[channel],
vc4_state->crtc_w, vc4_state->src_x, channel,
- hsub, state->chroma_siting_h, no_interpolate);
+ hsub, siting_h, no_interpolate);
}
/* Ch0 V-PPF Words 0-1: Scaling Parameters, Context */
if (vc4_state->y_scaling[channel] == VC4_SCALING_PPF) {
vc4_write_ppf(vc4_state, vc4_state->src_h[channel],
vc4_state->crtc_h, vc4_state->src_y, channel,
- vsub, state->chroma_siting_v, no_interpolate);
+ vsub, siting_v, no_interpolate);
vc4_dlist_write(vc4_state, 0xc0c0c0c0);
}
@@ -0,0 +1,51 @@
From 0b01f0becf392cfd07b95da431f56431d3356776 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Tue, 15 Sep 2026 16:43:50 +0100
Subject: [PATCH] drm/vc4: Add the missing half-destination-pixel term to the
PPF phase
vc4_write_ppf() starts the phase at
(src_x - siting - 1/2) / subsample
but output pixel r samples the source at (r + 1/2) * scale - 1/2, so
the initial phase also needs half a destination pixel's worth of
source:
(src_x - siting - 1/2) / subsample + scale/2
Without it everything the PPF touches is displaced by half a
destination pixel's worth of source. For 4:2:0 chroma composited 1:1
that is 0.25 chroma pixels, i.e. half a luma line, and since the luma
at 1:1 goes through SCALING_NONE rather than the PPF, the chroma ends
up half a line adrift of the luma it belongs to.
Measured on a Pi 5 by compositing a synthetic 4:2:0 frame 1:1 and
capturing it through the writeback connector: with cosited chroma and
CHROMA_SITING_V=0 the chroma came back 0.371 luma rows early (0.378
rows on the horizontal axis), against a luma control that measured
0.000. The siting properties themselves scale correctly at -1.00 luma
pixels per unit.
Fixes: ac69c01fa825 ("drm/vc4: plane: Handle fractional coordinates using the phase field")
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
---
drivers/gpu/drm/vc4/vc4_plane.c | 7 +++++++
1 file changed, 7 insertions(+)
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -721,6 +721,13 @@ static void vc4_write_ppf(struct vc4_pla
offset >>= sub_shift;
/*
+ * Output pixel r samples the source at (r + 1/2) * scale - 1/2, so the
+ * phase the first output pixel starts at needs half a destination
+ * pixel's worth of source added to it.
+ */
+ offset += (s32)(scale >> (17 - PHASE_BITS));
+
+ /*
* There may be a also small error introduced by precision of scale.
* Add half of that as a compromise
*/
@@ -0,0 +1,43 @@
From bb74628f77016b40792cbe70290b359dd83941b6 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Tue, 15 Sep 2026 17:57:34 +0100
Subject: [PATCH] drm/vc4: Default vertical chroma siting to interstitial
The chroma siting properties defaulted to (0, 0), placing the chroma
samples on the top-left luma sample. MPEG-2, H.264 and HEVC 4:2:0 are
horizontally cosited but vertically interstitial, so the default left
typical video content half a luma line out unless userspace knew about
this property - which is downstream-only - and set it.
Default to (0, 0x8000) instead, which is right for the common case.
This is only an improvement once the PPF phase is right. Measured on a
Pi 5 by compositing a synthetic 4:2:0 frame 1:1 and capturing it
through the writeback connector, PSNR against an ideal reference,
whole frame:
SITING_V=0 SITING_V=0.5
before the scale/2 fix 21.01 dB 20.67 dB
after 20.21 dB 21.20 dB
Before that fix the pipeline sampled chroma 0.38 luma rows early, which
a siting of 0 partly cancelled and 0.5 made worse - so this change on
its own would have been a regression.
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
---
drivers/gpu/drm/vc4/vc4_plane.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -2843,7 +2843,8 @@ struct drm_plane *vc4_plane_init(struct
BIT(DRM_SCALING_FILTER_DEFAULT) |
BIT(DRM_SCALING_FILTER_NEAREST_NEIGHBOR));
- drm_plane_create_chroma_siting_properties(plane, 0, 0);
+ /* MPEG-2 / H.264 / HEVC 4:2:0 siting: H cosited, V interstitial */
+ drm_plane_create_chroma_siting_properties(plane, 0, 0x8000);
if (type == DRM_PLANE_TYPE_PRIMARY)
drm_plane_create_zpos_immutable_property(plane, 0);
@@ -0,0 +1,137 @@
From 8e8c07957368233228a9af82b9e99209653ef1e7 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Tue, 15 Sep 2026 17:59:21 +0100
Subject: [PATCH] drm/vc4: Tabulate the PPF filter kernel at the phases the
hardware uses
The PPF is a 4-tap filter with 64 phases. Only 8 key phases are stored -
32 coefficients, indexed tap * 8 + phase - and the hardware linearly
interpolates the other 56 from them. The key phases sit at 0, 1/8, ...,
7/8 of a source pixel.
The Mitchell-Netravali table was tabulated at (p + 1/2) / 8 instead:
1/16, 3/16, ..., 15/16. Every stored phase, and therefore every
interpolated one, was half a key phase - 1/16 of a source pixel - late.
For 4:2:0 chroma composited 1:1 that is an eighth of a luma line, on
both axes, and it does not respond to CHROMA_SITING because the siting
moves the requested phase and this moved the realised one.
It was tabulated that way because vc4_hvs_upload_linear_kernel() only
took the first 16 coefficients and mirrored them, which requires
f(p) + f(7 - p) == 1, and (p + 1/2) / 8 is the only spacing that gives
that. The hardware stores all 32 coefficients and has no such
requirement, so write all 32 and put the key phases where they belong.
The nearest-neighbour kernel is unchanged: the new macro emits exactly
the dwords the old mirroring did for a symmetric table.
While at it the coefficients are rounded so that every phase sums to
exactly 256 and is within 0.63 counts of the ideal kernel. Phases 0 and
7 were out by up to 5.7 counts and summed to 247, and SCALER_PPF_AGC
fixes a bad sum by rewriting the largest coefficient, so those two
phases had their dominant tap inflated from 227 to 236 and smoothed
noticeably less than the other six.
Measured on a Pi 5 through the writeback connector, chroma sampling
offset against the source's own siting, in luma pixels:
vertical horizontal
old table +0.125 +0.123
this table +0.011 +0.021
luma control 0.000 0.000
The old table's own centroids predicted +0.129 and this one's 0.000.
4:2:2 vertical chroma, which the old table put at +0.037, now measures
0.000. PSNR of an interstitially-sited 4:2:0 test frame against its
ideal now peaks with CHROMA_SITING_V at 0.5, where it should; with the
old table the peak was at 0.625.
Fixes: 21af94cf1a4c ("drm/vc4: Add support for scaling of display planes.")
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
---
drivers/gpu/drm/vc4/vc4_hvs.c | 55 +++++++++++++++++++++++------------
1 file changed, 36 insertions(+), 19 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
@@ -409,30 +409,53 @@ static int vc4_hvs_debugfs_lbm_allocs(st
(((c1) & 0x1ff) << 9) | \
(((c2) & 0x1ff) << 18))
-/* The whole filter kernel is arranged as the coefficients 0-16 going
+/* The PPF is a 4-tap filter with 64 phases, of which only 8 key phases
+ * (at 0, 1/8, ..., 7/8 of a source pixel) are stored; the hardware
+ * linearly interpolates the rest. The 32 coefficients are indexed
+ * tap * 8 + phase, taps ordered +2, +1, 0, -1 from the sample point.
+ *
+ * The whole filter kernel is arranged as the coefficients 0-16 going
* up, then a pad, then 17-31 going down and reversed within the
- * dwords. This means that a linear phase kernel (where it's
- * symmetrical at the boundary between 15 and 16) has the last 5
- * dwords matching the first 5, but reversed.
+ * dwords.
*/
-#define VC4_LINEAR_PHASE_KERNEL(c0, c1, c2, c3, c4, c5, c6, c7, c8, \
- c9, c10, c11, c12, c13, c14, c15) \
+#define VC4_KERNEL(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, \
+ c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, \
+ c22, c23, c24, c25, c26, c27, c28, c29, c30, c31) \
{VC4_PPF_FILTER_WORD(c0, c1, c2), \
VC4_PPF_FILTER_WORD(c3, c4, c5), \
VC4_PPF_FILTER_WORD(c6, c7, c8), \
VC4_PPF_FILTER_WORD(c9, c10, c11), \
VC4_PPF_FILTER_WORD(c12, c13, c14), \
- VC4_PPF_FILTER_WORD(c15, c15, 0)}
+ VC4_PPF_FILTER_WORD(c15, c16, 0), \
+ VC4_PPF_FILTER_WORD(c19, c18, c17), \
+ VC4_PPF_FILTER_WORD(c22, c21, c20), \
+ VC4_PPF_FILTER_WORD(c25, c24, c23), \
+ VC4_PPF_FILTER_WORD(c28, c27, c26), \
+ VC4_PPF_FILTER_WORD(c31, c30, c29)}
-#define VC4_LINEAR_PHASE_KERNEL_DWORDS 6
-#define VC4_KERNEL_DWORDS (VC4_LINEAR_PHASE_KERNEL_DWORDS * 2 - 1)
+/* A linear phase kernel is symmetrical at the boundary between 15 and
+ * 16, so only the first half need be given.
+ */
+#define VC4_LINEAR_PHASE_KERNEL(c0, c1, c2, c3, c4, c5, c6, c7, c8, \
+ c9, c10, c11, c12, c13, c14, c15) \
+ VC4_KERNEL(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, \
+ c12, c13, c14, c15, c15, c14, c13, c12, c11, c10, \
+ c9, c8, c7, c6, c5, c4, c3, c2, c1, c0)
+
+#define VC4_KERNEL_DWORDS 11
/* Recommended B=1/3, C=1/3 filter choice from Mitchell/Netravali.
* http://www.cs.utexas.edu/~fussell/courses/cs384g/lectures/mitchell/Mitchell.pdf
+ *
+ * Tabulated at the key phases the hardware actually uses, so it is not
+ * linear phase: a symmetric table would have to put the key phases at
+ * (p + 1/2) / 8, half a key phase late.
*/
static const u32 mitchell_netravali_1_3_1_3_kernel[] =
- VC4_LINEAR_PHASE_KERNEL(0, -2, -6, -8, -10, -8, -3, 2, 18,
- 50, 82, 119, 155, 187, 213, 227);
+ VC4_KERNEL(0, -1, -4, -7, -9, -9, -6, 1,
+ 14, 36, 66, 101, 137, 171, 200, 220,
+ 228, 220, 200, 171, 137, 101, 66, 36,
+ 14, 1, -6, -9, -9, -7, -4, -1);
static const u32 nearest_neighbour_kernel[] =
VC4_LINEAR_PHASE_KERNEL(0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 255, 255, 255, 255);
@@ -458,14 +481,8 @@ static int vc4_hvs_upload_linear_kernel(
dst_kernel = hvs->dlist + space->start;
- for (i = 0; i < VC4_KERNEL_DWORDS; i++) {
- if (i < VC4_LINEAR_PHASE_KERNEL_DWORDS)
- writel(kernel[i], &dst_kernel[i]);
- else {
- writel(kernel[VC4_KERNEL_DWORDS - i - 1],
- &dst_kernel[i]);
- }
- }
+ for (i = 0; i < VC4_KERNEL_DWORDS; i++)
+ writel(kernel[i], &dst_kernel[i]);
return 0;
}
@@ -0,0 +1,102 @@
From 5dffd062b57250664e0efdec9d0e24c4ef65d335 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Thu, 17 Sep 2026 12:05:06 +0100
Subject: [PATCH] net: phy: mxl-86110: Add BCM54210-like LED settings
Copy the led-modes DT property from the Broadcom PHYs, with a
translation table to equivalent settings for this PHY.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/net/phy/mxl-86110.c | 66 +++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
--- a/drivers/net/phy/mxl-86110.c
+++ b/drivers/net/phy/mxl-86110.c
@@ -7,6 +7,7 @@
*/
#include <linux/bitfield.h>
+#include <linux/brcmphy.h> // For compatible LED definitions
#include <linux/etherdevice.h>
#include <linux/kernel.h>
#include <linux/module.h>
@@ -652,6 +653,67 @@ static int mxl86110_enable_led_activity_
}
/**
+ * mxl86110_emulate_brcm_leds - Support LED configuration from Device Tree, in a
+ * a manner similar to the Broadcom Ethernet PHYs.
+ * @phydev: Pointer to the PHY device structure
+ *
+ * If the PHY DT node contains an led-modes property, it is interpreted as 2
+ * integers - one for each LED - where each value is one of the following:
+ * 0=Link/activity
+ * 1=Speed
+ * 3=FDX
+ * 4=Off
+ * 5=On
+ * 8=Link
+ * 9=Activity
+ * Other values are undefined.
+ */
+static int mxl86110_emulate_brcm_leds(struct phy_device *phydev)
+{
+ int i, ret = 0;
+ static const u16 brcm_to_mxl[16] = {
+ [BCM_LED_MULTICOLOR_LINK_ACT] = 0x670,
+ [BCM_LED_MULTICOLOR_SPEED] = 0x62,
+ [BCM_LED_MULTICOLOR_FDX] = 0x1000,
+ [BCM_LED_MULTICOLOR_OFF] = 0x8000,
+ [BCM_LED_MULTICOLOR_ON] = 0xc000,
+ [BCM_LED_MULTICOLOR_LINK] = 0x70,
+ [BCM_LED_MULTICOLOR_ACT] = 0x2600,
+ };
+ u32 led_modes[] = { BCM_LED_MULTICOLOR_LINK_ACT, BCM_LED_MULTICOLOR_LINK };
+ struct device_node *np = phydev->mdio.dev.of_node;
+
+ if (!of_property_read_u32_array(np, "led-modes", led_modes, 2)) {
+ int led_swap = of_property_read_bool(np, "led-swap") ? 1 : 0;
+
+ for (i = 0; i < 2; i++) {
+ u16 led_mode = brcm_to_mxl[led_modes[i] & 0xf];
+ int led_num = 1 + (i ^ led_swap);
+
+ if (led_mode & 0x8000) {
+ // This is a static on/off
+ u16 set = MXL86110_COM_EXT_LED_GEN_CFG_LFE(led_num);
+
+ if (led_mode & 0x4000)
+ set |= MXL86110_COM_EXT_LED_GEN_CFG_LFME(led_num);
+ ret = __mxl86110_modify_extended_reg(phydev,
+ MXL86110_COM_EXT_LED_GEN_CFG,
+ MXL86110_COM_EXT_LED_GEN_CFG_LFM(led_num),
+ set);
+ } else {
+ ret = __mxl86110_write_extended_reg(phydev,
+ MXL86110_LED0_CFG_REG + led_num,
+ led_mode);
+ }
+ if (ret < 0)
+ break;
+ }
+ }
+
+ return ret;
+}
+
+/**
* mxl86110_config_rgmii_delay() - configure RGMII delays
* @phydev: pointer to the phy_device
*
@@ -731,6 +793,10 @@ static int mxl86110_config_init(struct p
if (ret < 0)
goto out;
+ ret = mxl86110_emulate_brcm_leds(phydev);
+ if (ret < 0)
+ goto out;
+
ret = mxl86110_broadcast_cfg(phydev);
out:
@@ -0,0 +1,24 @@
From d9e1735f53397e2f9f51b4215da341613f8f8b1b Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Thu, 17 Sep 2026 12:09:27 +0100
Subject: [PATCH] arm64: dts: broadcom: bcm2712-rpi: Add PHY led-modes
Add a led-modes property as an instruction to other PHYs to accept
Broadcom-compatible configuration. The default values are the same as
the defaults in the Broadcom driver.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts | 1 +
1 file changed, 1 insertion(+)
--- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts
+++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts
@@ -176,6 +176,7 @@ rp1_target: &pcie2 {
phy1: ethernet-phy@1 {
reg = <0x1>;
brcm,powerdown-enable;
+ led-modes = <0 8>;
};
};
@@ -0,0 +1,41 @@
From 3ee04ab2cf49270c8111c342bd9a8fe62a3fcea1 Mon Sep 17 00:00:00 2001
From: Jai Luthra <jai.luthra@ideasonboard.com>
Date: Fri, 3 Jul 2026 14:49:16 +0530
Subject: [PATCH] dt-bindings: media: i2c: Add Sony IMX678
Commit 447ea0c26e57c1b423426e6c46d7ff89fd66eb6b upstream.
Sony IMX678 is an 8.4 Megapixel (3856x2180) CMOS sensor, that can output
pixels over MIPI CSI-2 bus. Add bindings for it.
Runtime detection for mono vs color variant of this sensor is feasible
by reading a register, but it's not always desirable given the sensor
needs to be powered on for it, potentially flashing a privacy LED or
wasting precious boot time.
The manufacturer or vendor knows which sensor variant they are putting
on their board, so we define the compatible property to expect the
(color/mono) specific name of the sensor, along with a generic fallback.
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
MAINTAINERS | 6 ++++++
1 file changed, 6 insertions(+)
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -24138,6 +24138,12 @@ T: git git://linuxtv.org/media_tree.git
F: Documentation/devicetree/bindings/media/i2c/sony,imx708.yaml
F: drivers/media/i2c/imx708.c
+SONY IMX678 SENSOR DRIVER
+M: Jai Luthra <jai.luthra@ideasonboard.com>
+L: linux-media@vger.kernel.org
+S: Maintained
+F: Documentation/devicetree/bindings/media/i2c/sony,imx678.yaml
+
SONY MEMORYSTICK SUBSYSTEM
M: Maxim Levitsky <maximlevitsky@gmail.com>
M: Alex Dubov <oakad@yahoo.com>
@@ -0,0 +1,71 @@
From 4970861bda47056fe0e32e8c64f2cdcae79e0fef Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 3 Sep 2026 16:46:00 +0100
Subject: [PATCH] media: sony-starvis2: Reorder link frequencies to remove
lookup
link_freqs_reg_value is table that just reverses the order of the
link frequency enum.
Reverse the order of the link frequencies so that the table is
redundant, and remove it.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/sony-starvis2.c | 31 ++++++++++---------------------
1 file changed, 10 insertions(+), 21 deletions(-)
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -186,25 +186,14 @@ enum starvis2_lanemode {
/* Link frequency setup (DDR: lane rate = 2 x link freq) */
enum {
- STARVIS2_LINK_FREQ_297MHZ,
- STARVIS2_LINK_FREQ_360MHZ,
- STARVIS2_LINK_FREQ_445MHZ,
- STARVIS2_LINK_FREQ_594MHZ,
- STARVIS2_LINK_FREQ_720MHZ,
- STARVIS2_LINK_FREQ_891MHZ,
- STARVIS2_LINK_FREQ_1039MHZ,
- STARVIS2_LINK_FREQ_1188MHZ,
-};
-
-static const u8 link_freqs_reg_value[] = {
- [STARVIS2_LINK_FREQ_297MHZ] = 0x07,
- [STARVIS2_LINK_FREQ_360MHZ] = 0x06,
- [STARVIS2_LINK_FREQ_445MHZ] = 0x05,
- [STARVIS2_LINK_FREQ_594MHZ] = 0x04,
- [STARVIS2_LINK_FREQ_720MHZ] = 0x03,
- [STARVIS2_LINK_FREQ_891MHZ] = 0x02,
- [STARVIS2_LINK_FREQ_1039MHZ] = 0x01,
- [STARVIS2_LINK_FREQ_1188MHZ] = 0x00,
+ STARVIS2_LINK_FREQ_1188MHZ = 0x00,
+ STARVIS2_LINK_FREQ_1039MHZ = 0x01,
+ STARVIS2_LINK_FREQ_891MHZ = 0x02,
+ STARVIS2_LINK_FREQ_720MHZ = 0x03,
+ STARVIS2_LINK_FREQ_594MHZ = 0x04,
+ STARVIS2_LINK_FREQ_445MHZ = 0x05,
+ STARVIS2_LINK_FREQ_360MHZ = 0x06,
+ STARVIS2_LINK_FREQ_297MHZ = 0x07,
};
static const u64 link_freqs[] = {
@@ -911,7 +900,7 @@ static int starvis2_write_common(struct
cci_write(starvis2->cci, STARVIS2_REG_INCK_SEL, starvis2->inck_sel_val,
&ret);
cci_write(starvis2->cci, STARVIS2_REG_DATARATE_SEL,
- link_freqs_reg_value[__ffs(starvis2->link_freq_bitmap)],
+ __fls(starvis2->link_freq_bitmap),
&ret);
cci_write(starvis2->cci, STARVIS2_REG_LANEMODE, starvis2->lane_mode,
&ret);
@@ -1161,7 +1150,7 @@ static int starvis2_init_controls(struct
{
struct v4l2_ctrl_handler *ctrl_hdlr;
const u32 hmax_4lane =
- min_hmax_4lane[__ffs(starvis2->link_freq_bitmap)];
+ min_hmax_4lane[__fls(starvis2->link_freq_bitmap)];
const u32 lane_scale =
starvis2->lane_mode == STARVIS2_LANEMODE_2L ? 2 : 1;
struct i2c_client *client = v4l2_get_subdevdata(&starvis2->sd);
@@ -0,0 +1,31 @@
From dc92039e2da737c65d684c5fc5146fc7be238a04 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 3 Sep 2026 16:50:37 +0100
Subject: [PATCH] media: sony-starvis2: Always program the sensor in window
mode
If the requested region matched the defined active area then
the driver switched to all-pixel mode. This left the possibility
that the activeare was incorrect and not reading out the area
expected.
Switch to always requesting window mode.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/sony-starvis2.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -917,9 +917,7 @@ static int starvis2_program_window(struc
int ret = 0;
cci_write(starvis2->cci, STARVIS2_REG_ADDMODE, 0x00, &ret);
- cci_write(starvis2->cci, STARVIS2_REG_WINMODE,
- v4l2_rect_equal(crop, &imx678_active_area) ? 0x00 : 0x04,
- &ret);
+ cci_write(starvis2->cci, STARVIS2_REG_WINMODE, 0x04, &ret);
cci_write(starvis2->cci, STARVIS2_REG_PIX_HST,
crop->left - imx678_active_area.left, &ret);
cci_write(starvis2->cci, STARVIS2_REG_PIX_HWIDTH, crop->width, &ret);
@@ -0,0 +1,396 @@
From fb822e0314f3063003882579bd6b1283d608c4e3 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 3 Sep 2026 17:19:16 +0100
Subject: [PATCH] media: sony-starvis2: Parameterise the configuration to allow
for other models
Several of the Sony Starvis 2 sensors are identical in the
majority of their programming, but differ largely only in the
size of pixel array and some timing parameters.
Parameterise those parameters in preparation for supporting other
variants.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/sony-starvis2.c | 166 +++++++++++++++++++-----------
1 file changed, 106 insertions(+), 60 deletions(-)
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -51,17 +51,9 @@
/* Lane Count */
#define STARVIS2_REG_LANEMODE CCI_REG8(0x3040)
-/*
- * The internal readout clock runs at 74.25 MHz. In one cycle the AD reads 8
- * pixels, thus giving us a rate of 74.25 * 8 = 594 MPix/s
- */
-#define IMX678_PIXEL_RATE 594000000
-#define IMX678_PIX_PER_CLK 8
-
/* VMAX - Frame Length in Lines */
#define STARVIS2_REG_VMAX CCI_REG24_LE(0x3028)
#define STARVIS2_VMAX_MAX 0xfffff
-#define IMX678_VMAX_DEFAULT 2250
/* HMAX - Line Length in Cycles (8 Pixels) */
#define STARVIS2_REG_HMAX CCI_REG16_LE(0x302c)
@@ -103,7 +95,6 @@
#define STARVIS2_REG_MONOCHROME CCI_REG8(0x4d18)
#define STARVIS2_TYPE BIT(0)
#define STARVIS2_REG_MODULE_ID CCI_REG16_LE(0x4d1c)
-#define IMX678_ID 0x02a6
#define IMX678_MODULE_ID_DELAY 80000
/* Common configuration registers */
@@ -153,32 +144,11 @@
/* Subdev pads */
#define STARVIS2_SOURCE_PAD 0
-/* IMX678 native and active pixel array size. */
-static const struct v4l2_rect imx678_native_area = {
- .top = 0,
- .left = 0,
- .width = 3857,
- .height = 2201,
-};
-
-static const struct v4l2_rect imx678_active_area = {
- .top = 20,
- .left = 0,
- .width = 3856,
- .height = 2180,
-};
-
enum starvis2_type {
STARVIS2_COLOR = 0,
STARVIS2_MONOCHROME = 1,
};
-struct starvis2_model_info {
- enum starvis2_type type;
- const u32 *codes;
- unsigned int num_codes;
-};
-
enum starvis2_lanemode {
STARVIS2_LANEMODE_2L = 1,
STARVIS2_LANEMODE_4L = 3,
@@ -207,7 +177,7 @@ static const u64 link_freqs[] = {
[STARVIS2_LINK_FREQ_1188MHZ] = 1188000000,
};
-static const u16 min_hmax_4lane[] = {
+static const u16 imx678_min_hmax_4lane[] = {
[STARVIS2_LINK_FREQ_297MHZ] = 1584,
[STARVIS2_LINK_FREQ_360MHZ] = 1320,
[STARVIS2_LINK_FREQ_445MHZ] = 1100,
@@ -267,7 +237,7 @@ static const int starvis2_tpg_val[] = {
};
/* Common configuration */
-static const struct cci_reg_sequence common_regs[] = {
+static const struct cci_reg_sequence imx678_common_regs[] = {
{ STARVIS2_REG_THIN_V_EN, 0x00 },
{ STARVIS2_REG_VCMODE, 0x01 },
{ CCI_REG8(0x306b), 0x00 },
@@ -650,16 +620,72 @@ static const u32 codes_monochrome[] = {
MEDIA_BUS_FMT_Y12_1X12,
};
+struct starvis2_variant {
+ const char *name;
+ u32 id_reg;
+ u32 id_value;
+ struct v4l2_rect native_area;
+ struct v4l2_rect active_area;
+ u64 pixel_rate;
+ unsigned int pix_per_clk;
+ const struct cci_reg_sequence *common_regs;
+ unsigned int num_common_regs;
+ unsigned int vmax_default;
+ const u16 *hmax_min;
+};
+
+const struct starvis2_variant imx678_variant_def = {
+ .name = "imx678",
+ .id_reg = STARVIS2_REG_MODULE_ID,
+ .id_value = 0x2a6,
+ .native_area = {
+ .top = 0,
+ .left = 0,
+ .width = 3857,
+ .height = 2201,
+ },
+ .active_area = {
+ .top = 20,
+ .left = 0,
+ .width = 3856,
+ .height = 2180,
+ },
+ .pixel_rate = 594000000,
+ .pix_per_clk = 8,
+ .common_regs = imx678_common_regs,
+ .num_common_regs = ARRAY_SIZE(imx678_common_regs),
+ .vmax_default = 2250,
+ .hmax_min = imx678_min_hmax_4lane,
+};
+
+struct starvis2_model_info {
+ enum starvis2_type type;
+ const u32 *codes;
+ unsigned int num_codes;
+ const struct starvis2_variant *variant;
+
+ const struct starvis2_model_info *auto_detect_colour;
+ const struct starvis2_model_info *auto_detect_mono;
+};
+
static const struct starvis2_model_info imx678_aaqr_info = {
.type = STARVIS2_COLOR,
.codes = codes_bayer,
.num_codes = ARRAY_SIZE(codes_bayer),
+ .variant = &imx678_variant_def,
};
static const struct starvis2_model_info imx678_aamr_info = {
.type = STARVIS2_MONOCHROME,
.codes = codes_monochrome,
.num_codes = ARRAY_SIZE(codes_monochrome),
+ .variant = &imx678_variant_def,
+};
+
+static const struct starvis2_model_info imx678_autodetect_info = {
+ .variant = &imx678_variant_def,
+ .auto_detect_colour = &imx678_aaqr_info,
+ .auto_detect_mono = &imx678_aamr_info,
};
static const char * const starvis2_supply_name[] = {
@@ -674,6 +700,7 @@ struct starvis2 {
struct regmap *cci;
const struct starvis2_model_info *info;
+ const struct starvis2_variant *variant;
struct clk *xclk;
u32 xclk_freq;
@@ -769,7 +796,8 @@ static int starvis2_set_ctrl(struct v4l2
cci_write(starvis2->cci, STARVIS2_REG_GAIN, ctrl->val, &ret);
break;
case V4L2_CID_HBLANK: {
- u32 hmax = (format->width + ctrl->val) / IMX678_PIX_PER_CLK;
+ u32 hmax = (format->width + ctrl->val) /
+ starvis2->variant->pix_per_clk;
cci_write(starvis2->cci, STARVIS2_REG_HMAX, hmax, &ret);
break;
@@ -849,18 +877,20 @@ static int starvis2_get_selection(struct
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel)
{
+ struct starvis2 *starvis2 = to_starvis2(sd);
+
switch (sel->target) {
case V4L2_SEL_TGT_CROP:
sel->r = *v4l2_subdev_state_get_crop(sd_state, sel->pad);
return 0;
case V4L2_SEL_TGT_NATIVE_SIZE:
- sel->r = imx678_native_area;
+ sel->r = starvis2->variant->native_area;
return 0;
case V4L2_SEL_TGT_CROP_DEFAULT:
case V4L2_SEL_TGT_CROP_BOUNDS:
- sel->r = imx678_active_area;
+ sel->r = starvis2->variant->active_area;
return 0;
}
@@ -875,12 +905,12 @@ static int starvis2_init_state(struct v4
struct v4l2_rect *crop;
crop = v4l2_subdev_state_get_crop(state, STARVIS2_SOURCE_PAD);
- *crop = imx678_active_area;
+ *crop = starvis2->variant->active_area;
format = v4l2_subdev_state_get_format(state, STARVIS2_SOURCE_PAD);
format->code = starvis2_default_mbus_code(starvis2);
- format->width = imx678_active_area.width;
- format->height = imx678_active_area.height;
+ format->width = starvis2->variant->active_area.width;
+ format->height = starvis2->variant->active_area.height;
format->field = V4L2_FIELD_NONE;
format->colorspace = V4L2_COLORSPACE_RAW;
format->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;
@@ -894,8 +924,12 @@ static int starvis2_write_common(struct
{
int ret = 0;
- cci_multi_reg_write(starvis2->cci, common_regs, ARRAY_SIZE(common_regs),
- &ret);
+ if (!starvis2->variant)
+ /* Powered on during probe to do detection. Variant unknown. */
+ return 0;
+
+ cci_multi_reg_write(starvis2->cci, starvis2->variant->common_regs,
+ starvis2->variant->num_common_regs, &ret);
cci_write(starvis2->cci, STARVIS2_REG_INCK_SEL, starvis2->inck_sel_val,
&ret);
@@ -919,10 +953,10 @@ static int starvis2_program_window(struc
cci_write(starvis2->cci, STARVIS2_REG_ADDMODE, 0x00, &ret);
cci_write(starvis2->cci, STARVIS2_REG_WINMODE, 0x04, &ret);
cci_write(starvis2->cci, STARVIS2_REG_PIX_HST,
- crop->left - imx678_active_area.left, &ret);
+ crop->left - starvis2->variant->active_area.left, &ret);
cci_write(starvis2->cci, STARVIS2_REG_PIX_HWIDTH, crop->width, &ret);
cci_write(starvis2->cci, STARVIS2_REG_PIX_VST,
- crop->top - imx678_active_area.top, &ret);
+ crop->top - starvis2->variant->active_area.top, &ret);
cci_write(starvis2->cci, STARVIS2_REG_PIX_VWIDTH, crop->height, &ret);
cci_write(starvis2->cci, STARVIS2_REG_ADBIT, 0x01, &ret);
@@ -1065,11 +1099,16 @@ static int starvis2_identify_model(struc
{
struct i2c_client *client = v4l2_get_subdevdata(&starvis2->sd);
const struct starvis2_model_info *info;
+ const struct starvis2_variant *variant;
enum starvis2_type detected;
int ret = 0;
u64 val = 0;
info = device_get_match_data(&client->dev);
+ if (!info)
+ return -EINVAL;
+
+ variant = info->variant;
/*
* This sensor's ID registers become accessible 80ms after coming out
@@ -1078,7 +1117,7 @@ static int starvis2_identify_model(struc
cci_write(starvis2->cci, STARVIS2_REG_MODE_SELECT, 0, &ret);
fsleep(IMX678_MODULE_ID_DELAY);
- cci_read(starvis2->cci, STARVIS2_REG_MODULE_ID, &val, &ret);
+ cci_read(starvis2->cci, variant->id_reg, &val, &ret);
if (ret) {
dev_err(&client->dev,
@@ -1086,9 +1125,9 @@ static int starvis2_identify_model(struc
return ret;
}
- if (val != IMX678_ID) {
- dev_err(&client->dev,
- "Chip ID mismatch: %x!=%llx\n", IMX678_ID, val);
+ if (val != variant->id_value) {
+ dev_err(&client->dev, "Chip ID mismatch: %x!=%llx\n",
+ variant->id_value, val);
return -ENXIO;
}
@@ -1103,7 +1142,7 @@ static int starvis2_identify_model(struc
detected = val & STARVIS2_TYPE;
/* Prefer to use sensor type specified in device tree */
- if (info) {
+ if (info->codes) {
starvis2->info = info;
if (detected != info->type)
dev_err(&client->dev,
@@ -1112,11 +1151,12 @@ static int starvis2_identify_model(struc
info->type == STARVIS2_COLOR ? "color" : "mono");
} else {
starvis2->info = detected == STARVIS2_MONOCHROME ?
- &imx678_aamr_info : &imx678_aaqr_info;
+ info->auto_detect_mono : info->auto_detect_colour;
dev_info(&client->dev,
"sensor type missing in DT; detected %s sensor\n",
detected == STARVIS2_MONOCHROME ? "mono" : "color");
}
+ starvis2->variant = starvis2->info->variant;
return 0;
}
@@ -1148,7 +1188,7 @@ static int starvis2_init_controls(struct
{
struct v4l2_ctrl_handler *ctrl_hdlr;
const u32 hmax_4lane =
- min_hmax_4lane[__fls(starvis2->link_freq_bitmap)];
+ starvis2->variant->hmax_min[__fls(starvis2->link_freq_bitmap)];
const u32 lane_scale =
starvis2->lane_mode == STARVIS2_LANEMODE_2L ? 2 : 1;
struct i2c_client *client = v4l2_get_subdevdata(&starvis2->sd);
@@ -1167,13 +1207,14 @@ static int starvis2_init_controls(struct
if (ret)
return ret;
- starvis2->vmax = IMX678_VMAX_DEFAULT;
+ starvis2->vmax = starvis2->variant->vmax_default;
hmax = hmax_4lane * lane_scale;
/* PIXEL_RATE is fixed and read-only */
v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops, V4L2_CID_PIXEL_RATE,
- IMX678_PIXEL_RATE, IMX678_PIXEL_RATE, 1,
- IMX678_PIXEL_RATE);
+ starvis2->variant->pixel_rate,
+ starvis2->variant->pixel_rate, 1,
+ starvis2->variant->pixel_rate);
/* LINK_FREQ is also read only */
link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr, &starvis2_ctrl_ops,
@@ -1185,23 +1226,25 @@ static int starvis2_init_controls(struct
if (link_freq)
link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
- vblank = starvis2->vmax - imx678_active_area.height;
- max_vblank = STARVIS2_VMAX_MAX - imx678_active_area.height;
+ vblank = starvis2->vmax - starvis2->variant->active_area.height;
+ max_vblank = STARVIS2_VMAX_MAX - starvis2->variant->active_area.height;
starvis2->vblank = v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops,
V4L2_CID_VBLANK, vblank, max_vblank,
2, vblank);
- hblank = hmax * IMX678_PIX_PER_CLK - imx678_active_area.width;
- max_hblank = STARVIS2_HMAX_MAX * IMX678_PIX_PER_CLK -
- imx678_active_area.width;
+ hblank = hmax * starvis2->variant->pix_per_clk -
+ starvis2->variant->active_area.width;
+ max_hblank = STARVIS2_HMAX_MAX * starvis2->variant->pix_per_clk -
+ starvis2->variant->active_area.width;
starvis2->hblank = v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops,
V4L2_CID_HBLANK, hblank, max_hblank,
- IMX678_PIX_PER_CLK, hblank);
+ starvis2->variant->pix_per_clk,
+ hblank);
starvis2->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops,
V4L2_CID_EXPOSURE,
STARVIS2_EXPOSURE_MIN,
- IMX678_VMAX_DEFAULT -
+ starvis2->variant->vmax_default -
STARVIS2_SHR_MIN,
STARVIS2_EXPOSURE_STEP,
STARVIS2_EXPOSURE_DEFAULT);
@@ -1342,6 +1385,9 @@ static int starvis2_probe(struct i2c_cli
if (ret)
goto error_power_off;
+ v4l2_i2c_subdev_set_name(&starvis2->sd, client, starvis2->variant->name,
+ NULL);
+
pm_runtime_set_active(dev);
pm_runtime_enable(dev);
@@ -1422,7 +1468,7 @@ static const struct of_device_id starvis
{ .compatible = "sony,imx678-aamr", .data = &imx678_aamr_info },
{ .compatible = "sony,imx678-aaqr", .data = &imx678_aaqr_info },
/* for non-conforming DTs that rely on runtime check */
- { .compatible = "sony,imx678" },
+ { .compatible = "sony,imx678", .data = &imx678_autodetect_info },
{ /* sentinel */ }
};
@@ -0,0 +1,92 @@
From 688ba635b44e0eca30719469b0cbcf1149d52e47 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 10 Sep 2026 12:29:40 +0100
Subject: [PATCH] media: sony-starvis2: Rework 2 lane support for higher link
freqs
With some Starvis 2 sensors, the link frequency on 2 lanes is sufficient
to achieve a lower line time than the 4 lane divided by 2, effectively
that it hits the minimum that the pixel array can handle.
That can't easily be handled with the way the values are currently stored.
Storing the 2 lane hmax alongside the pixel array's minimum allows the
4 lane support to divide the value by 2, and then clip to the pixel
array value as a minimum.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/sony-starvis2.c | 34 ++++++++++++++++---------------
1 file changed, 18 insertions(+), 16 deletions(-)
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -177,15 +177,15 @@ static const u64 link_freqs[] = {
[STARVIS2_LINK_FREQ_1188MHZ] = 1188000000,
};
-static const u16 imx678_min_hmax_4lane[] = {
- [STARVIS2_LINK_FREQ_297MHZ] = 1584,
- [STARVIS2_LINK_FREQ_360MHZ] = 1320,
- [STARVIS2_LINK_FREQ_445MHZ] = 1100,
- [STARVIS2_LINK_FREQ_594MHZ] = 792,
- [STARVIS2_LINK_FREQ_720MHZ] = 660,
- [STARVIS2_LINK_FREQ_891MHZ] = 550,
- [STARVIS2_LINK_FREQ_1039MHZ] = 550,
- [STARVIS2_LINK_FREQ_1188MHZ] = 550,
+static const u16 imx678_min_hmax_2lane[] = {
+ [STARVIS2_LINK_FREQ_297MHZ] = 3168,
+ [STARVIS2_LINK_FREQ_360MHZ] = 2640,
+ [STARVIS2_LINK_FREQ_445MHZ] = 2200,
+ [STARVIS2_LINK_FREQ_594MHZ] = 1584,
+ [STARVIS2_LINK_FREQ_720MHZ] = 1320,
+ [STARVIS2_LINK_FREQ_891MHZ] = 1100,
+ [STARVIS2_LINK_FREQ_1039MHZ] = 1100,
+ [STARVIS2_LINK_FREQ_1188MHZ] = 1100,
};
struct starvis2_inck_cfg {
@@ -631,7 +631,8 @@ struct starvis2_variant {
const struct cci_reg_sequence *common_regs;
unsigned int num_common_regs;
unsigned int vmax_default;
- const u16 *hmax_min;
+ const u16 *hmax_min_link_freq;
+ u16 hmax_min_pixel_array;
};
const struct starvis2_variant imx678_variant_def = {
@@ -655,7 +656,8 @@ const struct starvis2_variant imx678_var
.common_regs = imx678_common_regs,
.num_common_regs = ARRAY_SIZE(imx678_common_regs),
.vmax_default = 2250,
- .hmax_min = imx678_min_hmax_4lane,
+ .hmax_min_link_freq = imx678_min_hmax_2lane,
+ .hmax_min_pixel_array = 550,
};
struct starvis2_model_info {
@@ -1187,11 +1189,8 @@ static const struct v4l2_subdev_internal
static int starvis2_init_controls(struct starvis2 *starvis2)
{
struct v4l2_ctrl_handler *ctrl_hdlr;
- const u32 hmax_4lane =
- starvis2->variant->hmax_min[__fls(starvis2->link_freq_bitmap)];
- const u32 lane_scale =
- starvis2->lane_mode == STARVIS2_LANEMODE_2L ? 2 : 1;
struct i2c_client *client = v4l2_get_subdevdata(&starvis2->sd);
+ const struct starvis2_variant *variant = starvis2->variant;
struct v4l2_fwnode_device_properties props;
struct v4l2_ctrl *link_freq;
s32 hblank, max_hblank, vblank, max_vblank;
@@ -1208,7 +1207,10 @@ static int starvis2_init_controls(struct
return ret;
starvis2->vmax = starvis2->variant->vmax_default;
- hmax = hmax_4lane * lane_scale;
+
+ hmax = variant->hmax_min_link_freq[__fls(starvis2->link_freq_bitmap)];
+ if (starvis2->lane_mode == STARVIS2_LANEMODE_4L)
+ hmax = max(hmax >> 1, variant->hmax_min_pixel_array);
/* PIXEL_RATE is fixed and read-only */
v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops, V4L2_CID_PIXEL_RATE,
@@ -0,0 +1,156 @@
From 127240b80281c0b379cff7eb1c6b24b3794cbbab Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 10 Sep 2026 12:49:22 +0100
Subject: [PATCH] media: sony-starvis2: Allow runtime control of link frequency
DT allows configuration of multiple link frequencies.
V4L2_CID_LINK_FREQ allows read write control.
Join these up so that link frequency can be configured at run time,
as long, as the sensor isn't streaming.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/sony-starvis2.c | 62 ++++++++++++++++++++++---------
1 file changed, 45 insertions(+), 17 deletions(-)
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -723,6 +723,7 @@ struct starvis2 {
struct v4l2_ctrl *exposure;
struct v4l2_ctrl *vblank;
struct v4l2_ctrl *hblank;
+ struct v4l2_ctrl *link_freq;
/* Track VMAX for exposure updates */
u32 vmax;
@@ -753,6 +754,7 @@ static int starvis2_set_ctrl(struct v4l2
struct starvis2 *starvis2 = container_of_const(ctrl->handler, struct
starvis2, ctrl_handler);
struct i2c_client *client = v4l2_get_subdevdata(&starvis2->sd);
+ const struct starvis2_variant *variant = starvis2->variant;
const struct v4l2_mbus_framefmt *format;
struct v4l2_subdev_state *state;
int ret = 0;
@@ -776,6 +778,25 @@ static int starvis2_set_ctrl(struct v4l2
return ret;
}
+ if (ctrl->id == V4L2_CID_LINK_FREQ) {
+ u32 hmax = variant->hmax_min_link_freq[ctrl->val];
+ s32 hblank;
+
+ if (starvis2->lane_mode == STARVIS2_LANEMODE_4L)
+ hmax = max(hmax >> 1, variant->hmax_min_pixel_array);
+
+ hblank = hmax * variant->pix_per_clk -
+ variant->active_area.width;
+
+ ret = __v4l2_ctrl_modify_range(starvis2->hblank,
+ hblank,
+ starvis2->hblank->maximum,
+ starvis2->hblank->step,
+ hblank);
+ if (ret)
+ return ret;
+ }
+
/*
* Only apply control values when device is powered on (RPM ACTIVE)
* and streaming (usage count != 0)
@@ -822,6 +843,12 @@ static int starvis2_set_ctrl(struct v4l2
cci_write(starvis2->cci, STARVIS2_REG_WINMODEV, ctrl->val,
&ret);
break;
+ case V4L2_CID_LINK_FREQ:
+ /* The STARVIS2_LINK_FREQ_ enums match up with the register */
+ cci_write(starvis2->cci, STARVIS2_REG_DATARATE_SEL, ctrl->val,
+ &ret);
+ break;
+
default:
dev_warn(&client->dev,
"ctrl(id:0x%x,val:0x%x) is not handled\n",
@@ -935,9 +962,6 @@ static int starvis2_write_common(struct
cci_write(starvis2->cci, STARVIS2_REG_INCK_SEL, starvis2->inck_sel_val,
&ret);
- cci_write(starvis2->cci, STARVIS2_REG_DATARATE_SEL,
- __fls(starvis2->link_freq_bitmap),
- &ret);
cci_write(starvis2->cci, STARVIS2_REG_LANEMODE, starvis2->lane_mode,
&ret);
@@ -1004,6 +1028,7 @@ static int starvis2_enable_streams(struc
goto err_rpm_put;
}
+ __v4l2_ctrl_grab(starvis2->link_freq, true);
return 0;
err_rpm_put:
@@ -1028,6 +1053,8 @@ static int starvis2_disable_streams(stru
if (ret)
dev_err(&client->dev, "%s failed to stop stream\n", __func__);
+ __v4l2_ctrl_grab(starvis2->link_freq, false);
+
pm_runtime_put(&client->dev);
return ret;
@@ -1192,7 +1219,6 @@ static int starvis2_init_controls(struct
struct i2c_client *client = v4l2_get_subdevdata(&starvis2->sd);
const struct starvis2_variant *variant = starvis2->variant;
struct v4l2_fwnode_device_properties props;
- struct v4l2_ctrl *link_freq;
s32 hblank, max_hblank, vblank, max_vblank;
u32 hmax;
int ret;
@@ -1208,25 +1234,23 @@ static int starvis2_init_controls(struct
starvis2->vmax = starvis2->variant->vmax_default;
- hmax = variant->hmax_min_link_freq[__fls(starvis2->link_freq_bitmap)];
- if (starvis2->lane_mode == STARVIS2_LANEMODE_4L)
- hmax = max(hmax >> 1, variant->hmax_min_pixel_array);
-
/* PIXEL_RATE is fixed and read-only */
v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops, V4L2_CID_PIXEL_RATE,
starvis2->variant->pixel_rate,
starvis2->variant->pixel_rate, 1,
starvis2->variant->pixel_rate);
- /* LINK_FREQ is also read only */
- link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr, &starvis2_ctrl_ops,
- V4L2_CID_LINK_FREQ,
- ARRAY_SIZE(link_freqs) - 1,
- __ffs(starvis2->link_freq_bitmap),
- link_freqs);
-
- if (link_freq)
- link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
+ starvis2->link_freq =
+ v4l2_ctrl_new_int_menu(ctrl_hdlr, &starvis2_ctrl_ops,
+ V4L2_CID_LINK_FREQ,
+ __fls(starvis2->link_freq_bitmap),
+ __ffs(starvis2->link_freq_bitmap),
+ link_freqs);
+ __v4l2_ctrl_modify_range(starvis2->link_freq,
+ __ffs(starvis2->link_freq_bitmap),
+ __fls(starvis2->link_freq_bitmap),
+ ~(starvis2->link_freq_bitmap),
+ __ffs(starvis2->link_freq_bitmap));
vblank = starvis2->vmax - starvis2->variant->active_area.height;
max_vblank = STARVIS2_VMAX_MAX - starvis2->variant->active_area.height;
@@ -1234,6 +1258,10 @@ static int starvis2_init_controls(struct
V4L2_CID_VBLANK, vblank, max_vblank,
2, vblank);
+ hmax = variant->hmax_min_link_freq[starvis2->link_freq->val];
+ if (starvis2->lane_mode == STARVIS2_LANEMODE_4L)
+ hmax = max(hmax >> 1, variant->hmax_min_pixel_array);
+
hblank = hmax * starvis2->variant->pix_per_clk -
starvis2->variant->active_area.width;
max_hblank = STARVIS2_HMAX_MAX * starvis2->variant->pix_per_clk -
@@ -0,0 +1,136 @@
From 024ba8f80a8d7ae8902571e97d64631c6cb27fea Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 17 Sep 2026 16:15:39 +0100
Subject: [PATCH] media: sony-starvis2: Add a mechanism for detection of
Starvis2 variant
As we have a way to confirm which Starvis2 module is connected, add
a generic compatible that will use all defined variants to attempt to
identify which module is connected.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/sony-starvis2.c | 61 ++++++++++++++++++++++---------
1 file changed, 43 insertions(+), 18 deletions(-)
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -94,7 +94,6 @@
/* Sensor Identification */
#define STARVIS2_REG_MONOCHROME CCI_REG8(0x4d18)
#define STARVIS2_TYPE BIT(0)
-#define STARVIS2_REG_MODULE_ID CCI_REG16_LE(0x4d1c)
#define IMX678_MODULE_ID_DELAY 80000
/* Common configuration registers */
@@ -623,6 +622,7 @@ static const u32 codes_monochrome[] = {
struct starvis2_variant {
const char *name;
u32 id_reg;
+ u32 id_mask;
u32 id_value;
struct v4l2_rect native_area;
struct v4l2_rect active_area;
@@ -637,7 +637,8 @@ struct starvis2_variant {
const struct starvis2_variant imx678_variant_def = {
.name = "imx678",
- .id_reg = STARVIS2_REG_MODULE_ID,
+ .id_reg = CCI_REG16_LE(0x4d1c),
+ .id_mask = 0x3ff,
.id_value = 0x2a6,
.native_area = {
.top = 0,
@@ -690,6 +691,10 @@ static const struct starvis2_model_info
.auto_detect_mono = &imx678_aamr_info,
};
+static const struct starvis2_model_info *starvis2_all_model_autodetect[] = {
+ &imx678_autodetect_info,
+};
+
static const char * const starvis2_supply_name[] = {
"avdd", /* Analog (3.3V) supply */
"dvdd", /* Digital Core (1.1V) supply */
@@ -1134,10 +1139,6 @@ static int starvis2_identify_model(struc
u64 val = 0;
info = device_get_match_data(&client->dev);
- if (!info)
- return -EINVAL;
-
- variant = info->variant;
/*
* This sensor's ID registers become accessible 80ms after coming out
@@ -1146,18 +1147,40 @@ static int starvis2_identify_model(struc
cci_write(starvis2->cci, STARVIS2_REG_MODE_SELECT, 0, &ret);
fsleep(IMX678_MODULE_ID_DELAY);
- cci_read(starvis2->cci, variant->id_reg, &val, &ret);
+ if (!info) {
+ /* Generic "sony,starvis2" - identify the module */
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(starvis2_all_model_autodetect); i++) {
+ variant = starvis2_all_model_autodetect[i]->variant;
+
+ cci_read(starvis2->cci, variant->id_reg, &val, &ret);
+ if ((val & variant->id_mask) == variant->id_value) {
+ info = starvis2_all_model_autodetect[i];
+ break;
+ }
+ }
- if (ret) {
- dev_err(&client->dev,
- "I2C transaction failed ret = %d\n", ret);
- return ret;
- }
+ if (!info) {
+ dev_err(&client->dev, "No Starvis2 camera found\n");
+ return -ENXIO;
+ }
+ } else {
+ variant = info->variant;
- if (val != variant->id_value) {
- dev_err(&client->dev, "Chip ID mismatch: %x!=%llx\n",
- variant->id_value, val);
- return -ENXIO;
+ cci_read(starvis2->cci, variant->id_reg, &val, &ret);
+
+ if (ret) {
+ dev_err(&client->dev,
+ "I2C transaction failed ret = %d\n", ret);
+ return ret;
+ }
+
+ if (val != variant->id_value) {
+ dev_err(&client->dev, "Chip ID mismatch: %x!=%llx\n",
+ variant->id_value, val);
+ return -ENXIO;
+ }
}
cci_read(starvis2->cci, STARVIS2_REG_MONOCHROME, &val, &ret);
@@ -1182,8 +1205,9 @@ static int starvis2_identify_model(struc
starvis2->info = detected == STARVIS2_MONOCHROME ?
info->auto_detect_mono : info->auto_detect_colour;
dev_info(&client->dev,
- "sensor type missing in DT; detected %s sensor\n",
- detected == STARVIS2_MONOCHROME ? "mono" : "color");
+ "sensor type not specified in DT; detected %s %s sensor\n",
+ detected == STARVIS2_MONOCHROME ? "mono" : "color",
+ info->variant->name);
}
starvis2->variant = starvis2->info->variant;
@@ -1499,6 +1523,7 @@ static const struct of_device_id starvis
{ .compatible = "sony,imx678-aaqr", .data = &imx678_aaqr_info },
/* for non-conforming DTs that rely on runtime check */
{ .compatible = "sony,imx678", .data = &imx678_autodetect_info },
+ { .compatible = "sony,starvis2", .data = NULL },
{ /* sentinel */ }
};
@@ -0,0 +1,205 @@
From a861d10f718c202499cafe2cbaad3ac66fcc4fa1 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 3 Sep 2026 17:30:49 +0100
Subject: [PATCH] media: sony-starvis2: Add support for IMX662
IMX662 is a 1080p Starvis 2 sensor that follows the same programming
pattern as IMX678, so add it to the newly parameterised common
driver.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/sony-starvis2.c | 158 +++++++++++++++++++++++++++++-
1 file changed, 157 insertions(+), 1 deletion(-)
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -8,7 +8,9 @@
* Currently supported are:
* IMX678: Diagonal 8.86 mm (Type 1/1.8) CMOS image sensor with 8.40 M effective
* pixels.
- *
+ * IMX662: Diagonal 6.45mm (Type 1/2.8) CMOS image sensor with 2.12 M effective
+ * pixels.
+
* Copyright (C) 2026 Ideas On Board Oy.
*
* Based on Sony IMX678 driver prepared by Will Whang & Soho Enterprise Ltd.
@@ -661,6 +663,136 @@ const struct starvis2_variant imx678_var
.hmax_min_pixel_array = 550,
};
+static const struct cci_reg_sequence imx662_common_regs[] = {
+ { CCI_REG8(0x3444), 0xac },
+ { CCI_REG8(0x3492), 0x08 },
+ { CCI_REG8(0x3b00), 0x39 },
+ { CCI_REG8(0x3b23), 0x2d },
+ { CCI_REG8(0x3b45), 0x04 },
+ { CCI_REG8(0x3c0a), 0x1f },
+ { CCI_REG8(0x3c0b), 0x1e },
+ { CCI_REG8(0x3c38), 0x21 },
+ { CCI_REG8(0x3c44), 0x00 },
+ { CCI_REG8(0x3cb6), 0xd8 },
+ { CCI_REG8(0x3cc4), 0xda },
+ { CCI_REG8(0x3e24), 0x79 },
+ { CCI_REG8(0x3e2c), 0x15 },
+ { CCI_REG8(0x3edc), 0x2d },
+ { CCI_REG8(0x4498), 0x05 },
+ { CCI_REG8(0x449c), 0x19 },
+ { CCI_REG8(0x449d), 0x00 },
+ { CCI_REG8(0x449e), 0x32 },
+ { CCI_REG8(0x449f), 0x01 },
+ { CCI_REG8(0x44a0), 0x92 },
+ { CCI_REG8(0x44a2), 0x91 },
+ { CCI_REG8(0x44a4), 0x8c },
+ { CCI_REG8(0x44a6), 0x87 },
+ { CCI_REG8(0x44a8), 0x82 },
+ { CCI_REG8(0x44aa), 0x78 },
+ { CCI_REG8(0x44ac), 0x6e },
+ { CCI_REG8(0x44ae), 0x69 },
+ { CCI_REG8(0x44b0), 0x92 },
+ { CCI_REG8(0x44b2), 0x91 },
+ { CCI_REG8(0x44b4), 0x8c },
+ { CCI_REG8(0x44b6), 0x87 },
+ { CCI_REG8(0x44b8), 0x82 },
+ { CCI_REG8(0x44ba), 0x78 },
+ { CCI_REG8(0x44bc), 0x6e },
+ { CCI_REG8(0x44be), 0x69 },
+ { CCI_REG8(0x44c0), 0x7f },
+ { CCI_REG8(0x44c1), 0x01 },
+ { CCI_REG8(0x44c2), 0x7f },
+ { CCI_REG8(0x44c3), 0x01 },
+ { CCI_REG8(0x44c4), 0x7a },
+ { CCI_REG8(0x44c5), 0x01 },
+ { CCI_REG8(0x44c6), 0x7a },
+ { CCI_REG8(0x44c7), 0x01 },
+ { CCI_REG8(0x44c8), 0x70 },
+ { CCI_REG8(0x44c9), 0x01 },
+ { CCI_REG8(0x44ca), 0x6b },
+ { CCI_REG8(0x44cb), 0x01 },
+ { CCI_REG8(0x44cc), 0x6b },
+ { CCI_REG8(0x44cd), 0x01 },
+ { CCI_REG8(0x44ce), 0x5c },
+ { CCI_REG8(0x44cf), 0x01 },
+ { CCI_REG8(0x44d0), 0x7f },
+ { CCI_REG8(0x44d1), 0x01 },
+ { CCI_REG8(0x44d2), 0x7f },
+ { CCI_REG8(0x44d3), 0x01 },
+ { CCI_REG8(0x44d4), 0x7a },
+ { CCI_REG8(0x44d5), 0x01 },
+ { CCI_REG8(0x44d6), 0x7a },
+ { CCI_REG8(0x44d7), 0x01 },
+ { CCI_REG8(0x44d8), 0x70 },
+ { CCI_REG8(0x44d9), 0x01 },
+ { CCI_REG8(0x44da), 0x6b },
+ { CCI_REG8(0x44db), 0x01 },
+ { CCI_REG8(0x44dc), 0x6b },
+ { CCI_REG8(0x44dd), 0x01 },
+ { CCI_REG8(0x44de), 0x5c },
+ { CCI_REG8(0x44df), 0x01 },
+ { CCI_REG8(0x4534), 0x1c },
+ { CCI_REG8(0x4535), 0x03 },
+ { CCI_REG8(0x4538), 0x1c },
+ { CCI_REG8(0x4539), 0x1c },
+ { CCI_REG8(0x453a), 0x1c },
+ { CCI_REG8(0x453b), 0x1c },
+ { CCI_REG8(0x453c), 0x1c },
+ { CCI_REG8(0x453d), 0x1c },
+ { CCI_REG8(0x453e), 0x1c },
+ { CCI_REG8(0x453f), 0x1c },
+ { CCI_REG8(0x4540), 0x1c },
+ { CCI_REG8(0x4541), 0x03 },
+ { CCI_REG8(0x4542), 0x03 },
+ { CCI_REG8(0x4543), 0x03 },
+ { CCI_REG8(0x4544), 0x03 },
+ { CCI_REG8(0x4545), 0x03 },
+ { CCI_REG8(0x4546), 0x03 },
+ { CCI_REG8(0x4547), 0x03 },
+ { CCI_REG8(0x4548), 0x03 },
+ { CCI_REG8(0x4549), 0x03 },
+ { STARVIS2_REG_WDMODE, 0x00 },
+ { STARVIS2_REG_MDBIT, 0x01 },
+ { STARVIS2_REG_XXS_DRV, 0x00 },
+};
+
+static const u16 imx662_min_hmax_2lane[] = {
+ [STARVIS2_LINK_FREQ_297MHZ] = 1980,
+ [STARVIS2_LINK_FREQ_360MHZ] = 1980,
+ [STARVIS2_LINK_FREQ_445MHZ] = 1188,
+ [STARVIS2_LINK_FREQ_594MHZ] = 990,
+ [STARVIS2_LINK_FREQ_720MHZ] = 990,
+ [STARVIS2_LINK_FREQ_891MHZ] = 990,
+ [STARVIS2_LINK_FREQ_1039MHZ] = 990,
+ [STARVIS2_LINK_FREQ_1188MHZ] = 990,
+};
+
+const struct starvis2_variant imx662_variant_def = {
+ .name = "imx662",
+ .id_reg = CCI_REG16_LE(0x4d1c),
+ .id_mask = 0x3ff,
+ .id_value = 0x296,
+ .native_area = {
+ .top = 0,
+ .left = 0,
+ .width = 1937,
+ .height = 1101,
+ },
+ .active_area = {
+ .top = 0,
+ .left = 0,
+ .width = 1936,
+ .height = 1096,
+ },
+ .pixel_rate = 222750000,
+ .pix_per_clk = 3,
+ .common_regs = imx662_common_regs,
+ .num_common_regs = ARRAY_SIZE(imx662_common_regs),
+ .vmax_default = 1136,
+ .hmax_min_link_freq = imx662_min_hmax_2lane,
+ .hmax_min_pixel_array = 990,
+};
+
struct starvis2_model_info {
enum starvis2_type type;
const u32 *codes;
@@ -691,7 +823,28 @@ static const struct starvis2_model_info
.auto_detect_mono = &imx678_aamr_info,
};
+static const struct starvis2_model_info imx662_aaqr_info = {
+ .type = STARVIS2_COLOR,
+ .codes = codes_bayer,
+ .num_codes = ARRAY_SIZE(codes_bayer),
+ .variant = &imx662_variant_def,
+};
+
+static const struct starvis2_model_info imx662_aamr_info = {
+ .type = STARVIS2_MONOCHROME,
+ .codes = codes_monochrome,
+ .num_codes = ARRAY_SIZE(codes_monochrome),
+ .variant = &imx662_variant_def,
+};
+
+static const struct starvis2_model_info imx662_autodetect_info = {
+ .variant = &imx662_variant_def,
+ .auto_detect_colour = &imx662_aaqr_info,
+ .auto_detect_mono = &imx662_aamr_info,
+};
+
static const struct starvis2_model_info *starvis2_all_model_autodetect[] = {
+ &imx662_autodetect_info,
&imx678_autodetect_info,
};
@@ -1521,8 +1674,11 @@ static const struct dev_pm_ops starvis2_
static const struct of_device_id starvis2_of_match[] = {
{ .compatible = "sony,imx678-aamr", .data = &imx678_aamr_info },
{ .compatible = "sony,imx678-aaqr", .data = &imx678_aaqr_info },
+ { .compatible = "sony,imx662-aamr", .data = &imx662_aamr_info },
+ { .compatible = "sony,imx662-aaqr", .data = &imx662_aaqr_info },
/* for non-conforming DTs that rely on runtime check */
{ .compatible = "sony,imx678", .data = &imx678_autodetect_info },
+ { .compatible = "sony,imx662", .data = &imx662_autodetect_info },
{ .compatible = "sony,starvis2", .data = NULL },
{ /* sentinel */ }
};
@@ -0,0 +1,268 @@
From 09e54410fb99b3b0d912b23a1a8836c0fbfbfed0 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 3 Sep 2026 17:49:44 +0100
Subject: [PATCH] media: sony-starvis2: Add support for IMX675
The IMX675 is a 5MPix Starvis2 sensor that follows the same
programming pattern as IMX678 and IMX662, so add it into the
driver.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/sony-starvis2.c | 219 +++++++++++++++++++++++++++++-
1 file changed, 218 insertions(+), 1 deletion(-)
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -10,7 +10,9 @@
* pixels.
* IMX662: Diagonal 6.45mm (Type 1/2.8) CMOS image sensor with 2.12 M effective
* pixels.
-
+ * IMX675: Diagonal 6.53mm (Type 1/2.8) CMOS image sensor with 5.12 M effective
+ * pixels.
+ *
* Copyright (C) 2026 Ideas On Board Oy.
*
* Based on Sony IMX678 driver prepared by Will Whang & Soho Enterprise Ltd.
@@ -793,6 +795,193 @@ const struct starvis2_variant imx662_var
.hmax_min_pixel_array = 990,
};
+static const struct cci_reg_sequence imx675_common_regs[] = {
+ { STARVIS2_REG_THIN_V_EN, 0x00 },
+ { STARVIS2_REG_VCMODE, 0x01 },
+
+ { CCI_REG8(0x3081), 0x00 },
+ { STARVIS2_REG_XXS_OUTSEL, 0xaa },
+ { STARVIS2_REG_XXS_DRV, 0x0f },
+ { CCI_REG8(0x30cc), 0x00 },
+ { CCI_REG8(0x30cd), 0x00 },
+ { CCI_REG8(0x30ce), 0x02 },
+ { CCI_REG8(0x3400), 0x01 },
+
+ { CCI_REG8(0x3460), 0x22 },
+ { CCI_REG8(0x347b), 0x02 },
+ { CCI_REG8(0x3492), 0x08 },
+ { CCI_REG8(0x3b1d), 0x17 },
+ { CCI_REG8(0x3b44), 0x3f },
+ { CCI_REG8(0x3b60), 0x03 },
+ { CCI_REG8(0x3c03), 0x04 },
+ { CCI_REG8(0x3c04), 0x04 },
+ { CCI_REG8(0x3c0a), 0x1f },
+ { CCI_REG8(0x3c0b), 0x1f },
+ { CCI_REG8(0x3c0c), 0x1f },
+ { CCI_REG8(0x3c0d), 0x1f },
+ { CCI_REG8(0x3c0e), 0x1f },
+ { CCI_REG8(0x3c0f), 0x1f },
+ { CCI_REG8(0x3c30), 0x73 },
+ { CCI_REG8(0x3c3c), 0x20 },
+ { CCI_REG8(0x3c44), 0x06 },
+ { CCI_REG8(0x3c7c), 0xb9 },
+ { CCI_REG8(0x3c7d), 0x01 },
+ { CCI_REG8(0x3c7e), 0xb7 },
+ { CCI_REG8(0x3c7f), 0x01 },
+ { CCI_REG8(0x3cb0), 0x00 },
+ { CCI_REG8(0x3cb2), 0xff },
+ { CCI_REG8(0x3cb3), 0x03 },
+ { CCI_REG8(0x3cb4), 0xff },
+ { CCI_REG8(0x3cb5), 0x03 },
+ { CCI_REG8(0x3cba), 0xff },
+ { CCI_REG8(0x3cbb), 0x03 },
+ { CCI_REG8(0x3cc0), 0xff },
+ { CCI_REG8(0x3cc1), 0x03 },
+ { CCI_REG8(0x3cc2), 0x00 },
+ { CCI_REG8(0x3cc6), 0xff },
+ { CCI_REG8(0x3cc7), 0x03 },
+ { CCI_REG8(0x3cc8), 0xff },
+ { CCI_REG8(0x3cc9), 0x03 },
+ { CCI_REG8(0x3e00), 0x1e },
+ { CCI_REG8(0x3e02), 0x04 },
+ { CCI_REG8(0x3e03), 0x00 },
+ { CCI_REG8(0x3e20), 0x04 },
+ { CCI_REG8(0x3e21), 0x00 },
+ { CCI_REG8(0x3e22), 0x1e },
+ { CCI_REG8(0x3e24), 0xba },
+ { CCI_REG8(0x3e72), 0x85 },
+ { CCI_REG8(0x3e76), 0x0c },
+ { CCI_REG8(0x3e77), 0x01 },
+ { CCI_REG8(0x3e7a), 0x85 },
+ { CCI_REG8(0x3e7e), 0x1f },
+ { CCI_REG8(0x3e82), 0xa6 },
+ { CCI_REG8(0x3e86), 0x2d },
+ { CCI_REG8(0x3ee2), 0x33 },
+ { CCI_REG8(0x3ee3), 0x03 },
+ { CCI_REG8(0x4490), 0x07 },
+ { CCI_REG8(0x4494), 0x19 },
+ { CCI_REG8(0x4495), 0x00 },
+ { CCI_REG8(0x4496), 0xbb },
+ { CCI_REG8(0x4497), 0x00 },
+ { CCI_REG8(0x4498), 0x55 },
+ { CCI_REG8(0x449a), 0x50 },
+ { CCI_REG8(0x449c), 0x50 },
+ { CCI_REG8(0x449e), 0x50 },
+ { CCI_REG8(0x44a0), 0x3c },
+ { CCI_REG8(0x44a2), 0x19 },
+ { CCI_REG8(0x44a4), 0x19 },
+ { CCI_REG8(0x44a6), 0x19 },
+ { CCI_REG8(0x44a8), 0x4b },
+ { CCI_REG8(0x44aa), 0x4b },
+ { CCI_REG8(0x44ac), 0x4b },
+ { CCI_REG8(0x44ae), 0x4b },
+ { CCI_REG8(0x44b0), 0x3c },
+ { CCI_REG8(0x44b2), 0x19 },
+ { CCI_REG8(0x44b4), 0x19 },
+ { CCI_REG8(0x44b6), 0x19 },
+ { CCI_REG8(0x44b8), 0x4b },
+ { CCI_REG8(0x44ba), 0x4b },
+ { CCI_REG8(0x44bc), 0x4b },
+ { CCI_REG8(0x44be), 0x4b },
+ { CCI_REG8(0x44c0), 0x3c },
+ { CCI_REG8(0x44c2), 0x19 },
+ { CCI_REG8(0x44c4), 0x19 },
+ { CCI_REG8(0x44c6), 0x19 },
+ { CCI_REG8(0x44c8), 0xf0 },
+ { CCI_REG8(0x44ca), 0xeb },
+ { CCI_REG8(0x44cc), 0xeb },
+ { CCI_REG8(0x44ce), 0xe6 },
+ { CCI_REG8(0x44d0), 0xe6 },
+ { CCI_REG8(0x44d2), 0xbb },
+ { CCI_REG8(0x44d4), 0xbb },
+ { CCI_REG8(0x44d6), 0xbb },
+ { CCI_REG8(0x44d8), 0xe6 },
+ { CCI_REG8(0x44da), 0xe6 },
+ { CCI_REG8(0x44dc), 0xe6 },
+ { CCI_REG8(0x44de), 0xe6 },
+ { CCI_REG8(0x44e0), 0xe6 },
+ { CCI_REG8(0x44e2), 0xbb },
+ { CCI_REG8(0x44e4), 0xbb },
+ { CCI_REG8(0x44e6), 0xbb },
+ { CCI_REG8(0x44e8), 0xe6 },
+ { CCI_REG8(0x44ea), 0xe6 },
+ { CCI_REG8(0x44ec), 0xe6 },
+ { CCI_REG8(0x44ee), 0xe6 },
+ { CCI_REG8(0x44f0), 0xe6 },
+ { CCI_REG8(0x44f2), 0xbb },
+ { CCI_REG8(0x44f4), 0xbb },
+ { CCI_REG8(0x44f6), 0xbb },
+ { CCI_REG8(0x4538), 0x15 },
+ { CCI_REG8(0x4539), 0x15 },
+ { CCI_REG8(0x453a), 0x15 },
+ { CCI_REG8(0x4544), 0x15 },
+ { CCI_REG8(0x4545), 0x15 },
+ { CCI_REG8(0x4546), 0x15 },
+ { CCI_REG8(0x4550), 0x10 },
+ { CCI_REG8(0x4551), 0x10 },
+ { CCI_REG8(0x4552), 0x10 },
+ { CCI_REG8(0x4553), 0x10 },
+ { CCI_REG8(0x4554), 0x10 },
+ { CCI_REG8(0x4555), 0x10 },
+ { CCI_REG8(0x4556), 0x10 },
+ { CCI_REG8(0x4557), 0x10 },
+ { CCI_REG8(0x4558), 0x10 },
+ { CCI_REG8(0x455c), 0x10 },
+ { CCI_REG8(0x455d), 0x10 },
+ { CCI_REG8(0x455e), 0x10 },
+ { CCI_REG8(0x455f), 0x10 },
+ { CCI_REG8(0x4560), 0x10 },
+ { CCI_REG8(0x4561), 0x10 },
+ { CCI_REG8(0x4562), 0x10 },
+ { CCI_REG8(0x4563), 0x10 },
+ { CCI_REG8(0x4564), 0x10 },
+ { CCI_REG8(0x4569), 0x01 },
+ { CCI_REG8(0x456a), 0x01 },
+ { CCI_REG8(0x456b), 0x06 },
+ { CCI_REG8(0x456c), 0x06 },
+ { CCI_REG8(0x456d), 0x06 },
+ { CCI_REG8(0x456e), 0x06 },
+ { CCI_REG8(0x456f), 0x06 },
+ { CCI_REG8(0x4570), 0x06 },
+};
+
+static const u16 imx675_min_hmax_2lane[] = {
+ [STARVIS2_LINK_FREQ_297MHZ] = 2044,
+ [STARVIS2_LINK_FREQ_360MHZ] = 1692,
+ [STARVIS2_LINK_FREQ_445MHZ] = 1376,
+ [STARVIS2_LINK_FREQ_594MHZ] = 1064,
+ [STARVIS2_LINK_FREQ_720MHZ] = 840,
+ [STARVIS2_LINK_FREQ_891MHZ] = 684,
+ [STARVIS2_LINK_FREQ_1039MHZ] = 592,
+ [STARVIS2_LINK_FREQ_1188MHZ] = 528,
+};
+
+const struct starvis2_variant imx675_variant_def = {
+ .name = "imx675",
+ .id_reg = CCI_REG16_LE(0x4d12),
+ .id_mask = 0xfff,
+ .id_value = 0x576,
+ .native_area = {
+ .top = 0,
+ .left = 0,
+ .width = 2609,
+ .height = 1984,
+ },
+ .active_area = {
+ .top = 0,
+ .left = 0,
+ .width = 2608,
+ .height = 1984,
+ },
+ .pixel_rate = 594000000,
+ .pix_per_clk = 8,
+ .common_regs = imx675_common_regs,
+ .num_common_regs = ARRAY_SIZE(imx675_common_regs),
+ .vmax_default = 2024,
+ .hmax_min_link_freq = imx675_min_hmax_2lane,
+ .hmax_min_pixel_array = 528,
+};
+
struct starvis2_model_info {
enum starvis2_type type;
const u32 *codes;
@@ -843,7 +1032,32 @@ static const struct starvis2_model_info
.auto_detect_mono = &imx662_aamr_info,
};
+static const struct starvis2_model_info imx675_aaqr_info = {
+ .type = STARVIS2_COLOR,
+ .codes = codes_bayer,
+ .num_codes = ARRAY_SIZE(codes_bayer),
+ .variant = &imx675_variant_def,
+};
+
+static const struct starvis2_model_info imx675_aamr_info = {
+ .type = STARVIS2_MONOCHROME,
+ .codes = codes_monochrome,
+ .num_codes = ARRAY_SIZE(codes_monochrome),
+ .variant = &imx675_variant_def,
+};
+
+static const struct starvis2_model_info imx675_autodetect_info = {
+ .variant = &imx675_variant_def,
+ .auto_detect_colour = &imx675_aaqr_info,
+ .auto_detect_mono = &imx675_aamr_info,
+};
+
static const struct starvis2_model_info *starvis2_all_model_autodetect[] = {
+ /*
+ * NB IMX675 responds to 0x4d1c with 0x0296, same as IMX662 does
+ * officially, so it MUST come before IMX662 in the search order
+ */
+ &imx675_autodetect_info,
&imx662_autodetect_info,
&imx678_autodetect_info,
};
@@ -1674,10 +1888,13 @@ static const struct dev_pm_ops starvis2_
static const struct of_device_id starvis2_of_match[] = {
{ .compatible = "sony,imx678-aamr", .data = &imx678_aamr_info },
{ .compatible = "sony,imx678-aaqr", .data = &imx678_aaqr_info },
+ { .compatible = "sony,imx675-aamr", .data = &imx675_aamr_info },
+ { .compatible = "sony,imx675-aaqr", .data = &imx675_aaqr_info },
{ .compatible = "sony,imx662-aamr", .data = &imx662_aamr_info },
{ .compatible = "sony,imx662-aaqr", .data = &imx662_aaqr_info },
/* for non-conforming DTs that rely on runtime check */
{ .compatible = "sony,imx678", .data = &imx678_autodetect_info },
+ { .compatible = "sony,imx675", .data = &imx675_autodetect_info },
{ .compatible = "sony,imx662", .data = &imx662_autodetect_info },
{ .compatible = "sony,starvis2", .data = NULL },
{ /* sentinel */ }
@@ -0,0 +1,175 @@
From d8513151dc1e843a8922974c92b3f0fc18174590 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 16 Sep 2026 17:30:13 +0100
Subject: [PATCH] media: sony-starvis2: Add support for IMX832
IMX832 is replacing IMX662, and it follows the same pattern as all the
Starvis2 sensors.
Add the sensor specific configuration for it.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/sony-starvis2.c | 119 ++++++++++++++++++++++++++++++
1 file changed, 119 insertions(+)
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -12,6 +12,8 @@
* pixels.
* IMX675: Diagonal 6.53mm (Type 1/2.8) CMOS image sensor with 5.12 M effective
* pixels.
+ * IMX832: Diagonal 6.45mm (Type 1/2.8) CMOS image sensor with 2.12 M effective
+ * pixels.
*
* Copyright (C) 2026 Ideas On Board Oy.
*
@@ -982,6 +984,99 @@ const struct starvis2_variant imx675_var
.hmax_min_pixel_array = 528,
};
+static const struct cci_reg_sequence imx832_common_regs[] = {
+ { CCI_REG8(0x3460), 0x21 },
+ { CCI_REG8(0x3a94), 0x75 },
+ { CCI_REG8(0x3a96), 0x69 },
+ { CCI_REG8(0x3a98), 0x1e },
+ { CCI_REG8(0x3a9a), 0x1e },
+ { CCI_REG8(0x3b58), 0xeb },
+ { CCI_REG8(0x3b5c), 0xeb },
+ { CCI_REG8(0x3b88), 0xeb },
+ { CCI_REG8(0x3b8c), 0xeb },
+ { CCI_REG8(0x3c40), 0x06 },
+ { CCI_REG8(0x3cae), 0x79 },
+ { CCI_REG8(0x3cbc), 0x7b },
+ { CCI_REG8(0x4508), 0x00 },
+ { CCI_REG8(0x4509), 0x02 },
+ { CCI_REG8(0x450a), 0x41 },
+ { CCI_REG8(0x450b), 0x03 },
+ { CCI_REG8(0x4660), 0x12 },
+ { CCI_REG8(0x4661), 0x00 },
+ { CCI_REG8(0x4662), 0x29 },
+ { CCI_REG8(0x4664), 0x12 },
+ { CCI_REG8(0x4665), 0x00 },
+ { CCI_REG8(0x4666), 0x25 },
+ { CCI_REG8(0x4667), 0x03 },
+ { CCI_REG8(0x46c0), 0x13 },
+ { CCI_REG8(0x46c1), 0x00 },
+ { CCI_REG8(0x46c2), 0x28 },
+ { CCI_REG8(0x46c4), 0x13 },
+ { CCI_REG8(0x46c5), 0x00 },
+ { CCI_REG8(0x46c6), 0x24 },
+ { CCI_REG8(0x46c7), 0x03 },
+ { CCI_REG8(0x4720), 0x07 },
+ { CCI_REG8(0x4721), 0x00 },
+ { CCI_REG8(0x4722), 0x23 },
+ { CCI_REG8(0x4723), 0x03 },
+ { CCI_REG8(0x4724), 0x14 },
+ { CCI_REG8(0x4725), 0x00 },
+ { CCI_REG8(0x4726), 0x2a },
+ { CCI_REG8(0x4750), 0x1e },
+ { CCI_REG8(0x4752), 0x22 },
+ { CCI_REG8(0x4753), 0x03 },
+ { CCI_REG8(0x4754), 0x25 },
+ { CCI_REG8(0x4755), 0x00 },
+ { CCI_REG8(0x4756), 0x29 },
+ { CCI_REG8(0x4780), 0x08 },
+ { CCI_REG8(0x4781), 0x00 },
+ { CCI_REG8(0x4782), 0x1d },
+ { CCI_REG8(0x4783), 0x03 },
+ { CCI_REG8(0x4784), 0x15 },
+ { CCI_REG8(0x4785), 0x00 },
+ { CCI_REG8(0x4786), 0x24 },
+ { STARVIS2_REG_WDMODE, 0x00 },
+ { STARVIS2_REG_MDBIT, 0x01 },
+ { STARVIS2_REG_XXS_DRV, 0x00 },
+};
+
+static const u16 imx832_min_hmax_2lane[] = {
+ [STARVIS2_LINK_FREQ_297MHZ] = 1980,
+ [STARVIS2_LINK_FREQ_360MHZ] = 1980,
+ [STARVIS2_LINK_FREQ_445MHZ] = 1188,
+ [STARVIS2_LINK_FREQ_594MHZ] = 990,
+ [STARVIS2_LINK_FREQ_720MHZ] = 990,
+ [STARVIS2_LINK_FREQ_891MHZ] = 990,
+ [STARVIS2_LINK_FREQ_1039MHZ] = 990,
+ [STARVIS2_LINK_FREQ_1188MHZ] = 990,
+};
+
+const struct starvis2_variant imx832_variant_def = {
+ .name = "imx832",
+ .id_reg = CCI_REG16_LE(0x4d1c),
+ .id_mask = 0x3ff,
+ .id_value = 0x340,
+ .native_area = {
+ .top = 0,
+ .left = 0,
+ .width = 1937,
+ .height = 1101,
+ },
+ .active_area = {
+ .top = 0,
+ .left = 0,
+ .width = 1936,
+ .height = 1096,
+ },
+ .pixel_rate = 222750000,
+ .pix_per_clk = 3,
+ .common_regs = imx832_common_regs,
+ .num_common_regs = ARRAY_SIZE(imx832_common_regs),
+ .vmax_default = 1136,
+ .hmax_min_link_freq = imx832_min_hmax_2lane,
+ .hmax_min_pixel_array = 990,
+};
+
struct starvis2_model_info {
enum starvis2_type type;
const u32 *codes;
@@ -1052,6 +1147,26 @@ static const struct starvis2_model_info
.auto_detect_mono = &imx675_aamr_info,
};
+static const struct starvis2_model_info imx832_aaqr_info = {
+ .type = STARVIS2_COLOR,
+ .codes = codes_bayer,
+ .num_codes = ARRAY_SIZE(codes_bayer),
+ .variant = &imx832_variant_def,
+};
+
+static const struct starvis2_model_info imx832_aamr_info = {
+ .type = STARVIS2_MONOCHROME,
+ .codes = codes_monochrome,
+ .num_codes = ARRAY_SIZE(codes_monochrome),
+ .variant = &imx832_variant_def,
+};
+
+static const struct starvis2_model_info imx832_autodetect_info = {
+ .variant = &imx832_variant_def,
+ .auto_detect_colour = &imx832_aaqr_info,
+ .auto_detect_mono = &imx832_aamr_info,
+};
+
static const struct starvis2_model_info *starvis2_all_model_autodetect[] = {
/*
* NB IMX675 responds to 0x4d1c with 0x0296, same as IMX662 does
@@ -1059,6 +1174,7 @@ static const struct starvis2_model_info
*/
&imx675_autodetect_info,
&imx662_autodetect_info,
+ &imx832_autodetect_info,
&imx678_autodetect_info,
};
@@ -1892,10 +2008,13 @@ static const struct of_device_id starvis
{ .compatible = "sony,imx675-aaqr", .data = &imx675_aaqr_info },
{ .compatible = "sony,imx662-aamr", .data = &imx662_aamr_info },
{ .compatible = "sony,imx662-aaqr", .data = &imx662_aaqr_info },
+ { .compatible = "sony,imx832-aamr", .data = &imx832_aamr_info },
+ { .compatible = "sony,imx832-aaqr", .data = &imx832_aaqr_info },
/* for non-conforming DTs that rely on runtime check */
{ .compatible = "sony,imx678", .data = &imx678_autodetect_info },
{ .compatible = "sony,imx675", .data = &imx675_autodetect_info },
{ .compatible = "sony,imx662", .data = &imx662_autodetect_info },
+ { .compatible = "sony,imx832", .data = &imx832_autodetect_info },
{ .compatible = "sony,starvis2", .data = NULL },
{ /* sentinel */ }
};
@@ -0,0 +1,492 @@
From bcb59d4f4afe8f0a444ef5f020626307f8c9362e Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 17 Sep 2026 09:57:15 +0100
Subject: [PATCH] media: sony-starvis2: Add support for IMX585
IMX585 is an 8MPix Starvis 2 sensor, so add support for it.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/sony-starvis2.c | 438 ++++++++++++++++++++++++++++++
1 file changed, 438 insertions(+)
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -14,6 +14,8 @@
* pixels.
* IMX832: Diagonal 6.45mm (Type 1/2.8) CMOS image sensor with 2.12 M effective
* pixels.
+ * IMX585: Diagonal 12.84 mm (Type 1/1.2) CMOS image sensor with 8.40 M effective
+ * pixels.
*
* Copyright (C) 2026 Ideas On Board Oy.
*
@@ -1077,6 +1079,418 @@ const struct starvis2_variant imx832_var
.hmax_min_pixel_array = 990,
};
+static const struct cci_reg_sequence imx585_common_regs[] = {
+ { STARVIS2_REG_THIN_V_EN, 0x00 },
+ { STARVIS2_REG_VCMODE, 0x01 },
+ { CCI_REG8(0x306b), 0x00 },
+ { STARVIS2_REG_GAIN_PGC_FIDMD, 0x01 },
+ { CCI_REG8(0x3460), 0x22 },
+ { CCI_REG8(0x355a), 0x64 },
+ { CCI_REG8(0x3a02), 0x7a },
+ { CCI_REG8(0x3a10), 0xec },
+ { CCI_REG8(0x3a12), 0x71 },
+ { CCI_REG8(0x3a14), 0xde },
+ { CCI_REG8(0x3a20), 0x2b },
+ { CCI_REG8(0x3a24), 0x22 },
+ { CCI_REG8(0x3a25), 0x25 },
+ { CCI_REG8(0x3a26), 0x2a },
+ { CCI_REG8(0x3a27), 0x2c },
+ { CCI_REG8(0x3a28), 0x39 },
+ { CCI_REG8(0x3a29), 0x38 },
+ { CCI_REG8(0x3a30), 0x04 },
+ { CCI_REG8(0x3a31), 0x04 },
+ { CCI_REG8(0x3a32), 0x03 },
+ { CCI_REG8(0x3a33), 0x03 },
+ { CCI_REG8(0x3a34), 0x09 },
+ { CCI_REG8(0x3a35), 0x06 },
+ { CCI_REG8(0x3a38), 0xcd },
+ { CCI_REG8(0x3a3a), 0x4c },
+ { CCI_REG8(0x3a3c), 0xb9 },
+ { CCI_REG8(0x3a3e), 0x30 },
+ { CCI_REG8(0x3a40), 0x2c },
+ { CCI_REG8(0x3a42), 0x39 },
+ { CCI_REG8(0x3a4e), 0x00 },
+ { CCI_REG8(0x3a52), 0x00 },
+ { CCI_REG8(0x3a56), 0x00 },
+ { CCI_REG8(0x3a5a), 0x00 },
+ { CCI_REG8(0x3a5e), 0x00 },
+ { CCI_REG8(0x3a62), 0x00 },
+ { CCI_REG8(0x3a64), 0x00 },
+ { CCI_REG8(0x3a6e), 0xa0 },
+ { CCI_REG8(0x3a70), 0x50 },
+ { CCI_REG8(0x3a8c), 0x04 },
+ { CCI_REG8(0x3a8d), 0x03 },
+ { CCI_REG8(0x3a8e), 0x09 },
+ { CCI_REG8(0x3a90), 0x38 },
+ { CCI_REG8(0x3a91), 0x42 },
+ { CCI_REG8(0x3a92), 0x3c },
+ { CCI_REG8(0x3b0e), 0xf3 },
+ { CCI_REG8(0x3b12), 0xe5 },
+ { CCI_REG8(0x3b27), 0xc0 },
+ { CCI_REG8(0x3b2e), 0xef },
+ { CCI_REG8(0x3b30), 0x6a },
+ { CCI_REG8(0x3b32), 0xf6 },
+ { CCI_REG8(0x3b36), 0xe1 },
+ { CCI_REG8(0x3b3a), 0xe8 },
+ { CCI_REG8(0x3b5a), 0x17 },
+ { CCI_REG8(0x3b5e), 0xef },
+ { CCI_REG8(0x3b60), 0x6a },
+ { CCI_REG8(0x3b62), 0xf6 },
+ { CCI_REG8(0x3b66), 0xe1 },
+ { CCI_REG8(0x3b6a), 0xe8 },
+ { CCI_REG8(0x3b88), 0xec },
+ { CCI_REG8(0x3b8a), 0xed },
+ { CCI_REG8(0x3b94), 0x71 },
+ { CCI_REG8(0x3b96), 0x72 },
+ { CCI_REG8(0x3b98), 0xde },
+ { CCI_REG8(0x3b9a), 0xdf },
+ { CCI_REG8(0x3c0f), 0x06 },
+ { CCI_REG8(0x3c10), 0x06 },
+ { CCI_REG8(0x3c11), 0x06 },
+ { CCI_REG8(0x3c12), 0x06 },
+ { CCI_REG8(0x3c13), 0x06 },
+ { CCI_REG8(0x3c18), 0x20 },
+ { CCI_REG8(0x3c37), 0x10 },
+ { CCI_REG8(0x3c3a), 0x7a },
+ { CCI_REG8(0x3c40), 0xf4 },
+ { CCI_REG8(0x3c48), 0xe6 },
+ { CCI_REG8(0x3c54), 0xce },
+ { CCI_REG8(0x3c56), 0xd0 },
+ { CCI_REG8(0x3c6c), 0x53 },
+ { CCI_REG8(0x3c6e), 0x55 },
+ { CCI_REG8(0x3c70), 0xc0 },
+ { CCI_REG8(0x3c72), 0xc2 },
+ { CCI_REG8(0x3c7e), 0xce },
+ { CCI_REG8(0x3c8c), 0xcf },
+ { CCI_REG8(0x3c8e), 0xeb },
+ { CCI_REG8(0x3c98), 0x54 },
+ { CCI_REG8(0x3c9a), 0x70 },
+ { CCI_REG8(0x3c9c), 0xc1 },
+ { CCI_REG8(0x3c9e), 0xdd },
+ { CCI_REG8(0x3cb0), 0x7a },
+ { CCI_REG8(0x3cb2), 0xba },
+ { CCI_REG8(0x3cc8), 0xbc },
+ { CCI_REG8(0x3cca), 0x7c },
+ { CCI_REG8(0x3cd4), 0xea },
+ { CCI_REG8(0x3cd5), 0x01 },
+ { CCI_REG8(0x3cd6), 0x4a },
+ { CCI_REG8(0x3cd8), 0x00 },
+ { CCI_REG8(0x3cd9), 0x00 },
+ { CCI_REG8(0x3cda), 0xff },
+ { CCI_REG8(0x3cdb), 0x03 },
+ { CCI_REG8(0x3cdc), 0x00 },
+ { CCI_REG8(0x3cdd), 0x00 },
+ { CCI_REG8(0x3cde), 0xff },
+ { CCI_REG8(0x3cdf), 0x03 },
+ { CCI_REG8(0x3ce4), 0x4c },
+ { CCI_REG8(0x3ce6), 0xec },
+ { CCI_REG8(0x3ce7), 0x01 },
+ { CCI_REG8(0x3ce8), 0xff },
+ { CCI_REG8(0x3ce9), 0x03 },
+ { CCI_REG8(0x3cea), 0x00 },
+ { CCI_REG8(0x3ceb), 0x00 },
+ { CCI_REG8(0x3cec), 0xff },
+ { CCI_REG8(0x3ced), 0x03 },
+ { CCI_REG8(0x3cee), 0x00 },
+ { CCI_REG8(0x3cef), 0x00 },
+ { CCI_REG8(0x3cf2), 0xff },
+ { CCI_REG8(0x3cf3), 0x03 },
+ { CCI_REG8(0x3cf4), 0x00 },
+ { CCI_REG8(0x3e28), 0x82 },
+ { CCI_REG8(0x3e2a), 0x80 },
+ { CCI_REG8(0x3e30), 0x85 },
+ { CCI_REG8(0x3e32), 0x7d },
+ { CCI_REG8(0x3e5c), 0xce },
+ { CCI_REG8(0x3e5e), 0xd3 },
+ { CCI_REG8(0x3e70), 0x53 },
+ { CCI_REG8(0x3e72), 0x58 },
+ { CCI_REG8(0x3e74), 0xc0 },
+ { CCI_REG8(0x3e76), 0xc5 },
+ { CCI_REG8(0x3e78), 0xc0 },
+ { CCI_REG8(0x3e79), 0x01 },
+ { CCI_REG8(0x3e7a), 0xd4 },
+ { CCI_REG8(0x3e7b), 0x01 },
+ { CCI_REG8(0x3eb4), 0x0b },
+ { CCI_REG8(0x3eb5), 0x02 },
+ { CCI_REG8(0x3eb6), 0x4d },
+ { CCI_REG8(0x3eb7), 0x42 },
+ { CCI_REG8(0x3eec), 0xf3 },
+ { CCI_REG8(0x3eee), 0xe7 },
+ { CCI_REG8(0x3f01), 0x01 },
+ { CCI_REG8(0x3f24), 0x10 },
+ { CCI_REG8(0x3f28), 0x2d },
+ { CCI_REG8(0x3f2a), 0x2d },
+ { CCI_REG8(0x3f2c), 0x2d },
+ { CCI_REG8(0x3f2e), 0x2d },
+ { CCI_REG8(0x3f30), 0x23 },
+ { CCI_REG8(0x3f38), 0x2d },
+ { CCI_REG8(0x3f3a), 0x2d },
+ { CCI_REG8(0x3f3c), 0x2d },
+ { CCI_REG8(0x3f3e), 0x28 },
+ { CCI_REG8(0x3f40), 0x1e },
+ { CCI_REG8(0x3f48), 0x2d },
+ { CCI_REG8(0x3f4a), 0x2d },
+ { CCI_REG8(0x3f4c), 0x00 },
+ { CCI_REG8(0x4004), 0xe4 },
+ { CCI_REG8(0x4006), 0xff },
+ { CCI_REG8(0x4018), 0x69 },
+ { CCI_REG8(0x401a), 0x84 },
+ { CCI_REG8(0x401c), 0xd6 },
+ { CCI_REG8(0x401e), 0xf1 },
+ { CCI_REG8(0x4038), 0xde },
+ { CCI_REG8(0x403a), 0x00 },
+ { CCI_REG8(0x403b), 0x01 },
+ { CCI_REG8(0x404c), 0x63 },
+ { CCI_REG8(0x404e), 0x85 },
+ { CCI_REG8(0x4050), 0xd0 },
+ { CCI_REG8(0x4052), 0xf2 },
+ { CCI_REG8(0x4108), 0xdd },
+ { CCI_REG8(0x410a), 0xf7 },
+ { CCI_REG8(0x411c), 0x62 },
+ { CCI_REG8(0x411e), 0x7c },
+ { CCI_REG8(0x4120), 0xcf },
+ { CCI_REG8(0x4122), 0xe9 },
+ { CCI_REG8(0x4138), 0xe6 },
+ { CCI_REG8(0x413a), 0xf1 },
+ { CCI_REG8(0x414c), 0x6b },
+ { CCI_REG8(0x414e), 0x76 },
+ { CCI_REG8(0x4150), 0xd8 },
+ { CCI_REG8(0x4152), 0xe3 },
+ { CCI_REG8(0x417e), 0x03 },
+ { CCI_REG8(0x417f), 0x01 },
+ { CCI_REG8(0x4186), 0xe0 },
+ { CCI_REG8(0x4190), 0xf3 },
+ { CCI_REG8(0x4192), 0xf7 },
+ { CCI_REG8(0x419c), 0x78 },
+ { CCI_REG8(0x419e), 0x7c },
+ { CCI_REG8(0x41a0), 0xe5 },
+ { CCI_REG8(0x41a2), 0xe9 },
+ { CCI_REG8(0x41c8), 0xe2 },
+ { CCI_REG8(0x41ca), 0xfd },
+ { CCI_REG8(0x41dc), 0x67 },
+ { CCI_REG8(0x41de), 0x82 },
+ { CCI_REG8(0x41e0), 0xd4 },
+ { CCI_REG8(0x41e2), 0xef },
+ { CCI_REG8(0x4200), 0xde },
+ { CCI_REG8(0x4202), 0xda },
+ { CCI_REG8(0x4218), 0x63 },
+ { CCI_REG8(0x421a), 0x5f },
+ { CCI_REG8(0x421c), 0xd0 },
+ { CCI_REG8(0x421e), 0xcc },
+ { CCI_REG8(0x425a), 0x82 },
+ { CCI_REG8(0x425c), 0xef },
+ { CCI_REG8(0x4348), 0xfe },
+ { CCI_REG8(0x4349), 0x06 },
+ { CCI_REG8(0x4352), 0xce },
+ { CCI_REG8(0x4420), 0x0b },
+ { CCI_REG8(0x4421), 0x02 },
+ { CCI_REG8(0x4422), 0x4d },
+ { CCI_REG8(0x4423), 0x0a },
+ { CCI_REG8(0x4426), 0xf5 },
+ { CCI_REG8(0x442a), 0xe7 },
+ { CCI_REG8(0x4432), 0xf5 },
+ { CCI_REG8(0x4436), 0xe7 },
+ { CCI_REG8(0x4466), 0xb4 },
+ { CCI_REG8(0x446e), 0x32 },
+ { CCI_REG8(0x449f), 0x1c },
+ { CCI_REG8(0x44a4), 0x2c },
+ { CCI_REG8(0x44a6), 0x2c },
+ { CCI_REG8(0x44a8), 0x2c },
+ { CCI_REG8(0x44aa), 0x2c },
+ { CCI_REG8(0x44b4), 0x2c },
+ { CCI_REG8(0x44b6), 0x2c },
+ { CCI_REG8(0x44b8), 0x2c },
+ { CCI_REG8(0x44ba), 0x2c },
+ { CCI_REG8(0x44c4), 0x2c },
+ { CCI_REG8(0x44c6), 0x2c },
+ { CCI_REG8(0x44c8), 0x2c },
+ { CCI_REG8(0x4506), 0xf3 },
+ { CCI_REG8(0x450e), 0xe5 },
+ { CCI_REG8(0x4516), 0xf3 },
+ { CCI_REG8(0x4522), 0xe5 },
+ { CCI_REG8(0x4524), 0xf3 },
+ { CCI_REG8(0x452c), 0xe5 },
+ { CCI_REG8(0x453c), 0x22 },
+ { CCI_REG8(0x453d), 0x1b },
+ { CCI_REG8(0x453e), 0x1b },
+ { CCI_REG8(0x453f), 0x15 },
+ { CCI_REG8(0x4540), 0x15 },
+ { CCI_REG8(0x4541), 0x15 },
+ { CCI_REG8(0x4542), 0x15 },
+ { CCI_REG8(0x4543), 0x15 },
+ { CCI_REG8(0x4544), 0x15 },
+ { CCI_REG8(0x4548), 0x00 },
+ { CCI_REG8(0x4549), 0x01 },
+ { CCI_REG8(0x454a), 0x01 },
+ { CCI_REG8(0x454b), 0x06 },
+ { CCI_REG8(0x454c), 0x06 },
+ { CCI_REG8(0x454d), 0x06 },
+ { CCI_REG8(0x454e), 0x06 },
+ { CCI_REG8(0x454f), 0x06 },
+ { CCI_REG8(0x4550), 0x06 },
+ { CCI_REG8(0x4554), 0x55 },
+ { CCI_REG8(0x4555), 0x02 },
+ { CCI_REG8(0x4556), 0x42 },
+ { CCI_REG8(0x4557), 0x05 },
+ { CCI_REG8(0x4558), 0xfd },
+ { CCI_REG8(0x4559), 0x05 },
+ { CCI_REG8(0x455a), 0x94 },
+ { CCI_REG8(0x455b), 0x06 },
+ { CCI_REG8(0x455d), 0x06 },
+ { CCI_REG8(0x455e), 0x49 },
+ { CCI_REG8(0x455f), 0x07 },
+ { CCI_REG8(0x4560), 0x7f },
+ { CCI_REG8(0x4561), 0x07 },
+ { CCI_REG8(0x4562), 0xa5 },
+ { CCI_REG8(0x4564), 0x55 },
+ { CCI_REG8(0x4565), 0x02 },
+ { CCI_REG8(0x4566), 0x42 },
+ { CCI_REG8(0x4567), 0x05 },
+ { CCI_REG8(0x4568), 0xfd },
+ { CCI_REG8(0x4569), 0x05 },
+ { CCI_REG8(0x456a), 0x94 },
+ { CCI_REG8(0x456b), 0x06 },
+ { CCI_REG8(0x456d), 0x06 },
+ { CCI_REG8(0x456e), 0x49 },
+ { CCI_REG8(0x456f), 0x07 },
+ { CCI_REG8(0x4572), 0xa5 },
+ { CCI_REG8(0x460c), 0x7d },
+ { CCI_REG8(0x460e), 0xb1 },
+ { CCI_REG8(0x4614), 0xa8 },
+ { CCI_REG8(0x4616), 0xb2 },
+ { CCI_REG8(0x461c), 0x7e },
+ { CCI_REG8(0x461e), 0xa7 },
+ { CCI_REG8(0x4624), 0xa8 },
+ { CCI_REG8(0x4626), 0xb2 },
+ { CCI_REG8(0x462c), 0x7e },
+ { CCI_REG8(0x462e), 0x8a },
+ { CCI_REG8(0x4630), 0x94 },
+ { CCI_REG8(0x4632), 0xa7 },
+ { CCI_REG8(0x4634), 0xfb },
+ { CCI_REG8(0x4636), 0x2f },
+ { CCI_REG8(0x4638), 0x81 },
+ { CCI_REG8(0x4639), 0x01 },
+ { CCI_REG8(0x463a), 0xb5 },
+ { CCI_REG8(0x463b), 0x01 },
+ { CCI_REG8(0x463c), 0x26 },
+ { CCI_REG8(0x463e), 0x30 },
+ { CCI_REG8(0x4640), 0xac },
+ { CCI_REG8(0x4641), 0x01 },
+ { CCI_REG8(0x4642), 0xb6 },
+ { CCI_REG8(0x4643), 0x01 },
+ { CCI_REG8(0x4644), 0xfc },
+ { CCI_REG8(0x4646), 0x25 },
+ { CCI_REG8(0x4648), 0x82 },
+ { CCI_REG8(0x4649), 0x01 },
+ { CCI_REG8(0x464a), 0xab },
+ { CCI_REG8(0x464b), 0x01 },
+ { CCI_REG8(0x464c), 0x26 },
+ { CCI_REG8(0x464e), 0x30 },
+ { CCI_REG8(0x4654), 0xfc },
+ { CCI_REG8(0x4656), 0x08 },
+ { CCI_REG8(0x4658), 0x12 },
+ { CCI_REG8(0x465a), 0x25 },
+ { CCI_REG8(0x4662), 0xfc },
+ { CCI_REG8(0x46a2), 0xfb },
+ { CCI_REG8(0x46d6), 0xf3 },
+ { CCI_REG8(0x46e6), 0x00 },
+ { CCI_REG8(0x46e8), 0xff },
+ { CCI_REG8(0x46e9), 0x03 },
+ { CCI_REG8(0x46ec), 0x7a },
+ { CCI_REG8(0x46ee), 0xe5 },
+ { CCI_REG8(0x46f4), 0xee },
+ { CCI_REG8(0x46f6), 0xf2 },
+ { CCI_REG8(0x470c), 0xff },
+ { CCI_REG8(0x470d), 0x03 },
+ { CCI_REG8(0x470e), 0x00 },
+ { CCI_REG8(0x4714), 0xe0 },
+ { CCI_REG8(0x4716), 0xe4 },
+ { CCI_REG8(0x471e), 0xed },
+ { CCI_REG8(0x472e), 0x00 },
+ { CCI_REG8(0x4730), 0xff },
+ { CCI_REG8(0x4731), 0x03 },
+ { CCI_REG8(0x4734), 0x7b },
+ { CCI_REG8(0x4736), 0xdf },
+ { CCI_REG8(0x4754), 0x7d },
+ { CCI_REG8(0x4756), 0x8b },
+ { CCI_REG8(0x4758), 0x93 },
+ { CCI_REG8(0x475a), 0xb1 },
+ { CCI_REG8(0x475c), 0xfb },
+ { CCI_REG8(0x475e), 0x09 },
+ { CCI_REG8(0x4760), 0x11 },
+ { CCI_REG8(0x4762), 0x2f },
+ { CCI_REG8(0x4766), 0xcc },
+ { CCI_REG8(0x4776), 0xcb },
+ { CCI_REG8(0x477e), 0x4a },
+ { CCI_REG8(0x478e), 0x49 },
+ { CCI_REG8(0x4794), 0x7c },
+ { CCI_REG8(0x4796), 0x8f },
+ { CCI_REG8(0x4798), 0xb3 },
+ { CCI_REG8(0x4799), 0x00 },
+ { CCI_REG8(0x479a), 0xcc },
+ { CCI_REG8(0x479c), 0xc1 },
+ { CCI_REG8(0x479e), 0xcb },
+ { CCI_REG8(0x47a4), 0x7d },
+ { CCI_REG8(0x47a6), 0x8e },
+ { CCI_REG8(0x47a8), 0xb4 },
+ { CCI_REG8(0x47a9), 0x00 },
+ { CCI_REG8(0x47aa), 0xc0 },
+ { CCI_REG8(0x47ac), 0xfa },
+ { CCI_REG8(0x47ae), 0x0d },
+ { CCI_REG8(0x47b0), 0x31 },
+ { CCI_REG8(0x47b1), 0x01 },
+ { CCI_REG8(0x47b2), 0x4a },
+ { CCI_REG8(0x47b3), 0x01 },
+ { CCI_REG8(0x47b4), 0x3f },
+ { CCI_REG8(0x47b6), 0x49 },
+ { CCI_REG8(0x47bc), 0xfb },
+ { CCI_REG8(0x47be), 0x0c },
+ { CCI_REG8(0x47c0), 0x32 },
+ { CCI_REG8(0x47c1), 0x01 },
+ { CCI_REG8(0x47c2), 0x3e },
+ { CCI_REG8(0x47c3), 0x01 },
+ { STARVIS2_REG_WDMODE, 0x00 },
+ { STARVIS2_REG_MDBIT, 0x01 },
+ { STARVIS2_REG_XXS_DRV, 0x00 },
+};
+
+static const u16 imx585_min_hmax_2lane[] = {
+ [STARVIS2_LINK_FREQ_297MHZ] = 1980,
+ [STARVIS2_LINK_FREQ_360MHZ] = 1980,
+ [STARVIS2_LINK_FREQ_445MHZ] = 1188,
+ [STARVIS2_LINK_FREQ_594MHZ] = 990,
+ [STARVIS2_LINK_FREQ_720MHZ] = 990,
+ [STARVIS2_LINK_FREQ_891MHZ] = 990,
+ [STARVIS2_LINK_FREQ_1039MHZ] = 990,
+ [STARVIS2_LINK_FREQ_1188MHZ] = 990,
+};
+
+const struct starvis2_variant imx585_variant_def = {
+ .name = "imx585",
+ .id_reg = CCI_REG16_LE(0x5a1d),
+ .id_mask = 0x3ff,
+ .id_value = 0x259,
+ .active_area = {
+ .top = 0,
+ .left = 0,
+ .width = 3857,
+ .height = 2201,
+ },
+ .active_area = {
+ .top = 20,
+ .left = 0,
+ .width = 3856,
+ .height = 2180,
+ },
+ .pixel_rate = 594000000,
+ .pix_per_clk = 8,
+ .common_regs = imx585_common_regs,
+ .num_common_regs = ARRAY_SIZE(imx585_common_regs),
+ .vmax_default = 2250,
+ .hmax_min_link_freq = imx585_min_hmax_2lane,
+ .hmax_min_pixel_array = 550,
+};
+
struct starvis2_model_info {
enum starvis2_type type;
const u32 *codes;
@@ -1167,6 +1581,26 @@ static const struct starvis2_model_info
.auto_detect_mono = &imx832_aamr_info,
};
+static const struct starvis2_model_info imx585_aaqr_info = {
+ .type = STARVIS2_COLOR,
+ .codes = codes_bayer,
+ .num_codes = ARRAY_SIZE(codes_bayer),
+ .variant = &imx585_variant_def,
+};
+
+static const struct starvis2_model_info imx585_aamr_info = {
+ .type = STARVIS2_MONOCHROME,
+ .codes = codes_monochrome,
+ .num_codes = ARRAY_SIZE(codes_monochrome),
+ .variant = &imx585_variant_def,
+};
+
+static const struct starvis2_model_info imx585_autodetect_info = {
+ .variant = &imx585_variant_def,
+ .auto_detect_colour = &imx585_aaqr_info,
+ .auto_detect_mono = &imx585_aamr_info,
+};
+
static const struct starvis2_model_info *starvis2_all_model_autodetect[] = {
/*
* NB IMX675 responds to 0x4d1c with 0x0296, same as IMX662 does
@@ -1176,6 +1610,7 @@ static const struct starvis2_model_info
&imx662_autodetect_info,
&imx832_autodetect_info,
&imx678_autodetect_info,
+ &imx585_autodetect_info,
};
static const char * const starvis2_supply_name[] = {
@@ -2010,11 +2445,14 @@ static const struct of_device_id starvis
{ .compatible = "sony,imx662-aaqr", .data = &imx662_aaqr_info },
{ .compatible = "sony,imx832-aamr", .data = &imx832_aamr_info },
{ .compatible = "sony,imx832-aaqr", .data = &imx832_aaqr_info },
+ { .compatible = "sony,imx585-aamr", .data = &imx585_aamr_info },
+ { .compatible = "sony,imx585-aaqr", .data = &imx585_aaqr_info },
/* for non-conforming DTs that rely on runtime check */
{ .compatible = "sony,imx678", .data = &imx678_autodetect_info },
{ .compatible = "sony,imx675", .data = &imx675_autodetect_info },
{ .compatible = "sony,imx662", .data = &imx662_autodetect_info },
{ .compatible = "sony,imx832", .data = &imx832_autodetect_info },
+ { .compatible = "sony,imx585", .data = &imx585_autodetect_info },
{ .compatible = "sony,starvis2", .data = NULL },
{ /* sentinel */ }
};
@@ -0,0 +1,236 @@
From d04884636b1289b8a4ef0d53204ed22e4df53deb Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 17 Sep 2026 16:39:10 +0100
Subject: [PATCH] dtoverlays: Add the generic Sony Starvis2 image sensor
overlay
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
arch/arm/boot/dts/overlays/Makefile | 1 +
arch/arm/boot/dts/overlays/README | 33 +++++
.../boot/dts/overlays/starvis2-overlay.dts | 136 ++++++++++++++++++
arch/arm/boot/dts/overlays/starvis2.dtsi | 26 ++++
4 files changed, 196 insertions(+)
create mode 100644 arch/arm/boot/dts/overlays/starvis2-overlay.dts
create mode 100644 arch/arm/boot/dts/overlays/starvis2.dtsi
--- a/arch/arm/boot/dts/overlays/Makefile
+++ b/arch/arm/boot/dts/overlays/Makefile
@@ -317,6 +317,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
ssd1327-spi.dtbo \
ssd1331-spi.dtbo \
ssd1351-spi.dtbo \
+ starvis2.dtbo \
sunfounder-pipower3.dtbo \
sunfounder-pironman5.dtbo \
superaudioboard.dtbo \
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -5477,6 +5477,39 @@ Params: speed SPI bus
reset_pin GPIO pin for RESET (default 25)
+Name: starvis2
+Info: Sony Starvis2 camera module.
+ Uses Unicam 1, which is the standard camera connector on most Pi
+ variants.
+Load: dtoverlay=starvis2,<param>
+Params: 4lane Enable 4 CSI2 data lanes (default is for 2 lane
+ operation), which requires a Pi5 or CM.
+ clock-frequency Sets the clock frequency to match that used on
+ the board.
+ Valid values are 24, 27, 37.125, 72, or
+ 74.25MHz.
+ The default is 24MHz.
+ link-frequency Confgures the link frequency to be used. Note
+ that the permitted values vary based on
+ clock-frequency and number of lanes.
+ The default is 445.5MHz for 891Mbit/s.
+ all-link-frequencies Define all permitted link frequencies to allow
+ for user selection of the preferred rate.
+ Does NOT include 1188Mbit/s as that is not
+ reliable.
+ orientation Sensor orientation (0 = front, 1 = rear,
+ 2 = external, default external)
+ rotation Mounting rotation of the camera sensor (0 or
+ 180, default 0)
+ media-controller Configure use of Media Controller API for
+ configuring the sensor (default on)
+ cam0 Adopt the default configuration for CAM0 on a
+ Compute Module (CSI0, i2c_vc, and cam0_reg).
+ vcm Enable ad5398 VCM associated with the sensor.
+ compatible Allows overriding of the compatible if automatic
+ detection at probe is undesirable.
+
+
Name: sunfounder-pipower3
Info: Overlay for SunFounder PiPower 3
Load: dtoverlay=sunfounder-pipower3,<param>=<val>
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/starvis2-overlay.dts
@@ -0,0 +1,136 @@
+// SPDX-License-Identifier: GPL-2.0-only
+// Definitions for a Sony Starvis2 camera module on VC I2C bus
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/gpio.h>
+
+/{
+ compatible = "brcm,bcm2835";
+
+ fragment@0 {
+ target = <&i2c0if>;
+ __overlay__ {
+ status = "okay";
+ };
+ };
+
+ clk_frag: fragment@1 {
+ target = <&cam1_clk>;
+ clk: __overlay__ {
+ status = "okay";
+ clock-frequency = <24000000>;
+ };
+ };
+
+ fragment@2 {
+ target = <&i2c0mux>;
+ __overlay__ {
+ status = "okay";
+ };
+ };
+
+ reg_frag: fragment@3 {
+ target = <&cam1_reg>;
+ cam_reg: __overlay__ {
+ startup-delay-us = <300000>;
+ };
+ };
+
+ i2c_frag: fragment@100 {
+ target = <&i2c_csi_dsi>;
+ __overlay__ {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "okay";
+
+ #include "starvis2.dtsi"
+
+ vcm: ad5398@c {
+ compatible = "adi,ad5398";
+ reg = <0x0c>;
+ status = "disabled";
+ VANA-supply = <&cam1_reg>;
+ };
+ };
+ };
+
+ csi_frag: fragment@101 {
+ target = <&csi1>;
+ csi: __overlay__ {
+ status = "okay";
+
+ port {
+ csi_ep: endpoint {
+ remote-endpoint = <&cam_endpoint>;
+ clock-lanes = <0>;
+ data-lanes = <1 2>;
+ clock-noncontinuous;
+ };
+ };
+ };
+ };
+
+ fragment@102 {
+ target = <&csi1>;
+ __dormant__ {
+ compatible = "brcm,bcm2835-unicam-legacy";
+ };
+ };
+
+ fragment@201 {
+ target = <&csi_ep>;
+ __dormant__ {
+ data-lanes = <1 2 3 4>;
+ };
+ };
+
+ fragment@202 {
+ target = <&cam_endpoint>;
+ __dormant__ {
+ data-lanes = <1 2 3 4>;
+ };
+ };
+
+ fragment@203 {
+ target = <&cam_endpoint>;
+ __dormant__ {
+ link-frequencies = /bits/ 64
+ <1039500000
+ 891000000
+ 720000000
+ 594000000
+ 445500000
+ 360000000
+ 297000000>;
+ };
+ };
+
+ __overrides__ {
+ rotation = <&cam_node>,"rotation:0";
+ orientation = <&cam_node>,"orientation:0";
+ media-controller = <0>,"!102";
+ cam0 = <&i2c_frag>, "target:0=",<&i2c_csi_dsi0>,
+ <&csi_frag>, "target:0=",<&csi0>,
+ <&clk_frag>, "target:0=",<&cam0_clk>,
+ <&cam_node>, "clocks:0=",<&cam0_clk>,
+ <&reg_frag>, "target:0=",<&cam0_reg>,
+ <&cam_node>, "avdd-supply:0=",<&cam0_reg>,
+ <&vcm>, "VANA-supply:0=", <&cam0_reg>;
+ vcm = <&vcm>, "status=okay",
+ <&cam_node>,"lens-focus:0=", <&vcm>;
+ 4lane = <0>, "+201+202";
+ clock-frequency = <&clk>,"clock-frequency:0";
+ link-frequency = <&cam_endpoint>,"link-frequencies#0";
+ all-link-frequencies = <0>, "+203";
+ compatible = <&cam_node>,"compatible";
+ };
+};
+
+&cam_node {
+ status = "okay";
+};
+
+&cam_endpoint {
+ remote-endpoint = <&csi_ep>;
+};
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/starvis2.dtsi
@@ -0,0 +1,26 @@
+// Fragment that configures a Sony Starvis 2 image sensor
+
+cam_node: starvis2@1a {
+ compatible = "sony,starvis2";
+ reg = <0x1a>;
+ status = "disabled";
+
+ clocks = <&cam1_clk>;
+
+ avdd-supply = <&cam1_reg>; /* 2.8v */
+ dvdd-supply = <&cam_dummy_reg>; /* 1.8v */
+ ovdd-supply = <&cam_dummy_reg>;/* 1.2v */
+
+ rotation = <180>;
+ orientation = <2>;
+
+ port {
+ cam_endpoint: endpoint {
+ clock-lanes = <0>;
+ data-lanes = <1 2>;
+ clock-noncontinuous;
+ link-frequencies =
+ /bits/ 64 <594000000>;
+ };
+ };
+};
@@ -0,0 +1,69 @@
From 76cb11855c7b524e890e67a243f89c581cae1e09 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Mon, 21 Sep 2026 12:16:28 +0100
Subject: [PATCH] dtoverlays: Add an overlay for the Sony imx662 image sensor
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
arch/arm/boot/dts/overlays/Makefile | 1 +
arch/arm/boot/dts/overlays/README | 33 +++++++++++++++++++
arch/arm/boot/dts/overlays/imx662-overlay.dts | 1 +
3 files changed, 35 insertions(+)
create mode 100644 arch/arm/boot/dts/overlays/imx662-overlay.dts
--- a/arch/arm/boot/dts/overlays/Makefile
+++ b/arch/arm/boot/dts/overlays/Makefile
@@ -157,6 +157,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
imx500.dtbo \
imx500-pi5.dtbo \
imx519.dtbo \
+ imx662.dtbo \
imx708.dtbo \
interludeaudio-analog.dtbo \
interludeaudio-digital.dtbo \
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -3278,6 +3278,39 @@ Params: rotation Mounting
but vcm=off will disable.
+Name: imx662
+Info: Sony imx662 camera module.
+ Uses Unicam 1, which is the standard camera connector on most Pi
+ variants.
+Load: dtoverlay=imx662,<param>
+Params: 4lane Enable 4 CSI2 data lanes (default is for 2 lane
+ operation), which requires a Pi5 or CM.
+ clock-frequency Sets the clock frequency to match that used on
+ the board.
+ Valid values are 24, 27, 37.125, 72, or
+ 74.25MHz.
+ The default is 24MHz.
+ link-frequency Confgures the link frequency to be used. Note
+ that the permitted values vary based on
+ clock-frequency and number of lanes.
+ The default is 445.5MHz for 891Mbit/s.
+ all-link-frequencies Define all permitted link frequencies to allow
+ for user selection of the preferred rate.
+ Does NOT include 1188Mbit/s as that is not
+ reliable.
+ orientation Sensor orientation (0 = front, 1 = rear,
+ 2 = external, default external)
+ rotation Mounting rotation of the camera sensor (0 or
+ 180, default 0)
+ media-controller Configure use of Media Controller API for
+ configuring the sensor (default on)
+ cam0 Adopt the default configuration for CAM0 on a
+ Compute Module (CSI0, i2c_vc, and cam0_reg).
+ vcm Enable ad5398 VCM associated with the sensor.
+ compatible Allows overriding of the compatible if automatic
+ detection at probe is undesirable.
+
+
Name: imx708
Info: Sony IMX708 camera module.
Uses Unicam 1, which is the standard camera connector on most Pi
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/imx662-overlay.dts
@@ -0,0 +1 @@
+#include "starvis2-overlay.dts"
@@ -0,0 +1,120 @@
From 2027e3b64d8e70627a7aed7991d459f33913de45 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Tue, 15 Sep 2026 18:09:45 +0100
Subject: [PATCH] media: sony-starvis2: Add support for HCG mode
HCG (High Conversion Gain) adds additional gain within the sensor,
but also requires that the minimum analogue gain is 34 rather than
0 when in the default LCG mode.
Add a module parameter that is read during probe and at the start
of enable_streams, and adjust settings accordingly.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/sony-starvis2.c | 41 ++++++++++++++++++++++++++++---
1 file changed, 37 insertions(+), 4 deletions(-)
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -27,6 +27,7 @@
#include <linux/i2c.h>
#include <linux/media-bus-format.h>
#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/property.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
@@ -38,6 +39,10 @@
#include <media/v4l2-rect.h>
#include <media/v4l2-subdev.h>
+static bool hcg_mode;
+module_param(hcg_mode, bool, 0664);
+MODULE_PARM_DESC(hcg_mode, "Enable HCG mode");
+
/* Standby or streaming mode */
#define STARVIS2_REG_MODE_SELECT CCI_REG8(0x3000)
#define STARVIS2_MODE_STANDBY 0x01
@@ -84,10 +89,14 @@
*/
#define STARVIS2_REG_GAIN CCI_REG16_LE(0x3070)
#define STARVIS2_ANA_GAIN_MIN_NORMAL 0
+#define STARVIS2_ANA_GAIN_MIN_HCG 34
#define STARVIS2_ANA_GAIN_MAX_NORMAL 100
#define STARVIS2_ANA_GAIN_STEP 1
#define STARVIS2_ANA_GAIN_DEFAULT 0
+#define STARVIS2_REG_FDG_SEL0 CCI_REG8(0x3030)
+#define STARVIS2_FDG_SEL0_HCG BIT(0)
+
/* Crop */
#define STARVIS2_REG_WINMODE CCI_REG8(0x3018)
#define STARVIS2_REG_PIX_HST CCI_REG16_LE(0x303c)
@@ -1647,6 +1656,8 @@ struct starvis2 {
struct v4l2_ctrl *vblank;
struct v4l2_ctrl *hblank;
struct v4l2_ctrl *link_freq;
+ struct v4l2_ctrl *gain;
+ bool hcg_mode;
/* Track VMAX for exposure updates */
u32 vmax;
@@ -1925,6 +1936,17 @@ static int starvis2_enable_streams(struc
if (ret < 0)
return ret;
+ starvis2->hcg_mode = hcg_mode;
+ __v4l2_ctrl_modify_range(starvis2->gain,
+ starvis2->hcg_mode ?
+ STARVIS2_ANA_GAIN_MIN_HCG :
+ STARVIS2_ANA_GAIN_MIN_NORMAL,
+ STARVIS2_ANA_GAIN_MAX_NORMAL,
+ STARVIS2_ANA_GAIN_STEP,
+ starvis2->hcg_mode ?
+ STARVIS2_ANA_GAIN_MIN_HCG :
+ STARVIS2_ANA_GAIN_DEFAULT);
+
crop = v4l2_subdev_state_get_crop(state, pad);
ret = starvis2_program_window(starvis2, crop);
if (ret) {
@@ -1939,6 +1961,9 @@ static int starvis2_enable_streams(struc
goto err_rpm_put;
}
+ cci_write(starvis2->cci, STARVIS2_REG_FDG_SEL0,
+ starvis2->hcg_mode ? STARVIS2_FDG_SEL0_HCG : 0, &ret);
+
cci_write(starvis2->cci, STARVIS2_REG_MODE_SELECT,
STARVIS2_MODE_STREAMING, &ret);
usleep_range(STARVIS2_STREAM_DELAY_US, STARVIS2_STREAM_DELAY_US +
@@ -2221,10 +2246,16 @@ static int starvis2_init_controls(struct
STARVIS2_EXPOSURE_STEP,
STARVIS2_EXPOSURE_DEFAULT);
- v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops, V4L2_CID_ANALOGUE_GAIN,
- STARVIS2_ANA_GAIN_MIN_NORMAL,
- STARVIS2_ANA_GAIN_MAX_NORMAL, STARVIS2_ANA_GAIN_STEP,
- STARVIS2_ANA_GAIN_DEFAULT);
+ starvis2->gain = v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops,
+ V4L2_CID_ANALOGUE_GAIN,
+ starvis2->hcg_mode ?
+ STARVIS2_ANA_GAIN_MIN_HCG :
+ STARVIS2_ANA_GAIN_MIN_NORMAL,
+ STARVIS2_ANA_GAIN_MAX_NORMAL,
+ STARVIS2_ANA_GAIN_STEP,
+ starvis2->hcg_mode ?
+ STARVIS2_ANA_GAIN_MIN_HCG :
+ STARVIS2_ANA_GAIN_DEFAULT);
v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops, V4L2_CID_HFLIP,
0, 1, 1, 0);
@@ -2363,6 +2394,8 @@ static int starvis2_probe(struct i2c_cli
pm_runtime_set_active(dev);
pm_runtime_enable(dev);
+ starvis2->hcg_mode = hcg_mode;
+
ret = starvis2_init_controls(starvis2);
if (ret)
goto error_pm_runtime;
@@ -0,0 +1,36 @@
From 58741ff6db79f59c42ffd6e2210de0b278102487 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 16 Sep 2026 16:52:45 +0100
Subject: [PATCH] media: sony-starvis2: Allow the use of on sensor digital gain
Whilst normally digital gain would be applied in the ISP, there
are some situations where it is an advantage to allow the use of
the on-sensor digital gain too. Allow it.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/sony-starvis2.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -82,15 +82,15 @@ MODULE_PARM_DESC(hcg_mode, "Enable HCG m
#define STARVIS2_EXPOSURE_DEFAULT 1000
/*
- * Analogue gain control
- * Range is from 0 to 100 (0dB - 30dB) with 0.3dB step size
+ * Gain control
+ * Range is from 0 to 100 (0dB - 30dB) analogue gain with 0.3dB step size
* Values from 101 to 240 are valid but correspond to additional digital gain
- * (0.3dB - 42dB) so don't expose it to userspace
+ * (0.3dB - 42dB).
*/
#define STARVIS2_REG_GAIN CCI_REG16_LE(0x3070)
#define STARVIS2_ANA_GAIN_MIN_NORMAL 0
#define STARVIS2_ANA_GAIN_MIN_HCG 34
-#define STARVIS2_ANA_GAIN_MAX_NORMAL 100
+#define STARVIS2_ANA_GAIN_MAX_NORMAL 240
#define STARVIS2_ANA_GAIN_STEP 1
#define STARVIS2_ANA_GAIN_DEFAULT 0
@@ -0,0 +1,47 @@
From 7e030b60792de1c15b9ec1d8d5d34d63f0f0f1d8 Mon Sep 17 00:00:00 2001
From: Carlos Beltran <cbeltran@managingcomposites.com>
Date: Fri, 25 Sep 2026 16:17:52 +0200
Subject: [PATCH] media: i2c: arducam_64mp: Fix crop sizes for 9152x6944 and
8000x6000
The analog crop reported for these two modes uses the full pixel
array size (9248x6944), but the register settings read a smaller
area:
- 8000x6000 reads x 624-8623, y 472-6471 unbinned (0x0344-0x034a),
so the crop is 8000x6000 at the existing offset.
- 9152x6944 reads the full array and then keeps the first 9152
columns (0x0408 = 0, 0x040c = 9152), so the crop is 9152x6944
at offset 0.
Tested on a Pi 5: each mode's image was located inside a full-array
capture, confirming the position and 1:1 scale.
Link: https://github.com/raspberrypi/linux/issues/7650
Signed-off-by: Carlos Beltran <cbeltran@managingcomposites.com>
---
drivers/media/i2c/arducam_64mp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/drivers/media/i2c/arducam_64mp.c
+++ b/drivers/media/i2c/arducam_64mp.c
@@ -1244,7 +1244,7 @@ static const struct arducam_64mp_mode su
.crop = {
.left = ARDUCAM_64MP_PIXEL_ARRAY_LEFT,
.top = ARDUCAM_64MP_PIXEL_ARRAY_TOP,
- .width = 9248,
+ .width = 9152,
.height = 6944,
},
.timeperframe_default = {
@@ -1262,8 +1262,8 @@ static const struct arducam_64mp_mode su
.crop = {
.left = ARDUCAM_64MP_PIXEL_ARRAY_LEFT + 624,
.top = ARDUCAM_64MP_PIXEL_ARRAY_TOP + 472,
- .width = 9248,
- .height = 6944,
+ .width = 8000,
+ .height = 6000,
},
.timeperframe_default = {
.numerator = 100,
@@ -0,0 +1,42 @@
From 648ac9c948c43a95de21fa9b171689ba9a4e1fd1 Mon Sep 17 00:00:00 2001
From: Nicolai Buchwitz <nb@tipi-net.de>
Date: Mon, 28 Sep 2026 14:17:30 +0200
Subject: [PATCH] hwmon: rp1-adc: fix spinlock leak on errors
rp1_adc_read() returns with the spinlock held when the ADC is not ready
in time or reports a conversion error. The next read then spins on the
lock forever with preemption disabled.
This also happens when RP1 stops responding on PCIe, since CS then
reads as all ones with both READY and ERR set.
Fixes: 512bbbd5fbc1 ("hwmon: Add RP1 ADC and temperature driver")
Link: https://github.com/raspberrypi/linux/issues/7653
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
drivers/hwmon/rp1-adc.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
--- a/drivers/hwmon/rp1-adc.c
+++ b/drivers/hwmon/rp1-adc.c
@@ -98,14 +98,17 @@ static int rp1_adc_read(struct rp1_adc_d
ret = rp1_adc_ready_wait(data);
if (ret)
- return ret;
+ goto out;
/* Asserted if the completed conversion had a convergence error */
- if (readl(data->base + RP1_ADC_CS) & RP1_ADC_CS_ERR)
- return -EIO;
+ if (readl(data->base + RP1_ADC_CS) & RP1_ADC_CS_ERR) {
+ ret = -EIO;
+ goto out;
+ }
*val = readl(data->base + RP1_ADC_RESULT);
+out:
spin_unlock(&data->lock);
return ret;
@@ -0,0 +1,32 @@
From 68ea915c96a04fa3297264c96d3ac18acd37b45b Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Mon, 28 Sep 2026 17:10:52 +0100
Subject: [PATCH] media: sony-starvis2: Correct the minimum exposure
The software reference for imx678 lists register SHR0 setting
the shutter sweep time with a valid range of 4 to (Number of
lines per frame - 1), and then gives the example of all-pixel
scan mode with VMAX=2250 and SHR0=2249 giving an integraion time
of "1H + Toffset" (further defining Toffset as 0).
The driver defining STARVIS2_EXPOSURE_MIN as 2 would therefore
be contradictory, and increasing the minimum exposure achievable.
Correct STARVIS2_EXPOSURE_MIN.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/sony-starvis2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -77,7 +77,7 @@ MODULE_PARM_DESC(hcg_mode, "Enable HCG m
#define STARVIS2_SHR_MIN 8
/* Exposure control */
-#define STARVIS2_EXPOSURE_MIN 2
+#define STARVIS2_EXPOSURE_MIN 1
#define STARVIS2_EXPOSURE_STEP 1
#define STARVIS2_EXPOSURE_DEFAULT 1000
@@ -0,0 +1,64 @@
From 72538df94f7c0aebdd79edc397aff9d61987631e Mon Sep 17 00:00:00 2001
From: Arthur Guilliman <auroraxq@protonmail.com>
Date: Tue, 29 Sep 2026 10:49:14 +0800
Subject: [PATCH] overlays: i2c-rtc: Add quartz-load-femtofarads
Expose the existing DT property on pcf85063/pcf85063a so 12.5 pF
crystals can be selected from config.txt.
Signed-off-by: Arthur Guilliman <auroraxq@protonmail.com>
---
arch/arm/boot/dts/overlays/README | 6 ++++++
arch/arm/boot/dts/overlays/i2c-rtc-common.dtsi | 6 ++++--
2 files changed, 10 insertions(+), 2 deletions(-)
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -2492,6 +2492,9 @@ Params: abx80x Select o
and Vdd < Vddsw and Vbackup > Vddsw)
(RV3028, RV3032)
+ quartz-load-femtofarads Quartz load capacitance in femtofarads,
+ 7000 or 12500 (PCF85063, PCF85063A)
+
Name: i2c-rtc-gpio
Info: Adds support for a number of I2C Real Time Clock devices
@@ -2574,6 +2577,9 @@ Params: abx80x Select o
and Vdd < Vddsw and Vbackup > Vddsw)
(RV3028, RV3032)
+ quartz-load-femtofarads Quartz load capacitance in femtofarads,
+ 7000 or 12500 (PCF85063, PCF85063A)
+
i2c_gpio_sda GPIO used for I2C data (default "23")
i2c_gpio_scl GPIO used for I2C clock (default "24")
--- a/arch/arm/boot/dts/overlays/i2c-rtc-common.dtsi
+++ b/arch/arm/boot/dts/overlays/i2c-rtc-common.dtsi
@@ -209,7 +209,7 @@
#address-cells = <1>;
#size-cells = <0>;
- pcf85063@51 {
+ pcf85063: pcf85063@51 {
compatible = "nxp,pcf85063";
reg = <0x51>;
};
@@ -222,7 +222,7 @@
#address-cells = <1>;
#size-cells = <0>;
- pcf85063a@51 {
+ pcf85063a: pcf85063a@51 {
compatible = "nxp,pcf85063a";
reg = <0x51>;
};
@@ -378,5 +378,7 @@
<&m41t62>,"wakeup-source?",
<&m41t80>,"wakeup-source?",
<&pcf8563>,"wakeup-source?";
+ quartz-load-femtofarads = <&pcf85063>,"quartz-load-femtofarads:0",
+ <&pcf85063a>,"quartz-load-femtofarads:0";
};
};
@@ -0,0 +1,34 @@
From 746ade8bbc572b82ce1cdb31bc459ed85d0a7548 Mon Sep 17 00:00:00 2001
From: Arthur Guilliman <auroraxq@protonmail.com>
Date: Tue, 29 Sep 2026 18:10:55 +0800
Subject: [PATCH] overlays: i2c-rtc: Fix README parameter alignment
Start the description on column 33.
Signed-off-by: Arthur Guilliman <auroraxq@protonmail.com>
---
arch/arm/boot/dts/overlays/README | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -2492,7 +2492,8 @@ Params: abx80x Select o
and Vdd < Vddsw and Vbackup > Vddsw)
(RV3028, RV3032)
- quartz-load-femtofarads Quartz load capacitance in femtofarads,
+ quartz-load-femtofarads
+ Quartz load capacitance in femtofarads,
7000 or 12500 (PCF85063, PCF85063A)
@@ -2577,7 +2578,8 @@ Params: abx80x Select o
and Vdd < Vddsw and Vbackup > Vddsw)
(RV3028, RV3032)
- quartz-load-femtofarads Quartz load capacitance in femtofarads,
+ quartz-load-femtofarads
+ Quartz load capacitance in femtofarads,
7000 or 12500 (PCF85063, PCF85063A)
i2c_gpio_sda GPIO used for I2C data (default "23")
@@ -0,0 +1,101 @@
From eb51c76151a63918d21603a7adc6a4c86d3b3cd1 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Mon, 28 Sep 2026 10:06:29 +0100
Subject: [PATCH] dmaengine: dw-axi-dmac: Add channel abort support
Disabling a channel will stall and timeout if it is currently
transferring to or from a slow peripheral with handshaking (which they
all have). When that happens, use the channels "abort" feature to
unblock the channel.
See: https://github.com/raspberrypi/linux/issues/7642
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
.../dma/dw-axi-dmac/dw-axi-dmac-platform.c | 44 +++++++++++++++++--
drivers/dma/dw-axi-dmac/dw-axi-dmac.h | 7 +++
2 files changed, 48 insertions(+), 3 deletions(-)
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -230,6 +230,32 @@ static inline void axi_chan_disable(stru
}
}
+/*
+ * Abort a channel, flushing its FIFO. This is only intended for use when a
+ * channel has failed to respond to a disable request, e.g. because it is
+ * stalled waiting on a peripheral handshake.
+ */
+static inline void axi_chan_abort(struct axi_dma_chan *chan)
+{
+ u64 val;
+
+ if (chan->chip->dw->hdata->reg_map_8_channels) {
+ val = BIT(chan->id) << (DMAC_CHAN_ABORT_SHIFT - 32) |
+ BIT(chan->id) << (DMAC_CHAN_ABORT_WE_SHIFT - 32);
+ axi_dma_iowrite32(chan->chip, DMAC_CHEN + 4, (u32)val);
+ } else if (chan->id >= DMAC_CHAN_16) {
+ val = (u64)(BIT(chan->id) >> DMAC_CHAN_16)
+ << (DMAC_CHAN_ABORT2_SHIFT + DMAC_CHAN_BLOCK_SHIFT) |
+ (u64)(BIT(chan->id) >> DMAC_CHAN_16)
+ << (DMAC_CHAN_ABORT2_WE_SHIFT + DMAC_CHAN_BLOCK_SHIFT);
+ axi_dma_iowrite64(chan->chip, DMAC_CHABORTREG, val);
+ } else {
+ val = BIT(chan->id) << DMAC_CHAN_ABORT2_SHIFT |
+ BIT(chan->id) << DMAC_CHAN_ABORT2_WE_SHIFT;
+ axi_dma_iowrite32(chan->chip, DMAC_CHABORTREG, (u32)val);
+ }
+}
+
static inline void axi_chan_enable(struct axi_dma_chan *chan)
{
u64 val;
@@ -1356,9 +1382,21 @@ static int dma_chan_terminate_all(struct
ret = readl_poll_timeout_atomic(chan->chip->regs + DMAC_CHEN, val,
!(val & chan_active), 1000, 50000);
- if (ret == -ETIMEDOUT)
- dev_warn(dchan2dev(dchan),
- "%s failed to stop\n", axi_chan_name(chan));
+ if (ret == -ETIMEDOUT) {
+ /*
+ * The channel is probably stalled waiting for a handshake
+ * from the peripheral - abort it. Discarding the contents
+ * of the FIFO is permitted when terminating, so this is
+ * not an error.
+ */
+ dev_dbg(dchan2dev(dchan), "%s aborting\n", axi_chan_name(chan));
+ axi_chan_abort(chan);
+ ret = readl_poll_timeout_atomic(chan->chip->regs + DMAC_CHEN, val,
+ !(val & chan_active), 10, 10000);
+ if (ret == -ETIMEDOUT)
+ dev_err(dchan2dev(dchan),
+ "%s failed to abort\n", axi_chan_name(chan));
+ }
if (chan->direction != DMA_MEM_TO_MEM)
dw_axi_dma_set_hw_channel(chan, false);
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h
@@ -221,6 +221,9 @@ static inline struct axi_dma_chan *dchan
#define DMAC_CHAN_SUSP_SHIFT 16
#define DMAC_CHAN_SUSP_WE_SHIFT 24
+#define DMAC_CHAN_ABORT_SHIFT 32
+#define DMAC_CHAN_ABORT_WE_SHIFT 40
+
/* DMAC_CHEN2 */
#define DMAC_CHAN_EN2_WE_SHIFT 16
@@ -232,6 +235,10 @@ static inline struct axi_dma_chan *dchan
#define DMAC_CHAN_SUSP2_SHIFT 0
#define DMAC_CHAN_SUSP2_WE_SHIFT 16
+/* DMAC_CHABORT */
+#define DMAC_CHAN_ABORT2_SHIFT 0
+#define DMAC_CHAN_ABORT2_WE_SHIFT 16
+
/* CH_CTL_H */
#define CH_CTL_H_ARLEN_EN BIT(6)
#define CH_CTL_H_ARLEN_POS 7
@@ -0,0 +1,228 @@
From 6e1ba052d8a8e8b6c117108fb5bdcadf0209209c Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Mon, 28 Sep 2026 10:18:16 +0100
Subject: [PATCH] misc: rp1-pio: Handle signals correctly
In the event of a signal being received, the transfer functions should
return -ERESTARTSYS, having updated the ioctl args in place to prevent
any duplication, so that the ioctl will be automatically retried once
the signal has been dealt with.
Also remove a few unnecessary error messages for non-error conditions.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/misc/rp1-pio.c | 88 ++++++++++++++++++++++++++++++++----------
1 file changed, 67 insertions(+), 21 deletions(-)
--- a/drivers/misc/rp1-pio.c
+++ b/drivers/misc/rp1-pio.c
@@ -69,6 +69,10 @@
#define HANDLER(_n, _f) \
[_IOC_NR(PIO_IOC_ ## _n)] = { #_n, rp1_pio_ ## _f, _IOC_SIZE(PIO_IOC_ ## _n) }
+/* A handler that records its progress in its args if it is interrupted */
+#define HANDLER_RESTARTABLE(_n, _f) \
+ [_IOC_NR(PIO_IOC_ ## _n)] = { #_n, rp1_pio_ ## _f, _IOC_SIZE(PIO_IOC_ ## _n), true }
+
#define ROUND_UP(x, y) (((x) + (y) - 1) - (((x) + (y) - 1) % (y)))
@@ -1195,10 +1199,24 @@ static int rp1_pio_sm_config_xfer_v2_use
args->flags);
}
+/*
+ * Record the progress of a transfer in its arguments. If the call is
+ * interrupted, the updated arguments are copied back to the caller, so that
+ * a restarted call resumes where this one stopped rather than repeating it.
+ */
+static void rp1_pio_sm_xfer_progress(struct rp1_pio_sm_xfer_data32_args *args,
+ size_t bytes)
+{
+ args->data += bytes;
+ args->data_bytes -= bytes;
+}
+
static int rp1_pio_sm_tx_user(struct rp1_pio_device *pio, struct dma_info *dma,
- const void __user *userbuf, size_t bytes)
+ struct rp1_pio_sm_xfer_data32_args *args)
{
struct platform_device *pdev = pio->pdev;
+ const void __user *userbuf = args->data;
+ size_t bytes = args->data_bytes;
struct dma_async_tx_descriptor *desc;
struct device *dev = &pdev->dev;
int ret = 0;
@@ -1209,10 +1227,8 @@ static int rp1_pio_sm_tx_user(struct rp1
/* grab the next free buffer, waiting if they're all full */
if (dma->head_idx - dma->tail_idx == dma->buf_count) {
- if (down_interruptible(&dma->buf_sem)) {
- dev_err(dev, "DMA bounce interrupted\n");
- break;
- }
+ if (down_interruptible(&dma->buf_sem))
+ return -ERESTARTSYS;
dma->tail_idx++;
}
@@ -1220,9 +1236,8 @@ static int rp1_pio_sm_tx_user(struct rp1
sg_dma_len(&dbi->sgl) = copy_bytes;
- ret = copy_from_user(dbi->buf, userbuf, copy_bytes);
- if (ret < 0)
- break;
+ if (copy_from_user(dbi->buf, userbuf, copy_bytes))
+ return -EFAULT;
userbuf += copy_bytes;
@@ -1249,6 +1264,7 @@ static int rp1_pio_sm_tx_user(struct rp1
dma->head_idx++;
bytes -= copy_bytes;
+ rp1_pio_sm_xfer_progress(args, copy_bytes);
}
return ret;
@@ -1297,9 +1313,10 @@ static int rp1_pio_sm_rx_submit(struct r
* chunk (reads can be any size up to buf_size, and need not match it).
*/
static int rp1_pio_sm_rx_user(struct rp1_pio_device *pio, struct dma_info *dma,
- void __user *userbuf, size_t bytes)
+ struct rp1_pio_sm_xfer_data32_args *args)
{
- struct device *dev = &pio->pdev->dev;
+ void __user *userbuf = args->data;
+ size_t bytes = args->data_bytes;
int ret;
if (!bytes)
@@ -1358,16 +1375,16 @@ static int rp1_pio_sm_rx_user(struct rp1
if (len > bytes)
return -EINVAL;
- if (down_interruptible(&dma->buf_sem)) {
- dev_err(dev, "DMA wait interrupted\n");
- return -ETIMEDOUT;
- }
+ if (down_interruptible(&dma->buf_sem))
+ return -ERESTARTSYS;
+
dma->tail_idx++;
if (copy_to_user(userbuf, dbi->buf, len))
return -EFAULT;
userbuf += len;
bytes -= len;
+ rp1_pio_sm_xfer_progress(args, len);
}
return 0;
@@ -1394,22 +1411,28 @@ static int rp1_pio_sm_xfer_data32_user(s
return -EINVAL;
if (args->dir == RP1_PIO_DIR_TO_SM)
- return rp1_pio_sm_tx_user(pio, dma, args->data, args->data_bytes);
+ return rp1_pio_sm_tx_user(pio, dma, args);
else
- return rp1_pio_sm_rx_user(pio, dma, args->data, args->data_bytes);
+ return rp1_pio_sm_rx_user(pio, dma, args);
}
static int rp1_pio_sm_xfer_data_user(struct rp1_pio_client *client, void *param)
{
struct rp1_pio_sm_xfer_data_args *args = param;
struct rp1_pio_sm_xfer_data32_args args32;
+ int ret;
args32.sm = args->sm;
args32.dir = args->dir;
args32.data_bytes = args->data_bytes;
args32.data = args->data;
- return rp1_pio_sm_xfer_data32_user(client, &args32);
+ ret = rp1_pio_sm_xfer_data32_user(client, &args32);
+
+ args->data_bytes = args32.data_bytes;
+ args->data = args32.data;
+
+ return ret;
}
int rp1_pio_sm_config_xfer(struct rp1_pio_client *client, uint sm, uint dir,
@@ -1509,10 +1532,11 @@ struct handler_info {
const char *name;
int (*func)(struct rp1_pio_client *client, void *param);
int argsize;
+ bool restartable;
} ioctl_handlers[] = {
HANDLER(SM_CONFIG_XFER, sm_config_xfer_user),
- HANDLER(SM_XFER_DATA, sm_xfer_data_user),
- HANDLER(SM_XFER_DATA32, sm_xfer_data32_user),
+ HANDLER_RESTARTABLE(SM_XFER_DATA, sm_xfer_data_user),
+ HANDLER_RESTARTABLE(SM_XFER_DATA32, sm_xfer_data32_user),
HANDLER(SM_CONFIG_XFER32, sm_config_xfer32_user),
HANDLER(SM_CONFIG_XFER_V2, sm_config_xfer_v2_user),
@@ -1735,6 +1759,10 @@ static long rp1_pio_ioctl(struct file *f
if (ret > 0) {
if (copy_to_user(argp, argbuf, ret))
ret = -EFAULT;
+ } else if (ret == -ERESTARTSYS && hdlr->restartable) {
+ /* Pass back the progress, so that a restart resumes from there */
+ if (copy_to_user(argp, argbuf, sz))
+ ret = -EFAULT;
}
return ret;
@@ -1779,6 +1807,7 @@ static long rp1_pio_compat_ioctl(struct
{
struct rp1_pio_sm_xfer_data_args_compat compat_param;
struct rp1_pio_sm_xfer_data_args param;
+ int ret;
if (copy_from_user(&compat_param, compat_ptr(ioctl_param), sizeof(compat_param)))
return -EFAULT;
@@ -1786,12 +1815,21 @@ static long rp1_pio_compat_ioctl(struct
param.dir = compat_param.dir;
param.data_bytes = compat_param.data_bytes;
param.data = compat_ptr(compat_param.data);
- return rp1_pio_sm_xfer_data_user(client, &param);
+ ret = rp1_pio_sm_xfer_data_user(client, &param);
+ if (ret == -ERESTARTSYS) {
+ compat_param.data_bytes = param.data_bytes;
+ compat_param.data = ptr_to_compat(param.data);
+ if (copy_to_user(compat_ptr(ioctl_param), &compat_param,
+ sizeof(compat_param)))
+ ret = -EFAULT;
+ }
+ return ret;
}
case PIO_IOC_SM_XFER_DATA32_COMPAT:
{
struct rp1_pio_sm_xfer_data32_args_compat compat_param;
struct rp1_pio_sm_xfer_data32_args param;
+ int ret;
if (copy_from_user(&compat_param, compat_ptr(ioctl_param), sizeof(compat_param)))
return -EFAULT;
@@ -1799,7 +1837,15 @@ static long rp1_pio_compat_ioctl(struct
param.dir = compat_param.dir;
param.data_bytes = compat_param.data_bytes;
param.data = compat_ptr(compat_param.data);
- return rp1_pio_sm_xfer_data32_user(client, &param);
+ ret = rp1_pio_sm_xfer_data32_user(client, &param);
+ if (ret == -ERESTARTSYS) {
+ compat_param.data_bytes = param.data_bytes;
+ compat_param.data = ptr_to_compat(param.data);
+ if (copy_to_user(compat_ptr(ioctl_param), &compat_param,
+ sizeof(compat_param)))
+ ret = -EFAULT;
+ }
+ return ret;
}
case PIO_IOC_READ_HW_COMPAT:
@@ -0,0 +1,92 @@
From eb1d43b5213525b913ba740889f01cf08478bcf4 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Mon, 28 Sep 2026 16:47:58 +0100
Subject: [PATCH] misc: rp1-pio: Clear stale RX data on close
The DMAC's hardware handshake requires a peripheral's DMA request to
stay asserted until the DMAC acknowledges a burst. If an SM's RX FIFO
reaches its DMA threshold with no transfer queued - for example when a
program exits - the request is held, and survives the FIFO being
cleared or drained. The next user of that SM then gets a phantom burst:
the first 4 or 8 words it receives are copies of a stale FIFO entry.
When an SM is released, and after it has been disabled, retire any held
request and leftover data with a throwaway RX transfer of a FIFO's worth
plus one burst, then stop the channel.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/misc/rp1-pio.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
--- a/drivers/misc/rp1-pio.c
+++ b/drivers/misc/rp1-pio.c
@@ -99,6 +99,7 @@ struct dma_info {
struct dma_chan *chan;
size_t buf_size;
size_t buf_count;
+ size_t burst_bytes;
bool cyclic;
unsigned int head_idx;
unsigned int tail_idx;
@@ -965,6 +966,42 @@ static void rp1_pio_sm_kernel_dma_callba
kfree(dxs);
}
+/*
+ * Once the RX FIFO reaches its DMA threshold, the DMA request is held until
+ * the DMAC acknowledges a burst, even if the FIFO is emptied in the meantime.
+ * A request still held when the SM is released makes the next user's first
+ * burst read stale data from the empty FIFO, so retire it (and any data that
+ * is left) with a throwaway transfer. Only one request can be outstanding, and
+ * it is satisfied by whatever is at the head of the FIFO, so a full FIFO is the
+ * most that can be pending - the extra burst is just a margin. The SM must
+ * already be disabled, so that no new data can arrive and any bursts complete
+ * almost immediately; the transfer is then stopped, finished or not.
+ */
+static void rp1_pio_sm_dma_flush_rx(struct dma_info *dma)
+{
+ size_t len = RP1_PIO_FIFO_DEPTH * sizeof(uint32_t) + dma->burst_bytes;
+ struct device *dma_dev = dma->chan->device->dev;
+ struct dma_async_tx_descriptor *desc;
+ dma_addr_t dma_addr;
+ void *buf;
+
+ dmaengine_terminate_sync(dma->chan);
+
+ buf = dma_alloc_coherent(dma_dev, len, &dma_addr, GFP_KERNEL);
+ if (!buf)
+ return;
+
+ desc = dmaengine_prep_slave_single(dma->chan, dma_addr, len,
+ DMA_DEV_TO_MEM, DMA_CTRL_ACK);
+ if (desc && dmaengine_submit(desc) >= 0) {
+ dma_async_issue_pending(dma->chan);
+ fsleep(1000);
+ }
+
+ dmaengine_terminate_sync(dma->chan);
+ dma_free_coherent(dma_dev, len, buf, dma_addr);
+}
+
static void rp1_pio_sm_dma_free(struct device *dev, struct dma_info *dma)
{
dmaengine_terminate_all(dma->chan);
@@ -1116,6 +1153,7 @@ static int rp1_pio_sm_config_xfer_intern
config.dst_maxburst = dma_caps.max_burst;
else
config.src_maxburst = dma_caps.max_burst;
+ dma->burst_bytes = dma_caps.max_burst * sizeof(uint32_t);
ret = dmaengine_slave_config(dma->chan, &config);
if (ret)
@@ -1671,6 +1709,9 @@ void rp1_pio_close(struct rp1_pio_client
struct dma_info *dma = &pio->dma_configs[i >> 1][i & 1];
claimed &= ~mask;
+ /* The SMs have been disabled, so this is safe */
+ if ((i & 1) == RP1_PIO_DIR_FROM_SM)
+ rp1_pio_sm_dma_flush_rx(dma);
rp1_pio_sm_dma_free(&pio->pdev->dev, dma);
}
}
@@ -0,0 +1,24 @@
From 55ceac59490f0b662696837e128962fb56e2017c Mon Sep 17 00:00:00 2001
From: Mark W <213702+MWP@users.noreply.github.com>
Date: Wed, 30 Sep 2026 18:28:12 +0930
Subject: [PATCH] overlays: crystalfontz-cfa050_pi_m goodix touchscreen fix
Correcting a fault in the overlay which only became apparent with the update of goodix.c (commit 7363096).
The problem was masked before the update by the driver releasing the reset line to input after reset and the PCF8574's high output then let the GT928 run.
Signed-off-by: Mark Williams <mark@crystalfontz.com>
---
arch/arm/boot/dts/overlays/crystalfontz-cfa050_pi_m-overlay.dts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/arm/boot/dts/overlays/crystalfontz-cfa050_pi_m-overlay.dts
+++ b/arch/arm/boot/dts/overlays/crystalfontz-cfa050_pi_m-overlay.dts
@@ -114,7 +114,7 @@
interrupt-parent = <&gpio>;
interrupts = <26 2>; //gpio 26, 2=high-to-low trigger
irq-gpios = <&gpio 26 0>; //gpio 26, 0=active-high
- reset-gpios = <&pcf8574a 1 1>;
+ reset-gpios = <&pcf8574a 1 0>;
touchscreen-inverted-x;
touchscreen-inverted-y;
};
@@ -0,0 +1,69 @@
From 3b0051a83226f526e2c6918f6fd434e0655eb05d Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Tue, 29 Sep 2026 13:41:32 +0100
Subject: [PATCH] misc: rp1-pio: Use the correct dev in dma_free
Although it hasn't been an issue due to the specifics of the Pi 5
platform, DMA buffers should be allocated and freed with the same "dev"
parameter. Guarantee that by deriving the dev pointer from the given
dma_info pointer.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/misc/rp1-pio.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
--- a/drivers/misc/rp1-pio.c
+++ b/drivers/misc/rp1-pio.c
@@ -1002,18 +1002,21 @@ static void rp1_pio_sm_dma_flush_rx(stru
dma_free_coherent(dma_dev, len, buf, dma_addr);
}
-static void rp1_pio_sm_dma_free(struct device *dev, struct dma_info *dma)
+static void rp1_pio_sm_dma_free(struct dma_info *dma)
{
+ /* The buffers were allocated for the DMA controller, so free them there */
+ struct device *dma_dev = dma->chan->device->dev;
+
dmaengine_terminate_all(dma->chan);
if (dma->cyclic) {
dma->buf_count = 0;
- dma_free_coherent(dev, ROUND_UP(dma->buf_size, PAGE_SIZE),
+ dma_free_coherent(dma_dev, ROUND_UP(dma->buf_size, PAGE_SIZE),
dma->bufs[0].buf,
dma->bufs[0].dma_addr);
} else {
while (dma->buf_count > 0) {
dma->buf_count--;
- dma_free_coherent(dev, ROUND_UP(dma->buf_size, PAGE_SIZE),
+ dma_free_coherent(dma_dev, ROUND_UP(dma->buf_size, PAGE_SIZE),
dma->bufs[dma->buf_count].buf,
dma->bufs[dma->buf_count].dma_addr);
}
@@ -1068,7 +1071,7 @@ static int rp1_pio_sm_config_xfer_intern
/* dma_release_channel() sleeps, so free the old channel outside the lock. */
if (reconfigure)
- rp1_pio_sm_dma_free(dev, dma);
+ rp1_pio_sm_dma_free(dma);
sema_init(&dma->buf_sem, 0);
@@ -1199,7 +1202,7 @@ static int rp1_pio_sm_config_xfer_intern
return 0;
err_dma_free:
- rp1_pio_sm_dma_free(dev, dma);
+ rp1_pio_sm_dma_free(dma);
err_unclaim:
spin_lock(&pio->lock);
@@ -1712,7 +1715,7 @@ void rp1_pio_close(struct rp1_pio_client
/* The SMs have been disabled, so this is safe */
if ((i & 1) == RP1_PIO_DIR_FROM_SM)
rp1_pio_sm_dma_flush_rx(dma);
- rp1_pio_sm_dma_free(&pio->pdev->dev, dma);
+ rp1_pio_sm_dma_free(dma);
}
}
@@ -0,0 +1,51 @@
From ccae069bb483b1f95ac659386b808b269ad988bf Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Tue, 29 Sep 2026 15:22:13 +0100
Subject: [PATCH] misc: rp1-pio: Minor cyclic DMA error path fixes
1. Set dma->cyclic earlier so it is available to rp1_pio_sm_dma_free in
the error path.
2. Set an error code in the case that the cyclic preparation fails.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/misc/rp1-pio.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/drivers/misc/rp1-pio.c
+++ b/drivers/misc/rp1-pio.c
@@ -1101,7 +1101,7 @@ static int rp1_pio_sm_config_xfer_intern
if (cyclic) {
dma->buf_size = buf_size * buf_count;
- dma->buf_count = buf_count;
+ dma->buf_count = 0;
/* Round up the allocations */
buf_size = ROUND_UP(dma->buf_size, PAGE_SIZE);
@@ -1116,6 +1116,8 @@ static int rp1_pio_sm_config_xfer_intern
}
sg_init_table(&dbi->sgl, 1);
sg_dma_address(&dbi->sgl) = dbi->dma_addr;
+ dma->buf_count = buf_count;
+ dma->cyclic = cyclic;
} else {
dma->buf_size = buf_size;
/* Round up the allocations */
@@ -1185,6 +1187,7 @@ static int rp1_pio_sm_config_xfer_intern
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!desc) {
dev_err(dev, "DMA preparation failed\n");
+ ret = -EIO;
goto err_dma_free;
}
@@ -1196,7 +1199,6 @@ static int rp1_pio_sm_config_xfer_intern
if (ret < 0)
goto err_dma_free;
- dma->cyclic = cyclic;
dma_async_issue_pending(dma->chan);
}
return 0;
@@ -0,0 +1,124 @@
From fda87bd8b6401020b59fd126ff0639b26dfe86ce Mon Sep 17 00:00:00 2001
From: Yu Dukai <646689853@qq.com>
Date: Wed, 30 Sep 2026 10:19:46 +0800
Subject: [PATCH] drm/panel: panel-waveshare-dsi: Add 10.1inch DSI LCD (E)
variants
The 10.1inch DSI LCD (E) panel (1920x1200) is wired either with 4 DSI
lanes running at 60fps or with 2 DSI lanes running at 30fps. Expose
these as two explicit variants selected via the overlay parameter
instead of runtime I2C auto-detection, keeping only the default
landscape orientation. Write the corresponding refresh rate to
register 0xd0 so the panel controller runs in the expected mode.
Signed-off-by: Yu Dukai <646689853@qq.com>
---
drivers/gpu/drm/panel/panel-waveshare-dsi.c | 59 +++++++++++++++++++++
1 file changed, 59 insertions(+)
--- a/drivers/gpu/drm/panel/panel-waveshare-dsi.c
+++ b/drivers/gpu/drm/panel/panel-waveshare-dsi.c
@@ -345,6 +345,45 @@ static const struct ws_panel_data ws_pan
.mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
};
+/* 10.1inch DSI LCD (E)
+ * https://www.waveshare.com/10.1inch-dsi-lcd-e.htm
+ */
+static const struct drm_display_mode ws_panel_1920x1200_60fps_mode = {
+ .clock = 166666,
+ .hdisplay = 1920,
+ .hsync_start = 1920 + 238,
+ .hsync_end = 1920 + 238 + 4,
+ .htotal = 1920 + 238 + 4 + 28,
+ .vdisplay = 1200,
+ .vsync_start = 1200 + 28,
+ .vsync_end = 1200 + 28 + 10,
+ .vtotal = 1200 + 28 + 10 + 30,
+};
+
+static const struct drm_display_mode ws_panel_1920x1200_30fps_mode = {
+ .clock = 83333,
+ .hdisplay = 1920,
+ .hsync_start = 1920 + 238,
+ .hsync_end = 1920 + 238 + 4,
+ .htotal = 1920 + 238 + 4 + 28,
+ .vdisplay = 1200,
+ .vsync_start = 1200 + 28,
+ .vsync_end = 1200 + 28 + 10,
+ .vtotal = 1200 + 28 + 10 + 30,
+};
+
+static const struct ws_panel_data ws_panel_10_1_e_4lane_data = {
+ .mode = &ws_panel_1920x1200_60fps_mode,
+ .lanes = 4,
+ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
+};
+
+static const struct ws_panel_data ws_panel_10_1_e_2lane_data = {
+ .mode = &ws_panel_1920x1200_30fps_mode,
+ .lanes = 2,
+ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
+};
+
static struct ws_panel *panel_to_ts(struct drm_panel *panel)
{
return container_of(panel, struct ws_panel, base);
@@ -493,12 +532,17 @@ static int ws_panel_probe(struct i2c_cli
return -EINVAL;
ts->mode = _ws_panel_data->mode;
+
if (!ts->mode)
return -EINVAL;
i2c_set_clientdata(i2c, ts);
ts->i2c = i2c;
+ if (of_device_is_compatible(dev->of_node, "waveshare,10.1inch-e-4lane-panel"))
+ ws_panel_i2c_write(ts, 0xd0, 60);
+ else if (of_device_is_compatible(dev->of_node, "waveshare,10.1inch-e-2lane-panel"))
+ ws_panel_i2c_write(ts, 0xd0, 30);
ws_panel_i2c_write(ts, 0xc0, 0x01);
ws_panel_i2c_write(ts, 0xc2, 0x01);
@@ -570,10 +614,18 @@ error:
return -ENODEV;
}
+static void ws_panel_reset(struct drm_panel *panel)
+{
+ struct ws_panel *ts = panel_to_ts(panel);
+
+ ws_panel_i2c_write(ts, 0xd2, 0x5a);
+}
+
static void ws_panel_remove(struct i2c_client *i2c)
{
struct ws_panel *ts = i2c_get_clientdata(i2c);
+ ws_panel_reset(&ts->base);
ws_panel_disable(&ts->base);
drm_panel_remove(&ts->base);
@@ -583,6 +635,7 @@ static void ws_panel_shutdown(struct i2c
{
struct ws_panel *ts = i2c_get_clientdata(i2c);
+ ws_panel_reset(&ts->base);
ws_panel_disable(&ts->base);
}
@@ -636,6 +689,12 @@ static const struct of_device_id ws_pane
.compatible = "waveshare,7.0inch-h-panel",
.data = &ws_panel_7_0_h_data,
}, {
+ .compatible = "waveshare,10.1inch-e-4lane-panel",
+ .data = &ws_panel_10_1_e_4lane_data,
+ }, {
+ .compatible = "waveshare,10.1inch-e-2lane-panel",
+ .data = &ws_panel_10_1_e_2lane_data,
+ }, {
/* sentinel */
}
};
@@ -0,0 +1,45 @@
From fc91bf882691e52d09436c2819831dc4ba61900e Mon Sep 17 00:00:00 2001
From: Yu Dukai <646689853@qq.com>
Date: Wed, 30 Sep 2026 10:20:27 +0800
Subject: [PATCH] dts: overlays: vc4-kms-dsi-waveshare-panel: Add 10.1inch E
variants
Add the 10_1_inchE_4lane and 10_1_inchE_2lane overlay parameters
matching the new panel driver compatible strings
(waveshare,10.1inch-e-4lane-panel / waveshare,10.1inch-e-2lane-panel)
for the 10.1inch DSI LCD (E): 1920x1200 at 60fps over 4 DSI lanes or
at 30fps over 2 DSI lanes, keeping only the default landscape
orientation.
Signed-off-by: Yu Dukai <646689853@qq.com>
---
arch/arm/boot/dts/overlays/README | 2 ++
.../dts/overlays/vc4-kms-dsi-waveshare-panel-overlay.dts | 6 ++++++
2 files changed, 8 insertions(+)
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -6269,6 +6269,8 @@ Params: 2_8_inch 2.8" 480
11_9_inch 11.9" 320x1480
13_3_inch_4lane 13.3" 1920x1080 4lane
13_3_inch_2lane 13.3" 1920x1080 2lane
+ 10_1_inchE_4lane 10.1" E 1920x1200 60fps 4lane
+ 10_1_inchE_2lane 10.1" E 1920x1200 30fps 2lane
i2c1 Use i2c-1 with jumper wires from GPIOs 2&3
disable_touch Disable the touch controller
rotation Set the panel orientation property
--- a/arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-panel-overlay.dts
+++ b/arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-panel-overlay.dts
@@ -136,6 +136,12 @@
7_0_inchH = <&panel>, "compatible=waveshare,7.0inch-h-panel",
<&touch>, "touchscreen-swapped-x-y?",
<&touch>, "touchscreen-inverted-x?";
+ 10_1_inchE_4lane = <&panel>, "compatible=waveshare,10.1inch-e-4lane-panel",
+ <&touch>, "touchscreen-swapped-x-y?",
+ <&touch>, "touchscreen-inverted-x?";
+ 10_1_inchE_2lane = <&panel>, "compatible=waveshare,10.1inch-e-2lane-panel",
+ <&touch>, "touchscreen-swapped-x-y?",
+ <&touch>, "touchscreen-inverted-x?";
i2c1 = <&i2c_frag>, "target:0=",<&i2c1>,
<0>, "-3-4+5";
disable_touch = <&touch>, "status=disabled";
@@ -0,0 +1,37 @@
From 1e055fd3068d63412a7d7d82a20ac98de26f13c9 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 30 Sep 2026 16:47:14 +0100
Subject: [PATCH] media: sony-starvis2: Only update bits for window mode
IMX585 requires bit 4 of the WINMODE register (0x3018) to be
set, whilst the bottom nibble selects between all-pixel and
window mode.
Switch to using cci_update_bits so that only the bottom nibble
is updated, thereby working on all supported Starvis2 sensors.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/sony-starvis2.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -99,6 +99,7 @@ MODULE_PARM_DESC(hcg_mode, "Enable HCG m
/* Crop */
#define STARVIS2_REG_WINMODE CCI_REG8(0x3018)
+#define STARVIS2_REG_WINMODE_MASK 0x0f
#define STARVIS2_REG_PIX_HST CCI_REG16_LE(0x303c)
#define STARVIS2_REG_PIX_HWIDTH CCI_REG16_LE(0x303e)
#define STARVIS2_REG_PIX_VST CCI_REG16_LE(0x3044)
@@ -1911,7 +1912,8 @@ static int starvis2_program_window(struc
int ret = 0;
cci_write(starvis2->cci, STARVIS2_REG_ADDMODE, 0x00, &ret);
- cci_write(starvis2->cci, STARVIS2_REG_WINMODE, 0x04, &ret);
+ cci_update_bits(starvis2->cci, STARVIS2_REG_WINMODE,
+ STARVIS2_REG_WINMODE_MASK, 0x04, &ret);
cci_write(starvis2->cci, STARVIS2_REG_PIX_HST,
crop->left - starvis2->variant->active_area.left, &ret);
cci_write(starvis2->cci, STARVIS2_REG_PIX_HWIDTH, crop->width, &ret);
@@ -0,0 +1,637 @@
From 7044e8a79a06984f15ed7214e8c2496114dc83f6 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 30 Sep 2026 17:11:29 +0100
Subject: [PATCH] media: sony-starvis2: Fixup imx585 configuration
The common registers and minimum HMAX values merged for IMX585 were
incorrect. Validate against the information from Sony, and confirmed
working.
Fixes: bcb59d4f4afe ("media: sony-starvis2: Add support for IMX585")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/sony-starvis2.c | 601 ++++++++++++------------------
1 file changed, 233 insertions(+), 368 deletions(-)
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -1094,385 +1094,250 @@ static const struct cci_reg_sequence imx
{ STARVIS2_REG_VCMODE, 0x01 },
{ CCI_REG8(0x306b), 0x00 },
{ STARVIS2_REG_GAIN_PGC_FIDMD, 0x01 },
- { CCI_REG8(0x3460), 0x22 },
- { CCI_REG8(0x355a), 0x64 },
- { CCI_REG8(0x3a02), 0x7a },
- { CCI_REG8(0x3a10), 0xec },
- { CCI_REG8(0x3a12), 0x71 },
- { CCI_REG8(0x3a14), 0xde },
- { CCI_REG8(0x3a20), 0x2b },
- { CCI_REG8(0x3a24), 0x22 },
- { CCI_REG8(0x3a25), 0x25 },
- { CCI_REG8(0x3a26), 0x2a },
- { CCI_REG8(0x3a27), 0x2c },
- { CCI_REG8(0x3a28), 0x39 },
- { CCI_REG8(0x3a29), 0x38 },
- { CCI_REG8(0x3a30), 0x04 },
- { CCI_REG8(0x3a31), 0x04 },
- { CCI_REG8(0x3a32), 0x03 },
- { CCI_REG8(0x3a33), 0x03 },
- { CCI_REG8(0x3a34), 0x09 },
- { CCI_REG8(0x3a35), 0x06 },
- { CCI_REG8(0x3a38), 0xcd },
- { CCI_REG8(0x3a3a), 0x4c },
- { CCI_REG8(0x3a3c), 0xb9 },
- { CCI_REG8(0x3a3e), 0x30 },
- { CCI_REG8(0x3a40), 0x2c },
- { CCI_REG8(0x3a42), 0x39 },
- { CCI_REG8(0x3a4e), 0x00 },
- { CCI_REG8(0x3a52), 0x00 },
+
+ { CCI_REG8(0x3460), 0x21 },
+ { CCI_REG8(0x3478), 0xa1 },
+ { CCI_REG8(0x347c), 0x01 },
+ { CCI_REG8(0x3480), 0x01 },
+ { CCI_REG8(0x3930), 0x0c },
+ { CCI_REG8(0x3931), 0x01 },
+ { CCI_REG8(0x3a4c), 0x39 },
+ { CCI_REG8(0x3a4d), 0x01 },
+ { CCI_REG8(0x3a4e), 0x14 },
+ { CCI_REG8(0x3a50), 0x48 },
+ { CCI_REG8(0x3a51), 0x01 },
+ { CCI_REG8(0x3a52), 0x14 },
{ CCI_REG8(0x3a56), 0x00 },
{ CCI_REG8(0x3a5a), 0x00 },
{ CCI_REG8(0x3a5e), 0x00 },
{ CCI_REG8(0x3a62), 0x00 },
- { CCI_REG8(0x3a64), 0x00 },
+ { CCI_REG8(0x3a6a), 0x20 },
+ { CCI_REG8(0x3a6c), 0x42 },
{ CCI_REG8(0x3a6e), 0xa0 },
- { CCI_REG8(0x3a70), 0x50 },
- { CCI_REG8(0x3a8c), 0x04 },
- { CCI_REG8(0x3a8d), 0x03 },
- { CCI_REG8(0x3a8e), 0x09 },
- { CCI_REG8(0x3a90), 0x38 },
- { CCI_REG8(0x3a91), 0x42 },
- { CCI_REG8(0x3a92), 0x3c },
- { CCI_REG8(0x3b0e), 0xf3 },
- { CCI_REG8(0x3b12), 0xe5 },
- { CCI_REG8(0x3b27), 0xc0 },
- { CCI_REG8(0x3b2e), 0xef },
- { CCI_REG8(0x3b30), 0x6a },
- { CCI_REG8(0x3b32), 0xf6 },
- { CCI_REG8(0x3b36), 0xe1 },
- { CCI_REG8(0x3b3a), 0xe8 },
- { CCI_REG8(0x3b5a), 0x17 },
- { CCI_REG8(0x3b5e), 0xef },
- { CCI_REG8(0x3b60), 0x6a },
- { CCI_REG8(0x3b62), 0xf6 },
- { CCI_REG8(0x3b66), 0xe1 },
- { CCI_REG8(0x3b6a), 0xe8 },
- { CCI_REG8(0x3b88), 0xec },
- { CCI_REG8(0x3b8a), 0xed },
- { CCI_REG8(0x3b94), 0x71 },
- { CCI_REG8(0x3b96), 0x72 },
- { CCI_REG8(0x3b98), 0xde },
- { CCI_REG8(0x3b9a), 0xdf },
- { CCI_REG8(0x3c0f), 0x06 },
- { CCI_REG8(0x3c10), 0x06 },
- { CCI_REG8(0x3c11), 0x06 },
- { CCI_REG8(0x3c12), 0x06 },
- { CCI_REG8(0x3c13), 0x06 },
- { CCI_REG8(0x3c18), 0x20 },
- { CCI_REG8(0x3c37), 0x10 },
- { CCI_REG8(0x3c3a), 0x7a },
- { CCI_REG8(0x3c40), 0xf4 },
- { CCI_REG8(0x3c48), 0xe6 },
- { CCI_REG8(0x3c54), 0xce },
- { CCI_REG8(0x3c56), 0xd0 },
- { CCI_REG8(0x3c6c), 0x53 },
- { CCI_REG8(0x3c6e), 0x55 },
- { CCI_REG8(0x3c70), 0xc0 },
- { CCI_REG8(0x3c72), 0xc2 },
- { CCI_REG8(0x3c7e), 0xce },
- { CCI_REG8(0x3c8c), 0xcf },
- { CCI_REG8(0x3c8e), 0xeb },
- { CCI_REG8(0x3c98), 0x54 },
- { CCI_REG8(0x3c9a), 0x70 },
- { CCI_REG8(0x3c9c), 0xc1 },
- { CCI_REG8(0x3c9e), 0xdd },
- { CCI_REG8(0x3cb0), 0x7a },
- { CCI_REG8(0x3cb2), 0xba },
- { CCI_REG8(0x3cc8), 0xbc },
- { CCI_REG8(0x3cca), 0x7c },
- { CCI_REG8(0x3cd4), 0xea },
- { CCI_REG8(0x3cd5), 0x01 },
- { CCI_REG8(0x3cd6), 0x4a },
- { CCI_REG8(0x3cd8), 0x00 },
- { CCI_REG8(0x3cd9), 0x00 },
- { CCI_REG8(0x3cda), 0xff },
- { CCI_REG8(0x3cdb), 0x03 },
- { CCI_REG8(0x3cdc), 0x00 },
- { CCI_REG8(0x3cdd), 0x00 },
- { CCI_REG8(0x3cde), 0xff },
- { CCI_REG8(0x3cdf), 0x03 },
- { CCI_REG8(0x3ce4), 0x4c },
- { CCI_REG8(0x3ce6), 0xec },
- { CCI_REG8(0x3ce7), 0x01 },
- { CCI_REG8(0x3ce8), 0xff },
- { CCI_REG8(0x3ce9), 0x03 },
- { CCI_REG8(0x3cea), 0x00 },
- { CCI_REG8(0x3ceb), 0x00 },
- { CCI_REG8(0x3cec), 0xff },
- { CCI_REG8(0x3ced), 0x03 },
- { CCI_REG8(0x3cee), 0x00 },
- { CCI_REG8(0x3cef), 0x00 },
- { CCI_REG8(0x3cf2), 0xff },
- { CCI_REG8(0x3cf3), 0x03 },
- { CCI_REG8(0x3cf4), 0x00 },
- { CCI_REG8(0x3e28), 0x82 },
- { CCI_REG8(0x3e2a), 0x80 },
- { CCI_REG8(0x3e30), 0x85 },
- { CCI_REG8(0x3e32), 0x7d },
- { CCI_REG8(0x3e5c), 0xce },
- { CCI_REG8(0x3e5e), 0xd3 },
- { CCI_REG8(0x3e70), 0x53 },
- { CCI_REG8(0x3e72), 0x58 },
- { CCI_REG8(0x3e74), 0xc0 },
- { CCI_REG8(0x3e76), 0xc5 },
- { CCI_REG8(0x3e78), 0xc0 },
- { CCI_REG8(0x3e79), 0x01 },
- { CCI_REG8(0x3e7a), 0xd4 },
- { CCI_REG8(0x3e7b), 0x01 },
- { CCI_REG8(0x3eb4), 0x0b },
- { CCI_REG8(0x3eb5), 0x02 },
- { CCI_REG8(0x3eb6), 0x4d },
- { CCI_REG8(0x3eb7), 0x42 },
- { CCI_REG8(0x3eec), 0xf3 },
- { CCI_REG8(0x3eee), 0xe7 },
- { CCI_REG8(0x3f01), 0x01 },
- { CCI_REG8(0x3f24), 0x10 },
- { CCI_REG8(0x3f28), 0x2d },
- { CCI_REG8(0x3f2a), 0x2d },
- { CCI_REG8(0x3f2c), 0x2d },
- { CCI_REG8(0x3f2e), 0x2d },
- { CCI_REG8(0x3f30), 0x23 },
- { CCI_REG8(0x3f38), 0x2d },
- { CCI_REG8(0x3f3a), 0x2d },
- { CCI_REG8(0x3f3c), 0x2d },
- { CCI_REG8(0x3f3e), 0x28 },
- { CCI_REG8(0x3f40), 0x1e },
- { CCI_REG8(0x3f48), 0x2d },
- { CCI_REG8(0x3f4a), 0x2d },
- { CCI_REG8(0x3f4c), 0x00 },
- { CCI_REG8(0x4004), 0xe4 },
- { CCI_REG8(0x4006), 0xff },
- { CCI_REG8(0x4018), 0x69 },
- { CCI_REG8(0x401a), 0x84 },
- { CCI_REG8(0x401c), 0xd6 },
- { CCI_REG8(0x401e), 0xf1 },
- { CCI_REG8(0x4038), 0xde },
- { CCI_REG8(0x403a), 0x00 },
- { CCI_REG8(0x403b), 0x01 },
- { CCI_REG8(0x404c), 0x63 },
- { CCI_REG8(0x404e), 0x85 },
- { CCI_REG8(0x4050), 0xd0 },
- { CCI_REG8(0x4052), 0xf2 },
- { CCI_REG8(0x4108), 0xdd },
- { CCI_REG8(0x410a), 0xf7 },
- { CCI_REG8(0x411c), 0x62 },
- { CCI_REG8(0x411e), 0x7c },
- { CCI_REG8(0x4120), 0xcf },
- { CCI_REG8(0x4122), 0xe9 },
- { CCI_REG8(0x4138), 0xe6 },
- { CCI_REG8(0x413a), 0xf1 },
- { CCI_REG8(0x414c), 0x6b },
- { CCI_REG8(0x414e), 0x76 },
- { CCI_REG8(0x4150), 0xd8 },
- { CCI_REG8(0x4152), 0xe3 },
- { CCI_REG8(0x417e), 0x03 },
- { CCI_REG8(0x417f), 0x01 },
- { CCI_REG8(0x4186), 0xe0 },
- { CCI_REG8(0x4190), 0xf3 },
- { CCI_REG8(0x4192), 0xf7 },
- { CCI_REG8(0x419c), 0x78 },
- { CCI_REG8(0x419e), 0x7c },
- { CCI_REG8(0x41a0), 0xe5 },
- { CCI_REG8(0x41a2), 0xe9 },
- { CCI_REG8(0x41c8), 0xe2 },
- { CCI_REG8(0x41ca), 0xfd },
- { CCI_REG8(0x41dc), 0x67 },
- { CCI_REG8(0x41de), 0x82 },
- { CCI_REG8(0x41e0), 0xd4 },
- { CCI_REG8(0x41e2), 0xef },
- { CCI_REG8(0x4200), 0xde },
- { CCI_REG8(0x4202), 0xda },
- { CCI_REG8(0x4218), 0x63 },
- { CCI_REG8(0x421a), 0x5f },
- { CCI_REG8(0x421c), 0xd0 },
- { CCI_REG8(0x421e), 0xcc },
- { CCI_REG8(0x425a), 0x82 },
- { CCI_REG8(0x425c), 0xef },
- { CCI_REG8(0x4348), 0xfe },
- { CCI_REG8(0x4349), 0x06 },
- { CCI_REG8(0x4352), 0xce },
- { CCI_REG8(0x4420), 0x0b },
- { CCI_REG8(0x4421), 0x02 },
- { CCI_REG8(0x4422), 0x4d },
- { CCI_REG8(0x4423), 0x0a },
- { CCI_REG8(0x4426), 0xf5 },
- { CCI_REG8(0x442a), 0xe7 },
- { CCI_REG8(0x4432), 0xf5 },
- { CCI_REG8(0x4436), 0xe7 },
- { CCI_REG8(0x4466), 0xb4 },
- { CCI_REG8(0x446e), 0x32 },
- { CCI_REG8(0x449f), 0x1c },
- { CCI_REG8(0x44a4), 0x2c },
- { CCI_REG8(0x44a6), 0x2c },
- { CCI_REG8(0x44a8), 0x2c },
- { CCI_REG8(0x44aa), 0x2c },
- { CCI_REG8(0x44b4), 0x2c },
- { CCI_REG8(0x44b6), 0x2c },
- { CCI_REG8(0x44b8), 0x2c },
- { CCI_REG8(0x44ba), 0x2c },
- { CCI_REG8(0x44c4), 0x2c },
- { CCI_REG8(0x44c6), 0x2c },
- { CCI_REG8(0x44c8), 0x2c },
- { CCI_REG8(0x4506), 0xf3 },
- { CCI_REG8(0x450e), 0xe5 },
- { CCI_REG8(0x4516), 0xf3 },
- { CCI_REG8(0x4522), 0xe5 },
- { CCI_REG8(0x4524), 0xf3 },
- { CCI_REG8(0x452c), 0xe5 },
- { CCI_REG8(0x453c), 0x22 },
- { CCI_REG8(0x453d), 0x1b },
- { CCI_REG8(0x453e), 0x1b },
- { CCI_REG8(0x453f), 0x15 },
- { CCI_REG8(0x4540), 0x15 },
- { CCI_REG8(0x4541), 0x15 },
- { CCI_REG8(0x4542), 0x15 },
- { CCI_REG8(0x4543), 0x15 },
- { CCI_REG8(0x4544), 0x15 },
- { CCI_REG8(0x4548), 0x00 },
- { CCI_REG8(0x4549), 0x01 },
- { CCI_REG8(0x454a), 0x01 },
- { CCI_REG8(0x454b), 0x06 },
- { CCI_REG8(0x454c), 0x06 },
- { CCI_REG8(0x454d), 0x06 },
- { CCI_REG8(0x454e), 0x06 },
- { CCI_REG8(0x454f), 0x06 },
- { CCI_REG8(0x4550), 0x06 },
- { CCI_REG8(0x4554), 0x55 },
- { CCI_REG8(0x4555), 0x02 },
- { CCI_REG8(0x4556), 0x42 },
- { CCI_REG8(0x4557), 0x05 },
- { CCI_REG8(0x4558), 0xfd },
- { CCI_REG8(0x4559), 0x05 },
- { CCI_REG8(0x455a), 0x94 },
- { CCI_REG8(0x455b), 0x06 },
- { CCI_REG8(0x455d), 0x06 },
- { CCI_REG8(0x455e), 0x49 },
- { CCI_REG8(0x455f), 0x07 },
- { CCI_REG8(0x4560), 0x7f },
- { CCI_REG8(0x4561), 0x07 },
- { CCI_REG8(0x4562), 0xa5 },
- { CCI_REG8(0x4564), 0x55 },
- { CCI_REG8(0x4565), 0x02 },
- { CCI_REG8(0x4566), 0x42 },
- { CCI_REG8(0x4567), 0x05 },
- { CCI_REG8(0x4568), 0xfd },
- { CCI_REG8(0x4569), 0x05 },
- { CCI_REG8(0x456a), 0x94 },
- { CCI_REG8(0x456b), 0x06 },
- { CCI_REG8(0x456d), 0x06 },
- { CCI_REG8(0x456e), 0x49 },
- { CCI_REG8(0x456f), 0x07 },
- { CCI_REG8(0x4572), 0xa5 },
- { CCI_REG8(0x460c), 0x7d },
- { CCI_REG8(0x460e), 0xb1 },
- { CCI_REG8(0x4614), 0xa8 },
- { CCI_REG8(0x4616), 0xb2 },
- { CCI_REG8(0x461c), 0x7e },
- { CCI_REG8(0x461e), 0xa7 },
- { CCI_REG8(0x4624), 0xa8 },
- { CCI_REG8(0x4626), 0xb2 },
- { CCI_REG8(0x462c), 0x7e },
- { CCI_REG8(0x462e), 0x8a },
- { CCI_REG8(0x4630), 0x94 },
- { CCI_REG8(0x4632), 0xa7 },
- { CCI_REG8(0x4634), 0xfb },
- { CCI_REG8(0x4636), 0x2f },
- { CCI_REG8(0x4638), 0x81 },
- { CCI_REG8(0x4639), 0x01 },
- { CCI_REG8(0x463a), 0xb5 },
- { CCI_REG8(0x463b), 0x01 },
- { CCI_REG8(0x463c), 0x26 },
- { CCI_REG8(0x463e), 0x30 },
- { CCI_REG8(0x4640), 0xac },
- { CCI_REG8(0x4641), 0x01 },
- { CCI_REG8(0x4642), 0xb6 },
- { CCI_REG8(0x4643), 0x01 },
- { CCI_REG8(0x4644), 0xfc },
- { CCI_REG8(0x4646), 0x25 },
- { CCI_REG8(0x4648), 0x82 },
- { CCI_REG8(0x4649), 0x01 },
- { CCI_REG8(0x464a), 0xab },
- { CCI_REG8(0x464b), 0x01 },
- { CCI_REG8(0x464c), 0x26 },
- { CCI_REG8(0x464e), 0x30 },
- { CCI_REG8(0x4654), 0xfc },
- { CCI_REG8(0x4656), 0x08 },
- { CCI_REG8(0x4658), 0x12 },
- { CCI_REG8(0x465a), 0x25 },
- { CCI_REG8(0x4662), 0xfc },
- { CCI_REG8(0x46a2), 0xfb },
- { CCI_REG8(0x46d6), 0xf3 },
- { CCI_REG8(0x46e6), 0x00 },
- { CCI_REG8(0x46e8), 0xff },
- { CCI_REG8(0x46e9), 0x03 },
- { CCI_REG8(0x46ec), 0x7a },
- { CCI_REG8(0x46ee), 0xe5 },
- { CCI_REG8(0x46f4), 0xee },
- { CCI_REG8(0x46f6), 0xf2 },
- { CCI_REG8(0x470c), 0xff },
- { CCI_REG8(0x470d), 0x03 },
- { CCI_REG8(0x470e), 0x00 },
- { CCI_REG8(0x4714), 0xe0 },
- { CCI_REG8(0x4716), 0xe4 },
- { CCI_REG8(0x471e), 0xed },
- { CCI_REG8(0x472e), 0x00 },
- { CCI_REG8(0x4730), 0xff },
- { CCI_REG8(0x4731), 0x03 },
- { CCI_REG8(0x4734), 0x7b },
- { CCI_REG8(0x4736), 0xdf },
- { CCI_REG8(0x4754), 0x7d },
- { CCI_REG8(0x4756), 0x8b },
- { CCI_REG8(0x4758), 0x93 },
- { CCI_REG8(0x475a), 0xb1 },
- { CCI_REG8(0x475c), 0xfb },
- { CCI_REG8(0x475e), 0x09 },
- { CCI_REG8(0x4760), 0x11 },
- { CCI_REG8(0x4762), 0x2f },
- { CCI_REG8(0x4766), 0xcc },
- { CCI_REG8(0x4776), 0xcb },
- { CCI_REG8(0x477e), 0x4a },
- { CCI_REG8(0x478e), 0x49 },
- { CCI_REG8(0x4794), 0x7c },
- { CCI_REG8(0x4796), 0x8f },
- { CCI_REG8(0x4798), 0xb3 },
- { CCI_REG8(0x4799), 0x00 },
- { CCI_REG8(0x479a), 0xcc },
- { CCI_REG8(0x479c), 0xc1 },
- { CCI_REG8(0x479e), 0xcb },
- { CCI_REG8(0x47a4), 0x7d },
- { CCI_REG8(0x47a6), 0x8e },
- { CCI_REG8(0x47a8), 0xb4 },
- { CCI_REG8(0x47a9), 0x00 },
- { CCI_REG8(0x47aa), 0xc0 },
- { CCI_REG8(0x47ac), 0xfa },
- { CCI_REG8(0x47ae), 0x0d },
- { CCI_REG8(0x47b0), 0x31 },
- { CCI_REG8(0x47b1), 0x01 },
- { CCI_REG8(0x47b2), 0x4a },
- { CCI_REG8(0x47b3), 0x01 },
- { CCI_REG8(0x47b4), 0x3f },
- { CCI_REG8(0x47b6), 0x49 },
- { CCI_REG8(0x47bc), 0xfb },
- { CCI_REG8(0x47be), 0x0c },
- { CCI_REG8(0x47c0), 0x32 },
- { CCI_REG8(0x47c1), 0x01 },
- { CCI_REG8(0x47c2), 0x3e },
- { CCI_REG8(0x47c3), 0x01 },
+ { CCI_REG8(0x3b2c), 0x0c },
+ { CCI_REG8(0x3b30), 0x1c },
+ { CCI_REG8(0x3b34), 0x0c },
+ { CCI_REG8(0x3b38), 0x1c },
+ { CCI_REG8(0x3ba0), 0x0c },
+ { CCI_REG8(0x3ba4), 0x1c },
+ { CCI_REG8(0x3ba8), 0x0c },
+ { CCI_REG8(0x3bac), 0x1c },
+ { CCI_REG8(0x3d3c), 0x11 },
+ { CCI_REG8(0x3d46), 0x0b },
+ { CCI_REG8(0x3de0), 0x3f },
+ { CCI_REG8(0x3de1), 0x08 },
+ { CCI_REG8(0x3e10), 0x10 },
+ { CCI_REG8(0x3e14), 0x87 },
+ { CCI_REG8(0x3e16), 0x91 },
+ { CCI_REG8(0x3e18), 0x91 },
+ { CCI_REG8(0x3e1a), 0x87 },
+ { CCI_REG8(0x3e1c), 0x78 },
+ { CCI_REG8(0x3e1e), 0x50 },
+ { CCI_REG8(0x3e20), 0x50 },
+ { CCI_REG8(0x3e22), 0x50 },
+ { CCI_REG8(0x3e24), 0x87 },
+ { CCI_REG8(0x3e26), 0x91 },
+ { CCI_REG8(0x3e28), 0x91 },
+ { CCI_REG8(0x3e2a), 0x87 },
+ { CCI_REG8(0x3e2c), 0x78 },
+ { CCI_REG8(0x3e2e), 0x50 },
+ { CCI_REG8(0x3e30), 0x50 },
+ { CCI_REG8(0x3e32), 0x50 },
+ { CCI_REG8(0x3e34), 0x87 },
+ { CCI_REG8(0x3e36), 0x91 },
+ { CCI_REG8(0x3e38), 0x91 },
+ { CCI_REG8(0x3e3a), 0x87 },
+ { CCI_REG8(0x3e3c), 0x78 },
+ { CCI_REG8(0x3e3e), 0x50 },
+ { CCI_REG8(0x3e40), 0x50 },
+ { CCI_REG8(0x3e42), 0x50 },
+ { CCI_REG8(0x4054), 0x64 },
+ { CCI_REG8(0x4148), 0xfe },
+ { CCI_REG8(0x4149), 0x05 },
+ { CCI_REG8(0x414a), 0xff },
+ { CCI_REG8(0x414b), 0x05 },
+ { CCI_REG8(0x420a), 0x03 },
+ { CCI_REG8(0x4231), 0x08 },
+ { CCI_REG8(0x423d), 0x9c },
+ { CCI_REG8(0x4242), 0xb4 },
+ { CCI_REG8(0x4246), 0xb4 },
+ { CCI_REG8(0x424e), 0xb4 },
+ { CCI_REG8(0x425c), 0xb4 },
+ { CCI_REG8(0x425e), 0xb6 },
+ { CCI_REG8(0x426c), 0xb4 },
+ { CCI_REG8(0x426e), 0xb6 },
+ { CCI_REG8(0x428c), 0xb4 },
+ { CCI_REG8(0x428e), 0xb6 },
+ { CCI_REG8(0x4708), 0x00 },
+ { CCI_REG8(0x4709), 0x00 },
+ { CCI_REG8(0x470a), 0xff },
+ { CCI_REG8(0x470b), 0x03 },
+ { CCI_REG8(0x470c), 0x00 },
+ { CCI_REG8(0x470d), 0x00 },
+ { CCI_REG8(0x470e), 0xff },
+ { CCI_REG8(0x470f), 0x03 },
+ { CCI_REG8(0x47eb), 0x1c },
+ { CCI_REG8(0x47f0), 0xa6 },
+ { CCI_REG8(0x47f2), 0xa6 },
+ { CCI_REG8(0x47f4), 0xa0 },
+ { CCI_REG8(0x47f6), 0x96 },
+ { CCI_REG8(0x4808), 0xa6 },
+ { CCI_REG8(0x480a), 0xa6 },
+ { CCI_REG8(0x480c), 0xa0 },
+ { CCI_REG8(0x480e), 0x96 },
+ { CCI_REG8(0x492c), 0xb2 },
+ { CCI_REG8(0x4930), 0x03 },
+ { CCI_REG8(0x4932), 0x03 },
+ { CCI_REG8(0x4936), 0x5b },
+ { CCI_REG8(0x4938), 0x82 },
+ { CCI_REG8(0x493c), 0x23 },
+ { CCI_REG8(0x493e), 0x23 },
+ { CCI_REG8(0x4940), 0x23 },
+ { CCI_REG8(0x4ba8), 0x1c },
+ { CCI_REG8(0x4ba9), 0x03 },
+ { CCI_REG8(0x4bac), 0x1c },
+ { CCI_REG8(0x4bad), 0x1c },
+ { CCI_REG8(0x4bae), 0x1c },
+ { CCI_REG8(0x4baf), 0x1c },
+ { CCI_REG8(0x4bb0), 0x1c },
+ { CCI_REG8(0x4bb1), 0x1c },
+ { CCI_REG8(0x4bb2), 0x1c },
+ { CCI_REG8(0x4bb3), 0x1c },
+ { CCI_REG8(0x4bb4), 0x1c },
+ { CCI_REG8(0x4bb8), 0x03 },
+ { CCI_REG8(0x4bb9), 0x03 },
+ { CCI_REG8(0x4bba), 0x03 },
+ { CCI_REG8(0x4bbb), 0x03 },
+ { CCI_REG8(0x4bbc), 0x03 },
+ { CCI_REG8(0x4bbd), 0x03 },
+ { CCI_REG8(0x4bbe), 0x03 },
+ { CCI_REG8(0x4bbf), 0x03 },
+ { CCI_REG8(0x4bc0), 0x03 },
+ { CCI_REG8(0x4c14), 0x87 },
+ { CCI_REG8(0x4c16), 0x91 },
+ { CCI_REG8(0x4c18), 0x91 },
+ { CCI_REG8(0x4c1a), 0x87 },
+ { CCI_REG8(0x4c1c), 0x78 },
+ { CCI_REG8(0x4c1e), 0x50 },
+ { CCI_REG8(0x4c20), 0x50 },
+ { CCI_REG8(0x4c22), 0x50 },
+ { CCI_REG8(0x4c24), 0x87 },
+ { CCI_REG8(0x4c26), 0x91 },
+ { CCI_REG8(0x4c28), 0x91 },
+ { CCI_REG8(0x4c2a), 0x87 },
+ { CCI_REG8(0x4c2c), 0x78 },
+ { CCI_REG8(0x4c2e), 0x50 },
+ { CCI_REG8(0x4c30), 0x50 },
+ { CCI_REG8(0x4c32), 0x50 },
+ { CCI_REG8(0x4c34), 0x87 },
+ { CCI_REG8(0x4c36), 0x91 },
+ { CCI_REG8(0x4c38), 0x91 },
+ { CCI_REG8(0x4c3a), 0x87 },
+ { CCI_REG8(0x4c3c), 0x78 },
+ { CCI_REG8(0x4c3e), 0x50 },
+ { CCI_REG8(0x4c40), 0x50 },
+ { CCI_REG8(0x4c42), 0x50 },
+ { CCI_REG8(0x4d12), 0x1f },
+ { CCI_REG8(0x4d13), 0x1e },
+ { CCI_REG8(0x4d26), 0x33 },
+ { CCI_REG8(0x4e0e), 0x59 },
+ { CCI_REG8(0x4e14), 0x55 },
+ { CCI_REG8(0x4e16), 0x59 },
+ { CCI_REG8(0x4e1e), 0x3b },
+ { CCI_REG8(0x4e20), 0x47 },
+ { CCI_REG8(0x4e22), 0x54 },
+ { CCI_REG8(0x4e26), 0x81 },
+ { CCI_REG8(0x4e2c), 0x7d },
+ { CCI_REG8(0x4e2e), 0x81 },
+ { CCI_REG8(0x4e36), 0x63 },
+ { CCI_REG8(0x4e38), 0x6f },
+ { CCI_REG8(0x4e3a), 0x7c },
+ { CCI_REG8(0x4f3a), 0x3c },
+ { CCI_REG8(0x4f3c), 0x46 },
+ { CCI_REG8(0x4f3e), 0x59 },
+ { CCI_REG8(0x4f42), 0x64 },
+ { CCI_REG8(0x4f44), 0x6e },
+ { CCI_REG8(0x4f46), 0x81 },
+ { CCI_REG8(0x4f4a), 0x82 },
+ { CCI_REG8(0x4f5a), 0x81 },
+ { CCI_REG8(0x4f62), 0xaa },
+ { CCI_REG8(0x4f72), 0xa9 },
+ { CCI_REG8(0x4f78), 0x36 },
+ { CCI_REG8(0x4f7a), 0x41 },
+ { CCI_REG8(0x4f7c), 0x61 },
+ { CCI_REG8(0x4f7d), 0x01 },
+ { CCI_REG8(0x4f7e), 0x7c },
+ { CCI_REG8(0x4f7f), 0x01 },
+ { CCI_REG8(0x4f80), 0x77 },
+ { CCI_REG8(0x4f82), 0x7b },
+ { CCI_REG8(0x4f88), 0x37 },
+ { CCI_REG8(0x4f8a), 0x40 },
+ { CCI_REG8(0x4f8c), 0x62 },
+ { CCI_REG8(0x4f8d), 0x01 },
+ { CCI_REG8(0x4f8e), 0x76 },
+ { CCI_REG8(0x4f8f), 0x01 },
+ { CCI_REG8(0x4f90), 0x5e },
+ { CCI_REG8(0x4f91), 0x02 },
+ { CCI_REG8(0x4f92), 0x69 },
+ { CCI_REG8(0x4f93), 0x02 },
+ { CCI_REG8(0x4f94), 0x89 },
+ { CCI_REG8(0x4f95), 0x02 },
+ { CCI_REG8(0x4f96), 0xa4 },
+ { CCI_REG8(0x4f97), 0x02 },
+ { CCI_REG8(0x4f98), 0x9f },
+ { CCI_REG8(0x4f99), 0x02 },
+ { CCI_REG8(0x4f9a), 0xa3 },
+ { CCI_REG8(0x4f9b), 0x02 },
+ { CCI_REG8(0x4fa0), 0x5f },
+ { CCI_REG8(0x4fa1), 0x02 },
+ { CCI_REG8(0x4fa2), 0x68 },
+ { CCI_REG8(0x4fa3), 0x02 },
+ { CCI_REG8(0x4fa4), 0x8a },
+ { CCI_REG8(0x4fa5), 0x02 },
+ { CCI_REG8(0x4fa6), 0x9e },
+ { CCI_REG8(0x4fa7), 0x02 },
+ { CCI_REG8(0x519e), 0x79 },
+ { CCI_REG8(0x51a6), 0xa1 },
+ { CCI_REG8(0x51f0), 0xac },
+ { CCI_REG8(0x51f2), 0xaa },
+ { CCI_REG8(0x51f4), 0xa5 },
+ { CCI_REG8(0x51f6), 0xa0 },
+ { CCI_REG8(0x5200), 0x9b },
+ { CCI_REG8(0x5202), 0x91 },
+ { CCI_REG8(0x5204), 0x87 },
+ { CCI_REG8(0x5206), 0x82 },
+ { CCI_REG8(0x5208), 0xac },
+ { CCI_REG8(0x520a), 0xaa },
+ { CCI_REG8(0x520c), 0xa5 },
+ { CCI_REG8(0x520e), 0xa0 },
+ { CCI_REG8(0x5210), 0x9b },
+ { CCI_REG8(0x5212), 0x91 },
+ { CCI_REG8(0x5214), 0x87 },
+ { CCI_REG8(0x5216), 0x82 },
+ { CCI_REG8(0x5218), 0xac },
+ { CCI_REG8(0x521a), 0xaa },
+ { CCI_REG8(0x521c), 0xa5 },
+ { CCI_REG8(0x521e), 0xa0 },
+ { CCI_REG8(0x5220), 0x9b },
+ { CCI_REG8(0x5222), 0x91 },
+ { CCI_REG8(0x5224), 0x87 },
+ { CCI_REG8(0x5226), 0x82 },
+ { CCI_REG8(0x5b3c), 0x07 },
+
{ STARVIS2_REG_WDMODE, 0x00 },
{ STARVIS2_REG_MDBIT, 0x01 },
{ STARVIS2_REG_XXS_DRV, 0x00 },
};
static const u16 imx585_min_hmax_2lane[] = {
- [STARVIS2_LINK_FREQ_297MHZ] = 1980,
- [STARVIS2_LINK_FREQ_360MHZ] = 1980,
- [STARVIS2_LINK_FREQ_445MHZ] = 1188,
- [STARVIS2_LINK_FREQ_594MHZ] = 990,
- [STARVIS2_LINK_FREQ_720MHZ] = 990,
- [STARVIS2_LINK_FREQ_891MHZ] = 990,
- [STARVIS2_LINK_FREQ_1039MHZ] = 990,
- [STARVIS2_LINK_FREQ_1188MHZ] = 990,
+ [STARVIS2_LINK_FREQ_297MHZ] = 2984,
+ [STARVIS2_LINK_FREQ_360MHZ] = 2464,
+ [STARVIS2_LINK_FREQ_445MHZ] = 2004,
+ [STARVIS2_LINK_FREQ_594MHZ] = 1512,
+ [STARVIS2_LINK_FREQ_720MHZ] = 1226,
+ [STARVIS2_LINK_FREQ_891MHZ] = 996,
+ [STARVIS2_LINK_FREQ_1039MHZ] = 856,
+ [STARVIS2_LINK_FREQ_1188MHZ] = 856,
};
const struct starvis2_variant imx585_variant_def = {
@@ -0,0 +1,48 @@
From 8946ad8626ecacee8a8a9cffa433a23f0b118dcd Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Tue, 1 Sep 2026 16:29:02 +0100
Subject: [PATCH] ASoC: dwc: Revert i2s_stop to the upstream version
Since we started using the DWC I2S block in RP1, the upstream driver
has improved a lot. Drop the downstream version of i2s_stop, which
avoided clearing ITER and IRER in order to not block DMA, now that
upstream uses i2s_disable_dma.
See: https://github.com/raspberrypi/linux/issues/7584
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
sound/soc/dwc/dwc-i2s.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
--- a/sound/soc/dwc/dwc-i2s.c
+++ b/sound/soc/dwc/dwc-i2s.c
@@ -209,15 +209,23 @@ static void i2s_start(struct dw_i2s_dev
static void i2s_stop(struct dw_i2s_dev *dev,
struct snd_pcm_substream *substream)
{
- if (dev->is_jh7110) {
- struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
- struct snd_soc_dai_link *dai_link = rtd->dai_link;
- dai_link->trigger_stop = SND_SOC_TRIGGER_ORDER_LDC;
- }
i2s_clear_irqs(dev, substream->stream);
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ i2s_write_reg(dev->i2s_base, ITER, 0);
+ else
+ i2s_write_reg(dev->i2s_base, IRER, 0);
+
+ if (!(dev->use_pio || dev->is_jh7110))
+ i2s_disable_dma(dev, substream->stream);
i2s_disable_irqs(dev, substream->stream, 8);
+
+
+ if (!dev->active) {
+ i2s_write_reg(dev->i2s_base, CER, 0);
+ i2s_write_reg(dev->i2s_base, IER, 0);
+ }
}
static void i2s_pause(struct dw_i2s_dev *dev,
@@ -0,0 +1,114 @@
From bf7976475281b31dbd0d81c6a814d42398f82b3a Mon Sep 17 00:00:00 2001
From: Hans Verkuil <hverkuil+cisco@kernel.org>
Date: Thu, 1 Oct 2026 15:02:31 +0200
Subject: [PATCH] misc: rp1-pio: name the DMA direction with a tx bool
rp1_pio_sm_config_xfer_internal() tested dir == RP1_PIO_DIR_TO_SM in
half a dozen places, which is both repetitive and awkward to read
where the two arms of the resulting conditionals are not in the
natural tx/rx order. Derive a tx bool once and use it throughout,
putting the tx arm first consistently.
Record it in struct dma_info as well, so that code holding only a
dma_info does not have to recover the direction from the index it was
looked up by, as rp1_pio_close() had to.
No functional change.
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Assisted-by: Claude-Code:claude-opus-5
---
drivers/misc/rp1-pio.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
--- a/drivers/misc/rp1-pio.c
+++ b/drivers/misc/rp1-pio.c
@@ -101,6 +101,7 @@ struct dma_info {
size_t buf_count;
size_t burst_bytes;
bool cyclic;
+ bool tx;
unsigned int head_idx;
unsigned int tail_idx;
struct dma_buf_info bufs[DMA_BOUNCE_BUFFER_COUNT];
@@ -1024,6 +1025,7 @@ static void rp1_pio_sm_dma_free(struct d
dma_release_channel(dma->chan);
dma->chan = NULL;
dma->cyclic = false;
+ dma->tx = false;
}
static int rp1_pio_sm_config_xfer_internal(struct rp1_pio_client *client, uint sm, uint dir,
@@ -1037,6 +1039,7 @@ static int rp1_pio_sm_config_xfer_intern
struct dma_slave_caps dma_caps;
struct dma_info *dma = NULL;
bool cyclic = flags & RP1_PIO_SM_CONFIG_XFER_FL_DMA_CYCLE;
+ bool tx = dir == RP1_PIO_DIR_TO_SM;
bool prefer_light_dma = flags & BIT(0);
bool force_dma_type = flags & BIT(1);
bool reconfigure = false;
@@ -1077,7 +1080,7 @@ static int rp1_pio_sm_config_xfer_intern
/* Allocate and configure a DMA channel */
/* Careful - each SM FIFO has its own DREQ value */
- chan_name[0] = (dir == RP1_PIO_DIR_TO_SM) ? 't' : 'r';
+ chan_name[0] = tx ? 't' : 'r';
chan_name[1] = 'x';
chan_name[2] = '0' + sm;
if (prefer_light_dma)
@@ -1087,6 +1090,7 @@ static int rp1_pio_sm_config_xfer_intern
chan_name[4] = '\0';
dma->cyclic = false;
+ dma->tx = tx;
dma->chan = dma_request_chan(dev, chan_name);
if (IS_ERR(dma->chan)) {
ret = PTR_ERR(dma->chan);
@@ -1143,18 +1147,18 @@ static int rp1_pio_sm_config_xfer_intern
fifo_addr = pio->phys_addr;
fifo_addr += sm * (RP1_PIO_FIFO_TX1 - RP1_PIO_FIFO_TX0);
- fifo_addr += (dir == RP1_PIO_DIR_TO_SM) ? RP1_PIO_FIFO_TX0 : RP1_PIO_FIFO_RX0;
+ fifo_addr += tx ? RP1_PIO_FIFO_TX0 : RP1_PIO_FIFO_RX0;
config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
config.src_addr = fifo_addr;
config.dst_addr = fifo_addr;
- config.direction = (dir == RP1_PIO_DIR_TO_SM) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+ config.direction = tx ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
dma_caps.max_burst = 4;
dma_get_slave_caps(dma->chan, &dma_caps);
if (dma_caps.max_burst > RP1_PIO_FIFO_DEPTH)
dma_caps.max_burst = RP1_PIO_FIFO_DEPTH;
- if (dir == RP1_PIO_DIR_TO_SM)
+ if (tx)
config.dst_maxburst = dma_caps.max_burst;
else
config.src_maxburst = dma_caps.max_burst;
@@ -1165,12 +1169,12 @@ static int rp1_pio_sm_config_xfer_intern
goto err_dma_free;
set_dmactrl_args.sm = sm;
- set_dmactrl_args.is_tx = (dir == RP1_PIO_DIR_TO_SM);
- if (dir == RP1_PIO_DIR_FROM_SM)
- set_dmactrl_args.ctrl = RP1_PIO_DMACTRL_DEFAULT | config.src_maxburst;
- else
+ set_dmactrl_args.is_tx = tx;
+ if (tx)
set_dmactrl_args.ctrl = RP1_PIO_DMACTRL_DEFAULT |
(RP1_PIO_FIFO_DEPTH - config.dst_maxburst);
+ else
+ set_dmactrl_args.ctrl = RP1_PIO_DMACTRL_DEFAULT | config.src_maxburst;
ret = rp1_pio_sm_set_dmactrl(client, &set_dmactrl_args);
if (ret)
@@ -1715,7 +1719,7 @@ void rp1_pio_close(struct rp1_pio_client
claimed &= ~mask;
/* The SMs have been disabled, so this is safe */
- if ((i & 1) == RP1_PIO_DIR_FROM_SM)
+ if (!dma->tx)
rp1_pio_sm_dma_flush_rx(dma);
rp1_pio_sm_dma_free(dma);
}
@@ -0,0 +1,49 @@
From 07b2ae412969662a1ddfdfe9ee5247dedee166a6 Mon Sep 17 00:00:00 2001
From: Hans Verkuil <hverkuil+cisco@kernel.org>
Date: Mon, 5 Oct 2026 13:44:20 +0200
Subject: [PATCH] misc: rp1-pio: guard against unreasonable buffer allocations
Refuse total buffer sizes of > 512 MB. This also guards against
overflows if userspace passes values like ~0.
Also allow buf_count values > 4 for cyclic DMA: the limit of 4 is
specific to non-cyclic DMA.
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
---
drivers/misc/rp1-pio.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
--- a/drivers/misc/rp1-pio.c
+++ b/drivers/misc/rp1-pio.c
@@ -79,6 +79,13 @@
#define DMA_BOUNCE_BUFFER_SIZE 0x1000
#define DMA_BOUNCE_BUFFER_COUNT 4
+/*
+ * Upper bound on the buffer memory a transfer may ask the driver to
+ * allocate, i.e. on buf_size * buf_count, for cyclic and non-cyclic
+ * transfers alike. Larger requests are rejected with -EINVAL.
+ */
+#define RP1_PIO_MAX_TOTAL_BUF_SIZE (512 * 1024 * 1024)
+
struct dma_xfer_state {
struct dma_info *dma;
void (*callback)(void *param);
@@ -1052,7 +1059,15 @@ static int rp1_pio_sm_config_xfer_intern
return -EINVAL;
if ((buf_count || buf_size) &&
(!buf_size || (buf_size & 3) ||
- !buf_count || buf_count > DMA_BOUNCE_BUFFER_COUNT))
+ !buf_count || (!cyclic && buf_count > DMA_BOUNCE_BUFFER_COUNT)))
+ return -EINVAL;
+
+ /*
+ * Sanity check for insane amounts of buffer data.
+ * This also guards against potential overflow issues if either
+ * buf_size or buf_count are e.g. ~0.
+ */
+ if (buf_count && buf_size > RP1_PIO_MAX_TOTAL_BUF_SIZE / buf_count)
return -EINVAL;
/* Cyclic DMA is currently only supported for FROM_SM */
if (cyclic && dir == RP1_PIO_DIR_TO_SM)
@@ -0,0 +1,36 @@
From 25cce5411ad214dd43992fb2a8a18a20b05ffd8e Mon Sep 17 00:00:00 2001
From: Hans Verkuil <hverkuil+cisco@kernel.org>
Date: Tue, 29 Sep 2026 10:58:02 +0200
Subject: [PATCH] misc: rp1-pio: ensure >= 2 buffers are available for cyclic
DMA
In the case of cyclic DMA it was possible to accept < 2
buffers or a zero buffer size. Check this and return -EINVAL
in that case.
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Assisted-by: Claude-Code:claude-opus-5
---
drivers/misc/rp1-pio.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
--- a/drivers/misc/rp1-pio.c
+++ b/drivers/misc/rp1-pio.c
@@ -1069,9 +1069,14 @@ static int rp1_pio_sm_config_xfer_intern
*/
if (buf_count && buf_size > RP1_PIO_MAX_TOTAL_BUF_SIZE / buf_count)
return -EINVAL;
- /* Cyclic DMA is currently only supported for FROM_SM */
- if (cyclic && dir == RP1_PIO_DIR_TO_SM)
- return -EINVAL;
+ if (cyclic) {
+ /*
+ * Cyclic DMA is currently not supported for TO_SM, and
+ * needs at least two real buffers to cycle through.
+ */
+ if (tx || !buf_size || buf_count < 2)
+ return -EINVAL;
+ }
dma_mask = 1 << (sm * 2 + dir);
@@ -0,0 +1,46 @@
From 691e5e3a15cc6134a562fd602e02ed94170c5d8b Mon Sep 17 00:00:00 2001
From: Hans Verkuil <hverkuil+cisco@kernel.org>
Date: Tue, 6 Oct 2026 11:27:01 +0200
Subject: [PATCH] misc: rp1-pio: add RP1_PIO_CYCLIC_MIN_BUF_SIZE
Set the minimum DMA buf_size to RP1_PIO_CYCLIC_MIN_BUF_SIZE.
This ensures that a single period is larger than the FIFO + burst,
which avoids some corner cases.
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
---
drivers/misc/rp1-pio.c | 9 ++++++++-
include/uapi/misc/rp1_pio_if.h | 1 +
2 files changed, 9 insertions(+), 1 deletion(-)
--- a/drivers/misc/rp1-pio.c
+++ b/drivers/misc/rp1-pio.c
@@ -1071,10 +1071,17 @@ static int rp1_pio_sm_config_xfer_intern
return -EINVAL;
if (cyclic) {
/*
+ * RP1_PIO_CYCLIC_MIN_BUF_SIZE is > FIFO + burst + margin,
+ * which ensures that you can't fit a period of data in just
+ * the FIFO + burst, which might cause weird behavior.
+ */
+ if (buf_size < RP1_PIO_CYCLIC_MIN_BUF_SIZE)
+ return -EINVAL;
+ /*
* Cyclic DMA is currently not supported for TO_SM, and
* needs at least two real buffers to cycle through.
*/
- if (tx || !buf_size || buf_count < 2)
+ if (tx || buf_count < 2)
return -EINVAL;
}
--- a/include/uapi/misc/rp1_pio_if.h
+++ b/include/uapi/misc/rp1_pio_if.h
@@ -188,6 +188,7 @@ struct rp1_pio_sm_config_xfer32_args {
#define RP1_PIO_SM_CONFIG_XFER_FL_DMA_FORCE_HEAVY 2
#define RP1_PIO_SM_CONFIG_XFER_FL_DMA_FORCE_LIGHT 3
+#define RP1_PIO_CYCLIC_MIN_BUF_SIZE 128
#define RP1_PIO_SM_CONFIG_XFER_FL_DMA_CYCLE (1 << 2)
struct rp1_pio_sm_config_xfer_v2_args {
Loaded 100 of 190 files, more files were not shown because too many files have changed in this diff. Show more