hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Designware HDMI CEC driver
34 *
45 * Copyright (C) 2015-2017 Russell King.
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
96 */
107 #include <linux/input.h>
118 #include <linux/interrupt.h>
....@@ -17,6 +14,7 @@
1714 #include <linux/slab.h>
1815
1916 #include <drm/drm_edid.h>
17
+#include <drm/bridge/dw_hdmi.h>
2018
2119 #include <media/cec.h>
2220 #include <media/cec-notifier.h>
....@@ -397,7 +395,7 @@
397395 .owner = THIS_MODULE,
398396 };
399397
400
-void dw_hdmi_hpd_wake_up(struct platform_device *pdev)
398
+static void dw_hdmi_cec_hpd_wake_up(struct platform_device *pdev)
401399 {
402400 struct dw_hdmi_cec *cec = platform_get_drvdata(pdev);
403401
....@@ -417,7 +415,10 @@
417415 input_sync(cec->devinput);
418416 mutex_unlock(&cec->wake_lock);
419417 }
420
-EXPORT_SYMBOL_GPL(dw_hdmi_hpd_wake_up);
418
+
419
+static const struct dw_hdmi_cec_wake_ops cec_ops = {
420
+ .hpd_wake_up = dw_hdmi_cec_hpd_wake_up,
421
+};
421422
422423 static int dw_hdmi_cec_probe(struct platform_device *pdev)
423424 {
....@@ -453,11 +454,13 @@
453454 dw_hdmi_write(cec, 0, HDMI_CEC_POLARITY);
454455
455456 cec->adap = cec_allocate_adapter(&dw_hdmi_cec_ops, cec, "dw_hdmi",
456
- CEC_CAP_LOG_ADDRS | CEC_CAP_TRANSMIT |
457
- CEC_CAP_RC | CEC_CAP_PASSTHROUGH,
457
+ CEC_CAP_DEFAULTS |
458
+ CEC_CAP_CONNECTOR_INFO,
458459 CEC_MAX_LOG_ADDRS);
459460 if (IS_ERR(cec->adap))
460461 return PTR_ERR(cec->adap);
462
+
463
+ dw_hdmi_set_cec_adap(cec->hdmi, cec->adap);
461464
462465 /* override the module pointer */
463466 cec->adap->owner = THIS_MODULE;
....@@ -491,13 +494,14 @@
491494 enable_irq_wake(cec->wake_irq);
492495 }
493496
494
- cec->notify = cec_notifier_get(pdev->dev.parent);
497
+ cec->notify = cec_notifier_cec_adap_register(pdev->dev.parent,
498
+ NULL, cec->adap);
495499 if (!cec->notify)
496500 return -ENOMEM;
497501
498502 ret = cec_register_adapter(cec->adap, pdev->dev.parent);
499503 if (ret < 0) {
500
- cec_notifier_put(cec->notify);
504
+ cec_notifier_cec_adap_unregister(cec->notify, cec->adap);
501505 return ret;
502506 }
503507
....@@ -507,7 +511,6 @@
507511 */
508512 devm_remove_action(&pdev->dev, dw_hdmi_cec_del, cec);
509513
510
- cec_register_cec_notifier(cec->adap, cec->notify);
511514 rockchip_hdmi_cec_input_init(cec);
512515
513516 cec->misc_dev.name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "rk_cec");
....@@ -519,6 +522,8 @@
519522
520523 ret = misc_register(&cec->misc_dev);
521524
525
+ dw_hdmi_cec_wake_ops_register(cec->hdmi, &cec_ops);
526
+
522527 return ret;
523528 }
524529
....@@ -526,8 +531,8 @@
526531 {
527532 struct dw_hdmi_cec *cec = platform_get_drvdata(pdev);
528533
534
+ cec_notifier_cec_adap_unregister(cec->notify, cec->adap);
529535 cec_unregister_adapter(cec->adap);
530
- cec_notifier_put(cec->notify);
531536 misc_deregister(&cec->misc_dev);
532537
533538 return 0;