aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>2017-05-08 11:28:47 +0200
committerSrinivas Kandagatla <srinivas.kandagatla@linaro.org>2017-05-08 11:28:47 +0200
commitdd2644b4fa1e7b5e707a960c4e7b93229e05b51f (patch)
tree30a368cb5185e0207d215fcd1c0cb39a9b1d9d9a
parent6309dd4d4c752ab19ad0cb0880fd73e81f851a6f (diff)
WIP: ASoC: qcom: qdsp6v2: move to asoc-topologyasoc-topology-wip-msm8996
This is a first attempt to move all the dapm's from driver to asoc-topology config/firmware file. Currently all the callbacks are dummy, but we should be able to hook up stuff like calibration info and more. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
-rw-r--r--sound/soc/qcom/qdsp6v2/msm-dai-q6-hdmi-v2.c67
-rw-r--r--sound/soc/qcom/qdsp6v2/msm-pcm-q6-v2.c29
-rw-r--r--sound/soc/qcom/qdsp6v2/msm-pcm-routing-v2.c100
3 files changed, 112 insertions, 84 deletions
diff --git a/sound/soc/qcom/qdsp6v2/msm-dai-q6-hdmi-v2.c b/sound/soc/qcom/qdsp6v2/msm-dai-q6-hdmi-v2.c
index e657cd59c1f5f..2512036c77aff 100644
--- a/sound/soc/qcom/qdsp6v2/msm-dai-q6-hdmi-v2.c
+++ b/sound/soc/qcom/qdsp6v2/msm-dai-q6-hdmi-v2.c
@@ -28,6 +28,8 @@
//#include <sound/msm-dai-q6-v2.h>
#include <sound/pcm_params.h>
#include <dt-bindings/sound/qcom,afe.h>
+#include <linux/firmware.h>
+#include <sound/soc-topology.h>
#include "q6afe-v2.h"
@@ -36,8 +38,6 @@ struct msm_hdmi_ca {
u32 ca;
};
-static struct msm_hdmi_ca hdmi_ca = { false, 0x0 };
-
struct msm_dai_q6_hdmi_dai_data {
struct q6afe_port *port;
struct q6afe_hdmi_cfg port_config;
@@ -66,20 +66,6 @@ static int msm_dai_q6_hdmi_format_get(struct snd_kcontrol *kcontrol,
return 0;
}
-static int msm_dai_q6_hdmi_ca_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- hdmi_ca.ca = ucontrol->value.integer.value[0];
- hdmi_ca.set_ca = true;
- return 0;
-}
-
-static int msm_dai_q6_hdmi_ca_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- ucontrol->value.integer.value[0] = hdmi_ca.ca;
- return 0;
-}
/* HDMI format field for AFE_PORT_MULTI_CHAN_HDMI_AUDIO_IF_CONFIG command
* 0: linear PCM
@@ -98,10 +84,6 @@ static const struct snd_kcontrol_new hdmi_config_controls[] = {
SOC_ENUM_EXT("HDMI RX Format", hdmi_config_enum[0],
msm_dai_q6_hdmi_format_get,
msm_dai_q6_hdmi_format_put),
-// SOC_SINGLE_MULTI_EXT("HDMI RX CA", SND_SOC_NOPM, 0,
-// HDMI_RX_CA_MAX, 0, 1,
-// msm_dai_q6_hdmi_ca_get,
-// msm_dai_q6_hdmi_ca_put),
};
/* Current implementation assumes hw_param is called once
@@ -270,6 +252,7 @@ static struct snd_soc_dai_ops msm_dai_q6_hdmi_ops = {
.shutdown = msm_dai_q6_hdmi_shutdown,
};
+/* BE DAI */
static struct snd_soc_dai_driver msm_dai_q6_hdmi_hdmi_rx_dai = {
.playback = {
.stream_name = "HDMI Playback",
@@ -293,7 +276,51 @@ static const struct snd_soc_dapm_widget hdmi_dapm_widgets[] = {
SND_SOC_DAPM_OUTPUT("HDMI-RX"),
};
+#define QCOM_TOPOLOGY_BE_INDEX 1
+
+int qcom_tplg_dai_load(struct snd_soc_component *c,
+ struct snd_soc_dai_driver *dai_drv)
+{
+ //FIXME load calibration data here
+
+ return 0;
+}
+
+int qcom_tplg_dai_unload(struct snd_soc_component *c,
+ struct snd_soc_dobj *o)
+{
+ return 0;
+}
+
+static struct snd_soc_tplg_ops qcom_tplg_ops = {
+ .dai_load = qcom_tplg_dai_load,
+ .dai_unload = qcom_tplg_dai_unload,
+};
+
+int msm_dai_q6_hdmi_comp_probe(struct snd_soc_component *component)
+{
+ int ret;
+ const struct firmware *fw;
+
+ ret = request_firmware(&fw, "qcom.bin", component->dev);
+ if (ret < 0) {
+ dev_err(component->dev, "tplg fw %s load failed with %d\n",
+ "qcom.bin", ret);
+ return ret;
+ }
+
+ ret = snd_soc_tplg_component_load(component, &qcom_tplg_ops, fw, QCOM_TOPOLOGY_BE_INDEX);
+ if (ret < 0) {
+ dev_err(component->dev, "tplg component load failed%d\n", ret);
+ release_firmware(fw);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
static const struct snd_soc_component_driver msm_dai_hdmi_q6_component = {
+ .probe = msm_dai_q6_hdmi_comp_probe,
.name = "msm-dai-q6-hdmi",
.dapm_widgets = hdmi_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(hdmi_dapm_widgets),
diff --git a/sound/soc/qcom/qdsp6v2/msm-pcm-q6-v2.c b/sound/soc/qcom/qdsp6v2/msm-pcm-q6-v2.c
index 69321ca428c93..5f15593c8fa67 100644
--- a/sound/soc/qcom/qdsp6v2/msm-pcm-q6-v2.c
+++ b/sound/soc/qcom/qdsp6v2/msm-pcm-q6-v2.c
@@ -26,6 +26,8 @@
#include <dt-bindings/sound/qcom,asm.h>
#include <linux/of_device.h>
#include <sound/pcm_params.h>
+#include <linux/firmware.h>
+#include <sound/soc-topology.h>
//FIXME remove this dependency..
#include "q6asm-v2.h"
#include "msm-pcm-routing-v2.h"
@@ -399,7 +401,34 @@ static int msm_asoc_pcm_new(struct snd_soc_pcm_runtime *rtd)
return ret;
}
+static struct snd_soc_tplg_ops qcom_tplg_ops = {
+};
+
+#define QCOM_TOPOLOGY_PCM_INDEX 3
+static int msm_asoc_pcm_probe(struct snd_soc_platform *platform)
+{
+ int ret;
+ const struct firmware *fw;
+
+ ret = request_firmware(&fw, "qcom.bin", platform->dev);
+ if (ret < 0) {
+ dev_err(platform->dev, "tplg fw %s load failed with %d\n",
+ "qcom.bin", ret);
+ return ret;
+ }
+
+ ret = snd_soc_tplg_component_load(&platform->component, &qcom_tplg_ops, fw, QCOM_TOPOLOGY_PCM_INDEX);
+ if (ret < 0) {
+ dev_err(platform->dev, "tplg component load failed%d\n", ret);
+ release_firmware(fw);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
static struct snd_soc_platform_driver msm_soc_platform = {
+ .probe = msm_asoc_pcm_probe,
.ops = &msm_pcm_ops,
.pcm_new = msm_asoc_pcm_new,
};
diff --git a/sound/soc/qcom/qdsp6v2/msm-pcm-routing-v2.c b/sound/soc/qcom/qdsp6v2/msm-pcm-routing-v2.c
index fca8ff092db56..95331ae0c7c70 100644
--- a/sound/soc/qcom/qdsp6v2/msm-pcm-routing-v2.c
+++ b/sound/soc/qcom/qdsp6v2/msm-pcm-routing-v2.c
@@ -24,6 +24,8 @@
#include <sound/pcm.h>
#include <sound/control.h>
#include <sound/asound.h>
+#include <linux/firmware.h>
+#include <sound/soc-topology.h>
#include <sound/pcm_params.h>
//#include <sound/q6core.h>
#include <dt-bindings/sound/qcom,afe.h>
@@ -117,6 +119,7 @@ int msm_pcm_routing_reg_phy_stream_v2(int fedai_id, int perf_mode,
struct msm_routing_session_data *msm_pcm_routing_get_session_data(struct msm_routing_data *data, int port_id, int port_type)
{
int i;
+
for (i = 0; i < MAX_SESSIONS; i++) {
if (port_id == data->sessions[i].port_id) {
return &data->sessions[i];
@@ -174,9 +177,6 @@ static int msm_routing_get_audio_mixer(struct snd_kcontrol *kcontrol,
else
ucontrol->value.integer.value[0] = 0;
- pr_debug("%s: reg %x shift %x val %ld\n", __func__, mc->reg, mc->shift,
- ucontrol->value.integer.value[0]);
-
return 0;
}
@@ -193,6 +193,8 @@ static int msm_routing_put_audio_mixer(struct snd_kcontrol *kcontrol,
int session_id = mc->shift;
struct msm_routing_session_data *session = &data->sessions[session_id];
+
+
if (ucontrol->value.integer.value[0]) {
session->port_id = be_id;//q6afe_get_port_id(be_id);
@@ -208,68 +210,9 @@ static int msm_routing_put_audio_mixer(struct snd_kcontrol *kcontrol,
return 1;
}
-//FIXME ..
-static const struct snd_kcontrol_new hdmi_mixer_controls[] = {
- SOC_SINGLE_EXT("MultiMedia1", AFE_PORT_HDMI_RX,
- MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
- msm_routing_put_audio_mixer),
- SOC_SINGLE_EXT("MultiMedia2", AFE_PORT_HDMI_RX,
- MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer,
- msm_routing_put_audio_mixer),
- SOC_SINGLE_EXT("MultiMedia3", AFE_PORT_HDMI_RX,
- MSM_FRONTEND_DAI_MULTIMEDIA3, 1, 0, msm_routing_get_audio_mixer,
- msm_routing_put_audio_mixer),
- SOC_SINGLE_EXT("MultiMedia4", AFE_PORT_HDMI_RX,
- MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer,
- msm_routing_put_audio_mixer),
- SOC_SINGLE_EXT("MultiMedia5", AFE_PORT_HDMI_RX,
- MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer,
- msm_routing_put_audio_mixer),
- SOC_SINGLE_EXT("MultiMedia6", AFE_PORT_HDMI_RX,
- MSM_FRONTEND_DAI_MULTIMEDIA6, 1, 0, msm_routing_get_audio_mixer,
- msm_routing_put_audio_mixer),
- SOC_SINGLE_EXT("MultiMedia7", AFE_PORT_HDMI_RX,
- MSM_FRONTEND_DAI_MULTIMEDIA7, 1, 0, msm_routing_get_audio_mixer,
- msm_routing_put_audio_mixer),
- SOC_SINGLE_EXT("MultiMedia8", AFE_PORT_HDMI_RX,
- MSM_FRONTEND_DAI_MULTIMEDIA8, 1, 0, msm_routing_get_audio_mixer,
- msm_routing_put_audio_mixer),
-};
-
-static const struct snd_soc_dapm_widget msm_qdsp6_widgets[] = {
- /* Frontend AIF */
- /* Widget name equals to Front-End DAI name<Need confirmation>,
- * Stream name must contains substring of front-end dai name
- */
- SND_SOC_DAPM_AIF_IN("MM_DL1", "MultiMedia1 Playback", 0, 0, 0, 0),
-
- SND_SOC_DAPM_AIF_IN("MM_DL2", "MultiMedia2 Playback", 0, 0, 0, 0),
- SND_SOC_DAPM_AIF_IN("MM_DL3", "MultiMedia3 Playback", 0, 0, 0, 0),
- SND_SOC_DAPM_AIF_IN("MM_DL4", "MultiMedia4 Playback", 0, 0, 0, 0),
- SND_SOC_DAPM_AIF_IN("MM_DL5", "MultiMedia5 Playback", 0, 0, 0, 0),
- SND_SOC_DAPM_AIF_IN("MM_DL6", "MultiMedia6 Playback", 0, 0, 0, 0),
- SND_SOC_DAPM_AIF_IN("MM_DL7", "MultiMedia7 Playback", 0, 0, 0, 0),
- SND_SOC_DAPM_AIF_IN("MM_DL8", "MultiMedia8 Playback", 0, 0, 0, 0),
-
- /* Mixer definitions */
- SND_SOC_DAPM_MIXER("HDMI Mixer", SND_SOC_NOPM, 0, 0, hdmi_mixer_controls, ARRAY_SIZE(hdmi_mixer_controls)),
- /* Virtual Pins to force backends ON atm */
-// SND_SOC_DAPM_OUTPUT("BE_OUT"),
-};
-
static const struct snd_soc_dapm_route intercon[] = {
- {"HDMI Mixer", "MultiMedia1", "MM_DL1"},
- {"HDMI Mixer", "MultiMedia2", "MM_DL2"},
- {"HDMI Mixer", "MultiMedia3", "MM_DL3"},
- {"HDMI Mixer", "MultiMedia4", "MM_DL4"},
- {"HDMI Mixer", "MultiMedia5", "MM_DL5"},
- {"HDMI Mixer", "MultiMedia6", "MM_DL6"},
- {"HDMI Mixer", "MultiMedia7", "MM_DL7"},
- {"HDMI Mixer", "MultiMedia8", "MM_DL8"},
{"HDMI", NULL, "HDMI Mixer"},
/* Backend Enablement */
-// {"BE_OUT", NULL, "HDMI"},
- //FIXME should go to machine driver
{"HDMI-RX", NULL, "HDMI"},
};
@@ -338,22 +281,51 @@ static struct snd_pcm_ops msm_routing_pcm_ops = {
.prepare = msm_pcm_routing_prepare,
};
+/* mapping of Kcontrol types and associated operations. */
+static const struct snd_soc_tplg_kcontrol_ops io_ops[] = {
+ {257, msm_routing_get_audio_mixer,
+ msm_routing_put_audio_mixer, snd_soc_info_volsw},
+};
+
+static struct snd_soc_tplg_ops qcom_tplg_ops = {
+ .io_ops = io_ops,
+ .io_ops_count = ARRAY_SIZE(io_ops),
+};
+
+#define QCOM_TOPOLOGY_ROUTING_INDEX 2
/* Not used but frame seems to require it */
static int msm_routing_probe(struct snd_soc_platform *platform)
{
int i;
+ int ret;
+ const struct firmware *fw;
+
+ ret = request_firmware(&fw, "qcom.bin", platform->dev);
+ if (ret < 0) {
+ dev_err(platform->dev, "tplg fw %s load failed with %d\n",
+ "qcom.bin", ret);
+ return ret;
+ }
+
+ ret = snd_soc_tplg_component_load(&platform->component, &qcom_tplg_ops, fw, QCOM_TOPOLOGY_ROUTING_INDEX);
+ if (ret < 0) {
+ dev_err(platform->dev, "tplg component load failed%d\n", ret);
+ release_firmware(fw);
+ return -EINVAL;
+ }
+
+
for (i = 0; i < MAX_SESSIONS; i++) {
routing_data.sessions[i].port_id = -1;
}
snd_soc_platform_set_drvdata(platform, &routing_data);
return 0;
}
+
static struct snd_soc_platform_driver msm_soc_routing_platform = {
.ops = &msm_routing_pcm_ops,
.probe = msm_routing_probe,
.component_driver = {
- .dapm_widgets = msm_qdsp6_widgets,
- .num_dapm_widgets = ARRAY_SIZE(msm_qdsp6_widgets),
.dapm_routes = intercon,
.num_dapm_routes = ARRAY_SIZE(intercon),
},