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

Configure Feed

Select the types of activity you want to include in your feed.

drm/bridge: split HDMI Audio from DRM_BRIDGE_OP_HDMI

As pointed out by Laurent, OP bits are supposed to describe operations.
Split DRM_BRIDGE_OP_HDMI_AUDIO from DRM_BRIDGE_OP_HDMI instead of
overloading DRM_BRIDGE_OP_HDMI.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/r/20250314-dp-hdmi-audio-v6-1-dbd228fa73d7@oss.qualcomm.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

+76 -33
+1 -1
drivers/gpu/drm/bridge/lontium-lt9611.c
··· 1131 1131 lt9611->bridge.of_node = client->dev.of_node; 1132 1132 lt9611->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID | 1133 1133 DRM_BRIDGE_OP_HPD | DRM_BRIDGE_OP_MODES | 1134 - DRM_BRIDGE_OP_HDMI; 1134 + DRM_BRIDGE_OP_HDMI | DRM_BRIDGE_OP_HDMI_AUDIO; 1135 1135 lt9611->bridge.type = DRM_MODE_CONNECTOR_HDMIA; 1136 1136 lt9611->bridge.vendor = "Lontium"; 1137 1137 lt9611->bridge.product = "LT9611";
+1
drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
··· 1077 1077 hdmi->bridge.ops = DRM_BRIDGE_OP_DETECT | 1078 1078 DRM_BRIDGE_OP_EDID | 1079 1079 DRM_BRIDGE_OP_HDMI | 1080 + DRM_BRIDGE_OP_HDMI_AUDIO | 1080 1081 DRM_BRIDGE_OP_HPD; 1081 1082 hdmi->bridge.of_node = pdev->dev.of_node; 1082 1083 hdmi->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
+39 -20
drivers/gpu/drm/display/drm_bridge_connector.c
··· 98 98 * HDMI connector infrastructure, if any (see &DRM_BRIDGE_OP_HDMI). 99 99 */ 100 100 struct drm_bridge *bridge_hdmi; 101 + /** 102 + * @bridge_hdmi_audio: 103 + * 104 + * The bridge in the chain that implements necessary support for the 105 + * HDMI Audio infrastructure, if any (see &DRM_BRIDGE_OP_HDMI_AUDIO). 106 + */ 107 + struct drm_bridge *bridge_hdmi_audio; 101 108 }; 102 109 103 110 #define to_drm_bridge_connector(x) \ ··· 440 433 to_drm_bridge_connector(connector); 441 434 struct drm_bridge *bridge; 442 435 443 - bridge = bridge_connector->bridge_hdmi; 436 + bridge = bridge_connector->bridge_hdmi_audio; 444 437 if (!bridge) 445 438 return -EINVAL; 446 439 ··· 458 451 to_drm_bridge_connector(connector); 459 452 struct drm_bridge *bridge; 460 453 461 - bridge = bridge_connector->bridge_hdmi; 454 + bridge = bridge_connector->bridge_hdmi_audio; 462 455 if (!bridge) 463 456 return -EINVAL; 464 457 ··· 471 464 to_drm_bridge_connector(connector); 472 465 struct drm_bridge *bridge; 473 466 474 - bridge = bridge_connector->bridge_hdmi; 467 + bridge = bridge_connector->bridge_hdmi_audio; 475 468 if (!bridge) 476 469 return; 477 470 ··· 485 478 to_drm_bridge_connector(connector); 486 479 struct drm_bridge *bridge; 487 480 488 - bridge = bridge_connector->bridge_hdmi; 481 + bridge = bridge_connector->bridge_hdmi_audio; 489 482 if (!bridge) 490 483 return -EINVAL; 491 484 ··· 583 576 max_bpc = bridge->max_bpc; 584 577 } 585 578 579 + if (bridge->ops & DRM_BRIDGE_OP_HDMI_AUDIO) { 580 + if (bridge_connector->bridge_hdmi_audio) 581 + return ERR_PTR(-EBUSY); 582 + 583 + if (!bridge->hdmi_audio_max_i2s_playback_channels && 584 + !bridge->hdmi_audio_spdif_playback) 585 + return ERR_PTR(-EINVAL); 586 + 587 + if (!bridge->funcs->hdmi_audio_prepare || 588 + !bridge->funcs->hdmi_audio_shutdown) 589 + return ERR_PTR(-EINVAL); 590 + 591 + bridge_connector->bridge_hdmi_audio = bridge; 592 + } 593 + 586 594 if (!drm_bridge_get_next_bridge(bridge)) 587 595 connector_type = bridge->type; 588 596 ··· 633 611 max_bpc); 634 612 if (ret) 635 613 return ERR_PTR(ret); 636 - 637 - if (bridge->hdmi_audio_max_i2s_playback_channels || 638 - bridge->hdmi_audio_spdif_playback) { 639 - if (!bridge->funcs->hdmi_audio_prepare || 640 - !bridge->funcs->hdmi_audio_shutdown) 641 - return ERR_PTR(-EINVAL); 642 - 643 - ret = drm_connector_hdmi_audio_init(connector, 644 - bridge->hdmi_audio_dev, 645 - &drm_bridge_connector_hdmi_audio_funcs, 646 - bridge->hdmi_audio_max_i2s_playback_channels, 647 - bridge->hdmi_audio_spdif_playback, 648 - bridge->hdmi_audio_dai_port); 649 - if (ret) 650 - return ERR_PTR(ret); 651 - } 652 614 } else { 653 615 ret = drmm_connector_init(drm, connector, 654 616 &drm_bridge_connector_funcs, 655 617 connector_type, ddc); 618 + if (ret) 619 + return ERR_PTR(ret); 620 + } 621 + 622 + if (bridge_connector->bridge_hdmi_audio) { 623 + bridge = bridge_connector->bridge_hdmi_audio; 624 + 625 + ret = drm_connector_hdmi_audio_init(connector, 626 + bridge->hdmi_audio_dev, 627 + &drm_bridge_connector_hdmi_audio_funcs, 628 + bridge->hdmi_audio_max_i2s_playback_channels, 629 + bridge->hdmi_audio_spdif_playback, 630 + bridge->hdmi_audio_dai_port); 656 631 if (ret) 657 632 return ERR_PTR(ret); 658 633 }
+1
drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
··· 515 515 bridge->ops = DRM_BRIDGE_OP_HPD | 516 516 DRM_BRIDGE_OP_DETECT | 517 517 DRM_BRIDGE_OP_HDMI | 518 + DRM_BRIDGE_OP_HDMI_AUDIO | 518 519 DRM_BRIDGE_OP_EDID; 519 520 bridge->hdmi_audio_max_i2s_playback_channels = 8; 520 521 bridge->hdmi_audio_dev = &hdmi->pdev->dev;
+34 -12
include/drm/drm_bridge.h
··· 681 681 /** 682 682 * @hdmi_audio_startup: 683 683 * 684 - * Called when ASoC starts an audio stream setup. The 685 - * @hdmi_audio_startup() is optional. 684 + * Called when ASoC starts an audio stream setup. 685 + * 686 + * This callback is optional, it can be implemented by bridges that 687 + * set the @DRM_BRIDGE_OP_HDMI_AUDIO flag in their &drm_bridge->ops. 686 688 * 687 689 * Returns: 688 690 * 0 on success, a negative error code otherwise ··· 695 693 /** 696 694 * @hdmi_audio_prepare: 697 695 * Configures HDMI-encoder for audio stream. Can be called multiple 698 - * times for each setup. Mandatory if HDMI audio is enabled in the 699 - * bridge's configuration. 696 + * times for each setup. 697 + * 698 + * This callback is optional but it must be implemented by bridges that 699 + * set the @DRM_BRIDGE_OP_HDMI_AUDIO flag in their &drm_bridge->ops. 700 700 * 701 701 * Returns: 702 702 * 0 on success, a negative error code otherwise ··· 711 707 /** 712 708 * @hdmi_audio_shutdown: 713 709 * 714 - * Shut down the audio stream. Mandatory if HDMI audio is enabled in 715 - * the bridge's configuration. 710 + * Shut down the audio stream. 711 + * 712 + * This callback is optional but it must be implemented by bridges that 713 + * set the @DRM_BRIDGE_OP_HDMI_AUDIO flag in their &drm_bridge->ops. 716 714 * 717 715 * Returns: 718 716 * 0 on success, a negative error code otherwise ··· 725 719 /** 726 720 * @hdmi_audio_mute_stream: 727 721 * 728 - * Mute/unmute HDMI audio stream. The @hdmi_audio_mute_stream callback 729 - * is optional. 722 + * Mute/unmute HDMI audio stream. 723 + * 724 + * This callback is optional, it can be implemented by bridges that 725 + * set the @DRM_BRIDGE_OP_HDMI_AUDIO flag in their &drm_bridge->ops. 730 726 * 731 727 * Returns: 732 728 * 0 on success, a negative error code otherwise ··· 822 814 * drivers. 823 815 */ 824 816 DRM_BRIDGE_OP_HDMI = BIT(4), 817 + /** 818 + * @DRM_BRIDGE_OP_HDMI_AUDIO: The bridge provides HDMI audio operations. 819 + * Bridges that set this flag must implement the 820 + * &drm_bridge_funcs->hdmi_audio_prepare and 821 + * &drm_bridge_funcs->hdmi_audio_shutdown callbacks. 822 + * 823 + * Note: currently there can be at most one bridge in a chain that sets 824 + * this bit. This is to simplify corresponding glue code in connector 825 + * drivers. 826 + */ 827 + DRM_BRIDGE_OP_HDMI_AUDIO = BIT(5), 825 828 }; 826 829 827 830 /** ··· 945 926 unsigned int max_bpc; 946 927 947 928 /** 948 - * @hdmi_audio_dev: device to be used as a parent for the HDMI Codec 929 + * @hdmi_audio_dev: device to be used as a parent for the HDMI Codec if 930 + * @DRM_BRIDGE_OP_HDMI_AUDIO is set. 949 931 */ 950 932 struct device *hdmi_audio_dev; 951 933 952 934 /** 953 935 * @hdmi_audio_max_i2s_playback_channels: maximum number of playback 954 - * I2S channels for the HDMI codec 936 + * I2S channels for the bridge that sets @DRM_BRIDGE_OP_HDMI_AUDIO. 955 937 */ 956 938 int hdmi_audio_max_i2s_playback_channels; 957 939 958 940 /** 959 - * @hdmi_audio_spdif_playback: set if HDMI codec has S/PDIF playback port 941 + * @hdmi_audio_spdif_playback: set if this bridge has S/PDIF playback 942 + * port for @DRM_BRIDGE_OP_HDMI_AUDIO 960 943 */ 961 944 unsigned int hdmi_audio_spdif_playback : 1; 962 945 963 946 /** 964 - * @hdmi_audio_dai_port: sound DAI port, -1 if it is not enabled 947 + * @hdmi_audio_dai_port: sound DAI port for @DRM_BRIDGE_OP_HDMI_AUDIO, 948 + * -1 if it is not used. 965 949 */ 966 950 int hdmi_audio_dai_port; 967 951 };