diff mbox series

[RFC,11/16] soundwire: intel_auxdevice: add indirection for BPT open/close/send_async/wait

Message ID 20231207222944.663893-12-pierre-louis.bossart@linux.intel.com (mailing list archive)
State RFC
Headers show
Series soundwire/ASoC: speed-up downloads with BTP/BRA protocol | expand

Commit Message

Pierre-Louis Bossart Dec. 7, 2023, 10:29 p.m. UTC
Mirror abstraction added for master ops.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 drivers/soundwire/intel_auxdevice.c | 55 +++++++++++++++++++++++++++++
 include/linux/soundwire/sdw_intel.h | 16 +++++++++
 2 files changed, 71 insertions(+)
diff mbox series

Patch

diff --git a/drivers/soundwire/intel_auxdevice.c b/drivers/soundwire/intel_auxdevice.c
index 93698532deac..1cdf4699cf2a 100644
--- a/drivers/soundwire/intel_auxdevice.c
+++ b/drivers/soundwire/intel_auxdevice.c
@@ -74,6 +74,56 @@  static bool is_wake_capable(struct sdw_slave *slave)
 	return false;
 }
 
+static int generic_bpt_stream_open(struct sdw_bus *bus,
+				   struct sdw_slave *slave,
+				   enum sdw_bpt_type mode,
+				   struct sdw_bpt_msg *msg)
+{
+	struct sdw_cdns *cdns = bus_to_cdns(bus);
+	struct sdw_intel *sdw = cdns_to_intel(cdns);
+
+	if (sdw->link_res->hw_ops->bpt_open_stream)
+		return sdw->link_res->hw_ops->bpt_open_stream(sdw, slave, mode, msg);
+	return -ENOTSUPP;
+}
+
+static int generic_bpt_stream_close(struct sdw_bus *bus,
+				    struct sdw_slave *slave,
+				    enum sdw_bpt_type mode,
+				    struct sdw_bpt_msg *msg)
+{
+	struct sdw_cdns *cdns = bus_to_cdns(bus);
+	struct sdw_intel *sdw = cdns_to_intel(cdns);
+
+	if (sdw->link_res->hw_ops->bpt_close_stream)
+		return sdw->link_res->hw_ops->bpt_close_stream(sdw, slave, mode, msg);
+	return -ENOTSUPP;
+}
+
+static int generic_bpt_send_async(struct sdw_bus *bus,
+				  struct sdw_slave *slave,
+				  struct sdw_bpt_msg *msg)
+{
+	struct sdw_cdns *cdns = bus_to_cdns(bus);
+	struct sdw_intel *sdw = cdns_to_intel(cdns);
+
+	if (sdw->link_res->hw_ops->bpt_send_async)
+		return sdw->link_res->hw_ops->bpt_send_async(sdw, slave, msg);
+	return -ENOTSUPP;
+}
+
+static int generic_bpt_wait(struct sdw_bus *bus,
+			    struct sdw_slave *slave,
+			    struct sdw_bpt_msg *msg)
+{
+	struct sdw_cdns *cdns = bus_to_cdns(bus);
+	struct sdw_intel *sdw = cdns_to_intel(cdns);
+
+	if (sdw->link_res->hw_ops->bpt_wait)
+		return sdw->link_res->hw_ops->bpt_wait(sdw, slave, msg);
+	return -ENOTSUPP;
+}
+
 static int generic_pre_bank_switch(struct sdw_bus *bus)
 {
 	struct sdw_cdns *cdns = bus_to_cdns(bus);
@@ -203,6 +253,11 @@  static struct sdw_master_ops sdw_intel_ops = {
 	.get_device_num =  intel_get_device_num_ida,
 	.put_device_num = intel_put_device_num_ida,
 	.new_peripheral_assigned = generic_new_peripheral_assigned,
+
+	.bpt_open_stream = generic_bpt_stream_open,
+	.bpt_close_stream = generic_bpt_stream_close,
+	.bpt_send_async = generic_bpt_send_async,
+	.bpt_wait = generic_bpt_wait,
 };
 
 /*
diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/sdw_intel.h
index 00bb22d96ae5..9e114df37a5b 100644
--- a/include/linux/soundwire/sdw_intel.h
+++ b/include/linux/soundwire/sdw_intel.h
@@ -423,6 +423,22 @@  struct sdw_intel_hw_ops {
 	bool (*sync_check_cmdsync_unlocked)(struct sdw_intel *sdw);
 
 	void (*program_sdi)(struct sdw_intel *sdw, int dev_num);
+
+	int (*bpt_open_stream)(struct sdw_intel *sdw,
+			       struct sdw_slave *slave,
+			       enum sdw_bpt_type mode,
+			       struct sdw_bpt_msg *msg);
+	int (*bpt_close_stream)(struct sdw_intel *sdw,
+				struct sdw_slave *slave,
+				enum sdw_bpt_type mode,
+				struct sdw_bpt_msg *msg);
+	int (*bpt_send_async)(struct sdw_intel *sdw,
+			      struct sdw_slave *slave,
+			      struct sdw_bpt_msg *msg);
+	int (*bpt_wait)(struct sdw_intel *sdw,
+			struct sdw_slave *slave,
+			struct sdw_bpt_msg *msg);
+
 };
 
 extern const struct sdw_intel_hw_ops sdw_intel_cnl_hw_ops;