Message ID | 20250123042823.2067740-4-quic_mohs@quicinc.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Add static channel mapping between soundwire master and slave | expand |
On Thu, Jan 23, 2025 at 09:58:22AM +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. This breaks an allmodconfig build, and arm64 defconfig: /build/stage/linux/drivers/soundwire/qcom.c: In function ‘qcom_swrm_set_channel_map’: /build/stage/linux/drivers/soundwire/qcom.c:1283:36: warning: unused variable ‘sruntime’ [-Wunused-variable] 1283 | struct sdw_stream_runtime *sruntime = ctrl->sruntime[dai->id]; | ^~~~~~~~ /build/stage/linux/drivers/soundwire/qcom.c: At top level: /build/stage/linux/drivers/soundwire/qcom.c:1335:28: error: initialization of ‘int (*)(struct snd_soc_dai *, unsigned int, const unsigned int *, unsigned int, const unsigned int *)’ from incompatible pointer type ‘int (*)(struct snd_soc_dai *, unsigned int, unsigned int *, unsigned int, unsigned int *)’ [-Werror=incompatible-pointer-types] 1335 | .set_channel_map = qcom_swrm_set_channel_map, | ^~~~~~~~~~~~~~~~~~~~~~~~~ /build/stage/linux/drivers/soundwire/qcom.c:1335:28: note: (near initialization for ‘qcom_swrm_pdm_dai_ops.set_channel_map’)
On 2/3/2025 6:49 PM, Mark Brown wrote: > On Thu, Jan 23, 2025 at 09:58:22AM +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. > > This breaks an allmodconfig build, and arm64 defconfig: > > /build/stage/linux/drivers/soundwire/qcom.c: In function ‘qcom_swrm_set_channel_map’: > /build/stage/linux/drivers/soundwire/qcom.c:1283:36: warning: unused variable ‘sruntime’ [-Wunused-variable] > 1283 | struct sdw_stream_runtime *sruntime = ctrl->sruntime[dai->id]; > | ^~~~~~~~ > /build/stage/linux/drivers/soundwire/qcom.c: At top level: > /build/stage/linux/drivers/soundwire/qcom.c:1335:28: error: initialization of ‘int (*)(struct snd_soc_dai *, unsigned int, const unsigned int *, unsigned int, const unsigned int *)’ from incompatible pointer type ‘int (*)(struct snd_soc_dai *, unsigned int, unsigned int *, unsigned int, unsigned int *)’ [-Werror=incompatible-pointer-types] > 1335 | .set_channel_map = qcom_swrm_set_channel_map, > | ^~~~~~~~~~~~~~~~~~~~~~~~~ > /build/stage/linux/drivers/soundwire/qcom.c:1335:28: note: (near initialization for ‘qcom_swrm_pdm_dai_ops.set_channel_map’) ACK, Thanks for the review and test. Somehow above build errors not reproduced in my build setup. I am Using below commands for build: make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- allmodconfig make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j32 Will check and fix in next version. Thanks & Regards, Rafi
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index 0f45e3404756..0183e1ad4853 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,27 @@ 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, unsigned int *tx_slot, + unsigned int rx_num, unsigned int *rx_slot) +{ + struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(dai->dev); + struct sdw_stream_runtime *sruntime = ctrl->sruntime[dai->id]; + 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 +1332,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 = {