===== drivers/video/aty/radeon_base.c 1.40 vs edited ===== --- 1.40/drivers/video/aty/radeon_base.c 2005-02-15 21:25:30 -05:00 +++ edited/drivers/video/aty/radeon_base.c 2005-02-17 20:30:48 -05:00 @@ -273,6 +273,9 @@ #ifdef CONFIG_MTRR static int nomtrr = 0; #endif +#if defined(CONFIG_PM) && defined(CONFIG_X86) +int radeon_force_sleep = 0; +#endif /* * prototypes @@ -2535,6 +2538,10 @@ force_measure_pll = 1; } else if (!strncmp(this_opt, "ignore_edid", 11)) { ignore_edid = 1; +#if defined(CONFIG_PM) && defined(CONFIG_X86) + } else if (!strncmp(this_opt, "force_sleep", 11)) { + radeon_force_sleep = 1; +#endif } else mode_option = this_opt; } @@ -2574,3 +2581,5 @@ MODULE_PARM_DESC(panel_yres, "int: set panel yres"); module_param(mode_option, charp, 0); MODULE_PARM_DESC(mode_option, "Specify resolution as \"x[-][@]\" "); +module_param(radeon_force_sleep, int, 0); +MODULE_PARM_DESC(radeon_force_sleep, "bool: force ACPI sleep mode on untested machines"); ===== drivers/video/aty/radeon_pm.c 1.10 vs edited ===== --- 1.10/drivers/video/aty/radeon_pm.c 2005-02-12 23:01:11 -05:00 +++ edited/drivers/video/aty/radeon_pm.c 2005-02-17 20:23:57 -05:00 @@ -25,8 +25,97 @@ #include #endif +/* For detecting supported PC laptops */ +#ifdef CONFIG_X86 +#include +#endif + #include "ati_ids.h" +#ifdef CONFIG_X86 +/* This array holds a list of supported PC laptops. + * Currently only few IBM models are tested. + * If you want to experiment, use dmidecode to find out + * vendor and product codes for Your laptop. + */ +static struct dmi_system_id __devinitdata radeonfb_dmi_table[] = { + { + .ident = "IBM ThinkPad R40 (2722-B3G)", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "IBM"), + DMI_MATCH(DMI_PRODUCT_NAME, "2722B3G"), + }, + }, + { + .ident = "IBM ThinkPad R51 (1829-9MG)", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "IBM"), + DMI_MATCH(DMI_PRODUCT_NAME, "18299MG"), + }, + }, + { + .ident = "IBM ThinkPad T40 (2373-92G)", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "IBM"), + DMI_MATCH(DMI_PRODUCT_NAME, "237392G"), + }, + }, + { + .ident = "IBM ThinkPad T40 (2373-8CG)", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "IBM"), + DMI_MATCH(DMI_PRODUCT_NAME, "23738CG"), + }, + }, + { + .ident = "IBM ThinkPad T40 (2373-94U)", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "IBM"), + DMI_MATCH(DMI_PRODUCT_NAME, "237394U"), + }, + }, + { + .ident = "IBM ThinkPad T40p (2373-G1U)", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "IBM"), + DMI_MATCH(DMI_PRODUCT_NAME, "2373G1U"), + }, + }, + { + .ident = "IBM ThinkPad T41 (2373-2FG)", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "IBM"), + DMI_MATCH(DMI_PRODUCT_NAME, "23732FG"), + }, + }, + { + .ident = "IBM ThinkPad T41 (2378-DEU)", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "IBM"), + DMI_MATCH(DMI_PRODUCT_NAME, "2378DEU"), + }, + }, + { + /* Reported by Volker Braun */ + .ident = "IBM ThinkPad T41 (2379-DJU)", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "IBM"), + DMI_MATCH(DMI_PRODUCT_NAME, "2379DJU"), + }, + }, + { + .ident = "IBM ThinkPad T42 (2373-FWG)", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "IBM"), + DMI_MATCH(DMI_PRODUCT_NAME, "2373FWG"), + }, + }, + { }, +}; + +extern int radeon_force_sleep; +#endif + void radeon_pm_disable_dynamic_mode(struct radeonfb_info *rinfo) { u32 tmp; @@ -853,6 +942,13 @@ tmp = INPLL( pllMCLK_MISC) | MCLK_MISC__EN_MCLK_TRISTATE_IN_SUSPEND; OUTPLL( pllMCLK_MISC, tmp); + /* BUS_CNTL1__MOBILE_PLATORM_SEL setting is northbridge chipset + * and radeon chip dependent. Thus we only enable it on Mac for + * now (until we get more info on how to compute the correct + * value for various X86 bridges). + */ + +#ifdef CONFIG_PPC_PMAC /* AGP PLL control */ if (rinfo->family <= CHIP_FAMILY_RV280) { OUTREG(BUS_CNTL1, INREG(BUS_CNTL1) | BUS_CNTL1__AGPCLK_VALID); @@ -864,6 +960,7 @@ OUTREG(BUS_CNTL1, INREG(BUS_CNTL1)); OUTREG(BUS_CNTL1, (INREG(BUS_CNTL1) & ~0x4000) | 0x8000); } +#endif OUTREG(CRTC_OFFSET_CNTL, (INREG(CRTC_OFFSET_CNTL) & ~CRTC_OFFSET_CNTL__CRTC_STEREO_SYNC_OUT_EN)); @@ -2750,6 +2847,29 @@ #endif } #endif /* defined(CONFIG_PM) && defined(CONFIG_PPC_OF) */ + +/* The PM code also works on some PC laptops. + * Only a few models are actually tested so Your mileage may vary. + * We can do D2 on at least M7 and M9 on some IBM ThinkPad T41 models. + */ +#if defined(CONFIG_PM) && defined(CONFIG_X86) + if (radeon_force_sleep || dmi_check_system(radeonfb_dmi_table)) { + if (radeon_force_sleep) + printk("radeonfb: forcefully enabling sleep mode\n"); + else + printk("radeonfb: enabling sleep mode\n"); + + if (rinfo->is_mobility && rinfo->pm_reg && + rinfo->family <= CHIP_FAMILY_RV250) + rinfo->pm_mode |= radeon_pm_d2; + + /* Power down TV DAC, that saves a significant amount of power, + * we'll have something better once we actually have some TVOut + * support + */ + OUTREG(TV_DAC_CNTL, INREG(TV_DAC_CNTL) | 0x07000000); + } +#endif /* defined(CONFIG_PM) && defined(CONFIG_X86) */ } void radeonfb_pm_exit(struct radeonfb_info *rinfo)