mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-22 18:44:44 +08:00
radeonfb: Use pci_dev pm_cap
Use the already existing pm_cap variable in struct pci_dev for determining the power management offset. This saves the driver from having to keep track of an extra variable. Also, use the pci_power_t value instead of always using the raw value for PCI_D2. Signed-off-by: Jon Mason <jdmason@kudzu.us> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
This commit is contained in:
parent
8d0c03dd2d
commit
65122f7e80
@ -2515,13 +2515,13 @@ static void radeonfb_whack_power_state(struct radeonfb_info *rinfo, pci_power_t
|
||||
|
||||
for (;;) {
|
||||
pci_read_config_word(rinfo->pdev,
|
||||
rinfo->pm_reg+PCI_PM_CTRL,
|
||||
rinfo->pdev->pm_cap + PCI_PM_CTRL,
|
||||
&pwr_cmd);
|
||||
if (pwr_cmd & 2)
|
||||
if (pwr_cmd & state)
|
||||
break;
|
||||
pwr_cmd = (pwr_cmd & ~PCI_PM_CTRL_STATE_MASK) | 2;
|
||||
pwr_cmd = (pwr_cmd & ~PCI_PM_CTRL_STATE_MASK) | state;
|
||||
pci_write_config_word(rinfo->pdev,
|
||||
rinfo->pm_reg+PCI_PM_CTRL,
|
||||
rinfo->pdev->pm_cap + PCI_PM_CTRL,
|
||||
pwr_cmd);
|
||||
msleep(500);
|
||||
}
|
||||
@ -2532,7 +2532,7 @@ static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend)
|
||||
{
|
||||
u32 tmp;
|
||||
|
||||
if (!rinfo->pm_reg)
|
||||
if (!rinfo->pdev->pm_cap)
|
||||
return;
|
||||
|
||||
/* Set the chip into appropriate suspend mode (we use D2,
|
||||
@ -2804,9 +2804,6 @@ static void radeonfb_early_resume(void *data)
|
||||
|
||||
void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk, int ignore_devlist, int force_sleep)
|
||||
{
|
||||
/* Find PM registers in config space if any*/
|
||||
rinfo->pm_reg = rinfo->pdev->pm_cap;
|
||||
|
||||
/* Enable/Disable dynamic clocks: TODO add sysfs access */
|
||||
if (rinfo->family == CHIP_FAMILY_RS480)
|
||||
rinfo->dynclk = -1;
|
||||
@ -2830,7 +2827,7 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk, int ignore_devlis
|
||||
* reason. --BenH
|
||||
*/
|
||||
if (machine_is(powermac) && rinfo->of_node) {
|
||||
if (rinfo->is_mobility && rinfo->pm_reg &&
|
||||
if (rinfo->is_mobility && rinfo->pdev->pm_cap &&
|
||||
rinfo->family <= CHIP_FAMILY_RV250)
|
||||
rinfo->pm_mode |= radeon_pm_d2;
|
||||
|
||||
|
@ -342,7 +342,6 @@ struct radeonfb_info {
|
||||
|
||||
int mtrr_hdl;
|
||||
|
||||
int pm_reg;
|
||||
u32 save_regs[100];
|
||||
int asleep;
|
||||
int lock_blank;
|
||||
|
Loading…
Reference in New Issue
Block a user