soundwire: intel: implement new ASoC interfaces
Subsystems (3)
cover soundwire: intel: implement new ASoC interfaces
this patchset applies on top of the series "[PATCH 0/4] soundwire:
update ASoC interfaces" and previously submitted cleanups "[PATCH v3 0/5] soundwire: intel/cadence: better initialization"
The changes are essentially a removal of the platform devices and the implementation of the new interfaces required to scan the ACPI tables, probe the links and start them.
The missing prepare, trigger and setup ASoC callbacks are also implemented. The hw_params and free callbacks use the new interfaces as well.
While there are quite a few lines of code changed, this is mostly about interface changes. The next series will contain more functional changes and deal with race conditions on probe, enumeration and suspend/resume issues.
Bard Liao (1):
soundwire: add device driver to sdw_md_driver
Pierre-Louis Bossart (10):
soundwire: renames to prepare support for master drivers/devices
soundwire: rename dev_to_sdw_dev macro
soundwire: rename drv_to_sdw_slave_driver macro
soundwire: bus_type: rename sdw_drv_ to sdw_slave_drv
soundwire: intel: rename res field as link_res
soundwire: add support for sdw_slave_type
soundwire: add initial definitions for sdw_master_device
soundwire: intel: remove platform devices and provide new interface
soundwire: intel: free all resources on hw_free()
soundwire: intel_init: add implementation of sdw_intel_enable_irq()
Rander Wang (3):
soundwire: intel: add prepare support in sdw dai driver
soundwire: intel: add trigger support in sdw dai driver
soundwire: intel: add sdw_stream_setup helper for .startup callback
drivers/base/regmap/regmap-sdw.c | 4 +- drivers/soundwire/Makefile | 2 +- drivers/soundwire/bus.c | 2 +- drivers/soundwire/bus_type.c | 60 +++--- drivers/soundwire/intel.c | 280 ++++++++++++++++++++++----- drivers/soundwire/intel.h | 8 +- drivers/soundwire/intel_init.c | 300 ++++++++++++++++++++++------- drivers/soundwire/master.c | 64 ++++++ drivers/soundwire/slave.c | 9 +- include/linux/soundwire/sdw.h | 39 +++- include/linux/soundwire/sdw_type.h | 34 +++- 11 files changed, 642 insertions(+), 160 deletions(-) create mode 100644 drivers/soundwire/master.c
Signature · 1 line
2.20.1
PATCH 1/14 soundwire: renames to prepare support for master drivers/devices
Add clearer references to sdw_slave_driver for internal macros
No change for sdw_driver and module_sdw_driver to avoid compatibility issues with existing codec devices
No functionality change.
--- drivers/soundwire/bus_type.c | 21 +++++++++++---------- include/linux/soundwire/sdw_type.h | 18 ++++++++++-------- 2 files changed, 21 insertions(+), 18 deletions(-)
drivers/soundwire/bus_type.c +11 -10
@@ -34,7 +34,7 @@ sdw_get_device_id(struct sdw_slave *slave, struct sdw_driver *drv)static int sdw_bus_match (struct device *dev,struct device_driver *ddrv) {struct sdw_slave *slave =dev_to_sdw_dev (dev); -struct sdw_driver *drv =drv_to_sdw_driver (ddrv); +struct sdw_driver *drv =drv_to_sdw_slave_driver (ddrv);return !!sdw_get_device_id (slave, drv); }
@@ -70,7 +70,7 @@ EXPORT_SYMBOL_GPL(sdw_bus_type);static int sdw_drv_probe (struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev); -struct sdw_driver *drv =drv_to_sdw_driver (dev->driver); +struct sdw_driver *drv =drv_to_sdw_slave_driver (dev->driver);const struct sdw_device_id *id;int ret;
@@ -116,7 +116,7 @@ static int sdw_drv_probe(struct device *dev)static int sdw_drv_remove (struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev); -struct sdw_driver *drv =drv_to_sdw_driver (dev->driver); +struct sdw_driver *drv =drv_to_sdw_slave_driver (dev->driver);int ret =0 ;if (drv->remove)
@@ -130,20 +130,21 @@ static int sdw_drv_remove(struct device *dev)static void sdw_drv_shutdown (struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev); -struct sdw_driver *drv =drv_to_sdw_driver (dev->driver); +struct sdw_driver *drv =drv_to_sdw_slave_driver (dev->driver);if (drv->shutdown) drv->shutdown (slave); }/** -* __sdw_register_driver() - register a SoundWire Slave driver +* __sdw_register_slave_driver() - register a SoundWire Slave driver * @drv: driver to register * @owner: owning module/driver * * Return: zero on success, else a negative error code. */ -int __sdw_register_driver (struct sdw_driver *drv,struct module *owner) +int __sdw_register_slave_driver (struct sdw_driver *drv, +struct module *owner) { drv->driver.bus = &sdw_bus_type;
@@ -164,17 +165,17 @@ int __sdw_register_driver(struct sdw_driver *drv, struct module *owner)return driver_register (&drv->driver); } -EXPORT_SYMBOL_GPL (__sdw_register_driver); +EXPORT_SYMBOL_GPL (__sdw_register_slave_driver);/** -* sdw_unregister_driver() - unregisters the SoundWire Slave driver +* sdw_unregister_slave_driver() - unregisters the SoundWire Slave driver * @drv: driver to unregister */ -void sdw_unregister_driver (struct sdw_driver *drv) +void sdw_unregister_slave_driver (struct sdw_driver *drv) {driver_unregister (&drv->driver); } -EXPORT_SYMBOL_GPL (sdw_unregister_driver); +EXPORT_SYMBOL_GPL (sdw_unregister_slave_driver);static int __init sdw_bus_init (void ) {
include/linux/soundwire/sdw_type.h +10 -8
@@ -6,13 +6,15 @@extern struct bus_type sdw_bus_type; -#define drv_to_sdw_driver (_drv) container_of(_drv, struct sdw_driver, driver) +#define drv_to_sdw_slave_driver (_drv) \ + container_of(_drv, struct sdw_driver, driver) -#define sdw_register_driver (drv) \ - __sdw_register_driver(drv, THIS_MODULE) +#define sdw_register_slave_driver (drv) \ + __sdw_register_slave_driver(drv, THIS_MODULE) -int __sdw_register_driver (struct sdw_driver *drv,struct module *owner); -void sdw_unregister_driver (struct sdw_driver *drv); +int __sdw_register_slave_driver (struct sdw_driver *drv, +struct module *owner); +void sdw_unregister_slave_driver (struct sdw_driver *drv);int sdw_slave_modalias (const struct sdw_slave *slave,char *buf,size_t size);
@@ -24,7 +26,7 @@ int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size);* module init/exit. This eliminates a lot of boilerplate. Each module may only * use this macro once, and calling it replaces module_init() and module_exit() */ -#define module_sdw_driver (__sdw_driver) \ - module_driver(__sdw_driver, sdw_register_driver, \ - sdw_unregister_driver) +#define module_sdw_driver (__sdw_slave_driver) \ + module_driver(__sdw_slave_driver, sdw_register_slave_driver, \ + sdw_unregister_slave_driver)#endif /* __SOUNDWIRE_TYPES_H */
Signature · 1 line
2.20.1
PATCH 2/14 soundwire: rename dev_to_sdw_dev macro
In reply to Pierre-Louis BossartSince we want to introduce master devices, rename macro so that we have consistency between slave and master device access, following the Grey Bus example.
--- drivers/base/regmap/regmap-sdw.c | 4 ++-- drivers/soundwire/bus.c | 2 +- drivers/soundwire/bus_type.c | 11 ++++++----- drivers/soundwire/slave.c | 2 +- include/linux/soundwire/sdw.h | 3 ++- 5 files changed, 12 insertions(+), 10 deletions(-)
drivers/base/regmap/regmap-sdw.c +2 -2
@@ -10,7 +10,7 @@static int regmap_sdw_write (void *context,unsigned int reg,unsigned int val) {struct device *dev = context; -struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct sdw_slave *slave =to_sdw_slave_device (dev);return sdw_write (slave, reg, val); }
@@ -18,7 +18,7 @@ static int regmap_sdw_write(void *context, unsigned int reg, unsigned int val)static int regmap_sdw_read (void *context,unsigned int reg,unsigned int *val) {struct device *dev = context; -struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct sdw_slave *slave =to_sdw_slave_device (dev);int read; read =sdw_read (slave, reg);
drivers/soundwire/bus.c +1 -1
@@ -110,7 +110,7 @@ EXPORT_SYMBOL(sdw_add_bus_master);static int sdw_delete_slave (struct device *dev,void *data) { -struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_bus *bus = slave->bus;sdw_slave_debugfs_exit (slave);
drivers/soundwire/bus_type.c +6 -5
@@ -33,7 +33,7 @@ sdw_get_device_id(struct sdw_slave *slave, struct sdw_driver *drv)static int sdw_bus_match (struct device *dev,struct device_driver *ddrv) { -struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_driver *drv =drv_to_sdw_slave_driver (ddrv);return !!sdw_get_device_id (slave, drv);
@@ -49,7 +49,7 @@ int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size)static int sdw_uevent (struct device *dev,struct kobj_uevent_env *env) { -struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct sdw_slave *slave =to_sdw_slave_device (dev);char modalias[32 ];sdw_slave_modalias (slave, modalias,sizeof (modalias));
@@ -69,7 +69,7 @@ EXPORT_SYMBOL_GPL(sdw_bus_type);static int sdw_drv_probe (struct device *dev) { -struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_driver *drv =drv_to_sdw_slave_driver (dev->driver);const struct sdw_device_id *id;int ret;
@@ -115,8 +115,9 @@ static int sdw_drv_probe(struct device *dev)static int sdw_drv_remove (struct device *dev) { -struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_driver *drv =drv_to_sdw_slave_driver (dev->driver); +int ret =0 ;if (drv->remove)
@@ -129,7 +130,7 @@ static int sdw_drv_remove(struct device *dev)static void sdw_drv_shutdown (struct device *dev) { -struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_driver *drv =drv_to_sdw_slave_driver (dev->driver);if (drv->shutdown)
drivers/soundwire/slave.c +1 -1
@@ -9,7 +9,7 @@static void sdw_slave_release (struct device *dev) { -struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct sdw_slave *slave =to_sdw_slave_device (dev);kfree (slave); }
include/linux/soundwire/sdw.h +2 -1
@@ -570,7 +570,8 @@ struct sdw_slave {struct completion enumeration_complete; }; -#define dev_to_sdw_dev (_dev) container_of(_dev, struct sdw_slave, dev) +#define to_sdw_slave_device (d) \ + container_of(d, struct sdw_slave, dev)struct sdw_driver {const char *name;
Signature · 1 line
2.20.1
Vinod Koul
maintainerRe: [PATCH 02/14] soundwire: rename dev_to_sdw_dev macro
Quoted 7 lines · Pierre-Louis Bossart
Since we want to introduce master devices, rename macro so that we have consistency between slave and master device access, following the Grey Bus example.
Signed-off-by Pierre-Louis Bossart <[email protected]>--- drivers/base/regmap/regmap-sdw.c | 4 ++--
This needs Mark's ACK
Quoted 121 lines
drivers/soundwire/bus.c | 2 +- drivers/soundwire/bus_type.c | 11 ++++++----- drivers/soundwire/slave.c | 2 +- include/linux/soundwire/sdw.h | 3 ++- 5 files changed, 12 insertions(+), 10 deletions(-)drivers/base/regmap/regmap-sdw.c +2
-2@@ -10,7 +10,7 @@static int regmap_sdw_write (void *context,unsigned int reg,unsigned int val) {struct device *dev = context; -struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct sdw_slave *slave =to_sdw_slave_device (dev);return sdw_write (slave, reg, val); }@@ -18,7 +18,7 @@ static int regmap_sdw_write(void *context, unsigned int reg, unsigned int val)static int regmap_sdw_read (void *context,unsigned int reg,unsigned int *val) {struct device *dev = context; -struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct sdw_slave *slave =to_sdw_slave_device (dev);int read; read =sdw_read (slave, reg);drivers/soundwire/bus.c +1
-1@@ -110,7 +110,7 @@ EXPORT_SYMBOL(sdw_add_bus_master);static int sdw_delete_slave (struct device *dev,void *data) { -struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_bus *bus = slave->bus;sdw_slave_debugfs_exit (slave);drivers/soundwire/bus_type.c +6
-5@@ -33,7 +33,7 @@ sdw_get_device_id(struct sdw_slave *slave, struct sdw_driver *drv)static int sdw_bus_match (struct device *dev,struct device_driver *ddrv) { -struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_driver *drv =drv_to_sdw_slave_driver (ddrv);return !!sdw_get_device_id (slave, drv);@@ -49,7 +49,7 @@ int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size)static int sdw_uevent (struct device *dev,struct kobj_uevent_env *env) { -struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct sdw_slave *slave =to_sdw_slave_device (dev);char modalias[32 ];sdw_slave_modalias (slave, modalias,sizeof (modalias));@@ -69,7 +69,7 @@ EXPORT_SYMBOL_GPL(sdw_bus_type);static int sdw_drv_probe (struct device *dev) { -struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_driver *drv =drv_to_sdw_slave_driver (dev->driver);const struct sdw_device_id *id;int ret;@@ -115,8 +115,9 @@ static int sdw_drv_probe(struct device *dev)static int sdw_drv_remove (struct device *dev) { -struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_driver *drv =drv_to_sdw_slave_driver (dev->driver); +int ret =0 ;if (drv->remove)@@ -129,7 +130,7 @@ static int sdw_drv_remove(struct device *dev)static void sdw_drv_shutdown (struct device *dev) { -struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_driver *drv =drv_to_sdw_slave_driver (dev->driver);if (drv->shutdown)drivers/soundwire/slave.c +1
-1@@ -9,7 +9,7 @@static void sdw_slave_release (struct device *dev) { -struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct sdw_slave *slave =to_sdw_slave_device (dev);kfree (slave); }include/linux/soundwire/sdw.h +2
-1@@ -570,7 +570,8 @@ struct sdw_slave {struct completion enumeration_complete; }; -#define dev_to_sdw_dev (_dev) container_of(_dev, struct sdw_slave, dev) +#define to_sdw_slave_device (d) \ + container_of(d, struct sdw_slave, dev)struct sdw_driver {const char *name;Signature · 1 line
2.20.1
Signature · 1 line
~Vinod
PATCH 3/14 soundwire: rename drv_to_sdw_slave_driver macro
In reply to Pierre-Louis BossartAlign with previous renames and shorten macro
No functionality change
--- drivers/soundwire/bus_type.c | 9 ++++----- include/linux/soundwire/sdw_type.h | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/soundwire/bus_type.c +4 -5
@@ -34,7 +34,7 @@ sdw_get_device_id(struct sdw_slave *slave, struct sdw_driver *drv)static int sdw_bus_match (struct device *dev,struct device_driver *ddrv) {struct sdw_slave *slave =to_sdw_slave_device (dev); -struct sdw_driver *drv =drv_to_sdw_slave_driver (ddrv); +struct sdw_driver *drv =to_sdw_slave_driver (ddrv);return !!sdw_get_device_id (slave, drv); }
@@ -70,7 +70,7 @@ EXPORT_SYMBOL_GPL(sdw_bus_type);static int sdw_drv_probe (struct device *dev) {struct sdw_slave *slave =to_sdw_slave_device (dev); -struct sdw_driver *drv =drv_to_sdw_slave_driver (dev->driver); +struct sdw_driver *drv =to_sdw_slave_driver (dev->driver);const struct sdw_device_id *id;int ret;
@@ -116,8 +116,7 @@ static int sdw_drv_probe(struct device *dev)static int sdw_drv_remove (struct device *dev) {struct sdw_slave *slave =to_sdw_slave_device (dev); -struct sdw_driver *drv =drv_to_sdw_slave_driver (dev->driver); - +struct sdw_driver *drv =to_sdw_slave_driver (dev->driver);int ret =0 ;if (drv->remove)
@@ -131,7 +130,7 @@ static int sdw_drv_remove(struct device *dev)static void sdw_drv_shutdown (struct device *dev) {struct sdw_slave *slave =to_sdw_slave_device (dev); -struct sdw_driver *drv =drv_to_sdw_slave_driver (dev->driver); +struct sdw_driver *drv =to_sdw_slave_driver (dev->driver);if (drv->shutdown) drv->shutdown (slave);
include/linux/soundwire/sdw_type.h +2 -1
@@ -6,7 +6,7 @@extern struct bus_type sdw_bus_type; -#define drv_to_sdw_slave_driver (_drv) \ +#define to_sdw_slave_driver (_drv) \ container_of(_drv, struct sdw_driver, driver)#define sdw_register_slave_driver (drv) \
@@ -29,4 +29,5 @@ int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size);#define module_sdw_driver (__sdw_slave_driver) \ module_driver(__sdw_slave_driver, sdw_register_slave_driver, \ sdw_unregister_slave_driver) +#endif /* __SOUNDWIRE_TYPES_H */
Signature · 1 line
2.20.1
PATCH 4/14 soundwire: bus_type: rename sdw_drv_ to sdw_slave_drv
In reply to Pierre-Louis BossartBefore we add master driver support, make sure there is no ambiguity and no occirrences of sdw_drv_ functions.
No functionality change.
--- drivers/soundwire/bus_type.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/soundwire/bus_type.c +6 -6
@@ -67,7 +67,7 @@ struct bus_type sdw_bus_type = { };EXPORT_SYMBOL_GPL (sdw_bus_type); -static int sdw_drv_probe (struct device *dev) +static int sdw_slave_drv_probe (struct device *dev) {struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_driver *drv =to_sdw_slave_driver (dev->driver);
@@ -113,7 +113,7 @@ static int sdw_drv_probe(struct device *dev)return 0 ; } -static int sdw_drv_remove (struct device *dev) +static int sdw_slave_drv_remove (struct device *dev) {struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_driver *drv =to_sdw_slave_driver (dev->driver);
@@ -127,7 +127,7 @@ static int sdw_drv_remove(struct device *dev)return ret; } -static void sdw_drv_shutdown (struct device *dev) +static void sdw_slave_drv_shutdown (struct device *dev) {struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_driver *drv =to_sdw_slave_driver (dev->driver);
@@ -155,13 +155,13 @@ int __sdw_register_slave_driver(struct sdw_driver *drv, } drv->driver.owner = owner; - drv->driver.probe = sdw_drv_probe; + drv->driver.probe = sdw_slave_drv_probe;if (drv->remove) - drv->driver.remove = sdw_drv_remove; + drv->driver.remove = sdw_slave_drv_remove;if (drv->shutdown) - drv->driver.shutdown = sdw_drv_shutdown; + drv->driver.shutdown = sdw_slave_drv_shutdown;return driver_register (&drv->driver); }
Signature · 1 line
2.20.1
Vinod Koul
maintainerRe: [PATCH 04/14] soundwire: bus_type: rename sdw_drv_ to sdw_slave_drv
Quoted 2 lines · Pierre-Louis Bossart
Before we add master driver support, make sure there is no ambiguity and no occirrences of
sdw_drv_functions.
^^^^^^^^^^^
typo
Quoted 58 lines
No functionality change.
Signed-off-by Pierre-Louis Bossart <[email protected]>--- drivers/soundwire/bus_type.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/soundwire/bus_type.c +6
-6@@ -67,7 +67,7 @@ struct bus_type sdw_bus_type = { };EXPORT_SYMBOL_GPL (sdw_bus_type); -static int sdw_drv_probe (struct device *dev) +static int sdw_slave_drv_probe (struct device *dev) {struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_driver *drv =to_sdw_slave_driver (dev->driver);@@ -113,7 +113,7 @@ static int sdw_drv_probe(struct device *dev)return 0 ; } -static int sdw_drv_remove (struct device *dev) +static int sdw_slave_drv_remove (struct device *dev) {struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_driver *drv =to_sdw_slave_driver (dev->driver);@@ -127,7 +127,7 @@ static int sdw_drv_remove(struct device *dev)return ret; } -static void sdw_drv_shutdown (struct device *dev) +static void sdw_slave_drv_shutdown (struct device *dev) {struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_driver *drv =to_sdw_slave_driver (dev->driver);@@ -155,13 +155,13 @@ int __sdw_register_slave_driver(struct sdw_driver *drv, } drv->driver.owner = owner; - drv->driver.probe = sdw_drv_probe; + drv->driver.probe = sdw_slave_drv_probe;if (drv->remove) - drv->driver.remove = sdw_drv_remove; + drv->driver.remove = sdw_slave_drv_remove;if (drv->shutdown) - drv->driver.shutdown = sdw_drv_shutdown; + drv->driver.shutdown = sdw_slave_drv_shutdown;return driver_register (&drv->driver); }Signature · 1 line
2.20.1
Signature · 1 line
~Vinod
Re: [alsa-devel] [PATCH 04/14] soundwire: bus_type: rename sdw_drv_ to sdw_slave_drv
Quoted 5 lines · Vinod Koul
Quoted 2 lines · Pierre-Louis Bossart
Before we add master driver support, make sure there is no ambiguity and no occirrences of
sdw_drv_functions.^^^^^^^^^^^typo
Ack, will fix.
Quoted 60 lines
Quoted 59 lines
No functionality change.
Signed-off-by Pierre-Louis Bossart <[email protected]>--- drivers/soundwire/bus_type.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/soundwire/bus_type.c +6
-6@@ -67,7 +67,7 @@ struct bus_type sdw_bus_type = { };EXPORT_SYMBOL_GPL (sdw_bus_type); -static int sdw_drv_probe (struct device *dev) +static int sdw_slave_drv_probe (struct device *dev) {struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_driver *drv =to_sdw_slave_driver (dev->driver);@@ -113,7 +113,7 @@ static int sdw_drv_probe(struct device *dev)return 0 ; } -static int sdw_drv_remove (struct device *dev) +static int sdw_slave_drv_remove (struct device *dev) {struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_driver *drv =to_sdw_slave_driver (dev->driver);@@ -127,7 +127,7 @@ static int sdw_drv_remove(struct device *dev)return ret; } -static void sdw_drv_shutdown (struct device *dev) +static void sdw_slave_drv_shutdown (struct device *dev) {struct sdw_slave *slave =to_sdw_slave_device (dev);struct sdw_driver *drv =to_sdw_slave_driver (dev->driver);@@ -155,13 +155,13 @@ int __sdw_register_slave_driver(struct sdw_driver *drv, } drv->driver.owner = owner; - drv->driver.probe = sdw_drv_probe; + drv->driver.probe = sdw_slave_drv_probe;if (drv->remove) - drv->driver.remove = sdw_drv_remove; + drv->driver.remove = sdw_slave_drv_remove;if (drv->shutdown) - drv->driver.shutdown = sdw_drv_shutdown; + drv->driver.shutdown = sdw_slave_drv_shutdown;return driver_register (&drv->driver); }Signature · 1 line
2.20.1
PATCH 5/14 soundwire: intel: rename res field as link_res
In reply to Pierre-Louis BossartThere are too many fields called 'res' so add prefix to make it easier to track what the structures are.
Pure rename, no functionality change
--- drivers/soundwire/intel.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-)
drivers/soundwire/intel.c +19 -18
@@ -103,7 +103,7 @@ enum intel_pdi_type {struct sdw_intel {struct sdw_cdns cdns;int instance; -struct sdw_intel_link_res *res; +struct sdw_intel_link_res *link_res;#ifdef CONFIG_DEBUG_FS struct dentry *debugfs;#endif
@@ -193,8 +193,8 @@ static ssize_t intel_sprintf(void __iomem *mem, bool l,static int intel_reg_show (struct seq_file *s_file,void *data) {struct sdw_intel *sdw = s_file->private; -void __iomem *s = sdw->res->shim; -void __iomem *a = sdw->res->alh; +void __iomem *s = sdw->link_res->shim; +void __iomem *a = sdw->link_res->alh;char *buf;ssize_t ret;int i, j;
@@ -289,7 +289,7 @@ static void intel_debugfs_exit(struct sdw_intel *sdw) {}static int intel_link_power_up (struct sdw_intel *sdw) {unsigned int link_id = sdw->instance; -void __iomem *shim = sdw->res->shim; +void __iomem *shim = sdw->link_res->shim;int spa_mask, cpa_mask;int link_control, ret;
@@ -309,7 +309,7 @@ static int intel_link_power_up(struct sdw_intel *sdw)static int intel_shim_init (struct sdw_intel *sdw) { -void __iomem *shim = sdw->res->shim; +void __iomem *shim = sdw->link_res->shim;unsigned int link_id = sdw->instance;int sync_reg, ret;u16 ioctl =0 , act =0 ;
@@ -370,7 +370,7 @@ static int intel_shim_init(struct sdw_intel *sdw)static void intel_pdi_init (struct sdw_intel *sdw,struct sdw_cdns_stream_config *config) { -void __iomem *shim = sdw->res->shim; +void __iomem *shim = sdw->link_res->shim;unsigned int link_id = sdw->instance;int pcm_cap, pdm_cap;
@@ -404,7 +404,7 @@ static void intel_pdi_init(struct sdw_intel *sdw,static int intel_pdi_get_ch_cap (struct sdw_intel *sdw,unsigned int pdi_num,bool pcm) { -void __iomem *shim = sdw->res->shim; +void __iomem *shim = sdw->link_res->shim;unsigned int link_id = sdw->instance;int count;
@@ -476,7 +476,7 @@ static int intel_pdi_ch_update(struct sdw_intel *sdw)static void intel_pdi_shim_configure (struct sdw_intel *sdw,struct sdw_cdns_pdi *pdi) { -void __iomem *shim = sdw->res->shim; +void __iomem *shim = sdw->link_res->shim;unsigned int link_id = sdw->instance;int pdi_conf =0 ;
@@ -508,7 +508,7 @@ intel_pdi_shim_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi)static void intel_pdi_alh_configure (struct sdw_intel *sdw,struct sdw_cdns_pdi *pdi) { -void __iomem *alh = sdw->res->alh; +void __iomem *alh = sdw->link_res->alh;unsigned int link_id = sdw->instance;unsigned int conf;
@@ -535,7 +535,7 @@ static int intel_params_stream(struct sdw_intel *sdw,struct snd_pcm_hw_params *hw_params, int link_id, int alh_stream_id) { - struct sdw_intel_link_res *res = sdw->res; + struct sdw_intel_link_res *res = sdw->link_res;struct sdw_intel_stream_params_data params_data; params_data.substream = substream;
@@ -558,7 +558,7 @@ static int intel_pre_bank_switch(struct sdw_bus *bus) {struct sdw_cdns *cdns =bus_to_cdns (bus);struct sdw_intel *sdw =cdns_to_intel (cdns); -void __iomem *shim = sdw->res->shim; +void __iomem *shim = sdw->link_res->shim;int sync_reg;/* Write to register only for multi-link */
@@ -577,7 +577,7 @@ static int intel_post_bank_switch(struct sdw_bus *bus) {struct sdw_cdns *cdns =bus_to_cdns (bus);struct sdw_intel *sdw =cdns_to_intel (cdns); -void __iomem *shim = sdw->res->shim; +void __iomem *shim = sdw->link_res->shim;int sync_reg, ret;/* Write to register only for multi-link */
@@ -934,9 +934,9 @@ static int intel_probe(struct platform_device *pdev)return -ENOMEM ; sdw->instance = pdev->id; - sdw->res =dev_get_platdata (&pdev->dev); + sdw->link_res =dev_get_platdata (&pdev->dev); sdw->cdns.dev = &pdev->dev; - sdw->cdns.registers = sdw->res->registers; + sdw->cdns.registers = sdw->link_res->registers; sdw->cdns.instance = sdw->instance; sdw->cdns.msg_count =0 ; sdw->cdns.bus.dev = &pdev->dev;
@@ -976,11 +976,12 @@ static int intel_probe(struct platform_device *pdev)intel_pdi_ch_update (sdw);/* Acquire IRQ */ - ret =request_threaded_irq (sdw->res->irq, sdw_cdns_irq, sdw_cdns_thread, + ret =request_threaded_irq (sdw->link_res->irq, + sdw_cdns_irq, sdw_cdns_thread,IRQF_SHARED ,KBUILD_MODNAME , &sdw->cdns);if (ret <0 ) {dev_err (sdw->cdns.dev,"unable to grab IRQ %d, disabling device\n" , - sdw->res->irq); + sdw->link_res->irq); goto err_init; }
@@ -1010,7 +1011,7 @@ static int intel_probe(struct platform_device *pdev) err_interrupt:sdw_cdns_enable_interrupt (&sdw->cdns, false); -free_irq (sdw->res->irq, sdw); +free_irq (sdw->link_res->irq, sdw); err_init:sdw_delete_bus_master (&sdw->cdns.bus);return ret;
@@ -1025,7 +1026,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); +free_irq (sdw->link_res->irq, sdw);snd_soc_unregister_component (sdw->cdns.dev); }sdw_delete_bus_master (&sdw->cdns.bus);
Signature · 1 line
2.20.1
PATCH 6/14 soundwire: add support for sdw_slave_type
In reply to Pierre-Louis BossartCurrently the bus does not have any explicit support for master devices. Add explicit support for sdw_slave_type, so that in follow-up patches we can add support for the sdw_md_type (md==Master Device), following the Grey Bus example.
--- drivers/soundwire/bus_type.c | 9 ++++++++- drivers/soundwire/slave.c | 7 ++++++- include/linux/soundwire/sdw_type.h | 6 ++++++ 3 files changed, 20 insertions(+), 2 deletions(-)
drivers/soundwire/bus_type.c +8 -1
@@ -49,9 +49,16 @@ int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size)static int sdw_uevent (struct device *dev,struct kobj_uevent_env *env) { -struct sdw_slave *slave =to_sdw_slave_device (dev); +struct sdw_slave *slave;char modalias[32 ]; +if (is_sdw_slave (dev)) { + slave =to_sdw_slave_device (dev); + }else { +dev_warn (dev,"uevent for unknown Soundwire type\n" ); +return -EINVAL ; + } +sdw_slave_modalias (slave, modalias,sizeof (modalias));if (add_uevent_var (env,"MODALIAS=%s" , modalias))
drivers/soundwire/slave.c +6 -1
@@ -14,6 +14,11 @@ static void sdw_slave_release(struct device *dev)kfree (slave); } +struct device_type sdw_slave_type = { + .name ="sdw_slave" , + .release = sdw_slave_release, +}; +static int sdw_slave_add (struct sdw_bus *bus,struct sdw_slave_id *id,struct fwnode_handle *fwnode) {
@@ -41,9 +46,9 @@ static int sdw_slave_add(struct sdw_bus *bus, id->class_id, id->unique_id); } - slave->dev.release = sdw_slave_release; slave->dev.bus = &sdw_bus_type; slave->dev.of_node =of_node_get (to_of_node (fwnode)); + slave->dev.type = &sdw_slave_type; slave->bus = bus; slave->status =SDW_SLAVE_UNATTACHED ; slave->dev_num =0 ;
include/linux/soundwire/sdw_type.h +6 -0
@@ -5,6 +5,12 @@#define __SOUNDWIRE_TYPES_Hextern struct bus_type sdw_bus_type; +extern struct device_type sdw_slave_type; + +static inline int is_sdw_slave (const struct device *dev) +{ +return dev->type == &sdw_slave_type; +}#define to_sdw_slave_driver (_drv) \ container_of(_drv, struct sdw_driver, driver)
Signature · 1 line
2.20.1
Vinod Koul
maintainerRe: [PATCH 06/14] soundwire: add support for sdw_slave_type
Quoted 19 lines · Pierre-Louis Bossart
Currently the bus does not have any explicit support for master devices. Add explicit support for
sdw_slave_type, so that in follow-up patches we can add support for thesdw_md_type(md==Master Device), following the Grey Bus example.Signed-off-by Pierre-Louis Bossart <[email protected]>--- drivers/soundwire/bus_type.c | 9 ++++++++- drivers/soundwire/slave.c | 7 ++++++- include/linux/soundwire/sdw_type.h | 6 ++++++ 3 files changed, 20 insertions(+), 2 deletions(-)drivers/soundwire/bus_type.c +0
-0@@ -49,9 +49,16 @@ int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size)static int sdw_uevent (struct device *dev,struct kobj_uevent_env *env)
drivers/soundwire/bus_type.c int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size) · line 59
Quoted 10 lines
drivers/soundwire/bus_type.c +6
-1{ -struct sdw_slave *slave =to_sdw_slave_device (dev); +struct sdw_slave *slave;char modalias[32 ]; +if (is_sdw_slave (dev)) { + slave =to_sdw_slave_device (dev); + }else { +dev_warn (dev,"uevent for unknown Soundwire type\n" ); +return -EINVAL ;
when is the case where this would be triggered?
Quoted 51 lines
drivers/soundwire/bus_type.c +2
-0+ } +sdw_slave_modalias (slave, modalias,sizeof (modalias));if (add_uevent_var (env,"MODALIAS=%s" , modalias))drivers/soundwire/slave.c +6
-1@@ -14,6 +14,11 @@ static void sdw_slave_release(struct device *dev)kfree (slave); } +struct device_type sdw_slave_type = { + .name ="sdw_slave" , + .release = sdw_slave_release, +}; +static int sdw_slave_add (struct sdw_bus *bus,struct sdw_slave_id *id,struct fwnode_handle *fwnode) {@@ -41,9 +46,9 @@ static int sdw_slave_add(struct sdw_bus *bus, id->class_id, id->unique_id); } - slave->dev.release = sdw_slave_release; slave->dev.bus = &sdw_bus_type; slave->dev.of_node =of_node_get (to_of_node (fwnode)); + slave->dev.type = &sdw_slave_type; slave->bus = bus; slave->status =SDW_SLAVE_UNATTACHED ; slave->dev_num =0 ;include/linux/soundwire/sdw_type.h +6
-0@@ -5,6 +5,12 @@#define __SOUNDWIRE_TYPES_Hextern struct bus_type sdw_bus_type; +extern struct device_type sdw_slave_type; + +static inline int is_sdw_slave (const struct device *dev) +{ +return dev->type == &sdw_slave_type; +}#define to_sdw_slave_driver (_drv) \ container_of(_drv, struct sdw_driver, driver)Signature · 1 line
2.20.1
Signature · 1 line
~Vinod
Re: [alsa-devel] [PATCH 06/14] soundwire: add support for sdw_slave_type
Quoted 25 lines · Vinod Koul
Quoted 24 lines · Pierre-Louis Bossart
Currently the bus does not have any explicit support for master devices. Add explicit support for
sdw_slave_type, so that in follow-up patches we can add support for thesdw_md_type(md==Master Device), following the Grey Bus example.Signed-off-by Pierre-Louis Bossart <[email protected]>--- drivers/soundwire/bus_type.c | 9 ++++++++- drivers/soundwire/slave.c | 7 ++++++- include/linux/soundwire/sdw_type.h | 6 ++++++ 3 files changed, 20 insertions(+), 2 deletions(-)drivers/soundwire/bus_type.c +1
-1@@ -49,9 +49,16 @@ int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size)static int sdw_uevent (struct device *dev,struct kobj_uevent_env *env) { -struct sdw_slave *slave =to_sdw_slave_device (dev); +struct sdw_slave *slave;char modalias[32 ];
Quoted 7 lines
drivers/soundwire/bus_type.c int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size) · line 59
Quoted 5 lines
drivers/soundwire/bus_type.c +5
-0+if (is_sdw_slave (dev)) { + slave =to_sdw_slave_device (dev); + }else { +dev_warn (dev,"uevent for unknown Soundwire type\n" ); +return -EINVAL ;when is the case where this would be triggered?
this is in preparation for the master case, where you will have 2 types of devices, so need to check if the type is correct.
Re: [PATCH 06/14] soundwire: add support for sdw_slave_type
In reply to Pierre-Louis BossartQuoted 12 lines · Pierre-Louis Bossart
drivers/soundwire/bus_type.c +1
-1@@ -49,9 +49,16 @@ int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size)static int sdw_uevent (struct device *dev,struct kobj_uevent_env *env) { -struct sdw_slave *slave =to_sdw_slave_device (dev); +struct sdw_slave *slave;char modalias[32 ];
drivers/soundwire/bus_type.c int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size) · line 64
Quoted 10 lines
drivers/soundwire/bus_type.c +7
-0+if (is_sdw_slave (dev)) { + slave =to_sdw_slave_device (dev); + }else { +dev_warn (dev,"uevent for unknown Soundwire type\n" ); +return -EINVAL ; + } +sdw_slave_modalias (slave, modalias,sizeof (modalias));if (add_uevent_var (env,"MODALIAS=%s" , modalias))
Positive evaluation of is_sdw_slave() check is required for function to continue, thus you might as well do:
if (!is_sdw_slave(dev)) {
dev_warn();
return -EINVAL;
}slave = to_sdw_slave_device(dev);
(...)
Czarek
Re: [alsa-devel] [PATCH 06/14] soundwire: add support for sdw_slave_type
Quoted 21 lines
Quoted 8 lines
drivers/soundwire/bus_type.c +1
-1@@ -49,9 +49,16 @@ int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size) static int sdw_uevent(struct device *dev, struct kobj_uevent_env *env) { - struct sdw_slave *slave = to_sdw_slave_device(dev); + struct sdw_slave *slave;drivers/soundwire/bus_type.c int sdw_slave_modalias(const struct sdw_slave · line 62
Quoted 10 lines
drivers/soundwire/bus_type.c +7
-0char modalias[32]; + if (is_sdw_slave(dev)) { + slave = to_sdw_slave_device(dev); + } else { + dev_warn(dev, "uevent for unknown Soundwire type\n"); + return -EINVAL; + } + sdw_slave_modalias(slave, modalias, sizeof(modalias)); if (add_uevent_var(env, "MODALIAS=%s", modalias))Positive evaluation of
is_sdw_slave()check is required for function to continue, thus you might as well do:
Quoted 6 lines
if (!is_sdw_slave(dev)) {
dev_warn();
return-EINVAL;
}slave =
to_sdw_slave_device(dev);
see the following patch 7, it becomes a 2-case test (slave and master). I am all for optimizations but wait until the actual changes are added...
PATCH 7/14 soundwire: add initial definitions for sdw_master_device
In reply to Pierre-Louis BossartSince we want an explicit support for the SoundWire Master device, add the definitions, following the Grey Bus example.
Open: do we need to set a variable when dealing with the master uevent?
--- drivers/soundwire/Makefile | 2 +- drivers/soundwire/bus_type.c | 16 +++++--- drivers/soundwire/master.c | 62 ++++++++++++++++++++++++++++++ include/linux/soundwire/sdw.h | 35 +++++++++++++++++ include/linux/soundwire/sdw_type.h | 9 +++++ 5 files changed, 117 insertions(+), 7 deletions(-) create mode 100644 drivers/soundwire/master.c
drivers/soundwire/Makefile +1 -1
@@ -4,7 +4,7 @@ # #Bus Objs -soundwire-bus-objs := bus_type.o bus.o slave.o mipi_disco.o stream.o +soundwire-bus-objs := bus_type.o bus.o master.o slave.o mipi_disco.o stream.o obj-$(CONFIG_SOUNDWIRE) += soundwire-bus.o ifdef CONFIG_DEBUG_FS
drivers/soundwire/bus_type.c +10 -6
@@ -49,21 +49,25 @@ int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size)static int sdw_uevent (struct device *dev,struct kobj_uevent_env *env) { +struct sdw_master_device *md;struct sdw_slave *slave;char modalias[32 ]; -if (is_sdw_slave (dev)) { +if (is_sdw_md (dev)) { + md =to_sdw_master_device (dev); +/* TODO: do we need to call add_uevent_var() ? */ + }else if (is_sdw_slave (dev)) { slave =to_sdw_slave_device (dev); + +sdw_slave_modalias (slave, modalias,sizeof (modalias)); + +if (add_uevent_var (env,"MODALIAS=%s" , modalias)) +return -ENOMEM ; }else {dev_warn (dev,"uevent for unknown Soundwire type\n" );return -EINVAL ; } -sdw_slave_modalias (slave, modalias,sizeof (modalias)); - -if (add_uevent_var (env,"MODALIAS=%s" , modalias)) -return -ENOMEM ; -return 0 ; }
drivers/soundwire/master.c new file +62 -0
62 lines not on this page · raw message
include/linux/soundwire/sdw.h +35 -0
@@ -573,6 +573,16 @@ struct sdw_slave {#define to_sdw_slave_device (d) \ container_of(d, struct sdw_slave, dev) +struct sdw_master_device { +struct device dev; +int link_id; +struct sdw_md_driver *driver; +void *pdata;/* core does not touch */ +}; + +#define to_sdw_master_device (d) \ + container_of(d, struct sdw_master_device, dev) +struct sdw_driver {const char *name;
@@ -587,6 +597,26 @@ struct sdw_driver {struct device_driver driver; }; +struct sdw_md_driver { +/* initializations and allocations */ +int (*probe)(struct sdw_master_device *md,void *link_ctx); +/* hardware enablement, all clock/power dependencies are available */ +int (*startup)(struct sdw_master_device *md); +/* hardware disabled */ +int (*shutdown)(struct sdw_master_device *md); +/* free all resources */ +int (*remove)(struct sdw_master_device *md); +/* +* enable/disable driver control while in clock-stop mode, +* typically in always-on/D0ix modes. When the driver yields +* control, another entity in the system (typically firmware +* running on an always-on microprocessor) is responsible to +* tracking Slave-initiated wakes +*/ +int (*autonomous_clock_stop_enable)(struct sdw_master_device *md, +bool state); +}; +#define SDW_SLAVE_ENTRY (_mfg_id, _part_id, _drv_data) \ { .mfg_id = (_mfg_id), .part_id = (_part_id), \ .driver_data = (unsigned long)(_drv_data) }
@@ -776,6 +806,11 @@ struct sdw_bus {int sdw_add_bus_master (struct sdw_bus *bus);void sdw_delete_bus_master (struct sdw_bus *bus); +struct sdw_master_device *sdw_md_add (struct sdw_md_driver *driver, +struct device *parent, +struct fwnode_handle *fwnode, +int link_id); +/** * sdw_port_config: Master or Slave Port configuration *
include/linux/soundwire/sdw_type.h +9 -0
@@ -6,15 +6,24 @@extern struct bus_type sdw_bus_type;extern struct device_type sdw_slave_type; +extern struct device_type sdw_md_type;static inline int is_sdw_slave (const struct device *dev) {return dev->type == &sdw_slave_type; } +static inline int is_sdw_md (const struct device *dev) +{ +return dev->type == &sdw_md_type; +} +#define to_sdw_slave_driver (_drv) \ container_of(_drv, struct sdw_driver, driver) +#define to_sdw_md_driver (_drv) \ + container_of(_drv, struct sdw_md_driver, driver) +#define sdw_register_slave_driver (drv) \ __sdw_register_slave_driver(drv, THIS_MODULE)
Signature · 1 line
2.20.1
Vinod Koul
maintainerRe: [PATCH 07/14] soundwire: add initial definitions for sdw_master_device
Quoted 4 lines · Pierre-Louis Bossart
Since we want an explicit support for the SoundWire Master device, add the definitions, following the Grey Bus example.
Open: do we need to set a variable when dealing with the master uevent?
I dont think we want that or we need that!
And to prevent that rather than adding a variable, can you please modify the device_type and use separate ones for master_device and slave_device
Quoted 29 lines
Signed-off-by Pierre-Louis Bossart <[email protected]>--- drivers/soundwire/Makefile | 2 +- drivers/soundwire/bus_type.c | 16 +++++--- drivers/soundwire/master.c | 62 ++++++++++++++++++++++++++++++ include/linux/soundwire/sdw.h | 35 +++++++++++++++++ include/linux/soundwire/sdw_type.h | 9 +++++ 5 files changed, 117 insertions(+), 7 deletions(-) create mode 100644 drivers/soundwire/master.cdrivers/soundwire/Makefile +1
-1@@ -4,7 +4,7 @@ # #Bus Objs -soundwire-bus-objs := bus_type.o bus.o slave.o mipi_disco.o stream.o +soundwire-bus-objs := bus_type.o bus.o master.o slave.o mipi_disco.o stream.o obj-$(CONFIG_SOUNDWIRE) += soundwire-bus.o ifdef CONFIG_DEBUG_FSdrivers/soundwire/bus_type.c +0
-0
drivers/soundwire/bus_type.c int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size) · line 57
Quoted 10 lines
drivers/soundwire/bus_type.c +3
-1@@ -49,21 +49,25 @@ int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size)static int sdw_uevent (struct device *dev,struct kobj_uevent_env *env) { +struct sdw_master_device *md;struct sdw_slave *slave;char modalias[32 ]; -if (is_sdw_slave (dev)) { +if (is_sdw_md (dev)) { + md =to_sdw_master_device (dev);
md seems unused?
Quoted 94 lines
drivers/soundwire/bus_type.c +7
-5+/* TODO: do we need to call add_uevent_var() ? */ + }else if (is_sdw_slave (dev)) { slave =to_sdw_slave_device (dev); + +sdw_slave_modalias (slave, modalias,sizeof (modalias)); + +if (add_uevent_var (env,"MODALIAS=%s" , modalias)) +return -ENOMEM ; }else {dev_warn (dev,"uevent for unknown Soundwire type\n" );return -EINVAL ; } -sdw_slave_modalias (slave, modalias,sizeof (modalias)); - -if (add_uevent_var (env,"MODALIAS=%s" , modalias)) -return -ENOMEM ; -return 0 ; }drivers/soundwire/master.c new file +62
-0@@ -0,0 +1,62 @@ +// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) +// Copyright(c) 2019 Intel Corporation. + +#include <linux/device.h> +#include <linux/acpi.h> +#include <linux/soundwire/sdw.h> +#include <linux/soundwire/sdw_type.h> +#include "bus.h" + +static void sdw_md_release (struct device *dev) +{ +struct sdw_master_device *md =to_sdw_master_device (dev); + +kfree (md); +} + +struct device_type sdw_md_type = { + .name ="soundwire_master" , + .release = sdw_md_release, +}; + +struct sdw_master_device *sdw_md_add (struct sdw_md_driver *driver, +struct device *parent, +struct fwnode_handle *fwnode, +int link_id) +{ +struct sdw_master_device *md; +int ret; + +if (!driver->probe) { +dev_err (parent,"mandatory probe callback missing\n" ); +return ERR_PTR (-EINVAL ); + } + + md =kzalloc (sizeof (*md),GFP_KERNEL ); +if (!md) +return ERR_PTR (-ENOMEM ); + + md->link_id = link_id; + + md->driver = driver; + + md->dev.parent = parent; + md->dev.fwnode = fwnode; + md->dev.bus = &sdw_bus_type; + 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); + + ret =device_register (&md->dev); +if (ret) { +dev_err (parent,"Failed to add master: ret %d\n" , ret); +/* +* On err, don't free but drop ref as this will be freed +* when release method is invoked. +*/ +put_device (&md->dev); + } + +return md; +} +EXPORT_SYMBOL (sdw_md_add);include/linux/soundwire/sdw.h +0
-0
include/linux/soundwire/sdw.h struct sdw_slave { · line 580
Quoted 8 lines
include/linux/soundwire/sdw.h +5
-0@@ -573,6 +573,16 @@ struct sdw_slave {#define to_sdw_slave_device (d) \ container_of(d, struct sdw_slave, dev) +struct sdw_master_device { +struct device dev; +int link_id; +struct sdw_md_driver *driver; +void *pdata;/* core does not touch */
what is the use for this, also please add kernel-doc style comments for core structs
Quoted 78 lines
include/linux/soundwire/sdw.h +30
-0+}; + +#define to_sdw_master_device (d) \ + container_of(d, struct sdw_master_device, dev) +struct sdw_driver {const char *name;@@ -587,6 +597,26 @@ struct sdw_driver {struct device_driver driver; }; +struct sdw_md_driver { +/* initializations and allocations */ +int (*probe)(struct sdw_master_device *md,void *link_ctx); +/* hardware enablement, all clock/power dependencies are available */ +int (*startup)(struct sdw_master_device *md); +/* hardware disabled */ +int (*shutdown)(struct sdw_master_device *md); +/* free all resources */ +int (*remove)(struct sdw_master_device *md); +/* +* enable/disable driver control while in clock-stop mode, +* typically in always-on/D0ix modes. When the driver yields +* control, another entity in the system (typically firmware +* running on an always-on microprocessor) is responsible to +* tracking Slave-initiated wakes +*/ +int (*autonomous_clock_stop_enable)(struct sdw_master_device *md, +bool state); +}; +#define SDW_SLAVE_ENTRY (_mfg_id, _part_id, _drv_data) \ { .mfg_id = (_mfg_id), .part_id = (_part_id), \ .driver_data = (unsigned long)(_drv_data) }@@ -776,6 +806,11 @@ struct sdw_bus {int sdw_add_bus_master (struct sdw_bus *bus);void sdw_delete_bus_master (struct sdw_bus *bus); +struct sdw_master_device *sdw_md_add (struct sdw_md_driver *driver, +struct device *parent, +struct fwnode_handle *fwnode, +int link_id); +/** * sdw_port_config: Master or Slave Port configuration * include/linux/soundwire/sdw_type.h +9
-0@@ -6,15 +6,24 @@extern struct bus_type sdw_bus_type;extern struct device_type sdw_slave_type; +extern struct device_type sdw_md_type;static inline int is_sdw_slave (const struct device *dev) {return dev->type == &sdw_slave_type; } +static inline int is_sdw_md (const struct device *dev) +{ +return dev->type == &sdw_md_type; +} +#define to_sdw_slave_driver (_drv) \ container_of(_drv, struct sdw_driver, driver) +#define to_sdw_md_driver (_drv) \ + container_of(_drv, struct sdw_md_driver, driver) +#define sdw_register_slave_driver (drv) \ __sdw_register_slave_driver(drv, THIS_MODULE)Signature · 1 line
2.20.1
Signature · 5 lines
~Vinod _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [alsa-devel] [PATCH 07/14] soundwire: add initial definitions for sdw_master_device
Quoted 7 lines · Vinod Koul
Quoted 4 lines · Pierre-Louis Bossart
Since we want an explicit support for the SoundWire Master device, add the definitions, following the Grey Bus example.
Open: do we need to set a variable when dealing with the master uevent?
I dont think we want that or we need that!
In GreyBus there are events and variables set, not sure what they were used for. The code works without setting an event, but we'd need to make a conscious design decision, and I am not too sure what usersace would use the informatio for.
Quoted 4 lines
And to prevent that rather than adding a variable, can you please modify the
device_typeand use separate ones formaster_deviceandslave_device
sorry, I don't get the comment. There is only already a different device type
struct bus_type sdw_bus_type = {
.name = "soundwire",
.match = sdw_bus_match,
.uevent = sdw_uevent,
};
struct device_type sdw_slave_type = {
.name = "sdw_slave",
.release = sdw_slave_release,
};struct device_type sdw_md_type = {
.name = "soundwire_master",
.release = sdw_md_release,
};Quoted 37 lines
Quoted 37 lines
Signed-off-by Pierre-Louis Bossart <[email protected]>--- drivers/soundwire/Makefile | 2 +- drivers/soundwire/bus_type.c | 16 +++++--- drivers/soundwire/master.c | 62 ++++++++++++++++++++++++++++++ include/linux/soundwire/sdw.h | 35 +++++++++++++++++ include/linux/soundwire/sdw_type.h | 9 +++++ 5 files changed, 117 insertions(+), 7 deletions(-)create mode 100644
drivers/soundwire/master.cdrivers/soundwire/Makefile +1
-1@@ -4,7 +4,7 @@ # #Bus Objs -soundwire-bus-objs := bus_type.o bus.o slave.o mipi_disco.o stream.o +soundwire-bus-objs := bus_type.o bus.o master.o slave.o mipi_disco.o stream.o obj-$(CONFIG_SOUNDWIRE) += soundwire-bus.o ifdef CONFIG_DEBUG_FSdrivers/soundwire/bus_type.c +1
-0@@ -49,21 +49,25 @@ int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size)static int sdw_uevent (struct device *dev,struct kobj_uevent_env *env) { +struct sdw_master_device *md;struct sdw_slave *slave;char modalias[32 ];
Quoted 5 lines
drivers/soundwire/bus_type.c int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size) · line 57
Quoted 3 lines
drivers/soundwire/bus_type.c +2
-1-if (is_sdw_slave (dev)) { +if (is_sdw_md (dev)) { + md =to_sdw_master_device (dev);md seems unused?
well, yes, its use depends on whether we need to call add_event_var() as asked below
Quoted 186 lines
Quoted 95 lines
drivers/soundwire/bus_type.c +7
-5+/* TODO: do we need to call add_uevent_var() ? */ + }else if (is_sdw_slave (dev)) { slave =to_sdw_slave_device (dev); + +sdw_slave_modalias (slave, modalias,sizeof (modalias)); + +if (add_uevent_var (env,"MODALIAS=%s" , modalias)) +return -ENOMEM ; }else {dev_warn (dev,"uevent for unknown Soundwire type\n" );return -EINVAL ; } -sdw_slave_modalias (slave, modalias,sizeof (modalias)); - -if (add_uevent_var (env,"MODALIAS=%s" , modalias)) -return -ENOMEM ; -return 0 ; }drivers/soundwire/master.c new file +62
-0@@ -0,0 +1,62 @@ +// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) +// Copyright(c) 2019 Intel Corporation. + +#include <linux/device.h> +#include <linux/acpi.h> +#include <linux/soundwire/sdw.h> +#include <linux/soundwire/sdw_type.h> +#include "bus.h" + +static void sdw_md_release (struct device *dev) +{ +struct sdw_master_device *md =to_sdw_master_device (dev); + +kfree (md); +} + +struct device_type sdw_md_type = { + .name ="soundwire_master" , + .release = sdw_md_release, +}; + +struct sdw_master_device *sdw_md_add (struct sdw_md_driver *driver, +struct device *parent, +struct fwnode_handle *fwnode, +int link_id) +{ +struct sdw_master_device *md; +int ret; + +if (!driver->probe) { +dev_err (parent,"mandatory probe callback missing\n" ); +return ERR_PTR (-EINVAL ); + } + + md =kzalloc (sizeof (*md),GFP_KERNEL ); +if (!md) +return ERR_PTR (-ENOMEM ); + + md->link_id = link_id; + + md->driver = driver; + + md->dev.parent = parent; + md->dev.fwnode = fwnode; + md->dev.bus = &sdw_bus_type; + 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); + + ret =device_register (&md->dev); +if (ret) { +dev_err (parent,"Failed to add master: ret %d\n" , ret); +/* +* On err, don't free but drop ref as this will be freed +* when release method is invoked. +*/ +put_device (&md->dev); + } + +return md; +} +EXPORT_SYMBOL (sdw_md_add);include/linux/soundwire/sdw.h +0
-0include/linux/soundwire/sdw.h struct sdw_slave { · line 580
Quoted 8 lines
include/linux/soundwire/sdw.h +5
-0@@ -573,6 +573,16 @@ struct sdw_slave {#define to_sdw_slave_device (d) \ container_of(d, struct sdw_slave, dev) +struct sdw_master_device { +struct device dev; +int link_id; +struct sdw_md_driver *driver; +void *pdata;/* core does not touch */ what is the use for this, also please add kernel-doc style comments for core structs
Quoted 78 lines
include/linux/soundwire/sdw.h +30
-0+}; + +#define to_sdw_master_device (d) \ + container_of(d, struct sdw_master_device, dev) +struct sdw_driver {const char *name;@@ -587,6 +597,26 @@ struct sdw_driver {struct device_driver driver; }; +struct sdw_md_driver { +/* initializations and allocations */ +int (*probe)(struct sdw_master_device *md,void *link_ctx); +/* hardware enablement, all clock/power dependencies are available */ +int (*startup)(struct sdw_master_device *md); +/* hardware disabled */ +int (*shutdown)(struct sdw_master_device *md); +/* free all resources */ +int (*remove)(struct sdw_master_device *md); +/* +* enable/disable driver control while in clock-stop mode, +* typically in always-on/D0ix modes. When the driver yields +* control, another entity in the system (typically firmware +* running on an always-on microprocessor) is responsible to +* tracking Slave-initiated wakes +*/ +int (*autonomous_clock_stop_enable)(struct sdw_master_device *md, +bool state); +}; +#define SDW_SLAVE_ENTRY (_mfg_id, _part_id, _drv_data) \ { .mfg_id = (_mfg_id), .part_id = (_part_id), \ .driver_data = (unsigned long)(_drv_data) }@@ -776,6 +806,11 @@ struct sdw_bus {int sdw_add_bus_master (struct sdw_bus *bus);void sdw_delete_bus_master (struct sdw_bus *bus); +struct sdw_master_device *sdw_md_add (struct sdw_md_driver *driver, +struct device *parent, +struct fwnode_handle *fwnode, +int link_id); +/** * sdw_port_config: Master or Slave Port configuration * include/linux/soundwire/sdw_type.h +9
-0@@ -6,15 +6,24 @@extern struct bus_type sdw_bus_type;extern struct device_type sdw_slave_type; +extern struct device_type sdw_md_type;static inline int is_sdw_slave (const struct device *dev) {return dev->type == &sdw_slave_type; } +static inline int is_sdw_md (const struct device *dev) +{ +return dev->type == &sdw_md_type; +} +#define to_sdw_slave_driver (_drv) \ container_of(_drv, struct sdw_driver, driver) +#define to_sdw_md_driver (_drv) \ + container_of(_drv, struct sdw_md_driver, driver) +#define sdw_register_slave_driver (drv) \ __sdw_register_slave_driver(drv, THIS_MODULE)Signature · 1 line
2.20.1
Vinod Koul
maintainerRe: [alsa-devel] [PATCH 07/14] soundwire: add initial definitions for sdw_master_device
Quoted 21 lines · Pierre-Louis Bossart
Quoted 7 lines · Vinod Koul
Quoted 4 lines · Pierre-Louis Bossart
Since we want an explicit support for the SoundWire Master device, add the definitions, following the Grey Bus example.
Open: do we need to set a variable when dealing with the master uevent?
I dont think we want that or we need that!
In GreyBus there are events and variables set, not sure what they were used for. The code works without setting an event, but we'd need to make a conscious design decision, and I am not too sure what usersace would use the informatio for.
Quoted 4 lines
And to prevent that rather than adding a variable, can you please modify the
device_typeand use separate ones formaster_deviceandslave_device
Quoted 8 lines
sorry, I don't get the comment. There is only already a different device type
struct
bus_typesdw_bus_type= {
.name = "soundwire",
.match =sdw_bus_match,
.uevent =sdw_uevent,
We can remove this
Quoted 5 lines
};
struct device_type sdw_slave_type = { .name = "sdw_slave", .release = sdw_slave_release,
Add here:
uevent = sdw_uevent,
Quoted 6 lines
};
struct device_type sdw_md_type = { .name = "soundwire_master", .release = sdw_md_release, };
And not have here!
Problem solved!
Signature · 1 line
~Vinod
Re: [alsa-devel] [PATCH 07/14] soundwire: add initial definitions for sdw_master_device
Quoted 45 lines · Vinod Koul
Quoted 21 lines · Pierre-Louis Bossart
Quoted 7 lines · Vinod Koul
Quoted 4 lines · Pierre-Louis Bossart
Since we want an explicit support for the SoundWire Master device, add the definitions, following the Grey Bus example.
Open: do we need to set a variable when dealing with the master uevent?
I dont think we want that or we need that!
In GreyBus there are events and variables set, not sure what they were used for. The code works without setting an event, but we'd need to make a conscious design decision, and I am not too sure what usersace would use the informatio for.
Quoted 4 lines
And to prevent that rather than adding a variable, can you please modify the
device_typeand use separate ones formaster_deviceandslave_deviceQuoted 8 lines
sorry, I don't get the comment. There is only already a different device type
struct
bus_typesdw_bus_type= {
.name = "soundwire",
.match =sdw_bus_match,
.uevent =sdw_uevent,We can remove this
Quoted 5 lines
};
struct device_type sdw_slave_type = { .name = "sdw_slave", .release = sdw_slave_release,Add here:
uevent =
sdw_uevent,Quoted 2 lines
};
Quoted 8 lines
Quoted 4 lines
struct device_type sdw_md_type = { .name = "soundwire_master", .release = sdw_md_release, };And not have here!
Problem solved!
I will give it a try but I don't know what the 'problem' was.
The code works as is, and btw you are commenting on the wrong version of the series, v2 was sent yesterday.
PATCH 8/14 soundwire: intel: remove platform devices and provide new interface
In reply to Pierre-Louis BossartUse sdw_master_device and driver instead of platform devices
To quote GregKH:
"Don't mess with a platform device unless you really have no other possible choice. And even then, don't do it and try to do something else. Platform devices are really abused, don't perpetuate it "
In addition, rather than a plain-vanilla init/exit, this patch provides 3 steps in the initialization (ACPI scan, probe, startup) which make it easier to verify support and allocate required resources as early as possible, and conversely help make the startup lighter-weight with only hardware register setup.
--- drivers/soundwire/intel.c | 92 ++++++----- drivers/soundwire/intel.h | 8 +- drivers/soundwire/intel_init.c | 276 ++++++++++++++++++++++++--------- 3 files changed, 268 insertions(+), 108 deletions(-)
drivers/soundwire/intel.c +56 -36
@@ -92,8 +92,6 @@#define SDW_ALH_STRMZCFG_DMAT GENMASK(7, 0)#define SDW_ALH_STRMZCFG_CHN GENMASK(19, 16) -#define SDW_INTEL_QUIRK_MASK_BUS_DISABLE BIT(1) -enum intel_pdi_type {INTEL_PDI_IN =0 ,INTEL_PDI_OUT =1 ,
@@ -923,24 +921,23 @@ static int intel_init(struct sdw_intel *sdw)/* * probe and init */ -static int intel_probe (struct platform_device *pdev) +static int intel_master_probe (struct sdw_master_device *md,void *link_ctx) { -struct sdw_cdns_stream_config config;struct sdw_intel *sdw;int ret; - sdw =devm_kzalloc (&pdev->dev,sizeof (*sdw),GFP_KERNEL ); + sdw =devm_kzalloc (&md->dev,sizeof (*sdw),GFP_KERNEL );if (!sdw)return -ENOMEM ; - sdw->instance = pdev->id; - sdw->link_res =dev_get_platdata (&pdev->dev); - sdw->cdns.dev = &pdev->dev; + sdw->instance = md->link_id; + sdw->link_res = link_ctx; + sdw->cdns.dev = &md->dev; sdw->cdns.registers = sdw->link_res->registers; - sdw->cdns.instance = sdw->instance; + sdw->cdns.instance = md->link_id; sdw->cdns.msg_count =0 ; - sdw->cdns.bus.dev = &pdev->dev; - sdw->cdns.bus.link_id = pdev->id; + sdw->cdns.bus.dev = &md->dev; + sdw->cdns.bus.link_id = md->link_id;sdw_cdns_probe (&sdw->cdns);
@@ -948,16 +945,50 @@ static int intel_probe(struct platform_device *pdev) sdw_intel_ops.read_prop = intel_prop_read; sdw->cdns.bus.ops = &sdw_intel_ops; -platform_set_drvdata (pdev, sdw); + md->pdata = sdw; + +/* set driver data, accessed by snd_soc_dai_set_drvdata() */ +dev_set_drvdata (&md->dev, &sdw->cdns); ret =sdw_add_bus_master (&sdw->cdns.bus);if (ret) { -dev_err (&pdev->dev,"sdw_add_bus_master fail: %d\n" , ret); +dev_err (&md->dev,"sdw_add_bus_master fail: %d\n" , ret);return ret; }if (sdw->cdns.bus.prop.hw_disabled) { -dev_info (&pdev->dev,"SoundWire master %d is disabled, ignoring\n" , +dev_info (&md->dev,"SoundWire master %d is disabled, ignoring\n" , + sdw->cdns.bus.link_id); +return 0 ; + } + +/* Acquire IRQ */ + ret =request_threaded_irq (sdw->link_res->irq, + sdw_cdns_irq, sdw_cdns_thread, +IRQF_SHARED ,KBUILD_MODNAME , &sdw->cdns); +if (ret <0 ) { +dev_err (sdw->cdns.dev,"unable to grab IRQ %d, disabling device\n" , + sdw->link_res->irq); + goto err_init; + } + +return 0 ; + +err_init: +sdw_delete_bus_master (&sdw->cdns.bus); +return ret; +} + +static int intel_master_startup (struct sdw_master_device *md) +{ +struct sdw_cdns_stream_config config; +struct sdw_intel *sdw; +int ret; + + sdw = md->pdata; + +if (sdw->cdns.bus.prop.hw_disabled) { +dev_info (&md->dev,"SoundWire master %d is disabled, ignoring\n" , sdw->cdns.bus.link_id);return 0 ; }
@@ -975,16 +1006,6 @@ static int intel_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 , &sdw->cdns); -if (ret <0 ) { -dev_err (sdw->cdns.dev,"unable to grab IRQ %d, disabling device\n" , - sdw->link_res->irq); - goto err_init; - } - ret =sdw_cdns_enable_interrupt (&sdw->cdns, true);if (ret <0 ) {dev_err (sdw->cdns.dev,"cannot enable interrupts\n" );
@@ -1011,17 +1032,17 @@ static int intel_probe(struct platform_device *pdev) err_interrupt:sdw_cdns_enable_interrupt (&sdw->cdns, false); -free_irq (sdw->link_res->irq, sdw); err_init: +free_irq (sdw->link_res->irq, sdw);sdw_delete_bus_master (&sdw->cdns.bus);return ret; } -static int intel_remove (struct platform_device *pdev) +static int intel_master_remove (struct sdw_master_device *md) {struct sdw_intel *sdw; - sdw =platform_get_drvdata (pdev); + sdw = md->pdata;if (!sdw->cdns.bus.prop.hw_disabled) {intel_debugfs_exit (sdw);
@@ -1031,19 +1052,18 @@ static int intel_remove(struct platform_device *pdev) }sdw_delete_bus_master (&sdw->cdns.bus); + md->dev.driver =NULL ; +device_unregister (&md->dev); +return 0 ; } -static struct platform_driver sdw_intel_drv = { - .probe = intel_probe, - .remove = intel_remove, - .driver = { - .name ="int-sdw" , - - }, +struct sdw_md_driver intel_sdw_driver = { + .probe = intel_master_probe, + .startup = intel_master_startup, + .remove = intel_master_remove, }; - -module_platform_driver (sdw_intel_drv); +EXPORT_SYMBOL (intel_sdw_driver);MODULE_LICENSE ("Dual BSD/GPL" );MODULE_ALIAS ("platform:int-sdw" );
drivers/soundwire/intel.h +6 -2
@@ -7,7 +7,7 @@/** * struct sdw_intel_link_res - Soundwire Intel link resource structure, * typically populated by the controller driver. -* @pdev: platform_device +* @md: master device * @mmio_base: mmio base of SoundWire registers * @registers: Link IO registers base * @shim: Audio shim pointer
@@ -17,7 +17,7 @@* @dev: device implementing hw_params and free callbacks */ struct sdw_intel_link_res { -struct platform_device *pdev; +struct sdw_master_device *md;void __iomem *mmio_base;/* not strictly needed, useful for debug */ void __iomem *registers;void __iomem *shim;
@@ -27,4 +27,8 @@ struct sdw_intel_link_res { struct device *dev; }; +#define SDW_INTEL_QUIRK_MASK_BUS_DISABLE BIT(1) + +extern struct sdw_md_driver intel_sdw_driver; +#endif /* __SDW_INTEL_LOCAL_H */
drivers/soundwire/intel_init.c +206 -70
391 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 9/14 soundwire: add device driver to sdw_md_driver
In reply to Pierre-Louis BossartFrom: Bard Liao <[email protected]>
Setting an device driver is necessary for ASoC to register DAI components.
--- drivers/soundwire/intel.c | 4 ++++ drivers/soundwire/master.c | 2 ++ include/linux/soundwire/sdw.h | 1 + 3 files changed, 7 insertions(+)
drivers/soundwire/intel.c +4 -0
@@ -1059,6 +1059,10 @@ static int intel_master_remove(struct sdw_master_device *md) }struct sdw_md_driver intel_sdw_driver = { + .driver = { + .name ="intel-sdw" , + .owner =THIS_MODULE , + }, .probe = intel_master_probe, .startup = intel_master_startup, .remove = intel_master_remove,
drivers/soundwire/master.c +2 -0
@@ -57,6 +57,8 @@ struct sdw_master_device *sdw_md_add(struct sdw_md_driver *driver,put_device (&md->dev); } + md->dev.driver = &driver->driver; +return md; }EXPORT_SYMBOL (sdw_md_add);
include/linux/soundwire/sdw.h +1 -0
@@ -615,6 +615,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) \
Signature · 1 line
2.20.1
PATCH 10/14 soundwire: intel: add prepare support in sdw dai driver
In reply to Pierre-Louis BossartFrom: Rander Wang <[email protected]>
It gets sdw runtime information from dai to prepare stream.
--- drivers/soundwire/intel.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/soundwire/intel.c +17 -0
@@ -697,6 +697,21 @@ static int intel_hw_params(struct snd_pcm_substream *substream,return ret; } +static int intel_prepare (struct snd_pcm_substream *substream, +struct snd_soc_dai *dai) +{ +struct sdw_cdns_dma_data *dma; + + dma =snd_soc_dai_get_dma_data (dai, substream); +if (!dma) { +dev_err (dai->dev,"failed to get dma data in %s" , + __func__); +return -EIO ; + } + +return sdw_prepare_stream (dma->stream); +} +static int intel_hw_free (struct snd_pcm_substream *substream,struct snd_soc_dai *dai) {
@@ -743,6 +758,7 @@ static int intel_pdm_set_sdw_stream(struct snd_soc_dai *dai,static const struct snd_soc_dai_ops intel_pcm_dai_ops = { .hw_params = intel_hw_params, + .prepare = intel_prepare, .hw_free = intel_hw_free, .shutdown = intel_shutdown, .set_sdw_stream = intel_pcm_set_sdw_stream,
@@ -750,6 +766,7 @@ static const struct snd_soc_dai_ops intel_pcm_dai_ops = {static const struct snd_soc_dai_ops intel_pdm_dai_ops = { .hw_params = intel_hw_params, + .prepare = intel_prepare, .hw_free = intel_hw_free, .shutdown = intel_shutdown, .set_sdw_stream = intel_pdm_set_sdw_stream,
Signature · 1 line
2.20.1
Re: [PATCH 10/14] soundwire: intel: add prepare support in sdw dai driver
Quoted 6 lines · Pierre-Louis Bossart
From: Rander Wang <[email protected]>
It gets sdw runtime information from dai to prepare stream.
Signed-off-by Rander Wang <[email protected]>Signed-off-by Pierre-Louis Bossart <[email protected]>
While the patch looks good, the commit message is questionable. You may simply state why it is added only just now. Judging from the commit title, it has been added to make the sdw dai driver interface complete.
Czarek
Re: [PATCH 10/14] soundwire: intel: add prepare support in sdw dai driver
Quoted 9 lines · Cezary Rojewski
Quoted 6 lines · Pierre-Louis Bossart
From: Rander Wang <[email protected]>
It gets sdw runtime information from dai to prepare stream.
Signed-off-by Rander Wang <[email protected]>Signed-off-by Pierre-Louis Bossart <[email protected]>While the patch looks good, the commit message is questionable. You may simply state why it is added only just now. Judging from the commit title, it has been added to make the sdw dai driver interface complete.
The commit message is not great but it's not wrong either...
Vinod Koul
maintainerRe: [PATCH 10/14] soundwire: intel: add prepare support in sdw dai driver
Quoted 12 lines · Pierre-Louis Bossart
Quoted 9 lines · Cezary Rojewski
Quoted 7 lines · Pierre-Louis Bossart
From: Rander Wang <[email protected]>
It gets sdw runtime information from dai to prepare stream.
Signed-off-by Rander Wang <[email protected]>Signed-off-by Pierre-Louis Bossart
Quoted 5 lines
Quoted 3 lines
While the patch looks good, the commit message is questionable. You may simply state why it is added only just now. Judging from the commit title, it has been added to make the sdw dai driver interface complete.
The commit message is not great but it's not wrong either...
And it doesn't harm to elaborate and explain things rather than have reviewer play detective!
Signature · 1 line
~Vinod
PATCH 11/14 soundwire: intel: add trigger support in sdw dai driver
In reply to Pierre-Louis BossartFrom: Rander Wang <[email protected]>
Sdw stream is enabled and disabled in trigger function.
--- drivers/soundwire/intel.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
drivers/soundwire/intel.c +39 -0
@@ -712,6 +712,43 @@ static int intel_prepare(struct snd_pcm_substream *substream,return sdw_prepare_stream (dma->stream); } +static int intel_trigger (struct snd_pcm_substream *substream,int cmd, +struct snd_soc_dai *dai) +{ +struct sdw_cdns_dma_data *dma; +int ret; + + dma =snd_soc_dai_get_dma_data (dai, substream); +if (!dma) { +dev_err (dai->dev,"failed to get dma data in %s" , __func__); +return -EIO ; + } + +switch (cmd) { +case SNDRV_PCM_TRIGGER_START : +case SNDRV_PCM_TRIGGER_PAUSE_RELEASE : +case SNDRV_PCM_TRIGGER_RESUME : + ret =sdw_enable_stream (dma->stream); +break ; + +case SNDRV_PCM_TRIGGER_PAUSE_PUSH : +case SNDRV_PCM_TRIGGER_SUSPEND : +case SNDRV_PCM_TRIGGER_STOP : + ret =sdw_disable_stream (dma->stream); +break ; + +default : + ret = -EINVAL ; +break ; + } + +if (ret) +dev_err (dai->dev, +"%s trigger %d failed: %d" , + __func__, cmd, ret); +return ret; +} +static int intel_hw_free (struct snd_pcm_substream *substream,struct snd_soc_dai *dai) {
@@ -759,6 +796,7 @@ static int intel_pdm_set_sdw_stream(struct snd_soc_dai *dai,static const struct snd_soc_dai_ops intel_pcm_dai_ops = { .hw_params = intel_hw_params, .prepare = intel_prepare, + .trigger = intel_trigger, .hw_free = intel_hw_free, .shutdown = intel_shutdown, .set_sdw_stream = intel_pcm_set_sdw_stream,
@@ -767,6 +805,7 @@ static const struct snd_soc_dai_ops intel_pcm_dai_ops = {static const struct snd_soc_dai_ops intel_pdm_dai_ops = { .hw_params = intel_hw_params, .prepare = intel_prepare, + .trigger = intel_trigger, .hw_free = intel_hw_free, .shutdown = intel_shutdown, .set_sdw_stream = intel_pdm_set_sdw_stream,
Signature · 1 line
2.20.1
PATCH 12/14 soundwire: intel: add sdw_stream_setup helper for .startup callback
In reply to Pierre-Louis BossartFrom: Rander Wang <[email protected]>
The sdw stream is allocated and stored in dai to share the sdw runtime information.
--- drivers/soundwire/intel.c | 65 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+)
drivers/soundwire/intel.c +65 -0
@@ -615,6 +615,69 @@ static int intel_post_bank_switch(struct sdw_bus *bus)* DAI routines */ +static int sdw_stream_setup (struct snd_pcm_substream *substream, +struct snd_soc_dai *dai) +{ +struct snd_soc_pcm_runtime *rtd = substream->private_data; +struct sdw_stream_runtime *sdw_stream =NULL ; +char *name; +int i, ret; + + name =kzalloc (32 ,GFP_KERNEL ); +if (!name) +return -ENOMEM ; + +if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) +snprintf (name,32 ,"%s-Playback" , dai->name); +else +snprintf (name,32 ,"%s-Capture" , dai->name); + + sdw_stream =sdw_alloc_stream (name); +if (!sdw_stream) { +dev_err (dai->dev,"alloc stream failed for DAI %s" , dai->name); + ret = -ENOMEM ; + goto error; + } + +/* Set stream pointer on CPU DAI */ + ret =snd_soc_dai_set_sdw_stream (dai, sdw_stream, substream->stream); +if (ret <0 ) { +dev_err (dai->dev,"failed to set stream pointer on cpu dai %s" , + dai->name); + goto release_stream; + } + +/* Set stream pointer on all CODEC DAIs */ +for (i =0 ; i < rtd->num_codecs; i++) { + ret =snd_soc_dai_set_sdw_stream (rtd->codec_dais[i], sdw_stream, + substream->stream); +if (ret <0 ) { +dev_err (dai->dev,"failed to set stream pointer on codec dai %s" , + rtd->codec_dais[i]->name); + goto release_stream; + } + } + +return 0 ; + +release_stream: +sdw_release_stream (sdw_stream); +error: +kfree (name); +return ret; +} + +static int intel_startup (struct snd_pcm_substream *substream, +struct snd_soc_dai *dai) +{ +/* +* TODO: add pm_runtime support here, the startup callback +* will make sure the IP is 'active' +*/ + +return sdw_stream_setup (substream, dai); +} +static int intel_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params,struct snd_soc_dai *dai)
@@ -794,6 +857,7 @@ static int intel_pdm_set_sdw_stream(struct snd_soc_dai *dai, }static const struct snd_soc_dai_ops intel_pcm_dai_ops = { + .startup = intel_startup, .hw_params = intel_hw_params, .prepare = intel_prepare, .trigger = intel_trigger,
@@ -803,6 +867,7 @@ static const struct snd_soc_dai_ops intel_pcm_dai_ops = { };static const struct snd_soc_dai_ops intel_pdm_dai_ops = { + .startup = intel_startup, .hw_params = intel_hw_params, .prepare = intel_prepare, .trigger = intel_trigger,
Signature · 1 line
2.20.1
PATCH 13/14 soundwire: intel: free all resources on hw_free()
In reply to Pierre-Louis BossartMake sure all calls to the SoundWire stream API are done and involve callback
--- drivers/soundwire/intel.c | 40 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)
drivers/soundwire/intel.c +38 -2
@@ -548,6 +548,25 @@ static int intel_params_stream(struct sdw_intel *sdw,return -EIO ; } +static int intel_free_stream (struct sdw_intel *sdw, +struct snd_pcm_substream *substream, +struct snd_soc_dai *dai, +int link_id) +{ +struct sdw_intel_link_res *res = sdw->link_res; +struct sdw_intel_stream_free_data free_data; + + free_data.substream = substream; + free_data.dai = dai; + free_data.link_id = link_id; + +if (res->ops && res->ops->free_stream && res->dev) +return res->ops->free_stream (res->dev, + &free_data); + +return 0 ; +} +/* * bank switch routines */
@@ -816,6 +835,7 @@ static int intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai); +struct sdw_intel *sdw =cdns_to_intel (cdns);struct sdw_cdns_dma_data *dma;int ret;
@@ -823,12 +843,28 @@ intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)if (!dma)return -EIO ; + ret =sdw_deprepare_stream (dma->stream); +if (ret) { +dev_err (dai->dev,"sdw_deprepare_stream: failed %d" , ret); +return ret; + } + ret =sdw_stream_remove_master (&cdns->bus, dma->stream); -if (ret <0 ) +if (ret <0 ) {dev_err (dai->dev,"remove master from stream %s failed: %d\n" , dma->stream->name, ret); +return ret; + } -return ret; + ret =intel_free_stream (sdw, substream, dai, sdw->instance); +if (ret <0 ) { +dev_err (dai->dev,"intel_free_stream: failed %d" , ret); +return ret; + } + +sdw_release_stream (dma->stream); + +return 0 ; } static void intel_shutdown(struct snd_pcm_substream *substream,
Signature · 1 line
2.20.1
Re: [PATCH 13/14] soundwire: intel: free all resources on hw_free()
Quoted 20 lines · Pierre-Louis Bossart
Make sure all calls to the SoundWire stream API are done and involve callback
Signed-off-by Rander Wang <[email protected]>Signed-off-by Pierre-Louis Bossart <[email protected]>--- drivers/soundwire/intel.c | 40 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)drivers/soundwire/intel.c +3
-0@@ -548,6 +548,25 @@ static int intel_params_stream(struct sdw_intel *sdw,return -EIO ; } +static int intel_free_stream(struct sdw_intel *sdw, + struct snd_pcm_substream *substream, + struct snd_soc_dai *dai,
drivers/soundwire/intel.c static int intel_params_stream(struct sdw_intel *sdw, · line 563
Quoted 10 lines
drivers/soundwire/intel.c +10
-0+ int link_id) +{ +struct sdw_intel_link_res *res = sdw->link_res; +struct sdw_intel_stream_free_data free_data; + + free_data.substream = substream; + free_data.dai = dai; + free_data.link_id = link_id; + +if (res->ops && res->ops->free_stream && res->dev)
Can res->dev even be null?
Quoted 18 lines
drivers/soundwire/intel.c +7
-0+return res->ops->free_stream (res->dev, + &free_data); + +return 0 ; +} +/* * bank switch routines */ @@ -816,6 +835,7 @@ static int intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai); +struct sdw_intel *sdw =cdns_to_intel (cdns);struct sdw_cdns_dma_data *dma;int ret;
drivers/soundwire/intel.c intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) · line 851
Quoted 9 lines
drivers/soundwire/intel.c +6
-0@@ -823,12 +843,28 @@ intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)if (!dma)return -EIO ; + ret =sdw_deprepare_stream (dma->stream); +if (ret) { +dev_err (dai->dev,"sdw_deprepare_stream: failed %d" , ret); +return ret; + } +
I understand that you want to be transparent to caller with failure reasons via dev_err/_warn. However, sdw_deprepare_stream already dumps all the logs we need. The same applies for most of the other calls (and not just in this patch..).
Do we really need to be that verbose? Maybe just agree on caller -or- subject being the source for the messaging, align existing usages and thus preventing further duplication?
Not forcing anything, just asking for your opinion on this.
Quoted 9 lines
drivers/soundwire/intel.c +3
-2ret =sdw_stream_remove_master (&cdns->bus, dma->stream); -if (ret <0 ) +if (ret <0 ) {dev_err (dai->dev,"remove master from stream %s failed: %d\n" , dma->stream->name, ret); +return ret; + } -return ret;
drivers/soundwire/intel.c intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) · line 868
Quoted 10 lines
drivers/soundwire/intel.c +9
-0+ ret =intel_free_stream (sdw, substream, dai, sdw->instance); +if (ret <0 ) { +dev_err (dai->dev,"intel_free_stream: failed %d" , ret); +return ret; + } + +sdw_release_stream (dma->stream); + +return 0 ; }
Given the structure of this function, shouldn't the generic flow be handled by upper layer i.e. part of sdw core?. Apart from intel_free_stream, the rest looks pretty generic to me and this sole call could easily be extracted into ops.
Quoted 3 lines
drivers/soundwire/intel.c +0
-0static void intel_shutdown(struct snd_pcm_substream *substream,
Re: [alsa-devel] [PATCH 13/14] soundwire: intel: free all resources on hw_free()
Quoted 25 lines · Cezary Rojewski
Quoted 24 lines · Pierre-Louis Bossart
Make sure all calls to the SoundWire stream API are done and involve callback
Signed-off-by Rander Wang <[email protected]>Signed-off-by Pierre-Louis Bossart <[email protected]>---
drivers/soundwire/intel.c| 40 +++++++++++++++++++++++++++++++++++++--1 file changed, 38 insertions(+), 2 deletions(-)drivers/soundwire/intel.c +7
-0@@ -548,6 +548,25 @@ static int intel_params_stream(struct sdw_intel *sdw, return -EIO; } +static int intel_free_stream (struct sdw_intel *sdw, + struct snd_pcm_substream *substream, + struct snd_soc_dai *dai, + int link_id) +{ + struct sdw_intel_link_res *res = sdw->link_res; + struct sdw_intel_stream_free_data free_data;
Quoted 8 lines
drivers/soundwire/intel.c static int intel_params_stream(struct sdw_intel *sdw, · line 563
Quoted 6 lines
drivers/soundwire/intel.c +6
-0+ + free_data.substream = substream; + free_data.dai = dai; + free_data.link_id = link_id; + + if (res->ops && res->ops->free_stream && res->dev)Can
res->deveven be null?
in error cases yes. this 'res' structure is setup by the DSP driver, and it could be wrong or not set.
Note that in the previous solution we tested the res->arg pointer, we did find a case where we could oops here.
Quoted 30 lines
Quoted 18 lines
drivers/soundwire/intel.c +7
-0+ return res->ops->free_stream(res->dev, + &free_data); + + return 0; +} + /** bank switch routines */ @@ -816,6 +835,7 @@ static int intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai); + struct sdw_intel *sdw = cdns_to_intel(cdns); struct sdw_cdns_dma_data *dma; int ret;drivers/soundwire/intel.c intel_hw_free(struct snd_pcm_substream · line 851
Quoted 9 lines
drivers/soundwire/intel.c +6
-0@@ -823,12 +843,28 @@ intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) if (!dma) return -EIO; + ret = sdw_deprepare_stream(dma->stream); + if (ret) { + dev_err(dai->dev, "sdw_deprepare_stream: failed %d", ret); + return ret; + } +I understand that you want to be transparent to caller with failure reasons via dev_err/_warn. However,
sdw_deprepare_streamalready dumps all the logs we need. The same applies for most of the other calls (and not just in this patch..).
Quoted 3 lines
Do we really need to be that verbose? Maybe just agree on caller -or- subject being the source for the messaging, align existing usages and thus preventing further duplication?
Not forcing anything, just asking for your opinion on this.
the sdw_prepare/deprepare_stream calls provide error logs, but they are not mapped to specific devices/dais (pr_err vs. dev_dbg). I found it was easier to check for which dai the error was reported.
We are also in the middle of integration with new hardware/boards, and erring on the side of more traces will help everyone involved. We can revisit later which ones are strictly necessary.
Quoted 13 lines
Quoted 13 lines
drivers/soundwire/intel.c +7
-2ret = sdw_stream_remove_master(&cdns->bus, dma->stream); - if (ret < 0) + if (ret < 0) { dev_err(dai->dev, "remove master from stream %s failed: %d\n", dma->stream->name, ret); + return ret; + } - return ret; + ret = intel_free_stream(sdw, substream, dai, sdw->instance); + if (ret < 0) { + dev_err(dai->dev, "intel_free_stream: failed %d", ret); + return ret;
Quoted 8 lines
drivers/soundwire/intel.c intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) · line 868
Quoted 6 lines
drivers/soundwire/intel.c +5
-0+ } + + sdw_release_stream(dma->stream); + + return 0; }Given the structure of this function, shouldn't the generic flow be handled by upper layer i.e. part of sdw core?. Apart from
intel_free_stream, the rest looks pretty generic to me and this sole call could easily be extracted into ops.
The mapping between DAI and stream is not necessarily the same for all platforms, we just had this discussion while reviewing the QCOM patches last week. whether you release the resources in .hw_free() or .shutdown() is also platform dependent.
Also this code will change when we support the multi-CPU dais, more work will be handled at the dailink level than at the dai. We can (and will) refactor at a later point.
Vinod Koul
maintainerRe: [alsa-devel] [PATCH 13/14] soundwire: intel: free all resources on hw_free()
Quoted 17 lines · Pierre-Louis Bossart
Quoted 16 lines · Cezary Rojewski
Quoted 15 lines · Pierre-Louis Bossart
(quoted diff) +0
-0@@ -816,6 +835,7 @@ static int
intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
{
structsdw_cdns*cdns =snd_soc_dai_get_drvdata(dai); + structsdw_intel*sdw =cdns_to_intel(cdns); structsdw_cdns_dma_data*dma;
int ret;drivers/soundwire/intel.c +3
-0@@ -823,12 +843,28 @@ intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) if (!dma) return -EIO; + ret = sdw_deprepare_stream(dma->stream); + if (ret) { + dev_err(dai->dev, "sdw_deprepare_stream: failed %d", ret);
Quoted 8 lines
Quoted 8 lines
drivers/soundwire/intel.c intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) · line 851
Quoted 3 lines
drivers/soundwire/intel.c +3
-0+ return ret; + } +I understand that you want to be transparent to caller with failure reasons via dev_err/_warn. However,
sdw_deprepare_streamalready dumps all the logs we need. The same applies for most of the other calls (and not just in this patch..).
I think this is a valid concern! In linux we do not do that, for example we ask people to not log errors on kmalloc as it will be logged on failures so drivers do not need to do that.
Quoted 9 lines
Quoted 5 lines
Do we really need to be that verbose? Maybe just agree on caller -or- subject being the source for the messaging, align existing usages and thus preventing further duplication?
Not forcing anything, just asking for your opinion on this.
the sdw_prepare/deprepare_stream calls provide error logs, but they are not mapped to specific devices/dais (
pr_errvs.dev_dbg). I found it was easier to check for which dai the error was reported.
Well in that case we should fix pr_err, there are only 17 instances of these in core, and few of them are justified in core (no dev pointer) and 11 in stream (few of them valid (no stream pointer) but rest can be converted to use dev_err! Even then they print stream name, so checking error is not justified argument!
Quoted 3 lines
We are also in the middle of integration with new hardware/boards, and erring on the side of more traces will help everyone involved. We can revisit later which ones are strictly necessary.
Naah you are having duplicate logs, it does *not* help in debug seems 1000 line logs and few lines conveying duplicate info, I would rather have each line unique so that I dont have to skip duplicate ones while debugging!
Signature · 1 line
~Vinod
Re: [alsa-devel] [PATCH 13/14] soundwire: intel: free all resources on hw_free()
Quoted 41 lines · Vinod Koul
Quoted 17 lines · Pierre-Louis Bossart
Quoted 16 lines · Cezary Rojewski
Quoted 15 lines · Pierre-Louis Bossart
drivers/soundwire/intel.c +4
-0@@ -816,6 +835,7 @@ static int intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai); + struct sdw_intel *sdw = cdns_to_intel(cdns); struct sdw_cdns_dma_data *dma; int ret;@@ -823,12 +843,28 @@ intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) if (!dma) return -EIO; + ret = sdw_deprepare_stream(dma->stream); + if (ret) { + dev_err(dai->dev, "sdw_deprepare_stream: failed %d", ret);Quoted 8 lines
Quoted 8 lines
drivers/soundwire/intel.c intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) · line 851
Quoted 3 lines
drivers/soundwire/intel.c +3
-0+ return ret; + } +I understand that you want to be transparent to caller with failure reasons via dev_err/_warn. However,
sdw_deprepare_streamalready dumps all the logs we need. The same applies for most of the other calls (and not just in this patch..).I think this is a valid concern! In linux we do not do that, for example we ask people to not log errors on kmalloc as it will be logged on failures so drivers do not need to do that.
Quoted 9 lines
Quoted 5 lines
Do we really need to be that verbose? Maybe just agree on caller -or- subject being the source for the messaging, align existing usages and thus preventing further duplication?
Not forcing anything, just asking for your opinion on this.
the sdw_prepare/deprepare_stream calls provide error logs, but they are not mapped to specific devices/dais (
pr_errvs.dev_dbg). I found it was easier to check for which dai the error was reported.
Quoted 5 lines
Well in that case we should fix
pr_err, there are only 17 instances of these in core, and few of them are justified in core (no dev pointer) and 11 in stream (few of them valid (no stream pointer) but rest can be converted to usedev_err! Even then they print stream name, so checking error is not justified argument!
the stream has no notion of device, it can be made of multiple devices, so which one would you choose?
Quoted 9 lines
Quoted 4 lines
We are also in the middle of integration with new hardware/boards, and erring on the side of more traces will help everyone involved. We can revisit later which ones are strictly necessary.
Naah you are having duplicate logs, it does *not* help in debug seems 1000 line logs and few lines conveying duplicate info, I would rather have each line unique so that I dont have to skip duplicate ones while debugging!
They are not all duplicates.
Again, if I remove the logs in stream.c, then I do lose valuable information on bad state machines transitions, etc. An error code is not enough to reconstruct the issues from intel.c
If I remove the logs in intel.c, I can't know which dai had an error and what caused it.
seriously, these are all details, you have over 50 patches to review with a complete rework of this subsystem and we argue about dev_err verbosity?
PATCH 14/14 soundwire: intel_init: add implementation of sdw_intel_enable_irq()
In reply to Pierre-Louis BossartThis function is required to enable all interrupts across all links.
--- drivers/soundwire/intel_init.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/soundwire/intel_init.c +24 -0
@@ -137,6 +137,30 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info)return 0 ; } +#define HDA_DSP_REG_ADSPIC2 (0x10) +#define HDA_DSP_REG_ADSPIS2 (0x14) +#define HDA_DSP_REG_ADSPIC2_SNDW BIT(5) + +/** +* sdw_intel_enable_irq() - enable/disable Intel SoundWire IRQ +* @mmio_base: The mmio base of the control register +* @enable: true if enable +*/ +void sdw_intel_enable_irq (void __iomem *mmio_base,bool enable) +{ +u32 val; + + val =readl (mmio_base +HDA_DSP_REG_ADSPIC2 ); + +if (enable) + val |=HDA_DSP_REG_ADSPIC2_SNDW ; +else + val &= ~HDA_DSP_REG_ADSPIC2_SNDW ; + +writel (val, mmio_base +HDA_DSP_REG_ADSPIC2 ); +} +EXPORT_SYMBOL (sdw_intel_enable_irq); +static struct sdw_intel_ctx *sdw_intel_probe_controller (struct sdw_intel_res *res) {
Signature · 1 line
2.20.1