Merge branch 'drm-fixes-4.16' of git://people.freedesktop.org/~agd5f/linux into drm-fixes

A few more fixes for 4.16.  Mostly for displays:
- A fix for DP handling on radeon
- Fix banding on eDP panels
- Fix HBR audio
- Fix for disabling VGA mode on Raven that leads to a corrupt or
  blank display on some platforms

* 'drm-fixes-4.16' of git://people.freedesktop.org/~agd5f/linux:
  drm/amd/display: Add one to EDID's audio channel count when passing to DC
  drm/amd/display: We shouldn't set format_default on plane as atomic driver
  drm/amd/display: Fix FMT truncation programming
  drm/amd/display: Allow truncation to 10 bits
  drm/amd/display: fix dereferencing possible ERR_PTR()
  drm/amd/display: Refine disable VGA
  drm/amdgpu: Use atomic function to disable crtcs with dc enabled
  drm/radeon: Don't turn off DP sink when disconnected
This commit is contained in:
Dave Airlie 2018-03-22 08:52:21 +10:00
commit 82269df3bb
7 changed files with 45 additions and 33 deletions

View File

@ -2063,9 +2063,12 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
DRM_INFO("amdgpu: finishing device.\n"); DRM_INFO("amdgpu: finishing device.\n");
adev->shutdown = true; adev->shutdown = true;
if (adev->mode_info.mode_config_initialized) if (adev->mode_info.mode_config_initialized){
drm_crtc_force_disable_all(adev->ddev); if (!amdgpu_device_has_dc_support(adev))
drm_crtc_force_disable_all(adev->ddev);
else
drm_atomic_helper_shutdown(adev->ddev);
}
amdgpu_ib_pool_fini(adev); amdgpu_ib_pool_fini(adev);
amdgpu_fence_driver_fini(adev); amdgpu_fence_driver_fini(adev);
amdgpu_fbdev_fini(adev); amdgpu_fbdev_fini(adev);

View File

@ -3134,8 +3134,6 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
switch (aplane->base.type) { switch (aplane->base.type) {
case DRM_PLANE_TYPE_PRIMARY: case DRM_PLANE_TYPE_PRIMARY:
aplane->base.format_default = true;
res = drm_universal_plane_init( res = drm_universal_plane_init(
dm->adev->ddev, dm->adev->ddev,
&aplane->base, &aplane->base,
@ -4794,6 +4792,9 @@ static int dm_atomic_check_plane_state_fb(struct drm_atomic_state *state,
return -EDEADLK; return -EDEADLK;
crtc_state = drm_atomic_get_crtc_state(plane_state->state, crtc); crtc_state = drm_atomic_get_crtc_state(plane_state->state, crtc);
if (IS_ERR(crtc_state))
return PTR_ERR(crtc_state);
if (crtc->primary == plane && crtc_state->active) { if (crtc->primary == plane && crtc_state->active) {
if (!plane_state->fb) if (!plane_state->fb)
return -EINVAL; return -EINVAL;

View File

@ -109,7 +109,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps(
struct cea_sad *sad = &sads[i]; struct cea_sad *sad = &sads[i];
edid_caps->audio_modes[i].format_code = sad->format; edid_caps->audio_modes[i].format_code = sad->format;
edid_caps->audio_modes[i].channel_count = sad->channels; edid_caps->audio_modes[i].channel_count = sad->channels + 1;
edid_caps->audio_modes[i].sample_rate = sad->freq; edid_caps->audio_modes[i].sample_rate = sad->freq;
edid_caps->audio_modes[i].sample_size = sad->byte2; edid_caps->audio_modes[i].sample_size = sad->byte2;
} }

View File

@ -496,6 +496,9 @@ struct dce_hwseq_registers {
HWS_SF(, DOMAIN7_PG_STATUS, DOMAIN7_PGFSM_PWR_STATUS, mask_sh), \ HWS_SF(, DOMAIN7_PG_STATUS, DOMAIN7_PGFSM_PWR_STATUS, mask_sh), \
HWS_SF(, DC_IP_REQUEST_CNTL, IP_REQUEST_EN, mask_sh), \ HWS_SF(, DC_IP_REQUEST_CNTL, IP_REQUEST_EN, mask_sh), \
HWS_SF(, D1VGA_CONTROL, D1VGA_MODE_ENABLE, mask_sh),\ HWS_SF(, D1VGA_CONTROL, D1VGA_MODE_ENABLE, mask_sh),\
HWS_SF(, D2VGA_CONTROL, D2VGA_MODE_ENABLE, mask_sh),\
HWS_SF(, D3VGA_CONTROL, D3VGA_MODE_ENABLE, mask_sh),\
HWS_SF(, D4VGA_CONTROL, D4VGA_MODE_ENABLE, mask_sh),\
HWS_SF(, VGA_TEST_CONTROL, VGA_TEST_ENABLE, mask_sh),\ HWS_SF(, VGA_TEST_CONTROL, VGA_TEST_ENABLE, mask_sh),\
HWS_SF(, VGA_TEST_CONTROL, VGA_TEST_RENDER_START, mask_sh),\ HWS_SF(, VGA_TEST_CONTROL, VGA_TEST_RENDER_START, mask_sh),\
HWS_SF(, LVTMA_PWRSEQ_CNTL, LVTMA_BLON, mask_sh), \ HWS_SF(, LVTMA_PWRSEQ_CNTL, LVTMA_BLON, mask_sh), \
@ -591,7 +594,10 @@ struct dce_hwseq_registers {
type DENTIST_DISPCLK_WDIVIDER; \ type DENTIST_DISPCLK_WDIVIDER; \
type VGA_TEST_ENABLE; \ type VGA_TEST_ENABLE; \
type VGA_TEST_RENDER_START; \ type VGA_TEST_RENDER_START; \
type D1VGA_MODE_ENABLE; type D1VGA_MODE_ENABLE; \
type D2VGA_MODE_ENABLE; \
type D3VGA_MODE_ENABLE; \
type D4VGA_MODE_ENABLE;
struct dce_hwseq_shift { struct dce_hwseq_shift {
HWSEQ_REG_FIELD_LIST(uint8_t) HWSEQ_REG_FIELD_LIST(uint8_t)

View File

@ -128,23 +128,22 @@ static void set_truncation(
return; return;
} }
/* on other format-to do */ /* on other format-to do */
if (params->flags.TRUNCATE_ENABLED == 0 || if (params->flags.TRUNCATE_ENABLED == 0)
params->flags.TRUNCATE_DEPTH == 2)
return; return;
/*Set truncation depth and Enable truncation*/ /*Set truncation depth and Enable truncation*/
REG_UPDATE_3(FMT_BIT_DEPTH_CONTROL, REG_UPDATE_3(FMT_BIT_DEPTH_CONTROL,
FMT_TRUNCATE_EN, 1, FMT_TRUNCATE_EN, 1,
FMT_TRUNCATE_DEPTH, FMT_TRUNCATE_DEPTH,
params->flags.TRUNCATE_MODE, params->flags.TRUNCATE_DEPTH,
FMT_TRUNCATE_MODE, FMT_TRUNCATE_MODE,
params->flags.TRUNCATE_DEPTH); params->flags.TRUNCATE_MODE);
} }
/** /**
* set_spatial_dither * set_spatial_dither
* 1) set spatial dithering mode: pattern of seed * 1) set spatial dithering mode: pattern of seed
* 2) set spatical dithering depth: 0 for 18bpp or 1 for 24bpp * 2) set spatial dithering depth: 0 for 18bpp or 1 for 24bpp
* 3) set random seed * 3) set random seed
* 4) set random mode * 4) set random mode
* lfsr is reset every frame or not reset * lfsr is reset every frame or not reset

View File

@ -238,14 +238,24 @@ static void enable_power_gating_plane(
static void disable_vga( static void disable_vga(
struct dce_hwseq *hws) struct dce_hwseq *hws)
{ {
unsigned int in_vga_mode = 0; unsigned int in_vga1_mode = 0;
unsigned int in_vga2_mode = 0;
unsigned int in_vga3_mode = 0;
unsigned int in_vga4_mode = 0;
REG_GET(D1VGA_CONTROL, D1VGA_MODE_ENABLE, &in_vga_mode); REG_GET(D1VGA_CONTROL, D1VGA_MODE_ENABLE, &in_vga1_mode);
REG_GET(D2VGA_CONTROL, D2VGA_MODE_ENABLE, &in_vga2_mode);
REG_GET(D3VGA_CONTROL, D3VGA_MODE_ENABLE, &in_vga3_mode);
REG_GET(D4VGA_CONTROL, D4VGA_MODE_ENABLE, &in_vga4_mode);
if (in_vga_mode == 0) if (in_vga1_mode == 0 && in_vga2_mode == 0 &&
in_vga3_mode == 0 && in_vga4_mode == 0)
return; return;
REG_WRITE(D1VGA_CONTROL, 0); REG_WRITE(D1VGA_CONTROL, 0);
REG_WRITE(D2VGA_CONTROL, 0);
REG_WRITE(D3VGA_CONTROL, 0);
REG_WRITE(D4VGA_CONTROL, 0);
/* HW Engineer's Notes: /* HW Engineer's Notes:
* During switch from vga->extended, if we set the VGA_TEST_ENABLE and * During switch from vga->extended, if we set the VGA_TEST_ENABLE and

View File

@ -90,25 +90,18 @@ void radeon_connector_hotplug(struct drm_connector *connector)
/* don't do anything if sink is not display port, i.e., /* don't do anything if sink is not display port, i.e.,
* passive dp->(dvi|hdmi) adaptor * passive dp->(dvi|hdmi) adaptor
*/ */
if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) { if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT &&
int saved_dpms = connector->dpms; radeon_hpd_sense(rdev, radeon_connector->hpd.hpd) &&
/* Only turn off the display if it's physically disconnected */ radeon_dp_needs_link_train(radeon_connector)) {
if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) { /* Don't start link training before we have the DPCD */
drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); if (!radeon_dp_getdpcd(radeon_connector))
} else if (radeon_dp_needs_link_train(radeon_connector)) { return;
/* Don't try to start link training before we
* have the dpcd */
if (!radeon_dp_getdpcd(radeon_connector))
return;
/* set it to OFF so that drm_helper_connector_dpms() /* Turn the connector off and back on immediately, which
* won't return immediately since the current state * will trigger link training
* is ON at this point. */
*/ drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
connector->dpms = DRM_MODE_DPMS_OFF; drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
}
connector->dpms = saved_dpms;
} }
} }
} }