On Mon Sep 30, 2024 at 6:31 AM BST, Mohammad Rafi Shaik wrote:
From: Rohit kumar quic_rohkumar@quicinc.com
Add channel map mixer control for lpass macro codec DAIs.
Signed-off-by: Rohit kumar quic_rohkumar@quicinc.com Co-developed-by: Mohammad Rafi Shaik quic_mohs@quicinc.com Signed-off-by: Mohammad Rafi Shaik quic_mohs@quicinc.com
IIUC there was off-the-list discussion about why it is needed. Could you please elaborate a bit more in the commit message?
--- a/sound/soc/codecs/lpass-macro-common.c +++ b/sound/soc/codecs/lpass-macro-common.c @@ -8,12 +8,67 @@ #include <linux/platform_device.h> #include <linux/pm_domain.h> #include <linux/pm_runtime.h> +#include <sound/control.h> +#include <sound/pcm.h> +#include <sound/soc.h>
#include "lpass-macro-common.h"
static DEFINE_MUTEX(lpass_codec_mutex); static enum lpass_codec_version lpass_codec_version;
+static int lpass_macro_chmap_ctl_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
+{
- struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol);
- struct snd_soc_dai *dai = info->private_data;
- u32 *chmap_data = NULL;
You don't really need to set chmap_data to NULL if you're going to overwrite it with a kzalloc() call a couple of lines below.
- u32 rx_ch_cnt = 0;
- u32 tx_ch_cnt = 0;
- u32 rx_ch, tx_ch;
- chmap_data = kzalloc(sizeof(u32) * 2, GFP_KERNEL);
- if (!chmap_data)
return -ENOMEM;
[...]
Thanks, Alexey