1 /* SPDX-License-Identifier: GPL-2.0-only */ << 2 /* 1 /* 3 * cec-notifier.h - notify CEC drivers of phys 2 * cec-notifier.h - notify CEC drivers of physical address changes 4 * 3 * 5 * Copyright 2016 Russell King. !! 4 * Copyright 2016 Russell King <rmk+kernel@arm.linux.org.uk> 6 * Copyright 2016-2017 Cisco Systems, Inc. and 5 * Copyright 2016-2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved. >> 6 * >> 7 * This program is free software; you may redistribute it and/or modify >> 8 * it under the terms of the GNU General Public License as published by >> 9 * the Free Software Foundation; version 2 of the License. >> 10 * >> 11 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, >> 12 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF >> 13 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND >> 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS >> 15 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN >> 16 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN >> 17 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE >> 18 * SOFTWARE. 7 */ 19 */ 8 20 9 #ifndef LINUX_CEC_NOTIFIER_H 21 #ifndef LINUX_CEC_NOTIFIER_H 10 #define LINUX_CEC_NOTIFIER_H 22 #define LINUX_CEC_NOTIFIER_H 11 23 12 #include <linux/err.h> !! 24 #include <linux/types.h> 13 #include <media/cec.h> 25 #include <media/cec.h> 14 26 15 struct device; 27 struct device; 16 struct edid; 28 struct edid; 17 struct cec_adapter; 29 struct cec_adapter; 18 struct cec_notifier; 30 struct cec_notifier; 19 31 20 #if IS_REACHABLE(CONFIG_CEC_CORE) && IS_ENABLE 32 #if IS_REACHABLE(CONFIG_CEC_CORE) && IS_ENABLED(CONFIG_CEC_NOTIFIER) 21 33 22 /** 34 /** 23 * cec_notifier_conn_register - find or create !! 35 * cec_notifier_get - find or create a new cec_notifier for the given device. 24 * HDMI device and connector tuple. !! 36 * @dev: device that sends the events. 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 * 37 * 30 * If a notifier for device @dev and connector !! 38 * If a notifier for device @dev already exists, then increase the refcount 31 * increase the refcount and return that notif !! 39 * and return that notifier. 32 * 40 * 33 * If it doesn't exist, then allocate a new no 41 * If it doesn't exist, then allocate a new notifier struct and return a 34 * pointer to that new struct. 42 * pointer to that new struct. 35 * 43 * 36 * Return NULL if the memory could not be allo 44 * Return NULL if the memory could not be allocated. 37 */ 45 */ 38 struct cec_notifier * !! 46 struct cec_notifier *cec_notifier_get(struct device *dev); 39 cec_notifier_conn_register(struct device *hdmi << 40 const struct cec_co << 41 47 42 /** 48 /** 43 * cec_notifier_conn_unregister - decrease ref !! 49 * cec_notifier_put - decrease refcount and delete when the refcount reaches 0. 44 * refcount reaches 0. !! 50 * @n: notifier 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 */ 51 */ 65 struct cec_notifier * !! 52 void cec_notifier_put(struct cec_notifier *n); 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 53 78 /** 54 /** 79 * cec_notifier_set_phys_addr - set a new phys 55 * cec_notifier_set_phys_addr - set a new physical address. 80 * @n: the CEC notifier 56 * @n: the CEC notifier 81 * @pa: the CEC physical address 57 * @pa: the CEC physical address 82 * 58 * 83 * Set a new CEC physical address. 59 * Set a new CEC physical address. 84 * Does nothing if @n == NULL. << 85 */ 60 */ 86 void cec_notifier_set_phys_addr(struct cec_not 61 void cec_notifier_set_phys_addr(struct cec_notifier *n, u16 pa); 87 62 88 /** 63 /** 89 * cec_notifier_set_phys_addr_from_edid - set 64 * cec_notifier_set_phys_addr_from_edid - set parse the PA from the EDID. 90 * @n: the CEC notifier 65 * @n: the CEC notifier 91 * @edid: the struct edid pointer 66 * @edid: the struct edid pointer 92 * 67 * 93 * Parses the EDID to obtain the new CEC physi 68 * Parses the EDID to obtain the new CEC physical address and set it. 94 * Does nothing if @n == NULL. << 95 */ 69 */ 96 void cec_notifier_set_phys_addr_from_edid(stru 70 void cec_notifier_set_phys_addr_from_edid(struct cec_notifier *n, 97 cons 71 const struct edid *edid); 98 72 99 /** 73 /** 100 * cec_notifier_parse_hdmi_phandle - find the !! 74 * cec_notifier_register - register a callback with the notifier 101 * @dev: the device with the "hdmi-phandle" de !! 75 * @n: the CEC notifier 102 * !! 76 * @adap: the CEC adapter, passed as argument to the callback function 103 * Returns the device pointer referenced by th !! 77 * @callback: the callback function 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 */ 78 */ 108 struct device *cec_notifier_parse_hdmi_phandle !! 79 void cec_notifier_register(struct cec_notifier *n, >> 80 struct cec_adapter *adap, >> 81 void (*callback)(struct cec_adapter *adap, u16 pa)); 109 82 110 #else !! 83 /** 111 !! 84 * cec_notifier_unregister - unregister the callback from the notifier. 112 static inline struct cec_notifier * !! 85 * @n: the CEC notifier 113 cec_notifier_conn_register(struct device *hdmi !! 86 */ 114 const struct cec_co !! 87 void cec_notifier_unregister(struct cec_notifier *n); 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 88 124 static inline struct cec_notifier * !! 89 #else 125 cec_notifier_cec_adap_register(struct device * !! 90 static inline struct cec_notifier *cec_notifier_get(struct device *dev) 126 struct cec_adap << 127 { 91 { 128 /* A non-NULL pointer is expected on s 92 /* A non-NULL pointer is expected on success */ 129 return (struct cec_notifier *)0xdeadfe 93 return (struct cec_notifier *)0xdeadfeed; 130 } 94 } 131 95 132 static inline void cec_notifier_cec_adap_unreg !! 96 static inline void cec_notifier_put(struct cec_notifier *n) 133 << 134 { 97 { 135 } 98 } 136 99 137 static inline void cec_notifier_set_phys_addr( 100 static inline void cec_notifier_set_phys_addr(struct cec_notifier *n, u16 pa) 138 { 101 { 139 } 102 } 140 103 141 static inline void cec_notifier_set_phys_addr_ 104 static inline void cec_notifier_set_phys_addr_from_edid(struct cec_notifier *n, 142 105 const struct edid *edid) 143 { 106 { 144 } 107 } 145 108 146 static inline struct device *cec_notifier_pars !! 109 static inline void cec_notifier_register(struct cec_notifier *n, >> 110 struct cec_adapter *adap, >> 111 void (*callback)(struct cec_adapter *adap, u16 pa)) 147 { 112 { 148 return ERR_PTR(-ENODEV); << 149 } 113 } 150 114 151 #endif !! 115 static inline void cec_notifier_unregister(struct cec_notifier *n) 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 { 116 { 163 cec_notifier_set_phys_addr(n, CEC_PHYS << 164 } 117 } >> 118 >> 119 #endif 165 120 166 #endif 121 #endif 167 122
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.