xref: /OK3568_Linux_fs/kernel/drivers/video/hdmi-notifier.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 #include <linux/export.h>
2 #include <linux/hdmi-notifier.h>
3 #include <linux/notifier.h>
4 #include <linux/string.h>
5 
6 static BLOCKING_NOTIFIER_HEAD(hdmi_notifier);
7 
hdmi_register_notifier(struct notifier_block * nb)8 int hdmi_register_notifier(struct notifier_block *nb)
9 {
10 	return blocking_notifier_chain_register(&hdmi_notifier, nb);
11 }
12 EXPORT_SYMBOL_GPL(hdmi_register_notifier);
13 
hdmi_unregister_notifier(struct notifier_block * nb)14 int hdmi_unregister_notifier(struct notifier_block *nb)
15 {
16 	return blocking_notifier_chain_unregister(&hdmi_notifier, nb);
17 }
18 EXPORT_SYMBOL_GPL(hdmi_unregister_notifier);
19 
hdmi_event_connect(struct device * dev)20 void hdmi_event_connect(struct device *dev)
21 {
22 	struct hdmi_event_base base;
23 
24 	base.source = dev;
25 
26 	blocking_notifier_call_chain(&hdmi_notifier, HDMI_CONNECTED, &base);
27 }
28 EXPORT_SYMBOL_GPL(hdmi_event_connect);
29 
hdmi_event_disconnect(struct device * dev)30 void hdmi_event_disconnect(struct device *dev)
31 {
32 	struct hdmi_event_base base;
33 
34 	base.source = dev;
35 
36 	blocking_notifier_call_chain(&hdmi_notifier, HDMI_DISCONNECTED, &base);
37 }
38 EXPORT_SYMBOL_GPL(hdmi_event_disconnect);
39 
hdmi_event_new_edid(struct device * dev,const void * edid,size_t size)40 void hdmi_event_new_edid(struct device *dev, const void *edid, size_t size)
41 {
42 	struct hdmi_event_new_edid new_edid;
43 
44 	new_edid.base.source = dev;
45 	new_edid.edid = edid;
46 	new_edid.size = size;
47 
48 	blocking_notifier_call_chain(&hdmi_notifier, HDMI_NEW_EDID, &new_edid);
49 }
50 EXPORT_SYMBOL_GPL(hdmi_event_new_edid);
51 
hdmi_event_new_eld(struct device * dev,const void * eld)52 void hdmi_event_new_eld(struct device *dev, const void *eld)
53 {
54 	struct hdmi_event_new_eld new_eld;
55 
56 	new_eld.base.source = dev;
57 	memcpy(new_eld.eld, eld, sizeof(new_eld.eld));
58 
59 	blocking_notifier_call_chain(&hdmi_notifier, HDMI_NEW_ELD, &new_eld);
60 }
61 EXPORT_SYMBOL_GPL(hdmi_event_new_eld);
62