* add TV encoder setup

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42919 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexander von Gluck IV 2011-10-25 18:34:47 +00:00
parent 6f6d1e36fd
commit 62278874a6
2 changed files with 34 additions and 0 deletions

View File

@ -196,6 +196,7 @@ encoder_mode_set(uint8 id, uint32 pixelClock)
{
radeon_shared_info &info = *gInfo->shared_info;
uint32 connectorIndex = gDisplay[id]->connectorIndex;
uint16 encoderFlags = gConnector[connectorIndex]->encoder.flags;
switch (gConnector[connectorIndex]->encoder.objectID) {
case ENCODER_OBJECT_ID_INTERNAL_DAC1:
@ -203,6 +204,12 @@ encoder_mode_set(uint8 id, uint32 pixelClock)
case ENCODER_OBJECT_ID_INTERNAL_DAC2:
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2:
encoder_analog_setup(id, pixelClock, ATOM_ENABLE);
if ((encoderFlags
& (ATOM_DEVICE_TV_SUPPORT | ATOM_DEVICE_CV_SUPPORT)) != 0) {
encoder_tv_setup(id, pixelClock, ATOM_ENABLE);
} else {
encoder_tv_setup(id, pixelClock, ATOM_DISABLE);
}
break;
case ENCODER_OBJECT_ID_INTERNAL_TMDS1:
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1:
@ -257,6 +264,32 @@ encoder_mode_set(uint8 id, uint32 pixelClock)
}
status_t
encoder_tv_setup(uint8 id, uint32 pixelClock, int command)
{
uint32 connectorIndex = gDisplay[id]->connectorIndex;
uint16 encoderFlags = gConnector[connectorIndex]->encoder.flags;
TV_ENCODER_CONTROL_PS_ALLOCATION args;
memset(&args, 0, sizeof(args));
int index = GetIndexIntoMasterTable(COMMAND, TVEncoderControl);
args.sTVEncoder.ucAction = command;
if ((encoderFlags & ATOM_DEVICE_CV_SUPPORT) != 0)
args.sTVEncoder.ucTvStandard = ATOM_TV_CV;
else {
// TODO: we assume NTSC for now
args.sTVEncoder.ucTvStandard = ATOM_TV_NTSC;
}
args.sTVEncoder.usPixelClock = B_HOST_TO_LENDIAN_INT16(pixelClock / 10);
return atom_execute_table(gAtomContext, index, (uint32*)&args);
}
union lvds_encoder_control {
LVDS_ENCODER_CONTROL_PS_ALLOCATION v1;
LVDS_ENCODER_CONTROL_PS_ALLOCATION_V2 v2;

View File

@ -15,6 +15,7 @@ void encoder_mode_set(uint8 id, uint32 pixelClock);
status_t encoder_digital_setup(uint8 id, uint32 pixelClock, int command);
status_t encoder_analog_setup(uint8 id, uint32 pixelClock, int command);
status_t encoder_dig_setup(uint8 id, uint32 pixelClock, int command);
status_t encoder_tv_setup(uint8 id, uint32 pixelClock, int command);
bool encoder_analog_load_detect(uint8 connectorIndex);
void encoder_output_lock(bool lock);
void encoder_crtc_scratch(uint8 crtcID);