From: Bard Liao yung-chuan.liao@linux.intel.com
While we don't have a matching function, setting an device driver is still necessary for ASoC to register DAI components as well as power management.
Signed-off-by: Bard Liao yung-chuan.liao@linux.intel.com Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- drivers/soundwire/intel.c | 6 ++++++ drivers/soundwire/intel_init.c | 10 ++++++++++ drivers/soundwire/master.c | 1 + include/linux/soundwire/sdw.h | 1 + 4 files changed, 18 insertions(+)
diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index ba3bc410d816..adf06833af74 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -17,6 +17,7 @@ #include <linux/soundwire/sdw_registers.h> #include <linux/soundwire/sdw.h> #include <linux/soundwire/sdw_intel.h> +#include <linux/soundwire/sdw_type.h> #include "cadence_master.h" #include "bus.h" #include "intel.h" @@ -1059,6 +1060,11 @@ static int intel_master_remove(struct sdw_master_device *md) }
struct sdw_md_driver intel_sdw_driver = { + .driver = { + .name = "intel-sdw", + .owner = THIS_MODULE, + .bus = &sdw_bus_type, + }, .probe = intel_master_probe, .startup = intel_master_startup, .remove = intel_master_remove, diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c index 42f7ae034bea..a30d95ee71b7 100644 --- a/drivers/soundwire/intel_init.c +++ b/drivers/soundwire/intel_init.c @@ -146,6 +146,7 @@ static struct sdw_intel_ctx struct sdw_master_device *md; u32 link_mask; int count; + int err; int i;
if (!res) @@ -176,6 +177,12 @@ static struct sdw_intel_ctx link = ctx->links; link_mask = ctx->link_mask;
+ err = driver_register(&intel_sdw_driver.driver); + if (err) { + dev_err(&adev->dev, "failed to register sdw master driver\n"); + goto register_err; + } + /* Create SDW Master devices */ for (i = 0; i < count; i++, link++) { if (link_mask && !(link_mask & BIT(i))) @@ -209,6 +216,8 @@ static struct sdw_intel_ctx err: sdw_intel_cleanup(ctx); link_err: + driver_unregister(&intel_sdw_driver.driver); +register_err: kfree(ctx); return NULL; } @@ -350,6 +359,7 @@ EXPORT_SYMBOL(sdw_intel_startup); void sdw_intel_exit(struct sdw_intel_ctx *ctx) { sdw_intel_cleanup(ctx); + driver_unregister(&intel_sdw_driver.driver); kfree(ctx); } EXPORT_SYMBOL(sdw_intel_exit); diff --git a/drivers/soundwire/master.c b/drivers/soundwire/master.c index 6210098c892b..44f70ea67ae3 100644 --- a/drivers/soundwire/master.c +++ b/drivers/soundwire/master.c @@ -46,6 +46,7 @@ struct sdw_master_device *sdw_md_add(struct sdw_md_driver *driver, md->dev.type = &sdw_md_type; md->dev.dma_mask = md->dev.parent->dma_mask; dev_set_name(&md->dev, "sdw-master-%d", md->link_id); + md->dev.driver = &driver->driver;
ret = device_register(&md->dev); if (ret) { diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index af0a72e7afdf..d22950b1a5d9 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -627,6 +627,7 @@ struct sdw_md_driver { */ int (*autonomous_clock_stop_enable)(struct sdw_master_device *md, bool state); + struct device_driver driver; };
#define SDW_SLAVE_ENTRY(_mfg_id, _part_id, _drv_data) \