-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sunxi-6.12: re-export all patches and disable TV Output patch
- Loading branch information
Showing
53 changed files
with
2,236 additions
and
5,362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
...archive/sunxi-6.12/patches.drm/clk-sunxi-ng-ccu-add-Display-Engine-3.3-DE33-support.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
From b41f5a9ec8841c0342f101585c64c292019543d2 Mon Sep 17 00:00:00 2001 | ||
From: Ryan Walklin <ryan@testtoast.com> | ||
Date: Sun, 29 Sep 2024 22:04:54 +1300 | ||
Subject: clk: sunxi-ng: ccu: add Display Engine 3.3 (DE33) support | ||
|
||
The DE33 is a newer version of the Allwinner Display Engine IP block, | ||
found in the H616, H618, H700 and T507 SoCs. DE2 and DE3 are already | ||
supported by the mainline driver. | ||
|
||
The DE33 in the H616 has mixer0 and writeback units. The clocks | ||
and resets required are identical to the H3 and H5 respectively, so use | ||
those existing structs for the H616 description. | ||
|
||
There are two additional 32-bit registers (at offsets 0x24 and 0x28) | ||
which require clearing and setting respectively to bring up the | ||
hardware. The function of these registers is currently unknown, and the | ||
values are taken from the out-of-tree driver. | ||
|
||
Add the required clock description struct and compatible string to the | ||
DE2 driver. | ||
|
||
Signed-off-by: Ryan Walklin <ryan@testtoast.com> | ||
--- | ||
drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 25 +++++++++++++++++++++++++ | ||
1 file changed, 25 insertions(+) | ||
|
||
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c | ||
index 7683ea08d8e3..83eab6f132aa 100644 | ||
--- a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c | ||
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c | ||
@@ -5,6 +5,7 @@ | ||
|
||
#include <linux/clk.h> | ||
#include <linux/clk-provider.h> | ||
+#include <linux/io.h> | ||
#include <linux/module.h> | ||
#include <linux/of.h> | ||
#include <linux/platform_device.h> | ||
@@ -239,6 +240,16 @@ static const struct sunxi_ccu_desc sun50i_h5_de2_clk_desc = { | ||
.num_resets = ARRAY_SIZE(sun50i_h5_de2_resets), | ||
}; | ||
|
||
+static const struct sunxi_ccu_desc sun50i_h616_de33_clk_desc = { | ||
+ .ccu_clks = sun8i_de2_ccu_clks, | ||
+ .num_ccu_clks = ARRAY_SIZE(sun8i_de2_ccu_clks), | ||
+ | ||
+ .hw_clks = &sun8i_h3_de2_hw_clks, | ||
+ | ||
+ .resets = sun50i_h5_de2_resets, | ||
+ .num_resets = ARRAY_SIZE(sun50i_h5_de2_resets), | ||
+}; | ||
+ | ||
static int sunxi_de2_clk_probe(struct platform_device *pdev) | ||
{ | ||
struct clk *bus_clk, *mod_clk; | ||
@@ -291,6 +302,16 @@ static int sunxi_de2_clk_probe(struct platform_device *pdev) | ||
goto err_disable_mod_clk; | ||
} | ||
|
||
+ /* | ||
+ * The DE33 requires these additional (unknown) registers set | ||
+ * during initialisation. | ||
+ */ | ||
+ if (of_device_is_compatible(pdev->dev.of_node, | ||
+ "allwinner,sun50i-h616-de33-clk")) { | ||
+ writel(0, reg + 0x24); | ||
+ writel(0x0000a980, reg + 0x28); | ||
+ } | ||
+ | ||
ret = devm_sunxi_ccu_probe(&pdev->dev, reg, ccu_desc); | ||
if (ret) | ||
goto err_assert_reset; | ||
@@ -335,6 +356,10 @@ static const struct of_device_id sunxi_de2_clk_ids[] = { | ||
.compatible = "allwinner,sun50i-h6-de3-clk", | ||
.data = &sun50i_h5_de2_clk_desc, | ||
}, | ||
+ { | ||
+ .compatible = "allwinner,sun50i-h616-de33-clk", | ||
+ .data = &sun50i_h616_de33_clk_desc, | ||
+ }, | ||
{ } | ||
}; | ||
MODULE_DEVICE_TABLE(of, sunxi_de2_clk_ids); | ||
-- | ||
2.35.3 | ||
|
75 changes: 75 additions & 0 deletions
75
...kernel/archive/sunxi-6.12/patches.drm/drm-sun4i-de2-Initialize-layer-fields-earlier.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
From 5c2859b3cccd1b1b3f1700fd70c06770f418247a Mon Sep 17 00:00:00 2001 | ||
From: Jernej Skrabec <jernej.skrabec@gmail.com> | ||
Date: Sun, 29 Sep 2024 22:04:36 +1300 | ||
Subject: drm: sun4i: de2: Initialize layer fields earlier | ||
|
||
drm_universal_plane_init() can already call some callbacks, like | ||
format_mod_supported, during initialization. Because of that, fields | ||
should be initialized beforehand. | ||
|
||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com> | ||
Co-developed-by: Ryan Walklin <ryan@testtoast.com> | ||
Signed-off-by: Ryan Walklin <ryan@testtoast.com> | ||
Reviewed-by: Chen-Yu Tsai <wens@csie.org> | ||
--- | ||
drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 9 +++++---- | ||
drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 9 +++++---- | ||
2 files changed, 10 insertions(+), 8 deletions(-) | ||
|
||
diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c | ||
index aa987bca1dbb..cb9b694fef10 100644 | ||
--- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c | ||
+++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c | ||
@@ -295,6 +295,11 @@ struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm, | ||
if (!layer) | ||
return ERR_PTR(-ENOMEM); | ||
|
||
+ layer->mixer = mixer; | ||
+ layer->type = SUN8I_LAYER_TYPE_UI; | ||
+ layer->channel = channel; | ||
+ layer->overlay = 0; | ||
+ | ||
if (index == 0) | ||
type = DRM_PLANE_TYPE_PRIMARY; | ||
|
||
@@ -325,10 +330,6 @@ struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm, | ||
} | ||
|
||
drm_plane_helper_add(&layer->plane, &sun8i_ui_layer_helper_funcs); | ||
- layer->mixer = mixer; | ||
- layer->type = SUN8I_LAYER_TYPE_UI; | ||
- layer->channel = channel; | ||
- layer->overlay = 0; | ||
|
||
return layer; | ||
} | ||
diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c | ||
index f3a5329351ca..3c657b069d1f 100644 | ||
--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c | ||
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c | ||
@@ -478,6 +478,11 @@ struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm, | ||
if (!layer) | ||
return ERR_PTR(-ENOMEM); | ||
|
||
+ layer->mixer = mixer; | ||
+ layer->type = SUN8I_LAYER_TYPE_VI; | ||
+ layer->channel = index; | ||
+ layer->overlay = 0; | ||
+ | ||
if (mixer->cfg->is_de3) { | ||
formats = sun8i_vi_layer_de3_formats; | ||
format_count = ARRAY_SIZE(sun8i_vi_layer_de3_formats); | ||
@@ -536,10 +541,6 @@ struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm, | ||
} | ||
|
||
drm_plane_helper_add(&layer->plane, &sun8i_vi_layer_helper_funcs); | ||
- layer->mixer = mixer; | ||
- layer->type = SUN8I_LAYER_TYPE_VI; | ||
- layer->channel = index; | ||
- layer->overlay = 0; | ||
|
||
return layer; | ||
} | ||
-- | ||
2.35.3 | ||
|
178 changes: 178 additions & 0 deletions
178
patch/kernel/archive/sunxi-6.12/patches.drm/drm-sun4i-de2-de3-Change-CSC-argument.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
From 54669ac67e47835b8cc3eea215026385a0050567 Mon Sep 17 00:00:00 2001 | ||
From: Jernej Skrabec <jernej.skrabec@gmail.com> | ||
Date: Sun, 29 Sep 2024 22:04:33 +1300 | ||
Subject: drm: sun4i: de2/de3: Change CSC argument | ||
|
||
Currently, CSC module takes care only for converting YUV to RGB. | ||
However, DE3 is more suited to work in YUV color space. Change CSC mode | ||
argument to format type to be more neutral. New argument only tells | ||
layer format type and doesn't imply output type. | ||
|
||
This commit doesn't make any functional change. | ||
|
||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com> | ||
Signed-off-by: Ryan Walklin <ryan@testtoast.com> | ||
Reviewed-by: Andre Przywara <andre.przywara@arm.com> | ||
--- | ||
drivers/gpu/drm/sun4i/sun8i_csc.c | 22 +++++++++++----------- | ||
drivers/gpu/drm/sun4i/sun8i_csc.h | 10 +++++----- | ||
drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 16 ++++++++-------- | ||
3 files changed, 24 insertions(+), 24 deletions(-) | ||
|
||
diff --git a/drivers/gpu/drm/sun4i/sun8i_csc.c b/drivers/gpu/drm/sun4i/sun8i_csc.c | ||
index 58480d8e4f70..6ebd1c3aa3ab 100644 | ||
--- a/drivers/gpu/drm/sun4i/sun8i_csc.c | ||
+++ b/drivers/gpu/drm/sun4i/sun8i_csc.c | ||
@@ -108,7 +108,7 @@ static const u32 yuv2rgb_de3[2][3][12] = { | ||
}; | ||
|
||
static void sun8i_csc_set_coefficients(struct regmap *map, u32 base, | ||
- enum sun8i_csc_mode mode, | ||
+ enum format_type fmt_type, | ||
enum drm_color_encoding encoding, | ||
enum drm_color_range range) | ||
{ | ||
@@ -118,12 +118,12 @@ static void sun8i_csc_set_coefficients(struct regmap *map, u32 base, | ||
|
||
table = yuv2rgb[range][encoding]; | ||
|
||
- switch (mode) { | ||
- case SUN8I_CSC_MODE_YUV2RGB: | ||
+ switch (fmt_type) { | ||
+ case FORMAT_TYPE_YUV: | ||
base_reg = SUN8I_CSC_COEFF(base, 0); | ||
regmap_bulk_write(map, base_reg, table, 12); | ||
break; | ||
- case SUN8I_CSC_MODE_YVU2RGB: | ||
+ case FORMAT_TYPE_YVU: | ||
for (i = 0; i < 12; i++) { | ||
if ((i & 3) == 1) | ||
base_reg = SUN8I_CSC_COEFF(base, i + 1); | ||
@@ -141,7 +141,7 @@ static void sun8i_csc_set_coefficients(struct regmap *map, u32 base, | ||
} | ||
|
||
static void sun8i_de3_ccsc_set_coefficients(struct regmap *map, int layer, | ||
- enum sun8i_csc_mode mode, | ||
+ enum format_type fmt_type, | ||
enum drm_color_encoding encoding, | ||
enum drm_color_range range) | ||
{ | ||
@@ -151,12 +151,12 @@ static void sun8i_de3_ccsc_set_coefficients(struct regmap *map, int layer, | ||
|
||
table = yuv2rgb_de3[range][encoding]; | ||
|
||
- switch (mode) { | ||
- case SUN8I_CSC_MODE_YUV2RGB: | ||
+ switch (fmt_type) { | ||
+ case FORMAT_TYPE_YUV: | ||
addr = SUN50I_MIXER_BLEND_CSC_COEFF(DE3_BLD_BASE, layer, 0); | ||
regmap_bulk_write(map, addr, table, 12); | ||
break; | ||
- case SUN8I_CSC_MODE_YVU2RGB: | ||
+ case FORMAT_TYPE_YVU: | ||
for (i = 0; i < 12; i++) { | ||
if ((i & 3) == 1) | ||
addr = SUN50I_MIXER_BLEND_CSC_COEFF(DE3_BLD_BASE, | ||
@@ -206,7 +206,7 @@ static void sun8i_de3_ccsc_enable(struct regmap *map, int layer, bool enable) | ||
} | ||
|
||
void sun8i_csc_set_ccsc_coefficients(struct sun8i_mixer *mixer, int layer, | ||
- enum sun8i_csc_mode mode, | ||
+ enum format_type fmt_type, | ||
enum drm_color_encoding encoding, | ||
enum drm_color_range range) | ||
{ | ||
@@ -214,14 +214,14 @@ void sun8i_csc_set_ccsc_coefficients(struct sun8i_mixer *mixer, int layer, | ||
|
||
if (mixer->cfg->is_de3) { | ||
sun8i_de3_ccsc_set_coefficients(mixer->engine.regs, layer, | ||
- mode, encoding, range); | ||
+ fmt_type, encoding, range); | ||
return; | ||
} | ||
|
||
base = ccsc_base[mixer->cfg->ccsc][layer]; | ||
|
||
sun8i_csc_set_coefficients(mixer->engine.regs, base, | ||
- mode, encoding, range); | ||
+ fmt_type, encoding, range); | ||
} | ||
|
||
void sun8i_csc_enable_ccsc(struct sun8i_mixer *mixer, int layer, bool enable) | ||
diff --git a/drivers/gpu/drm/sun4i/sun8i_csc.h b/drivers/gpu/drm/sun4i/sun8i_csc.h | ||
index 828b86fd0cab..7322770f39f0 100644 | ||
--- a/drivers/gpu/drm/sun4i/sun8i_csc.h | ||
+++ b/drivers/gpu/drm/sun4i/sun8i_csc.h | ||
@@ -22,14 +22,14 @@ struct sun8i_mixer; | ||
|
||
#define SUN8I_CSC_CTRL_EN BIT(0) | ||
|
||
-enum sun8i_csc_mode { | ||
- SUN8I_CSC_MODE_OFF, | ||
- SUN8I_CSC_MODE_YUV2RGB, | ||
- SUN8I_CSC_MODE_YVU2RGB, | ||
+enum format_type { | ||
+ FORMAT_TYPE_RGB, | ||
+ FORMAT_TYPE_YUV, | ||
+ FORMAT_TYPE_YVU, | ||
}; | ||
|
||
void sun8i_csc_set_ccsc_coefficients(struct sun8i_mixer *mixer, int layer, | ||
- enum sun8i_csc_mode mode, | ||
+ enum format_type fmt_type, | ||
enum drm_color_encoding encoding, | ||
enum drm_color_range range); | ||
void sun8i_csc_enable_ccsc(struct sun8i_mixer *mixer, int layer, bool enable); | ||
diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c | ||
index 9c09d9c08496..8a80934e928f 100644 | ||
--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c | ||
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c | ||
@@ -193,19 +193,19 @@ static int sun8i_vi_layer_update_coord(struct sun8i_mixer *mixer, int channel, | ||
return 0; | ||
} | ||
|
||
-static u32 sun8i_vi_layer_get_csc_mode(const struct drm_format_info *format) | ||
+static u32 sun8i_vi_layer_get_format_type(const struct drm_format_info *format) | ||
{ | ||
if (!format->is_yuv) | ||
- return SUN8I_CSC_MODE_OFF; | ||
+ return FORMAT_TYPE_RGB; | ||
|
||
switch (format->format) { | ||
case DRM_FORMAT_YVU411: | ||
case DRM_FORMAT_YVU420: | ||
case DRM_FORMAT_YVU422: | ||
case DRM_FORMAT_YVU444: | ||
- return SUN8I_CSC_MODE_YVU2RGB; | ||
+ return FORMAT_TYPE_YVU; | ||
default: | ||
- return SUN8I_CSC_MODE_YUV2RGB; | ||
+ return FORMAT_TYPE_YUV; | ||
} | ||
} | ||
|
||
@@ -213,7 +213,7 @@ static int sun8i_vi_layer_update_formats(struct sun8i_mixer *mixer, int channel, | ||
int overlay, struct drm_plane *plane) | ||
{ | ||
struct drm_plane_state *state = plane->state; | ||
- u32 val, ch_base, csc_mode, hw_fmt; | ||
+ u32 val, ch_base, fmt_type, hw_fmt; | ||
const struct drm_format_info *fmt; | ||
int ret; | ||
|
||
@@ -231,9 +231,9 @@ static int sun8i_vi_layer_update_formats(struct sun8i_mixer *mixer, int channel, | ||
SUN8I_MIXER_CHAN_VI_LAYER_ATTR(ch_base, overlay), | ||
SUN8I_MIXER_CHAN_VI_LAYER_ATTR_FBFMT_MASK, val); | ||
|
||
- csc_mode = sun8i_vi_layer_get_csc_mode(fmt); | ||
- if (csc_mode != SUN8I_CSC_MODE_OFF) { | ||
- sun8i_csc_set_ccsc_coefficients(mixer, channel, csc_mode, | ||
+ fmt_type = sun8i_vi_layer_get_format_type(fmt); | ||
+ if (fmt_type != FORMAT_TYPE_RGB) { | ||
+ sun8i_csc_set_ccsc_coefficients(mixer, channel, fmt_type, | ||
state->color_encoding, | ||
state->color_range); | ||
sun8i_csc_enable_ccsc(mixer, channel, true); | ||
-- | ||
2.35.3 | ||
|
Oops, something went wrong.