mirror of
https://github.com/gnif/vendor-reset.git
synced 2025-12-29 15:09:28 +01:00
[amd] audio: Preserve PCI config space for audio device
This commit is contained in:
parent
eadbb20b38
commit
623fa20705
@ -84,6 +84,15 @@ int amd_common_pre_reset(struct vendor_reset_dev *dev)
|
|||||||
pci_read_config_word(pdev, PCI_COMMAND, &priv->cfg);
|
pci_read_config_word(pdev, PCI_COMMAND, &priv->cfg);
|
||||||
pci_write_config_word(pdev, PCI_COMMAND, priv->cfg | PCI_COMMAND_MEMORY | PCI_COMMAND_INTX_DISABLE);
|
pci_write_config_word(pdev, PCI_COMMAND, priv->cfg | PCI_COMMAND_MEMORY | PCI_COMMAND_INTX_DISABLE);
|
||||||
|
|
||||||
|
priv->audio_pdev = pci_get_domain_bus_and_slot(pci_domain_nr(pdev->bus),
|
||||||
|
pdev->bus->number, 1);
|
||||||
|
if (priv->audio_pdev)
|
||||||
|
{
|
||||||
|
pci_set_power_state(priv->audio_pdev, PCI_D0);
|
||||||
|
pci_clear_master(priv->audio_pdev);
|
||||||
|
pci_save_state(priv->audio_pdev);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_free:
|
err_free:
|
||||||
@ -96,7 +105,8 @@ int amd_common_post_reset(struct vendor_reset_dev *dev)
|
|||||||
struct amd_vendor_private *priv = amd_private(dev);
|
struct amd_vendor_private *priv = amd_private(dev);
|
||||||
struct pci_dev *pdev = dev->pdev;
|
struct pci_dev *pdev = dev->pdev;
|
||||||
|
|
||||||
if (priv->mmio) {
|
if (priv->mmio)
|
||||||
|
{
|
||||||
iounmap(priv->mmio);
|
iounmap(priv->mmio);
|
||||||
priv->mmio = NULL;
|
priv->mmio = NULL;
|
||||||
}
|
}
|
||||||
@ -114,6 +124,14 @@ int amd_common_post_reset(struct vendor_reset_dev *dev)
|
|||||||
}
|
}
|
||||||
pci_write_config_word(pdev, PCI_COMMAND, priv->cfg);
|
pci_write_config_word(pdev, PCI_COMMAND, priv->cfg);
|
||||||
|
|
||||||
|
if (priv->audio_pdev)
|
||||||
|
{
|
||||||
|
pci_restore_state(priv->audio_pdev);
|
||||||
|
pci_set_power_state(priv->audio_pdev, PCI_D3hot);
|
||||||
|
pci_dev_put(priv->audio_pdev);
|
||||||
|
priv->audio_pdev = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* don't try to go to low power if reset failed */
|
/* don't try to go to low power if reset failed */
|
||||||
if (!dev->reset_ret)
|
if (!dev->reset_ret)
|
||||||
pci_set_power_state(pdev, PCI_D3hot);
|
pci_set_power_state(pdev, PCI_D3hot);
|
||||||
|
|||||||
@ -117,6 +117,8 @@ struct amd_vendor_private
|
|||||||
{
|
{
|
||||||
u16 cfg;
|
u16 cfg;
|
||||||
|
|
||||||
|
struct pci_dev *audio_pdev;
|
||||||
|
|
||||||
struct vendor_reset_dev *vdev;
|
struct vendor_reset_dev *vdev;
|
||||||
struct pci_saved_state *saved_state;
|
struct pci_saved_state *saved_state;
|
||||||
struct amd_fake_dev adev;
|
struct amd_fake_dev adev;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user