soundwire: add flag to ignore all command/control for mockup devices

SoundWire mockup devices don't take part in the command/control
protocol, so all commands will complete with -ENODATA or
Command_Ignored results. With a flag, we can suppress such errors in
the bus management and make it appear as if all read/writes succeed.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20210714032209.11284-7-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
Pierre-Louis Bossart 2021-07-14 11:22:05 +08:00 committed by Vinod Koul
parent e6645314eb
commit 4a7a603cad
2 changed files with 5 additions and 0 deletions

View File

@ -661,6 +661,8 @@ struct sdw_slave_ops {
* initialized * initialized
* @first_interrupt_done: status flag tracking if the interrupt handling * @first_interrupt_done: status flag tracking if the interrupt handling
* for a Slave happens for the first time after enumeration * for a Slave happens for the first time after enumeration
* @is_mockup_device: status flag used to squelch errors in the command/control
* protocol for SoundWire mockup devices
*/ */
struct sdw_slave { struct sdw_slave {
struct sdw_slave_id id; struct sdw_slave_id id;
@ -683,6 +685,7 @@ struct sdw_slave {
struct completion initialization_complete; struct completion initialization_complete;
u32 unattach_request; u32 unattach_request;
bool first_interrupt_done; bool first_interrupt_done;
bool is_mockup_device;
}; };
#define dev_to_sdw_dev(_dev) container_of(_dev, struct sdw_slave, dev) #define dev_to_sdw_dev(_dev) container_of(_dev, struct sdw_slave, dev)

View File

@ -263,6 +263,8 @@ static int sdw_mockup_sdw_probe(struct sdw_slave *slave,
dev_set_drvdata(dev, sdw_mockup); dev_set_drvdata(dev, sdw_mockup);
sdw_mockup->slave = slave; sdw_mockup->slave = slave;
slave->is_mockup_device = true;
ret = devm_snd_soc_register_component(dev, ret = devm_snd_soc_register_component(dev,
&snd_soc_sdw_mockup_component, &snd_soc_sdw_mockup_component,
sdw_mockup_dai, sdw_mockup_dai,