diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2011-05-22 13:20:36 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-05-23 18:59:30 -0400 |
commit | ac89af1e1010640db072416c786f97391b85790f (patch) | |
tree | 5faa022ee9e242efa8bf9f3fa3c8a0101671aae7 /drivers | |
parent | bb92091acfbb9549e3fd2900427c7548e9ebd1bd (diff) |
drm/radeon/kms/atom: move dig phy init out of modesetting
It only needs to be called once at startup, not for every
modeset.
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_device.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_display.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_encoders.c | 68 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_mode.h | 1 |
4 files changed, 68 insertions, 9 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 890217e678d3..5b61364e31f4 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -923,6 +923,9 @@ int radeon_resume_kms(struct drm_device *dev) | |||
923 | radeon_fbdev_set_suspend(rdev, 0); | 923 | radeon_fbdev_set_suspend(rdev, 0); |
924 | console_unlock(); | 924 | console_unlock(); |
925 | 925 | ||
926 | /* init dig PHYs */ | ||
927 | if (rdev->is_atom_bios) | ||
928 | radeon_atom_encoder_init(rdev); | ||
926 | /* reset hpd state */ | 929 | /* reset hpd state */ |
927 | radeon_hpd_init(rdev); | 930 | radeon_hpd_init(rdev); |
928 | /* blat the mode back in */ | 931 | /* blat the mode back in */ |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 06719340edcb..ae247eec87c0 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -1345,6 +1345,11 @@ int radeon_modeset_init(struct radeon_device *rdev) | |||
1345 | if (!ret) { | 1345 | if (!ret) { |
1346 | return ret; | 1346 | return ret; |
1347 | } | 1347 | } |
1348 | |||
1349 | /* init dig PHYs */ | ||
1350 | if (rdev->is_atom_bios) | ||
1351 | radeon_atom_encoder_init(rdev); | ||
1352 | |||
1348 | /* initialize hpd */ | 1353 | /* initialize hpd */ |
1349 | radeon_hpd_init(rdev); | 1354 | radeon_hpd_init(rdev); |
1350 | 1355 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 73efb4e0b8cd..1b557554696e 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -229,6 +229,22 @@ radeon_get_connector_for_encoder(struct drm_encoder *encoder) | |||
229 | return NULL; | 229 | return NULL; |
230 | } | 230 | } |
231 | 231 | ||
232 | static struct drm_connector * | ||
233 | radeon_get_connector_for_encoder_init(struct drm_encoder *encoder) | ||
234 | { | ||
235 | struct drm_device *dev = encoder->dev; | ||
236 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | ||
237 | struct drm_connector *connector; | ||
238 | struct radeon_connector *radeon_connector; | ||
239 | |||
240 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | ||
241 | radeon_connector = to_radeon_connector(connector); | ||
242 | if (radeon_encoder->devices & radeon_connector->devices) | ||
243 | return connector; | ||
244 | } | ||
245 | return NULL; | ||
246 | } | ||
247 | |||
232 | struct drm_encoder *radeon_atom_get_external_encoder(struct drm_encoder *encoder) | 248 | struct drm_encoder *radeon_atom_get_external_encoder(struct drm_encoder *encoder) |
233 | { | 249 | { |
234 | struct drm_device *dev = encoder->dev; | 250 | struct drm_device *dev = encoder->dev; |
@@ -928,7 +944,7 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t | |||
928 | struct radeon_device *rdev = dev->dev_private; | 944 | struct radeon_device *rdev = dev->dev_private; |
929 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 945 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
930 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 946 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
931 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | 947 | struct drm_connector *connector; |
932 | union dig_transmitter_control args; | 948 | union dig_transmitter_control args; |
933 | int index = 0; | 949 | int index = 0; |
934 | uint8_t frev, crev; | 950 | uint8_t frev, crev; |
@@ -939,6 +955,11 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t | |||
939 | int connector_object_id = 0; | 955 | int connector_object_id = 0; |
940 | int igp_lane_info = 0; | 956 | int igp_lane_info = 0; |
941 | 957 | ||
958 | if (action == ATOM_TRANSMITTER_ACTION_INIT) | ||
959 | connector = radeon_get_connector_for_encoder_init(encoder); | ||
960 | else | ||
961 | connector = radeon_get_connector_for_encoder(encoder); | ||
962 | |||
942 | if (connector) { | 963 | if (connector) { |
943 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 964 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
944 | struct radeon_connector_atom_dig *dig_connector = | 965 | struct radeon_connector_atom_dig *dig_connector = |
@@ -1180,7 +1201,7 @@ atombios_external_encoder_setup(struct drm_encoder *encoder, | |||
1180 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1201 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
1181 | struct radeon_encoder *ext_radeon_encoder = to_radeon_encoder(ext_encoder); | 1202 | struct radeon_encoder *ext_radeon_encoder = to_radeon_encoder(ext_encoder); |
1182 | union external_encoder_control args; | 1203 | union external_encoder_control args; |
1183 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | 1204 | struct drm_connector *connector; |
1184 | int index = GetIndexIntoMasterTable(COMMAND, ExternalEncoderControl); | 1205 | int index = GetIndexIntoMasterTable(COMMAND, ExternalEncoderControl); |
1185 | u8 frev, crev; | 1206 | u8 frev, crev; |
1186 | int dp_clock = 0; | 1207 | int dp_clock = 0; |
@@ -1189,6 +1210,11 @@ atombios_external_encoder_setup(struct drm_encoder *encoder, | |||
1189 | u32 ext_enum = (ext_radeon_encoder->encoder_enum & ENUM_ID_MASK) >> ENUM_ID_SHIFT; | 1210 | u32 ext_enum = (ext_radeon_encoder->encoder_enum & ENUM_ID_MASK) >> ENUM_ID_SHIFT; |
1190 | int bpc = 8; | 1211 | int bpc = 8; |
1191 | 1212 | ||
1213 | if (action == EXTERNAL_ENCODER_ACTION_V3_ENCODER_INIT) | ||
1214 | connector = radeon_get_connector_for_encoder_init(encoder); | ||
1215 | else | ||
1216 | connector = radeon_get_connector_for_encoder(encoder); | ||
1217 | |||
1192 | if (connector) { | 1218 | if (connector) { |
1193 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 1219 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
1194 | struct radeon_connector_atom_dig *dig_connector = | 1220 | struct radeon_connector_atom_dig *dig_connector = |
@@ -1771,6 +1797,34 @@ static int radeon_atom_pick_dig_encoder(struct drm_encoder *encoder) | |||
1771 | return 1; | 1797 | return 1; |
1772 | } | 1798 | } |
1773 | 1799 | ||
1800 | /* This only needs to be called once at startup */ | ||
1801 | void | ||
1802 | radeon_atom_encoder_init(struct radeon_device *rdev) | ||
1803 | { | ||
1804 | struct drm_device *dev = rdev->ddev; | ||
1805 | struct drm_encoder *encoder; | ||
1806 | |||
1807 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | ||
1808 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | ||
1809 | struct drm_encoder *ext_encoder = radeon_atom_get_external_encoder(encoder); | ||
1810 | |||
1811 | switch (radeon_encoder->encoder_id) { | ||
1812 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: | ||
1813 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: | ||
1814 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: | ||
1815 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: | ||
1816 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_INIT, 0, 0); | ||
1817 | break; | ||
1818 | default: | ||
1819 | break; | ||
1820 | } | ||
1821 | |||
1822 | if (ext_encoder && ASIC_IS_DCE41(rdev)) | ||
1823 | atombios_external_encoder_setup(encoder, ext_encoder, | ||
1824 | EXTERNAL_ENCODER_ACTION_V3_ENCODER_INIT); | ||
1825 | } | ||
1826 | } | ||
1827 | |||
1774 | static void | 1828 | static void |
1775 | radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | 1829 | radeon_atom_encoder_mode_set(struct drm_encoder *encoder, |
1776 | struct drm_display_mode *mode, | 1830 | struct drm_display_mode *mode, |
@@ -1807,8 +1861,7 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | |||
1807 | /* setup and enable the encoder */ | 1861 | /* setup and enable the encoder */ |
1808 | atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_SETUP, 0); | 1862 | atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_SETUP, 0); |
1809 | 1863 | ||
1810 | /* init and enable the transmitter */ | 1864 | /* enable the transmitter */ |
1811 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_INIT, 0, 0); | ||
1812 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0); | 1865 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0); |
1813 | } else { | 1866 | } else { |
1814 | /* disable the encoder and transmitter */ | 1867 | /* disable the encoder and transmitter */ |
@@ -1817,7 +1870,6 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | |||
1817 | 1870 | ||
1818 | /* setup and enable the encoder and transmitter */ | 1871 | /* setup and enable the encoder and transmitter */ |
1819 | atombios_dig_encoder_setup(encoder, ATOM_ENABLE, 0); | 1872 | atombios_dig_encoder_setup(encoder, ATOM_ENABLE, 0); |
1820 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_INIT, 0, 0); | ||
1821 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_SETUP, 0, 0); | 1873 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_SETUP, 0, 0); |
1822 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0); | 1874 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0); |
1823 | } | 1875 | } |
@@ -1842,12 +1894,10 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | |||
1842 | } | 1894 | } |
1843 | 1895 | ||
1844 | if (ext_encoder) { | 1896 | if (ext_encoder) { |
1845 | if (ASIC_IS_DCE41(rdev)) { | 1897 | if (ASIC_IS_DCE41(rdev)) |
1846 | atombios_external_encoder_setup(encoder, ext_encoder, | ||
1847 | EXTERNAL_ENCODER_ACTION_V3_ENCODER_INIT); | ||
1848 | atombios_external_encoder_setup(encoder, ext_encoder, | 1898 | atombios_external_encoder_setup(encoder, ext_encoder, |
1849 | EXTERNAL_ENCODER_ACTION_V3_ENCODER_SETUP); | 1899 | EXTERNAL_ENCODER_ACTION_V3_ENCODER_SETUP); |
1850 | } else | 1900 | else |
1851 | atombios_external_encoder_setup(encoder, ext_encoder, ATOM_ENABLE); | 1901 | atombios_external_encoder_setup(encoder, ext_encoder, ATOM_ENABLE); |
1852 | } | 1902 | } |
1853 | 1903 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 88257bc5729b..977a341266b6 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -479,6 +479,7 @@ extern void radeon_dp_link_train(struct drm_encoder *encoder, | |||
479 | extern u8 radeon_dp_getsinktype(struct radeon_connector *radeon_connector); | 479 | extern u8 radeon_dp_getsinktype(struct radeon_connector *radeon_connector); |
480 | extern bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector); | 480 | extern bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector); |
481 | extern void atombios_dig_encoder_setup(struct drm_encoder *encoder, int action, int panel_mode); | 481 | extern void atombios_dig_encoder_setup(struct drm_encoder *encoder, int action, int panel_mode); |
482 | extern void radeon_atom_encoder_init(struct radeon_device *rdev); | ||
482 | extern void atombios_dig_transmitter_setup(struct drm_encoder *encoder, | 483 | extern void atombios_dig_transmitter_setup(struct drm_encoder *encoder, |
483 | int action, uint8_t lane_num, | 484 | int action, uint8_t lane_num, |
484 | uint8_t lane_set); | 485 | uint8_t lane_set); |