mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-24 21:24:00 +08:00
soundwire: intel/cadence: add flag for interrupt enable
Prepare for future PM support and fix error handling by disabling interrupts as needed. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20191022235448.17586-5-pierre-louis.bossart@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
dfbe642d1e
commit
9e3d47fb2b
@ -815,14 +815,17 @@ EXPORT_SYMBOL(sdw_cdns_exit_reset);
|
||||
* sdw_cdns_enable_interrupt() - Enable SDW interrupts and update config
|
||||
* @cdns: Cadence instance
|
||||
*/
|
||||
int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns)
|
||||
int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns, bool state)
|
||||
{
|
||||
u32 mask;
|
||||
u32 slave_intmask0 = 0;
|
||||
u32 slave_intmask1 = 0;
|
||||
u32 mask = 0;
|
||||
|
||||
cdns_writel(cdns, CDNS_MCP_SLAVE_INTMASK0,
|
||||
CDNS_MCP_SLAVE_INTMASK0_MASK);
|
||||
cdns_writel(cdns, CDNS_MCP_SLAVE_INTMASK1,
|
||||
CDNS_MCP_SLAVE_INTMASK1_MASK);
|
||||
if (!state)
|
||||
goto update_masks;
|
||||
|
||||
slave_intmask0 = CDNS_MCP_SLAVE_INTMASK0_MASK;
|
||||
slave_intmask1 = CDNS_MCP_SLAVE_INTMASK1_MASK;
|
||||
|
||||
/* enable detection of all slave state changes */
|
||||
mask = CDNS_MCP_INT_SLAVE_MASK;
|
||||
@ -845,6 +848,9 @@ int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns)
|
||||
if (interrupt_mask) /* parameter override */
|
||||
mask = interrupt_mask;
|
||||
|
||||
update_masks:
|
||||
cdns_writel(cdns, CDNS_MCP_SLAVE_INTMASK0, slave_intmask0);
|
||||
cdns_writel(cdns, CDNS_MCP_SLAVE_INTMASK1, slave_intmask1);
|
||||
cdns_writel(cdns, CDNS_MCP_INTMASK, mask);
|
||||
|
||||
/* commit changes */
|
||||
|
@ -142,7 +142,7 @@ int sdw_cdns_init(struct sdw_cdns *cdns);
|
||||
int sdw_cdns_pdi_init(struct sdw_cdns *cdns,
|
||||
struct sdw_cdns_stream_config config);
|
||||
int sdw_cdns_exit_reset(struct sdw_cdns *cdns);
|
||||
int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns);
|
||||
int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns, bool state);
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
void sdw_cdns_debugfs_init(struct sdw_cdns *cdns, struct dentry *root);
|
||||
|
@ -939,7 +939,7 @@ static int intel_probe(struct platform_device *pdev)
|
||||
ret = sdw_add_bus_master(&sdw->cdns.bus);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "sdw_add_bus_master fail: %d\n", ret);
|
||||
goto err_master_reg;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (sdw->cdns.bus.prop.hw_disabled) {
|
||||
@ -970,7 +970,7 @@ static int intel_probe(struct platform_device *pdev)
|
||||
goto err_init;
|
||||
}
|
||||
|
||||
ret = sdw_cdns_enable_interrupt(&sdw->cdns);
|
||||
ret = sdw_cdns_enable_interrupt(&sdw->cdns, true);
|
||||
if (ret < 0) {
|
||||
dev_err(sdw->cdns.dev, "cannot enable interrupts\n");
|
||||
goto err_init;
|
||||
@ -979,7 +979,7 @@ static int intel_probe(struct platform_device *pdev)
|
||||
ret = sdw_cdns_exit_reset(&sdw->cdns);
|
||||
if (ret < 0) {
|
||||
dev_err(sdw->cdns.dev, "unable to exit bus reset sequence\n");
|
||||
goto err_init;
|
||||
goto err_interrupt;
|
||||
}
|
||||
|
||||
/* Register DAIs */
|
||||
@ -987,18 +987,18 @@ static int intel_probe(struct platform_device *pdev)
|
||||
if (ret) {
|
||||
dev_err(sdw->cdns.dev, "DAI registration failed: %d\n", ret);
|
||||
snd_soc_unregister_component(sdw->cdns.dev);
|
||||
goto err_dai;
|
||||
goto err_interrupt;
|
||||
}
|
||||
|
||||
intel_debugfs_init(sdw);
|
||||
|
||||
return 0;
|
||||
|
||||
err_dai:
|
||||
err_interrupt:
|
||||
sdw_cdns_enable_interrupt(&sdw->cdns, false);
|
||||
free_irq(sdw->res->irq, sdw);
|
||||
err_init:
|
||||
sdw_delete_bus_master(&sdw->cdns.bus);
|
||||
err_master_reg:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1010,6 +1010,7 @@ static int intel_remove(struct platform_device *pdev)
|
||||
|
||||
if (!sdw->cdns.bus.prop.hw_disabled) {
|
||||
intel_debugfs_exit(sdw);
|
||||
sdw_cdns_enable_interrupt(&sdw->cdns, false);
|
||||
free_irq(sdw->res->irq, sdw);
|
||||
snd_soc_unregister_component(sdw->cdns.dev);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user