From: Álvaro Fernández Rojas Date: Sat, 6 Apr 2024 15:30:49 +0000 (+0200) Subject: bcm27xx: update 6.1 patches from RPi foundation X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=20fe7e687e59bdc787362585f154a71227add004;p=openwrt%2Fopenwrt.git bcm27xx: update 6.1 patches from RPi foundation Sync 6.1 patches with the RPi foundation. Since rpi-6.6.y is now the main branch of the RPi foundation, there won't be any new patches for linux 6.1. Signed-off-by: Álvaro Fernández Rojas --- diff --git a/target/linux/bcm27xx/bcm2708/config-6.1 b/target/linux/bcm27xx/bcm2708/config-6.1 index af5d0183ec..d874eb9f8a 100644 --- a/target/linux/bcm27xx/bcm2708/config-6.1 +++ b/target/linux/bcm27xx/bcm2708/config-6.1 @@ -169,6 +169,7 @@ CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y CONFIG_GCC11_NO_ARRAY_BOUNDS=y +CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_CLOCKEVENTS=y @@ -229,6 +230,7 @@ CONFIG_LOGO_LINUX_CLUT224=y # CONFIG_LOGO_LINUX_VGA16 is not set CONFIG_MAC_PARTITION=y CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1f6 CONFIG_MAILBOX=y # CONFIG_MAILBOX_TEST is not set CONFIG_MDIO_BUS=y @@ -290,6 +292,7 @@ CONFIG_PAGE_SIZE_LESS_THAN_64KB=y CONFIG_PERF_USE_VMALLOC=y CONFIG_PGTABLE_LEVELS=2 CONFIG_PHYLIB=y +CONFIG_PHYLIB_LEDS=y CONFIG_PINCTRL=y CONFIG_PINCTRL_BCM2835=y CONFIG_PM=y diff --git a/target/linux/bcm27xx/bcm2709/config-6.1 b/target/linux/bcm27xx/bcm2709/config-6.1 index 58d695cff3..4dcca5dd04 100644 --- a/target/linux/bcm27xx/bcm2709/config-6.1 +++ b/target/linux/bcm27xx/bcm2709/config-6.1 @@ -206,6 +206,7 @@ CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y CONFIG_GCC11_NO_ARRAY_BOUNDS=y +CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y CONFIG_GENERIC_BUG=y @@ -287,6 +288,7 @@ CONFIG_LOGO_LINUX_CLUT224=y # CONFIG_LOGO_LINUX_VGA16 is not set CONFIG_MAC_PARTITION=y CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1f6 CONFIG_MAILBOX=y # CONFIG_MAILBOX_TEST is not set CONFIG_MDIO_BCM_UNIMAC=y @@ -367,6 +369,7 @@ CONFIG_PCI_MSI_IRQ_DOMAIN=y CONFIG_PERF_USE_VMALLOC=y CONFIG_PGTABLE_LEVELS=3 CONFIG_PHYLIB=y +CONFIG_PHYLIB_LEDS=y CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_PINCTRL=y CONFIG_PINCTRL_BCM2835=y diff --git a/target/linux/bcm27xx/bcm2710/config-6.1 b/target/linux/bcm27xx/bcm2710/config-6.1 index e5b357f2fa..8f262671c7 100644 --- a/target/linux/bcm27xx/bcm2710/config-6.1 +++ b/target/linux/bcm27xx/bcm2710/config-6.1 @@ -213,6 +213,7 @@ CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y CONFIG_GCC11_NO_ARRAY_BOUNDS=y +CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y @@ -286,6 +287,7 @@ CONFIG_LOGO_LINUX_CLUT224=y # CONFIG_LOGO_LINUX_VGA16 is not set CONFIG_MAC_PARTITION=y CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1f6 CONFIG_MAILBOX=y # CONFIG_MAILBOX_TEST is not set CONFIG_MDIO_BUS=y @@ -358,6 +360,7 @@ CONFIG_PCI_MSI=y CONFIG_PCI_MSI_IRQ_DOMAIN=y CONFIG_PGTABLE_LEVELS=3 CONFIG_PHYLIB=y +CONFIG_PHYLIB_LEDS=y CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_PINCTRL=y CONFIG_PINCTRL_BCM2835=y diff --git a/target/linux/bcm27xx/bcm2711/config-6.1 b/target/linux/bcm27xx/bcm2711/config-6.1 index 2feb6e9aea..1556ae5593 100644 --- a/target/linux/bcm27xx/bcm2711/config-6.1 +++ b/target/linux/bcm27xx/bcm2711/config-6.1 @@ -213,6 +213,7 @@ CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y CONFIG_GCC11_NO_ARRAY_BOUNDS=y +CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y @@ -287,6 +288,7 @@ CONFIG_LOGO_LINUX_CLUT224=y # CONFIG_LOGO_LINUX_VGA16 is not set CONFIG_MAC_PARTITION=y CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1f6 CONFIG_MAILBOX=y # CONFIG_MAILBOX_TEST is not set CONFIG_MDIO_BCM_UNIMAC=y @@ -362,6 +364,7 @@ CONFIG_PCI_MSI=y CONFIG_PCI_MSI_IRQ_DOMAIN=y CONFIG_PGTABLE_LEVELS=3 CONFIG_PHYLIB=y +CONFIG_PHYLIB_LEDS=y CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_PINCTRL=y CONFIG_PINCTRL_BCM2835=y diff --git a/target/linux/bcm27xx/bcm2712/config-6.1 b/target/linux/bcm27xx/bcm2712/config-6.1 index ddd29f78fb..ed2b623cfe 100644 --- a/target/linux/bcm27xx/bcm2712/config-6.1 +++ b/target/linux/bcm27xx/bcm2712/config-6.1 @@ -256,6 +256,7 @@ CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y CONFIG_GCC11_NO_ARRAY_BOUNDS=y +CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y @@ -360,6 +361,7 @@ CONFIG_MACB_PCI=y CONFIG_MACB_USE_HWSTAMP=y CONFIG_MAC_PARTITION=y CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1f6 CONFIG_MAILBOX=y # CONFIG_MAILBOX_TEST is not set CONFIG_MDIO_BCM_UNIMAC=y @@ -460,6 +462,7 @@ CONFIG_PCI_MSI_IRQ_DOMAIN=y CONFIG_PCI_STUB=y CONFIG_PGTABLE_LEVELS=3 CONFIG_PHYLIB=y +CONFIG_PHYLIB_LEDS=y CONFIG_PHYLINK=y CONFIG_PHYS_ADDR_T_64BIT=y # CONFIG_PHY_BRCM_SATA is not set diff --git a/target/linux/bcm27xx/patches-6.1/950-0905-drm-v3d-Improve-MMU-support-for-larger-pages.patch b/target/linux/bcm27xx/patches-6.1/950-0905-drm-v3d-Improve-MMU-support-for-larger-pages.patch deleted file mode 100644 index 3c53996ff0..0000000000 --- a/target/linux/bcm27xx/patches-6.1/950-0905-drm-v3d-Improve-MMU-support-for-larger-pages.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 12c7ea43b930976f35ce75d11fd3f55438868e13 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Fri, 4 Aug 2023 11:26:10 +0100 -Subject: [PATCH] drm/v3d: Improve MMU support for larger pages - -The built-in MMU driver went most of the way towards supporting larger -kernel pages, but dropped the ball when it comes to calculating indexes -into the page table. Fix it. - -Signed-off-by: Phil Elwell ---- - drivers/gpu/drm/v3d/v3d_mmu.c | 15 ++++++++------- - 1 file changed, 8 insertions(+), 7 deletions(-) - ---- a/drivers/gpu/drm/v3d/v3d_mmu.c -+++ b/drivers/gpu/drm/v3d/v3d_mmu.c -@@ -22,6 +22,7 @@ - #include "v3d_regs.h" - - #define V3D_MMU_PAGE_SHIFT 12 -+#define V3D_PAGE_FACTOR (PAGE_SIZE >> V3D_MMU_PAGE_SHIFT) - - /* Note: All PTEs for the 1MB superpage must be filled with the - * superpage bit set. -@@ -88,7 +89,7 @@ void v3d_mmu_insert_ptes(struct v3d_bo * - { - struct drm_gem_shmem_object *shmem_obj = &bo->base; - struct v3d_dev *v3d = to_v3d_dev(shmem_obj->base.dev); -- u32 page = bo->node.start; -+ u32 page = bo->node.start * V3D_PAGE_FACTOR; - u32 page_prot = V3D_PTE_WRITEABLE | V3D_PTE_VALID; - struct sg_dma_page_iter dma_iter; - -@@ -98,13 +99,13 @@ void v3d_mmu_insert_ptes(struct v3d_bo * - u32 pte = page_prot | page_address; - u32 i; - -- BUG_ON(page_address + (PAGE_SIZE >> V3D_MMU_PAGE_SHIFT) >= -+ BUG_ON(page_address + V3D_PAGE_FACTOR >= - BIT(24)); -- for (i = 0; i < PAGE_SIZE >> V3D_MMU_PAGE_SHIFT; i++) -+ for (i = 0; i < V3D_PAGE_FACTOR; i++) - v3d->pt[page++] = pte + i; - } - -- WARN_ON_ONCE(page - bo->node.start != -+ WARN_ON_ONCE(page - (bo->node.start * V3D_PAGE_FACTOR) != - shmem_obj->base.size >> V3D_MMU_PAGE_SHIFT); - - if (v3d_mmu_flush_all(v3d)) -@@ -115,10 +116,10 @@ void v3d_mmu_remove_ptes(struct v3d_bo * - { - struct v3d_dev *v3d = to_v3d_dev(bo->base.base.dev); - u32 npages = bo->base.base.size >> V3D_MMU_PAGE_SHIFT; -- u32 page; -+ u32 page = bo->node.start * V3D_PAGE_FACTOR; - -- for (page = bo->node.start; page < bo->node.start + npages; page++) -- v3d->pt[page] = 0; -+ while (npages--) -+ v3d->pt[page++] = 0; - - if (v3d_mmu_flush_all(v3d)) - dev_err(v3d->drm.dev, "MMU flush timeout\n"); diff --git a/target/linux/bcm27xx/patches-6.1/950-1226-i2c-designware-Look-for-CNT-values-in-DT.patch b/target/linux/bcm27xx/patches-6.1/950-1226-i2c-designware-Look-for-CNT-values-in-DT.patch deleted file mode 100644 index ccba16ad8e..0000000000 --- a/target/linux/bcm27xx/patches-6.1/950-1226-i2c-designware-Look-for-CNT-values-in-DT.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 0a09088e24c013ef608b1bb79501ef890cefc767 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 19 Dec 2023 11:16:25 +0000 -Subject: [PATCH] i2c: designware: Look for *CNT values in DT - -The i2c-designware driver supports reading precise timing values from -ACPI, but the Device Tree support relies on a combination of standard -rise and fall times and hard-coded minimum timings. The result of this -is that it is difficult to get optimum timings, particularly given that -the values are bus speed-specific and only one set can be stored in -DT at a time. - -Add support for initialisation from DT that is similar to that for -ACPI. - -Signed-off-by: Phil Elwell ---- - drivers/i2c/busses/i2c-designware-platdrv.c | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - ---- a/drivers/i2c/busses/i2c-designware-platdrv.c -+++ b/drivers/i2c/busses/i2c-designware-platdrv.c -@@ -132,9 +132,18 @@ static int mscc_twi_set_sda_hold_time(st - return 0; - } - -+static void dw_i2c_read_of_cnt(struct device_node *np, const char *name, u16 *pval) -+{ -+ u32 val; -+ -+ if (!of_property_read_u32(np, name, &val)) -+ *pval = (u16)val; -+} -+ - static int dw_i2c_of_configure(struct platform_device *pdev) - { - struct dw_i2c_dev *dev = platform_get_drvdata(pdev); -+ struct device_node *np = pdev->dev.of_node; - - switch (dev->flags & MODEL_MASK) { - case MODEL_MSCC_OCELOT: -@@ -146,6 +155,15 @@ static int dw_i2c_of_configure(struct pl - break; - } - -+ dw_i2c_read_of_cnt(np, "snps,ss_hcnt", &dev->ss_hcnt); -+ dw_i2c_read_of_cnt(np, "snps,ss_lcnt", &dev->ss_lcnt); -+ dw_i2c_read_of_cnt(np, "snps,fs_hcnt", &dev->fs_hcnt); -+ dw_i2c_read_of_cnt(np, "snps,fs_lcnt", &dev->fs_lcnt); -+ dw_i2c_read_of_cnt(np, "snps,fp_hcnt", &dev->fp_hcnt); -+ dw_i2c_read_of_cnt(np, "snps,fp_lcnt", &dev->fp_lcnt); -+ dw_i2c_read_of_cnt(np, "snps,hs_hcnt", &dev->hs_hcnt); -+ dw_i2c_read_of_cnt(np, "snps,hs_lcnt", &dev->hs_lcnt); -+ - return 0; - } - diff --git a/target/linux/bcm27xx/patches-6.1/950-1227-dts-rp1-Add-I2C-timings.patch b/target/linux/bcm27xx/patches-6.1/950-1227-dts-rp1-Add-I2C-timings.patch deleted file mode 100644 index 892f31ec9f..0000000000 --- a/target/linux/bcm27xx/patches-6.1/950-1227-dts-rp1-Add-I2C-timings.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 660d569b1a623e4b64350e608bbf8bc2cc6332e9 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 19 Dec 2023 11:27:20 +0000 -Subject: [PATCH] dts: rp1: Add I2C timings - -Signed-off-by: Phil Elwell ---- - arch/arm/boot/dts/rp1.dtsi | 42 ++++++++++++++++++++++++++++++++++++++ - 1 file changed, 42 insertions(+) - ---- a/arch/arm/boot/dts/rp1.dtsi -+++ b/arch/arm/boot/dts/rp1.dtsi -@@ -305,6 +305,12 @@ - compatible = "snps,designware-i2c"; - interrupts = ; - clocks = <&rp1_clocks RP1_CLK_SYS>; -+ snps,ss_hcnt = <978>; -+ snps,ss_lcnt = <990>; -+ snps,fs_hcnt = <200>; -+ snps,fs_lcnt = <268>; -+ snps,fp_hcnt = <60>; -+ snps,fp_lcnt = <107>; - status = "disabled"; - }; - -@@ -313,6 +319,12 @@ - compatible = "snps,designware-i2c"; - interrupts = ; - clocks = <&rp1_clocks RP1_CLK_SYS>; -+ snps,ss_hcnt = <978>; -+ snps,ss_lcnt = <990>; -+ snps,fs_hcnt = <200>; -+ snps,fs_lcnt = <268>; -+ snps,fp_hcnt = <60>; -+ snps,fp_lcnt = <107>; - status = "disabled"; - }; - -@@ -321,6 +333,12 @@ - compatible = "snps,designware-i2c"; - interrupts = ; - clocks = <&rp1_clocks RP1_CLK_SYS>; -+ snps,ss_hcnt = <978>; -+ snps,ss_lcnt = <990>; -+ snps,fs_hcnt = <200>; -+ snps,fs_lcnt = <268>; -+ snps,fp_hcnt = <60>; -+ snps,fp_lcnt = <107>; - status = "disabled"; - }; - -@@ -329,6 +347,12 @@ - compatible = "snps,designware-i2c"; - interrupts = ; - clocks = <&rp1_clocks RP1_CLK_SYS>; -+ snps,ss_hcnt = <978>; -+ snps,ss_lcnt = <990>; -+ snps,fs_hcnt = <200>; -+ snps,fs_lcnt = <268>; -+ snps,fp_hcnt = <60>; -+ snps,fp_lcnt = <107>; - status = "disabled"; - }; - -@@ -337,6 +361,12 @@ - compatible = "snps,designware-i2c"; - interrupts = ; - clocks = <&rp1_clocks RP1_CLK_SYS>; -+ snps,ss_hcnt = <978>; -+ snps,ss_lcnt = <990>; -+ snps,fs_hcnt = <200>; -+ snps,fs_lcnt = <268>; -+ snps,fp_hcnt = <60>; -+ snps,fp_lcnt = <107>; - status = "disabled"; - }; - -@@ -345,6 +375,12 @@ - compatible = "snps,designware-i2c"; - interrupts = ; - clocks = <&rp1_clocks RP1_CLK_SYS>; -+ snps,ss_hcnt = <978>; -+ snps,ss_lcnt = <990>; -+ snps,fs_hcnt = <200>; -+ snps,fs_lcnt = <268>; -+ snps,fp_hcnt = <60>; -+ snps,fp_lcnt = <107>; - status = "disabled"; - }; - -@@ -353,6 +389,12 @@ - compatible = "snps,designware-i2c"; - interrupts = ; - clocks = <&rp1_clocks RP1_CLK_SYS>; -+ snps,ss_hcnt = <978>; -+ snps,ss_lcnt = <990>; -+ snps,fs_hcnt = <200>; -+ snps,fs_lcnt = <268>; -+ snps,fp_hcnt = <60>; -+ snps,fp_lcnt = <107>; - status = "disabled"; - }; - diff --git a/target/linux/bcm27xx/patches-6.1/950-1247-drm-vc4-Optimise-vc4_hvs_dlist_free_work-to-only-rea.patch b/target/linux/bcm27xx/patches-6.1/950-1247-drm-vc4-Optimise-vc4_hvs_dlist_free_work-to-only-rea.patch new file mode 100644 index 0000000000..1e2893381d --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1247-drm-vc4-Optimise-vc4_hvs_dlist_free_work-to-only-rea.patch @@ -0,0 +1,45 @@ +From d8e53e0b83c947123c38c81d2fb5162c86d26fb5 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Thu, 4 Jan 2024 12:39:33 +0000 +Subject: [PATCH 1247/1295] drm/vc4: Optimise vc4_hvs_dlist_free_work to only + read frcnt and active once + +vc4_hvs_dlist_free_work was iterating through the list of stale +dlist entries and reading the frame count and active flags from +the hardware for each one. + +Read the frame count and active flags once, and then use the +cached value in the loop. + +Signed-off-by: Dave Stevenson +--- + drivers/gpu/drm/vc4/vc4_hvs.c | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +--- a/drivers/gpu/drm/vc4/vc4_hvs.c ++++ b/drivers/gpu/drm/vc4/vc4_hvs.c +@@ -796,14 +796,19 @@ static void vc4_hvs_dlist_free_work(stru + struct vc4_hvs *hvs = container_of(work, struct vc4_hvs, free_dlist_work); + struct vc4_hvs_dlist_allocation *cur, *next; + unsigned long flags; ++ bool active[3]; ++ u8 frcnt[3]; ++ int i; ++ + + spin_lock_irqsave(&hvs->mm_lock, flags); ++ for (i = 0; i < 3; i++) { ++ frcnt[i] = vc4_hvs_get_fifo_frame_count(hvs, i); ++ active[i] = vc4_hvs_check_channel_active(hvs, i); ++ } + list_for_each_entry_safe(cur, next, &hvs->stale_dlist_entries, node) { +- u8 frcnt; +- +- frcnt = vc4_hvs_get_fifo_frame_count(hvs, cur->channel); +- if (vc4_hvs_check_channel_active(hvs, cur->channel) && +- !vc4_hvs_frcnt_lte(cur->target_frame_count, frcnt)) ++ if (active[cur->channel] && ++ !vc4_hvs_frcnt_lte(cur->target_frame_count, frcnt[cur->channel])) + continue; + + vc4_hvs_free_dlist_entry_locked(hvs, cur); diff --git a/target/linux/bcm27xx/patches-6.1/950-1248-drm-vc4-Flush-stale-dlist-entries-if-allocation-fail.patch b/target/linux/bcm27xx/patches-6.1/950-1248-drm-vc4-Flush-stale-dlist-entries-if-allocation-fail.patch new file mode 100644 index 0000000000..27497483da --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1248-drm-vc4-Flush-stale-dlist-entries-if-allocation-fail.patch @@ -0,0 +1,69 @@ +From c0d4ab94e37991db311b0d4e955a349e359fc73a Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 17 Jan 2024 18:36:11 +0000 +Subject: [PATCH 1248/1295] drm/vc4: Flush stale dlist entries if allocation + fails + +This is largely for debug at present. +For reasons unknown we are not getting the end of frame interrupts +that should trigger a sweep of stale dlist entries. + +On allocation failure clear out ALL stale entries, and retry the +allocation. Log the interrupt status so we have debug regarding +whether the HVS believes the interrupt is enabled. + +Signed-off-by: Dave Stevenson +--- + drivers/gpu/drm/vc4/vc4_hvs.c | 27 ++++++++++++++++++++++++--- + 1 file changed, 24 insertions(+), 3 deletions(-) + +--- a/drivers/gpu/drm/vc4/vc4_hvs.c ++++ b/drivers/gpu/drm/vc4/vc4_hvs.c +@@ -634,6 +634,9 @@ static void vc4_hvs_irq_clear_eof(struct + hvs->eof_irq[channel].enabled = false; + } + ++static void vc4_hvs_free_dlist_entry_locked(struct vc4_hvs *hvs, ++ struct vc4_hvs_dlist_allocation *alloc); ++ + static struct vc4_hvs_dlist_allocation * + vc4_hvs_alloc_dlist_entry(struct vc4_hvs *hvs, + unsigned int channel, +@@ -642,6 +645,7 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs + struct vc4_dev *vc4 = hvs->vc4; + struct drm_device *dev = &vc4->base; + struct vc4_hvs_dlist_allocation *alloc; ++ struct vc4_hvs_dlist_allocation *cur, *next; + unsigned long flags; + int ret; + +@@ -659,9 +663,26 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs + dlist_count); + spin_unlock_irqrestore(&hvs->mm_lock, flags); + if (ret) { +- drm_err(dev, "Failed to allocate DLIST entry. Requested size=%zu. ret=%d\n", +- dlist_count, ret); +- return ERR_PTR(ret); ++ drm_err(dev, "Failed to allocate DLIST entry. Requested size=%zu. ret=%d. DISPCTRL is %08x\n", ++ dlist_count, ret, HVS_READ(SCALER_DISPCTRL)); ++ ++ /* This should never happen as stale entries should get released ++ * as the frame counter interrupt triggers. ++ * However we've seen this fail for reasons currently unknown. ++ * Free all stale entries now so we should be able to complete ++ * this allocation. ++ */ ++ spin_lock_irqsave(&hvs->mm_lock, flags); ++ list_for_each_entry_safe(cur, next, &hvs->stale_dlist_entries, node) { ++ vc4_hvs_free_dlist_entry_locked(hvs, cur); ++ } ++ ++ ret = drm_mm_insert_node(&hvs->dlist_mm, &alloc->mm_node, ++ dlist_count); ++ spin_unlock_irqrestore(&hvs->mm_lock, flags); ++ ++ if (ret) ++ return ERR_PTR(ret); + } + + alloc->channel = channel; diff --git a/target/linux/bcm27xx/patches-6.1/950-1249-Pisound-Don-t-export-the-button-GPIO-via-sysfs-GPIO-.patch b/target/linux/bcm27xx/patches-6.1/950-1249-Pisound-Don-t-export-the-button-GPIO-via-sysfs-GPIO-.patch new file mode 100644 index 0000000000..73f308bba3 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1249-Pisound-Don-t-export-the-button-GPIO-via-sysfs-GPIO-.patch @@ -0,0 +1,55 @@ +From cd62562b276b5724d1c75ea1465937a5bd9037db Mon Sep 17 00:00:00 2001 +From: Giedrius +Date: Fri, 19 Jan 2024 10:55:55 +0000 +Subject: [PATCH 1249/1295] Pisound: Don't export the button GPIO via sysfs + GPIO class. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Giedrius Trainavičius +--- + sound/soc/bcm/pisound.c | 9 +-------- + 1 file changed, 1 insertion(+), 8 deletions(-) + +--- a/sound/soc/bcm/pisound.c ++++ b/sound/soc/bcm/pisound.c +@@ -857,7 +857,6 @@ static int pisnd_ctl_uninit(void) + + static struct gpio_desc *osr0, *osr1, *osr2; + static struct gpio_desc *reset; +-static struct gpio_desc *button; + + static int pisnd_hw_params( + struct snd_pcm_substream *substream, +@@ -1016,8 +1015,6 @@ static int pisnd_init_gpio(struct device + + reset = gpiod_get_index(dev, "reset", 0, GPIOD_ASIS); + +- button = gpiod_get_index(dev, "button", 0, GPIOD_ASIS); +- + gpiod_direction_output(osr0, 1); + gpiod_direction_output(osr1, 1); + gpiod_direction_output(osr2, 1); +@@ -1029,8 +1026,6 @@ static int pisnd_init_gpio(struct device + gpiod_set_value(osr2, false); + gpiod_set_value(reset, true); + +- gpiod_export(button, false); +- + return 0; + } + +@@ -1039,11 +1034,9 @@ static int pisnd_uninit_gpio(void) + int i; + + struct gpio_desc **gpios[] = { +- &osr0, &osr1, &osr2, &reset, &button, ++ &osr0, &osr1, &osr2, &reset, + }; + +- gpiod_unexport(button); +- + for (i = 0; i < ARRAY_SIZE(gpios); ++i) { + if (*gpios[i] == NULL) { + printd("weird, GPIO[%d] is NULL already\n", i); diff --git a/target/linux/bcm27xx/patches-6.1/950-1250-Pisound-Read-out-the-SPI-speed-to-use-from-the-Devic.patch b/target/linux/bcm27xx/patches-6.1/950-1250-Pisound-Read-out-the-SPI-speed-to-use-from-the-Devic.patch new file mode 100644 index 0000000000..5da78175b1 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1250-Pisound-Read-out-the-SPI-speed-to-use-from-the-Devic.patch @@ -0,0 +1,94 @@ +From 273139b285f7a1a825eb689943626a0172b8802b Mon Sep 17 00:00:00 2001 +From: Giedrius +Date: Mon, 22 Jan 2024 13:26:58 +0000 +Subject: [PATCH 1250/1295] Pisound: Read out the SPI speed to use from the + Device Tree. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Giedrius Trainavičius +--- + sound/soc/bcm/pisound.c | 31 ++++++++++++++++++++++++++----- + 1 file changed, 26 insertions(+), 5 deletions(-) + +--- a/sound/soc/bcm/pisound.c ++++ b/sound/soc/bcm/pisound.c +@@ -1,6 +1,6 @@ + /* + * Pisound Linux kernel module. +- * Copyright (C) 2016-2020 Vilniaus Blokas UAB, https://blokas.io/pisound ++ * Copyright (C) 2016-2024 Vilniaus Blokas UAB, https://blokas.io/pisound + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License +@@ -142,14 +142,14 @@ static void pisnd_input_trigger(struct s + } + } + +-static struct snd_rawmidi_ops pisnd_output_ops = { ++static const struct snd_rawmidi_ops pisnd_output_ops = { + .open = pisnd_output_open, + .close = pisnd_output_close, + .trigger = pisnd_output_trigger, + .drain = pisnd_output_drain, + }; + +-static struct snd_rawmidi_ops pisnd_input_ops = { ++static const struct snd_rawmidi_ops pisnd_input_ops = { + .open = pisnd_input_open, + .close = pisnd_input_close, + .trigger = pisnd_input_trigger, +@@ -226,6 +226,7 @@ static char g_id[25]; + enum { MAX_VERSION_STR_LEN = 6 }; + static char g_fw_version[MAX_VERSION_STR_LEN]; + static char g_hw_version[MAX_VERSION_STR_LEN]; ++static u32 g_spi_speed_hz; + + static uint8_t g_ledFlashDuration; + static bool g_ledFlashDurationChanged; +@@ -329,7 +330,7 @@ static void spi_transfer(const uint8_t * + transfer.tx_buf = txbuf; + transfer.rx_buf = rxbuf; + transfer.len = len; +- transfer.speed_hz = 150000; ++ transfer.speed_hz = g_spi_speed_hz; + transfer.delay.value = 10; + transfer.delay.unit = SPI_DELAY_UNIT_USECS; + +@@ -646,6 +647,26 @@ static int pisnd_spi_init(struct device + memset(g_fw_version, 0, sizeof(g_fw_version)); + memset(g_hw_version, 0, sizeof(g_hw_version)); + ++ g_spi_speed_hz = 150000; ++ if (dev->of_node) { ++ struct device_node *spi_node; ++ ++ spi_node = of_parse_phandle( ++ dev->of_node, ++ "spi-controller", ++ 0 ++ ); ++ ++ if (spi_node) { ++ ret = of_property_read_u32(spi_node, "spi-speed-hz", &g_spi_speed_hz); ++ if (ret != 0) ++ printe("Failed reading spi-speed-hz! (%d)\n", ret); ++ ++ of_node_put(spi_node); ++ } ++ } ++ printi("Using SPI speed: %u\n", g_spi_speed_hz); ++ + spi = pisnd_spi_find_device(); + + if (spi != NULL) { +@@ -950,7 +971,7 @@ static int pisnd_startup(struct snd_pcm_ + return 0; + } + +-static struct snd_soc_ops pisnd_ops = { ++static const struct snd_soc_ops pisnd_ops = { + .startup = pisnd_startup, + .hw_params = pisnd_hw_params, + }; diff --git a/target/linux/bcm27xx/patches-6.1/950-1251-Pisound-Set-the-spi-speed-hz-for-Pisound-in-the-Devi.patch b/target/linux/bcm27xx/patches-6.1/950-1251-Pisound-Set-the-spi-speed-hz-for-Pisound-in-the-Devi.patch new file mode 100644 index 0000000000..b0ddd8f5ab --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1251-Pisound-Set-the-spi-speed-hz-for-Pisound-in-the-Devi.patch @@ -0,0 +1,129 @@ +From 92123f0abd5e24c150b54c56261813ced432ac87 Mon Sep 17 00:00:00 2001 +From: Giedrius +Date: Mon, 22 Jan 2024 13:29:24 +0000 +Subject: [PATCH 1251/1295] Pisound: Set the spi-speed-hz for Pisound in the + Device Tree overlay, and specify spi-speed-hz override for Pi 5. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Giedrius Trainavičius +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 8 ++++- + arch/arm/boot/dts/overlays/overlay_map.dts | 10 ++++++ + .../arm/boot/dts/overlays/pisound-overlay.dts | 4 ++- + .../boot/dts/overlays/pisound-pi5-overlay.dts | 31 +++++++++++++++++++ + 5 files changed, 52 insertions(+), 2 deletions(-) + create mode 100644 arch/arm/boot/dts/overlays/pisound-pi5-overlay.dts + +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -192,6 +192,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ + piscreen.dtbo \ + piscreen2r.dtbo \ + pisound.dtbo \ ++ pisound-pi5.dtbo \ + pitft22.dtbo \ + pitft28-capacitive.dtbo \ + pitft28-resistive.dtbo \ +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -3486,11 +3486,17 @@ Params: speed Display + + + Name: pisound +-Info: Configures the Blokas Labs pisound card ++Info: Configures the Blokas Labs Pisound card + Load: dtoverlay=pisound + Params: + + ++Name: pisound-pi5 ++Info: Pi 5 specific overlay override for Blokas Labs Pisound card, see pisound ++Load: dtoverlay=pisound-pi5 ++Params: ++ ++ + Name: pitft22 + Info: Adafruit PiTFT 2.2" screen + Load: dtoverlay=pitft22,= +--- a/arch/arm/boot/dts/overlays/overlay_map.dts ++++ b/arch/arm/boot/dts/overlays/overlay_map.dts +@@ -203,6 +203,16 @@ + renamed = "miniuart-bt"; + }; + ++ pisound { ++ bcm2835; ++ bcm2711; ++ bcm2712 = "pisound-pi5"; ++ }; ++ ++ pisound-pi5 { ++ bcm2712; ++ }; ++ + pwm1 { + bcm2711; + }; +--- a/arch/arm/boot/dts/overlays/pisound-overlay.dts ++++ b/arch/arm/boot/dts/overlays/pisound-overlay.dts +@@ -1,6 +1,6 @@ + /* + * Pisound Linux kernel module. +- * Copyright (C) 2016-2017 Vilniaus Blokas UAB, https://blokas.io/pisound ++ * Copyright (C) 2016-2024 Vilniaus Blokas UAB, https://blokas.io/pisound + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License +@@ -56,6 +56,7 @@ + compatible = "blokaslabs,pisound-spi"; + reg = <0>; + spi-max-frequency = <1000000>; ++ spi-speed-hz = <150000>; + }; + }; + }; +@@ -76,6 +77,7 @@ + __overlay__ { + compatible = "blokaslabs,pisound"; + i2s-controller = <&i2s_clk_consumer>; ++ spi-controller = <&pisound_spi>; + status = "okay"; + + pinctrl-names = "default"; +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pisound-pi5-overlay.dts +@@ -0,0 +1,31 @@ ++/* ++ * Pisound Linux kernel module. ++ * Copyright (C) 2016-2024 Vilniaus Blokas UAB, https://blokas.io/pisound ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; version 2 of the ++ * License. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++#include "pisound-overlay.dts" ++ ++&pisound_spi { ++ spi-speed-hz = <100000>; ++}; ++ ++/ { ++ compatible = "brcm,bcm2712"; ++}; diff --git a/target/linux/bcm27xx/patches-6.1/950-1252-Improvement-on-backup-switchover-mode-overlay-value-.patch b/target/linux/bcm27xx/patches-6.1/950-1252-Improvement-on-backup-switchover-mode-overlay-value-.patch new file mode 100644 index 0000000000..9fabd9fd13 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1252-Improvement-on-backup-switchover-mode-overlay-value-.patch @@ -0,0 +1,51 @@ +From f85acc3d0fb33ce5c92578dca7b1345915f744ff Mon Sep 17 00:00:00 2001 +From: Tiago Freire <41837236+tiagofreire-pt@users.noreply.github.com> +Date: Tue, 23 Jan 2024 12:10:24 +0000 +Subject: [PATCH 1252/1295] Improvement on backup-switchover-mode overlay value + definitions (#5884) + +For the RV3028 RTC, the definitions for its `backup-switchover-mode` overlay +were not intelligible neither complete/exhaustive. + +Accordingly to the https://github.com/raspberrypi/linux/issues/2912#issuecomment-477670051 +these one here proposed should be correct. + +`/boot/config.txt` should be as a configuration example, for rv3028, on a + Uputronics GPS Extension HAT: + + # For GPS Expansion Board from Uputronics + dtparam=i2c_arm=on + dtoverlay=i2c-rtc,rv3028,backup-switchover-mode=3 + dtoverlay=pps-gpio,gpiopin=18 + init_uart_baud=115200 + +From my tests (`sudo rmmod rtc_rv3028 && sudo i2cget -y 1 0x52 0x37`): + +`Default from factory`: `0x10` +`Mode 0`: `0x10` +`Mode 1`: `0x14` +`Mode 2`: `0x18` +`Mode 3`: `0x1c` + +`Mode 3`: `0x1c` is consistent with the manufacturer configuration script: http://store.uputronics.com/files/configure-rv3028.sh +--- + arch/arm/boot/dts/overlays/README | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -2106,7 +2106,13 @@ Params: abx80x Select o + source + + backup-switchover-mode Backup power supply switch mode. Must be 0 for +- off or 1 for Vdd < VBackup (RV3028, RV3032) ++ "Switchover disabled", 1 for "Direct Switching" ++ (if Vdd < VBackup), 2 for "Standby ++ Mode" (if Vdd < Vbackup, ++ does not draw current) or 3 for ++ "Level Switching" (if Vdd < Vbackup ++ and Vdd < Vddsw and Vbackup > Vddsw) ++ (RV3028, RV3032) + + + Name: i2c-rtc-gpio diff --git a/target/linux/bcm27xx/patches-6.1/950-1253-Harmonizing-the-improvement-on-backup-switchover-mod.patch b/target/linux/bcm27xx/patches-6.1/950-1253-Harmonizing-the-improvement-on-backup-switchover-mod.patch new file mode 100644 index 0000000000..b5fe17b959 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1253-Harmonizing-the-improvement-on-backup-switchover-mod.patch @@ -0,0 +1,30 @@ +From f2ada4aa6b1d214c67b7efe874a408be9b4eaf3f Mon Sep 17 00:00:00 2001 +From: Tiago Freire <41837236+tiagofreire-pt@users.noreply.github.com> +Date: Wed, 24 Jan 2024 10:03:03 +0000 +Subject: [PATCH 1253/1295] Harmonizing the improvement on + backup-switchover-mode overlay value definitions + +On the followup of https://github.com/raspberrypi/linux/pull/5884, I missed a second duplicate definition. Now, harmonized the entire document. + +Signed-off-by: Tiago Freire <41837236+tiagofreire-pt@users.noreply.github.com> +--- + arch/arm/boot/dts/overlays/README | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -2184,7 +2184,13 @@ Params: abx80x Select o + source + + backup-switchover-mode Backup power supply switch mode. Must be 0 for +- off or 1 for Vdd < VBackup (RV3028, RV3032) ++ "Switchover disabled", 1 for "Direct Switching" ++ (if Vdd < VBackup), 2 for "Standby ++ Mode" (if Vdd < Vbackup, ++ does not draw current) or 3 for ++ "Level Switching" (if Vdd < Vbackup ++ and Vdd < Vddsw and Vbackup > Vddsw) ++ (RV3028, RV3032) + + i2c_gpio_sda GPIO used for I2C data (default "23") + diff --git a/target/linux/bcm27xx/patches-6.1/950-1254-Add-pcie-32bit-dma-overlay-pi5-to-enable-32bit-DMA-o.patch b/target/linux/bcm27xx/patches-6.1/950-1254-Add-pcie-32bit-dma-overlay-pi5-to-enable-32bit-DMA-o.patch new file mode 100644 index 0000000000..2127d2ca4f --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1254-Add-pcie-32bit-dma-overlay-pi5-to-enable-32bit-DMA-o.patch @@ -0,0 +1,85 @@ +From 1cdbd99f402b76c61632d09a49b20ce90af0cc72 Mon Sep 17 00:00:00 2001 +From: Rodrigo Rosmaninho +Date: Tue, 23 Jan 2024 18:50:19 +0000 +Subject: [PATCH 1254/1295] Add pcie-32bit-dma-overlay-pi5 to enable 32bit DMA + on the Pi 5's external PCIe + +Changes dma-ranges in the pcie1 component of the bcm2712 dts in order to ensure that the DMA addressing space is 32bits, at the expense of having to bounce buffers. + +Signed-off-by: Rodrigo Rosmaninho +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 6 +++++ + arch/arm/boot/dts/overlays/overlay_map.dts | 5 ++++ + .../overlays/pcie-32bit-dma-pi5-overlay.dts | 26 +++++++++++++++++++ + 4 files changed, 38 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/pcie-32bit-dma-pi5-overlay.dts + +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -182,6 +182,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ + pca953x.dtbo \ + pcf857x.dtbo \ + pcie-32bit-dma.dtbo \ ++ pcie-32bit-dma-pi5.dtbo \ + pibell.dtbo \ + pifacedigital.dtbo \ + pifi-40.dtbo \ +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -3388,6 +3388,12 @@ Load: dtoverlay=pcie-32bit-dma + Params: + + ++Name: pcie-32bit-dma-pi5 ++Info: Force PCIe config to support 32bit DMA addresses at the expense of ++ having to bounce buffers (on the Pi 5). ++Load: dtoverlay=pcie-32bit-dma-pi5 ++Params: ++ + [ The pcf2127-rtc overlay has been deleted. See i2c-rtc. ] + + +--- a/arch/arm/boot/dts/overlays/overlay_map.dts ++++ b/arch/arm/boot/dts/overlays/overlay_map.dts +@@ -185,6 +185,11 @@ + + pcie-32bit-dma { + bcm2711; ++ bcm2712 = "pcie-32bit-dma-pi5"; ++ }; ++ ++ pcie-32bit-dma-pi5 { ++ bcm2712; + }; + + pi3-act-led { +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pcie-32bit-dma-pi5-overlay.dts +@@ -0,0 +1,26 @@ ++/* ++ * pcie-32bit-dma-pi5-overlay.dts ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2712"; ++ ++ fragment@0 { ++ target = <&pcie1>; ++ __overlay__ { ++ /* ++ * The size of the range is rounded up to a power of 2, ++ * so the range ends up being 0-4GB, and the MSI vector ++ * gets pushed beyond 4GB. ++ */ ++ #address-cells = <3>; ++ #size-cells = <2>; ++ dma-ranges = <0x02000000 0x0 0x00000000 0x0 0x00000000 ++ 0x0 0x80000000>; ++ }; ++ }; ++ ++}; diff --git a/target/linux/bcm27xx/patches-6.1/950-1257-i2c-designware-Use-SCL-rise-and-fall-times-in-DT.patch b/target/linux/bcm27xx/patches-6.1/950-1257-i2c-designware-Use-SCL-rise-and-fall-times-in-DT.patch new file mode 100644 index 0000000000..3aa719cc80 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1257-i2c-designware-Use-SCL-rise-and-fall-times-in-DT.patch @@ -0,0 +1,91 @@ +From b660279cc83aff2018cecfc3fb55757a8d64f607 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 16 Jan 2024 15:54:22 +0000 +Subject: [PATCH 1257/1295] i2c: designware: Use SCL rise and fall times in DT + +Calculate the HCNT and LCNT values for all modes using the rise and +fall times of SCL, the aim being a 50/50 mark/space ratio. + +Signed-off-by: Phil Elwell +--- + drivers/i2c/busses/i2c-designware-master.c | 26 ++++++++++++++++++++++ + 1 file changed, 26 insertions(+) + +--- a/drivers/i2c/busses/i2c-designware-master.c ++++ b/drivers/i2c/busses/i2c-designware-master.c +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -37,6 +38,22 @@ static void i2c_dw_configure_fifo_master + regmap_write(dev->map, DW_IC_CON, dev->master_cfg); + } + ++static u16 clock_calc(struct dw_i2c_dev *dev, bool want_high) ++{ ++ struct i2c_timings *t = &dev->timings; ++ u32 wanted_speed = t->bus_freq_hz; ++ u32 clk_khz = i2c_dw_clk_rate(dev); ++ u32 extra_ns = want_high ? t->scl_fall_ns : t->scl_rise_ns; ++ u32 extra_cycles = (u32)div_u64((u64)clk_khz * extra_ns, 1000000); ++ u32 period = div_u64((u64)clk_khz * 1000 + wanted_speed - 1, wanted_speed); ++ u32 cycles = (period + want_high)/2 - extra_cycles; ++ ++ if (cycles > 0xffff) ++ cycles = 0xffff; ++ ++ return (u16)cycles; ++} ++ + static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) + { + u32 comp_param1; +@@ -44,6 +61,7 @@ static int i2c_dw_set_timings_master(str + struct i2c_timings *t = &dev->timings; + const char *fp_str = ""; + u32 ic_clk; ++ u32 hcnt, lcnt; + int ret; + + ret = i2c_dw_acquire_lock(dev); +@@ -59,6 +77,9 @@ static int i2c_dw_set_timings_master(str + sda_falling_time = t->sda_fall_ns ?: 300; /* ns */ + scl_falling_time = t->scl_fall_ns ?: 300; /* ns */ + ++ hcnt = clock_calc(dev, true); ++ lcnt = clock_calc(dev, false); ++ + /* Calculate SCL timing parameters for standard mode if not set */ + if (!dev->ss_hcnt || !dev->ss_lcnt) { + ic_clk = i2c_dw_clk_rate(dev); +@@ -74,6 +95,8 @@ static int i2c_dw_set_timings_master(str + scl_falling_time, + 0); /* No offset */ + } ++ dev->ss_hcnt = hcnt; ++ dev->ss_lcnt = lcnt; + dev_dbg(dev->dev, "Standard Mode HCNT:LCNT = %d:%d\n", + dev->ss_hcnt, dev->ss_lcnt); + +@@ -124,6 +147,8 @@ static int i2c_dw_set_timings_master(str + scl_falling_time, + 0); /* No offset */ + } ++ dev->fs_hcnt = hcnt; ++ dev->fs_lcnt = lcnt; + dev_dbg(dev->dev, "Fast Mode%s HCNT:LCNT = %d:%d\n", + fp_str, dev->fs_hcnt, dev->fs_lcnt); + +@@ -152,6 +177,8 @@ static int i2c_dw_set_timings_master(str + scl_falling_time, + 0); /* No offset */ + } ++ dev->hs_hcnt = hcnt; ++ dev->hs_lcnt = lcnt; + dev_dbg(dev->dev, "High Speed Mode HCNT:LCNT = %d:%d\n", + dev->hs_hcnt, dev->hs_lcnt); + } diff --git a/target/linux/bcm27xx/patches-6.1/950-1258-i2c-designware-Support-non-standard-bus-speeds.patch b/target/linux/bcm27xx/patches-6.1/950-1258-i2c-designware-Support-non-standard-bus-speeds.patch new file mode 100644 index 0000000000..fc24d508e0 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1258-i2c-designware-Support-non-standard-bus-speeds.patch @@ -0,0 +1,80 @@ +From 6868dba87e2765042ac376a4a8427b9b981cd410 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 16 Jan 2024 16:03:14 +0000 +Subject: [PATCH 1258/1295] i2c: designware: Support non-standard bus speeds + +Add support for non-standard bus speeds by treating them as detuned +versions of the slowest standard speed not less than the requested +speed. + +Signed-off-by: Phil Elwell +--- + drivers/i2c/busses/i2c-designware-common.c | 27 ++++++++++++++++++++++ + drivers/i2c/busses/i2c-designware-core.h | 1 + + drivers/i2c/busses/i2c-designware-master.c | 2 +- + 3 files changed, 29 insertions(+), 1 deletion(-) + +--- a/drivers/i2c/busses/i2c-designware-common.c ++++ b/drivers/i2c/busses/i2c-designware-common.c +@@ -318,6 +318,9 @@ void i2c_dw_adjust_bus_speed(struct dw_i + { + u32 acpi_speed = i2c_dw_acpi_round_bus_speed(dev->dev); + struct i2c_timings *t = &dev->timings; ++ u32 wanted_speed; ++ u32 legal_speed = 0; ++ int i; + + /* + * Find bus speed from the "clock-frequency" device property, ACPI +@@ -329,6 +332,30 @@ void i2c_dw_adjust_bus_speed(struct dw_i + t->bus_freq_hz = max(t->bus_freq_hz, acpi_speed); + else + t->bus_freq_hz = I2C_MAX_FAST_MODE_FREQ; ++ ++ wanted_speed = t->bus_freq_hz; ++ ++ /* For unsupported speeds, scale down the lowest speed which is faster. */ ++ for (i = 0; i < ARRAY_SIZE(supported_speeds); i++) { ++ /* supported speeds is in decreasing order */ ++ if (wanted_speed == supported_speeds[i]) { ++ legal_speed = 0; ++ break; ++ } ++ if (wanted_speed > supported_speeds[i]) ++ break; ++ ++ legal_speed = supported_speeds[i]; ++ } ++ ++ if (legal_speed) { ++ /* ++ * Pretend this was the requested speed, but preserve the preferred ++ * speed so the clock counts can be scaled. ++ */ ++ t->bus_freq_hz = legal_speed; ++ dev->wanted_bus_speed = wanted_speed; ++ } + } + EXPORT_SYMBOL_GPL(i2c_dw_adjust_bus_speed); + +--- a/drivers/i2c/busses/i2c-designware-core.h ++++ b/drivers/i2c/busses/i2c-designware-core.h +@@ -287,6 +287,7 @@ struct dw_i2c_dev { + u16 fp_lcnt; + u16 hs_hcnt; + u16 hs_lcnt; ++ u32 wanted_bus_speed; + int (*acquire_lock)(void); + void (*release_lock)(void); + int semaphore_idx; +--- a/drivers/i2c/busses/i2c-designware-master.c ++++ b/drivers/i2c/busses/i2c-designware-master.c +@@ -41,7 +41,7 @@ static void i2c_dw_configure_fifo_master + static u16 clock_calc(struct dw_i2c_dev *dev, bool want_high) + { + struct i2c_timings *t = &dev->timings; +- u32 wanted_speed = t->bus_freq_hz; ++ u32 wanted_speed = dev->wanted_bus_speed ?: t->bus_freq_hz; + u32 clk_khz = i2c_dw_clk_rate(dev); + u32 extra_ns = want_high ? t->scl_fall_ns : t->scl_rise_ns; + u32 extra_cycles = (u32)div_u64((u64)clk_khz * extra_ns, 1000000); diff --git a/target/linux/bcm27xx/patches-6.1/950-1259-ARM-dts-rp1-Add-I2C-timings.patch b/target/linux/bcm27xx/patches-6.1/950-1259-ARM-dts-rp1-Add-I2C-timings.patch new file mode 100644 index 0000000000..adf7cc25bc --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1259-ARM-dts-rp1-Add-I2C-timings.patch @@ -0,0 +1,78 @@ +From 4c7a8e9e40d915c61df188d6b9f82836b616bd4f Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 16 Jan 2024 16:05:18 +0000 +Subject: [PATCH 1259/1295] ARM: dts: rp1: Add I2C timings + +Add SCL rise and fall times, to allow the derivation of timings at +arbitrary speeds. + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/rp1.dtsi | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/arch/arm/boot/dts/rp1.dtsi ++++ b/arch/arm/boot/dts/rp1.dtsi +@@ -305,6 +305,8 @@ + compatible = "snps,designware-i2c"; + interrupts = ; + clocks = <&rp1_clocks RP1_CLK_SYS>; ++ i2c-scl-rising-time-ns = <65>; ++ i2c-scl-falling-time-ns = <100>; + status = "disabled"; + }; + +@@ -313,6 +315,8 @@ + compatible = "snps,designware-i2c"; + interrupts = ; + clocks = <&rp1_clocks RP1_CLK_SYS>; ++ i2c-scl-rising-time-ns = <65>; ++ i2c-scl-falling-time-ns = <100>; + status = "disabled"; + }; + +@@ -321,6 +325,8 @@ + compatible = "snps,designware-i2c"; + interrupts = ; + clocks = <&rp1_clocks RP1_CLK_SYS>; ++ i2c-scl-rising-time-ns = <65>; ++ i2c-scl-falling-time-ns = <100>; + status = "disabled"; + }; + +@@ -329,6 +335,8 @@ + compatible = "snps,designware-i2c"; + interrupts = ; + clocks = <&rp1_clocks RP1_CLK_SYS>; ++ i2c-scl-rising-time-ns = <65>; ++ i2c-scl-falling-time-ns = <100>; + status = "disabled"; + }; + +@@ -337,6 +345,8 @@ + compatible = "snps,designware-i2c"; + interrupts = ; + clocks = <&rp1_clocks RP1_CLK_SYS>; ++ i2c-scl-rising-time-ns = <65>; ++ i2c-scl-falling-time-ns = <100>; + status = "disabled"; + }; + +@@ -345,6 +355,8 @@ + compatible = "snps,designware-i2c"; + interrupts = ; + clocks = <&rp1_clocks RP1_CLK_SYS>; ++ i2c-scl-rising-time-ns = <65>; ++ i2c-scl-falling-time-ns = <100>; + status = "disabled"; + }; + +@@ -353,6 +365,8 @@ + compatible = "snps,designware-i2c"; + interrupts = ; + clocks = <&rp1_clocks RP1_CLK_SYS>; ++ i2c-scl-rising-time-ns = <65>; ++ i2c-scl-falling-time-ns = <100>; + status = "disabled"; + }; + diff --git a/target/linux/bcm27xx/patches-6.1/950-1260-iommu-bcm2712-don-t-allow-building-as-module.patch b/target/linux/bcm27xx/patches-6.1/950-1260-iommu-bcm2712-don-t-allow-building-as-module.patch new file mode 100644 index 0000000000..98790267f6 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1260-iommu-bcm2712-don-t-allow-building-as-module.patch @@ -0,0 +1,28 @@ +From 86450c7dc4df99c3b16677cb00c2d3caf01a40f6 Mon Sep 17 00:00:00 2001 +From: Ratchanan Srirattanamet +Date: Tue, 30 Jan 2024 14:09:00 +0700 +Subject: [PATCH 1260/1295] iommu/bcm2712: don't allow building as module + +Since bcm2712-iommu{,-cache}.c doesn't have usual module descriptors +such as `MODULE_LICENSE`, configuring this as 'M' fails the build with +`ERROR: modpost: missing MODULE_LICENSE() in <...>/bcm2712-iommu.o`. +Since it seems like the code is not intended to be built as a module +anyway (it registers the driver with `builtin_platform_driver()`), don't +allow building this code as a module. + +Signed-off-by: Ratchanan Srirattanamet +--- + drivers/iommu/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/iommu/Kconfig ++++ b/drivers/iommu/Kconfig +@@ -507,7 +507,7 @@ config SPRD_IOMMU + Say Y here if you want to use the multimedia devices listed above. + + config BCM2712_IOMMU +- tristate "BCM2712 IOMMU driver" ++ bool "BCM2712 IOMMU driver" + depends on ARM64 && ARCH_BCM + select IOMMU_API + help diff --git a/target/linux/bcm27xx/patches-6.1/950-1261-drm-rp1-depends-on-instead-of-select-MFD_RP1.patch b/target/linux/bcm27xx/patches-6.1/950-1261-drm-rp1-depends-on-instead-of-select-MFD_RP1.patch new file mode 100644 index 0000000000..9e6755b378 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1261-drm-rp1-depends-on-instead-of-select-MFD_RP1.patch @@ -0,0 +1,59 @@ +From 57695002a68bdd4c077ea2173b64aeee6e1ef24f Mon Sep 17 00:00:00 2001 +From: Ratchanan Srirattanamet +Date: Fri, 26 Jan 2024 18:49:42 +0700 +Subject: [PATCH 1261/1295] drm/rp1: depends on, instead of select, MFD_RP1 + +According to kconfig-language.txt [1], select should be used only for +"non-visible symbols ... and for symbols with no dependencies". Since +MFD_RP1 both is visible and has a dependency, "select" should not be +used and "depends on" should be used instead. + +In particular, this fixes the build of this kernel tree on NixOS, where +its kernel config system will try to answer 'M' to as many config as +possible. + +[1] https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html + +Signed-off-by: Ratchanan Srirattanamet +--- + drivers/gpu/drm/rp1/rp1-dpi/Kconfig | 3 +-- + drivers/gpu/drm/rp1/rp1-dsi/Kconfig | 3 +-- + drivers/gpu/drm/rp1/rp1-vec/Kconfig | 3 +-- + 3 files changed, 3 insertions(+), 6 deletions(-) + +--- a/drivers/gpu/drm/rp1/rp1-dpi/Kconfig ++++ b/drivers/gpu/drm/rp1/rp1-dpi/Kconfig +@@ -1,8 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0-only + config DRM_RP1_DPI + tristate "DRM Support for RP1 DPI" +- depends on DRM +- select MFD_RP1 ++ depends on DRM && MFD_RP1 + select DRM_GEM_DMA_HELPER + select DRM_KMS_HELPER + select DRM_VRAM_HELPER +--- a/drivers/gpu/drm/rp1/rp1-dsi/Kconfig ++++ b/drivers/gpu/drm/rp1/rp1-dsi/Kconfig +@@ -1,8 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0-only + config DRM_RP1_DSI + tristate "DRM Support for RP1 DSI" +- depends on DRM +- select MFD_RP1 ++ depends on DRM && MFD_RP1 + select DRM_GEM_DMA_HELPER + select DRM_KMS_HELPER + select DRM_MIPI_DSI +--- a/drivers/gpu/drm/rp1/rp1-vec/Kconfig ++++ b/drivers/gpu/drm/rp1/rp1-vec/Kconfig +@@ -1,8 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0-only + config DRM_RP1_VEC + tristate "DRM Support for RP1 VEC" +- depends on DRM +- select MFD_RP1 ++ depends on DRM && MFD_RP1 + select DRM_GEM_DMA_HELPER + select DRM_KMS_HELPER + select DRM_VRAM_HELPER diff --git a/target/linux/bcm27xx/patches-6.1/950-1262-Update-touch-PiTFT-overlays.patch b/target/linux/bcm27xx/patches-6.1/950-1262-Update-touch-PiTFT-overlays.patch new file mode 100644 index 0000000000..43c275fde1 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1262-Update-touch-PiTFT-overlays.patch @@ -0,0 +1,435 @@ +From 1c2a93ce0e1cf6d278cf565346183d7592cfbb24 Mon Sep 17 00:00:00 2001 +From: Melissa LeBlanc-Williams +Date: Fri, 26 Jan 2024 14:41:42 -0800 +Subject: [PATCH 1262/1295] Update touch PiTFT overlays + +Expose the invert and swap touch parameters on 2.8" and 3.5" resistive touchscreens. Add +the DRM parameter to the PiTFT 2.2" and 2.8" Capacitive overlay in the same +way it is on the resistive overlays. Change the DRM driver to `adafruit,yx240qv29` +because the rotations are consistent with the FBTFT Driver. Fix the override size parameters +on the 2.8" capacitive PiTFT. + +Signed-off-by: Melissa LeBlanc-Williams +--- + arch/arm/boot/dts/overlays/README | 20 +++ + .../arm/boot/dts/overlays/pitft22-overlay.dts | 102 +++++++------- + .../overlays/pitft28-capacitive-overlay.dts | 132 +++++++++--------- + .../overlays/pitft28-resistive-overlay.dts | 12 +- + .../overlays/pitft35-resistive-overlay.dts | 10 +- + 5 files changed, 156 insertions(+), 120 deletions(-) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -3526,6 +3526,10 @@ Params: speed Display + + debug Debug output level {0-7} + ++ drm Force the use of the mi0283qt DRM driver (by ++ default the ili9340 framebuffer driver will ++ be used in preference if available) ++ + + Name: pitft28-capacitive + Info: Adafruit PiTFT 2.8" capacitive touch screen +@@ -3538,6 +3542,10 @@ Params: speed Display + + debug Debug output level {0-7} + ++ drm Force the use of the mi0283qt DRM driver (by ++ default the ili9340 framebuffer driver will ++ be used in preference if available) ++ + touch-sizex Touchscreen size x (default 240) + + touch-sizey Touchscreen size y (default 320) +@@ -3564,6 +3572,12 @@ Params: speed Display + default the ili9340 framebuffer driver will + be used in preference if available) + ++ touch-invx Touchscreen inverted x axis ++ ++ touch-invy Touchscreen inverted y axis ++ ++ touch-swapxy Touchscreen swapped x y axis ++ + + Name: pitft35-resistive + Info: Adafruit PiTFT 3.5" resistive touch screen +@@ -3580,6 +3594,12 @@ Params: speed Display + default the fb_hx8357d framebuffer driver will + be used in preference if available) + ++ touch-invx Touchscreen inverted x axis ++ ++ touch-invy Touchscreen inverted y axis ++ ++ touch-swapxy Touchscreen swapped x y axis ++ + + Name: pps-gpio + Info: Configures the pps-gpio (pulse-per-second time signal via GPIO). +--- a/arch/arm/boot/dts/overlays/pitft22-overlay.dts ++++ b/arch/arm/boot/dts/overlays/pitft22-overlay.dts +@@ -7,63 +7,65 @@ + /plugin/; + + / { +- compatible = "brcm,bcm2835"; ++ compatible = "brcm,bcm2835"; + +- fragment@0 { +- target = <&spidev0>; +- __overlay__ { +- status = "disabled"; +- }; ++ fragment@0 { ++ target = <&spidev0>; ++ __overlay__ { ++ status = "disabled"; ++ }; + }; + +- fragment@1 { +- target = <&spidev1>; +- __overlay__ { +- status = "disabled"; +- }; +- }; +- +- fragment@2 { +- target = <&gpio>; +- __overlay__ { +- pitft_pins: pitft_pins { +- brcm,pins = <25>; +- brcm,function = <1>; /* out */ +- brcm,pull = <0>; /* none */ +- }; +- }; +- }; +- +- fragment@3 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- pitft: pitft@0{ +- compatible = "ilitek,ili9340"; +- reg = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&pitft_pins>; +- +- spi-max-frequency = <32000000>; +- rotate = <90>; +- fps = <25>; +- bgr; +- buswidth = <8>; +- dc-gpios = <&gpio 25 0>; +- debug = <0>; +- }; +- +- }; +- }; +- +- __overrides__ { +- speed = <&pitft>,"spi-max-frequency:0"; +- rotate = <&pitft>,"rotate:0"; +- fps = <&pitft>,"fps:0"; +- debug = <&pitft>,"debug:0"; +- }; ++ fragment@1 { ++ target = <&spidev1>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ pitft_pins: pitft_pins { ++ brcm,pins = <25>; ++ brcm,function = <1>; /* out */ ++ brcm,pull = <0>; /* none */ ++ }; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pitft: pitft@0{ ++ compatible = "ilitek,ili9340"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pitft_pins>; ++ ++ spi-max-frequency = <32000000>; ++ rotate = <90>; ++ fps = <25>; ++ bgr; ++ buswidth = <8>; ++ dc-gpios = <&gpio 25 0>; ++ debug = <0>; ++ }; ++ ++ }; ++ }; ++ ++ __overrides__ { ++ speed = <&pitft>,"spi-max-frequency:0"; ++ rotate = <&pitft>,"rotate:0", /* fbtft */ ++ <&pitft>,"rotation:0"; /* drm */ ++ fps = <&pitft>,"fps:0"; ++ debug = <&pitft>,"debug:0"; ++ drm = <&pitft>,"compatible=adafruit,yx240qv29"; ++ }; + }; +--- a/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts ++++ b/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts +@@ -7,14 +7,14 @@ + /plugin/; + + / { +- compatible = "brcm,bcm2835"; ++ compatible = "brcm,bcm2835"; + +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- }; +- }; ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; + + fragment@1 { + target = <&spidev0>; +@@ -23,69 +23,71 @@ + }; + }; + +- fragment@2 { +- target = <&gpio>; +- __overlay__ { +- pitft_pins: pitft_pins { +- brcm,pins = <24 25>; +- brcm,function = <0 1>; /* in out */ +- brcm,pull = <2 0>; /* pullup none */ +- }; +- }; +- }; +- +- fragment@3 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- pitft: pitft@0{ +- compatible = "ilitek,ili9340"; +- reg = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&pitft_pins>; +- +- spi-max-frequency = <32000000>; +- rotate = <90>; +- fps = <25>; +- bgr; +- buswidth = <8>; +- dc-gpios = <&gpio 25 0>; +- debug = <0>; +- }; +- }; +- }; +- +- fragment@4 { +- target = <&i2c1>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- ft6236: ft6236@38 { +- compatible = "focaltech,ft6236"; +- reg = <0x38>; +- +- interrupt-parent = <&gpio>; +- interrupts = <24 2>; +- touchscreen-size-x = <240>; +- touchscreen-size-y = <320>; +- }; +- }; +- }; +- +- __overrides__ { +- speed = <&pitft>,"spi-max-frequency:0"; +- rotate = <&pitft>,"rotate:0"; +- fps = <&pitft>,"fps:0"; +- debug = <&pitft>,"debug:0"; +- touch-sizex = <&ft6236>,"touchscreen-size-x?"; +- touch-sizey = <&ft6236>,"touchscreen-size-y?"; +- touch-invx = <&ft6236>,"touchscreen-inverted-x?"; +- touch-invy = <&ft6236>,"touchscreen-inverted-y?"; +- touch-swapxy = <&ft6236>,"touchscreen-swapped-x-y?"; +- }; ++ fragment@2 { ++ target = <&gpio>; ++ __overlay__ { ++ pitft_pins: pitft_pins { ++ brcm,pins = <24 25>; ++ brcm,function = <0 1>; /* in out */ ++ brcm,pull = <2 0>; /* pullup none */ ++ }; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ pitft: pitft@0{ ++ compatible = "ilitek,ili9340"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pitft_pins>; ++ ++ spi-max-frequency = <32000000>; ++ rotate = <90>; ++ fps = <25>; ++ bgr; ++ buswidth = <8>; ++ dc-gpios = <&gpio 25 0>; ++ debug = <0>; ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&i2c1>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ft6236: ft6236@38 { ++ compatible = "focaltech,ft6236"; ++ reg = <0x38>; ++ ++ interrupt-parent = <&gpio>; ++ interrupts = <24 2>; ++ touchscreen-size-x = <240>; ++ touchscreen-size-y = <320>; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ speed = <&pitft>,"spi-max-frequency:0"; ++ rotate = <&pitft>,"rotate:0", /* fbtft */ ++ <&pitft>,"rotation:0"; /* drm */ ++ fps = <&pitft>,"fps:0"; ++ debug = <&pitft>,"debug:0"; ++ drm = <&pitft>,"compatible=adafruit,yx240qv29"; ++ touch-sizex = <&ft6236>,"touchscreen-size-x:0"; ++ touch-sizey = <&ft6236>,"touchscreen-size-y:0"; ++ touch-invx = <&ft6236>,"touchscreen-inverted-x?"; ++ touch-invy = <&ft6236>,"touchscreen-inverted-y?"; ++ touch-swapxy = <&ft6236>,"touchscreen-swapped-x-y?"; ++ }; + }; +--- a/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts ++++ b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts +@@ -49,7 +49,7 @@ + #size-cells = <0>; + + pitft: pitft@0{ +- compatible = "ilitek,ili9340", "multi-inno,mi0283qt"; ++ compatible = "ilitek,ili9340"; + reg = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&pitft_pins>; +@@ -64,6 +64,9 @@ + }; + + pitft_ts@1 { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #interrupt-cells = <1>; + compatible = "st,stmpe610"; + reg = <1>; + +@@ -72,7 +75,7 @@ + interrupt-parent = <&gpio>; + interrupt-controller; + +- stmpe_touchscreen { ++ stmpe_touchscreen: stmpe_touchscreen { + compatible = "st,stmpe-ts"; + st,sample-time = <4>; + st,mod-12b = <1>; +@@ -115,6 +118,9 @@ + <&pitft>,"rotation:0"; /* drm */ + fps = <&pitft>,"fps:0"; + debug = <&pitft>,"debug:0"; +- drm = <&pitft>,"compatible=multi-inno,mi0283qt"; ++ drm = <&pitft>,"compatible=adafruit,yx240qv29"; ++ touch-invx = <&stmpe_touchscreen>,"touchscreen-inverted-x?"; ++ touch-invy = <&stmpe_touchscreen>,"touchscreen-inverted-y?"; ++ touch-swapxy = <&stmpe_touchscreen>,"touchscreen-swapped-x-y?"; + }; + }; +--- a/arch/arm/boot/dts/overlays/pitft35-resistive-overlay.dts ++++ b/arch/arm/boot/dts/overlays/pitft35-resistive-overlay.dts +@@ -49,7 +49,7 @@ + #size-cells = <0>; + + pitft: pitft@0{ +- compatible = "himax,hx8357d", "adafruit,yx350hv15"; ++ compatible = "himax,hx8357d"; + reg = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&pitft_pins>; +@@ -64,6 +64,9 @@ + }; + + pitft_ts@1 { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #interrupt-cells = <1>; + compatible = "st,stmpe610"; + reg = <1>; + +@@ -72,7 +75,7 @@ + interrupt-parent = <&gpio>; + interrupt-controller; + +- stmpe_touchscreen { ++ stmpe_touchscreen: stmpe_touchscreen { + compatible = "st,stmpe-ts"; + st,sample-time = <4>; + st,mod-12b = <1>; +@@ -117,5 +120,8 @@ + debug = <&pitft>,"debug:0"; + drm = <&pitft>,"compatible=adafruit,yx350hv15", + <&pitft>,"backlight:0=",<&backlight>; ++ touch-invx = <&stmpe_touchscreen>,"touchscreen-inverted-x?"; ++ touch-invy = <&stmpe_touchscreen>,"touchscreen-inverted-y?"; ++ touch-swapxy = <&stmpe_touchscreen>,"touchscreen-swapped-x-y?"; + }; + }; diff --git a/target/linux/bcm27xx/patches-6.1/950-1263-ARM-dts-rp1-Boost-the-I2C-drive-strength.patch b/target/linux/bcm27xx/patches-6.1/950-1263-ARM-dts-rp1-Boost-the-I2C-drive-strength.patch new file mode 100644 index 0000000000..55ce6523db --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1263-ARM-dts-rp1-Boost-the-I2C-drive-strength.patch @@ -0,0 +1,95 @@ +From ea9b088747d379256e2582dd5c29638bf4ff9928 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 31 Jan 2024 17:20:07 +0000 +Subject: [PATCH 1263/1295] ARM: dts: rp1: Boost the I2C drive strength + +Boosting the drive strength on I2C pins allows SCL to achieve safe +voltage swings, even at 1MHz. + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/rp1.dtsi | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +--- a/arch/arm/boot/dts/rp1.dtsi ++++ b/arch/arm/boot/dts/rp1.dtsi +@@ -650,66 +650,79 @@ + rp1_i2c4_34_35: rp1_i2c4_34_35 { + function = "i2c4"; + pins = "gpio34", "gpio35"; ++ drive-strength = <12>; + bias-pull-up; + }; + rp1_i2c6_38_39: rp1_i2c6_38_39 { + function = "i2c6"; + pins = "gpio38", "gpio39"; ++ drive-strength = <12>; + bias-pull-up; + }; + rp1_i2c4_40_41: rp1_i2c4_40_41 { + function = "i2c4"; + pins = "gpio40", "gpio41"; ++ drive-strength = <12>; + bias-pull-up; + }; + rp1_i2c5_44_45: rp1_i2c5_44_45 { + function = "i2c5"; + pins = "gpio44", "gpio45"; ++ drive-strength = <12>; + bias-pull-up; + }; + rp1_i2c0_0_1: rp1_i2c0_0_1 { + function = "i2c0"; + pins = "gpio0", "gpio1"; ++ drive-strength = <12>; + bias-pull-up; + }; + rp1_i2c0_8_9: rp1_i2c0_8_9 { + function = "i2c0"; + pins = "gpio8", "gpio9"; ++ drive-strength = <12>; + bias-pull-up; + }; + rp1_i2c1_2_3: rp1_i2c1_2_3 { + function = "i2c1"; + pins = "gpio2", "gpio3"; ++ drive-strength = <12>; + bias-pull-up; + }; + rp1_i2c1_10_11: rp1_i2c1_10_11 { + function = "i2c1"; + pins = "gpio10", "gpio11"; ++ drive-strength = <12>; + bias-pull-up; + }; + rp1_i2c2_4_5: rp1_i2c2_4_5 { + function = "i2c2"; + pins = "gpio4", "gpio5"; ++ drive-strength = <12>; + bias-pull-up; + }; + rp1_i2c2_12_13: rp1_i2c2_12_13 { + function = "i2c2"; + pins = "gpio12", "gpio13"; ++ drive-strength = <12>; + bias-pull-up; + }; + rp1_i2c3_6_7: rp1_i2c3_6_7 { + function = "i2c3"; + pins = "gpio6", "gpio7"; ++ drive-strength = <12>; + bias-pull-up; + }; + rp1_i2c3_14_15: rp1_i2c3_14_15 { + function = "i2c3"; + pins = "gpio14", "gpio15"; ++ drive-strength = <12>; + bias-pull-up; + }; + rp1_i2c3_22_23: rp1_i2c3_22_23 { + function = "i2c3"; + pins = "gpio22", "gpio23"; ++ drive-strength = <12>; + bias-pull-up; + }; + diff --git a/target/linux/bcm27xx/patches-6.1/950-1264-ARM-dts-rp1-Add-a-safe-I2C-SDA-hold-time.patch b/target/linux/bcm27xx/patches-6.1/950-1264-ARM-dts-rp1-Add-a-safe-I2C-SDA-hold-time.patch new file mode 100644 index 0000000000..7052239224 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1264-ARM-dts-rp1-Add-a-safe-I2C-SDA-hold-time.patch @@ -0,0 +1,75 @@ +From 15dedc2ad5a9073b8639881680672214f605a5c6 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 31 Jan 2024 17:44:02 +0000 +Subject: [PATCH 1264/1295] ARM: dts: rp1: Add a safe I2C SDA hold time + +Failing to set a reasonable SDA hold time can cause SDA to change too +close to the falling edge of SCL. 300ns is the recommended minimum +interval between the two at 100kHz and 400kHz, and also seems to +work at 1MHz, so use that. + +See: https://github.com/raspberrypi/linux/issues/5914 + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/rp1.dtsi | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/arch/arm/boot/dts/rp1.dtsi ++++ b/arch/arm/boot/dts/rp1.dtsi +@@ -307,6 +307,7 @@ + clocks = <&rp1_clocks RP1_CLK_SYS>; + i2c-scl-rising-time-ns = <65>; + i2c-scl-falling-time-ns = <100>; ++ i2c-sda-hold-time-ns = <300>; + status = "disabled"; + }; + +@@ -317,6 +318,7 @@ + clocks = <&rp1_clocks RP1_CLK_SYS>; + i2c-scl-rising-time-ns = <65>; + i2c-scl-falling-time-ns = <100>; ++ i2c-sda-hold-time-ns = <300>; + status = "disabled"; + }; + +@@ -327,6 +329,7 @@ + clocks = <&rp1_clocks RP1_CLK_SYS>; + i2c-scl-rising-time-ns = <65>; + i2c-scl-falling-time-ns = <100>; ++ i2c-sda-hold-time-ns = <300>; + status = "disabled"; + }; + +@@ -337,6 +340,7 @@ + clocks = <&rp1_clocks RP1_CLK_SYS>; + i2c-scl-rising-time-ns = <65>; + i2c-scl-falling-time-ns = <100>; ++ i2c-sda-hold-time-ns = <300>; + status = "disabled"; + }; + +@@ -347,6 +351,7 @@ + clocks = <&rp1_clocks RP1_CLK_SYS>; + i2c-scl-rising-time-ns = <65>; + i2c-scl-falling-time-ns = <100>; ++ i2c-sda-hold-time-ns = <300>; + status = "disabled"; + }; + +@@ -357,6 +362,7 @@ + clocks = <&rp1_clocks RP1_CLK_SYS>; + i2c-scl-rising-time-ns = <65>; + i2c-scl-falling-time-ns = <100>; ++ i2c-sda-hold-time-ns = <300>; + status = "disabled"; + }; + +@@ -367,6 +373,7 @@ + clocks = <&rp1_clocks RP1_CLK_SYS>; + i2c-scl-rising-time-ns = <65>; + i2c-scl-falling-time-ns = <100>; ++ i2c-sda-hold-time-ns = <300>; + status = "disabled"; + }; + diff --git a/target/linux/bcm27xx/patches-6.1/950-1265-ASoC-DACplus-fix-16bit-sample-support-in-clock-consu.patch b/target/linux/bcm27xx/patches-6.1/950-1265-ASoC-DACplus-fix-16bit-sample-support-in-clock-consu.patch new file mode 100644 index 0000000000..ba1b3edda5 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1265-ASoC-DACplus-fix-16bit-sample-support-in-clock-consu.patch @@ -0,0 +1,33 @@ +From 89bd4e64da3345c2764a42875b99c96fa8931967 Mon Sep 17 00:00:00 2001 +From: Joerg Schambacher +Date: Thu, 1 Feb 2024 17:32:44 +0100 +Subject: [PATCH 1265/1295] ASoC: DACplus - fix 16bit sample support in clock + consumer mode + +The former code did not adjust the physical sample width when +in clock consumer mode and has taken the fixed 32 bit default. +This has caused the audio to be played at half its frequency due to +the fixed bclk_ratio of 64. + +Signed-off-by: Joerg Schambacher +--- + sound/soc/bcm/hifiberry_dacplus.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/sound/soc/bcm/hifiberry_dacplus.c ++++ b/sound/soc/bcm/hifiberry_dacplus.c +@@ -279,13 +279,11 @@ static int snd_rpi_hifiberry_dacplus_hw_ + int ret = 0; + struct snd_soc_pcm_runtime *rtd = substream->private_data; + int channels = params_channels(params); +- int width = 32; ++ int width = snd_pcm_format_physical_width(params_format(params)); + + if (snd_rpi_hifiberry_is_dacpro) { + struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; + +- width = snd_pcm_format_physical_width(params_format(params)); +- + snd_rpi_hifiberry_dacplus_set_sclk(component, + params_rate(params)); + diff --git a/target/linux/bcm27xx/patches-6.1/950-1266-ASoC-adds-support-for-AMP4-Pro-to-the-DAC-Plus-drive.patch b/target/linux/bcm27xx/patches-6.1/950-1266-ASoC-adds-support-for-AMP4-Pro-to-the-DAC-Plus-drive.patch new file mode 100644 index 0000000000..84251f2800 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1266-ASoC-adds-support-for-AMP4-Pro-to-the-DAC-Plus-drive.patch @@ -0,0 +1,114 @@ +From d58c054ba30b313bacbb7d19f559ecb4e3bb5c76 Mon Sep 17 00:00:00 2001 +From: Joerg Schambacher +Date: Fri, 19 Jan 2024 10:58:39 +0100 +Subject: [PATCH 1266/1295] ASoC: adds support for AMP4 Pro to the DAC Plus + driver + +The AMP4 Pro is a I2S master mode capable amplifier with +clean onboard clock generators. +We can share the card driver between TAS575x amplifiers +and the PCM512x DACs as they are SW compatible. +From a HW perspective though we need to limit the sample +rates to the standard audio rates to avoid running the +onboard clocks through the PLL. Using the PLL would require +even a different HW. +DAI/stream name are also set accordingly to allow the user +a convenient identification of the soundcard + +Needs the pcm512x driver with TAS575x support (already in +upstream kernel). + +Signed-off-by: Joerg Schambacher +--- + sound/soc/bcm/hifiberry_dacplus.c | 41 ++++++++++++++++++++++++++++--- + 1 file changed, 38 insertions(+), 3 deletions(-) + +--- a/sound/soc/bcm/hifiberry_dacplus.c ++++ b/sound/soc/bcm/hifiberry_dacplus.c +@@ -58,10 +58,21 @@ static bool leds_off; + static bool auto_mute; + static int mute_ext_ctl; + static int mute_ext; ++static bool tas_device; + static struct gpio_desc *snd_mute_gpio; + static struct gpio_desc *snd_reset_gpio; + static struct snd_soc_card snd_rpi_hifiberry_dacplus; + ++static const u32 master_dai_rates[] = { ++ 44100, 48000, 88200, 96000, ++ 176400, 192000, 352800, 384000, ++}; ++ ++static const struct snd_pcm_hw_constraint_list constraints_master = { ++ .count = ARRAY_SIZE(master_dai_rates), ++ .list = master_dai_rates, ++}; ++ + static int snd_rpi_hifiberry_dacplus_mute_set(int mute) + { + gpiod_set_value_cansleep(snd_mute_gpio, mute); +@@ -197,8 +208,13 @@ static int snd_rpi_hifiberry_dacplus_ini + if (snd_rpi_hifiberry_is_dacpro) { + struct snd_soc_dai_link *dai = rtd->dai_link; + +- dai->name = "HiFiBerry DAC+ Pro"; +- dai->stream_name = "HiFiBerry DAC+ Pro HiFi"; ++ if (tas_device) { ++ dai->name = "HiFiBerry AMP4 Pro"; ++ dai->stream_name = "HiFiBerry AMP4 Pro HiFi"; ++ } else { ++ dai->name = "HiFiBerry DAC+ Pro"; ++ dai->stream_name = "HiFiBerry DAC+ Pro HiFi"; ++ } + dai->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF + | SND_SOC_DAIFMT_CBM_CFM; + +@@ -303,6 +319,18 @@ static int snd_rpi_hifiberry_dacplus_sta + { + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; ++ int ret; ++ ++ if (tas_device && !slave) { ++ ret = snd_pcm_hw_constraint_list(substream->runtime, 0, ++ SNDRV_PCM_HW_PARAM_RATE, ++ &constraints_master); ++ if (ret < 0) { ++ dev_err(rtd->card->dev, ++ "Cannot apply constraints for sample rates\n"); ++ return ret; ++ } ++ } + + if (auto_mute) + gpiod_set_value_cansleep(snd_mute_gpio, 0); +@@ -324,7 +352,7 @@ static void snd_rpi_hifiberry_dacplus_sh + } + + /* machine stream operations */ +-static struct snd_soc_ops snd_rpi_hifiberry_dacplus_ops = { ++static const struct snd_soc_ops snd_rpi_hifiberry_dacplus_ops = { + .hw_params = snd_rpi_hifiberry_dacplus_hw_params, + .startup = snd_rpi_hifiberry_dacplus_startup, + .shutdown = snd_rpi_hifiberry_dacplus_shutdown, +@@ -394,6 +422,7 @@ static int snd_rpi_hifiberry_dacplus_pro + struct snd_soc_card *card = &snd_rpi_hifiberry_dacplus; + int len; + struct device_node *tpa_node; ++ struct device_node *tas_node; + struct property *tpa_prop; + struct of_changeset ocs; + struct property *pp; +@@ -430,6 +459,12 @@ static int snd_rpi_hifiberry_dacplus_pro + } + } + ++ tas_node = of_find_compatible_node(NULL, NULL, "ti,tas5756"); ++ if (tas_node) { ++ tas_device = true; ++ dev_info(&pdev->dev, "TAS5756 device found!\n"); ++ }; ++ + snd_rpi_hifiberry_dacplus.dev = &pdev->dev; + if (pdev->dev.of_node) { + struct device_node *i2s_node; diff --git a/target/linux/bcm27xx/patches-6.1/950-1267-DT-overlays-adds-support-for-Hifiberry-AMP4-Pro.patch b/target/linux/bcm27xx/patches-6.1/950-1267-DT-overlays-adds-support-for-Hifiberry-AMP4-Pro.patch new file mode 100644 index 0000000000..49429bca06 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1267-DT-overlays-adds-support-for-Hifiberry-AMP4-Pro.patch @@ -0,0 +1,130 @@ +From 98ac9b84709dc01ee936b6fe79eaac5e3a4aa6e7 Mon Sep 17 00:00:00 2001 +From: Joerg Schambacher +Date: Fri, 19 Jan 2024 10:44:22 +0100 +Subject: [PATCH 1267/1295] DT-overlays: adds support for Hifiberry AMP4 Pro + +The AMP4 Pro uses a TI TAS5756 amplifier in master mode +and requires the DAC Plus card driver and the +pcm512x component driver with TAS support. + +Signed-off-by: Joerg Schambacher +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 28 +++++++++ + .../overlays/hifiberry-amp4pro-overlay.dts | 63 +++++++++++++++++++ + 3 files changed, 92 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-amp4pro-overlay.dts + +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -86,6 +86,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ + hifiberry-amp.dtbo \ + hifiberry-amp100.dtbo \ + hifiberry-amp3.dtbo \ ++ hifiberry-amp4pro.dtbo \ + hifiberry-dac.dtbo \ + hifiberry-dacplus.dtbo \ + hifiberry-dacplusadc.dtbo \ +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -1738,6 +1738,34 @@ Load: dtoverlay=hifiberry-amp3 + Params: + + ++Name: hifiberry-amp4pro ++Info: Configures the HifiBerry AMP4 Pro audio card ++Load: dtoverlay=hifiberry-amp4pro,= ++Params: 24db_digital_gain Allow gain to be applied via the TAS5756 ++ Digital volume control. Enable with ++ "dtoverlay=hifiberry-amp4pro,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24dB_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) ++ slave Force the amp into slave mode, using Pi as ++ master for bit clock and frame clock. ++ leds_off If set to 'true' the onboard indicator LEDs ++ are switched off at all times. ++ auto_mute If set to 'true' the amplifier is automatically ++ muted when it is not playing. ++ mute_ext_ctl The amplifier's HW mute control is enabled ++ in ALSA mixer and set to . ++ Will be overwritten by ALSA user settings. ++ ++ + Name: hifiberry-dac + Info: Configures the HifiBerry DAC audio cards + Load: dtoverlay=hifiberry-dac +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-amp4pro-overlay.dts +@@ -0,0 +1,63 @@ ++// Definitions for HiFiBerry AMP4PRO ++/dts-v1/; ++/plugin/; ++#include ++ ++/ { ++ compatible = "brcm,bcm2835"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ dacpro_osc: dacpro_osc { ++ compatible = "hifiberry,dacpro-clk"; ++ #clock-cells = <0>; ++ }; ++ }; ++ }; ++ ++ frag1: fragment@1 { ++ target = <&i2s_clk_consumer>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ tas5756@4d { ++ #sound-dai-cells = <0>; ++ compatible = "ti,tas5756"; ++ reg = <0x4d>; ++ clocks = <&dacpro_osc>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&sound>; ++ hifiberry_dacplus: __overlay__ { ++ compatible = "hifiberry,hifiberry-dacplus"; ++ i2s-controller = <&i2s_clk_consumer>; ++ status = "okay"; ++ mute-gpio = <&gpio 4 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ __overrides__ { ++ 24db_digital_gain = ++ <&hifiberry_dacplus>,"hifiberry-amp4,24db_digital_gain?"; ++ leds_off = <&hifiberry_dacplus>,"hifiberry-amp4,leds_off?"; ++ mute_ext_ctl = <&hifiberry_dacplus>,"hifiberry-amp4,mute_ext_ctl:0"; ++ auto_mute = <&hifiberry_dacplus>,"hifiberry-amp4,auto_mute?"; ++ slave = <&hifiberry_dacplus>,"hifiberry-dacplus,slave?", ++ <&frag1>,"target:0=",<&i2s_clk_producer>, ++ <&hifiberry_dacplus>,"i2s-controller:0=",<&i2s_clk_producer>; ++ }; ++}; diff --git a/target/linux/bcm27xx/patches-6.1/950-1268-ASoC-DACplusADCPro-fix-16bit-sample-support-in-clock.patch b/target/linux/bcm27xx/patches-6.1/950-1268-ASoC-DACplusADCPro-fix-16bit-sample-support-in-clock.patch new file mode 100644 index 0000000000..f608e5ee7d --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1268-ASoC-DACplusADCPro-fix-16bit-sample-support-in-clock.patch @@ -0,0 +1,38 @@ +From ba86793796525f8276fafbaf9d31d5156a2cfcb5 Mon Sep 17 00:00:00 2001 +From: Joerg Schambacher +Date: Fri, 2 Feb 2024 08:51:06 +0100 +Subject: [PATCH 1268/1295] ASoC: DACplusADCPro - fix 16bit sample support in + clock consumer mode + +The former code did not adjust the physical sample width when in +clock consumer mode and has taken the fixed 32 bit default. This +has caused the audio to be played at half its frequency due to +the fixed bclk_ratio of 64. + +Problem appears only on PI5 as on the former PIs the I2S module +did simply run at fixed 64x rate. + +Signed-off-by: Joerg Schambacher +--- + sound/soc/bcm/hifiberry_dacplusadcpro.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/sound/soc/bcm/hifiberry_dacplusadcpro.c ++++ b/sound/soc/bcm/hifiberry_dacplusadcpro.c +@@ -383,15 +383,13 @@ static int snd_rpi_hifiberry_dacplusadcp + int ret = 0; + struct snd_soc_pcm_runtime *rtd = substream->private_data; + int channels = params_channels(params); +- int width = 32; ++ int width = snd_pcm_format_physical_width(params_format(params)); + struct snd_soc_component *dac = asoc_rtd_to_codec(rtd, 0)->component; + struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0); + struct snd_soc_dai_driver *drv = dai->driver; + const struct snd_soc_dai_ops *ops = drv->ops; + + if (snd_rpi_hifiberry_is_dacpro) { +- width = snd_pcm_format_physical_width(params_format(params)); +- + snd_rpi_hifiberry_dacplusadcpro_set_sclk(dac, + params_rate(params)); + diff --git a/target/linux/bcm27xx/patches-6.1/950-1269-overlays-Correct-some-compatible-strings.patch b/target/linux/bcm27xx/patches-6.1/950-1269-overlays-Correct-some-compatible-strings.patch new file mode 100644 index 0000000000..f29e20d7bf --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1269-overlays-Correct-some-compatible-strings.patch @@ -0,0 +1,72 @@ +From 707f6e221946ec2025e8f0e2fedf92016ed8a5b7 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 2 Feb 2024 14:08:14 +0000 +Subject: [PATCH 1269/1295] overlays: Correct some compatible strings + +More thorough overlay testing has identified some Pi 4-specific +overlays that has "brcm,bcm2835" compatible strings. Correct them. + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/overlays/midi-uart2-overlay.dts | 2 +- + arch/arm/boot/dts/overlays/midi-uart3-overlay.dts | 2 +- + arch/arm/boot/dts/overlays/midi-uart4-overlay.dts | 2 +- + arch/arm/boot/dts/overlays/midi-uart5-overlay.dts | 2 +- + arch/arm/boot/dts/overlays/ramoops-pi4-overlay.dts | 2 +- + 5 files changed, 5 insertions(+), 5 deletions(-) + +--- a/arch/arm/boot/dts/overlays/midi-uart2-overlay.dts ++++ b/arch/arm/boot/dts/overlays/midi-uart2-overlay.dts +@@ -12,7 +12,7 @@ + */ + + /{ +- compatible = "brcm,bcm2835"; ++ compatible = "brcm,bcm2711"; + + fragment@0 { + target-path = "/"; +--- a/arch/arm/boot/dts/overlays/midi-uart3-overlay.dts ++++ b/arch/arm/boot/dts/overlays/midi-uart3-overlay.dts +@@ -12,7 +12,7 @@ + */ + + /{ +- compatible = "brcm,bcm2835"; ++ compatible = "brcm,bcm2711"; + + fragment@0 { + target-path = "/"; +--- a/arch/arm/boot/dts/overlays/midi-uart4-overlay.dts ++++ b/arch/arm/boot/dts/overlays/midi-uart4-overlay.dts +@@ -12,7 +12,7 @@ + */ + + /{ +- compatible = "brcm,bcm2835"; ++ compatible = "brcm,bcm2711"; + + fragment@0 { + target-path = "/"; +--- a/arch/arm/boot/dts/overlays/midi-uart5-overlay.dts ++++ b/arch/arm/boot/dts/overlays/midi-uart5-overlay.dts +@@ -12,7 +12,7 @@ + */ + + /{ +- compatible = "brcm,bcm2835"; ++ compatible = "brcm,bcm2711"; + + fragment@0 { + target-path = "/"; +--- a/arch/arm/boot/dts/overlays/ramoops-pi4-overlay.dts ++++ b/arch/arm/boot/dts/overlays/ramoops-pi4-overlay.dts +@@ -2,7 +2,7 @@ + /plugin/; + + / { +- compatible = "brcm,bcm2835"; ++ compatible = "brcm,bcm2711"; + + fragment@0 { + target = <&rmem>; diff --git a/target/linux/bcm27xx/patches-6.1/950-1270-overlays-Delete-deprecated-overlay-mpu6050.patch b/target/linux/bcm27xx/patches-6.1/950-1270-overlays-Delete-deprecated-overlay-mpu6050.patch new file mode 100644 index 0000000000..3f1864f4ec --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1270-overlays-Delete-deprecated-overlay-mpu6050.patch @@ -0,0 +1,57 @@ +From 223d1247c0b0c0659a65949b6b9c3de53fd14223 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 2 Feb 2024 14:14:47 +0000 +Subject: [PATCH 1270/1295] overlays: Delete deprecated overlay mpu6050 + +The mpu6050 overlay has been deprecated for a year (when we were still +shipping rpi-5.15.y). Delete it. + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/overlays/Makefile | 1 - + .../arm/boot/dts/overlays/mpu6050-overlay.dts | 29 ------------------- + 2 files changed, 30 deletions(-) + delete mode 100644 arch/arm/boot/dts/overlays/mpu6050-overlay.dts + +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -172,7 +172,6 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ + mipi-dbi-spi.dtbo \ + mlx90640.dtbo \ + mmc.dtbo \ +- mpu6050.dtbo \ + mz61581.dtbo \ + ov2311.dtbo \ + ov5647.dtbo \ +--- a/arch/arm/boot/dts/overlays/mpu6050-overlay.dts ++++ /dev/null +@@ -1,29 +0,0 @@ +-// Definitions for MPU6050 +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835"; +- +- fragment@0 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- clock-frequency = <400000>; +- +- mpu6050: mpu6050@68 { +- compatible = "invensense,mpu6050"; +- reg = <0x68>; +- interrupt-parent = <&gpio>; +- interrupts = <4 1>; +- }; +- }; +- }; +- +- __overrides__ { +- interrupt = <&mpu6050>,"interrupts:0"; +- addr = <&mpu6050>,"reg:0"; +- }; +-}; diff --git a/target/linux/bcm27xx/patches-6.1/950-1271-drivers-media-cfe-Increase-default-size-of-embedded-.patch b/target/linux/bcm27xx/patches-6.1/950-1271-drivers-media-cfe-Increase-default-size-of-embedded-.patch new file mode 100644 index 0000000000..90cfdc4ebe --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1271-drivers-media-cfe-Increase-default-size-of-embedded-.patch @@ -0,0 +1,36 @@ +From beba81b0b77268f72d717ab8ec98afe11a176ee0 Mon Sep 17 00:00:00 2001 +From: Naushir Patuck +Date: Mon, 5 Feb 2024 12:12:17 +0000 +Subject: [PATCH 1271/1295] drivers: media: cfe: Increase default size of + embedded buffer + +Increase the size of the default embedded buffer to 16k. This is done to +match what is advertised by the IMX219 driver and workaround a problem +where the embedded stream is not actually used. Without full streams API +support, the media pipeline validation will fail in these circumstances. + +Signed-off-by: Naushir Patuck +--- + drivers/media/platform/raspberrypi/rp1_cfe/cfe.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/media/platform/raspberrypi/rp1_cfe/cfe.c ++++ b/drivers/media/platform/raspberrypi/rp1_cfe/cfe.c +@@ -93,7 +93,7 @@ MODULE_PARM_DESC(verbose_debug, "verbose + #define MIN_WIDTH 16 + #define MIN_HEIGHT 16 + /* Default size of the embedded buffer */ +-#define DEFAULT_EMBEDDED_SIZE 8192 ++#define DEFAULT_EMBEDDED_SIZE 16384 + + const struct v4l2_mbus_framefmt cfe_default_format = { + .width = 640, +@@ -107,7 +107,7 @@ const struct v4l2_mbus_framefmt cfe_defa + }; + + const struct v4l2_mbus_framefmt cfe_default_meta_format = { +- .width = 8192, ++ .width = DEFAULT_EMBEDDED_SIZE, + .height = 1, + .code = MEDIA_BUS_FMT_SENSOR_DATA, + .field = V4L2_FIELD_NONE, diff --git a/target/linux/bcm27xx/patches-6.1/950-1274-serial-sc16is7xx-Don-t-spin-if-no-data-received.patch b/target/linux/bcm27xx/patches-6.1/950-1274-serial-sc16is7xx-Don-t-spin-if-no-data-received.patch new file mode 100644 index 0000000000..e469b44880 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1274-serial-sc16is7xx-Don-t-spin-if-no-data-received.patch @@ -0,0 +1,26 @@ +From 58c600f728f2787e905eff2f678fa9cf09694004 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 2 Feb 2024 15:41:29 +0000 +Subject: [PATCH 1274/1295] serial: sc16is7xx: Don't spin if no data received + +There are multiple causes of interrupts, errors being one, and only the +receipt of data warrants continued polling. + +See: https://github.com/raspberrypi/linux/issues/2676 + +Signed-off-by: Phil Elwell +--- + drivers/tty/serial/sc16is7xx.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/tty/serial/sc16is7xx.c ++++ b/drivers/tty/serial/sc16is7xx.c +@@ -762,6 +762,8 @@ static bool sc16is7xx_port_irq(struct sc + + if (rxlen) + sc16is7xx_handle_rx(port, rxlen, iir); ++ else ++ rc = false; + break; + /* CTSRTS interrupt comes only when CTS goes inactive */ + case SC16IS7XX_IIR_CTSRTS_SRC: diff --git a/target/linux/bcm27xx/patches-6.1/950-1276-Impliment-driver-support-for-Interlude-Audio-Digital.patch b/target/linux/bcm27xx/patches-6.1/950-1276-Impliment-driver-support-for-Interlude-Audio-Digital.patch new file mode 100644 index 0000000000..ff638aed61 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1276-Impliment-driver-support-for-Interlude-Audio-Digital.patch @@ -0,0 +1,196 @@ +From fb21611efd7cd916646d9ab2988c3af08f139761 Mon Sep 17 00:00:00 2001 +From: Ben Payne +Date: Tue, 13 Feb 2024 14:55:14 -0800 +Subject: [PATCH 1276/1295] Impliment driver support for Interlude Audio + Digital Hat + +Implementing driver support for +Interlude audio's WM8805 based digital hat +by leveraging existing drivers +--- + sound/soc/bcm/rpi-wm8804-soundcard.c | 139 +++++++++++++++++++++++++++ + 1 file changed, 139 insertions(+) + +--- a/sound/soc/bcm/rpi-wm8804-soundcard.c ++++ b/sound/soc/bcm/rpi-wm8804-soundcard.c +@@ -34,6 +34,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -65,6 +66,10 @@ struct snd_rpi_wm8804_drvdata { + static struct gpio_desc *snd_clk44gpio; + static struct gpio_desc *snd_clk48gpio; + static int wm8804_samplerate = 0; ++static struct gpio_desc *led_gpio_1; ++static struct gpio_desc *led_gpio_2; ++static struct gpio_desc *led_gpio_3; ++static struct gpio_desc *custom_reset; + + /* Forward declarations */ + static struct snd_soc_dai_link snd_allo_digione_dai[]; +@@ -74,6 +79,37 @@ static struct snd_soc_card snd_rpi_wm880 + #define CLK_44EN_RATE 22579200UL + #define CLK_48EN_RATE 24576000UL + ++static const char * const wm8805_input_select_text[] = { ++ "Rx 0", ++ "Rx 1", ++ "Rx 2", ++ "Rx 3", ++ "Rx 4", ++ "Rx 5", ++ "Rx 6", ++ "Rx 7" ++}; ++ ++static const unsigned int wm8805_input_channel_select_value[] = { ++ 0, 1, 2, 3, 4, 5, 6, 7 ++}; ++ ++static const struct soc_enum wm8805_input_channel_sel[] = { ++ SOC_VALUE_ENUM_SINGLE(WM8804_PLL6, 0, 7, ARRAY_SIZE(wm8805_input_select_text), ++ wm8805_input_select_text, wm8805_input_channel_select_value), ++}; ++ ++static const struct snd_kcontrol_new wm8805_input_controls_card[] = { ++ SOC_ENUM("Select Input Channel", wm8805_input_channel_sel[0]), ++}; ++ ++static int wm8805_add_input_controls(struct snd_soc_component *component) ++{ ++ snd_soc_add_component_controls(component, wm8805_input_controls_card, ++ ARRAY_SIZE(wm8805_input_controls_card)); ++ return 0; ++} ++ + static unsigned int snd_rpi_wm8804_enable_clock(unsigned int samplerate) + { + switch (samplerate) { +@@ -187,6 +223,53 @@ static struct snd_soc_ops snd_rpi_wm8804 + .hw_params = snd_rpi_wm8804_hw_params, + }; + ++static int snd_interlude_audio_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ int ret = snd_rpi_wm8804_hw_params(substream, params); ++ int samplerate = params_rate(params); ++ ++ switch (samplerate) { ++ case 44100: ++ gpiod_set_value_cansleep(led_gpio_1, 1); ++ gpiod_set_value_cansleep(led_gpio_2, 0); ++ gpiod_set_value_cansleep(led_gpio_3, 0); ++ break; ++ case 48000: ++ gpiod_set_value_cansleep(led_gpio_1, 1); ++ gpiod_set_value_cansleep(led_gpio_2, 0); ++ gpiod_set_value_cansleep(led_gpio_3, 0); ++ break; ++ case 88200: ++ gpiod_set_value_cansleep(led_gpio_1, 0); ++ gpiod_set_value_cansleep(led_gpio_2, 1); ++ gpiod_set_value_cansleep(led_gpio_3, 0); ++ break; ++ case 96000: ++ gpiod_set_value_cansleep(led_gpio_1, 0); ++ gpiod_set_value_cansleep(led_gpio_2, 1); ++ gpiod_set_value_cansleep(led_gpio_3, 0); ++ break; ++ case 176400: ++ gpiod_set_value_cansleep(led_gpio_1, 0); ++ gpiod_set_value_cansleep(led_gpio_2, 0); ++ gpiod_set_value_cansleep(led_gpio_3, 1); ++ break; ++ case 192000: ++ gpiod_set_value_cansleep(led_gpio_1, 0); ++ gpiod_set_value_cansleep(led_gpio_2, 0); ++ gpiod_set_value_cansleep(led_gpio_3, 1); ++ break; ++ default: ++ break; ++ } ++ return ret; ++} ++ ++const struct snd_soc_ops interlude_audio_digital_dai_ops = { ++ .hw_params = snd_interlude_audio_hw_params, ++}; ++ + SND_SOC_DAILINK_DEFS(justboom_digi, + DAILINK_COMP_ARRAY(COMP_EMPTY()), + DAILINK_COMP_ARRAY(COMP_EMPTY()), +@@ -287,6 +370,60 @@ static struct snd_rpi_wm8804_drvdata drv + .probe = snd_hifiberry_digi_probe, + }; + ++SND_SOC_DAILINK_DEFS(interlude_audio_digital, ++ DAILINK_COMP_ARRAY(COMP_EMPTY()), ++ DAILINK_COMP_ARRAY(COMP_EMPTY()), ++ DAILINK_COMP_ARRAY(COMP_EMPTY())); ++ ++static int snd_interlude_audio_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; ++ int ret; ++ ++ ret = wm8805_add_input_controls(component); ++ if (ret != 0) ++ pr_err("failed to add input controls"); ++ ++ return 0; ++} ++ ++ ++static struct snd_soc_dai_link snd_interlude_audio_digital_dai[] = { ++{ ++ .name = "Interlude Audio Digital", ++ .stream_name = "Interlude Audio Digital HiFi", ++ .init = snd_interlude_audio_init, ++ .ops = &interlude_audio_digital_dai_ops, ++ SND_SOC_DAILINK_REG(interlude_audio_digital), ++}, ++}; ++ ++ ++static int snd_interlude_audio_digital_probe(struct platform_device *pdev) ++{ ++ if (IS_ERR(snd_clk44gpio) || IS_ERR(snd_clk48gpio)) ++ return 0; ++ ++ custom_reset = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW); ++ gpiod_set_value_cansleep(custom_reset, 0); ++ mdelay(10); ++ gpiod_set_value_cansleep(custom_reset, 1); ++ ++ snd_interlude_audio_digital_dai->name = "Interlude Audio Digital"; ++ snd_interlude_audio_digital_dai->stream_name = "Interlude Audio Digital HiFi"; ++ led_gpio_1 = devm_gpiod_get(&pdev->dev, "led1", GPIOD_OUT_LOW); ++ led_gpio_2 = devm_gpiod_get(&pdev->dev, "led2", GPIOD_OUT_LOW); ++ led_gpio_3 = devm_gpiod_get(&pdev->dev, "led3", GPIOD_OUT_LOW); ++ return 0; ++} ++ ++ ++static struct snd_rpi_wm8804_drvdata drvdata_interlude_audio_digital = { ++ .card_name = "snd_IA_Digital_Hat", ++ .dai = snd_interlude_audio_digital_dai, ++ .probe = snd_interlude_audio_digital_probe, ++}; ++ + static const struct of_device_id snd_rpi_wm8804_of_match[] = { + { .compatible = "justboom,justboom-digi", + .data = (void *) &drvdata_justboom_digi }, +@@ -296,6 +433,8 @@ static const struct of_device_id snd_rpi + .data = (void *) &drvdata_allo_digione }, + { .compatible = "hifiberry,hifiberry-digi", + .data = (void *) &drvdata_hifiberry_digi }, ++ { .compatible = "interludeaudio,interludeaudio-digital", ++ .data = (void *) &drvdata_interlude_audio_digital }, + {}, + }; + diff --git a/target/linux/bcm27xx/patches-6.1/950-1277-Add-overlays-needed-for-Interlude-Audio-Digital-and-.patch b/target/linux/bcm27xx/patches-6.1/950-1277-Add-overlays-needed-for-Interlude-Audio-Digital-and-.patch new file mode 100644 index 0000000000..2c4196ad4d --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1277-Add-overlays-needed-for-Interlude-Audio-Digital-and-.patch @@ -0,0 +1,179 @@ +From d787ecf50d7a6ec32f8e1afcb8559600396c0f45 Mon Sep 17 00:00:00 2001 +From: Ben Payne +Date: Tue, 13 Feb 2024 14:56:28 -0800 +Subject: [PATCH 1277/1295] Add overlays needed for Interlude Audio Digital and + Analog hats + +Adding 2 new overlays for use with +Interlude Audio's Digital and Analog hats +adding descriptions for both in README +adding changes to Makefile to include both DT's +--- + arch/arm/boot/dts/overlays/Makefile | 2 + + arch/arm/boot/dts/overlays/README | 12 +++ + .../interludeaudio-analog-overlay.dts | 73 +++++++++++++++++++ + .../interludeaudio-digital-overlay.dts | 49 +++++++++++++ + 4 files changed, 136 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/interludeaudio-analog-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/interludeaudio-digital-overlay.dts + +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -131,6 +131,8 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ + imx477.dtbo \ + imx519.dtbo \ + imx708.dtbo \ ++ interludeaudio-analog.dtbo \ ++ interludeaudio-digital.dtbo \ + iqaudio-codec.dtbo \ + iqaudio-dac.dtbo \ + iqaudio-dacplus.dtbo \ +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -2708,6 +2708,18 @@ Params: rotation Mounting + 450000000 (default), 447000000, 453000000. + + ++Name: interludeaudio-analog ++Info: Configures Interlude Audio Analog Hat audio card ++Load: dtoverlay=interludeaudio-analog,= ++Params: gpiopin GPIO pin for codec reset ++ ++ ++Name: interludeaudio-digital ++Info: Configures Interlude Audio Digital Hat audio card ++Load: dtoverlay=interludeaudio-digital ++Params: ++ ++ + Name: iqaudio-codec + Info: Configures the IQaudio Codec audio card + Load: dtoverlay=iqaudio-codec +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/interludeaudio-analog-overlay.dts +@@ -0,0 +1,73 @@ ++// Definitions for Interlude audio analog hat ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835"; ++ ++ fragment@0 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "simple-audio-card"; ++ i2s-controller = <&i2s_clk_consumer>; ++ status = "okay"; ++ ++ simple-audio-card,name = "snd_IA_Analog_Hat"; ++ ++ simple-audio-card,widgets = ++ "Line", "Line In", ++ "Line", "Line Out"; ++ ++ simple-audio-card,routing = ++ "Line Out","AOUTA+", ++ "Line Out","AOUTA-", ++ "Line Out","AOUTB+", ++ "Line Out","AOUTB-", ++ "AINA","Line In", ++ "AINB","Line In"; ++ ++ simple-audio-card,format = "i2s"; ++ ++ simple-audio-card,bitclock-master = <&sound_master>; ++ simple-audio-card,frame-master = <&sound_master>; ++ ++ simple-audio-card,cpu { ++ sound-dai = <&i2s>; ++ dai-tdm-slot-num = <2>; ++ dai-tdm-slot-width = <32>; ++ }; ++ ++ sound_master: simple-audio-card,codec { ++ sound-dai = <&cs4271>; ++ system-clock-frequency = <24576000>; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s_clk_consumer>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ cs4271: cs4271@10 { ++ #sound-dai-cells = <0>; ++ compatible = "cirrus,cs4271"; ++ reg = <0x10>; ++ status = "okay"; ++ reset-gpio = <&gpio 24 0>; /* Pin 26, active high */ ++ }; ++ }; ++ }; ++ __overrides__ { ++ gpiopin = <&cs4271>,"reset-gpio:4"; ++ }; ++}; +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/interludeaudio-digital-overlay.dts +@@ -0,0 +1,49 @@ ++// Definitions for Interlude Audio Digital Hat ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835"; ++ ++ fragment@0 { ++ target = <&i2s_clk_consumer>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8804@3b { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8804"; ++ reg = <0x3b>; ++ PVDD-supply = <&vdd_3v3_reg>; ++ DVDD-supply = <&vdd_3v3_reg>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "interludeaudio,interludeaudio-digital"; ++ i2s-controller = <&i2s_clk_consumer>; ++ status = "okay"; ++ clock44-gpio = <&gpio 22 0>; ++ clock48-gpio = <&gpio 27 0>; ++ led1-gpio = <&gpio 13 0>; ++ led2-gpio = <&gpio 12 0>; ++ led3-gpio = <&gpio 6 0>; ++ reset-gpio = <&gpio 23 0>; ++ }; ++ }; ++ ++}; diff --git a/target/linux/bcm27xx/patches-6.1/950-1279-drm-v3d-Enable-V3D-to-use-different-PAGE_SIZE.patch b/target/linux/bcm27xx/patches-6.1/950-1279-drm-v3d-Enable-V3D-to-use-different-PAGE_SIZE.patch new file mode 100644 index 0000000000..39d4ce9067 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1279-drm-v3d-Enable-V3D-to-use-different-PAGE_SIZE.patch @@ -0,0 +1,118 @@ +From eb06d31da3e2025a2e578d8de9843e24b68137a6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ma=C3=ADra=20Canal?= +Date: Tue, 13 Feb 2024 15:26:44 -0300 +Subject: [PATCH 1279/1295] drm/v3d: Enable V3D to use different PAGE_SIZE +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Currently, the V3D driver uses PAGE_SHIFT over the assumption that +PAGE_SHIFT = 12, as the PAGE_SIZE = 4KB. But, the RPi 5 is using +PAGE_SIZE = 16KB, so the MMU PAGE_SHIFT is different than the system's +PAGE_SHIFT. + +Enable V3D to be used in system's with any PAGE_SIZE by making sure that +everything MMU-related uses the MMU page shift. + +Signed-off-by: Maíra Canal +--- + drivers/gpu/drm/v3d/v3d_bo.c | 12 ++++++------ + drivers/gpu/drm/v3d/v3d_debugfs.c | 2 +- + drivers/gpu/drm/v3d/v3d_drv.h | 2 ++ + drivers/gpu/drm/v3d/v3d_irq.c | 2 +- + drivers/gpu/drm/v3d/v3d_mmu.c | 2 -- + 5 files changed, 10 insertions(+), 10 deletions(-) + +--- a/drivers/gpu/drm/v3d/v3d_bo.c ++++ b/drivers/gpu/drm/v3d/v3d_bo.c +@@ -37,7 +37,7 @@ void v3d_free_object(struct drm_gem_obje + + mutex_lock(&v3d->bo_lock); + v3d->bo_stats.num_allocated--; +- v3d->bo_stats.pages_allocated -= obj->size >> PAGE_SHIFT; ++ v3d->bo_stats.pages_allocated -= obj->size >> V3D_MMU_PAGE_SHIFT; + mutex_unlock(&v3d->bo_lock); + + spin_lock(&v3d->mm_lock); +@@ -106,8 +106,8 @@ v3d_bo_create_finish(struct drm_gem_obje + * lifetime of the BO. + */ + ret = drm_mm_insert_node_generic(&v3d->mm, &bo->node, +- obj->size >> PAGE_SHIFT, +- GMP_GRANULARITY >> PAGE_SHIFT, 0, 0); ++ obj->size >> V3D_MMU_PAGE_SHIFT, ++ GMP_GRANULARITY >> V3D_MMU_PAGE_SHIFT, 0, 0); + spin_unlock(&v3d->mm_lock); + if (ret) + return ret; +@@ -115,7 +115,7 @@ v3d_bo_create_finish(struct drm_gem_obje + /* Track stats for /debug/dri/n/bo_stats. */ + mutex_lock(&v3d->bo_lock); + v3d->bo_stats.num_allocated++; +- v3d->bo_stats.pages_allocated += obj->size >> PAGE_SHIFT; ++ v3d->bo_stats.pages_allocated += obj->size >> V3D_MMU_PAGE_SHIFT; + mutex_unlock(&v3d->bo_lock); + + v3d_mmu_insert_ptes(bo); +@@ -183,7 +183,7 @@ int v3d_create_bo_ioctl(struct drm_devic + if (IS_ERR(bo)) + return PTR_ERR(bo); + +- args->offset = bo->node.start << PAGE_SHIFT; ++ args->offset = bo->node.start << V3D_MMU_PAGE_SHIFT; + + ret = drm_gem_handle_create(file_priv, &bo->base.base, &args->handle); + drm_gem_object_put(&bo->base.base); +@@ -228,7 +228,7 @@ int v3d_get_bo_offset_ioctl(struct drm_d + } + bo = to_v3d_bo(gem_obj); + +- args->offset = bo->node.start << PAGE_SHIFT; ++ args->offset = bo->node.start << V3D_MMU_PAGE_SHIFT; + + drm_gem_object_put(gem_obj); + return 0; +--- a/drivers/gpu/drm/v3d/v3d_debugfs.c ++++ b/drivers/gpu/drm/v3d/v3d_debugfs.c +@@ -220,7 +220,7 @@ static int v3d_debugfs_bo_stats(struct s + seq_printf(m, "allocated bos: %d\n", + v3d->bo_stats.num_allocated); + seq_printf(m, "allocated bo size (kb): %ld\n", +- (long)v3d->bo_stats.pages_allocated << (PAGE_SHIFT - 10)); ++ (long)v3d->bo_stats.pages_allocated << (V3D_MMU_PAGE_SHIFT - 10)); + mutex_unlock(&v3d->bo_lock); + + return 0; +--- a/drivers/gpu/drm/v3d/v3d_drv.h ++++ b/drivers/gpu/drm/v3d/v3d_drv.h +@@ -19,6 +19,8 @@ struct reset_control; + + #define GMP_GRANULARITY (128 * 1024) + ++#define V3D_MMU_PAGE_SHIFT 12 ++ + #define V3D_MAX_QUEUES (V3D_CACHE_CLEAN + 1) + + static inline char * +--- a/drivers/gpu/drm/v3d/v3d_irq.c ++++ b/drivers/gpu/drm/v3d/v3d_irq.c +@@ -70,7 +70,7 @@ v3d_overflow_mem_work(struct work_struct + list_add_tail(&bo->unref_head, &v3d->bin_job->render->unref_list); + spin_unlock_irqrestore(&v3d->job_lock, irqflags); + +- V3D_CORE_WRITE(0, V3D_PTB_BPOA, bo->node.start << PAGE_SHIFT); ++ V3D_CORE_WRITE(0, V3D_PTB_BPOA, bo->node.start << V3D_MMU_PAGE_SHIFT); + V3D_CORE_WRITE(0, V3D_PTB_BPOS, obj->size); + + out: +--- a/drivers/gpu/drm/v3d/v3d_mmu.c ++++ b/drivers/gpu/drm/v3d/v3d_mmu.c +@@ -21,8 +21,6 @@ + #include "v3d_drv.h" + #include "v3d_regs.h" + +-#define V3D_MMU_PAGE_SHIFT 12 +- + /* Note: All PTEs for the 1MB superpage must be filled with the + * superpage bit set. + */ diff --git a/target/linux/bcm27xx/patches-6.1/950-1280-overlays-adau1977-adc-Replace-use-of-i2c-label.patch b/target/linux/bcm27xx/patches-6.1/950-1280-overlays-adau1977-adc-Replace-use-of-i2c-label.patch new file mode 100644 index 0000000000..bb28d9369e --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1280-overlays-adau1977-adc-Replace-use-of-i2c-label.patch @@ -0,0 +1,25 @@ +From aa00918b9562daa3b776600f48d8264b20fd54f6 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Sun, 18 Feb 2024 15:31:50 +0000 +Subject: [PATCH 1280/1295] overlays: adau1977-adc: Replace use of i2c label + +The label 'i2c' is no longer created by the firmware - i2c_arm or +i2c1 should be used instead. Replace the last occurrence of &i2c with +&i2c1. + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts ++++ b/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts +@@ -6,7 +6,7 @@ + compatible = "brcm,bcm2835"; + + fragment@0 { +- target = <&i2c>; ++ target = <&i2c1>; + + __overlay__ { + #address-cells = <1>; diff --git a/target/linux/bcm27xx/patches-6.1/950-1281-Add-IQaudio-CodecZero-to-hat_map.dts.patch b/target/linux/bcm27xx/patches-6.1/950-1281-Add-IQaudio-CodecZero-to-hat_map.dts.patch new file mode 100644 index 0000000000..399c293e1f --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1281-Add-IQaudio-CodecZero-to-hat_map.dts.patch @@ -0,0 +1,24 @@ +From afd5f659b0453e4c710ce5cf74c577563ff16239 Mon Sep 17 00:00:00 2001 +From: Andrew Scheller +Date: Tue, 20 Feb 2024 17:53:03 +0000 +Subject: [PATCH 1281/1295] Add IQaudio CodecZero to hat_map.dts + +Fixes https://github.com/raspberrypi/Pi-Codec/issues/9 +--- + arch/arm/boot/dts/overlays/hat_map.dts | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/arch/arm/boot/dts/overlays/hat_map.dts ++++ b/arch/arm/boot/dts/overlays/hat_map.dts +@@ -6,6 +6,11 @@ + overlay = "iqaudio-codec"; + }; + ++ iqaudio-pi-codeczero { ++ uuid = [ e15c739c 877d 4e29 ab36 4dc73c21127c ]; ++ overlay = "iqaudio-codec"; ++ }; ++ + pisound { + uuid = [ a7ee5d28 da03 41f5 bbd7 20438a4bec5d ]; + overlay = "pisound"; diff --git a/target/linux/bcm27xx/patches-6.1/950-1282-ASOc-Add-HiFiBerry-DAC8X-to-the-simple-card-driver.patch b/target/linux/bcm27xx/patches-6.1/950-1282-ASOc-Add-HiFiBerry-DAC8X-to-the-simple-card-driver.patch new file mode 100644 index 0000000000..dadd8123be --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1282-ASOc-Add-HiFiBerry-DAC8X-to-the-simple-card-driver.patch @@ -0,0 +1,82 @@ +From d4acd8b7ea890c01453cdcf9b04a999ca04dfd2a Mon Sep 17 00:00:00 2001 +From: j-schambacher +Date: Wed, 28 Feb 2024 11:25:14 +0100 +Subject: [PATCH 1282/1295] ASOc: Add HiFiBerry DAC8X to the simple card driver + +Defines the settings for the 8 channel version of the standard +DAC by overwriting the number of channels in the DAI defs. +It can run in 8ch mode only on PI5 using the 4 lane data output +of the designware I2S0 module. + +Signed-off-by: j-schambacher +--- + sound/soc/bcm/Kconfig | 5 +++-- + sound/soc/bcm/rpi-simple-soundcard.c | 33 ++++++++++++++++++++++++++++ + 2 files changed, 36 insertions(+), 2 deletions(-) + +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -40,11 +40,12 @@ config SND_BCM2708_SOC_GOOGLEVOICEHAT_SO + Say Y or M if you want to add support for voiceHAT soundcard. + + config SND_BCM2708_SOC_HIFIBERRY_DAC +- tristate "Support for HifiBerry DAC" ++ tristate "Support for HifiBerry DAC and DAC8X" + select SND_SOC_PCM5102A + select SND_RPI_SIMPLE_SOUNDCARD + help +- Say Y or M if you want to add support for HifiBerry DAC. ++ Say Y or M if you want to add support for HifiBerry DAC and DAC8X. ++ Note: DAC8X only works on PI5 + + config SND_BCM2708_SOC_HIFIBERRY_DACPLUS + tristate "Support for HifiBerry DAC+" +--- a/sound/soc/bcm/rpi-simple-soundcard.c ++++ b/sound/soc/bcm/rpi-simple-soundcard.c +@@ -316,6 +316,37 @@ static struct snd_rpi_simple_drvdata drv + .dai = snd_hifiberry_dac_dai, + }; + ++static int hifiberry_dac8x_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); ++ ++ /* override the defaults to reflect 4 x PCM5102A on the card ++ * and limit the sample rate to 192ksps ++ */ ++ codec_dai->driver->playback.channels_max = 8; ++ codec_dai->driver->playback.rates = SNDRV_PCM_RATE_8000_192000; ++ ++ return 0; ++} ++ ++static struct snd_soc_dai_link snd_hifiberry_dac8x_dai[] = { ++ { ++ .name = "HifiBerry DAC8x", ++ .stream_name = "HifiBerry DAC8x HiFi", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | ++ SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBS_CFS, ++ .init = hifiberry_dac8x_init, ++ SND_SOC_DAILINK_REG(hifiberry_dac), ++ }, ++}; ++ ++static struct snd_rpi_simple_drvdata drvdata_hifiberry_dac8x = { ++ .card_name = "snd_rpi_hifiberry_dac8x", ++ .dai = snd_hifiberry_dac8x_dai, ++ .fixed_bclk_ratio = 64, ++}; ++ + SND_SOC_DAILINK_DEFS(dionaudio_kiwi, + DAILINK_COMP_ARRAY(COMP_EMPTY()), + DAILINK_COMP_ARRAY(COMP_CODEC("pcm1794a-codec", "pcm1794a-hifi")), +@@ -417,6 +448,8 @@ static const struct of_device_id snd_rpi + .data = (void *) &drvdata_hifiberry_amp3 }, + { .compatible = "hifiberry,hifiberry-dac", + .data = (void *) &drvdata_hifiberry_dac }, ++ { .compatible = "hifiberry,hifiberry-dac8x", ++ .data = (void *) &drvdata_hifiberry_dac8x }, + { .compatible = "dionaudio,dionaudio-kiwi", + .data = (void *) &drvdata_dionaudio_kiwi }, + { .compatible = "rpi,rpi-dac", &drvdata_rpi_dac}, diff --git a/target/linux/bcm27xx/patches-6.1/950-1283-Overlays-Add-definitions-for-HiFiBerry-8-channel-DAC.patch b/target/linux/bcm27xx/patches-6.1/950-1283-Overlays-Add-definitions-for-HiFiBerry-8-channel-DAC.patch new file mode 100644 index 0000000000..b383b744e7 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1283-Overlays-Add-definitions-for-HiFiBerry-8-channel-DAC.patch @@ -0,0 +1,113 @@ +From 813135a7ff3f0c2b91dc06a5b3f8deac15570466 Mon Sep 17 00:00:00 2001 +From: j-schambacher +Date: Wed, 28 Feb 2024 11:34:05 +0100 +Subject: [PATCH 1283/1295] Overlays: Add definitions for HiFiBerry 8 channel + DAC8X + +Dedicated overlay claiming all 4 data lanes of the designware +I2S0 module to drive 4x PCM5102. THe devices share BCLK and +LRCLK, therefore all outputs will always run at the same +samplerate and format. + +Compatible only with PI5! + +Signed-off-by: j-schambacher +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 6 +++ + .../dts/overlays/hifiberry-dac8x-overlay.dts | 50 +++++++++++++++++++ + arch/arm/boot/dts/overlays/overlay_map.dts | 4 ++ + 4 files changed, 61 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dac8x-overlay.dts + +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -88,6 +88,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ + hifiberry-amp3.dtbo \ + hifiberry-amp4pro.dtbo \ + hifiberry-dac.dtbo \ ++ hifiberry-dac8x.dtbo \ + hifiberry-dacplus.dtbo \ + hifiberry-dacplusadc.dtbo \ + hifiberry-dacplusadcpro.dtbo \ +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -1772,6 +1772,12 @@ Load: dtoverlay=hifiberry-dac + Params: + + ++Name: hifiberry-dac8x ++Info: Configures the HifiBerry DAC8X audio cards (only on PI5) ++Load: dtoverlay=hifiberry-dac8x ++Params: ++ ++ + Name: hifiberry-dacplus + Info: Configures the HifiBerry DAC+ audio card + Load: dtoverlay=hifiberry-dacplus,= +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-dac8x-overlay.dts +@@ -0,0 +1,50 @@ ++// Definitions for HiFiBerry DAC8x ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2712"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ rp1_i2s0_dac8x: rp1_i2s0_dac8x { ++ function = "i2s0"; ++ pins = "gpio18", "gpio19", "gpio21", ++ "gpio23", "gpio25", "gpio27"; ++ bias-disable; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s_clk_producer>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rp1_i2s0_dac8x>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target-path = "/"; ++ __overlay__ { ++ pcm5102a-codec { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5102a"; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-dac8x"; ++ i2s-controller = <&i2s_clk_producer>; ++ status = "okay"; ++ }; ++ }; ++ ++}; +--- a/arch/arm/boot/dts/overlays/overlay_map.dts ++++ b/arch/arm/boot/dts/overlays/overlay_map.dts +@@ -48,6 +48,10 @@ + bcm2712; + }; + ++ hifiberry-dac8x { ++ bcm2712; ++ }; ++ + highperi { + bcm2711; + }; diff --git a/target/linux/bcm27xx/patches-6.1/950-1285-vc4-hvs-Fix-lbm-size-calculation-for-yuv-6012.patch b/target/linux/bcm27xx/patches-6.1/950-1285-vc4-hvs-Fix-lbm-size-calculation-for-yuv-6012.patch new file mode 100644 index 0000000000..cb4681909e --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1285-vc4-hvs-Fix-lbm-size-calculation-for-yuv-6012.patch @@ -0,0 +1,31 @@ +From c0169f2c197d005aff8acfbc618de6e7f6b1ab94 Mon Sep 17 00:00:00 2001 +From: Florian Wesch +Date: Tue, 5 Mar 2024 15:17:56 +0100 +Subject: [PATCH 1285/1295] vc4/hvs: Fix lbm size calculation for yuv (#6012) + +The code was reducing the number of components by one when we were not +blending with alpha. But that only makes sense if the components include +alpha. + +For YUV, we were reducing the number of components for Y from one to zero +which resulted in no lbm space being allocated. + +Fixes: https://github.com/raspberrypi/linux/issues/5912 + +Signed-off-by: Dom Cobley +Co-authored-by: Dom Cobley +--- + drivers/gpu/drm/vc4/vc4_plane.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/vc4/vc4_plane.c ++++ b/drivers/gpu/drm/vc4/vc4_plane.c +@@ -733,7 +733,7 @@ static unsigned int vc4_lbm_channel_size + if (!components) + return 0; + +- if (state->alpha != DRM_BLEND_ALPHA_OPAQUE) ++ if (state->alpha != DRM_BLEND_ALPHA_OPAQUE && info->has_alpha) + components -= 1; + + words = width * wpc * components; diff --git a/target/linux/bcm27xx/patches-6.1/950-1286-Driver-add-waveshare-4inch-dsi-lcd-C-driver.patch b/target/linux/bcm27xx/patches-6.1/950-1286-Driver-add-waveshare-4inch-dsi-lcd-C-driver.patch new file mode 100644 index 0000000000..4bda41a791 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1286-Driver-add-waveshare-4inch-dsi-lcd-C-driver.patch @@ -0,0 +1,41 @@ +From 50da59d237df59b38c5e3c375b3df8fabbda1069 Mon Sep 17 00:00:00 2001 +From: Eng33 +Date: Fri, 8 Mar 2024 18:36:37 +0800 +Subject: [PATCH 1286/1295] Driver:add waveshare 4inch dsi lcd (C) driver + +Signed-off-by: Eng33 +--- + drivers/gpu/drm/panel/panel-waveshare-dsi.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- a/drivers/gpu/drm/panel/panel-waveshare-dsi.c ++++ b/drivers/gpu/drm/panel/panel-waveshare-dsi.c +@@ -138,6 +138,18 @@ static const struct drm_display_mode ws_ + .vtotal = 1480 + 60 + 60 + 60, + }; + ++static const struct drm_display_mode ws_panel_4_mode = { ++ .clock = 50000, ++ .hdisplay = 720, ++ .hsync_start = 720 + 32, ++ .hsync_end = 720 + 32 + 200, ++ .htotal = 720 + 32 + 200 + 120, ++ .vdisplay = 720, ++ .vsync_start = 720 + 8, ++ .vsync_end = 720 + 8 + 4, ++ .vtotal = 720 + 8 + 4 + 16, ++}; ++ + static struct ws_panel *panel_to_ts(struct drm_panel *panel) + { + return container_of(panel, struct ws_panel, base); +@@ -399,6 +411,9 @@ static const struct of_device_id ws_pane + .compatible = "waveshare,11.9inch-panel", + .data = &ws_panel_11_9_mode, + }, { ++ .compatible = "waveshare,4inch-panel", ++ .data = &ws_panel_4_mode, ++ }, { + /* sentinel */ + } + }; diff --git a/target/linux/bcm27xx/patches-6.1/950-1287-Dtoverlay-add-waveshare-4inch-dsi-lcd-C-dtoverlay.patch b/target/linux/bcm27xx/patches-6.1/950-1287-Dtoverlay-add-waveshare-4inch-dsi-lcd-C-dtoverlay.patch new file mode 100644 index 0000000000..605ad842cf --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1287-Dtoverlay-add-waveshare-4inch-dsi-lcd-C-dtoverlay.patch @@ -0,0 +1,22 @@ +From bb2f912c94d11a0f0b5f13c91793fa9f79eb92aa Mon Sep 17 00:00:00 2001 +From: Eng33 +Date: Fri, 8 Mar 2024 18:37:03 +0800 +Subject: [PATCH 1287/1295] Dtoverlay:add waveshare 4inch dsi lcd (C) dtoverlay + +Signed-off-by: Eng33 +--- + .../boot/dts/overlays/vc4-kms-dsi-waveshare-panel-overlay.dts | 3 +++ + 1 file changed, 3 insertions(+) + +--- 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 +@@ -112,6 +112,9 @@ + <&touch>, "touchscreen-size-y:0=1480", + <&touch>, "touchscreen-inverted-x?", + <&touch>, "touchscreen-swapped-x-y?"; ++ 4_0_inchC = <&panel>, "compatible=waveshare,4inch-panel", ++ <&touch>, "touchscreen-size-x:0=720", ++ <&touch>, "touchscreen-size-y:0=720"; + i2c1 = <&i2c_frag>, "target:0=",<&i2c1>, + <0>, "-3-4+5"; + disable_touch = <&touch>, "status=disabled"; diff --git a/target/linux/bcm27xx/patches-6.1/950-1288-Dtoverlay-fix-waveshare-11.9inch-touch-orientation-e.patch b/target/linux/bcm27xx/patches-6.1/950-1288-Dtoverlay-fix-waveshare-11.9inch-touch-orientation-e.patch new file mode 100644 index 0000000000..868c162cc4 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1288-Dtoverlay-fix-waveshare-11.9inch-touch-orientation-e.patch @@ -0,0 +1,22 @@ +From 29cc64d7d94f9a6ee0e97e8009b832514d2525e0 Mon Sep 17 00:00:00 2001 +From: Eng33 +Date: Fri, 8 Mar 2024 18:38:33 +0800 +Subject: [PATCH 1288/1295] Dtoverlay:fix waveshare 11.9inch touch orientation + error + +Signed-off-by: Eng33 +--- + .../boot/dts/overlays/vc4-kms-dsi-waveshare-panel-overlay.dts | 2 -- + 1 file changed, 2 deletions(-) + +--- 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 +@@ -108,8 +108,6 @@ + <&touch>, "touchscreen-inverted-x?", + <&touch>, "touchscreen-swapped-x-y?"; + 11_9_inch = <&panel>, "compatible=waveshare,11.9inch-panel", +- <&touch>, "touchscreen-size-x:0=320", +- <&touch>, "touchscreen-size-y:0=1480", + <&touch>, "touchscreen-inverted-x?", + <&touch>, "touchscreen-swapped-x-y?"; + 4_0_inchC = <&panel>, "compatible=waveshare,4inch-panel", diff --git a/target/linux/bcm27xx/patches-6.1/950-1289-Dtoverlay-Add-waveshare-4inch-dsi-lcd-C-parameters-t.patch b/target/linux/bcm27xx/patches-6.1/950-1289-Dtoverlay-Add-waveshare-4inch-dsi-lcd-C-parameters-t.patch new file mode 100644 index 0000000000..ea72100e52 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1289-Dtoverlay-Add-waveshare-4inch-dsi-lcd-C-parameters-t.patch @@ -0,0 +1,21 @@ +From 8db8a2b856a24dd30b201c9af3238cedaf5f0c58 Mon Sep 17 00:00:00 2001 +From: Eng33 +Date: Mon, 11 Mar 2024 10:00:23 +0800 +Subject: [PATCH 1289/1295] Dtoverlay:Add waveshare 4inch dsi lcd (C) + parameters to the README + +Signed-off-by: Eng33 +--- + arch/arm/boot/dts/overlays/README | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -5011,6 +5011,7 @@ Load: dtoverlay=vc4-kms-dsi-waveshare- + Params: 2_8_inch 2.8" 480x640 + 3_4_inch 3.4" 800x800 round + 4_0_inch 4.0" 480x800 ++ 4_0_inchC 4.0" 720x720 + 7_0_inchC 7.0" C 1024x600 + 7_9_inch 7.9" 400x1280 + 8_0_inch 8.0" 1280x800 diff --git a/target/linux/bcm27xx/patches-6.1/950-1290-Overlays-Add-specific-clk-producer-consumer-overlays.patch b/target/linux/bcm27xx/patches-6.1/950-1290-Overlays-Add-specific-clk-producer-consumer-overlays.patch new file mode 100644 index 0000000000..477276a59a --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1290-Overlays-Add-specific-clk-producer-consumer-overlays.patch @@ -0,0 +1,223 @@ +From 9e31e8ce44ef11cabcb1b95830e1fdd8a9655ad3 Mon Sep 17 00:00:00 2001 +From: j-schambacher +Date: Mon, 11 Mar 2024 15:32:28 +0100 +Subject: [PATCH 1290/1295] Overlays:Add specific clk-producer/-consumer + overlays for Hifiberry DAC+ + +As the easy switching of the I2S module bewteen clock producer/consumer +on the PI5 is not possible, two specific DT-overlays are introduced. +The DAC+PRO boards with onboard clocks use the -PRO overlay, the boards +without oscillators the -STD version. +The "hifiberry-dacplus,slave" parameter in the -STD overlay disables +the automatic clock detection inside the hifiberry-dacplus driver. + +The former hifiberry-dacplus overlay is kept for compatibility but +will be deprecated. + +Signed-off-by: j-schambacher +--- + arch/arm/boot/dts/overlays/Makefile | 2 + + arch/arm/boot/dts/overlays/README | 42 ++++++++++++ + .../hifiberry-dacplus-pro-overlay.dts | 64 ++++++++++++++++++ + .../hifiberry-dacplus-std-overlay.dts | 65 +++++++++++++++++++ + 4 files changed, 173 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dacplus-pro-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dacplus-std-overlay.dts + +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -90,6 +90,8 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ + hifiberry-dac.dtbo \ + hifiberry-dac8x.dtbo \ + hifiberry-dacplus.dtbo \ ++ hifiberry-dacplus-pro.dtbo \ ++ hifiberry-dacplus-std.dtbo \ + hifiberry-dacplusadc.dtbo \ + hifiberry-dacplusadcpro.dtbo \ + hifiberry-dacplusdsp.dtbo \ +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -1801,6 +1801,48 @@ Params: 24db_digital_gain Allow ga + are switched off at all times. + + ++Name: hifiberry-dacplus-pro ++Info: Configures the HifiBerry DAC+ PRO audio card (onboard clocks) ++Load: dtoverlay=hifiberry-dacplus-pro,= ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=hifiberry-dacplus,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24dB_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) ++ leds_off If set to 'true' the onboard indicator LEDs ++ are switched off at all times. ++ ++ ++Name: hifiberry-dacplus-std ++Info: Configures the HifiBerry DAC+ standard audio card (no onboard clocks) ++Load: dtoverlay=hifiberry-dacplus-std,= ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=hifiberry-dacplus,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24dB_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) ++ leds_off If set to 'true' the onboard indicator LEDs ++ are switched off at all times. ++ ++ + Name: hifiberry-dacplusadc + Info: Configures the HifiBerry DAC+ADC audio card + Load: dtoverlay=hifiberry-dacplusadc,= +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-pro-overlay.dts +@@ -0,0 +1,64 @@ ++// Definitions for HiFiBerry DAC+ PRO, with onboard clocks ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ dacpro_osc: dacpro_osc { ++ compatible = "hifiberry,dacpro-clk"; ++ #clock-cells = <0>; ++ }; ++ }; ++ }; ++ ++ frag1: fragment@1 { ++ target = <&i2s_clk_consumer>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4d { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4d>; ++ clocks = <&dacpro_osc>; ++ AVDD-supply = <&vdd_3v3_reg>; ++ DVDD-supply = <&vdd_3v3_reg>; ++ CPVDD-supply = <&vdd_3v3_reg>; ++ status = "okay"; ++ }; ++ hpamp: hpamp@60 { ++ compatible = "ti,tpa6130a2"; ++ reg = <0x60>; ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&sound>; ++ hifiberry_dacplus: __overlay__ { ++ compatible = "hifiberry,hifiberry-dacplus"; ++ i2s-controller = <&i2s_clk_consumer>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ 24db_digital_gain = ++ <&hifiberry_dacplus>,"hifiberry,24db_digital_gain?"; ++ leds_off = <&hifiberry_dacplus>,"hifiberry-dacplus,leds_off?"; ++ }; ++}; +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-std-overlay.dts +@@ -0,0 +1,65 @@ ++// Definitions for HiFiBerry DAC+ Standard w/o onboard clocks ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ dacpro_osc: dacpro_osc { ++ compatible = "hifiberry,dacpro-clk"; ++ #clock-cells = <0>; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s_clk_producer>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4d { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4d>; ++ clocks = <&dacpro_osc>; ++ AVDD-supply = <&vdd_3v3_reg>; ++ DVDD-supply = <&vdd_3v3_reg>; ++ CPVDD-supply = <&vdd_3v3_reg>; ++ status = "okay"; ++ }; ++ hpamp: hpamp@60 { ++ compatible = "ti,tpa6130a2"; ++ reg = <0x60>; ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&sound>; ++ hifiberry_dacplus: __overlay__ { ++ compatible = "hifiberry,hifiberry-dacplus"; ++ i2s-controller = <&i2s_clk_producer>; ++ hifiberry-dacplus,slave; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ 24db_digital_gain = ++ <&hifiberry_dacplus>,"hifiberry,24db_digital_gain?"; ++ leds_off = <&hifiberry_dacplus>,"hifiberry-dacplus,leds_off?"; ++ }; ++}; diff --git a/target/linux/bcm27xx/patches-6.1/950-1291-overlays-hat_map-Add-Hifiberry-cards.patch b/target/linux/bcm27xx/patches-6.1/950-1291-overlays-hat_map-Add-Hifiberry-cards.patch new file mode 100644 index 0000000000..2e25c3c302 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1291-overlays-hat_map-Add-Hifiberry-cards.patch @@ -0,0 +1,96 @@ +From fae2848e87c2696d1eeaeb3f449ad871874b699f Mon Sep 17 00:00:00 2001 +From: j-schambacher +Date: Tue, 12 Mar 2024 10:59:48 +0100 +Subject: [PATCH 1291/1295] overlays:hat_map: Add Hifiberry cards + +Adds all available Hifberry cards' UUIDs to the hat_map file. + +Signed-off-by: j-schambacher +--- + arch/arm/boot/dts/overlays/hat_map.dts | 75 ++++++++++++++++++++++++++ + 1 file changed, 75 insertions(+) + +--- a/arch/arm/boot/dts/overlays/hat_map.dts ++++ b/arch/arm/boot/dts/overlays/hat_map.dts +@@ -1,6 +1,81 @@ + /dts-v1/; + + / { ++ hifiberry-amp100-1 { ++ uuid = [ 5eb863b8 12f9 41ad 978f 4cee1b3eca62 ]; ++ overlay = "hifiberry-amp100"; ++ }; ++ ++ hifiberry-amp100-2 { ++ uuid = [ b1a57dbe 8b52 447f 939e 1baf72157d79 ]; ++ overlay = "hifiberry-amp100"; ++ }; ++ ++ hifiberry-amp4pro { ++ uuid = [ 3619722a c92d 4092 95bd 493a2903e933 ]; ++ overlay = "hifiberry-amp4pro"; ++ }; ++ ++ hifiberry-amp4 { ++ uuid = [ fcb6ec42 a182 419d a314 7eeae416f608 ]; ++ overlay = "hifiberry-dacplus-std"; ++ }; ++ ++ hifiberry-dac2proadc { ++ uuid = [ 30660215 dbb2 4c57 953f 099370b63e2e ]; ++ overlay = "hifiberry-dacplusadcpro"; ++ }; ++ ++ hifiberry-dac2hd { ++ uuid = [ 482ad277 5586 480c 88e7 85ae89c4e501 ]; ++ overlay = "hifiberry-dacplushd"; ++ }; ++ ++ hifiberry-dac2pro { ++ uuid = [ ebf9cfc4 6d77 4880 89fd 353690467dfc ]; ++ overlay = "hifiberry-dacplus-pro"; ++ }; ++ ++ hifiberry-dac8x { ++ uuid = [ f65985f9 5354 4457 ae3b 3da39ba2cf6d ]; ++ overlay = "hifiberry-dac8x"; ++ }; ++ ++ hifiberry-dacplus-amp2-1 { ++ uuid = [ 81cac43d 27c6 4a1e a0b2 c70b4e608ab6 ]; ++ overlay = "hifiberry-dacplus-std"; ++ }; ++ ++ hifiberry-dacplus-amp2-2 { ++ uuid = [ ef586afc 2efa 47a0 be2e 95a7d952fe98 ]; ++ overlay = "hifiberry-dacplus-std"; ++ }; ++ ++ hifiberry-digiplus-pro { ++ uuid = [ 2154f80b 0f92 45e4 96db c1643ec2b46b ]; ++ overlay = "hifiberry-digi-pro"; ++ }; ++ ++ hifiberry-dacplusadcpro { ++ uuid = [ 36e3d3da 1ed9 468b aea3 cd165f6820f0 ]; ++ overlay = "hifiberry-dacplusadcpro"; ++ }; ++ ++ hifiberry-digi2pro { ++ uuid = [ 5af941bb 4dcf 4eac 82a8 e36e84fcabef ]; ++ overlay = "hifiberry-digi-pro"; ++ }; ++ ++ hifiberry-digi2standard { ++ uuid = [ 7c980a0e 9d15 40af 9f40 bddfbd3aee8c ]; ++ overlay = "hifiberry-digi"; ++ }; ++ ++ hifiberry-dsp2x4 { ++ uuid = [ 8f287583 429d 4206 a751 862264bbda63 ]; ++ overlay = "hifiberry-dacplus-dsp"; ++ }; ++ + iqaudio-pi-codecplus { + uuid = [ dc1c9594 c1ab 4c6c acda a88dc59a3c5b ]; + overlay = "iqaudio-codec"; diff --git a/target/linux/bcm27xx/patches-6.1/950-1292-ASoC-Fix-16bit-sample-support-for-Hifiberry-DACplusA.patch b/target/linux/bcm27xx/patches-6.1/950-1292-ASoC-Fix-16bit-sample-support-for-Hifiberry-DACplusA.patch new file mode 100644 index 0000000000..95c954ab5c --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1292-ASoC-Fix-16bit-sample-support-for-Hifiberry-DACplusA.patch @@ -0,0 +1,31 @@ +From f87bf7dfa65cce1d46800c0769351fef59abba55 Mon Sep 17 00:00:00 2001 +From: j-schambacher +Date: Wed, 13 Mar 2024 10:31:18 +0100 +Subject: [PATCH 1292/1295] ASoC: Fix 16bit sample support for Hifiberry + DACplusADC + +Same issue as #5919. +'width' needs to be set independent of clocking mode. + +Signed-off-by: j-schambacher +--- + sound/soc/bcm/hifiberry_dacplusadc.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/sound/soc/bcm/hifiberry_dacplusadc.c ++++ b/sound/soc/bcm/hifiberry_dacplusadc.c +@@ -229,13 +229,11 @@ static int snd_rpi_hifiberry_dacplusadc_ + int ret = 0; + struct snd_soc_pcm_runtime *rtd = substream->private_data; + int channels = params_channels(params); +- int width = 32; ++ int width = snd_pcm_format_width(params_format(params)); + + if (snd_rpi_hifiberry_is_dacpro) { + struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; + +- width = snd_pcm_format_physical_width(params_format(params)); +- + snd_rpi_hifiberry_dacplusadc_set_sclk(component, + params_rate(params)); + diff --git a/target/linux/bcm27xx/patches-6.1/950-1293-overlays-Sets-i2s_clk_producer-as-default-for-Hifibe.patch b/target/linux/bcm27xx/patches-6.1/950-1293-overlays-Sets-i2s_clk_producer-as-default-for-Hifibe.patch new file mode 100644 index 0000000000..f1b39eb540 --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1293-overlays-Sets-i2s_clk_producer-as-default-for-Hifibe.patch @@ -0,0 +1,79 @@ +From 5d1972f99f893ac9394d2a795a3b21385b9e34a5 Mon Sep 17 00:00:00 2001 +From: j-schambacher +Date: Wed, 13 Mar 2024 10:11:27 +0100 +Subject: [PATCH 1293/1295] overlays: Sets i2s_clk_producer as default for + Hifiberry DACplusADC + +As we have never released a (standard) DACplusADC board with onboard +clocks, we can simply use a fixed setup avoiding incompatibilities +with Pi5 during driver init. Setting 'hifiberry-dacplusadc,slave' in +the overlays disables the failing clock probing mechanism. + +Removes 'slave' parameter description from README which is still +supported but not needed. + +Signed-off-by: j-schambacher +--- + arch/arm/boot/dts/overlays/README | 4 +--- + .../dts/overlays/hifiberry-dacplusadc-overlay.dts | 12 +++++------- + 2 files changed, 6 insertions(+), 10 deletions(-) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -1773,7 +1773,7 @@ Params: + + + Name: hifiberry-dac8x +-Info: Configures the HifiBerry DAC8X audio cards (only on PI5) ++Info: Configures the HifiBerry DAC8X audio cards (only on Pi5) + Load: dtoverlay=hifiberry-dac8x + Params: + +@@ -1860,8 +1860,6 @@ Params: 24db_digital_gain Allow ga + responsibility of the user to ensure that + the Digital volume control is set to a value + that does not result in clipping/distortion!) +- slave Force DAC+ADC into slave mode, using Pi as +- master for bit clock and frame clock. + leds_off If set to 'true' the onboard indicator LEDs + are switched off at all times. + +--- a/arch/arm/boot/dts/overlays/hifiberry-dacplusadc-overlay.dts ++++ b/arch/arm/boot/dts/overlays/hifiberry-dacplusadc-overlay.dts +@@ -1,4 +1,4 @@ +-// Definitions for HiFiBerry DAC+ADC ++// Definitions for HiFiBerry DAC+ADC, no onboard clocks + /dts-v1/; + /plugin/; + +@@ -15,8 +15,8 @@ + }; + }; + +- frag1: fragment@1 { +- target = <&i2s_clk_consumer>; ++ fragment@1 { ++ target = <&i2s_clk_producer>; + __overlay__ { + status = "okay"; + }; +@@ -58,7 +58,8 @@ + target = <&sound>; + hifiberry_dacplusadc: __overlay__ { + compatible = "hifiberry,hifiberry-dacplusadc"; +- i2s-controller = <&i2s_clk_consumer>; ++ i2s-controller = <&i2s_clk_producer>; ++ hifiberry-dacplusadc,slave; + status = "okay"; + }; + }; +@@ -66,9 +67,6 @@ + __overrides__ { + 24db_digital_gain = + <&hifiberry_dacplusadc>,"hifiberry,24db_digital_gain?"; +- slave = <&hifiberry_dacplusadc>,"hifiberry-dacplusadc,slave?", +- <&frag1>,"target:0=",<&i2s_clk_producer>, +- <&hifiberry_dacplusadc>,"i2s-controller:0=",<&i2s_clk_producer>; + leds_off = <&hifiberry_dacplusadc>,"hifiberry-dacplusadc,leds_off?"; + }; + }; diff --git a/target/linux/bcm27xx/patches-6.1/950-1294-imx477-make-trigger-mode-more-configurable.patch b/target/linux/bcm27xx/patches-6.1/950-1294-imx477-make-trigger-mode-more-configurable.patch new file mode 100644 index 0000000000..584782d25a --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1294-imx477-make-trigger-mode-more-configurable.patch @@ -0,0 +1,77 @@ +From f4102d30e760482e9f2fc94dcf8ce223afef3230 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Erik=20Bot=C3=B6?= +Date: Fri, 9 Feb 2024 18:37:46 +0100 +Subject: [PATCH 1294/1295] imx477: make trigger-mode more configurable +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Allow trigger-mode to be overridden using device tree so that it can be +set per camera. Previously the mode could only be changed using a module +parameter, which would then affect all cameras. + +Signed-off-by: Erik Botö +--- + drivers/media/i2c/imx477.c | 19 ++++++++++++++----- + 1 file changed, 14 insertions(+), 5 deletions(-) + +--- a/drivers/media/i2c/imx477.c ++++ b/drivers/media/i2c/imx477.c +@@ -1124,6 +1124,9 @@ struct imx477 { + /* Current mode */ + const struct imx477_mode *mode; + ++ /* Trigger mode */ ++ int trigger_mode_of; ++ + /* + * Mutex for serialized access: + * Protect sensor module set pad format and start/stop streaming safely. +@@ -1711,7 +1714,7 @@ static int imx477_start_streaming(struct + struct i2c_client *client = v4l2_get_subdevdata(&imx477->sd); + const struct imx477_reg_list *reg_list; + const struct imx477_reg_list *extra_regs; +- int ret; ++ int ret, tm; + + if (!imx477->common_regs_written) { + ret = imx477_write_regs(imx477, mode_common_regs, +@@ -1748,14 +1751,15 @@ static int imx477_start_streaming(struct + return ret; + + /* Set vsync trigger mode: 0=standalone, 1=source, 2=sink */ ++ tm = (imx477->trigger_mode_of >= 0) ? imx477->trigger_mode_of : trigger_mode; + imx477_write_reg(imx477, IMX477_REG_MC_MODE, +- IMX477_REG_VALUE_08BIT, (trigger_mode > 0) ? 1 : 0); ++ IMX477_REG_VALUE_08BIT, (tm > 0) ? 1 : 0); + imx477_write_reg(imx477, IMX477_REG_MS_SEL, +- IMX477_REG_VALUE_08BIT, (trigger_mode <= 1) ? 1 : 0); ++ IMX477_REG_VALUE_08BIT, (tm <= 1) ? 1 : 0); + imx477_write_reg(imx477, IMX477_REG_XVS_IO_CTRL, +- IMX477_REG_VALUE_08BIT, (trigger_mode == 1) ? 1 : 0); ++ IMX477_REG_VALUE_08BIT, (tm == 1) ? 1 : 0); + imx477_write_reg(imx477, IMX477_REG_EXTOUT_EN, +- IMX477_REG_VALUE_08BIT, (trigger_mode == 1) ? 1 : 0); ++ IMX477_REG_VALUE_08BIT, (tm == 1) ? 1 : 0); + + /* set stream on register */ + return imx477_write_reg(imx477, IMX477_REG_MODE_SELECT, +@@ -2187,6 +2191,7 @@ static int imx477_probe(struct i2c_clien + struct imx477 *imx477; + const struct of_device_id *match; + int ret; ++ u32 tm_of; + + imx477 = devm_kzalloc(&client->dev, sizeof(*imx477), GFP_KERNEL); + if (!imx477) +@@ -2204,6 +2209,10 @@ static int imx477_probe(struct i2c_clien + if (imx477_check_hwcfg(dev)) + return -EINVAL; + ++ /* Default the trigger mode from OF to -1, which means invalid */ ++ ret = of_property_read_u32(dev->of_node, "trigger-mode", &tm_of); ++ imx477->trigger_mode_of = (ret == 0) ? tm_of : -1; ++ + /* Get system clock (xclk) */ + imx477->xclk = devm_clk_get(dev, NULL); + if (IS_ERR(imx477->xclk)) { diff --git a/target/linux/bcm27xx/patches-6.1/950-1295-imx477-Update-device-tree-overlays-to-support-trigge.patch b/target/linux/bcm27xx/patches-6.1/950-1295-imx477-Update-device-tree-overlays-to-support-trigge.patch new file mode 100644 index 0000000000..d9df79412b --- /dev/null +++ b/target/linux/bcm27xx/patches-6.1/950-1295-imx477-Update-device-tree-overlays-to-support-trigge.patch @@ -0,0 +1,129 @@ +From d02bd251d7f85e3aec02e5752df2f44a35961360 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Erik=20Bot=C3=B6?= +Date: Fri, 9 Feb 2024 18:41:24 +0100 +Subject: [PATCH 1295/1295] imx477: Update device tree overlays to support + trigger-mode +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Also create generic overrides in camera-mux-N-port, that can be extended +to configure vsync modes for cameras supporting this. + +Example usages (to be combined with camera_auto_detect=0): +dtoverlay=imx477,cam0,sync-source +dtoverlay=imx477,sync-sink +dtoverlay=camera-mux-2port,cam1-imx477,cam1-sync-sink +dtoverlay=camera-mux-4port,cam3-imx477,cam3-sync-sink + +Signed-off-by: Erik Botö +--- + arch/arm/boot/dts/overlays/README | 16 ++++++++++++++++ + .../dts/overlays/camera-mux-2port-overlay.dts | 5 +++++ + .../dts/overlays/camera-mux-4port-overlay.dts | 9 +++++++++ + arch/arm/boot/dts/overlays/imx378-overlay.dts | 7 +++++++ + arch/arm/boot/dts/overlays/imx477-overlay.dts | 7 +++++++ + 5 files changed, 44 insertions(+) + +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -862,6 +862,10 @@ Params: cam0-arducam-64mp Select A + cam1-ov7251 Select OV7251 for camera on port 1 + cam1-ov9281 Select OV9281 for camera on port 1 + cam1-imx290-clk-freq Set clock frequency for an IMX290 on port 1 ++ cam0-sync-source Set camera on port 0 as vsync source ++ cam0-sync-sink Set camera on port 0 as vsync sink ++ cam1-sync-source Set camera on port 1 as vsync source ++ cam1-sync-sink Set camera on port 1 as vsync sink + + cam0 Connect the mux to CAM0 port (default is CAM1) + +@@ -923,6 +927,14 @@ Params: cam0-arducam-64mp Select A + cam3-ov7251 Select OV7251 for camera on port 3 + cam3-ov9281 Select OV9281 for camera on port 3 + cam3-imx290-clk-freq Set clock frequency for an IMX290 on port 3 ++ cam0-sync-source Set camera on port 0 as vsync source ++ cam0-sync-sink Set camera on port 0 as vsync sink ++ cam1-sync-source Set camera on port 1 as vsync source ++ cam1-sync-sink Set camera on port 1 as vsync sink ++ cam2-sync-source Set camera on port 2 as vsync source ++ cam2-sync-sink Set camera on port 2 as vsync sink ++ cam3-sync-source Set camera on port 3 as vsync source ++ cam3-sync-sink Set camera on port 3 as vsync sink + + cam0 Connect the mux to CAM0 port (default is CAM1) + +@@ -2676,6 +2688,8 @@ Params: rotation Mounting + Compute Module (CSI0, i2c_vc, and cam0_reg). + always-on Leave the regulator powered up, to stop the + camera clamping I/Os such as XVS to 0V. ++ sync-source Configure as vsync source ++ sync-sink Configure as vsync sink + + + Name: imx462 +@@ -2716,6 +2730,8 @@ Params: rotation Mounting + Compute Module (CSI0, i2c_vc, and cam0_reg). + always-on Leave the regulator powered up, to stop the + camera clamping I/Os such as XVS to 0V. ++ sync-source Configure as vsync source ++ sync-sink Configure as vsync sink + + + Name: imx519 +--- a/arch/arm/boot/dts/overlays/camera-mux-2port-overlay.dts ++++ b/arch/arm/boot/dts/overlays/camera-mux-2port-overlay.dts +@@ -536,5 +536,10 @@ + + cam0 = <&i2c_frag>, "target:0=",<&i2c_csi_dsi0>, + <&csi_frag>, "target:0=",<&csi0>; ++ ++ cam0-sync-source = <&imx477_0>, "trigger-mode:0=1"; ++ cam0-sync-sink = <&imx477_0>, "trigger-mode:0=2"; ++ cam1-sync-source = <&imx477_1>, "trigger-mode:0=1"; ++ cam1-sync-sink = <&imx477_1>, "trigger-mode:0=2"; + }; + }; +--- a/arch/arm/boot/dts/overlays/camera-mux-4port-overlay.dts ++++ b/arch/arm/boot/dts/overlays/camera-mux-4port-overlay.dts +@@ -939,5 +939,14 @@ + + cam0 = <&i2c_frag>, "target:0=",<&i2c_csi_dsi0>, + <&csi_frag>, "target:0=",<&csi0>; ++ ++ cam0-sync-source = <&imx477_0>, "trigger-mode:0=1"; ++ cam0-sync-sink = <&imx477_0>, "trigger-mode:0=2"; ++ cam1-sync-source = <&imx477_1>, "trigger-mode:0=1"; ++ cam1-sync-sink = <&imx477_1>, "trigger-mode:0=2"; ++ cam2-sync-source = <&imx477_2>, "trigger-mode:0=1"; ++ cam2-sync-sink = <&imx477_2>, "trigger-mode:0=2"; ++ cam3-sync-source = <&imx477_3>, "trigger-mode:0=1"; ++ cam3-sync-sink = <&imx477_3>, "trigger-mode:0=2"; + }; + }; +--- a/arch/arm/boot/dts/overlays/imx378-overlay.dts ++++ b/arch/arm/boot/dts/overlays/imx378-overlay.dts +@@ -8,3 +8,10 @@ + &cam_node { + compatible = "sony,imx378"; + }; ++ ++/{ ++ __overrides__ { ++ sync-sink = <&cam_node>,"trigger-mode:0=2"; ++ sync-source = <&cam_node>,"trigger-mode:0=1"; ++ }; ++}; +--- a/arch/arm/boot/dts/overlays/imx477-overlay.dts ++++ b/arch/arm/boot/dts/overlays/imx477-overlay.dts +@@ -8,3 +8,10 @@ + &cam_node { + compatible = "sony,imx477"; + }; ++ ++/{ ++ __overrides__ { ++ sync-sink = <&cam_node>,"trigger-mode:0=2"; ++ sync-source = <&cam_node>,"trigger-mode:0=1"; ++ }; ++};