-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5522814
commit ad7d606
Showing
24 changed files
with
6,347 additions
and
2 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
135 changes: 135 additions & 0 deletions
135
patch/kernel/archive/sm8250-6.11/0001-drm-Add-drm-notifier-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,135 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Jianhua Lu <lujianhua000@gmail.com> | ||
Date: Thu, 4 Aug 2022 13:26:53 +0800 | ||
Subject: drm: Add drm notifier support | ||
|
||
--- | ||
drivers/gpu/drm/Makefile | 3 +- | ||
drivers/gpu/drm/drm_notifier.c | 58 ++++++++++ | ||
include/drm/drm_notifier.h | 37 ++++++ | ||
3 files changed, 97 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile | ||
index 111111111111..222222222222 100644 | ||
--- a/drivers/gpu/drm/Makefile | ||
+++ b/drivers/gpu/drm/Makefile | ||
@@ -74,7 +74,8 @@ drm-y := \ | ||
drm_vblank.o \ | ||
drm_vblank_work.o \ | ||
drm_vma_manager.o \ | ||
- drm_writeback.o | ||
+ drm_writeback.o \ | ||
+ drm_notifier.o | ||
drm-$(CONFIG_DRM_LIB_RANDOM) += lib/drm_random.o | ||
drm-$(CONFIG_COMPAT) += drm_ioc32.o | ||
drm-$(CONFIG_DRM_PANEL) += drm_panel.o | ||
diff --git a/drivers/gpu/drm/drm_notifier.c b/drivers/gpu/drm/drm_notifier.c | ||
new file mode 100644 | ||
index 000000000000..111111111111 | ||
--- /dev/null | ||
+++ b/drivers/gpu/drm/drm_notifier.c | ||
@@ -0,0 +1,58 @@ | ||
+/* | ||
+ * Copyright (c) 2019, The Linux Foundation. All rights reserved. | ||
+ * Copyright (C) 2021 XiaoMi, Inc. | ||
+ * | ||
+ * This program is free software; you can redistribute it and/or modify | ||
+ * it under the terms of the GNU General Public License version 2 and | ||
+ * only version 2 as published by the Free Software Foundation. | ||
+ * | ||
+ * 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. | ||
+ * | ||
+ */ | ||
+ | ||
+#include <linux/notifier.h> | ||
+#include <drm/drm_notifier.h> | ||
+ | ||
+static BLOCKING_NOTIFIER_HEAD(mi_drm_notifier_list); | ||
+ | ||
+/** | ||
+ * mi_drm_register_client - register a client notifier | ||
+ * @nb: notifier block to callback on events | ||
+ * | ||
+ * This function registers a notifier callback function | ||
+ * to msm_drm_notifier_list, which would be called when | ||
+ * received unblank/power down event. | ||
+ */ | ||
+int mi_drm_register_client(struct notifier_block *nb) | ||
+{ | ||
+ return blocking_notifier_chain_register(&mi_drm_notifier_list, nb); | ||
+} | ||
+EXPORT_SYMBOL(mi_drm_register_client); | ||
+ | ||
+/** | ||
+ * mi_drm_unregister_client - unregister a client notifier | ||
+ * @nb: notifier block to callback on events | ||
+ * | ||
+ * This function unregisters the callback function from | ||
+ * msm_drm_notifier_list. | ||
+ */ | ||
+int mi_drm_unregister_client(struct notifier_block *nb) | ||
+{ | ||
+ return blocking_notifier_chain_unregister(&mi_drm_notifier_list, nb); | ||
+} | ||
+EXPORT_SYMBOL(mi_drm_unregister_client); | ||
+ | ||
+/** | ||
+ * mi_drm_notifier_call_chain - notify clients of drm_events | ||
+ * @val: event MSM_DRM_EARLY_EVENT_BLANK or MSM_DRM_EVENT_BLANK | ||
+ * @v: notifier data, inculde display id and display blank | ||
+ * event(unblank or power down). | ||
+ */ | ||
+int mi_drm_notifier_call_chain(unsigned long val, void *v) | ||
+{ | ||
+ return blocking_notifier_call_chain(&mi_drm_notifier_list, val, v); | ||
+} | ||
+EXPORT_SYMBOL(mi_drm_notifier_call_chain); | ||
diff --git a/include/drm/drm_notifier.h b/include/drm/drm_notifier.h | ||
new file mode 100644 | ||
index 000000000000..111111111111 | ||
--- /dev/null | ||
+++ b/include/drm/drm_notifier.h | ||
@@ -0,0 +1,37 @@ | ||
+/* | ||
+ * Copyright (c) 2019, The Linux Foundation. All rights reserved. | ||
+ * Copyright (C) 2021 XiaoMi, Inc. | ||
+ * | ||
+ * This program is free software; you can redistribute it and/or modify | ||
+ * it under the terms of the GNU General Public License version 2 and | ||
+ * only version 2 as published by the Free Software Foundation. | ||
+ * | ||
+ * 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. | ||
+ * | ||
+ */ | ||
+ | ||
+#ifndef _DRM_NOTIFIER_H_ | ||
+#define _DRM_NOTIFIER_H_ | ||
+ | ||
+#include <linux/notifier.h> | ||
+ | ||
+/* A hardware display blank change occurred */ | ||
+#define MI_DRM_EVENT_BLANK 0x01 | ||
+/* A hardware display blank early change occurred */ | ||
+#define MI_DRM_EARLY_EVENT_BLANK 0x02 | ||
+ | ||
+enum drm_notifier_data { | ||
+ /* panel: power on */ | ||
+ MI_DRM_BLANK_UNBLANK, | ||
+ /* panel: power down */ | ||
+ MI_DRM_BLANK_POWERDOWN, | ||
+}; | ||
+ | ||
+int mi_drm_register_client(struct notifier_block *nb); | ||
+int mi_drm_unregister_client(struct notifier_block *nb); | ||
+int mi_drm_notifier_call_chain(unsigned long val, void *v); | ||
+ | ||
+#endif /* _DRM_NOTIFIER_H */ | ||
-- | ||
Armbian | ||
|
56 changes: 56 additions & 0 deletions
56
...ernel/archive/sm8250-6.11/0002-drm-dsi-emit-panel-turn-on-off-signal-to-touchscreen.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,56 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Jianhua Lu <lujianhua000@gmail.com> | ||
Date: Mon, 17 Oct 2022 08:02:58 +0800 | ||
Subject: drm: dsi: emit panel turn on/off signal to touchscreen | ||
|
||
--- | ||
drivers/gpu/drm/msm/dsi/dsi_manager.c | 9 +++++++++ | ||
1 file changed, 9 insertions(+) | ||
|
||
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c | ||
index 111111111111..222222222222 100644 | ||
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c | ||
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c | ||
@@ -7,6 +7,7 @@ | ||
|
||
#include "msm_kms.h" | ||
#include "dsi.h" | ||
+#include "drm/drm_notifier.h" | ||
|
||
#define DSI_CLOCK_MASTER DSI_0 | ||
#define DSI_CLOCK_SLAVE DSI_1 | ||
@@ -273,6 +274,7 @@ static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge) | ||
struct mipi_dsi_host *host = msm_dsi->host; | ||
bool is_bonded_dsi = IS_BONDED_DSI(); | ||
int ret; | ||
+ enum drm_notifier_data notifier_data; | ||
|
||
DBG("id=%d", id); | ||
|
||
@@ -286,6 +288,9 @@ static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge) | ||
return; | ||
} | ||
|
||
+ notifier_data = MI_DRM_BLANK_UNBLANK; | ||
+ mi_drm_notifier_call_chain(MI_DRM_EVENT_BLANK, ¬ifier_data); | ||
+ | ||
ret = msm_dsi_host_enable(host); | ||
if (ret) { | ||
pr_err("%s: enable host %d failed, %d\n", __func__, id, ret); | ||
@@ -329,9 +334,13 @@ static void dsi_mgr_bridge_post_disable(struct drm_bridge *bridge) | ||
struct mipi_dsi_host *host = msm_dsi->host; | ||
bool is_bonded_dsi = IS_BONDED_DSI(); | ||
int ret; | ||
+ enum drm_notifier_data notifier_data; | ||
|
||
DBG("id=%d", id); | ||
|
||
+ notifier_data = MI_DRM_BLANK_POWERDOWN; | ||
+ mi_drm_notifier_call_chain(MI_DRM_EARLY_EVENT_BLANK, ¬ifier_data); | ||
+ | ||
/* | ||
* Do nothing with the host if it is slave-DSI in case of bonded DSI. | ||
* It is safe to call dsi_mgr_phy_disable() here because a single PHY | ||
-- | ||
Armbian | ||
|
Oops, something went wrong.