From: "Christian König" <deathsimple@vodafone.de>
To: Alex Deucher <alexdeucher@gmail.com>, dri-devel@lists.freedesktop.org
Cc: Alex Deucher <alexander.deucher@amd.com>, slava.grigorev@amd.com
Subject: Re: [PATCH 05/24] radeon/audio: consolidate write_latency_fields() functions
Date: Wed, 14 Jan 2015 15:51:38 +0100 [thread overview]
Message-ID: <54B6827A.3070202@vodafone.de> (raw)
In-Reply-To: <1421171213-23977-6-git-send-email-alexander.deucher@amd.com>
Am 13.01.2015 um 18:46 schrieb Alex Deucher:
> From: Slava Grigorev <slava.grigorev@amd.com>
>
> Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> drivers/gpu/drm/radeon/dce6_afmt.c | 16 +--------
> drivers/gpu/drm/radeon/evergreen_hdmi.c | 33 ++++--------------
> drivers/gpu/drm/radeon/radeon_audio.c | 62 +++++++++++++++++++++------------
> drivers/gpu/drm/radeon/radeon_audio.h | 4 +++
> 4 files changed, 51 insertions(+), 64 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c b/drivers/gpu/drm/radeon/dce6_afmt.c
> index a24c95a..96f298c 100644
> --- a/drivers/gpu/drm/radeon/dce6_afmt.c
> +++ b/drivers/gpu/drm/radeon/dce6_afmt.c
> @@ -102,13 +102,11 @@ void dce6_afmt_select_pin(struct drm_encoder *encoder)
> }
>
> void dce6_afmt_write_latency_fields(struct drm_encoder *encoder,
> - struct drm_display_mode *mode)
> + struct drm_connector *connector, struct drm_display_mode *mode)
> {
> struct radeon_device *rdev = encoder->dev->dev_private;
> struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
> struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
> - struct drm_connector *connector;
> - struct radeon_connector *radeon_connector = NULL;
> u32 tmp = 0, offset;
>
> if (!dig || !dig->afmt || !dig->afmt->pin)
> @@ -116,18 +114,6 @@ void dce6_afmt_write_latency_fields(struct drm_encoder *encoder,
>
> offset = dig->afmt->pin->offset;
>
> - list_for_each_entry(connector, &encoder->dev->mode_config.connector_list, head) {
> - if (connector->encoder == encoder) {
> - radeon_connector = to_radeon_connector(connector);
> - break;
> - }
> - }
> -
> - if (!radeon_connector) {
> - DRM_ERROR("Couldn't find encoder's connector\n");
> - return;
> - }
> -
> if (mode->flags & DRM_MODE_FLAG_INTERLACE) {
> if (connector->latency_present[1])
> tmp = VIDEO_LIPSYNC(connector->video_latency[1]) |
> diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c
> index 3a9bb04..aa8a31b 100644
> --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c
> +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c
> @@ -34,8 +34,6 @@
> #include "atom.h"
>
> extern void dce6_afmt_select_pin(struct drm_encoder *encoder);
> -extern void dce6_afmt_write_latency_fields(struct drm_encoder *encoder,
> - struct drm_display_mode *mode);
>
> /* enable the audio stream */
> static void dce4_audio_enable(struct radeon_device *rdev,
> @@ -90,26 +88,12 @@ static void evergreen_hdmi_update_ACR(struct drm_encoder *encoder, uint32_t cloc
> WREG32(HDMI_ACR_48_1 + offset, acr.n_48khz);
> }
>
> -static void dce4_afmt_write_latency_fields(struct drm_encoder *encoder,
> - struct drm_display_mode *mode)
> +void dce4_afmt_write_latency_fields(struct drm_encoder *encoder,
> + struct drm_connector *connector, struct drm_display_mode *mode)
> {
> struct radeon_device *rdev = encoder->dev->dev_private;
> - struct drm_connector *connector;
> - struct radeon_connector *radeon_connector = NULL;
> u32 tmp = 0;
>
> - list_for_each_entry(connector, &encoder->dev->mode_config.connector_list, head) {
> - if (connector->encoder == encoder) {
> - radeon_connector = to_radeon_connector(connector);
> - break;
> - }
> - }
> -
> - if (!radeon_connector) {
> - DRM_ERROR("Couldn't find encoder's connector\n");
> - return;
> - }
> -
> if (mode->flags & DRM_MODE_FLAG_INTERLACE) {
> if (connector->latency_present[1])
> tmp = VIDEO_LIPSYNC(connector->video_latency[1]) |
> @@ -123,7 +107,7 @@ static void dce4_afmt_write_latency_fields(struct drm_encoder *encoder,
> else
> tmp = VIDEO_LIPSYNC(255) | AUDIO_LIPSYNC(255);
> }
> - WREG32(AZ_F0_CODEC_PIN0_CONTROL_RESPONSE_LIPSYNC, tmp);
> + WREG32_ENDPOINT(0, AZ_F0_CODEC_PIN0_CONTROL_RESPONSE_LIPSYNC, tmp);
> }
>
> void dce4_afmt_hdmi_write_speaker_allocation(struct drm_encoder *encoder,
> @@ -418,14 +402,11 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
>
> /* fglrx sets 0x40 in 0x5f80 here */
>
> - if (ASIC_IS_DCE6(rdev)) {
> + if (ASIC_IS_DCE6(rdev))
> dce6_afmt_select_pin(encoder);
> - radeon_audio_write_sad_regs(encoder);
> - dce6_afmt_write_latency_fields(encoder, mode);
> - } else {
> - radeon_audio_write_sad_regs(encoder);
> - dce4_afmt_write_latency_fields(encoder, mode);
> - }
> +
> + radeon_audio_write_sad_regs(encoder);
> + radeon_audio_write_latency_fields(encoder, mode);
>
> err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
> if (err < 0) {
> diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c
> index f359a29..a95eee1 100644
> --- a/drivers/gpu/drm/radeon/radeon_audio.c
> +++ b/drivers/gpu/drm/radeon/radeon_audio.c
> @@ -53,6 +53,10 @@ void dce6_afmt_hdmi_write_speaker_allocation(struct drm_encoder *encoder,
> u8 *sadb, int sad_count);
> void dce6_afmt_dp_write_speaker_allocation(struct drm_encoder *encoder,
> u8 *sadb, int sad_count);
> +void dce4_afmt_write_latency_fields(struct drm_encoder *encoder,
> + struct drm_connector *connector, struct drm_display_mode *mode);
> +void dce6_afmt_write_latency_fields(struct drm_encoder *encoder,
> + struct drm_connector *connector, struct drm_display_mode *mode);
>
> static const u32 pin_offsets[7] =
> {
> @@ -93,50 +97,36 @@ static struct radeon_audio_basic_funcs dce6_funcs = {
>
> static struct radeon_audio_funcs dce32_hdmi_funcs = {
> .write_sad_regs = dce3_2_afmt_write_sad_regs,
> -};
> -
> -static struct radeon_audio_funcs dce32_dp_funcs = {
> - .write_sad_regs = dce3_2_afmt_write_sad_regs,
> -};
> -
> -static struct radeon_audio_funcs dce4_hdmi_funcs = {
> - .write_sad_regs = evergreen_hdmi_write_sad_regs,
> -};
> -
> -static struct radeon_audio_funcs dce4_dp_funcs = {
> - .write_sad_regs = evergreen_hdmi_write_sad_regs,
> -};
> -
> -static struct radeon_audio_funcs dce6_hdmi_funcs = {
> - .write_sad_regs = dce6_afmt_write_sad_regs,
> -};
> -
> -static struct radeon_audio_funcs dce6_dp_funcs = {
> - .write_sad_regs = dce6_afmt_write_sad_regs,
> -};
> -
> -static struct radeon_audio_funcs dce32_hdmi_funcs = {
Looks like that change doesn't belong into this patch, but rather into
the patch consolidating the sad functions.
Christian.
> .write_speaker_allocation = dce3_2_afmt_hdmi_write_speaker_allocation,
> };
>
> static struct radeon_audio_funcs dce32_dp_funcs = {
> + .write_sad_regs = dce3_2_afmt_write_sad_regs,
> .write_speaker_allocation = dce3_2_afmt_dp_write_speaker_allocation,
> };
>
> static struct radeon_audio_funcs dce4_hdmi_funcs = {
> + .write_sad_regs = evergreen_hdmi_write_sad_regs,
> .write_speaker_allocation = dce4_afmt_hdmi_write_speaker_allocation,
> + .write_latency_fields = dce4_afmt_write_latency_fields,
> };
>
> static struct radeon_audio_funcs dce4_dp_funcs = {
> + .write_sad_regs = evergreen_hdmi_write_sad_regs,
> .write_speaker_allocation = dce4_afmt_dp_write_speaker_allocation,
> + .write_latency_fields = dce4_afmt_write_latency_fields,
> };
>
> static struct radeon_audio_funcs dce6_hdmi_funcs = {
> + .write_sad_regs = dce6_afmt_write_sad_regs,
> .write_speaker_allocation = dce6_afmt_hdmi_write_speaker_allocation,
> + .write_latency_fields = dce6_afmt_write_latency_fields,
> };
>
> static struct radeon_audio_funcs dce6_dp_funcs = {
> + .write_sad_regs = dce6_afmt_write_sad_regs,
> .write_speaker_allocation = dce6_afmt_dp_write_speaker_allocation,
> + .write_latency_fields = dce6_afmt_write_latency_fields,
> };
>
> static void radeon_audio_interface_init(struct radeon_device *rdev)
> @@ -325,3 +315,29 @@ void radeon_audio_write_speaker_allocation(struct drm_encoder *encoder)
>
> kfree(sadb);
> }
> +
> +void radeon_audio_write_latency_fields(struct drm_encoder *encoder,
> + struct drm_display_mode *mode)
> +{
> + struct radeon_encoder *radeon_encoder;
> + struct drm_connector *connector;
> + struct radeon_connector *radeon_connector = 0;
> +
> + list_for_each_entry(connector,
> + &encoder->dev->mode_config.connector_list, head) {
> + if (connector->encoder == encoder) {
> + radeon_connector = to_radeon_connector(connector);
> + break;
> + }
> + }
> +
> + if (!radeon_connector) {
> + DRM_ERROR("Couldn't find encoder's connector\n");
> + return;
> + }
> +
> + radeon_encoder = to_radeon_encoder(encoder);
> +
> + if (radeon_encoder->audio && radeon_encoder->audio->write_latency_fields)
> + radeon_encoder->audio->write_latency_fields(encoder, connector, mode);
> +}
> diff --git a/drivers/gpu/drm/radeon/radeon_audio.h b/drivers/gpu/drm/radeon/radeon_audio.h
> index cc0596f..33981c8 100644
> --- a/drivers/gpu/drm/radeon/radeon_audio.h
> +++ b/drivers/gpu/drm/radeon/radeon_audio.h
> @@ -41,6 +41,8 @@ struct radeon_audio_basic_funcs
>
> struct radeon_audio_funcs
> {
> + void (*write_latency_fields)(struct drm_encoder *encoder,
> + struct drm_connector *connector, struct drm_display_mode *mode);
> void (*write_sad_regs)(struct drm_encoder *encoder,
> struct cea_sad *sads, int sad_count);
> void (*write_speaker_allocation)(struct drm_encoder *encoder,
> @@ -56,5 +58,7 @@ void radeon_audio_endpoint_wreg(struct radeon_device *rdev,
> u32 offset, u32 reg, u32 v);
> void radeon_audio_write_sad_regs(struct drm_encoder *encoder);
> void radeon_audio_write_speaker_allocation(struct drm_encoder *encoder);
> +void radeon_audio_write_latency_fields(struct drm_encoder *encoder,
> + struct drm_display_mode *mode);
>
> #endif
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-01-14 14:52 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-13 17:46 [PATCH 00/24] radeon audio rework Alex Deucher
2015-01-13 17:46 ` [PATCH 01/24] radeon/audio: consolidate audio_init() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 02/24] radeon/audio: defined initial audio interface that gets initialized via detect() call Alex Deucher
2015-01-13 17:46 ` [PATCH 03/24] radeon/audio: consolidate write_sad_regs() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 04/24] radeon/audio: consolidate write_speaker_allocation() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 05/24] radeon/audio: consolidate write_latency_fields() functions Alex Deucher
2015-01-14 14:51 ` Christian König [this message]
2015-01-13 17:46 ` [PATCH 06/24] radeon/audio: consolidate audio_get_pin() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 07/24] radeon/audio: consolidate select_pin() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 08/24] radeon/audio: consolidate audio_enable() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 09/24] radeon/audio: consolidate audio_fini() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 10/24] radeon/audio: consolidate audio_set_dto() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 11/24] radeon/audio: consolidate update_avi_infoframe() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 12/24] radeon/audio: consolidate update_acr() functions Alex Deucher
2015-01-14 14:55 ` Christian König
2015-01-13 17:46 ` [PATCH 13/24] radeon/audio: moved VBI packet programming to separate functions Alex Deucher
2015-01-13 17:46 ` [PATCH 14/24] radeon: moved HDMI color depth programming to a separate function Alex Deucher
2015-01-13 17:46 ` [PATCH 15/24] radeon/audio: removed unnecessary CRC control programing Alex Deucher
2015-01-13 17:46 ` [PATCH 16/24] radeon/audio: set_avi_packet() function cleanup Alex Deucher
2015-01-13 17:46 ` [PATCH 17/24] radeon/audio: moved audio packet programming to a separate function Alex Deucher
2015-01-13 17:46 ` [PATCH 18/24] radeon/audio: moved mute " Alex Deucher
2015-01-13 17:46 ` [PATCH 19/24] radeon/audio: removed unnecessary debug settings Alex Deucher
2015-01-13 17:46 ` [PATCH 20/24] radeon/audio: consolidate audio_mode_set() functions Alex Deucher
2015-01-13 17:46 ` [PATCH 21/24] radeon/audio: applied audio_dpms() and audio_mode_set() calls Alex Deucher
2015-01-13 17:46 ` [PATCH 22/24] radeon/audio: moved audio caps programming to audio_hotplug() function Alex Deucher
2015-01-13 17:46 ` [PATCH 23/24] radeon/audio: enable DP audio Alex Deucher
2015-01-13 17:46 ` [PATCH 24/24] drm/radeon: whitespace clean up in radeon_audio.c Alex Deucher
2015-01-14 15:01 ` [PATCH 00/24] radeon audio rework Christian König
2015-01-14 21:47 ` Alex Deucher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54B6827A.3070202@vodafone.de \
--to=deathsimple@vodafone.de \
--cc=alexander.deucher@amd.com \
--cc=alexdeucher@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=slava.grigorev@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.