mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-14 00:47:33 +07:00
radeonfb: Whack the PCI PM register until it sticks
This fixes a regression introduced when we switched to using the core pci_set_power_state(). The chip seems to need the state to be written over and over again until it sticks, so we do that. Note that the code is a bit blunt, without timeout, etc... but that's pretty much because I put back in there the code exactly as it used to be before the regression. I still add a call to pci_set_power_state() at the end so that ACPI gets called appropriately on x86. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Tested-by: Raymond Wooninck <tittiatcoke@gmail.com> Acked-by: Rafael J. Wysocki <rjw@sisk.pl> Cc: Jesse Barnes <jbarnes@virtuousgeek.org> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
65c24491b4
commit
18a0d89e54
@ -2507,6 +2507,25 @@ static void radeon_reinitialize_QW(struct radeonfb_info *rinfo)
|
|||||||
|
|
||||||
#endif /* CONFIG_PPC_OF */
|
#endif /* CONFIG_PPC_OF */
|
||||||
|
|
||||||
|
static void radeonfb_whack_power_state(struct radeonfb_info *rinfo, pci_power_t state)
|
||||||
|
{
|
||||||
|
u16 pwr_cmd;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
pci_read_config_word(rinfo->pdev,
|
||||||
|
rinfo->pm_reg+PCI_PM_CTRL,
|
||||||
|
&pwr_cmd);
|
||||||
|
if (pwr_cmd & 2)
|
||||||
|
break;
|
||||||
|
pwr_cmd = (pwr_cmd & ~PCI_PM_CTRL_STATE_MASK) | 2;
|
||||||
|
pci_write_config_word(rinfo->pdev,
|
||||||
|
rinfo->pm_reg+PCI_PM_CTRL,
|
||||||
|
pwr_cmd);
|
||||||
|
msleep(500);
|
||||||
|
}
|
||||||
|
rinfo->pdev->current_state = state;
|
||||||
|
}
|
||||||
|
|
||||||
static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend)
|
static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend)
|
||||||
{
|
{
|
||||||
u32 tmp;
|
u32 tmp;
|
||||||
@ -2558,6 +2577,11 @@ static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend)
|
|||||||
/* Switch PCI power management to D2. */
|
/* Switch PCI power management to D2. */
|
||||||
pci_disable_device(rinfo->pdev);
|
pci_disable_device(rinfo->pdev);
|
||||||
pci_save_state(rinfo->pdev);
|
pci_save_state(rinfo->pdev);
|
||||||
|
/* The chip seems to need us to whack the PM register
|
||||||
|
* repeatedly until it sticks. We do that -prior- to
|
||||||
|
* calling pci_set_power_state()
|
||||||
|
*/
|
||||||
|
radeonfb_whack_power_state(rinfo, PCI_D2);
|
||||||
pci_set_power_state(rinfo->pdev, PCI_D2);
|
pci_set_power_state(rinfo->pdev, PCI_D2);
|
||||||
} else {
|
} else {
|
||||||
printk(KERN_DEBUG "radeonfb (%s): switching to D0 state...\n",
|
printk(KERN_DEBUG "radeonfb (%s): switching to D0 state...\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user