summaryrefslogtreecommitdiff
path: root/drivers/soundwire/intel.c
diff options
context:
space:
mode:
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>2020-06-01 02:21:02 +0800
committerVinod Koul <vkoul@kernel.org>2020-06-22 17:21:36 +0530
commit6d2c66695bf30355bacceb2b0635d3ddaf26cce4 (patch)
treec13397afaeccc3a2c7cba12fa9abc455066684b7 /drivers/soundwire/intel.c
parent4ab34412fc62fba29ba00d76cf2c46585b3e5ba3 (diff)
soundwire: intel: transition to 3 steps initialization
Rather than a plain-vanilla init/exit, this patch provides 3 steps in the initialization needed for driver selection, machine driver selection and deal with power rail dependencies. - ACPI scan: this step is done at a very early stage to detect the presence of a SoundWire Controller and enabled links at the BIOS level. This step may be called from the legacy HDaudio driver, which will abort its probe to let the Sound Open Firmware (SOF) handle the hardware. - probe: this step allocates all the required memory and will add a sdw_bus, which in turn will result in identifying all possible Slaves listed below the Controller ACPI companion device. All the information is reported to the parent PCI driver which will select the relevant machine driver. - startup: this last step starts the bus reset, which results in Slave devices reporting as ATTACHED and being enumerated. This step is only done during the card creation stage, after the DSP is powered to account for internal power rail dependencies. These 3 steps are already supported in the Sound Open firmware drivers and upstream. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20200531182102.27840-7-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/soundwire/intel.c')
-rw-r--r--drivers/soundwire/intel.c50
1 files changed, 34 insertions, 16 deletions
diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
index 5053e176a6f3..950e4cf09f2a 100644
--- a/drivers/soundwire/intel.c
+++ b/drivers/soundwire/intel.c
@@ -1074,7 +1074,6 @@ static int intel_init(struct sdw_intel *sdw)
*/
static int intel_master_probe(struct platform_device *pdev)
{
- struct sdw_cdns_stream_config config;
struct device *dev = &pdev->dev;
struct sdw_intel *sdw;
struct sdw_cdns *cdns;
@@ -1112,10 +1111,41 @@ static int intel_master_probe(struct platform_device *pdev)
return ret;
}
- if (bus->prop.hw_disabled) {
+ if (bus->prop.hw_disabled)
dev_info(dev,
"SoundWire master %d is disabled, will be ignored\n",
bus->link_id);
+
+ /* Acquire IRQ */
+ ret = request_threaded_irq(sdw->link_res->irq,
+ sdw_cdns_irq, sdw_cdns_thread,
+ IRQF_SHARED, KBUILD_MODNAME, cdns);
+ if (ret < 0) {
+ dev_err(dev, "unable to grab IRQ %d, disabling device\n",
+ sdw->link_res->irq);
+ goto err_init;
+ }
+
+ return 0;
+
+err_init:
+ sdw_bus_master_delete(bus);
+ return ret;
+}
+
+int intel_master_startup(struct platform_device *pdev)
+{
+ struct sdw_cdns_stream_config config;
+ struct device *dev = &pdev->dev;
+ struct sdw_cdns *cdns = dev_get_drvdata(dev);
+ struct sdw_intel *sdw = cdns_to_intel(cdns);
+ struct sdw_bus *bus = &cdns->bus;
+ int ret;
+
+ if (bus->prop.hw_disabled) {
+ dev_info(dev,
+ "SoundWire master %d is disabled, ignoring\n",
+ sdw->instance);
return 0;
}
@@ -1132,16 +1162,6 @@ static int intel_master_probe(struct platform_device *pdev)
intel_pdi_ch_update(sdw);
- /* Acquire IRQ */
- ret = request_threaded_irq(sdw->link_res->irq,
- sdw_cdns_irq, sdw_cdns_thread,
- IRQF_SHARED, KBUILD_MODNAME, cdns);
- if (ret < 0) {
- dev_err(dev, "unable to grab IRQ %d, disabling device\n",
- sdw->link_res->irq);
- goto err_init;
- }
-
ret = sdw_cdns_enable_interrupt(cdns, true);
if (ret < 0) {
dev_err(dev, "cannot enable interrupts\n");
@@ -1168,9 +1188,7 @@ static int intel_master_probe(struct platform_device *pdev)
err_interrupt:
sdw_cdns_enable_interrupt(cdns, false);
- free_irq(sdw->link_res->irq, sdw);
err_init:
- sdw_bus_master_delete(bus);
return ret;
}
@@ -1196,12 +1214,12 @@ static struct platform_driver sdw_intel_drv = {
.probe = intel_master_probe,
.remove = intel_master_remove,
.driver = {
- .name = "int-sdw",
+ .name = "intel-sdw",
},
};
module_platform_driver(sdw_intel_drv);
MODULE_LICENSE("Dual BSD/GPL");
-MODULE_ALIAS("platform:int-sdw");
+MODULE_ALIAS("platform:intel-sdw");
MODULE_DESCRIPTION("Intel Soundwire Master Driver");