@@ -162,7 +162,7 @@ int mtk_afe_fe_hw_params(struct snd_pcm_substream *substream,
}
/* set rate */
- ret = mtk_memif_set_rate_substream(substream, id, rate);
+ ret = mtk_memif_set_rate_substream(dai->component, substream, id, rate);
if (ret) {
dev_err(afe->dev, "%s(), error, id %d, set rate %d, ret %d\n",
__func__, id, rate, ret);
@@ -225,7 +225,7 @@ int mtk_afe_fe_trigger(struct snd_pcm_substream *substream, int cmd,
irq_data->irq_cnt_shift);
/* set irq fs */
- fs = afe->irq_fs(substream, runtime->rate);
+ fs = afe->irq_fs(dai->component, substream, runtime->rate);
if (fs < 0)
return -EINVAL;
@@ -502,12 +502,10 @@ int mtk_memif_set_rate(struct mtk_base_afe *afe,
}
EXPORT_SYMBOL_GPL(mtk_memif_set_rate);
-int mtk_memif_set_rate_substream(struct snd_pcm_substream *substream,
+int mtk_memif_set_rate_substream(struct snd_soc_component *component,
+ struct snd_pcm_substream *substream,
int id, unsigned int rate)
{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_component *component =
- snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
int fs = 0;
@@ -518,7 +516,7 @@ int mtk_memif_set_rate_substream(struct snd_pcm_substream *substream,
return -EINVAL;
}
- fs = afe->memif_fs(substream, rate);
+ fs = afe->memif_fs(component, substream, rate);
if (fs < 0)
return -EINVAL;
@@ -44,7 +44,8 @@ int mtk_memif_set_channel(struct mtk_base_afe *afe,
int id, unsigned int channel);
int mtk_memif_set_rate(struct mtk_base_afe *afe,
int id, unsigned int rate);
-int mtk_memif_set_rate_substream(struct snd_pcm_substream *substream,
+int mtk_memif_set_rate_substream(struct snd_soc_component *component,
+ struct snd_pcm_substream *substream,
int id, unsigned int rate);
int mtk_memif_set_format(struct mtk_base_afe *afe,
int id, snd_pcm_format_t format);
@@ -97,9 +97,11 @@ struct mtk_base_afe {
unsigned int num_dai_drivers;
const struct snd_pcm_hardware *mtk_afe_hardware;
- int (*memif_fs)(struct snd_pcm_substream *substream,
+ int (*memif_fs)(struct snd_soc_component *component,
+ struct snd_pcm_substream *substream,
unsigned int rate);
- int (*irq_fs)(struct snd_pcm_substream *substream,
+ int (*irq_fs)(struct snd_soc_component *component,
+ struct snd_pcm_substream *substream,
unsigned int rate);
int (*get_dai_fs)(struct mtk_base_afe *afe,
int dai_id, unsigned int rate);
@@ -491,7 +491,8 @@ static int mt2701_dlm_fe_trigger(struct snd_pcm_substream *substream,
}
}
-static int mt2701_memif_fs(struct snd_pcm_substream *substream,
+static int mt2701_memif_fs(struct snd_soc_component *component,
+ struct snd_pcm_substream *substream,
unsigned int rate)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -505,7 +506,8 @@ static int mt2701_memif_fs(struct snd_pcm_substream *substream,
return fs;
}
-static int mt2701_irq_fs(struct snd_pcm_substream *substream, unsigned int rate)
+static int mt2701_irq_fs(struct snd_soc_component *component,
+ struct snd_pcm_substream *substream, unsigned int rate)
{
return mt2701_afe_i2s_fs(rate);
}
@@ -136,23 +136,20 @@ static const struct snd_pcm_hardware mt6797_afe_hardware = {
.fifo_size = 0,
};
-static int mt6797_memif_fs(struct snd_pcm_substream *substream,
+static int mt6797_memif_fs(struct snd_soc_component *component,
+ struct snd_pcm_substream *substream,
unsigned int rate)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_component *component =
- snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
int id = asoc_rtd_to_cpu(rtd, 0)->id;
return mt6797_rate_transform(afe->dev, rate, id);
}
-static int mt6797_irq_fs(struct snd_pcm_substream *substream, unsigned int rate)
+static int mt6797_irq_fs(struct snd_soc_component *component,
+ struct snd_pcm_substream *substream, unsigned int rate)
{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_component *component =
- snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
return mt6797_general_rate_transform(afe->dev, rate);
@@ -479,11 +479,11 @@ static int mt8173_afe_hdmi_trigger(struct snd_pcm_substream *substream, int cmd,
}
}
-static int mt8173_memif_fs(struct snd_pcm_substream *substream,
+static int mt8173_memif_fs(struct snd_soc_component *component,
+ struct snd_pcm_substream *substream,
unsigned int rate)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
struct mtk_base_afe_memif *memif = &afe->memif[asoc_rtd_to_cpu(rtd, 0)->id];
int fs;
@@ -509,7 +509,8 @@ static int mt8173_memif_fs(struct snd_pcm_substream *substream,
return fs;
}
-static int mt8173_irq_fs(struct snd_pcm_substream *substream, unsigned int rate)
+static int mt8173_irq_fs(struct snd_soc_component *component,
+ struct snd_pcm_substream *substream, unsigned int rate)
{
return mt8173_afe_i2s_fs(rate);
}
@@ -139,23 +139,20 @@ static const struct snd_pcm_hardware mt8183_afe_hardware = {
.fifo_size = 0,
};
-static int mt8183_memif_fs(struct snd_pcm_substream *substream,
+static int mt8183_memif_fs(struct snd_soc_component *component,
+ struct snd_pcm_substream *substream,
unsigned int rate)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_component *component =
- snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
int id = asoc_rtd_to_cpu(rtd, 0)->id;
return mt8183_rate_transform(afe->dev, rate, id);
}
-static int mt8183_irq_fs(struct snd_pcm_substream *substream, unsigned int rate)
+static int mt8183_irq_fs(struct snd_soc_component *component,
+ struct snd_pcm_substream *substream, unsigned int rate)
{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_component *component =
- snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
return mt8183_general_rate_transform(afe->dev, rate);