summaryrefslogtreecommitdiff
path: root/src/radeon_output.c
diff options
context:
space:
mode:
authorAlex Deucher <alex@samba.(none)>2007-12-12 22:37:44 -0500
committerAlex Deucher <alex@samba.(none)>2007-12-12 22:37:44 -0500
commitf5ac34983411e4c4f41ab1817dce582830f398fd (patch)
tree4d2c47513ae6893ff7ea928704718356eb3824cd /src/radeon_output.c
parentf2b2e0804183b52d9d3f56ad85b3552ece76c544 (diff)
parent6ccf5b33d27218ae1c45ab93c122438ed536d8ba (diff)
Merge branch 'master' of git+ssh://agd5f@git.freedesktop.org/git/xorg/driver/xf86-video-ati into atombios-support
merge and fix conflicts
Diffstat (limited to 'src/radeon_output.c')
-rw-r--r--src/radeon_output.c54
1 files changed, 41 insertions, 13 deletions
diff --git a/src/radeon_output.c b/src/radeon_output.c
index 4dc47ce0..02c96aef 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -741,6 +741,45 @@ void RADEONConnectorFindMonitor(ScrnInfoPtr pScrn, xf86OutputPtr output)
}
}
+static RADEONMonitorType
+RADEONDetectLidStatus(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ RADEONMonitorType MonType = MT_NONE;
+#ifdef __linux__
+ char lidline[50]; /* 50 should be sufficient for our purposes */
+ FILE *f = fopen ("/proc/acpi/button/lid/LID/state", "r");
+
+ if (f != NULL) {
+ while (fgets(lidline, sizeof lidline, f)) {
+ if (!strncmp(lidline, "state:", strlen ("state:"))) {
+ if (strstr(lidline, "open")) {
+ ErrorF("proc lid open\n");
+ return MT_LCD;
+ }
+ else if (strstr(lidline, "closed")) {
+ ErrorF("proc lid closed\n");
+ return MT_NONE;
+ }
+ }
+ }
+ }
+#endif
+
+ if (!info->IsAtomBios) {
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ /* see if the lid is closed -- only works at boot */
+ if (INREG(RADEON_BIOS_6_SCRATCH) & 0x10)
+ MonType = MT_NONE;
+ else
+ MonType = MT_LCD;
+ } else
+ MonType = MT_LCD;
+
+ return MonType;
+}
+
static RADEONMonitorType RADEONPortCheckNonDDC(ScrnInfoPtr pScrn, xf86OutputPtr output)
{
RADEONOutputPrivatePtr radeon_output = output->driver_private;
@@ -748,21 +787,10 @@ static RADEONMonitorType RADEONPortCheckNonDDC(ScrnInfoPtr pScrn, xf86OutputPtr
if (radeon_output->type == OUTPUT_LVDS) {
#if defined(__powerpc__)
- /* not sure on ppc, OF? */
+ MonType = MT_LCD;
#else
- RADEONInfoPtr info = RADEONPTR(pScrn);
-
- if (!info->IsAtomBios) {
- unsigned char *RADEONMMIO = info->MMIO;
-
- /* see if the lid is closed -- only works at boot */
- if (INREG(RADEON_BIOS_6_SCRATCH) & 0x10)
- MonType = MT_NONE;
- else
- MonType = MT_LCD;
- } else
+ MonType = RADEONDetectLidStatus(pScrn);
#endif
- MonType = MT_LCD;
} /*else if (radeon_output->type == OUTPUT_DVI) {
if (radeon_output->TMDSType == TMDS_INT) {
if (INREG(RADEON_FP_GEN_CNTL) & RADEON_FP_DETECT_SENSE)