Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] cec: integrate CEC notifier support

Support the CEC notifier framework, simplifying drivers that
depend on this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
e3a93adc 6917a7b7

+32
+22
drivers/media/cec/cec-core.c
··· 195 195 put_device(&devnode->dev); 196 196 } 197 197 198 + #ifdef CONFIG_MEDIA_CEC_NOTIFIER 199 + static void cec_cec_notify(struct cec_adapter *adap, u16 pa) 200 + { 201 + cec_s_phys_addr(adap, pa, false); 202 + } 203 + 204 + void cec_register_cec_notifier(struct cec_adapter *adap, 205 + struct cec_notifier *notifier) 206 + { 207 + if (WARN_ON(!adap->devnode.registered)) 208 + return; 209 + 210 + adap->notifier = notifier; 211 + cec_notifier_register(adap->notifier, adap, cec_cec_notify); 212 + } 213 + EXPORT_SYMBOL_GPL(cec_register_cec_notifier); 214 + #endif 215 + 198 216 struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, 199 217 void *priv, const char *name, u32 caps, 200 218 u8 available_las) ··· 361 343 adap->rc = NULL; 362 344 #endif 363 345 debugfs_remove_recursive(adap->cec_dir); 346 + #ifdef CONFIG_MEDIA_CEC_NOTIFIER 347 + if (adap->notifier) 348 + cec_notifier_unregister(adap->notifier); 349 + #endif 364 350 cec_devnode_unregister(&adap->devnode); 365 351 } 366 352 EXPORT_SYMBOL_GPL(cec_unregister_adapter);
+10
include/media/cec.h
··· 30 30 #include <linux/cec-funcs.h> 31 31 #include <media/rc-core.h> 32 32 #include <media/cec-edid.h> 33 + #include <media/cec-notifier.h> 33 34 34 35 /** 35 36 * struct cec_devnode - cec device node ··· 174 173 bool passthrough; 175 174 struct cec_log_addrs log_addrs; 176 175 176 + #ifdef CONFIG_MEDIA_CEC_NOTIFIER 177 + struct cec_notifier *notifier; 178 + #endif 179 + 177 180 struct dentry *cec_dir; 178 181 struct dentry *status_file; 179 182 ··· 222 217 void cec_transmit_done(struct cec_adapter *adap, u8 status, u8 arb_lost_cnt, 223 218 u8 nack_cnt, u8 low_drive_cnt, u8 error_cnt); 224 219 void cec_received_msg(struct cec_adapter *adap, struct cec_msg *msg); 220 + 221 + #ifdef CONFIG_MEDIA_CEC_NOTIFIER 222 + void cec_register_cec_notifier(struct cec_adapter *adap, 223 + struct cec_notifier *notifier); 224 + #endif 225 225 226 226 #else 227 227