Commit 0d1d7a66 authored by Garlic Tseng's avatar Garlic Tseng Committed by Mark Brown
Browse files

ASoC: mediatek: Refine mt8173 driver and change config option



move mt8173 driver to another folder and add prefix.
add config option SND_SOC_MT8173
Signed-off-by: default avatarGarlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 0c198ed2
config SND_SOC_MEDIATEK
tristate "ASoC support for Mediatek chip"
config SND_SOC_MT8173
tristate "ASoC support for Mediatek MT8173 chip"
depends on ARCH_MEDIATEK
help
This adds ASoC platform driver support for Mediatek chip
This adds ASoC platform driver support for Mediatek MT8173 chip
that can be used with other codecs.
Select Y if you have such device.
Ex: MT8173
config SND_SOC_MT8173_MAX98090
tristate "ASoC Audio driver for MT8173 with MAX98090 codec"
depends on SND_SOC_MEDIATEK && I2C
depends on SND_SOC_MT8173 && I2C
select SND_SOC_MAX98090
help
This adds ASoC driver for Mediatek MT8173 boards
......@@ -19,7 +19,7 @@ config SND_SOC_MT8173_MAX98090
config SND_SOC_MT8173_RT5650
tristate "ASoC Audio driver for MT8173 with RT5650 codec"
depends on SND_SOC_MEDIATEK && I2C
depends on SND_SOC_MT8173 && I2C
select SND_SOC_RT5645
help
This adds ASoC driver for Mediatek MT8173 boards
......@@ -29,7 +29,7 @@ config SND_SOC_MT8173_RT5650
config SND_SOC_MT8173_RT5650_RT5514
tristate "ASoC Audio driver for MT8173 with RT5650 RT5514 codecs"
depends on SND_SOC_MEDIATEK && I2C
depends on SND_SOC_MT8173 && I2C
select SND_SOC_RT5645
select SND_SOC_RT5514
help
......@@ -40,7 +40,7 @@ config SND_SOC_MT8173_RT5650_RT5514
config SND_SOC_MT8173_RT5650_RT5676
tristate "ASoC Audio driver for MT8173 with RT5650 RT5676 codecs"
depends on SND_SOC_MEDIATEK && I2C
depends on SND_SOC_MT8173 && I2C
select SND_SOC_RT5645
select SND_SOC_RT5677
select SND_SOC_HDMI_CODEC
......
# MTK Platform Support
obj-$(CONFIG_SND_SOC_MEDIATEK) += mtk-afe-pcm.o
# Machine support
obj-$(CONFIG_SND_SOC_MT8173_MAX98090) += mt8173-max98090.o
obj-$(CONFIG_SND_SOC_MT8173_RT5650) += mt8173-rt5650.o
obj-$(CONFIG_SND_SOC_MT8173_RT5650_RT5514) += mt8173-rt5650-rt5514.o
obj-$(CONFIG_SND_SOC_MT8173_RT5650_RT5676) += mt8173-rt5650-rt5676.o
# 8173 Machine support
obj-$(CONFIG_SND_SOC_MT8173) += mt8173/
# MTK Platform Support
obj-$(CONFIG_SND_SOC_MT8173) += mt8173-afe-pcm.o
# Machine support
obj-$(CONFIG_SND_SOC_MT8173_MAX98090) += mt8173-max98090.o
obj-$(CONFIG_SND_SOC_MT8173_RT5650) += mt8173-rt5650.o
obj-$(CONFIG_SND_SOC_MT8173_RT5650_RT5514) += mt8173-rt5650-rt5514.o
obj-$(CONFIG_SND_SOC_MT8173_RT5650_RT5676) += mt8173-rt5650-rt5676.o
/*
* mtk_afe_common.h -- Mediatek audio driver common definitions
* mt8173_afe_common.h -- Mediatek 8173 audio driver common definitions
*
* Copyright (c) 2015 MediaTek Inc.
* Author: Koro Chen <koro.chen@mediatek.com>
......@@ -17,64 +17,64 @@
* GNU General Public License for more details.
*/
#ifndef _MTK_AFE_COMMON_H_
#define _MTK_AFE_COMMON_H_
#ifndef _MT8173_AFE_COMMON_H_
#define _MT8173_AFE_COMMON_H_
#include <linux/clk.h>
#include <linux/regmap.h>
enum {
MTK_AFE_MEMIF_DL1,
MTK_AFE_MEMIF_DL2,
MTK_AFE_MEMIF_VUL,
MTK_AFE_MEMIF_DAI,
MTK_AFE_MEMIF_AWB,
MTK_AFE_MEMIF_MOD_DAI,
MTK_AFE_MEMIF_HDMI,
MTK_AFE_MEMIF_NUM,
MTK_AFE_IO_MOD_PCM1 = MTK_AFE_MEMIF_NUM,
MTK_AFE_IO_MOD_PCM2,
MTK_AFE_IO_PMIC,
MTK_AFE_IO_I2S,
MTK_AFE_IO_2ND_I2S,
MTK_AFE_IO_HW_GAIN1,
MTK_AFE_IO_HW_GAIN2,
MTK_AFE_IO_MRG_O,
MTK_AFE_IO_MRG_I,
MTK_AFE_IO_DAIBT,
MTK_AFE_IO_HDMI,
MT8173_AFE_MEMIF_DL1,
MT8173_AFE_MEMIF_DL2,
MT8173_AFE_MEMIF_VUL,
MT8173_AFE_MEMIF_DAI,
MT8173_AFE_MEMIF_AWB,
MT8173_AFE_MEMIF_MOD_DAI,
MT8173_AFE_MEMIF_HDMI,
MT8173_AFE_MEMIF_NUM,
MT8173_AFE_IO_MOD_PCM1 = MT8173_AFE_MEMIF_NUM,
MT8173_AFE_IO_MOD_PCM2,
MT8173_AFE_IO_PMIC,
MT8173_AFE_IO_I2S,
MT8173_AFE_IO_2ND_I2S,
MT8173_AFE_IO_HW_GAIN1,
MT8173_AFE_IO_HW_GAIN2,
MT8173_AFE_IO_MRG_O,
MT8173_AFE_IO_MRG_I,
MT8173_AFE_IO_DAIBT,
MT8173_AFE_IO_HDMI,
};
enum {
MTK_AFE_IRQ_1,
MTK_AFE_IRQ_2,
MTK_AFE_IRQ_3,
MTK_AFE_IRQ_4,
MTK_AFE_IRQ_5,
MTK_AFE_IRQ_6,
MTK_AFE_IRQ_7,
MTK_AFE_IRQ_8,
MTK_AFE_IRQ_NUM,
MT8173_AFE_IRQ_1,
MT8173_AFE_IRQ_2,
MT8173_AFE_IRQ_3,
MT8173_AFE_IRQ_4,
MT8173_AFE_IRQ_5,
MT8173_AFE_IRQ_6,
MT8173_AFE_IRQ_7,
MT8173_AFE_IRQ_8,
MT8173_AFE_IRQ_NUM,
};
enum {
MTK_CLK_INFRASYS_AUD,
MTK_CLK_TOP_PDN_AUD,
MTK_CLK_TOP_PDN_AUD_BUS,
MTK_CLK_I2S0_M,
MTK_CLK_I2S1_M,
MTK_CLK_I2S2_M,
MTK_CLK_I2S3_M,
MTK_CLK_I2S3_B,
MTK_CLK_BCK0,
MTK_CLK_BCK1,
MTK_CLK_NUM
MT8173_CLK_INFRASYS_AUD,
MT8173_CLK_TOP_PDN_AUD,
MT8173_CLK_TOP_PDN_AUD_BUS,
MT8173_CLK_I2S0_M,
MT8173_CLK_I2S1_M,
MT8173_CLK_I2S2_M,
MT8173_CLK_I2S3_M,
MT8173_CLK_I2S3_B,
MT8173_CLK_BCK0,
MT8173_CLK_BCK1,
MT8173_CLK_NUM
};
struct mtk_afe;
struct mt8173_afe;
struct snd_pcm_substream;
struct mtk_afe_memif_data {
struct mt8173_afe_memif_data {
int id;
const char *name;
int reg_ofs_base;
......@@ -90,12 +90,12 @@ struct mtk_afe_memif_data {
int msb_shift;
};
struct mtk_afe_memif {
struct mt8173_afe_memif {
unsigned int phys_buf_addr;
int buffer_size;
struct snd_pcm_substream *substream;
const struct mtk_afe_memif_data *data;
const struct mtk_afe_irq_data *irqdata;
const struct mt8173_afe_memif_data *data;
const struct mt8173_afe_irq_data *irqdata;
};
#endif
/*
* Mediatek ALSA SoC AFE platform driver
* Mediatek 8173 ALSA SoC AFE platform driver
*
* Copyright (c) 2015 MediaTek Inc.
* Author: Koro Chen <koro.chen@mediatek.com>
......@@ -24,7 +24,7 @@
#include <linux/dma-mapping.h>
#include <linux/pm_runtime.h>
#include <sound/soc.h>
#include "mtk-afe-common.h"
#include "mt8173-afe-common.h"
/*****************************************************************************
* R E G I S T E R D E F I N I T I O N
......@@ -135,7 +135,7 @@ enum afe_tdm_ch_start {
AFE_TDM_CH_ZERO,
};
static const unsigned int mtk_afe_backup_list[] = {
static const unsigned int mt8173_afe_backup_list[] = {
AUDIO_TOP_CON0,
AFE_CONN1,
AFE_CONN2,
......@@ -152,18 +152,18 @@ static const unsigned int mtk_afe_backup_list[] = {
AFE_DAC_CON0,
};
struct mtk_afe {
struct mt8173_afe {
/* address for ioremap audio hardware register */
void __iomem *base_addr;
struct device *dev;
struct regmap *regmap;
struct mtk_afe_memif memif[MTK_AFE_MEMIF_NUM];
struct clk *clocks[MTK_CLK_NUM];
unsigned int backup_regs[ARRAY_SIZE(mtk_afe_backup_list)];
struct mt8173_afe_memif memif[MT8173_AFE_MEMIF_NUM];
struct clk *clocks[MT8173_CLK_NUM];
unsigned int backup_regs[ARRAY_SIZE(mt8173_afe_backup_list)];
bool suspended;
};
static const struct snd_pcm_hardware mtk_afe_hardware = {
static const struct snd_pcm_hardware mt8173_afe_hardware = {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID),
.buffer_bytes_max = 256 * 1024,
......@@ -174,12 +174,12 @@ static const struct snd_pcm_hardware mtk_afe_hardware = {
.fifo_size = 0,
};
static snd_pcm_uframes_t mtk_afe_pcm_pointer
static snd_pcm_uframes_t mt8173_afe_pcm_pointer
(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct mtk_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
struct mtk_afe_memif *memif = &afe->memif[rtd->cpu_dai->id];
struct mt8173_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
struct mt8173_afe_memif *memif = &afe->memif[rtd->cpu_dai->id];
unsigned int hw_ptr;
int ret;
......@@ -193,40 +193,40 @@ static snd_pcm_uframes_t mtk_afe_pcm_pointer
hw_ptr - memif->phys_buf_addr);
}
static const struct snd_pcm_ops mtk_afe_pcm_ops = {
static const struct snd_pcm_ops mt8173_afe_pcm_ops = {
.ioctl = snd_pcm_lib_ioctl,
.pointer = mtk_afe_pcm_pointer,
.pointer = mt8173_afe_pcm_pointer,
};
static int mtk_afe_pcm_new(struct snd_soc_pcm_runtime *rtd)
static int mt8173_afe_pcm_new(struct snd_soc_pcm_runtime *rtd)
{
size_t size;
struct snd_card *card = rtd->card->snd_card;
struct snd_pcm *pcm = rtd->pcm;
size = mtk_afe_hardware.buffer_bytes_max;
size = mt8173_afe_hardware.buffer_bytes_max;
return snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
card->dev, size, size);
}
static void mtk_afe_pcm_free(struct snd_pcm *pcm)
static void mt8173_afe_pcm_free(struct snd_pcm *pcm)
{
snd_pcm_lib_preallocate_free_for_all(pcm);
}
static const struct snd_soc_platform_driver mtk_afe_pcm_platform = {
.ops = &mtk_afe_pcm_ops,
.pcm_new = mtk_afe_pcm_new,
.pcm_free = mtk_afe_pcm_free,
static const struct snd_soc_platform_driver mt8173_afe_pcm_platform = {
.ops = &mt8173_afe_pcm_ops,
.pcm_new = mt8173_afe_pcm_new,
.pcm_free = mt8173_afe_pcm_free,
};
struct mtk_afe_rate {
struct mt8173_afe_rate {
unsigned int rate;
unsigned int regvalue;
};
static const struct mtk_afe_rate mtk_afe_i2s_rates[] = {
static const struct mt8173_afe_rate mt8173_afe_i2s_rates[] = {
{ .rate = 8000, .regvalue = 0 },
{ .rate = 11025, .regvalue = 1 },
{ .rate = 12000, .regvalue = 2 },
......@@ -242,21 +242,21 @@ static const struct mtk_afe_rate mtk_afe_i2s_rates[] = {
{ .rate = 192000, .regvalue = 14 },
};
static int mtk_afe_i2s_fs(unsigned int sample_rate)
static int mt8173_afe_i2s_fs(unsigned int sample_rate)
{
int i;
for (i = 0; i < ARRAY_SIZE(mtk_afe_i2s_rates); i++)
if (mtk_afe_i2s_rates[i].rate == sample_rate)
return mtk_afe_i2s_rates[i].regvalue;
for (i = 0; i < ARRAY_SIZE(mt8173_afe_i2s_rates); i++)
if (mt8173_afe_i2s_rates[i].rate == sample_rate)
return mt8173_afe_i2s_rates[i].regvalue;
return -EINVAL;
}
static int mtk_afe_set_i2s(struct mtk_afe *afe, unsigned int rate)
static int mt8173_afe_set_i2s(struct mt8173_afe *afe, unsigned int rate)
{
unsigned int val;
int fs = mtk_afe_i2s_fs(rate);
int fs = mt8173_afe_i2s_fs(rate);
if (fs < 0)
return -EINVAL;
......@@ -281,7 +281,7 @@ static int mtk_afe_set_i2s(struct mtk_afe *afe, unsigned int rate)
return 0;
}
static void mtk_afe_set_i2s_enable(struct mtk_afe *afe, bool enable)
static void mt8173_afe_set_i2s_enable(struct mt8173_afe *afe, bool enable)
{
unsigned int val;
......@@ -296,8 +296,8 @@ static void mtk_afe_set_i2s_enable(struct mtk_afe *afe, bool enable)
regmap_update_bits(afe->regmap, AFE_I2S_CON1, 0x1, enable);
}
static int mtk_afe_dais_enable_clks(struct mtk_afe *afe,
struct clk *m_ck, struct clk *b_ck)
static int mt8173_afe_dais_enable_clks(struct mt8173_afe *afe,
struct clk *m_ck, struct clk *b_ck)
{
int ret;
......@@ -319,9 +319,9 @@ static int mtk_afe_dais_enable_clks(struct mtk_afe *afe,
return 0;
}
static int mtk_afe_dais_set_clks(struct mtk_afe *afe,
struct clk *m_ck, unsigned int mck_rate,
struct clk *b_ck, unsigned int bck_rate)
static int mt8173_afe_dais_set_clks(struct mt8173_afe *afe,
struct clk *m_ck, unsigned int mck_rate,
struct clk *b_ck, unsigned int bck_rate)
{
int ret;
......@@ -343,8 +343,8 @@ static int mtk_afe_dais_set_clks(struct mtk_afe *afe,
return 0;
}
static void mtk_afe_dais_disable_clks(struct mtk_afe *afe,
struct clk *m_ck, struct clk *b_ck)
static void mt8173_afe_dais_disable_clks(struct mt8173_afe *afe,
struct clk *m_ck, struct clk *b_ck)
{
if (m_ck)
clk_disable_unprepare(m_ck);
......@@ -352,11 +352,11 @@ static void mtk_afe_dais_disable_clks(struct mtk_afe *afe,
clk_disable_unprepare(b_ck);
}
static int mtk_afe_i2s_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
static int mt8173_afe_i2s_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct mtk_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
struct mt8173_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
if (dai->active)
return 0;
......@@ -366,84 +366,82 @@ static int mtk_afe_i2s_startup(struct snd_pcm_substream *substream,
return 0;
}
static void mtk_afe_i2s_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
static void mt8173_afe_i2s_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct mtk_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
struct mt8173_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
if (dai->active)
return;
mtk_afe_set_i2s_enable(afe, false);
mt8173_afe_set_i2s_enable(afe, false);
regmap_update_bits(afe->regmap, AUDIO_TOP_CON0,
AUD_TCON0_PDN_22M | AUD_TCON0_PDN_24M,
AUD_TCON0_PDN_22M | AUD_TCON0_PDN_24M);
}
static int mtk_afe_i2s_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
static int mt8173_afe_i2s_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_pcm_runtime * const runtime = substream->runtime;
struct mtk_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
struct mt8173_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
int ret;
mtk_afe_dais_set_clks(afe,
afe->clocks[MTK_CLK_I2S1_M], runtime->rate * 256,
NULL, 0);
mtk_afe_dais_set_clks(afe,
afe->clocks[MTK_CLK_I2S2_M], runtime->rate * 256,
NULL, 0);
mt8173_afe_dais_set_clks(afe, afe->clocks[MT8173_CLK_I2S1_M],
runtime->rate * 256, NULL, 0);
mt8173_afe_dais_set_clks(afe, afe->clocks[MT8173_CLK_I2S2_M],
runtime->rate * 256, NULL, 0);
/* config I2S */
ret = mtk_afe_set_i2s(afe, substream->runtime->rate);
ret = mt8173_afe_set_i2s(afe, substream->runtime->rate);
if (ret)
return ret;
mtk_afe_set_i2s_enable(afe, true);
mt8173_afe_set_i2s_enable(afe, true);
return 0;
}
static int mtk_afe_hdmi_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
static int mt8173_afe_hdmi_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct mtk_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
struct mt8173_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
if (dai->active)
return 0;
mtk_afe_dais_enable_clks(afe, afe->clocks[MTK_CLK_I2S3_M],
afe->clocks[MTK_CLK_I2S3_B]);
mt8173_afe_dais_enable_clks(afe, afe->clocks[MT8173_CLK_I2S3_M],
afe->clocks[MT8173_CLK_I2S3_B]);
return 0;
}
static void mtk_afe_hdmi_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
static void mt8173_afe_hdmi_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct mtk_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
struct mt8173_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
if (dai->active)
return;
mtk_afe_dais_disable_clks(afe, afe->clocks[MTK_CLK_I2S3_M],
afe->clocks[MTK_CLK_I2S3_B]);
mt8173_afe_dais_disable_clks(afe, afe->clocks[MT8173_CLK_I2S3_M],
afe->clocks[MT8173_CLK_I2S3_B]);
}
static int mtk_afe_hdmi_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
static int mt8173_afe_hdmi_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_pcm_runtime * const runtime = substream->runtime;
struct mtk_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
struct mt8173_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
unsigned int val;
mtk_afe_dais_set_clks(afe,
afe->clocks[MTK_CLK_I2S3_M], runtime->rate * 128,
afe->clocks[MTK_CLK_I2S3_B],
runtime->rate * runtime->channels * 32);
mt8173_afe_dais_set_clks(afe, afe->clocks[MT8173_CLK_I2S3_M],
runtime->rate * 128,
afe->clocks[MT8173_CLK_I2S3_B],
runtime->rate * runtime->channels * 32);
val = AFE_TDM_CON1_BCK_INV |
AFE_TDM_CON1_LRCK_INV |
......@@ -494,11 +492,11 @@ static int mtk_afe_hdmi_prepare(struct snd_pcm_substream *substream,
return 0;
}
static int mtk_afe_hdmi_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai)
static int mt8173_afe_hdmi_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct mtk_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
struct mt8173_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
dev_info(afe->dev, "%s cmd=%d %s\n", __func__, cmd, dai->name);
......@@ -540,18 +538,18 @@ static int mtk_afe_hdmi_trigger(struct snd_pcm_substream *substream, int cmd,
}
}
static int mtk_afe_dais_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
static int mt8173_afe_dais_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct mtk_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
struct mt8173_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
struct snd_pcm_runtime *runtime = substream->runtime;
struct mtk_afe_memif *memif = &afe->memif[rtd->cpu_dai->id];
struct mt8173_afe_memif *memif = &afe->memif[rtd->cpu_dai->id];
int ret;
memif->substream = substream;
snd_soc_set_runtime_hwparams(substream, &mtk_afe_hardware);
snd_soc_set_runtime_hwparams(substream, &mt8173_afe_hardware);
/*
* Capture cannot use ping-pong buffer since hw_ptr at IRQ may be
......@@ -563,7 +561,7 @@ static int mtk_afe_dais_startup(struct snd_pcm_substream *substream,
ret = snd_pcm_hw_constraint_minmax(runtime,
SNDRV_PCM_HW_PARAM_PERIODS,
3,
mtk_afe_hardware.periods_max);
mt8173_afe_hardware.periods_max);
if (ret < 0) {
dev_err(afe->dev, "hw_constraint_minmax failed\n");
return ret;
......@@ -576,23 +574,23 @@ static int mtk_afe_dais_startup(struct snd_pcm_substream *substream,
return ret;
}
static void mtk_afe_dais_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
static void mt8173_afe_dais_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct mtk_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
struct mtk_afe_memif *memif = &afe->memif[rtd->cpu_dai->id];
struct mt8173_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
struct mt8173_afe_memif *memif = &afe->memif[rtd->cpu_dai->id];
memif->substream = NULL;
}
static int mtk_afe_dais_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
static int mt8173_afe_dais_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct mtk_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
struct mtk_afe_memif *memif = &afe->memif[rtd->cpu_dai->id];
struct mt8173_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
struct mt8173_afe_memif *memif = &afe->memif[rtd->cpu_dai->id];
int msb_at_bit33 = 0;
int ret;
......@@ -634,8 +632,8 @@ static int mtk_afe_dais_hw_params(struct snd_pcm_substream *substream,
/* set rate */
if (memif->data->fs_shift < 0)
return 0;
if (memif->data->id == MTK_AFE_MEMIF_DAI ||
memif->data->id == MTK_AFE_MEMIF_MOD_DAI) {
if (memif->data->id == MT8173_AFE_MEMIF_DAI ||
memif->data->id == MT8173_AFE_MEMIF_MOD_DAI) {
unsigned int val;
switch (params_rate(params)) {
......@@ -652,7 +650,7 @@ static int mtk_afe_dais_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
if (memif->data->id == MTK_AFE_MEMIF_DAI)
if (memif->data->id == MT8173_AFE_MEMIF_DAI)
regmap_update_bits(afe->regmap, AFE_DAC_CON0,
0x3 << memif->data->fs_shift,
val << memif->data->fs_shift);
......@@ -662,7 +660,7 @@ static int mtk_afe_dais_hw_params(struct snd_pcm_substream *substream,
val << memif->data->fs_shift);