On 09/02/2020 15:47, Adam Serbinski wrote:
This patch adds support to pcm ports in AFE.
Signed-off-by: Adam Serbinski <adam@xxxxxxxxxxxxx>
CC: Andy Gross <agross@xxxxxxxxxx>
CC: Mark Rutland <mark.rutland@xxxxxxx>
CC: Liam Girdwood <lgirdwood@xxxxxxxxx>
CC: Patrick Lai <plai@xxxxxxxxxxxxxx>
CC: Banajit Goswami <bgoswami@xxxxxxxxxxxxxx>
CC: Jaroslav Kysela <perex@xxxxxxxx>
CC: Takashi Iwai <tiwai@xxxxxxxx>
CC: alsa-devel@xxxxxxxxxxxxxxxx
CC: linux-arm-msm@xxxxxxxxxxxxxxx
CC: devicetree@xxxxxxxxxxxxxxx
CC: linux-kernel@xxxxxxxxxxxxxxx
---
sound/soc/qcom/qdsp6/q6afe.c | 246 +++++++++++++++++++++++++++++++++++
sound/soc/qcom/qdsp6/q6afe.h | 9 +-
2 files changed, 254 insertions(+), 1 deletion(-)
Few general comments.
1>documentation to "struct afe_param_id_pcm_cfg "
Either we follow kerneldoc style or not add this as we did with other
similar afe port config structures.
Am okay either way!
2> some of the defines in this patch has no reals users, so we better
remove all the unused constants.
diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c
index e0945f7a58c8..b53ad14a78fd 100644
--- a/sound/soc/qcom/qdsp6/q6afe.c
+++ b/sound/soc/qcom/qdsp6/q6afe.c
@@ -40,6 +40,7 @@
...
+/**
+ * q6afe_pcm_port_prepare() - Prepare pcm afe port.
+ *
+ * @port: Instance of afe port
+ * @cfg: PCM configuration for the afe port
+ *
+ */
+int q6afe_pcm_port_prepare(struct q6afe_port *port, struct q6afe_pcm_cfg *cfg)
+{
+ union afe_port_config *pcfg = &port->port_cfg;
+
+ pcfg->pcm_cfg.pcm_cfg_minor_version = AFE_API_VERSION_PCM_CONFIG;
+ pcfg->pcm_cfg.aux_mode = AFE_PORT_PCM_AUX_MODE_PCM;
+
+ switch (cfg->fmt & SND_SOC_DAIFMT_MASTER_MASK) {
+ case SND_SOC_DAIFMT_CBS_CFS:
+ pcfg->pcm_cfg.sync_src = AFE_PORT_PCM_SYNC_SRC_INTERNAL;
+ break;
+ case SND_SOC_DAIFMT_CBM_CFM:
+ /* CPU is slave */
+ pcfg->pcm_cfg.sync_src = AFE_PORT_PCM_SYNC_SRC_EXTERNAL;
+ break;
+ default:
+ break;
+ }
+
+ switch (cfg->sample_rate) {
+ case 8000:
+ pcfg->pcm_cfg.frame_setting = AFE_PORT_PCM_BITS_PER_FRAME_128;
+ break;
+ case 16000:
+ pcfg->pcm_cfg.frame_setting = AFE_PORT_PCM_BITS_PER_FRAME_64;
+ break;
+ }
+ pcfg->pcm_cfg.quantype = AFE_PORT_PCM_LINEAR_NOPADDING;
+ pcfg->pcm_cfg.ctrl_data_out_enable = AFE_PORT_PCM_CTRL_DATA_OE_DISABLE;
+ pcfg->pcm_cfg.reserved = 0;
+ pcfg->pcm_cfg.sample_rate = cfg->sample_rate;
+
+ /* 16 bit mono */
+ pcfg->pcm_cfg.bit_width = 16;
+ pcfg->pcm_cfg.num_channels = 1;
+ pcfg->pcm_cfg.slot_number_mapping[0] = 1;
PCM quantization type and Slot Mapping should come from device tree.
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(q6afe_pcm_port_prepare);
+
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel