1 /* SPDX-License-Identifier: GPL-2.0-only */ 1 2 /* 3 * cec-notifier.h - notify CEC drivers of phys 4 * 5 * Copyright 2016 Russell King. 6 * Copyright 2016-2017 Cisco Systems, Inc. and 7 */ 8 9 #ifndef LINUX_CEC_NOTIFIER_H 10 #define LINUX_CEC_NOTIFIER_H 11 12 #include <linux/err.h> 13 #include <media/cec.h> 14 15 struct device; 16 struct edid; 17 struct cec_adapter; 18 struct cec_notifier; 19 20 #if IS_REACHABLE(CONFIG_CEC_CORE) && IS_ENABLE 21 22 /** 23 * cec_notifier_conn_register - find or create 24 * HDMI device and connector tuple. 25 * @hdmi_dev: HDMI device that sends the event 26 * @port_name: the connector name from which t 27 * if there is always only one HDMI connector 28 * @conn_info: the connector info from which t 29 * 30 * If a notifier for device @dev and connector 31 * increase the refcount and return that notif 32 * 33 * If it doesn't exist, then allocate a new no 34 * pointer to that new struct. 35 * 36 * Return NULL if the memory could not be allo 37 */ 38 struct cec_notifier * 39 cec_notifier_conn_register(struct device *hdmi 40 const struct cec_co 41 42 /** 43 * cec_notifier_conn_unregister - decrease ref 44 * refcount reaches 0. 45 * @n: notifier. If NULL, then this function d 46 */ 47 void cec_notifier_conn_unregister(struct cec_n 48 49 /** 50 * cec_notifier_cec_adap_register - find or cr 51 * given device. 52 * @hdmi_dev: HDMI device that sends the event 53 * @port_name: the connector name from which t 54 * if there is always only one HDMI connector 55 * @adap: the cec adapter that registered this 56 * 57 * If a notifier for device @dev and connector 58 * increase the refcount and return that notif 59 * 60 * If it doesn't exist, then allocate a new no 61 * pointer to that new struct. 62 * 63 * Return NULL if the memory could not be allo 64 */ 65 struct cec_notifier * 66 cec_notifier_cec_adap_register(struct device * 67 struct cec_adap 68 69 /** 70 * cec_notifier_cec_adap_unregister - decrease 71 * refcount reaches 0. 72 * @n: notifier. If NULL, then this function d 73 * @adap: the cec adapter that registered this 74 */ 75 void cec_notifier_cec_adap_unregister(struct c 76 struct c 77 78 /** 79 * cec_notifier_set_phys_addr - set a new phys 80 * @n: the CEC notifier 81 * @pa: the CEC physical address 82 * 83 * Set a new CEC physical address. 84 * Does nothing if @n == NULL. 85 */ 86 void cec_notifier_set_phys_addr(struct cec_not 87 88 /** 89 * cec_notifier_set_phys_addr_from_edid - set 90 * @n: the CEC notifier 91 * @edid: the struct edid pointer 92 * 93 * Parses the EDID to obtain the new CEC physi 94 * Does nothing if @n == NULL. 95 */ 96 void cec_notifier_set_phys_addr_from_edid(stru 97 cons 98 99 /** 100 * cec_notifier_parse_hdmi_phandle - find the 101 * @dev: the device with the "hdmi-phandle" de 102 * 103 * Returns the device pointer referenced by th 104 * Note that the refcount of the returned devi 105 * This device pointer is only used as a key v 106 * list, but it is never accessed by the CEC d 107 */ 108 struct device *cec_notifier_parse_hdmi_phandle 109 110 #else 111 112 static inline struct cec_notifier * 113 cec_notifier_conn_register(struct device *hdmi 114 const struct cec_co 115 { 116 /* A non-NULL pointer is expected on s 117 return (struct cec_notifier *)0xdeadfe 118 } 119 120 static inline void cec_notifier_conn_unregiste 121 { 122 } 123 124 static inline struct cec_notifier * 125 cec_notifier_cec_adap_register(struct device * 126 struct cec_adap 127 { 128 /* A non-NULL pointer is expected on s 129 return (struct cec_notifier *)0xdeadfe 130 } 131 132 static inline void cec_notifier_cec_adap_unreg 133 134 { 135 } 136 137 static inline void cec_notifier_set_phys_addr( 138 { 139 } 140 141 static inline void cec_notifier_set_phys_addr_ 142 143 { 144 } 145 146 static inline struct device *cec_notifier_pars 147 { 148 return ERR_PTR(-ENODEV); 149 } 150 151 #endif 152 153 /** 154 * cec_notifier_phys_addr_invalidate() - set t 155 * 156 * @n: the CEC notifier 157 * 158 * This is a simple helper function to invalid 159 * address. Does nothing if @n == NULL. 160 */ 161 static inline void cec_notifier_phys_addr_inva 162 { 163 cec_notifier_set_phys_addr(n, CEC_PHYS 164 } 165 166 #endif 167
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.