| .. | .. |
|---|
| 24 | 24 | * Alex Deucher |
|---|
| 25 | 25 | * Jerome Glisse |
|---|
| 26 | 26 | */ |
|---|
| 27 | | -#include <drm/drmP.h> |
|---|
| 27 | + |
|---|
| 28 | 28 | #include <drm/amdgpu_drm.h> |
|---|
| 29 | 29 | #include "amdgpu.h" |
|---|
| 30 | 30 | |
|---|
| .. | .. |
|---|
| 60 | 60 | u8 delay, u8 *ack) |
|---|
| 61 | 61 | { |
|---|
| 62 | 62 | struct drm_device *dev = chan->dev; |
|---|
| 63 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 63 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 64 | 64 | union aux_channel_transaction args; |
|---|
| 65 | 65 | int index = GetIndexIntoMasterTable(COMMAND, ProcessAuxChannelTransaction); |
|---|
| 66 | 66 | unsigned char *base; |
|---|
| .. | .. |
|---|
| 186 | 186 | |
|---|
| 187 | 187 | void amdgpu_atombios_dp_aux_init(struct amdgpu_connector *amdgpu_connector) |
|---|
| 188 | 188 | { |
|---|
| 189 | | - int ret; |
|---|
| 190 | | - |
|---|
| 191 | 189 | amdgpu_connector->ddc_bus->rec.hpd = amdgpu_connector->hpd.hpd; |
|---|
| 192 | | - amdgpu_connector->ddc_bus->aux.dev = amdgpu_connector->base.kdev; |
|---|
| 193 | 190 | amdgpu_connector->ddc_bus->aux.transfer = amdgpu_atombios_dp_aux_transfer; |
|---|
| 194 | | - ret = drm_dp_aux_register(&amdgpu_connector->ddc_bus->aux); |
|---|
| 195 | | - if (!ret) |
|---|
| 196 | | - amdgpu_connector->ddc_bus->has_aux = true; |
|---|
| 197 | | - |
|---|
| 198 | | - WARN(ret, "drm_dp_aux_register_i2c_bus() failed with error %d\n", ret); |
|---|
| 191 | + drm_dp_aux_init(&amdgpu_connector->ddc_bus->aux); |
|---|
| 192 | + amdgpu_connector->ddc_bus->has_aux = true; |
|---|
| 199 | 193 | } |
|---|
| 200 | 194 | |
|---|
| 201 | 195 | /***** general DP utility functions *****/ |
|---|
| .. | .. |
|---|
| 311 | 305 | u8 amdgpu_atombios_dp_get_sinktype(struct amdgpu_connector *amdgpu_connector) |
|---|
| 312 | 306 | { |
|---|
| 313 | 307 | struct drm_device *dev = amdgpu_connector->base.dev; |
|---|
| 314 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 308 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 315 | 309 | |
|---|
| 316 | 310 | return amdgpu_atombios_dp_encoder_service(adev, ATOM_DP_ACTION_GET_SINK_TYPE, 0, |
|---|
| 317 | 311 | amdgpu_connector->ddc_bus->rec.i2c_id, 0); |
|---|
| .. | .. |
|---|
| 334 | 328 | buf[0], buf[1], buf[2]); |
|---|
| 335 | 329 | } |
|---|
| 336 | 330 | |
|---|
| 331 | +static void amdgpu_atombios_dp_ds_ports(struct amdgpu_connector *amdgpu_connector) |
|---|
| 332 | +{ |
|---|
| 333 | + struct amdgpu_connector_atom_dig *dig_connector = amdgpu_connector->con_priv; |
|---|
| 334 | + int ret; |
|---|
| 335 | + |
|---|
| 336 | + if (dig_connector->dpcd[DP_DPCD_REV] > 0x10) { |
|---|
| 337 | + ret = drm_dp_dpcd_read(&amdgpu_connector->ddc_bus->aux, |
|---|
| 338 | + DP_DOWNSTREAM_PORT_0, |
|---|
| 339 | + dig_connector->downstream_ports, |
|---|
| 340 | + DP_MAX_DOWNSTREAM_PORTS); |
|---|
| 341 | + if (ret) |
|---|
| 342 | + memset(dig_connector->downstream_ports, 0, |
|---|
| 343 | + DP_MAX_DOWNSTREAM_PORTS); |
|---|
| 344 | + } |
|---|
| 345 | +} |
|---|
| 346 | + |
|---|
| 337 | 347 | int amdgpu_atombios_dp_get_dpcd(struct amdgpu_connector *amdgpu_connector) |
|---|
| 338 | 348 | { |
|---|
| 339 | 349 | struct amdgpu_connector_atom_dig *dig_connector = amdgpu_connector->con_priv; |
|---|
| .. | .. |
|---|
| 349 | 359 | dig_connector->dpcd); |
|---|
| 350 | 360 | |
|---|
| 351 | 361 | amdgpu_atombios_dp_probe_oui(amdgpu_connector); |
|---|
| 352 | | - |
|---|
| 362 | + amdgpu_atombios_dp_ds_ports(amdgpu_connector); |
|---|
| 353 | 363 | return 0; |
|---|
| 354 | 364 | } |
|---|
| 355 | 365 | |
|---|
| .. | .. |
|---|
| 361 | 371 | struct drm_connector *connector) |
|---|
| 362 | 372 | { |
|---|
| 363 | 373 | struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector); |
|---|
| 364 | | - struct amdgpu_connector_atom_dig *dig_connector; |
|---|
| 365 | 374 | int panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE; |
|---|
| 366 | 375 | u16 dp_bridge = amdgpu_connector_encoder_get_dp_bridge_encoder_id(connector); |
|---|
| 367 | 376 | u8 tmp; |
|---|
| 368 | 377 | |
|---|
| 369 | 378 | if (!amdgpu_connector->con_priv) |
|---|
| 370 | 379 | return panel_mode; |
|---|
| 371 | | - |
|---|
| 372 | | - dig_connector = amdgpu_connector->con_priv; |
|---|
| 373 | 380 | |
|---|
| 374 | 381 | if (dp_bridge != ENCODER_OBJECT_ID_NONE) { |
|---|
| 375 | 382 | /* DP bridge chips */ |
|---|
| .. | .. |
|---|
| 711 | 718 | struct drm_connector *connector) |
|---|
| 712 | 719 | { |
|---|
| 713 | 720 | struct drm_device *dev = encoder->dev; |
|---|
| 714 | | - struct amdgpu_device *adev = dev->dev_private; |
|---|
| 721 | + struct amdgpu_device *adev = drm_to_adev(dev); |
|---|
| 715 | 722 | struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); |
|---|
| 716 | | - struct amdgpu_encoder_atom_dig *dig; |
|---|
| 717 | 723 | struct amdgpu_connector *amdgpu_connector; |
|---|
| 718 | 724 | struct amdgpu_connector_atom_dig *dig_connector; |
|---|
| 719 | 725 | struct amdgpu_atombios_dp_link_train_info dp_info; |
|---|
| .. | .. |
|---|
| 721 | 727 | |
|---|
| 722 | 728 | if (!amdgpu_encoder->enc_priv) |
|---|
| 723 | 729 | return; |
|---|
| 724 | | - dig = amdgpu_encoder->enc_priv; |
|---|
| 725 | 730 | |
|---|
| 726 | 731 | amdgpu_connector = to_amdgpu_connector(connector); |
|---|
| 727 | 732 | if (!amdgpu_connector->con_priv) |
|---|