mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-18 16:44:27 +08:00
drm/radeon: rework audio option
In 3.12 I changed audio to be enabled by default, but you still had to turn it on via xrandr. This was confusing to users so change it to minic the previous behavior: - audio option is set to -1 (auto) by default which is the current 3.12 behavior (audio is enabled but requires xrandr to turn it on). - if audio = 1, the audio is enabled without needing to mess with xrandr (previous behavior) - audio = 0 disables audio It retains the new feature of allowing the user to enable audio on the fly with xrandr, but turns audio on automatically if radeon.audio=1 is set which is what most users expect. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com>
This commit is contained in:
parent
4b7495770c
commit
108dc8e8b4
@ -707,24 +707,37 @@ atombios_get_encoder_mode(struct drm_encoder *encoder)
|
||||
switch (connector->connector_type) {
|
||||
case DRM_MODE_CONNECTOR_DVII:
|
||||
case DRM_MODE_CONNECTOR_HDMIB: /* HDMI-B is basically DL-DVI; analog works fine */
|
||||
if ((radeon_connector->audio == RADEON_AUDIO_ENABLE) ||
|
||||
(drm_detect_hdmi_monitor(radeon_connector->edid) &&
|
||||
(radeon_connector->audio == RADEON_AUDIO_AUTO)))
|
||||
return ATOM_ENCODER_MODE_HDMI;
|
||||
else if (radeon_connector->use_digital)
|
||||
if (radeon_audio != 0) {
|
||||
if (radeon_connector->use_digital &&
|
||||
(radeon_connector->audio == RADEON_AUDIO_ENABLE))
|
||||
return ATOM_ENCODER_MODE_HDMI;
|
||||
else if (drm_detect_hdmi_monitor(radeon_connector->edid) &&
|
||||
(radeon_connector->audio == RADEON_AUDIO_AUTO))
|
||||
return ATOM_ENCODER_MODE_HDMI;
|
||||
else if (radeon_connector->use_digital)
|
||||
return ATOM_ENCODER_MODE_DVI;
|
||||
else
|
||||
return ATOM_ENCODER_MODE_CRT;
|
||||
} else if (radeon_connector->use_digital) {
|
||||
return ATOM_ENCODER_MODE_DVI;
|
||||
else
|
||||
} else {
|
||||
return ATOM_ENCODER_MODE_CRT;
|
||||
}
|
||||
break;
|
||||
case DRM_MODE_CONNECTOR_DVID:
|
||||
case DRM_MODE_CONNECTOR_HDMIA:
|
||||
default:
|
||||
if ((radeon_connector->audio == RADEON_AUDIO_ENABLE) ||
|
||||
(drm_detect_hdmi_monitor(radeon_connector->edid) &&
|
||||
(radeon_connector->audio == RADEON_AUDIO_AUTO)))
|
||||
return ATOM_ENCODER_MODE_HDMI;
|
||||
else
|
||||
if (radeon_audio != 0) {
|
||||
if (radeon_connector->audio == RADEON_AUDIO_ENABLE)
|
||||
return ATOM_ENCODER_MODE_HDMI;
|
||||
else if (drm_detect_hdmi_monitor(radeon_connector->edid) &&
|
||||
(radeon_connector->audio == RADEON_AUDIO_AUTO))
|
||||
return ATOM_ENCODER_MODE_HDMI;
|
||||
else
|
||||
return ATOM_ENCODER_MODE_DVI;
|
||||
} else {
|
||||
return ATOM_ENCODER_MODE_DVI;
|
||||
}
|
||||
break;
|
||||
case DRM_MODE_CONNECTOR_LVDS:
|
||||
return ATOM_ENCODER_MODE_LVDS;
|
||||
@ -732,14 +745,19 @@ atombios_get_encoder_mode(struct drm_encoder *encoder)
|
||||
case DRM_MODE_CONNECTOR_DisplayPort:
|
||||
dig_connector = radeon_connector->con_priv;
|
||||
if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) ||
|
||||
(dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP))
|
||||
(dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) {
|
||||
return ATOM_ENCODER_MODE_DP;
|
||||
else if ((radeon_connector->audio == RADEON_AUDIO_ENABLE) ||
|
||||
(drm_detect_hdmi_monitor(radeon_connector->edid) &&
|
||||
(radeon_connector->audio == RADEON_AUDIO_AUTO)))
|
||||
return ATOM_ENCODER_MODE_HDMI;
|
||||
else
|
||||
} else if (radeon_audio != 0) {
|
||||
if (radeon_connector->audio == RADEON_AUDIO_ENABLE)
|
||||
return ATOM_ENCODER_MODE_HDMI;
|
||||
else if (drm_detect_hdmi_monitor(radeon_connector->edid) &&
|
||||
(radeon_connector->audio == RADEON_AUDIO_AUTO))
|
||||
return ATOM_ENCODER_MODE_HDMI;
|
||||
else
|
||||
return ATOM_ENCODER_MODE_DVI;
|
||||
} else {
|
||||
return ATOM_ENCODER_MODE_DVI;
|
||||
}
|
||||
break;
|
||||
case DRM_MODE_CONNECTOR_eDP:
|
||||
return ATOM_ENCODER_MODE_DP;
|
||||
|
@ -1658,9 +1658,12 @@ radeon_add_atom_connector(struct drm_device *dev,
|
||||
drm_object_attach_property(&radeon_connector->base.base,
|
||||
rdev->mode_info.underscan_vborder_property,
|
||||
0);
|
||||
drm_object_attach_property(&radeon_connector->base.base,
|
||||
rdev->mode_info.audio_property,
|
||||
RADEON_AUDIO_DISABLE);
|
||||
if (radeon_audio != 0)
|
||||
drm_object_attach_property(&radeon_connector->base.base,
|
||||
rdev->mode_info.audio_property,
|
||||
(radeon_audio == 1) ?
|
||||
RADEON_AUDIO_AUTO :
|
||||
RADEON_AUDIO_DISABLE);
|
||||
subpixel_order = SubPixelHorizontalRGB;
|
||||
connector->interlace_allowed = true;
|
||||
if (connector_type == DRM_MODE_CONNECTOR_HDMIB)
|
||||
@ -1754,10 +1757,12 @@ radeon_add_atom_connector(struct drm_device *dev,
|
||||
rdev->mode_info.underscan_vborder_property,
|
||||
0);
|
||||
}
|
||||
if (ASIC_IS_DCE2(rdev)) {
|
||||
if (ASIC_IS_DCE2(rdev) && (radeon_audio != 0)) {
|
||||
drm_object_attach_property(&radeon_connector->base.base,
|
||||
rdev->mode_info.audio_property,
|
||||
RADEON_AUDIO_DISABLE);
|
||||
rdev->mode_info.audio_property,
|
||||
(radeon_audio == 1) ?
|
||||
RADEON_AUDIO_AUTO :
|
||||
RADEON_AUDIO_DISABLE);
|
||||
}
|
||||
if (connector_type == DRM_MODE_CONNECTOR_DVII) {
|
||||
radeon_connector->dac_load_detect = true;
|
||||
@ -1799,10 +1804,12 @@ radeon_add_atom_connector(struct drm_device *dev,
|
||||
rdev->mode_info.underscan_vborder_property,
|
||||
0);
|
||||
}
|
||||
if (ASIC_IS_DCE2(rdev)) {
|
||||
if (ASIC_IS_DCE2(rdev) && (radeon_audio != 0)) {
|
||||
drm_object_attach_property(&radeon_connector->base.base,
|
||||
rdev->mode_info.audio_property,
|
||||
RADEON_AUDIO_DISABLE);
|
||||
rdev->mode_info.audio_property,
|
||||
(radeon_audio == 1) ?
|
||||
RADEON_AUDIO_AUTO :
|
||||
RADEON_AUDIO_DISABLE);
|
||||
}
|
||||
subpixel_order = SubPixelHorizontalRGB;
|
||||
connector->interlace_allowed = true;
|
||||
@ -1843,10 +1850,12 @@ radeon_add_atom_connector(struct drm_device *dev,
|
||||
rdev->mode_info.underscan_vborder_property,
|
||||
0);
|
||||
}
|
||||
if (ASIC_IS_DCE2(rdev)) {
|
||||
if (ASIC_IS_DCE2(rdev) && (radeon_audio != 0)) {
|
||||
drm_object_attach_property(&radeon_connector->base.base,
|
||||
rdev->mode_info.audio_property,
|
||||
RADEON_AUDIO_DISABLE);
|
||||
rdev->mode_info.audio_property,
|
||||
(radeon_audio == 1) ?
|
||||
RADEON_AUDIO_AUTO :
|
||||
RADEON_AUDIO_DISABLE);
|
||||
}
|
||||
connector->interlace_allowed = true;
|
||||
/* in theory with a DP to VGA converter... */
|
||||
|
@ -153,7 +153,7 @@ int radeon_benchmarking = 0;
|
||||
int radeon_testing = 0;
|
||||
int radeon_connector_table = 0;
|
||||
int radeon_tv = 1;
|
||||
int radeon_audio = 1;
|
||||
int radeon_audio = -1;
|
||||
int radeon_disp_priority = 0;
|
||||
int radeon_hw_i2c = 0;
|
||||
int radeon_pcie_gen2 = -1;
|
||||
@ -196,7 +196,7 @@ module_param_named(connector_table, radeon_connector_table, int, 0444);
|
||||
MODULE_PARM_DESC(tv, "TV enable (0 = disable)");
|
||||
module_param_named(tv, radeon_tv, int, 0444);
|
||||
|
||||
MODULE_PARM_DESC(audio, "Audio enable (1 = enable)");
|
||||
MODULE_PARM_DESC(audio, "Audio enable (-1 = auto, 0 = disable, 1 = enable)");
|
||||
module_param_named(audio, radeon_audio, int, 0444);
|
||||
|
||||
MODULE_PARM_DESC(disp_priority, "Display Priority (0 = auto, 1 = normal, 2 = high)");
|
||||
|
Loading…
Reference in New Issue
Block a user