* [PATCH v6 1/4] ASoC: dt-bindings: wcd937x-sdw: Add static channel mapping support
2025-02-06 11:22 [PATCH v6 0/4] Add static channel mapping between soundwire master and slave Mohammad Rafi Shaik
@ 2025-02-06 11:22 ` Mohammad Rafi Shaik
2025-02-06 11:22 ` [PATCH v6 2/4] ASoC: codecs: wcd937x: Add static channel mapping support in wcd937x-sdw Mohammad Rafi Shaik
` (4 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Mohammad Rafi Shaik @ 2025-02-06 11:22 UTC (permalink / raw)
To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Vinod Koul, Bard Liao,
Jaroslav Kysela, Takashi Iwai
Cc: Pierre-Louis Bossart, Sanyog Kale, linux-arm-msm, linux-sound,
devicetree, linux-kernel, quic_pkumpatl, kernel,
Mohammad Rafi Shaik, Krzysztof Kozlowski
Add static channel mapping between master and slave rx/tx ports for
Qualcomm wcd937x soundwire codec.
Currently, the channel map index value for each soundwire port is
hardcoded in the wcd937x-sdw driver, and the same channel map index
value is configured in the soundwire master.
The Qualcomm board like the QCM6490-IDP require static channel map
settings for the soundwire master and slave ports.
If another boards which are using enable wcd937x, the channel mapping
index values between master and slave may be different depending on the
board hw design and requirements. If the above properties are not used
in a SoC specific device tree, the channel mapping index values are set
to default.
With the introduction of the following channel mapping properties, it is
now possible to configure the master channel mapping directly from the
device tree.
The qcom,tx-channel-mapping property specifies the static channel mapping
between the slave and master tx ports in the order of slave port channels
which is adc1, adc2, adc3, adc4, dmic0, dmic1, mbhc, dmic2, dmic3, dmci4,
dmic5, dmic6, dmic7.
The qcom,rx-channel-mapping property specifies the static channel mapping
between the slave and master rx ports in the order of slave port channels
which is hph_l, hph_r, clsh, comp_l, comp_r, lo, dsd_r, dsd_l.
Signed-off-by: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
.../bindings/sound/qcom,wcd937x-sdw.yaml | 36 +++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/qcom,wcd937x-sdw.yaml b/Documentation/devicetree/bindings/sound/qcom,wcd937x-sdw.yaml
index d3cf8f59cb23..c8543f969ebb 100644
--- a/Documentation/devicetree/bindings/sound/qcom,wcd937x-sdw.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,wcd937x-sdw.yaml
@@ -58,6 +58,40 @@ properties:
items:
enum: [1, 2, 3, 4, 5]
+ qcom,tx-channel-mapping:
+ description: |
+ Specifies static channel mapping between slave and master tx port
+ channels.
+ In the order of slave port channels which is adc1, adc2, adc3,
+ dmic0, dmic1, mbhc, dmic2, dmic3, dmci4, dmic5, dmic6, dmic7.
+ $ref: /schemas/types.yaml#/definitions/uint8-array
+ minItems: 12
+ maxItems: 12
+ additionalItems: false
+ items:
+ enum:
+ - 1 # WCD9370_SWRM_CH1
+ - 2 # WCD9370_SWRM_CH2
+ - 3 # WCD9370_SWRM_CH3
+ - 4 # WCD9370_SWRM_CH4
+
+ qcom,rx-channel-mapping:
+ description: |
+ Specifies static channels mapping between slave and master rx port
+ channels.
+ In the order of slave port channels, which is
+ hph_l, hph_r, clsh, comp_l, comp_r, lo, dsd_r, dsd_l.
+ $ref: /schemas/types.yaml#/definitions/uint8-array
+ minItems: 8
+ maxItems: 8
+ additionalItems: false
+ items:
+ enum:
+ - 1 # WCD9370_SWRM_CH1
+ - 2 # WCD9370_SWRM_CH2
+ - 3 # WCD9370_SWRM_CH3
+ - 4 # WCD9370_SWRM_CH4
+
required:
- compatible
- reg
@@ -74,6 +108,7 @@ examples:
compatible = "sdw20217010a00";
reg = <0 4>;
qcom,rx-port-mapping = <1 2 3 4 5>;
+ qcom,rx-channel-mapping = /bits/ 8 <1 2 1 1 2 1 1 2>;
};
};
@@ -85,6 +120,7 @@ examples:
compatible = "sdw20217010a00";
reg = <0 3>;
qcom,tx-port-mapping = <2 2 3 4>;
+ qcom,tx-channel-mapping = /bits/ 8 <1 2 1 1 2 3 3 4 1 2 3 4>;
};
};
--
2.34.1
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH v6 2/4] ASoC: codecs: wcd937x: Add static channel mapping support in wcd937x-sdw
2025-02-06 11:22 [PATCH v6 0/4] Add static channel mapping between soundwire master and slave Mohammad Rafi Shaik
2025-02-06 11:22 ` [PATCH v6 1/4] ASoC: dt-bindings: wcd937x-sdw: Add static channel mapping support Mohammad Rafi Shaik
@ 2025-02-06 11:22 ` Mohammad Rafi Shaik
2025-02-06 11:22 ` [PATCH v6 3/4] soundwire: qcom: Add set_channel_map api support Mohammad Rafi Shaik
` (3 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Mohammad Rafi Shaik @ 2025-02-06 11:22 UTC (permalink / raw)
To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Vinod Koul, Bard Liao,
Jaroslav Kysela, Takashi Iwai
Cc: Pierre-Louis Bossart, Sanyog Kale, linux-arm-msm, linux-sound,
devicetree, linux-kernel, quic_pkumpatl, kernel,
Mohammad Rafi Shaik
Add static channel mapping between master and slave ports in wcd937x-sdw
driver.
Currently, the channel mask for each soundwire port is hardcoded in the
wcd937x-sdw driver, and the same channel mask value is configured in the
soundwire master.
The Qualcomm boards like the QCM6490-IDP require different channel mask
settings for the soundwire master and slave ports.
Implemented logic to read TX/RX channel mappings from device tree
properties (qcom,tx-channel-mapping and qcom,rx-channel-mapping).
Modified the wcd937x_connect_port to handle master channel masks during
port enable/disable operations.
Added wcd937x_get_channel_map api to retrieve the current master
channel map for TX and RX paths.
Signed-off-by: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
---
sound/soc/codecs/wcd937x-sdw.c | 39 ++++++++++++++++++++++---
sound/soc/codecs/wcd937x.c | 53 ++++++++++++++++++++++++++++++++--
sound/soc/codecs/wcd937x.h | 7 ++++-
3 files changed, 92 insertions(+), 7 deletions(-)
diff --git a/sound/soc/codecs/wcd937x-sdw.c b/sound/soc/codecs/wcd937x-sdw.c
index 0c33f7f3dc25..1fbff313b965 100644
--- a/sound/soc/codecs/wcd937x-sdw.c
+++ b/sound/soc/codecs/wcd937x-sdw.c
@@ -19,7 +19,7 @@
#include <sound/soc.h>
#include "wcd937x.h"
-static const struct wcd937x_sdw_ch_info wcd937x_sdw_rx_ch_info[] = {
+static struct wcd937x_sdw_ch_info wcd937x_sdw_rx_ch_info[] = {
WCD_SDW_CH(WCD937X_HPH_L, WCD937X_HPH_PORT, BIT(0)),
WCD_SDW_CH(WCD937X_HPH_R, WCD937X_HPH_PORT, BIT(1)),
WCD_SDW_CH(WCD937X_CLSH, WCD937X_CLSH_PORT, BIT(0)),
@@ -30,7 +30,7 @@ static const struct wcd937x_sdw_ch_info wcd937x_sdw_rx_ch_info[] = {
WCD_SDW_CH(WCD937X_DSD_R, WCD937X_DSD_PORT, BIT(1)),
};
-static const struct wcd937x_sdw_ch_info wcd937x_sdw_tx_ch_info[] = {
+static struct wcd937x_sdw_ch_info wcd937x_sdw_tx_ch_info[] = {
WCD_SDW_CH(WCD937X_ADC1, WCD937X_ADC_1_PORT, BIT(0)),
WCD_SDW_CH(WCD937X_ADC2, WCD937X_ADC_2_3_PORT, BIT(0)),
WCD_SDW_CH(WCD937X_ADC3, WCD937X_ADC_2_3_PORT, BIT(0)),
@@ -1019,7 +1019,9 @@ static int wcd9370_probe(struct sdw_slave *pdev,
{
struct device *dev = &pdev->dev;
struct wcd937x_sdw_priv *wcd;
- int ret;
+ u8 master_ch_mask[WCD937X_MAX_SWR_CH_IDS];
+ int master_ch_mask_size = 0;
+ int ret, i;
wcd = devm_kzalloc(dev, sizeof(*wcd), GFP_KERNEL);
if (!wcd)
@@ -1048,10 +1050,36 @@ static int wcd9370_probe(struct sdw_slave *pdev,
SDW_SCP_INT1_PARITY;
pdev->prop.lane_control_support = true;
pdev->prop.simple_clk_stop_capable = true;
+
+ memset(master_ch_mask, 0, WCD937X_MAX_SWR_CH_IDS);
+
if (wcd->is_tx) {
- pdev->prop.source_ports = GENMASK(WCD937X_MAX_TX_SWR_PORTS - 1, 0);
+ master_ch_mask_size = of_property_count_u8_elems(dev->of_node,
+ "qcom,tx-channel-mapping");
+
+ if (master_ch_mask_size)
+ ret = of_property_read_u8_array(dev->of_node, "qcom,tx-channel-mapping",
+ master_ch_mask, master_ch_mask_size);
+ } else {
+ master_ch_mask_size = of_property_count_u8_elems(dev->of_node,
+ "qcom,rx-channel-mapping");
+
+ if (master_ch_mask_size)
+ ret = of_property_read_u8_array(dev->of_node, "qcom,rx-channel-mapping",
+ master_ch_mask, master_ch_mask_size);
+ }
+
+ if (ret < 0)
+ dev_info(dev, "Static channel mapping not specified using device channel maps\n");
+
+ if (wcd->is_tx) {
+ pdev->prop.source_ports = GENMASK(WCD937X_MAX_TX_SWR_PORTS, 0);
pdev->prop.src_dpn_prop = wcd937x_dpn_prop;
wcd->ch_info = &wcd937x_sdw_tx_ch_info[0];
+
+ for (i = 0; i < master_ch_mask_size; i++)
+ wcd->ch_info[i].master_ch_mask = WCD937X_SWRM_CH_MASK(master_ch_mask[i]);
+
pdev->prop.wake_capable = true;
wcd->regmap = devm_regmap_init_sdw(pdev, &wcd937x_regmap_config);
@@ -1065,6 +1093,9 @@ static int wcd9370_probe(struct sdw_slave *pdev,
pdev->prop.sink_ports = GENMASK(WCD937X_MAX_SWR_PORTS - 1, 0);
pdev->prop.sink_dpn_prop = wcd937x_dpn_prop;
wcd->ch_info = &wcd937x_sdw_rx_ch_info[0];
+
+ for (i = 0; i < master_ch_mask_size; i++)
+ wcd->ch_info[i].master_ch_mask = WCD937X_SWRM_CH_MASK(master_ch_mask[i]);
}
diff --git a/sound/soc/codecs/wcd937x.c b/sound/soc/codecs/wcd937x.c
index c9d5e67bf66e..e8d3fddbc7b1 100644
--- a/sound/soc/codecs/wcd937x.c
+++ b/sound/soc/codecs/wcd937x.c
@@ -1197,13 +1197,21 @@ static int wcd937x_connect_port(struct wcd937x_sdw_priv *wcd, u8 port_idx, u8 ch
const struct wcd937x_sdw_ch_info *ch_info = &wcd->ch_info[ch_id];
u8 port_num = ch_info->port_num;
u8 ch_mask = ch_info->ch_mask;
+ u8 mstr_port_num, mstr_ch_mask;
+ struct sdw_slave *sdev = wcd->sdev;
port_config->num = port_num;
- if (enable)
+ mstr_port_num = sdev->m_port_map[port_num];
+ mstr_ch_mask = ch_info->master_ch_mask;
+
+ if (enable) {
port_config->ch_mask |= ch_mask;
- else
+ wcd->master_channel_map[mstr_port_num] |= mstr_ch_mask;
+ } else {
port_config->ch_mask &= ~ch_mask;
+ wcd->master_channel_map[mstr_port_num] &= ~mstr_ch_mask;
+ }
return 0;
}
@@ -2689,10 +2697,51 @@ static int wcd937x_codec_set_sdw_stream(struct snd_soc_dai *dai,
return 0;
}
+static int wcd937x_get_channel_map(const struct snd_soc_dai *dai,
+ unsigned int *tx_num, unsigned int *tx_slot,
+ unsigned int *rx_num, unsigned int *rx_slot)
+{
+ struct wcd937x_priv *wcd937x = dev_get_drvdata(dai->dev);
+ struct wcd937x_sdw_priv *wcd = wcd937x->sdw_priv[dai->id];
+ int i;
+
+ switch (dai->id) {
+ case AIF1_PB:
+ if (!rx_slot || !rx_num) {
+ dev_err(dai->dev, "Invalid rx_slot %p or rx_num %p\n",
+ rx_slot, rx_num);
+ return -EINVAL;
+ }
+
+ for (i = 0; i < SDW_MAX_PORTS; i++)
+ rx_slot[i] = wcd->master_channel_map[i];
+
+ *rx_num = i;
+ break;
+ case AIF1_CAP:
+ if (!tx_slot || !tx_num) {
+ dev_err(dai->dev, "Invalid tx_slot %p or tx_num %p\n",
+ tx_slot, tx_num);
+ return -EINVAL;
+ }
+
+ for (i = 0; i < SDW_MAX_PORTS; i++)
+ tx_slot[i] = wcd->master_channel_map[i];
+
+ *tx_num = i;
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
static const struct snd_soc_dai_ops wcd937x_sdw_dai_ops = {
.hw_params = wcd937x_codec_hw_params,
.hw_free = wcd937x_codec_free,
.set_stream = wcd937x_codec_set_sdw_stream,
+ .get_channel_map = wcd937x_get_channel_map,
};
static struct snd_soc_dai_driver wcd937x_dais[] = {
diff --git a/sound/soc/codecs/wcd937x.h b/sound/soc/codecs/wcd937x.h
index 4afa48dcaf74..4ef57c496c37 100644
--- a/sound/soc/codecs/wcd937x.h
+++ b/sound/soc/codecs/wcd937x.h
@@ -489,6 +489,7 @@
#define WCD937X_MAX_MICBIAS 3
#define WCD937X_MAX_BULK_SUPPLY 4
#define WCD937X_MAX_SWR_CH_IDS 15
+#define WCD937X_SWRM_CH_MASK(ch_idx) BIT(ch_idx - 1)
enum wcd937x_tx_sdw_ports {
WCD937X_ADC_1_PORT = 1,
@@ -510,12 +511,14 @@ enum wcd937x_rx_sdw_ports {
struct wcd937x_sdw_ch_info {
int port_num;
unsigned int ch_mask;
+ unsigned int master_ch_mask;
};
#define WCD_SDW_CH(id, pn, cmask) \
[id] = { \
.port_num = pn, \
.ch_mask = cmask, \
+ .master_ch_mask = cmask, \
}
struct wcd937x_priv;
@@ -524,9 +527,11 @@ struct wcd937x_sdw_priv {
struct sdw_stream_config sconfig;
struct sdw_stream_runtime *sruntime;
struct sdw_port_config port_config[WCD937X_MAX_SWR_PORTS];
- const struct wcd937x_sdw_ch_info *ch_info;
+ struct wcd937x_sdw_ch_info *ch_info;
bool port_enable[WCD937X_MAX_SWR_CH_IDS];
+ unsigned int master_channel_map[SDW_MAX_PORTS];
int active_ports;
+ int num_ports;
bool is_tx;
struct wcd937x_priv *wcd937x;
struct irq_domain *slave_irq;
--
2.34.1
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH v6 3/4] soundwire: qcom: Add set_channel_map api support
2025-02-06 11:22 [PATCH v6 0/4] Add static channel mapping between soundwire master and slave Mohammad Rafi Shaik
2025-02-06 11:22 ` [PATCH v6 1/4] ASoC: dt-bindings: wcd937x-sdw: Add static channel mapping support Mohammad Rafi Shaik
2025-02-06 11:22 ` [PATCH v6 2/4] ASoC: codecs: wcd937x: Add static channel mapping support in wcd937x-sdw Mohammad Rafi Shaik
@ 2025-02-06 11:22 ` Mohammad Rafi Shaik
2025-02-10 3:30 ` Jie Gan
2025-06-27 20:59 ` Dan Carpenter
2025-02-06 11:22 ` [PATCH v6 4/4] ASoC: qcom: sdw: Add get and set channel maps support from codec to cpu dais Mohammad Rafi Shaik
` (2 subsequent siblings)
5 siblings, 2 replies; 11+ messages in thread
From: Mohammad Rafi Shaik @ 2025-02-06 11:22 UTC (permalink / raw)
To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Vinod Koul, Bard Liao,
Jaroslav Kysela, Takashi Iwai
Cc: Pierre-Louis Bossart, Sanyog Kale, linux-arm-msm, linux-sound,
devicetree, linux-kernel, quic_pkumpatl, kernel,
Mohammad Rafi Shaik
Added qcom_swrm_set_channel_map api to set the master channel mask for
TX and RX paths based on the provided slots.
Added a new field ch_mask to the qcom_swrm_port_config structure.
This field is used to store the master channel mask, which allows more
flexible to configure channel mask in runtime for specific active
soundwire ports.
Modified the qcom_swrm_port_enable function to configure master
channel mask. If the ch_mask is set to SWR_INVALID_PARAM or is zero,
the function will use the default channel mask.
Signed-off-by: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
---
drivers/soundwire/qcom.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 0f45e3404756..295a46dc2be7 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -156,6 +156,7 @@ struct qcom_swrm_port_config {
u8 word_length;
u8 blk_group_count;
u8 lane_control;
+ u8 ch_mask;
};
/*
@@ -1048,9 +1049,13 @@ static int qcom_swrm_port_enable(struct sdw_bus *bus,
{
u32 reg = SWRM_DP_PORT_CTRL_BANK(enable_ch->port_num, bank);
struct qcom_swrm_ctrl *ctrl = to_qcom_sdw(bus);
+ struct qcom_swrm_port_config *pcfg;
u32 val;
+ pcfg = &ctrl->pconfig[enable_ch->port_num];
ctrl->reg_read(ctrl, reg, &val);
+ if (pcfg->ch_mask != SWR_INVALID_PARAM && pcfg->ch_mask != 0)
+ enable_ch->ch_mask = pcfg->ch_mask;
if (enable_ch->enable)
val |= (enable_ch->ch_mask << SWRM_DP_PORT_CTRL_EN_CHAN_SHFT);
@@ -1270,6 +1275,26 @@ static void *qcom_swrm_get_sdw_stream(struct snd_soc_dai *dai, int direction)
return ctrl->sruntime[dai->id];
}
+static int qcom_swrm_set_channel_map(struct snd_soc_dai *dai,
+ unsigned int tx_num, const unsigned int *tx_slot,
+ unsigned int rx_num, const unsigned int *rx_slot)
+{
+ struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(dai->dev);
+ int i;
+
+ if (tx_slot) {
+ for (i = 0; i < tx_num; i++)
+ ctrl->pconfig[i].ch_mask = tx_slot[i];
+ }
+
+ if (rx_slot) {
+ for (i = 0; i < rx_num; i++)
+ ctrl->pconfig[i].ch_mask = rx_slot[i];
+ }
+
+ return 0;
+}
+
static int qcom_swrm_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
@@ -1306,6 +1331,7 @@ static const struct snd_soc_dai_ops qcom_swrm_pdm_dai_ops = {
.shutdown = qcom_swrm_shutdown,
.set_stream = qcom_swrm_set_sdw_stream,
.get_stream = qcom_swrm_get_sdw_stream,
+ .set_channel_map = qcom_swrm_set_channel_map,
};
static const struct snd_soc_component_driver qcom_swrm_dai_component = {
--
2.34.1
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH v6 3/4] soundwire: qcom: Add set_channel_map api support
2025-02-06 11:22 ` [PATCH v6 3/4] soundwire: qcom: Add set_channel_map api support Mohammad Rafi Shaik
@ 2025-02-10 3:30 ` Jie Gan
2025-05-08 7:18 ` Yongqin Liu
2025-06-27 20:59 ` Dan Carpenter
1 sibling, 1 reply; 11+ messages in thread
From: Jie Gan @ 2025-02-10 3:30 UTC (permalink / raw)
To: Mohammad Rafi Shaik, Srinivas Kandagatla, Liam Girdwood,
Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Vinod Koul, Bard Liao, Jaroslav Kysela, Takashi Iwai
Cc: Pierre-Louis Bossart, Sanyog Kale, linux-arm-msm, linux-sound,
devicetree, linux-kernel, quic_pkumpatl, kernel
On 2/6/2025 7:22 PM, Mohammad Rafi Shaik wrote:
> Added qcom_swrm_set_channel_map api to set the master channel mask for
> TX and RX paths based on the provided slots.
>
> Added a new field ch_mask to the qcom_swrm_port_config structure.
> This field is used to store the master channel mask, which allows more
> flexible to configure channel mask in runtime for specific active
> soundwire ports.
>
> Modified the qcom_swrm_port_enable function to configure master
> channel mask. If the ch_mask is set to SWR_INVALID_PARAM or is zero,
> the function will use the default channel mask.
>
> Signed-off-by: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
> Acked-by: Vinod Koul <vkoul@kernel.org>
> ---
> drivers/soundwire/qcom.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> index 0f45e3404756..295a46dc2be7 100644
> --- a/drivers/soundwire/qcom.c
> +++ b/drivers/soundwire/qcom.c
> @@ -156,6 +156,7 @@ struct qcom_swrm_port_config {
> u8 word_length;
> u8 blk_group_count;
> u8 lane_control;
> + u8 ch_mask;
> };
>
> /*
> @@ -1048,9 +1049,13 @@ static int qcom_swrm_port_enable(struct sdw_bus *bus,
> {
> u32 reg = SWRM_DP_PORT_CTRL_BANK(enable_ch->port_num, bank);
> struct qcom_swrm_ctrl *ctrl = to_qcom_sdw(bus);
> + struct qcom_swrm_port_config *pcfg;
> u32 val;
>
> + pcfg = &ctrl->pconfig[enable_ch->port_num];
> ctrl->reg_read(ctrl, reg, &val);
> + if (pcfg->ch_mask != SWR_INVALID_PARAM && pcfg->ch_mask != 0)
> + enable_ch->ch_mask = pcfg->ch_mask;
>
> if (enable_ch->enable)
> val |= (enable_ch->ch_mask << SWRM_DP_PORT_CTRL_EN_CHAN_SHFT);
> @@ -1270,6 +1275,26 @@ static void *qcom_swrm_get_sdw_stream(struct snd_soc_dai *dai, int direction)
> return ctrl->sruntime[dai->id];
> }
>
> +static int qcom_swrm_set_channel_map(struct snd_soc_dai *dai,
> + unsigned int tx_num, const unsigned int *tx_slot,
> + unsigned int rx_num, const unsigned int *rx_slot)
> +{
> + struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(dai->dev);
> + int i;
> +
> + if (tx_slot) {
> + for (i = 0; i < tx_num; i++)
> + ctrl->pconfig[i].ch_mask = tx_slot[i];
> + }
> +
> + if (rx_slot) {
> + for (i = 0; i < rx_num; i++)
> + ctrl->pconfig[i].ch_mask = rx_slot[i];
> + }
> +
It looks like a hack.
Consider the situation: if(tx_slot) is true and if(rx_slot) is true. So
the ch_mask always overwritten by rx_slot?
> + return 0;
I think you dont need the return value here. Just void is ok.
Thanks,
Jie
> +}
> +
> static int qcom_swrm_startup(struct snd_pcm_substream *substream,
> struct snd_soc_dai *dai)
> {
> @@ -1306,6 +1331,7 @@ static const struct snd_soc_dai_ops qcom_swrm_pdm_dai_ops = {
> .shutdown = qcom_swrm_shutdown,
> .set_stream = qcom_swrm_set_sdw_stream,
> .get_stream = qcom_swrm_get_sdw_stream,
> + .set_channel_map = qcom_swrm_set_channel_map,
> };
>
> static const struct snd_soc_component_driver qcom_swrm_dai_component = {
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH v6 3/4] soundwire: qcom: Add set_channel_map api support
2025-02-10 3:30 ` Jie Gan
@ 2025-05-08 7:18 ` Yongqin Liu
0 siblings, 0 replies; 11+ messages in thread
From: Yongqin Liu @ 2025-05-08 7:18 UTC (permalink / raw)
To: Mohammad Rafi Shaik
Cc: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Vinod Koul, Bard Liao,
Jaroslav Kysela, Takashi Iwai, Pierre-Louis Bossart, Sanyog Kale,
linux-arm-msm, linux-sound, devicetree, linux-kernel,
quic_pkumpatl, kernel, Jie Gan, Sumit Semwal
Hi, Mohammad
On Mon, 10 Feb 2025 at 11:30, Jie Gan <jie.gan@oss.qualcomm.com> wrote:
>
>
>
> On 2/6/2025 7:22 PM, Mohammad Rafi Shaik wrote:
> > Added qcom_swrm_set_channel_map api to set the master channel mask for
> > TX and RX paths based on the provided slots.
> >
> > Added a new field ch_mask to the qcom_swrm_port_config structure.
> > This field is used to store the master channel mask, which allows more
> > flexible to configure channel mask in runtime for specific active
> > soundwire ports.
> >
> > Modified the qcom_swrm_port_enable function to configure master
> > channel mask. If the ch_mask is set to SWR_INVALID_PARAM or is zero,
> > the function will use the default channel mask.
> >
> > Signed-off-by: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
> > Acked-by: Vinod Koul <vkoul@kernel.org>
> > ---
There is one "UBSAN: array index out of bounds" kernel panic reported
by one of our db845c Android builds,
the kernel panic is something like the following:
[ 34.478844][ T12] CPU: 1 UID: 0 PID: 12 Comm: kworker/u32:0
Tainted: G W E 6.15.0-rc5-mainline-g3d5bad71a798-4k #1
PREEMPT 6c0487950a65cef6b999d2d67be1f493cc9d9cb7
[ 34.495133][ T12] Tainted: [W]=WARN, [E]=UNSIGNED_MODULE
[ 34.500663][ T12] Hardware name: Thundercomm Dragonboard 845c (DT)
[ 34.507072][ T12] Workqueue: events_unbound deferred_probe_work_func
[ 34.513667][ T12] pstate: 20400005 (nzCv daif +PAN -UAO -TCO
-DIT -SSBS BTYPE=--)
[ 34.521392][ T12] pc : qcom_swrm_set_channel_map+0x208/0x210
[soundwire_qcom]
[ 34.528776][ T12] lr : snd_soc_dai_set_channel_map+0x50/0x8c
[ 34.534670][ T12] sp : ffffffc0800b3910
[ 34.538715][ T12] x29: ffffffc0800b3910 x28: ffffff808e65d090
x27: ffffffed1b8edec8
[ 34.546622][ T12] x26: ffffffed1b8edec8 x25: ffffff808c579c80
x24: ffffff808c6ff480
[ 34.554527][ T12] x23: 0000000000000002 x22: ffffff808cebea80
x21: ffffff808e639080
[ 34.562433][ T12] x20: ffffff808e63a880 x19: ffffff808cebea80
x18: ffffffc0800b50a0
[ 34.570334][ T12] x17: 00000000e068a532 x16: 00000000e068a532
x15: 00000000035fc49d
[ 34.578241][ T12] x14: 000000003b9243a6 x13: 00000000ec1dbcad
x12: ffffff93e1f38000
[ 34.586145][ T12] x11: 0000009b0000009a x10: 0000008100000080
x9 : 000000000000008e
[ 34.594051][ T12] x8 : ffffff808e463080 x7 : 0000000000000000
x6 : ffffffed1a0779c0
[ 34.601951][ T12] x5 : ffffff808034ba80 x4 : ffffffc0800b3970
x3 : 000000000000000d
[ 34.609857][ T12] x2 : ffffffc0800b3930 x1 : 0000000000000010
x0 : ffffff808cebea80
[ 34.617763][ T12] Call trace:
[ 34.620944][ T12] qcom_swrm_set_channel_map+0x208/0x210
[soundwire_qcom e3a7c79ee66106e972319e98e81c50cf82a5307f] (P)
[ 34.631908][ T12] sdm845_dai_init+0x1d8/0x2f4
[snd_soc_sdm845 1c888555a3e29ffd70a1064d1f53d421696609ba]
[ 34.641644][ T12] snd_soc_link_init+0x48/0x88
[ 34.646314][ T12] snd_soc_bind_card+0x734/0xbc4
[ 34.651157][ T12] snd_soc_register_card+0xf8/0x110
[ 34.656261][ T12] devm_snd_soc_register_card+0x54/0xa0
[ 34.661709][ T12] sdm845_snd_platform_probe+0x13c/0x144
[snd_soc_sdm845 1c888555a3e29ffd70a1064d1f53d421696609ba]
[ 34.672314][ T12] platform_probe+0xa8/0xe8
[ 34.676715][ T12] really_probe+0x11c/0x45c
[ 34.681116][ T12] __driver_probe_device+0xac/0x168
[ 34.686219][ T12] driver_probe_device+0x44/0x1b4
[ 34.691150][ T12] __device_attach_driver+0x108/0x184
[ 34.696426][ T12] bus_for_each_drv+0x114/0x170
[ 34.701183][ T12] __device_attach+0xc8/0x1a8
[ 34.705757][ T12] device_initial_probe+0x1c/0x2c
[ 34.710678][ T12] bus_probe_device+0x9c/0x128
[ 34.715341][ T12] deferred_probe_work_func+0xc8/0x134
[ 34.720706][ T12] process_one_work+0x26c/0x614
[ 34.725462][ T12] worker_thread+0x268/0x3b8
[ 34.729954][ T12] kthread+0x164/0x294
[ 34.733923][ T12] ret_from_fork+0x10/0x20
[ 34.738251][ T12] Code: 39190109 54000061 2a1f03e0 d65f03c0 (d42aa240)
[ 34.745094][ T12] ---[ end trace 0000000000000000 ]---
[ 34.750456][ T12] Kernel panic - not syncing: UBSAN: array
index out of bounds: Fatal exception
[ 34.759398][ T12] SMP: stopping secondary CPUs
[ 34.964362][ T12] Kernel Offset: 0x2c99200000 from 0xffffffc080000000
[ 34.971037][ T12] PHYS_OFFSET: 0x80000000
[ 34.975258][ T12] CPU features: 0x0000,00000248,01002650,8200721b
[ 34.981581][ T12] Memory Limit: none
With my investigation, IIUC, it seems related to the following tree variables:
#define QCOM_SDW_MAX_PORTS 14
#define SLIM_MAX_TX_PORTS 16
#define SLIM_MAX_RX_PORTS 13
QCOM_SDW_MAX_PORTS is used to declare the pconfig array,
SLIM_MAX_TX_PORTS and SLIM_MAX_RX_PORTS
are used to declare the rx_ch and tx_ch arrays in the sdm845_dai_init
function, which are finally passed
to qcom_swrm_set_channel_map as the rx_slot and tx_slot,
And I could confirm that the panic is not reported if this commit is reverted.
I also tried to add one debug line to print the value of the related
numbers in qcom_swrm_set_channel_map,
and here is the output
[ 34.143174][ T115] drivers/soundwire/qcom.c 1287
qcom_swrm_set_channel_map tx_num=16, rx_num=13, QCOM_SDW_MAX_PORTS=14,
ARRAY_SIZE(ctrl->pconfig)=15
which could help to confirm the "array index out of bounds" error as well.
Could you please help to have a check, and give some suggestions?
Thanks,
Yongqin Liu
> > drivers/soundwire/qcom.c | 26 ++++++++++++++++++++++++++
> > 1 file changed, 26 insertions(+)
> >
> > diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> > index 0f45e3404756..295a46dc2be7 100644
> > --- a/drivers/soundwire/qcom.c
> > +++ b/drivers/soundwire/qcom.c
> > @@ -156,6 +156,7 @@ struct qcom_swrm_port_config {
> > u8 word_length;
> > u8 blk_group_count;
> > u8 lane_control;
> > + u8 ch_mask;
> > };
> >
> > /*
> > @@ -1048,9 +1049,13 @@ static int qcom_swrm_port_enable(struct sdw_bus *bus,
> > {
> > u32 reg = SWRM_DP_PORT_CTRL_BANK(enable_ch->port_num, bank);
> > struct qcom_swrm_ctrl *ctrl = to_qcom_sdw(bus);
> > + struct qcom_swrm_port_config *pcfg;
> > u32 val;
> >
> > + pcfg = &ctrl->pconfig[enable_ch->port_num];
> > ctrl->reg_read(ctrl, reg, &val);
> > + if (pcfg->ch_mask != SWR_INVALID_PARAM && pcfg->ch_mask != 0)
> > + enable_ch->ch_mask = pcfg->ch_mask;
> >
> > if (enable_ch->enable)
> > val |= (enable_ch->ch_mask << SWRM_DP_PORT_CTRL_EN_CHAN_SHFT);
> > @@ -1270,6 +1275,26 @@ static void *qcom_swrm_get_sdw_stream(struct snd_soc_dai *dai, int direction)
> > return ctrl->sruntime[dai->id];
> > }
> >
> > +static int qcom_swrm_set_channel_map(struct snd_soc_dai *dai,
> > + unsigned int tx_num, const unsigned int *tx_slot,
> > + unsigned int rx_num, const unsigned int *rx_slot)
> > +{
> > + struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(dai->dev);
> > + int i;
> > +
> > + if (tx_slot) {
> > + for (i = 0; i < tx_num; i++)
> > + ctrl->pconfig[i].ch_mask = tx_slot[i];
> > + }
> > +
> > + if (rx_slot) {
> > + for (i = 0; i < rx_num; i++)
> > + ctrl->pconfig[i].ch_mask = rx_slot[i];
> > + }
> > +
> It looks like a hack.
> Consider the situation: if(tx_slot) is true and if(rx_slot) is true. So
> the ch_mask always overwritten by rx_slot?
>
> > + return 0;
> I think you dont need the return value here. Just void is ok.
>
> Thanks,
> Jie
>
> > +}
> > +
> > static int qcom_swrm_startup(struct snd_pcm_substream *substream,
> > struct snd_soc_dai *dai)
> > {
> > @@ -1306,6 +1331,7 @@ static const struct snd_soc_dai_ops qcom_swrm_pdm_dai_ops = {
> > .shutdown = qcom_swrm_shutdown,
> > .set_stream = qcom_swrm_set_sdw_stream,
> > .get_stream = qcom_swrm_get_sdw_stream,
> > + .set_channel_map = qcom_swrm_set_channel_map,
> > };
> >
> > static const struct snd_soc_component_driver qcom_swrm_dai_component = {
>
>
--
Best Regards,
Yongqin Liu
---------------------------------------------------------------
#mailing list
linaro-android@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-android
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v6 3/4] soundwire: qcom: Add set_channel_map api support
2025-02-06 11:22 ` [PATCH v6 3/4] soundwire: qcom: Add set_channel_map api support Mohammad Rafi Shaik
2025-02-10 3:30 ` Jie Gan
@ 2025-06-27 20:59 ` Dan Carpenter
1 sibling, 0 replies; 11+ messages in thread
From: Dan Carpenter @ 2025-06-27 20:59 UTC (permalink / raw)
To: Mohammad Rafi Shaik
Cc: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Vinod Koul, Bard Liao,
Jaroslav Kysela, Takashi Iwai, Pierre-Louis Bossart, Sanyog Kale,
linux-arm-msm, linux-sound, devicetree, linux-kernel,
quic_pkumpatl, kernel
On Thu, Feb 06, 2025 at 04:52:24PM +0530, Mohammad Rafi Shaik wrote:
> Added qcom_swrm_set_channel_map api to set the master channel mask for
> TX and RX paths based on the provided slots.
>
> Added a new field ch_mask to the qcom_swrm_port_config structure.
> This field is used to store the master channel mask, which allows more
> flexible to configure channel mask in runtime for specific active
> soundwire ports.
>
> Modified the qcom_swrm_port_enable function to configure master
> channel mask. If the ch_mask is set to SWR_INVALID_PARAM or is zero,
> the function will use the default channel mask.
>
> Signed-off-by: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
> Acked-by: Vinod Koul <vkoul@kernel.org>
> ---
> drivers/soundwire/qcom.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> index 0f45e3404756..295a46dc2be7 100644
> --- a/drivers/soundwire/qcom.c
> +++ b/drivers/soundwire/qcom.c
> @@ -156,6 +156,7 @@ struct qcom_swrm_port_config {
> u8 word_length;
> u8 blk_group_count;
> u8 lane_control;
> + u8 ch_mask;
> };
>
> /*
> @@ -1048,9 +1049,13 @@ static int qcom_swrm_port_enable(struct sdw_bus *bus,
> {
> u32 reg = SWRM_DP_PORT_CTRL_BANK(enable_ch->port_num, bank);
> struct qcom_swrm_ctrl *ctrl = to_qcom_sdw(bus);
> + struct qcom_swrm_port_config *pcfg;
> u32 val;
>
> + pcfg = &ctrl->pconfig[enable_ch->port_num];
> ctrl->reg_read(ctrl, reg, &val);
> + if (pcfg->ch_mask != SWR_INVALID_PARAM && pcfg->ch_mask != 0)
> + enable_ch->ch_mask = pcfg->ch_mask;
>
> if (enable_ch->enable)
> val |= (enable_ch->ch_mask << SWRM_DP_PORT_CTRL_EN_CHAN_SHFT);
> @@ -1270,6 +1275,26 @@ static void *qcom_swrm_get_sdw_stream(struct snd_soc_dai *dai, int direction)
> return ctrl->sruntime[dai->id];
> }
>
> +static int qcom_swrm_set_channel_map(struct snd_soc_dai *dai,
> + unsigned int tx_num, const unsigned int *tx_slot,
> + unsigned int rx_num, const unsigned int *rx_slot)
> +{
> + struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(dai->dev);
> + int i;
> +
> + if (tx_slot) {
> + for (i = 0; i < tx_num; i++)
> + ctrl->pconfig[i].ch_mask = tx_slot[i];
> + }
> +
> + if (rx_slot) {
> + for (i = 0; i < rx_num; i++)
> + ctrl->pconfig[i].ch_mask = rx_slot[i];
> + }
> +
> + return 0;
> +}
> +
Could we fix or revert this patch? It's called like this from
sdm845_dai_init():
sound/soc/qcom/sdm845.c
247 /*
248 * Codec SLIMBUS configuration
249 * RX1, RX2, RX3, RX4, RX5, RX6, RX7, RX8, RX9, RX10, RX11, RX12, RX13
250 * TX1, TX2, TX3, TX4, TX5, TX6, TX7, TX8, TX9, TX10, TX11, TX12, TX13
251 * TX14, TX15, TX16
252 */
253 unsigned int rx_ch[SLIM_MAX_RX_PORTS] = {144, 145, 146, 147, 148, 149,
254 150, 151, 152, 153, 154, 155, 156};
255 unsigned int tx_ch[SLIM_MAX_TX_PORTS] = {128, 129, 130, 131, 132, 133,
256 134, 135, 136, 137, 138, 139,
257 140, 141, 142, 143};
[ snip ]
304 for_each_rtd_codec_dais(rtd, i, codec_dai) {
305 rval = snd_soc_dai_set_channel_map(codec_dai,
306 ARRAY_SIZE(tx_ch),
307 tx_ch,
308 ARRAY_SIZE(rx_ch),
309 rx_ch);
310 if (rval != 0 && rval != -ENOTSUPP)
311 return rval;
There are 3 bugs:
Bug #1:
The zeroeth element of ctrl->pconfig[] is supposed to be unused. We
start counting at 1. However this code sets ctrl->pconfig[0].ch_mask = 128.
Bug #2:
There are SLIM_MAX_TX_PORTS (16) elements in tx_ch[] array but only
QCOM_SDW_MAX_PORTS + 1 (15) in the ctrl->pconfig[] array so it corrupts
memory like Yongqin Liu pointed out.
Bug 3:
Like Jie Gan pointed out, it erases all the tx information with the rx
information.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v6 4/4] ASoC: qcom: sdw: Add get and set channel maps support from codec to cpu dais
2025-02-06 11:22 [PATCH v6 0/4] Add static channel mapping between soundwire master and slave Mohammad Rafi Shaik
` (2 preceding siblings ...)
2025-02-06 11:22 ` [PATCH v6 3/4] soundwire: qcom: Add set_channel_map api support Mohammad Rafi Shaik
@ 2025-02-06 11:22 ` Mohammad Rafi Shaik
2025-02-07 14:02 ` [PATCH v6 0/4] Add static channel mapping between soundwire master and slave Mark Brown
2025-04-22 14:59 ` Xilin Wu
5 siblings, 0 replies; 11+ messages in thread
From: Mohammad Rafi Shaik @ 2025-02-06 11:22 UTC (permalink / raw)
To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Vinod Koul, Bard Liao,
Jaroslav Kysela, Takashi Iwai
Cc: Pierre-Louis Bossart, Sanyog Kale, linux-arm-msm, linux-sound,
devicetree, linux-kernel, quic_pkumpatl, kernel,
Mohammad Rafi Shaik
Add get and set channel maps support from codec to cpu dais.
Implemented logic to get the channel map in case of only sdw stream and
set channel map only for specific cpu dais.
Signed-off-by: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
---
sound/soc/qcom/sdw.c | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/sound/soc/qcom/sdw.c b/sound/soc/qcom/sdw.c
index f2eda2ff46c0..1d01b9329e08 100644
--- a/sound/soc/qcom/sdw.c
+++ b/sound/soc/qcom/sdw.c
@@ -23,9 +23,11 @@ int qcom_snd_sdw_startup(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+ u32 rx_ch[SDW_MAX_PORTS], tx_ch[SDW_MAX_PORTS];
struct sdw_stream_runtime *sruntime;
struct snd_soc_dai *codec_dai;
- int ret, i;
+ u32 rx_ch_cnt = 0, tx_ch_cnt = 0;
+ int ret, i, j;
sruntime = sdw_alloc_stream(cpu_dai->name);
if (!sruntime)
@@ -35,9 +37,35 @@ int qcom_snd_sdw_startup(struct snd_pcm_substream *substream)
ret = snd_soc_dai_set_stream(codec_dai, sruntime,
substream->stream);
if (ret < 0 && ret != -ENOTSUPP) {
- dev_err(rtd->dev, "Failed to set sdw stream on %s\n",
- codec_dai->name);
+ dev_err(rtd->dev, "Failed to set sdw stream on %s\n", codec_dai->name);
goto err_set_stream;
+ } else if (ret == -ENOTSUPP) {
+ /* Ignore unsupported */
+ continue;
+ }
+
+ ret = snd_soc_dai_get_channel_map(codec_dai, &tx_ch_cnt, tx_ch,
+ &rx_ch_cnt, rx_ch);
+ if (ret != 0 && ret != -ENOTSUPP) {
+ dev_err(rtd->dev, "Failed to get codec chan map %s\n", codec_dai->name);
+ goto err_set_stream;
+ } else if (ret == -ENOTSUPP) {
+ /* Ignore unsupported */
+ continue;
+ }
+ }
+
+ switch (cpu_dai->id) {
+ case RX_CODEC_DMA_RX_0:
+ case TX_CODEC_DMA_TX_3:
+ if (tx_ch_cnt || rx_ch_cnt) {
+ for_each_rtd_codec_dais(rtd, j, codec_dai) {
+ ret = snd_soc_dai_set_channel_map(codec_dai,
+ tx_ch_cnt, tx_ch,
+ rx_ch_cnt, rx_ch);
+ if (ret != 0 && ret != -ENOTSUPP)
+ goto err_set_stream;
+ }
}
}
--
2.34.1
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH v6 0/4] Add static channel mapping between soundwire master and slave
2025-02-06 11:22 [PATCH v6 0/4] Add static channel mapping between soundwire master and slave Mohammad Rafi Shaik
` (3 preceding siblings ...)
2025-02-06 11:22 ` [PATCH v6 4/4] ASoC: qcom: sdw: Add get and set channel maps support from codec to cpu dais Mohammad Rafi Shaik
@ 2025-02-07 14:02 ` Mark Brown
2025-04-22 14:59 ` Xilin Wu
5 siblings, 0 replies; 11+ messages in thread
From: Mark Brown @ 2025-02-07 14:02 UTC (permalink / raw)
To: Srinivas Kandagatla, Liam Girdwood, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Vinod Koul, Bard Liao,
Jaroslav Kysela, Takashi Iwai, Mohammad Rafi Shaik
Cc: Pierre-Louis Bossart, Sanyog Kale, linux-arm-msm, linux-sound,
devicetree, linux-kernel, quic_pkumpatl, kernel
On Thu, 06 Feb 2025 16:52:21 +0530, Mohammad Rafi Shaik wrote:
> Add static channel map support between soundwire master and slave.
>
> Currently, the channel value for each soundwire port is hardcoded in the
> wcd937x-sdw driver and the same channel value is configured in the
> soundwire master.
>
> The Qualcomm board like the QCM6490-IDP require static channel map
> settings for the soundwire master and slave ports.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/4] ASoC: dt-bindings: wcd937x-sdw: Add static channel mapping support
commit: 72826381215e2f9d2bd2f32f63f76a80942b7fdf
[2/4] ASoC: codecs: wcd937x: Add static channel mapping support in wcd937x-sdw
commit: c06c4f7cbea1d8dc71485bfddef2849a1b721e67
[3/4] soundwire: qcom: Add set_channel_map api support
commit: 7796c97df6b1b2206681a07f3c80f6023a6593d5
[4/4] ASoC: qcom: sdw: Add get and set channel maps support from codec to cpu dais
commit: 0e9a970d7b2cb98d741bc0e32ad8c8f30c009c63
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH v6 0/4] Add static channel mapping between soundwire master and slave
2025-02-06 11:22 [PATCH v6 0/4] Add static channel mapping between soundwire master and slave Mohammad Rafi Shaik
` (4 preceding siblings ...)
2025-02-07 14:02 ` [PATCH v6 0/4] Add static channel mapping between soundwire master and slave Mark Brown
@ 2025-04-22 14:59 ` Xilin Wu
2025-04-23 6:47 ` Xilin Wu
5 siblings, 1 reply; 11+ messages in thread
From: Xilin Wu @ 2025-04-22 14:59 UTC (permalink / raw)
To: Mohammad Rafi Shaik, Srinivas Kandagatla, Liam Girdwood,
Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Vinod Koul, Bard Liao, Jaroslav Kysela, Takashi Iwai
Cc: Pierre-Louis Bossart, Sanyog Kale, linux-arm-msm, linux-sound,
devicetree, linux-kernel, quic_pkumpatl, kernel
On 2025/2/6 19:22:21, Mohammad Rafi Shaik wrote:
> Add static channel map support between soundwire master and slave.
>
> Currently, the channel value for each soundwire port is hardcoded in the
> wcd937x-sdw driver and the same channel value is configured in the
> soundwire master.
>
> The Qualcomm board like the QCM6490-IDP require static channel map
> settings for the soundwire master and slave ports.
>
> If another boards which are using enable wcd937x, the channel mapping
> index values between master and slave may be different depending on the
> board hw design and requirements. If the above properties are not used
> in a SoC specific device tree, the channel mapping index values are set
> to default.
>
> With the introduction of the following channel mapping properties, it is
> now possible to configure the master channel mapping directly from the
> device tree.
>
> Added qcom_swrm_set_channel_map api to set the master channel values
> which allows more flexible to configure channel values in runtime for
> specific active soundwire ports.
>
> Add get and set channel maps support from codec to cpu dais in common
> Qualcomm sdw driver.
>
> Changes since v5:
> - Fixed build compile issue with v5-0003 patch, reported by Mark Brown.
>
> Changes since v4:
> - Update the order of channel map index values in v4-0001 dt-bindings patch as suggested by Krzysztof.
>
> Changes since v3:
> - Change the order of channel map index values in v3-0002 dt-bindings patch as suggested by Krzysztof.
> - Dropped V3-0001 patch which is not required.
>
> Changes since v2:
> - Rephrase commit description v2-0001 dt-bindings patch as suggested by Krzysztof.
>
> Changes since v1:
> - Modified the design and followed new approach to setting the master channel mask.
> - Used existing set_channel_map api as suggested by Pierre-Louis
> - Fixed the typo mistake in v1-0001 dt-bindings patch.
> - Rephrase the commit description for all v1 patches.
>
> Mohammad Rafi Shaik (4):
> ASoC: dt-bindings: wcd937x-sdw: Add static channel mapping support
> ASoC: codecs: wcd937x: Add static channel mapping support in
> wcd937x-sdw
> soundwire: qcom: Add set_channel_map api support
> ASoC: qcom: sdw: Add get and set channel maps support from codec to
> cpu dais
>
> .../bindings/sound/qcom,wcd937x-sdw.yaml | 36 +++++++++++++
> drivers/soundwire/qcom.c | 26 +++++++++
> sound/soc/codecs/wcd937x-sdw.c | 39 ++++++++++++--
> sound/soc/codecs/wcd937x.c | 53 ++++++++++++++++++-
> sound/soc/codecs/wcd937x.h | 7 ++-
> sound/soc/qcom/sdw.c | 34 ++++++++++--
> 6 files changed, 185 insertions(+), 10 deletions(-)
Hi Mohammad,
I'm working on a QCS6490 board with the WCD9380 codec. I wonder if a
similar patch is needed to enable headset audio? Currently, DisplayPort
audio and headset plug-in detection work, but no audio is coming from
the headset.
Additionally, I noticed an unusual output in dmesg:
qcom-soundwire 3210000.soundwire: qcom_swrm_irq_handler: SWR Port
collision detected
Could this be related to the issue? Let me know if you need further details.
--
Best regards,
Xilin Wu <sophon@radxa.com>
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH v6 0/4] Add static channel mapping between soundwire master and slave
2025-04-22 14:59 ` Xilin Wu
@ 2025-04-23 6:47 ` Xilin Wu
0 siblings, 0 replies; 11+ messages in thread
From: Xilin Wu @ 2025-04-23 6:47 UTC (permalink / raw)
To: Mohammad Rafi Shaik, Srinivas Kandagatla, Liam Girdwood,
Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Vinod Koul, Bard Liao, Jaroslav Kysela, Takashi Iwai
Cc: Pierre-Louis Bossart, Sanyog Kale, linux-arm-msm, linux-sound,
devicetree, linux-kernel, quic_pkumpatl, kernel
On 2025/4/22 22:59:13, Xilin Wu wrote:
> On 2025/2/6 19:22:21, Mohammad Rafi Shaik wrote:
>> Add static channel map support between soundwire master and slave.
>>
>> Currently, the channel value for each soundwire port is hardcoded in the
>> wcd937x-sdw driver and the same channel value is configured in the
>> soundwire master.
>>
>> The Qualcomm board like the QCM6490-IDP require static channel map
>> settings for the soundwire master and slave ports.
>>
>> If another boards which are using enable wcd937x, the channel mapping
>> index values between master and slave may be different depending on the
>> board hw design and requirements. If the above properties are not used
>> in a SoC specific device tree, the channel mapping index values are set
>> to default.
>>
>> With the introduction of the following channel mapping properties, it is
>> now possible to configure the master channel mapping directly from the
>> device tree.
>>
>> Added qcom_swrm_set_channel_map api to set the master channel values
>> which allows more flexible to configure channel values in runtime for
>> specific active soundwire ports.
>>
>> Add get and set channel maps support from codec to cpu dais in common
>> Qualcomm sdw driver.
>>
>> Changes since v5:
>> - Fixed build compile issue with v5-0003 patch, reported by Mark Brown.
>>
>> Changes since v4:
>> - Update the order of channel map index values in v4-0001 dt-
>> bindings patch as suggested by Krzysztof.
>> Changes since v3:
>> - Change the order of channel map index values in v3-0002 dt-
>> bindings patch as suggested by Krzysztof.
>> - Dropped V3-0001 patch which is not required.
>>
>> Changes since v2:
>> - Rephrase commit description v2-0001 dt-bindings patch as suggested
>> by Krzysztof.
>>
>> Changes since v1:
>> - Modified the design and followed new approach to setting the
>> master channel mask.
>> - Used existing set_channel_map api as suggested by Pierre-Louis
>> - Fixed the typo mistake in v1-0001 dt-bindings patch.
>> - Rephrase the commit description for all v1 patches.
>>
>> Mohammad Rafi Shaik (4):
>> ASoC: dt-bindings: wcd937x-sdw: Add static channel mapping support
>> ASoC: codecs: wcd937x: Add static channel mapping support in
>> wcd937x-sdw
>> soundwire: qcom: Add set_channel_map api support
>> ASoC: qcom: sdw: Add get and set channel maps support from codec to
>> cpu dais
>>
>> .../bindings/sound/qcom,wcd937x-sdw.yaml | 36 +++++++++++++
>> drivers/soundwire/qcom.c | 26 +++++++++
>> sound/soc/codecs/wcd937x-sdw.c | 39 ++++++++++++--
>> sound/soc/codecs/wcd937x.c | 53 ++++++++++++++++++-
>> sound/soc/codecs/wcd937x.h | 7 ++-
>> sound/soc/qcom/sdw.c | 34 ++++++++++--
>> 6 files changed, 185 insertions(+), 10 deletions(-)
>
> Hi Mohammad,
>
> I'm working on a QCS6490 board with the WCD9380 codec. I wonder if a
> similar patch is needed to enable headset audio? Currently, DisplayPort
> audio and headset plug-in detection work, but no audio is coming from
> the headset.
>
> Additionally, I noticed an unusual output in dmesg:
>
> qcom-soundwire 3210000.soundwire: qcom_swrm_irq_handler: SWR Port
> collision detected
>
> Could this be related to the issue? Let me know if you need further
> details.
>
Well, headset audio works now. It seems that the error message has
nothing to do with it :)
--
Best regards,
Xilin Wu <sophon@radxa.com>
^ permalink raw reply [flat|nested] 11+ messages in thread