diff --git a/kernel_platform/msm-kernel/drivers/misc/Makefile b/kernel_platform/msm-kernel/drivers/misc/Makefile
index 41cfa70..b603deb 100644
--- a/kernel_platform/msm-kernel/drivers/misc/Makefile
+++ b/kernel_platform/msm-kernel/drivers/misc/Makefile
@@ -65,6 +65,7 @@
qseecom-mod-$(CONFIG_QSEECOM) := qseecom.o
qseecom-mod-$(CONFIG_COMPAT) += compat_qseecom.o
obj-$(CONFIG_WIGIG_SENSING_SPI) += wigig_sensing.o
+obj-m += msg_notifier.o
# Add for taskId 30248 by xulei at 2023/01/03 start
obj-m += board_id.o
# Add for taskId 30248 by xulei at 2023/01/03 end
diff --git a/kernel_platform/msm-kernel/drivers/misc/msg_notifier.c b/kernel_platform/msm-kernel/drivers/misc/msg_notifier.c
new file mode 100644
index 0000000..13a7eca
--- /dev/null
+++ b/kernel_platform/msm-kernel/drivers/misc/msg_notifier.c
@@ -0,0 +1,29 @@
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/msg_notifier.h>
+
+BLOCKING_NOTIFIER_HEAD(msg_notifier_list);
+
+int msg_notifier_call_chain(unsigned long val, unsigned int type)
+{
+ unsigned int v;
+
+ v = type;
+ return blocking_notifier_call_chain(&msg_notifier_list, val, (void *)&v);
+}
+EXPORT_SYMBOL(msg_notifier_call_chain);
+
+int msg_notifier_register(struct notifier_block *nb)
+{
+ return blocking_notifier_chain_register(&msg_notifier_list, nb);
+}
+EXPORT_SYMBOL(msg_notifier_register);
+
+int msg_notifier_unregister(struct notifier_block *nb)
+{
+ return blocking_notifier_chain_unregister(&msg_notifier_list, nb);
+}
+EXPORT_SYMBOL(msg_notifier_unregister);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("For message notify");
diff --git a/kernel_platform/msm-kernel/drivers/usb/typec/ucsi/ucsi_glink.c b/kernel_platform/msm-kernel/drivers/usb/typec/ucsi/ucsi_glink.c
index b2e050b..c5bdd41 100644
--- a/kernel_platform/msm-kernel/drivers/usb/typec/ucsi/ucsi_glink.c
+++ b/kernel_platform/msm-kernel/drivers/usb/typec/ucsi/ucsi_glink.c
@@ -15,6 +15,7 @@
#include <linux/soc/qcom/pmic_glink.h>
#include <linux/usb/typec.h>
#include <linux/usb/ucsi_glink.h>
+#include <linux/msg_notifier.h>
#include "ucsi.h"
@@ -91,11 +92,13 @@
struct list_head constat_info_list;
struct work_struct notify_work;
struct work_struct setup_work;
+ struct notifier_block usb_notifier;
atomic_t state;
};
static void *ucsi_ipc_log;
static RAW_NOTIFIER_HEAD(ucsi_glink_notifier);
+static int flag = -1;
int register_ucsi_glink_notifier(struct notifier_block *nb)
{
@@ -254,6 +257,17 @@
pr_debug("owner: %u type: %u opcode: %u len:%zu\n", hdr->owner,
hdr->type, hdr->opcode, len);
+ pr_err("[%s] : flag = %d\n", __func__, flag);
+ if(flag == 1)
+ {
+ pr_err("irq usb\n");
+ return 0;
+ }
+ else
+ {
+ pr_err("start usb; falg value is %d\n", flag);
+ }
+
if (hdr->opcode == UC_UCSI_READ_BUF_REQ)
handle_ucsi_read_ack(udev, data, len);
else if (hdr->opcode == UC_UCSI_WRITE_BUF_REQ)
@@ -606,6 +620,23 @@
mutex_unlock(&udev->state_lock);
}
+static int hub_notifier_callback(struct notifier_block *self,
+ unsigned long event, void *data)
+{
+ enum msg_event_notifier_type *type = data;
+
+ if (type && *type == MSG_EVENT_NOTIFIER_TYPE_ACC_STATE) {
+ if(event == MSG_EVENT_ACC_ON) {
+
+ flag = 1;
+ }else if (event == MSG_EVENT_ACC_OFF){
+ flag = 0;
+ }
+ }
+
+ return 0;
+}
+
static int ucsi_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -659,6 +690,11 @@
pmic_glink_unregister_client(udev->client);
}
+
+ udev->usb_notifier.notifier_call = hub_notifier_callback;
+ if (msg_notifier_register(&udev->usb_notifier))
+ pr_err("Failed to register usb msg notifier client\n" );
+
return rc;
}
diff --git a/kernel_platform/msm-kernel/include/linux/msg_notifier.h b/kernel_platform/msm-kernel/include/linux/msg_notifier.h
new file mode 100644
index 0000000..821d488
--- /dev/null
+++ b/kernel_platform/msm-kernel/include/linux/msg_notifier.h
@@ -0,0 +1,16 @@
+#include <linux/notifier.h>
+
+enum msg_event_notifier_type {
+ MSG_EVENT_NOTIFIER_TYPE_ACC_STATE = 0,
+ MSG_EVENT_NOTIFIER_TYPE_UNDEFINE,
+};
+
+enum msg_event_notification_type {
+ MSG_EVENT_NONE = 0,
+ MSG_EVENT_ACC_ON,
+ MSG_EVENT_ACC_OFF,
+};
+
+extern int msg_notifier_call_chain(unsigned long val, unsigned int type);
+extern int msg_notifier_register(struct notifier_block *nb);
+extern int msg_notifier_unregister(struct notifier_block *nb);
diff --git a/vendor/qcom/opensource/display-drivers/msm/dp/dp_gpio_hpd.c b/vendor/qcom/opensource/display-drivers/msm/dp/dp_gpio_hpd.c
index 420786c..8f8946c 100644
--- a/vendor/qcom/opensource/display-drivers/msm/dp/dp_gpio_hpd.c
+++ b/vendor/qcom/opensource/display-drivers/msm/dp/dp_gpio_hpd.c
@@ -13,6 +13,7 @@
#include <linux/sde_io_util.h>
#include <linux/of_gpio.h>
#include <linux/export.h>
+#include <linux/msg_notifier.h>
#include "dp_gpio_hpd.h"
#include "dp_debug.h"
#include "linux/jiffies.h"
@@ -145,6 +146,10 @@
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
"dp-gpio-intp", gpio_hpd);
dp_gpio_hpd_connect(gpio_hpd, true);
+
+ pr_err("hdmi connect\n");
+ msg_notifier_call_chain(MSG_EVENT_ACC_ON, MSG_EVENT_NOTIFIER_TYPE_ACC_STATE);
+
} else {
pr_err("display_port>>> hdmi plug-out,request falling irq,and final disconnect hdmi\n");
devm_free_irq(gpio_hpd->dev,
@@ -155,6 +160,10 @@
IRQF_TRIGGER_RISING | IRQF_ONESHOT,
"dp-gpio-intp", gpio_hpd);
dp_gpio_hpd_connect(gpio_hpd, false);
+
+ pr_err("hdmi disconnect\n");
+ msg_notifier_call_chain(MSG_EVENT_ACC_OFF, MSG_EVENT_NOTIFIER_TYPE_ACC_STATE);
+
hdmi_type_state();
}
linux 通知链
于 2023-11-27 13:48:34 首次发布