[Xorg-driver-geode] [PATCH] Document LXGetLegacyPanelMode(..)
Christian Gmeiner
christian.gmeiner at gmail.com
Tue Oct 2 02:11:19 PDT 2012
Oh and I forgot to say that the AMD source is under LGPL.
/*
* Copyright (c) 2006-2008 Advanced Micro Devices,Inc. ("AMD").
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* License, or (at your option) any later version.
*
* This code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
---
Christian Gmeiner, MSc
2012/9/27 <christian.gmeiner at gmail.com>:
> From: root <root at OT.(none)>
>
> It is quite hard to understand all this magic numbers and bits so
> add some defined and comments to make it understandable.
> All the needed defines are taken from gplvsa_ii source code, which
> can be found at coreboot project.
>
> Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
> ---
> src/lx_panel.c | 42 +++++++++++++++++++++++++++++++++++-------
> 1 files changed, 35 insertions(+), 7 deletions(-)
>
> diff --git a/src/lx_panel.c b/src/lx_panel.c
> index 6b5d4ed..576ad21 100644
> --- a/src/lx_panel.c
> +++ b/src/lx_panel.c
> @@ -39,8 +39,24 @@
> #include "xf86Modes.h"
> #include "geode.h"
>
> +
> +#define VRC_INDEX 0xAC1C // Index register
> +#define VRC_DATA 0xAC1E // Data register
> +#define VR_UNLOCK 0xFC53 // Virtual register unlock code
> +
> +#define VRC_VG 0x02
> +
> +#define VG_CONFIG 0x00 // Main configuration register
> +#define VG_CFG_DSMASK 0x0700 // Active display mask bits
> +#define VG_CFG_DSCRT 0x0000 // Active display is CRT
> +#define VG_CFG_DSPAN 0x0100 // Active display is panel
> +#define VG_CFG_DSTV 0x0200 // Active display is TV
> +#define VG_CFG_DSSIM 0x0400 // Simultaneous CRT
> +
> +#define VG_FP_TYPE 0x02 // Flat panel type data
> +
> #define LX_READ_VG(reg) \
> - (outw(0xAC1C,0xFC53), outw(0xAC1C,0x0200|(reg)), inw(0xAC1E))
> + (outw(VRC_INDEX, VR_UNLOCK), outw(VRC_INDEX, (VRC_VG << 8) | (reg)), inw(VRC_DATA))
>
> /* This is borrowed from xerver/hw/xfree86/modes */
>
> @@ -79,12 +95,24 @@ DisplayModeRec lx_panel_modes[] = {
> DisplayModePtr
> LXGetLegacyPanelMode(ScrnInfoPtr pScrni)
> {
> - unsigned short reg = LX_READ_VG(0x00);
> - unsigned char ret = (reg >> 8) & 0x07;
> -
> - if ((ret == 1 || ret == 5)) {
> -
> - reg = LX_READ_VG(0x02);
> + /* read Active display configuration */
> + unsigned short reg = LX_READ_VG(VG_CONFIG);
> + unsigned char ret = (reg & VG_CFG_DSMASK);
> +
> + if ((ret == VG_CFG_DSPAN || ret == (VG_CFG_DSPAN | VG_CFG_DSSIM))) {
> +
> + /* read panel resolution
> + *
> + * 0x00: 640x480
> + * 0x01: 800x600
> + * 0x02: 1004x768
> + * 0x03: 1152x864
> + * 0x04: 1280x768
> + * 0x05: reserved
> + * 0x06: reserved
> + * 0x07: reserved
> + */
> + reg = LX_READ_VG(VG_FP_TYPE);
> ret = (reg >> 3) & 0x07;
>
> /* FIXME: 7 is reserved in default. We use this value to support
> --
> 1.7.2.5
>
More information about the Xorg-driver-geode
mailing list