ASoC: mediatek: Add AFE platform driver
This is the DPCM based platform driver of AFE (Audio Front End) unit. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Koro Chen <koro.chen@mediatek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Родитель
b787f68c36
Коммит
ee0bcaff10
|
@ -0,0 +1,45 @@
|
|||
Mediatek AFE PCM controller
|
||||
|
||||
Required properties:
|
||||
- compatible = "mediatek,mt8173-afe-pcm";
|
||||
- reg: register location and size
|
||||
- interrupts: Should contain AFE interrupt
|
||||
- clock-names: should have these clock names:
|
||||
"infra_sys_audio_clk",
|
||||
"top_pdn_audio",
|
||||
"top_pdn_aud_intbus",
|
||||
"bck0",
|
||||
"bck1",
|
||||
"i2s0_m",
|
||||
"i2s1_m",
|
||||
"i2s2_m",
|
||||
"i2s3_m",
|
||||
"i2s3_b";
|
||||
|
||||
Example:
|
||||
|
||||
afe: mt8173-afe-pcm@11220000 {
|
||||
compatible = "mediatek,mt8173-afe-pcm";
|
||||
reg = <0 0x11220000 0 0x1000>;
|
||||
interrupts = <GIC_SPI 134 IRQ_TYPE_EDGE_FALLING>;
|
||||
clocks = <&infracfg INFRA_AUDIO>,
|
||||
<&topckgen TOP_AUDIO_SEL>,
|
||||
<&topckgen TOP_AUD_INTBUS_SEL>,
|
||||
<&topckgen TOP_APLL1_DIV0>,
|
||||
<&topckgen TOP_APLL2_DIV0>,
|
||||
<&topckgen TOP_I2S0_M_CK_SEL>,
|
||||
<&topckgen TOP_I2S1_M_CK_SEL>,
|
||||
<&topckgen TOP_I2S2_M_CK_SEL>,
|
||||
<&topckgen TOP_I2S3_M_CK_SEL>,
|
||||
<&topckgen TOP_I2S3_B_CK_SEL>;
|
||||
clock-names = "infra_sys_audio_clk",
|
||||
"top_pdn_audio",
|
||||
"top_pdn_aud_intbus",
|
||||
"bck0",
|
||||
"bck1",
|
||||
"i2s0_m",
|
||||
"i2s1_m",
|
||||
"i2s2_m",
|
||||
"i2s3_m",
|
||||
"i2s3_b";
|
||||
};
|
|
@ -45,6 +45,7 @@ source "sound/soc/nuc900/Kconfig"
|
|||
source "sound/soc/omap/Kconfig"
|
||||
source "sound/soc/kirkwood/Kconfig"
|
||||
source "sound/soc/intel/Kconfig"
|
||||
source "sound/soc/mediatek/Kconfig"
|
||||
source "sound/soc/mxs/Kconfig"
|
||||
source "sound/soc/pxa/Kconfig"
|
||||
source "sound/soc/qcom/Kconfig"
|
||||
|
|
|
@ -23,6 +23,7 @@ obj-$(CONFIG_SND_SOC) += dwc/
|
|||
obj-$(CONFIG_SND_SOC) += fsl/
|
||||
obj-$(CONFIG_SND_SOC) += jz4740/
|
||||
obj-$(CONFIG_SND_SOC) += intel/
|
||||
obj-$(CONFIG_SND_SOC) += mediatek/
|
||||
obj-$(CONFIG_SND_SOC) += mxs/
|
||||
obj-$(CONFIG_SND_SOC) += nuc900/
|
||||
obj-$(CONFIG_SND_SOC) += omap/
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
config SND_SOC_MEDIATEK
|
||||
tristate "ASoC support for Mediatek chip"
|
||||
depends on ARCH_MEDIATEK
|
||||
help
|
||||
This adds ASoC platform driver support for Mediatek chip
|
||||
that can be used with other codecs.
|
||||
Select Y if you have such device.
|
||||
Ex: MT8173
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
# MTK Platform Support
|
||||
obj-$(CONFIG_SND_SOC_MEDIATEK) += mtk-afe-pcm.o
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* mtk_afe_common.h -- Mediatek audio driver common definitions
|
||||
*
|
||||
* Copyright (c) 2015 MediaTek Inc.
|
||||
* Author: Koro Chen <koro.chen@mediatek.com>
|
||||
* Sascha Hauer <s.hauer@pengutronix.de>
|
||||
* Hidalgo Huang <hidalgo.huang@mediatek.com>
|
||||
* Ir Lian <ir.lian@mediatek.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _MTK_AFE_COMMON_H_
|
||||
#define _MTK_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,
|
||||
};
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
struct mtk_afe;
|
||||
struct snd_pcm_substream;
|
||||
|
||||
struct mtk_afe_memif_data {
|
||||
int id;
|
||||
const char *name;
|
||||
int reg_ofs_base;
|
||||
int reg_ofs_cur;
|
||||
int fs_shift;
|
||||
int mono_shift;
|
||||
int enable_shift;
|
||||
int irq_reg_cnt;
|
||||
int irq_cnt_shift;
|
||||
int irq_en_shift;
|
||||
int irq_fs_shift;
|
||||
int irq_clr_shift;
|
||||
};
|
||||
|
||||
struct mtk_afe_memif {
|
||||
unsigned int phys_buf_addr;
|
||||
int buffer_size;
|
||||
unsigned int hw_ptr; /* Previous IRQ's HW ptr */
|
||||
struct snd_pcm_substream *substream;
|
||||
const struct mtk_afe_memif_data *data;
|
||||
const struct mtk_afe_irq_data *irqdata;
|
||||
};
|
||||
|
||||
struct mtk_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];
|
||||
};
|
||||
#endif
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче