.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Designware HDMI CEC driver |
---|
3 | 4 | * |
---|
4 | 5 | * 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. |
---|
9 | 6 | */ |
---|
10 | 7 | #include <linux/input.h> |
---|
11 | 8 | #include <linux/interrupt.h> |
---|
.. | .. |
---|
17 | 14 | #include <linux/slab.h> |
---|
18 | 15 | |
---|
19 | 16 | #include <drm/drm_edid.h> |
---|
| 17 | +#include <drm/bridge/dw_hdmi.h> |
---|
20 | 18 | |
---|
21 | 19 | #include <media/cec.h> |
---|
22 | 20 | #include <media/cec-notifier.h> |
---|
.. | .. |
---|
397 | 395 | .owner = THIS_MODULE, |
---|
398 | 396 | }; |
---|
399 | 397 | |
---|
400 | | -void dw_hdmi_hpd_wake_up(struct platform_device *pdev) |
---|
| 398 | +static void dw_hdmi_cec_hpd_wake_up(struct platform_device *pdev) |
---|
401 | 399 | { |
---|
402 | 400 | struct dw_hdmi_cec *cec = platform_get_drvdata(pdev); |
---|
403 | 401 | |
---|
.. | .. |
---|
417 | 415 | input_sync(cec->devinput); |
---|
418 | 416 | mutex_unlock(&cec->wake_lock); |
---|
419 | 417 | } |
---|
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 | +}; |
---|
421 | 422 | |
---|
422 | 423 | static int dw_hdmi_cec_probe(struct platform_device *pdev) |
---|
423 | 424 | { |
---|
.. | .. |
---|
453 | 454 | dw_hdmi_write(cec, 0, HDMI_CEC_POLARITY); |
---|
454 | 455 | |
---|
455 | 456 | 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, |
---|
458 | 459 | CEC_MAX_LOG_ADDRS); |
---|
459 | 460 | if (IS_ERR(cec->adap)) |
---|
460 | 461 | return PTR_ERR(cec->adap); |
---|
| 462 | + |
---|
| 463 | + dw_hdmi_set_cec_adap(cec->hdmi, cec->adap); |
---|
461 | 464 | |
---|
462 | 465 | /* override the module pointer */ |
---|
463 | 466 | cec->adap->owner = THIS_MODULE; |
---|
.. | .. |
---|
491 | 494 | enable_irq_wake(cec->wake_irq); |
---|
492 | 495 | } |
---|
493 | 496 | |
---|
494 | | - cec->notify = cec_notifier_get(pdev->dev.parent); |
---|
| 497 | + cec->notify = cec_notifier_cec_adap_register(pdev->dev.parent, |
---|
| 498 | + NULL, cec->adap); |
---|
495 | 499 | if (!cec->notify) |
---|
496 | 500 | return -ENOMEM; |
---|
497 | 501 | |
---|
498 | 502 | ret = cec_register_adapter(cec->adap, pdev->dev.parent); |
---|
499 | 503 | if (ret < 0) { |
---|
500 | | - cec_notifier_put(cec->notify); |
---|
| 504 | + cec_notifier_cec_adap_unregister(cec->notify, cec->adap); |
---|
501 | 505 | return ret; |
---|
502 | 506 | } |
---|
503 | 507 | |
---|
.. | .. |
---|
507 | 511 | */ |
---|
508 | 512 | devm_remove_action(&pdev->dev, dw_hdmi_cec_del, cec); |
---|
509 | 513 | |
---|
510 | | - cec_register_cec_notifier(cec->adap, cec->notify); |
---|
511 | 514 | rockchip_hdmi_cec_input_init(cec); |
---|
512 | 515 | |
---|
513 | 516 | cec->misc_dev.name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "rk_cec"); |
---|
.. | .. |
---|
519 | 522 | |
---|
520 | 523 | ret = misc_register(&cec->misc_dev); |
---|
521 | 524 | |
---|
| 525 | + dw_hdmi_cec_wake_ops_register(cec->hdmi, &cec_ops); |
---|
| 526 | + |
---|
522 | 527 | return ret; |
---|
523 | 528 | } |
---|
524 | 529 | |
---|
.. | .. |
---|
526 | 531 | { |
---|
527 | 532 | struct dw_hdmi_cec *cec = platform_get_drvdata(pdev); |
---|
528 | 533 | |
---|
| 534 | + cec_notifier_cec_adap_unregister(cec->notify, cec->adap); |
---|
529 | 535 | cec_unregister_adapter(cec->adap); |
---|
530 | | - cec_notifier_put(cec->notify); |
---|
531 | 536 | misc_deregister(&cec->misc_dev); |
---|
532 | 537 | |
---|
533 | 538 | return 0; |
---|