aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2014-03-21 10:34:07 -0400
committerChristian König <christian.koenig@amd.com>2014-03-25 08:13:21 -0400
commit496263bf2bee13387f6e2a780f0c783c9c377c42 (patch)
tree307aa5f7928d85b8756b637635b162035975189d
parent743b1e32f203ec1d28a65327dd98bd290a356ea0 (diff)
drm/radeon: use the new drm helpers for dp aux
Switch to the new dp helpers. The main difference is that the DP helpers don't allow an adjustable delay in the aux transaction, but I don't know that this is necessary. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Acked-by: Christian König <christian.koenig@amd.com>
-rw-r--r--drivers/gpu/drm/radeon/atombios_dp.c192
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c17
-rw-r--r--drivers/gpu/drm/radeon/radeon_mode.h2
3 files changed, 104 insertions, 107 deletions
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
index 23189b796eae..8d8f84676544 100644
--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -142,94 +142,62 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan,
142 return recv_bytes; 142 return recv_bytes;
143} 143}
144 144
145static int radeon_dp_aux_native_write(struct radeon_connector *radeon_connector, 145#define HEADER_SIZE 4
146 u16 address, u8 *send, u8 send_bytes, u8 delay)
147{
148 struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv;
149 int ret;
150 u8 msg[20];
151 int msg_bytes = send_bytes + 4;
152 u8 ack;
153 unsigned retry;
154
155 if (send_bytes > 16)
156 return -1;
157 146
158 msg[0] = address; 147static ssize_t
159 msg[1] = address >> 8; 148radeon_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
160 msg[2] = DP_AUX_NATIVE_WRITE << 4;
161 msg[3] = (msg_bytes << 4) | (send_bytes - 1);
162 memcpy(&msg[4], send, send_bytes);
163
164 for (retry = 0; retry < 7; retry++) {
165 ret = radeon_process_aux_ch(dig_connector->dp_i2c_bus,
166 msg, msg_bytes, NULL, 0, delay, &ack);
167 if (ret == -EBUSY)
168 continue;
169 else if (ret < 0)
170 return ret;
171 ack >>= 4;
172 if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_ACK)
173 return send_bytes;
174 else if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_DEFER)
175 usleep_range(400, 500);
176 else
177 return -EIO;
178 }
179
180 return -EIO;
181}
182
183static int radeon_dp_aux_native_read(struct radeon_connector *radeon_connector,
184 u16 address, u8 *recv, int recv_bytes, u8 delay)
185{ 149{
186 struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; 150 struct radeon_i2c_chan *chan =
187 u8 msg[4]; 151 container_of(aux, struct radeon_i2c_chan, aux);
188 int msg_bytes = 4;
189 u8 ack;
190 int ret; 152 int ret;
191 unsigned retry; 153 u8 tx_buf[20];
192 154 size_t tx_size;
193 msg[0] = address; 155 u8 ack, delay = 0;
194 msg[1] = address >> 8; 156
195 msg[2] = DP_AUX_NATIVE_READ << 4; 157 if (WARN_ON(msg->size > 16))
196 msg[3] = (msg_bytes << 4) | (recv_bytes - 1); 158 return -E2BIG;
197 159
198 for (retry = 0; retry < 7; retry++) { 160 tx_buf[0] = msg->address & 0xff;
199 ret = radeon_process_aux_ch(dig_connector->dp_i2c_bus, 161 tx_buf[1] = msg->address >> 8;
200 msg, msg_bytes, recv, recv_bytes, delay, &ack); 162 tx_buf[2] = msg->request << 4;
201 if (ret == -EBUSY) 163 tx_buf[3] = msg->size - 1;
202 continue; 164
203 else if (ret < 0) 165 switch (msg->request & ~DP_AUX_I2C_MOT) {
204 return ret; 166 case DP_AUX_NATIVE_WRITE:
205 ack >>= 4; 167 case DP_AUX_I2C_WRITE:
206 if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_ACK) 168 tx_size = HEADER_SIZE + msg->size;
207 return ret; 169 tx_buf[3] |= tx_size << 4;
208 else if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_DEFER) 170 memcpy(tx_buf + HEADER_SIZE, msg->buffer, msg->size);
209 usleep_range(400, 500); 171 ret = radeon_process_aux_ch(chan,
210 else if (ret == 0) 172 tx_buf, tx_size, NULL, 0, delay, &ack);
211 return -EPROTO; 173 if (ret >= 0)
212 else 174 /* Return payload size. */
213 return -EIO; 175 ret = msg->size;
176 break;
177 case DP_AUX_NATIVE_READ:
178 case DP_AUX_I2C_READ:
179 tx_size = HEADER_SIZE;
180 tx_buf[3] |= tx_size << 4;
181 ret = radeon_process_aux_ch(chan,
182 tx_buf, tx_size, msg->buffer, msg->size, delay, &ack);
183 break;
184 default:
185 ret = -EINVAL;
186 break;
214 } 187 }
215 188
216 return -EIO; 189 if (ret > 0)
217} 190 msg->reply = ack >> 4;
218 191
219static void radeon_write_dpcd_reg(struct radeon_connector *radeon_connector, 192 return ret;
220 u16 reg, u8 val)
221{
222 radeon_dp_aux_native_write(radeon_connector, reg, &val, 1, 0);
223} 193}
224 194
225static u8 radeon_read_dpcd_reg(struct radeon_connector *radeon_connector, 195void radeon_dp_aux_init(struct radeon_connector *radeon_connector)
226 u16 reg)
227{ 196{
228 u8 val = 0; 197 struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv;
229
230 radeon_dp_aux_native_read(radeon_connector, reg, &val, 1, 0);
231 198
232 return val; 199 dig_connector->dp_i2c_bus->aux.dev = radeon_connector->base.kdev;
200 dig_connector->dp_i2c_bus->aux.transfer = radeon_dp_aux_transfer;
233} 201}
234 202
235int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, 203int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
@@ -468,11 +436,11 @@ static void radeon_dp_probe_oui(struct radeon_connector *radeon_connector)
468 if (!(dig_connector->dpcd[DP_DOWN_STREAM_PORT_COUNT] & DP_OUI_SUPPORT)) 436 if (!(dig_connector->dpcd[DP_DOWN_STREAM_PORT_COUNT] & DP_OUI_SUPPORT))
469 return; 437 return;
470 438
471 if (radeon_dp_aux_native_read(radeon_connector, DP_SINK_OUI, buf, 3, 0)) 439 if (drm_dp_dpcd_read(&dig_connector->dp_i2c_bus->aux, DP_SINK_OUI, buf, 3))
472 DRM_DEBUG_KMS("Sink OUI: %02hx%02hx%02hx\n", 440 DRM_DEBUG_KMS("Sink OUI: %02hx%02hx%02hx\n",
473 buf[0], buf[1], buf[2]); 441 buf[0], buf[1], buf[2]);
474 442
475 if (radeon_dp_aux_native_read(radeon_connector, DP_BRANCH_OUI, buf, 3, 0)) 443 if (drm_dp_dpcd_read(&dig_connector->dp_i2c_bus->aux, DP_BRANCH_OUI, buf, 3))
476 DRM_DEBUG_KMS("Branch OUI: %02hx%02hx%02hx\n", 444 DRM_DEBUG_KMS("Branch OUI: %02hx%02hx%02hx\n",
477 buf[0], buf[1], buf[2]); 445 buf[0], buf[1], buf[2]);
478} 446}
@@ -483,8 +451,8 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector)
483 u8 msg[DP_DPCD_SIZE]; 451 u8 msg[DP_DPCD_SIZE];
484 int ret, i; 452 int ret, i;
485 453
486 ret = radeon_dp_aux_native_read(radeon_connector, DP_DPCD_REV, msg, 454 ret = drm_dp_dpcd_read(&dig_connector->dp_i2c_bus->aux, DP_DPCD_REV, msg,
487 DP_DPCD_SIZE, 0); 455 DP_DPCD_SIZE);
488 if (ret > 0) { 456 if (ret > 0) {
489 memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); 457 memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE);
490 DRM_DEBUG_KMS("DPCD: "); 458 DRM_DEBUG_KMS("DPCD: ");
@@ -506,6 +474,7 @@ int radeon_dp_get_panel_mode(struct drm_encoder *encoder,
506 struct drm_device *dev = encoder->dev; 474 struct drm_device *dev = encoder->dev;
507 struct radeon_device *rdev = dev->dev_private; 475 struct radeon_device *rdev = dev->dev_private;
508 struct radeon_connector *radeon_connector = to_radeon_connector(connector); 476 struct radeon_connector *radeon_connector = to_radeon_connector(connector);
477 struct radeon_connector_atom_dig *dig_connector;
509 int panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE; 478 int panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE;
510 u16 dp_bridge = radeon_connector_encoder_get_dp_bridge_encoder_id(connector); 479 u16 dp_bridge = radeon_connector_encoder_get_dp_bridge_encoder_id(connector);
511 u8 tmp; 480 u8 tmp;
@@ -513,9 +482,15 @@ int radeon_dp_get_panel_mode(struct drm_encoder *encoder,
513 if (!ASIC_IS_DCE4(rdev)) 482 if (!ASIC_IS_DCE4(rdev))
514 return panel_mode; 483 return panel_mode;
515 484
485 if (!radeon_connector->con_priv)
486 return panel_mode;
487
488 dig_connector = radeon_connector->con_priv;
489
516 if (dp_bridge != ENCODER_OBJECT_ID_NONE) { 490 if (dp_bridge != ENCODER_OBJECT_ID_NONE) {
517 /* DP bridge chips */ 491 /* DP bridge chips */
518 tmp = radeon_read_dpcd_reg(radeon_connector, DP_EDP_CONFIGURATION_CAP); 492 drm_dp_dpcd_readb(&dig_connector->dp_i2c_bus->aux,
493 DP_EDP_CONFIGURATION_CAP, &tmp);
519 if (tmp & 1) 494 if (tmp & 1)
520 panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; 495 panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE;
521 else if ((dp_bridge == ENCODER_OBJECT_ID_NUTMEG) || 496 else if ((dp_bridge == ENCODER_OBJECT_ID_NUTMEG) ||
@@ -525,7 +500,8 @@ int radeon_dp_get_panel_mode(struct drm_encoder *encoder,
525 panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE; 500 panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE;
526 } else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { 501 } else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
527 /* eDP */ 502 /* eDP */
528 tmp = radeon_read_dpcd_reg(radeon_connector, DP_EDP_CONFIGURATION_CAP); 503 drm_dp_dpcd_readb(&dig_connector->dp_i2c_bus->aux,
504 DP_EDP_CONFIGURATION_CAP, &tmp);
529 if (tmp & 1) 505 if (tmp & 1)
530 panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; 506 panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE;
531 } 507 }
@@ -576,9 +552,15 @@ int radeon_dp_mode_valid_helper(struct drm_connector *connector,
576static bool radeon_dp_get_link_status(struct radeon_connector *radeon_connector, 552static bool radeon_dp_get_link_status(struct radeon_connector *radeon_connector,
577 u8 link_status[DP_LINK_STATUS_SIZE]) 553 u8 link_status[DP_LINK_STATUS_SIZE])
578{ 554{
555 struct radeon_connector_atom_dig *dig_connector;
579 int ret; 556 int ret;
580 ret = radeon_dp_aux_native_read(radeon_connector, DP_LANE0_1_STATUS, 557
581 link_status, DP_LINK_STATUS_SIZE, 100); 558 if (!radeon_connector->con_priv)
559 return false;
560 dig_connector = radeon_connector->con_priv;
561
562 ret = drm_dp_dpcd_read(&dig_connector->dp_i2c_bus->aux, DP_LANE0_1_STATUS,
563 link_status, DP_LINK_STATUS_SIZE);
582 if (ret <= 0) { 564 if (ret <= 0) {
583 return false; 565 return false;
584 } 566 }
@@ -612,7 +594,7 @@ void radeon_dp_set_rx_power_state(struct drm_connector *connector,
612 594
613 /* power up/down the sink */ 595 /* power up/down the sink */
614 if (dig_connector->dpcd[0] >= 0x11) { 596 if (dig_connector->dpcd[0] >= 0x11) {
615 radeon_write_dpcd_reg(radeon_connector, 597 drm_dp_dpcd_writeb(&dig_connector->dp_i2c_bus->aux,
616 DP_SET_POWER, power_state); 598 DP_SET_POWER, power_state);
617 usleep_range(1000, 2000); 599 usleep_range(1000, 2000);
618 } 600 }
@@ -633,6 +615,7 @@ struct radeon_dp_link_train_info {
633 u8 link_status[DP_LINK_STATUS_SIZE]; 615 u8 link_status[DP_LINK_STATUS_SIZE];
634 u8 tries; 616 u8 tries;
635 bool use_dpencoder; 617 bool use_dpencoder;
618 struct drm_dp_aux *aux;
636}; 619};
637 620
638static void radeon_dp_update_vs_emph(struct radeon_dp_link_train_info *dp_info) 621static void radeon_dp_update_vs_emph(struct radeon_dp_link_train_info *dp_info)
@@ -643,8 +626,8 @@ static void radeon_dp_update_vs_emph(struct radeon_dp_link_train_info *dp_info)
643 0, dp_info->train_set[0]); /* sets all lanes at once */ 626 0, dp_info->train_set[0]); /* sets all lanes at once */
644 627
645 /* set the vs/emph on the sink */ 628 /* set the vs/emph on the sink */
646 radeon_dp_aux_native_write(dp_info->radeon_connector, DP_TRAINING_LANE0_SET, 629 drm_dp_dpcd_write(dp_info->aux, DP_TRAINING_LANE0_SET,
647 dp_info->train_set, dp_info->dp_lane_count, 0); 630 dp_info->train_set, dp_info->dp_lane_count);
648} 631}
649 632
650static void radeon_dp_set_tp(struct radeon_dp_link_train_info *dp_info, int tp) 633static void radeon_dp_set_tp(struct radeon_dp_link_train_info *dp_info, int tp)
@@ -679,7 +662,7 @@ static void radeon_dp_set_tp(struct radeon_dp_link_train_info *dp_info, int tp)
679 } 662 }
680 663
681 /* enable training pattern on the sink */ 664 /* enable training pattern on the sink */
682 radeon_write_dpcd_reg(dp_info->radeon_connector, DP_TRAINING_PATTERN_SET, tp); 665 drm_dp_dpcd_writeb(dp_info->aux, DP_TRAINING_PATTERN_SET, tp);
683} 666}
684 667
685static int radeon_dp_link_train_init(struct radeon_dp_link_train_info *dp_info) 668static int radeon_dp_link_train_init(struct radeon_dp_link_train_info *dp_info)
@@ -693,26 +676,26 @@ static int radeon_dp_link_train_init(struct radeon_dp_link_train_info *dp_info)
693 676
694 /* possibly enable downspread on the sink */ 677 /* possibly enable downspread on the sink */
695 if (dp_info->dpcd[3] & 0x1) 678 if (dp_info->dpcd[3] & 0x1)
696 radeon_write_dpcd_reg(dp_info->radeon_connector, 679 drm_dp_dpcd_writeb(dp_info->aux,
697 DP_DOWNSPREAD_CTRL, DP_SPREAD_AMP_0_5); 680 DP_DOWNSPREAD_CTRL, DP_SPREAD_AMP_0_5);
698 else 681 else
699 radeon_write_dpcd_reg(dp_info->radeon_connector, 682 drm_dp_dpcd_writeb(dp_info->aux,
700 DP_DOWNSPREAD_CTRL, 0); 683 DP_DOWNSPREAD_CTRL, 0);
701 684
702 if ((dp_info->connector->connector_type == DRM_MODE_CONNECTOR_eDP) && 685 if ((dp_info->connector->connector_type == DRM_MODE_CONNECTOR_eDP) &&
703 (dig->panel_mode == DP_PANEL_MODE_INTERNAL_DP2_MODE)) { 686 (dig->panel_mode == DP_PANEL_MODE_INTERNAL_DP2_MODE)) {
704 radeon_write_dpcd_reg(dp_info->radeon_connector, DP_EDP_CONFIGURATION_SET, 1); 687 drm_dp_dpcd_writeb(dp_info->aux, DP_EDP_CONFIGURATION_SET, 1);
705 } 688 }
706 689
707 /* set the lane count on the sink */ 690 /* set the lane count on the sink */
708 tmp = dp_info->dp_lane_count; 691 tmp = dp_info->dp_lane_count;
709 if (drm_dp_enhanced_frame_cap(dp_info->dpcd)) 692 if (drm_dp_enhanced_frame_cap(dp_info->dpcd))
710 tmp |= DP_LANE_COUNT_ENHANCED_FRAME_EN; 693 tmp |= DP_LANE_COUNT_ENHANCED_FRAME_EN;
711 radeon_write_dpcd_reg(dp_info->radeon_connector, DP_LANE_COUNT_SET, tmp); 694 drm_dp_dpcd_writeb(dp_info->aux, DP_LANE_COUNT_SET, tmp);
712 695
713 /* set the link rate on the sink */ 696 /* set the link rate on the sink */
714 tmp = drm_dp_link_rate_to_bw_code(dp_info->dp_clock); 697 tmp = drm_dp_link_rate_to_bw_code(dp_info->dp_clock);
715 radeon_write_dpcd_reg(dp_info->radeon_connector, DP_LINK_BW_SET, tmp); 698 drm_dp_dpcd_writeb(dp_info->aux, DP_LINK_BW_SET, tmp);
716 699
717 /* start training on the source */ 700 /* start training on the source */
718 if (ASIC_IS_DCE4(dp_info->rdev) || !dp_info->use_dpencoder) 701 if (ASIC_IS_DCE4(dp_info->rdev) || !dp_info->use_dpencoder)
@@ -723,9 +706,9 @@ static int radeon_dp_link_train_init(struct radeon_dp_link_train_info *dp_info)
723 dp_info->dp_clock, dp_info->enc_id, 0); 706 dp_info->dp_clock, dp_info->enc_id, 0);
724 707
725 /* disable the training pattern on the sink */ 708 /* disable the training pattern on the sink */
726 radeon_write_dpcd_reg(dp_info->radeon_connector, 709 drm_dp_dpcd_writeb(dp_info->aux,
727 DP_TRAINING_PATTERN_SET, 710 DP_TRAINING_PATTERN_SET,
728 DP_TRAINING_PATTERN_DISABLE); 711 DP_TRAINING_PATTERN_DISABLE);
729 712
730 return 0; 713 return 0;
731} 714}
@@ -735,9 +718,9 @@ static int radeon_dp_link_train_finish(struct radeon_dp_link_train_info *dp_info
735 udelay(400); 718 udelay(400);
736 719
737 /* disable the training pattern on the sink */ 720 /* disable the training pattern on the sink */
738 radeon_write_dpcd_reg(dp_info->radeon_connector, 721 drm_dp_dpcd_writeb(dp_info->aux,
739 DP_TRAINING_PATTERN_SET, 722 DP_TRAINING_PATTERN_SET,
740 DP_TRAINING_PATTERN_DISABLE); 723 DP_TRAINING_PATTERN_DISABLE);
741 724
742 /* disable the training pattern on the source */ 725 /* disable the training pattern on the source */
743 if (ASIC_IS_DCE4(dp_info->rdev) || !dp_info->use_dpencoder) 726 if (ASIC_IS_DCE4(dp_info->rdev) || !dp_info->use_dpencoder)
@@ -914,7 +897,7 @@ void radeon_dp_link_train(struct drm_encoder *encoder,
914 else 897 else
915 dp_info.enc_id |= ATOM_DP_CONFIG_LINK_A; 898 dp_info.enc_id |= ATOM_DP_CONFIG_LINK_A;
916 899
917 tmp = radeon_read_dpcd_reg(radeon_connector, DP_MAX_LANE_COUNT); 900 drm_dp_dpcd_readb(&dig_connector->dp_i2c_bus->aux, DP_MAX_LANE_COUNT, &tmp);
918 if (ASIC_IS_DCE5(rdev) && (tmp & DP_TPS3_SUPPORTED)) 901 if (ASIC_IS_DCE5(rdev) && (tmp & DP_TPS3_SUPPORTED))
919 dp_info.tp3_supported = true; 902 dp_info.tp3_supported = true;
920 else 903 else
@@ -927,6 +910,7 @@ void radeon_dp_link_train(struct drm_encoder *encoder,
927 dp_info.radeon_connector = radeon_connector; 910 dp_info.radeon_connector = radeon_connector;
928 dp_info.dp_lane_count = dig_connector->dp_lane_count; 911 dp_info.dp_lane_count = dig_connector->dp_lane_count;
929 dp_info.dp_clock = dig_connector->dp_clock; 912 dp_info.dp_clock = dig_connector->dp_clock;
913 dp_info.aux = &dig_connector->dp_i2c_bus->aux;
930 914
931 if (radeon_dp_link_train_init(&dp_info)) 915 if (radeon_dp_link_train_init(&dp_info))
932 goto done; 916 goto done;
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 82d4f865546e..ec958e86fd8b 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -1595,6 +1595,7 @@ radeon_add_atom_connector(struct drm_device *dev,
1595 uint32_t subpixel_order = SubPixelNone; 1595 uint32_t subpixel_order = SubPixelNone;
1596 bool shared_ddc = false; 1596 bool shared_ddc = false;
1597 bool is_dp_bridge = false; 1597 bool is_dp_bridge = false;
1598 bool has_aux = false;
1598 1599
1599 if (connector_type == DRM_MODE_CONNECTOR_Unknown) 1600 if (connector_type == DRM_MODE_CONNECTOR_Unknown)
1600 return; 1601 return;
@@ -1672,7 +1673,9 @@ radeon_add_atom_connector(struct drm_device *dev,
1672 radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "eDP-auxch"); 1673 radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "eDP-auxch");
1673 else 1674 else
1674 radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); 1675 radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch");
1675 if (!radeon_dig_connector->dp_i2c_bus) 1676 if (radeon_dig_connector->dp_i2c_bus)
1677 has_aux = true;
1678 else
1676 DRM_ERROR("DP: Failed to assign dp ddc bus! Check dmesg for i2c errors.\n"); 1679 DRM_ERROR("DP: Failed to assign dp ddc bus! Check dmesg for i2c errors.\n");
1677 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1680 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1678 if (!radeon_connector->ddc_bus) 1681 if (!radeon_connector->ddc_bus)
@@ -1895,7 +1898,9 @@ radeon_add_atom_connector(struct drm_device *dev,
1895 if (!radeon_dig_connector->dp_i2c_bus) 1898 if (!radeon_dig_connector->dp_i2c_bus)
1896 DRM_ERROR("DP: Failed to assign dp ddc bus! Check dmesg for i2c errors.\n"); 1899 DRM_ERROR("DP: Failed to assign dp ddc bus! Check dmesg for i2c errors.\n");
1897 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1900 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1898 if (!radeon_connector->ddc_bus) 1901 if (radeon_connector->ddc_bus)
1902 has_aux = true;
1903 else
1899 DRM_ERROR("DP: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); 1904 DRM_ERROR("DP: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1900 } 1905 }
1901 subpixel_order = SubPixelHorizontalRGB; 1906 subpixel_order = SubPixelHorizontalRGB;
@@ -1939,7 +1944,9 @@ radeon_add_atom_connector(struct drm_device *dev,
1939 if (i2c_bus->valid) { 1944 if (i2c_bus->valid) {
1940 /* add DP i2c bus */ 1945 /* add DP i2c bus */
1941 radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "eDP-auxch"); 1946 radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "eDP-auxch");
1942 if (!radeon_dig_connector->dp_i2c_bus) 1947 if (radeon_dig_connector->dp_i2c_bus)
1948 has_aux = true;
1949 else
1943 DRM_ERROR("DP: Failed to assign dp ddc bus! Check dmesg for i2c errors.\n"); 1950 DRM_ERROR("DP: Failed to assign dp ddc bus! Check dmesg for i2c errors.\n");
1944 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1951 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1945 if (!radeon_connector->ddc_bus) 1952 if (!radeon_connector->ddc_bus)
@@ -2000,6 +2007,10 @@ radeon_add_atom_connector(struct drm_device *dev,
2000 2007
2001 connector->display_info.subpixel_order = subpixel_order; 2008 connector->display_info.subpixel_order = subpixel_order;
2002 drm_sysfs_connector_add(connector); 2009 drm_sysfs_connector_add(connector);
2010
2011 if (has_aux)
2012 radeon_dp_aux_init(radeon_connector);
2013
2003 return; 2014 return;
2004 2015
2005failed: 2016failed:
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index e390f559e496..832d9fa1a4c4 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -192,6 +192,7 @@ struct radeon_i2c_chan {
192 struct i2c_algo_dp_aux_data dp; 192 struct i2c_algo_dp_aux_data dp;
193 } algo; 193 } algo;
194 struct radeon_i2c_bus_rec rec; 194 struct radeon_i2c_bus_rec rec;
195 struct drm_dp_aux aux;
195}; 196};
196 197
197/* mostly for macs, but really any system without connector tables */ 198/* mostly for macs, but really any system without connector tables */
@@ -692,6 +693,7 @@ extern int radeon_dp_get_panel_mode(struct drm_encoder *encoder,
692 struct drm_connector *connector); 693 struct drm_connector *connector);
693extern void radeon_dp_set_rx_power_state(struct drm_connector *connector, 694extern void radeon_dp_set_rx_power_state(struct drm_connector *connector,
694 u8 power_state); 695 u8 power_state);
696extern void radeon_dp_aux_init(struct radeon_connector *radeon_connector);
695extern void atombios_dig_encoder_setup(struct drm_encoder *encoder, int action, int panel_mode); 697extern void atombios_dig_encoder_setup(struct drm_encoder *encoder, int action, int panel_mode);
696extern void radeon_atom_encoder_init(struct radeon_device *rdev); 698extern void radeon_atom_encoder_init(struct radeon_device *rdev);
697extern void radeon_atom_disp_eng_pll_init(struct radeon_device *rdev); 699extern void radeon_atom_disp_eng_pll_init(struct radeon_device *rdev);