Skip to contentSkip to conversation

soundwire: configure block packing mode with new

PATCH Applied Bard Liao 2 participants 4 messages Mar 23, 2021 – Mar 30, 2021 SoundWire

lore
Share & tools
lore

Bard Liao

author maintainer
#0 lore raw

cover soundwire: configure block packing mode with new

The existing code multiply a channel number by zero (SDW_BLK_GRP_CNT_1), and the result is used to configure the block packing mode. Sampling grouping and channel packing are two separate concepts in SoundWire.

In addition, the bandwidth allocation allocates a vertical slice for each stream, which makes the use of the PER_CHANNEL packing mode irrelevant.

Let's use the proper definition for block packing mode (PER_PORT).

This change has no functional impact though since the net result is the same configuration of the DPN_BlockCtrl3 register, when implemented.

Pierre-Louis Bossart (2):
soundwire: add definition for DPn BlockPackingMode
soundwire: generic_allocation: fix confusion between group and packing

 drivers/soundwire/generic_bandwidth_allocation.c | 7 +++----
 include/linux/soundwire/sdw.h                    | 6 ++++++
 2 files changed, 9 insertions(+), 4 deletions(-)
Signature · 1 line
2.17.1
author maintainer
#1 lore raw

PATCH 1/2 soundwire: add definition for DPn BlockPackingMode

From: Pierre-Louis Bossart <[email protected]>

For some reason we don't have an enum for this concept. Add definitions following Table 102 of the SoundWire 1.2 specification.

---
 include/linux/soundwire/sdw.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/soundwire/sdw.h +6 -0
index eaa1486bdca9..350436db6ddb 100644
@@ -125,6 +125,12 @@ enum sdw_dpn_grouping {
 	SDW_BLK_GRP_CNT_4 = 3,
 };
 
+/* block packing mode enum */
+enum sdw_dpn_pkg_mode {
+	SDW_BLK_PKG_PER_PORT = 0,
+	SDW_BLK_PKG_PER_CHANNEL = 1
+};
+
 /**
  * enum sdw_stream_type: data stream type
  *
Signature · 1 line
2.17.1
author maintainer
#2 lore raw

PATCH 2/2 soundwire: generic_allocation: fix confusion between group and packing

In reply to Bard Liao

From: Pierre-Louis Bossart <[email protected]>

The existing code makes no sense, we multiply a channel number by zero (SDW_BLK_GRP_CNT_1), and the result is used to configure the block packing mode. Sampling grouping and channel packing are two separate concepts in SoundWire.

In addition, the bandwidth allocation allocates a vertical slice for each stream, which makes the use of the PER_CHANNEL packing mode irrelevant.

Let's use the proper definition for block packing mode (PER_PORT).

This change has no functional impact though since the net result is the same configuration of the DPN_BlockCtrl3 register, when implemented.

---
 drivers/soundwire/generic_bandwidth_allocation.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/soundwire/generic_bandwidth_allocation.c +3 -4
index 0bdef38c9a30..0d1b8ee02713 100644
@@ -62,7 +62,7 @@ static void sdw_compute_slave_ports(struct sdw_master_runtime *m_rt,
 					      sample_int, port_bo, port_bo >> 8,
 					      t_data->hstart,
 					      t_data->hstop,
-					      (SDW_BLK_GRP_CNT_1 * ch), 0x0);
+					      SDW_BLK_PKG_PER_PORT, 0x0);
 
 			sdw_fill_port_params(&p_rt->port_params,
 					     p_rt->num, bps,
@@ -95,7 +95,7 @@ static void sdw_compute_master_ports(struct sdw_master_runtime *m_rt,
 	struct sdw_bus *bus = m_rt->bus;
 	struct sdw_bus_params *b_params = &bus->params;
 	int sample_int, hstart = 0;
-	unsigned int rate, bps, ch, no_ch;
+	unsigned int rate, bps, ch;
 
 	rate = m_rt->stream->params.rate;
 	bps = m_rt->stream->params.bps;
@@ -110,12 +110,11 @@ static void sdw_compute_master_ports(struct sdw_master_runtime *m_rt,
 	t_data.hstart = hstart;
 
 	list_for_each_entry(p_rt, &m_rt->port_list, port_node) {
-		no_ch = sdw_ch_mask_to_ch(p_rt->ch_mask);
 
 		sdw_fill_xport_params(&p_rt->transport_params, p_rt->num,
 				      false, SDW_BLK_GRP_CNT_1, sample_int,
 				      port_bo, port_bo >> 8, hstart, hstop,
-				      (SDW_BLK_GRP_CNT_1 * no_ch), 0x0);
+				      SDW_BLK_PKG_PER_PORT, 0x0);
 
 		sdw_fill_port_params(&p_rt->port_params,
 				     p_rt->num, bps,
Signature · 1 line
2.17.1
maintainer Applied
#3 lore raw
In reply to Bard Liao
Quoted 4 lines · Bard Liao

The existing code multiply a channel number by zero (SDW_BLK_GRP_CNT_1), and the result is used to configure the block packing mode. Sampling grouping and channel packing are two separate concepts in SoundWire.

Quoted 8 lines

In addition, the bandwidth allocation allocates a vertical slice for each stream, which makes the use of the PER_CHANNEL packing mode irrelevant.

Let's use the proper definition for block packing mode (PER_PORT).

This change has no functional impact though since the net result is the same configuration of the DPN_BlockCtrl3 register, when implemented.

Applied, thanks

Signature · 1 line
~Vinod