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>
This commit is contained in:
parent
a85d682a65
commit
96ea7afbc2
|
@ -254,7 +254,7 @@ void dce3_1_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *m
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
r600_hdmi_update_avi_infoframe(encoder, buffer, sizeof(buffer));
|
radeon_update_avi_infoframe(encoder, buffer, sizeof(buffer));
|
||||||
r600_hdmi_update_ACR(encoder, mode->clock);
|
r600_hdmi_update_ACR(encoder, mode->clock);
|
||||||
|
|
||||||
/* it's unknown what these bits do excatly, but it's indeed quite useful for debugging */
|
/* it's unknown what these bits do excatly, but it's indeed quite useful for debugging */
|
||||||
|
|
|
@ -195,18 +195,12 @@ void evergreen_hdmi_write_sad_regs(struct drm_encoder *encoder,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* build a HDMI Video Info Frame
|
* build a AVI Info Frame
|
||||||
*/
|
*/
|
||||||
static void evergreen_hdmi_update_avi_infoframe(struct drm_encoder *encoder,
|
void evergreen_update_avi_infoframe(struct radeon_device *rdev, u32 offset,
|
||||||
void *buffer, size_t size)
|
unsigned char *buffer, size_t size)
|
||||||
{
|
{
|
||||||
struct drm_device *dev = encoder->dev;
|
|
||||||
struct radeon_device *rdev = dev->dev_private;
|
|
||||||
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
|
|
||||||
struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
|
|
||||||
uint32_t offset = dig->afmt->offset;
|
|
||||||
uint8_t *frame = buffer + 3;
|
uint8_t *frame = buffer + 3;
|
||||||
uint8_t *header = buffer;
|
|
||||||
|
|
||||||
WREG32(AFMT_AVI_INFO0 + offset,
|
WREG32(AFMT_AVI_INFO0 + offset,
|
||||||
frame[0x0] | (frame[0x1] << 8) | (frame[0x2] << 16) | (frame[0x3] << 24));
|
frame[0x0] | (frame[0x1] << 8) | (frame[0x2] << 16) | (frame[0x3] << 24));
|
||||||
|
@ -215,7 +209,7 @@ static void evergreen_hdmi_update_avi_infoframe(struct drm_encoder *encoder,
|
||||||
WREG32(AFMT_AVI_INFO2 + offset,
|
WREG32(AFMT_AVI_INFO2 + offset,
|
||||||
frame[0x8] | (frame[0x9] << 8) | (frame[0xA] << 16) | (frame[0xB] << 24));
|
frame[0x8] | (frame[0x9] << 8) | (frame[0xA] << 16) | (frame[0xB] << 24));
|
||||||
WREG32(AFMT_AVI_INFO3 + offset,
|
WREG32(AFMT_AVI_INFO3 + offset,
|
||||||
frame[0xC] | (frame[0xD] << 8) | (header[1] << 24));
|
frame[0xC] | (frame[0xD] << 8) | (buffer[1] << 24));
|
||||||
}
|
}
|
||||||
|
|
||||||
void dce4_hdmi_audio_set_dto(struct radeon_device *rdev,
|
void dce4_hdmi_audio_set_dto(struct radeon_device *rdev,
|
||||||
|
@ -431,7 +425,7 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
evergreen_hdmi_update_avi_infoframe(encoder, buffer, sizeof(buffer));
|
radeon_update_avi_infoframe(encoder, buffer, sizeof(buffer));
|
||||||
|
|
||||||
WREG32_OR(HDMI_INFOFRAME_CONTROL0 + offset,
|
WREG32_OR(HDMI_INFOFRAME_CONTROL0 + offset,
|
||||||
HDMI_AVI_INFO_SEND | /* enable AVI info frames */
|
HDMI_AVI_INFO_SEND | /* enable AVI info frames */
|
||||||
|
|
|
@ -285,16 +285,10 @@ void r600_hdmi_update_ACR(struct drm_encoder *encoder, uint32_t clock)
|
||||||
/*
|
/*
|
||||||
* build a HDMI Video Info Frame
|
* build a HDMI Video Info Frame
|
||||||
*/
|
*/
|
||||||
void r600_hdmi_update_avi_infoframe(struct drm_encoder *encoder, void *buffer,
|
void r600_update_avi_infoframe(struct radeon_device *rdev, u32 offset,
|
||||||
size_t size)
|
unsigned char *buffer, size_t size)
|
||||||
{
|
{
|
||||||
struct drm_device *dev = encoder->dev;
|
|
||||||
struct radeon_device *rdev = dev->dev_private;
|
|
||||||
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
|
|
||||||
struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
|
|
||||||
uint32_t offset = dig->afmt->offset;
|
|
||||||
uint8_t *frame = buffer + 3;
|
uint8_t *frame = buffer + 3;
|
||||||
uint8_t *header = buffer;
|
|
||||||
|
|
||||||
WREG32(HDMI0_AVI_INFO0 + offset,
|
WREG32(HDMI0_AVI_INFO0 + offset,
|
||||||
frame[0x0] | (frame[0x1] << 8) | (frame[0x2] << 16) | (frame[0x3] << 24));
|
frame[0x0] | (frame[0x1] << 8) | (frame[0x2] << 16) | (frame[0x3] << 24));
|
||||||
|
@ -303,7 +297,7 @@ void r600_hdmi_update_avi_infoframe(struct drm_encoder *encoder, void *buffer,
|
||||||
WREG32(HDMI0_AVI_INFO2 + offset,
|
WREG32(HDMI0_AVI_INFO2 + offset,
|
||||||
frame[0x8] | (frame[0x9] << 8) | (frame[0xA] << 16) | (frame[0xB] << 24));
|
frame[0x8] | (frame[0x9] << 8) | (frame[0xA] << 16) | (frame[0xB] << 24));
|
||||||
WREG32(HDMI0_AVI_INFO3 + offset,
|
WREG32(HDMI0_AVI_INFO3 + offset,
|
||||||
frame[0xC] | (frame[0xD] << 8) | (header[1] << 24));
|
frame[0xC] | (frame[0xD] << 8) | (buffer[1] << 24));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -486,7 +480,7 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
r600_hdmi_update_avi_infoframe(encoder, buffer, sizeof(buffer));
|
radeon_update_avi_infoframe(encoder, buffer, sizeof(buffer));
|
||||||
|
|
||||||
/* fglrx duplicates INFOFRAME_CONTROL0 & INFOFRAME_CONTROL1 ops here */
|
/* fglrx duplicates INFOFRAME_CONTROL0 & INFOFRAME_CONTROL1 ops here */
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,10 @@ void dce6_hdmi_audio_set_dto(struct radeon_device *rdev,
|
||||||
struct radeon_crtc *crtc, unsigned int clock);
|
struct radeon_crtc *crtc, unsigned int clock);
|
||||||
void dce6_dp_audio_set_dto(struct radeon_device *rdev,
|
void dce6_dp_audio_set_dto(struct radeon_device *rdev,
|
||||||
struct radeon_crtc *crtc, unsigned int clock);
|
struct radeon_crtc *crtc, unsigned int clock);
|
||||||
|
void r600_update_avi_infoframe(struct radeon_device *rdev, u32 offset,
|
||||||
|
unsigned char *buffer, size_t size);
|
||||||
|
void evergreen_update_avi_infoframe(struct radeon_device *rdev, u32 offset,
|
||||||
|
unsigned char *buffer, size_t size);
|
||||||
|
|
||||||
static const u32 pin_offsets[7] =
|
static const u32 pin_offsets[7] =
|
||||||
{
|
{
|
||||||
|
@ -101,24 +105,28 @@ static struct radeon_audio_basic_funcs r600_funcs = {
|
||||||
.endpoint_rreg = radeon_audio_rreg,
|
.endpoint_rreg = radeon_audio_rreg,
|
||||||
.endpoint_wreg = radeon_audio_wreg,
|
.endpoint_wreg = radeon_audio_wreg,
|
||||||
.enable = r600_audio_enable,
|
.enable = r600_audio_enable,
|
||||||
|
.update_avi_infoframe = r600_update_avi_infoframe,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct radeon_audio_basic_funcs dce32_funcs = {
|
static struct radeon_audio_basic_funcs dce32_funcs = {
|
||||||
.endpoint_rreg = radeon_audio_rreg,
|
.endpoint_rreg = radeon_audio_rreg,
|
||||||
.endpoint_wreg = radeon_audio_wreg,
|
.endpoint_wreg = radeon_audio_wreg,
|
||||||
.enable = r600_audio_enable,
|
.enable = r600_audio_enable,
|
||||||
|
.update_avi_infoframe = r600_update_avi_infoframe,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct radeon_audio_basic_funcs dce4_funcs = {
|
static struct radeon_audio_basic_funcs dce4_funcs = {
|
||||||
.endpoint_rreg = radeon_audio_rreg,
|
.endpoint_rreg = radeon_audio_rreg,
|
||||||
.endpoint_wreg = radeon_audio_wreg,
|
.endpoint_wreg = radeon_audio_wreg,
|
||||||
.enable = dce4_audio_enable,
|
.enable = dce4_audio_enable,
|
||||||
|
.update_avi_infoframe = evergreen_update_avi_infoframe,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct radeon_audio_basic_funcs dce6_funcs = {
|
static struct radeon_audio_basic_funcs dce6_funcs = {
|
||||||
.endpoint_rreg = dce6_endpoint_rreg,
|
.endpoint_rreg = dce6_endpoint_rreg,
|
||||||
.endpoint_wreg = dce6_endpoint_wreg,
|
.endpoint_wreg = dce6_endpoint_wreg,
|
||||||
.enable = dce6_audio_enable,
|
.enable = dce6_audio_enable,
|
||||||
|
.update_avi_infoframe = evergreen_update_avi_infoframe,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct radeon_audio_funcs r600_hdmi_funcs = {
|
static struct radeon_audio_funcs r600_hdmi_funcs = {
|
||||||
|
@ -436,3 +444,15 @@ void radeon_audio_set_dto(struct drm_encoder *encoder, unsigned int clock)
|
||||||
if (radeon_encoder->audio && radeon_encoder->audio->set_dto)
|
if (radeon_encoder->audio && radeon_encoder->audio->set_dto)
|
||||||
radeon_encoder->audio->set_dto(rdev, crtc, clock);
|
radeon_encoder->audio->set_dto(rdev, crtc, clock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void radeon_update_avi_infoframe(struct drm_encoder *encoder, void *buffer,
|
||||||
|
size_t size)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
if (dig && dig->afmt && rdev->audio.funcs->update_avi_infoframe)
|
||||||
|
rdev->audio.funcs->update_avi_infoframe(rdev, dig->afmt->offset,
|
||||||
|
buffer, size);
|
||||||
|
}
|
||||||
|
|
|
@ -39,6 +39,8 @@ struct radeon_audio_basic_funcs
|
||||||
u32 offset, u32 reg, u32 v);
|
u32 offset, u32 reg, u32 v);
|
||||||
void (*enable)(struct radeon_device *rdev,
|
void (*enable)(struct radeon_device *rdev,
|
||||||
struct r600_audio_pin *pin, u8 enable_mask);
|
struct r600_audio_pin *pin, u8 enable_mask);
|
||||||
|
void (*update_avi_infoframe)(struct radeon_device *rdev, u32 offset,
|
||||||
|
unsigned char *buffer, size_t size);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct radeon_audio_funcs
|
struct radeon_audio_funcs
|
||||||
|
@ -72,5 +74,7 @@ void radeon_audio_enable(struct radeon_device *rdev,
|
||||||
struct r600_audio_pin *pin, u8 enable_mask);
|
struct r600_audio_pin *pin, u8 enable_mask);
|
||||||
void radeon_audio_fini(struct radeon_device *rdev);
|
void radeon_audio_fini(struct radeon_device *rdev);
|
||||||
void radeon_audio_set_dto(struct drm_encoder *encoder, unsigned int clock);
|
void radeon_audio_set_dto(struct drm_encoder *encoder, unsigned int clock);
|
||||||
|
void radeon_update_avi_infoframe(struct drm_encoder *encoder, void *buffer,
|
||||||
|
size_t size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue