From b926d7695baa0e000103371401d0f4878a08c8cd Mon Sep 17 00:00:00 2001 From: Jens Muecke Date: Tue, 19 Feb 2008 04:03:49 +0000 Subject: [PATCH] Adding .24 support for olpc kernel compiles fine, but graphic support is broken to test new kernel version, change target/linux/olpc/Makefile from .23.16 to .24 SVN-Revision: 10493 --- target/linux/olpc/config-2.6.24 | 2219 ++++ .../arch/i386/boot/setup.S | 0 .../arch/i386/configs/olpc_defconfig | 0 .../arch/i386/kernel/mfgpt.c | 0 .../arch/i386/kernel/ofw.c | 0 .../arch/i386/kernel/olpc-pm.c | 0 .../arch/i386/kernel/olpc-sleep.S | 0 .../arch/i386/kernel/olpc-wakeup.S | 0 .../arch/i386/kernel/olpc.c | 0 .../arch/i386/kernel/prom.c | 0 .../arch/i386/pci/olpc.c | 0 .../drivers/input/mouse/olpc.c | 0 .../drivers/input/mouse/olpc.h | 0 .../drivers/mtd/mtdcore.h | 0 .../drivers/mtd/mtdoops.c | 0 .../drivers/mtd/onenand/onenand_sim.c | 0 .../drivers/video/geode/geode_regs.h | 0 .../drivers/video/geode/suspend_gx.c | 0 .../drivers/video/olpc_dcon.c | 0 .../drivers/video/olpc_dcon.h | 0 .../include/asm-i386/ofw.h | 0 .../include/asm-i386/olpc.h | 0 .../include/asm-i386/prom.h | 0 .../include/linux/battery.h | 0 .../sound/pci/cs5535audio/cs5535audio_olpc.c | 0 target/linux/olpc/image/Makefile | 2 +- target/linux/olpc/image/olpc.fth | 2 +- .../linux/olpc/patches-2.6.24/100-olpc.patch | 10201 ++++++++++++++++ 28 files changed, 12422 insertions(+), 2 deletions(-) create mode 100644 target/linux/olpc/config-2.6.24 rename target/linux/olpc/{files => files-2.6.23}/arch/i386/boot/setup.S (100%) rename target/linux/olpc/{files => files-2.6.23}/arch/i386/configs/olpc_defconfig (100%) rename target/linux/olpc/{files => files-2.6.23}/arch/i386/kernel/mfgpt.c (100%) rename target/linux/olpc/{files => files-2.6.23}/arch/i386/kernel/ofw.c (100%) rename target/linux/olpc/{files => files-2.6.23}/arch/i386/kernel/olpc-pm.c (100%) rename target/linux/olpc/{files => files-2.6.23}/arch/i386/kernel/olpc-sleep.S (100%) rename target/linux/olpc/{files => files-2.6.23}/arch/i386/kernel/olpc-wakeup.S (100%) rename target/linux/olpc/{files => files-2.6.23}/arch/i386/kernel/olpc.c (100%) rename target/linux/olpc/{files => files-2.6.23}/arch/i386/kernel/prom.c (100%) rename target/linux/olpc/{files => files-2.6.23}/arch/i386/pci/olpc.c (100%) rename target/linux/olpc/{files => files-2.6.23}/drivers/input/mouse/olpc.c (100%) rename target/linux/olpc/{files => files-2.6.23}/drivers/input/mouse/olpc.h (100%) rename target/linux/olpc/{files => files-2.6.23}/drivers/mtd/mtdcore.h (100%) rename target/linux/olpc/{files => files-2.6.23}/drivers/mtd/mtdoops.c (100%) rename target/linux/olpc/{files => files-2.6.23}/drivers/mtd/onenand/onenand_sim.c (100%) rename target/linux/olpc/{files => files-2.6.23}/drivers/video/geode/geode_regs.h (100%) rename target/linux/olpc/{files => files-2.6.23}/drivers/video/geode/suspend_gx.c (100%) rename target/linux/olpc/{files => files-2.6.23}/drivers/video/olpc_dcon.c (100%) rename target/linux/olpc/{files => files-2.6.23}/drivers/video/olpc_dcon.h (100%) rename target/linux/olpc/{files => files-2.6.23}/include/asm-i386/ofw.h (100%) rename target/linux/olpc/{files => files-2.6.23}/include/asm-i386/olpc.h (100%) rename target/linux/olpc/{files => files-2.6.23}/include/asm-i386/prom.h (100%) rename target/linux/olpc/{files => files-2.6.23}/include/linux/battery.h (100%) rename target/linux/olpc/{files => files-2.6.23}/sound/pci/cs5535audio/cs5535audio_olpc.c (100%) create mode 100644 target/linux/olpc/patches-2.6.24/100-olpc.patch diff --git a/target/linux/olpc/config-2.6.24 b/target/linux/olpc/config-2.6.24 new file mode 100644 index 0000000000..41cee4ba49 --- /dev/null +++ b/target/linux/olpc/config-2.6.24 @@ -0,0 +1,2219 @@ +# CONFIG_4KSTACKS is not set +# CONFIG_60XX_WDT is not set +# CONFIG_64BIT is not set +# CONFIG_6PACK is not set +# CONFIG_8139CP is not set +# CONFIG_8139TOO is not set +# CONFIG_9P_FS is not set +# CONFIG_ACENIC is not set +# CONFIG_ACORN_PARTITION is not set +# CONFIG_ACPI is not set +# CONFIG_ACQUIRE_WDT is not set +# CONFIG_ADAPTEC_STARFIRE is not set +# CONFIG_ADFS_FS is not set +# CONFIG_ADVANTECH_WDT is not set +# CONFIG_AFFS_FS is not set +# CONFIG_AFS_FS is not set +# CONFIG_AF_RXRPC is not set +# CONFIG_AGP is not set +# CONFIG_AIRO is not set +CONFIG_AIRO_CS=m +# CONFIG_ALIM1535_WDT is not set +# CONFIG_ALIM7101_WDT is not set +# CONFIG_AMD8111_ETH is not set +# CONFIG_AMIGA_PARTITION is not set +CONFIG_ANON_INODES=y +# CONFIG_APM is not set +# CONFIG_APPLICOM is not set +CONFIG_ARCH_FLATMEM_ENABLE=y +# CONFIG_ARCH_HAS_ILOG2_U32 is not set +# CONFIG_ARCH_HAS_ILOG2_U64 is not set +CONFIG_ARCH_MAY_HAVE_PC_FDC=y +CONFIG_ARCH_POPULATES_NODE_MAP=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SUPPORTS_MSI=y +CONFIG_ARCH_SUPPORTS_OPROFILE=y +# CONFIG_ARCNET is not set +CONFIG_ARPD=y +CONFIG_ASK_IP_FIB_HASH=y +# CONFIG_ATA is not set +# CONFIG_ATALK is not set +# CONFIG_ATARI_PARTITION is not set +# CONFIG_ATA_GENERIC is not set +# CONFIG_ATA_OVER_ETH is not set +# CONFIG_ATL1 is not set +# CONFIG_ATM is not set +CONFIG_ATMEL=m +# CONFIG_ATM_AMBASSADOR is not set +CONFIG_ATM_BR2684=m +CONFIG_ATM_BR2684_IPFILTER=y +CONFIG_ATM_CLIP=m +CONFIG_ATM_CLIP_NO_ICMP=y +# CONFIG_ATM_DRIVERS is not set +CONFIG_ATM_DUMMY=m +# CONFIG_ATM_ENI is not set +# CONFIG_ATM_FIRESTREAM is not set +# CONFIG_ATM_FORE200E_MAYBE is not set +# CONFIG_ATM_HE is not set +# CONFIG_ATM_HORIZON is not set +# CONFIG_ATM_IA is not set +# CONFIG_ATM_IDT77252 is not set +# CONFIG_ATM_LANAI is not set +CONFIG_ATM_LANE=m +CONFIG_ATM_MPOA=m +# CONFIG_ATM_NICSTAR is not set +CONFIG_ATM_TCP=m +# CONFIG_ATM_ZATM is not set +# CONFIG_AUDIT is not set +# CONFIG_AUDIT_ARCH is not set +# CONFIG_AUTOFS4_FS is not set +# CONFIG_AUTOFS_FS is not set +CONFIG_AX25=m +# CONFIG_AX25_DAMA_SLAVE is not set +# CONFIG_AX88796 is not set +# CONFIG_B44 is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +# CONFIG_BACKLIGHT_CORGI is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +# CONFIG_BACKLIGHT_PROGEAR is not set +CONFIG_BASE_FULL=y +CONFIG_BASE_SMALL=0 +# CONFIG_BASLER_EXCITE is not set +# CONFIG_BATTERY_DS2760 is not set +CONFIG_BATTERY_OLPC=y +# CONFIG_BAYCOM_EPP is not set +# CONFIG_BAYCOM_PAR is not set +# CONFIG_BAYCOM_SER_FDX is not set +# CONFIG_BAYCOM_SER_HDX is not set +CONFIG_BCM43XX=m +CONFIG_BCM43XX_DEBUG=y +CONFIG_BCM43XX_DMA=y +CONFIG_BCM43XX_DMA_AND_PIO_MODE=y +# CONFIG_BCM43XX_DMA_MODE is not set +CONFIG_BCM43XX_PIO=y +# CONFIG_BCM43XX_PIO_MODE is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_BINFMT_AOUT is not set +CONFIG_BINFMT_ELF=y +CONFIG_BINFMT_MISC=y +CONFIG_BITREVERSE=y +# CONFIG_BLINK is not set +# CONFIG_BLK_CPQ_CISS_DA is not set +# CONFIG_BLK_CPQ_DA is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_3W_XXXX_RAID is not set +# CONFIG_BLK_DEV_AEC62XX is not set +# CONFIG_BLK_DEV_ALI15X3 is not set +# CONFIG_BLK_DEV_AMD74XX is not set +# CONFIG_BLK_DEV_ATIIXP is not set +# CONFIG_BLK_DEV_BSG is not set +# CONFIG_BLK_DEV_CMD640 is not set +# CONFIG_BLK_DEV_CMD64X is not set +# CONFIG_BLK_DEV_COW_COMMON is not set +CONFIG_BLK_DEV_CRYPTOLOOP=m +# CONFIG_BLK_DEV_CS5520 is not set +# CONFIG_BLK_DEV_CS5530 is not set +# CONFIG_BLK_DEV_CS5535 is not set +# CONFIG_BLK_DEV_CY82C693 is not set +# CONFIG_BLK_DEV_DAC960 is not set +# CONFIG_BLK_DEV_DELKIN is not set +# CONFIG_BLK_DEV_FD is not set +# CONFIG_BLK_DEV_GENERIC is not set +# CONFIG_BLK_DEV_HD is not set +# CONFIG_BLK_DEV_HD_IDE is not set +# CONFIG_BLK_DEV_HPT34X is not set +# CONFIG_BLK_DEV_HPT366 is not set +# CONFIG_BLK_DEV_IDECD is not set +# CONFIG_BLK_DEV_IDECS is not set +# CONFIG_BLK_DEV_IDEDMA_FORCED is not set +# CONFIG_BLK_DEV_IDEFLOPPY is not set +# CONFIG_BLK_DEV_IDEPCI is not set +# CONFIG_BLK_DEV_IDEPNP is not set +# CONFIG_BLK_DEV_IDESCSI is not set +# CONFIG_BLK_DEV_IDETAPE is not set +# CONFIG_BLK_DEV_IDE_SATA is not set +CONFIG_BLK_DEV_INITRD=y +# CONFIG_BLK_DEV_IO_TRACE is not set +# CONFIG_BLK_DEV_IT8213 is not set +# CONFIG_BLK_DEV_IT821X is not set +# CONFIG_BLK_DEV_JMICRON is not set +# CONFIG_BLK_DEV_LOOP is not set +# CONFIG_BLK_DEV_NBD is not set +# CONFIG_BLK_DEV_NS87415 is not set +# CONFIG_BLK_DEV_OFFBOARD is not set +# CONFIG_BLK_DEV_OPTI621 is not set +# CONFIG_BLK_DEV_PDC202XX_NEW is not set +# CONFIG_BLK_DEV_PDC202XX_OLD is not set +# CONFIG_BLK_DEV_PIIX is not set +# CONFIG_BLK_DEV_RAM is not set +# CONFIG_BLK_DEV_RZ1000 is not set +# CONFIG_BLK_DEV_SC1200 is not set +CONFIG_BLK_DEV_SD=y +# CONFIG_BLK_DEV_SIIMAGE is not set +# CONFIG_BLK_DEV_SIS5513 is not set +# CONFIG_BLK_DEV_SLC90E66 is not set +CONFIG_BLK_DEV_SR=y +CONFIG_BLK_DEV_SR_VENDOR=y +# CONFIG_BLK_DEV_SVWKS is not set +# CONFIG_BLK_DEV_SX8 is not set +# CONFIG_BLK_DEV_TC86C001 is not set +# CONFIG_BLK_DEV_TRIFLEX is not set +# CONFIG_BLK_DEV_TRM290 is not set +# CONFIG_BLK_DEV_UB is not set +# CONFIG_BLK_DEV_UMEM is not set +# CONFIG_BLK_DEV_VIA82CXXX is not set +CONFIG_BLOCK=y +# CONFIG_BNX2 is not set +# CONFIG_BONDING is not set +# CONFIG_BOOT_PRINTK_DELAY is not set +CONFIG_BOUNCE=y +# CONFIG_BPQETHER is not set +CONFIG_BRIDGE=y +CONFIG_BRIDGE_EBT_802_3=m +CONFIG_BRIDGE_EBT_AMONG=m +CONFIG_BRIDGE_EBT_ARP=m +CONFIG_BRIDGE_EBT_ARPREPLY=m +CONFIG_BRIDGE_EBT_BROUTE=m +CONFIG_BRIDGE_EBT_DNAT=m +CONFIG_BRIDGE_EBT_IP=m +CONFIG_BRIDGE_EBT_LIMIT=m +CONFIG_BRIDGE_EBT_LOG=m +CONFIG_BRIDGE_EBT_MARK=m +CONFIG_BRIDGE_EBT_MARK_T=m +CONFIG_BRIDGE_EBT_PKTTYPE=m +CONFIG_BRIDGE_EBT_REDIRECT=m +CONFIG_BRIDGE_EBT_SNAT=m +CONFIG_BRIDGE_EBT_STP=m +CONFIG_BRIDGE_EBT_T_FILTER=m +CONFIG_BRIDGE_EBT_T_NAT=m +CONFIG_BRIDGE_EBT_ULOG=m +CONFIG_BRIDGE_EBT_VLAN=m +# CONFIG_BRIDGE_NETFILTER is not set +# CONFIG_BRIDGE_NF_EBTABLES is not set +CONFIG_BROKEN_ON_SMP=y +CONFIG_BSD_DISKLABEL=y +CONFIG_BSD_PROCESS_ACCT=y +# CONFIG_BSD_PROCESS_ACCT_V3 is not set +# CONFIG_BT is not set +CONFIG_BT_BNEP=m +CONFIG_BT_BNEP_MC_FILTER=y +CONFIG_BT_BNEP_PROTO_FILTER=y +# CONFIG_BT_CMTP is not set +CONFIG_BT_HCIBCM203X=m +CONFIG_BT_HCIBFUSB=m +# CONFIG_BT_HCIBLUECARD is not set +CONFIG_BT_HCIBPA10X=m +# CONFIG_BT_HCIBT3C is not set +# CONFIG_BT_HCIBTUART is not set +# CONFIG_BT_HCIDTL1 is not set +CONFIG_BT_HCIUART=m +CONFIG_BT_HCIUART_BCSP=y +CONFIG_BT_HCIUART_H4=y +CONFIG_BT_HCIUSB=m +CONFIG_BT_HCIUSB_SCO=y +CONFIG_BT_HCIVHCI=m +CONFIG_BT_HIDP=m +CONFIG_BT_L2CAP=m +CONFIG_BT_RFCOMM=m +CONFIG_BT_RFCOMM_TTY=y +CONFIG_BT_SCO=m +CONFIG_BUG=y +# CONFIG_CAPI_AVM is not set +# CONFIG_CAPI_EICON is not set +# CONFIG_CAPI_TRACE is not set +CONFIG_CARDBUS=y +# CONFIG_CARDMAN_4000 is not set +# CONFIG_CARDMAN_4040 is not set +# CONFIG_CASSINI is not set +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +# CONFIG_CDROM_PKTCDVD is not set +CONFIG_CFG80211=m +# CONFIG_CGROUPS is not set +# CONFIG_CHELSIO_T1 is not set +# CONFIG_CHELSIO_T3 is not set +# CONFIG_CHR_DEV_OSST is not set +# CONFIG_CHR_DEV_SCH is not set +CONFIG_CHR_DEV_SG=y +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CICADA_PHY is not set +# CONFIG_CIFS is not set +# CONFIG_CIFS_DEBUG2 is not set +# CONFIG_CIFS_EXPERIMENTAL is not set +CONFIG_CIFS_POSIX=y +CONFIG_CIFS_STATS=y +# CONFIG_CIFS_STATS2 is not set +# CONFIG_CIFS_WEAK_PW_HASH is not set +# CONFIG_CIFS_XATTR is not set +CONFIG_CLOCKSOURCE_WATCHDOG=y +CONFIG_CLS_U32_MARK=y +CONFIG_CLS_U32_PERF=y +CONFIG_CMDLINE="" +# CONFIG_CODA_FS is not set +CONFIG_COMPAT_VDSO=y +CONFIG_CONFIGFS_FS=y +# CONFIG_CONNECTOR is not set +# CONFIG_CPU5_WDT is not set +# CONFIG_CPU_FREQ is not set +# CONFIG_CPU_IDLE is not set +# CONFIG_CRAMFS is not set +CONFIG_CRC16=m +CONFIG_CRC32=y +# CONFIG_CRC7 is not set +CONFIG_CRC_CCITT=m +# CONFIG_CRC_ITU_T is not set +CONFIG_CROSSCOMPILE=y +CONFIG_CRYPTO=y +# CONFIG_CRYPTO_AES is not set +# CONFIG_CRYPTO_AES_586 is not set +CONFIG_CRYPTO_ALGAPI=m +# CONFIG_CRYPTO_ANUBIS is not set +# CONFIG_CRYPTO_ARC4 is not set +# CONFIG_CRYPTO_AUTHENC is not set +CONFIG_CRYPTO_BLKCIPHER=m +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +# CONFIG_CRYPTO_CBC is not set +# CONFIG_CRYPTO_CRC32C is not set +# CONFIG_CRYPTO_CRYPTD is not set +# CONFIG_CRYPTO_DEFLATE is not set +# CONFIG_CRYPTO_DES is not set +# CONFIG_CRYPTO_ECB is not set +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_GF128MUL is not set +CONFIG_CRYPTO_HASH=m +# CONFIG_CRYPTO_HMAC is not set +# CONFIG_CRYPTO_HW is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_MANAGER is not set +# CONFIG_CRYPTO_MD4 is not set +# CONFIG_CRYPTO_MD5 is not set +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_NULL is not set +# CONFIG_CRYPTO_PCBC is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_SHA1 is not set +# CONFIG_CRYPTO_SHA256 is not set +# CONFIG_CRYPTO_SHA512 is not set +# CONFIG_CRYPTO_TEA is not set +# CONFIG_CRYPTO_TEST is not set +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_TWOFISH is not set +# CONFIG_CRYPTO_TWOFISH_586 is not set +CONFIG_CRYPTO_TWOFISH_COMMON=m +# CONFIG_CRYPTO_WP512 is not set +# CONFIG_CRYPTO_XCBC is not set +# CONFIG_CRYPTO_XTS is not set +# CONFIG_CS5535_GPIO is not set +# CONFIG_DAB is not set +# CONFIG_DAVICOM_PHY is not set +# CONFIG_DCDBAS is not set +# CONFIG_DEBUG_BUGVERBOSE is not set +# CONFIG_DEBUG_DEVRES is not set +# CONFIG_DEBUG_DRIVER is not set +# CONFIG_DEBUG_FS is not set +# CONFIG_DEBUG_INFO is not set +CONFIG_DEBUG_KERNEL=y +# CONFIG_DEBUG_KOBJECT is not set +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_RODATA is not set +# CONFIG_DEBUG_RT_MUTEXES is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_SHIRQ is not set +# CONFIG_DEBUG_SLAB is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set +# CONFIG_DEBUG_STACKOVERFLOW is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_VM is not set +# CONFIG_DECNET is not set +# CONFIG_DEFAULT_AS is not set +# CONFIG_DEFAULT_BIC is not set +# CONFIG_DEFAULT_CFQ is not set +# CONFIG_DEFAULT_CUBIC is not set +CONFIG_DEFAULT_DEADLINE=y +# CONFIG_DEFAULT_HTCP is not set +CONFIG_DEFAULT_IOSCHED="deadline" +# CONFIG_DEFAULT_NOOP is not set +# CONFIG_DEFAULT_RENO is not set +CONFIG_DEFAULT_TCP_CONG="vegas" +CONFIG_DEFAULT_VEGAS=y +# CONFIG_DEFAULT_WESTWOOD is not set +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" +# CONFIG_DELL_RBU is not set +CONFIG_DETECT_SOFTLOCKUP=y +# CONFIG_DEVFS_DEBUG is not set +CONFIG_DEVFS_FS=y +CONFIG_DEVFS_MOUNT=y +CONFIG_DEVPORT=y +# CONFIG_DGRS is not set +# CONFIG_DISABLE_SUSPEND_VT_SWITCH is not set +# CONFIG_DISCONTIGMEM_MANUAL is not set +CONFIG_DISPLAY_SUPPORT=y +# CONFIG_DL2K is not set +# CONFIG_DLM is not set +# CONFIG_DMADEVICES is not set +# CONFIG_DMA_ENGINE is not set +CONFIG_DMI=y +CONFIG_DMIID=y +CONFIG_DNOTIFY=y +CONFIG_DOUBLEFAULT=y +CONFIG_DRM=y +# CONFIG_DRM_MGA is not set +# CONFIG_DRM_R128 is not set +# CONFIG_DRM_RADEON is not set +# CONFIG_DRM_SAVAGE is not set +# CONFIG_DRM_TDFX is not set +# CONFIG_DRM_VIA is not set +# CONFIG_DS1682 is not set +# CONFIG_DTLK is not set +# CONFIG_DUMMY is not set +CONFIG_DUMMY_CONSOLE=y +# CONFIG_DVB is not set +# CONFIG_DVB_CORE is not set +# CONFIG_E100 is not set +# CONFIG_E1000 is not set +# CONFIG_E1000E is not set +CONFIG_EARLY_PRINTK=y +# CONFIG_ECONET is not set +# CONFIG_EDAC is not set +# CONFIG_EDD is not set +# CONFIG_EEPRO100 is not set +# CONFIG_EEPROM_93CX6 is not set +# CONFIG_EFI_PARTITION is not set +# CONFIG_EFS_FS is not set +CONFIG_ELF_CORE=y +CONFIG_EMBEDDED=y +# CONFIG_ENABLE_MUST_CHECK is not set +CONFIG_ENABLE_WARN_DEPRECATED=y +# CONFIG_EPIC100 is not set +CONFIG_EPOLL=y +# CONFIG_EQUALIZER is not set +# CONFIG_EUROTECH_WDT is not set +CONFIG_EVENTFD=y +CONFIG_EXPERIMENTAL=y +CONFIG_EXPORTFS=m +CONFIG_EXT2_FS=y +# CONFIG_EXT2_FS_XATTR is not set +# CONFIG_EXT2_FS_XIP is not set +# CONFIG_EXT3_FS is not set +# CONFIG_EXT3_FS_XATTR is not set +# CONFIG_EXT4DEV_FS is not set +# CONFIG_FAIR_GROUP_SCHED is not set +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +CONFIG_FAT_FS=m +# CONFIG_FAULT_INJECTION is not set +CONFIG_FB=y +# CONFIG_FB_3DFX is not set +# CONFIG_FB_ARC is not set +# CONFIG_FB_ARK is not set +# CONFIG_FB_ASILIANT is not set +# CONFIG_FB_ATY is not set +# CONFIG_FB_ATY128 is not set +# CONFIG_FB_BACKLIGHT is not set +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_IMAGEBLIT=y +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +# CONFIG_FB_CIRRUS is not set +# CONFIG_FB_CYBER2000 is not set +# CONFIG_FB_CYBLA is not set +# CONFIG_FB_DDC is not set +CONFIG_FB_DEFERRED_IO=y +# CONFIG_FB_EFI is not set +CONFIG_FB_GEODE=y +CONFIG_FB_GEODE_GX=y +CONFIG_FB_GEODE_GX1=y +CONFIG_FB_GEODE_LX=y +# CONFIG_FB_HECUBA is not set +# CONFIG_FB_HGA is not set +# CONFIG_FB_I810 is not set +# CONFIG_FB_IBM_GXT4500 is not set +# CONFIG_FB_IMSTT is not set +# CONFIG_FB_INTEL is not set +# CONFIG_FB_KYRO is not set +# CONFIG_FB_LE80578 is not set +# CONFIG_FB_MACMODES is not set +# CONFIG_FB_MATROX is not set +# CONFIG_FB_MODE_HELPERS is not set +# CONFIG_FB_NEOMAGIC is not set +# CONFIG_FB_NVIDIA is not set +CONFIG_FB_OLPC_DCON=y +# CONFIG_FB_PM2 is not set +# CONFIG_FB_PM3 is not set +# CONFIG_FB_RADEON is not set +# CONFIG_FB_RIVA is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_S3 is not set +# CONFIG_FB_SAVAGE is not set +# CONFIG_FB_SIS is not set +# CONFIG_FB_SVGALIB is not set +# CONFIG_FB_SYS_COPYAREA is not set +# CONFIG_FB_SYS_FILLRECT is not set +# CONFIG_FB_SYS_FOPS is not set +# CONFIG_FB_SYS_IMAGEBLIT is not set +# CONFIG_FB_TILEBLITTING is not set +# CONFIG_FB_TRIDENT is not set +# CONFIG_FB_VESA is not set +# CONFIG_FB_VGA16 is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_VOODOO1 is not set +# CONFIG_FB_VT8623 is not set +# CONFIG_FDDI is not set +# CONFIG_FEALNX is not set +CONFIG_FIB_RULES=y +# CONFIG_FIREWIRE is not set +# CONFIG_FIRMWARE_EDID is not set +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_FLATMEM=y +CONFIG_FLATMEM_MANUAL=y +CONFIG_FLAT_NODE_MEM_MAP=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x16=y +CONFIG_FONT_8x8=y +# CONFIG_FORCEDETH is not set +CONFIG_FORCED_INLINING=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y +# CONFIG_FRAME_POINTER is not set +# CONFIG_FS_POSIX_ACL is not set +# CONFIG_FTL is not set +# CONFIG_FUSE_FS is not set +# CONFIG_FUSION is not set +# CONFIG_FUSION_FC is not set +# CONFIG_FUSION_SAS is not set +# CONFIG_FUSION_SPI is not set +CONFIG_FUTEX=y +CONFIG_FW_LOADER=y +CONFIG_GACT_PROB=y +# CONFIG_GAMEPORT is not set +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CMOS_UPDATE=y +# CONFIG_GENERIC_CPU is not set +CONFIG_GENERIC_HARDIRQS=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_IOMAP=y +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_ISA_DMA=y +CONFIG_GENERIC_TIME=y +# CONFIG_GENERIC_TIME_VSYSCALL is not set +CONFIG_GEODE_MFGPT_TIMER=y +# CONFIG_GFS2_FS is not set +# CONFIG_GPIO_DEVICE is not set +# CONFIG_HAMACHI is not set +# CONFIG_HAMRADIO is not set +# CONFIG_HANGCHECK_TIMER is not set +# CONFIG_HAPPYMEAL is not set +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +# CONFIG_HEADERS_CHECK is not set +# CONFIG_HERMES is not set +# CONFIG_HFSPLUS_FS is not set +# CONFIG_HFS_FS is not set +CONFIG_HIBERNATION=y +CONFIG_HIBERNATION_UP_POSSIBLE=y +CONFIG_HID=y +# CONFIG_HIDRAW is not set +# CONFIG_HID_DEBUG is not set +# CONFIG_HID_FF is not set +CONFIG_HID_SUPPORT=y +# CONFIG_HIGHMEM4G is not set +# CONFIG_HIGHMEM64G is not set +CONFIG_HIGH_RES_TIMERS=y +# CONFIG_HIPPI is not set +# CONFIG_HOSTAP is not set +# CONFIG_HOSTAP_CS is not set +CONFIG_HOSTAP_FIRMWARE=y +CONFIG_HOSTAP_FIRMWARE_NVRAM=y +CONFIG_HOSTAP_PCI=m +CONFIG_HOSTAP_PLX=m +CONFIG_HOTPLUG=y +# CONFIG_HOTPLUG_CPU is not set +# CONFIG_HOTPLUG_PCI is not set +# CONFIG_HP100 is not set +# CONFIG_HPET_TIMER is not set +# CONFIG_HPFS_FS is not set +CONFIG_HT_IRQ=y +# CONFIG_HUGETLBFS is not set +# CONFIG_HUGETLB_PAGE is not set +# CONFIG_HWMON is not set +# CONFIG_HWMON_VID is not set +CONFIG_HW_CONSOLE=y +CONFIG_HW_RANDOM=y +# CONFIG_HW_RANDOM_AMD is not set +CONFIG_HW_RANDOM_GEODE=y +# CONFIG_HW_RANDOM_INTEL is not set +CONFIG_HW_RANDOM_VIA=y +CONFIG_HZ=100 +CONFIG_HZ_100=y +# CONFIG_HZ_1000 is not set +# CONFIG_HZ_1024 is not set +# CONFIG_HZ_128 is not set +# CONFIG_HZ_250 is not set +# CONFIG_HZ_256 is not set +# CONFIG_HZ_300 is not set +# CONFIG_HZ_48 is not set +CONFIG_I2C=y +# CONFIG_I2C_ALGOBIT is not set +# CONFIG_I2C_ALGOPCA is not set +# CONFIG_I2C_ALGOPCF is not set +# CONFIG_I2C_ALI1535 is not set +# CONFIG_I2C_ALI1563 is not set +# CONFIG_I2C_ALI15X3 is not set +# CONFIG_I2C_AMD756 is not set +# CONFIG_I2C_AMD8111 is not set +CONFIG_I2C_BOARDINFO=y +# CONFIG_I2C_CHARDEV is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +# CONFIG_I2C_DEBUG_CHIP is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_ELEKTOR is not set +# CONFIG_I2C_GPIO is not set +# CONFIG_I2C_I801 is not set +# CONFIG_I2C_I810 is not set +# CONFIG_I2C_NFORCE2 is not set +# CONFIG_I2C_OCORES is not set +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_PCA_ISA is not set +# CONFIG_I2C_PIIX4 is not set +# CONFIG_I2C_PROSAVAGE is not set +# CONFIG_I2C_SAVAGE4 is not set +# CONFIG_I2C_SIMTEC is not set +# CONFIG_I2C_SIS5595 is not set +# CONFIG_I2C_SIS630 is not set +# CONFIG_I2C_SIS96X is not set +# CONFIG_I2C_STUB is not set +# CONFIG_I2C_TAOS_EVM is not set +# CONFIG_I2C_TINY_USB is not set +# CONFIG_I2C_VIA is not set +# CONFIG_I2C_VIAPRO is not set +# CONFIG_I2C_VOODOO3 is not set +# CONFIG_I2O is not set +# CONFIG_I6300ESB_WDT is not set +# CONFIG_I82092 is not set +# CONFIG_I8K is not set +# CONFIG_IB700_WDT is not set +# CONFIG_IBMASR is not set +# CONFIG_IBM_ASM is not set +# CONFIG_IBM_NEW_EMAC_EMAC4 is not set +# CONFIG_IBM_NEW_EMAC_RGMII is not set +# CONFIG_IBM_NEW_EMAC_TAH is not set +# CONFIG_IBM_NEW_EMAC_ZMII is not set +# CONFIG_ICPLUS_PHY is not set +# CONFIG_IDE is not set +# CONFIG_IDEDISK_MULTI_MODE is not set +# CONFIG_IDEDMA_IVB is not set +# CONFIG_IDEDMA_ONLYDISK is not set +# CONFIG_IDEPCI_SHARE_IRQ is not set +CONFIG_IDE_MAX_HWIFS=4 +CONFIG_IDE_PROC_FS=y +# CONFIG_IDE_TASK_IOCTL is not set +# CONFIG_IEEE1394 is not set +# CONFIG_IEEE80211 is not set +CONFIG_IEEE80211_CRYPT_CCMP=m +CONFIG_IEEE80211_CRYPT_TKIP=m +CONFIG_IEEE80211_CRYPT_WEP=m +# CONFIG_IEEE80211_DEBUG is not set +CONFIG_IEEE80211_SOFTMAC=m +# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set +CONFIG_IFB=m +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_IMQ=m +# CONFIG_IMQ_BEHAVIOR_AA is not set +# CONFIG_IMQ_BEHAVIOR_AB is not set +CONFIG_IMQ_BEHAVIOR_BA=y +# CONFIG_IMQ_BEHAVIOR_BB is not set +CONFIG_IMQ_NUM_DEVS=2 +CONFIG_INET=y +CONFIG_INET6_AH=m +CONFIG_INET6_ESP=m +CONFIG_INET6_IPCOMP=m +# CONFIG_INET6_TUNNEL is not set +CONFIG_INET6_XFRM_MODE_BEET=m +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +CONFIG_INET6_XFRM_MODE_TRANSPORT=m +CONFIG_INET6_XFRM_MODE_TUNNEL=m +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET_AH is not set +CONFIG_INET_DIAG=m +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_INET_LRO is not set +CONFIG_INET_TCP_DIAG=m +# CONFIG_INET_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_TUNNEL is not set +# CONFIG_INFINIBAND is not set +# CONFIG_INFTL is not set +CONFIG_INITRAMFS_SOURCE="" +CONFIG_INIT_ENV_ARG_LIMIT=32 +# CONFIG_INOTIFY is not set +# CONFIG_INOTIFY_USER is not set +CONFIG_INPUT=y +# CONFIG_INPUT_ATI_REMOTE is not set +# CONFIG_INPUT_ATI_REMOTE2 is not set +# CONFIG_INPUT_EVBUG is not set +# CONFIG_INPUT_EVDEV is not set +# CONFIG_INPUT_FF_MEMLESS is not set +# CONFIG_INPUT_JOYDEV is not set +# CONFIG_INPUT_JOYSTICK is not set +CONFIG_INPUT_KEYBOARD=y +# CONFIG_INPUT_KEYSPAN_REMOTE is not set +# CONFIG_INPUT_MISC is not set +CONFIG_INPUT_MOUSE=y +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSEDEV_PSAUX=y +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +# CONFIG_INPUT_PCSPKR is not set +# CONFIG_INPUT_POLLDEV is not set +# CONFIG_INPUT_POWERMATE is not set +# CONFIG_INPUT_TABLET is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_TSDEV is not set +# CONFIG_INPUT_UINPUT is not set +# CONFIG_INPUT_WISTRON_BTNS is not set +CONFIG_INSTRUMENTATION=y +# CONFIG_IOSCHED_AS is not set +# CONFIG_IOSCHED_CFQ is not set +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_NOOP=y +# CONFIG_IP1000 is not set +CONFIG_IP6_NF_FILTER=m +CONFIG_IP6_NF_IPTABLES=m +CONFIG_IP6_NF_MANGLE=m +CONFIG_IP6_NF_MATCH_AH=m +CONFIG_IP6_NF_MATCH_EUI64=m +CONFIG_IP6_NF_MATCH_FRAG=m +CONFIG_IP6_NF_MATCH_HL=m +CONFIG_IP6_NF_MATCH_IPV6HEADER=m +CONFIG_IP6_NF_MATCH_LIMIT=m +CONFIG_IP6_NF_MATCH_MH=m +CONFIG_IP6_NF_MATCH_OPTS=m +CONFIG_IP6_NF_MATCH_OWNER=m +CONFIG_IP6_NF_MATCH_RT=m +CONFIG_IP6_NF_QUEUE=m +CONFIG_IP6_NF_RAW=m +CONFIG_IP6_NF_TARGET_HL=m +CONFIG_IP6_NF_TARGET_IMQ=m +CONFIG_IP6_NF_TARGET_LOG=m +CONFIG_IP6_NF_TARGET_REJECT=m +CONFIG_IP6_NF_TARGET_ROUTE=m +# CONFIG_IPC_NS is not set +# CONFIG_IPMI_HANDLER is not set +CONFIG_IPSEC_NAT_TRAVERSAL=y +# CONFIG_IPV6 is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_IPV6_PRIVACY is not set +CONFIG_IPV6_ROUTER_PREF=y +# CONFIG_IPV6_ROUTE_INFO is not set +CONFIG_IPV6_SIT=m +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IPW2100 is not set +# CONFIG_IPW2100_DEBUG is not set +CONFIG_IPW2100_MONITOR=y +# CONFIG_IPW2200 is not set +# CONFIG_IPW2200_DEBUG is not set +CONFIG_IPW2200_MONITOR=y +# CONFIG_IPW2200_PROMISCUOUS is not set +# CONFIG_IPW2200_QOS is not set +# CONFIG_IPW2200_RADIOTAP is not set +# CONFIG_IPX is not set +CONFIG_IP_ADVANCED_ROUTER=y +# CONFIG_IP_DCCP is not set +CONFIG_IP_FIB_HASH=y +# CONFIG_IP_FIB_TRIE is not set +# CONFIG_IP_MROUTE is not set +CONFIG_IP_MULTICAST=y +CONFIG_IP_MULTIPLE_TABLES=y +CONFIG_IP_NF_AMANDA=m +CONFIG_IP_NF_ARPFILTER=m +# CONFIG_IP_NF_ARPTABLES is not set +CONFIG_IP_NF_ARP_MANGLE=m +CONFIG_IP_NF_CONNTRACK=y +# CONFIG_IP_NF_CONNTRACK_EVENTS is not set +CONFIG_IP_NF_CONNTRACK_MARK=y +CONFIG_IP_NF_CT_ACCT=y +CONFIG_IP_NF_CT_PROTO_SCTP=m +CONFIG_IP_NF_FILTER=y +CONFIG_IP_NF_FTP=m +CONFIG_IP_NF_H323=m +CONFIG_IP_NF_IPTABLES=y +CONFIG_IP_NF_IRC=m +CONFIG_IP_NF_MANGLE=y +CONFIG_IP_NF_MATCH_ADDRTYPE=m +# CONFIG_IP_NF_MATCH_AH is not set +# CONFIG_IP_NF_MATCH_ECN is not set +CONFIG_IP_NF_MATCH_HASHLIMIT=m +# CONFIG_IP_NF_MATCH_IPP2P is not set +CONFIG_IP_NF_MATCH_IPRANGE=m +# CONFIG_IP_NF_MATCH_OWNER is not set +# CONFIG_IP_NF_MATCH_RECENT is not set +CONFIG_IP_NF_MATCH_SET=m +# CONFIG_IP_NF_MATCH_TIME is not set +# CONFIG_IP_NF_MATCH_TOS is not set +# CONFIG_IP_NF_MATCH_TTL is not set +CONFIG_IP_NF_NAT=y +CONFIG_IP_NF_NAT_AMANDA=m +CONFIG_IP_NF_NAT_FTP=m +CONFIG_IP_NF_NAT_H323=m +CONFIG_IP_NF_NAT_IRC=m +CONFIG_IP_NF_NAT_NEEDED=y +CONFIG_IP_NF_NAT_PPTP=m +CONFIG_IP_NF_NAT_SIP=m +# CONFIG_IP_NF_NAT_SNMP_BASIC is not set +CONFIG_IP_NF_NAT_TFTP=m +# CONFIG_IP_NF_NETBIOS_NS is not set +CONFIG_IP_NF_PPTP=m +# CONFIG_IP_NF_QUEUE is not set +CONFIG_IP_NF_RAW=m +# CONFIG_IP_NF_SET is not set +CONFIG_IP_NF_SET_HASHSIZE=1024 +CONFIG_IP_NF_SET_IPHASH=m +CONFIG_IP_NF_SET_IPMAP=m +CONFIG_IP_NF_SET_IPPORTHASH=m +CONFIG_IP_NF_SET_IPTREE=m +CONFIG_IP_NF_SET_IPTREEMAP=m +CONFIG_IP_NF_SET_MACIPMAP=m +CONFIG_IP_NF_SET_MAX=256 +CONFIG_IP_NF_SET_NETHASH=m +CONFIG_IP_NF_SET_PORTMAP=m +CONFIG_IP_NF_SIP=m +# CONFIG_IP_NF_TARGET_CLUSTERIP is not set +# CONFIG_IP_NF_TARGET_ECN is not set +# CONFIG_IP_NF_TARGET_IMQ is not set +# CONFIG_IP_NF_TARGET_LOG is not set +CONFIG_IP_NF_TARGET_MASQUERADE=y +# CONFIG_IP_NF_TARGET_NETMAP is not set +# CONFIG_IP_NF_TARGET_REDIRECT is not set +CONFIG_IP_NF_TARGET_REJECT=y +CONFIG_IP_NF_TARGET_ROUTE=m +CONFIG_IP_NF_TARGET_SAME=m +CONFIG_IP_NF_TARGET_SET=m +# CONFIG_IP_NF_TARGET_TOS is not set +# CONFIG_IP_NF_TARGET_TTL is not set +# CONFIG_IP_NF_TARGET_ULOG is not set +CONFIG_IP_NF_TFTP=m +# CONFIG_IP_PNP is not set +CONFIG_IP_ROUTE_FWMARK=y +CONFIG_IP_ROUTE_MULTIPATH=y +CONFIG_IP_ROUTE_MULTIPATH_CACHED=y +CONFIG_IP_ROUTE_MULTIPATH_DRR=m +CONFIG_IP_ROUTE_MULTIPATH_RANDOM=m +CONFIG_IP_ROUTE_MULTIPATH_RR=m +CONFIG_IP_ROUTE_MULTIPATH_WRANDOM=m +CONFIG_IP_ROUTE_VERBOSE=y +# CONFIG_IP_SCTP is not set +# CONFIG_IP_VS is not set +# CONFIG_IRDA is not set +# CONFIG_ISA is not set +CONFIG_ISA_DMA_API=y +# CONFIG_ISCSI_TCP is not set +# CONFIG_ISDN is not set +CONFIG_ISDN_CAPI=m +CONFIG_ISDN_CAPI_CAPI20=m +CONFIG_ISDN_CAPI_CAPIFS=m +CONFIG_ISDN_CAPI_CAPIFS_BOOL=y +CONFIG_ISDN_CAPI_MIDDLEWARE=y +# CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON is not set +# CONFIG_ISDN_I4L is not set +# CONFIG_ISO9660_FS is not set +# CONFIG_IT8712F_WDT is not set +# CONFIG_ITCO_WDT is not set +# CONFIG_IXGB is not set +CONFIG_JBD=m +# CONFIG_JBD_DEBUG is not set +# CONFIG_JFFS2_CMODE_FAVOURLZO is not set +# CONFIG_JFFS2_CMODE_NONE is not set +CONFIG_JFFS2_CMODE_PRIORITY=y +# CONFIG_JFFS2_CMODE_SIZE is not set +CONFIG_JFFS2_COMPRESSION_OPTIONS=y +CONFIG_JFFS2_FS=y +CONFIG_JFFS2_FS_DEBUG=0 +# CONFIG_JFFS2_FS_WBUF_VERIFY is not set +CONFIG_JFFS2_FS_WRITEBUFFER=y +# CONFIG_JFFS2_FS_XATTR is not set +# CONFIG_JFFS2_LZO is not set +CONFIG_JFFS2_RTIME=y +# CONFIG_JFFS2_RUBIN is not set +CONFIG_JFFS2_SUMMARY=y +CONFIG_JFFS2_ZLIB=y +# CONFIG_JFFS_FS is not set +# CONFIG_JFS_DEBUG is not set +# CONFIG_JFS_FS is not set +# CONFIG_JFS_POSIX_ACL is not set +# CONFIG_JFS_SECURITY is not set +# CONFIG_JFS_STATISTICS is not set +CONFIG_JOLIET=y +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +# CONFIG_KALLSYMS_EXTRA_PASS is not set +# CONFIG_KARMA_PARTITION is not set +CONFIG_KEXEC=y +CONFIG_KEYBOARD_ATKBD=y +# CONFIG_KEYBOARD_LKKBD is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_XTKBD is not set +# CONFIG_KEYS is not set +CONFIG_KMOD=y +# CONFIG_KPROBES is not set +CONFIG_KTIME_SCALAR=y +# CONFIG_KVM is not set +# CONFIG_LAPB is not set +# CONFIG_LASAT is not set +# CONFIG_LBD is not set +CONFIG_LCD_CLASS_DEVICE=y +# CONFIG_LDM_PARTITION is not set +# CONFIG_LEDS_ALIX is not set +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +# CONFIG_LEDS_TRIGGER_IDE_DISK is not set +# CONFIG_LEDS_TRIGGER_MORSE is not set +CONFIG_LEDS_TRIGGER_TIMER=y +# CONFIG_LEGACY_PTYS is not set +# CONFIG_LGUEST is not set +CONFIG_LIBCRC32C=m +# CONFIG_LIBERTAS is not set +# CONFIG_LIBERTAS_USB is not set +CONFIG_LLC=y +CONFIG_LLC2=m +CONFIG_LOCALVERSION="" +CONFIG_LOCALVERSION_AUTO=y +CONFIG_LOCKD=m +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_LOCKD_V4=y +# CONFIG_LOCK_STAT is not set +CONFIG_LOGO=y +CONFIG_LOGO_LINUX_CLUT224=y +# CONFIG_LOGO_LINUX_MONO is not set +# CONFIG_LOGO_LINUX_VGA16 is not set +CONFIG_LOG_BUF_SHIFT=14 +# CONFIG_LSF is not set +# CONFIG_LXT_PHY is not set +# CONFIG_M386 is not set +# CONFIG_M486 is not set +# CONFIG_M586 is not set +# CONFIG_M586MMX is not set +# CONFIG_M586TSC is not set +# CONFIG_M686 is not set +# CONFIG_MAC80211 is not set +# CONFIG_MAC80211_DEBUG is not set +# CONFIG_MAC80211_LEDS is not set +# CONFIG_MACHZ_WDT is not set +# CONFIG_MACINTOSH_DRIVERS is not set +# CONFIG_MACVLAN is not set +# CONFIG_MAC_EMUMOUSEBTN is not set +CONFIG_MAC_PARTITION=y +# CONFIG_MAGIC_SYSRQ is not set +# CONFIG_MARKEINS is not set +# CONFIG_MARKERS is not set +# CONFIG_MARVELL_PHY is not set +# CONFIG_MATH_EMULATION is not set +# CONFIG_MCA is not set +# CONFIG_MCORE2 is not set +# CONFIG_MCRUSOE is not set +# CONFIG_MCYRIXIII is not set +# CONFIG_MD is not set +# CONFIG_MEFFICEON is not set +# CONFIG_MEGARAID_LEGACY is not set +# CONFIG_MEGARAID_NEWGEN is not set +# CONFIG_MEGARAID_SAS is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_MGEODEGX1 is not set +CONFIG_MGEODE_LX=y +CONFIG_MICROCODE=y +CONFIG_MICROCODE_OLD_INTERFACE=y +CONFIG_MII=y +# CONFIG_MINIX_FS is not set +# CONFIG_MINIX_SUBPARTITION is not set +CONFIG_MINI_FO=y +CONFIG_MISC_DEVICES=y +# CONFIG_MK6 is not set +# CONFIG_MK7 is not set +# CONFIG_MK8 is not set +CONFIG_MKISS=m +CONFIG_MMC=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_BLOCK_BOUNCE=y +# CONFIG_MMC_DEBUG is not set +# CONFIG_MMC_RICOH_MMC is not set +CONFIG_MMC_SDHCI=y +# CONFIG_MMC_TIFM_SD is not set +# CONFIG_MMC_UNSAFE_RESUME is not set +# CONFIG_MMC_WBSD is not set +CONFIG_MMU=y +CONFIG_MODULES=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +CONFIG_MODULE_UNLOAD=y +CONFIG_MODVERSIONS=y +# CONFIG_MOUSE_APPLETOUCH is not set +# CONFIG_MOUSE_INPORT is not set +# CONFIG_MOUSE_LOGIBM is not set +# CONFIG_MOUSE_PC110PAD is not set +CONFIG_MOUSE_PS2=y +CONFIG_MOUSE_PS2_ALPS=y +CONFIG_MOUSE_PS2_LIFEBOOK=y +CONFIG_MOUSE_PS2_LOGIPS2PP=y +# CONFIG_MOUSE_PS2_OLPC is not set +CONFIG_MOUSE_PS2_SYNAPTICS=y +# CONFIG_MOUSE_PS2_TOUCHKIT is not set +CONFIG_MOUSE_PS2_TRACKPOINT=y +# CONFIG_MOUSE_SERIAL is not set +# CONFIG_MOUSE_VSXXXAA is not set +# CONFIG_MPENTIUM4 is not set +# CONFIG_MPENTIUMII is not set +# CONFIG_MPENTIUMIII is not set +# CONFIG_MPENTIUMM is not set +# CONFIG_MPSC is not set +# CONFIG_MSDOS_FS is not set +CONFIG_MSDOS_PARTITION=y +CONFIG_MTD=y +# CONFIG_MTD_ABSENT is not set +# CONFIG_MTD_ALAUDA is not set +CONFIG_MTD_BLKDEVS=y +CONFIG_MTD_BLOCK=y +CONFIG_MTD_BLOCK2MTD=y +# CONFIG_MTD_CFI is not set +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +# CONFIG_MTD_CFI_I4 is not set +# CONFIG_MTD_CFI_I8 is not set +CONFIG_MTD_CHAR=y +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_COMPLEX_MAPPINGS=y +# CONFIG_MTD_CONCAT is not set +# CONFIG_MTD_DEBUG is not set +# CONFIG_MTD_DOC2000 is not set +# CONFIG_MTD_DOC2001 is not set +# CONFIG_MTD_DOC2001PLUS is not set +# CONFIG_MTD_INTEL_VR_NOR is not set +# CONFIG_MTD_JEDECPROBE is not set +CONFIG_MTD_MAP_BANK_WIDTH_1=y +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set +CONFIG_MTD_MAP_BANK_WIDTH_2=y +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set +CONFIG_MTD_MAP_BANK_WIDTH_4=y +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set +# CONFIG_MTD_MTDRAM is not set +CONFIG_MTD_NAND=y +CONFIG_MTD_NAND_CAFE=y +# CONFIG_MTD_NAND_CS553X is not set +# CONFIG_MTD_NAND_DISKONCHIP is not set +# CONFIG_MTD_NAND_ECC_SMC is not set +CONFIG_MTD_NAND_IDS=y +# CONFIG_MTD_NAND_MUSEUM_IDS is not set +# CONFIG_MTD_NAND_NANDSIM is not set +# CONFIG_MTD_NAND_PLATFORM is not set +# CONFIG_MTD_NAND_VERIFY_WRITE is not set +# CONFIG_MTD_ONENAND is not set +CONFIG_MTD_OOPS=y +CONFIG_MTD_PARTITIONS=y +CONFIG_MTD_PCI=y +# CONFIG_MTD_PHRAM is not set +# CONFIG_MTD_PLATRAM is not set +# CONFIG_MTD_PMC551 is not set +# CONFIG_MTD_RAM is not set +# CONFIG_MTD_REDBOOT_PARTS is not set +# CONFIG_MTD_ROM is not set +CONFIG_MTD_ROOTFS_ROOT_DEV=y +CONFIG_MTD_ROOTFS_SPLIT=y +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_TS5500 is not set +# CONFIG_MTD_UBI is not set +# CONFIG_MTRR is not set +# CONFIG_MVIAC3_2 is not set +# CONFIG_MVIAC7 is not set +# CONFIG_MWAVE is not set +# CONFIG_MWINCHIP2 is not set +# CONFIG_MWINCHIP3D is not set +# CONFIG_MWINCHIPC6 is not set +# CONFIG_MYRI10GE is not set +# CONFIG_NATSEMI is not set +# CONFIG_NCP_FS is not set +# CONFIG_NE2K_PCI is not set +CONFIG_NET=y +# CONFIG_NETCONSOLE is not set +# CONFIG_NETDEBUG is not set +CONFIG_NETDEVICES=y +# CONFIG_NETDEVICES_MULTIQUEUE is not set +CONFIG_NETDEV_1000=y +# CONFIG_NETDEV_10000 is not set +CONFIG_NETFILTER=y +# CONFIG_NETFILTER_DEBUG is not set +# CONFIG_NETFILTER_NETLINK is not set +CONFIG_NETFILTER_XTABLES=y +CONFIG_NETFILTER_XT_MATCH_COMMENT=m +# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set +CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m +# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set +# CONFIG_NETFILTER_XT_MATCH_CONNTRACK is not set +CONFIG_NETFILTER_XT_MATCH_DCCP=m +# CONFIG_NETFILTER_XT_MATCH_DSCP is not set +# CONFIG_NETFILTER_XT_MATCH_ESP is not set +CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m +# CONFIG_NETFILTER_XT_MATCH_HELPER is not set +CONFIG_NETFILTER_XT_MATCH_LAYER7=m +# CONFIG_NETFILTER_XT_MATCH_LAYER7_DEBUG is not set +# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set +CONFIG_NETFILTER_XT_MATCH_LIMIT=y +# CONFIG_NETFILTER_XT_MATCH_MAC is not set +# CONFIG_NETFILTER_XT_MATCH_MARK is not set +CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y +CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m +# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set +CONFIG_NETFILTER_XT_MATCH_POLICY=m +# CONFIG_NETFILTER_XT_MATCH_PORTSCAN is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set +CONFIG_NETFILTER_XT_MATCH_REALM=m +CONFIG_NETFILTER_XT_MATCH_SCTP=m +CONFIG_NETFILTER_XT_MATCH_STATE=y +# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set +# CONFIG_NETFILTER_XT_MATCH_STRING is not set +# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set +CONFIG_NETFILTER_XT_MATCH_TIME=m +CONFIG_NETFILTER_XT_MATCH_U32=m +# CONFIG_NETFILTER_XT_TARGET_CHAOS is not set +# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set +# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set +# CONFIG_NETFILTER_XT_TARGET_DELUDE is not set +# CONFIG_NETFILTER_XT_TARGET_DSCP is not set +# CONFIG_NETFILTER_XT_TARGET_MARK is not set +CONFIG_NETFILTER_XT_TARGET_NFLOG=m +CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m +# CONFIG_NETFILTER_XT_TARGET_NOTRACK is not set +# CONFIG_NETFILTER_XT_TARGET_TARPIT is not set +CONFIG_NETFILTER_XT_TARGET_TCPMSS=y +CONFIG_NETFILTER_XT_TARGET_TRACE=m +# CONFIG_NETPOLL is not set +# CONFIG_NETROM is not set +CONFIG_NETWORK_FILESYSTEMS=y +# CONFIG_NETWORK_SECMARK is not set +# CONFIG_NETXEN_NIC is not set +# CONFIG_NET_9P is not set +CONFIG_NET_ACT_GACT=m +CONFIG_NET_ACT_IPT=m +CONFIG_NET_ACT_MIRRED=m +# CONFIG_NET_ACT_NAT is not set +CONFIG_NET_ACT_PEDIT=m +CONFIG_NET_ACT_POLICE=y +# CONFIG_NET_ACT_SIMP is not set +CONFIG_NET_CLS=y +CONFIG_NET_CLS_ACT=y +CONFIG_NET_CLS_BASIC=m +CONFIG_NET_CLS_FW=m +CONFIG_NET_CLS_IND=y +CONFIG_NET_CLS_POLICE=y +CONFIG_NET_CLS_ROUTE=y +CONFIG_NET_CLS_ROUTE4=m +CONFIG_NET_CLS_RSVP=m +CONFIG_NET_CLS_RSVP6=m +CONFIG_NET_CLS_TCINDEX=m +CONFIG_NET_CLS_U32=m +CONFIG_NET_EMATCH=y +CONFIG_NET_EMATCH_CMP=m +CONFIG_NET_EMATCH_META=m +CONFIG_NET_EMATCH_NBYTE=m +CONFIG_NET_EMATCH_STACK=32 +CONFIG_NET_EMATCH_TEXT=m +CONFIG_NET_EMATCH_U32=m +CONFIG_NET_ESTIMATOR=y +CONFIG_NET_ETHERNET=y +# CONFIG_NET_FC is not set +# CONFIG_NET_IPGRE is not set +CONFIG_NET_IPGRE_BROADCAST=y +# CONFIG_NET_IPIP is not set +# CONFIG_NET_ISA is not set +# CONFIG_NET_KEY is not set +# CONFIG_NET_KEY_MIGRATE is not set +CONFIG_NET_PCI=y +# CONFIG_NET_PCMCIA is not set +# CONFIG_NET_PKTGEN is not set +# CONFIG_NET_POLL_CONTROLLER is not set +CONFIG_NET_RADIO=y +# CONFIG_NET_SB1000 is not set +CONFIG_NET_SCHED=y +CONFIG_NET_SCH_ATM=m +CONFIG_NET_SCH_CBQ=m +# CONFIG_NET_SCH_CLK_CPU is not set +# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set +CONFIG_NET_SCH_CLK_JIFFIES=y +# CONFIG_NET_SCH_DSMARK is not set +# CONFIG_NET_SCH_ESFQ is not set +CONFIG_NET_SCH_ESFQ_NFCT=y +CONFIG_NET_SCH_FIFO=y +# CONFIG_NET_SCH_GRED is not set +# CONFIG_NET_SCH_HFSC is not set +# CONFIG_NET_SCH_HTB is not set +# CONFIG_NET_SCH_INGRESS is not set +CONFIG_NET_SCH_NETEM=m +CONFIG_NET_SCH_PRIO=m +# CONFIG_NET_SCH_RED is not set +CONFIG_NET_SCH_RR=m +# CONFIG_NET_SCH_SFQ is not set +# CONFIG_NET_SCH_TBF is not set +# CONFIG_NET_SCH_TEQL is not set +# CONFIG_NET_TULIP is not set +CONFIG_NET_VENDOR_3COM=y +CONFIG_NET_WIRELESS=y +CONFIG_NET_WIRELESS_RTNETLINK=y +# CONFIG_NEW_GPIO is not set +CONFIG_NEW_LEDS=y +# CONFIG_NFSD is not set +CONFIG_NFSD_TCP=y +# CONFIG_NFSD_V2_ACL is not set +CONFIG_NFSD_V3=y +# CONFIG_NFSD_V3_ACL is not set +CONFIG_NFSD_V4=y +# CONFIG_NFS_ACL_SUPPORT is not set +CONFIG_NFS_COMMON=y +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_NFS_FS is not set +CONFIG_NFS_V3=y +# CONFIG_NFS_V3_ACL is not set +CONFIG_NFS_V4=y +# CONFIG_NFTL is not set +CONFIG_NF_CONNTRACK=y +# CONFIG_NF_CONNTRACK_AMANDA is not set +CONFIG_NF_CONNTRACK_ENABLED=y +# CONFIG_NF_CONNTRACK_EVENTS is not set +CONFIG_NF_CONNTRACK_FTP=m +# CONFIG_NF_CONNTRACK_H323 is not set +CONFIG_NF_CONNTRACK_IPV4=y +CONFIG_NF_CONNTRACK_IPV6=m +CONFIG_NF_CONNTRACK_IRC=m +CONFIG_NF_CONNTRACK_MARK=y +# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set +# CONFIG_NF_CONNTRACK_PPTP is not set +CONFIG_NF_CONNTRACK_PROC_COMPAT=y +# CONFIG_NF_CONNTRACK_RTSP is not set +# CONFIG_NF_CONNTRACK_SANE is not set +# CONFIG_NF_CONNTRACK_SIP is not set +CONFIG_NF_CONNTRACK_SUPPORT=y +CONFIG_NF_CONNTRACK_TFTP=m +CONFIG_NF_CT_ACCT=y +CONFIG_NF_CT_PROTO_GRE=m +# CONFIG_NF_CT_PROTO_SCTP is not set +# CONFIG_NF_CT_PROTO_UDPLITE is not set +CONFIG_NF_NAT=y +# CONFIG_NF_NAT_AMANDA is not set +CONFIG_NF_NAT_FTP=m +# CONFIG_NF_NAT_H323 is not set +CONFIG_NF_NAT_IRC=m +CONFIG_NF_NAT_NEEDED=y +# CONFIG_NF_NAT_PPTP is not set +CONFIG_NF_NAT_PROTO_GRE=m +# CONFIG_NF_NAT_RTSP is not set +# CONFIG_NF_NAT_SIP is not set +# CONFIG_NF_NAT_SNMP_BASIC is not set +CONFIG_NF_NAT_TFTP=m +CONFIG_NL80211=y +# CONFIG_NLS is not set +# CONFIG_NLS_ASCII is not set +CONFIG_NLS_CODEPAGE_1250=m +# CONFIG_NLS_CODEPAGE_1251 is not set +CONFIG_NLS_CODEPAGE_437=m +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +CONFIG_NLS_CODEPAGE_850=m +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +CONFIG_NLS_DEFAULT="iso8859-1" +CONFIG_NLS_ISO8859_1=m +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +CONFIG_NLS_ISO8859_15=m +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_ISO8859_9 is not set +CONFIG_NLS_KOI8_R=m +# CONFIG_NLS_KOI8_U is not set +CONFIG_NLS_UTF8=m +CONFIG_NOHIGHMEM=y +CONFIG_NORTEL_HERMES=m +CONFIG_NO_HZ=y +CONFIG_NR_QUICK=1 +# CONFIG_NS83820 is not set +CONFIG_NSC_GPIO=m +# CONFIG_NTFS_DEBUG is not set +# CONFIG_NTFS_FS is not set +# CONFIG_NTFS_RW is not set +CONFIG_NVRAM=y +# CONFIG_OCFS2_FS is not set +CONFIG_OLPC=y +CONFIG_OLPC_PM=y +CONFIG_OPEN_FIRMWARE=y +# CONFIG_OSF_PARTITION is not set +CONFIG_PACKET=y +CONFIG_PACKET_MMAP=y +CONFIG_PAGE_OFFSET=0xC0000000 +# CONFIG_PARAVIRT_GUEST is not set +# CONFIG_PARPORT is not set +# CONFIG_PARPORT_PC is not set +CONFIG_PARTITION_ADVANCED=y +# CONFIG_PATA_ALI is not set +# CONFIG_PATA_AMD is not set +# CONFIG_PATA_ARTOP is not set +# CONFIG_PATA_ATIIXP is not set +# CONFIG_PATA_CMD640_PCI is not set +# CONFIG_PATA_CMD64X is not set +# CONFIG_PATA_CS5520 is not set +# CONFIG_PATA_CS5530 is not set +# CONFIG_PATA_CS5535 is not set +# CONFIG_PATA_CYPRESS is not set +# CONFIG_PATA_EFAR is not set +# CONFIG_PATA_HPT366 is not set +# CONFIG_PATA_HPT37X is not set +# CONFIG_PATA_HPT3X2N is not set +# CONFIG_PATA_HPT3X3 is not set +# CONFIG_PATA_ISAPNP is not set +# CONFIG_PATA_IT8213 is not set +# CONFIG_PATA_IT821X is not set +# CONFIG_PATA_JMICRON is not set +# CONFIG_PATA_LEGACY is not set +# CONFIG_PATA_MARVELL is not set +# CONFIG_PATA_MPIIX is not set +# CONFIG_PATA_NETCELL is not set +# CONFIG_PATA_NS87410 is not set +# CONFIG_PATA_OLDPIIX is not set +# CONFIG_PATA_OPTI is not set +# CONFIG_PATA_OPTIDMA is not set +# CONFIG_PATA_PCMCIA is not set +# CONFIG_PATA_PDC2027X is not set +# CONFIG_PATA_PDC_OLD is not set +CONFIG_PATA_PLATFORM=m +# CONFIG_PATA_QDI is not set +# CONFIG_PATA_RADISYS is not set +# CONFIG_PATA_RZ1000 is not set +# CONFIG_PATA_SC1200 is not set +# CONFIG_PATA_SERVERWORKS is not set +# CONFIG_PATA_SIL680 is not set +# CONFIG_PATA_SIS is not set +# CONFIG_PATA_TRIFLEX is not set +# CONFIG_PATA_VIA is not set +# CONFIG_PATA_WINBOND is not set +# CONFIG_PATA_WINBOND_VLB is not set +# CONFIG_PC300TOO is not set +CONFIG_PC8736x_GPIO=m +# CONFIG_PC87413_WDT is not set +# CONFIG_PCCARD is not set +CONFIG_PCI=y +# CONFIG_PCIEPORTBUS is not set +# CONFIG_PCIPCWATCHDOG is not set +# CONFIG_PCI_ATMEL is not set +# CONFIG_PCI_DEBUG is not set +CONFIG_PCI_DIRECT=y +CONFIG_PCI_DOMAINS=y +# CONFIG_PCI_GOANY is not set +# CONFIG_PCI_GOBIOS is not set +# CONFIG_PCI_GODIRECT is not set +# CONFIG_PCI_GOMMCONFIG is not set +CONFIG_PCI_GOOLPC=y +CONFIG_PCI_HERMES=m +# CONFIG_PCI_LEGACY is not set +# CONFIG_PCI_MSI is not set +CONFIG_PCI_OLPC=y +# CONFIG_PCMCIA is not set +# CONFIG_PCMCIA_AHA152X is not set +# CONFIG_PCMCIA_ATMEL is not set +# CONFIG_PCMCIA_DEBUG is not set +# CONFIG_PCMCIA_FDOMAIN is not set +# CONFIG_PCMCIA_HERMES is not set +# CONFIG_PCMCIA_IOCTL is not set +# CONFIG_PCMCIA_LOAD_CIS is not set +# CONFIG_PCMCIA_NETWAVE is not set +# CONFIG_PCMCIA_NINJA_SCSI is not set +# CONFIG_PCMCIA_QLOGIC is not set +# CONFIG_PCMCIA_RAYCS is not set +# CONFIG_PCMCIA_SPECTRUM is not set +# CONFIG_PCMCIA_SYM53C500 is not set +# CONFIG_PCMCIA_WAVELAN is not set +# CONFIG_PCMCIA_WL3501 is not set +# CONFIG_PCNET32 is not set +# CONFIG_PD6729 is not set +# CONFIG_PDA_POWER is not set +# CONFIG_PDC_ADMA is not set +# CONFIG_PHANTOM is not set +# CONFIG_PHONE is not set +# CONFIG_PHYLIB is not set +CONFIG_PHYSICAL_ALIGN=0x100000 +CONFIG_PHYSICAL_START=0x100000 +# CONFIG_PID_NS is not set +CONFIG_PLIST=y +CONFIG_PLX_HERMES=m +CONFIG_PM=y +CONFIG_PM_DEBUG=y +CONFIG_PM_LEGACY=y +CONFIG_PM_SLEEP=y +CONFIG_PM_STD_PARTITION="" +# CONFIG_PM_TRACE is not set +# CONFIG_PM_VERBOSE is not set +# CONFIG_POSIX_MQUEUE is not set +CONFIG_POWER_SUPPLY=y +# CONFIG_POWER_SUPPLY_DEBUG is not set +CONFIG_PPP=m +CONFIG_PPPOATM=m +CONFIG_PPPOE=m +CONFIG_PPPOL2TP=m +CONFIG_PPP_ASYNC=m +CONFIG_PPP_BSDCOMP=m +CONFIG_PPP_DEFLATE=m +CONFIG_PPP_FILTER=y +# CONFIG_PPP_MPPE is not set +CONFIG_PPP_MULTILINK=y +# CONFIG_PPP_SYNC_TTY is not set +# CONFIG_PREEMPT is not set +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_VOLUNTARY=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +CONFIG_PRINTK=y +# CONFIG_PRINTK_TIME is not set +# CONFIG_PRISM54 is not set +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_PROC_SYSCTL=y +# CONFIG_PROFILING is not set +# CONFIG_PROMFS_FS is not set +# CONFIG_PROVE_LOCKING is not set +# CONFIG_QEMU is not set +# CONFIG_QLA3XXX is not set +# CONFIG_QNX4FS_FS is not set +CONFIG_QUICKLIST=y +# CONFIG_QUOTA is not set +# CONFIG_R3964 is not set +# CONFIG_R8169 is not set +# CONFIG_RADIO_ADAPTERS is not set +# CONFIG_RADIO_AZTECH is not set +# CONFIG_RADIO_CADET is not set +# CONFIG_RADIO_GEMTEK is not set +# CONFIG_RADIO_GEMTEK_PCI is not set +# CONFIG_RADIO_MAESTRO is not set +# CONFIG_RADIO_MAXIRADIO is not set +# CONFIG_RADIO_RTRACK is not set +# CONFIG_RADIO_RTRACK2 is not set +# CONFIG_RADIO_SF16FMI is not set +# CONFIG_RADIO_SF16FMR2 is not set +# CONFIG_RADIO_TERRATEC is not set +# CONFIG_RADIO_TRUST is not set +# CONFIG_RADIO_TYPHOON is not set +# CONFIG_RADIO_ZOLTRIX is not set +# CONFIG_RAID_ATTRS is not set +CONFIG_RAMFS=y +# CONFIG_RAW_DRIVER is not set +# CONFIG_RCU_TORTURE_TEST is not set +CONFIG_REED_SOLOMON=y +CONFIG_REED_SOLOMON_DEC16=y +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_FS is not set +# CONFIG_REISERFS_FS_XATTR is not set +# CONFIG_REISERFS_PROC_INFO is not set +CONFIG_RELAY=y +# CONFIG_RELOCATABLE is not set +# CONFIG_RESOURCES_64BIT is not set +# CONFIG_RFD_FTL is not set +# CONFIG_RFKILL is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_ROSE is not set +CONFIG_RPCSEC_GSS_KRB5=m +# CONFIG_RPCSEC_GSS_SPKM3 is not set +CONFIG_RTC=y +# CONFIG_RTC_CLASS is not set +CONFIG_RTC_DRV_CMOS=y +# CONFIG_RTC_DRV_MAX6900 is not set +# CONFIG_RTL8187 is not set +CONFIG_RT_MUTEXES=y +# CONFIG_RT_MUTEX_TESTER is not set +# CONFIG_RWSEM_GENERIC_SPINLOCK is not set +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +# CONFIG_S2IO is not set +# CONFIG_SAMPLES is not set +# CONFIG_SATA_AHCI is not set +# CONFIG_SATA_INIC162X is not set +# CONFIG_SATA_MV is not set +# CONFIG_SATA_NV is not set +# CONFIG_SATA_PROMISE is not set +# CONFIG_SATA_QSTOR is not set +# CONFIG_SATA_SIL is not set +# CONFIG_SATA_SIL24 is not set +# CONFIG_SATA_SIS is not set +# CONFIG_SATA_SVW is not set +# CONFIG_SATA_SX4 is not set +# CONFIG_SATA_ULI is not set +# CONFIG_SATA_VIA is not set +# CONFIG_SATA_VITESSE is not set +# CONFIG_SBC7240_WDT is not set +# CONFIG_SBC8360_WDT is not set +# CONFIG_SBC_EPX_C3_WATCHDOG is not set +# CONFIG_SC1200_WDT is not set +# CONFIG_SC520_WDT is not set +# CONFIG_SC92031 is not set +# CONFIG_SCHEDSTATS is not set +CONFIG_SCHED_DEBUG=y +CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y +CONFIG_SCSI=y +# CONFIG_SCSI_3W_9XXX is not set +# CONFIG_SCSI_7000FASST is not set +# CONFIG_SCSI_AACRAID is not set +# CONFIG_SCSI_ACARD is not set +# CONFIG_SCSI_ADVANSYS is not set +# CONFIG_SCSI_AHA152X is not set +# CONFIG_SCSI_AHA1542 is not set +# CONFIG_SCSI_AIC79XX is not set +# CONFIG_SCSI_AIC7XXX is not set +# CONFIG_SCSI_AIC7XXX_OLD is not set +# CONFIG_SCSI_AIC94XX is not set +# CONFIG_SCSI_ARCMSR is not set +# CONFIG_SCSI_BUSLOGIC is not set +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_DC390T is not set +# CONFIG_SCSI_DC395x is not set +# CONFIG_SCSI_DEBUG is not set +CONFIG_SCSI_DMA=y +# CONFIG_SCSI_DMX3191D is not set +# CONFIG_SCSI_DPT_I2O is not set +# CONFIG_SCSI_DTC3280 is not set +# CONFIG_SCSI_EATA is not set +# CONFIG_SCSI_ESP_CORE is not set +# CONFIG_SCSI_FC_ATTRS is not set +# CONFIG_SCSI_FUTURE_DOMAIN is not set +# CONFIG_SCSI_GDTH is not set +# CONFIG_SCSI_GENERIC_NCR5380 is not set +# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set +# CONFIG_SCSI_HPTIOP is not set +# CONFIG_SCSI_IN2000 is not set +# CONFIG_SCSI_INIA100 is not set +# CONFIG_SCSI_INITIO is not set +# CONFIG_SCSI_IPR is not set +# CONFIG_SCSI_IPS is not set +# CONFIG_SCSI_ISCSI_ATTRS is not set +# CONFIG_SCSI_LOGGING is not set +CONFIG_SCSI_LOWLEVEL=y +# CONFIG_SCSI_LPFC is not set +CONFIG_SCSI_MULTI_LUN=y +# CONFIG_SCSI_NCR53C406A is not set +# CONFIG_SCSI_NETLINK is not set +# CONFIG_SCSI_NSP32 is not set +# CONFIG_SCSI_PAS16 is not set +CONFIG_SCSI_PROC_FS=y +# CONFIG_SCSI_PSI240I is not set +# CONFIG_SCSI_QLA_FC is not set +# CONFIG_SCSI_QLA_ISCSI is not set +# CONFIG_SCSI_QLOGIC_1280 is not set +# CONFIG_SCSI_QLOGIC_FAS is not set +# CONFIG_SCSI_SAS_ATTRS is not set +# CONFIG_SCSI_SAS_LIBSAS is not set +# CONFIG_SCSI_SCAN_ASYNC is not set +# CONFIG_SCSI_SEAGATE is not set +# CONFIG_SCSI_SPI_ATTRS is not set +# CONFIG_SCSI_SRP is not set +# CONFIG_SCSI_SRP_ATTRS is not set +# CONFIG_SCSI_STEX is not set +# CONFIG_SCSI_SYM53C416 is not set +# CONFIG_SCSI_SYM53C8XX_2 is not set +# CONFIG_SCSI_T128 is not set +# CONFIG_SCSI_TGT is not set +# CONFIG_SCSI_U14_34F is not set +# CONFIG_SCSI_ULTRASTOR is not set +CONFIG_SCSI_WAIT_SCAN=m +# CONFIG_SCx200 is not set +# CONFIG_SCx200_ACB is not set +# CONFIG_SDIO_UART is not set +# CONFIG_SECCOMP is not set +# CONFIG_SECURITY is not set +# CONFIG_SECURITY_FILE_CAPABILITIES is not set +CONFIG_SELECT_MEMORY_MODEL=y +CONFIG_SEMAPHORE_SLEEPERS=y +# CONFIG_SENSORS_ABITUGURU is not set +# CONFIG_SENSORS_ABITUGURU3 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_APPLESMC is not set +# CONFIG_SENSORS_ASB100 is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_CORETEMP is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_DS1337 is not set +# CONFIG_SENSORS_DS1374 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_EEPROM is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_FSCHER is not set +# CONFIG_SENSORS_FSCPOS is not set +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_HDAPS is not set +# CONFIG_SENSORS_IT87 is not set +# CONFIG_SENSORS_K8TEMP is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM75 is not set +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_MAX6875 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_PCA9539 is not set +# CONFIG_SENSORS_PCF8574 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_SENSORS_SIS5595 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_SENSORS_VIA686A is not set +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_VT8231 is not set +# CONFIG_SENSORS_W83627EHF is not set +# CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +# CONFIG_SENSORS_W83L785TS is not set +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_CS=m +# CONFIG_SERIAL_8250_EXTENDED is not set +CONFIG_SERIAL_8250_NR_UARTS=2 +CONFIG_SERIAL_8250_PCI=y +CONFIG_SERIAL_8250_RUNTIME_UARTS=2 +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_JSM is not set +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_SERIAL_UARTLITE is not set +CONFIG_SERIO=y +# CONFIG_SERIO_CT82C710 is not set +CONFIG_SERIO_I8042=y +CONFIG_SERIO_LIBPS2=y +# CONFIG_SERIO_PCIPS2 is not set +# CONFIG_SERIO_RAW is not set +CONFIG_SERIO_SERPORT=y +# CONFIG_SGI_IOC4 is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_SHAPER is not set +CONFIG_SHMEM=y +CONFIG_SIGNALFD=y +# CONFIG_SIS190 is not set +# CONFIG_SIS900 is not set +# CONFIG_SK98LIN is not set +# CONFIG_SKGE is not set +# CONFIG_SKY2 is not set +CONFIG_SLAB=y +CONFIG_SLABINFO=y +CONFIG_SLHC=m +# CONFIG_SLIP is not set +# CONFIG_SLOB is not set +# CONFIG_SLUB is not set +# CONFIG_SMB_FS is not set +# CONFIG_SMB_NLS_DEFAULT is not set +# CONFIG_SMP is not set +# CONFIG_SMSC37B787_WDT is not set +CONFIG_SND=m +# CONFIG_SND_AC97_POWER_SAVE is not set +# CONFIG_SND_AD1816A is not set +# CONFIG_SND_AD1848 is not set +# CONFIG_SND_AD1889 is not set +# CONFIG_SND_ADLIB is not set +# CONFIG_SND_ALI5451 is not set +# CONFIG_SND_ALS100 is not set +# CONFIG_SND_ALS300 is not set +# CONFIG_SND_ALS4000 is not set +# CONFIG_SND_ATIIXP is not set +# CONFIG_SND_ATIIXP_MODEM is not set +# CONFIG_SND_AU8810 is not set +# CONFIG_SND_AU8820 is not set +# CONFIG_SND_AU8830 is not set +# CONFIG_SND_AZT2320 is not set +# CONFIG_SND_AZT3328 is not set +# CONFIG_SND_BT87X is not set +# CONFIG_SND_CA0106 is not set +# CONFIG_SND_CMI8330 is not set +# CONFIG_SND_CMIPCI is not set +# CONFIG_SND_CS4231 is not set +# CONFIG_SND_CS4232 is not set +# CONFIG_SND_CS4236 is not set +# CONFIG_SND_CS4281 is not set +# CONFIG_SND_CS46XX is not set +# CONFIG_SND_CS5535AUDIO is not set +# CONFIG_SND_DARLA20 is not set +# CONFIG_SND_DARLA24 is not set +# CONFIG_SND_DEBUG is not set +# CONFIG_SND_DT019X is not set +# CONFIG_SND_DUMMY is not set +# CONFIG_SND_DYNAMIC_MINORS is not set +# CONFIG_SND_ECHO3G is not set +# CONFIG_SND_EMU10K1 is not set +# CONFIG_SND_EMU10K1X is not set +# CONFIG_SND_ENS1370 is not set +# CONFIG_SND_ENS1371 is not set +# CONFIG_SND_ES1688 is not set +# CONFIG_SND_ES18XX is not set +# CONFIG_SND_ES1938 is not set +# CONFIG_SND_ES1968 is not set +# CONFIG_SND_ES968 is not set +# CONFIG_SND_FM801 is not set +# CONFIG_SND_GINA20 is not set +# CONFIG_SND_GINA24 is not set +# CONFIG_SND_GUSCLASSIC is not set +# CONFIG_SND_GUSEXTREME is not set +# CONFIG_SND_GUSMAX is not set +# CONFIG_SND_HDA_INTEL is not set +# CONFIG_SND_HDSP is not set +# CONFIG_SND_HDSPM is not set +CONFIG_SND_HWDEP=m +# CONFIG_SND_ICE1712 is not set +# CONFIG_SND_ICE1724 is not set +# CONFIG_SND_INDIGO is not set +# CONFIG_SND_INDIGODJ is not set +# CONFIG_SND_INDIGOIO is not set +# CONFIG_SND_INTEL8X0 is not set +# CONFIG_SND_INTEL8X0M is not set +# CONFIG_SND_INTERWAVE is not set +# CONFIG_SND_INTERWAVE_STB is not set +# CONFIG_SND_KORG1212 is not set +# CONFIG_SND_LAYLA20 is not set +# CONFIG_SND_LAYLA24 is not set +# CONFIG_SND_MAESTRO3 is not set +# CONFIG_SND_MIA is not set +# CONFIG_SND_MIRO is not set +# CONFIG_SND_MIXART is not set +CONFIG_SND_MIXER_OSS=m +# CONFIG_SND_MONA is not set +# CONFIG_SND_MPU401 is not set +# CONFIG_SND_MTPAV is not set +# CONFIG_SND_NM256 is not set +# CONFIG_SND_OPL3SA2 is not set +# CONFIG_SND_OPTI92X_AD1848 is not set +# CONFIG_SND_OPTI92X_CS4231 is not set +# CONFIG_SND_OPTI93X is not set +CONFIG_SND_OSSEMUL=y +CONFIG_SND_PCM=m +CONFIG_SND_PCM_OSS=m +CONFIG_SND_PCM_OSS_PLUGINS=y +# CONFIG_SND_PCXHR is not set +# CONFIG_SND_PDAUDIOCF is not set +CONFIG_SND_RAWMIDI=m +# CONFIG_SND_RIPTIDE is not set +# CONFIG_SND_RME32 is not set +# CONFIG_SND_RME96 is not set +# CONFIG_SND_RME9652 is not set +# CONFIG_SND_RTCTIMER is not set +# CONFIG_SND_SB16 is not set +# CONFIG_SND_SB8 is not set +# CONFIG_SND_SBAWE is not set +# CONFIG_SND_SEQUENCER is not set +# CONFIG_SND_SERIAL_U16550 is not set +# CONFIG_SND_SGALAXY is not set +# CONFIG_SND_SOC is not set +# CONFIG_SND_SONICVIBES is not set +# CONFIG_SND_SSCAPE is not set +# CONFIG_SND_SUPPORT_OLD_API is not set +CONFIG_SND_TIMER=m +# CONFIG_SND_TRIDENT is not set +CONFIG_SND_USB_AUDIO=m +# CONFIG_SND_USB_CAIAQ is not set +# CONFIG_SND_USB_USX2Y is not set +# CONFIG_SND_VERBOSE_PRINTK is not set +CONFIG_SND_VERBOSE_PROCFS=y +# CONFIG_SND_VIA82XX is not set +# CONFIG_SND_VIA82XX_MODEM is not set +# CONFIG_SND_VX222 is not set +# CONFIG_SND_VXPOCKET is not set +# CONFIG_SND_WAVEFRONT is not set +# CONFIG_SND_YMFPCI is not set +# CONFIG_SNI_RM is not set +# CONFIG_SOFT_WATCHDOG is not set +# CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_SONYPI is not set +# CONFIG_SOUND is not set +# CONFIG_SOUND_PRIME is not set +# CONFIG_SPARSEMEM_MANUAL is not set +CONFIG_SPARSEMEM_STATIC=y +# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set +# CONFIG_SPI is not set +# CONFIG_SPI_MASTER is not set +CONFIG_SPLIT_PTLOCK_CPUS=4 +CONFIG_SQUASHFS=y +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +# CONFIG_SQUASHFS_VMALLOC is not set +# CONFIG_SSB is not set +CONFIG_SSB_POSSIBLE=y +# CONFIG_SSFDC is not set +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_STANDALONE=y +# CONFIG_STRIP is not set +# CONFIG_SUNDANCE is not set +# CONFIG_SUNGEM is not set +CONFIG_SUNRPC=m +# CONFIG_SUNRPC_BIND34 is not set +CONFIG_SUNRPC_GSS=m +# CONFIG_SUN_PARTITION is not set +CONFIG_SUSPEND=y +CONFIG_SUSPEND_UP_POSSIBLE=y +CONFIG_SWAP=y +# CONFIG_SYNCLINK_CS is not set +CONFIG_SYN_COOKIES=y +CONFIG_SYSCTL=y +CONFIG_SYSCTL_SYSCALL=y +CONFIG_SYSFS=y +# CONFIG_SYSFS_DEPRECATED is not set +# CONFIG_SYSPROF is not set +# CONFIG_SYSV68_PARTITION is not set +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +# CONFIG_SYSV_FS is not set +# CONFIG_SYS_HYPERVISOR is not set +# CONFIG_TASKSTATS is not set +# CONFIG_TCG_TPM is not set +CONFIG_TCP_CONG_ADVANCED=y +CONFIG_TCP_CONG_BIC=m +CONFIG_TCP_CONG_CUBIC=m +CONFIG_TCP_CONG_HSTCP=m +CONFIG_TCP_CONG_HTCP=m +CONFIG_TCP_CONG_HYBLA=m +CONFIG_TCP_CONG_ILLINOIS=m +CONFIG_TCP_CONG_LP=m +CONFIG_TCP_CONG_SCALABLE=m +CONFIG_TCP_CONG_VEGAS=y +CONFIG_TCP_CONG_VENO=m +CONFIG_TCP_CONG_WESTWOOD=m +CONFIG_TCP_CONG_YEAH=m +# CONFIG_TCP_MD5SIG is not set +# CONFIG_TELCLOCK is not set +CONFIG_TEXTSEARCH=y +CONFIG_TEXTSEARCH_BM=m +CONFIG_TEXTSEARCH_FSM=m +CONFIG_TEXTSEARCH_KMP=m +CONFIG_TICK_ONESHOT=y +# CONFIG_TIFM_CORE is not set +# CONFIG_TIGON3 is not set +CONFIG_TIMERFD=y +# CONFIG_TIMER_STATS is not set +# CONFIG_TINY_SHMEM is not set +# CONFIG_TIPC is not set +# CONFIG_TLAN is not set +CONFIG_TMD_HERMES=m +CONFIG_TMPFS=y +# CONFIG_TMPFS_POSIX_ACL is not set +# CONFIG_TOSHIBA is not set +# CONFIG_TR is not set +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +# CONFIG_TUN is not set +# CONFIG_TUNER_3036 is not set +# CONFIG_TUNER_TEA5761 is not set +# CONFIG_TYPHOON is not set +# CONFIG_UDF_FS is not set +CONFIG_UDF_NLS=y +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +# CONFIG_UFS_FS is not set +CONFIG_UID16=y +# CONFIG_UIO is not set +# CONFIG_ULTRIX_PARTITION is not set +CONFIG_UNIX=y +CONFIG_UNIX98_PTYS=y +# CONFIG_UNIXWARE_DISKLABEL is not set +# CONFIG_UNUSED_SYMBOLS is not set +CONFIG_USB=y +# CONFIG_USBPCWATCHDOG is not set +# CONFIG_USB_ACECAD is not set +# CONFIG_USB_ACM is not set +# CONFIG_USB_ADUTUX is not set +# CONFIG_USB_AIPTEK is not set +CONFIG_USB_ALI_M5632=y +CONFIG_USB_AN2720=y +# CONFIG_USB_APPLEDISPLAY is not set +# CONFIG_USB_APPLETOUCH is not set +CONFIG_USB_ARCH_HAS_EHCI=y +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB_ARCH_HAS_OHCI=y +CONFIG_USB_ARMLINUX=y +# CONFIG_USB_ATI_REMOTE is not set +# CONFIG_USB_ATI_REMOTE2 is not set +CONFIG_USB_ATM=m +# CONFIG_USB_AUERSWALD is not set +# CONFIG_USB_BANDWIDTH is not set +CONFIG_USB_BELKIN=y +# CONFIG_USB_BERRY_CHARGE is not set +CONFIG_USB_CATC=m +# CONFIG_USB_CXACRU is not set +# CONFIG_USB_CYPRESS_CY7C63 is not set +# CONFIG_USB_CYTHERM is not set +# CONFIG_USB_DABUSB is not set +# CONFIG_USB_DEBUG is not set +CONFIG_USB_DEVICEFS=y +# CONFIG_USB_DEVICE_CLASS is not set +# CONFIG_USB_DSBR is not set +# CONFIG_USB_DYNAMIC_MINORS is not set +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_ROOT_HUB_TT=y +CONFIG_USB_EHCI_SPLIT_ISO=y +CONFIG_USB_EHCI_TT_NEWSCHED=y +# CONFIG_USB_EMI26 is not set +# CONFIG_USB_EMI62 is not set +# CONFIG_USB_EPSON2888 is not set +# CONFIG_USB_ET61X251 is not set +CONFIG_USB_EZUSB=y +# CONFIG_USB_FTDI_ELAN is not set +# CONFIG_USB_GADGET is not set +# CONFIG_USB_HID is not set +# CONFIG_USB_HIDDEV is not set +CONFIG_USB_HIDINPUT=y +# CONFIG_USB_HIDINPUT_POWERBOOK is not set +# CONFIG_USB_IBMCAM is not set +# CONFIG_USB_IDMOUSE is not set +# CONFIG_USB_IOWARRIOR is not set +# CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_KAWETH is not set +# CONFIG_USB_KBD is not set +# CONFIG_USB_KBTAB is not set +# CONFIG_USB_KC2190 is not set +# CONFIG_USB_KEYSPAN_REMOTE is not set +# CONFIG_USB_KONICAWC is not set +# CONFIG_USB_LCD is not set +# CONFIG_USB_LD is not set +# CONFIG_USB_LED is not set +# CONFIG_USB_LEGOTOWER is not set +# CONFIG_USB_LIBUSUAL is not set +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set +# CONFIG_USB_MON is not set +# CONFIG_USB_MOUSE is not set +CONFIG_USB_NET_AX8817X=m +CONFIG_USB_NET_CDCETHER=m +CONFIG_USB_NET_CDC_SUBSET=m +CONFIG_USB_NET_DM9601=m +CONFIG_USB_NET_GL620A=m +CONFIG_USB_NET_MCS7830=m +CONFIG_USB_NET_NET1080=m +CONFIG_USB_NET_PLUSB=m +CONFIG_USB_NET_RNDIS_HOST=m +CONFIG_USB_NET_ZAURUS=m +# CONFIG_USB_OHCI_BIG_ENDIAN is not set +# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set +# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +# CONFIG_USB_OTG is not set +# CONFIG_USB_OV511 is not set +# CONFIG_USB_PEGASUS is not set +# CONFIG_USB_PERSIST is not set +# CONFIG_USB_PHIDGET is not set +# CONFIG_USB_POWERMATE is not set +# CONFIG_USB_PRINTER is not set +# CONFIG_USB_QUICKCAM_MESSENGER is not set +# CONFIG_USB_R8A66597_HCD is not set +# CONFIG_USB_RIO500 is not set +# CONFIG_USB_RTL8150 is not set +# CONFIG_USB_SE401 is not set +# CONFIG_USB_SERIAL is not set +CONFIG_USB_SERIAL_AIRCABLE=m +CONFIG_USB_SERIAL_AIRPRIME=m +CONFIG_USB_SERIAL_ARK3116=m +CONFIG_USB_SERIAL_BELKIN=m +CONFIG_USB_SERIAL_CP2101=m +CONFIG_USB_SERIAL_CYBERJACK=m +CONFIG_USB_SERIAL_CYPRESS_M8=m +# CONFIG_USB_SERIAL_DEBUG is not set +CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m +CONFIG_USB_SERIAL_EDGEPORT=m +CONFIG_USB_SERIAL_EDGEPORT_TI=m +CONFIG_USB_SERIAL_EMPEG=m +CONFIG_USB_SERIAL_FTDI_SIO=m +CONFIG_USB_SERIAL_FUNSOFT=m +CONFIG_USB_SERIAL_GARMIN=m +CONFIG_USB_SERIAL_GENERIC=y +CONFIG_USB_SERIAL_HP4X=m +CONFIG_USB_SERIAL_IPAQ=m +CONFIG_USB_SERIAL_IPW=m +CONFIG_USB_SERIAL_IR=m +CONFIG_USB_SERIAL_KEYSPAN=m +CONFIG_USB_SERIAL_KEYSPAN_MPR=y +CONFIG_USB_SERIAL_KEYSPAN_PDA=m +CONFIG_USB_SERIAL_KEYSPAN_USA18X=y +CONFIG_USB_SERIAL_KEYSPAN_USA19=y +CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y +CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y +CONFIG_USB_SERIAL_KEYSPAN_USA19W=y +CONFIG_USB_SERIAL_KEYSPAN_USA28=y +CONFIG_USB_SERIAL_KEYSPAN_USA28X=y +CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y +CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y +CONFIG_USB_SERIAL_KEYSPAN_USA49W=y +CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y +CONFIG_USB_SERIAL_KLSI=m +CONFIG_USB_SERIAL_KOBIL_SCT=m +CONFIG_USB_SERIAL_MCT_U232=m +CONFIG_USB_SERIAL_MOS7720=m +CONFIG_USB_SERIAL_MOS7840=m +CONFIG_USB_SERIAL_NAVMAN=m +CONFIG_USB_SERIAL_OMNINET=m +CONFIG_USB_SERIAL_OPTION=m +CONFIG_USB_SERIAL_OTI6858=m +CONFIG_USB_SERIAL_PL2303=m +CONFIG_USB_SERIAL_SAFE=m +CONFIG_USB_SERIAL_SAFE_PADDED=y +CONFIG_USB_SERIAL_SIERRAWIRELESS=m +CONFIG_USB_SERIAL_TI=m +CONFIG_USB_SERIAL_VISOR=m +CONFIG_USB_SERIAL_WHITEHEAT=m +CONFIG_USB_SERIAL_XIRCOM=m +# CONFIG_USB_SISUSBVGA is not set +# CONFIG_USB_SL811_HCD is not set +# CONFIG_USB_SN9C102 is not set +CONFIG_USB_SPEEDTOUCH=m +CONFIG_USB_STORAGE=y +CONFIG_USB_STORAGE_ALAUDA=y +CONFIG_USB_STORAGE_DATAFAB=y +# CONFIG_USB_STORAGE_DEBUG is not set +CONFIG_USB_STORAGE_DPCM=y +CONFIG_USB_STORAGE_FREECOM=y +# CONFIG_USB_STORAGE_ISD200 is not set +CONFIG_USB_STORAGE_JUMPSHOT=y +CONFIG_USB_STORAGE_KARMA=y +# CONFIG_USB_STORAGE_ONETOUCH is not set +CONFIG_USB_STORAGE_SDDR09=y +CONFIG_USB_STORAGE_SDDR55=y +CONFIG_USB_STORAGE_USBAT=y +# CONFIG_USB_STV680 is not set +CONFIG_USB_SUPPORT=y +# CONFIG_USB_SUSPEND is not set +# CONFIG_USB_TEST is not set +# CONFIG_USB_TOUCHSCREEN is not set +# CONFIG_USB_TRANCEVIBRATOR is not set +CONFIG_USB_UEAGLEATM=m +CONFIG_USB_UHCI_HCD=y +# CONFIG_USB_USBNET is not set +CONFIG_USB_USBNET_MII=m +# CONFIG_USB_VICAM is not set +# CONFIG_USB_W9968CF is not set +# CONFIG_USB_WACOM is not set +# CONFIG_USB_XPAD is not set +# CONFIG_USB_XUSBATM is not set +CONFIG_USB_YEALINK=m +# CONFIG_USB_ZC0301 is not set +# CONFIG_USB_ZD1201 is not set +# CONFIG_USB_ZR364XX is not set +# CONFIG_USER_NS is not set +# CONFIG_UTS_NS is not set +# CONFIG_VETH is not set +# CONFIG_VFAT_FS is not set +CONFIG_VGACON_SOFT_SCROLLBACK=y +CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=64 +# CONFIG_VGASTATE is not set +CONFIG_VGA_CONSOLE=y +# CONFIG_VIA_RHINE is not set +# CONFIG_VIA_VELOCITY is not set +# CONFIG_VIDEO_ADV7170 is not set +# CONFIG_VIDEO_ADV7175 is not set +# CONFIG_VIDEO_ADV_DEBUG is not set +# CONFIG_VIDEO_BT819 is not set +# CONFIG_VIDEO_BT848 is not set +# CONFIG_VIDEO_BT856 is not set +# CONFIG_VIDEO_BT866 is not set +# CONFIG_VIDEO_CAFE_CCIC is not set +# CONFIG_VIDEO_CAPTURE_DRIVERS is not set +# CONFIG_VIDEO_CPIA is not set +# CONFIG_VIDEO_CS53L32A is not set +# CONFIG_VIDEO_CX2341X is not set +# CONFIG_VIDEO_CX25840 is not set +# CONFIG_VIDEO_CX88 is not set +# CONFIG_VIDEO_DEV is not set +# CONFIG_VIDEO_DPC is not set +# CONFIG_VIDEO_EM28XX is not set +# CONFIG_VIDEO_HELPER_CHIPS_AUTO is not set +# CONFIG_VIDEO_HEXIUM_GEMINI is not set +# CONFIG_VIDEO_HEXIUM_ORION is not set +# CONFIG_VIDEO_IVTV is not set +# CONFIG_VIDEO_KS0127 is not set +# CONFIG_VIDEO_MSP3400 is not set +# CONFIG_VIDEO_MXB is not set +# CONFIG_VIDEO_OUTPUT_CONTROL is not set +# CONFIG_VIDEO_OV7670 is not set +# CONFIG_VIDEO_OVCAMCHIP is not set +# CONFIG_VIDEO_PMS is not set +# CONFIG_VIDEO_PVRUSB2 is not set +# CONFIG_VIDEO_SAA5246A is not set +# CONFIG_VIDEO_SAA5249 is not set +# CONFIG_VIDEO_SAA7110 is not set +# CONFIG_VIDEO_SAA7111 is not set +# CONFIG_VIDEO_SAA7114 is not set +# CONFIG_VIDEO_SAA711X is not set +# CONFIG_VIDEO_SAA7127 is not set +# CONFIG_VIDEO_SAA7134 is not set +# CONFIG_VIDEO_SAA7185 is not set +# CONFIG_VIDEO_SAA7191 is not set +CONFIG_VIDEO_SELECT=y +# CONFIG_VIDEO_STRADIS is not set +# CONFIG_VIDEO_TDA7432 is not set +# CONFIG_VIDEO_TDA9840 is not set +# CONFIG_VIDEO_TDA9875 is not set +# CONFIG_VIDEO_TEA6415C is not set +# CONFIG_VIDEO_TEA6420 is not set +# CONFIG_VIDEO_TLV320AIC23B is not set +# CONFIG_VIDEO_TVAUDIO is not set +# CONFIG_VIDEO_TVP5150 is not set +# CONFIG_VIDEO_UPD64031A is not set +# CONFIG_VIDEO_UPD64083 is not set +# CONFIG_VIDEO_USBVISION is not set +# CONFIG_VIDEO_V4L1 is not set +CONFIG_VIDEO_V4L1_COMPAT=y +CONFIG_VIDEO_V4L2=y +# CONFIG_VIDEO_VIVI is not set +# CONFIG_VIDEO_VPX3220 is not set +# CONFIG_VIDEO_WM8739 is not set +# CONFIG_VIDEO_WM8775 is not set +# CONFIG_VIDEO_ZORAN is not set +CONFIG_VIRTUALIZATION=y +CONFIG_VIRT_TO_BUS=y +# CONFIG_VITESSE_PHY is not set +CONFIG_VLAN_8021Q=y +CONFIG_VM86=y +# CONFIG_VMSPLIT_1G is not set +# CONFIG_VMSPLIT_2G is not set +# CONFIG_VMSPLIT_2G_OPT is not set +CONFIG_VMSPLIT_3G=y +# CONFIG_VMSPLIT_3G_OPT is not set +CONFIG_VM_EVENT_COUNTERS=y +# CONFIG_VORTEX is not set +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +# CONFIG_VT_HW_CONSOLE_BINDING is not set +# CONFIG_VXFS_FS is not set +# CONFIG_W1 is not set +# CONFIG_W83627HF_WDT is not set +# CONFIG_W83697HF_WDT is not set +# CONFIG_W83877F_WDT is not set +# CONFIG_W83977F_WDT is not set +# CONFIG_WAFER_WDT is not set +# CONFIG_WAN is not set +# CONFIG_WAN_ROUTER is not set +CONFIG_WATCHDOG=y +# CONFIG_WATCHDOG_NOWAYOUT is not set +# CONFIG_WDTPCI is not set +CONFIG_WIRELESS_EXT=y +CONFIG_WLAN_80211=y +# CONFIG_WLAN_PRE80211 is not set +# CONFIG_WR_PPMC is not set +# CONFIG_X25 is not set +CONFIG_X86=y +CONFIG_X86_32=y +# CONFIG_X86_64 is not set +# CONFIG_X86_BIGSMP is not set +CONFIG_X86_BIOS_REBOOT=y +CONFIG_X86_BSWAP=y +CONFIG_X86_CMPXCHG=y +# CONFIG_X86_CPUID is not set +# CONFIG_X86_ELAN is not set +# CONFIG_X86_ES7000 is not set +CONFIG_X86_FIND_SMP_CONFIG=y +CONFIG_X86_GENERIC=y +# CONFIG_X86_GENERICARCH is not set +CONFIG_X86_INTEL_USERCOPY=y +CONFIG_X86_INVLPG=y +CONFIG_X86_IO_APIC=y +CONFIG_X86_L1_CACHE_SHIFT=7 +CONFIG_X86_LOCAL_APIC=y +# CONFIG_X86_MCE is not set +CONFIG_X86_MINIMUM_CPU_FAMILY=4 +CONFIG_X86_MPPARSE=y +# CONFIG_X86_MSR is not set +# CONFIG_X86_NUMAQ is not set +# CONFIG_X86_PAE is not set +CONFIG_X86_PC=y +CONFIG_X86_POPAD_OK=y +# CONFIG_X86_REBOOTFIXUPS is not set +# CONFIG_X86_SUMMIT is not set +CONFIG_X86_TSC=y +CONFIG_X86_UP_APIC=y +CONFIG_X86_UP_IOAPIC=y +CONFIG_X86_USE_3DNOW=y +CONFIG_X86_USE_PPRO_CHECKSUM=y +# CONFIG_X86_VISWS is not set +# CONFIG_X86_VOYAGER is not set +# CONFIG_X86_VSMP is not set +CONFIG_X86_WP_WORKS_OK=y +CONFIG_X86_XADD=y +CONFIG_XFRM=y +# CONFIG_XFRM_MIGRATE is not set +# CONFIG_XFRM_SUB_POLICY is not set +CONFIG_XFRM_USER=m +# CONFIG_XFS_FS is not set +# CONFIG_XFS_POSIX_ACL is not set +# CONFIG_XFS_QUOTA is not set +# CONFIG_XFS_RT is not set +# CONFIG_XFS_SECURITY is not set +# CONFIG_YAFFS_FS is not set +# CONFIG_YAM is not set +# CONFIG_YELLOWFIN is not set +CONFIG_YENTA=m +# CONFIG_YENTA_O2 is not set +# CONFIG_YENTA_RICOH is not set +# CONFIG_YENTA_TI is not set +# CONFIG_YENTA_TOSHIBA is not set +CONFIG_ZD1211RW=m +# CONFIG_ZD1211RW_DEBUG is not set +CONFIG_ZISOFS=y +CONFIG_ZISOFS_FS=m +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y +CONFIG_ZONE_DMA=y +# CONFIG_ZONE_DMA32 is not set +CONFIG_ZONE_DMA_FLAG=1 diff --git a/target/linux/olpc/files/arch/i386/boot/setup.S b/target/linux/olpc/files-2.6.23/arch/i386/boot/setup.S similarity index 100% rename from target/linux/olpc/files/arch/i386/boot/setup.S rename to target/linux/olpc/files-2.6.23/arch/i386/boot/setup.S diff --git a/target/linux/olpc/files/arch/i386/configs/olpc_defconfig b/target/linux/olpc/files-2.6.23/arch/i386/configs/olpc_defconfig similarity index 100% rename from target/linux/olpc/files/arch/i386/configs/olpc_defconfig rename to target/linux/olpc/files-2.6.23/arch/i386/configs/olpc_defconfig diff --git a/target/linux/olpc/files/arch/i386/kernel/mfgpt.c b/target/linux/olpc/files-2.6.23/arch/i386/kernel/mfgpt.c similarity index 100% rename from target/linux/olpc/files/arch/i386/kernel/mfgpt.c rename to target/linux/olpc/files-2.6.23/arch/i386/kernel/mfgpt.c diff --git a/target/linux/olpc/files/arch/i386/kernel/ofw.c b/target/linux/olpc/files-2.6.23/arch/i386/kernel/ofw.c similarity index 100% rename from target/linux/olpc/files/arch/i386/kernel/ofw.c rename to target/linux/olpc/files-2.6.23/arch/i386/kernel/ofw.c diff --git a/target/linux/olpc/files/arch/i386/kernel/olpc-pm.c b/target/linux/olpc/files-2.6.23/arch/i386/kernel/olpc-pm.c similarity index 100% rename from target/linux/olpc/files/arch/i386/kernel/olpc-pm.c rename to target/linux/olpc/files-2.6.23/arch/i386/kernel/olpc-pm.c diff --git a/target/linux/olpc/files/arch/i386/kernel/olpc-sleep.S b/target/linux/olpc/files-2.6.23/arch/i386/kernel/olpc-sleep.S similarity index 100% rename from target/linux/olpc/files/arch/i386/kernel/olpc-sleep.S rename to target/linux/olpc/files-2.6.23/arch/i386/kernel/olpc-sleep.S diff --git a/target/linux/olpc/files/arch/i386/kernel/olpc-wakeup.S b/target/linux/olpc/files-2.6.23/arch/i386/kernel/olpc-wakeup.S similarity index 100% rename from target/linux/olpc/files/arch/i386/kernel/olpc-wakeup.S rename to target/linux/olpc/files-2.6.23/arch/i386/kernel/olpc-wakeup.S diff --git a/target/linux/olpc/files/arch/i386/kernel/olpc.c b/target/linux/olpc/files-2.6.23/arch/i386/kernel/olpc.c similarity index 100% rename from target/linux/olpc/files/arch/i386/kernel/olpc.c rename to target/linux/olpc/files-2.6.23/arch/i386/kernel/olpc.c diff --git a/target/linux/olpc/files/arch/i386/kernel/prom.c b/target/linux/olpc/files-2.6.23/arch/i386/kernel/prom.c similarity index 100% rename from target/linux/olpc/files/arch/i386/kernel/prom.c rename to target/linux/olpc/files-2.6.23/arch/i386/kernel/prom.c diff --git a/target/linux/olpc/files/arch/i386/pci/olpc.c b/target/linux/olpc/files-2.6.23/arch/i386/pci/olpc.c similarity index 100% rename from target/linux/olpc/files/arch/i386/pci/olpc.c rename to target/linux/olpc/files-2.6.23/arch/i386/pci/olpc.c diff --git a/target/linux/olpc/files/drivers/input/mouse/olpc.c b/target/linux/olpc/files-2.6.23/drivers/input/mouse/olpc.c similarity index 100% rename from target/linux/olpc/files/drivers/input/mouse/olpc.c rename to target/linux/olpc/files-2.6.23/drivers/input/mouse/olpc.c diff --git a/target/linux/olpc/files/drivers/input/mouse/olpc.h b/target/linux/olpc/files-2.6.23/drivers/input/mouse/olpc.h similarity index 100% rename from target/linux/olpc/files/drivers/input/mouse/olpc.h rename to target/linux/olpc/files-2.6.23/drivers/input/mouse/olpc.h diff --git a/target/linux/olpc/files/drivers/mtd/mtdcore.h b/target/linux/olpc/files-2.6.23/drivers/mtd/mtdcore.h similarity index 100% rename from target/linux/olpc/files/drivers/mtd/mtdcore.h rename to target/linux/olpc/files-2.6.23/drivers/mtd/mtdcore.h diff --git a/target/linux/olpc/files/drivers/mtd/mtdoops.c b/target/linux/olpc/files-2.6.23/drivers/mtd/mtdoops.c similarity index 100% rename from target/linux/olpc/files/drivers/mtd/mtdoops.c rename to target/linux/olpc/files-2.6.23/drivers/mtd/mtdoops.c diff --git a/target/linux/olpc/files/drivers/mtd/onenand/onenand_sim.c b/target/linux/olpc/files-2.6.23/drivers/mtd/onenand/onenand_sim.c similarity index 100% rename from target/linux/olpc/files/drivers/mtd/onenand/onenand_sim.c rename to target/linux/olpc/files-2.6.23/drivers/mtd/onenand/onenand_sim.c diff --git a/target/linux/olpc/files/drivers/video/geode/geode_regs.h b/target/linux/olpc/files-2.6.23/drivers/video/geode/geode_regs.h similarity index 100% rename from target/linux/olpc/files/drivers/video/geode/geode_regs.h rename to target/linux/olpc/files-2.6.23/drivers/video/geode/geode_regs.h diff --git a/target/linux/olpc/files/drivers/video/geode/suspend_gx.c b/target/linux/olpc/files-2.6.23/drivers/video/geode/suspend_gx.c similarity index 100% rename from target/linux/olpc/files/drivers/video/geode/suspend_gx.c rename to target/linux/olpc/files-2.6.23/drivers/video/geode/suspend_gx.c diff --git a/target/linux/olpc/files/drivers/video/olpc_dcon.c b/target/linux/olpc/files-2.6.23/drivers/video/olpc_dcon.c similarity index 100% rename from target/linux/olpc/files/drivers/video/olpc_dcon.c rename to target/linux/olpc/files-2.6.23/drivers/video/olpc_dcon.c diff --git a/target/linux/olpc/files/drivers/video/olpc_dcon.h b/target/linux/olpc/files-2.6.23/drivers/video/olpc_dcon.h similarity index 100% rename from target/linux/olpc/files/drivers/video/olpc_dcon.h rename to target/linux/olpc/files-2.6.23/drivers/video/olpc_dcon.h diff --git a/target/linux/olpc/files/include/asm-i386/ofw.h b/target/linux/olpc/files-2.6.23/include/asm-i386/ofw.h similarity index 100% rename from target/linux/olpc/files/include/asm-i386/ofw.h rename to target/linux/olpc/files-2.6.23/include/asm-i386/ofw.h diff --git a/target/linux/olpc/files/include/asm-i386/olpc.h b/target/linux/olpc/files-2.6.23/include/asm-i386/olpc.h similarity index 100% rename from target/linux/olpc/files/include/asm-i386/olpc.h rename to target/linux/olpc/files-2.6.23/include/asm-i386/olpc.h diff --git a/target/linux/olpc/files/include/asm-i386/prom.h b/target/linux/olpc/files-2.6.23/include/asm-i386/prom.h similarity index 100% rename from target/linux/olpc/files/include/asm-i386/prom.h rename to target/linux/olpc/files-2.6.23/include/asm-i386/prom.h diff --git a/target/linux/olpc/files/include/linux/battery.h b/target/linux/olpc/files-2.6.23/include/linux/battery.h similarity index 100% rename from target/linux/olpc/files/include/linux/battery.h rename to target/linux/olpc/files-2.6.23/include/linux/battery.h diff --git a/target/linux/olpc/files/sound/pci/cs5535audio/cs5535audio_olpc.c b/target/linux/olpc/files-2.6.23/sound/pci/cs5535audio/cs5535audio_olpc.c similarity index 100% rename from target/linux/olpc/files/sound/pci/cs5535audio/cs5535audio_olpc.c rename to target/linux/olpc/files-2.6.23/sound/pci/cs5535audio/cs5535audio_olpc.c diff --git a/target/linux/olpc/image/Makefile b/target/linux/olpc/image/Makefile index a245d72cf1..23aee45c80 100644 --- a/target/linux/olpc/image/Makefile +++ b/target/linux/olpc/image/Makefile @@ -39,7 +39,7 @@ ifeq ($(CONFIG_OLPC_BOOTSCRIPT_IMAGES),y) endif define Image/Prepare - cp $(LINUX_DIR)/arch/i386/boot/bzImage $(KDIR)/bzImage + cp $(LINUX_DIR)/arch/*86/boot/bzImage $(KDIR)/bzImage $(call Image/Prepare/bootscript) endef diff --git a/target/linux/olpc/image/olpc.fth b/target/linux/olpc/image/olpc.fth index a23cdd4fdf..3d284d2fcd 100644 --- a/target/linux/olpc/image/olpc.fth +++ b/target/linux/olpc/image/olpc.fth @@ -1,4 +1,4 @@ \ Boot script " u:\boot\vmlinuz" to boot-device -" block2mtd.block2mtd=/dev/sda2,65536,rootfs root=/dev/mtdblock1 rootfstype=squashfs init=/etc/preinit rootdelay=5 noinitrd console=tty0 quiet" to boot-file +" block2mtd.block2mtd=/dev/sda2,65536,rootfs root=/dev/mtdblock1 rootfstype=squashfs init=/etc/preinit noinitrd console=tty0" to boot-file boot diff --git a/target/linux/olpc/patches-2.6.24/100-olpc.patch b/target/linux/olpc/patches-2.6.24/100-olpc.patch new file mode 100644 index 0000000000..b694ef4e36 --- /dev/null +++ b/target/linux/olpc/patches-2.6.24/100-olpc.patch @@ -0,0 +1,10201 @@ +diff -purN linux_2.6.24_org/arch/x86/Kconfig linux_2.6.24_olpc/arch/x86/Kconfig +--- linux_2.6.24_org/arch/x86/Kconfig 2008-02-15 20:11:57.000000000 +0000 ++++ linux_2.6.24_olpc/arch/x86/Kconfig 2008-02-15 18:59:21.000000000 +0000 +@@ -1415,6 +1415,9 @@ config PCI_GODIRECT + config PCI_GOANY + bool "Any" + ++config PCI_GOOLPC ++ bool "OLPC" ++ + endchoice + + config PCI_BIOS +@@ -1425,7 +1428,7 @@ config PCI_BIOS + # x86-64 doesn't support PCI BIOS access from long mode so always go direct. + config PCI_DIRECT + bool +- depends on PCI && (X86_64 || (PCI_GODIRECT || PCI_GOANY) || X86_VISWS) ++ depends on PCI && (X86_64 || (PCI_GODIRECT || PCI_GOANY || PCI_GOOLPC) || X86_VISWS) + default y + + config PCI_MMCONFIG +@@ -1442,6 +1445,11 @@ config PCI_MMCONFIG + bool "Support mmconfig PCI config space access" + depends on X86_64 && PCI && ACPI + ++config PCI_OLPC ++ bool ++ depends on PCI && PCI_GOOLPC ++ default y ++ + config DMAR + bool "Support for DMA Remapping Devices (EXPERIMENTAL)" + depends on X86_64 && PCI_MSI && ACPI && EXPERIMENTAL +@@ -1561,6 +1569,21 @@ config K8_NB + def_bool y + depends on AGP_AMD64 || (X86_64 && (GART_IOMMU || (PCI && NUMA))) + ++config OLPC ++ bool "OLPC Support" ++ default n ++ help ++ Add OLPC Support ++ ++config OLPC_PM ++ bool "OLPC power management support" ++ default n ++ depends on OLPC ++ ++config OPEN_FIRMWARE ++ bool "Support for Open Firmware" ++ default y if OLPC ++ + source "drivers/pcmcia/Kconfig" + + source "drivers/pci/hotplug/Kconfig" +diff -purN linux_2.6.24_org/arch/x86/kernel/Makefile_32 linux_2.6.24_olpc/arch/x86/kernel/Makefile_32 +--- linux_2.6.24_org/arch/x86/kernel/Makefile_32 2008-02-15 20:11:58.000000000 +0000 ++++ linux_2.6.24_olpc/arch/x86/kernel/Makefile_32 2008-02-15 18:59:25.000000000 +0000 +@@ -49,6 +49,13 @@ obj-y += pcspeaker.o + + obj-$(CONFIG_SCx200) += scx200_32.o + ++obj-$(CONFIG_OLPC) += olpc.o ++obj-$(CONFIG_OLPC_PM) += olpc-pm.o olpc-wakeup.o ++obj-$(CONFIG_OPEN_FIRMWARE) += ofw.o ++obj-$(PROM_FS) += promfs.o ++ ++ ++ + # vsyscall_32.o contains the vsyscall DSO images as __initdata. + # We must build both images before we can assemble it. + # Note: kbuild does not track this dependency due to usage of .incbin +diff -purN linux_2.6.24_org/arch/x86/kernel/ofw.c linux_2.6.24_olpc/arch/x86/kernel/ofw.c +--- linux_2.6.24_org/arch/x86/kernel/ofw.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/arch/x86/kernel/ofw.c 2008-02-15 18:59:25.000000000 +0000 +@@ -0,0 +1,100 @@ ++/* ++ * ofw.c - Open Firmware client interface for 32-bit systems. ++ * This code is intended to be portable to any 32-bit Open Firmware ++ * implementation with a standard client interface that can be ++ * called when Linux is running. ++ * ++ * Copyright (C) 2007 Mitch Bradley ++ * Copyright (C) 2007 Andres Salomon ++ */ ++ ++#include ++#include ++#include ++#include ++ ++ ++int (*call_firmware)(int *); ++ ++static DEFINE_SPINLOCK(prom_lock); ++ ++#define MAXARGS 20 ++ ++/* ++ * The return value from ofw() in all cases is 0 if the attempt to call the ++ * function succeeded, <0 otherwise. That return value is from the ++ * gateway function only. Any results from the called function are returned ++ * via output argument pointers. ++ * ++ * Here are call templates for all the standard OFW client services: ++ * ++ * ofw("test", 1, 1, namestr, &missing); ++ * ofw("peer", 1, 1, phandle, &sibling_phandle); ++ * ofw("child", 1, 1, phandle, &child_phandle); ++ * ofw("parent", 1, 1, phandle, &parent_phandle); ++ * ofw("instance_to_package", 1, 1, ihandle, &phandle); ++ * ofw("getproplen", 2, 1, phandle, namestr, &proplen); ++ * ofw("getprop", 4, 1, phandle, namestr, bufaddr, buflen, &size); ++ * ofw("nextprop", 3, 1, phandle, previousstr, bufaddr, &flag); ++ * ofw("setprop", 4, 1, phandle, namestr, bufaddr, len, &size); ++ * ofw("canon", 3, 1, devspecstr, bufaddr, buflen, &length); ++ * ofw("finddevice", 1, 1, devspecstr, &phandle); ++ * ofw("instance-to-path", 3, 1, ihandle, bufaddr, buflen, &length); ++ * ofw("package-to-path", 3, 1, phandle, bufaddr, buflen, &length); ++ * ofw("call_method", numin, numout, in0, in1, ..., &out0, &out1, ...); ++ * ofw("open", 1, 1, devspecstr, &ihandle); ++ * ofw("close", 1, 0, ihandle); ++ * ofw("read", 3, 1, ihandle, addr, len, &actual); ++ * ofw("write", 3, 1, ihandle, addr, len, &actual); ++ * ofw("seek", 3, 1, ihandle, pos_hi, pos_lo, &status); ++ * ofw("claim", 3, 1, virtaddr, size, align, &baseaddr); ++ * ofw("release", 2, 0, virtaddr, size); ++ * ofw("boot", 1, 0, bootspecstr); ++ * ofw("enter", 0, 0); ++ * ofw("exit", 0, 0); ++ * ofw("chain", 5, 0, virtaddr, size, entryaddr, argsaddr, len); ++ * ofw("interpret", numin+1, numout+1, cmdstr, in0, ..., &catchres, &out0, ...); ++ * ofw("set-callback", 1, 1, newfuncaddr, &oldfuncaddr); ++ * ofw("set-symbol-lookup", 2, 0, symtovaladdr, valtosymaddr); ++ * ofw("milliseconds", 0, 1, &ms); ++ */ ++ ++int ofw(char *name, int numargs, int numres, ...) ++{ ++ va_list ap; ++ int argarray[MAXARGS+3]; ++ int argnum = 3; ++ int retval; ++ int *intp; ++ unsigned long flags; ++ ++ if (!call_firmware) ++ return -1; ++ if ((numargs + numres) > MAXARGS) ++ return -1; /* spit out an error? */ ++ ++ argarray[0] = (int) name; ++ argarray[1] = numargs; ++ argarray[2] = numres; ++ ++ va_start(ap, numres); ++ while (numargs) { ++ argarray[argnum++] = va_arg(ap, int); ++ numargs--; ++ } ++ ++ spin_lock_irqsave(&prom_lock, flags); ++ retval = call_firmware(argarray); ++ spin_unlock_irqrestore(&prom_lock, flags); ++ ++ if (retval == 0) { ++ while (numres) { ++ intp = va_arg(ap, int *); ++ *intp = argarray[argnum++]; ++ numres--; ++ } ++ } ++ va_end(ap); ++ return retval; ++} ++EXPORT_SYMBOL(ofw); +diff -purN linux_2.6.24_org/arch/x86/kernel/olpc.c linux_2.6.24_olpc/arch/x86/kernel/olpc.c +--- linux_2.6.24_org/arch/x86/kernel/olpc.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/arch/x86/kernel/olpc.c 2008-02-15 18:59:25.000000000 +0000 +@@ -0,0 +1,287 @@ ++/* Support for the OLPC DCON and OLPC EC access ++ * Copyright (C) 2006, Advanced Micro Devices, Inc. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++/* This is our new multi-purpose structure used to contain the ++ * information about the platform that we detect ++ */ ++ ++struct olpc_platform_t olpc_platform_info; ++EXPORT_SYMBOL_GPL(olpc_platform_info); ++ ++/********************************************************************* ++ * EC locking and access ++ *********************************************************************/ ++ ++static DEFINE_SPINLOCK(ec_lock); ++ ++/* what the timeout *should* be (in ms) */ ++#define EC_BASE_TIMEOUT 20 ++ ++/* the timeout that bugs in the EC might force us to actually use */ ++static int ec_timeout = EC_BASE_TIMEOUT; ++ ++static int __init olpc_ec_timeout_set(char *str) ++{ ++ if (get_option(&str, &ec_timeout) != 1) { ++ ec_timeout = EC_BASE_TIMEOUT; ++ printk(KERN_ERR "olpc-ec: invalid argument to " ++ "'olpc_ec_timeout=', ignoring!\n"); ++ } ++ printk(KERN_DEBUG "olpc-ec: using %d ms delay for EC commands.\n", ++ ec_timeout); ++ return 1; ++} ++__setup("olpc_ec_timeout=", olpc_ec_timeout_set); ++ ++/* ++ * These *bf_status functions return whether the buffers are full or not. ++ */ ++ ++static inline unsigned int ibf_status(unsigned int port) ++{ ++ return !!(inb(port) & 0x02); ++} ++ ++static inline unsigned int obf_status(unsigned int port) ++{ ++ return inb(port) & 0x01; ++} ++ ++#define wait_on_ibf(p, d) __wait_on_ibf(__LINE__, (p), (d)) ++static int __wait_on_ibf(unsigned int line, unsigned int port, int desired) ++{ ++ unsigned int timeo; ++ int state = ibf_status(port); ++ ++ for (timeo = ec_timeout; state != desired && timeo; timeo--) { ++ mdelay(1); ++ state = ibf_status(port); ++ } ++ ++ if ((state == desired) && (ec_timeout > EC_BASE_TIMEOUT) && ++ timeo < (ec_timeout - EC_BASE_TIMEOUT)) { ++ printk(KERN_WARNING "olpc-ec: %d: waited %u ms for IBF!\n", ++ line, ec_timeout - timeo); ++ } ++ ++ return !(state == desired); ++} ++ ++#define wait_on_obf(p, d) __wait_on_obf(__LINE__, (p), (d)) ++static int __wait_on_obf(unsigned int line, unsigned int port, int desired) ++{ ++ unsigned int timeo; ++ int state = obf_status(port); ++ ++ for (timeo = ec_timeout; state != desired && timeo; timeo--) { ++ mdelay(1); ++ state = obf_status(port); ++ } ++ ++ if ((state == desired) && (ec_timeout > EC_BASE_TIMEOUT) && ++ timeo < (ec_timeout - EC_BASE_TIMEOUT)) { ++ printk(KERN_WARNING "olpc-ec: %d: waited %u ms for OBF!\n", ++ line, ec_timeout - timeo); ++ } ++ ++ return !(state == desired); ++} ++ ++int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen, ++ unsigned char *outbuf, size_t outlen) ++{ ++ unsigned long flags; ++ int ret = -EIO; ++ int i; ++ ++ spin_lock_irqsave(&ec_lock, flags); ++ ++ /* Clear OBF */ ++ for (i = 0; i < 10 && (obf_status(0x6c) == 1); i++) ++ inb(0x68); ++ if (i == 10) { ++ printk(KERN_ERR "olpc-ec: timeout while attempting to " ++ "clear OBF flag!\n"); ++ goto err; ++ } ++ ++ if (wait_on_ibf(0x6c, 0)) { ++ printk(KERN_ERR "olpc-ec: timeout waiting for EC to " ++ "quiesce!\n"); ++ goto err; ++ } ++ ++restart: ++ /* ++ * Note that if we time out during any IBF checks, that's a failure; ++ * we have to return. There's no way for the kernel to clear that. ++ * ++ * If we time out during an OBF check, we can restart the command; ++ * reissuing it will clear the OBF flag, and we should be alright. ++ * The OBF flag will sometimes misbehave due to what we believe ++ * is a hardware quirk.. ++ */ ++ printk(KERN_DEBUG "olpc-ec: running cmd 0x%x\n", cmd); ++ outb(cmd, 0x6c); ++ ++ if (wait_on_ibf(0x6c, 0)) { ++ printk(KERN_ERR "olpc-ec: timeout waiting for EC to read " ++ "command!\n"); ++ goto err; ++ } ++ ++ if (inbuf && inlen) { ++ /* write data to EC */ ++ for (i = 0; i < inlen; i++) { ++ if (wait_on_ibf(0x6c, 0)) { ++ printk(KERN_ERR "olpc-ec: timeout waiting for" ++ " EC accept data!\n"); ++ goto err; ++ } ++ printk(KERN_DEBUG "olpc-ec: sending cmd arg 0x%x\n", ++ inbuf[i]); ++ outb(inbuf[i], 0x68); ++ } ++ } ++ if (outbuf && outlen) { ++ /* read data from EC */ ++ for (i = 0; i < outlen; i++) { ++ if (wait_on_obf(0x6c, 1)) { ++ printk(KERN_ERR "olpc-ec: timeout waiting for" ++ " EC to provide data!\n"); ++ goto restart; ++ } ++ outbuf[i] = inb(0x68); ++ printk(KERN_DEBUG "olpc-ec: received 0x%x\n", ++ outbuf[i]); ++ } ++ } ++ ++ ret = 0; ++err: ++ spin_unlock_irqrestore(&ec_lock, flags); ++ return ret; ++} ++EXPORT_SYMBOL_GPL(olpc_ec_cmd); ++ ++/********************************************************************* ++ * DCON stuff ++ *********************************************************************/ ++ ++static void __init ++ec_detect(void) ++{ ++ olpc_ec_cmd(0x08, NULL, 0, (unsigned char *) &olpc_platform_info.ecver, 1); ++} ++ ++/* Check to see if this version of the OLPC board has VSA built ++ * in, and set a flag ++ */ ++ ++static void __init vsa_detect(void) ++{ ++ u16 rev; ++ ++ outw(0xFC53, 0xAC1C); ++ outw(0x0003, 0xAC1C); ++ ++ rev = inw(0xAC1E); ++ ++ if (rev == 0x4132) ++ olpc_platform_info.flags |= OLPC_F_VSA; ++} ++ ++static void __init platform_detect(void) ++{ ++ size_t propsize; ++ u32 rev; ++ ++ if (ofw("getprop", 4, 1, NULL, "board-revision-int", &rev, 4, ++ &propsize) || propsize != 4) { ++ printk(KERN_ERR "ofw: getprop call failed!\n"); ++ rev = 0; ++ } ++ olpc_platform_info.boardrev = be32_to_cpu(rev); ++} ++ ++static int olpc_dcon_present = -1; ++module_param(olpc_dcon_present, int, 0444); ++ ++/* REV_A CMOS map: ++ * bit 440; DCON present bit ++ */ ++ ++#define OLPC_CMOS_DCON_OFFSET (440 / 8) ++#define OLPC_CMOS_DCON_MASK 0x01 ++ ++static int __init olpc_init(void) ++{ ++ unsigned char *romsig; ++ ++ spin_lock_init(&ec_lock); ++ ++ romsig = ioremap(0xffffffc0, 16); ++ ++ if (!romsig) ++ return 0; ++ ++ if (strncmp(romsig, "CL1 Q", 7)) ++ goto unmap; ++ if (strncmp(romsig+6, romsig+13, 3)) { ++ printk(KERN_INFO "OLPC BIOS signature looks invalid. Assuming not OLPC\n"); ++ goto unmap; ++ } ++ printk(KERN_INFO "OLPC board with OpenFirmware: %.16s\n", romsig); ++ ++ olpc_platform_info.flags |= OLPC_F_PRESENT; ++ ++ /* Get the platform revision */ ++ platform_detect(); ++ ++ /* If olpc_dcon_present isn't set by the command line, then ++ * "detect" it ++ */ ++ ++ if (olpc_dcon_present == -1) { ++ /* B1 and greater always has a DCON */ ++ if (olpc_board_at_least(olpc_board(0xb1))) ++ olpc_dcon_present = 1; ++ } ++ ++ if (olpc_dcon_present) ++ olpc_platform_info.flags |= OLPC_F_DCON; ++ ++ /* Get the EC revision */ ++ ec_detect(); ++ ++ /* Check to see if the VSA exists */ ++ vsa_detect(); ++ ++ printk(KERN_INFO "OLPC board revision: %s%X (EC=%x)\n", ++ ((olpc_platform_info.boardrev & 0xf) < 8) ? "pre" : "", ++ olpc_platform_info.boardrev >> 4, ++ olpc_platform_info.ecver); ++ ++ unmap: ++ iounmap(romsig); ++ ++ return 0; ++} ++ ++postcore_initcall(olpc_init); +diff -purN linux_2.6.24_org/arch/x86/kernel/olpc-pm.c linux_2.6.24_olpc/arch/x86/kernel/olpc-pm.c +--- linux_2.6.24_org/arch/x86/kernel/olpc-pm.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/arch/x86/kernel/olpc-pm.c 2008-02-15 18:59:26.000000000 +0000 +@@ -0,0 +1,946 @@ ++/* olpc-pm.c ++ * © 2006 Red Hat, Inc. ++ * Portions also copyright 2006 Advanced Micro Devices, Inc. ++ * GPLv2 ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++/* A few words about accessing the ACPI and PM registers. Long story short, ++ byte and word accesses of the ACPI and PM registers is broken. The only ++ way to do it really correctly is to use dword accesses, which we do ++ throughout this code. For more details, please consult Eratta 17 and 18 ++ here: ++ ++ http://www.amd.com/files/connectivitysolutions/geode/geode_gx/34472D_CS5536_B1_specupdate.pdf ++*/ ++ ++#define PM_IRQ 3 ++ ++#define CS5536_PM_PWRBTN (1 << 8) ++#define CS5536_PM_RTC (1 << 10) ++#define CS5536_PM_WAK (1 << 15) ++ ++#define GPIO_WAKEUP_EC (1 << 31) ++#define GPIO_WAKEUP_LID (1 << 30) ++ ++#define PM_MODE_NORMAL 0 ++#define PM_MODE_TEST 1 ++#define PM_MODE_MAX 2 ++ ++/* These, and the battery EC commands, should be in an olpc.h. */ ++#define EC_WRITE_SCI_MASK 0x1b ++#define EC_READ_SCI_MASK 0x1c ++ ++extern void do_olpc_suspend_lowlevel(void); ++ ++static struct { ++ unsigned long address; ++ unsigned short segment; ++} ofw_bios_entry = { 0, __KERNEL_CS }; ++ ++static int olpc_pm_mode = PM_MODE_NORMAL; ++static unsigned long acpi_base; ++static unsigned long pms_base; ++static int sci_irq; ++static int olpc_lid_flag; ++ ++static struct input_dev *pm_inputdev; ++static struct input_dev *lid_inputdev; ++static struct input_dev *ebook_inputdev; ++static struct platform_suspend_ops olpc_pm_ops; ++ ++static int gpio_wake_events = 0; ++static int ebook_state = -1; ++static u16 olpc_wakeup_mask = 0; ++ ++static unsigned int test_timeout = 0; ++static char *wackup_source = "none"; ++ ++struct platform_device olpc_powerbutton_dev = { ++ .name = "powerbutton", ++ .id = -1, ++}; ++ ++struct platform_device olpc_lid_dev = { ++ .name = "lid", ++ .id = -1, ++}; ++ ++static void __init init_ebook_state(void) ++{ ++ if (olpc_ec_cmd(0x2a, NULL, 0, (unsigned char *) &ebook_state, 1)) { ++ printk(KERN_WARNING "olpc-pm: failed to get EBOOK state!\n"); ++ ebook_state = 0; ++ } ++ ebook_state &= 1; ++ ++ /* the input layer needs to know what value to default to as well */ ++ input_report_switch(ebook_inputdev, SW_TABLET_MODE, ebook_state); ++ input_sync(ebook_inputdev); ++} ++ ++static void (*battery_callback)(unsigned long); ++static DEFINE_SPINLOCK(battery_callback_lock); ++ ++/* propagate_events is non-NULL if run from workqueue, ++ NULL when called at init time to flush SCI queue */ ++static void process_sci_queue(struct work_struct *propagate_events) ++{ ++ unsigned char data = 0; ++ unsigned char battery_events = 0; ++ int ret; ++ ++ do { ++ ret = olpc_ec_cmd(0x84, NULL, 0, &data, 1); ++ if (!ret) { ++ printk(KERN_DEBUG "olpc-pm: SCI 0x%x received\n", ++ data); ++ ++ if (wackup_source && !strcmp(wackup_source, "sci")) { ++ /* ++ * XXX: in order for this to not be racy, we ++ * need assurance that we will never get ++ * preempted by olpc_do_sleep here! ++ */ ++ switch (data) { ++ case EC_SCI_SRC_EMPTY: ++ wackup_source = "empty sci"; ++ break; ++ case EC_SCI_SRC_GAME: ++ wackup_source = "key press"; ++ break; ++ case EC_SCI_SRC_BATTERY: ++ wackup_source = "battery"; ++ break; ++ case EC_SCI_SRC_BATSOC: ++ wackup_source = "battery state change"; ++ break; ++ case EC_SCI_SRC_BATERR: ++ wackup_source = "battery error"; ++ break; ++ case EC_SCI_SRC_EBOOK: ++ wackup_source = "ebook"; ++ break; ++ case EC_SCI_SRC_WLAN: ++ wackup_source = "wlan packet"; ++ break; ++ case EC_SCI_SRC_ACPWR: ++ wackup_source = "ac power"; ++ break; ++ default: ++ wackup_source = "unknown"; ++ } ++ } ++ ++ if (data & (EC_SCI_SRC_BATERR | EC_SCI_SRC_BATSOC | ++ EC_SCI_SRC_BATTERY | EC_SCI_SRC_ACPWR)) ++ battery_events |= data; ++ else if (data == EC_SCI_SRC_EBOOK) { ++ ebook_state = !ebook_state; ++ if (propagate_events) { ++ input_report_switch(ebook_inputdev, ++ SW_TABLET_MODE, ebook_state); ++ input_sync(ebook_inputdev); ++ } ++ } ++ } ++ } while (data && !ret); ++ ++ if (battery_events && battery_callback && propagate_events) { ++ void (*cbk)(unsigned long); ++ ++ /* Older EC versions didn't distinguish between AC and battery ++ events */ ++ if (olpc_platform_info.ecver < 0x51) ++ battery_events = EC_SCI_SRC_BATTERY | EC_SCI_SRC_ACPWR; ++ ++ spin_lock(&battery_callback_lock); ++ cbk = battery_callback; ++ spin_unlock(&battery_callback_lock); ++ ++ cbk(battery_events); ++ } ++ ++ if (ret) ++ printk(KERN_WARNING "Failed to clear SCI queue!\n"); ++} ++ ++static DECLARE_WORK(sci_work, process_sci_queue); ++ ++void olpc_register_battery_callback(void (*f)(unsigned long)) ++{ ++ spin_lock(&battery_callback_lock); ++ battery_callback = f; ++ spin_unlock(&battery_callback_lock); ++} ++EXPORT_SYMBOL_GPL(olpc_register_battery_callback); ++ ++void olpc_deregister_battery_callback(void) ++{ ++ spin_lock(&battery_callback_lock); ++ battery_callback = NULL; ++ spin_unlock(&battery_callback_lock); ++ cancel_work_sync(&sci_work); ++} ++EXPORT_SYMBOL_GPL(olpc_deregister_battery_callback); ++ ++ ++static int olpc_pm_interrupt(int irq, void *id) ++{ ++ uint32_t sts, gpe = 0; ++ ++ sts = inl(acpi_base + PM1_STS); ++ outl(sts | 0xFFFF, acpi_base + PM1_STS); ++ ++ if (olpc_board_at_least(olpc_board(0xb2))) { ++ gpe = inl(acpi_base + PM_GPE0_STS); ++ outl(0xFFFFFFFF, acpi_base + PM_GPE0_STS); ++ } ++ ++ if (sts & CS5536_PM_PWRBTN) { ++ if (!wackup_source) ++ wackup_source = "power button"; ++ printk(KERN_DEBUG "olpm-pm: PM_PWRBTN %sevent received\n", ++ sts & CS5536_PM_WAK ? "wakeup " : ""); ++ if (!(sts & CS5536_PM_WAK)) { ++ input_report_key(pm_inputdev, KEY_POWER, 1); ++ input_sync(pm_inputdev); ++ /* Do we need to delay this? */ ++ input_report_key(pm_inputdev, KEY_POWER, 0); ++ input_sync(pm_inputdev); ++ } ++ } ++ ++ if (gpe & GPIO_WAKEUP_EC) { ++ geode_gpio_clear(OLPC_GPIO_ECSCI, GPIO_NEGATIVE_EDGE_STS); ++ if (!wackup_source) ++ wackup_source = "sci"; ++ schedule_work(&sci_work); ++ } ++ ++ if (gpe & GPIO_WAKEUP_LID) { ++ /* Disable events */ ++ geode_gpio_clear(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE); ++ ++ /* Clear the edge */ ++ ++ if (olpc_lid_flag) ++ geode_gpio_clear(OLPC_GPIO_LID, GPIO_NEGATIVE_EDGE_EN); ++ else ++ geode_gpio_clear(OLPC_GPIO_LID, GPIO_POSITIVE_EDGE_EN); ++ ++ /* Clear the status too */ ++ geode_gpio_set(OLPC_GPIO_LID, GPIO_NEGATIVE_EDGE_STS); ++ geode_gpio_set(OLPC_GPIO_LID, GPIO_POSITIVE_EDGE_STS); ++ ++ /* The line is high when the LID is open, but SW_LID ++ * should be high when the LID is closed, so we pass the old ++ * value of olpc_lid_flag ++ */ ++ ++ input_report_switch(lid_inputdev, SW_LID, olpc_lid_flag); ++ input_sync(lid_inputdev); ++ if (!wackup_source) ++ wackup_source = "lid"; ++ ++ /* Swap the status */ ++ olpc_lid_flag = !olpc_lid_flag; ++ ++ if (olpc_lid_flag) ++ geode_gpio_set(OLPC_GPIO_LID, GPIO_NEGATIVE_EDGE_EN); ++ else ++ geode_gpio_set(OLPC_GPIO_LID, GPIO_POSITIVE_EDGE_EN); ++ ++ /* re-enable the event */ ++ geode_gpio_set(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE); ++ } ++ ++ return IRQ_HANDLED; ++} ++ ++int olpc_ec_mask_set(u8 bits) ++{ ++ int ret; ++ u8 byte; ++ ++ ret = olpc_ec_cmd(EC_READ_SCI_MASK, NULL, 0, &byte, 1); ++ if (ret) { ++ printk(KERN_ERR "olpc-pm: error getting SCI mask: %d\n", ret); ++ return ret; ++ } ++ /* the high bit is unused, if it is ever unset, that is a good sign ++ sign of EC communication corruption! */ ++ WARN_ON(!(byte & 0x80)); ++ ++ byte |= bits; ++ ret = olpc_ec_cmd(EC_WRITE_SCI_MASK, &byte, 1, NULL, 0); ++ if (ret) ++ printk(KERN_ERR "olpc-pm: error setting SCI mask: %d\n", ret); ++ ++ return ret; ++} ++EXPORT_SYMBOL_GPL(olpc_ec_mask_set); ++ ++int olpc_ec_mask_unset(u8 bits) ++{ ++ int ret; ++ u8 byte; ++ ++ ret = olpc_ec_cmd(EC_READ_SCI_MASK, NULL, 0, &byte, 1); ++ if (ret) { ++ printk(KERN_ERR "olpc-pm: error getting SCI mask: %d\n", ret); ++ return ret; ++ } ++ /* the high bit is unused, if it is ever unset, that is a good sign ++ sign of EC communication corruption! */ ++ WARN_ON(!(byte & 0x80)); ++ ++ byte &= ~bits; ++ ret = olpc_ec_cmd(EC_WRITE_SCI_MASK, &byte, 1, NULL, 0); ++ if (ret) ++ printk(KERN_ERR "olpc-pm: error setting SCI mask: %d\n", ret); ++ ++ return ret; ++} ++EXPORT_SYMBOL_GPL(olpc_ec_mask_unset); ++ ++/* ++ * For now, only support STR. We also don't support suspending on ++ * B1s, due to difficulties with the cafe FPGA. ++ */ ++static int olpc_pm_state_valid(suspend_state_t pm_state) ++{ ++ if (pm_state == PM_SUSPEND_MEM && olpc_board_at_least(olpc_board(0xb2))) ++ return 1; ++ ++ return 0; ++} ++ ++/* This is a catchall function for operations that just don't belong ++ * anywhere else. Later we will evaluate if these belong in the ++ * individual device drivers or the firmware. ++ * If you add something to this function, please explain yourself with ++ * a comment. ++ */ ++ ++extern void gxfb_flatpanel_control(int state); ++ ++static u32 gpio_wakeup[2]; ++static u64 irq_sources[4]; ++static u64 mfgpt_irq_msr, mfgpt_nr_msr; ++ ++void olpc_fixup_wakeup(void) ++{ ++ u32 base = geode_gpio_base(); ++ int i; ++ ++ /* Enable the flatpanel sequencing as early as possible, because ++ it takes ~64ms to resume. This probably belongs in the firmware */ ++ ++ //gxfb_flatpanel_control(1); ++ ++ /* Tell the EC to stop inhibiting SCIs */ ++ olpc_ec_cmd(0x34, NULL, 0, NULL, 0); ++ ++ /* Restore the interrupt sources */ ++ wrmsrl(MSR_PIC_YSEL_LOW, irq_sources[0]); ++ wrmsrl(MSR_PIC_ZSEL_LOW, irq_sources[1]); ++ wrmsrl(MSR_PIC_YSEL_HIGH, irq_sources[2]); ++ wrmsrl(MSR_PIC_ZSEL_HIGH, irq_sources[3]); ++ ++ /* Restore the X and Y sources for GPIO */ ++ outl(gpio_wakeup[0], base + GPIO_MAP_X); ++ outl(gpio_wakeup[1], base + GPIO_MAP_Y); ++ ++ /* Resture the MFGPT MSRs */ ++ wrmsrl(MFGPT_IRQ_MSR, mfgpt_irq_msr); ++ wrmsrl(MFGPT_NR_MSR, mfgpt_nr_msr); ++ ++ for (i=0;i<2;i++) { ++ /* tell the wireless module to restart USB communication */ ++ olpc_ec_cmd(0x24, NULL, 0, NULL, 0); ++ } ++ ++ /* Turn all events on */ ++ olpc_ec_mask_set(EC_SCI_SRC_ALL); ++} ++ ++void olpc_fixup_sleep(void) ++{ ++ u32 base = geode_gpio_base(); ++ int i; ++ ++ /* Save the X and Y sources for GPIO */ ++ gpio_wakeup[0] = inl(base + GPIO_MAP_X); ++ gpio_wakeup[1] = inl(base + GPIO_MAP_Y); ++ ++ /* Save the Y and Z unrestricted sources */ ++ ++ rdmsrl(MSR_PIC_YSEL_LOW, irq_sources[0]); ++ rdmsrl(MSR_PIC_ZSEL_LOW, irq_sources[1]); ++ rdmsrl(MSR_PIC_YSEL_HIGH, irq_sources[2]); ++ rdmsrl(MSR_PIC_ZSEL_HIGH, irq_sources[3]); ++ ++ /* Turn off the MFGPT timers on the way down */ ++ ++ for(i = 0; i < 8; i++) { ++ u32 val = geode_mfgpt_read(i, MFGPT_REG_SETUP); ++ ++ if (val & MFGPT_SETUP_SETUP) { ++ val &= ~MFGPT_SETUP_CNTEN; ++ geode_mfgpt_write(i, MFGPT_REG_SETUP, val); ++ } ++ } ++ ++ /* Save the MFGPT MSRs */ ++ rdmsrl(MFGPT_IRQ_MSR, mfgpt_irq_msr); ++ rdmsrl(MFGPT_NR_MSR, mfgpt_nr_msr); ++ ++ if (device_may_wakeup(&olpc_powerbutton_dev.dev)) ++ olpc_wakeup_mask |= CS5536_PM_PWRBTN; ++ else ++ olpc_wakeup_mask &= ~(CS5536_PM_PWRBTN); ++ ++ if (device_may_wakeup(&olpc_lid_dev.dev)) { ++ geode_gpio_set(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE); ++ gpio_wake_events |= GPIO_WAKEUP_LID; ++ } else { ++ geode_gpio_clear(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE); ++ gpio_wake_events &= ~(GPIO_WAKEUP_LID); ++ } ++ ++ /* We don't want to wake up on superfluous events */ ++ olpc_ec_mask_unset(EC_SCI_SRC_BATSOC | EC_SCI_SRC_ACPWR); ++ ++ /* ++ * Cmd 0x32 tells the EC that we're going into suspend; this was ++ * added to work around hardware races related to SCI events. This ++ * should cause the EC to inhibit further SCIs while MAIN_ON is ++ * transitioning low. ++ * ++ * There's also some sort of EC race whereby the EC gets its ++ * IBF/OBF flags confused and all future communication (after ++ * resuming) fails if we suspend too soon after updating ++ * the EC SCI mask. Having this command after updating the ++ * SCI mask allows the EC enough time to finish doing what it's ++ * doing. ++ */ ++ olpc_ec_cmd(0x32, NULL, 0, NULL, 0); ++} ++ ++static int olpc_pm_enter(suspend_state_t pm_state) ++{ ++ /* Only STR is supported */ ++ if (pm_state != PM_SUSPEND_MEM) ++ return -EINVAL; ++ ++ olpc_fixup_sleep(); ++ ++ /* Set the GPIO wakeup bits */ ++ outl(gpio_wake_events, acpi_base + PM_GPE0_EN); ++ outl(0xFFFFFFFF, acpi_base + PM_GPE0_STS); ++ ++ /* Save CPU state */ ++ do_olpc_suspend_lowlevel(); ++ ++ olpc_fixup_wakeup(); ++ ++ /* Restore the SCI wakeup events */ ++ outl(gpio_wake_events, acpi_base + PM_GPE0_EN); ++ ++ return 0; ++} ++ ++int asmlinkage olpc_do_sleep(u8 sleep_state) ++{ ++ void *pgd_addr = __va(read_cr3()); ++ printk(KERN_ERR "olpc_do_sleep!\n"); /* this needs to remain here so ++ * that gcc doesn't optimize ++ * away our __va! */ ++ /* FIXME: Set the SCI bits we want to wake up on here */ ++ ++ /* FIXME: Set any other SCI events that we might want here */ ++ ++ outl((olpc_wakeup_mask << 16) | 0xFFFF, acpi_base + PM1_STS); ++ ++ wackup_source = NULL; ++ ++ /* If we are in test mode, then just return (simulate a successful ++ suspend/resume). Otherwise, if we are doing the real thing, ++ then go for the gusto */ ++ ++ if (olpc_pm_mode != PM_MODE_TEST) { ++ __asm__ __volatile__("movl %0,%%eax" : : "r" (pgd_addr)); ++ __asm__("call *(%%edi); cld" ++ : : "D" (&ofw_bios_entry)); ++ __asm__ __volatile__("movb $0x34, %al\n\t" ++ "outb %al, $0x70\n\t" ++ "movb $0x30, %al\n\t" ++ "outb %al, $0x71\n\t"); ++ ++ } ++ else if (test_timeout > 0) { ++ int t; ++ ++ /* Delay N seconds for testing purposes */ ++ ++ for(t = 0; t < test_timeout; t++) ++ mdelay(1000); ++ } ++ ++ return 0; ++} ++ ++static void olpc_power_off(void) ++{ ++ printk(KERN_INFO "OLPC power off sequence...\n"); ++ ++ /* Enable all of these controls with 0 delay */ ++ outl(0x40000000, pms_base + PM_SCLK); ++ outl(0x40000000, pms_base + PM_IN_SLPCTL); ++ outl(0x40000000, pms_base + PM_WKXD); ++ outl(0x40000000, pms_base + PM_WKD); ++ ++ /* Clear status bits (possibly unnecessary) */ ++ outl(0x0002ffff, pms_base + PM_SSC); ++ outl(0xffffffff, acpi_base + PM_GPE0_STS); ++ ++ /* Write SLP_EN bit to start the machinery */ ++ outl(0x00002000, acpi_base + PM1_CNT); ++} ++ ++/* This code will slowly disappear as we fixup the issues in the BIOS */ ++ ++static void __init olpc_fixup_bios(void) ++{ ++ unsigned long hi, lo; ++ ++ if (olpc_has_vsa()) { ++ /* The VSA aggressively sets up the ACPI and PM register for ++ * trapping - its not enough to force these values in the BIOS - ++ * they seem to be changed during PCI init as well. ++ */ ++ ++ /* Change the PM registers to decode to the DD */ ++ ++ rdmsr(0x510100e2, lo, hi); ++ hi |= 0x80000000; ++ wrmsr(0x510100e2, lo, hi); ++ ++ /* Change the ACPI registers to decode to the DD */ ++ ++ rdmsr(0x510100e3, lo, hi); ++ hi |= 0x80000000; ++ wrmsr(0x510100e3, lo, hi); ++ } ++ ++ /* GPIO24 controls WORK_AUX */ ++ ++ geode_gpio_set(OLPC_GPIO_WORKAUX, GPIO_OUTPUT_ENABLE); ++ geode_gpio_set(OLPC_GPIO_WORKAUX, GPIO_OUTPUT_AUX1); ++ ++ if (olpc_board_at_least(olpc_board(0xb2))) { ++ /* GPIO10 is connected to the thermal alarm */ ++ geode_gpio_set(OLPC_GPIO_THRM_ALRM, GPIO_INPUT_ENABLE); ++ geode_gpio_set(OLPC_GPIO_THRM_ALRM, GPIO_INPUT_AUX1); ++ ++ /* Set up to get LID events */ ++ geode_gpio_set(OLPC_GPIO_LID, GPIO_INPUT_ENABLE); ++ ++ /* Clear edge detection and event enable for now */ ++ geode_gpio_clear(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE); ++ geode_gpio_clear(OLPC_GPIO_LID, GPIO_NEGATIVE_EDGE_EN); ++ geode_gpio_clear(OLPC_GPIO_LID, GPIO_POSITIVE_EDGE_EN); ++ ++ geode_gpio_set(OLPC_GPIO_LID, GPIO_NEGATIVE_EDGE_STS); ++ geode_gpio_set(OLPC_GPIO_LID, GPIO_POSITIVE_EDGE_STS); ++ ++ /* Set the LID to cause an PME event on group 6 */ ++ geode_gpio_event_pme(OLPC_GPIO_LID, 6); ++ ++ /* Set PME group 6 to fire the SCI interrupt */ ++ geode_gpio_set_irq(6, sci_irq); ++ } ++ ++ geode_gpio_set(OLPC_GPIO_ECSCI, GPIO_INPUT_ENABLE); ++ ++ /* Clear pending events */ ++ ++ geode_gpio_set(OLPC_GPIO_ECSCI, GPIO_NEGATIVE_EDGE_STS); ++ geode_gpio_set(OLPC_GPIO_ECSCI, GPIO_POSITIVE_EDGE_STS); ++ ++ //geode_gpio_set(OLPC_GPIO_ECSCI, GPIO_NEGATIVE_EDGE_EN); ++ geode_gpio_set(OLPC_GPIO_ECSCI, GPIO_EVENTS_ENABLE); ++ ++ /* Set the SCI to cause a PME event on group 7 */ ++ geode_gpio_event_pme(OLPC_GPIO_ECSCI, 7); ++ ++ /* And have group 6 also fire the SCI interrupt */ ++ geode_gpio_set_irq(7, sci_irq); ++} ++ ++/* This provides a control file for setting up testing of the ++ power management system. For now, there is just one setting: ++ "test" which means that we don't actually enter the power ++ off routine. ++*/ ++ ++static const char * const pm_states[] = { ++ [PM_MODE_NORMAL] = "normal", ++ [PM_MODE_TEST] = "test", ++}; ++ ++extern struct mutex pm_mutex; ++extern struct kset power_subsys; ++ ++static ssize_t control_show(struct kset *s, char *buf) ++{ ++ return sprintf(buf, "%s\n", pm_states[olpc_pm_mode]); ++} ++ ++static ssize_t control_store(struct kset *s, const char *buf, size_t n) ++{ ++ int i, len; ++ char *p; ++ ++ p = memchr(buf, '\n', n); ++ len = p ? p - buf : n; ++ ++ /* Grab the mutex */ ++ mutex_lock(&pm_mutex); ++ ++ for(i = 0; i < PM_MODE_MAX; i++) { ++ if (!strncmp(buf, pm_states[i], len)) { ++ olpc_pm_mode = i; ++ break; ++ } ++ } ++ ++ mutex_unlock(&pm_mutex); ++ ++ return (i == PM_MODE_MAX) ? -EINVAL : n; ++} ++ ++static ssize_t timeout_show(struct kset *s, char *buf) ++{ ++ return sprintf(buf, "%d\n", test_timeout); ++} ++ ++static ssize_t timeout_store(struct kset *s, const char *buf, size_t n) ++{ ++ unsigned int t = simple_strtoul(buf, NULL, 0); ++ test_timeout = t; ++ ++ return n; ++} ++ ++static ssize_t wackup_show(struct kset *s, char *buf) ++{ ++ return sprintf(buf, "%s\n", wackup_source ? wackup_source : "none"); ++} ++ ++static struct subsys_attribute control_attr = { ++ .attr = { ++ .name = "olpc-pm", ++ .mode = 0644, ++ }, ++ .show = control_show, ++ .store = control_store, ++}; ++ ++static struct subsys_attribute test_attr = { ++ .attr = { ++ .name = "test-timeout", ++ .mode = 0644, ++ }, ++ .show = timeout_show, ++ .store = timeout_store, ++}; ++ ++static struct subsys_attribute wackup_attr = { ++ .attr = { ++ .name = "wakeup-source", ++ .mode = 0400, ++ }, ++ .show = wackup_show, ++}; ++ ++static struct attribute * olpc_attributes[] = { ++ &control_attr.attr, ++ &test_attr.attr, ++ &wackup_attr.attr, ++ NULL ++}; ++ ++static struct attribute_group olpc_attrs = { ++ .attrs = olpc_attributes, ++}; ++ ++static int __init alloc_inputdevs(void) ++{ ++ int ret = -ENOMEM; ++ ++ pm_inputdev = input_allocate_device(); ++ if (!pm_inputdev) ++ goto err; ++ ++ pm_inputdev->name = "OLPC PM"; ++ pm_inputdev->phys = "olpc_pm/input0"; ++ set_bit(EV_KEY, pm_inputdev->evbit); ++ set_bit(KEY_POWER, pm_inputdev->keybit); ++ ++ ret = input_register_device(pm_inputdev); ++ if (ret) { ++ printk(KERN_ERR "olpc-pm: failed to register PM input device: %d\n", ret); ++ goto err; ++ } ++ ++ lid_inputdev = input_allocate_device(); ++ if (!lid_inputdev) ++ goto err; ++ ++ lid_inputdev->name = "OLPC lid switch"; ++ lid_inputdev->phys = "olpc_pm/input1"; ++ set_bit(EV_SW, lid_inputdev->evbit); ++ set_bit(SW_LID, lid_inputdev->swbit); ++ ++ ret = input_register_device(lid_inputdev); ++ if (ret) { ++ printk(KERN_ERR "olpc-pm: failed to register lid input device: %d\n", ret); ++ goto err; ++ } ++ ++ ebook_inputdev = input_allocate_device(); ++ if (!ebook_inputdev) ++ goto err; ++ ++ ebook_inputdev->name = "OLPC ebook switch"; ++ ebook_inputdev->phys = "olpc_pm/input2"; ++ set_bit(EV_SW, ebook_inputdev->evbit); ++ set_bit(SW_TABLET_MODE, ebook_inputdev->swbit); ++ ++ ret = input_register_device(ebook_inputdev); ++ if (ret) { ++ printk(KERN_ERR "olpc-pm: failed to register ebook input device: %d\n", ret); ++ goto err; ++ } ++ ++ return ret; ++err: ++ if (ebook_inputdev) { ++ input_unregister_device(ebook_inputdev); ++ ebook_inputdev = NULL; ++ } ++ if (lid_inputdev) { ++ input_unregister_device(lid_inputdev); ++ lid_inputdev = NULL; ++ } ++ if (pm_inputdev) { ++ input_unregister_device(pm_inputdev); ++ pm_inputdev = NULL; ++ } ++ ++ return ret; ++} ++ ++static int __init olpc_pm_init(void) ++{ ++ uint32_t lo, hi; ++ int ret; ++ ++ if (!machine_is_olpc()) ++ return -ENODEV; ++ ++ acpi_base = geode_acpi_base(); ++ pms_base = geode_pms_base(); ++ ++ if (!acpi_base || !pms_base) ++ return -ENODEV; ++ ++ pm_power_off = olpc_power_off; ++ ++ ret = alloc_inputdevs(); ++ if (ret) ++ return ret; ++ ++ rdmsr(0x51400020, lo, hi); ++ sci_irq = (lo >> 20) & 15; ++ ++ if (sci_irq) { ++ printk(KERN_INFO "SCI is mapped to IRQ %d\n", sci_irq); ++ } else { ++ /* Zero doesn't mean zero -- it means masked */ ++ printk(KERN_INFO "SCI unmapped. Mapping to IRQ 3\n"); ++ sci_irq = 3; ++ lo |= 0x00300000; ++ wrmsrl(0x51400020, lo); ++ } ++ ++ olpc_fixup_bios(); ++ ++ lo = inl(pms_base + PM_FSD); ++ ++ /* Lock, enable failsafe, 4 seconds */ ++ outl(0xc001f400, pms_base + PM_FSD); ++ ++ /* Here we set up the SCI events we're interested in during ++ * real-time. We have no sleep button, and the RTC doesn't make ++ * sense, so set up the power button ++ */ ++ ++ outl(inl(acpi_base) | ((CS5536_PM_PWRBTN) << 16), acpi_base); ++ ++ if (olpc_board_at_least(olpc_board(0xb2))) { ++ gpio_wake_events |= GPIO_WAKEUP_LID; ++ ++ /* Get the current value of the GPIO, and set up the edges */ ++ olpc_lid_flag = geode_gpio_isset(OLPC_GPIO_LID, GPIO_READ_BACK); ++ ++ /* Watch for the opposite edge */ ++ ++ if (olpc_lid_flag) ++ geode_gpio_set(OLPC_GPIO_LID, GPIO_NEGATIVE_EDGE_EN); ++ else ++ geode_gpio_set(OLPC_GPIO_LID, GPIO_POSITIVE_EDGE_EN); ++ ++ /* Enable the event */ ++ geode_gpio_set(OLPC_GPIO_LID, GPIO_EVENTS_ENABLE); ++ } ++ ++ /* Set up the EC SCI */ ++ ++ gpio_wake_events |= GPIO_WAKEUP_EC; ++ ++ outl(gpio_wake_events, acpi_base + PM_GPE0_EN); ++ outl(0xFFFFFFFF, acpi_base + PM_GPE0_STS); ++ ++ /* Select level triggered in PIC */ ++ ++ if (sci_irq < 8) { ++ lo = inb(0x4d0); ++ lo |= 1 << sci_irq; ++ outb(lo, 0x4d0); ++ } else { ++ lo = inb(0x4d1); ++ lo |= 1 << (sci_irq - 8); ++ outb(lo, 0x4d1); ++ } ++ /* Clear pending interrupt */ ++ outl(inl(acpi_base) | 0xFFFF, acpi_base); ++ process_sci_queue(0); /* we just want to flush the queue here */ ++ init_ebook_state(); ++ ++ /* Enable the interrupt */ ++ ++ ret = request_irq(sci_irq, &olpc_pm_interrupt, 0, "SCI", &acpi_base); ++ ++ if (ret) { ++ printk(KERN_ERR "Error registering SCI: %d\n", ret); ++ return ret; ++ } ++ ++ ofw_bios_entry.address = 0xF0000 + PAGE_OFFSET; ++ suspend_set_ops(&olpc_pm_ops); ++ ++ sysfs_create_group(&power_subsys.kobj, &olpc_attrs); ++ ++ return 0; ++} ++ ++ ++#if defined (CONFIG_RTC_DRV_CMOS) || defined (CONFIG_RTC_DRV_CMOS_MODULE) ++struct resource rtc_platform_resource[2] = { ++ { ++ .flags = IORESOURCE_IO, ++ .start = RTC_PORT(0), ++ .end = RTC_PORT(0) + RTC_IO_EXTENT ++ }, ++ { ++ .flags = IORESOURCE_IRQ, ++ .start = 8, ++ .end = 8, ++ }, ++}; ++ ++ ++static void rtc_wake_on(struct device *dev) ++{ ++ olpc_wakeup_mask |= CS5536_PM_RTC; ++} ++ ++static void rtc_wake_off(struct device *dev) ++{ ++ olpc_wakeup_mask &= ~(CS5536_PM_RTC); ++} ++ ++static struct cmos_rtc_board_info rtc_info = { ++ .rtc_day_alarm = 0, ++ .rtc_mon_alarm = 0, ++ .rtc_century = 0, ++ .wake_on = rtc_wake_on, ++ .wake_off = rtc_wake_off, ++}; ++ ++struct platform_device olpc_rtc_device = { ++ .name = "rtc_cmos", ++ .id = -1, ++ .num_resources = ARRAY_SIZE(rtc_platform_resource), ++ .dev.platform_data = &rtc_info, ++ .resource = rtc_platform_resource, ++}; ++ ++static int __init olpc_platform_init(void) ++{ ++ rdmsrl(MSR_RTC_DOMA_OFFSET, rtc_info.rtc_day_alarm); ++ rdmsrl(MSR_RTC_MONA_OFFSET, rtc_info.rtc_mon_alarm); ++ rdmsrl(MSR_RTC_CEN_OFFSET, rtc_info.rtc_century); ++ ++ (void)platform_device_register(&olpc_rtc_device); ++ device_init_wakeup(&olpc_rtc_device.dev, 1); ++ ++ (void)platform_device_register(&olpc_powerbutton_dev); ++ device_init_wakeup(&olpc_powerbutton_dev.dev, 1); ++ ++ (void)platform_device_register(&olpc_lid_dev); ++ device_init_wakeup(&olpc_lid_dev.dev, 1); ++ ++ return 0; ++} ++arch_initcall(olpc_platform_init); ++#endif /* CONFIG_RTC_DRV_CMOS */ ++ ++static void olpc_pm_exit(void) ++{ ++ /* Clear any pending events, and disable them */ ++ outl(0xFFFF, acpi_base+2); ++ ++ free_irq(sci_irq, &acpi_base); ++ input_unregister_device(pm_inputdev); ++ input_unregister_device(lid_inputdev); ++ input_unregister_device(ebook_inputdev); ++} ++ ++static struct platform_suspend_ops olpc_pm_ops = { ++ .valid = olpc_pm_state_valid, ++ .enter = olpc_pm_enter, ++}; ++ ++module_init(olpc_pm_init); ++module_exit(olpc_pm_exit); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("David Woodhouse "); ++MODULE_DESCRIPTION("AMD Geode power management for OLPC CL1"); +diff -purN linux_2.6.24_org/arch/x86/kernel/olpc-sleep.S linux_2.6.24_olpc/arch/x86/kernel/olpc-sleep.S +--- linux_2.6.24_org/arch/x86/kernel/olpc-sleep.S 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/arch/x86/kernel/olpc-sleep.S 2008-02-15 18:59:26.000000000 +0000 +@@ -0,0 +1,39 @@ ++.text ++ ++ENTRY(olpc_sleep_asm) ++olpc_sleep: ++ ;; Get the value of PM1_CNT and store it off ++ ++ add 08h, ax ++ mov bx,dx ++ in dx,eax ++ or 2000h, ax ++ mov ax,di ++ ++ ;; flush the cache ++ wbinvd ++ ++ ;; GX2 must disable refresh before going into self-refresh ++ mov 2000000180xh, ecx ++ rdmsr ++ mov eax, esi ++ and 0FF0000FFh, eax ++ wrmsr ++ ++ ;; Now, put the memory into self refresh ++ mov 2004, cx ++ xor edx, edx ++ xor eax, eax ++ mov 04h, al ++ wrmsr ++ ++ ;; Thats all she wrote - time to go to sleep ++ ++ mov bx, dx ++ movzx di, eax ++ out eax, dx ++ ++ ;; ++ ++ ++ +diff -purN linux_2.6.24_org/arch/x86/kernel/olpc-wakeup.S linux_2.6.24_olpc/arch/x86/kernel/olpc-wakeup.S +--- linux_2.6.24_org/arch/x86/kernel/olpc-wakeup.S 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/arch/x86/kernel/olpc-wakeup.S 2008-02-15 18:59:25.000000000 +0000 +@@ -0,0 +1,133 @@ ++.text ++#include ++#include ++#include ++ ++ .macro writepost,value ++ movb $0x34, %al ++ outb %al, $0x70 ++ movb $\value, %al ++ outb %al, $0x71 ++ .endm ++ ++ALIGN ++ .align 4096 ++ ++wakeup_start: ++# jmp wakeup_start ++ ++ cli ++ cld ++ ++ # Clear any dangerous flags ++ ++ pushl $0 ++ popfl ++ ++ writepost 0x31 ++ ++ # Set up %cr3 ++ movl $swsusp_pg_dir - __PAGE_OFFSET, %eax ++ movl %eax, %cr3 ++ ++ movl saved_cr4, %eax ++ movl %eax, %cr4 ++ ++ movl saved_cr0, %eax ++ movl %eax, %cr0 ++ ++ jmp 1f ++1: ++ ljmpl $__KERNEL_CS,$wakeup_return ++ ++ ++.org 0x1000 ++ ++wakeup_return: ++ movw $__KERNEL_DS, %ax ++ movw %ax, %ss ++ movw %ax, %ds ++ movw %ax, %es ++ movw %ax, %fs ++ movw %ax, %gs ++ ++ lgdt saved_gdt ++ lidt saved_idt ++ lldt saved_ldt ++ ljmp $(__KERNEL_CS),$1f ++1: ++ movl %cr3, %eax ++ movl %eax, %cr3 ++ wbinvd ++ ++ # Go back to the return point ++ jmp ret_point ++ ++save_registers: ++ sgdt saved_gdt ++ sidt saved_idt ++ sldt saved_ldt ++ ++ pushl %edx ++ movl %cr4, %edx ++ movl %edx, saved_cr4 ++ ++ movl %cr0, %edx ++ movl %edx, saved_cr0 ++ ++ popl %edx ++ ++ ++ movl %ebx, saved_context_ebx ++ movl %ebp, saved_context_ebp ++ movl %esi, saved_context_esi ++ movl %edi, saved_context_edi ++ ++ pushfl ++ popl saved_context_eflags ++ ++ ret ++ ++ ++restore_registers: ++ movl saved_context_ebp, %ebp ++ movl saved_context_ebx, %ebx ++ movl saved_context_esi, %esi ++ movl saved_context_edi, %edi ++ ++ pushl saved_context_eflags ++ popfl ++ ++ ret ++ ++ ++ENTRY(do_olpc_suspend_lowlevel) ++ call save_processor_state ++ call save_registers ++ ++ # This is the stack context we want to remember ++ movl %esp, saved_context_esp ++ ++ pushl $3 ++ call olpc_do_sleep ++ ++ jmp wakeup_start ++ .p2align 4,,7 ++ret_point: ++ movl saved_context_esp, %esp ++ ++ writepost 0x32 ++ ++ call restore_registers ++ call restore_processor_state ++ ret ++ ++.data ++ALIGN ++ ++saved_gdt: .long 0,0 ++saved_idt: .long 0,0 ++saved_ldt: .long 0 ++saved_cr4: .long 0 ++saved_cr0: .long 0 ++ +diff -purN linux_2.6.24_org/arch/x86/kernel/prom.c linux_2.6.24_olpc/arch/x86/kernel/prom.c +--- linux_2.6.24_org/arch/x86/kernel/prom.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/arch/x86/kernel/prom.c 2008-02-15 18:59:26.000000000 +0000 +@@ -0,0 +1,478 @@ ++/* ++ * Procedures for creating, accessing and interpreting the device tree. ++ * ++ * Paul Mackerras August 1996. ++ * Copyright (C) 1996-2005 Paul Mackerras. ++ * ++ * Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner. ++ * {engebret|bergner}@us.ibm.com ++ * ++ * Adapted for sparc64 by David S. Miller davem@davemloft.net ++ * ++ * Adapter for i386/OLPC by Andres Salomon ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* ++ * XXX: This is very much a stub; right now we're keeping 2 device trees ++ * in memory (one for promfs, and one here). That will not remain ++ * for long! ++ */ ++ ++static struct device_node *allnodes; ++ ++/* use when traversing tree through the allnext, child, sibling, ++ * or parent members of struct device_node. ++ */ ++static DEFINE_RWLOCK(devtree_lock); ++ ++int of_device_is_compatible(const struct device_node *device, ++ const char *compat) ++{ ++ const char* cp; ++ int cplen, l; ++ ++ cp = of_get_property(device, "compatible", &cplen); ++ if (cp == NULL) ++ return 0; ++ while (cplen > 0) { ++ if (strncmp(cp, compat, strlen(compat)) == 0) ++ return 1; ++ l = strlen(cp) + 1; ++ cp += l; ++ cplen -= l; ++ } ++ ++ return 0; ++} ++EXPORT_SYMBOL(of_device_is_compatible); ++ ++struct device_node *of_get_parent(const struct device_node *node) ++{ ++ struct device_node *np; ++ ++ if (!node) ++ return NULL; ++ ++ np = node->parent; ++ ++ return np; ++} ++EXPORT_SYMBOL(of_get_parent); ++ ++struct device_node *of_get_next_child(const struct device_node *node, ++ struct device_node *prev) ++{ ++ struct device_node *next; ++ ++ next = prev ? prev->sibling : node->child; ++ for (; next != 0; next = next->sibling) { ++ break; ++ } ++ ++ return next; ++} ++EXPORT_SYMBOL(of_get_next_child); ++ ++struct device_node *of_find_node_by_path(const char *path) ++{ ++ struct device_node *np = allnodes; ++ ++ for (; np != 0; np = np->allnext) { ++ if (np->full_name != 0 && strcmp(np->full_name, path) == 0) ++ break; ++ } ++ ++ return np; ++} ++EXPORT_SYMBOL(of_find_node_by_path); ++ ++struct device_node *of_find_node_by_phandle(phandle handle) ++{ ++ struct device_node *np; ++ ++ for (np = allnodes; np != 0; np = np->allnext) ++ if (np->node == handle) ++ break; ++ ++ return np; ++} ++EXPORT_SYMBOL(of_find_node_by_phandle); ++ ++struct device_node *of_find_node_by_name(struct device_node *from, ++ const char *name) ++{ ++ struct device_node *np; ++ ++ np = from ? from->allnext : allnodes; ++ for (; np != NULL; np = np->allnext) ++ if (np->name != NULL && strcmp(np->name, name) == 0) ++ break; ++ ++ return np; ++} ++EXPORT_SYMBOL(of_find_node_by_name); ++ ++struct device_node *of_find_node_by_type(struct device_node *from, ++ const char *type) ++{ ++ struct device_node *np; ++ ++ np = from ? from->allnext : allnodes; ++ for (; np != 0; np = np->allnext) ++ if (np->type != 0 && strcmp(np->type, type) == 0) ++ break; ++ ++ return np; ++} ++EXPORT_SYMBOL(of_find_node_by_type); ++ ++struct device_node *of_find_compatible_node(struct device_node *from, ++ const char *type, const char *compatible) ++{ ++ struct device_node *np; ++ ++ np = from ? from->allnext : allnodes; ++ for (; np != 0; np = np->allnext) { ++ if (type != NULL ++ && !(np->type != 0 && strcmp(np->type, type) == 0)) ++ continue; ++ if (of_device_is_compatible(np, compatible)) ++ break; ++ } ++ ++ return np; ++} ++EXPORT_SYMBOL(of_find_compatible_node); ++ ++struct property *of_find_property(const struct device_node *np, ++ const char *name, ++ int *lenp) ++{ ++ struct property *pp; ++ ++ for (pp = np->properties; pp != 0; pp = pp->next) { ++ if (strcasecmp(pp->name, name) == 0) { ++ if (lenp != 0) ++ *lenp = pp->length; ++ break; ++ } ++ } ++ return pp; ++} ++EXPORT_SYMBOL(of_find_property); ++ ++/* ++ * Find a property with a given name for a given node ++ * and return the value. ++ */ ++const void *of_get_property(const struct device_node *np, const char *name, ++ int *lenp) ++{ ++ struct property *pp = of_find_property(np,name,lenp); ++ return pp ? pp->value : NULL; ++} ++EXPORT_SYMBOL(of_get_property); ++ ++int of_getintprop_default(struct device_node *np, const char *name, int def) ++{ ++ struct property *prop; ++ int len; ++ ++ prop = of_find_property(np, name, &len); ++ if (!prop || len != 4) ++ return def; ++ ++ return *(int *) prop->value; ++} ++EXPORT_SYMBOL(of_getintprop_default); ++ ++int of_n_addr_cells(struct device_node *np) ++{ ++ const int* ip; ++ do { ++ if (np->parent) ++ np = np->parent; ++ ip = of_get_property(np, "#address-cells", NULL); ++ if (ip != NULL) ++ return *ip; ++ } while (np->parent); ++ /* No #address-cells property for the root node, default to 2 */ ++ return 2; ++} ++EXPORT_SYMBOL(of_n_addr_cells); ++ ++int of_n_size_cells(struct device_node *np) ++{ ++ const int* ip; ++ do { ++ if (np->parent) ++ np = np->parent; ++ ip = of_get_property(np, "#size-cells", NULL); ++ if (ip != NULL) ++ return *ip; ++ } while (np->parent); ++ /* No #size-cells property for the root node, default to 1 */ ++ return 1; ++} ++EXPORT_SYMBOL(of_n_size_cells); ++ ++int of_set_property(struct device_node *dp, const char *name, void *val, int len) ++{ ++ return -EIO; ++} ++EXPORT_SYMBOL(of_set_property); ++ ++static unsigned int prom_early_allocated; ++ ++static void * __init prom_early_alloc(unsigned long size) ++{ ++ void *ret; ++ ++ ret = kmalloc(size, GFP_KERNEL); ++ if (ret != NULL) ++ memset(ret, 0, size); ++ else ++ printk(KERN_ERR "ACK! couldn't allocate prom memory!\n"); ++ ++ prom_early_allocated += size; ++ ++ return ret; ++} ++ ++static int is_root_node(const struct device_node *dp) ++{ ++ if (!dp) ++ return 0; ++ ++ return (dp->parent == NULL); ++} ++ ++static char * __init build_path_component(struct device_node *dp) ++{ ++ int pathlen; ++ char *n, *i; ++ ++ if (ofw("package-to-path", 3, 1, dp->node, NULL, 0, &pathlen)) { ++ printk(KERN_ERR "PROM: unable to get path name from OFW!\n"); ++ return "ERROR"; ++ } ++ n = prom_early_alloc(pathlen + 1); ++ if (ofw("package-to-path", 3, 1, dp->node, n, pathlen+1, &pathlen)) ++ printk(KERN_ERR "PROM: unable to get path name from OFW\n"); ++ ++ if ((i = strrchr(n, '/'))) ++ n = ++i; /* we only want the file name */ ++ return n; ++} ++ ++static char * __init build_full_name(struct device_node *dp) ++{ ++ int len, ourlen, plen; ++ char *n; ++ ++ plen = strlen(dp->parent->full_name); ++ ourlen = strlen(dp->path_component_name); ++ len = ourlen + plen + 2; ++ ++ n = prom_early_alloc(len); ++ strcpy(n, dp->parent->full_name); ++ if (!is_root_node(dp->parent)) { ++ strcpy(n + plen, "/"); ++ plen++; ++ } ++ strcpy(n + plen, dp->path_component_name); ++ ++ return n; ++} ++ ++static struct property * __init build_one_prop(phandle node, char *prev, char *special_name, void *special_val, int special_len) ++{ ++ static struct property *tmp = NULL; ++ struct property *p; ++ ++ if (tmp) { ++ p = tmp; ++ memset(p, 0, sizeof(*p) + 32); ++ tmp = NULL; ++ } else { ++ p = prom_early_alloc(sizeof(struct property) + 32); ++ } ++ ++ p->name = (char *) (p + 1); ++ if (special_name) { ++ strcpy(p->name, special_name); ++ p->length = special_len; ++ p->value = prom_early_alloc(special_len); ++ memcpy(p->value, special_val, special_len); ++ } else { ++ int fl; ++ if (prev == NULL) { ++ if (ofw("nextprop", 3, 1, node, "", p->name, &fl)) { ++ printk(KERN_ERR "PROM: %s: nextprop failed!\n", __func__); ++ return NULL; ++ } ++ } else { ++ if (ofw("nextprop", 3, 1, node, prev, p->name, &fl)) { ++ printk(KERN_ERR "PROM: %s: nextprop failed!\n", __func__); ++ return NULL; ++ } ++ } ++ if (strlen(p->name) == 0 || fl != 1) { ++ tmp = p; ++ return NULL; ++ } ++ if (ofw("getproplen", 2, 1, node, p->name, &p->length)) { ++ printk(KERN_ERR "PROM: %s: getproplen failed!\n", __func__); ++ return NULL; ++ } ++ if (p->length <= 0) { ++ p->length = 0; ++ } else { ++ p->value = prom_early_alloc(p->length + 1); ++ if (ofw("getprop", 4, 1, node, p->name, p->value, p->length, &p->length)) { ++ printk(KERN_ERR "PROM: %s: getprop failed!\n", __func__); ++ return NULL; ++ } ++ ((unsigned char *)p->value)[p->length] = '\0'; ++ } ++ } ++ return p; ++} ++ ++static struct property * __init build_prop_list(phandle node) ++{ ++ struct property *head, *tail; ++ ++ head = tail = build_one_prop(node, NULL, ++ ".node", &node, sizeof(node)); ++ ++ tail->next = build_one_prop(node, NULL, NULL, NULL, 0); ++ tail = tail->next; ++ while(tail) { ++ tail->next = build_one_prop(node, tail->name, ++ NULL, NULL, 0); ++ tail = tail->next; ++ } ++ ++ return head; ++} ++ ++static char * __init get_one_property(phandle node, const char *name) ++{ ++ char *buf = ""; ++ int len; ++ ++ if (ofw("getproplen", 2, 1, node, name, &len)) { ++ printk(KERN_ERR "PROM: %s: getproplen failed!\n", __func__); ++ return NULL; ++ } ++ if (len > 0) { ++ buf = prom_early_alloc(len); ++ if (ofw("getprop", 4, 1, node, name, buf, len, &len)) { ++ printk(KERN_ERR "PROM: %s: getprop failed!\n", __func__); ++ return NULL; ++ } ++ } ++ ++ return buf; ++} ++ ++static struct device_node * __init create_node(phandle node, struct device_node *parent) ++{ ++ struct device_node *dp; ++ ++ if (!node) ++ return NULL; ++ ++ dp = prom_early_alloc(sizeof(*dp)); ++ dp->parent = parent; ++ ++ kref_init(&dp->kref); ++ ++ dp->name = get_one_property(node, "name"); ++ dp->type = get_one_property(node, "device_type"); ++ dp->node = node; ++ ++ dp->properties = build_prop_list(node); ++ ++ return dp; ++} ++ ++static struct device_node * __init build_tree(struct device_node *parent, phandle node, struct device_node ***nextp) ++{ ++ struct device_node *ret = NULL, *prev_sibling = NULL; ++ struct device_node *dp; ++ u32 child; ++ ++ while (1) { ++ dp = create_node(node, parent); ++ if (!dp) ++ break; ++ ++ if (prev_sibling) ++ prev_sibling->sibling = dp; ++ ++ if (!ret) ++ ret = dp; ++ prev_sibling = dp; ++ ++ *(*nextp) = dp; ++ *nextp = &dp->allnext; ++ ++ dp->path_component_name = build_path_component(dp); ++ dp->full_name = build_full_name(dp); ++ ++ if (ofw("child", 1, 1, node, &child)) { ++ printk(KERN_ERR "PROM: %s: fetching child failed!\n", __func__); ++ return NULL; ++ } ++ dp->child = build_tree(dp, child, nextp); ++ ++ if (ofw("peer", 1, 1, node, &node)) { ++ printk(KERN_ERR "PROM: %s: fetching peer failed!\n", __func__); ++ return NULL; ++ } ++ } ++ ++ return ret; ++} ++ ++static phandle root_node; ++ ++void __init prom_build_devicetree(void) ++{ ++ struct device_node **nextp; ++ u32 child; ++ ++ if (ofw("peer", 1, 1, 0, &root_node)) { ++ printk(KERN_ERR "PROM: unable to get root node from OFW!\n"); ++ return; ++ } ++ ++ allnodes = create_node(root_node, NULL); ++ allnodes->path_component_name = ""; ++ allnodes->full_name = "/"; ++ ++ nextp = &allnodes->allnext; ++ if (ofw("child", 1, 1, allnodes->node, &child)) { ++ printk(KERN_ERR "PROM: unable to get child node from OFW!\n"); ++ return; ++ } ++ allnodes->child = build_tree(allnodes, child, &nextp); ++ printk("PROM: Built device tree with %u bytes of memory.\n", ++ prom_early_allocated); ++} +diff -purN linux_2.6.24_org/arch/x86/pci/olpc.c linux_2.6.24_olpc/arch/x86/pci/olpc.c +--- linux_2.6.24_org/arch/x86/pci/olpc.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/arch/x86/pci/olpc.c 2008-02-15 18:59:22.000000000 +0000 +@@ -0,0 +1,298 @@ ++/* ++ * olpcpci.c - Low-level PCI config space access for OLPC systems ++ * without the VSA PCI virtualization software. ++ * ++ * The AMD Geode chipset (GX2 processor, cs5536 I/O companion device) ++ * has some I/O functions (display, southbridge, sound, USB HCIs, etc) ++ * that more or less behave like PCI devices, but the hardware doesn't ++ * directly implement the PCI configuration space headers. AMD provides ++ * "VSA" (Virtual System Architecture) software that emulates PCI config ++ * space for these devices, by trapping I/O accesses to PCI config register ++ * (CF8/CFC) and running some code in System Management Mode interrupt state. ++ * On the OLPC platform, we don't want to use that VSA code because ++ * (a) it slows down suspend/resume, and (b) recompiling it requires special ++ * compilers that are hard to get. So instead of letting the complex VSA ++ * code simulate the PCI config registers for the on-chip devices, we ++ * just simulate them the easy way, by inserting the code into the ++ * pci_write_config and pci_read_config path. Most of the config registers ++ * are read-only anyway, so the bulk of the simulation is just table lookup. ++ */ ++ ++#include ++#include ++#include ++#include ++#include "pci.h" ++ ++static int is_lx; ++ ++/* ++ * In the tables below, the first two line (8 longwords) are the ++ * size masks that are used when the higher level PCI code determines ++ * the size of the region by writing ~0 to a base address register ++ * and reading back the result. ++ * ++ * The following lines are the values that are read during normal ++ * PCI config access cycles, i.e. not after just having written ++ * ~0 to a base address register. ++ */ ++ ++static const u32 lxnb_hdr[] = { /* dev 1 function 0 - devfn = 8 */ ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ ++ 0x281022 , 0x2200005 , 0x6000021 , 0x80f808 , /* AMD Vendor ID */ ++ 0x0 , 0x0 , 0x0 , 0x0 , /* No virtual registers, hence no BAR for them */ ++ 0x0 , 0x0 , 0x0 , 0x28100b , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++}; ++ ++static const u32 gxnb_hdr[] = { /* dev 1 function 0 - devfn = 8 */ ++ 0xfffffffd , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ ++ 0x28100b , 0x2200005 , 0x6000021 , 0x80f808 , /* NSC Vendor ID */ ++ 0xac1d , 0x0 , 0x0 , 0x0 , /* I/O BAR - base of virtual registers */ ++ 0x0 , 0x0 , 0x0 , 0x28100b , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++}; ++ ++static const u32 lxfb_hdr[] = { /* dev 1 function 1 - devfn = 9 */ ++ 0xff800008 , 0xffffc000 , 0xffffc000 , 0xffffc000 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ ++ 0x20811022 , 0x2200003 , 0x3000000 , 0x0 , /* AMD Vendor ID */ ++ 0xfd000000 , 0xfe000000 , 0xfe004000 , 0xfe008000 , /* FB, GP, VG, DF */ ++ 0xfe00c000 , 0x0 , 0x0 , 0x30100b , /* VIP */ ++ 0x0 , 0x0 , 0x0 , 0x10e , /* INTA, IRQ14 for graphics accel */ ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ 0x3d0 , 0x3c0 , 0xa0000 , 0x0 , /* VG IO, VG IO, EGA FB, MONO FB */ ++ 0x0 , 0x0 , 0x0 , 0x0 , ++}; ++ ++static const u32 gxfb_hdr[] = { /* dev 1 function 1 - devfn = 9 */ ++ 0xff800008 , 0xffffc000 , 0xffffc000 , 0xffffc000 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ ++ 0x30100b , 0x2200003 , 0x3000000 , 0x0 , /* NSC Vendor ID */ ++ 0xfd000000 , 0xfe000000 , 0xfe004000 , 0xfe008000 , /* FB, GP, VG, DF */ ++ 0x0 , 0x0 , 0x0 , 0x30100b , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ 0x3d0 , 0x3c0 , 0xa0000 , 0x0 , /* VG IO, VG IO, EGA FB, MONO FB */ ++ 0x0 , 0x0 , 0x0 , 0x0 , ++}; ++ ++static const u32 aes_hdr[] = { /* dev 1 function 2 - devfn = 0xa */ ++ 0xffffc000 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ ++ 0x20821022 , 0x2a00006 , 0x10100000 , 0x8 , /* NSC Vendor ID */ ++ 0xfe010000 , 0x0 , 0x0 , 0x0 , /* AES registers */ ++ 0x0 , 0x0 , 0x0 , 0x20821022 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++}; ++ ++ ++static const u32 isa_hdr[] = { /* dev f function 0 - devfn = 78 */ ++ 0xfffffff9 , 0xffffff01 , 0xffffffc1 , 0xffffffe1 , ++ 0xffffff81 , 0xffffffc1 , 0x0 , 0x0 , ++ ++ 0x20901022 , 0x2a00049 , 0x6010003 , 0x802000 , ++ 0x18b1 , 0x1001 , 0x1801 , 0x1881 , /* SMB-8 GPIO-256 MFGPT-64 IRQ-32 */ ++ 0x1401 , 0x1841 , 0x0 , 0x20901022 , /* PMS-128 ACPI-64 */ ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0xaa5b , /* interrupt steering */ ++ 0x0 , 0x0 , 0x0 , 0x0 , ++}; ++ ++static const u32 ac97_hdr[] = { /* dev f function 3 - devfn = 7b */ ++ 0xffffff81 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ ++ 0x20931022 , 0x2a00041 , 0x4010001 , 0x0 , ++ 0x1481 , 0x0 , 0x0 , 0x0 , /* I/O BAR-128 */ ++ 0x0 , 0x0 , 0x0 , 0x20931022 , ++ 0x0 , 0x0 , 0x0 , 0x205 , /* IntB , IRQ5 */ ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++}; ++ ++static const u32 ohci_hdr[] = { /* dev f function 4 - devfn = 7c */ ++ 0xfffff000 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ ++ 0x20941022 , 0x2300006 , 0xc031002 , 0x0 , ++ 0xfe01a000 , 0x0 , 0x0 , 0x0 , /* MEMBAR-1000 */ ++ 0x0 , 0x0 , 0x0 , 0x20941022 , ++ 0x0 , 0x40 , 0x0 , 0x40a , /* CapPtr INT-D, IRQ A */ ++ 0xc8020001 , 0x0 , 0x0 , 0x0 , /* Capabilities - 40 is R/O, 44 is mask 8103 (power control) */ ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++}; ++ ++static const u32 ehci_hdr[] = { /* dev f function 4 - devfn = 7d */ ++ 0xfffff000 , 0x0 , 0x0 , 0x0 , ++ 0x0 , 0x0 , 0x0 , 0x0 , ++ ++ 0x20951022 , 0x2300006 , 0xc032002 , 0x0 , ++ 0xfe01b000 , 0x0 , 0x0 , 0x0 , /* MEMBAR-1000 */ ++ 0x0 , 0x0 , 0x0 , 0x20951022 , ++ 0x0 , 0x40 , 0x0 , 0x40a , /* CapPtr INT-D, IRQ A */ ++ 0xc8020001 , 0x0 , 0x0 , 0x0 , /* Capabilities - 40 is R/O, 44 is mask 8103 (power control) */ ++#if 0 ++ 0x1 , 0x40080000 , 0x0 , 0x0 , /* EECP - see section 2.1.7 of EHCI spec */ ++#endif ++ 0x01000001 , 0x00000000 , 0x0 , 0x0 , /* EECP - see section 2.1.7 of EHCI spec */ ++ 0x2020 , 0x0 , 0x0 , 0x0 , /* (EHCI page 8) 60 SBRN (R/O), 61 FLADJ (R/W), PORTWAKECAP */ ++}; ++ ++static u32 ff_loc = ~0; ++static u32 zero_loc = 0; ++ ++static int bar_probing = 0; /* Set after a write of ~0 to a BAR */ ++ ++#define NB_SLOT 0x1 /* Northbridge - GX chip - Device 1 */ ++#define SB_SLOT 0xf /* Southbridge - CS5536 chip - Device F */ ++#define SIMULATED(bus, devfn) (((bus) == 0) && ((PCI_SLOT(devfn) == NB_SLOT) || (PCI_SLOT(devfn) == SB_SLOT))) ++ ++static u32 *hdr_addr(const u32 *hdr, int reg) ++{ ++ u32 addr; ++ ++ /* ++ * This is a little bit tricky. The header maps consist of ++ * 0x20 bytes of size masks, followed by 0x70 bytes of header data. ++ * In the normal case, when not probing a BAR's size, we want ++ * to access the header data, so we add 0x20 to the reg offset, ++ * thus skipping the size mask area. ++ * In the BAR probing case, we want to access the size mask for ++ * the BAR, so we subtract 0x10 (the config header offset for ++ * BAR0), and don't skip the size mask area. ++ */ ++ ++ addr = (u32)hdr + reg + (bar_probing ? -0x10 : 0x20); ++ ++ bar_probing = 0; ++ return (u32 *)addr; ++} ++ ++static int pci_olpc_read(unsigned int seg, unsigned int bus, ++ unsigned int devfn, int reg, int len, u32 *value) ++{ ++ u32 *addr; ++ ++ /* Use the hardware mechanism for non-simulated devices */ ++ if (!SIMULATED(bus, devfn)) ++ return pci_conf1_read(seg, bus, devfn, reg, len, value); ++ ++ /* ++ * No device has config registers past 0x70, so we save table space ++ * by not storing entries for the nonexistent registers ++ */ ++ if (reg >= 0x70) ++ addr = &zero_loc; ++ else { ++ switch (devfn) { ++ case 0x8: ++ addr = hdr_addr(is_lx ? lxnb_hdr : gxnb_hdr, reg); ++ break; ++ case 0x9: ++ addr = hdr_addr(is_lx ? lxfb_hdr : gxfb_hdr, reg); ++ break; ++ case 0xa: ++ addr = is_lx ? hdr_addr(aes_hdr, reg) : &ff_loc; ++ break; ++ case 0x78: ++ addr = hdr_addr(isa_hdr, reg); ++ break; ++ case 0x7b: ++ addr = hdr_addr(ac97_hdr, reg); ++ break; ++ case 0x7c: ++ addr = hdr_addr(ohci_hdr, reg); ++ break; ++ case 0x7d: ++ addr = hdr_addr(ehci_hdr, reg); ++ break; ++ default: ++ addr = &ff_loc; ++ break; ++ } ++ } ++ switch (len) { ++ case 1: ++ *value = *(u8 *) addr; ++ break; ++ case 2: ++ *value = *(u16 *) addr; ++ break; ++ case 4: ++ *value = *addr; ++ break; ++ default: ++ BUG(); ++ } ++ ++ return 0; ++} ++ ++static int pci_olpc_write(unsigned int seg, unsigned int bus, ++ unsigned int devfn, int reg, int len, u32 value) ++{ ++ /* Use the hardware mechanism for non-simulated devices */ ++ if (!SIMULATED(bus, devfn)) ++ return pci_conf1_write(seg, bus, devfn, reg, len, value); ++ ++ /* XXX we may want to extend this to simulate EHCI power management */ ++ ++ /* ++ * Mostly we just discard writes, but if the write is a size probe ++ * (i.e. writing ~0 to a BAR), we remember it and arrange to return ++ * the appropriate size mask on the next read. This is cheating ++ * to some extent, because it depends on the fact that the next ++ * access after such a write will always be a read to the same BAR. ++ */ ++ ++ if ((reg >= 0x10) && (reg < 0x2c)) { ++ /* Write is to a BAR */ ++ if (value == ~0) ++ bar_probing = 1; ++ } else { ++ /* ++ * No warning on writes to ROM BAR, CMD, LATENCY_TIMER, ++ * CACHE_LINE_SIZE, or PM registers. ++ */ ++ if ((reg != 0x30) && (reg != 0x04) && (reg != 0x0d) && ++ (reg != 0x0c) && (reg != 0x44)) ++ printk(KERN_WARNING "OLPC PCI: Config write to devfn %x reg %x value %x\n", devfn, reg, value); ++ } ++ ++ return 0; ++} ++ ++static struct pci_raw_ops pci_olpc_conf = { ++ .read = pci_olpc_read, ++ .write = pci_olpc_write, ++}; ++ ++void __init pci_olpc_init(void) ++{ ++ if (!machine_is_olpc() || olpc_has_vsa()) ++ return; ++ ++ printk(KERN_INFO "PCI: Using configuration type OLPC\n"); ++ raw_pci_ops = &pci_olpc_conf; ++ is_lx = is_geode_lx(); ++} +diff -purN linux_2.6.24_org/Documentation/kernel-parameters.txt linux_2.6.24_olpc/Documentation/kernel-parameters.txt +--- linux_2.6.24_org/Documentation/kernel-parameters.txt 2008-02-15 20:12:29.000000000 +0000 ++++ linux_2.6.24_olpc/Documentation/kernel-parameters.txt 2008-02-15 18:59:54.000000000 +0000 +@@ -1244,6 +1244,13 @@ and is between 256 and 4096 characters. + + nr_uarts= [SERIAL] maximum number of UARTs to be registered. + ++ olpc_ec_timeout= [OLPC] ms delay when issuing EC commands ++ Rather than timing out after 20 ms if an EC ++ command is not properly ACKed, override the length ++ of the timeout. We have interrupts disabled while ++ waiting for the ACK, so if this is set too high ++ interrupts *may* be lost! ++ + opl3= [HW,OSS] + Format: + +diff -purN linux_2.6.24_org/drivers/base/dd.c linux_2.6.24_olpc/drivers/base/dd.c +--- linux_2.6.24_org/drivers/base/dd.c 2008-02-15 20:11:29.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/base/dd.c 2008-02-15 18:58:46.000000000 +0000 +@@ -293,7 +293,6 @@ static void __device_release_driver(stru + if (drv) { + driver_sysfs_remove(dev); + sysfs_remove_link(&dev->kobj, "driver"); +- klist_remove(&dev->knode_driver); + + if (dev->bus) + blocking_notifier_call_chain(&dev->bus->bus_notifier, +@@ -306,6 +305,7 @@ static void __device_release_driver(stru + drv->remove(dev); + devres_release_all(dev); + dev->driver = NULL; ++ klist_remove(&dev->knode_driver); + put_driver(drv); + } + } +diff -purN linux_2.6.24_org/drivers/char/vt_ioctl.c linux_2.6.24_olpc/drivers/char/vt_ioctl.c +--- linux_2.6.24_org/drivers/char/vt_ioctl.c 2008-02-15 20:11:48.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/char/vt_ioctl.c 2008-02-15 18:59:11.000000000 +0000 +@@ -38,6 +38,9 @@ + char vt_dont_switch; + extern struct tty_driver *console_driver; + ++/* Add a notifier chain to inform drivers of a VT_TEXT/VT_GRAPHICS switch */ ++RAW_NOTIFIER_HEAD(console_notifier_list); ++ + #define VT_IS_IN_USE(i) (console_driver->ttys[i] && console_driver->ttys[i]->count) + #define VT_BUSY(i) (VT_IS_IN_USE(i) || i == fg_console || vc_cons[i].d == sel_cons) + +@@ -492,6 +495,14 @@ int vt_ioctl(struct tty_struct *tty, str + vc->vc_mode = (unsigned char) arg; + if (console != fg_console) + return 0; ++ ++ /* Notify listeners if the current fg_console has switched */ ++ ++ raw_notifier_call_chain(&console_notifier_list, ++ (arg == KD_TEXT) ? ++ CONSOLE_EVENT_SWITCH_TEXT : ++ CONSOLE_EVENT_SWITCH_GRAPHICS, 0); ++ + /* + * explicitly blank/unblank the screen if switching modes + */ +diff -purN linux_2.6.24_org/drivers/i2c/busses/scx200_acb.c linux_2.6.24_olpc/drivers/i2c/busses/scx200_acb.c +--- linux_2.6.24_org/drivers/i2c/busses/scx200_acb.c 2008-02-15 20:11:33.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/i2c/busses/scx200_acb.c 2008-02-15 18:58:49.000000000 +0000 +@@ -46,6 +46,10 @@ static int base[MAX_DEVICES] = { 0x820, + module_param_array(base, int, NULL, 0); + MODULE_PARM_DESC(base, "Base addresses for the ACCESS.bus controllers"); + ++static unsigned int smbclk = 0x70; ++module_param(smbclk, uint, 0); ++MODULE_PARM_DESC(smbclk, "Specify the SMB_CLK value"); ++ + #define POLL_TIMEOUT (HZ/5) + + enum scx200_acb_state { +@@ -108,6 +112,7 @@ struct scx200_acb_iface { + #define ACBADDR (iface->base + 4) + #define ACBCTL2 (iface->base + 5) + #define ACBCTL2_ENABLE 0x01 ++#define ACBCTL3 (iface->base + 6) + + /************************************************************************/ + +@@ -392,11 +397,13 @@ static __init int scx200_acb_probe(struc + { + u8 val; + +- /* Disable the ACCESS.bus device and Configure the SCL +- frequency: 16 clock cycles */ +- outb(0x70, ACBCTL2); ++ /* Disable the ACCESS.bus device and Configure the SCL */ ++ ++ outb((smbclk & 0x7F) << 1, ACBCTL2); ++ ++ outb((smbclk >> 7) & 0xFF, ACBCTL3); + +- if (inb(ACBCTL2) != 0x70) { ++ if (inb(ACBCTL2) != ((smbclk & 0x7F) << 1)) { + pr_debug(NAME ": ACBCTL2 readback failed\n"); + return -ENXIO; + } +diff -purN linux_2.6.24_org/drivers/input/keyboard/atkbd.c linux_2.6.24_olpc/drivers/input/keyboard/atkbd.c +--- linux_2.6.24_org/drivers/input/keyboard/atkbd.c 2008-02-15 20:11:51.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/input/keyboard/atkbd.c 2008-02-15 18:59:14.000000000 +0000 +@@ -63,12 +63,25 @@ static int atkbd_extra; + module_param_named(extra, atkbd_extra, bool, 0); + MODULE_PARM_DESC(extra, "Enable extra LEDs and keys on IBM RapidAcces, EzKey and similar keyboards"); + ++#define ATKBD_KEY_UNKNOWN 0 ++#define ATKBD_KEY_NULL 0xFF0000FF ++ ++#define ATKBD_SCR_1 0xFF0000FE ++#define ATKBD_SCR_2 0xFF0000FD ++#define ATKBD_SCR_4 0xFF0000FC ++#define ATKBD_SCR_8 0xFF0000FB ++#define ATKBD_SCR_CLICK 0xFF0000FA ++#define ATKBD_SCR_LEFT 0xFF0000F9 ++#define ATKBD_SCR_RIGHT 0xFF0000F8 ++ ++#define ATKBD_SPECIAL 0xFF0000F8 ++ + /* + * Scancode to keycode tables. These are just the default setting, and + * are loadable via an userland utility. + */ + +-static unsigned char atkbd_set2_keycode[512] = { ++static unsigned int atkbd_set2_keycode[512] = { + + #ifdef CONFIG_KEYBOARD_ATKBD_HP_KEYCODES + +@@ -87,11 +100,17 @@ static unsigned char atkbd_set2_keycode[ + 82, 83, 80, 76, 77, 72, 1, 69, 87, 78, 81, 74, 55, 73, 70, 99, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +- 217,100,255, 0, 97,165, 0, 0,156, 0, 0, 0, 0, 0, 0,125, ++ ++ 217,100,ATKBD_KEY_NULL, 0, 97,165, 0, 0, ++ 156, 0, 0, 0, 0, 0, 0,125, ++ + 173,114, 0,113, 0, 0, 0,126,128, 0, 0,140, 0, 0, 0,127, + 159, 0,115, 0,164, 0, 0,116,158, 0,172,166, 0, 0, 0,142, + 157, 0, 0, 0, 0, 0, 0, 0,155, 0, 98, 0, 0,163, 0, 0, +- 226, 0, 0, 0, 0, 0, 0, 0, 0,255, 96, 0, 0, 0,143, 0, ++ ++ 226, 0, 0, 0, 0, 0, 0, 0, ++ 0,ATKBD_KEY_NULL, 96, 0, 0, 0,143, 0, ++ + 0, 0, 0, 0, 0, 0, 0, 0, 0,107, 0,105,102, 0, 0,112, + 110,111,108,112,106,103, 0,119, 0,118,109, 0, 99,104,119, 0, + +@@ -150,19 +169,6 @@ static unsigned char atkbd_unxlate_table + #define ATKBD_RET_HANGEUL 0xf2 + #define ATKBD_RET_ERR 0xff + +-#define ATKBD_KEY_UNKNOWN 0 +-#define ATKBD_KEY_NULL 255 +- +-#define ATKBD_SCR_1 254 +-#define ATKBD_SCR_2 253 +-#define ATKBD_SCR_4 252 +-#define ATKBD_SCR_8 251 +-#define ATKBD_SCR_CLICK 250 +-#define ATKBD_SCR_LEFT 249 +-#define ATKBD_SCR_RIGHT 248 +- +-#define ATKBD_SPECIAL 248 +- + #define ATKBD_LED_EVENT_BIT 0 + #define ATKBD_REP_EVENT_BIT 1 + +@@ -174,7 +180,7 @@ static unsigned char atkbd_unxlate_table + #define ATKBD_XL_HANJA 0x20 + + static struct { +- unsigned char keycode; ++ unsigned int keycode; + unsigned char set2; + } atkbd_scroll_keys[] = { + { ATKBD_SCR_1, 0xc5 }, +@@ -200,7 +206,7 @@ struct atkbd { + char phys[32]; + + unsigned short id; +- unsigned char keycode[512]; ++ unsigned int keycode[512]; + unsigned char set; + unsigned char translated; + unsigned char extra; +@@ -351,7 +357,7 @@ static irqreturn_t atkbd_interrupt(struc + unsigned int code = data; + int scroll = 0, hscroll = 0, click = -1, add_release_event = 0; + int value; +- unsigned char keycode; ++ unsigned int keycode; + + #ifdef ATKBD_DEBUG + printk(KERN_DEBUG "atkbd.c: Received %02x flags %02x\n", data, flags); +@@ -856,9 +862,11 @@ static void atkbd_set_keycode_table(stru + atkbd->keycode[i | 0x80] = atkbd_scroll_keys[j].keycode; + } + } else if (atkbd->set == 3) { +- memcpy(atkbd->keycode, atkbd_set3_keycode, sizeof(atkbd->keycode)); ++ for (i = 0; i < ARRAY_SIZE(atkbd_set3_keycode); i++) ++ atkbd->keycode[i] = atkbd_set3_keycode[i]; + } else { +- memcpy(atkbd->keycode, atkbd_set2_keycode, sizeof(atkbd->keycode)); ++ for (i = 0; i < ARRAY_SIZE(atkbd_set2_keycode); i++) ++ atkbd->keycode[i] = atkbd_set2_keycode[i]; + + if (atkbd->scroll) + for (i = 0; i < ARRAY_SIZE(atkbd_scroll_keys); i++) +@@ -930,8 +938,8 @@ static void atkbd_set_device_attrs(struc + } + + input_dev->keycode = atkbd->keycode; +- input_dev->keycodesize = sizeof(unsigned char); +- input_dev->keycodemax = ARRAY_SIZE(atkbd_set2_keycode); ++ input_dev->keycodesize = sizeof(unsigned int); ++ input_dev->keycodemax = ARRAY_SIZE(atkbd->keycode); + + for (i = 0; i < 512; i++) + if (atkbd->keycode[i] && atkbd->keycode[i] < ATKBD_SPECIAL) +@@ -1022,6 +1030,10 @@ static int atkbd_connect(struct serio *s + return err; + } + ++#ifdef CONFIG_OLPC ++#include ++#endif ++ + /* + * atkbd_reconnect() tries to restore keyboard into a sane state and is + * most likely called on resume. +@@ -1032,6 +1044,12 @@ static int atkbd_reconnect(struct serio + struct atkbd *atkbd = serio_get_drvdata(serio); + struct serio_driver *drv = serio->drv; + ++#ifdef CONFIG_OLPC ++ if (olpc_board_at_least(olpc_board_pre(0xb3))) ++ if (serio->dev.power.power_state.event != PM_EVENT_ON) ++ return 0; ++#endif ++ + if (!atkbd || !drv) { + printk(KERN_DEBUG "atkbd: reconnect request, but serio is disconnected, ignoring...\n"); + return -1; +diff -purN linux_2.6.24_org/drivers/input/mouse/Kconfig linux_2.6.24_olpc/drivers/input/mouse/Kconfig +--- linux_2.6.24_org/drivers/input/mouse/Kconfig 2008-02-15 20:11:51.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/input/mouse/Kconfig 2008-02-15 18:59:14.000000000 +0000 +@@ -96,6 +96,16 @@ config MOUSE_PS2_TOUCHKIT + + If unsure, say N. + ++config MOUSE_PS2_OLPC ++ bool "OLPC PS/2 mouse protocol extension" if EMBEDDED ++ default n ++ depends on MOUSE_PS2 && OLPC ++ ---help--- ++ Say Y here if you have an OLPC PS/2 touchpad connected to ++ your system. ++ ++ If unsure, say N. ++ + config MOUSE_SERIAL + tristate "Serial mouse" + select SERIO +diff -purN linux_2.6.24_org/drivers/input/mouse/Makefile linux_2.6.24_olpc/drivers/input/mouse/Makefile +--- linux_2.6.24_org/drivers/input/mouse/Makefile 2008-02-15 20:11:51.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/input/mouse/Makefile 2008-02-15 18:59:14.000000000 +0000 +@@ -24,3 +24,4 @@ psmouse-$(CONFIG_MOUSE_PS2_LOGIPS2PP) += + psmouse-$(CONFIG_MOUSE_PS2_LIFEBOOK) += lifebook.o + psmouse-$(CONFIG_MOUSE_PS2_TRACKPOINT) += trackpoint.o + psmouse-$(CONFIG_MOUSE_PS2_TOUCHKIT) += touchkit_ps2.o ++psmouse-$(CONFIG_MOUSE_PS2_OLPC) += olpc.o +diff -purN linux_2.6.24_org/drivers/input/mouse/olpc.c linux_2.6.24_olpc/drivers/input/mouse/olpc.c +--- linux_2.6.24_org/drivers/input/mouse/olpc.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/drivers/input/mouse/olpc.c 2008-02-15 18:59:14.000000000 +0000 +@@ -0,0 +1,837 @@ ++/* ++ * OLPC touchpad PS/2 mouse driver ++ * ++ * Copyright (c) 2006-2008 One Laptop Per Child ++ * Authors: ++ * Zephaniah E. Hull ++ * Andres Salomon ++ * ++ * This driver is partly based on the ALPS driver, which is: ++ * ++ * Copyright (c) 2003 Neil Brown ++ * Copyright (c) 2003-2005 Peter Osterlund ++ * Copyright (c) 2004 Dmitry Torokhov ++ * Copyright (c) 2005 Vojtech Pavlik ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++/* ++ * The touchpad on the OLPC is fairly wide, with the entire area usable ++ * as a tablet (Pen Tablet/PT), and the center 1/3rd also usable as a ++ * touchpad (Glide Sensor/GS). The spec from ALPS is available from ++ * . It refers to this ++ * device as HGPK (Hybrid GS, PT, and Keymatrix). ++ * ++ * Earlier version of the device had simultaneous reporting; however, that ++ * was removed. Instead, the device now reports packets in one mode, and ++ * tells the driver when a mode switch needs to happen. ++ */ ++ ++#define DEBUG ++#include ++#include ++#include ++#include ++#include ++ ++#include "psmouse.h" ++#include "olpc.h" ++ ++static int tpdebug; ++module_param(tpdebug, int, 0644); ++ ++static int ignore_delta = 60; ++module_param(ignore_delta, int, 0644); ++MODULE_PARM_DESC(ignore_delta, "ignore packets that cause an X or Y delta larger than this value."); ++ ++/* ++ * With older hardware, a finger-up event is sometimes not sent. If it's been ++ * more than 50mS since the last packet, we can safely assume that there was ++ * a finger-up event that we never received. ++ */ ++static void hgpk_fingerup_hack(struct psmouse *psmouse, struct hgpk_packet *p) ++{ ++ struct hgpk_data *priv = psmouse->private; ++ struct timeval now_tv; ++ s64 now_ns; ++ ++ if (psmouse->model >= HGPK_MODEL_C) ++ return; ++ ++ if (p->gs_down || p->pt_down) { ++ do_gettimeofday(&now_tv); ++ now_ns = timeval_to_ns(&now_tv); ++ ++ if (priv->late && now_ns >= priv->late) { ++ struct input_dev *pt = psmouse->dev; ++ struct input_dev *gs = priv->gs; ++ ++ input_report_key(pt, BTN_TOUCH, 0); ++ input_report_key(gs, BTN_TOUCH, 0); ++ input_sync(pt); ++ input_sync(gs); ++ hgpk_dbg(psmouse, "Missing finger-up packet detected, " ++ "working around buggy hardware.\n"); ++ } ++ priv->late = now_ns + (50 * NSEC_PER_MSEC); ++ } else ++ priv->late = 0; ++} ++ ++/* ++ * C and D series touchpads send an extra finger-up packet to ensure we've ++ * seen it. That's all well and good, but for some uncomprehensible reason ++ * they sometimes also get stuck in a state where they also send an ++ * extra finger-down packet with coordinates of x=0, y=0. This royally ++ * screws relative positioning; end users see it as the touchpad jumping ++ * around when they first put their finger down. This works around that. ++ * ++ * *Sigh*. ALPS.. ++ */ ++static void hgpk_fingerdown_hack(struct psmouse *psmouse, struct hgpk_packet *p) ++{ ++ if (psmouse->model < HGPK_MODEL_C) ++ return; ++ ++ /* we only care about x=0, y=0 packets */ ++ if (p->x != 0 || p->y != 0) ++ return; ++ ++ /* ++ * if we're a gs_down packet but we were not previously down, ++ * we're going to assume that this is one of those spurious packets ++ * that needs to be worked around. ++ */ ++ if (p->gs_down && !test_bit(BTN_TOUCH, p->dev->key)) { ++ hgpk_dbg(psmouse, "spurious GS finger-down packet\n"); ++ p->gs_down = 0; ++ } else if (p->pt_down && !test_bit(BTN_TOUCH, p->dev->key)) { ++ hgpk_dbg(psmouse, "spurious PT finger-down packet\n"); ++ p->pt_down = 0; ++ } ++} ++ ++/* ++ * In general, we have lots of calibration problems that manifest ++ * themselves as jumpy mouse pointers. Miscalibration, capacitance issues ++ * with the hardware, etc; these make the touchpad detect errant packets ++ * at random places all over the place. Since we don't expect large deltas ++ * to ever actually be useful, we'll large axis changes that go over our ++ * threshold. ++ */ ++static void hgpk_big_delta_hack(struct psmouse *psmouse, struct hgpk_packet *p) ++{ ++ struct hgpk_data *priv = psmouse->private; ++ struct input_dev *dev = p->dev; ++ ++ /* afaik, this happens on all hardware */ ++ ++ /* ignore finger-up packets */ ++ if (!p->pt_down && !p->gs_down) ++ goto done; ++ ++ /* ensure that we're not a finger-down packet */ ++ if ((p->pt_down && !test_bit(BTN_TOUCH, dev->key)) || ++ (p->gs_down && !test_bit(BTN_TOUCH, dev->key))) ++ goto done; ++ ++ if (abs(dev->abs[ABS_X] - p->x) > ignore_delta || ++ abs(dev->abs[ABS_Y] - p->y) > ignore_delta) { ++ hgpk_dbg(psmouse, "axis change (%d,%d) => (%d,%d) is over " ++ "delta threshold\n", dev->abs[ABS_X], ++ dev->abs[ABS_Y], p->x, p->y); ++ input_report_key(dev, BTN_TOUCH, 0); ++ input_sync(dev); ++ ++ ++ /* two in a row is a pretty good indicator of miscalibration */ ++ if (priv->axis_errors++) { ++ /* wait 2s for finger removal, and then recalibrate */ ++ queue_delayed_work(kpsmoused_wq, &priv->recalib_wq, ++ msecs_to_jiffies(2000)); ++ priv->axis_errors = 0; ++ } ++ return; ++ } ++done: ++ priv->axis_errors = 0; ++} ++ ++/* ++ * This is my favorite touchpad hardware bug. I'm entirely not sure what ++ * triggers it (I've seen it triggered while the laptop was left on overnight, ++ * but my cat could have very well been using it/sleeping on it). However, ++ * the touchpad will randomly get stuck in a state where it constantly spews ++ * packets without a finger being on it. A recalibration will fix it, but ++ * without that it will go on for days (auto-recalibration doesn't catch it, ++ * either). The packets tend to either have the same coordinates, or be ++ * 1px away from each other; ie, (283,139,6) -> (284,139,5) -> (285,139,5) -> ++ * (286,139,6) -> (286,139,6) -> etc. We have a number of workarounds here.. ++ */ ++static void hgpk_spewing_hack(struct psmouse *psmouse, struct hgpk_packet *p) ++{ ++ struct hgpk_data *priv = psmouse->private; ++ struct input_dev *dev = p->dev; ++ int repeat_axes; ++ ++ if (psmouse->model < HGPK_MODEL_C) ++ return; ++ ++ /* ignore 0, 0 packets */ ++ if (p->x == 0 && p->y == 0) ++ return; ++ ++ /* PT packets don't count */ ++ if (p->pt_down) { ++ priv->repeat_pkts = 0; ++ return; ++ } ++ ++ /* ++ * If we see 2s+ worth of packets that have at least 2 axis deltas of ++ * only 1px, that's a good indication that we're spewing packets. ++ * We're going to ignore z=15, though; that's pretty indicative of ++ * an actual finger on the touchpad just staying still. ++ */ ++ if (p->z == 0 || p->z == 15) ++ goto next_hack; ++ repeat_axes = abs(p->x - dev->abs[ABS_X]) < 2 ? 1 : 0; ++ repeat_axes += abs(p->y - dev->abs[ABS_Y]) < 2 ? 1 : 0; ++ repeat_axes += abs(p->z - dev->abs[ABS_PRESSURE]) < 2 ? 1 : 0; ++ if (repeat_axes > 1) { ++ priv->repeat_pkts++; ++ /* we get 1 packet about every 24mS */ ++ if (priv->repeat_pkts > 83) { ++ queue_delayed_work(kpsmoused_wq, &priv->recalib_wq, 0); ++ priv->repeat_pkts = 0; ++ } ++ } ++ else ++ priv->repeat_pkts = 0; ++ return; ++ ++next_hack: ++ /* ++ * 10s of y and z not changing is another kind of miscalibration. ++ */ ++ repeat_axes = (p->y == dev->abs[ABS_Y]) ? 1 : 0; ++ repeat_axes += (p->z == dev->abs[ABS_PRESSURE]) ? 1 : 0; ++ if (repeat_axes > 1) { ++ priv->repeat_pkts++; ++ if (priv->repeat_pkts > 416) { ++ queue_delayed_work(kpsmoused_wq, &priv->recalib_wq, 0); ++ priv->repeat_pkts = 0; ++ } ++ } ++ else ++ priv->repeat_pkts = 0; ++} ++ ++/* ++ * HGPK Advanced Mode - single-mode format ++ * ++ * byte 0(PT): 1 1 0 0 1 1 1 1 ++ * byte 0(GS): 1 1 1 1 1 1 1 1 ++ * byte 1: 0 x6 x5 x4 x3 x2 x1 x0 ++ * byte 2(PT): 0 0 x9 x8 x7 ? pt-dsw 0 ++ * byte 2(GS): 0 x10 x9 x8 x7 ? gs-dsw pt-dsw ++ * byte 3: 0 y9 y8 y7 1 0 swr swl ++ * byte 4: 0 y6 y5 y4 y3 y2 y1 y0 ++ * byte 5: 0 z6 z5 z4 z3 z2 z1 z0 ++ * ++ * ?'s are not defined in the protocol spec, may vary between models. ++ * ++ * swr/swl are the left/right buttons. ++ * ++ * pt-dsw/gs-dsw indicate that the pt/gs sensor is detecting a ++ * pen/finger ++ */ ++ ++static int hgpk_validate_byte(unsigned char *packet, int pktcnt) ++{ ++ BUG_ON(pktcnt < 1); ++ ++ if (packet[0] != HGPK_PT && packet[0] != HGPK_GS) ++ return -1; ++ ++ /* bytes 2 - 6 should have 0 in the highest bit */ ++ if (pktcnt >= 2 && pktcnt <= 6 && (packet[pktcnt - 1] & 0x80)) ++ return -1; ++ ++ return 0; ++} ++ ++static void hgpk_decode_packet(struct psmouse *psmouse, struct hgpk_packet *p) ++{ ++ unsigned char *packet = psmouse->packet; ++ ++ BUG_ON(psmouse->pktcnt < 6); ++ ++ p->left = packet[3] & 1; ++ p->right = !!(packet[3] & 2); ++ p->x = packet[1] | ((packet[2] & 0x78) << 4); ++ p->y = packet[4] | ((packet[3] & 0x70) << 3); ++ p->z = packet[5]; ++ ++ if (packet[0] == HGPK_GS) { ++ p->pt_down = !!(packet[2] & 1); ++ p->gs_down = !!(packet[2] & 2); ++ p->dev = ((struct hgpk_data *) psmouse->private)->gs; ++ if (p->pt_down) { ++ /* we miss spurious PT finger-downs if pt_down is set */ ++ p->mode_switch = HGPK_PT; ++ p->pt_down = 0; ++ } else { ++ p->mode_switch = 0; ++ } ++ } else if (packet[0] == HGPK_PT) { ++ p->pt_down = !!(packet[2] & 2); ++ p->gs_down = 0; ++ p->dev = psmouse->dev; ++ p->mode_switch = !p->pt_down ? HGPK_GS : 0; ++ } ++ ++ if (tpdebug) { ++ hgpk_dbg(psmouse, "l=%d r=%d p=%d g=%d x=%d y=%d z=%d m=%x\n", ++ p->left, p->right, p->pt_down, p->gs_down, ++ p->x, p->y, p->z, p->mode_switch); ++ } ++} ++ ++static void hgpk_process_packet_gspt(struct psmouse *psmouse) ++{ ++ struct hgpk_data *priv = psmouse->private; ++ struct input_dev *pt = psmouse->dev; ++ struct input_dev *gs = priv->gs; ++ struct hgpk_packet pkt; ++ ++ hgpk_decode_packet(psmouse, &pkt); ++ ++ hgpk_fingerup_hack(psmouse, &pkt); ++ hgpk_fingerdown_hack(psmouse, &pkt); ++ hgpk_big_delta_hack(psmouse, &pkt); ++ hgpk_spewing_hack(psmouse, &pkt); ++ ++ input_report_key(pt, BTN_LEFT, pkt.left); ++ input_report_key(pt, BTN_RIGHT, pkt.right); ++ input_report_key(pt, BTN_TOUCH, pkt.pt_down); ++ ++ input_report_key(gs, BTN_LEFT, pkt.left); ++ input_report_key(gs, BTN_RIGHT, pkt.right); ++ input_report_key(gs, BTN_TOUCH, pkt.gs_down); ++ ++ input_report_abs(pkt.dev, ABS_X, pkt.x); ++ input_report_abs(pkt.dev, ABS_Y, pkt.y); ++ input_report_abs(pkt.dev, ABS_PRESSURE, pkt.z); ++ ++ input_sync(pt); ++ input_sync(gs); ++ ++ if (priv->recalib_window) { ++ if (time_before(jiffies, priv->recalib_window)) { ++ /* ++ * ugh, got a packet inside our recalibration ++ * window, schedule another recalibration. ++ */ ++ hgpk_dbg(psmouse, "packet inside calibration window, " ++ "queueing another recalibration\n"); ++ queue_delayed_work(kpsmoused_wq, &priv->recalib_wq, ++ msecs_to_jiffies(1000)); ++ } ++ priv->recalib_window = 0; ++ } ++ ++ if (psmouse->model != HGPK_MODEL_A) { ++ if (priv->pending_mode && (!pkt.mode_switch || ++ priv->current_mode == pkt.mode_switch)) { ++ priv->pending_mode = 0; ++ cancel_delayed_work(&priv->switch_wq); ++ } ++ else if (priv->pending_mode != pkt.mode_switch) { ++ priv->pending_mode = pkt.mode_switch; ++ ++ /* allow for spurious mode_switch packets by delaying */ ++ queue_delayed_work(kpsmoused_wq, &priv->switch_wq, ++ msecs_to_jiffies(50)); ++ } ++ } ++} ++ ++static psmouse_ret_t hgpk_process_byte(struct psmouse *psmouse) ++{ ++ if (hgpk_validate_byte(psmouse->packet, psmouse->pktcnt)) { ++ hgpk_dbg(psmouse, "%s: (%d) %02x %02x %02x %02x %02x %02x\n", ++ __func__, psmouse->pktcnt, psmouse->packet[0], ++ psmouse->packet[1], psmouse->packet[2], ++ psmouse->packet[3], psmouse->packet[4], ++ psmouse->packet[5]); ++ return PSMOUSE_BAD_DATA; ++ } ++ ++ if (psmouse->pktcnt == 6) { ++ hgpk_process_packet_gspt(psmouse); ++ return PSMOUSE_FULL_PACKET; ++ } ++ ++ return PSMOUSE_GOOD_DATA; ++} ++ ++static int hgpk_force_recalibrate(struct psmouse *psmouse) ++{ ++ struct ps2dev *ps2dev = &psmouse->ps2dev; ++ struct hgpk_data *priv = psmouse->private; ++ struct input_dev *pt = psmouse->dev; ++ struct input_dev *gs = priv->gs; ++ ++ /* C-series touchpads added the recalibrate command */ ++ if (psmouse->model < HGPK_MODEL_C) ++ return 0; ++ ++ if (ps2_command(ps2dev, NULL, 0xf5) || ++ ps2_command(ps2dev, NULL, 0xf5) || ++ ps2_command(ps2dev, NULL, 0xe6) || ++ ps2_command(ps2dev, NULL, 0xf5)) ++ return -1; ++ ++ /* send a finger-up event so the cursor doesn't jump around */ ++ input_report_key(pt, BTN_TOUCH, 0); ++ input_report_key(gs, BTN_TOUCH, 0); ++ input_sync(pt); ++ input_sync(gs); ++ ++ /* according to ALPS, 150mS is required for recalibration */ ++ msleep(150); ++ ++ /* ++ * XXX: If a finger is down during this delay, recalibration will ++ * detect capacitance incorrectly. This is a hardware bug, and ++ * we may need to work around that here. ++ */ ++ ++ if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE)) ++ return -1; ++ ++ /* ++ * After we recalibrate, we shouldn't get any packets for 2s. If ++ * we do, it's likely that someone's finger was on the touchpad. ++ * If someone's finger *was* on the touchpad, it's probably ++ * miscalibrated. So, we should schedule another recalibration ++ */ ++ priv->recalib_window = jiffies + msecs_to_jiffies(2000); ++ ++ return 0; ++} ++ ++static enum hgpk_model_t hgpk_get_model(struct psmouse *psmouse) ++{ ++ struct ps2dev *ps2dev = &psmouse->ps2dev; ++ unsigned char param[3]; ++ ++ /* E7, E7, E7, E9 gets us a 3 byte identifier */ ++ if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE21) || ++ ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE21) || ++ ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE21) || ++ ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) ++ return -EIO; ++ ++ hgpk_dbg(psmouse, "ID: %02x %02x %02x", param[0], param[1], param[2]); ++ ++ /* HGPK signature: 0x67, 0x00, 0x */ ++ if (param[0] != 0x67 || param[1] != 0x00) ++ return -ENODEV; ++ ++ hgpk_info(psmouse, "OLPC touchpad revision 0x%x\n", param[2]); ++ return param[2]; ++} ++ ++/* ++ * Touchpad should be disabled before calling this! ++ */ ++static int hgpk_new_mode(struct psmouse *psmouse, int mode) ++{ ++ struct ps2dev *ps2dev = &psmouse->ps2dev; ++ struct hgpk_data *priv = psmouse->private; ++ ++ /* ++ * PT mode: F2, F2, F2, E7 ++ * GS mode: F2, F2, F2, E6 ++ */ ++ if (ps2_command(ps2dev, NULL, 0xF2) || ++ ps2_command(ps2dev, NULL, 0xF2) || ++ ps2_command(ps2dev, NULL, 0xF2)) ++ return -EIO; ++ ++ if (mode == HGPK_GS) { ++ if (ps2_command(ps2dev, NULL, 0xE6)) ++ return -EIO; ++ } else { ++ if (ps2_command(ps2dev, NULL, 0xE7)) ++ return -EIO; ++ } ++ ++ if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE)) ++ return -EIO; ++ ++ /* tell the irq handler to stop ignoring packets */ ++ psmouse_set_state(psmouse, PSMOUSE_ACTIVATED); ++ ++ priv->current_mode = mode; ++ priv->pending_mode = 0; ++ if (tpdebug) ++ hgpk_warn(psmouse, "Switched to mode 0x%x successful.\n", mode); ++ ++ return 0; ++} ++ ++static int hgpk_advanced_mode(struct psmouse *psmouse) ++{ ++ struct ps2dev *ps2dev = &psmouse->ps2dev; ++ ++ /* Switch to 'Advanced mode.', four disables in a row. */ ++ if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE) || ++ ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE) || ++ ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE) || ++ ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE)) ++ return -1; ++ ++ return hgpk_new_mode(psmouse, HGPK_GS); ++} ++ ++/* ++ * This kills power to the touchpad; according to ALPS, current consumption ++ * goes down to 50uA after running this. To turn power back on, we drive ++ * MS-DAT low. ++ */ ++static int hgpk_toggle_power(struct psmouse *psmouse, int enable) ++{ ++ struct ps2dev *ps2dev = &psmouse->ps2dev; ++ int timeo; ++ ++ /* Added on D-series touchpads */ ++ if (psmouse->model < HGPK_MODEL_D) ++ return 0; ++ ++ if (enable) { ++ psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); ++ ++ /* ++ * Sending a byte will drive MS-DAT low; this will wake up ++ * the controller. Once we get an ACK back from it, it ++ * means we can continue with the touchpad re-init. ALPS ++ * tells us that 1s should be long enough, so set that as ++ * the upper bound. ++ */ ++ for (timeo = 20; timeo > 0; timeo--) { ++ if (!ps2_sendbyte(&psmouse->ps2dev, ++ PSMOUSE_CMD_DISABLE, 20)) ++ break; ++ msleep(50); ++ } ++ ++ psmouse_reset(psmouse); ++ ++ if (hgpk_advanced_mode(psmouse)) { ++ hgpk_err(psmouse, "Failed to reinit touchpad!\n"); ++ return -1; ++ } ++ } else { ++ hgpk_dbg(psmouse, "Powering off touchpad.\n"); ++ psmouse_set_state(psmouse, PSMOUSE_IGNORE); ++ ++ if (ps2_command(ps2dev, NULL, 0xec) || ++ ps2_command(ps2dev, NULL, 0xec) || ++ ps2_command(ps2dev, NULL, 0xea)) ++ return -1; ++ /* probably won't see an ACK, the touchpad will be off */ ++ ps2_sendbyte(&psmouse->ps2dev, 0xec, 20); ++ } ++ ++ return 0; ++} ++ ++/* ++ * poll the touchpad for current motion packet. ++ * Used in resync. ++ * Note: We can't poll, so always return failure. ++ */ ++static int hgpk_poll(struct psmouse *psmouse) ++{ ++ return -1; ++} ++ ++static int hgpk_reconnect(struct psmouse *psmouse) ++{ ++ if (olpc_board_at_least(olpc_board(0xb2))) ++ if (psmouse->ps2dev.serio->dev.power.power_state.event != PM_EVENT_ON) ++ return 0; ++ ++ psmouse_reset(psmouse); ++ ++ if (hgpk_advanced_mode(psmouse)) { ++ hgpk_err(psmouse, "failed to reenable advanced mode.\n"); ++ return -1; ++ } ++ ++ return 0; ++} ++ ++static ssize_t hgpk_show_powered(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ struct serio *serio = to_serio_port(dev); ++ struct psmouse *psmouse; ++ struct hgpk_data *priv; ++ int retval; ++ ++ retval = serio_pin_driver(serio); ++ if (retval) ++ return retval; ++ ++ psmouse = serio_get_drvdata(serio); ++ priv = psmouse->private; ++ ++ retval = sprintf(buf, "%d\n", priv->powered); ++ serio_unpin_driver(serio); ++ return retval; ++} ++ ++static ssize_t hgpk_set_powered(struct device *dev, ++ struct device_attribute *attr, const char *buf, size_t count) ++{ ++ struct serio *serio = to_serio_port(dev); ++ struct psmouse *psmouse; ++ struct hgpk_data *priv; ++ unsigned long val; ++ int retval; ++ ++ if (*buf == '1') ++ val = 1; ++ else if (*buf == '0') ++ val = 0; ++ else ++ return -EINVAL; ++ ++ retval = serio_pin_driver(serio); ++ if (retval) ++ return retval; ++ ++/* ++ * FUCK IT. I don't fucking care. locking in psmouse is fucking retarded! ++ retval = mutex_lock_interruptible(&psmouse_mutex); ++ if (retval) ++ goto out_unpin; ++*/ ++ ++ psmouse = serio_get_drvdata(serio); ++ priv = psmouse->private; ++ ++ if (val == priv->powered) ++ goto done; ++ ++ retval = hgpk_toggle_power(psmouse, val); ++ if (!retval) ++ priv->powered = val; ++ ++done: ++ serio_unpin_driver(serio); ++ return retval ? retval : count; ++} ++ ++static DEVICE_ATTR(powered, S_IWUSR | S_IRUGO, hgpk_show_powered, ++ hgpk_set_powered); ++ ++static void hgpk_disconnect(struct psmouse *psmouse) ++{ ++ struct hgpk_data *priv = psmouse->private; ++ ++ device_remove_file(&psmouse->ps2dev.serio->dev, &dev_attr_powered); ++ psmouse_reset(psmouse); ++ flush_scheduled_work(); ++ input_unregister_device(priv->gs); ++ kfree(priv); ++} ++ ++static void hgpk_mode_switch(struct work_struct *work) ++{ ++ struct delayed_work *w = container_of(work, struct delayed_work, work); ++ struct hgpk_data *priv = container_of(w, struct hgpk_data, switch_wq); ++ struct psmouse *psmouse = priv->psmouse; ++ struct ps2dev *ps2dev = &psmouse->ps2dev; ++ int pending_mode; ++ ++ if (tpdebug) ++ hgpk_dbg(psmouse, "Starting mode switch to 0x%x. [%lu]\n", ++ priv->pending_mode, jiffies); ++ ++ if (priv->pending_mode == priv->current_mode) { ++ priv->pending_mode = 0; ++ hgpk_dbg(psmouse, "Already in target mode, no-op.\n"); ++ return; ++ } ++ ++ /* tell the irq handler to ignore any further packets */ ++ psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); ++ priv->late = 0; ++ ++ if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE)) ++ goto bad; ++ ++ /* ++ * ALPS tells us that it may take up to 20msec for the disable to ++ * take effect; however, ps2_command() will wait up to 200msec for ++ * the ACK to come back (and I'm assuming that by the time the ++ * hardware sends back its ACK, it has stopped sending bytes). ++ */ ++ pending_mode = priv->pending_mode; ++ ++ if (hgpk_new_mode(psmouse, priv->pending_mode)) ++ goto bad; ++ ++ /* ++ * Deal with a potential race condition. ++ * ++ * If there is a brief tap of a stylus or a fingernail that ++ * triggers a mode switch to PT mode, and the stylus/fingernail is ++ * lifted after the DISABLE above, but before we reenable in the ++ * new mode then we can get stuck in PT mode. ++ */ ++ if (pending_mode == HGPK_PT) { ++ priv->pending_mode = HGPK_GS; ++ queue_delayed_work(kpsmoused_wq, &priv->switch_wq, ++ msecs_to_jiffies(50)); ++ } ++ ++ return; ++bad: ++ hgpk_warn(psmouse, "Failure to switch modes, resetting device...\n"); ++ hgpk_reconnect(psmouse); ++} ++ ++static void hgpk_recalib_work(struct work_struct *work) ++{ ++ struct delayed_work *w = container_of(work, struct delayed_work, work); ++ struct hgpk_data *priv = container_of(w, struct hgpk_data, recalib_wq); ++ struct psmouse *psmouse = priv->psmouse; ++ ++ if (tpdebug) ++ hgpk_dbg(psmouse, "Recalibrating touchpad..\n"); ++ ++ if (hgpk_force_recalibrate(psmouse)) ++ hgpk_err(psmouse, "Recalibration failed!\n"); ++} ++ ++int olpc_init(struct psmouse *psmouse) ++{ ++ struct hgpk_data *priv; ++ struct input_dev *pt = psmouse->dev; ++ struct input_dev *gs; ++ ++ priv = kzalloc(sizeof(struct hgpk_data), GFP_KERNEL); ++ gs = input_allocate_device(); ++ if (!priv || !gs) ++ goto init_fail; ++ ++ psmouse->private = priv; ++ priv->gs = gs; ++ priv->psmouse = psmouse; ++ priv->powered = 1; ++ ++ psmouse_reset(psmouse); ++ ++ if (hgpk_advanced_mode(psmouse)) { ++ hgpk_err(psmouse, "failed to enable advanced mode\n"); ++ goto init_fail; ++ } ++ ++ /* Unset things that psmouse-base sets that we don't have */ ++ pt->evbit[0] &= ~BIT(EV_REL); ++ pt->keybit[LONG(BTN_MOUSE)] &= ~BIT(BTN_MIDDLE); ++ pt->relbit[0] &= ~(BIT(REL_X) | BIT(REL_Y)); ++ ++ /* Set all the things we *do* have */ ++ set_bit(EV_KEY, pt->evbit); ++ set_bit(EV_ABS, pt->evbit); ++ ++ set_bit(BTN_LEFT, pt->keybit); ++ set_bit(BTN_RIGHT, pt->keybit); ++ set_bit(BTN_TOUCH, pt->keybit); ++ ++ input_set_abs_params(pt, ABS_X, 2, 1000, 0, 0); ++ input_set_abs_params(pt, ABS_Y, 0, 717, 0, 0); ++ input_set_abs_params(pt, ABS_PRESSURE, 0, 127, 0, 0); ++ ++ snprintf(priv->phys, sizeof(priv->phys), ++ "%s/input1", psmouse->ps2dev.serio->phys); ++ gs->phys = priv->phys; ++ gs->name = "OLPC ALPS GlideSensor"; ++ gs->id.bustype = BUS_I8042; ++ gs->id.vendor = 0x0002; ++ gs->id.product = PSMOUSE_OLPC; ++ gs->id.version = psmouse->model; ++ ++ set_bit(EV_KEY, gs->evbit); ++ set_bit(EV_ABS, gs->evbit); ++ ++ set_bit(BTN_LEFT, gs->keybit); ++ set_bit(BTN_RIGHT, gs->keybit); ++ set_bit(BTN_TOUCH, gs->keybit); ++ ++ input_set_abs_params(gs, ABS_X, 350, 512, 0, 0); ++ input_set_abs_params(gs, ABS_Y, 70, 325, 0, 0); ++ input_set_abs_params(gs, ABS_PRESSURE, 0, 15, 0, 0); ++ ++ if (input_register_device(gs)) { ++ hgpk_err(psmouse, "Failed to register GlideSensor\n"); ++ goto init_fail; ++ } ++ ++ psmouse->protocol_handler = hgpk_process_byte; ++ psmouse->poll = hgpk_poll; ++ psmouse->disconnect = hgpk_disconnect; ++ psmouse->reconnect = hgpk_reconnect; ++ psmouse->pktsize = 6; ++ ++ /* Disable the idle resync. */ ++ psmouse->resync_time = 0; ++ /* Reset after a lot of bad bytes. */ ++ psmouse->resetafter = 1024; ++ ++ INIT_DELAYED_WORK(&priv->switch_wq, hgpk_mode_switch); ++ INIT_DELAYED_WORK(&priv->recalib_wq, hgpk_recalib_work); ++ ++ if (device_create_file(&psmouse->ps2dev.serio->dev, ++ &dev_attr_powered)) { ++ hgpk_err(psmouse, "Failed to create sysfs attribute\n"); ++ goto attr_fail; ++ } ++ ++ ++ return 0; ++ ++attr_fail: ++ input_unregister_device(gs); ++ gs = NULL; ++init_fail: ++ input_free_device(gs); ++ kfree(priv); ++ return -1; ++} ++ ++int olpc_detect(struct psmouse *psmouse, int set_properties) ++{ ++ int version; ++ ++ version = hgpk_get_model(psmouse); ++ if (version < 0) ++ return version; ++ ++ if (set_properties) { ++ psmouse->vendor = "ALPS"; ++ psmouse->name = "PenTablet"; ++ psmouse->model = version; ++ } ++ return 0; ++} +diff -purN linux_2.6.24_org/drivers/input/mouse/olpc.h linux_2.6.24_olpc/drivers/input/mouse/olpc.h +--- linux_2.6.24_org/drivers/input/mouse/olpc.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/drivers/input/mouse/olpc.h 2008-02-15 18:59:14.000000000 +0000 +@@ -0,0 +1,78 @@ ++/* ++ * OLPC touchpad PS/2 mouse driver ++ * ++ * Copyright (c) 2006 One Laptop Per Child, inc. ++ * ++ * This driver is partly based on the ALPS driver. ++ * Copyright (c) 2003 Peter Osterlund ++ * Copyright (c) 2005 Vojtech Pavlik ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published by ++ * the Free Software Foundation. ++ */ ++ ++#ifndef _OLPC_H ++#define _OLPC_H ++ ++enum hgpk_model_t { ++ HGPK_MODEL_PreA = 0x0a, /* pre-B1s */ ++ HGPK_MODEL_A = 0x14, /* found on B1s, PT disabled in hardware */ ++ HGPK_MODEL_B = 0x28, /* B2s, has capacitance issues */ ++ HGPK_MODEL_C = 0x3c, ++ HGPK_MODEL_D = 0x50, /* C1, mass production */ ++}; ++ ++#define HGPK_GS 0xff /* The GlideSensor */ ++#define HGPK_PT 0xcf /* The PenTablet */ ++ ++struct hgpk_packet { ++ struct input_dev *dev; ++ int x, y, z; ++ unsigned char mode_switch; ++ unsigned int pt_down:1, gs_down:1; ++ unsigned int left:1, right:1; ++}; ++ ++struct hgpk_data { ++ struct input_dev *gs; /* GlideSensor */ ++ struct psmouse *psmouse; ++ char name[32]; /* Name */ ++ char phys[32]; /* Phys */ ++ int pending_mode; ++ int current_mode; ++ s64 late; ++ int axis_errors; ++ int repeat_pkts; ++ int powered; ++ unsigned long recalib_window; ++ struct delayed_work switch_wq; ++ struct delayed_work recalib_wq; ++}; ++ ++#define hgpk_dbg(psmouse, format, arg...) \ ++ dev_dbg(&(psmouse)->ps2dev.serio->dev, format, ## arg) ++#define hgpk_err(psmouse, format, arg...) \ ++ dev_err(&(psmouse)->ps2dev.serio->dev, format, ## arg) ++#define hgpk_info(psmouse, format, arg...) \ ++ dev_info(&(psmouse)->ps2dev.serio->dev, format, ## arg) ++#define hgpk_warn(psmouse, format, arg...) \ ++ dev_warn(&(psmouse)->ps2dev.serio->dev, format, ## arg) ++#define hgpk_notice(psmouse, format, arg...) \ ++ dev_notice(&(psmouse)->ps2dev.serio->dev, format, ## arg) ++ ++#ifdef CONFIG_MOUSE_PS2_OLPC ++int olpc_detect(struct psmouse *psmouse, int set_properties); ++int olpc_init(struct psmouse *psmouse); ++#else ++inline int olpc_detect(struct psmouse *psmouse, int set_properties) ++{ ++ return -ENOSYS; ++} ++inline int olpc_init(struct psmouse *psmouse) ++{ ++ return -ENOSYS; ++} ++#endif ++ ++#endif +diff -purN linux_2.6.24_org/drivers/input/mouse/psmouse-base.c linux_2.6.24_olpc/drivers/input/mouse/psmouse-base.c +--- linux_2.6.24_org/drivers/input/mouse/psmouse-base.c 2008-02-15 20:11:51.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/input/mouse/psmouse-base.c 2008-02-15 18:59:14.000000000 +0000 +@@ -26,6 +26,7 @@ + #include "synaptics.h" + #include "logips2pp.h" + #include "alps.h" ++#include "olpc.h" + #include "lifebook.h" + #include "trackpoint.h" + #include "touchkit_ps2.h" +@@ -103,7 +104,7 @@ static struct attribute_group psmouse_at + */ + static DEFINE_MUTEX(psmouse_mutex); + +-static struct workqueue_struct *kpsmoused_wq; ++struct workqueue_struct *kpsmoused_wq; + + struct psmouse_protocol { + enum psmouse_type type; +@@ -221,7 +222,7 @@ static inline void __psmouse_set_state(s + * is not a concern. + */ + +-static void psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state) ++void psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state) + { + serio_pause_rx(psmouse->ps2dev.serio); + __psmouse_set_state(psmouse, new_state); +@@ -320,7 +321,7 @@ static irqreturn_t psmouse_interrupt(str + goto out; + } + +- if (psmouse->packet[1] == PSMOUSE_RET_ID) { ++ if (psmouse->packet[1] == PSMOUSE_RET_ID || psmouse->packet[1] == PSMOUSE_RET_BAT) { + __psmouse_set_state(psmouse, PSMOUSE_IGNORE); + serio_reconnect(serio); + goto out; +@@ -631,8 +632,21 @@ static int psmouse_extensions(struct psm + } + } + ++/* ++ * Try OLPC touchpad. ++ */ + if (max_proto > PSMOUSE_IMEX) { ++ if (olpc_detect(psmouse, set_properties) == 0) { ++ if (!set_properties || olpc_init(psmouse) == 0) ++ return PSMOUSE_OLPC; ++/* ++ * Init failed, try basic relative protocols ++ */ ++ max_proto = PSMOUSE_IMEX; ++ } ++ } + ++ if (max_proto > PSMOUSE_IMEX) { + if (genius_detect(psmouse, set_properties) == 0) + return PSMOUSE_GENPS; + +@@ -763,6 +777,14 @@ static const struct psmouse_protocol psm + .detect = touchkit_ps2_detect, + }, + #endif ++#ifdef CONFIG_MOUSE_PS2_OLPC ++ { ++ .type = PSMOUSE_OLPC, ++ .name = "OLPC", ++ .alias = "olpc", ++ .detect = olpc_detect, ++ }, ++#endif + { + .type = PSMOUSE_CORTRON, + .name = "CortronPS/2", +diff -purN linux_2.6.24_org/drivers/input/mouse/psmouse.h linux_2.6.24_olpc/drivers/input/mouse/psmouse.h +--- linux_2.6.24_org/drivers/input/mouse/psmouse.h 2008-02-15 20:11:51.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/input/mouse/psmouse.h 2008-02-15 18:59:14.000000000 +0000 +@@ -88,6 +88,7 @@ enum psmouse_type { + PSMOUSE_LIFEBOOK, + PSMOUSE_TRACKPOINT, + PSMOUSE_TOUCHKIT_PS2, ++ PSMOUSE_OLPC, + PSMOUSE_CORTRON, + PSMOUSE_AUTO /* This one should always be last */ + }; +@@ -95,7 +96,9 @@ enum psmouse_type { + int psmouse_sliced_command(struct psmouse *psmouse, unsigned char command); + int psmouse_reset(struct psmouse *psmouse); + void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution); ++void psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state); + ++extern struct workqueue_struct *kpsmoused_wq; + + struct psmouse_attribute { + struct device_attribute dattr; +diff -purN linux_2.6.24_org/drivers/input/serio/i8042.c linux_2.6.24_olpc/drivers/input/serio/i8042.c +--- linux_2.6.24_org/drivers/input/serio/i8042.c 2008-02-15 20:11:51.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/input/serio/i8042.c 2008-02-15 18:59:14.000000000 +0000 +@@ -874,6 +874,11 @@ static long i8042_panic_blink(long count + #undef DELAY + + #ifdef CONFIG_PM ++ ++#ifdef CONFIG_OLPC ++#include ++#endif ++ + /* + * Here we try to restore the original BIOS settings. We only want to + * do that once, when we really suspend, not when we taking memory +@@ -884,8 +889,15 @@ static long i8042_panic_blink(long count + static int i8042_suspend(struct platform_device *dev, pm_message_t state) + { + if (dev->dev.power.power_state.event != state.event) { ++#ifdef CONFIG_OLPC ++ /* Anything newer than B2 remains powered; no reset needed */ ++ if (!olpc_board_at_least(olpc_board_pre(0xb3))) { ++#endif + if (state.event == PM_EVENT_SUSPEND) + i8042_controller_reset(); ++#ifdef CONFIG_OLPC ++ } ++#endif + + dev->dev.power.power_state = state; + } +@@ -908,9 +920,15 @@ static int i8042_resume(struct platform_ + if (dev->dev.power.power_state.event == PM_EVENT_ON) + return 0; + ++#ifdef CONFIG_OLPC ++ if (!olpc_board_at_least(olpc_board_pre(0xb3))) { ++#endif + error = i8042_controller_check(); + if (error) + return error; ++#ifdef CONFIG_OLPC ++ } ++#endif + + error = i8042_controller_selftest(); + if (error) +diff -purN linux_2.6.24_org/drivers/input/serio/serio.c linux_2.6.24_olpc/drivers/input/serio/serio.c +--- linux_2.6.24_org/drivers/input/serio/serio.c 2008-02-15 20:11:51.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/input/serio/serio.c 2008-02-15 18:59:14.000000000 +0000 +@@ -910,11 +910,22 @@ static int serio_uevent(struct device *d + #endif /* CONFIG_HOTPLUG */ + + #ifdef CONFIG_PM ++ ++#ifdef CONFIG_OLPC ++#include ++#endif ++ + static int serio_suspend(struct device *dev, pm_message_t state) + { + if (dev->power.power_state.event != state.event) { ++#ifdef CONFIG_OLPC ++ if (!olpc_board_at_least(olpc_board_pre(0xb3))) { ++#endif + if (state.event == PM_EVENT_SUSPEND) + serio_cleanup(to_serio_port(dev)); ++#ifdef CONFIG_OLPC ++ } ++#endif + + dev->power.power_state = state; + } +diff -purN linux_2.6.24_org/drivers/Kconfig linux_2.6.24_olpc/drivers/Kconfig +--- linux_2.6.24_org/drivers/Kconfig 2008-02-15 20:11:21.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/Kconfig 2008-02-15 18:58:34.000000000 +0000 +@@ -94,6 +94,8 @@ source "drivers/auxdisplay/Kconfig" + + source "drivers/kvm/Kconfig" + ++source "drivers/sysprof/Kconfig" ++ + source "drivers/uio/Kconfig" + + source "drivers/virtio/Kconfig" +diff -purN linux_2.6.24_org/drivers/Makefile linux_2.6.24_olpc/drivers/Makefile +--- linux_2.6.24_org/drivers/Makefile 2008-02-15 20:11:24.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/Makefile 2008-02-15 18:58:43.000000000 +0000 +@@ -23,6 +23,8 @@ obj-y += char/ + + obj-$(CONFIG_CONNECTOR) += connector/ + ++obj-$(CONFIG_SYSPROF) += sysprof/ ++ + # i810fb and intelfb depend on char/agp/ + obj-$(CONFIG_FB_I810) += video/i810/ + obj-$(CONFIG_FB_INTEL) += video/intelfb/ +diff -purN linux_2.6.24_org/drivers/media/video/cafe_ccic.c linux_2.6.24_olpc/drivers/media/video/cafe_ccic.c +--- linux_2.6.24_org/drivers/media/video/cafe_ccic.c 2008-02-15 20:11:25.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/media/video/cafe_ccic.c 2008-02-15 18:58:44.000000000 +0000 +@@ -372,6 +372,10 @@ static int cafe_smbus_write_data(struct + rval = value | ((command << TWSIC1_ADDR_SHIFT) & TWSIC1_ADDR); + cafe_reg_write(cam, REG_TWSIC1, rval); + spin_unlock_irqrestore(&cam->dev_lock, flags); ++ mdelay(2); /* It'll probably take about 900µs anyway, and the ++ CAFÉ is apparently quite sensitive to being poked ++ at this point. If we can work out precisely what's ++ going on and reduce this delay, it would be nice. */ + + /* + * Time to wait for the write to complete. THIS IS A RACY +@@ -907,8 +911,6 @@ static int cafe_cam_configure(struct caf + struct v4l2_format fmt; + int ret, zero = 0; + +- if (cam->state != S_IDLE) +- return -EINVAL; + fmt.fmt.pix = cam->pix_format; + ret = __cafe_cam_cmd(cam, VIDIOC_INT_INIT, &zero); + if (ret == 0) +@@ -2237,14 +2239,18 @@ static int cafe_pci_suspend(struct pci_d + int ret; + enum cafe_state cstate; + ++ mutex_lock(&cam->s_mutex); + ret = pci_save_state(pdev); +- if (ret) ++ if (ret) { ++ cam_warn(cam, "Unable to save PCI state\n"); + return ret; ++ } + cstate = cam->state; /* HACK - stop_dma sets to idle */ + cafe_ctlr_stop_dma(cam); + cafe_ctlr_power_down(cam); + pci_disable_device(pdev); + cam->state = cstate; ++ /* hold mutex until restore */ + return 0; + } + +@@ -2263,16 +2269,18 @@ static int cafe_pci_resume(struct pci_de + cam_warn(cam, "Unable to re-enable device on resume!\n"); + return ret; + } ++ /* we're still holding mutex from suspend */ + cafe_ctlr_init(cam); + cafe_ctlr_power_down(cam); + +- mutex_lock(&cam->s_mutex); +- if (cam->users > 0) { +- cafe_ctlr_power_up(cam); +- __cafe_cam_reset(cam); +- } +- mutex_unlock(&cam->s_mutex); +- ++ if (cam->users > 0) { ++ cafe_ctlr_power_up(cam); ++ __cafe_cam_reset(cam); ++ } ++ else ++ cafe_ctlr_power_down(cam); ++ mutex_unlock(&cam->s_mutex); ++ + set_bit(CF_CONFIG_NEEDED, &cam->flags); + if (cam->state == S_SPECREAD) + cam->state = S_IDLE; /* Don't bother restarting */ +diff -purN linux_2.6.24_org/drivers/misc/Kconfig linux_2.6.24_olpc/drivers/misc/Kconfig +--- linux_2.6.24_org/drivers/misc/Kconfig 2008-02-15 20:11:42.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/misc/Kconfig 2008-02-15 18:58:52.000000000 +0000 +@@ -219,6 +219,11 @@ config THINKPAD_ACPI_BAY + + If you are not sure, say Y here. + ++config EEPROM_93CX6 ++ tristate "EEPROM 93CX6 support" ++ ---help--- ++ This is a driver for the EEPROM chipsets 93c46 and 93c66. ++ The driver supports both read as well as write commands. + + config ATMEL_SSC + tristate "Device driver for Atmel SSC peripheral" +diff -purN linux_2.6.24_org/drivers/mmc/card/block.c linux_2.6.24_olpc/drivers/mmc/card/block.c +--- linux_2.6.24_org/drivers/mmc/card/block.c 2008-02-15 20:11:13.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/mmc/card/block.c 2008-02-15 18:58:17.000000000 +0000 +@@ -237,6 +237,13 @@ static int mmc_blk_issue_rq(struct mmc_q + if (brq.data.blocks > card->host->max_blk_count) + brq.data.blocks = card->host->max_blk_count; + ++ if (mmc_card_sd(card) && !card->host->ios.clock) { ++ printk(KERN_ERR "%s: I/O to stopped card\n", ++ req->rq_disk->disk_name); ++ goto cmd_err; ++ } ++ mmc_set_data_timeout(&brq.data, card); ++ + /* + * If the host doesn't support multiple block writes, force + * block writes to single block. SD cards are excepted from +diff -purN linux_2.6.24_org/drivers/mmc/host/sdhci.c linux_2.6.24_olpc/drivers/mmc/host/sdhci.c +--- linux_2.6.24_org/drivers/mmc/host/sdhci.c 2008-02-15 20:11:13.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/mmc/host/sdhci.c 2008-02-15 18:58:17.000000000 +0000 +@@ -441,6 +441,12 @@ static void sdhci_prepare_data(struct sd + break; + } + ++ /* ++ * There's an off-by-one error in the hw that we need to ++ * compensate for. ++ */ ++ count++; ++ + if (count >= 0xF) { + printk(KERN_WARNING "%s: Too large timeout requested!\n", + mmc_hostname(host->mmc)); +@@ -728,19 +734,17 @@ static void sdhci_set_power(struct sdhci + if (!(host->chip->quirks & SDHCI_QUIRK_SINGLE_POWER_WRITE)) + writeb(0, host->ioaddr + SDHCI_POWER_CONTROL); + +- pwr = SDHCI_POWER_ON; +- + switch (1 << power) { + case MMC_VDD_165_195: +- pwr |= SDHCI_POWER_180; ++ pwr = SDHCI_POWER_180; + break; + case MMC_VDD_29_30: + case MMC_VDD_30_31: +- pwr |= SDHCI_POWER_300; ++ pwr = SDHCI_POWER_300; + break; + case MMC_VDD_32_33: + case MMC_VDD_33_34: +- pwr |= SDHCI_POWER_330; ++ pwr = SDHCI_POWER_330; + break; + default: + BUG(); +@@ -748,6 +752,10 @@ static void sdhci_set_power(struct sdhci + + writeb(pwr, host->ioaddr + SDHCI_POWER_CONTROL); + ++ pwr |= SDHCI_POWER_ON; ++ ++ writeb(pwr, host->ioaddr + SDHCI_POWER_CONTROL); ++ + out: + host->power = power; + } +diff -purN linux_2.6.24_org/drivers/mtd/nand/cafe_nand.c linux_2.6.24_olpc/drivers/mtd/nand/cafe_nand.c +--- linux_2.6.24_org/drivers/mtd/nand/cafe_nand.c 2008-02-15 20:11:46.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/mtd/nand/cafe_nand.c 2008-02-15 18:58:57.000000000 +0000 +@@ -11,6 +11,7 @@ + #undef DEBUG + #include + #include ++#include + #include + #include + #include +@@ -52,6 +53,7 @@ + + struct cafe_priv { + struct nand_chip nand; ++ struct mtd_partition *parts; + struct pci_dev *pdev; + void __iomem *mmio; + struct rs_control *rs; +@@ -84,6 +86,10 @@ static unsigned int numtimings; + static int timing[3]; + module_param_array(timing, int, &numtimings, 0644); + ++#ifdef CONFIG_MTD_PARTITIONS ++static const char *part_probes[] = { "RedBoot", NULL }; ++#endif ++ + /* Hrm. Why isn't this already conditional on something in the struct device? */ + #define cafe_dev_dbg(dev, args...) do { if (debug) dev_dbg(dev, ##args); } while(0) + +@@ -620,7 +626,9 @@ static int __devinit cafe_nand_probe(str + { + struct mtd_info *mtd; + struct cafe_priv *cafe; ++ struct mtd_partition *parts; + uint32_t ctrl; ++ int nr_parts; + int err = 0; + + /* Very old versions shared the same PCI ident for all three +@@ -787,7 +795,18 @@ static int __devinit cafe_nand_probe(str + goto out_irq; + + pci_set_drvdata(pdev, mtd); ++ ++ /* We register the whole device first, separate from the partitions */ + add_mtd_device(mtd); ++ ++#ifdef CONFIG_MTD_PARTITIONS ++ nr_parts = parse_mtd_partitions(mtd, part_probes, &parts, 0); ++ if (nr_parts > 0) { ++ cafe->parts = parts; ++ dev_info(&cafe->pdev->dev, "%d RedBoot partitions found\n", nr_parts); ++ add_mtd_partitions(mtd, parts, nr_parts); ++ } ++#endif + goto out; + + out_irq: +diff -purN linux_2.6.24_org/drivers/mtd/redboot.c linux_2.6.24_olpc/drivers/mtd/redboot.c +--- linux_2.6.24_org/drivers/mtd/redboot.c 2008-02-15 20:11:46.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/mtd/redboot.c 2008-02-15 18:58:58.000000000 +0000 +@@ -59,16 +59,31 @@ static int parse_redboot_partitions(stru + static char nullstring[] = "unallocated"; + #endif + ++ if ( directory < 0 ) { ++ offset = master->size + directory * master->erasesize; ++ while (master->block_isbad && ++ master->block_isbad(master, offset)) { ++ if (!offset) { ++ nogood: ++ printk(KERN_NOTICE "Failed to find a non-bad block to check for RedBoot partition table\n"); ++ return -EIO; ++ } ++ offset -= master->erasesize; ++ } ++ } else { ++ offset = directory * master->erasesize; ++ while (master->block_isbad && ++ master->block_isbad(master, offset)) { ++ offset += master->erasesize; ++ if (offset == master->size) ++ goto nogood; ++ } ++ } + buf = vmalloc(master->erasesize); + + if (!buf) + return -ENOMEM; + +- if ( directory < 0 ) +- offset = master->size + directory*master->erasesize; +- else +- offset = directory*master->erasesize; +- + printk(KERN_NOTICE "Searching for RedBoot partition table in %s at offset 0x%lx\n", + master->name, offset); + +diff -purN linux_2.6.24_org/drivers/net/forcedeth.c linux_2.6.24_olpc/drivers/net/forcedeth.c +--- linux_2.6.24_org/drivers/net/forcedeth.c 2008-02-15 20:11:19.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/net/forcedeth.c 2008-02-15 18:58:33.000000000 +0000 +@@ -3559,11 +3559,13 @@ static int nv_request_irq(struct net_dev + } + if (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) { + if ((ret = pci_enable_msi(np->pci_dev)) == 0) { ++ pci_intx(np->pci_dev, 0); + np->msi_flags |= NV_MSI_ENABLED; + dev->irq = np->pci_dev->irq; + if (request_irq(np->pci_dev->irq, handler, IRQF_SHARED, dev->name, dev) != 0) { + printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret); + pci_disable_msi(np->pci_dev); ++ pci_intx(np->pci_dev, 1); + np->msi_flags &= ~NV_MSI_ENABLED; + dev->irq = np->pci_dev->irq; + goto out_err; +@@ -3606,6 +3608,7 @@ static void nv_free_irq(struct net_devic + free_irq(np->pci_dev->irq, dev); + if (np->msi_flags & NV_MSI_ENABLED) { + pci_disable_msi(np->pci_dev); ++ pci_intx(np->pci_dev, 1); + np->msi_flags &= ~NV_MSI_ENABLED; + } + } +diff -purN linux_2.6.24_org/drivers/pci/quirks.c linux_2.6.24_olpc/drivers/pci/quirks.c +--- linux_2.6.24_org/drivers/pci/quirks.c 2008-02-15 20:11:33.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/pci/quirks.c 2008-02-15 18:58:50.000000000 +0000 +@@ -1359,6 +1359,17 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x260b, quirk_intel_pcie_pm); + + /* ++ * According to Tom Sylla, the Geode does not support PCI power management ++ * transition, so we shouldn't need the D3hot delay. ++ */ ++static void __init quirk_geode_pci_pm(struct pci_dev *dev) ++{ ++ pci_pm_d3_delay = 0; ++} ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, quirk_geode_pci_pm); ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, quirk_geode_pci_pm); ++ ++/* + * Toshiba TC86C001 IDE controller reports the standard 8-byte BAR0 size + * but the PIO transfers won't work if BAR0 falls at the odd 8 bytes. + * Re-allocate the region if needed... +diff -purN linux_2.6.24_org/drivers/power/ds2760_battery.c linux_2.6.24_olpc/drivers/power/ds2760_battery.c +--- linux_2.6.24_org/drivers/power/ds2760_battery.c 2008-02-15 20:11:45.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/power/ds2760_battery.c 2008-02-15 18:58:56.000000000 +0000 +@@ -409,6 +409,7 @@ static int ds2760_battery_suspend(struct + struct ds2760_device_info *di = platform_get_drvdata(pdev); + + di->charge_status = POWER_SUPPLY_STATUS_UNKNOWN; ++ power_supply_changed(&di->bat); + + return 0; + } +diff -purN linux_2.6.24_org/drivers/power/olpc_battery.c linux_2.6.24_olpc/drivers/power/olpc_battery.c +--- linux_2.6.24_org/drivers/power/olpc_battery.c 2008-02-15 20:11:45.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/power/olpc_battery.c 2008-02-15 18:58:56.000000000 +0000 +@@ -14,12 +14,13 @@ + #include + #include + #include ++#include + #include + + + #define EC_BAT_VOLTAGE 0x10 /* uint16_t, *9.76/32, mV */ + #define EC_BAT_CURRENT 0x11 /* int16_t, *15.625/120, mA */ +-#define EC_BAT_ACR 0x12 ++#define EC_BAT_ACR 0x12 /* int16_t *416.667 µAh */ + #define EC_BAT_TEMP 0x13 /* uint16_t, *100/256, °C */ + #define EC_AMB_TEMP 0x14 /* uint16_t, *100/256, °C */ + #define EC_BAT_STATUS 0x15 /* uint8_t, bitmask */ +@@ -84,6 +85,8 @@ static struct power_supply olpc_ac = { + .get_property = olpc_ac_get_prop, + }; + ++static char bat_serial[17]; /* Ick */ ++ + /********************************************************************* + * Battery properties + *********************************************************************/ +@@ -94,6 +97,7 @@ static int olpc_bat_get_property(struct + int ret = 0; + int16_t ec_word; + uint8_t ec_byte; ++ uint64_t ser_buf; + + ret = olpc_ec_cmd(EC_BAT_STATUS, NULL, 0, &ec_byte, 1); + if (ret) +@@ -127,8 +131,8 @@ static int olpc_bat_get_property(struct + val->intval = POWER_SUPPLY_STATUS_FULL; + else /* Not _necessarily_ true but EC doesn't tell all yet */ + val->intval = POWER_SUPPLY_STATUS_CHARGING; +- break; + } ++ break; + case POWER_SUPPLY_PROP_PRESENT: + val->intval = !!(ec_byte & BAT_STAT_PRESENT); + break; +@@ -249,6 +253,22 @@ static int olpc_bat_get_property(struct + ec_word = be16_to_cpu(ec_word); + val->intval = ec_word * 100 / 256; + break; ++ case POWER_SUPPLY_PROP_ACCUM_CURRENT: ++ ret = olpc_ec_cmd(EC_BAT_ACR, NULL, 0, (void *)&ec_word, 2); ++ if (ret) ++ return ret; ++ ++ ec_word = be16_to_cpu(ec_word); ++ val->intval = (uint16_t)ec_word; ++ break; ++ case POWER_SUPPLY_PROP_SERIAL_NUMBER: ++ ret = olpc_ec_cmd(EC_BAT_SERIAL, NULL, 0, (void *)&ser_buf, 8); ++ if (ret) ++ return ret; ++ ++ sprintf(bat_serial, "%016llx", (long long)be64_to_cpu(ser_buf)); ++ val->strval = bat_serial; ++ break; + default: + ret = -EINVAL; + break; +@@ -268,7 +288,51 @@ static enum power_supply_property olpc_b + POWER_SUPPLY_PROP_CAPACITY_LEVEL, + POWER_SUPPLY_PROP_TEMP, + POWER_SUPPLY_PROP_TEMP_AMBIENT, ++ POWER_SUPPLY_PROP_ACCUM_CURRENT, + POWER_SUPPLY_PROP_MANUFACTURER, ++ POWER_SUPPLY_PROP_SERIAL_NUMBER, ++}; ++ ++/* EEPROM reading goes completely around the power_supply API, sadly */ ++ ++#define EEPROM_START 0x20 ++#define EEPROM_END 0x80 ++#define EEPROM_SIZE (EEPROM_END - EEPROM_START) ++ ++static ssize_t olpc_bat_eeprom_read(struct kobject *kobj, char *buf, loff_t off, ++ size_t count) ++{ ++ uint8_t ec_byte; ++ int ret, end; ++ ++ if (off >= EEPROM_SIZE) ++ return 0; ++ if (off + count > EEPROM_SIZE) ++ count = EEPROM_SIZE - off; ++ ++ end = EEPROM_START + off + count; ++ for (ec_byte = EEPROM_START + off; ec_byte < end; ec_byte++) { ++ ret = olpc_ec_cmd(EC_BAT_EEPROM, &ec_byte, 1, ++ &buf[ec_byte - EEPROM_START], 1); ++ if (ret) { ++ printk(KERN_ERR "olpc-battery: EC command " ++ "EC_BAT_EEPROM @ 0x%x failed -" ++ " %d!\n", ec_byte, ret); ++ return -EIO; ++ } ++ } ++ ++ return count; ++} ++ ++static struct bin_attribute olpc_bat_eeprom = { ++ .attr = { ++ .name = "eeprom", ++ .mode = S_IRUGO, ++ .owner = THIS_MODULE, ++ }, ++ .size = 0, ++ .read = olpc_bat_eeprom_read, + }; + + /********************************************************************* +@@ -299,7 +363,7 @@ static int __init olpc_bat_init(void) + + if (!olpc_platform_info.ecver) + return -ENXIO; +- if (olpc_platform_info.ecver < 0x43) { ++ if (olpc_platform_info.ecver < 0x44) { + printk(KERN_NOTICE "OLPC EC version 0x%02x too old for battery driver.\n", olpc_platform_info.ecver); + return -ENXIO; + } +@@ -324,9 +388,15 @@ static int __init olpc_bat_init(void) + if (ret) + goto battery_failed; + ++ ret = device_create_bin_file(olpc_bat.dev, &olpc_bat_eeprom); ++ if (ret) ++ goto eeprom_failed; ++ + olpc_register_battery_callback(&olpc_battery_trigger_uevent); + goto success; + ++eeprom_failed: ++ power_supply_unregister(&olpc_bat); + battery_failed: + power_supply_unregister(&olpc_ac); + ac_failed: +@@ -338,6 +408,7 @@ success: + static void __exit olpc_bat_exit(void) + { + olpc_deregister_battery_callback(); ++ device_remove_bin_file(olpc_bat.dev, &olpc_bat_eeprom); + power_supply_unregister(&olpc_bat); + power_supply_unregister(&olpc_ac); + platform_device_unregister(bat_pdev); +diff -purN linux_2.6.24_org/drivers/power/power_supply_sysfs.c linux_2.6.24_olpc/drivers/power/power_supply_sysfs.c +--- linux_2.6.24_org/drivers/power/power_supply_sysfs.c 2008-02-15 20:11:45.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/power/power_supply_sysfs.c 2008-02-15 18:58:56.000000000 +0000 +@@ -114,9 +114,11 @@ static struct device_attribute power_sup + POWER_SUPPLY_ATTR(time_to_empty_avg), + POWER_SUPPLY_ATTR(time_to_full_now), + POWER_SUPPLY_ATTR(time_to_full_avg), ++ POWER_SUPPLY_ATTR(accum_current), + /* Properties of type `const char *' */ + POWER_SUPPLY_ATTR(model_name), + POWER_SUPPLY_ATTR(manufacturer), ++ POWER_SUPPLY_ATTR(serial_number), + }; + + static ssize_t power_supply_show_static_attrs(struct device *dev, +diff -purN linux_2.6.24_org/drivers/serial/serial_core.c linux_2.6.24_olpc/drivers/serial/serial_core.c +--- linux_2.6.24_org/drivers/serial/serial_core.c 2008-02-15 20:11:33.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/serial/serial_core.c 2008-02-15 18:58:51.000000000 +0000 +@@ -2013,6 +2013,7 @@ int uart_suspend_port(struct uart_driver + int uart_resume_port(struct uart_driver *drv, struct uart_port *port) + { + struct uart_state *state = drv->state + port->line; ++ struct ktermios termios; + + mutex_lock(&state->mutex); + +@@ -2035,20 +2036,6 @@ int uart_resume_port(struct uart_driver + * Re-enable the console device after suspending. + */ + if (uart_console(port)) { +- struct ktermios termios; +- +- /* +- * First try to use the console cflag setting. +- */ +- memset(&termios, 0, sizeof(struct ktermios)); +- termios.c_cflag = port->cons->cflag; +- +- /* +- * If that's unset, use the tty termios setting. +- */ +- if (state->info && state->info->tty && termios.c_cflag == 0) +- termios = *state->info->tty->termios; +- + port->ops->set_termios(port, &termios, NULL); + console_start(port->cons); + } +diff -purN linux_2.6.24_org/drivers/sysprof/config.h linux_2.6.24_olpc/drivers/sysprof/config.h +--- linux_2.6.24_org/drivers/sysprof/config.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/drivers/sysprof/config.h 2008-02-15 18:58:59.000000000 +0000 +@@ -0,0 +1,23 @@ ++/* config.h. Generated by configure. */ ++/* config.h.in. Generated from configure.ac by autoheader. */ ++ ++/* Look for global separate debug info in this path */ ++#define DEBUGDIR "/usr/local/lib/debug" ++ ++/* Define to 1 if you have the `iberty' library (-liberty). */ ++/* #undef HAVE_LIBIBERTY */ ++ ++/* Define to the address where bug reports for this package should be sent. */ ++#define PACKAGE_BUGREPORT "" ++ ++/* Define to the full name of this package. */ ++#define PACKAGE_NAME "sysprof" ++ ++/* Define to the full name and version of this package. */ ++#define PACKAGE_STRING "sysprof 1.0.8" ++ ++/* Define to the one symbol short name of this package. */ ++#define PACKAGE_TARNAME "sysprof" ++ ++/* Define to the version of this package. */ ++#define PACKAGE_VERSION "1.0.8" +diff -purN linux_2.6.24_org/drivers/sysprof/Kconfig linux_2.6.24_olpc/drivers/sysprof/Kconfig +--- linux_2.6.24_org/drivers/sysprof/Kconfig 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/drivers/sysprof/Kconfig 2008-02-15 18:58:59.000000000 +0000 +@@ -0,0 +1,12 @@ ++ ++menu "Sysprof" ++ ++config SYSPROF ++ tristate "Sysprof support" ++ help ++ Say M here to include the sysprof-module. ++ ++ Sysprof is a sampling profiler that uses a kernel module, ++ sysprof-module, to generate stacktraces which are then interpreted by ++ the userspace program "sysprof". ++endmenu +diff -purN linux_2.6.24_org/drivers/sysprof/Makefile linux_2.6.24_olpc/drivers/sysprof/Makefile +--- linux_2.6.24_org/drivers/sysprof/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/drivers/sysprof/Makefile 2008-02-15 18:58:59.000000000 +0000 +@@ -0,0 +1 @@ ++obj-$(CONFIG_SYSPROF) += sysprof-module.o +diff -purN linux_2.6.24_org/drivers/sysprof/sysprof-module.c linux_2.6.24_olpc/drivers/sysprof/sysprof-module.c +--- linux_2.6.24_org/drivers/sysprof/sysprof-module.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/drivers/sysprof/sysprof-module.c 2008-02-15 18:58:59.000000000 +0000 +@@ -0,0 +1,271 @@ ++/* -*- c-basic-offset: 8 -*- */ ++ ++/* Sysprof -- Sampling, systemwide CPU profiler ++ * Copyright 2004, Red Hat, Inc. ++ * Copyright 2004, 2005, Soeren Sandmann ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program 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 General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++#ifdef CONFIG_SMP ++# define __SMP__ ++#endif ++#include ++#include /* Needed for KERN_ALERT */ ++#include /* Needed by all modules */ ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "sysprof-module.h" ++ ++#include "config.h" ++ ++#include ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) ++#include ++#endif ++ ++#if !CONFIG_PROFILING ++# error Sysprof needs a kernel with profiling support compiled in. ++#endif ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) ++# error Sysprof needs a Linux 2.6.11 kernel or later ++#endif ++#include ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Soeren Sandmann (sandmann@daimi.au.dk)"); ++ ++#define SAMPLES_PER_SECOND (200) ++#define INTERVAL ((HZ <= SAMPLES_PER_SECOND)? 1 : (HZ / SAMPLES_PER_SECOND)) ++#define N_TRACES 256 ++ ++static SysprofStackTrace stack_traces[N_TRACES]; ++static SysprofStackTrace * head = &stack_traces[0]; ++static SysprofStackTrace * tail = &stack_traces[0]; ++DECLARE_WAIT_QUEUE_HEAD (wait_for_trace); ++DECLARE_WAIT_QUEUE_HEAD (wait_for_exit); ++ ++/* Macro the names of the registers that are used on each architecture */ ++#if defined(CONFIG_X86_64) ++# define REG_FRAME_PTR rbp ++# define REG_INS_PTR rip ++# define REG_STACK_PTR rsp ++#elif defined(CONFIG_X86) ++# define REG_FRAME_PTR ebp ++# define REG_INS_PTR eip ++# define REG_STACK_PTR esp ++#else ++# error Sysprof only supports the i386 and x86-64 architectures ++#endif ++ ++typedef struct userspace_reader userspace_reader; ++struct userspace_reader ++{ ++ struct task_struct *task; ++ unsigned long cache_address; ++ unsigned long *cache; ++}; ++ ++typedef struct StackFrame StackFrame; ++struct StackFrame { ++ unsigned long next; ++ unsigned long return_address; ++}; ++ ++struct work_struct work; ++ ++static int ++read_frame (void *frame_pointer, StackFrame *frame) ++{ ++#if 0 ++ /* This is commented out because we seem to be called with ++ * (current_thread_info()->addr_limit.seg)) == 0 ++ * which means access_ok() _always_ fails. ++ * ++ * Not sure why (or if) this isn't the case for oprofile ++ */ ++ if (!access_ok(VERIFY_READ, frame_pointer, sizeof(StackFrame))) ++ return 1; ++#endif ++ ++ if (__copy_from_user_inatomic ( ++ frame, frame_pointer, sizeof (StackFrame))) ++ return 1; ++ ++ return 0; ++} ++ ++DEFINE_PER_CPU(int, n_samples); ++ ++static int ++timer_notify (struct pt_regs *regs) ++{ ++ SysprofStackTrace *trace = head; ++ int i; ++ int is_user; ++ static atomic_t in_timer_notify = ATOMIC_INIT(1); ++ int n; ++ ++ n = ++get_cpu_var(n_samples); ++ put_cpu_var(n_samples); ++ ++ if (n % INTERVAL != 0) ++ return 0; ++ ++ /* 0: locked, 1: unlocked */ ++ ++ if (!atomic_dec_and_test(&in_timer_notify)) ++ goto out; ++ ++ is_user = user_mode(regs); ++ ++ if (!current || current->pid == 0) ++ goto out; ++ ++ if (is_user && current->state != TASK_RUNNING) ++ goto out; ++ ++ if (!is_user) ++ { ++ /* kernel */ ++ ++ trace->pid = current->pid; ++ trace->truncated = 0; ++ trace->n_addresses = 1; ++ ++ /* 0x1 is taken by sysprof to mean "in kernel" */ ++ trace->addresses[0] = (void *)0x1; ++ } ++ else ++ { ++ StackFrame *frame_pointer; ++ StackFrame frame; ++ memset(trace, 0, sizeof (SysprofStackTrace)); ++ ++ trace->pid = current->pid; ++ trace->truncated = 0; ++ ++ i = 0; ++ ++ trace->addresses[i++] = (void *)regs->REG_INS_PTR; ++ ++ frame_pointer = (void *)regs->REG_FRAME_PTR; ++ ++ while (read_frame (frame_pointer, &frame) == 0 && ++ i < SYSPROF_MAX_ADDRESSES && ++ (unsigned long)frame_pointer >= regs->REG_STACK_PTR) ++ { ++ trace->addresses[i++] = (void *)frame.return_address; ++ frame_pointer = (StackFrame *)frame.next; ++ } ++ ++ trace->n_addresses = i; ++ ++ if (i == SYSPROF_MAX_ADDRESSES) ++ trace->truncated = 1; ++ else ++ trace->truncated = 0; ++ } ++ ++ if (head++ == &stack_traces[N_TRACES - 1]) ++ head = &stack_traces[0]; ++ ++ wake_up (&wait_for_trace); ++ ++out: ++ atomic_inc(&in_timer_notify); ++ return 0; ++} ++ ++static int ++procfile_read(char *buffer, ++ char **buffer_location, ++ off_t offset, ++ int buffer_len, ++ int *eof, ++ void *data) ++{ ++ if (head == tail) ++ return -EWOULDBLOCK; ++ ++ *buffer_location = (char *)tail; ++ ++ BUG_ON(tail->pid == 0); ++ ++ if (tail++ == &stack_traces[N_TRACES - 1]) ++ tail = &stack_traces[0]; ++ ++ return sizeof (SysprofStackTrace); ++} ++ ++struct proc_dir_entry *trace_proc_file; ++static unsigned int ++procfile_poll(struct file *filp, poll_table *poll_table) ++{ ++ if (head != tail) ++ return POLLIN | POLLRDNORM; ++ ++ poll_wait(filp, &wait_for_trace, poll_table); ++ ++ if (head != tail) ++ return POLLIN | POLLRDNORM; ++ ++ return 0; ++} ++ ++int ++init_module(void) ++{ ++ static struct file_operations fops; ++ ++ trace_proc_file = ++ create_proc_entry ("sysprof-trace", S_IFREG | S_IRUGO, &proc_root); ++ ++ if (!trace_proc_file) ++ return 1; ++ ++ fops = *trace_proc_file->proc_fops; ++ fops.poll = procfile_poll; ++ ++ trace_proc_file->read_proc = procfile_read; ++ trace_proc_file->proc_fops = &fops; ++ trace_proc_file->size = sizeof (SysprofStackTrace); ++ ++ register_timer_hook (timer_notify); ++ ++ printk(KERN_ALERT "sysprof: loaded (%s)\n", PACKAGE_VERSION); ++ ++ return 0; ++} ++ ++void ++cleanup_module(void) ++{ ++ unregister_timer_hook (timer_notify); ++ ++ remove_proc_entry("sysprof-trace", &proc_root); ++ ++ printk(KERN_ALERT "sysprof: unloaded\n"); ++} ++ +diff -purN linux_2.6.24_org/drivers/sysprof/sysprof-module.h linux_2.6.24_olpc/drivers/sysprof/sysprof-module.h +--- linux_2.6.24_org/drivers/sysprof/sysprof-module.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/drivers/sysprof/sysprof-module.h 2008-02-15 18:58:59.000000000 +0000 +@@ -0,0 +1,37 @@ ++/* Sysprof -- Sampling, systemwide CPU profiler ++ * Copyright 2004, Red Hat, Inc. ++ * Copyright 2004, 2005, Soeren Sandmann ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program 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 General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++#ifndef SYSPROF_MODULE_H ++#define SYSPROF_MODULE_H ++ ++typedef struct SysprofStackTrace SysprofStackTrace; ++ ++#define SYSPROF_MAX_ADDRESSES 512 ++ ++struct SysprofStackTrace ++{ ++ int pid; /* -1 if in kernel */ ++ int truncated; ++ int n_addresses; /* note: this can be 1 if the process was compiled ++ * with -fomit-frame-pointer or is otherwise weird ++ */ ++ void *addresses[SYSPROF_MAX_ADDRESSES]; ++}; ++ ++#endif +diff -purN linux_2.6.24_org/drivers/usb/core/driver.c linux_2.6.24_olpc/drivers/usb/core/driver.c +--- linux_2.6.24_org/drivers/usb/core/driver.c 2008-02-15 20:11:09.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/usb/core/driver.c 2008-02-15 18:58:14.000000000 +0000 +@@ -1062,8 +1062,15 @@ static int usb_suspend_both(struct usb_d + break; + } + } +- if (status == 0) ++ if (status == 0) { ++ ++ /* Non-root devices don't need to do anything for FREEZE ++ * or PRETHAW. */ ++ if (udev->parent && (msg.event == PM_EVENT_FREEZE || ++ msg.event == PM_EVENT_PRETHAW)) ++ goto done; + status = usb_suspend_device(udev, msg); ++ } + + /* If the suspend failed, resume interfaces that did get suspended */ + if (status != 0) { +diff -purN linux_2.6.24_org/drivers/usb/core/quirks.c linux_2.6.24_olpc/drivers/usb/core/quirks.c +--- linux_2.6.24_org/drivers/usb/core/quirks.c 2008-02-15 20:11:09.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/usb/core/quirks.c 2008-02-15 18:58:12.000000000 +0000 +@@ -45,6 +45,9 @@ static const struct usb_device_id usb_qu + /* SKYMEDI USB_DRIVE */ + { USB_DEVICE(0x1516, 0x8628), .driver_info = USB_QUIRK_RESET_RESUME }, + ++ /* Philips PSC805 audio device */ ++ { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME }, ++ + { } /* terminating entry must be last */ + }; + +diff -purN linux_2.6.24_org/drivers/usb/core/usb.h linux_2.6.24_olpc/drivers/usb/core/usb.h +--- linux_2.6.24_org/drivers/usb/core/usb.h 2008-02-15 20:11:09.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/usb/core/usb.h 2008-02-15 18:58:14.000000000 +0000 +@@ -41,6 +41,7 @@ extern void usb_host_cleanup(void); + extern void usb_autosuspend_work(struct work_struct *work); + extern int usb_port_suspend(struct usb_device *dev); + extern int usb_port_resume(struct usb_device *dev); ++extern int usb_reset_suspended_device(struct usb_device *udev); + extern int usb_external_suspend_device(struct usb_device *udev, + pm_message_t msg); + extern int usb_external_resume_device(struct usb_device *udev); +diff -purN linux_2.6.24_org/drivers/usb/host/ehci-hcd.c linux_2.6.24_olpc/drivers/usb/host/ehci-hcd.c +--- linux_2.6.24_org/drivers/usb/host/ehci-hcd.c 2008-02-15 20:11:09.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/usb/host/ehci-hcd.c 2008-02-15 18:58:12.000000000 +0000 +@@ -653,9 +653,16 @@ static irqreturn_t ehci_irq (struct usb_ + + /* complete the unlinking of some qh [4.15.2.3] */ + if (status & STS_IAA) { +- COUNT (ehci->stats.reclaim); +- ehci->reclaim_ready = 1; +- bh = 1; ++ if (!ehci->reclaim) { ++ printk(KERN_WARNING "%s would set reclaim_ready with nothing to reclaim!\n", __func__); ++printk(KERN_DEBUG "%s: USBCMD: 0x%x\n", __func__, ehci_readl(ehci, &ehci->regs->command)); ++printk(KERN_DEBUG "%s: USBSTS: 0x%x\n", __func__, ehci_readl(ehci, &ehci->regs->status)); ++ WARN_ON(1); ++ } else { ++ COUNT (ehci->stats.reclaim); ++ ehci->reclaim_ready = 1; ++ bh = 1; ++ } + } + + /* remote wakeup [4.3.1] */ +diff -purN linux_2.6.24_org/drivers/usb/host/ehci-hub.c linux_2.6.24_olpc/drivers/usb/host/ehci-hub.c +--- linux_2.6.24_org/drivers/usb/host/ehci-hub.c 2008-02-15 20:11:09.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/usb/host/ehci-hub.c 2008-02-15 18:58:12.000000000 +0000 +@@ -132,10 +132,15 @@ static int ehci_bus_suspend (struct usb_ + ehci_quiesce (ehci); + hcd->state = HC_STATE_QUIESCING; + } ++printk(KERN_DEBUG "%s: USBCMD: 0x%x\n", __func__, ehci_readl(ehci, &ehci->regs->command)); ++printk(KERN_DEBUG "%s: USBSTS: 0x%x\n", __func__, ehci_readl(ehci, &ehci->regs->status)); ++ + ehci->command = ehci_readl(ehci, &ehci->regs->command); + if (ehci->reclaim) + ehci->reclaim_ready = 1; + ehci_work(ehci); ++printk(KERN_DEBUG "%s: USBCMD: 0x%x\n", __func__, ehci_readl(ehci, &ehci->regs->command)); ++printk(KERN_DEBUG "%s: USBSTS: 0x%x\n", __func__, ehci_readl(ehci, &ehci->regs->status)); + + /* Unlike other USB host controller types, EHCI doesn't have + * any notion of "global" or bus-wide suspend. The driver has +@@ -175,6 +180,9 @@ static int ehci_bus_suspend (struct usb_ + ehci_halt (ehci); + hcd->state = HC_STATE_SUSPENDED; + ++printk(KERN_DEBUG "%s: USBCMD: 0x%x\n", __func__, ehci_readl(ehci, &ehci->regs->command)); ++printk(KERN_DEBUG "%s: USBSTS: 0x%x\n", __func__, ehci_readl(ehci, &ehci->regs->status)); ++ + /* allow remote wakeup */ + mask = INTR_MASK; + if (!device_may_wakeup(&hcd->self.root_hub->dev)) +@@ -195,6 +203,18 @@ static int ehci_bus_resume (struct usb_h + u32 temp; + u32 power_okay; + int i; ++#ifdef CONFIG_OLPC ++ u32 lo; ++ static void __iomem *usb_ehc_addr; ++ ++ rdmsrl(0x51200009, lo); ++ usb_ehc_addr = ioremap(lo, 256); ++ writel(readl(usb_ehc_addr+0x54) | 0x1000, usb_ehc_addr+0x54); ++ writel(readl(usb_ehc_addr+0x58) | 0x1000, usb_ehc_addr+0x58); ++ writel(readl(usb_ehc_addr+0x5C) | 0x1000, usb_ehc_addr+0x5C); ++ writel(readl(usb_ehc_addr+0x60) | 0x1000, usb_ehc_addr+0x60); ++ iounmap(usb_ehc_addr); ++#endif + + if (time_before (jiffies, ehci->next_statechange)) + msleep(5); +diff -purN linux_2.6.24_org/drivers/usb/host/ehci-pci.c linux_2.6.24_olpc/drivers/usb/host/ehci-pci.c +--- linux_2.6.24_org/drivers/usb/host/ehci-pci.c 2008-02-15 20:11:09.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/usb/host/ehci-pci.c 2008-02-15 18:58:12.000000000 +0000 +@@ -247,6 +247,9 @@ static int ehci_pci_suspend(struct usb_h + rc = -EINVAL; + goto bail; + } ++printk(KERN_DEBUG "%s: USBCMD: 0x%x\n", __func__, ehci_readl(ehci, &ehci->regs->command)); ++printk(KERN_DEBUG "%s: USBSTS: 0x%x\n", __func__, ehci_readl(ehci, &ehci->regs->status)); ++ + ehci_writel(ehci, 0, &ehci->regs->intr_enable); + (void)ehci_readl(ehci, &ehci->regs->intr_enable); + +diff -purN linux_2.6.24_org/drivers/usb/host/ehci-q.c linux_2.6.24_olpc/drivers/usb/host/ehci-q.c +--- linux_2.6.24_org/drivers/usb/host/ehci-q.c 2008-02-15 20:11:09.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/usb/host/ehci-q.c 2008-02-15 18:58:12.000000000 +0000 +@@ -177,7 +177,7 @@ static int qtd_copy_status ( + if (QTD_CERR (token)) + status = -EPIPE; + else { +- ehci_dbg (ehci, "devpath %s ep%d%s 3strikes\n", ++ printk(KERN_ERR "devpath %s ep%d%s 3strikes\n", + urb->dev->devpath, + usb_pipeendpoint (urb->pipe), + usb_pipein (urb->pipe) ? "in" : "out"); +@@ -973,6 +973,11 @@ static void end_unlink_async (struct ehc + struct ehci_qh *qh = ehci->reclaim; + struct ehci_qh *next; + ++ if (!qh) { ++ printk(KERN_CRIT "%s with ehci->reclaim == NULL!\n", __func__); ++ WARN_ON(1); ++ return; ++ } + timer_action_done (ehci, TIMER_IAA_WATCHDOG); + + // qh->hw_next = cpu_to_hc32(qh->qh_dma); +diff -purN linux_2.6.24_org/drivers/usb/host/ohci-pci.c linux_2.6.24_olpc/drivers/usb/host/ohci-pci.c +--- linux_2.6.24_org/drivers/usb/host/ohci-pci.c 2008-02-15 20:11:09.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/usb/host/ohci-pci.c 2008-02-15 18:58:12.000000000 +0000 +@@ -317,6 +317,8 @@ static int ohci_pci_resume (struct usb_h + /* FIXME: we should try to detect loss of VBUS power here */ + prepare_for_handover(hcd); + ++ /* Force the PM core to resume the root hub */ ++ hcd_to_bus(hcd)->root_hub->dev.power.prev_state.event = PM_EVENT_ON; + return 0; + } + +diff -purN linux_2.6.24_org/drivers/usb/storage/usb.c linux_2.6.24_olpc/drivers/usb/storage/usb.c +--- linux_2.6.24_org/drivers/usb/storage/usb.c 2008-02-15 20:11:09.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/usb/storage/usb.c 2008-02-15 18:58:11.000000000 +0000 +@@ -244,7 +244,7 @@ static int storage_pre_reset(struct usb_ + return 0; + } + +-static int storage_post_reset(struct usb_interface *iface) ++static void storage_post_reset(struct usb_interface *iface, int reset_resume) + { + struct us_data *us = usb_get_intfdata(iface); + +@@ -256,8 +256,10 @@ static int storage_post_reset(struct usb + /* FIXME: Notify the subdrivers that they need to reinitialize + * the device */ + +- mutex_unlock(&us->dev_mutex); +- return 0; ++ /* If this is a reset-resume then the pre_reset routine wasn't ++ * called, so we don't need to unlock the mutex. */ ++ if (!reset_resume) ++ mutex_unlock(&us->dev_mutex); + } + + /* +diff -purN linux_2.6.24_org/drivers/video/fbmem.c linux_2.6.24_olpc/drivers/video/fbmem.c +--- linux_2.6.24_org/drivers/video/fbmem.c 2008-02-15 20:11:23.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/video/fbmem.c 2008-02-15 18:58:42.000000000 +0000 +@@ -820,6 +820,53 @@ static void try_to_load(int fb) + #endif /* CONFIG_KMOD */ + + int ++fb_powerup(struct fb_info *info) ++{ ++ int ret = 0; ++ ++ if (!info || info->state == FBINFO_STATE_RUNNING) ++ return 0; ++ ++ if (info->fbops->fb_powerup) ++ ret = info->fbops->fb_powerup(info); ++ ++ if (!ret) { ++ acquire_console_sem(); ++ fb_set_suspend(info, 0); ++ release_console_sem(); ++ } ++ ++ return ret; ++} ++ ++int ++fb_powerdown(struct fb_info *info) ++{ ++ int ret = 0; ++ ++ if (!info || info->state == FBINFO_STATE_SUSPENDED) ++ return 0; ++ ++ /* Tell everybody that the fbdev is going down */ ++ acquire_console_sem(); ++ fb_set_suspend(info, 1); ++ release_console_sem(); ++ ++ if (info->fbops->fb_powerdown) ++ ret = info->fbops->fb_powerdown(info); ++ ++ /* If the power down failed, then un-notify */ ++ ++ if (ret) { ++ acquire_console_sem(); ++ fb_set_suspend(info, 0); ++ release_console_sem(); ++ } ++ ++ return ret; ++} ++ ++int + fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var) + { + struct fb_fix_screeninfo *fix = &info->fix; +diff -purN linux_2.6.24_org/drivers/video/geode/display_gx.c linux_2.6.24_olpc/drivers/video/geode/display_gx.c +--- linux_2.6.24_org/drivers/video/geode/display_gx.c 2008-02-15 20:11:23.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/video/geode/display_gx.c 2008-02-15 18:58:41.000000000 +0000 +@@ -11,26 +11,44 @@ + * Free Software Foundation; either version 2 of the License, or * (at your + * option) any later version. + */ ++ ++#include + #include + #include + #include + #include + #include + #include ++#include + + #include "geodefb.h" + #include "display_gx.h" + +-#ifdef CONFIG_FB_GEODE_GX_SET_FBSIZE +-unsigned int gx_frame_buffer_size(void) ++static inline void rmwl(u32 val, u32 *reg) + { +- return CONFIG_FB_GEODE_GX_FBSIZE; ++ u32 in = readl(reg); ++ if (in != val) ++ writel(val, reg); + } +-#else ++ + unsigned int gx_frame_buffer_size(void) + { + unsigned int val; + ++#ifdef CONFIG_OLPC ++ if (machine_is_olpc() && !olpc_has_vsa()) { ++ u32 hi,lo; ++ rdmsr(GLIU0_P2D_RO0, lo, hi); ++ ++ /* Top page number */ ++ val = ((hi & 0xff) << 12) | ((lo & 0xfff00000) >> 20); ++ ++ val -= (lo & 0x000fffff); /* Subtract bottom page number */ ++ val += 1; /* Adjust page count */ ++ return (val << 12); ++ } ++#endif ++ + /* FB size is reported by a virtual register */ + /* Virtual register class = 0x02 */ + /* VG_MEM_SIZE(512Kb units) = 0x00 */ +@@ -41,7 +59,6 @@ unsigned int gx_frame_buffer_size(void) + val = (unsigned int)(inw(0xAC1E)) & 0xFFl; + return (val << 19); + } +-#endif + + int gx_line_delta(int xres, int bpp) + { +@@ -63,23 +80,23 @@ static void gx_set_mode(struct fb_info * + gcfg = readl(par->dc_regs + DC_GENERAL_CFG); + dcfg = readl(par->dc_regs + DC_DISPLAY_CFG); + +- /* Disable the timing generator. */ +- dcfg &= ~(DC_DCFG_TGEN); +- writel(dcfg, par->dc_regs + DC_DISPLAY_CFG); +- +- /* Wait for pending memory requests before disabling the FIFO load. */ +- udelay(100); +- +- /* Disable FIFO load and compression. */ +- gcfg &= ~(DC_GCFG_DFLE | DC_GCFG_CMPE | DC_GCFG_DECE); +- writel(gcfg, par->dc_regs + DC_GENERAL_CFG); +- +- /* Setup DCLK and its divisor. */ +- par->vid_ops->set_dclk(info); +- +- /* +- * Setup new mode. +- */ ++ /* Programming the clock is costly and ugly, so avoid if if we can */ ++ ++ if (par->curdclk != info->var.pixclock) { ++ /* Disable the timing generator. */ ++ dcfg &= ~(DC_DCFG_TGEN); ++ writel(dcfg, par->dc_regs + DC_DISPLAY_CFG); ++ ++ /* Wait for pending memory requests before disabling the FIFO load. */ ++ udelay(100); ++ ++ /* Disable FIFO load and compression. */ ++ gcfg &= ~(DC_GCFG_DFLE | DC_GCFG_CMPE | DC_GCFG_DECE); ++ writel(gcfg, par->dc_regs + DC_GENERAL_CFG); ++ ++ /* Setup DCLK and its divisor. */ ++ par->vid_ops->set_dclk(info); ++ } + + /* Clear all unused feature bits. */ + gcfg &= DC_GCFG_YUVM | DC_GCFG_VDSE; +@@ -90,12 +107,13 @@ static void gx_set_mode(struct fb_info * + gcfg |= (6 << DC_GCFG_DFHPEL_POS) | (5 << DC_GCFG_DFHPSL_POS) | DC_GCFG_DFLE; + + /* Framebuffer start offset. */ +- writel(0, par->dc_regs + DC_FB_ST_OFFSET); ++ rmwl(0, par->dc_regs + DC_FB_ST_OFFSET); + + /* Line delta and line buffer length. */ +- writel(info->fix.line_length >> 3, par->dc_regs + DC_GFX_PITCH); +- writel(((info->var.xres * info->var.bits_per_pixel/8) >> 3) + 2, +- par->dc_regs + DC_LINE_SIZE); ++ rmwl(info->fix.line_length >> 3, par->dc_regs + DC_GFX_PITCH); ++ ++ rmwl(((info->var.xres * info->var.bits_per_pixel/8) >> 3) + 2, ++ par->dc_regs + DC_LINE_SIZE); + + + /* Enable graphics and video data and unmask address lines. */ +@@ -134,17 +152,16 @@ static void gx_set_mode(struct fb_info * + vblankend = vsyncend + info->var.upper_margin; + vtotal = vblankend; + +- writel((hactive - 1) | ((htotal - 1) << 16), par->dc_regs + DC_H_ACTIVE_TIMING); +- writel((hblankstart - 1) | ((hblankend - 1) << 16), par->dc_regs + DC_H_BLANK_TIMING); +- writel((hsyncstart - 1) | ((hsyncend - 1) << 16), par->dc_regs + DC_H_SYNC_TIMING); +- +- writel((vactive - 1) | ((vtotal - 1) << 16), par->dc_regs + DC_V_ACTIVE_TIMING); +- writel((vblankstart - 1) | ((vblankend - 1) << 16), par->dc_regs + DC_V_BLANK_TIMING); +- writel((vsyncstart - 1) | ((vsyncend - 1) << 16), par->dc_regs + DC_V_SYNC_TIMING); ++ rmwl((hactive - 1) | ((htotal - 1) << 16), par->dc_regs + DC_H_ACTIVE_TIMING); ++ rmwl((hblankstart - 1) | ((hblankend - 1) << 16), par->dc_regs + DC_H_BLANK_TIMING); ++ rmwl((hsyncstart - 1) | ((hsyncend - 1) << 16), par->dc_regs + DC_H_SYNC_TIMING); ++ rmwl((vactive - 1) | ((vtotal - 1) << 16), par->dc_regs + DC_V_ACTIVE_TIMING); ++ rmwl((vblankstart - 1) | ((vblankend - 1) << 16), par->dc_regs + DC_V_BLANK_TIMING); ++ rmwl((vsyncstart - 1) | ((vsyncend - 1) << 16), par->dc_regs + DC_V_SYNC_TIMING); + + /* Write final register values. */ +- writel(dcfg, par->dc_regs + DC_DISPLAY_CFG); +- writel(gcfg, par->dc_regs + DC_GENERAL_CFG); ++ rmwl(dcfg, par->dc_regs + DC_DISPLAY_CFG); ++ rmwl(gcfg, par->dc_regs + DC_GENERAL_CFG); + + par->vid_ops->configure_display(info); + +diff -purN linux_2.6.24_org/drivers/video/geode/display_gx.h linux_2.6.24_olpc/drivers/video/geode/display_gx.h +--- linux_2.6.24_org/drivers/video/geode/display_gx.h 2008-02-15 20:11:23.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/video/geode/display_gx.h 2008-02-15 18:58:41.000000000 +0000 +@@ -20,6 +20,9 @@ extern struct geode_dc_ops gx_dc_ops; + #define GLD_MSR_CONFIG 0xC0002001 + #define GLD_MSR_CONFIG_DM_FP 0x40 + ++/* Used for memory dection on the OLPC */ ++#define GLIU0_P2D_RO0 0x10000029 ++ + /* Display controller registers */ + + #define DC_UNLOCK 0x00 +diff -purN linux_2.6.24_org/drivers/video/geode/geodefb.h linux_2.6.24_olpc/drivers/video/geode/geodefb.h +--- linux_2.6.24_org/drivers/video/geode/geodefb.h 2008-02-15 20:11:23.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/video/geode/geodefb.h 2008-02-15 18:58:41.000000000 +0000 +@@ -12,6 +12,10 @@ + #ifndef __GEODEFB_H__ + #define __GEODEFB_H__ + ++#define FB_POWER_STATE_OFF 0 ++#define FB_POWER_STATE_SUSPEND 1 ++#define FB_POWER_STATE_ON 2 ++ + struct geodefb_info; + + struct geode_dc_ops { +@@ -21,18 +25,24 @@ struct geode_dc_ops { + + struct geode_vid_ops { + void (*set_dclk)(struct fb_info *); ++ unsigned int (*get_dclk)(struct fb_info *); + void (*configure_display)(struct fb_info *); + int (*blank_display)(struct fb_info *, int blank_mode); + }; + + struct geodefb_par { + int enable_crt; ++ int fbactive; /* True if the current console is in KD_GRAPHICS mode */ + int panel_x; /* dimensions of an attached flat panel, non-zero => enable panel */ + int panel_y; ++ unsigned int curdclk; /* Used by GX to avoid unnessesary clock switching */ + void __iomem *dc_regs; + void __iomem *vid_regs; ++ void __iomem *gp_regs; + struct geode_dc_ops *dc_ops; + struct geode_vid_ops *vid_ops; ++ ++ int state; + }; + + #endif /* !__GEODEFB_H__ */ +diff -purN linux_2.6.24_org/drivers/video/geode/geode_regs.h linux_2.6.24_olpc/drivers/video/geode/geode_regs.h +--- linux_2.6.24_org/drivers/video/geode/geode_regs.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/drivers/video/geode/geode_regs.h 2008-02-15 18:58:41.000000000 +0000 +@@ -0,0 +1,255 @@ ++/* This header file defines the registers and suspend/resume ++ structures for the Geode GX and LX. The lxfb driver defines ++ _GEODELX_ before including this file, which will unlock the ++ extra registers that are only valid for LX. ++*/ ++ ++#ifndef _GEODE_REGS_H_ ++#define _GEODE_REGS_H_ ++ ++/* MSRs */ ++ ++#define GX_VP_MSR_PAD_SELECT 0xC0002011 ++#define LX_VP_MSR_PAD_SELECT 0x48000011 ++ ++#define GEODE_MSR_GLCP_DOTPLL 0x4c000015 ++ ++#define GLCP_DOTPLL_RESET (1 << 0) ++#define GLCP_DOTPLL_BYPASS (1 << 15) ++#define GLCP_DOTPLL_HALFPIX (1 << 24) ++#define GLCP_DOTPLL_LOCK (1 << 25) ++ ++/* Registers */ ++#define VP_FP_START 0x400 ++ ++ ++#ifdef _GEODELX_ ++ ++#define GP_REG_SIZE 0x7C ++#define DC_REG_SIZE 0xF0 ++#define VP_REG_SIZE 0x158 ++#define FP_REG_SIZE 0x70 ++ ++#else ++ ++#define GP_REG_SIZE 0x50 ++#define DC_REG_SIZE 0x90 ++#define VP_REG_SIZE 0x138 ++#define FP_REG_SIZE 0x70 ++ ++#endif ++ ++#define DC_PAL_SIZE 0x105 ++#define VP_COEFF_COUNT 512 ++#define DC_HFILT_SIZE 256 ++#define DC_VFILT_SIZE 256 ++ ++struct geoderegs { ++ ++ struct { ++ u64 padsel; ++ u64 dotpll; ++ ++#ifdef _GEODELX_ ++ u64 dfglcfg; ++ u64 dcspare; ++#else ++ u64 rstpll; ++#endif ++ } msr; ++ ++ union { ++ unsigned char b[GP_REG_SIZE]; ++ struct { ++ u32 dst_offset; /* 0x00 */ ++ u32 src_offset; /* 0x04 */ ++ u32 stride; /* 0x08 */ ++ u32 wid_height; /* 0x0C */ ++ u32 src_color_fg; /* 0x10 */ ++ u32 src_color_bg; /* 0x14 */ ++ u32 pat_color_0; /* 0x18 */ ++ u32 pat_color_1; /* 0x1C */ ++ u32 pat_color_2; /* 0x20 */ ++ u32 pat_color_3; /* 0x24 */ ++ u32 pat_color_4; /* 0x28 */ ++ u32 pat_color_5; /* 0x2C */ ++ u32 pat_data_0; /* 0x30 */ ++ u32 pat_data_1; /* 0x34 */ ++ u32 raster_mode; /* 0x38 */ ++ u32 vector_mode; /* 0x3C */ ++ u32 blt_mode; /* 0x40 */ ++ u32 blit_status; /* 0x4C */ ++ u32 hst_src; /* 0x48 */ ++ u32 base_offset; /* 0x4C */ ++ ++#ifdef _GEODELX_ ++ u32 cmd_top; /* 0x50 */ ++ u32 cmd_bot; /* 0x54 */ ++ u32 cmd_read; /* 0x58 */ ++ u32 cmd_write; /* 0x5C */ ++ u32 ch3_offset; /* 0x60 */ ++ u32 ch3_mode_str; /* 0x64 */ ++ u32 ch3_width; /* 0x68 */ ++ u32 ch3_hsrc; /* 0x6C */ ++ u32 lut_index; /* 0x70 */ ++ u32 lut_data; /* 0x74 */ ++ u32 int_cntrl; /* 0x78 */ ++#endif ++ } r; ++ } gp; ++ ++ union { ++ unsigned char b[DC_REG_SIZE]; ++ ++ struct { ++ u32 unlock; /* 0x00 */ ++ u32 gcfg; /* 0x04 */ ++ u32 dcfg; /* 0x08 */ ++ u32 arb; /* 0x0C */ ++ u32 fb_st_offset; /* 0x10 */ ++ u32 cb_st_offset; /* 0x14 */ ++ u32 curs_st_offset; /* 0x18 */ ++ u32 icon_st_offset; /* 0x1C */ ++ u32 vid_y_st_offset; /* 0x20 */ ++ u32 vid_u_st_offset; /* 0x24 */ ++ u32 vid_v_st_offset; /* 0x28 */ ++ u32 dctop; /* 0x2c */ ++ u32 line_size; /* 0x30 */ ++ u32 gfx_pitch; /* 0x34 */ ++ u32 vid_yuv_pitch; /* 0x38 */ ++ u32 rsvd2; /* 0x3C */ ++ u32 h_active_timing; /* 0x40 */ ++ u32 h_blank_timing; /* 0x44 */ ++ u32 h_sync_timing; /* 0x48 */ ++ u32 rsvd3; /* 0x4C */ ++ u32 v_active_timing; /* 0x50 */ ++ u32 v_blank_timing; /* 0x54 */ ++ u32 v_sync_timing; /* 0x58 */ ++ u32 fbactive; /* 0x5C */ ++ u32 dc_cursor_x; /* 0x60 */ ++ u32 dc_cursor_y; /* 0x64 */ ++ u32 dc_icon_x; /* 0x68 */ ++ u32 dc_line_cnt; /* 0x6C */ ++ u32 rsvd5; /* 0x70 - palette address */ ++ u32 rsvd6; /* 0x74 - palette data */ ++ u32 dfifo_diag; /* 0x78 */ ++ u32 cfifo_diag; /* 0x7C */ ++ u32 dc_vid_ds_delta; /* 0x80 */ ++ u32 gliu0_mem_offset; /* 0x84 */ ++ u32 dv_ctl; /* 0x88 - added by LX */ ++ u32 dv_acc; /* 0x8C */ ++ ++#ifdef _GEODELX_ ++ u32 gfx_scale; ++ u32 irq_filt_ctl; ++ u32 filt_coeff1; ++ u32 filt_coeff2; ++ u32 vbi_event_ctl; ++ u32 vbi_odd_ctl; ++ u32 vbi_hor; ++ u32 vbi_ln_odd; ++ u32 vbi_ln_event; ++ u32 vbi_pitch; ++ u32 clr_key; ++ u32 clr_key_mask; ++ u32 clr_key_x; ++ u32 clr_key_y; ++ u32 irq; ++ u32 rsvd8; ++ u32 genlk_ctrl; ++ u32 vid_even_y_st_offset; /* 0xD8 */ ++ u32 vid_even_u_st_offset; /* 0xDC */ ++ u32 vid_even_v_st_offset; /* 0xE0 */ ++ u32 v_active_even_timing; /* 0xE4 */ ++ u32 v_blank_even_timing; /* 0xE8 */ ++ u32 v_sync_even_timing; /* 0xEC */ ++#endif ++ } r; ++ } dc; ++ ++ union { ++ unsigned char b[VP_REG_SIZE]; ++ ++ struct { ++ u64 vcfg; /* 0x00 */ ++ u64 dcfg; /* 0x08 */ ++ u64 vx; /* 0x10 */ ++ u64 vy; /* 0x18 */ ++ u64 vs; /* 0x20 */ ++ u64 vck; /* 0x28 */ ++ u64 vcm; /* 0x30 */ ++ u64 rsvd1; /* 0x38 - Gamma address*/ ++ u64 rsvd2; /* 0x40 - Gamma data*/ ++ u64 slr; /* 0x48 - LX only*/ ++ u64 misc; /* 0x50 */ ++ u64 ccs; /* 0x58 */ ++ u64 vys; /* 0x60 */ ++ u64 vxs; /* 0x68 */ ++ u64 rsvd4; /* 0x70 */ ++ u64 vdc; /* 0x78 */ ++ u64 vco; /* 0x80 */ ++ u64 crc; /* 0x88 */ ++ u64 crc32; /* 0x90 */ ++ u64 vde; /* 0x98 */ ++ u64 cck; /* 0xA0 */ ++ u64 ccm; /* 0xA8 */ ++ u64 cc1; /* 0xB0 */ ++ u64 cc2; /* 0xB8 */ ++ u64 a1x; /* 0xC0 */ ++ u64 a1y; /* 0xC8 */ ++ u64 a1c; /* 0xD0 */ ++ u64 a1t; /* 0xD8 */ ++ u64 a2x; /* 0xE0 */ ++ u64 a2y; /* 0xE8 */ ++ u64 a2c; /* 0xF0 */ ++ u64 a2t; /* 0xF8 */ ++ u64 a3x; /* 0x100 */ ++ u64 a3y; /* 0x108 */ ++ u64 a3c; /* 0x110 */ ++ u64 a3t; /* 0x118 */ ++ u64 vrr; /* 0x120 */ ++ u64 awt; /* 0x128 */ ++ u64 vtm; /* 0x130 */ ++#ifdef _GEODELX_ ++ u64 vye; /* 0x138 */ ++ u64 a1ye; /* 0x140 */ ++ u32 a2ye; /* 0x148 */ ++ u32 a3ye; /* 0x150 */ ++#endif ++ } r; ++ } vp; ++ ++ union { ++ unsigned char b[FP_REG_SIZE]; ++ ++ struct { ++ u64 pt1; /* 0x400 */ ++ u64 pt2; /* 0x408 */ ++ u64 pm; /* 0x410 */ ++ u64 dfc; /* 0x418 */ ++ u64 blfsr; /* 0x420 */ ++ u64 rlfsr; /* 0x428 */ ++ u64 fmi; /* 0x430 */ ++ u64 fmd; /* 0x438 */ ++ u64 rsvd; /* 0x440 */ ++ u64 dca; /* 0x448 */ ++ u64 dmd; /* 0x450 */ ++ u64 crc; /* 0x458 */ ++ u64 fbb; /* 0x460 */ ++ u64 crc32; /* 0x468 */ ++ } r; ++ } fp; ++ ++ u32 pal[DC_PAL_SIZE]; ++ u32 gamma[256]; ++ ++#ifdef _GEODELX_ ++ ++ u32 hcoeff[DC_HFILT_SIZE * 2]; ++ u32 vcoeff[DC_VFILT_SIZE]; ++ ++ u32 vp_coeff[VP_COEFF_COUNT]; ++#endif ++}; ++ ++#endif +diff -purN linux_2.6.24_org/drivers/video/geode/gxfb_core.c linux_2.6.24_olpc/drivers/video/geode/gxfb_core.c +--- linux_2.6.24_org/drivers/video/geode/gxfb_core.c 2008-02-15 20:11:23.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/video/geode/gxfb_core.c 2008-02-15 18:58:41.000000000 +0000 +@@ -30,12 +30,31 @@ + #include + #include + #include ++#include ++#include ++#include ++#include ++#include + + #include "geodefb.h" + #include "display_gx.h" + #include "video_gx.h" + ++#define FBIOSGAMMA _IOW('F', 0x20, void *) ++#define FBIOGGAMMA _IOW('F', 0x21, void *) ++ ++#ifdef DEBUG ++ ++#define FBIODUMPGP _IOW('F', 0x22, void *) ++#define FBIODUMPDC _IOW('F', 0x23, void *) ++#define FBIODUMPVP _IOW('F', 0x24, void *) ++#define FBIODUMPFP _IOW('F', 0x25, void *) ++ ++#endif ++ + static char *mode_option; ++static int noclear; ++struct fb_info *gxfb_info; + + /* Modes relevant to the GX (taken from modedb.c) */ + static const struct fb_videomode gx_modedb[] __initdata = { +@@ -103,8 +122,20 @@ static const struct fb_videomode gx_mode + { NULL, 85, 1600, 1200, 4357, 304, 64, 46, 1, 192, 3, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, ++ /* 1200x900-75 - CRT timings for the OLPC mode */ ++ { NULL, 75, 1200, 900, 8049, 104, 240, 29, 54, 136, 3, ++ 0, FB_VMODE_NONINTERLACED, 0 } + }; + ++#ifdef CONFIG_OLPC ++static const struct fb_videomode gx_dcon_modedb[] __initdata = { ++ /* The only mode the DCON has is 1200x900 */ ++ { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3, ++ 0, FB_VMODE_NONINTERLACED, 0 } ++}; ++#endif ++ ++ + static int gxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) + { + if (var->xres > 1600 || var->yres > 1200) +@@ -137,7 +168,7 @@ static int gxfb_check_var(struct fb_var_ + return 0; + } + +-static int gxfb_set_par(struct fb_info *info) ++int gxfb_set_par(struct fb_info *info) + { + struct geodefb_par *par = info->par; + +@@ -204,16 +235,26 @@ static int gxfb_blank(int blank_mode, st + return par->vid_ops->blank_display(info, blank_mode); + } + ++static int fbsize; ++ + static int __init gxfb_map_video_memory(struct fb_info *info, struct pci_dev *dev) + { + struct geodefb_par *par = info->par; +- int fb_len; + int ret; + + ret = pci_enable_device(dev); + if (ret < 0) + return ret; + ++ ret = pci_request_region(dev, 1, "gxfb (graphics processor)"); ++ if (ret < 0) ++ return ret; ++ ++ par->gp_regs = ioremap(pci_resource_start(dev, 1), ++ pci_resource_len(dev, 1)); ++ if (!par->gp_regs) ++ return -ENOMEM; ++ + ret = pci_request_region(dev, 3, "gxfb (video processor)"); + if (ret < 0) + return ret; +@@ -232,36 +273,118 @@ static int __init gxfb_map_video_memory( + ret = pci_request_region(dev, 0, "gxfb (framebuffer)"); + if (ret < 0) + return ret; +- if ((fb_len = gx_frame_buffer_size()) < 0) +- return -ENOMEM; ++ ++ /* If the fbsize wasn't specified then try to probe it */ ++ ++ if (!fbsize) { ++ fbsize = gx_frame_buffer_size(); ++ if (fbsize == 0) ++ return -ENOMEM; ++ } ++ + info->fix.smem_start = pci_resource_start(dev, 0); +- info->fix.smem_len = fb_len; ++ info->fix.smem_len = fbsize; + info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len); + if (!info->screen_base) + return -ENOMEM; + +- /* Set the 16MB aligned base address of the graphics memory region ++ /* Set the 16MiB aligned base address of the graphics memory region + * in the display controller */ + + writel(info->fix.smem_start & 0xFF000000, + par->dc_regs + DC_GLIU0_MEM_OFFSET); + +- dev_info(&dev->dev, "%d Kibyte of video memory at 0x%lx\n", ++ dev_info(&dev->dev, "%d KiB of video memory at 0x%lx\n", + info->fix.smem_len / 1024, info->fix.smem_start); + + return 0; + } + ++static int gxfb_ioctl( struct fb_info *info, unsigned int cmd, ++ unsigned long arg) ++{ ++ unsigned int gamma[GXFB_GAMMA_DWORDS]; ++ int ret = -EINVAL; ++ struct geodefb_par *par = info->par; ++ int i; ++ ++ switch(cmd) { ++ case FBIOSGAMMA: ++ /* Read the gamma information from the user - 256 dwords */ ++ ++ if (copy_from_user(gamma, (void * __user) arg, GXFB_GAMMA_SIZE)) ++ return -EFAULT; ++ ++ writel(0, par->vid_regs + GX_GAR); ++ ++ /* Sequential writes to the data register will increment the ++ address automatically */ ++ ++ for(i = 0; i < GXFB_GAMMA_DWORDS; i++) ++ writel(gamma[i] & 0xFFFFFF, par->vid_regs + GX_GDR); ++ ++ writel(readl(par->vid_regs + GX_MISC) & ~GX_MISC_GAM_EN, ++ par->vid_regs + GX_MISC); ++ ++ ret = 0; ++ break; ++ ++ case FBIOGGAMMA: ++ if (readl(par->vid_regs + GX_MISC) & GX_MISC_GAM_EN) ++ return -EINVAL; ++ ++ memset(gamma, 0, GXFB_GAMMA_SIZE); ++ writel(0, par->vid_regs + GX_GAR); ++ ++ for(i = 0; i < GXFB_GAMMA_DWORDS;i++) ++ gamma[i] = readl(par->vid_regs + GX_GDR); ++ ++ if (copy_to_user((void * __user) arg, gamma, GXFB_GAMMA_SIZE)) ++ ret = -EFAULT; ++ else ++ ret = 0; ++ ++ break; ++ ++#ifdef DEBUG ++ case FBIODUMPGP: ++ ret = 0; ++ dump_regs(info, 0); ++ break; ++ ++ case FBIODUMPDC: ++ ret = 0; ++ dump_regs(info, 1); ++ break; ++ ++ case FBIODUMPVP: ++ ret = 0; ++ dump_regs(info, 2); ++ break; ++ ++ case FBIODUMPFP: ++ ret = 0; ++ dump_regs(info, 3); ++ break; ++#endif ++ } ++ ++ return ret; ++} ++ + static struct fb_ops gxfb_ops = { + .owner = THIS_MODULE, + .fb_check_var = gxfb_check_var, + .fb_set_par = gxfb_set_par, + .fb_setcolreg = gxfb_setcolreg, + .fb_blank = gxfb_blank, ++ .fb_ioctl = gxfb_ioctl, + /* No HW acceleration for now. */ + .fb_fillrect = cfb_fillrect, + .fb_copyarea = cfb_copyarea, + .fb_imageblit = cfb_imageblit, ++ .fb_powerdown = gxfb_powerdown, ++ .fb_powerup = gxfb_powerup, + }; + + static struct fb_info * __init gxfb_init_fbinfo(struct device *dev) +@@ -303,23 +426,86 @@ static struct fb_info * __init gxfb_init + return info; + } + +-static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id) ++static int gxfb_console_notify(struct notifier_block *self, ++ unsigned long action, void *data) ++{ ++ if (gxfb_info != NULL) { ++ struct geodefb_par *par = gxfb_info->par; ++ par->fbactive = (action == CONSOLE_EVENT_SWITCH_TEXT) ? 0 : 1; ++ } ++ ++ return NOTIFY_OK; ++} ++ ++static struct notifier_block gxfb_console_notifier = { ++ .notifier_call = gxfb_console_notify ++}; ++ ++#ifdef CONFIG_PM ++ ++static int gxfb_suspend(struct pci_dev *pdev, pm_message_t state) ++{ ++ struct fb_info *info = pci_get_drvdata(pdev); ++ struct geodefb_par *par = info->par; ++ ++ if (pdev->dev.power.power_state.event == state.event) ++ return 0; ++ ++ if (state.event == PM_EVENT_SUSPEND) { ++ ++ acquire_console_sem(); ++ gxfb_powerdown(info); ++ ++ par->state = FB_POWER_STATE_OFF; ++ fb_set_suspend(info, 1); ++ ++ release_console_sem(); ++ } ++ ++ pdev->dev.power.power_state = state; ++ return 0; ++} ++ ++static int gxfb_resume(struct pci_dev *pdev) ++{ ++ struct fb_info *info = pci_get_drvdata(pdev); ++ ++ acquire_console_sem(); ++ ++ /* Turn the engine completely on */ ++ ++ if (gxfb_powerup(info)) ++ printk(KERN_ERR "gxfb: Powerup failed\n"); ++ ++ fb_set_suspend(info, 0); ++ release_console_sem(); ++ ++ pdev->dev.power.power_state = PMSG_ON; ++ return 0; ++} ++#endif ++ ++static int __init gxfb_probe(struct pci_dev *pdev, ++ const struct pci_device_id *id) + { + struct geodefb_par *par; +- struct fb_info *info; + int ret; + unsigned long val; + +- info = gxfb_init_fbinfo(&pdev->dev); +- if (!info) ++ struct fb_videomode *modedb_ptr; ++ int modedb_size; ++ ++ gxfb_info = gxfb_init_fbinfo(&pdev->dev); ++ if (gxfb_info == NULL) + return -ENOMEM; +- par = info->par; ++ ++ par = gxfb_info->par; + + /* GX display controller and GX video device. */ + par->dc_ops = &gx_dc_ops; + par->vid_ops = &gx_vid_ops; + +- if ((ret = gxfb_map_video_memory(info, pdev)) < 0) { ++ if ((ret = gxfb_map_video_memory(gxfb_info, pdev)) < 0) { + dev_err(&pdev->dev, "failed to map frame buffer or controller registers\n"); + goto err; + } +@@ -333,32 +519,60 @@ static int __init gxfb_probe(struct pci_ + else + par->enable_crt = 1; + +- ret = fb_find_mode(&info->var, info, mode_option, +- gx_modedb, ARRAY_SIZE(gx_modedb), NULL, 16); ++ /* Get the current dotclock */ ++ ++ par->curdclk = (par->vid_ops->get_dclk) ? par->vid_ops->get_dclk(gxfb_info) : 0; ++ ++ /* We need to determine a display mode right now, so we will ++ * check to see if the DCON was previously detected by the BIOS ++ * and use that to make our mode database decision. ++ */ ++ ++ modedb_ptr = (struct fb_videomode *) gx_modedb; ++ modedb_size = ARRAY_SIZE(gx_modedb); ++ ++#ifdef CONFIG_OLPC ++ if (olpc_has_dcon()) { ++ modedb_ptr = (struct fb_videomode *) gx_dcon_modedb; ++ modedb_size = ARRAY_SIZE(gx_dcon_modedb); ++ } ++#endif ++ ++ ret = fb_find_mode(&gxfb_info->var, gxfb_info, mode_option, ++ modedb_ptr, modedb_size, NULL, 16); ++ + if (ret == 0 || ret == 4) { + dev_err(&pdev->dev, "could not find valid video mode\n"); + ret = -EINVAL; + goto err; + } + ++ /* Clear the screen of garbage, unless noclear was specified, ++ * in which case we assume the user knows what he is doing */ ++ ++ if (!noclear) ++ memset_io(gxfb_info->screen_base, 0, gxfb_info->fix.smem_len); ++ ++ gxfb_check_var(&gxfb_info->var, gxfb_info); ++ gxfb_set_par(gxfb_info); ++ ++ /* We are powered up */ ++ par->state = FB_POWER_STATE_ON; + +- /* Clear the frame buffer of garbage. */ +- memset_io(info->screen_base, 0, info->fix.smem_len); + +- gxfb_check_var(&info->var, info); +- gxfb_set_par(info); ++ console_event_register(&gxfb_console_notifier); + +- if (register_framebuffer(info) < 0) { ++ if (register_framebuffer(gxfb_info) < 0) { + ret = -EINVAL; + goto err; + } +- pci_set_drvdata(pdev, info); +- printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id); ++ pci_set_drvdata(pdev, gxfb_info); ++ printk(KERN_INFO "fb%d: %s frame buffer device\n", gxfb_info->node, gxfb_info->fix.id); + return 0; + + err: +- if (info->screen_base) { +- iounmap(info->screen_base); ++ if (gxfb_info->screen_base) { ++ iounmap(gxfb_info->screen_base); + pci_release_region(pdev, 0); + } + if (par->vid_regs) { +@@ -370,8 +584,9 @@ static int __init gxfb_probe(struct pci_ + pci_release_region(pdev, 2); + } + +- if (info) +- framebuffer_release(info); ++ if (gxfb_info) ++ framebuffer_release(gxfb_info); ++ + return ret; + } + +@@ -397,9 +612,7 @@ static void gxfb_remove(struct pci_dev * + } + + static struct pci_device_id gxfb_id_table[] = { +- { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_GX_VIDEO, +- PCI_ANY_ID, PCI_ANY_ID, PCI_BASE_CLASS_DISPLAY << 16, +- 0xff0000, 0 }, ++ { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_GX_VIDEO) }, + { 0, } + }; + +@@ -410,22 +623,30 @@ static struct pci_driver gxfb_driver = { + .id_table = gxfb_id_table, + .probe = gxfb_probe, + .remove = gxfb_remove, ++#ifdef CONFIG_PM ++ .suspend = gxfb_suspend, ++ .resume = gxfb_resume ++#endif + }; + + #ifndef MODULE +-static int __init gxfb_setup(char *options) +-{ ++static int __init gxfb_setup(char *options) { + + char *opt; + + if (!options || !*options) + return 0; + +- while ((opt = strsep(&options, ",")) != NULL) { ++ while((opt = strsep(&options, ",")) != NULL) { + if (!*opt) + continue; + +- mode_option = opt; ++ if (!strncmp(opt, "fbsize:", 7)) ++ fbsize = simple_strtoul(opt+7, NULL, 0); ++ else if (!strcmp(opt, "noclear")) ++ noclear = 1; ++ else ++ mode_option = opt; + } + + return 0; +@@ -444,7 +665,6 @@ static int __init gxfb_init(void) + #endif + return pci_register_driver(&gxfb_driver); + } +- + static void __exit gxfb_cleanup(void) + { + pci_unregister_driver(&gxfb_driver); +@@ -456,5 +676,8 @@ module_exit(gxfb_cleanup); + module_param(mode_option, charp, 0); + MODULE_PARM_DESC(mode_option, "video mode (x[-][@])"); + ++module_param(fbsize, int, 0); ++MODULE_PARM_DESC(fbsize, "video memory size"); ++ + MODULE_DESCRIPTION("Framebuffer driver for the AMD Geode GX"); + MODULE_LICENSE("GPL"); +diff -purN linux_2.6.24_org/drivers/video/geode/Kconfig linux_2.6.24_olpc/drivers/video/geode/Kconfig +--- linux_2.6.24_org/drivers/video/geode/Kconfig 2008-02-15 20:11:23.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/video/geode/Kconfig 2008-02-15 18:58:41.000000000 +0000 +@@ -38,26 +38,6 @@ config FB_GEODE_GX + + If unsure, say N. + +-config FB_GEODE_GX_SET_FBSIZE +- bool "Manually specify the Geode GX framebuffer size" +- depends on FB_GEODE_GX +- default n +- ---help--- +- If you want to manually specify the size of your GX framebuffer, +- say Y here, otherwise say N to dynamically probe it. +- +- Say N unless you know what you are doing. +- +-config FB_GEODE_GX_FBSIZE +- hex "Size of the GX framebuffer, in bytes" +- depends on FB_GEODE_GX_SET_FBSIZE +- default "0x1600000" +- ---help--- +- Specify the size of the GX framebuffer. Normally, you will +- want this to be MB aligned. Common values are 0x80000 (8MB) +- and 0x1600000 (16MB). Don't change this unless you know what +- you are doing +- + config FB_GEODE_GX1 + tristate "AMD Geode GX1 framebuffer support (EXPERIMENTAL)" + depends on FB && FB_GEODE && EXPERIMENTAL +diff -purN linux_2.6.24_org/drivers/video/geode/lxfb_core.c linux_2.6.24_olpc/drivers/video/geode/lxfb_core.c +--- linux_2.6.24_org/drivers/video/geode/lxfb_core.c 2008-02-15 20:11:23.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/video/geode/lxfb_core.c 2008-02-15 18:58:41.000000000 +0000 +@@ -21,7 +21,8 @@ + #include + #include + #include +-#include ++#include ++#include + + #include "lxfb.h" + +@@ -35,186 +36,84 @@ static int fbsize; + */ + + const struct fb_videomode geode_modedb[] __initdata = { +- /* 640x480-60 */ +- { NULL, 60, 640, 480, 39682, 48, 8, 25, 2, 88, 2, ++ /* 640x480-60 VESA */ ++ { NULL, 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2, ++ 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, ++ /* 640x480-75 VESA */ ++ { NULL, 75, 640, 480, 31746, 120, 16, 16, 01, 64, 3, ++ 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, ++ /* 640x480-85 VESA */ ++ { NULL, 85, 640, 480, 27777, 80, 56, 25, 01, 56, 3, ++ 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, ++ /* 800x600-60 VESA */ ++ { NULL, 60, 800, 600, 25000, 88, 40, 23, 01, 128, 4, ++ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, ++ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, ++ /* 800x600-75 VESA */ ++ { NULL, 75, 800, 600, 20202, 160, 16, 21, 01, 80, 3, ++ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, ++ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, ++ /* 800x600-85 VESA */ ++ { NULL, 85, 800, 600, 17761, 152, 32, 27, 01, 64, 3, ++ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, ++ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, ++ /* 1024x768-60 VESA */ ++ { NULL, 60, 1024, 768, 15384, 160, 24, 29, 3, 136, 6, ++ 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, ++ /* 1024x768-75 VESA */ ++ { NULL, 75, 1024, 768, 12690, 176, 16, 28, 1, 96, 3, ++ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, ++ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, ++ /* 1024x768-85 VESA */ ++ { NULL, 85, 1024, 768, 10582, 208, 48, 36, 1, 96, 3, ++ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, ++ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, ++ /* 1280x960-60 VESA */ ++ { NULL, 60, 1280, 960, 9259, 312, 96, 36, 1, 112, 3, ++ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, ++ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, ++ /* 1280x960-85 VESA */ ++ { NULL, 85, 1280, 960, 6734, 224, 64, 47, 1, 160, 3, ++ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, ++ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, ++ /* 1280x1024-60 VESA */ ++ { NULL, 60, 1280, 1024, 9259, 248, 48, 38, 1, 112, 3, ++ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, ++ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, ++ /* 1280x1024-75 VESA */ ++ { NULL, 75, 1280, 1024, 7407, 248, 16, 38, 1, 144, 3, ++ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, ++ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, ++ /* 1280x1024-85 VESA */ ++ { NULL, 85, 1280, 1024, 6349, 224, 64, 44, 1, 160, 3, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_NONINTERLACED, 0 }, +- /* 640x400-70 */ +- { NULL, 70, 640, 400, 39770, 40, 8, 28, 5, 96, 2, +- FB_SYNC_HOR_HIGH_ACT, +- FB_VMODE_NONINTERLACED, 0 }, +- /* 640x480-70 */ +- { NULL, 70, 640, 480, 35014, 88, 24, 15, 2, 64, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 640x480-72 */ +- { NULL, 72, 640, 480, 32102, 120, 16, 20, 1, 40, 3, +- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_NONINTERLACED, 0 }, +- /* 640x480-75 */ +- { NULL, 75, 640, 480, 31746, 120, 16, 16, 1, 64, 3, +- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_NONINTERLACED, 0 }, +- /* 640x480-85 */ +- { NULL, 85, 640, 480, 27780, 80, 56, 25, 1, 56, 3, +- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_NONINTERLACED, 0 }, +- /* 640x480-90 */ +- { NULL, 90, 640, 480, 26392, 96, 32, 22, 1, 64, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 640x480-100 */ +- { NULL, 100, 640, 480, 23167, 104, 40, 25, 1, 64, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 640x480-60 */ +- { NULL, 60, 640, 480, 39682, 48, 16, 25, 10, 88, 2, +- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_NONINTERLACED, 0 }, +- /* 800x600-56 */ +- { NULL, 56, 800, 600, 27901, 128, 24, 22, 1, 72, 2, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 800x600-60 */ +- { NULL, 60, 800, 600, 25131, 72, 32, 23, 1, 136, 4, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 800x600-70 */ +- { NULL, 70, 800, 600, 21873, 120, 40, 21, 4, 80, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 800x600-72 */ +- { NULL, 72, 800, 600, 20052, 64, 56, 23, 37, 120, 6, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 800x600-75 */ +- { NULL, 75, 800, 600, 20202, 160, 16, 21, 1, 80, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 800x600-85 */ +- { NULL, 85, 800, 600, 17790, 152, 32, 27, 1, 64, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 800x600-90 */ +- { NULL, 90, 800, 600, 16648, 128, 40, 28, 1, 88, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 800x600-100 */ +- { NULL, 100, 800, 600, 14667, 136, 48, 27, 1, 88, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 800x600-60 */ +- { NULL, 60, 800, 600, 25131, 88, 40, 23, 1, 128, 4, +- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_NONINTERLACED, 0 }, +- /* 1024x768-60 */ +- { NULL, 60, 1024, 768, 15385, 160, 24, 29, 3, 136, 6, +- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_NONINTERLACED, 0 }, +- /* 1024x768-70 */ +- { NULL, 70, 1024, 768, 13346, 144, 24, 29, 3, 136, 6, +- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_NONINTERLACED, 0 }, +- /* 1024x768-72 */ +- { NULL, 72, 1024, 768, 12702, 168, 56, 29, 4, 112, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1024x768-75 */ +- { NULL, 75, 1024, 768, 12703, 176, 16, 28, 1, 96, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1024x768-85 */ +- { NULL, 85, 1024, 768, 10581, 208, 48, 36, 1, 96, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1024x768-90 */ +- { NULL, 90, 1024, 768, 9981, 176, 64, 37, 1, 112, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1024x768-100 */ +- { NULL, 100, 1024, 768, 8825, 184, 72, 42, 1, 112, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1024x768-60 */ +- { NULL, 60, 1024, 768, 15385, 160, 24, 29, 3, 136, 6, +- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_NONINTERLACED, 0 }, +- /* 1152x864-60 */ +- { NULL, 60, 1152, 864, 12251, 184, 64, 27, 1, 120, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1152x864-70 */ +- { NULL, 70, 1152, 864, 10254, 192, 72, 32, 8, 120, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1152x864-72 */ +- { NULL, 72, 1152, 864, 9866, 200, 72, 33, 7, 128, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1152x864-75 */ +- { NULL, 75, 1152, 864, 9259, 256, 64, 32, 1, 128, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1152x864-85 */ +- { NULL, 85, 1152, 864, 8357, 200, 72, 37, 3, 128, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1152x864-90 */ +- { NULL, 90, 1152, 864, 7719, 208, 80, 42, 9, 128, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1152x864-100 */ +- { NULL, 100, 1152, 864, 6947, 208, 80, 48, 3, 128, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1152x864-60 */ +- { NULL, 60, 1152, 864, 12251, 184, 64, 27, 1, 120, 3, +- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_NONINTERLACED, 0 }, +- /* 1280x1024-60 */ +- { NULL, 60, 1280, 1024, 9262, 248, 48, 38, 1, 112, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1280x1024-70 */ +- { NULL, 70, 1280, 1024, 7719, 224, 88, 38, 6, 136, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1280x1024-72 */ +- { NULL, 72, 1280, 1024, 7490, 224, 88, 39, 7, 136, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1280x1024-75 */ +- { NULL, 75, 1280, 1024, 7409, 248, 16, 38, 1, 144, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1280x1024-85 */ +- { NULL, 85, 1280, 1024, 6351, 224, 64, 44, 1, 160, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1280x1024-90 */ +- { NULL, 90, 1280, 1024, 5791, 240, 96, 51, 12, 144, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1280x1024-100 */ +- { NULL, 100, 1280, 1024, 5212, 240, 96, 57, 6, 144, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1280x1024-60 */ +- { NULL, 60, 1280, 1024, 9262, 248, 48, 38, 1, 112, 3, +- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_NONINTERLACED, 0 }, +- /* 1600x1200-60 */ ++ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, ++ /* 1600x1200-60 VESA */ + { NULL, 60, 1600, 1200, 6172, 304, 64, 46, 1, 192, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1600x1200-70 */ +- { NULL, 70, 1600, 1200, 5291, 304, 64, 46, 1, 192, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1600x1200-72 */ +- { NULL, 72, 1600, 1200, 5053, 288, 112, 47, 13, 176, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1600x1200-75 */ ++ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, ++ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, ++ /* 1600x1200-75 VESA */ + { NULL, 75, 1600, 1200, 4938, 304, 64, 46, 1, 192, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1600x1200-85 */ ++ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, ++ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, ++ /* 1600x1200-85 VESA */ + { NULL, 85, 1600, 1200, 4357, 304, 64, 46, 1, 192, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1600x1200-90 */ +- { NULL, 90, 1600, 1200, 3981, 304, 128, 60, 1, 176, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1600x1200-100 */ +- { NULL, 100, 1600, 1200, 3563, 304, 128, 67, 1, 176, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1600x1200-60 */ +- { NULL, 60, 1600, 1200, 6172, 304, 64, 46, 1, 192, 3, + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_NONINTERLACED, 0 }, +- /* 1920x1440-60 */ +- { NULL, 60, 1920, 1440, 4273, 344, 128, 56, 1, 208, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1920x1440-70 */ +- { NULL, 70, 1920, 1440, 3593, 360, 152, 55, 8, 208, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1920x1440-72 */ +- { NULL, 72, 1920, 1440, 3472, 360, 152, 68, 4, 208, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1920x1440-75 */ +- { NULL, 75, 1920, 1440, 3367, 352, 144, 56, 1, 224, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, +- /* 1920x1440-85 */ +- { NULL, 85, 1920, 1440, 2929, 368, 152, 68, 1, 216, 3, +- 0, FB_VMODE_NONINTERLACED, 0 }, ++ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, ++ /* 1200x900-75 - CRT timings for the OLPC mode */ ++ { NULL, 75, 1200, 900, 8049, 104, 240, 29, 54, 136, 3, ++ 0, FB_VMODE_NONINTERLACED, 0 } + }; + ++#ifdef CONFIG_OLPC ++const struct fb_videomode olpc_dcon_modedb[] __initdata = { ++ /* The only mode the DCON has is 1200x900 */ ++ { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3, ++ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, ++ FB_VMODE_NONINTERLACED, 0 } ++}; ++#endif ++ + static int lxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) + { + if (var->xres > 1920 || var->yres > 1440) +@@ -255,8 +154,7 @@ static int lxfb_set_par(struct fb_info * + fb_alloc_cmap(&info->cmap, 1<var.bits_per_pixel, 0); + } + +- info->fix.line_length = lx_get_pitch(info->var.xres, +- info->var.bits_per_pixel); ++ info->fix.line_length = lx_get_pitch(info->var.xres, info->var.bits_per_pixel); + + lx_set_mode(info); + return 0; +@@ -371,24 +269,61 @@ static int __init lxfb_map_video_memory( + writel(info->fix.smem_start & 0xFF000000, + par->dc_regs + DC_PHY_MEM_OFFSET); + +- writel(0, par->dc_regs + DC_UNLOCK); +- + dev_info(&dev->dev, "%d KB of video memory at 0x%lx\n", + info->fix.smem_len / 1024, info->fix.smem_start); + + return 0; + } + ++static int lxfb_set_gamma(struct fb_info *info, void * __user data) ++{ ++ unsigned int gamma[LXFB_GAMMA_DWORDS]; ++ ++ if (copy_from_user(gamma, data, LXFB_GAMMA_SIZE)) ++ return -EFAULT; ++ ++ lx_set_gamma(info, gamma, LXFB_GAMMA_SIZE); ++ return 0; ++} ++ ++static int lxfb_get_gamma(struct fb_info *info, void * __user data) ++{ ++ unsigned int gamma[LXFB_GAMMA_DWORDS]; ++ memset(gamma, 0, sizeof(gamma)); ++ ++ lx_get_gamma(info, gamma, LXFB_GAMMA_DWORDS); ++ ++ return copy_to_user(data, gamma, LXFB_GAMMA_SIZE) ? ++ -EFAULT : 0; ++} ++ ++static int lxfb_ioctl( struct fb_info *info, unsigned int cmd, ++ unsigned long arg) ++{ ++ switch(cmd) { ++ case FBIOSGAMMA: ++ return lxfb_set_gamma(info, (void * __user) arg); ++ ++ case FBIOGGAMMA: ++ return lxfb_get_gamma(info, (void * __user) arg); ++ } ++ ++ return -ENOTTY; ++} ++ + static struct fb_ops lxfb_ops = { + .owner = THIS_MODULE, + .fb_check_var = lxfb_check_var, + .fb_set_par = lxfb_set_par, + .fb_setcolreg = lxfb_setcolreg, + .fb_blank = lxfb_blank, ++ .fb_ioctl = lxfb_ioctl, + /* No HW acceleration for now. */ + .fb_fillrect = cfb_fillrect, + .fb_copyarea = cfb_copyarea, + .fb_imageblit = cfb_imageblit, ++ .fb_powerdown = lx_shutdown, ++ .fb_powerup = lx_powerup, + }; + + static struct fb_info * __init lxfb_init_fbinfo(struct device *dev) +@@ -431,6 +366,45 @@ static struct fb_info * __init lxfb_init + return info; + } + ++#ifdef CONFIG_PM ++ ++static int lxfb_suspend(struct pci_dev *pdev, pm_message_t state) ++{ ++ struct fb_info *info = pci_get_drvdata(pdev); ++ ++ if (pdev->dev.power.power_state.event == state.event) ++ return 0; ++ ++ if (state.event == PM_EVENT_SUSPEND) { ++ ++ acquire_console_sem(); ++ lx_shutdown(info); ++ fb_set_suspend(info, 1); ++ release_console_sem(); ++ } ++ ++ pdev->dev.power.power_state = state; ++ return 0; ++} ++ ++static int lxfb_resume(struct pci_dev *pdev) ++{ ++ struct fb_info *info = pci_get_drvdata(pdev); ++ ++ acquire_console_sem(); ++ ++ /* Turn the engine completely on */ ++ ++ lx_powerup(info); ++ fb_set_suspend(info, 0); ++ release_console_sem(); ++ ++ pdev->dev.power.power_state = PMSG_ON; ++ return 0; ++} ++ ++#endif ++ + static int __init lxfb_probe(struct pci_dev *pdev, + const struct pci_device_id *id) + { +@@ -467,6 +441,13 @@ static int __init lxfb_probe(struct pci_ + modedb_ptr = (struct fb_videomode *) geode_modedb; + modedb_size = ARRAY_SIZE(geode_modedb); + ++#ifdef CONFIG_OLPC ++ if (olpc_has_dcon()) { ++ modedb_ptr = (struct fb_videomode *) olpc_dcon_modedb; ++ modedb_size = ARRAY_SIZE(olpc_dcon_modedb); ++ } ++#endif ++ + ret = fb_find_mode(&info->var, info, mode_option, + modedb_ptr, modedb_size, NULL, 16); + +@@ -556,6 +537,10 @@ static struct pci_driver lxfb_driver = { + .id_table = lxfb_id_table, + .probe = lxfb_probe, + .remove = lxfb_remove, ++#ifdef CONFIG_PM ++ .suspend = lxfb_suspend, ++ .resume = lxfb_resume ++#endif + }; + + #ifndef MODULE +diff -purN linux_2.6.24_org/drivers/video/geode/lxfb.h linux_2.6.24_olpc/drivers/video/geode/lxfb.h +--- linux_2.6.24_org/drivers/video/geode/lxfb.h 2008-02-15 20:11:23.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/video/geode/lxfb.h 2008-02-15 18:58:41.000000000 +0000 +@@ -25,10 +25,23 @@ void lx_set_mode(struct fb_info *); + void lx_get_gamma(struct fb_info *, unsigned int *, int); + void lx_set_gamma(struct fb_info *, unsigned int *, int); + unsigned int lx_framebuffer_size(void); ++int lx_shutdown(struct fb_info *); ++int lx_powerup(struct fb_info *); + int lx_blank_display(struct fb_info *, int); + void lx_set_palette_reg(struct fb_info *, unsigned int, unsigned int, + unsigned int, unsigned int); + ++ ++ ++/* ioctl() defines */ ++ ++#define FBIOSGAMMA _IOW('F', 0x20, void *) ++#define FBIOGGAMMA _IOW('F', 0x21, void *) ++ ++/* General definitions */ ++#define LXFB_GAMMA_DWORDS 256 /* number of dwords in the gamma ram */ ++#define LXFB_GAMMA_SIZE (LXFB_GAMMA_DWORDS * sizeof(unsigned int)) ++ + /* MSRS */ + + #define MSR_LX_GLD_CONFIG 0x48002001 +@@ -127,7 +140,7 @@ void lx_set_palette_reg(struct fb_info * + + #define DC_GFX_SCALE 0x90 + #define DC_IRQ_FILT_CTL 0x94 +- ++#define DC_IRQFILT_H_FILT_SEL 0x00000400 + + #define DC_IRQ 0xC8 + #define DC_IRQ_MASK (1 << 0) +diff -purN linux_2.6.24_org/drivers/video/geode/lxfb_ops.c linux_2.6.24_olpc/drivers/video/geode/lxfb_ops.c +--- linux_2.6.24_org/drivers/video/geode/lxfb_ops.c 2008-02-15 20:11:23.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/video/geode/lxfb_ops.c 2008-02-15 18:58:41.000000000 +0000 +@@ -11,11 +11,15 @@ + #include + #include + #include +-#include +-#include ++#include ++#include ++#include + + #include "lxfb.h" + ++#define _GEODELX_ ++#include "geode_regs.h" ++ + /* TODO + * Support panel scaling + * Add acceleration +@@ -290,6 +294,19 @@ unsigned int lx_framebuffer_size(void) + { + unsigned int val; + ++#ifdef CONFIG_OLPC ++ if (machine_is_olpc() && !olpc_has_vsa()) { ++ u32 hi,lo; ++ rdmsr(MSR_LX_GLIU0_P2D_RO0, lo, hi); ++ ++ /* Top page number */ ++ val = ((hi & 0xff) << 12) | ((lo & 0xfff00000) >> 20); ++ val -= (lo & 0x000fffff); /* Subtract bottom page number */ ++ val += 1; /* Adjust page count */ ++ return (val << 12); ++ } ++#endif ++ + /* The frame buffer size is reported by a VSM in VSA II */ + /* Virtual Register Class = 0x02 */ + /* VG_MEM_SIZE (1MB units) = 0x00 */ +@@ -301,6 +318,34 @@ unsigned int lx_framebuffer_size(void) + return (val << 20); + } + ++void lx_set_gamma(struct fb_info *info, unsigned int *gamma, int len) ++{ ++ int i; ++ struct lxfb_par *par = info->par; ++ ++ writel(0, par->df_regs + DF_PAR); ++ ++ /* Sequential writes to the data register will increment the ++ address automatically */ ++ ++ for(i = 0; i < len; i++) ++ writel(gamma[i] & 0xFFFFFF, par->df_regs + DF_PDR); ++ ++ writel(readl(par->df_regs + DF_MISC) & ~DF_MISC_GAM_BYPASS, ++ par->df_regs + DF_MISC); ++} ++ ++void lx_get_gamma(struct fb_info *info, unsigned int *gamma, int len) ++{ ++ int i; ++ struct lxfb_par *par = info->par; ++ ++ writel(0, par->df_regs + DF_PAR); ++ ++ for(i = 0; i < len;i++) ++ gamma[i] = readl(par->df_regs + DF_PDR); ++} ++ + void lx_set_mode(struct fb_info *info) + { + struct lxfb_par *par = info->par; +@@ -313,6 +358,7 @@ void lx_set_mode(struct fb_info *info) + int vactive, vblankstart, vsyncstart, vsyncend, vblankend, vtotal; + + /* Unlock the DC registers */ ++ readl(par->dc_regs + DC_UNLOCK); + writel(DC_UNLOCK_CODE, par->dc_regs + DC_UNLOCK); + + lx_graphics_disable(info); +@@ -483,54 +529,408 @@ void lx_set_palette_reg(struct fb_info * + writel(val, par->dc_regs + DC_PAL_DATA); + } + ++static int lx_blank_mode = FB_BLANK_UNBLANK; ++ + int lx_blank_display(struct fb_info *info, int blank_mode) + { + struct lxfb_par *par = info->par; +- u32 dcfg, fp_pm; +- int blank, hsync, vsync; ++ u32 dcfg, val; ++ ++ if (blank_mode == lx_blank_mode) ++ return 0; ++ ++ writel(DC_UNLOCK_CODE, par->dc_regs + DC_UNLOCK); ++ ++ if (lx_blank_mode == FB_BLANK_POWERDOWN) { ++ val = readl(par->df_regs + DF_FP_PM); ++ writel(val | DF_FP_PM_P, par->df_regs + DF_FP_PM); ++ val = readl(par->df_regs + DF_MISC) & ~DF_MISC_DAC_PWRDN; ++ writel(val, par->df_regs + DF_MISC); ++ ++ val = readl(par->dc_regs + DC_GENERAL_CFG) | DC_GCFG_DFLE; ++ writel(val, par->dc_regs + DC_GENERAL_CFG); ++ ++ val = readl(par->dc_regs + DC_DISPLAY_CFG) | DC_DCFG_TGEN; ++ writel(val, par->dc_regs + DC_DISPLAY_CFG); ++ } ++ ++ dcfg = readl(par->df_regs + DF_DISPLAY_CFG); + + /* CRT power saving modes. */ + switch (blank_mode) { + case FB_BLANK_UNBLANK: +- blank = 0; hsync = 1; vsync = 1; ++ dcfg |= DF_DCFG_CRT_EN | DF_DCFG_HSYNC_EN | DF_DCFG_VSYNC_EN; ++ dcfg |= DF_DCFG_DAC_BL_EN; + break; + case FB_BLANK_NORMAL: +- blank = 1; hsync = 1; vsync = 1; ++ dcfg |= DF_DCFG_CRT_EN | DF_DCFG_HSYNC_EN | DF_DCFG_VSYNC_EN; ++ dcfg |= DF_DCFG_DAC_BL_EN; + break; + case FB_BLANK_VSYNC_SUSPEND: +- blank = 1; hsync = 1; vsync = 0; ++ dcfg |= DF_DCFG_CRT_EN | DF_DCFG_HSYNC_EN | DF_DCFG_DAC_BL_EN; ++ dcfg &= ~DF_DCFG_VSYNC_EN; + break; + case FB_BLANK_HSYNC_SUSPEND: +- blank = 1; hsync = 0; vsync = 1; ++ dcfg |= DF_DCFG_CRT_EN | DF_DCFG_VSYNC_EN | DF_DCFG_DAC_BL_EN; ++ dcfg &= ~DF_DCFG_HSYNC_EN; + break; + case FB_BLANK_POWERDOWN: +- blank = 1; hsync = 0; vsync = 0; ++ dcfg &= ~DF_DCFG_DAC_BL_EN; ++ dcfg &= ~(DF_DCFG_CRT_EN | DF_DCFG_HSYNC_EN | DF_DCFG_VSYNC_EN); + break; + default: ++ writel(0, par->dc_regs + DC_UNLOCK); + return -EINVAL; + } + +- dcfg = readl(par->df_regs + DF_DISPLAY_CFG); +- dcfg &= ~(DF_DCFG_DAC_BL_EN +- | DF_DCFG_HSYNC_EN | DF_DCFG_VSYNC_EN); +- if (!blank) +- dcfg |= DF_DCFG_DAC_BL_EN; +- if (hsync) +- dcfg |= DF_DCFG_HSYNC_EN; +- if (vsync) +- dcfg |= DF_DCFG_VSYNC_EN; +- writel(dcfg, par->df_regs + DF_DISPLAY_CFG); ++ /* Turn off the engine when we are in power down mode */ ++ if (blank_mode == FB_BLANK_POWERDOWN) { ++ val = readl(par->df_regs + DF_MISC) | DF_MISC_DAC_PWRDN; ++ writel(val, par->df_regs + DF_MISC); ++ ++ val = readl(par->dc_regs + DC_DISPLAY_CFG); ++ val &= ~DC_DCFG_TGEN; ++ writel(val, par->dc_regs + DC_DISPLAY_CFG); ++ ++ udelay(1000); ++ ++ val = readl(par->dc_regs + DC_GENERAL_CFG) & ~DC_GCFG_DFLE; ++ writel(val, par->dc_regs + DC_GENERAL_CFG); ++ ++ val = readl(par->df_regs + DF_FP_PM); ++ writel(val & ~DF_FP_PM_P, par->df_regs + DF_FP_PM); ++ } + ++ writel(0, par->dc_regs + DC_UNLOCK); ++ ++ lx_blank_mode = blank_mode; ++ return 0; ++} ++ ++static struct geoderegs saved_regs; ++ ++static void lx_save_regs(struct fb_info *info, struct geoderegs *regs) ++{ ++ struct lxfb_par *par = info->par; ++ int i; ++ u32 filt; ++ ++ /* Wait for the command buffer to empty */ ++ while(!(readl(par->gp_regs + 0x44) & (1 << 4))); ++ ++ /* Unlock the DC */ ++ writel(DC_UNLOCK_CODE, par->dc_regs + DC_UNLOCK); ++ ++ rdmsrl(MSR_LX_DF_PADSEL, regs->msr.padsel); ++ rdmsrl(MSR_LX_GLCP_DOTPLL, regs->msr.dotpll); ++ rdmsrl(MSR_LX_DF_GLCONFIG, regs->msr.dfglcfg); ++ rdmsrl(MSR_LX_DC_SPARE, regs->msr.dcspare); ++ ++ writel(0x4758, par->dc_regs + 0x00); ++ ++ memcpy(regs->gp.b, par->gp_regs, GP_REG_SIZE); ++ memcpy(regs->dc.b, par->dc_regs, DC_REG_SIZE); ++ memcpy(regs->vp.b, par->df_regs, VP_REG_SIZE); ++ memcpy(regs->fp.b, par->df_regs + VP_FP_START, FP_REG_SIZE); ++ ++ /* Save the palette */ ++ writel(0, par->dc_regs + 0x70); + /* Power on/off flat panel */ ++ for(i = 0; i < DC_PAL_SIZE; i++) ++ regs->pal[i] = readl(par->dc_regs + 0x74); + +- if (par->output & OUTPUT_PANEL) { +- fp_pm = readl(par->df_regs + DF_FP_PM); +- if (blank_mode == FB_BLANK_POWERDOWN) +- fp_pm &= ~DF_FP_PM_P; +- else +- fp_pm |= DF_FP_PM_P; +- writel(fp_pm, par->df_regs + DF_FP_PM); ++ /* save the filter coefficients */ ++ ++ filt = readl(par->dc_regs + 0x94); ++ filt |= DC_IRQFILT_H_FILT_SEL; ++ ++ for(i = 0; i < DC_HFILT_SIZE; i++) { ++ writel((filt & 0xFFFFFF00) | i, par->dc_regs + 0x94); ++ regs->hcoeff[i << 1] = readl(par->dc_regs + 0x98); ++ regs->hcoeff[(i << 1) + 1] = readl(par->dc_regs + 0x9c); ++ } ++ ++ filt &= ~DC_IRQFILT_H_FILT_SEL; ++ ++ for(i = 0; i < DC_VFILT_SIZE; i++) { ++ writel((filt & 0xFFFFFF00) | i, par->dc_regs + 0x94); ++ regs->vcoeff[i] = readl(par->dc_regs + 0x98); + } + ++ /* Save the vg filter coefficients */ ++ for(i = 0; i < VP_COEFF_COUNT; i++) ++ regs->vp_coeff[i] = ++ readl(par->df_regs + 0x1000 + (i << 2)); ++ ++ /* Save the VP gamma */ ++ ++ writel(0, par->df_regs + 0x38); ++ ++ for(i = 0; i <= 0xFF; i++) ++ regs->gamma[i] = readl(par->df_regs + 0x40); ++} ++ ++static void lx_restore_dc(struct lxfb_par *par, struct geoderegs *regs) ++{ ++ u32 filt; ++ int i; ++ ++ /* Unlock the registers */ ++ writel(DC_UNLOCK_CODE, par->dc_regs + 0x00); ++ ++ /* Restore the framebuffer offset */ ++ writel(regs->dc.r.gliu0_mem_offset, par->dc_regs + 0x84); ++ ++ /* Blank the configuration registers while we restore */ ++ writel(0, par->dc_regs + 0x04); ++ writel(0, par->dc_regs + 0x08); ++ ++ /* Restore the bulk of the registers */ ++ ++ writel(regs->dc.r.arb, par->dc_regs + 0x0C); ++ writel(regs->dc.r.fb_st_offset, par->dc_regs + 0x10); ++ writel(regs->dc.r.cb_st_offset, par->dc_regs + 0x14); ++ writel(regs->dc.r.curs_st_offset, par->dc_regs + 0x18); ++ ++ /* skip 0x1c */ ++ ++ writel(regs->dc.r.vid_y_st_offset, par->dc_regs + 0x20); ++ writel(regs->dc.r.vid_u_st_offset, par->dc_regs + 0x24); ++ writel(regs->dc.r.vid_v_st_offset, par->dc_regs + 0x28); ++ ++ writel(regs->dc.r.dctop, par->dc_regs + 0x2c); ++ writel(regs->dc.r.line_size, par->dc_regs + 0x30); ++ writel(regs->dc.r.gfx_pitch, par->dc_regs + 0x34); ++ writel(regs->dc.r.vid_yuv_pitch, par->dc_regs + 0x38); ++ writel(regs->dc.r.h_active_timing, par->dc_regs + 0x40); ++ writel(regs->dc.r.h_blank_timing, par->dc_regs + 0x44); ++ writel(regs->dc.r.h_sync_timing, par->dc_regs + 0x48); ++ writel(regs->dc.r.v_active_timing, par->dc_regs + 0x50); ++ writel(regs->dc.r.v_blank_timing, par->dc_regs + 0x54); ++ writel(regs->dc.r.v_sync_timing, par->dc_regs + 0x58); ++ writel(regs->dc.r.fbactive, par->dc_regs + 0x5c); ++ writel(regs->dc.r.dc_cursor_x, par->dc_regs + 0x60); ++ writel(regs->dc.r.dc_cursor_y, par->dc_regs + 0x64); ++ ++ /* skip 0x68, 0x6c, 0x70, 0x74, 0x78, 0x7c */ ++ ++ writel(regs->dc.r.dc_vid_ds_delta, par->dc_regs + 0x80); ++ ++ /* 0x84 was written above */ ++ ++ writel(regs->dc.r.dv_ctl | 0x01, par->dc_regs + 0x88); ++ writel(regs->dc.r.gfx_scale, par->dc_regs + 0x90); ++ writel(regs->dc.r.irq_filt_ctl, par->dc_regs + 0x94); ++ ++ /* skip 0x98, 0x9c */ ++ ++ writel(regs->dc.r.vbi_event_ctl, par->dc_regs + 0xA0); ++ writel(regs->dc.r.vbi_odd_ctl, par->dc_regs + 0xA4); ++ writel(regs->dc.r.vbi_hor, par->dc_regs + 0xA8); ++ writel(regs->dc.r.vbi_ln_odd, par->dc_regs + 0xAC); ++ writel(regs->dc.r.vbi_ln_event, par->dc_regs + 0xB0); ++ writel(regs->dc.r.vbi_pitch, par->dc_regs + 0xB4); ++ writel(regs->dc.r.clr_key, par->dc_regs + 0xB8); ++ writel(regs->dc.r.clr_key_mask, par->dc_regs + 0xBC); ++ writel(regs->dc.r.clr_key_x, par->dc_regs + 0xC0); ++ writel(regs->dc.r.clr_key_y, par->dc_regs + 0xC4); ++ writel(regs->dc.r.irq, par->dc_regs + 0xC8); ++ writel(regs->dc.r.genlk_ctrl, par->dc_regs + 0xD4); ++ writel(regs->dc.r.vid_even_y_st_offset, par->dc_regs + 0xD8); ++ writel(regs->dc.r.vid_even_u_st_offset, par->dc_regs + 0xDC); ++ writel(regs->dc.r.vid_even_v_st_offset, par->dc_regs + 0xE0); ++ writel(regs->dc.r.v_active_even_timing, par->dc_regs + 0xE4); ++ writel(regs->dc.r.v_blank_even_timing, par->dc_regs + 0xE8); ++ writel(regs->dc.r.v_sync_even_timing, par->dc_regs + 0xEC); ++ ++ /* Restore the palette */ ++ writel(0, par->dc_regs + 0x70); ++ ++ for(i = 0; i < DC_PAL_SIZE; i++) ++ writel(regs->pal[i], par->dc_regs + 0x74); ++ ++ /* Restore the horizontal filter coefficients */ ++ filt = readl(par->dc_regs + 0x94); ++ filt |= DC_IRQFILT_H_FILT_SEL; ++ ++ for(i = 0; i < DC_HFILT_SIZE; i++) { ++ writel(((filt & 0xFFFFFF00) | i), par->dc_regs + 0x94); ++ writel(regs->hcoeff[i << 1], par->dc_regs + 0x98); ++ writel(regs->hcoeff[(i << 1) + 1], par->dc_regs + 0x9c); ++ } ++ ++ filt &= ~DC_IRQFILT_H_FILT_SEL; ++ ++ for(i = 0; i < DC_VFILT_SIZE; i++) { ++ writel(((filt & 0xFFFFFF00) | i), par->dc_regs + 0x94); ++ writel(regs->vcoeff[i], par->dc_regs + 0x98); ++ } ++ ++ /* Turn on the dotpll */ ++ lx_set_dotpll((u32) (regs->msr.dotpll >> 32)); ++ ++ /* Restore MSRs */ ++ wrmsrl(MSR_LX_DC_SPARE, regs->msr.dcspare); ++ ++ /* Restore the configuration registers */ ++ ++ writel(regs->dc.r.dcfg, par->dc_regs + 0x08); ++ writel(regs->dc.r.gcfg, par->dc_regs + 0x04); ++ ++ /* Lock the DC again */ ++ writel(0, par->dc_regs + 0x00); ++} ++ ++static void lx_restore_vp(struct lxfb_par *par, struct geoderegs *regs) ++{ ++ u32 val; ++ int i; ++ ++ /* Restore MSRs */ ++ ++ wrmsrl(MSR_LX_DF_GLCONFIG, regs->msr.dfglcfg); ++ wrmsrl(MSR_LX_DF_PADSEL, regs->msr.padsel); ++ ++ /* Restore the registers */ ++ ++ writel((u32) regs->vp.r.vx, par->df_regs + 0x10); ++ writel((u32) regs->vp.r.vy, par->df_regs + 0x18); ++ writel((u32) regs->vp.r.vs, par->df_regs + 0x20); ++ writel((u32) regs->vp.r.vck, par->df_regs + 0x28); ++ writel((u32) regs->vp.r.vcm, par->df_regs + 0x30); ++ /* skip 0x38 and 0x40 */ ++ writel((u32) regs->vp.r.slr, par->df_regs + 0x48); ++ writel((u32) regs->vp.r.misc, par->df_regs + 0x50); ++ /* skip 0x58 */ ++ writel((u32) regs->vp.r.vys, par->df_regs + 0x60); ++ writel((u32) regs->vp.r.vxs, par->df_regs + 0x68); ++ writel((u32) regs->vp.r.vde, par->df_regs + 0x98); ++ writel((u32) regs->vp.r.cck, par->df_regs + 0xA0); ++ writel((u32) regs->vp.r.ccm, par->df_regs + 0xA8); ++ writel((u32) regs->vp.r.cc1, par->df_regs + 0xB0); ++ writel((u32) regs->vp.r.cc2, par->df_regs + 0xB8); ++ writel((u32) regs->vp.r.a1x, par->df_regs + 0xC0); ++ writel((u32) regs->vp.r.a1y, par->df_regs + 0xC8); ++ writel((u32) regs->vp.r.a1c, par->df_regs + 0xD0); ++ writel((u32) regs->vp.r.a1t, par->df_regs + 0xD8); ++ writel((u32) regs->vp.r.a2x, par->df_regs + 0xE0); ++ writel((u32) regs->vp.r.a2y, par->df_regs + 0xE8); ++ writel((u32) regs->vp.r.a2c, par->df_regs + 0xF0); ++ writel((u32) regs->vp.r.a2t, par->df_regs + 0xF8); ++ writel((u32) regs->vp.r.a3x, par->df_regs + 0x100); ++ writel((u32) regs->vp.r.a3y, par->df_regs + 0x108); ++ writel((u32) regs->vp.r.a3c, par->df_regs + 0x110); ++ writel((u32) regs->vp.r.a3t, par->df_regs + 0x118); ++ writel((u32) regs->vp.r.vrr, par->df_regs + 0x120); ++ writel((u32) regs->vp.r.vye, par->df_regs + 0x138); ++ writel((u32) regs->vp.r.a1ye, par->df_regs + 0x140); ++ writel((u32) regs->vp.r.a2ye, par->df_regs + 0x148); ++ writel((u32) regs->vp.r.a3ye, par->df_regs + 0x150); ++ ++ /* Panel */ ++ ++ writel((u32) regs->fp.r.pt1, par->df_regs + 0x400); ++ writel((u32) regs->fp.r.pt2, par->df_regs + 0x408); ++ writel((u32) regs->fp.r.dfc, par->df_regs + 0x418); ++ ++ /* Restore panel power */ ++ ++ val = readl(par->df_regs + 0x410); ++ ++ if (regs->fp.r.pm & (1 << 24)) { ++ if (!(val & 0x09)) ++ writel(regs->fp.r.pm, par->df_regs + 0x410); ++ } ++ else { ++ if (!(val & 0x05)) ++ writel(regs->fp.r.pm, par->df_regs + 0x410); ++ } ++ ++ /* Restore the vp palette */ ++ ++ writel(0, par->df_regs + 0x38); ++ ++ for(i = 0; i <= 0xFF; i++) ++ writel((u32) regs->gamma[i], par->df_regs + 0x40); ++ ++ /* Restore filter coefficients */ ++ ++ for(i = 0; i < VP_COEFF_COUNT; i++) ++ writel(regs->vp_coeff[i], ++ par->df_regs + 0x1000 + (i << 2)); ++ ++ /* Restore the configuration registers */ ++ ++ writel((u32) regs->vp.r.dcfg, par->df_regs + 0x08); ++ writel((u32) regs->vp.r.vcfg, par->df_regs + 0x00); ++} ++ ++static void lx_restore_gp(struct lxfb_par *par, struct geoderegs *regs) ++{ ++ writel(regs->gp.r.dst_offset, par->gp_regs + 0x00); ++ writel(regs->gp.r.src_offset, par->gp_regs + 0x04); ++ writel(regs->gp.r.stride, par->gp_regs + 0x08); ++ writel(regs->gp.r.wid_height, par->gp_regs + 0x0C); ++ writel(regs->gp.r.src_color_fg, par->gp_regs + 0x10); ++ writel(regs->gp.r.src_color_bg, par->gp_regs + 0x14); ++ writel(regs->gp.r.pat_color_0, par->gp_regs + 0x18); ++ writel(regs->gp.r.pat_color_1, par->gp_regs + 0x1C); ++ writel(regs->gp.r.pat_color_2, par->gp_regs + 0x20); ++ writel(regs->gp.r.pat_color_3, par->gp_regs + 0x24); ++ writel(regs->gp.r.pat_color_4, par->gp_regs + 0x28); ++ writel(regs->gp.r.pat_color_5, par->gp_regs + 0x2C); ++ writel(regs->gp.r.pat_data_0, par->gp_regs + 0x30); ++ writel(regs->gp.r.pat_data_1, par->gp_regs + 0x34); ++ ++ /* Writing to these registers would cause a blt to happen */ ++ /* 0x38, 0x3c, 0x40 */ ++ ++ /* Status register (0x44) is read only */ ++ ++ writel(regs->gp.r.hst_src, par->gp_regs + 0x48); ++ writel(regs->gp.r.base_offset, par->gp_regs + 0x4c); ++ writel(regs->gp.r.cmd_top, par->gp_regs + 0x50); ++ writel(regs->gp.r.cmd_bot, par->gp_regs + 0x54); ++ writel(regs->gp.r.cmd_read, par->gp_regs + 0x58); ++ writel(regs->gp.r.cmd_write, par->gp_regs + 0x5C); ++ writel(regs->gp.r.ch3_offset, par->gp_regs + 0x60); ++ writel(regs->gp.r.ch3_mode_str, par->gp_regs + 0x64); ++ writel(regs->gp.r.ch3_width, par->gp_regs + 0x6C); ++ writel(regs->gp.r.ch3_hsrc, par->gp_regs + 0x70); ++ ++ writel(regs->gp.r.int_cntrl, par->gp_regs + 0x70); ++} ++ ++static void lx_restore_regs(struct fb_info *info, struct geoderegs *regs) ++{ ++ struct lxfb_par *par = info->par; ++ ++ lx_restore_gp(par, regs); ++ lx_restore_vp(par, regs); ++ lx_restore_dc(par, regs); ++} ++ ++static int lx_power_on = 1; ++ ++int lx_shutdown(struct fb_info *info) ++{ ++ if (lx_power_on == 0) ++ return 0; ++ ++ lx_save_regs(info, &saved_regs); ++ lx_graphics_disable(info); ++ ++ lx_power_on = 0; ++ return 0; ++} ++ ++int lx_powerup(struct fb_info *info) ++{ ++ if (lx_power_on == 1) ++ return 0; ++ ++ lx_restore_regs(info, &saved_regs); ++ ++ lx_power_on = 1; + return 0; + } +diff -purN linux_2.6.24_org/drivers/video/geode/Makefile linux_2.6.24_olpc/drivers/video/geode/Makefile +--- linux_2.6.24_org/drivers/video/geode/Makefile 2008-02-15 20:11:23.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/video/geode/Makefile 2008-02-15 18:58:41.000000000 +0000 +@@ -5,5 +5,5 @@ obj-$(CONFIG_FB_GEODE_GX) += gxfb.o + obj-$(CONFIG_FB_GEODE_LX) += lxfb.o + + gx1fb-objs := gx1fb_core.o display_gx1.o video_cs5530.o +-gxfb-objs := gxfb_core.o display_gx.o video_gx.o ++gxfb-objs := gxfb_core.o display_gx.o video_gx.o suspend_gx.o + lxfb-objs := lxfb_core.o lxfb_ops.o +diff -purN linux_2.6.24_org/drivers/video/geode/suspend_gx.c linux_2.6.24_olpc/drivers/video/geode/suspend_gx.c +--- linux_2.6.24_org/drivers/video/geode/suspend_gx.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/drivers/video/geode/suspend_gx.c 2008-02-15 18:58:41.000000000 +0000 +@@ -0,0 +1,272 @@ ++#include ++#include ++#include ++ ++#include "geodefb.h" ++#include "video_gx.h" ++ ++void gx_set_dotpll(struct fb_info *info, struct geoderegs *regs) ++{ ++ int timeout = 1000; ++ ++ u64 rstpll, dotpll; ++ ++ rdmsrl(MSR_GLCP_SYS_RSTPLL, rstpll); ++ rdmsrl(MSR_GLCP_DOTPLL, dotpll); ++ ++ dotpll &= 0x00000000ffffffffull; ++ dotpll |= regs->msr.dotpll & 0xffffffff00000000ull; ++ ++ dotpll |= MSR_GLCP_DOTPLL_DOTRESET; ++ dotpll &= ~MSR_GLCP_DOTPLL_BYPASS; ++ ++ wrmsrl(MSR_GLCP_DOTPLL, dotpll); ++ ++ rstpll |= (regs->msr.rstpll & ++ ( MSR_GLCP_SYS_RSTPLL_DOTPREDIV2 | ++ MSR_GLCP_SYS_RSTPLL_DOTPREMULT2 | ++ MSR_GLCP_SYS_RSTPLL_DOTPOSTDIV3)); ++ ++ wrmsrl(MSR_GLCP_SYS_RSTPLL, rstpll); ++ dotpll &= ~(MSR_GLCP_DOTPLL_DOTRESET); ++ wrmsrl(MSR_GLCP_DOTPLL, dotpll); ++ ++ do { ++ rdmsrl(MSR_GLCP_DOTPLL, dotpll); ++ } while (timeout-- && !(dotpll & MSR_GLCP_DOTPLL_LOCK)); ++} ++ ++/* FIXME: Make sure nothing is read to clear */ ++ ++void gx_save_regs(struct fb_info *info, struct geoderegs *regs) ++{ ++ struct geodefb_par *par = info->par; ++ int i; ++ ++ /* Wait for the BLT engine to stop being busy */ ++ while(readl(par->gp_regs + 0x44) & 0x05); ++ ++ rdmsrl(GX_VP_MSR_PAD_SELECT, regs->msr.padsel); ++ rdmsrl(MSR_GLCP_DOTPLL, regs->msr.dotpll); ++ rdmsrl(MSR_GLCP_SYS_RSTPLL, regs->msr.rstpll); ++ ++ writel(0x4758, par->dc_regs + 0x00); ++ ++ memcpy(regs->gp.b, par->gp_regs, GP_REG_SIZE); ++ memcpy(regs->dc.b, par->dc_regs, DC_REG_SIZE); ++ memcpy(regs->vp.b, par->vid_regs, VP_REG_SIZE); ++ memcpy(regs->fp.b, par->vid_regs + 0x400, FP_REG_SIZE); ++ ++ /* Save the palettes */ ++ writel(0, par->dc_regs + 0x70); ++ ++ for(i = 0; i < DC_PAL_SIZE; i++) ++ regs->pal[i] = readl(par->dc_regs + 0x74); ++ ++ writel(0, par->vid_regs + 0x38); ++ ++ for(i = 0; i < 0xFF; i++) ++ regs->gamma[i] = readl(par->vid_regs + 0x40); ++} ++ ++void gx_restore_regs(struct fb_info *info, struct geoderegs *regs) ++{ ++ struct geodefb_par *par = info->par; ++ u32 val, i; ++ ++ /* DOTPLL */ ++ gx_set_dotpll(info, regs); ++ ++ /* GP */ ++ ++ writel(regs->gp.r.dst_offset, par->gp_regs + 0x00); ++ writel(regs->gp.r.src_offset, par->gp_regs + 0x04); ++ writel(regs->gp.r.stride, par->gp_regs + 0x08); ++ writel(regs->gp.r.wid_height, par->gp_regs + 0x0C); ++ writel(regs->gp.r.src_color_fg, par->gp_regs + 0x10); ++ writel(regs->gp.r.src_color_bg, par->gp_regs + 0x14); ++ writel(regs->gp.r.pat_color_0, par->gp_regs + 0x18); ++ writel(regs->gp.r.pat_color_1, par->gp_regs + 0x1C); ++ writel(regs->gp.r.pat_color_2, par->gp_regs + 0x20); ++ writel(regs->gp.r.pat_color_3, par->gp_regs + 0x24); ++ writel(regs->gp.r.pat_color_4, par->gp_regs + 0x28); ++ writel(regs->gp.r.pat_color_5, par->gp_regs + 0x2C); ++ writel(regs->gp.r.pat_data_0, par->gp_regs + 0x30); ++ writel(regs->gp.r.pat_data_1, par->gp_regs + 0x34); ++ ++ /* Don't write the raster / vector / blt mode regs */ ++ /* status register is read only */ ++ ++ writel(regs->gp.r.hst_src, par->gp_regs + 0x48); ++ writel(regs->gp.r.base_offset, par->gp_regs + 0x4c); ++ ++ /* DC */ ++ ++ /* Write the unlock value */ ++ writel(0x4758, par->dc_regs + 0x00); ++ ++ writel(0, par->dc_regs + 0x70); ++ ++ for(i = 0; i < DC_PAL_SIZE; i++) ++ writel(regs->pal[i], par->dc_regs + 0x74); ++ ++ /* Write the gcfg register without the enables */ ++ writel(regs->dc.r.gcfg & ~0x0F, par->dc_regs + 0x04); ++ ++ /* Write the vcfg register without the enables */ ++ writel(regs->dc.r.dcfg & ~0x19, par->dc_regs + 0x08); ++ ++ /* Write the rest of the active registers */ ++ ++ writel(regs->dc.r.fb_st_offset, par->dc_regs + 0x10); ++ writel(regs->dc.r.cb_st_offset, par->dc_regs + 0x14); ++ writel(regs->dc.r.curs_st_offset, par->dc_regs + 0x18); ++ writel(regs->dc.r.icon_st_offset, par->dc_regs + 0x1C); ++ writel(regs->dc.r.vid_y_st_offset, par->dc_regs + 0x20); ++ writel(regs->dc.r.vid_u_st_offset, par->dc_regs + 0x24); ++ writel(regs->dc.r.vid_v_st_offset, par->dc_regs + 0x28); ++ writel(regs->dc.r.line_size, par->dc_regs + 0x30); ++ writel(regs->dc.r.gfx_pitch, par->dc_regs + 0x34); ++ writel(regs->dc.r.vid_yuv_pitch, par->dc_regs + 0x38); ++ writel(regs->dc.r.h_active_timing, par->dc_regs + 0x40); ++ writel(regs->dc.r.h_blank_timing, par->dc_regs + 0x44); ++ writel(regs->dc.r.h_sync_timing, par->dc_regs + 0x48); ++ writel(regs->dc.r.v_active_timing, par->dc_regs + 0x50); ++ writel(regs->dc.r.v_blank_timing, par->dc_regs + 0x54); ++ writel(regs->dc.r.v_sync_timing, par->dc_regs + 0x58); ++ writel(regs->dc.r.dc_cursor_x, par->dc_regs + 0x60); ++ writel(regs->dc.r.dc_cursor_y, par->dc_regs + 0x64); ++ writel(regs->dc.r.dc_icon_x, par->dc_regs + 0x68); ++ ++ /* Don't write the line_cnt or diag registers */ ++ ++ writel(regs->dc.r.dc_vid_ds_delta, par->dc_regs + 0x80); ++ writel(regs->dc.r.gliu0_mem_offset, par->dc_regs + 0x84); ++ writel(regs->dc.r.dv_acc, par->dc_regs + 0x8C); ++ ++ /* VP */ ++ ++ /* MSR */ ++ wrmsrl(GX_VP_MSR_PAD_SELECT, regs->msr.padsel); ++ ++ writel(0, par->vid_regs + 0x38); ++ ++ for(i = 0; i < 0xFF; i++) ++ writel((u32) regs->gamma[i], par->vid_regs + 0x40); ++ ++ /* Don't enable video yet */ ++ writel((u32) regs->vp.r.vcfg & ~0x01, par->vid_regs + 0x00); ++ ++ /* Don't enable the CRT yet */ ++ writel((u32) regs->vp.r.dcfg & ~0x0F, par->vid_regs + 0x08); ++ ++ /* Write the rest of the VP registers */ ++ ++ writel((u32) regs->vp.r.vx, par->vid_regs + 0x10); ++ writel((u32) regs->vp.r.vy, par->vid_regs + 0x18); ++ writel((u32) regs->vp.r.vs, par->vid_regs + 0x20); ++ writel((u32) regs->vp.r.vck, par->vid_regs + 0x28); ++ writel((u32) regs->vp.r.vcm, par->vid_regs + 0x30); ++ writel((u32) regs->vp.r.misc, par->vid_regs + 0x50); ++ writel((u32) regs->vp.r.ccs, par->vid_regs + 0x58); ++ writel((u32) regs->vp.r.vdc, par->vid_regs + 0x78); ++ writel((u32) regs->vp.r.vco, par->vid_regs + 0x80); ++ writel((u32) regs->vp.r.crc, par->vid_regs + 0x88); ++ writel((u32) regs->vp.r.vde, par->vid_regs + 0x98); ++ writel((u32) regs->vp.r.cck, par->vid_regs + 0xA0); ++ writel((u32) regs->vp.r.ccm, par->vid_regs + 0xA8); ++ writel((u32) regs->vp.r.cc1, par->vid_regs + 0xB0); ++ writel((u32) regs->vp.r.cc2, par->vid_regs + 0xB8); ++ writel((u32) regs->vp.r.a1x, par->vid_regs + 0xC0); ++ writel((u32) regs->vp.r.a1y, par->vid_regs + 0xC8); ++ writel((u32) regs->vp.r.a1c, par->vid_regs + 0xD0); ++ writel((u32) regs->vp.r.a1t, par->vid_regs + 0xD8); ++ writel((u32) regs->vp.r.a2x, par->vid_regs + 0xE0); ++ writel((u32) regs->vp.r.a2y, par->vid_regs + 0xE8); ++ writel((u32) regs->vp.r.a2c, par->vid_regs + 0xF0); ++ writel((u32) regs->vp.r.a2t, par->vid_regs + 0xF8); ++ writel((u32) regs->vp.r.a3x, par->vid_regs + 0x100); ++ writel((u32) regs->vp.r.a3y, par->vid_regs + 0x108); ++ writel((u32) regs->vp.r.a3c, par->vid_regs + 0x110); ++ writel((u32) regs->vp.r.a3t, par->vid_regs + 0x118); ++ writel((u32) regs->vp.r.vrr, par->vid_regs + 0x120); ++ ++ ++ /* FP registers */ ++ ++ writel((u32) regs->fp.r.pt1, par->vid_regs + 0x400); ++ writel((u32) regs->fp.r.pt2, par->vid_regs + 0x408); ++ ++ writel((u32) regs->fp.r.dfc, par->vid_regs + 0x418); ++ writel(regs->fp.r.blfsr, par->vid_regs + 0x420); ++ writel(regs->fp.r.rlfsr, par->vid_regs + 0x428); ++ writel(regs->fp.r.fmi, par->vid_regs + 0x430); ++ writel(regs->fp.r.fmd, par->vid_regs + 0x438); ++ writel(regs->fp.r.dca, par->vid_regs + 0x448); ++ writel(regs->fp.r.dmd, par->vid_regs + 0x450); ++ writel(regs->fp.r.crc, par->vid_regs + 0x458); ++ writel(regs->fp.r.fbb, par->vid_regs + 0x460); ++ ++ /* Final enables */ ++ ++ val = readl(par->vid_regs + 0x410); ++ ++ /* Control the panel */ ++ if (regs->fp.r.pm & (1 << 24)) { ++ ++ if (!(val & 0x09)) ++ writel(regs->fp.r.pm, par->vid_regs + 0x410); ++ } ++ else { ++ if (!(val & 0x05)) ++ writel(regs->fp.r.pm, par->vid_regs + 0x410); ++ } ++ ++ /* Turn everything on */ ++ ++ writel(regs->dc.r.gcfg, par->dc_regs + 0x04); ++ writel((u32) regs->vp.r.vcfg, par->vid_regs + 0x00); ++ writel((u32) regs->vp.r.dcfg, par->vid_regs + 0x08); ++ writel(regs->dc.r.dcfg, par->dc_regs + 0x08); ++} ++ ++ ++#ifdef DEBUG ++ ++void dump_regs(struct fb_info *info, int mode) { ++ ++ struct geodefb_par *par = info->par; ++ u32 val; ++ int i; ++ ++ if (mode == 0) { ++ for(i = 0; i < GP_REG_SIZE; i += 4) { ++ val = readl(par->gp_regs + i); ++ } ++ } ++ ++ if (mode == 1) { ++ writel(0x4758, par->dc_regs + 0x00); ++ ++ for(i = 0; i < DC_REG_SIZE; i += 4) { ++ val = readl(par->dc_regs + i); ++ printk("DC%x: %x\n", i, val); ++ } ++ } ++ ++ if (mode == 2) { ++ for(i = 0; i < VP_REG_SIZE; i += 8) { ++ val = readl(par->vid_regs + i); ++ printk("VP%x: %x\n", i, val); ++ } ++ } ++ ++ if (mode == 3) { ++ for(i = 0; i < FP_REG_SIZE; i += 8) { ++ val = readl(par->vid_regs + 0x400 + i); ++ printk("FP%x: %x\n", i, val); ++ } ++ } ++} ++ ++#endif +diff -purN linux_2.6.24_org/drivers/video/geode/video_gx.c linux_2.6.24_olpc/drivers/video/geode/video_gx.c +--- linux_2.6.24_org/drivers/video/geode/video_gx.c 2008-02-15 20:11:23.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/video/geode/video_gx.c 2008-02-15 18:58:41.000000000 +0000 +@@ -16,10 +16,14 @@ + #include + #include + #include ++#include + + #include "geodefb.h" + #include "video_gx.h" ++#include "display_gx.h" + ++/* This structure is used to store the saved registers during suspend */ ++static struct geoderegs gx_saved_regs; + + /* + * Tables of register settings for various DOTCLKs. +@@ -58,7 +62,7 @@ static const struct gx_pll_entry gx_pll_ + { 13888, POSTDIV3, 0x000007E1 }, /* 72.0000 */ + { 13426, PREMULT2, 0x00000F4A }, /* 74.4810 */ + { 13333, 0, 0x00000052 }, /* 75.0000 */ +- { 12698, 0, 0x00000056 }, /* 78.7500 */ ++ { 12698, 0, 0x00000056 }, /* 78.7500 */ + { 12500, POSTDIV3|PREMULT2, 0x00000709 }, /* 80.0000 */ + { 11135, PREMULT2, 0x00000262 }, /* 89.8000 */ + { 10582, 0, 0x000002D2 }, /* 94.5000 */ +@@ -117,8 +121,9 @@ static const struct gx_pll_entry gx_pll_ + { 4357, 0, 0x0000057D }, /* 229.5000 */ + }; + +-static void gx_set_dclk_frequency(struct fb_info *info) ++void gx_set_dclk_frequency(struct fb_info *info) + { ++ struct geodefb_par *par = info->par; + const struct gx_pll_entry *pll_table; + int pll_table_len; + int i, best_i; +@@ -173,115 +178,169 @@ static void gx_set_dclk_frequency(struct + do { + rdmsrl(MSR_GLCP_DOTPLL, dotpll); + } while (timeout-- && !(dotpll & MSR_GLCP_DOTPLL_LOCK)); ++ ++ par->curdclk = pll_table[best_i].dotpll_value; + } + +-static void +-gx_configure_tft(struct fb_info *info) ++/* Find out the current clock - we will use this information to avoid ++ re-programming it if we don't need to */ ++ ++unsigned int gx_get_dclk(struct fb_info *info) + { +- struct geodefb_par *par = info->par; +- unsigned long val; +- unsigned long fp; ++ const struct gx_pll_entry *pll_table; ++ int pll_table_len; ++ u64 dotpll; ++ int i; + +- /* Set up the DF pad select MSR */ ++ if (cpu_data(0).x86_mask == 1) { ++ pll_table = gx_pll_table_14MHz; ++ pll_table_len = ARRAY_SIZE(gx_pll_table_14MHz); ++ } else { ++ pll_table = gx_pll_table_48MHz; ++ pll_table_len = ARRAY_SIZE(gx_pll_table_48MHz); ++ } + +- rdmsrl(GX_VP_MSR_PAD_SELECT, val); +- val &= ~GX_VP_PAD_SELECT_MASK; +- val |= GX_VP_PAD_SELECT_TFT; +- wrmsrl(GX_VP_MSR_PAD_SELECT, val); ++ rdmsrl(MSR_GLCP_DOTPLL, dotpll); + +- /* Turn off the panel */ ++ for(i = 0; i < pll_table_len; i++) { ++ if (pll_table[i].dotpll_value == (u32) (dotpll >> 32)) ++ break; ++ } ++ ++ return (i == pll_table_len) ? 0 : pll_table[i].pixclock; ++} + +- fp = readl(par->vid_regs + GX_FP_PM); +- fp &= ~GX_FP_PM_P; +- writel(fp, par->vid_regs + GX_FP_PM); + +- /* Set timing 1 */ ++#define CMP(val, mask, res) (((val) & (mask)) == (res)) + +- fp = readl(par->vid_regs + GX_FP_PT1); +- fp &= GX_FP_PT1_VSIZE_MASK; +- fp |= info->var.yres << GX_FP_PT1_VSIZE_SHIFT; +- writel(fp, par->vid_regs + GX_FP_PT1); ++static void ++gx_configure_tft(struct fb_info *info) { + +- /* Timing 2 */ +- /* Set bits that are always on for TFT */ ++ struct geodefb_par *par = info->par; ++ u32 val, fp = 0, fp1, fp2, sync = 0; + +- fp = 0x0F100000; ++ /* Set up the DF pad select MSR */ + +- /* Add sync polarity */ ++ rdmsrl(GX_VP_MSR_PAD_SELECT, val); ++ ++ if ((val & GX_VP_PAD_SELECT_MASK) != GX_VP_PAD_SELECT_TFT) { ++ val &= ~GX_VP_PAD_SELECT_MASK; ++ val |= GX_VP_PAD_SELECT_TFT; ++ wrmsrl(GX_VP_MSR_PAD_SELECT, val); ++ } + + if (!(info->var.sync & FB_SYNC_VERT_HIGH_ACT)) +- fp |= GX_FP_PT2_VSP; ++ sync |= GX_FP_PT2_VSP; + + if (!(info->var.sync & FB_SYNC_HOR_HIGH_ACT)) +- fp |= GX_FP_PT2_HSP; ++ sync |= GX_FP_PT2_HSP; + +- writel(fp, par->vid_regs + GX_FP_PT2); ++ /* We only need to turn off the panel if something changed */ + +- /* Set the dither control */ +- writel(0x70, par->vid_regs + GX_FP_DFC); ++ fp1 = readl(par->vid_regs + GX_FP_PT1); ++ fp2 = readl(par->vid_regs + GX_FP_PT2); ++ ++ if (!CMP(fp1, GX_FP_PT1_VSIZE_MASK, info->var.yres << GX_FP_PT1_VSIZE_SHIFT) || ++ (fp2 != (0x0F100000 | sync))) { ++ ++ /* Turn off the panel */ ++ ++#ifdef NOTUSED ++ /* Do we really need to turn off the panel? */ ++ /* Possibly - we have a glitch somewhere */ + +- /* Enable the FP data and power (in case the BIOS didn't) */ ++ fp = readl(par->vid_regs + GX_FP_PM); ++ fp &= ~GX_FP_PM_P; ++ writel(fp, par->vid_regs + GX_FP_PM); ++#endif + +- fp = readl(par->vid_regs + GX_DCFG); +- fp |= GX_DCFG_FP_PWR_EN | GX_DCFG_FP_DATA_EN; +- writel(fp, par->vid_regs + GX_DCFG); ++ /* Timing 1 */ ++ fp1 &= GX_FP_PT1_VSIZE_MASK; ++ fp1 |= info->var.yres << GX_FP_PT1_VSIZE_SHIFT; ++ writel(fp, par->vid_regs + GX_FP_PT1); + +- /* Unblank the panel */ ++ /* Timing 2 */ ++ writel(0x0F100000 | sync, par->vid_regs + GX_FP_PT2); ++ } ++ ++ /* Set the dither control */ ++ if (readl(par->vid_regs + GX_FP_DFC) != 0x70) { ++ writel(0x70, par->vid_regs + GX_FP_DFC); ++ } ++ ++ /* Turn on the panel */ + + fp = readl(par->vid_regs + GX_FP_PM); +- fp |= GX_FP_PM_P; +- writel(fp, par->vid_regs + GX_FP_PM); ++ ++ if (!(fp & 0x09)) ++ writel(fp | GX_FP_PM_P, par->vid_regs + GX_FP_PM); + } + ++#define DCFG_DEFAULT_VAL GX_DCFG_CRT_SYNC_SKW_DFLT | GX_DCFG_HSYNC_EN | GX_DCFG_VSYNC_EN | \ ++GX_DCFG_CRT_EN | GX_DCFG_DAC_BL_EN ++ + static void gx_configure_display(struct fb_info *info) + { + struct geodefb_par *par = info->par; +- u32 dcfg, misc; ++ u32 dcfg, misc, sync = 0; + + /* Set up the MISC register */ +- + misc = readl(par->vid_regs + GX_MISC); + +- /* Power up the DAC */ +- misc &= ~(GX_MISC_A_PWRDN | GX_MISC_DAC_PWRDN); ++ /* We leave gamma enabled if it was already enabled. ++ Although the hardware enables it without setting ++ up the gamma table, the BIOS or bootloader ought ++ to have either disabled it or loaded a table by now */ + +- /* Disable gamma correction */ +- misc |= GX_MISC_GAM_EN; + +- writel(misc, par->vid_regs + GX_MISC); + +- /* Write the display configuration */ +- dcfg = readl(par->vid_regs + GX_DCFG); ++ if (par->enable_crt) { ++ /* Power up the CRT DACs */ ++ if (misc & ( GX_MISC_A_PWRDN | GX_MISC_DAC_PWRDN)) { ++ misc &= ~(GX_MISC_A_PWRDN | GX_MISC_DAC_PWRDN); ++ writel(misc, par->vid_regs + GX_MISC); ++ } + +- /* Disable hsync and vsync */ +- dcfg &= ~(GX_DCFG_VSYNC_EN | GX_DCFG_HSYNC_EN); +- writel(dcfg, par->vid_regs + GX_DCFG); ++ if (!(info->var.sync & FB_SYNC_HOR_HIGH_ACT)) ++ sync |= GX_DCFG_CRT_HSYNC_POL; + +- /* Clear bits from existing mode. */ +- dcfg &= ~(GX_DCFG_CRT_SYNC_SKW_MASK +- | GX_DCFG_CRT_HSYNC_POL | GX_DCFG_CRT_VSYNC_POL +- | GX_DCFG_VSYNC_EN | GX_DCFG_HSYNC_EN); ++ if (!(info->var.sync & FB_SYNC_VERT_HIGH_ACT)) ++ sync |= GX_DCFG_CRT_VSYNC_POL; ++ } ++ else { ++ /* Turn off the CRT DACs in FP mode - we don't need them */ ++ if ((misc & (GX_MISC_A_PWRDN | GX_MISC_DAC_PWRDN))) { ++ misc |= (GX_MISC_A_PWRDN | GX_MISC_DAC_PWRDN); ++ writel(misc, par->vid_regs + GX_MISC); ++ } ++ } + +- /* Set default sync skew. */ +- dcfg |= GX_DCFG_CRT_SYNC_SKW_DFLT; ++ /* Write the display configuration */ ++ dcfg = readl(par->vid_regs + GX_DCFG); + +- /* Enable hsync and vsync. */ +- dcfg |= GX_DCFG_HSYNC_EN | GX_DCFG_VSYNC_EN; ++ if (!CMP(dcfg, DCFG_DEFAULT_VAL | GX_DCFG_CRT_HSYNC_POL | GX_DCFG_CRT_VSYNC_POL, ++ DCFG_DEFAULT_VAL | sync)) { + +- /* Sync polarities. */ +- if (info->var.sync & FB_SYNC_HOR_HIGH_ACT) +- dcfg |= GX_DCFG_CRT_HSYNC_POL; +- if (info->var.sync & FB_SYNC_VERT_HIGH_ACT) +- dcfg |= GX_DCFG_CRT_VSYNC_POL; ++ /* Disable hsync and vsync */ ++ dcfg &= ~(GX_DCFG_VSYNC_EN | GX_DCFG_HSYNC_EN); ++ writel(dcfg, par->vid_regs + GX_DCFG); + +- /* Enable the display logic */ +- /* Set up the DACS to blank normally */ ++ /* Clear bits from existing mode. */ ++ dcfg &= ~(GX_DCFG_CRT_SYNC_SKW_MASK ++ | GX_DCFG_CRT_HSYNC_POL | GX_DCFG_CRT_VSYNC_POL ++ | GX_DCFG_VSYNC_EN | GX_DCFG_HSYNC_EN); + +- dcfg |= GX_DCFG_CRT_EN | GX_DCFG_DAC_BL_EN; ++ /* Set default sync skew. */ ++ dcfg |= GX_DCFG_CRT_SYNC_SKW_DFLT; + +- /* Enable the external DAC VREF? */ ++ /* Enable hsync and vsync. */ ++ dcfg |= GX_DCFG_HSYNC_EN | GX_DCFG_VSYNC_EN; + +- writel(dcfg, par->vid_regs + GX_DCFG); ++ /* Enable the display logic */ ++ dcfg |= GX_DCFG_CRT_EN | GX_DCFG_DAC_BL_EN; ++ ++ writel(dcfg, par->vid_regs + GX_DCFG); ++ } + + /* Set up the flat panel (if it is enabled) */ + +@@ -289,6 +348,100 @@ static void gx_configure_display(struct + gx_configure_tft(info); + } + ++int gxfb_powerdown(struct fb_info *info) ++{ ++ struct geodefb_par *par = info->par; ++ ++ /* We're already suspended */ ++ ++ if (par->state != FB_POWER_STATE_ON) ++ return 0; ++ ++ /* Save the registers */ ++ gx_save_regs(info, &gx_saved_regs); ++ ++ /* Shut down the engine */ ++ ++ writel(gx_saved_regs.vp.r.vcfg & ~0x01, par->vid_regs + GX_VCFG); ++ writel(gx_saved_regs.vp.r.dcfg & ~0x0F, par->vid_regs + GX_DCFG); ++ ++ /* Turn off the flat panel unless we are attached to a DCON */ ++ if (!olpc_has_dcon()) ++ writel(gx_saved_regs.fp.r.pm & ~GX_FP_PM_P, par->vid_regs + GX_FP_PM); ++ ++ writel(0x4758, par->dc_regs + DC_UNLOCK); ++ ++ writel(gx_saved_regs.dc.r.gcfg & ~0x0F, ++ par->dc_regs + DC_GENERAL_CFG); ++ ++ writel(gx_saved_regs.dc.r.dcfg & ~0x19, ++ par->dc_regs + DC_DISPLAY_CFG); ++ ++ par->state = FB_POWER_STATE_SUSPEND; ++ ++ return 0; ++} ++ ++int gxfb_powerup(struct fb_info *info) ++{ ++ struct geodefb_par *par = info->par; ++ u32 val; ++ ++ if (par->state == FB_POWER_STATE_SUSPEND) { ++ ++ writel(gx_saved_regs.dc.r.dcfg, ++ par->dc_regs + DC_DISPLAY_CFG); ++ ++ writel(gx_saved_regs.vp.r.vcfg, par->vid_regs + GX_VCFG); ++ writel(gx_saved_regs.vp.r.dcfg, par->vid_regs + GX_DCFG); ++ ++ val = readl(par->vid_regs + GX_FP_PM); ++ ++ /* power up the panel if it needs it; we don't always power it down */ ++ if (!(val & 0x09)) { ++ writel(gx_saved_regs.fp.r.pm, par->vid_regs + GX_FP_PM); ++ mdelay(64); ++ } ++ } ++ ++ /* If the panel is currently on its way up, then wait up to 100ms ++ for it */ ++ ++ if (readl(par->vid_regs + GX_FP_PM) & 0x08) { ++ int i; ++ ++ for(i = 0; i < 10; i++) { ++ if (readl(par->vid_regs + GX_FP_PM) & 0x01) ++ break; ++ ++ mdelay(10); ++ } ++ ++ if (i == 10) ++ printk(KERN_ERR "gxfb: Panel power up timed out\n"); ++ } ++ ++ if (par->state == FB_POWER_STATE_ON) ++ return 0; ++ ++ switch(par->state) { ++ case FB_POWER_STATE_OFF: ++ gx_restore_regs(info, &gx_saved_regs); ++ break; ++ ++ case FB_POWER_STATE_SUSPEND: ++ /* Do this because it will turn on the FIFO which will ++ start the line count */ ++ writel(gx_saved_regs.dc.r.gcfg, ++ par->dc_regs + DC_GENERAL_CFG); ++ writel(0x0, par->dc_regs + DC_UNLOCK); ++ break; ++ } ++ ++ par->state = FB_POWER_STATE_ON; ++ return 0; ++} ++ + static int gx_blank_display(struct fb_info *info, int blank_mode) + { + struct geodefb_par *par = info->par; +@@ -315,6 +468,7 @@ static int gx_blank_display(struct fb_in + default: + return -EINVAL; + } ++ + dcfg = readl(par->vid_regs + GX_DCFG); + dcfg &= ~(GX_DCFG_DAC_BL_EN + | GX_DCFG_HSYNC_EN | GX_DCFG_VSYNC_EN); +@@ -326,7 +480,7 @@ static int gx_blank_display(struct fb_in + dcfg |= GX_DCFG_VSYNC_EN; + writel(dcfg, par->vid_regs + GX_DCFG); + +- /* Power on/off flat panel. */ ++ /* Power on/off flat panel */ + + if (par->enable_crt == 0) { + fp_pm = readl(par->vid_regs + GX_FP_PM); +@@ -340,8 +494,37 @@ static int gx_blank_display(struct fb_in + return 0; + } + ++extern struct fb_info *gxfb_info; ++ ++/* This function controls the flatpanel power sequencing - this is used ++ by the OLPC power management engine to enable the FP sequencing much ++ earlier in the resume process ++*/ ++ ++void gxfb_flatpanel_control(int state) ++{ ++ struct geodefb_par *par = gxfb_info->par; ++ u32 val, fp = readl(par->vid_regs + GX_FP_PM); ++ val = fp; ++ ++ /* Turn on the panel if it isn't aleady */ ++ ++ if (state) { ++ if (!(val & 0x01)) ++ val |= GX_FP_PM_P; ++ } ++ else { ++ if (!(val & 0x02)) ++ val &= ~GX_FP_PM_P; ++ } ++ ++ if (val != fp) ++ writel(val, par->vid_regs + GX_FP_PM); ++} ++ + struct geode_vid_ops gx_vid_ops = { + .set_dclk = gx_set_dclk_frequency, ++ .get_dclk = gx_get_dclk, + .configure_display = gx_configure_display, + .blank_display = gx_blank_display, + }; +diff -purN linux_2.6.24_org/drivers/video/geode/video_gx.h linux_2.6.24_olpc/drivers/video/geode/video_gx.h +--- linux_2.6.24_org/drivers/video/geode/video_gx.h 2008-02-15 20:11:23.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/video/geode/video_gx.h 2008-02-15 18:58:41.000000000 +0000 +@@ -11,6 +11,8 @@ + #ifndef __VIDEO_GX_H__ + #define __VIDEO_GX_H__ + ++#include "geode_regs.h" ++ + extern struct geode_vid_ops gx_vid_ops; + + /* GX Flatpanel control MSR */ +@@ -20,6 +22,8 @@ extern struct geode_vid_ops gx_vid_ops; + + /* Geode GX video processor registers */ + ++#define GX_VCFG 0x0000 ++ + #define GX_DCFG 0x0008 + # define GX_DCFG_CRT_EN 0x00000001 + # define GX_DCFG_HSYNC_EN 0x00000002 +@@ -42,6 +46,14 @@ extern struct geode_vid_ops gx_vid_ops; + #define GX_MISC_DAC_PWRDN 0x00000400 + #define GX_MISC_A_PWRDN 0x00000800 + ++/* Gamma correction RAM - address and data registers */ ++ ++#define GX_GAR 0x038 ++#define GX_GDR 0x040 ++ ++#define GXFB_GAMMA_DWORDS 256 /* number of dwords in the gamma ram */ ++#define GXFB_GAMMA_SIZE (GXFB_GAMMA_DWORDS * sizeof(unsigned int)) ++ + /* Geode GX flat panel display control registers */ + + #define GX_FP_PT1 0x0400 +@@ -69,4 +81,13 @@ extern struct geode_vid_ops gx_vid_ops; + # define MSR_GLCP_DOTPLL_BYPASS (0x0000000000008000ull) + # define MSR_GLCP_DOTPLL_LOCK (0x0000000002000000ull) + ++int gxfb_powerdown(struct fb_info *info); ++int gxfb_powerup(struct fb_info *info); ++ ++void gx_set_dclk_frequency(struct fb_info *info); ++unsigned int gx_get_dclk(struct fb_info *info); ++ ++void gx_save_regs(struct fb_info *info, struct geoderegs *regs); ++void gx_restore_regs(struct fb_info *info, struct geoderegs *regs); ++ + #endif /* !__VIDEO_GX_H__ */ +diff -purN linux_2.6.24_org/drivers/video/Kconfig linux_2.6.24_olpc/drivers/video/Kconfig +--- linux_2.6.24_org/drivers/video/Kconfig 2008-02-15 20:11:22.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/video/Kconfig 2008-02-15 18:58:36.000000000 +0000 +@@ -1869,6 +1869,15 @@ config FB_PS3_DEFAULT_SIZE_M + The default value can be overridden on the kernel command line + using the "ps3fb" option (e.g. "ps3fb=9M"); + ++config FB_OLPC_DCON ++ tristate "One Laptop Per Child Display CONtroller support" ++ depends on OLPC ++ select I2C ++ ---help--- ++ Add support for the OLPC DCON controller. This controller is only ++ available on OLPC platforms. Unless you have one of these ++ platforms, you will want to say 'N'. ++ + config FB_XILINX + tristate "Xilinx frame buffer support" + depends on FB && XILINX_VIRTEX +diff -purN linux_2.6.24_org/drivers/video/Makefile linux_2.6.24_olpc/drivers/video/Makefile +--- linux_2.6.24_org/drivers/video/Makefile 2008-02-15 20:11:22.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/video/Makefile 2008-02-15 18:58:36.000000000 +0000 +@@ -111,6 +111,7 @@ obj-$(CONFIG_FB_PNX4008_DUM_RGB) += pnx + obj-$(CONFIG_FB_IBM_GXT4500) += gxt4500.o + obj-$(CONFIG_FB_PS3) += ps3fb.o + obj-$(CONFIG_FB_SM501) += sm501fb.o ++obj-$(CONFIG_FB_OLPC_DCON) += olpc_dcon.o + obj-$(CONFIG_FB_XILINX) += xilinxfb.o + obj-$(CONFIG_FB_OMAP) += omap/ + +diff -purN linux_2.6.24_org/drivers/video/modedb.c linux_2.6.24_olpc/drivers/video/modedb.c +--- linux_2.6.24_org/drivers/video/modedb.c 2008-02-15 20:11:23.000000000 +0000 ++++ linux_2.6.24_olpc/drivers/video/modedb.c 2008-02-15 18:58:41.000000000 +0000 +@@ -33,6 +33,8 @@ const char *fb_mode_option; + * Standard video mode definitions (taken from XFree86) + */ + ++#define DEFAULT_MODEDB_INDEX 0 ++ + static const struct fb_videomode modedb[] = { + { + /* 640x400 @ 70 Hz, 31.5 kHz hsync */ +@@ -508,7 +510,8 @@ int fb_find_mode(struct fb_var_screeninf + } + + if (!default_mode) +- default_mode = &db[0]; ++ default_mode = (db == modedb) ? ++ &modedb[DEFAULT_MODEDB_INDEX] : &db[0]; + + if (!default_bpp) + default_bpp = 8; +diff -purN linux_2.6.24_org/drivers/video/olpc_dcon.c linux_2.6.24_olpc/drivers/video/olpc_dcon.c +--- linux_2.6.24_org/drivers/video/olpc_dcon.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/drivers/video/olpc_dcon.c 2008-02-15 18:58:42.000000000 +0000 +@@ -0,0 +1,946 @@ ++/* ++ * Mainly by David Woodhouse, somewhat modified by Jordan Crouse ++ * ++ * Copyright © 2006-2007 Red Hat, Inc. ++ * Copyright © 2006-2007 Advanced Micro Devices, Inc. ++ * ++ * This program is free software. You can redistribute it and/or ++ * modify it under the terms of version 2 of the GNU General Public ++ * License as published by the Free Software Foundation. ++ */ ++ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "olpc_dcon.h" ++ ++/* Module definitions */ ++ ++static int resumeline = 898; ++module_param(resumeline, int, 0444); ++ ++static int noinit; ++module_param(noinit, int, 0444); ++ ++/* Default off since it doesn't work on DCON ASIC in B-test OLPC board */ ++static int useaa = 1; ++module_param(useaa, int, 0444); ++ ++/* I2C structures */ ++ ++static struct i2c_driver dcon_driver; ++static struct i2c_client *dcon_client; ++ ++/* Platform devices */ ++static struct platform_device *dcon_device; ++ ++/* Backlight device */ ++static struct backlight_device *dcon_bl_dev; ++ ++/* Base address of the GPIO registers */ ++static unsigned long gpio_base; ++ ++static struct fb_info *fbinfo; ++ ++/* Current source, initialized at probe time */ ++static int dcon_source; ++ ++/* Desired source */ ++static int dcon_pending; ++ ++/* Current output type */ ++static int dcon_output = DCON_OUTPUT_COLOR; ++ ++/* Current sleep status (not yet implemented) */ ++static int dcon_sleep_val = DCON_ACTIVE; ++ ++/* Shadow register for the DCON_REG_MODE register */ ++static unsigned short dcon_disp_mode; ++ ++/* Variables used during switches */ ++static int dcon_switched; ++ ++static DECLARE_WAIT_QUEUE_HEAD(dcon_wait_queue); ++ ++static unsigned short normal_i2c[] = { 0x0D, I2C_CLIENT_END }; ++I2C_CLIENT_INSMOD; ++ ++#define dcon_write(reg,val) i2c_smbus_write_word_data(dcon_client,reg,val) ++#define dcon_read(reg) i2c_smbus_read_word_data(dcon_client,reg) ++ ++/* The current backlight value - this saves us some smbus traffic */ ++static int bl_val = -1; ++ ++/* ===== API functions - these are called by a variety of users ==== */ ++ ++static int dcon_request_irq(void); ++ ++static int dcon_hw_init(struct i2c_client *client, int is_init) ++{ ++ uint16_t ver; ++ int rc = 0; ++ ++ ver = i2c_smbus_read_word_data(client, DCON_REG_ID); ++ if ((ver >> 8) != 0xDC) { ++ printk(KERN_ERR "olpc-dcon: DCON ID not 0xDCxx: 0x%04x " ++ "instead.\n", ver); ++ rc = -ENXIO; ++ goto err; ++ } ++ ++ if (is_init) { ++ printk(KERN_INFO "olpc-dcon: Discovered DCON version %x\n", ++ ver & 0xFF); ++ if ((rc = dcon_request_irq())) { ++ printk(KERN_ERR "olpc-dcon: Unable to grab IRQ.\n"); ++ goto err; ++ } ++ } ++ ++ if (ver < 0xdc02 && !noinit) { ++ /* Initialize the DCON registers */ ++ ++ /* Start with work-arounds for DCON ASIC */ ++ i2c_smbus_write_word_data(client, 0x4b, 0x00cc); ++ i2c_smbus_write_word_data(client, 0x4b, 0x00cc); ++ i2c_smbus_write_word_data(client, 0x4b, 0x00cc); ++ i2c_smbus_write_word_data(client, 0x0b, 0x007a); ++ i2c_smbus_write_word_data(client, 0x36, 0x025c); ++ i2c_smbus_write_word_data(client, 0x37, 0x025e); ++ ++ /* Initialise SDRAM */ ++ ++ i2c_smbus_write_word_data(client, 0x3b, 0x002b); ++ i2c_smbus_write_word_data(client, 0x41, 0x0101); ++ i2c_smbus_write_word_data(client, 0x42, 0x0101); ++ } ++ else if (!noinit) { ++ /* SDRAM setup/hold time */ ++ i2c_smbus_write_word_data(client, 0x3a, 0xc040); ++ i2c_smbus_write_word_data(client, 0x41, 0x0000); ++ i2c_smbus_write_word_data(client, 0x41, 0x0101); ++ i2c_smbus_write_word_data(client, 0x42, 0x0101); ++ } ++ ++ /* Colour swizzle, AA, no passthrough, backlight */ ++ if (is_init) { ++ dcon_disp_mode = MODE_PASSTHRU | MODE_BL_ENABLE | MODE_CSWIZZLE; ++ if (useaa) ++ dcon_disp_mode |= MODE_COL_AA; ++ } ++ i2c_smbus_write_word_data(client, DCON_REG_MODE, dcon_disp_mode); ++ ++ ++ /* Set the scanline to interrupt on during resume */ ++ ++ i2c_smbus_write_word_data(client, DCON_REG_SCAN_INT, resumeline); ++ ++err: ++ return rc; ++} ++ ++/* ++ * The smbus doesn't always come back due to what is believed to be ++ * hardware (power rail) bugs. For older models where this is known to ++ * occur, our solution is to attempt to wait for the bus to stabilize; ++ * if it doesn't happen, cut power to the dcon, repower it, and wait ++ * for the bus to stabilize. Rinse, repeat until we have a working ++ * smbus. For newer models, we simply BUG(); we want to know if this ++ * still happens despite the power fixes that have been made! ++ */ ++static int dcon_bus_stabilize(struct i2c_client *client, int is_powered_down) ++{ ++ unsigned long timeout; ++ int x; ++ ++power_up: ++ if (is_powered_down) { ++ x = 1; ++ if ((x = olpc_ec_cmd(0x26, (unsigned char *) &x, 1, NULL, 0))) { ++ printk(KERN_WARNING "olpc-dcon: unable to force dcon " ++ "to power up: %d!\n", x); ++ return x; ++ } ++ msleep(10); /* we'll be conservative */ ++ } ++ ++ /* ++ * According to HiMax, when powering the DCON up we should hold ++ * SMB_DATA high for 8 SMB_CLK cycles. This will force the DCON ++ * state machine to reset to a (sane) initial state. Mitch Bradley ++ * did some testing and discovered that holding for 16 SMB_CLK cycles ++ * worked a lot more reliably, so that's what we do here. ++ * ++ * According to the cs5536 spec, to set GPIO14 to SMB_CLK we must ++ * simultaneously set AUX1 IN/OUT to GPIO14; ditto for SMB_DATA and ++ * GPIO15. ++ */ ++ geode_gpio_set(OLPC_GPIO_SMB_CLK|OLPC_GPIO_SMB_DATA, GPIO_OUTPUT_VAL); ++ geode_gpio_set(OLPC_GPIO_SMB_CLK|OLPC_GPIO_SMB_DATA, GPIO_OUTPUT_ENABLE); ++ geode_gpio_clear(OLPC_GPIO_SMB_CLK|OLPC_GPIO_SMB_DATA, GPIO_OUTPUT_AUX1); ++ geode_gpio_clear(OLPC_GPIO_SMB_CLK|OLPC_GPIO_SMB_DATA, GPIO_OUTPUT_AUX2); ++ geode_gpio_clear(OLPC_GPIO_SMB_CLK|OLPC_GPIO_SMB_DATA, GPIO_INPUT_AUX1); ++ ++ for (x = 0; x < 16; x++) { ++ udelay(5); ++ geode_gpio_clear(OLPC_GPIO_SMB_CLK, GPIO_OUTPUT_VAL); ++ udelay(5); ++ geode_gpio_set(OLPC_GPIO_SMB_CLK, GPIO_OUTPUT_VAL); ++ } ++ udelay(5); ++ geode_gpio_set(OLPC_GPIO_SMB_CLK|OLPC_GPIO_SMB_DATA, GPIO_OUTPUT_AUX1); ++ geode_gpio_set(OLPC_GPIO_SMB_CLK|OLPC_GPIO_SMB_DATA, GPIO_INPUT_AUX1); ++ ++ for (x = -1, timeout = 50; timeout && x < 0; timeout--) { ++ msleep(1); ++ x = dcon_read(DCON_REG_ID); ++ } ++ if (x < 0) { ++ printk(KERN_ERR "olpc-dcon: unable to stabilize dcon's " ++ "smbus, reasserting power and praying.\n"); ++ BUG_ON(olpc_board_at_least(olpc_board(0xc2))); ++ x = 0; ++ olpc_ec_cmd(0x26, (unsigned char *) &x, 1, NULL, 0); ++ msleep(100); ++ is_powered_down = 1; ++ goto power_up; /* argh, stupid hardware.. */ ++ } ++ ++ if (is_powered_down) ++ return dcon_hw_init(client, 0); ++ return 0; ++} ++ ++ ++/* Backlight notes - turning off the backlight enable bit in the DCON ++ * doesn't save us any power over just pushing the BL to zero, so we ++ * don't use that bit in this code. ++ */ ++ ++static int dcon_get_backlight(void) ++{ ++ if (dcon_client == NULL) ++ return 0; ++ ++ if (bl_val == -1) ++ bl_val = dcon_read(DCON_REG_BRIGHT) & 0x0F; ++ ++ return bl_val; ++} ++ ++static void dcon_set_backlight(int level) ++{ ++ if (dcon_client == NULL) ++ return; ++ ++ if (bl_val == (level & 0x0F)) ++ return; ++ ++ bl_val = level & 0x0F; ++ dcon_write(DCON_REG_BRIGHT, bl_val); ++ ++ /* Purposely turn off the backlight when we go to level 0 */ ++ ++ if (bl_val == 0) { ++ dcon_disp_mode &= ~MODE_BL_ENABLE; ++ dcon_write(DCON_REG_MODE, dcon_disp_mode); ++ } ++ else if (!(dcon_disp_mode & MODE_BL_ENABLE)) { ++ dcon_disp_mode |= MODE_BL_ENABLE; ++ dcon_write(DCON_REG_MODE, dcon_disp_mode); ++ } ++} ++ ++/* Set the output type to either color or mono */ ++ ++static int dcon_set_output(int arg) ++{ ++ if (dcon_output == arg) ++ return 0; ++ ++ dcon_output = arg; ++ ++ if (arg == DCON_OUTPUT_MONO) { ++ dcon_disp_mode &= ~(MODE_CSWIZZLE | MODE_COL_AA); ++ dcon_disp_mode |= MODE_MONO_LUMA; ++ } ++ else { ++ dcon_disp_mode &= ~(MODE_MONO_LUMA); ++ dcon_disp_mode |= MODE_CSWIZZLE; ++ if (useaa) ++ dcon_disp_mode |= MODE_COL_AA; ++ } ++ ++ dcon_write(DCON_REG_MODE, dcon_disp_mode); ++ return 0; ++} ++ ++/* For now, this will be really stupid - we need to address how ++ * DCONLOAD works in a sleep and account for it accordingly ++ */ ++ ++static void dcon_sleep(int state) ++{ ++ int x; ++ ++ /* Turn off the backlight and put the DCON to sleep */ ++ ++ if (state == dcon_sleep_val) ++ return; ++ ++ if (!olpc_board_at_least(olpc_board(0xc2))) ++ return; ++ ++ if (state == DCON_SLEEP) { ++ x = 0; ++ if ((x = olpc_ec_cmd(0x26, (unsigned char *) &x, 1, NULL, 0))) ++ printk(KERN_WARNING "olpc-dcon: unable to force dcon " ++ "to power down: %d!\n", x); ++ else ++ dcon_sleep_val = state; ++ } ++ else { ++ /* Only re-enable the backlight if the backlight value is set */ ++ if (bl_val != 0) ++ dcon_disp_mode |= MODE_BL_ENABLE; ++ ++ if ((x=dcon_bus_stabilize(dcon_client, 1))) ++ printk(KERN_WARNING "olpc-dcon: unable to reinit dcon" ++ " hardware: %d!\n", x); ++ else ++ dcon_sleep_val = state; ++ } ++ ++ /* We should turn off some stuff in the framebuffer - but what? */ ++} ++ ++/* Set the source of the display (CPU or DCON) */ ++ ++static void dcon_source_switch(struct work_struct *work) ++{ ++ DECLARE_WAITQUEUE(wait, current); ++ int source = dcon_pending; ++ ++ if (dcon_source == source) ++ return; ++ ++ dcon_switched = 0; ++ ++ switch (source) { ++ case DCON_SOURCE_CPU: ++ ++ /* Enable the scanline interrupt bit */ ++ if (dcon_write(DCON_REG_MODE, dcon_disp_mode | MODE_SCAN_INT)) ++ printk(KERN_ERR "olpc-dcon: couldn't enable scanline interrupt!\n"); ++ else { ++ /* Wait up to one second for the scanline interrupt */ ++ wait_event_timeout(dcon_wait_queue, dcon_switched == 1, HZ); ++ } ++ ++ if (!dcon_switched) ++ printk(KERN_ERR "olpc-dcon: Timeout entering CPU mode; expect a screen glitch.\n"); ++ ++ /* ++ * Ideally we'd like to disable interrupts here so that the ++ * fb unblanking and DCON turn on happen at a known time value; ++ * however, we can't do that right now with fb_blank ++ * messing with semaphores. ++ * ++ * For now, we just hope.. ++ */ ++ acquire_console_sem(); ++ if (fb_blank(fbinfo, FB_BLANK_UNBLANK)) { ++ release_console_sem(); ++ printk(KERN_ERR "olpc-dcon: Failed to enter CPU mode\n"); ++ dcon_pending = DCON_SOURCE_DCON; ++ return; ++ } ++ release_console_sem(); ++ ++ /* And turn off the DCON */ ++ outl(1<<11, gpio_base + GPIOx_OUT_VAL); ++ ++ /* Turn off the scanline interrupt */ ++ if (dcon_write(DCON_REG_MODE, dcon_disp_mode)) ++ printk(KERN_ERR "olpc-dcon: couldn't disable scanline interrupt!\n"); ++ ++ printk(KERN_INFO "olpc-dcon: The CPU has control\n"); ++ break; ++ case DCON_SOURCE_DCON: ++ { ++ int t; ++ ++ add_wait_queue(&dcon_wait_queue, &wait); ++ set_current_state(TASK_UNINTERRUPTIBLE); ++ ++ /* Clear GPIO11 (DCONLOAD) - this implies that the DCON is in ++ control */ ++ ++ outl(1 << (11 + 16), gpio_base + GPIOx_OUT_VAL); ++ ++ t = schedule_timeout(HZ/2); ++ remove_wait_queue(&dcon_wait_queue, &wait); ++ set_current_state(TASK_RUNNING); ++ ++ if (!dcon_switched) ++ printk(KERN_ERR "olpc-dcon: Timeout entering DCON mode; expect a screen glitch.\n"); ++ ++ acquire_console_sem(); ++ if (fb_blank(fbinfo, FB_BLANK_POWERDOWN)) ++ printk(KERN_ERR "olpc-dcon: couldn't blank fb!\n"); ++ release_console_sem(); ++ ++ printk(KERN_INFO "olpc-dcon: The DCON has control\n"); ++ break; ++ } ++ default: ++ BUG(); ++ } ++ ++ dcon_source = source; ++} ++ ++static DECLARE_WORK(dcon_work, dcon_source_switch); ++ ++static int dcon_set_source(int arg) ++{ ++ if (arg != DCON_SOURCE_CPU && arg != DCON_SOURCE_DCON) ++ return -EINVAL; ++ ++ if (dcon_pending == arg) ++ return 0; ++ ++ dcon_pending = arg; ++ if ((dcon_source != arg) && !work_pending(&dcon_work)) ++ schedule_work(&dcon_work); ++ ++ return 0; ++} ++ ++static int dcon_set_source_sync(int arg) ++{ ++ int ret = dcon_set_source(arg); ++ if (!ret) ++ flush_scheduled_work(); ++ return ret; ++} ++ ++static int dconbl_set(struct backlight_device *dev) { ++ ++ int level = dev->props.brightness; ++ ++ if (dev->props.power != FB_BLANK_UNBLANK) ++ level = 0; ++ ++ dcon_set_backlight(level); ++ return 0; ++} ++ ++static int dconbl_get(struct backlight_device *dev) { ++ return dcon_get_backlight(); ++} ++ ++static ssize_t dcon_mode_show(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ return sprintf(buf, "%4.4X\n", dcon_disp_mode); ++} ++ ++static ssize_t dcon_sleep_show(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ return sprintf(buf, "%d\n", dcon_sleep_val); ++} ++ ++static ssize_t /* __deprecated */ dcon_source_show(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ printk(KERN_WARNING "olpc-dcon: using deprecated sysfs 'source' interface; use 'freeze' instead!\n"); ++ return sprintf(buf, "%d\n", dcon_source); ++} ++ ++static ssize_t dcon_freeze_show(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ return sprintf(buf, "%d\n", dcon_source == DCON_SOURCE_DCON ? 1 : 0); ++} ++ ++static ssize_t dcon_output_show(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ return sprintf(buf, "%d\n", dcon_output); ++} ++ ++static ssize_t dcon_resumeline_show(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ return sprintf(buf, "%d\n", resumeline); ++} ++ ++static int _strtoul(const char *buf, int len, unsigned int *val) ++{ ++ ++ char *endp; ++ unsigned int output = simple_strtoul(buf, &endp, 0); ++ int size = endp - buf; ++ ++ if (*endp && isspace(*endp)) ++ size++; ++ ++ if (size != len) ++ return -EINVAL; ++ ++ *val = output; ++ return 0; ++} ++ ++static ssize_t dcon_output_store(struct device *dev, ++ struct device_attribute *attr, const char *buf, size_t count) ++{ ++ int output; ++ int rc = -EINVAL; ++ ++ if (_strtoul(buf, count, &output)) ++ return -EINVAL; ++ ++ if (output == DCON_OUTPUT_COLOR || output == DCON_OUTPUT_MONO) { ++ dcon_set_output(output); ++ rc = count; ++ } ++ ++ return rc; ++} ++ ++static ssize_t /* __deprecated */ dcon_source_store(struct device *dev, ++ struct device_attribute *attr, const char *buf, size_t count) ++{ ++ int output; ++ int rc = -EINVAL; ++ ++ printk(KERN_WARNING "olpc-dcon: using deprecated sysfs 'source' interface; use 'freeze' instead!\n"); ++ if (_strtoul(buf, count, &output)) ++ return -EINVAL; ++ ++ dcon_set_source(output); ++ rc = count; ++ ++ return rc; ++} ++ ++static ssize_t dcon_freeze_store(struct device *dev, ++ struct device_attribute *attr, const char *buf, size_t count) ++{ ++ int output; ++ int rc = -EINVAL; ++ ++ if (_strtoul(buf, count, &output)) ++ return rc; ++ ++ dcon_set_source(output ? DCON_SOURCE_DCON : DCON_SOURCE_CPU); ++ rc = count; ++ ++ return rc; ++} ++ ++static ssize_t dcon_resumeline_store(struct device *dev, ++ struct device_attribute *attr, const char *buf, size_t count) ++{ ++ int rl; ++ int rc = -EINVAL; ++ ++ if (_strtoul(buf, count, &rl)) ++ return rc; ++ ++ resumeline = rl; ++ dcon_write(DCON_REG_SCAN_INT, resumeline); ++ rc = count; ++ ++ return rc; ++} ++ ++static ssize_t dcon_sleep_store(struct device *dev, ++ struct device_attribute *attr, const char *buf, size_t count) ++{ ++ int output; ++ ++ if (_strtoul(buf, count, &output)) ++ return -EINVAL; ++ ++ dcon_sleep(output ? DCON_SLEEP : DCON_ACTIVE); ++ return count; ++} ++ ++static struct device_attribute dcon_device_files[] = { ++ __ATTR(mode, 0444, dcon_mode_show, NULL), ++ __ATTR(sleep, 0644, dcon_sleep_show, dcon_sleep_store), ++ __ATTR(source, 0644, dcon_source_show, dcon_source_store), ++ __ATTR(freeze, 0644, dcon_freeze_show, dcon_freeze_store), ++ __ATTR(output, 0644, dcon_output_show, dcon_output_store), ++ __ATTR(resumeline, 0644, dcon_resumeline_show, dcon_resumeline_store), ++}; ++ ++static struct backlight_ops dcon_bl_ops = { ++ .get_brightness = dconbl_get, ++ .update_status = dconbl_set ++}; ++ ++/* List of GPIOs that we care about: ++ (in) GPIO12 -- DCONBLNK ++ (in) GPIO[56] -- DCONSTAT[01] ++ (out) GPIO11 -- DCONLOAD ++*/ ++ ++#define IN_GPIOS ((1<<5) | (1<<6) | (1<<7) | (1<<12)) ++#define OUT_GPIOS (1<<11) ++ ++static irqreturn_t dcon_interrupt(int, void *); ++ ++static int dcon_request_irq(void) ++{ ++ unsigned long lo, hi; ++ unsigned char lob; ++ ++ rdmsr(MSR_LBAR_GPIO, lo, hi); ++ ++ /* Check the mask and whether GPIO is enabled (sanity check) */ ++ if (hi != 0x0000f001) { ++ printk(KERN_ERR "GPIO not enabled -- cannot use DCON\n"); ++ return -ENODEV; ++ } ++ ++ /* Mask off the IO base address */ ++ gpio_base = lo & 0x0000ff00; ++ ++ /* Turn off the event enable for GPIO7 just to be safe */ ++ outl(1 << (16+7), gpio_base + GPIOx_EVNT_EN); ++ ++ /* Set the directions for the GPIO pins */ ++ outl(OUT_GPIOS | (IN_GPIOS << 16), gpio_base + GPIOx_OUT_EN); ++ outl(IN_GPIOS | (OUT_GPIOS << 16), gpio_base + GPIOx_IN_EN); ++ ++ /* Set up the interrupt mappings */ ++ ++ /* Set the IRQ to pair 2 */ ++ geode_gpio_event_irq(OLPC_GPIO_DCON_IRQ, 2); ++ ++ /* Enable group 2 to trigger the DCON interrupt */ ++ geode_gpio_set_irq(2, DCON_IRQ); ++ ++ /* Select edge level for interrupt (in PIC) */ ++ ++ lob = inb(0x4d0); ++ lob &= ~(1 << DCON_IRQ); ++ outb(lob, 0x4d0); ++ ++ /* Register the interupt handler */ ++ if (request_irq(DCON_IRQ, &dcon_interrupt, 0, "DCON", &dcon_driver)) ++ return -EIO; ++ ++ /* Clear INV_EN for GPIO7 (DCONIRQ) */ ++ outl((1<<(16+7)), gpio_base + GPIOx_INV_EN); ++ ++ /* Enable filter for GPIO12 (DCONBLANK) */ ++ outl(1<<(12), gpio_base + GPIOx_IN_FLTR_EN); ++ ++ /* Disable filter for GPIO7 */ ++ outl(1<<(16+7), gpio_base + GPIOx_IN_FLTR_EN); ++ ++ /* Disable event counter for GPIO7 (DCONIRQ) and GPIO12 (DCONBLANK) */ ++ ++ outl(1<<(16+7), gpio_base + GPIOx_EVNTCNT_EN); ++ outl(1<<(16+12), gpio_base + GPIOx_EVNTCNT_EN); ++ ++ /* Add GPIO12 to the Filter Event Pair #7 */ ++ outb(12, gpio_base + GPIO_FE7_SEL); ++ ++ /* Turn off negative Edge Enable for GPIO12 */ ++ outl(1<<(16+12), gpio_base + GPIOx_NEGEDGE_EN); ++ ++ /* Enable negative Edge Enable for GPIO7 */ ++ outl(1<<7, gpio_base + GPIOx_NEGEDGE_EN); ++ ++ /* Zero the filter amount for Filter Event Pair #7 */ ++ outw(0, gpio_base + GPIO_FLT7_AMNT); ++ ++ /* Clear the negative edge status for GPIO7 and GPIO12 */ ++ outl((1<<7) | (1<<12), gpio_base+0x4c); ++ ++ /* FIXME: Clear the posiitive status as well, just to be sure */ ++ outl((1<<7) | (1<<12), gpio_base+0x48); ++ ++ /* Enable events for GPIO7 (DCONIRQ) and GPIO12 (DCONBLANK) */ ++ outl((1<<(7))|(1<<12), gpio_base + GPIOx_EVNT_EN); ++ ++ /* Determine the current state by reading the GPIO bit */ ++ /* Earlier stages of the boot process have established the state */ ++ dcon_source = inl(gpio_base + GPIOx_OUT_VAL) & (1<<11) ++ ? DCON_SOURCE_CPU ++ : DCON_SOURCE_DCON; ++ dcon_pending = dcon_source; ++ ++ return 0; ++} ++ ++static int dcon_reboot_notify(struct notifier_block *nb, unsigned long foo, void *bar) ++{ ++ if (dcon_client == NULL) ++ return 0; ++ ++ /* Turn off the DCON. Entirely. */ ++ dcon_write(DCON_REG_MODE, 0x39); ++ dcon_write(DCON_REG_MODE, 0x32); ++ return 0; ++} ++ ++static int dcon_conswitch_notify(struct notifier_block *nb, ++ unsigned long mode, void *dummy) ++{ ++ if (mode == CONSOLE_EVENT_SWITCH_TEXT) ++ dcon_sleep(DCON_ACTIVE); ++ ++ return 0; ++} ++ ++static struct notifier_block dcon_nb = { ++ .notifier_call = dcon_reboot_notify, ++ .priority = -1, ++}; ++ ++static struct notifier_block dcon_console_nb = { ++ .notifier_call = dcon_conswitch_notify, ++ .priority = -1, ++}; ++ ++static int unfreeze_on_panic(struct notifier_block *nb, unsigned long e, void *p) ++{ ++ outl(1<<11, gpio_base + GPIOx_OUT_VAL); ++ return NOTIFY_DONE; ++} ++ ++static struct notifier_block dcon_panic_nb = { ++ .notifier_call = unfreeze_on_panic, ++}; ++ ++static int dcon_probe(struct i2c_adapter *adap, int addr, int kind) ++{ ++ struct i2c_client *client; ++ int rc, i; ++ ++ if (!olpc_has_dcon()) { ++ printk("olpc-dcon: No DCON is attached.\n"); ++ return -ENODEV; ++ } ++ ++ if (num_registered_fb >= 1) ++ fbinfo = registered_fb[0]; ++ ++ if (adap->id != I2C_HW_SMBUS_SCX200) { ++ printk(KERN_ERR "olpc-dcon: Invalid I2C bus (%d not %d)\n", ++ adap->id, I2C_HW_SMBUS_SCX200); ++ return -ENXIO; ++ } ++ ++ client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); ++ if (client == NULL) ++ return -ENOMEM; ++ ++ strncpy(client->name, "OLPC-DCON", I2C_NAME_SIZE); ++ client->addr = addr; ++ client->adapter = adap; ++ client->driver = &dcon_driver; ++ ++ if ((rc = i2c_attach_client(client)) != 0) { ++ printk(KERN_ERR "olpc-dcon: Unable to attach the I2C client.\n"); ++ goto eclient; ++ } ++ ++ rc = dcon_hw_init(client, 1); ++ if (rc) ++ goto ei2c; ++ ++ /* Add the DCON device */ ++ ++ dcon_device = platform_device_alloc("dcon", -1); ++ ++ if (dcon_device == NULL) { ++ printk(KERN_ERR "dcon: Unable to create the DCON device\n"); ++ rc = -ENOMEM; ++ goto eirq; ++ } ++ ++ if ((rc = platform_device_add(dcon_device))) { ++ printk(KERN_ERR "dcon: Unable to add the DCON device\n"); ++ goto edev; ++ } ++ ++ for(i = 0; i < ARRAY_SIZE(dcon_device_files); i++) ++ device_create_file(&dcon_device->dev, &dcon_device_files[i]); ++ ++ /* Add the backlight device for the DCON */ ++ ++ dcon_client = client; ++ ++ dcon_bl_dev = backlight_device_register("dcon-bl", &dcon_device->dev, ++ NULL, &dcon_bl_ops); ++ ++ if (IS_ERR(dcon_bl_dev)) { ++ printk(KERN_INFO "Could not register the backlight device for the DCON (%ld)\n", PTR_ERR(dcon_bl_dev)); ++ dcon_bl_dev = NULL; ++ } ++ else { ++ dcon_bl_dev->props.max_brightness = 15; ++ dcon_bl_dev->props.power = FB_BLANK_UNBLANK; ++ dcon_bl_dev->props.brightness = dcon_get_backlight(); ++ ++ backlight_update_status(dcon_bl_dev); ++ } ++ ++ register_reboot_notifier(&dcon_nb); ++ console_event_register(&dcon_console_nb); ++ atomic_notifier_chain_register(&panic_notifier_list, &dcon_panic_nb); ++ ++ return 0; ++ ++ edev: ++ platform_device_unregister(dcon_device); ++ dcon_device = NULL; ++ eirq: ++ free_irq(DCON_IRQ, &dcon_driver); ++ ei2c: ++ i2c_detach_client(client); ++ eclient: ++ kfree(client); ++ ++ return rc; ++} ++ ++static int dcon_attach(struct i2c_adapter *adap) ++{ ++ int ret; ++ ++ ret = i2c_probe(adap, &addr_data, dcon_probe); ++ ++ if (dcon_client == NULL) ++ printk(KERN_ERR "olpc-dcon: No DCON found on SMBus\n"); ++ ++ return ret; ++} ++ ++static int dcon_detach(struct i2c_client *client) ++{ ++ int rc; ++ dcon_client = NULL; ++ ++ unregister_reboot_notifier(&dcon_nb); ++ console_event_unregister(&dcon_console_nb); ++ atomic_notifier_chain_unregister(&panic_notifier_list, &dcon_panic_nb); ++ ++ free_irq(DCON_IRQ, &dcon_driver); ++ ++ if ((rc = i2c_detach_client(client)) == 0) ++ kfree(i2c_get_clientdata(client)); ++ ++ if (dcon_bl_dev != NULL) ++ backlight_device_unregister(dcon_bl_dev); ++ ++ if (dcon_device != NULL) ++ platform_device_unregister(dcon_device); ++ cancel_work_sync(&dcon_work); ++ ++ return rc; ++} ++ ++ ++#ifdef CONFIG_PM ++static int dcon_suspend(struct i2c_client *client, pm_message_t state) ++{ ++ if (dcon_sleep_val != DCON_ACTIVE) ++ return 0; ++ ++ /* Set up the DCON to have the source */ ++ return dcon_set_source_sync(DCON_SOURCE_DCON); ++} ++ ++static int dcon_resume(struct i2c_client *client) ++{ ++ if (dcon_sleep_val != DCON_ACTIVE) ++ return 0; ++ ++ dcon_bus_stabilize(client, 0); ++ ++ return dcon_set_source(DCON_SOURCE_CPU); ++} ++ ++#endif ++ ++static irqreturn_t dcon_interrupt(int irq, void *id) ++{ ++ int status = inl(gpio_base + GPIOx_READ_BACK) >> 5; ++ ++ /* Clear the negative edge status for GPIO7 */ ++ outl(1 << 7, gpio_base + GPIOx_NEGEDGE_STS); ++ ++ switch (status & 3) { ++ case 3: ++ printk(KERN_DEBUG "olpc-dcon: DCONLOAD_MISSED interrupt\n"); ++ break; ++ case 2: /* switch to DCON mode */ ++ case 1: /* switch to CPU mode */ ++ dcon_switched = 1; ++ wake_up(&dcon_wait_queue); ++ break; ++ case 0: ++ printk(KERN_DEBUG "olpc-dcon: scanline interrupt w/CPU\n"); ++ } ++ ++ return IRQ_HANDLED; ++} ++ ++static struct i2c_driver dcon_driver = { ++ .driver = { ++ .name = "OLPC-DCON", ++ }, ++ .id = I2C_DRIVERID_DCON, ++ .attach_adapter = dcon_attach, ++ .detach_client = dcon_detach, ++#ifdef CONFIG_PM ++ .suspend = dcon_suspend, ++ .resume = dcon_resume, ++#endif ++}; ++ ++ ++static int __init olpc_dcon_init(void) ++{ ++ i2c_add_driver(&dcon_driver); ++ return 0; ++} ++ ++static void __exit olpc_dcon_exit(void) ++{ ++ i2c_del_driver(&dcon_driver); ++} ++ ++module_init(olpc_dcon_init); ++module_exit(olpc_dcon_exit); ++ ++MODULE_LICENSE("GPL"); +Binary files linux_2.6.24_org/drivers/video/.olpc_dcon.c.swp and linux_2.6.24_olpc/drivers/video/.olpc_dcon.c.swp differ +diff -purN linux_2.6.24_org/drivers/video/olpc_dcon.h linux_2.6.24_olpc/drivers/video/olpc_dcon.h +--- linux_2.6.24_org/drivers/video/olpc_dcon.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/drivers/video/olpc_dcon.h 2008-02-15 18:58:35.000000000 +0000 +@@ -0,0 +1,75 @@ ++#ifndef OLPC_DCON_H_ ++#define OLPC_DCON_H_ ++ ++/* DCON registers */ ++ ++#define DCON_REG_ID 0 ++#define DCON_REG_MODE 1 ++ ++#define MODE_PASSTHRU (1<<0) ++#define MODE_SLEEP (1<<1) ++#define MODE_SLEEP_AUTO (1<<2) ++#define MODE_BL_ENABLE (1<<3) ++#define MODE_BLANK (1<<4) ++#define MODE_CSWIZZLE (1<<5) ++#define MODE_COL_AA (1<<6) ++#define MODE_MONO_LUMA (1<<7) ++#define MODE_SCAN_INT (1<<8) ++#define MODE_CLOCKDIV (1<<9) ++#define MODE_DEBUG (1<<14) ++#define MODE_SELFTEST (1<<15) ++ ++#define DCON_REG_HRES 2 ++#define DCON_REG_HTOTAL 3 ++#define DCON_REG_HSYNC_WIDTH 4 ++#define DCON_REG_VRES 5 ++#define DCON_REG_VTOTAL 6 ++#define DCON_REG_VSYNC_WIDTH 7 ++#define DCON_REG_TIMEOUT 8 ++#define DCON_REG_SCAN_INT 9 ++#define DCON_REG_BRIGHT 10 ++ ++/* GPIO registers (CS5536) */ ++ ++#define MSR_LBAR_GPIO 0x5140000C ++ ++#define GPIOx_OUT_VAL 0x00 ++#define GPIOx_OUT_EN 0x04 ++#define GPIOx_IN_EN 0x20 ++#define GPIOx_INV_EN 0x24 ++#define GPIOx_IN_FLTR_EN 0x28 ++#define GPIOx_EVNTCNT_EN 0x2C ++#define GPIOx_READ_BACK 0x30 ++#define GPIOx_EVNT_EN 0x38 ++#define GPIOx_NEGEDGE_EN 0x44 ++#define GPIOx_NEGEDGE_STS 0x4C ++#define GPIO_FLT7_AMNT 0xD8 ++#define GPIO_MAP_X 0xE0 ++#define GPIO_MAP_Y 0xE4 ++#define GPIO_FE7_SEL 0xF7 ++ ++ ++/* Status values */ ++ ++#define DCONSTAT_SCANINT 0 ++#define DCONSTAT_SCANINT_DCON 1 ++#define DCONSTAT_DISPLAYLOAD 2 ++#define DCONSTAT_MISSED 3 ++ ++/* Source values */ ++ ++#define DCON_SOURCE_DCON 0 ++#define DCON_SOURCE_CPU 1 ++ ++/* Output values */ ++#define DCON_OUTPUT_COLOR 0 ++#define DCON_OUTPUT_MONO 1 ++ ++/* Sleep values */ ++#define DCON_ACTIVE 0 ++#define DCON_SLEEP 1 ++ ++/* Interrupt */ ++#define DCON_IRQ 6 ++ ++#endif +diff -purN linux_2.6.24_org/fs/jffs2/nodelist.h linux_2.6.24_olpc/fs/jffs2/nodelist.h +--- linux_2.6.24_org/fs/jffs2/nodelist.h 2008-02-15 20:10:35.000000000 +0000 ++++ linux_2.6.24_olpc/fs/jffs2/nodelist.h 2008-02-15 18:57:39.000000000 +0000 +@@ -197,7 +197,7 @@ struct jffs2_inode_cache { + #define RAWNODE_CLASS_XATTR_DATUM 1 + #define RAWNODE_CLASS_XATTR_REF 2 + +-#define INOCACHE_HASHSIZE 128 ++#define INOCACHE_HASHSIZE 1024 + + #define write_ofs(c) ((c)->nextblock->offset + (c)->sector_size - (c)->nextblock->free_size) + +diff -purN linux_2.6.24_org/fs/Kconfig linux_2.6.24_olpc/fs/Kconfig +--- linux_2.6.24_org/fs/Kconfig 2008-02-15 20:10:31.000000000 +0000 ++++ linux_2.6.24_olpc/fs/Kconfig 2008-02-15 18:57:33.000000000 +0000 +@@ -1031,6 +1031,37 @@ config HUGETLBFS + config HUGETLB_PAGE + def_bool HUGETLBFS + ++config PROMFS_FS ++ tristate "PromFS IEEE 1275 file system support" ++ depends on SPARC || PPC || OLPC ++ help ++ PromFS is a file system interface to various IEEE-1275 compatible ++ firmwares. If you have such a firmware (Sparc64, PowerPC, and ++ some other architectures and embedded systems have such firmwares, ++ with names like "OpenBoot (tm)" and "OpenFirmware"), say Y here ++ to be able to access the firmware's device-tree from Linux. ++ ++ The firmware device-tree is available as a virtual file system, ++ can be mounted under /prom with the command "mount -t promfs ++ none /prom". ++ ++ To compile PromFS support as a module, choose M here; the module ++ will be called promfs. If unsure, choose M. ++ ++config RAMFS ++ bool ++ default y ++ ---help--- ++ Ramfs is a file system which keeps all files in RAM. It allows ++ read and write access. ++ ++ It is more of an programming example than a useable file system. If ++ you need a file system which lives in RAM with limit checking use ++ tmpfs. ++ ++ To compile this as a module, choose M here: the module will be called ++ ramfs. ++ + config CONFIGFS_FS + tristate "Userspace-driven configuration filesystem (EXPERIMENTAL)" + depends on SYSFS && EXPERIMENTAL +diff -purN linux_2.6.24_org/fs/Makefile linux_2.6.24_olpc/fs/Makefile +--- linux_2.6.24_org/fs/Makefile 2008-02-15 20:10:33.000000000 +0000 ++++ linux_2.6.24_olpc/fs/Makefile 2008-02-15 18:57:34.000000000 +0000 +@@ -110,6 +110,7 @@ obj-$(CONFIG_ADFS_FS) += adfs/ + obj-$(CONFIG_FUSE_FS) += fuse/ + obj-$(CONFIG_UDF_FS) += udf/ + obj-$(CONFIG_SUN_OPENPROMFS) += openpromfs/ ++obj-$(CONFIG_PROMFS_FS) += promfs/ + obj-$(CONFIG_JFS_FS) += jfs/ + obj-$(CONFIG_XFS_FS) += xfs/ + obj-$(CONFIG_9P_FS) += 9p/ +diff -purN linux_2.6.24_org/fs/promfs/Makefile linux_2.6.24_olpc/fs/promfs/Makefile +--- linux_2.6.24_org/fs/promfs/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/fs/promfs/Makefile 2008-02-15 18:57:33.000000000 +0000 +@@ -0,0 +1 @@ ++obj-$(CONFIG_PROMFS_FS) += promfs.o +diff -purN linux_2.6.24_org/fs/promfs/promfs.c linux_2.6.24_olpc/fs/promfs/promfs.c +--- linux_2.6.24_org/fs/promfs/promfs.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/fs/promfs/promfs.c 2008-02-15 18:57:33.000000000 +0000 +@@ -0,0 +1,295 @@ ++/* ++ * promfs.c - generic inode/dentry functions for IEEE 1275-based filesystems. ++ * ++ * This is based heavily upon prior ieee1275 and other virtual filesystems ++ * implementations; openpromfs, proc_devtree.c, oprofilefs, procfs, ... ++ * ++ * Copyright (C) 2007 Andres Salomon ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program 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 General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License along ++ * with this program; if not, write to the Free Software Foundation, Inc., ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ++ */ ++ ++#include ++#include ++#include ++#include ++//#include ++#include ++ ++#define PROMFS_MAGIC 0x1f2f3fff ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Andres Salomon"); ++ ++struct promfs_inode ++{ ++ struct inode ino; ++ struct property *prop; ++}; ++ ++static inline struct promfs_inode *to_promfs_inode(struct inode *inode) ++{ ++ return container_of(inode, struct promfs_inode, ino); ++} ++ ++#if 0 ++static DEFINE_SPINLOCK(promfs_lock); ++ ++static struct of_node *of_tree = NULL; ++static DEFINE_RWLOCK(of_tree_lock); ++ ++void __init of_build_tree(void) ++{ ++ ++ ++} ++#endif ++ ++static int promfs_open_file(struct inode *inode, struct file *file) ++{ ++ struct promfs_inode *ino; ++ ++ ino = to_promfs_inode(inode); ++ if (!ino->prop) ++ return -EIO; ++ file->private_data = ino->prop; ++ ++ return 0; ++} ++ ++static ssize_t promfs_read_file(struct file *file, char __user *data, ++ size_t len, loff_t *ppos) ++{ ++ struct property *prop = (struct property *) file->private_data; ++ return simple_read_from_buffer(data, len, ppos, prop->value, ++ prop->length); ++} ++ ++static ssize_t promfs_write_file(struct file *file, char const __user *buf, ++ size_t count, loff_t * offset) ++{ ++ /* TODO.... 'cause, y'know, it would be nice. */ ++ return -EIO; ++} ++ ++static struct file_operations promfs_file_ops = { ++ .open = promfs_open_file, ++ .read = promfs_read_file, ++ .write = promfs_write_file, ++}; ++ ++static struct kmem_cache *promfs_inode_cachep; ++ ++static struct inode *promfs_alloc_inode(struct super_block *sb) ++{ ++ struct promfs_inode *pr_ino; ++ ++ pr_ino = kmem_cache_alloc(promfs_inode_cachep, GFP_KERNEL); ++ if (!pr_ino) ++ return NULL; ++ pr_ino->prop = NULL; ++ ++ return &pr_ino->ino; ++} ++ ++static void promfs_destroy_inode(struct inode *inode) ++{ ++ kmem_cache_free(promfs_inode_cachep, to_promfs_inode(inode)); ++} ++ ++static void promfs_read_inode(struct inode *inode) ++{ ++ inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; ++} ++ ++static int promfs_remount(struct super_block *sb, int *flags, char *data) ++{ ++ *flags |= MS_NOATIME; ++ return 0; ++} ++ ++static struct super_operations promfs_s_ops = { ++ .alloc_inode = promfs_alloc_inode, ++ .destroy_inode = promfs_destroy_inode, ++ .read_inode = promfs_read_inode, ++ .statfs = simple_statfs, ++ .drop_inode = generic_delete_inode, ++ .remount_fs = promfs_remount, ++}; ++ ++static struct inode *promfs_get_inode(struct super_block *sb, int mode) ++{ ++ struct inode *inode = new_inode(sb); ++ ++ if (inode) { ++ inode->i_mode = mode; ++ inode->i_uid = 0; ++ inode->i_gid = 0; ++ inode->i_blocks = 0; ++ inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; ++ } ++ ++ return inode; ++} ++ ++static int promfs_create_file(struct super_block *sb, struct dentry *root, ++ struct property *prop, const struct file_operations *fops) ++{ ++ struct dentry *dentry; ++ struct inode *inode; ++ struct promfs_inode *ino; ++ ++ dentry = d_alloc_name(root, prop->name); ++ if (!dentry) ++ goto err; ++ ++ inode = promfs_get_inode(sb, S_IFREG | 0644); ++ if (!inode) ++ goto err_dput; ++ inode->i_fop = fops; ++ ino = to_promfs_inode(inode); ++ ino->prop = prop; ++ d_add(dentry, inode); ++ ++ return 0; ++ ++err_dput: ++ dput(dentry); ++err: ++ return -EFAULT; ++} ++ ++struct dentry *promfs_create_dir(struct super_block *sb, struct dentry *root, ++ char const *name) ++{ ++ struct dentry *dentry; ++ struct inode *inode; ++ ++ dentry = d_alloc_name(root, name); ++ if (!dentry) ++ goto err; ++ ++ inode = promfs_get_inode(sb, S_IFDIR | 0755); ++ if (!inode) ++ goto err_dput; ++ inode->i_op = &simple_dir_inode_operations; ++ inode->i_fop = &simple_dir_operations; ++ d_add(dentry, inode); ++ return dentry; ++ ++err_dput: ++ dput(dentry); ++err: ++ return NULL; ++} ++ ++void promfs_populate(struct super_block *sb, struct dentry *root, ++ struct device_node *node) ++{ ++ struct dentry *dentry; ++ struct device_node *child; ++ struct property *prop; ++ ++ if (!node) ++ return; ++ ++ for (child = node->child; child; child = child->sibling) { ++ dentry = promfs_create_dir(sb, root, child->path_component_name); ++ promfs_populate(sb, dentry, child); ++ } ++ for (prop = node->properties; prop; prop = prop->next) ++ promfs_create_file(sb, root, prop, &promfs_file_ops); ++} ++ ++static int promfs_fill_super(struct super_block *sb, void *data, int silent) ++{ ++ struct inode *root_inode; ++ struct dentry *root_dentry; ++ struct promfs_inode *inode; ++ ++ sb->s_blocksize = PAGE_CACHE_SIZE; ++ sb->s_blocksize_bits = PAGE_CACHE_SHIFT; ++ sb->s_magic = PROMFS_MAGIC; ++ sb->s_op = &promfs_s_ops; ++ sb->s_time_gran = 1; ++ sb->s_flags |= MS_NOATIME; ++ ++ root_inode = promfs_get_inode(sb, S_IFDIR | 0755); ++ if (!root_inode) ++ goto err; ++ root_inode->i_op = &simple_dir_inode_operations; ++ root_inode->i_fop = &simple_dir_operations; ++ ++ inode = to_promfs_inode(root_inode); ++ ++ root_dentry = d_alloc_root(root_inode); ++ if (!root_dentry) ++ goto err_iput; ++ sb->s_root = root_dentry; ++ ++ promfs_populate(sb, root_dentry, of_find_node_by_path("/")); ++ return 0; ++ ++err_iput: ++ iput(root_inode); ++err: ++ return -ENOMEM; ++} ++ ++static int promfs_get_sb(struct file_system_type *fs_type, int flags, ++ const char *dev_name, void *data, struct vfsmount *mnt) ++{ ++ return get_sb_single(fs_type, flags, data, promfs_fill_super, mnt); ++} ++ ++static struct file_system_type promfs_fs_type = { ++ .owner = THIS_MODULE, ++ .name = "promfs", ++ .get_sb = promfs_get_sb, ++ .kill_sb = kill_litter_super, ++}; ++ ++static void init_once(void *i, struct kmem_cache *cachep, unsigned long fl) ++{ ++ struct promfs_inode *inode = (struct promfs_inode *) i; ++ inode_init_once(&inode->ino); ++} ++ ++static int __init init_promfs(void) ++{ ++ int err; ++ ++ prom_build_devicetree(); ++ promfs_inode_cachep = kmem_cache_create("promfs_inode_cache", ++ sizeof(struct promfs_inode), 0, ++ SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, init_once, NULL); ++ if (!promfs_inode_cachep) ++ return -ENOMEM; ++ ++ err = register_filesystem(&promfs_fs_type); ++ if (err) ++ kmem_cache_destroy(promfs_inode_cachep); ++ ++ return err; ++} ++ ++static void __exit exit_promfs(void) ++{ ++ unregister_filesystem(&promfs_fs_type); ++ kmem_cache_destroy(promfs_inode_cachep); ++} ++ ++module_init(init_promfs); ++module_exit(exit_promfs); +diff -purN linux_2.6.24_org/include/asm-x86/ofw.h linux_2.6.24_olpc/include/asm-x86/ofw.h +--- linux_2.6.24_org/include/asm-x86/ofw.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/include/asm-x86/ofw.h 2008-02-15 18:57:59.000000000 +0000 +@@ -0,0 +1,16 @@ ++/* ++ * Definitions for Open Firmware client interface on 32-bit system. ++ * OF Cell size is 4. Integer properties are encoded big endian, ++ * as with all OF implementations. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++#ifndef _OFW_H ++#define _OFW_H ++ ++extern int ofw(char *, int, int, ...); ++ ++#endif +diff -purN linux_2.6.24_org/include/asm-x86/olpc.h linux_2.6.24_olpc/include/asm-x86/olpc.h +--- linux_2.6.24_org/include/asm-x86/olpc.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/include/asm-x86/olpc.h 2008-02-15 18:57:59.000000000 +0000 +@@ -0,0 +1,107 @@ ++/* OLPC machine specific definitions */ ++ ++#ifndef ASM_OLPC_H_ ++#define ASM_OLPC_H_ ++ ++#include ++ ++struct olpc_platform_t { ++ int flags; ++ u32 boardrev; ++ int ecver; ++}; ++ ++#define OLPC_F_PRESENT 0x01 ++#define OLPC_F_DCON 0x02 ++#define OLPC_F_VSA 0x04 ++ ++/* ++ * OLPC board IDs contain the major build number within the mask 0x0ff0, ++ * and the minor build number withing 0x000f. Pre-builds have a minor ++ * number less than 8, and normal builds start at 8. For example, 0x0B10 ++ * is a PreB1, and 0x0C18 is a C1. ++ */ ++ ++static inline u32 olpc_board(u8 id) ++{ ++ return (id << 4) | 0x8; ++} ++ ++static inline u32 olpc_board_pre(u8 id) ++{ ++ return id << 4; ++} ++ ++#ifndef CONFIG_OLPC ++ ++static inline int machine_is_olpc(void) { return 0; } ++static inline int olpc_has_dcon(void) { return 0; } ++static inline int olpc_has_vsa(void) { return 0; } ++ ++#else ++ ++extern struct olpc_platform_t olpc_platform_info; ++ ++static inline int ++machine_is_olpc(void) ++{ ++ return (olpc_platform_info.flags & OLPC_F_PRESENT) ? 1 : 0; ++} ++ ++static inline int ++olpc_has_dcon(void) ++{ ++ return (olpc_platform_info.flags & OLPC_F_DCON) ? 1 : 0; ++} ++ ++static inline int ++olpc_has_vsa(void) ++{ ++ return (olpc_platform_info.flags & OLPC_F_VSA) ? 1 : 0; ++} ++ ++static inline int olpc_board_at_least(u32 rev) ++{ ++ return olpc_platform_info.boardrev >= rev; ++} ++ ++#endif ++ ++/* EC functions */ ++ ++int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen, ++ unsigned char *outbuf, size_t outlen); ++ ++void olpc_register_battery_callback(void (*f)(unsigned long)); ++void olpc_deregister_battery_callback(void); ++ ++/* EC commands and responses */ ++ ++/* SCI source values */ ++ ++#define EC_SCI_SRC_EMPTY 0x00 ++#define EC_SCI_SRC_GAME 0x01 ++#define EC_SCI_SRC_BATTERY 0x02 ++#define EC_SCI_SRC_BATSOC 0x04 ++#define EC_SCI_SRC_BATERR 0x08 ++#define EC_SCI_SRC_EBOOK 0x10 ++#define EC_SCI_SRC_WLAN 0x20 ++#define EC_SCI_SRC_ACPWR 0x40 ++#define EC_SCI_SRC_ALL 0x7F ++ ++int olpc_ec_mask_set(u8 bits); ++int olpc_ec_mask_unset(u8 bits); ++ ++/* GPIO assignments */ ++ ++#define OLPC_GPIO_MIC_AC (1 << 1) ++#define OLPC_GPIO_DCON_IRQ (1 << 7) ++#define OLPC_GPIO_THRM_ALRM (1 << 10) ++#define OLPC_GPIO_SMB_CLK (1 << 14) ++#define OLPC_GPIO_SMB_DATA (1 << 15) ++#define OLPC_GPIO_WORKAUX (1 << 24) ++#define OLPC_GPIO_LID (1 << 26) ++#define OLPC_GPIO_ECSCI (1 << 27) ++ ++#endif ++ +diff -purN linux_2.6.24_org/include/asm-x86/prom.h linux_2.6.24_olpc/include/asm-x86/prom.h +--- linux_2.6.24_org/include/asm-x86/prom.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/include/asm-x86/prom.h 2008-02-15 18:57:59.000000000 +0000 +@@ -0,0 +1,108 @@ ++#ifndef _I386_PROM_H ++#define _I386_PROM_H ++#ifdef __KERNEL__ ++ ++ ++/* ++ * Definitions for talking to the Open Firmware PROM on ++ * Power Macintosh computers. ++ * ++ * Copyright (C) 1996-2005 Paul Mackerras. ++ * ++ * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp. ++ * Updates for SPARC64 by David S. Miller ++ * Updates for i386/OLPC by Andres Salomon ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++ ++#include ++#include ++#include ++ ++typedef u32 phandle; ++typedef u32 ihandle; ++ ++struct property { ++ char *name; ++ int length; ++ void *value; ++ struct property *next; ++}; ++ ++struct device_node { ++ const char *name; ++ const char *type; ++ phandle node; ++// phandle linux_phandle; ++ char *path_component_name; ++ char *full_name; ++ ++ struct property *properties; ++ struct property *deadprops; /* removed properties */ ++ struct device_node *parent; ++ struct device_node *child; ++ struct device_node *sibling; ++ struct device_node *next; /* next device of same type */ ++ struct device_node *allnext; /* next in list of all nodes */ ++ struct proc_dir_entry *pde; /* this node's proc directory */ ++ struct kref kref; ++ unsigned long _flags; ++ void *data; ++}; ++ ++/* flag descriptions */ ++#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ ++ ++#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) ++#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) ++ ++#define OF_BAD_ADDR ((u64)-1) ++ ++static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de) ++{ ++ dn->pde = de; ++} ++ ++extern struct device_node *of_find_node_by_name(struct device_node *from, ++ const char *name); ++#define for_each_node_by_name(dn, name) \ ++ for (dn = of_find_node_by_name(NULL, name); dn; \ ++ dn = of_find_node_by_name(dn, name)) ++extern struct device_node *of_find_node_by_type(struct device_node *from, ++ const char *type); ++#define for_each_node_by_type(dn, type) \ ++ for (dn = of_find_node_by_type(NULL, type); dn; \ ++ dn = of_find_node_by_type(dn, type)) ++extern struct device_node *of_find_compatible_node(struct device_node *from, ++ const char *type, const char *compat); ++extern struct device_node *of_find_node_by_path(const char *path); ++extern struct device_node *of_find_node_by_phandle(phandle handle); ++extern struct device_node *of_get_parent(const struct device_node *node); ++extern struct device_node *of_get_next_child(const struct device_node *node, ++ struct device_node *prev); ++extern struct property *of_find_property(const struct device_node *np, ++ const char *name, ++ int *lenp); ++//extern struct device_node *of_node_get(struct device_node *node); ++//extern void of_node_put(struct device_node *node); ++extern int of_device_is_compatible(const struct device_node *device, ++ const char *); ++extern const void *of_get_property(const struct device_node *node, ++ const char *name, ++ int *lenp); ++#define get_property(node,name,lenp) of_get_property(node,name,lenp) ++extern int of_set_property(struct device_node *node, const char *name, void *val, int len); ++extern int of_getintprop_default(struct device_node *np, ++ const char *name, ++ int def); ++extern int of_n_addr_cells(struct device_node *np); ++extern int of_n_size_cells(struct device_node *np); ++ ++extern void prom_build_devicetree(void); ++ ++#endif /* __KERNEL__ */ ++#endif +diff -purN linux_2.6.24_org/include/linux/battery.h linux_2.6.24_olpc/include/linux/battery.h +--- linux_2.6.24_org/include/linux/battery.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/include/linux/battery.h 2008-02-15 18:58:06.000000000 +0000 +@@ -0,0 +1,101 @@ ++/* ++ * Driver model for batteries ++ * ++ * © 2006 David Woodhouse ++ * ++ * Based on LED Class support, by John Lenz and Richard Purdie: ++ * ++ * © 2005 John Lenz ++ * © 2005-2006 Richard Purdie ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++#ifndef __LINUX_BATTERY_H__ ++#define __LINUX_BATTERY_H__ ++ ++struct device; ++struct class_device; ++ ++/* ++ * Battery Core ++ */ ++#define PWRDEV_TYPE_BATTERY 0 ++#define PWRDEV_TYPE_AC 1 ++ ++#define BAT_STAT_PRESENT (1<<0) ++#define BAT_STAT_LOW (1<<1) ++#define BAT_STAT_FULL (1<<2) ++#define BAT_STAT_CHARGING (1<<3) ++#define BAT_STAT_DISCHARGING (1<<4) ++#define BAT_STAT_OVERTEMP (1<<5) ++#define BAT_STAT_CRITICAL (1<<6) ++#define BAT_STAT_FIRE (1<<7) ++#define BAT_STAT_CHARGE_DONE (1<<8) ++ ++/* Thou shalt not export any attributes in sysfs except these, and ++ with these units: */ ++#define BAT_INFO_STATUS "status" /* Not free-form. Use ++ provided function */ ++#define BAT_INFO_TEMP1 "temp1" /* °C/1000 */ ++#define BAT_INFO_TEMP1_NAME "temp1_name" /* string */ ++ ++#define BAT_INFO_TEMP2 "temp2" /* °C/1000 */ ++#define BAT_INFO_TEMP2_NAME "temp2_name" /* string */ ++ ++#define BAT_INFO_VOLTAGE "voltage" /* mV */ ++#define BAT_INFO_VOLTAGE_DESIGN "voltage_design" /* mV */ ++ ++#define BAT_INFO_CURRENT "current" /* mA */ ++#define BAT_INFO_CURRENT_NOW "current_now" /* mA */ ++ ++#define BAT_INFO_POWER "power" /* mW */ ++#define BAT_INFO_POWER_NOW "power_now" /* mW */ ++ ++/* The following capacity/charge properties are represented in either ++ mA or mW. The CAP_UNITS property MUST be provided if any of these are. */ ++#define BAT_INFO_RATE "rate" /* CAP_UNITS */ ++#define BAT_INFO_CAP_LEFT "capacity_left" /* CAP_UNITS*h */ ++#define BAT_INFO_CAP_DESIGN "capacity_design" /* CAP_UNITS*h */ ++#define BAT_INFO_CAP_LAST_FULL "capacity_last_full" /* CAP_UNITS*h */ ++#define BAT_INFO_CAP_LOW "capacity_low_thresh" /* CAP_UNITS*h */ ++#define BAT_INFO_CAP_WARN "capacity_warn_thresh" /* CAP_UNITS*h */ ++#define BAT_INFO_CAP_UNITS "capacity_units" /* string: must be ++ either mA or mW */ ++ ++#define BAT_INFO_CAP_PCT "capacity_percentage" /* integer */ ++ ++#define BAT_INFO_TIME_EMPTY "time_to_empty" /* seconds */ ++#define BAT_INFO_TIME_EMPTY_NOW "time_to_empty_now" /* seconds */ ++#define BAT_INFO_TIME_FULL "time_to_full" /* seconds */ ++#define BAT_INFO_TIME_FULL_NOW "time_to_full_now" /* seconds */ ++ ++#define BAT_INFO_MANUFACTURER "manufacturer" /* string */ ++#define BAT_INFO_TECHNOLOGY "technology" /* string */ ++#define BAT_INFO_MODEL "model" /* string */ ++#define BAT_INFO_SERIAL "serial" /* string */ ++#define BAT_INFO_OEM_INFO "oem_info" /* string */ ++ ++#define BAT_INFO_CYCLE_COUNT "cycle_count" /* integer */ ++#define BAT_INFO_DATE_MFR "date_manufactured" /* YYYY[-MM[-DD]] */ ++#define BAT_INFO_DATE_FIRST_USE "date_first_use" /* YYYY[-MM[-DD]] */ ++ ++struct battery_dev { ++ int status_cap; ++ int id; ++ int type; ++ const char *name; ++ ++ struct device *dev; ++}; ++ ++int battery_device_register(struct device *parent, ++ struct battery_dev *battery_cdev); ++void battery_device_unregister(struct battery_dev *battery_cdev); ++ ++ ++ssize_t battery_attribute_show_status(char *buf, unsigned long status); ++ssize_t battery_attribute_show_ac_status(char *buf, unsigned long status); ++#endif /* __LINUX_BATTERY_H__ */ +diff -purN linux_2.6.24_org/include/linux/fb.h linux_2.6.24_olpc/include/linux/fb.h +--- linux_2.6.24_org/include/linux/fb.h 2008-02-15 20:10:55.000000000 +0000 ++++ linux_2.6.24_olpc/include/linux/fb.h 2008-02-15 18:58:01.000000000 +0000 +@@ -666,6 +666,12 @@ struct fb_ops { + /* restore saved state */ + void (*fb_restore_state)(struct fb_info *info); + ++ /* Shut down the graphics engine to save power */ ++ int (*fb_powerdown)(struct fb_info *info); ++ ++ /* Power it back up */ ++ int (*fb_powerup)(struct fb_info *info); ++ + /* get capability given var */ + void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps, + struct fb_var_screeninfo *var); +@@ -945,6 +951,9 @@ extern int fb_get_color_depth(struct fb_ + extern int fb_get_options(char *name, char **option); + extern int fb_new_modelist(struct fb_info *info); + ++extern int fb_powerdown(struct fb_info *info); ++extern int fb_powerup(struct fb_info *info); ++ + extern struct fb_info *registered_fb[FB_MAX]; + extern int num_registered_fb; + extern struct class *fb_class; +diff -purN linux_2.6.24_org/include/linux/i2c-id.h linux_2.6.24_olpc/include/linux/i2c-id.h +--- linux_2.6.24_org/include/linux/i2c-id.h 2008-02-15 20:10:52.000000000 +0000 ++++ linux_2.6.24_olpc/include/linux/i2c-id.h 2008-02-15 18:58:00.000000000 +0000 +@@ -125,6 +125,7 @@ + #define I2C_DRIVERID_LM4857 92 /* LM4857 Audio Amplifier */ + #define I2C_DRIVERID_VP27SMPX 93 /* Panasonic VP27s tuner internal MPX */ + #define I2C_DRIVERID_CS4270 94 /* Cirrus Logic 4270 audio codec */ ++#define I2C_DRIVERID_DCON 95 + + #define I2C_DRIVERID_I2CDEV 900 + #define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ +diff -purN linux_2.6.24_org/include/linux/isl_38xx.h linux_2.6.24_olpc/include/linux/isl_38xx.h +--- linux_2.6.24_org/include/linux/isl_38xx.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/include/linux/isl_38xx.h 2008-02-15 18:58:05.000000000 +0000 +@@ -0,0 +1,127 @@ ++/* ++ * Copyright (C) 2002 Intersil Americas Inc. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License ++ * ++ * This program 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 General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#ifndef _LINUX_ISL_38XX_H ++#define _LINUX_ISL_38XX_H ++ ++#include ++ ++#define ISL38XX_CB_RX_QSIZE 8 ++#define ISL38XX_CB_TX_QSIZE 32 ++ ++/* ISL38XX Access Point Specific definitions */ ++#define ISL38XX_MAX_WDS_LINKS 8 ++ ++/* ISL38xx Client Specific definitions */ ++#define ISL38XX_PSM_ACTIVE_STATE 0 ++#define ISL38XX_PSM_POWERSAVE_STATE 1 ++ ++/* ISL38XX Host Interface Definitions */ ++#define ISL38XX_PCI_MEM_SIZE 0x02000 ++#define ISL38XX_MEMORY_WINDOW_SIZE 0x01000 ++#define ISL38XX_DEV_FIRMWARE_ADDRES 0x20000 ++#define ISL38XX_WRITEIO_DELAY 10 /* in us */ ++#define ISL38XX_RESET_DELAY 50 /* in ms */ ++#define ISL38XX_WAIT_CYCLE 10 /* in 10ms */ ++#define ISL38XX_MAX_WAIT_CYCLES 10 ++ ++/* PCI Memory Area */ ++#define ISL38XX_HARDWARE_REG 0x0000 ++#define ISL38XX_CARDBUS_CIS 0x0800 ++#define ISL38XX_DIRECT_MEM_WIN 0x1000 ++ ++/* Hardware registers */ ++#define ISL38XX_DEV_INT_REG 0x0000 ++#define ISL38XX_INT_IDENT_REG 0x0010 ++#define ISL38XX_INT_ACK_REG 0x0014 ++#define ISL38XX_INT_EN_REG 0x0018 ++#define ISL38XX_GEN_PURP_COM_REG_1 0x0020 ++#define ISL38XX_GEN_PURP_COM_REG_2 0x0024 ++#define ISL38XX_CTRL_BLK_BASE_REG ISL38XX_GEN_PURP_COM_REG_1 ++#define ISL38XX_DIR_MEM_BASE_REG 0x0030 ++#define ISL38XX_CTRL_STAT_REG 0x0078 ++ ++/* High end mobos queue up pci writes, the following ++ * is used to "read" from after a write to force flush */ ++#define ISL38XX_PCI_POSTING_FLUSH ISL38XX_INT_EN_REG ++ ++/** ++ * isl38xx_w32_flush - PCI iomem write helper ++ * @base: (host) memory base address of the device ++ * @val: 32bit value (host order) to write ++ * @offset: byte offset into @base to write value to ++ * ++ * This helper takes care of writing a 32bit datum to the ++ * specified offset into the device's pci memory space, and making sure ++ * the pci memory buffers get flushed by performing one harmless read ++ * from the %ISL38XX_PCI_POSTING_FLUSH offset. ++ */ ++static inline void ++isl38xx_w32_flush(void __iomem *base, u32 val, unsigned long offset) ++{ ++ writel(val, base + offset); ++ (void) readl(base + ISL38XX_PCI_POSTING_FLUSH); ++} ++ ++/* Device Interrupt register bits */ ++#define ISL38XX_DEV_INT_RESET 0x0001 ++#define ISL38XX_DEV_INT_UPDATE 0x0002 ++#define ISL38XX_DEV_INT_WAKEUP 0x0008 ++#define ISL38XX_DEV_INT_SLEEP 0x0010 ++#define ISL38XX_DEV_INT_ABORT 0x0020 ++/* thos two only used in USB */ ++#define ISL38XX_DEV_INT_DATA 0x0040 ++#define ISL38XX_DEV_INT_MGMT 0x0080 ++ ++#define ISL38XX_DEV_INT_PCIUART_CTS 0x4000 ++#define ISL38XX_DEV_INT_PCIUART_DR 0x8000 ++ ++/* Interrupt Identification/Acknowledge/Enable register bits */ ++#define ISL38XX_INT_IDENT_UPDATE 0x0002 ++#define ISL38XX_INT_IDENT_INIT 0x0004 ++#define ISL38XX_INT_IDENT_WAKEUP 0x0008 ++#define ISL38XX_INT_IDENT_SLEEP 0x0010 ++#define ISL38XX_INT_IDENT_PCIUART_CTS 0x4000 ++#define ISL38XX_INT_IDENT_PCIUART_DR 0x8000 ++ ++#define ISL38XX_INT_SOURCES (ISL38XX_INT_IDENT_UPDATE | \ ++ ISL38XX_INT_IDENT_INIT | \ ++ ISL38XX_INT_IDENT_WAKEUP | \ ++ ISL38XX_INT_IDENT_SLEEP | \ ++ ISL38XX_INT_IDENT_PCIUART_CTS | \ ++ ISL38XX_INT_IDENT_PCIUART_DR) ++ ++/* Control/Status register bits */ ++/* Looks like there are other meaningful bits ++ 0x20004400 seen in normal operation, ++ 0x200044db at 'timeout waiting for mgmt response' ++*/ ++#define ISL38XX_CTRL_STAT_SLEEPMODE 0x00000200 ++#define ISL38XX_CTRL_STAT_CLKRUN 0x00800000 ++#define ISL38XX_CTRL_STAT_RESET 0x10000000 ++#define ISL38XX_CTRL_STAT_RAMBOOT 0x20000000 ++#define ISL38XX_CTRL_STAT_STARTHALTED 0x40000000 ++#define ISL38XX_CTRL_STAT_HOST_OVERRIDE 0x80000000 ++ ++/* Some flags for the isl hardware registers controlling DMA inside the ++ * chip */ ++#define ISL38XX_DMA_STATUS_DONE 0x00000001 ++#define ISL38XX_DMA_STATUS_READY 0x00000002 ++#define NET2280_EPA_FIFO_PCI_ADDR 0x20000000 ++#define ISL38XX_DMA_MASTER_CONTROL_TRIGGER 0x00000004 ++ ++#endif /* _LINUX_ISL_38XX_H */ +diff -purN linux_2.6.24_org/include/linux/pm.h linux_2.6.24_olpc/include/linux/pm.h +--- linux_2.6.24_org/include/linux/pm.h 2008-02-15 20:11:06.000000000 +0000 ++++ linux_2.6.24_olpc/include/linux/pm.h 2008-02-15 18:58:06.000000000 +0000 +@@ -178,6 +178,9 @@ struct dev_pm_info { + unsigned can_wakeup:1; + #ifdef CONFIG_PM_SLEEP + unsigned should_wakeup:1; ++ pm_message_t prev_state; ++ void * saved_state; ++ struct device * pm_parent; + struct list_head entry; + #endif + }; +diff -purN linux_2.6.24_org/include/linux/power_supply.h linux_2.6.24_olpc/include/linux/power_supply.h +--- linux_2.6.24_org/include/linux/power_supply.h 2008-02-15 20:10:55.000000000 +0000 ++++ linux_2.6.24_olpc/include/linux/power_supply.h 2008-02-15 18:58:01.000000000 +0000 +@@ -98,9 +98,11 @@ enum power_supply_property { + POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG, + POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, + POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, ++ POWER_SUPPLY_PROP_ACCUM_CURRENT, + /* Properties of type `const char *' */ + POWER_SUPPLY_PROP_MODEL_NAME, + POWER_SUPPLY_PROP_MANUFACTURER, ++ POWER_SUPPLY_PROP_SERIAL_NUMBER, + }; + + enum power_supply_type { +@@ -169,9 +171,10 @@ struct power_supply_info { + + extern void power_supply_changed(struct power_supply *psy); + extern int power_supply_am_i_supplied(struct power_supply *psy); ++extern void power_supply_status_changed(struct power_supply *psy); + + extern int power_supply_register(struct device *parent, +- struct power_supply *psy); ++ struct power_supply *psy); + extern void power_supply_unregister(struct power_supply *psy); + + /* For APM emulation, think legacy userspace. */ +diff -purN linux_2.6.24_org/include/linux/vt_kern.h linux_2.6.24_olpc/include/linux/vt_kern.h +--- linux_2.6.24_org/include/linux/vt_kern.h 2008-02-15 20:10:55.000000000 +0000 ++++ linux_2.6.24_olpc/include/linux/vt_kern.h 2008-02-15 18:58:02.000000000 +0000 +@@ -96,4 +96,23 @@ struct vt_spawn_console { + }; + extern struct vt_spawn_console vt_spawn_con; + ++/* A notifier list for console events */ ++extern struct raw_notifier_head console_notifier_list; ++ ++/* Called when the FG console switches to KD_TEXT mode */ ++#define CONSOLE_EVENT_SWITCH_TEXT 0x01 ++ ++/* Called when the FG console switches to KD_GRAPHICS mode */ ++#define CONSOLE_EVENT_SWITCH_GRAPHICS 0x02 ++ ++static inline int console_event_register(struct notifier_block *n) ++{ ++ return raw_notifier_chain_register(&console_notifier_list, n); ++} ++ ++static inline int console_event_unregister(struct notifier_block *n) ++{ ++ return raw_notifier_chain_unregister(&console_notifier_list, n); ++} ++ + #endif /* _VT_KERN_H */ +diff -purN linux_2.6.24_org/include/sound/ac97_codec.h linux_2.6.24_olpc/include/sound/ac97_codec.h +--- linux_2.6.24_org/include/sound/ac97_codec.h 2008-02-15 20:10:44.000000000 +0000 ++++ linux_2.6.24_olpc/include/sound/ac97_codec.h 2008-02-15 18:57:45.000000000 +0000 +@@ -281,10 +281,12 @@ + /* specific - Analog Devices */ + #define AC97_AD_TEST 0x5a /* test register */ + #define AC97_AD_TEST2 0x5c /* undocumented test register 2 */ ++#define AC97_AD_HPFD_SHIFT 12 /* High Pass Filter Disable */ + #define AC97_AD_CODEC_CFG 0x70 /* codec configuration */ + #define AC97_AD_JACK_SPDIF 0x72 /* Jack Sense & S/PDIF */ + #define AC97_AD_SERIAL_CFG 0x74 /* Serial Configuration */ + #define AC97_AD_MISC 0x76 /* Misc Control Bits */ ++#define AC97_AD_VREFD_SHIFT 2 /* V_REFOUT Disable (AD1888) */ + + /* specific - Cirrus Logic */ + #define AC97_CSR_ACMODE 0x5e /* AC Mode Register */ +diff -purN linux_2.6.24_org/kernel/power/console.c linux_2.6.24_olpc/kernel/power/console.c +--- linux_2.6.24_org/kernel/power/console.c 2008-02-15 20:12:34.000000000 +0000 ++++ linux_2.6.24_olpc/kernel/power/console.c 2008-02-15 19:00:00.000000000 +0000 +@@ -9,7 +9,7 @@ + #include + #include "power.h" + +-#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) ++#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) && !defined(CONFIG_DISABLE_SUSPEND_VT_SWITCH) + #define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1) + + static int orig_fgconsole, orig_kmsg; +diff -purN linux_2.6.24_org/kernel/power/Kconfig linux_2.6.24_olpc/kernel/power/Kconfig +--- linux_2.6.24_org/kernel/power/Kconfig 2008-02-15 20:12:34.000000000 +0000 ++++ linux_2.6.24_olpc/kernel/power/Kconfig 2008-02-15 19:00:00.000000000 +0000 +@@ -37,9 +37,22 @@ config PM_DEBUG + code. This is helpful when debugging and reporting PM bugs, like + suspend support. + ++config DISABLE_SUSPEND_VT_SWITCH ++ bool "Disable the console switch prior to suspend (DANGEROUS)" ++ depends on PM_DEBUG ++ default n ++ ---help--- ++ This option disables the automatic switch to VT console that happens ++ prior to Linux going into a suspend/sleep. Your video card/framebuffer ++ must be able to properly restore the display (even if X is doing ++ something crazy!) in this scenario. This is useful for saving ++ precious milliseconds during suspend and resume. ++ ++ If unsure, say N. ++ + config PM_VERBOSE + bool "Verbose Power Management debugging" +- depends on PM_DEBUG ++ depends on VT_CONSOLE && PM && EXPERIMENTAL + default n + ---help--- + This option enables verbose messages from the Power Management code. +diff -purN linux_2.6.24_org/kernel/power/main.c linux_2.6.24_olpc/kernel/power/main.c +--- linux_2.6.24_org/kernel/power/main.c 2008-02-15 20:12:34.000000000 +0000 ++++ linux_2.6.24_olpc/kernel/power/main.c 2008-02-15 19:00:00.000000000 +0000 +@@ -76,11 +76,13 @@ static int suspend_prepare(void) + if (!suspend_ops || !suspend_ops->enter) + return -EPERM; + ++#ifndef CONFIG_OLPC_PM + error = pm_notifier_call_chain(PM_SUSPEND_PREPARE); + if (error) + goto Finish; + + pm_prepare_console(); ++#endif + + if (freeze_processes()) { + error = -EAGAIN; +diff -purN linux_2.6.24_org/scripts/kconfig/conf.c linux_2.6.24_olpc/scripts/kconfig/conf.c +--- linux_2.6.24_org/scripts/kconfig/conf.c 2008-02-15 20:10:15.000000000 +0000 ++++ linux_2.6.24_olpc/scripts/kconfig/conf.c 2008-02-15 18:57:09.000000000 +0000 +@@ -22,6 +22,7 @@ enum { + ask_new, + ask_silent, + set_default, ++ set_silentdefault, + set_yes, + set_mod, + set_no, +@@ -64,10 +65,11 @@ static void strip(char *str) + + static void check_stdin(void) + { +- if (!valid_stdin && input_mode == ask_silent) { ++ if (!valid_stdin && (input_mode == ask_silent || ++ input_mode == set_silentdefault)) { + printf(_("aborted!\n\n")); + printf(_("Console input/output is redirected. ")); +- printf(_("Run 'make oldconfig' to update configuration.\n\n")); ++ printf(_("Configuration file needs to be updated.\n\n")); + exit(1); + } + } +@@ -102,6 +104,7 @@ static int conf_askvalue(struct symbol * + break; + case ask_new: + case ask_silent: ++ case set_silentdefault: + if (sym_has_value(sym)) { + printf("%s\n", def); + return 0; +@@ -352,6 +355,7 @@ static int conf_choice(struct menu *menu + switch (input_mode) { + case ask_new: + case ask_silent: ++ case set_silentdefault: + if (!is_new) { + cnt = def; + printf("%d\n", cnt); +@@ -424,7 +428,9 @@ static void conf(struct menu *menu) + + switch (prop->type) { + case P_MENU: +- if (input_mode == ask_silent && rootEntry != menu) { ++ if ((input_mode == ask_silent || ++ input_mode == set_silentdefault) && ++ rootEntry != menu) { + check_conf(menu); + return; + } +@@ -508,6 +514,16 @@ int main(int ac, char **av) + input_mode = ask_silent; + valid_stdin = isatty(0) && isatty(1) && isatty(2); + break; ++ case 'S': ++ input_mode = set_silentdefault; ++ valid_stdin = isatty(0) && isatty(1) && isatty(2); ++ defconfig_file = av[i++]; ++ if (!defconfig_file) { ++ printf("%s: No default config file specified\n", ++ av[0]); ++ exit(1); ++ } ++ break; + case 'd': + input_mode = set_default; + break; +@@ -557,6 +573,14 @@ int main(int ac, char **av) + exit(1); + } + break; ++ case set_silentdefault: ++ if (conf_read(defconfig_file)) { ++ printf("***\n" ++ "*** Can't find default configuration \"%s\"!\n" ++ "***\n", defconfig_file); ++ exit(1); ++ } ++ break; + case ask_silent: + if (stat(".config", &tmpstat)) { + printf(_("***\n" +@@ -597,7 +621,7 @@ int main(int ac, char **av) + break; + } + +- if (input_mode != ask_silent) { ++ if (input_mode != ask_silent && input_mode != set_silentdefault) { + rootEntry = &rootmenu; + conf(&rootmenu); + if (input_mode == ask_all) { +@@ -610,19 +634,21 @@ int main(int ac, char **av) + fprintf(stderr, _("\n*** Kernel configuration requires explicit update.\n\n")); + return 1; + } +- } else ++ } else if (input_mode != set_silentdefault) + goto skip_check; + + do { + conf_cnt = 0; + check_conf(&rootmenu); + } while (conf_cnt); +- if (conf_write(NULL)) { ++ if (conf_write(NULL, input_mode == ask_silent || ++ input_mode == set_silentdefault)) { + fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); + return 1; + } + skip_check: +- if (input_mode == ask_silent && conf_write_autoconf()) { ++ if ((input_mode == ask_silent || input_mode == set_silentdefault) && ++ conf_write_autoconf()) { + fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); + return 1; + } +diff -purN linux_2.6.24_org/scripts/kconfig/confdata.c linux_2.6.24_olpc/scripts/kconfig/confdata.c +--- linux_2.6.24_org/scripts/kconfig/confdata.c 2008-02-15 20:10:15.000000000 +0000 ++++ linux_2.6.24_olpc/scripts/kconfig/confdata.c 2008-02-15 18:57:09.000000000 +0000 +@@ -393,7 +393,7 @@ int conf_read(const char *name) + return 0; + } + +-int conf_write(const char *name) ++int conf_write(const char *name, int quiet) + { + FILE *out; + struct symbol *sym; +@@ -548,9 +548,10 @@ int conf_write(const char *name) + return 1; + } + +- printf(_("#\n" +- "# configuration written to %s\n" +- "#\n"), newname); ++ if (!quiet) ++ printf("#\n" ++ "# configuration written to %s\n" ++ "#\n", newname); + + sym_set_change_count(0); + +diff -purN linux_2.6.24_org/scripts/kconfig/gconf.c linux_2.6.24_olpc/scripts/kconfig/gconf.c +--- linux_2.6.24_org/scripts/kconfig/gconf.c 2008-02-15 20:10:15.000000000 +0000 ++++ linux_2.6.24_olpc/scripts/kconfig/gconf.c 2008-02-15 18:57:09.000000000 +0000 +@@ -621,7 +621,7 @@ void on_load1_activate(GtkMenuItem * men + + void on_save_activate(GtkMenuItem * menuitem, gpointer user_data) + { +- if (conf_write(NULL)) ++ if (conf_write(NULL, 0)) + text_insert_msg(_("Error"), _("Unable to save configuration !")); + } + +@@ -634,7 +634,7 @@ store_filename(GtkFileSelection * file_s + fn = gtk_file_selection_get_filename(GTK_FILE_SELECTION + (user_data)); + +- if (conf_write(fn)) ++ if (conf_write(fn, 0)) + text_insert_msg(_("Error"), _("Unable to save configuration !")); + + gtk_widget_destroy(GTK_WIDGET(user_data)); +diff -purN linux_2.6.24_org/scripts/kconfig/lkc_proto.h linux_2.6.24_olpc/scripts/kconfig/lkc_proto.h +--- linux_2.6.24_org/scripts/kconfig/lkc_proto.h 2008-02-15 20:10:15.000000000 +0000 ++++ linux_2.6.24_olpc/scripts/kconfig/lkc_proto.h 2008-02-15 18:57:09.000000000 +0000 +@@ -3,7 +3,7 @@ + P(conf_parse,void,(const char *name)); + P(conf_read,int,(const char *name)); + P(conf_read_simple,int,(const char *name, int)); +-P(conf_write,int,(const char *name)); ++P(conf_write,int,(const char *name, int)); + P(conf_write_autoconf,int,(void)); + P(conf_get_changed,bool,(void)); + P(conf_set_changed_callback, void,(void (*fn)(void))); +diff -purN linux_2.6.24_org/scripts/kconfig/Makefile linux_2.6.24_olpc/scripts/kconfig/Makefile +--- linux_2.6.24_org/scripts/kconfig/Makefile 2008-02-15 20:10:15.000000000 +0000 ++++ linux_2.6.24_olpc/scripts/kconfig/Makefile 2008-02-15 18:57:09.000000000 +0000 +@@ -69,6 +69,9 @@ endif + %_defconfig: $(obj)/conf + $(Q)$< -D arch/$(SRCARCH)/configs/$@ $(Kconfig) + ++%_silentdefconfig: $(obj)/conf ++ $(Q)$< -S arch/$(ARCH)/configs/$(subst _silentdefconfig,_defconfig,$@) arch/$(ARCH)/Kconfig ++ + # Help text used by make help + help: + @echo ' config - Update current config utilising a line-oriented program' +Binary files linux_2.6.24_org/scripts/kconfig/mconf and linux_2.6.24_olpc/scripts/kconfig/mconf differ +diff -purN linux_2.6.24_org/scripts/kconfig/mconf.c linux_2.6.24_olpc/scripts/kconfig/mconf.c +--- linux_2.6.24_org/scripts/kconfig/mconf.c 2008-02-15 20:10:15.000000000 +0000 ++++ linux_2.6.24_olpc/scripts/kconfig/mconf.c 2008-02-15 18:57:09.000000000 +0000 +@@ -885,7 +885,7 @@ static void conf_save(void) + case 0: + if (!dialog_input_result[0]) + return; +- if (!conf_write(dialog_input_result)) { ++ if (!conf_write(dialog_input_result, 0)) { + set_config_filename(dialog_input_result); + return; + } +@@ -945,7 +945,7 @@ int main(int ac, char **av) + + switch (res) { + case 0: +- if (conf_write(filename)) { ++ if (conf_write(filename, 0)) { + fprintf(stderr, _("\n\n" + "Error during writing of the kernel configuration.\n" + "Your kernel configuration changes were NOT saved." +diff -purN linux_2.6.24_org/scripts/kconfig/qconf.cc linux_2.6.24_olpc/scripts/kconfig/qconf.cc +--- linux_2.6.24_org/scripts/kconfig/qconf.cc 2008-02-15 20:10:15.000000000 +0000 ++++ linux_2.6.24_olpc/scripts/kconfig/qconf.cc 2008-02-15 18:57:09.000000000 +0000 +@@ -1458,7 +1458,7 @@ void ConfigMainWindow::loadConfig(void) + + void ConfigMainWindow::saveConfig(void) + { +- if (conf_write(NULL)) ++ if (conf_write(NULL, 0)) + QMessageBox::information(this, "qconf", "Unable to save configuration!"); + } + +@@ -1467,7 +1467,7 @@ void ConfigMainWindow::saveConfigAs(void + QString s = QFileDialog::getSaveFileName(".config", NULL, this); + if (s.isNull()) + return; +- if (conf_write(QFile::encodeName(s))) ++ if (conf_write(QFile::encodeName(s), 0)) + QMessageBox::information(this, "qconf", "Unable to save configuration!"); + } + +@@ -1619,7 +1619,7 @@ void ConfigMainWindow::closeEvent(QClose + mb.setButtonText(QMessageBox::Cancel, "Cancel Exit"); + switch (mb.exec()) { + case QMessageBox::Yes: +- conf_write(NULL); ++ conf_write(NULL, 0); + case QMessageBox::No: + e->accept(); + break; +diff -purN linux_2.6.24_org/sound/pci/ac97/ac97_patch.c linux_2.6.24_olpc/sound/pci/ac97/ac97_patch.c +--- linux_2.6.24_org/sound/pci/ac97/ac97_patch.c 2008-02-15 20:10:24.000000000 +0000 ++++ linux_2.6.24_olpc/sound/pci/ac97/ac97_patch.c 2008-02-15 18:57:24.000000000 +0000 +@@ -2029,8 +2029,9 @@ static const struct snd_kcontrol_new snd + .get = snd_ac97_ad1888_lohpsel_get, + .put = snd_ac97_ad1888_lohpsel_put + }, +- AC97_SINGLE("V_REFOUT Enable", AC97_AD_MISC, 2, 1, 1), +- AC97_SINGLE("High Pass Filter Enable", AC97_AD_TEST2, 12, 1, 1), ++ AC97_SINGLE("V_REFOUT Enable", AC97_AD_MISC, AC97_AD_VREFD_SHIFT, 1, 1), ++ AC97_SINGLE("High Pass Filter Enable", AC97_AD_TEST2, ++ AC97_AD_HPFD_SHIFT, 1, 1), + AC97_SINGLE("Spread Front to Surround and Center/LFE", AC97_AD_MISC, 7, 1, 0), + { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, +diff -purN linux_2.6.24_org/sound/pci/cs5535audio/cs5535audio.c linux_2.6.24_olpc/sound/pci/cs5535audio/cs5535audio.c +--- linux_2.6.24_org/sound/pci/cs5535audio/cs5535audio.c 2008-02-15 20:10:23.000000000 +0000 ++++ linux_2.6.24_olpc/sound/pci/cs5535audio/cs5535audio.c 2008-02-15 18:57:23.000000000 +0000 +@@ -145,7 +145,7 @@ static unsigned short snd_cs5535audio_ac + return snd_cs5535audio_codec_read(cs5535au, reg); + } + +-static int snd_cs5535audio_mixer(struct cs5535audio *cs5535au) ++static int __devinit snd_cs5535audio_mixer(struct cs5535audio *cs5535au) + { + struct snd_card *card = cs5535au->card; + struct snd_ac97_bus *pbus; +@@ -160,10 +160,14 @@ static int snd_cs5535audio_mixer(struct + return err; + + memset(&ac97, 0, sizeof(ac97)); +- ac97.scaps = AC97_SCAP_AUDIO|AC97_SCAP_SKIP_MODEM; ++ ac97.scaps = AC97_SCAP_AUDIO | AC97_SCAP_SKIP_MODEM ++ | AC97_SCAP_POWER_SAVE; + ac97.private_data = cs5535au; + ac97.pci = cs5535au->pci; + ++ /* olpc_prequirks is dummied out if not olpc */ ++ olpc_prequirks(card, &ac97); ++ + if ((err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97)) < 0) { + snd_printk(KERN_ERR "mixer failed\n"); + return err; +@@ -171,6 +175,12 @@ static int snd_cs5535audio_mixer(struct + + snd_ac97_tune_hardware(cs5535au->ac97, ac97_quirks, ac97_quirk); + ++ /* olpc_quirks is dummied out if not olpc */ ++ if (( err = olpc_quirks(card, cs5535au->ac97)) < 0) { ++ snd_printk(KERN_ERR "olpc quirks failed\n"); ++ return err; ++ } ++ + return 0; + } + +diff -purN linux_2.6.24_org/sound/pci/cs5535audio/cs5535audio.h linux_2.6.24_olpc/sound/pci/cs5535audio/cs5535audio.h +--- linux_2.6.24_org/sound/pci/cs5535audio/cs5535audio.h 2008-02-15 20:10:23.000000000 +0000 ++++ linux_2.6.24_olpc/sound/pci/cs5535audio/cs5535audio.h 2008-02-15 18:57:23.000000000 +0000 +@@ -78,6 +78,7 @@ struct cs5535audio_dma { + unsigned int buf_addr, buf_bytes; + unsigned int period_bytes, periods; + u32 saved_prd; ++ int pcm_open_flag; + }; + + struct cs5535audio { +@@ -93,8 +94,21 @@ struct cs5535audio { + struct cs5535audio_dma dmas[NUM_CS5535AUDIO_DMAS]; + }; + ++#ifdef CONFIG_PM + int snd_cs5535audio_suspend(struct pci_dev *pci, pm_message_t state); + int snd_cs5535audio_resume(struct pci_dev *pci); ++#endif ++ ++#ifdef CONFIG_OLPC ++void olpc_prequirks(struct snd_card *card, struct snd_ac97_template *ac97) __devinit; ++int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97) __devinit; ++int olpc_ai_enable(struct snd_ac97 *ac97, u8 val); ++#else ++#define olpc_prequirks(arg,arg2) do {} while (0) ++#define olpc_quirks(arg,arg2) (0) ++#define olpc_ai_enable(a, v) (0) ++#endif ++ + int __devinit snd_cs5535audio_pcm(struct cs5535audio *cs5535audio); + + #endif /* __SOUND_CS5535AUDIO_H */ +diff -purN linux_2.6.24_org/sound/pci/cs5535audio/cs5535audio_olpc.c linux_2.6.24_olpc/sound/pci/cs5535audio/cs5535audio_olpc.c +--- linux_2.6.24_org/sound/pci/cs5535audio/cs5535audio_olpc.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux_2.6.24_olpc/sound/pci/cs5535audio/cs5535audio_olpc.c 2008-02-15 18:57:23.000000000 +0000 +@@ -0,0 +1,110 @@ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include "cs5535audio.h" ++ ++/* ++ * OLPC has an additional feature on top of the regular AD1888 codec features. ++ * It has an Analog Input mode that is switched into (after disabling the ++ * High Pass Filter) via GPIO. It is only supported on B2 and later models. ++ */ ++ ++int olpc_ai_enable(struct snd_ac97 *ac97, u8 val) ++{ ++ int err; ++ ++ /* ++ * update the High Pass Filter (via AC97_AD_TEST2), and then set ++ * Analog Input mode through a GPIO. ++ */ ++ ++ if (val) { ++ err = snd_ac97_update_bits(ac97, AC97_AD_TEST2, ++ 1<type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; ++ uinfo->count = 1; ++ uinfo->value.integer.min = 0; ++ uinfo->value.integer.max = 1; ++ return 0; ++} ++ ++static int snd_cs5535audio_ai_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ ucontrol->value.integer.value[0] = geode_gpio_isset(OLPC_GPIO_MIC_AC, ++ GPIO_OUTPUT_VAL); ++ return 0; ++} ++ ++static int snd_cs5535audio_ai_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct cs5535audio *cs5535au = snd_kcontrol_chip(kcontrol); ++ struct snd_ac97 *ac97 = cs5535au->ac97; ++ ++ olpc_ai_enable(ac97, ucontrol->value.integer.value[0]); ++ ++ return 1; ++} ++ ++static struct snd_kcontrol_new snd_cs5535audio_controls __devinitdata = ++{ ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, ++ .name = "DC Mode Enable", ++ .info = snd_cs5535audio_ai_info, ++ .get = snd_cs5535audio_ai_get, ++ .put = snd_cs5535audio_ai_put, ++ .private_value = 0 ++}; ++ ++void __devinit olpc_prequirks(struct snd_card *card, ++ struct snd_ac97_template *ac97) ++{ ++ /* Bail if this isn't an OLPC platform */ ++ if (!machine_is_olpc()) ++ return; ++ ++ /* If on an OLPC B3 or higher, invert EAPD. */ ++ if (olpc_board_at_least(olpc_board_pre(0xb3))) ++ ac97->scaps |= AC97_SCAP_INV_EAPD; ++} ++ ++int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97) ++{ ++ struct snd_ctl_elem_id elem; ++ ++ /* Bail if this isn't an OLPC platform */ ++ if (!machine_is_olpc()) ++ return 0; ++ ++ /* drop the original ad1888 HPF control */ ++ memset(&elem, 0, sizeof(elem)); ++ elem.iface = SNDRV_CTL_ELEM_IFACE_MIXER; ++ strcpy(elem.name, "High Pass Filter Enable"); ++ snd_ctl_remove_id(card, &elem); ++ ++ /* add the override for OLPC's HPF */ ++ return snd_ctl_add(card, snd_ctl_new1(&snd_cs5535audio_controls, ++ ac97->private_data)); ++} +diff -purN linux_2.6.24_org/sound/pci/cs5535audio/cs5535audio_pcm.c linux_2.6.24_olpc/sound/pci/cs5535audio/cs5535audio_pcm.c +--- linux_2.6.24_org/sound/pci/cs5535audio/cs5535audio_pcm.c 2008-02-15 20:10:23.000000000 +0000 ++++ linux_2.6.24_olpc/sound/pci/cs5535audio/cs5535audio_pcm.c 2008-02-15 18:57:23.000000000 +0000 +@@ -259,6 +259,9 @@ static int snd_cs5535audio_hw_params(str + err = cs5535audio_build_dma_packets(cs5535au, dma, substream, + params_periods(hw_params), + params_period_bytes(hw_params)); ++ if (!err) ++ dma->pcm_open_flag = 1; ++ + return err; + } + +@@ -267,6 +270,15 @@ static int snd_cs5535audio_hw_free(struc + struct cs5535audio *cs5535au = snd_pcm_substream_chip(substream); + struct cs5535audio_dma *dma = substream->runtime->private_data; + ++ if (dma->pcm_open_flag) { ++ if (substream == cs5535au->playback_substream) ++ snd_ac97_update_power(cs5535au->ac97, ++ AC97_PCM_FRONT_DAC_RATE, 0); ++ else ++ snd_ac97_update_power(cs5535au->ac97, ++ AC97_PCM_LR_ADC_RATE, 0); ++ dma->pcm_open_flag = 0; ++ } + cs5535audio_clear_dma_packets(cs5535au, dma, substream); + return snd_pcm_lib_free_pages(substream); + } +@@ -341,6 +353,7 @@ static int snd_cs5535audio_capture_open( + int err; + struct cs5535audio *cs5535au = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; ++ struct snd_ac97 *ac97 = cs5535au->ac97; + + runtime->hw = snd_cs5535audio_capture; + cs5535au->capture_substream = substream; +@@ -348,11 +361,29 @@ static int snd_cs5535audio_capture_open( + if ((err = snd_pcm_hw_constraint_integer(runtime, + SNDRV_PCM_HW_PARAM_PERIODS)) < 0) + return err; +- return 0; ++ ++#ifdef CONFIG_OLPC ++ /* Disable Analog Input */ ++ olpc_ai_enable(ac97, 0); ++ /* Enable V_ref bias while recording. */ ++ snd_ac97_update_bits(ac97, AC97_AD_MISC, 1<ac97; ++ ++ /* Disable Analog Input */ ++ olpc_ai_enable(ac97, 0); ++ /* Disable V_ref bias. */ ++ snd_ac97_update_bits(ac97, AC97_AD_MISC, 1<