Commit d79766fa authored by Alex Deucher's avatar Alex Deucher Committed by Dave Airlie

drm/radeon/kms: set proper default tv standard

we were just using 1 before.

reported on irc by soreau
Signed-off-by: default avatarAlex Deucher <alexdeucher@gmail.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 310a82c8
...@@ -1234,6 +1234,61 @@ bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index, ...@@ -1234,6 +1234,61 @@ bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index,
return true; return true;
} }
enum radeon_tv_std
radeon_atombios_get_tv_info(struct radeon_device *rdev)
{
struct radeon_mode_info *mode_info = &rdev->mode_info;
int index = GetIndexIntoMasterTable(DATA, AnalogTV_Info);
uint16_t data_offset;
uint8_t frev, crev;
struct _ATOM_ANALOG_TV_INFO *tv_info;
enum radeon_tv_std tv_std = TV_STD_NTSC;
atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, &crev, &data_offset);
tv_info = (struct _ATOM_ANALOG_TV_INFO *)(mode_info->atom_context->bios + data_offset);
switch (tv_info->ucTV_BootUpDefaultStandard) {
case ATOM_TV_NTSC:
tv_std = TV_STD_NTSC;
DRM_INFO("Default TV standard: NTSC\n");
break;
case ATOM_TV_NTSCJ:
tv_std = TV_STD_NTSC_J;
DRM_INFO("Default TV standard: NTSC-J\n");
break;
case ATOM_TV_PAL:
tv_std = TV_STD_PAL;
DRM_INFO("Default TV standard: PAL\n");
break;
case ATOM_TV_PALM:
tv_std = TV_STD_PAL_M;
DRM_INFO("Default TV standard: PAL-M\n");
break;
case ATOM_TV_PALN:
tv_std = TV_STD_PAL_N;
DRM_INFO("Default TV standard: PAL-N\n");
break;
case ATOM_TV_PALCN:
tv_std = TV_STD_PAL_CN;
DRM_INFO("Default TV standard: PAL-CN\n");
break;
case ATOM_TV_PAL60:
tv_std = TV_STD_PAL_60;
DRM_INFO("Default TV standard: PAL-60\n");
break;
case ATOM_TV_SECAM:
tv_std = TV_STD_SECAM;
DRM_INFO("Default TV standard: SECAM\n");
break;
default:
tv_std = TV_STD_NTSC;
DRM_INFO("Unknown TV standard; defaulting to NTSC\n");
break;
}
return tv_std;
}
struct radeon_encoder_tv_dac * struct radeon_encoder_tv_dac *
radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder) radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder)
{ {
...@@ -1269,6 +1324,7 @@ radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder) ...@@ -1269,6 +1324,7 @@ radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder)
dac = dac_info->ucDAC2_NTSC_DAC_Adjustment; dac = dac_info->ucDAC2_NTSC_DAC_Adjustment;
tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20);
tv_dac->tv_std = radeon_atombios_get_tv_info(rdev);
} }
return tv_dac; return tv_dac;
} }
......
...@@ -634,11 +634,10 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct ...@@ -634,11 +634,10 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
return p_dac; return p_dac;
} }
static enum radeon_tv_std enum radeon_tv_std
radeon_combios_get_tv_info(struct radeon_encoder *encoder) radeon_combios_get_tv_info(struct radeon_device *rdev)
{ {
struct drm_device *dev = encoder->base.dev; struct drm_device *dev = rdev->ddev;
struct radeon_device *rdev = dev->dev_private;
uint16_t tv_info; uint16_t tv_info;
enum radeon_tv_std tv_std = TV_STD_NTSC; enum radeon_tv_std tv_std = TV_STD_NTSC;
...@@ -779,7 +778,7 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct ...@@ -779,7 +778,7 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct
tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20);
found = 1; found = 1;
} }
tv_dac->tv_std = radeon_combios_get_tv_info(encoder); tv_dac->tv_std = radeon_combios_get_tv_info(rdev);
} }
if (!found) { if (!found) {
/* then check CRT table */ /* then check CRT table */
......
...@@ -1171,7 +1171,7 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -1171,7 +1171,7 @@ radeon_add_atom_connector(struct drm_device *dev,
1); 1);
drm_connector_attach_property(&radeon_connector->base, drm_connector_attach_property(&radeon_connector->base,
rdev->mode_info.tv_std_property, rdev->mode_info.tv_std_property,
1); radeon_atombios_get_tv_info(rdev));
} }
break; break;
case DRM_MODE_CONNECTOR_LVDS: case DRM_MODE_CONNECTOR_LVDS:
...@@ -1315,7 +1315,7 @@ radeon_add_legacy_connector(struct drm_device *dev, ...@@ -1315,7 +1315,7 @@ radeon_add_legacy_connector(struct drm_device *dev,
1); 1);
drm_connector_attach_property(&radeon_connector->base, drm_connector_attach_property(&radeon_connector->base,
rdev->mode_info.tv_std_property, rdev->mode_info.tv_std_property,
1); radeon_combios_get_tv_info(rdev));
} }
break; break;
case DRM_MODE_CONNECTOR_LVDS: case DRM_MODE_CONNECTOR_LVDS:
......
...@@ -739,7 +739,7 @@ static struct drm_prop_enum_list radeon_tv_std_enum_list[] = ...@@ -739,7 +739,7 @@ static struct drm_prop_enum_list radeon_tv_std_enum_list[] =
{ TV_STD_SECAM, "secam" }, { TV_STD_SECAM, "secam" },
}; };
int radeon_modeset_create_props(struct radeon_device *rdev) static int radeon_modeset_create_props(struct radeon_device *rdev)
{ {
int i, sz; int i, sz;
......
...@@ -88,6 +88,7 @@ enum radeon_tv_std { ...@@ -88,6 +88,7 @@ enum radeon_tv_std {
TV_STD_SCART_PAL, TV_STD_SCART_PAL,
TV_STD_SECAM, TV_STD_SECAM,
TV_STD_PAL_CN, TV_STD_PAL_CN,
TV_STD_PAL_N,
}; };
/* radeon gpio-based i2c /* radeon gpio-based i2c
...@@ -395,6 +396,11 @@ struct radeon_framebuffer { ...@@ -395,6 +396,11 @@ struct radeon_framebuffer {
struct drm_gem_object *obj; struct drm_gem_object *obj;
}; };
extern enum radeon_tv_std
radeon_combios_get_tv_info(struct radeon_device *rdev);
extern enum radeon_tv_std
radeon_atombios_get_tv_info(struct radeon_device *rdev);
extern void radeon_connector_hotplug(struct drm_connector *connector); extern void radeon_connector_hotplug(struct drm_connector *connector);
extern bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector); extern bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector);
extern int radeon_dp_mode_valid_helper(struct radeon_connector *radeon_connector, extern int radeon_dp_mode_valid_helper(struct radeon_connector *radeon_connector,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment