History log of /linux-master/drivers/gpu/drm/radeon/r600_hdmi.c
Revision Date Author Comments
# 312226f9 16-Nov-2020 Lee Jones <lee.jones@linaro.org>

drm/radeon/radeon_audio: Move 'r600_*' prototypes into shared header

Fixes the following W=1 kernel build warning(s):

drivers/gpu/drm/radeon/r600_hdmi.c:177:6: warning: no previous prototype for ‘r600_hdmi_update_acr’ [-Wmissing-prototypes]
177 | void r600_hdmi_update_acr(struct drm_encoder *encoder, long offset,
| ^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/radeon/r600_hdmi.c:217:6: warning: no previous prototype for ‘r600_set_avi_packet’ [-Wmissing-prototypes]
217 | void r600_set_avi_packet(struct radeon_device *rdev, u32 offset,
| ^~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/radeon/r600_hdmi.c:314:6: warning: no previous prototype for ‘r600_hdmi_audio_set_dto’ [-Wmissing-prototypes]
314 | void r600_hdmi_audio_set_dto(struct radeon_device *rdev,
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/radeon/r600_hdmi.c:340:6: warning: no previous prototype for ‘r600_set_vbi_packet’ [-Wmissing-prototypes]
340 | void r600_set_vbi_packet(struct drm_encoder *encoder, u32 offset)
| ^~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/radeon/r600_hdmi.c:351:6: warning: no previous prototype for ‘r600_set_audio_packet’ [-Wmissing-prototypes]
351 | void r600_set_audio_packet(struct drm_encoder *encoder, u32 offset)
| ^~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/radeon/r600_hdmi.c:393:6: warning: no previous prototype for ‘r600_set_mute’ [-Wmissing-prototypes]
393 | void r600_set_mute(struct drm_encoder *encoder, u32 offset, bool mute)
| ^~~~~~~~~~~~~
drivers/gpu/drm/radeon/r600_hdmi.c:469:6: warning: no previous prototype for ‘r600_hdmi_enable’ [-Wmissing-prototypes]
469 | void r600_hdmi_enable(struct drm_encoder *encoder, bool enable)
| ^~~~~~~~~~~~~~~~

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# c182615f 08-Jun-2019 Sam Ravnborg <sam@ravnborg.org>

drm/radeon: drop use of drmP.h (2/2)

Drop use of drmP.h in remaining .c files.
To ease review a little the drmP.h removal was divided in two commits.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190608080241.4958-8-sam@ravnborg.org


# e8820646 15-Sep-2017 Arnd Bergmann <arnd@arndb.de>

drm/radeon: properly initialize r600_audio_status() data

The structure returned from r600_audio_status() is only partially
initialized, and older gcc versions (4.3 and 4.4) warn about this:

drivers/gpu/drm/radeon/r600_hdmi.c: In function 'r600_audio_status':
drivers/gpu/drm/radeon/r600_hdmi.c:108: error: 'status.id' is used uninitialized in this function
drivers/gpu/drm/radeon/r600_hdmi.c:108: error: 'status.connected' is used uninitialized in this function
drivers/gpu/drm/radeon/r600_hdmi.c:108: error: 'status.offset' is used uninitialized in this function

This is harmless and surprisingly correct in C99, as the caller
only accesses the fields that got initialized, so newer compilers
don't warn about it, but initializing the entire structure feels
like the right thing to do here and avoids the warning.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 3cf8bb1a 15-Mar-2016 Jérome Glisse <jglisse@redhat.com>

drm/radeon: fix indentation.

I hate doing this but it hurts my eyes to go over code that does not
comply with indentation rules. Only thing that is not only space change
is in atom.c all other files are space indentation issues.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 304f07e9 31-Mar-2015 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: fix ordering of AVI packet setup

Set the line first, then enable the stream. May fix
pink line problems on some displays.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org


# add7d759 27-Feb-2015 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: fix the audio dpms callbacks

Don't touch the audio enable bits as these are already
handled in display detection. Enable the hdmi secondary
streams in hdmi enable to match dp. Rename dp dpms
callback to be consistent with hdmi.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=89327
https://bugzilla.kernel.org/show_bug.cgi?id=93921

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 6e72376d 10-Dec-2014 Slava Grigorev <slava.grigorev@amd.com>

radeon/audio: consolidate audio_mode_set() functions

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 7f604077 09-Dec-2014 Slava Grigorev <slava.grigorev@amd.com>

radeon/audio: removed unnecessary debug settings

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 3be2e7d0 09-Dec-2014 Slava Grigorev <slava.grigorev@amd.com>

radeon/audio: moved mute programming to a separate function

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 1852c9a0 09-Dec-2014 Slava Grigorev <slava.grigorev@amd.com>

radeon/audio: moved audio packet programming to a separate function

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# baa7d8e4 08-Dec-2014 Slava Grigorev <slava.grigorev@amd.com>

radeon/audio: set_avi_packet() function cleanup

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# be273e58 08-Dec-2014 Slava Grigorev <slava.grigorev@amd.com>

radeon: moved HDMI color depth programming to a separate function

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 930a9785 20-Jan-2015 Alex Deucher <alexander.deucher@amd.com>

radeon/audio: moved VBI packet programming to separate functions

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 64424d6e 06-Dec-2014 Slava Grigorev <slava.grigorev@amd.com>

radeon/audio: consolidate update_acr() functions (v2)

V2: fix missing dce6 callback

Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 96ea7afb 05-Dec-2014 Slava Grigorev <slava.grigorev@amd.com>

radeon/audio: consolidate update_avi_infoframe() functions

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# a85d682a 05-Dec-2014 Slava Grigorev <slava.grigorev@amd.com>

radeon/audio: consolidate audio_set_dto() functions

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 7991d665 03-Dec-2014 Slava Grigorev <slava.grigorev@amd.com>

radeon/audio: consolidate audio_fini() functions

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 8bf59820 03-Dec-2014 Slava Grigorev <slava.grigorev@amd.com>

radeon/audio: consolidate audio_enable() functions

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 3cdde027 02-Dec-2014 Slava Grigorev <slava.grigorev@amd.com>

radeon/audio: consolidate audio_get_pin() functions

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# bfc1f97d 22-Dec-2014 Slava Grigorev <slava.grigorev@amd.com>

radeon/audio: consolidate audio_init() functions

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 4adb34ef 18-Sep-2014 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: disable audio when we disable hdmi (v2)

This should allow the audio driver to get a better
idea of whether the sink is connected or not.

v2: fix copy/paste typo noticed by David Henningsson

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# d3d8c141 18-Sep-2014 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: split audio enable between eg and r600 (v2)

Clean up the enable sequence as well.

V2: clean up duplicate defines

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 72156676 18-Sep-2014 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: consolidate r600_audio.c into r600_hdmi.c

Most of that functionality is only used by r600_hdmi.c
and I'm planning to change that further.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 8e4d9f81 16-May-2014 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/hdmi: DCE2: simplify audio workaround

Thanks to advanced RE of fglrx we finally know what exactly needs to be
handled of AFMT change.

This has been tested for possible regressions on:
1) DCE2 HD2400 (RV610)
2) DCE3 HD3470 (RV620)

For a reference and details see:
https://bugzilla.kernel.org/show_bug.cgi?id=76231

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 68706337 16-May-2014 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/hdmi: DCE2: update setmode

Recent RE efforts revealed ops performed by fglrx during HDMI setup.
This mostly adds masks to r/w ops plus few single missing bits.

This has been tested for possible regressions on:
1) DCE2 HD2400 (RV610)
2) DCE3 HD3470 (RV620)

For a reference and details see:
https://bugzilla.kernel.org/show_bug.cgi?id=76231

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 2e93cac9 16-May-2014 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/hdmi: DCE3: clean ACR control

What initially seemed to be a typo in fglrx (using register 0x740c
instead of 0x74dc) appeared to be a correct behavior. DCE3 has ACR and
CRC registers swapped which explains why we needed
WREG32(HDMI0_AUDIO_CRC_CONTROL + offset, 0x1000);

This has been tested for possible regressions on DCE3 HD3470 (RV620).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 8f33a156 16-May-2014 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/hdmi: use separated file for DCE 3.1/3.2 code

DCE 3.1 and 3.2 should be programmed in a different way than DCE 2 and
DCE 3. The order of setting registers and sets of registers are
different.
It's still unsure how we will handle DCE 3.1 vs. DCE 3.2, since they
have few differences as well.
For now separate DCE 2 and DCE 3 path, so we can work on it without a
risk of breaking DCE 3.1+.

This has been tested for possible regressions on DCE32 HD4550 (RV710).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 3803c8e5 18-Feb-2014 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: enable speaker allocation setup on dce3.2

Now that we disable audio while setting up the audio
hw, we should be able to set this up without hangs.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>


# 832eafaf 18-Feb-2014 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: change audio enable logic

Disable audio around audio hw setup. This may avoid
hangs on certain asics.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>


# 27b83179 06-Jan-2014 Rashika Kheria <rashika.kheria@gmail.com>

drivers: gpu: Mark function as static in r600_hdmi.c

Mark function r600_audio_set_dto() as static in drm/radeon/r600_hdmi.c
because it is not used outside this file.

This eliminates the following warning in drm/radeon/r600_hdmi.c:
drivers/gpu/drm/radeon/r600_hdmi.c:253:6: warning: no previous prototype for ‘r600_audio_set_dto’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 55d4e020 25-Nov-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: program DCE2 audio dto just like DCE3

Seems to work like the DCE3 version despite what
the register spec says.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=71975

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org


# a2098250 06-Nov-2013 Pierre Ossman <pierre@ossman.eu>

drm/radeon/audio: improve ACR calculation

In order to have any realistic chance of calculating proper
ACR values, we need to be able to calculate both N and CTS,
not just CTS. We still aim for the ideal N as specified in
the HDMI spec though.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=69675

Signed-off-by: Pierre Ossman <pierre@ossman.eu>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 3e71985f 06-Nov-2013 Pierre Ossman <pierre@ossman.eu>

drm/radeon/audio: correct ACR table

The values were taken from the HDMI spec, but they assumed
exact x/1.001 clocks. Since we round the clocks, we also need
to calculate different N and CTS values.

Note that the N for 25.2/1.001 MHz at 44.1 kHz audio is out of
spec. Hopefully this mode is rarely used and/or HDMI sinks
tolerate overly large values of N.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=69675

Signed-off-by: Pierre Ossman <pierre@ossman.eu>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 0f57bca9 28-Oct-2013 Anssi Hannula <anssi.hannula@iki.fi>

drm/radeon/audio: fix missing multichannel PCM SAD in some cases

The current code writing SADs to the audio registers seems to assume
that there is at most a single SAD per audio format.

However, that is not the case. Especially for PCM it is somewhat common
for sinks to have two SADs, one for 8-channel and one for 2-channel
audio, which may have different supported sample rates (i.e. the sink
supports stereo audio at higher sample rates than multichannel audio).

Because of this, only the 2-channel SAD may be used if it appears before
the 8-channel SAD. Unless other SADs require otherwise, this may cause
the ALSA HDA driver to allow stereo playback only.

Fix the code to pick the PCM SAD with the highest number of channels,
while merging the rate masks of PCM SADs with lower amount of channels
into the additional stereo rate mask byte.

Technically there are even more cases to handle (multiple non-PCM SADs
of the same type, more than two PCM SADs with varying channel counts,
etc), but those have not actually been encountered in the field and
handling them would be non-trivial.

Example affected EDID from Onkyo TX-SR674 specifying 192kHz stereo
support and 96kHz 8-channel support (and other 8-channel compressed
formats):
00ffffffffffff003dcb010000000001
ffff0103800000780a0dc9a057479827
12484c00000001010101010101010101
010101010101011d8018711c1620582c
2500c48e2100009e011d007251d01e20
6e285500c48e2100001e000000fc0054
582d53523637342020202020000000fd
00313d0f2e08000a202020202020019b
02032f724f8504030f0e07069413121e
1d1615012f097f070f1f071707503707
503f07c0834f000066030c00ffff808c
0ad08a20e02d10103e9600c48e210000
18011d80d0721c1620102c2580c48e21
00009e011d00bc52d01e20b8285540c4
8e2100001e8c0ad090204031200c4055
00c48e210000180000000000000000a8

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Tested-by: Andre Heider <a.heider@gmail.com>
Cc: Rafał Miłecki <zajec5@gmail.com>
Acked-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 8a992ee1 10-Oct-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/audio: break out of loops once we match connector

No need to continue with the loops once we've matched
the appropriate connector.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 4b749577 17-Oct-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/audio: don't set speaker allocation on DCE3.2

It causes hangs on some asics.

Bug:
https://bugs.freedesktop.org/show_bug.cgi?id=70439

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>


# b852c985 10-Oct-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: re-enable sw ACR support on pre-DCE4

HW ACR support may have issues on some older chips, so
use SW ACR for now until we've tested further.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
CC: Rafał Miłecki <zajec5@gmail.com>


# ee0fec31 27-Sep-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: use hw generated CTS/N values for audio

Use the hw generated values rather than calculating
them in the driver. There may be some older r6xx
asics where this doesn't work correctly. This remains
to be seen.

See bug:
https://bugs.freedesktop.org/show_bug.cgi?id=69675

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# e7d12c2f 27-Sep-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: fix N/CTS clock matching for audio

The drm code that calculates the 1001 clocks rounds up
rather than truncating. This allows the table to match
properly on those modes.

See bug:
https://bugs.freedesktop.org/show_bug.cgi?id=69675

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 062c2e43 27-Sep-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: use 64-bit math to calculate CTS values for audio (v2)

Avoid losing precision. See bug:
https://bugs.freedesktop.org/show_bug.cgi?id=69675

v2: fix math as per Anssi's comments.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 58d327da 24-Sep-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: fix hdmi audio on DCE3.0/3.1 asics

These asics seem to use a mix of the DCE2.x and
DCE3.2 audio interfaces despite what the register spec
says.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=69729
https://bugs.freedesktop.org/show_bug.cgi?id=69671

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org


# c1cbee0e 29-Aug-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/audio: set up the sads on DCE3.2 asics

This sets up the short audio descriptors properly on
DCE3.2 asics for hdmi audio.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 0ffae60c 14-Aug-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: set speaker allocation for DCE3.2

This updates the audio driver to the speaker allocation
block from the EDID. A similar change was just implemented
for DCE4-8.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# b530602f 31-Jul-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: add audio support for DCE6/8 GPUs (v12)

Similar to DCE4/5, but supports multiple audio pins
which can be assigned per afmt block.

v2: rework the driver to handle more than one audio
pin.
v3: try different dto reg
v4: properly program dto
v5 (ck): change dto programming order
v6: program speaker allocation block
v7: rebase
v8: rebase on Rafał's changes
v9: integrated Rafał's comments, update to latest
drm_edid_to_speaker_allocation API
v10: add missing line break in error message
v11: add back audio enabled messages
v12: fix copy paste typo in r600_audio_enable

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Rafał Miłecki <zajec5@gmail.com>


# 1518dd8e 30-Jul-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: fix audio dto calculation on DCE3+ (v3)

Need to set the wallclock ratio and adjust the phase
and module registers appropriately. May fix problems
with audio timing at certain display timings.

v2: properly handle clocks below 24mhz
v3: rebase r600 changes

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# e1accbf0 29-Jul-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: select audio dto based on encoder id for DCE3

There are two audio dtos on radeon asics that you can
select between. Normally, dto0 is used for hdmi and
dto1 for DP, but it seems that the dto is somehow
tied to the encoders on DCE3 asics.

fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=67435

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org


# c2b4cacf 08-Jul-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/hdmi: make sure we have an afmt block assigned

Prevents a segfault if an afmt block is not assigned to the
encoder such as in the LVDS or eDP case.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=66714

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org


# f100380e 07-Jun-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: fix AVI infoframe generation

- remove adding 2 to checksum, this is incorrect.

This was incorrectly introduced in:
92db7f6c860b8190571a9dc1fcbc16d003422fe8
http://lists.freedesktop.org/archives/dri-devel/2011-December/017717.html
However, the off by 2 was due to adding the version twice.
From the examples in the URL above:

[Rafał Miłecki][RV620] fglrx:
0x7454: 00 A8 5E 79 R600_HDMI_VIDEOINFOFRAME_0
0x7458: 00 28 00 10 R600_HDMI_VIDEOINFOFRAME_1
0x745C: 00 48 00 28 R600_HDMI_VIDEOINFOFRAME_2
0x7460: 02 00 00 48 R600_HDMI_VIDEOINFOFRAME_3
===================
(0x82 + 0x2 + 0xD) + 0x1F8 = 0x289
-0x289 = 0x77

However, the payload sum is not 0x1f8, it's 0x1f6.
00 + A8 + 5E + 00 +
00 + 28 + 00 + 10 +
00 + 48 + 00 + 28 +
00 + 48 =
0x1f6

Bits 25:24 of HDMI_VIDEOINFOFRAME_3 are the packet version, not part
of the payload. So the total would be:
(0x82 + 0x2 + 0xD) + 0x1f6 = 0x287
-0x287 = 0x79

- properly emit the AVI infoframe version. This was not being
emitted previous which is probably what caused the issue above.

This should fix blank screen when HDMI audio is enabled on
certain monitors.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Cc: Rafał Miłecki <zajec5@gmail.com>


# 731da21b 13-May-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/dce2: use 10khz units for audio dto calculation

Avoids overflows on DCE2.x devices. Also clarify the calculation
on other asics.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org


# 1586505a 22-Apr-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: fix up audio dto programming for DCE2

Uses a different register than DCE3 asics.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# a973bea1 18-Apr-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: switch audio handling to use callbacks

Register audio callbacks for asic where we support
audio. Cleans up the code and makes it easier to
add support for newer asics.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# b1f6f47e 18-Apr-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: clean up audio dto programming

Split into DCE2/3 and DCE4/5 variants. Still todo is to
calculate the DTO dividers properly. Add proper formula
to the comments.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# 9054ae1c 18-Apr-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: disable audio format interrupts on Evergreen

The audio format change interrupts are an aid in debugging,
but not required for operation.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# dcb85290 18-Apr-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: fix hdmi mode enable on RS600/RS690/RS740

These chips were previously skipped since they are
pre-R600.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org


# d5169fc4 13-Apr-2013 Rafał Miłecki <zajec5@gmail.com>

drm/radeon: add helpers for masking and setting bits in regs

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# e3b2e034 14-Jan-2013 Thierry Reding <thierry.reding@avionic-design.de>

drm/radeon: Use generic HDMI infoframe helpers

Use the generic HDMI infoframe helpers to get rid of the duplicate
implementation in the radeon driver.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>


# c944b2ab 12-Feb-2013 Alex Deucher <alexander.deucher@amd.com>

drm/radeon: remove overzealous warning in hdmi handling

hdmi audio works fine. The warning just confuses users.

fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=44341

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Cc: stable@vger.kernel.org


# 760285e7 02-Oct-2012 David Howells <dhowells@redhat.com>

UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/

Convert #include "..." to #include <path/...> in drivers/gpu/.

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Dave Jones <davej@redhat.com>


# 1109ca09 31-Aug-2012 Lauri Kasanen <cand@gmx.com>

drm/radeon: Mark all possible functions / structs as static

Let's allow GCC to optimize better.

This exposed some five unused functions, but this patch doesn't remove them.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>


# fb98257a 16-May-2012 Christian Koenig <christian.koenig@amd.com>

drm/radeon: apply Murphy's law to the kms irq code v3

1. It is really dangerous to have more than one
spinlock protecting the same information.

2. radeon_irq_set sometimes wasn't called with lock
protection, so it can happen that more than one
CPU would tamper with the irq regs at the same
time.

3. The pm.gui_idle variable was assuming that the 3D
engine wasn't becoming idle between testing the
register and setting the variable. So just remove
it and test the register directly.

v2: Also handle the hpd irq code the same way.
v3: Rename hpd parameter for clarification.

Signed-off-by: Christian Koenig <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>


# 6b53a050 10-Jun-2012 Rafał Miłecki <zajec5@gmail.com>

drm/radeon: enable HDMI on DCE5 (AKA NI excluding Aruba)

After recent changes HDMI code is ready to be enabled on DCE5. This
patch just changes conditions to execute already present code on DCE5.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Tested-by: Christian König <christian.koenig@amd.com>
Tested-by: Andre Heider <a.heider@gmail.com>
Tested-by: Zoltán Böszörményi <zboszor@pr.hu>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 7838e05a 04-Jun-2012 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/hdmi: don't set SEND_MAX_PACKETS bit

Many TVs and A/V receivers don't work with this bit set. Problem was
confirmed using: Onkyo TX-SR605, Sony BRAVIA KDL-52X3500, Sony BRAVIA
KDL-40S40xx. In theory this bit shouldn't affect audio engine when
feeding it with data, however it seems it does. Driver fglrx doesn't set
that bit in any of the above cases.
This fixes a regression introduced by 3.5-rc1.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 3299de95 14-May-2012 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/hdmi: compile audio status in 1 function

This optmizes calls, registers reads and assignments.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# cfcbd6d3 14-May-2012 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/hdmi: use new AFMT structs

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# a366e392 06-May-2012 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/hdmi: fix some coding style

Use defined macros by the way.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 1c3439f2 06-May-2012 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/hdmi: update modesetting

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# e55d3e6c 06-May-2012 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/hdmi: separate evergreen code

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 1b688d08 30-Apr-2012 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/kms/hdmi: helper getting ready ACR entry

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 64fb4fb0 30-Apr-2012 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/kms/hdmi: clean&improve handling HDMI mode

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# a273a903 30-Apr-2012 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/kms/hdmi: enable audio packets at one place

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# c6543a6e 28-Apr-2012 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/kms/hdmi: use relative offsets, official regs

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Tested-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Christian König <deathsimple@vodafone.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# af0b5743 28-Apr-2012 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/kms: keep HDMI state in separated variable

If we want hdmi_offset to be relative to the first block, zero value can
be used also for enabled block.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Tested-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Christian König <deathsimple@vodafone.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 816ce437 28-Apr-2012 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/kms: get rid of r600_hdmi_find_free_block

R6xx has routable blocks, but there's nothing wrong in assignment based
on dig_encoder. We didn't really need that algorithm.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Tested-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Christian König <deathsimple@vodafone.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# a010fb1a 28-Apr-2012 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/kms: get rid of hdmi_config_offset

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Tested-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Christian König <deathsimple@vodafone.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# f122c610 30-Mar-2012 Alex Deucher <alexander.deucher@amd.com>

drm/radeon/kms: fix up audio interrupt handling

- add support for rs6xx
- add support for DCE4/5
- fixup 6xx/7xx

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 93a4ed87 23-Dec-2011 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/kms: define TMDS/LVTM HDMI enabling bits

The names has been taken from free M76 specs.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 92db7f6c 23-Dec-2011 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/kms: workaround invalid AVI infoframe checksum issue

This change was verified to fix both issues with no video I've
investigated. I've also checked checksum calculation with fglrx on:
RV620, HD54xx, HD5450, HD6310, HD6320.

Cc: stable@vger.kernel.org
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# f83d926a 23-Dec-2011 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/kms: setup HDMI mode on Evergreen encoders

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# ebcb796f 04-Dec-2011 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/kms: minor HDMI audio cleanups

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 25985edc 30-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi>

Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>


# 3574dda4 18-Feb-2011 Daniel Vetter <daniel.vetter@ffwll.ch>

radeon: consolidate asic-specific function decls for r600 & later

Now all the asic specific stuff ist mostly hid in radeon_asic.*

Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# fe50ac78 18-Jun-2010 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/kms: enable HDMI audio on RS600/RS690/RS740

We will need method of selecting encoder that should receive HDMI block. For
now we assign HDMI block to first enabled encoder. Hopefully there are not many
RS6x0 chips with two digital encoders.

[airlied: add RS740 checks as per Alex suggestion.]

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 66989987 18-May-2010 Dave Airlie <airlied@redhat.com>

drm/radeon: fix hdmi offset bug reported by smatch.

Reported-by: Dan Carpenter
Signed-off-by: Dave Airlie <airlied@redhat.com>


# f2594933 09-Apr-2010 Christian Koenig <deathsimple@vodafone.de>

drm/radeon/kms: HDMI irq support

Implements irq support for HDMI audio output. Now the polling timer
is only enabled if irq support isn't available.

Signed-off-by: Christian König <deathsimple@vodafone.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 58bd0863 05-Apr-2010 Christian König <deathsimple@vodafone.de>

drm/radeon/kms: rework audio polling timer

Rework HDMI audio polling timer, only enable it when
at least one HDMI encoder needs it. Preparation for
replacing it with irq support.

Signed-off-by: Christian König <deathsimple@vodafone.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 16823d16 16-Apr-2010 Alex Deucher <alexdeucher@gmail.com>

drm/radeon/kms/evergreen: don't enable hdmi audio stuff

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 3fe373d9 06-Mar-2010 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/kms: improve coding style a little

We still have many magic numbers in HDMI/audio to define

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 5715f67c 06-Mar-2010 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/kms: add HDMI code for pre-DCE3 R6xx GPUs

Older GPUs are little different, HDMI blocks are not hard-wired, but routable.
We should just find some free HDMI block and route it to choosen encoder. In
case of RS6x0 there is only one HDMI block, we don't enable HDMI on RS6x00 yet
however.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 2cd6218c 08-Mar-2010 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/kms: clean assigning HDMI blocks to encoders

We almost always used first HDMI block for first encoder and second for sencod.
Exception was KLDSCP_LVTMA. Analyzing code picking DIG encoder shows the same
behaviour. It shows HDMI block are related to DIGs, which relation we now use.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 808032ee 06-Mar-2010 Rafał Miłecki <zajec5@gmail.com>

drm/radeon/kms: clean HDMI definitions

We already know same offsets are used for different encoders/transmitters, so
just numeric them instead naming incorrectly. Additionaly we found additional
registers needed for RV770+

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# dafc3bd5 11-Oct-2009 Christian Koenig <deathsimple@vodafone.de>

drm/radeon/kms: HDMI support for R600 KMS

Adding basic HDMI support for R600 KMS, ported from radeonhd ddx.

[airlied:- checkpatch cleanups]
Signed-off-by: Christian Koenig <deathsimple@vodafone.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>