Commit c440c724 authored by Cezary Rojewski's avatar Cezary Rojewski Committed by Mark Brown

ASoC: Intel: catpt: Streamline power routines across LPT and WPT

There is no need for separate power on/off routines for LPT and WPT as
as the protocol is shared for both platforms. Make WPT routines generic
and reuse them in LPT case too.
Signed-off-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20201116133332.8530-5-cezary.rojewski@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 768a3a3b
......@@ -80,6 +80,8 @@ struct catpt_spec {
u32 host_ssp_offset[CATPT_SSP_COUNT];
u32 dram_mask;
u32 iram_mask;
u32 d3srampgd_bit;
u32 d3pgd_bit;
void (*pll_shutdown)(struct catpt_dev *cdev, bool enable);
int (*power_up)(struct catpt_dev *cdev);
int (*power_down)(struct catpt_dev *cdev);
......@@ -128,8 +130,8 @@ void lpt_dsp_pll_shutdown(struct catpt_dev *cdev, bool enable);
void wpt_dsp_pll_shutdown(struct catpt_dev *cdev, bool enable);
int lpt_dsp_power_up(struct catpt_dev *cdev);
int lpt_dsp_power_down(struct catpt_dev *cdev);
int wpt_dsp_power_up(struct catpt_dev *cdev);
int wpt_dsp_power_down(struct catpt_dev *cdev);
int catpt_dsp_power_up(struct catpt_dev *cdev);
int catpt_dsp_power_down(struct catpt_dev *cdev);
int catpt_dsp_stall(struct catpt_dev *cdev, bool stall);
void catpt_dsp_update_srampge(struct catpt_dev *cdev, struct resource *sram,
unsigned long mask);
......
......@@ -69,7 +69,7 @@ static int __maybe_unused catpt_suspend(struct device *dev)
dma_release_channel(chan);
if (ret)
return ret;
return cdev->spec->power_down(cdev);
return catpt_dsp_power_down(cdev);
}
static int __maybe_unused catpt_resume(struct device *dev)
......@@ -77,7 +77,7 @@ static int __maybe_unused catpt_resume(struct device *dev)
struct catpt_dev *cdev = dev_get_drvdata(dev);
int ret, i;
ret = cdev->spec->power_up(cdev);
ret = catpt_dsp_power_up(cdev);
if (ret)
return ret;
......@@ -162,7 +162,7 @@ static int catpt_probe_components(struct catpt_dev *cdev)
{
int ret;
ret = cdev->spec->power_up(cdev);
ret = catpt_dsp_power_up(cdev);
if (ret)
return ret;
......@@ -204,7 +204,7 @@ static int catpt_probe_components(struct catpt_dev *cdev)
err_boot_fw:
catpt_dmac_remove(cdev);
err_dmac_probe:
cdev->spec->power_down(cdev);
catpt_dsp_power_down(cdev);
return ret;
}
......@@ -293,7 +293,7 @@ static int catpt_acpi_remove(struct platform_device *pdev)
snd_soc_unregister_component(cdev->dev);
catpt_dmac_remove(cdev);
cdev->spec->power_down(cdev);
catpt_dsp_power_down(cdev);
catpt_sram_free(&cdev->iram);
catpt_sram_free(&cdev->dram);
......@@ -311,9 +311,9 @@ static struct catpt_spec lpt_desc = {
.host_ssp_offset = { 0x0E8000, 0x0E9000 },
.dram_mask = LPT_VDRTCTL0_DSRAMPGE_MASK,
.iram_mask = LPT_VDRTCTL0_ISRAMPGE_MASK,
.d3srampgd_bit = LPT_VDRTCTL0_D3SRAMPGD,
.d3pgd_bit = LPT_VDRTCTL0_D3PGD,
.pll_shutdown = lpt_dsp_pll_shutdown,
.power_up = lpt_dsp_power_up,
.power_down = lpt_dsp_power_down,
};
static struct catpt_spec wpt_desc = {
......@@ -326,9 +326,9 @@ static struct catpt_spec wpt_desc = {
.host_ssp_offset = { 0x0FC000, 0x0FD000 },
.dram_mask = WPT_VDRTCTL0_DSRAMPGE_MASK,
.iram_mask = WPT_VDRTCTL0_ISRAMPGE_MASK,
.d3srampgd_bit = WPT_VDRTCTL0_D3SRAMPGD,
.d3pgd_bit = WPT_VDRTCTL0_D3PGD,
.pll_shutdown = wpt_dsp_pll_shutdown,
.power_up = wpt_dsp_power_up,
.power_down = wpt_dsp_power_down,
};
static const struct acpi_device_id catpt_ids[] = {
......
......@@ -387,7 +387,7 @@ int lpt_dsp_power_up(struct catpt_dev *cdev)
return 0;
}
int wpt_dsp_power_down(struct catpt_dev *cdev)
int catpt_dsp_power_down(struct catpt_dev *cdev)
{
u32 mask, val;
......@@ -417,8 +417,8 @@ int wpt_dsp_power_down(struct catpt_dev *cdev)
cdev->spec->dram_mask);
catpt_dsp_set_srampge(cdev, &cdev->iram, cdev->spec->iram_mask,
cdev->spec->iram_mask);
mask = WPT_VDRTCTL0_D3SRAMPGD | WPT_VDRTCTL0_D3PGD;
catpt_updatel_pci(cdev, VDRTCTL0, mask, WPT_VDRTCTL0_D3PGD);
mask = cdev->spec->d3srampgd_bit | cdev->spec->d3pgd_bit;
catpt_updatel_pci(cdev, VDRTCTL0, mask, cdev->spec->d3pgd_bit);
catpt_updatel_pci(cdev, PMCS, PCI_PM_CTRL_STATE_MASK, PCI_D3hot);
/* give hw time to drop off */
......@@ -432,7 +432,7 @@ int wpt_dsp_power_down(struct catpt_dev *cdev)
return 0;
}
int wpt_dsp_power_up(struct catpt_dev *cdev)
int catpt_dsp_power_up(struct catpt_dev *cdev)
{
u32 mask, val;
......@@ -447,7 +447,7 @@ int wpt_dsp_power_up(struct catpt_dev *cdev)
catpt_updatel_pci(cdev, PMCS, PCI_PM_CTRL_STATE_MASK, PCI_D0);
/* SRAM power gating none */
mask = WPT_VDRTCTL0_D3SRAMPGD | WPT_VDRTCTL0_D3PGD;
mask = cdev->spec->d3srampgd_bit | cdev->spec->d3pgd_bit;
catpt_updatel_pci(cdev, VDRTCTL0, mask, mask);
catpt_dsp_set_srampge(cdev, &cdev->dram, cdev->spec->dram_mask, 0);
catpt_dsp_set_srampge(cdev, &cdev->iram, cdev->spec->iram_mask, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment