Commit d5227129 authored by Dave Airlie's avatar Dave Airlie

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

A few more radeon fixes.  A fix for UVD on AGP cards, a fix for non-full
screen scaling on laptop panels with DP bridge chips, and a bunch of dpm
fixes.

* 'drm-fixes-3.12' of git://people.freedesktop.org/~agd5f/linux:
  drm/radeon: avoid UVD corruptions on AGP cards
  drm/radeon: fix panel scaling with eDP and LVDS bridges
  drm/radeon/dpm: rework auto performance level enable
  drm/radeon: Fix hmdi typo
  drm/radeon/dpm/rs780: fix force_performance state for same sclks
  drm/radeon/dpm/rs780: don't enable sclk scaling if not required
  drm/radeon/dpm/rs780: add some sanity checking to sclk scaling
  drm/radeon/dpm/rs780: use drm_mode_vrefresh()
parents d2aebe33 4f66c599
...@@ -2340,12 +2340,6 @@ int btc_dpm_set_power_state(struct radeon_device *rdev) ...@@ -2340,12 +2340,6 @@ int btc_dpm_set_power_state(struct radeon_device *rdev)
return ret; return ret;
} }
ret = rv770_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO);
if (ret) {
DRM_ERROR("rv770_dpm_force_performance_level failed\n");
return ret;
}
return 0; return 0;
} }
......
...@@ -4748,12 +4748,6 @@ int ci_dpm_set_power_state(struct radeon_device *rdev) ...@@ -4748,12 +4748,6 @@ int ci_dpm_set_power_state(struct radeon_device *rdev)
if (pi->pcie_performance_request) if (pi->pcie_performance_request)
ci_notify_link_speed_change_after_state_change(rdev, new_ps, old_ps); ci_notify_link_speed_change_after_state_change(rdev, new_ps, old_ps);
ret = ci_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO);
if (ret) {
DRM_ERROR("ci_dpm_force_performance_level failed\n");
return ret;
}
cik_update_cg(rdev, (RADEON_CG_BLOCK_GFX | cik_update_cg(rdev, (RADEON_CG_BLOCK_GFX |
RADEON_CG_BLOCK_MC | RADEON_CG_BLOCK_MC |
RADEON_CG_BLOCK_SDMA | RADEON_CG_BLOCK_SDMA |
......
...@@ -2014,12 +2014,6 @@ int cypress_dpm_set_power_state(struct radeon_device *rdev) ...@@ -2014,12 +2014,6 @@ int cypress_dpm_set_power_state(struct radeon_device *rdev)
if (eg_pi->pcie_performance_request) if (eg_pi->pcie_performance_request)
cypress_notify_link_speed_change_after_state_change(rdev, new_ps, old_ps); cypress_notify_link_speed_change_after_state_change(rdev, new_ps, old_ps);
ret = rv770_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO);
if (ret) {
DRM_ERROR("rv770_dpm_force_performance_level failed\n");
return ret;
}
return 0; return 0;
} }
......
...@@ -1854,7 +1854,6 @@ int kv_dpm_set_power_state(struct radeon_device *rdev) ...@@ -1854,7 +1854,6 @@ int kv_dpm_set_power_state(struct radeon_device *rdev)
RADEON_CG_BLOCK_BIF | RADEON_CG_BLOCK_BIF |
RADEON_CG_BLOCK_HDP), true); RADEON_CG_BLOCK_HDP), true);
rdev->pm.dpm.forced_level = RADEON_DPM_FORCED_LEVEL_AUTO;
return 0; return 0;
} }
......
...@@ -3865,12 +3865,6 @@ int ni_dpm_set_power_state(struct radeon_device *rdev) ...@@ -3865,12 +3865,6 @@ int ni_dpm_set_power_state(struct radeon_device *rdev)
return ret; return ret;
} }
ret = ni_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO);
if (ret) {
DRM_ERROR("ni_dpm_force_performance_level failed\n");
return ret;
}
return 0; return 0;
} }
......
...@@ -1040,7 +1040,7 @@ ...@@ -1040,7 +1040,7 @@
# define HDMI0_AVI_INFO_CONT (1 << 1) # define HDMI0_AVI_INFO_CONT (1 << 1)
# define HDMI0_AUDIO_INFO_SEND (1 << 4) # define HDMI0_AUDIO_INFO_SEND (1 << 4)
# define HDMI0_AUDIO_INFO_CONT (1 << 5) # define HDMI0_AUDIO_INFO_CONT (1 << 5)
# define HDMI0_AUDIO_INFO_SOURCE (1 << 6) /* 0 - sound block; 1 - hmdi regs */ # define HDMI0_AUDIO_INFO_SOURCE (1 << 6) /* 0 - sound block; 1 - hdmi regs */
# define HDMI0_AUDIO_INFO_UPDATE (1 << 7) # define HDMI0_AUDIO_INFO_UPDATE (1 << 7)
# define HDMI0_MPEG_INFO_SEND (1 << 8) # define HDMI0_MPEG_INFO_SEND (1 << 8)
# define HDMI0_MPEG_INFO_CONT (1 << 9) # define HDMI0_MPEG_INFO_CONT (1 << 9)
......
...@@ -1435,7 +1435,7 @@ radeon_dp_detect(struct drm_connector *connector, bool force) ...@@ -1435,7 +1435,7 @@ radeon_dp_detect(struct drm_connector *connector, bool force)
if (radeon_dp_getdpcd(radeon_connector)) if (radeon_dp_getdpcd(radeon_connector))
ret = connector_status_connected; ret = connector_status_connected;
} else { } else {
/* try non-aux ddc (DP to DVI/HMDI/etc. adapter) */ /* try non-aux ddc (DP to DVI/HDMI/etc. adapter) */
if (radeon_ddc_probe(radeon_connector, false)) if (radeon_ddc_probe(radeon_connector, false))
ret = connector_status_connected; ret = connector_status_connected;
} }
...@@ -1504,6 +1504,24 @@ static const struct drm_connector_funcs radeon_dp_connector_funcs = { ...@@ -1504,6 +1504,24 @@ static const struct drm_connector_funcs radeon_dp_connector_funcs = {
.force = radeon_dvi_force, .force = radeon_dvi_force,
}; };
static const struct drm_connector_funcs radeon_edp_connector_funcs = {
.dpms = drm_helper_connector_dpms,
.detect = radeon_dp_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
.set_property = radeon_lvds_set_property,
.destroy = radeon_dp_connector_destroy,
.force = radeon_dvi_force,
};
static const struct drm_connector_funcs radeon_lvds_bridge_connector_funcs = {
.dpms = drm_helper_connector_dpms,
.detect = radeon_dp_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
.set_property = radeon_lvds_set_property,
.destroy = radeon_dp_connector_destroy,
.force = radeon_dvi_force,
};
void void
radeon_add_atom_connector(struct drm_device *dev, radeon_add_atom_connector(struct drm_device *dev,
uint32_t connector_id, uint32_t connector_id,
...@@ -1595,8 +1613,6 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -1595,8 +1613,6 @@ radeon_add_atom_connector(struct drm_device *dev,
goto failed; goto failed;
radeon_dig_connector->igp_lane_info = igp_lane_info; radeon_dig_connector->igp_lane_info = igp_lane_info;
radeon_connector->con_priv = radeon_dig_connector; radeon_connector->con_priv = radeon_dig_connector;
drm_connector_init(dev, &radeon_connector->base, &radeon_dp_connector_funcs, connector_type);
drm_connector_helper_add(&radeon_connector->base, &radeon_dp_connector_helper_funcs);
if (i2c_bus->valid) { if (i2c_bus->valid) {
/* add DP i2c bus */ /* add DP i2c bus */
if (connector_type == DRM_MODE_CONNECTOR_eDP) if (connector_type == DRM_MODE_CONNECTOR_eDP)
...@@ -1613,6 +1629,10 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -1613,6 +1629,10 @@ radeon_add_atom_connector(struct drm_device *dev,
case DRM_MODE_CONNECTOR_VGA: case DRM_MODE_CONNECTOR_VGA:
case DRM_MODE_CONNECTOR_DVIA: case DRM_MODE_CONNECTOR_DVIA:
default: default:
drm_connector_init(dev, &radeon_connector->base,
&radeon_dp_connector_funcs, connector_type);
drm_connector_helper_add(&radeon_connector->base,
&radeon_dp_connector_helper_funcs);
connector->interlace_allowed = true; connector->interlace_allowed = true;
connector->doublescan_allowed = true; connector->doublescan_allowed = true;
radeon_connector->dac_load_detect = true; radeon_connector->dac_load_detect = true;
...@@ -1625,6 +1645,10 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -1625,6 +1645,10 @@ radeon_add_atom_connector(struct drm_device *dev,
case DRM_MODE_CONNECTOR_HDMIA: case DRM_MODE_CONNECTOR_HDMIA:
case DRM_MODE_CONNECTOR_HDMIB: case DRM_MODE_CONNECTOR_HDMIB:
case DRM_MODE_CONNECTOR_DisplayPort: case DRM_MODE_CONNECTOR_DisplayPort:
drm_connector_init(dev, &radeon_connector->base,
&radeon_dp_connector_funcs, connector_type);
drm_connector_helper_add(&radeon_connector->base,
&radeon_dp_connector_helper_funcs);
drm_object_attach_property(&radeon_connector->base.base, drm_object_attach_property(&radeon_connector->base.base,
rdev->mode_info.underscan_property, rdev->mode_info.underscan_property,
UNDERSCAN_OFF); UNDERSCAN_OFF);
...@@ -1652,6 +1676,10 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -1652,6 +1676,10 @@ radeon_add_atom_connector(struct drm_device *dev,
break; break;
case DRM_MODE_CONNECTOR_LVDS: case DRM_MODE_CONNECTOR_LVDS:
case DRM_MODE_CONNECTOR_eDP: case DRM_MODE_CONNECTOR_eDP:
drm_connector_init(dev, &radeon_connector->base,
&radeon_lvds_bridge_connector_funcs, connector_type);
drm_connector_helper_add(&radeon_connector->base,
&radeon_dp_connector_helper_funcs);
drm_object_attach_property(&radeon_connector->base.base, drm_object_attach_property(&radeon_connector->base.base,
dev->mode_config.scaling_mode_property, dev->mode_config.scaling_mode_property,
DRM_MODE_SCALE_FULLSCREEN); DRM_MODE_SCALE_FULLSCREEN);
...@@ -1830,7 +1858,7 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -1830,7 +1858,7 @@ radeon_add_atom_connector(struct drm_device *dev,
goto failed; goto failed;
radeon_dig_connector->igp_lane_info = igp_lane_info; radeon_dig_connector->igp_lane_info = igp_lane_info;
radeon_connector->con_priv = radeon_dig_connector; radeon_connector->con_priv = radeon_dig_connector;
drm_connector_init(dev, &radeon_connector->base, &radeon_dp_connector_funcs, connector_type); drm_connector_init(dev, &radeon_connector->base, &radeon_edp_connector_funcs, connector_type);
drm_connector_helper_add(&radeon_connector->base, &radeon_dp_connector_helper_funcs); drm_connector_helper_add(&radeon_connector->base, &radeon_dp_connector_helper_funcs);
if (i2c_bus->valid) { if (i2c_bus->valid) {
/* add DP i2c bus */ /* add DP i2c bus */
......
...@@ -81,9 +81,11 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p) ...@@ -81,9 +81,11 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
p->relocs[i].lobj.bo = p->relocs[i].robj; p->relocs[i].lobj.bo = p->relocs[i].robj;
p->relocs[i].lobj.written = !!r->write_domain; p->relocs[i].lobj.written = !!r->write_domain;
/* the first reloc of an UVD job is the /* the first reloc of an UVD job is the msg and that must be in
msg and that must be in VRAM */ VRAM, also but everything into VRAM on AGP cards to avoid
if (p->ring == R600_RING_TYPE_UVD_INDEX && i == 0) { image corruptions */
if (p->ring == R600_RING_TYPE_UVD_INDEX &&
(i == 0 || p->rdev->flags & RADEON_IS_AGP)) {
/* TODO: is this still needed for NI+ ? */ /* TODO: is this still needed for NI+ ? */
p->relocs[i].lobj.domain = p->relocs[i].lobj.domain =
RADEON_GEM_DOMAIN_VRAM; RADEON_GEM_DOMAIN_VRAM;
......
...@@ -917,10 +917,13 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev) ...@@ -917,10 +917,13 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev)
radeon_dpm_post_set_power_state(rdev); radeon_dpm_post_set_power_state(rdev);
if (rdev->asic->dpm.force_performance_level) {
if (rdev->pm.dpm.thermal_active)
/* force low perf level for thermal */ /* force low perf level for thermal */
if (rdev->pm.dpm.thermal_active &&
rdev->asic->dpm.force_performance_level) {
radeon_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_LOW); radeon_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_LOW);
else
/* otherwise, enable auto */
radeon_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO);
} }
done: done:
...@@ -1149,9 +1152,10 @@ static int radeon_pm_init_dpm(struct radeon_device *rdev) ...@@ -1149,9 +1152,10 @@ static int radeon_pm_init_dpm(struct radeon_device *rdev)
{ {
int ret; int ret;
/* default to performance state */ /* default to balanced state */
rdev->pm.dpm.state = POWER_STATE_TYPE_BALANCED; rdev->pm.dpm.state = POWER_STATE_TYPE_BALANCED;
rdev->pm.dpm.user_state = POWER_STATE_TYPE_BALANCED; rdev->pm.dpm.user_state = POWER_STATE_TYPE_BALANCED;
rdev->pm.dpm.forced_level = RADEON_DPM_FORCED_LEVEL_AUTO;
rdev->pm.default_sclk = rdev->clock.default_sclk; rdev->pm.default_sclk = rdev->clock.default_sclk;
rdev->pm.default_mclk = rdev->clock.default_mclk; rdev->pm.default_mclk = rdev->clock.default_mclk;
rdev->pm.current_sclk = rdev->clock.default_sclk; rdev->pm.current_sclk = rdev->clock.default_sclk;
......
...@@ -62,9 +62,7 @@ static void rs780_get_pm_mode_parameters(struct radeon_device *rdev) ...@@ -62,9 +62,7 @@ static void rs780_get_pm_mode_parameters(struct radeon_device *rdev)
radeon_crtc = to_radeon_crtc(crtc); radeon_crtc = to_radeon_crtc(crtc);
pi->crtc_id = radeon_crtc->crtc_id; pi->crtc_id = radeon_crtc->crtc_id;
if (crtc->mode.htotal && crtc->mode.vtotal) if (crtc->mode.htotal && crtc->mode.vtotal)
pi->refresh_rate = pi->refresh_rate = drm_mode_vrefresh(&crtc->mode);
(crtc->mode.clock * 1000) /
(crtc->mode.htotal * crtc->mode.vtotal);
break; break;
} }
} }
...@@ -451,6 +449,12 @@ static int rs780_set_engine_clock_scaling(struct radeon_device *rdev, ...@@ -451,6 +449,12 @@ static int rs780_set_engine_clock_scaling(struct radeon_device *rdev,
if (ret) if (ret)
return ret; return ret;
if ((min_dividers.ref_div != max_dividers.ref_div) ||
(min_dividers.post_div != max_dividers.post_div) ||
(max_dividers.ref_div != current_max_dividers.ref_div) ||
(max_dividers.post_div != current_max_dividers.post_div))
return -EINVAL;
rs780_force_fbdiv(rdev, max_dividers.fb_div); rs780_force_fbdiv(rdev, max_dividers.fb_div);
if (max_dividers.fb_div > min_dividers.fb_div) { if (max_dividers.fb_div > min_dividers.fb_div) {
...@@ -495,6 +499,9 @@ static void rs780_activate_engine_clk_scaling(struct radeon_device *rdev, ...@@ -495,6 +499,9 @@ static void rs780_activate_engine_clk_scaling(struct radeon_device *rdev,
(new_state->sclk_low == old_state->sclk_low)) (new_state->sclk_low == old_state->sclk_low))
return; return;
if (new_state->sclk_high == new_state->sclk_low)
return;
rs780_clk_scaling_enable(rdev, true); rs780_clk_scaling_enable(rdev, true);
} }
...@@ -1036,8 +1043,10 @@ int rs780_dpm_force_performance_level(struct radeon_device *rdev, ...@@ -1036,8 +1043,10 @@ int rs780_dpm_force_performance_level(struct radeon_device *rdev,
if (pi->voltage_control) if (pi->voltage_control)
rs780_force_voltage(rdev, pi->max_voltage); rs780_force_voltage(rdev, pi->max_voltage);
if (ps->sclk_high != ps->sclk_low) {
WREG32_P(FVTHROT_FBDIV_REG1, 0, ~FORCE_FEEDBACK_DIV); WREG32_P(FVTHROT_FBDIV_REG1, 0, ~FORCE_FEEDBACK_DIV);
rs780_clk_scaling_enable(rdev, true); rs780_clk_scaling_enable(rdev, true);
}
if (pi->voltage_control) { if (pi->voltage_control) {
rs780_voltage_scaling_enable(rdev, true); rs780_voltage_scaling_enable(rdev, true);
......
...@@ -1758,8 +1758,6 @@ int rv6xx_dpm_set_power_state(struct radeon_device *rdev) ...@@ -1758,8 +1758,6 @@ int rv6xx_dpm_set_power_state(struct radeon_device *rdev)
rv6xx_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps); rv6xx_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps);
rdev->pm.dpm.forced_level = RADEON_DPM_FORCED_LEVEL_AUTO;
return 0; return 0;
} }
......
...@@ -2064,12 +2064,6 @@ int rv770_dpm_set_power_state(struct radeon_device *rdev) ...@@ -2064,12 +2064,6 @@ int rv770_dpm_set_power_state(struct radeon_device *rdev)
rv770_program_dcodt_after_state_switch(rdev, new_ps, old_ps); rv770_program_dcodt_after_state_switch(rdev, new_ps, old_ps);
rv770_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps); rv770_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps);
ret = rv770_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO);
if (ret) {
DRM_ERROR("rv770_dpm_force_performance_level failed\n");
return ret;
}
return 0; return 0;
} }
......
...@@ -852,7 +852,7 @@ ...@@ -852,7 +852,7 @@
#define AFMT_VBI_PACKET_CONTROL 0x7608 #define AFMT_VBI_PACKET_CONTROL 0x7608
# define AFMT_GENERIC0_UPDATE (1 << 2) # define AFMT_GENERIC0_UPDATE (1 << 2)
#define AFMT_INFOFRAME_CONTROL0 0x760c #define AFMT_INFOFRAME_CONTROL0 0x760c
# define AFMT_AUDIO_INFO_SOURCE (1 << 6) /* 0 - sound block; 1 - hmdi regs */ # define AFMT_AUDIO_INFO_SOURCE (1 << 6) /* 0 - sound block; 1 - hdmi regs */
# define AFMT_AUDIO_INFO_UPDATE (1 << 7) # define AFMT_AUDIO_INFO_UPDATE (1 << 7)
# define AFMT_MPEG_INFO_UPDATE (1 << 10) # define AFMT_MPEG_INFO_UPDATE (1 << 10)
#define AFMT_GENERIC0_7 0x7610 #define AFMT_GENERIC0_7 0x7610
......
...@@ -6075,12 +6075,6 @@ int si_dpm_set_power_state(struct radeon_device *rdev) ...@@ -6075,12 +6075,6 @@ int si_dpm_set_power_state(struct radeon_device *rdev)
return ret; return ret;
} }
ret = si_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO);
if (ret) {
DRM_ERROR("si_dpm_force_performance_level failed\n");
return ret;
}
si_update_cg(rdev, (RADEON_CG_BLOCK_GFX | si_update_cg(rdev, (RADEON_CG_BLOCK_GFX |
RADEON_CG_BLOCK_MC | RADEON_CG_BLOCK_MC |
RADEON_CG_BLOCK_SDMA | RADEON_CG_BLOCK_SDMA |
......
...@@ -1319,8 +1319,6 @@ int sumo_dpm_set_power_state(struct radeon_device *rdev) ...@@ -1319,8 +1319,6 @@ int sumo_dpm_set_power_state(struct radeon_device *rdev)
if (pi->enable_dpm) if (pi->enable_dpm)
sumo_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps); sumo_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps);
rdev->pm.dpm.forced_level = RADEON_DPM_FORCED_LEVEL_AUTO;
return 0; return 0;
} }
......
...@@ -1236,7 +1236,6 @@ int trinity_dpm_set_power_state(struct radeon_device *rdev) ...@@ -1236,7 +1236,6 @@ int trinity_dpm_set_power_state(struct radeon_device *rdev)
trinity_force_level_0(rdev); trinity_force_level_0(rdev);
trinity_unforce_levels(rdev); trinity_unforce_levels(rdev);
trinity_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps); trinity_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps);
rdev->pm.dpm.forced_level = RADEON_DPM_FORCED_LEVEL_AUTO;
} }
trinity_release_mutex(rdev); trinity_release_mutex(rdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment