mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-29 10:08:59 +00:00
2e715fb4fc
Add support for BCM2712 (Raspberry Pi 5).
3bb5880ab3
Patches were generated from the diff between linux kernel branch linux-6.1.y
and rpi-6.1.y from raspberry pi kernel source:
- git format-patch linux-6.1.y...rpi-6.1.y
Build system: x86_64
Build-tested: bcm2708, bcm2709, bcm2710, bcm2711
Run-tested: bcm2710/RPi3B, bcm2711/RPi4B
Signed-off-by: Marty Jones <mj8263788@gmail.com>
[Remove applied and reverted patches, squash patches and config commits]
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
110 lines
3.1 KiB
Diff
110 lines
3.1 KiB
Diff
From 3aa1f2477545ea6298bc6f2d7ffae68f090af9b8 Mon Sep 17 00:00:00 2001
|
|
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
|
|
Date: Thu, 28 Sep 2023 18:27:09 +0100
|
|
Subject: [PATCH] drm: Look for an alias for the displays to use as the DRM
|
|
device name
|
|
|
|
Allow DT aliases of eg DSI2 to force make DRM allocate the
|
|
display with the requested name.
|
|
|
|
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
|
|
---
|
|
drivers/gpu/drm/drm_connector.c | 60 ++++++++++++++++++++++++++++++---
|
|
1 file changed, 56 insertions(+), 4 deletions(-)
|
|
|
|
--- a/drivers/gpu/drm/drm_connector.c
|
|
+++ b/drivers/gpu/drm/drm_connector.c
|
|
@@ -81,6 +81,7 @@ struct drm_conn_prop_enum_list {
|
|
int type;
|
|
const char *name;
|
|
struct ida ida;
|
|
+ int first_dyn_num;
|
|
};
|
|
|
|
/*
|
|
@@ -110,12 +111,41 @@ static struct drm_conn_prop_enum_list dr
|
|
{ DRM_MODE_CONNECTOR_USB, "USB" },
|
|
};
|
|
|
|
+#define MAX_DT_NODE_NAME_LEN 20
|
|
+#define DT_DRM_NODE_PREFIX "drm_"
|
|
+
|
|
+static void drm_connector_get_of_name(int type, char *node_name, int length)
|
|
+{
|
|
+ int i = 0;
|
|
+
|
|
+ strcpy(node_name, DT_DRM_NODE_PREFIX);
|
|
+
|
|
+ do {
|
|
+ node_name[i + strlen(DT_DRM_NODE_PREFIX)] =
|
|
+ tolower(drm_connector_enum_list[type].name[i]);
|
|
+
|
|
+ } while (drm_connector_enum_list[type].name[i++] &&
|
|
+ i < length);
|
|
+
|
|
+ node_name[length - 1] = '\0';
|
|
+}
|
|
+
|
|
void drm_connector_ida_init(void)
|
|
{
|
|
- int i;
|
|
+ int i, id;
|
|
+ char node_name[MAX_DT_NODE_NAME_LEN];
|
|
|
|
- for (i = 0; i < ARRAY_SIZE(drm_connector_enum_list); i++)
|
|
+ for (i = 0; i < ARRAY_SIZE(drm_connector_enum_list); i++) {
|
|
ida_init(&drm_connector_enum_list[i].ida);
|
|
+
|
|
+ drm_connector_get_of_name(i, node_name, MAX_DT_NODE_NAME_LEN);
|
|
+
|
|
+ id = of_alias_get_highest_id(node_name);
|
|
+ if (id > 0)
|
|
+ drm_connector_enum_list[i].first_dyn_num = id + 1;
|
|
+ else
|
|
+ drm_connector_enum_list[i].first_dyn_num = 1;
|
|
+ }
|
|
}
|
|
|
|
void drm_connector_ida_destroy(void)
|
|
@@ -222,7 +252,9 @@ static int __drm_connector_init(struct d
|
|
struct i2c_adapter *ddc)
|
|
{
|
|
struct drm_mode_config *config = &dev->mode_config;
|
|
+ char node_name[MAX_DT_NODE_NAME_LEN];
|
|
int ret;
|
|
+ int id;
|
|
struct ida *connector_ida =
|
|
&drm_connector_enum_list[connector_type].ida;
|
|
|
|
@@ -252,8 +284,28 @@ static int __drm_connector_init(struct d
|
|
ret = 0;
|
|
|
|
connector->connector_type = connector_type;
|
|
- connector->connector_type_id =
|
|
- ida_alloc_min(connector_ida, 1, GFP_KERNEL);
|
|
+ connector->connector_type_id = 0;
|
|
+
|
|
+ drm_connector_get_of_name(connector_type, node_name, MAX_DT_NODE_NAME_LEN);
|
|
+ id = of_alias_get_id(dev->dev->of_node, node_name);
|
|
+ if (id > 0) {
|
|
+ /* Try and allocate the requested ID
|
|
+ * Valid range is 1 to 31, hence ignoring 0 as an error
|
|
+ */
|
|
+ int type_id = ida_alloc_range(connector_ida, id, id, GFP_KERNEL);
|
|
+
|
|
+ if (type_id > 0)
|
|
+ connector->connector_type_id = type_id;
|
|
+ else
|
|
+ drm_err(dev, "Failed to acquire type ID %d for interface type %s, ret %d\n",
|
|
+ id, drm_connector_enum_list[connector_type].name,
|
|
+ type_id);
|
|
+ }
|
|
+ if (!connector->connector_type_id)
|
|
+ connector->connector_type_id =
|
|
+ ida_alloc_min(connector_ida,
|
|
+ drm_connector_enum_list[connector_type].first_dyn_num,
|
|
+ GFP_KERNEL);
|
|
if (connector->connector_type_id < 0) {
|
|
ret = connector->connector_type_id;
|
|
goto out_put_id;
|