dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Hyungwon Hwang <hyungwon.hwang7@gmail.com>
To: alexander.deucher@amd.com, christian.koenig@amd.com,
	dri-devel@lists.freedesktop.org
Subject: radeon_connector->audio is set by RADEON_AUDIO_DISABLE as default.
Date: Thu, 14 Apr 2016 00:54:31 +0900	[thread overview]
Message-ID: <570E6BB7.4060401@gmail.com> (raw)

Dear all,

I switched my desktop environment to GNOME wayland recently, and I found
that no sound in this environment. In X desktop environment, the ioctl
DRM_IOCTL_MODE_SETPROPERTY(I confused it with
DRM_IOCTL_MODE_OBJ_SETPROPERTY - I deleted the log already :( ) is
called by userspace and it makes the sound works. But in Gnome wayland
desktop environment, the ioctl is not called. I tried to fixed it, and
found that it is because radeon_connector->audio is set by
RADEON_AUDIO_DISABLE.

In atombios_encoders.c, atombios_get_encoder_mode()
if (radeon_connector->audio == RADEON_AUDIO_ENABLE)
        return ATOM_ENCODER_MODE_HDMI;
else if (drm_detect_hdmi_monitor(radeon_connector_edid(connector)) &&
         (radeon_connector->audio == RADEON_AUDIO_AUTO))
        return ATOM_ENCODER_MODE_HDMI;
else
        return ATOM_ENCODER_MODE_DVI;

This code returns ATOM_ENCODER_MODE_DVI.

In atombios_encoders.c, radeon_atom_encoder_mode_set():
encoder_mode = atombios_get_encoder_mode(encoder);

if (connector && (radeon_audio != 0) &&

    ((encoder_mode == ATOM_ENCODER_MODE_HDMI) ||

     ENCODER_MODE_IS_DP(encoder_mode)))

        radeon_audio_mode_set(encoder, adjusted_mode);b

So this code bypasses the calling of radeon_audio_mode_set().

I think that radeon_connector->audio should be set  by
RADEON_AUDIO_AUTO, at least for connectors which can output audio. I
fixed the code like below, and it works for me. But I am not familiar
with radeon DRM driver, and can't see the big picture. Can you review
this code?

Thanks,
Hyungwon Hwang

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c
b/drivers/gpu/drm/radeon/radeon_connectors.c
index cfcc099..cf52ea5 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -1975,11 +1975,12 @@ radeon_add_atom_connector(struct drm_device *dev,

rdev->mode_info.output_csc_property,

RADEON_OUTPUT_CSC_BYPASS);
                        break;
-               case DRM_MODE_CONNECTOR_DVII:
-               case DRM_MODE_CONNECTOR_DVID:
                case DRM_MODE_CONNECTOR_HDMIA:
                case DRM_MODE_CONNECTOR_HDMIB:
                case DRM_MODE_CONNECTOR_DisplayPort:
+                       radeon_connector->audio = RADEON_AUDIO_AUTO;
+               case DRM_MODE_CONNECTOR_DVII:
+               case DRM_MODE_CONNECTOR_DVID:
                        drm_connector_init(dev, &radeon_connector->base,
                                           &radeon_dp_connector_funcs,
connector_type);
                        drm_connector_helper_add(&radeon_connector->base,
@@ -2024,8 +2025,9 @@ radeon_add_atom_connector(struct drm_device *dev,
                                                              1);
                        }
                        break;
-               case DRM_MODE_CONNECTOR_LVDS:
                case DRM_MODE_CONNECTOR_eDP:
+                       radeon_connector->audio = RADEON_AUDIO_AUTO;
+               case DRM_MODE_CONNECTOR_LVDS:
                        drm_connector_init(dev, &radeon_connector->base,

&radeon_lvds_bridge_connector_funcs, connector_type);
                        drm_connector_helper_add(&radeon_connector->base,
@@ -2196,6 +2198,7 @@ radeon_add_atom_connector(struct drm_device *dev,
                                connector->doublescan_allowed = true;
                        else
                                connector->doublescan_allowed = false;
+                       radeon_connector->audio = RADEON_AUDIO_AUTO;
                        break;
                case DRM_MODE_CONNECTOR_DisplayPort:
                        radeon_dig_connector = kzalloc(sizeof(struct
radeon_connector_atom_dig), GFP_KERNEL);
@@ -2245,6 +2248,7 @@ radeon_add_atom_connector(struct drm_device *dev,
                        connector->interlace_allowed = true;
                        /* in theory with a DP to VGA converter... */
                        connector->doublescan_allowed = false;
+                       radeon_connector->audio = RADEON_AUDIO_AUTO;
                        break;
                case DRM_MODE_CONNECTOR_eDP:
                        radeon_dig_connector = kzalloc(sizeof(struct
radeon_connector_atom_dig), GFP_KERNEL);
@@ -2267,6 +2271,7 @@ radeon_add_atom_connector(struct drm_device *dev,
                        subpixel_order = SubPixelHorizontalRGB;
                        connector->interlace_allowed = false;
                        connector->doublescan_allowed = false;
+                       radeon_connector->audio = RADEON_AUDIO_AUTO;
                        break;
                case DRM_MODE_CONNECTOR_SVIDEO:
                case DRM_MODE_CONNECTOR_Composite:
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2016-04-13 15:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13 15:54 Hyungwon Hwang [this message]
2016-04-13 16:12 ` radeon_connector->audio is set by RADEON_AUDIO_DISABLE as default Deucher, Alexander
2016-04-14  2:59   ` Hyungwon Hwang
2016-04-14  3:03     ` Hyungwon Hwang
2016-04-14 14:02   ` Hyungwon Hwang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=570E6BB7.4060401@gmail.com \
    --to=hyungwon.hwang7@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox