diff --git a/device/testing/linux-postmarketos-marvell/0003-dts-marvell-mmp-dell-ariel-add-framebuffer.patch b/device/testing/linux-postmarketos-marvell/0003-dts-marvell-mmp-dell-ariel-add-framebuffer.patch index ca2317117..f95b40530 100644 --- a/device/testing/linux-postmarketos-marvell/0003-dts-marvell-mmp-dell-ariel-add-framebuffer.patch +++ b/device/testing/linux-postmarketos-marvell/0003-dts-marvell-mmp-dell-ariel-add-framebuffer.patch @@ -1,16 +1,16 @@ -From ded0c6d4a82eea2e616730500c7d889df76c4bc8 Mon Sep 17 00:00:00 2001 +From a60fae40dea9618d00f5c88485cd4a417075cfae Mon Sep 17 00:00:00 2001 From: Robert Eckelmann Date: Fri, 26 Dec 2025 15:41:14 +0900 Subject: [PATCH 3/3] dts/marvell/mmp-dell-ariel: add framebuffer Signed-off-by: Robert Eckelmann --- - arch/arm/boot/dts/marvell/mmp3-dell-ariel.dts | 135 +++++++++++++++--- - arch/arm/boot/dts/marvell/mmp3.dtsi | 18 +-- - 2 files changed, 122 insertions(+), 31 deletions(-) + arch/arm/boot/dts/marvell/mmp3-dell-ariel.dts | 198 ++++++++++++------ + arch/arm/boot/dts/marvell/mmp3.dtsi | 13 +- + 2 files changed, 139 insertions(+), 72 deletions(-) diff --git a/arch/arm/boot/dts/marvell/mmp3-dell-ariel.dts b/arch/arm/boot/dts/marvell/mmp3-dell-ariel.dts -index 28a67cc8976c..7fb59f90a399 100644 +index 28a67cc8976c..e2c3125eb39f 100644 --- a/arch/arm/boot/dts/marvell/mmp3-dell-ariel.dts +++ b/arch/arm/boot/dts/marvell/mmp3-dell-ariel.dts @@ -8,6 +8,7 @@ @@ -21,22 +21,21 @@ index 28a67cc8976c..7fb59f90a399 100644 #include / { -@@ -30,23 +31,37 @@ memory@0 { +@@ -30,23 +31,36 @@ memory@0 { reg = <0x0 0x80000000>; device_type = "memory"; }; + + framebuffer@78000000 { -+ compatible = "simple-framebuffer"; -+ //compatible = "marvell,mmp2-framebuffer", -+ // "marvell,armada-framebuffer"; ++ compatible = "marvell,mmp2-framebuffer", ++ "marvell,armada-framebuffer"; + + //size Full-HD in 32bpp times 2 (2 outputs) + reg = <0x78000000 (1920 * 1080 * 4 * 2 )>; + width = <1920>; + height = <1080>; + stride = <(1920 * 4)>; -+ format = "a8r8g8b8"; ++ format = "r8g8b8"; + clocks = <&soc_clocks MMP2_CLK_DISP0_LCDC>, + <&soc_clocks MMP2_CLK_DISP0>; + display = <&dvi1_in>; @@ -65,7 +64,7 @@ index 28a67cc8976c..7fb59f90a399 100644 ddc-i2c-bus = <&twsi5>; hpd-gpios = <&gpio 62 GPIO_ACTIVE_LOW>; digital; -@@ -61,6 +76,7 @@ dvi0_in: endpoint { +@@ -61,6 +75,7 @@ dvi0_in: endpoint { dvi-connector-1 { compatible = "dvi-connector"; @@ -73,7 +72,7 @@ index 28a67cc8976c..7fb59f90a399 100644 ddc-i2c-bus = <&twsi6>; hpd-gpios = <&gpio 59 GPIO_ACTIVE_LOW>; digital; -@@ -71,6 +87,17 @@ dvi1_in: endpoint { +@@ -71,22 +86,29 @@ dvi1_in: endpoint { }; }; }; @@ -88,13 +87,23 @@ index 28a67cc8976c..7fb59f90a399 100644 + miso-gpios = <&gpio 57 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&gpio 58 GPIO_ACTIVE_HIGH>; + }; ++}; - sound-card { - compatible = "audio-graph-card"; -@@ -90,6 +117,19 @@ sound-card { - }; - }; - +- sound-card { +- compatible = "audio-graph-card"; +- label = "Dell Ariel"; +- dais = <&sspa0_dai>; +- routing = "Headphones", "HPL", +- "Headphones", "HPR", +- "Speaker External", "SPKLN", +- "Speaker External", "SPKLP", +- "Speaker External", "SPKRN", +- "Speaker External", "SPKRP", +- "MIC1N", "Mic Jack", +- "MIC1P", "Mic Jack"; +- widgets = "Headphone", "Headphones", +- "Speaker", "Speaker External", +- "Microphone", "Mic Jack"; +&ec_input_spi { + status = "okay"; + cs-gpios = <&gpio 56 GPIO_ACTIVE_LOW>; @@ -105,13 +114,10 @@ index 28a67cc8976c..7fb59f90a399 100644 + interrupts = <60 IRQ_TYPE_EDGE_RISING>; + compatible = "dell,wyse-ariel-ec-input", "ene,kb3930-input"; + spi-max-frequency = <33000000>; -+ }; -+}; -+ - &uart3 { - status = "okay"; + }; }; -@@ -157,6 +197,14 @@ vcpu: buck1 { + +@@ -157,6 +179,14 @@ vcpu: buck1 { regulator-boot-on; regulator-always-on; }; @@ -126,17 +132,27 @@ index 28a67cc8976c..7fb59f90a399 100644 }; }; -@@ -211,6 +259,9 @@ embedded-controller@58 { - - off-gpios = <&gpio 126 GPIO_ACTIVE_HIGH>, - <&gpio 127 GPIO_ACTIVE_HIGH>; -+ -+ -+ +@@ -186,19 +216,6 @@ encoder_out: endpoint { + }; + }; }; +- +- audio-codec@30 { +- compatible = "marvell,88ce156"; +- reg = <0x30>; +- +- port { +- ce156_0: endpoint { +- mclk-fs = <256>; +- clocks = <&audio_clk 0>; +- remote-endpoint = <&sspa0_0>; +- }; +- }; +- }; }; -@@ -234,6 +285,10 @@ &hdmi0_out { + &twsi4 { +@@ -234,6 +251,10 @@ &hdmi0_out { remote-endpoint = <&dvi1_in>; }; @@ -147,7 +163,7 @@ index 28a67cc8976c..7fb59f90a399 100644 &ssp1 { status = "okay"; cs-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; -@@ -246,21 +301,6 @@ firmware-flash@0 { +@@ -246,21 +267,6 @@ firmware-flash@0 { }; }; @@ -169,72 +185,126 @@ index 28a67cc8976c..7fb59f90a399 100644 &asram { status = "okay"; }; -@@ -289,10 +329,59 @@ sspa0_0: endpoint { +@@ -269,30 +275,88 @@ &adma0 { + status = "okay"; }; - &gpu_2d { -- status = "okay"; -+ status = "disabled"; - }; - - &gpu_3d { -- status = "okay"; -+ status = "disabled"; +-&audio_clk { ++&gpu_2d { + status = "okay"; }; +-&sspa0 { ++&gpu_3d { + status = "okay"; +- dmas = <&adma0 0>, <&adma0 1>; +- dma-names = "tx", "rx"; +- +- sspa0_dai: port { +- sspa0_0: endpoint { +- remote-endpoint = <&ce156_0>; +- frame-master; +- bitclock-master; +- dai-format = "i2s"; ++}; ++ +&pinctrl { -+ lcd_pins: lcd-pins { ++ twsi3_pins: twsi3-pins { ++ pins = <&gpio 71>, <&gpio 72>; ++ function = "twsi3"; ++ slew-rate = <1>; ++ }; ++ ++ twsi4_pins: twsi4-pins { ++ pins = "twsi4_scl", "twsi4_sda"; ++ function = "twsi4"; ++ slew-rate = <1>; ++ }; ++ ++ twsi5_pins: twsi5-pins { ++ pins = <&gpio 41>, <&gpio 42>; ++ function = "twsi5"; ++ slew-rate = <1>; ++ }; ++ ++ twsi6_pins: twsi6-pins { ++ pins = <&gpio 47>, <&gpio 48>; ++ function = "twsi6"; ++ slew-rate = <1>; ++ }; ++ ++ lcd0_pins: lcd0-pins { + lcd-fclk-pins { -+ pins = "gpio_74"; ++ pins = <&gpio 74>; + function = "lcd"; + slew-rate = <1>; -+ marvell,sleep-output = <0>; -+ // WKE_0; + }; + + lcd-lclk-pins { -+ pins = "gpio_75"; ++ pins = <&gpio 75>; + function = "lcd"; + slew-rate = <1>; -+ marvell,sleep-output = <0>; -+ // WKE_0; + }; + + lcd-pclk-pins { -+ pins = "gpio_76"; ++ pins = <&gpio 76>; + function = "lcd"; + bias-pull-up; + slew-rate = <3>; -+ marvell,sleep-output = <0>; -+ // WKE_0; + }; + + lcd-dena-pins { -+ pins = "gpio_77"; ++ pins = <&gpio 77>; + function = "lcd"; + slew-rate = <1>; -+ marvell,sleep-output = <0>; -+ // WKE_0; + }; + + lcd-data-pins { -+ pins = "gpio_100", "gpio_101", "gpio_78", "gpio_79", -+ "gpio_80", "gpio_81", "gpio_82", "gpio_83", -+ "gpio_84", "gpio_85", "gpio_86", "gpio_87", -+ "gpio_88", "gpio_89", "gpio_90", "gpio_91", -+ "gpio_92", "gpio_93", "gpio_94", "gpio_95", -+ "gpio_96", "gpio_97", "gpio_98", "gpio_99"; ++ pins = <&gpio 100>, <&gpio 101>, <&gpio 78>, <&gpio 79>, ++ <&gpio 80>, <&gpio 81>, <&gpio 82>, <&gpio 83>, ++ <&gpio 84>, <&gpio 85>, <&gpio 86>, <&gpio 87>, ++ <&gpio 88>, <&gpio 89>, <&gpio 90>, <&gpio 91>, ++ <&gpio 92>, <&gpio 93>, <&gpio 94>, <&gpio 95>, ++ <&gpio 96>, <&gpio 97>, <&gpio 98>, <&gpio 99>; + function = "lcd"; -+ marvell,sleep-output = <0>; + slew-rate = <1>; -+ // WKE_0; -+ }; + }; + }; +-}; + +-&gpu_2d { +- status = "okay"; +-}; ++ ssp1_pins: ssp1-pins { ++ pins = <&gpio 45>, <&gpio 44>, <&gpio 43>; ++ function = "ssp1"; ++ slew-rate = <2>; ++ bias-pull-up; + }; -+}; + +-&gpu_3d { +- status = "okay"; ++ ssp2_pins: ssp2-pins { ++ pins = <&gpio 58>, <&gpio 57>, <&gpio 55>; ++ function = "ssp2"; ++ slew-rate = <2>; ++ bias-pull-up; ++ }; + }; +- diff --git a/arch/arm/boot/dts/marvell/mmp3.dtsi b/arch/arm/boot/dts/marvell/mmp3.dtsi -index 03f987888c01..45d11c45293b 100644 +index 03f987888c01..ff7c8c3008a1 100644 --- a/arch/arm/boot/dts/marvell/mmp3.dtsi +++ b/arch/arm/boot/dts/marvell/mmp3.dtsi +@@ -47,7 +47,7 @@ axi@d4200000 { + ranges; + + lcd0: lcdc@d420b000 { +- compatible = "marvell,mmp3-lcd", "marvell,armada-lcdc"; ++ compatible = "marvell,mmp3-lcd", "marvell,armada-lcd"; + reg = <0xd420b000 0x1000>; + interrupts = ; + clocks = <&soc_clocks MMP2_CLK_DISP0_LCDC>, @@ -55,8 +55,6 @@ lcd0: lcdc@d420b000 { <&soc_clocks MMP2_CLK_DISP0>, <&soc_clocks MMP2_CLK_DISP1>, @@ -244,43 +314,35 @@ index 03f987888c01..45d11c45293b 100644 status = "disabled"; ports { -@@ -360,26 +358,30 @@ camera1: camera@d420a800 { - - gpu_3d: gpu@d420d000 { - compatible = "vivante,gc"; -- reg = <0xd420d000 0x2000>; -+ reg = <0xd420d000 0x1000>; - interrupt-parent = <&gpu_mux>; +@@ -365,9 +363,11 @@ gpu_3d: gpu@d420d000 { interrupts = <0>; status = "disabled"; clocks = <&soc_clocks MMP3_CLK_GPU_3D>, + <&soc_clocks MMP3_CLK_GPU_BUS>, <&soc_clocks MMP3_CLK_GPU_BUS>; - clock-names = "core", "bus"; -- power-domains = <&soc_clocks MMP2_POWER_DOMAIN_GPU>; + clock-names = "core", "bus","shader"; -+ //power-domains = <&soc_clocks MMP2_POWER_DOMAIN_GPU>; -+ power-domains = <&soc_clocks 0>; + power-domains = <&soc_clocks MMP2_POWER_DOMAIN_GPU>; + power-domain-names = "gpu"; }; gpu_2d: gpu@d420f000 { - compatible = "vivante,gc"; -- reg = <0xd420f000 0x2000>; -+ reg = <0xd420f000 0x1000>; - interrupt-parent = <&gpu_mux>; - interrupts = <2>; - status = "disabled"; - clocks = <&soc_clocks MMP3_CLK_GPU_2D>, +@@ -380,11 +380,14 @@ gpu_2d: gpu@d420f000 { <&soc_clocks MMP3_CLK_GPU_BUS>; clock-names = "core", "bus"; -- power-domains = <&soc_clocks MMP2_POWER_DOMAIN_GPU>; -+ power-domains = <&soc_clocks 0>; + power-domains = <&soc_clocks MMP2_POWER_DOMAIN_GPU>; + power-domain-names = "gpu"; }; rng@d4292c00 { -@@ -455,7 +457,7 @@ apb@d4000000 { + compatible = "marvell,mmp2-rng"; + reg = <0xd4292c00 8>; ++ // as we are missing the driver in mainline: ++ status="disabled"; + }; + + adma0: dma-controller@c0ffd800 { +@@ -455,7 +458,7 @@ apb@d4000000 { reg = <0xd4000000 0x00200000>; ranges; diff --git a/device/testing/linux-postmarketos-marvell/0010.patch b/device/testing/linux-postmarketos-marvell/0010.patch new file mode 100644 index 000000000..4ff579078 --- /dev/null +++ b/device/testing/linux-postmarketos-marvell/0010.patch @@ -0,0 +1,95 @@ +From 429d5b385d9554f73b176b9861c9c3bc7bdc2573 Mon Sep 17 00:00:00 2001 +From: Russell King +Date: Sun, 24 Jun 2018 14:03:31 +0100 +Subject: [PATCH] drm/armada: add reserved memory support + +Existing Armada DRM makes use of reserved memory for allocating +contiguous screen buffers, which currently prevents its use with +DT systems. Add support for this for DT systems. + +Signed-off-by: Russell King +--- + drivers/gpu/drm/armada/armada_drv.c | 52 +++++++++++++++++++++++++---- + 1 file changed, 46 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c +index cae25ad66c749d..a2ceaf9f4e7bfe 100644 +--- a/drivers/gpu/drm/armada/armada_drv.c ++++ b/drivers/gpu/drm/armada/armada_drv.c +@@ -9,6 +9,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -57,11 +58,40 @@ static const struct drm_mode_config_funcs armada_drm_mode_config_funcs = { + .atomic_commit = drm_atomic_helper_commit, + }; + +-static int armada_drm_bind(struct device *dev) ++static struct reserved_mem *armada_drm_get_rmem(struct device *dev, ++ const char *compatible) ++{ ++ struct device_node *np; ++ struct reserved_mem *rmem; ++ ++ np = of_find_compatible_node(NULL, NULL, compatible); ++ if (!np) ++ return NULL; ++ ++ rmem = of_reserved_mem_lookup(np); ++ of_node_put(np); ++ ++ return rmem; ++} ++ ++static struct resource *armada_drm_get_mem(struct device *dev) + { +- struct armada_private *priv; + struct resource *mem = NULL; +- int ret, n; ++ struct reserved_mem *rmem; ++ int n; ++ ++ rmem = armada_drm_get_rmem(dev, "marvell,armada-framebuffer"); ++ if (rmem) { ++ mem = devm_kzalloc(dev, sizeof(*mem), GFP_KERNEL); ++ if (!mem) ++ return ERR_PTR(-ENOMEM); ++ ++ mem->start = rmem->base; ++ mem->end = rmem->base + rmem->size - 1; ++ mem->flags = IORESOURCE_MEM; ++ ++ return mem; ++ } + + for (n = 0; ; n++) { + struct resource *r = platform_get_resource(to_platform_device(dev), +@@ -73,11 +103,21 @@ static int armada_drm_bind(struct device *dev) + if (resource_size(r) > SZ_64K) + mem = r; + else +- return -EINVAL; ++ return ERR_PTR(-EINVAL); + } + +- if (!mem) +- return -ENXIO; ++ return mem ? : ERR_PTR(-ENXIO); ++} ++ ++static int armada_drm_bind(struct device *dev) ++{ ++ struct armada_private *priv; ++ struct resource *mem; ++ int ret; ++ ++ mem = armada_drm_get_mem(dev); ++ if (IS_ERR(mem)) ++ return PTR_ERR(mem); + + if (!devm_request_mem_region(dev, mem->start, resource_size(mem), + "armada-drm")) diff --git a/device/testing/linux-postmarketos-marvell/0011.patch b/device/testing/linux-postmarketos-marvell/0011.patch new file mode 100644 index 000000000..7831ed395 --- /dev/null +++ b/device/testing/linux-postmarketos-marvell/0011.patch @@ -0,0 +1,108 @@ +From 4c71a98b6316cd973215558dddb99d7adc360676 Mon Sep 17 00:00:00 2001 +From: Russell King +Date: Sun, 24 Jun 2018 14:03:31 +0100 +Subject: [PATCH] drm/armada: add detection of DT LCD controllers for probing + +Using a virtual device is deprecated, so we have no option but to +detect the presence of available LCD controllers in DT and probe +all LCD controllers together within one DRM device. + +Signed-off-by: Russell King +--- + drivers/gpu/drm/armada/armada_drv.c | 52 +++++++++++++++++++++++++---- + 1 file changed, 45 insertions(+), 7 deletions(-) + +diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c +index a2ceaf9f4e7bfe..f3f52fbeae9025 100644 +--- a/drivers/gpu/drm/armada/armada_drv.c ++++ b/drivers/gpu/drm/armada/armada_drv.c +@@ -234,11 +234,6 @@ static int armada_drm_probe(struct platform_device *pdev) + { + struct component_match *match = NULL; + struct device *dev = &pdev->dev; +- int ret; +- +- ret = drm_of_component_probe(dev, component_compare_dev_name, &armada_master_ops); +- if (ret != -EINVAL) +- return ret; + + if (dev->platform_data) { + char **devices = dev->platform_data; +@@ -261,6 +256,22 @@ static int armada_drm_probe(struct platform_device *pdev) + armada_add_endpoints(dev, &match, d->of_node); + put_device(d); + } ++ } else { ++ struct device_node *np; ++ ++ for_each_compatible_node(np, NULL, "marvell,armada-lcdc") { ++ if (!of_device_is_available(np)) ++ continue; ++ ++ drm_of_component_match_add(dev, &match, component_compare_of, np); ++ } ++ ++ for_each_compatible_node(np, NULL, "marvell,armada-lcdc") { ++ if (!of_device_is_available(np)) ++ continue; ++ ++ armada_add_endpoints(dev, &match, np); ++ } + } + + return component_master_add_with_match(&pdev->dev, &armada_master_ops, +@@ -297,8 +308,11 @@ static struct platform_driver armada_drm_platform_driver = { + .id_table = armada_drm_platform_ids, + }; + ++static struct platform_device *armada_device; ++ + static int __init armada_drm_init(void) + { ++ struct device_node *np; + int ret; + + if (drm_firmware_drivers_only()) +@@ -306,16 +320,40 @@ static int __init armada_drm_init(void) + + ret = platform_driver_register(&armada_lcd_platform_driver); + if (ret) +- return ret; ++ goto err_lcd; ++ + ret = platform_driver_register(&armada_drm_platform_driver); + if (ret) +- platform_driver_unregister(&armada_lcd_platform_driver); ++ goto err_drm; ++ ++ for_each_compatible_node(np, NULL, "marvell,armada-lcdc") { ++ if (!of_device_is_available(np)) ++ continue; ++ ++ of_node_put(np); ++ armada_device = platform_device_register_simple( ++ "armada-drm", -1, NULL, 0); ++ if (IS_ERR(armada_device)) { ++ ret = PTR_ERR(armada_device); ++ goto err_dev; ++ } ++ break; ++ } ++ return 0; ++ ++ err_dev: ++ platform_driver_unregister(&armada_drm_platform_driver); ++ err_drm: ++ platform_driver_unregister(&armada_lcd_platform_driver); ++ err_lcd: + return ret; + } + module_init(armada_drm_init); + + static void __exit armada_drm_exit(void) + { ++ if (armada_device) ++ platform_device_unregister(armada_device); + platform_driver_unregister(&armada_drm_platform_driver); + platform_driver_unregister(&armada_lcd_platform_driver); + } diff --git a/device/testing/linux-postmarketos-marvell/0012.patch b/device/testing/linux-postmarketos-marvell/0012.patch new file mode 100644 index 000000000..990c83b2c --- /dev/null +++ b/device/testing/linux-postmarketos-marvell/0012.patch @@ -0,0 +1,154 @@ +From c9f0b0b0a076923a136aea4b948aee8737c35189 Mon Sep 17 00:00:00 2001 +From: Doug Brown +Date: Tue, 30 Aug 2022 21:34:34 -0700 +Subject: [PATCH] drm/armada: fix DT support to work with panels + +Add the necessary setup to create a simple encoder and connect it to a +bridge (which may be automatically created to hook up to a panel). + +This also required removing the "armada_add_endpoints" call, because it +would never find the panel so binding would never occur. + +Signed-off-by: Doug Brown +--- + drivers/gpu/drm/armada/armada_crtc.c | 36 ++++++++++++++++++++++++---- + drivers/gpu/drm/armada/armada_crtc.h | 2 ++ + drivers/gpu/drm/armada/armada_drv.c | 7 ------ + 3 files changed, 34 insertions(+), 11 deletions(-) + +diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c +index 46372e2fc47c76..daff098127c56f 100644 +--- a/drivers/gpu/drm/armada/armada_crtc.c ++++ b/drivers/gpu/drm/armada/armada_crtc.c +@@ -15,6 +15,8 @@ + #include + #include + #include ++#include ++#include + + #include "armada_crtc.h" + #include "armada_drm.h" +@@ -913,6 +915,7 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev, + struct armada_private *priv = drm_to_armada_dev(drm); + struct armada_crtc *dcrtc; + struct drm_plane *primary; ++ struct drm_bridge *bridge; + void __iomem *base; + int ret; + +@@ -929,6 +932,28 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev, + if (dev != drm->dev) + dev_set_drvdata(dev, dcrtc); + ++ /* Create a simple encoder for this CRTC to use */ ++ ret = drm_simple_encoder_init(drm, &dcrtc->encoder, DRM_MODE_ENCODER_NONE); ++ if (ret < 0) { ++ DRM_ERROR("failed to create Armada encoder\n"); ++ goto err_crtc; ++ } ++ dcrtc->encoder.possible_crtcs = 0x1; ++ ++ /* Find a bridge to connect */ ++ bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0); ++ if (IS_ERR(bridge) && (PTR_ERR(bridge) != -ENODEV)) { ++ ret = PTR_ERR(bridge); ++ goto err_encoder; ++ } ++ ++ /* Attach the bridge to the encoder */ ++ ret = drm_bridge_attach(&dcrtc->encoder, bridge, NULL, 0); ++ if (ret < 0) { ++ DRM_ERROR("failed to attach Armada bridge\n"); ++ goto err_encoder; ++ } ++ + dcrtc->variant = variant; + dcrtc->base = base; + dcrtc->num = drm->mode_config.num_crtc; +@@ -954,12 +979,12 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev, + ret = devm_request_irq(dev, irq, armada_drm_irq, 0, "armada_drm_crtc", + dcrtc); + if (ret < 0) +- goto err_crtc; ++ goto err_encoder; + + if (dcrtc->variant->init) { + ret = dcrtc->variant->init(dcrtc, dev); + if (ret) +- goto err_crtc; ++ goto err_encoder; + } + + /* Ensure AXI pipeline is enabled */ +@@ -972,13 +997,13 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev, + primary = kzalloc(sizeof(*primary), GFP_KERNEL); + if (!primary) { + ret = -ENOMEM; +- goto err_crtc; ++ goto err_encoder; + } + + ret = armada_drm_primary_plane_init(drm, primary); + if (ret) { + kfree(primary); +- goto err_crtc; ++ goto err_encoder; + } + + ret = drm_crtc_init_with_planes(drm, &dcrtc->crtc, primary, NULL, +@@ -998,6 +1023,8 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev, + + err_crtc_init: + primary->funcs->destroy(primary); ++err_encoder: ++ drm_encoder_cleanup(&dcrtc->encoder); + err_crtc: + kfree(dcrtc); + +@@ -1043,6 +1070,7 @@ armada_lcd_unbind(struct device *dev, struct device *master, void *data) + { + struct armada_crtc *dcrtc = dev_get_drvdata(dev); + ++ drm_encoder_cleanup(&dcrtc->encoder); + armada_drm_crtc_destroy(&dcrtc->crtc); + } + +diff --git a/drivers/gpu/drm/armada/armada_crtc.h b/drivers/gpu/drm/armada/armada_crtc.h +index b21267d1745f14..80f3e94e253482 100644 +--- a/drivers/gpu/drm/armada/armada_crtc.h ++++ b/drivers/gpu/drm/armada/armada_crtc.h +@@ -6,6 +6,7 @@ + #define ARMADA_CRTC_H + + #include ++#include + + struct armada_gem_object; + +@@ -35,6 +36,7 @@ struct armada_variant; + + struct armada_crtc { + struct drm_crtc crtc; ++ struct drm_encoder encoder; + const struct armada_variant *variant; + void *variant_data; + unsigned num; +diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c +index f3f52fbeae9025..532de779b8d200 100644 +--- a/drivers/gpu/drm/armada/armada_drv.c ++++ b/drivers/gpu/drm/armada/armada_drv.c +@@ -265,13 +265,6 @@ static int armada_drm_probe(struct platform_device *pdev) + + drm_of_component_match_add(dev, &match, component_compare_of, np); + } +- +- for_each_compatible_node(np, NULL, "marvell,armada-lcdc") { +- if (!of_device_is_available(np)) +- continue; +- +- armada_add_endpoints(dev, &match, np); +- } + } + + return component_master_add_with_match(&pdev->dev, &armada_master_ops, diff --git a/device/testing/linux-postmarketos-marvell/0013.patch b/device/testing/linux-postmarketos-marvell/0013.patch new file mode 100644 index 000000000..8ba570bad --- /dev/null +++ b/device/testing/linux-postmarketos-marvell/0013.patch @@ -0,0 +1,82 @@ +From 9ecac522c382f34010b283b1617b922725c263c9 Mon Sep 17 00:00:00 2001 +From: Doug Brown +Date: Thu, 1 Sep 2022 22:44:10 -0700 +Subject: [PATCH] drm/armada: make output format and pin allocation + configurable + +The output format and pin allocation were previously hardcoded for +RGB888. This allows you to configure it in device tree. + +Signed-off-by: Doug Brown +--- + drivers/gpu/drm/armada/armada_crtc.c | 50 +++++++++++++++++++++++++++- + 1 file changed, 49 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c +index daff098127c56f..f03f91a9384b79 100644 +--- a/drivers/gpu/drm/armada/armada_crtc.c ++++ b/drivers/gpu/drm/armada/armada_crtc.c +@@ -918,6 +918,7 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev, + struct drm_bridge *bridge; + void __iomem *base; + int ret; ++ const char *str; + + base = devm_ioremap_resource(dev, res); + if (IS_ERR(base)) +@@ -958,7 +959,54 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev, + dcrtc->base = base; + dcrtc->num = drm->mode_config.num_crtc; + dcrtc->cfg_dumb_ctrl = DUMB24_RGB888_0; +- dcrtc->spu_iopad_ctrl = CFG_VSCALE_LN_EN | CFG_IOPAD_DUMB24; ++ dcrtc->spu_iopad_ctrl = CFG_IOPAD_DUMB24; ++ if (dev->of_node && !of_property_read_string(dev->of_node, "output-format", &str)) { ++ if (!strcmp(str, "rgb565_15:0")) ++ dcrtc->cfg_dumb_ctrl = DUMB16_RGB565_0; ++ else if (!strcmp(str, "rgb565_23:8")) ++ dcrtc->cfg_dumb_ctrl = DUMB16_RGB565_1; ++ else if (!strcmp(str, "rgb666_17:0")) ++ dcrtc->cfg_dumb_ctrl = DUMB18_RGB666_0; ++ else if (!strcmp(str, "rgb666_23:6")) ++ dcrtc->cfg_dumb_ctrl = DUMB18_RGB666_1; ++ else if (!strcmp(str, "rgb444_11:0")) ++ dcrtc->cfg_dumb_ctrl = DUMB12_RGB444_0; ++ else if (!strcmp(str, "rgb444_23:12")) ++ dcrtc->cfg_dumb_ctrl = DUMB12_RGB444_1; ++ else if (!strcmp(str, "rgb888")) ++ dcrtc->cfg_dumb_ctrl = DUMB24_RGB888_0; ++ else { ++ DRM_ERROR("invalid output-format specified\n"); ++ ret = -EINVAL; ++ goto err_crtc; ++ } ++ } ++ if (dev->of_node && !of_property_read_string(dev->of_node, "io-pin-allocation", &str)) { ++ if (!strcmp(str, "dumb_24")) ++ dcrtc->spu_iopad_ctrl = CFG_IOPAD_DUMB24; ++ else if (!strcmp(str, "dumb_18_spi")) ++ dcrtc->spu_iopad_ctrl = CFG_IOPAD_DUMB18SPI; ++ else if (!strcmp(str, "dumb_18_gpio")) ++ dcrtc->spu_iopad_ctrl = CFG_IOPAD_DUMB18GPIO; ++ else if (!strcmp(str, "dumb_16_spi")) ++ dcrtc->spu_iopad_ctrl = CFG_IOPAD_DUMB16SPI; ++ else if (!strcmp(str, "dumb_16_gpio")) ++ dcrtc->spu_iopad_ctrl = CFG_IOPAD_DUMB16GPIO; ++ else if (!strcmp(str, "dumb_12")) ++ dcrtc->spu_iopad_ctrl = CFG_IOPAD_DUMB12GPIO; ++ else if (!strcmp(str, "smart_18_spi")) ++ dcrtc->spu_iopad_ctrl = CFG_IOPAD_SMART18; ++ else if (!strcmp(str, "smart_16_spi")) ++ dcrtc->spu_iopad_ctrl = CFG_IOPAD_SMART16; ++ else if (!strcmp(str, "smart_8")) ++ dcrtc->spu_iopad_ctrl = CFG_IOPAD_SMART8; ++ else { ++ DRM_ERROR("invalid io-pin-allocation specified\n"); ++ ret = -EINVAL; ++ goto err_crtc; ++ } ++ } ++ dcrtc->spu_iopad_ctrl |= CFG_VSCALE_LN_EN; + spin_lock_init(&dcrtc->irq_lock); + dcrtc->irq_ena = CLEAN_SPU_IRQ_ISR; + diff --git a/device/testing/linux-postmarketos-marvell/0014.patch b/device/testing/linux-postmarketos-marvell/0014.patch new file mode 100644 index 000000000..6bb468d61 --- /dev/null +++ b/device/testing/linux-postmarketos-marvell/0014.patch @@ -0,0 +1,54 @@ +From 07ad0166548a48002185f74f599a9eae903c6ccd Mon Sep 17 00:00:00 2001 +From: Doug Brown +Date: Sun, 11 Sep 2022 15:01:47 -0700 +Subject: [PATCH] drm/armada: add optional ability to preserve existing + framebuffer + +This allows the framebuffer to continue displaying a default image that +was set up by the bootloader until something else decides to change the +display. + +Signed-off-by: Doug Brown +--- + drivers/gpu/drm/armada/armada_crtc.c | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c +index f03f91a9384b79..45e20107fc1389 100644 +--- a/drivers/gpu/drm/armada/armada_crtc.c ++++ b/drivers/gpu/drm/armada/armada_crtc.c +@@ -919,6 +919,8 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev, + void __iomem *base; + int ret; + const char *str; ++ bool preserve_startup_fb = false; ++ u32 tmp; + + base = devm_ioremap_resource(dev, res); + if (IS_ERR(base)) +@@ -1010,15 +1012,21 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev, + spin_lock_init(&dcrtc->irq_lock); + dcrtc->irq_ena = CLEAN_SPU_IRQ_ISR; + ++ if (dev->of_node && of_get_property(dev->of_node, "preserve-startup-fb", NULL)) ++ preserve_startup_fb = true; ++ + /* Initialize some registers which we don't otherwise set */ +- writel_relaxed(0x00000001, dcrtc->base + LCD_CFG_SCLK_DIV); ++ if (!preserve_startup_fb) ++ writel_relaxed(0x00000001, dcrtc->base + LCD_CFG_SCLK_DIV); + writel_relaxed(0x00000000, dcrtc->base + LCD_SPU_BLANKCOLOR); + writel_relaxed(dcrtc->spu_iopad_ctrl, + dcrtc->base + LCD_SPU_IOPAD_CONTROL); + writel_relaxed(0x00000000, dcrtc->base + LCD_SPU_SRAM_PARA0); +- writel_relaxed(CFG_PDWN256x32 | CFG_PDWN256x24 | CFG_PDWN256x8 | +- CFG_PDWN32x32 | CFG_PDWN16x66 | CFG_PDWN32x66 | +- CFG_PDWN64x66, dcrtc->base + LCD_SPU_SRAM_PARA1); ++ tmp = CFG_PDWN256x32 | CFG_PDWN256x24 | CFG_PDWN256x8 | ++ CFG_PDWN32x32 | CFG_PDWN16x66 | CFG_PDWN32x66; ++ if (!preserve_startup_fb) ++ tmp |= CFG_PDWN64x66; ++ writel_relaxed(tmp, dcrtc->base + LCD_SPU_SRAM_PARA1); + writel_relaxed(0x2032ff81, dcrtc->base + LCD_SPU_DMA_CTRL1); + writel_relaxed(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA); + readl_relaxed(dcrtc->base + LCD_SPU_IRQ_ISR); diff --git a/device/testing/linux-postmarketos-marvell/APKBUILD b/device/testing/linux-postmarketos-marvell/APKBUILD index 84a6108ef..c28dd920d 100644 --- a/device/testing/linux-postmarketos-marvell/APKBUILD +++ b/device/testing/linux-postmarketos-marvell/APKBUILD @@ -33,6 +33,11 @@ source=" 0001-dts-marvell-mmp3-merge-parts-from-linux-mmp.patch 0002-dts-marvell-mmp3-dell-ariel-merge-parts-from-linux-m.patch 0003-dts-marvell-mmp-dell-ariel-add-framebuffer.patch + 0010.patch + 0011.patch + 0012.patch + 0013.patch + 0014.patch wd-glacier.patch $pkgname-$pkgver.tar.xz::https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/linux-$pkgver.tar.xz $_config @@ -71,7 +76,12 @@ package() { sha512sums=" 3ebc58600a07e07fba681c497b36a7f21de9f9034dab70988ad54e606affa33c49ba3580f92b8343e42b6cfad3b23531ac133d97c2c998878d96bd21d738475d 0001-dts-marvell-mmp3-merge-parts-from-linux-mmp.patch ac8471bae424aa0e5835f8c6ed04834918ca665941910fe132353bc35735f1e848e3c34b11e3cd50a49487ba8b5e7cd2a22efb678f19aa85a584efa01d8b49b1 0002-dts-marvell-mmp3-dell-ariel-merge-parts-from-linux-m.patch -109612e83948e49e02be4f3275504eb584f9146eba97f327995c8dc0d2a41f049f3976821206bc12087ff0059880a61c646e5cecdfbaf8441a0212f2e50ae93e 0003-dts-marvell-mmp-dell-ariel-add-framebuffer.patch +107416ff25b85f1ae28cb44bbe859f854f075927437c0e6b1f6fe687baff68410ed7deac7b1d44bfca4f4868964105941800ee3887da8d12efd9d893c43d755d 0003-dts-marvell-mmp-dell-ariel-add-framebuffer.patch +f025cf1e61516a133f52087a851ace4e074933dc36c6e02269503739c6c0ac6651477c27911135f8fabbe466c118746535285710259ece023236d46e12731249 0010.patch +7a7c4d2c7203fc1304f9736ced52f8c4fced6c987d025be67794cb944c20f63f2cddd72b706ef71523bc65a0b55cd4eddba8f44ebe4ef5d9c78219fefca4f456 0011.patch +2499c089eb16d49081fe28a40e1054fee9bc817450fdf80fb6b224007de622b9f419671733aa418532ea9a75b401177ed380dc4b082db6f64f01a53eeeee09aa 0012.patch +bece6f2dc2ca6c775224084d9a3bf282141751cdd1dcddea98427f2aab8f8b0be89b9e5c8577c33b668756e95f4721b083c310f0c393f6cf0b6609ff2e286c5e 0013.patch +25eca1ce39c8986323f127d09e4028861a11e3272c900d0f41ca620782191aadba731c9d7b3ea45389f99631ab160be13a1e71954401636ec19c7d6a12a41cd6 0014.patch 4c26ffca58dbdb75f24670d0aee5115cc3dc96b09ba2bcbcdd435d3e1e49cc0672cb0c0934a357047f59f47e1d24846f46cdd0cdcd19c87e14ff1c045ddd21af wd-glacier.patch 735c41f23846613cb52a4bc31820ee66251852d6a55c3a7aa29bd9a8e78634ea3042bff7090ef00652b35fa20523cb844c08f60486e6a0ee2cdef0e6b607e5fa linux-postmarketos-marvell-6.18.5.tar.xz e8bfda126c95c44469c857e103564926950734d3717b5cd022fca742224187e27fe24e1ccb1421f5c281a51609b1ba0d2e38dee43db4b2ac118a2d358a2dd5cb config-postmarketos-marvell.armv7