2 * Copyright 2008 Advanced Micro Devices, Inc.
3 * Copyright 2008 Red Hat Inc.
4 * Copyright 2009 Christian König.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
24 * Authors: Christian König
26 #include <linux/hdmi.h>
27 #include <linux/gcd.h>
29 #include <drm/radeon_drm.h>
31 #include "radeon_asic.h"
32 #include "radeon_audio.h"
39 enum r600_hdmi_color_format {
46 * IEC60958 status bits
48 enum r600_hdmi_iec_status_bits {
49 AUDIO_STATUS_DIG_ENABLE = 0x01,
50 AUDIO_STATUS_V = 0x02,
51 AUDIO_STATUS_VCFG = 0x04,
52 AUDIO_STATUS_EMPHASIS = 0x08,
53 AUDIO_STATUS_COPYRIGHT = 0x10,
54 AUDIO_STATUS_NONAUDIO = 0x20,
55 AUDIO_STATUS_PROFESSIONAL = 0x40,
56 AUDIO_STATUS_LEVEL = 0x80
59 static const struct radeon_hdmi_acr r600_hdmi_predefined_acr[] = {
60 /* 32kHz 44.1kHz 48kHz */
61 /* Clock N CTS N CTS N CTS */
62 { 25175, 4096, 25175, 28224, 125875, 6144, 25175 }, /* 25,20/1.001 MHz */
63 { 25200, 4096, 25200, 6272, 28000, 6144, 25200 }, /* 25.20 MHz */
64 { 27000, 4096, 27000, 6272, 30000, 6144, 27000 }, /* 27.00 MHz */
65 { 27027, 4096, 27027, 6272, 30030, 6144, 27027 }, /* 27.00*1.001 MHz */
66 { 54000, 4096, 54000, 6272, 60000, 6144, 54000 }, /* 54.00 MHz */
67 { 54054, 4096, 54054, 6272, 60060, 6144, 54054 }, /* 54.00*1.001 MHz */
68 { 74176, 4096, 74176, 5733, 75335, 6144, 74176 }, /* 74.25/1.001 MHz */
69 { 74250, 4096, 74250, 6272, 82500, 6144, 74250 }, /* 74.25 MHz */
70 { 148352, 4096, 148352, 5733, 150670, 6144, 148352 }, /* 148.50/1.001 MHz */
71 { 148500, 4096, 148500, 6272, 165000, 6144, 148500 }, /* 148.50 MHz */
74 static struct r600_audio_pin r600_audio_status(struct radeon_device *rdev)
76 struct r600_audio_pin status;
79 value = RREG32(R600_AUDIO_RATE_BPS_CHANNEL);
81 /* number of channels */
82 status.channels = (value & 0x7) + 1;
85 switch ((value & 0xF0) >> 4) {
87 status.bits_per_sample = 8;
90 status.bits_per_sample = 16;
93 status.bits_per_sample = 20;
96 status.bits_per_sample = 24;
99 status.bits_per_sample = 32;
102 dev_err(rdev->dev, "Unknown bits per sample 0x%x, using 16\n",
104 status.bits_per_sample = 16;
107 /* current sampling rate in HZ */
112 status.rate *= ((value >> 11) & 0x7) + 1;
113 status.rate /= ((value >> 8) & 0x7) + 1;
115 value = RREG32(R600_AUDIO_STATUS_BITS);
117 /* iec 60958 status bits */
118 status.status_bits = value & 0xff;
120 /* iec 60958 category code */
121 status.category_code = (value >> 8) & 0xff;
127 * update all hdmi interfaces with current audio parameters
129 void r600_audio_update_hdmi(struct work_struct *work)
131 struct radeon_device *rdev = container_of(work, struct radeon_device,
133 struct drm_device *dev = rdev->ddev;
134 struct r600_audio_pin audio_status = r600_audio_status(rdev);
135 struct drm_encoder *encoder;
136 bool changed = false;
138 if (rdev->audio.pin[0].channels != audio_status.channels ||
139 rdev->audio.pin[0].rate != audio_status.rate ||
140 rdev->audio.pin[0].bits_per_sample != audio_status.bits_per_sample ||
141 rdev->audio.pin[0].status_bits != audio_status.status_bits ||
142 rdev->audio.pin[0].category_code != audio_status.category_code) {
143 rdev->audio.pin[0] = audio_status;
147 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
148 if (!radeon_encoder_is_digital(encoder))
150 if (changed || r600_hdmi_buffer_status_changed(encoder))
151 r600_hdmi_update_audio_settings(encoder);
155 /* enable the audio stream */
156 void r600_audio_enable(struct radeon_device *rdev,
157 struct r600_audio_pin *pin,
160 u32 tmp = RREG32(AZ_HOT_PLUG_CONTROL);
166 tmp |= AUDIO_ENABLED;
168 tmp |= PIN0_AUDIO_ENABLED;
170 tmp |= PIN1_AUDIO_ENABLED;
172 tmp |= PIN2_AUDIO_ENABLED;
174 tmp |= PIN3_AUDIO_ENABLED;
176 tmp &= ~(AUDIO_ENABLED |
183 WREG32(AZ_HOT_PLUG_CONTROL, tmp);
186 struct r600_audio_pin *r600_audio_get_pin(struct radeon_device *rdev)
188 /* only one pin on 6xx-NI */
189 return &rdev->audio.pin[0];
193 * calculate CTS and N values if they are not found in the table
195 static void r600_hdmi_calc_cts(uint32_t clock, int *CTS, int *N, int freq)
198 unsigned long div, mul;
200 /* Safe, but overly large values */
204 /* Smallest valid fraction */
211 * The optimal N is 128*freq/1000. Calculate the closest larger
212 * value that doesn't truncate any bits.
214 mul = ((128*freq/1000) + (n-1))/n;
219 /* Check that we are in spec (not always possible) */
220 if (n < (128*freq/1500))
221 printk(KERN_WARNING "Calculated ACR N value is too small. You may experience audio problems.\n");
222 if (n > (128*freq/300))
223 printk(KERN_WARNING "Calculated ACR N value is too large. You may experience audio problems.\n");
228 DRM_DEBUG("Calculated ACR timing N=%d CTS=%d for frequency %d\n",
232 struct radeon_hdmi_acr r600_hdmi_acr(uint32_t clock)
234 struct radeon_hdmi_acr res;
237 /* Precalculated values for common clocks */
238 for (i = 0; i < ARRAY_SIZE(r600_hdmi_predefined_acr); i++) {
239 if (r600_hdmi_predefined_acr[i].clock == clock)
240 return r600_hdmi_predefined_acr[i];
243 /* And odd clocks get manually calculated */
244 r600_hdmi_calc_cts(clock, &res.cts_32khz, &res.n_32khz, 32000);
245 r600_hdmi_calc_cts(clock, &res.cts_44_1khz, &res.n_44_1khz, 44100);
246 r600_hdmi_calc_cts(clock, &res.cts_48khz, &res.n_48khz, 48000);
252 * update the N and CTS parameters for a given pixel clock rate
254 void r600_hdmi_update_ACR(struct drm_encoder *encoder, uint32_t clock)
256 struct drm_device *dev = encoder->dev;
257 struct radeon_device *rdev = dev->dev_private;
258 struct radeon_hdmi_acr acr = r600_hdmi_acr(clock);
259 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
260 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
261 uint32_t offset = dig->afmt->offset;
263 WREG32_P(HDMI0_ACR_32_0 + offset,
264 HDMI0_ACR_CTS_32(acr.cts_32khz),
265 ~HDMI0_ACR_CTS_32_MASK);
266 WREG32_P(HDMI0_ACR_32_1 + offset,
267 HDMI0_ACR_N_32(acr.n_32khz),
268 ~HDMI0_ACR_N_32_MASK);
270 WREG32_P(HDMI0_ACR_44_0 + offset,
271 HDMI0_ACR_CTS_44(acr.cts_44_1khz),
272 ~HDMI0_ACR_CTS_44_MASK);
273 WREG32_P(HDMI0_ACR_44_1 + offset,
274 HDMI0_ACR_N_44(acr.n_44_1khz),
275 ~HDMI0_ACR_N_44_MASK);
277 WREG32_P(HDMI0_ACR_48_0 + offset,
278 HDMI0_ACR_CTS_48(acr.cts_48khz),
279 ~HDMI0_ACR_CTS_48_MASK);
280 WREG32_P(HDMI0_ACR_48_1 + offset,
281 HDMI0_ACR_N_48(acr.n_48khz),
282 ~HDMI0_ACR_N_48_MASK);
286 * build a HDMI Video Info Frame
288 void r600_update_avi_infoframe(struct radeon_device *rdev, u32 offset,
289 unsigned char *buffer, size_t size)
291 uint8_t *frame = buffer + 3;
293 WREG32(HDMI0_AVI_INFO0 + offset,
294 frame[0x0] | (frame[0x1] << 8) | (frame[0x2] << 16) | (frame[0x3] << 24));
295 WREG32(HDMI0_AVI_INFO1 + offset,
296 frame[0x4] | (frame[0x5] << 8) | (frame[0x6] << 16) | (frame[0x7] << 24));
297 WREG32(HDMI0_AVI_INFO2 + offset,
298 frame[0x8] | (frame[0x9] << 8) | (frame[0xA] << 16) | (frame[0xB] << 24));
299 WREG32(HDMI0_AVI_INFO3 + offset,
300 frame[0xC] | (frame[0xD] << 8) | (buffer[1] << 24));
304 * build a Audio Info Frame
306 static void r600_hdmi_update_audio_infoframe(struct drm_encoder *encoder,
307 const void *buffer, size_t size)
309 struct drm_device *dev = encoder->dev;
310 struct radeon_device *rdev = dev->dev_private;
311 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
312 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
313 uint32_t offset = dig->afmt->offset;
314 const u8 *frame = buffer + 3;
316 WREG32(HDMI0_AUDIO_INFO0 + offset,
317 frame[0x0] | (frame[0x1] << 8) | (frame[0x2] << 16) | (frame[0x3] << 24));
318 WREG32(HDMI0_AUDIO_INFO1 + offset,
319 frame[0x4] | (frame[0x5] << 8) | (frame[0x6] << 16) | (frame[0x8] << 24));
323 * test if audio buffer is filled enough to start playing
325 static bool r600_hdmi_is_audio_buffer_filled(struct drm_encoder *encoder)
327 struct drm_device *dev = encoder->dev;
328 struct radeon_device *rdev = dev->dev_private;
329 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
330 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
331 uint32_t offset = dig->afmt->offset;
333 return (RREG32(HDMI0_STATUS + offset) & 0x10) != 0;
337 * have buffer status changed since last call?
339 int r600_hdmi_buffer_status_changed(struct drm_encoder *encoder)
341 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
342 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
345 if (!dig->afmt || !dig->afmt->enabled)
348 status = r600_hdmi_is_audio_buffer_filled(encoder);
349 result = dig->afmt->last_buffer_filled_status != status;
350 dig->afmt->last_buffer_filled_status = status;
356 * write the audio workaround status to the hardware
358 void r600_hdmi_audio_workaround(struct drm_encoder *encoder)
360 struct drm_device *dev = encoder->dev;
361 struct radeon_device *rdev = dev->dev_private;
362 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
363 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
364 uint32_t offset = dig->afmt->offset;
365 bool hdmi_audio_workaround = false; /* FIXME */
368 if (!hdmi_audio_workaround ||
369 r600_hdmi_is_audio_buffer_filled(encoder))
370 value = 0; /* disable workaround */
372 value = HDMI0_AUDIO_TEST_EN; /* enable workaround */
373 WREG32_P(HDMI0_AUDIO_PACKET_CONTROL + offset,
374 value, ~HDMI0_AUDIO_TEST_EN);
377 void r600_hdmi_audio_set_dto(struct radeon_device *rdev,
378 struct radeon_crtc *crtc, unsigned int clock)
380 struct radeon_encoder *radeon_encoder;
381 struct radeon_encoder_atom_dig *dig;
386 radeon_encoder = to_radeon_encoder(crtc->encoder);
387 dig = radeon_encoder->enc_priv;
392 if (dig->dig_encoder == 0) {
393 WREG32(DCCG_AUDIO_DTO0_PHASE, 24000 * 100);
394 WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100);
395 WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */
397 WREG32(DCCG_AUDIO_DTO1_PHASE, 24000 * 100);
398 WREG32(DCCG_AUDIO_DTO1_MODULE, clock * 100);
399 WREG32(DCCG_AUDIO_DTO_SELECT, 1); /* select DTO1 */
404 * update the info frames with the data from the current display mode
406 void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mode)
408 struct drm_device *dev = encoder->dev;
409 struct radeon_device *rdev = dev->dev_private;
410 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
411 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
412 u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE];
413 struct hdmi_avi_infoframe frame;
418 if (!dig || !dig->afmt)
421 /* Silent, r600_hdmi_enable will raise WARN for us */
422 if (!dig->afmt->enabled)
424 offset = dig->afmt->offset;
426 /* disable audio prior to setting up hw */
427 dig->afmt->pin = radeon_audio_get_pin(encoder);
428 radeon_audio_enable(rdev, dig->afmt->pin, 0);
430 radeon_audio_set_dto(encoder, mode->clock);
432 WREG32_P(HDMI0_AUDIO_PACKET_CONTROL + offset,
433 HDMI0_AUDIO_SAMPLE_SEND | /* send audio packets */
434 HDMI0_AUDIO_DELAY_EN(1) | /* default audio delay */
435 HDMI0_AUDIO_PACKETS_PER_LINE(3) | /* should be suffient for all audio modes and small enough for all hblanks */
436 HDMI0_60958_CS_UPDATE, /* allow 60958 channel status fields to be updated */
437 ~(HDMI0_AUDIO_SAMPLE_SEND |
438 HDMI0_AUDIO_DELAY_EN_MASK |
439 HDMI0_AUDIO_PACKETS_PER_LINE_MASK |
440 HDMI0_60958_CS_UPDATE));
442 /* DCE 3.0 uses register that's normally for CRC_CONTROL */
443 acr_ctl = ASIC_IS_DCE3(rdev) ? DCE3_HDMI0_ACR_PACKET_CONTROL :
444 HDMI0_ACR_PACKET_CONTROL;
445 WREG32_P(acr_ctl + offset,
446 HDMI0_ACR_SOURCE | /* select SW CTS value - XXX verify that hw CTS works on all families */
447 HDMI0_ACR_AUTO_SEND, /* allow hw to sent ACR packets when required */
449 HDMI0_ACR_AUTO_SEND));
451 WREG32_OR(HDMI0_VBI_PACKET_CONTROL + offset,
452 HDMI0_NULL_SEND | /* send null packets when required */
453 HDMI0_GC_SEND | /* send general control packets */
454 HDMI0_GC_CONT); /* send general control packets every frame */
456 WREG32_OR(HDMI0_INFOFRAME_CONTROL0 + offset,
457 HDMI0_AVI_INFO_SEND | /* enable AVI info frames */
458 HDMI0_AVI_INFO_CONT | /* send AVI info frames every frame/field */
459 HDMI0_AUDIO_INFO_SEND | /* enable audio info frames (frames won't be set until audio is enabled) */
460 HDMI0_AUDIO_INFO_UPDATE); /* required for audio info values to be updated */
462 WREG32_P(HDMI0_INFOFRAME_CONTROL1 + offset,
463 HDMI0_AVI_INFO_LINE(2) | /* anything other than 0 */
464 HDMI0_AUDIO_INFO_LINE(2), /* anything other than 0 */
465 ~(HDMI0_AVI_INFO_LINE_MASK |
466 HDMI0_AUDIO_INFO_LINE_MASK));
468 WREG32_AND(HDMI0_GC + offset,
469 ~HDMI0_GC_AVMUTE); /* unset HDMI0_GC_AVMUTE */
471 err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
473 DRM_ERROR("failed to setup AVI infoframe: %zd\n", err);
477 err = hdmi_avi_infoframe_pack(&frame, buffer, sizeof(buffer));
479 DRM_ERROR("failed to pack AVI infoframe: %zd\n", err);
483 radeon_update_avi_infoframe(encoder, buffer, sizeof(buffer));
485 /* fglrx duplicates INFOFRAME_CONTROL0 & INFOFRAME_CONTROL1 ops here */
487 WREG32_AND(HDMI0_GENERIC_PACKET_CONTROL + offset,
488 ~(HDMI0_GENERIC0_SEND |
489 HDMI0_GENERIC0_CONT |
490 HDMI0_GENERIC0_UPDATE |
491 HDMI0_GENERIC1_SEND |
492 HDMI0_GENERIC1_CONT |
493 HDMI0_GENERIC0_LINE_MASK |
494 HDMI0_GENERIC1_LINE_MASK));
496 r600_hdmi_update_ACR(encoder, mode->clock);
498 WREG32_P(HDMI0_60958_0 + offset,
499 HDMI0_60958_CS_CHANNEL_NUMBER_L(1),
500 ~(HDMI0_60958_CS_CHANNEL_NUMBER_L_MASK |
501 HDMI0_60958_CS_CLOCK_ACCURACY_MASK));
503 WREG32_P(HDMI0_60958_1 + offset,
504 HDMI0_60958_CS_CHANNEL_NUMBER_R(2),
505 ~HDMI0_60958_CS_CHANNEL_NUMBER_R_MASK);
507 /* it's unknown what these bits do excatly, but it's indeed quite useful for debugging */
508 WREG32(HDMI0_RAMP_CONTROL0 + offset, 0x00FFFFFF);
509 WREG32(HDMI0_RAMP_CONTROL1 + offset, 0x007FFFFF);
510 WREG32(HDMI0_RAMP_CONTROL2 + offset, 0x00000001);
511 WREG32(HDMI0_RAMP_CONTROL3 + offset, 0x00000001);
513 /* enable audio after to setting up hw */
514 radeon_audio_enable(rdev, dig->afmt->pin, 0xf);
518 * r600_hdmi_update_audio_settings - Update audio infoframe
520 * @encoder: drm encoder
522 * Gets info about current audio stream and updates audio infoframe.
524 void r600_hdmi_update_audio_settings(struct drm_encoder *encoder)
526 struct drm_device *dev = encoder->dev;
527 struct radeon_device *rdev = dev->dev_private;
528 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
529 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
530 struct r600_audio_pin audio = r600_audio_status(rdev);
531 uint8_t buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AUDIO_INFOFRAME_SIZE];
532 struct hdmi_audio_infoframe frame;
537 if (!dig->afmt || !dig->afmt->enabled)
539 offset = dig->afmt->offset;
541 DRM_DEBUG("%s with %d channels, %d Hz sampling rate, %d bits per sample,\n",
542 r600_hdmi_is_audio_buffer_filled(encoder) ? "playing" : "stopped",
543 audio.channels, audio.rate, audio.bits_per_sample);
544 DRM_DEBUG("0x%02X IEC60958 status bits and 0x%02X category code\n",
545 (int)audio.status_bits, (int)audio.category_code);
547 err = hdmi_audio_infoframe_init(&frame);
549 DRM_ERROR("failed to setup audio infoframe\n");
553 frame.channels = audio.channels;
555 err = hdmi_audio_infoframe_pack(&frame, buffer, sizeof(buffer));
557 DRM_ERROR("failed to pack audio infoframe\n");
561 value = RREG32(HDMI0_AUDIO_PACKET_CONTROL + offset);
562 if (value & HDMI0_AUDIO_TEST_EN)
563 WREG32(HDMI0_AUDIO_PACKET_CONTROL + offset,
564 value & ~HDMI0_AUDIO_TEST_EN);
566 WREG32_OR(HDMI0_CONTROL + offset,
569 WREG32_AND(HDMI0_INFOFRAME_CONTROL0 + offset,
570 ~HDMI0_AUDIO_INFO_SOURCE);
572 r600_hdmi_update_audio_infoframe(encoder, buffer, sizeof(buffer));
574 WREG32_OR(HDMI0_INFOFRAME_CONTROL0 + offset,
575 HDMI0_AUDIO_INFO_CONT |
576 HDMI0_AUDIO_INFO_UPDATE);
580 * enable the HDMI engine
582 void r600_hdmi_enable(struct drm_encoder *encoder, bool enable)
584 struct drm_device *dev = encoder->dev;
585 struct radeon_device *rdev = dev->dev_private;
586 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
587 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
588 u32 hdmi = HDMI0_ERROR_ACK;
590 if (!dig || !dig->afmt)
593 /* Silent, r600_hdmi_enable will raise WARN for us */
594 if (enable && dig->afmt->enabled)
596 if (!enable && !dig->afmt->enabled)
599 if (!enable && dig->afmt->pin) {
600 radeon_audio_enable(rdev, dig->afmt->pin, 0);
601 dig->afmt->pin = NULL;
604 /* Older chipsets require setting HDMI and routing manually */
605 if (!ASIC_IS_DCE3(rdev)) {
607 hdmi |= HDMI0_ENABLE;
608 switch (radeon_encoder->encoder_id) {
609 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1:
611 WREG32_OR(AVIVO_TMDSA_CNTL, AVIVO_TMDSA_CNTL_HDMI_EN);
612 hdmi |= HDMI0_STREAM(HDMI0_STREAM_TMDSA);
614 WREG32_AND(AVIVO_TMDSA_CNTL, ~AVIVO_TMDSA_CNTL_HDMI_EN);
617 case ENCODER_OBJECT_ID_INTERNAL_LVTM1:
619 WREG32_OR(AVIVO_LVTMA_CNTL, AVIVO_LVTMA_CNTL_HDMI_EN);
620 hdmi |= HDMI0_STREAM(HDMI0_STREAM_LVTMA);
622 WREG32_AND(AVIVO_LVTMA_CNTL, ~AVIVO_LVTMA_CNTL_HDMI_EN);
625 case ENCODER_OBJECT_ID_INTERNAL_DDI:
627 WREG32_OR(DDIA_CNTL, DDIA_HDMI_EN);
628 hdmi |= HDMI0_STREAM(HDMI0_STREAM_DDIA);
630 WREG32_AND(DDIA_CNTL, ~DDIA_HDMI_EN);
633 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
635 hdmi |= HDMI0_STREAM(HDMI0_STREAM_DVOA);
638 dev_err(rdev->dev, "Invalid encoder for HDMI: 0x%X\n",
639 radeon_encoder->encoder_id);
642 WREG32(HDMI0_CONTROL + dig->afmt->offset, hdmi);
645 if (rdev->irq.installed) {
646 /* if irq is available use it */
647 /* XXX: shouldn't need this on any asics. Double check DCE2/3 */
649 radeon_irq_kms_enable_afmt(rdev, dig->afmt->id);
651 radeon_irq_kms_disable_afmt(rdev, dig->afmt->id);
654 dig->afmt->enabled = enable;
656 DRM_DEBUG("%sabling HDMI interface @ 0x%04X for encoder 0x%x\n",
657 enable ? "En" : "Dis", dig->afmt->offset, radeon_encoder->encoder_id);