|
@@ -1212,6 +1212,29 @@ static int msm_dai_q6_add_island_mx_ctls(struct snd_card *card,
|
|
|
return rc;
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * For single CPU DAI registration, the dai id needs to be
|
|
|
+ * set explicitly in the dai probe as ASoC does not read
|
|
|
+ * the cpu->driver->id field rather it assigns the dai id
|
|
|
+ * from the device name that is in the form %s.%d. This dai
|
|
|
+ * id should be assigned to back-end AFE port id and used
|
|
|
+ * during dai prepare. For multiple dai registration, it
|
|
|
+ * is not required to call this function, however the dai->
|
|
|
+ * driver->id field must be defined and set to corresponding
|
|
|
+ * AFE Port id.
|
|
|
+ */
|
|
|
+static inline void msm_dai_q6_set_dai_id(struct snd_soc_dai *dai)
|
|
|
+{
|
|
|
+ if (!dai->driver) {
|
|
|
+ dev_err(dai->dev, "DAI driver is not set\n");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!dai->driver->id) {
|
|
|
+ dev_dbg(dai->dev, "DAI driver id is not set\n");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ dai->id = dai->driver->id;
|
|
|
+}
|
|
|
|
|
|
static int msm_dai_q6_aux_pcm_probe(struct snd_soc_dai *dai)
|
|
|
{
|
|
@@ -1226,11 +1249,8 @@ static int msm_dai_q6_aux_pcm_probe(struct snd_soc_dai *dai)
|
|
|
pr_err("%s: Invalid params dai dev\n", __func__);
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
- if (!dai->driver->id) {
|
|
|
- dev_warn(dai->dev, "DAI driver id is not set\n");
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
- dai->id = dai->driver->id;
|
|
|
+
|
|
|
+ msm_dai_q6_set_dai_id(dai);
|
|
|
dai_data = dev_get_drvdata(dai->dev);
|
|
|
|
|
|
if (dai_data->is_island_dai)
|
|
@@ -1725,15 +1745,20 @@ static int msm_dai_q6_spdif_dai_probe(struct snd_soc_dai *dai)
|
|
|
pr_err("%s: dai not found!!\n", __func__);
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
+ if (!dai->dev) {
|
|
|
+ pr_err("%s: Invalid params dai dev\n", __func__);
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+
|
|
|
dai_data = kzalloc(sizeof(struct msm_dai_q6_spdif_dai_data),
|
|
|
GFP_KERNEL);
|
|
|
|
|
|
- if (!dai_data) {
|
|
|
- rc = -ENOMEM;
|
|
|
- } else
|
|
|
+ if (!dai_data)
|
|
|
+ return -ENOMEM;
|
|
|
+ else
|
|
|
dev_set_drvdata(dai->dev, dai_data);
|
|
|
|
|
|
- dai->id = dai->driver->id;
|
|
|
+ msm_dai_q6_set_dai_id(dai);
|
|
|
dai_data->port_id = dai->id;
|
|
|
|
|
|
switch (dai->id) {
|
|
@@ -2530,26 +2555,6 @@ static struct snd_soc_dai_ops msm_dai_q6_ops = {
|
|
|
.set_channel_map = msm_dai_q6_set_channel_map,
|
|
|
};
|
|
|
|
|
|
-/*
|
|
|
- * For single CPU DAI registration, the dai id needs to be
|
|
|
- * set explicitly in the dai probe as ASoC does not read
|
|
|
- * the cpu->driver->id field rather it assigns the dai id
|
|
|
- * from the device name that is in the form %s.%d. This dai
|
|
|
- * id should be assigned to back-end AFE port id and used
|
|
|
- * during dai prepare. For multiple dai registration, it
|
|
|
- * is not required to call this function, however the dai->
|
|
|
- * driver->id field must be defined and set to corresponding
|
|
|
- * AFE Port id.
|
|
|
- */
|
|
|
-static inline void msm_dai_q6_set_dai_id(struct snd_soc_dai *dai)
|
|
|
-{
|
|
|
- if (!dai->driver->id) {
|
|
|
- dev_warn(dai->dev, "DAI driver id is not set\n");
|
|
|
- return;
|
|
|
- }
|
|
|
- dai->id = dai->driver->id;
|
|
|
-}
|
|
|
-
|
|
|
static int msm_dai_q6_cal_info_put(struct snd_kcontrol *kcontrol,
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
{
|
|
@@ -3188,7 +3193,7 @@ static int msm_dai_q6_dai_probe(struct snd_soc_dai *dai)
|
|
|
dai_data = kzalloc(sizeof(struct msm_dai_q6_dai_data), GFP_KERNEL);
|
|
|
|
|
|
if (!dai_data)
|
|
|
- rc = -ENOMEM;
|
|
|
+ return -ENOMEM;
|
|
|
else
|
|
|
dev_set_drvdata(dai->dev, dai_data);
|
|
|
|
|
@@ -6978,8 +6983,7 @@ static int msm_dai_q6_tdm_set_clk(
|
|
|
static int msm_dai_q6_dai_tdm_probe(struct snd_soc_dai *dai)
|
|
|
{
|
|
|
int rc = 0;
|
|
|
- struct msm_dai_q6_tdm_dai_data *tdm_dai_data =
|
|
|
- dev_get_drvdata(dai->dev);
|
|
|
+ struct msm_dai_q6_tdm_dai_data *tdm_dai_data = NULL;
|
|
|
struct snd_kcontrol *data_format_kcontrol = NULL;
|
|
|
struct snd_kcontrol *header_type_kcontrol = NULL;
|
|
|
struct snd_kcontrol *header_kcontrol = NULL;
|
|
@@ -6988,6 +6992,8 @@ static int msm_dai_q6_dai_tdm_probe(struct snd_soc_dai *dai)
|
|
|
const struct snd_kcontrol_new *header_type_ctrl = NULL;
|
|
|
const struct snd_kcontrol_new *header_ctrl = NULL;
|
|
|
|
|
|
+ tdm_dai_data = dev_get_drvdata(dai->dev);
|
|
|
+
|
|
|
msm_dai_q6_set_dai_id(dai);
|
|
|
|
|
|
port_idx = msm_dai_q6_get_port_idx(dai->id);
|