hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/include/media/cec-notifier.h
....@@ -2,14 +2,14 @@
22 /*
33 * cec-notifier.h - notify CEC drivers of physical address changes
44 *
5
- * Copyright 2016 Russell King <rmk+kernel@arm.linux.org.uk>
5
+ * Copyright 2016 Russell King.
66 * Copyright 2016-2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
77 */
88
99 #ifndef LINUX_CEC_NOTIFIER_H
1010 #define LINUX_CEC_NOTIFIER_H
1111
12
-#include <linux/types.h>
12
+#include <linux/err.h>
1313 #include <media/cec.h>
1414
1515 struct device;
....@@ -20,27 +20,60 @@
2020 #if IS_REACHABLE(CONFIG_CEC_CORE) && IS_ENABLED(CONFIG_CEC_NOTIFIER)
2121
2222 /**
23
- * cec_notifier_get_conn - find or create a new cec_notifier for the given
24
- * device and connector tuple.
25
- * @dev: device that sends the events.
26
- * @conn: the connector name from which the event occurs
23
+ * cec_notifier_conn_register - find or create a new cec_notifier for the given
24
+ * HDMI device and connector tuple.
25
+ * @hdmi_dev: HDMI device that sends the events.
26
+ * @port_name: the connector name from which the event occurs. May be NULL
27
+ * if there is always only one HDMI connector created by the HDMI device.
28
+ * @conn_info: the connector info from which the event occurs (may be NULL)
2729 *
28
- * If a notifier for device @dev already exists, then increase the refcount
29
- * and return that notifier.
30
+ * If a notifier for device @dev and connector @port_name already exists, then
31
+ * increase the refcount and return that notifier.
3032 *
3133 * If it doesn't exist, then allocate a new notifier struct and return a
3234 * pointer to that new struct.
3335 *
3436 * Return NULL if the memory could not be allocated.
3537 */
36
-struct cec_notifier *cec_notifier_get_conn(struct device *dev,
37
- const char *conn);
38
+struct cec_notifier *
39
+cec_notifier_conn_register(struct device *hdmi_dev, const char *port_name,
40
+ const struct cec_connector_info *conn_info);
3841
3942 /**
40
- * cec_notifier_put - decrease refcount and delete when the refcount reaches 0.
41
- * @n: notifier
43
+ * cec_notifier_conn_unregister - decrease refcount and delete when the
44
+ * refcount reaches 0.
45
+ * @n: notifier. If NULL, then this function does nothing.
4246 */
43
-void cec_notifier_put(struct cec_notifier *n);
47
+void cec_notifier_conn_unregister(struct cec_notifier *n);
48
+
49
+/**
50
+ * cec_notifier_cec_adap_register - find or create a new cec_notifier for the
51
+ * given device.
52
+ * @hdmi_dev: HDMI device that sends the events.
53
+ * @port_name: the connector name from which the event occurs. May be NULL
54
+ * if there is always only one HDMI connector created by the HDMI device.
55
+ * @adap: the cec adapter that registered this notifier.
56
+ *
57
+ * If a notifier for device @dev and connector @port_name already exists, then
58
+ * increase the refcount and return that notifier.
59
+ *
60
+ * If it doesn't exist, then allocate a new notifier struct and return a
61
+ * pointer to that new struct.
62
+ *
63
+ * Return NULL if the memory could not be allocated.
64
+ */
65
+struct cec_notifier *
66
+cec_notifier_cec_adap_register(struct device *hdmi_dev, const char *port_name,
67
+ struct cec_adapter *adap);
68
+
69
+/**
70
+ * cec_notifier_cec_adap_unregister - decrease refcount and delete when the
71
+ * refcount reaches 0.
72
+ * @n: notifier. If NULL, then this function does nothing.
73
+ * @adap: the cec adapter that registered this notifier.
74
+ */
75
+void cec_notifier_cec_adap_unregister(struct cec_notifier *n,
76
+ struct cec_adapter *adap);
4477
4578 /**
4679 * cec_notifier_set_phys_addr - set a new physical address.
....@@ -51,9 +84,6 @@
5184 * Does nothing if @n == NULL.
5285 */
5386 void cec_notifier_set_phys_addr(struct cec_notifier *n, u16 pa);
54
-
55
-void cec_notifier_repo_cec_hpd(struct cec_notifier *n,
56
- bool hpd_state, ktime_t ts);
5787
5888 /**
5989 * cec_notifier_set_phys_addr_from_edid - set parse the PA from the EDID.
....@@ -67,38 +97,40 @@
6797 const struct edid *edid);
6898
6999 /**
70
- * cec_notifier_register - register a callback with the notifier
71
- * @n: the CEC notifier
72
- * @adap: the CEC adapter, passed as argument to the callback function
73
- * @callback: the callback function
100
+ * cec_notifier_parse_hdmi_phandle - find the hdmi device from "hdmi-phandle"
101
+ * @dev: the device with the "hdmi-phandle" device tree property
102
+ *
103
+ * Returns the device pointer referenced by the "hdmi-phandle" property.
104
+ * Note that the refcount of the returned device is not incremented.
105
+ * This device pointer is only used as a key value in the notifier
106
+ * list, but it is never accessed by the CEC driver.
74107 */
75
-void cec_notifier_register(struct cec_notifier *n,
76
- struct cec_adapter *adap,
77
- void (*callback)(struct cec_adapter *adap, u16 pa));
78
-
79
-/**
80
- * cec_notifier_unregister - unregister the callback from the notifier.
81
- * @n: the CEC notifier
82
- */
83
-void cec_notifier_unregister(struct cec_notifier *n);
84
-
85
-/**
86
- * cec_register_cec_notifier - register the notifier with the cec adapter.
87
- * @adap: the CEC adapter
88
- * @notifier: the CEC notifier
89
- */
90
-void cec_register_cec_notifier(struct cec_adapter *adap,
91
- struct cec_notifier *notifier);
108
+struct device *cec_notifier_parse_hdmi_phandle(struct device *dev);
92109
93110 #else
94
-static inline struct cec_notifier *cec_notifier_get_conn(struct device *dev,
95
- const char *conn)
111
+
112
+static inline struct cec_notifier *
113
+cec_notifier_conn_register(struct device *hdmi_dev, const char *port_name,
114
+ const struct cec_connector_info *conn_info)
96115 {
97116 /* A non-NULL pointer is expected on success */
98117 return (struct cec_notifier *)0xdeadfeed;
99118 }
100119
101
-static inline void cec_notifier_put(struct cec_notifier *n)
120
+static inline void cec_notifier_conn_unregister(struct cec_notifier *n)
121
+{
122
+}
123
+
124
+static inline struct cec_notifier *
125
+cec_notifier_cec_adap_register(struct device *hdmi_dev, const char *port_name,
126
+ struct cec_adapter *adap)
127
+{
128
+ /* A non-NULL pointer is expected on success */
129
+ return (struct cec_notifier *)0xdeadfeed;
130
+}
131
+
132
+static inline void cec_notifier_cec_adap_unregister(struct cec_notifier *n,
133
+ struct cec_adapter *adap)
102134 {
103135 }
104136
....@@ -111,38 +143,12 @@
111143 {
112144 }
113145
114
-static inline void cec_notifier_register(struct cec_notifier *n,
115
- struct cec_adapter *adap,
116
- void (*callback)(struct cec_adapter *adap, u16 pa))
146
+static inline struct device *cec_notifier_parse_hdmi_phandle(struct device *dev)
117147 {
148
+ return ERR_PTR(-ENODEV);
118149 }
119150
120
-static inline void cec_notifier_unregister(struct cec_notifier *n)
121
-{
122
-}
123
-
124
-static inline void cec_register_cec_notifier(struct cec_adapter *adap,
125
- struct cec_notifier *notifier)
126
-{
127
-}
128151 #endif
129
-
130
-/**
131
- * cec_notifier_get - find or create a new cec_notifier for the given device.
132
- * @dev: device that sends the events.
133
- *
134
- * If a notifier for device @dev already exists, then increase the refcount
135
- * and return that notifier.
136
- *
137
- * If it doesn't exist, then allocate a new notifier struct and return a
138
- * pointer to that new struct.
139
- *
140
- * Return NULL if the memory could not be allocated.
141
- */
142
-static inline struct cec_notifier *cec_notifier_get(struct device *dev)
143
-{
144
- return cec_notifier_get_conn(dev, NULL);
145
-}
146152
147153 /**
148154 * cec_notifier_phys_addr_invalidate() - set the physical address to INVALID