Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
84bf51ea
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
84bf51ea
编写于
5月 27, 2016
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'asoc/topic/tlv320aic32x4' into asoc-next
上级
a5a3717a
2213fc35
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
369 addition
and
84 deletion
+369
-84
sound/soc/codecs/Kconfig
sound/soc/codecs/Kconfig
+12
-1
sound/soc/codecs/Makefile
sound/soc/codecs/Makefile
+4
-0
sound/soc/codecs/tlv320aic32x4-i2c.c
sound/soc/codecs/tlv320aic32x4-i2c.c
+74
-0
sound/soc/codecs/tlv320aic32x4-spi.c
sound/soc/codecs/tlv320aic32x4-spi.c
+76
-0
sound/soc/codecs/tlv320aic32x4.c
sound/soc/codecs/tlv320aic32x4.c
+196
-83
sound/soc/codecs/tlv320aic32x4.h
sound/soc/codecs/tlv320aic32x4.h
+7
-0
未找到文件。
sound/soc/codecs/Kconfig
浏览文件 @
84bf51ea
...
@@ -131,7 +131,8 @@ config SND_SOC_ALL_CODECS
...
@@ -131,7 +131,8 @@ config SND_SOC_ALL_CODECS
select SND_SOC_TLV320AIC23_SPI if SPI_MASTER
select SND_SOC_TLV320AIC23_SPI if SPI_MASTER
select SND_SOC_TLV320AIC26 if SPI_MASTER
select SND_SOC_TLV320AIC26 if SPI_MASTER
select SND_SOC_TLV320AIC31XX if I2C
select SND_SOC_TLV320AIC31XX if I2C
select SND_SOC_TLV320AIC32X4 if I2C
select SND_SOC_TLV320AIC32X4_I2C if I2C
select SND_SOC_TLV320AIC32X4_SPI if SPI_MASTER
select SND_SOC_TLV320AIC3X if I2C
select SND_SOC_TLV320AIC3X if I2C
select SND_SOC_TPA6130A2 if I2C
select SND_SOC_TPA6130A2 if I2C
select SND_SOC_TLV320DAC33 if I2C
select SND_SOC_TLV320DAC33 if I2C
...
@@ -780,6 +781,16 @@ config SND_SOC_TLV320AIC31XX
...
@@ -780,6 +781,16 @@ config SND_SOC_TLV320AIC31XX
config SND_SOC_TLV320AIC32X4
config SND_SOC_TLV320AIC32X4
tristate
tristate
config SND_SOC_TLV320AIC32X4_I2C
tristate
depends on I2C
select SND_SOC_TLV320AIC32X4
config SND_SOC_TLV320AIC32X4_SPI
tristate
depends on SPI_MASTER
select SND_SOC_TLV320AIC32X4
config SND_SOC_TLV320AIC3X
config SND_SOC_TLV320AIC3X
tristate "Texas Instruments TLV320AIC3x CODECs"
tristate "Texas Instruments TLV320AIC3x CODECs"
depends on I2C
depends on I2C
...
...
sound/soc/codecs/Makefile
浏览文件 @
84bf51ea
...
@@ -138,6 +138,8 @@ snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o
...
@@ -138,6 +138,8 @@ snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o
snd-soc-tlv320aic26-objs
:=
tlv320aic26.o
snd-soc-tlv320aic26-objs
:=
tlv320aic26.o
snd-soc-tlv320aic31xx-objs
:=
tlv320aic31xx.o
snd-soc-tlv320aic31xx-objs
:=
tlv320aic31xx.o
snd-soc-tlv320aic32x4-objs
:=
tlv320aic32x4.o
snd-soc-tlv320aic32x4-objs
:=
tlv320aic32x4.o
snd-soc-tlv320aic32x4-i2c-objs
:=
tlv320aic32x4-i2c.o
snd-soc-tlv320aic32x4-spi-objs
:=
tlv320aic32x4-spi.o
snd-soc-tlv320aic3x-objs
:=
tlv320aic3x.o
snd-soc-tlv320aic3x-objs
:=
tlv320aic3x.o
snd-soc-tlv320dac33-objs
:=
tlv320dac33.o
snd-soc-tlv320dac33-objs
:=
tlv320dac33.o
snd-soc-ts3a227e-objs
:=
ts3a227e.o
snd-soc-ts3a227e-objs
:=
ts3a227e.o
...
@@ -346,6 +348,8 @@ obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o
...
@@ -346,6 +348,8 @@ obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o
obj-$(CONFIG_SND_SOC_TLV320AIC26)
+=
snd-soc-tlv320aic26.o
obj-$(CONFIG_SND_SOC_TLV320AIC26)
+=
snd-soc-tlv320aic26.o
obj-$(CONFIG_SND_SOC_TLV320AIC31XX)
+=
snd-soc-tlv320aic31xx.o
obj-$(CONFIG_SND_SOC_TLV320AIC31XX)
+=
snd-soc-tlv320aic31xx.o
obj-$(CONFIG_SND_SOC_TLV320AIC32X4)
+=
snd-soc-tlv320aic32x4.o
obj-$(CONFIG_SND_SOC_TLV320AIC32X4)
+=
snd-soc-tlv320aic32x4.o
obj-$(CONFIG_SND_SOC_TLV320AIC32X4_I2C)
+=
snd-soc-tlv320aic32x4-i2c.o
obj-$(CONFIG_SND_SOC_TLV320AIC32X4_SPI)
+=
snd-soc-tlv320aic32x4-spi.o
obj-$(CONFIG_SND_SOC_TLV320AIC3X)
+=
snd-soc-tlv320aic3x.o
obj-$(CONFIG_SND_SOC_TLV320AIC3X)
+=
snd-soc-tlv320aic3x.o
obj-$(CONFIG_SND_SOC_TLV320DAC33)
+=
snd-soc-tlv320dac33.o
obj-$(CONFIG_SND_SOC_TLV320DAC33)
+=
snd-soc-tlv320dac33.o
obj-$(CONFIG_SND_SOC_TS3A227E)
+=
snd-soc-ts3a227e.o
obj-$(CONFIG_SND_SOC_TS3A227E)
+=
snd-soc-ts3a227e.o
...
...
sound/soc/codecs/tlv320aic32x4-i2c.c
0 → 100644
浏览文件 @
84bf51ea
/*
* linux/sound/soc/codecs/tlv320aic32x4-i2c.c
*
* Copyright 2011 NW Digital Radio
*
* Author: Jeremy McDermond <nh6z@nh6z.net>
*
* Based on sound/soc/codecs/wm8974 and TI driver for kernel 2.6.27.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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.
*/
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/regmap.h>
#include <sound/soc.h>
#include "tlv320aic32x4.h"
static
int
aic32x4_i2c_probe
(
struct
i2c_client
*
i2c
,
const
struct
i2c_device_id
*
id
)
{
struct
regmap
*
regmap
;
struct
regmap_config
config
;
config
=
aic32x4_regmap_config
;
config
.
reg_bits
=
8
;
config
.
val_bits
=
8
;
regmap
=
devm_regmap_init_i2c
(
i2c
,
&
config
);
return
aic32x4_probe
(
&
i2c
->
dev
,
regmap
);
}
static
int
aic32x4_i2c_remove
(
struct
i2c_client
*
i2c
)
{
return
aic32x4_remove
(
&
i2c
->
dev
);
}
static
const
struct
i2c_device_id
aic32x4_i2c_id
[]
=
{
{
"tlv320aic32x4"
,
0
},
{
/* sentinel */
}
};
MODULE_DEVICE_TABLE
(
i2c
,
aic32x4_i2c_id
);
static
const
struct
of_device_id
aic32x4_of_id
[]
=
{
{
.
compatible
=
"ti,tlv320aic32x4"
,
},
{
/* senitel */
}
};
MODULE_DEVICE_TABLE
(
of
,
aic32x4_of_id
);
static
struct
i2c_driver
aic32x4_i2c_driver
=
{
.
driver
=
{
.
name
=
"tlv320aic32x4"
,
.
of_match_table
=
aic32x4_of_id
,
},
.
probe
=
aic32x4_i2c_probe
,
.
remove
=
aic32x4_i2c_remove
,
.
id_table
=
aic32x4_i2c_id
,
};
module_i2c_driver
(
aic32x4_i2c_driver
);
MODULE_DESCRIPTION
(
"ASoC TLV320AIC32x4 codec driver I2C"
);
MODULE_AUTHOR
(
"Jeremy McDermond <nh6z@nh6z.net>"
);
MODULE_LICENSE
(
"GPL"
);
sound/soc/codecs/tlv320aic32x4-spi.c
0 → 100644
浏览文件 @
84bf51ea
/*
* linux/sound/soc/codecs/tlv320aic32x4-spi.c
*
* Copyright 2011 NW Digital Radio
*
* Author: Jeremy McDermond <nh6z@nh6z.net>
*
* Based on sound/soc/codecs/wm8974 and TI driver for kernel 2.6.27.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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.
*/
#include <linux/spi/spi.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/regmap.h>
#include <sound/soc.h>
#include "tlv320aic32x4.h"
static
int
aic32x4_spi_probe
(
struct
spi_device
*
spi
)
{
struct
regmap
*
regmap
;
struct
regmap_config
config
;
config
=
aic32x4_regmap_config
;
config
.
reg_bits
=
7
;
config
.
pad_bits
=
1
;
config
.
val_bits
=
8
;
config
.
read_flag_mask
=
0x01
;
regmap
=
devm_regmap_init_spi
(
spi
,
&
config
);
return
aic32x4_probe
(
&
spi
->
dev
,
regmap
);
}
static
int
aic32x4_spi_remove
(
struct
spi_device
*
spi
)
{
return
aic32x4_remove
(
&
spi
->
dev
);
}
static
const
struct
spi_device_id
aic32x4_spi_id
[]
=
{
{
"tlv320aic32x4"
,
0
},
{
/* sentinel */
}
};
MODULE_DEVICE_TABLE
(
spi
,
aic32x4_spi_id
);
static
const
struct
of_device_id
aic32x4_of_id
[]
=
{
{
.
compatible
=
"ti,tlv320aic32x4"
,
},
{
/* senitel */
}
};
MODULE_DEVICE_TABLE
(
of
,
aic32x4_of_id
);
static
struct
spi_driver
aic32x4_spi_driver
=
{
.
driver
=
{
.
name
=
"tlv320aic32x4"
,
.
owner
=
THIS_MODULE
,
.
of_match_table
=
aic32x4_of_id
,
},
.
probe
=
aic32x4_spi_probe
,
.
remove
=
aic32x4_spi_remove
,
.
id_table
=
aic32x4_spi_id
,
};
module_spi_driver
(
aic32x4_spi_driver
);
MODULE_DESCRIPTION
(
"ASoC TLV320AIC32x4 codec driver SPI"
);
MODULE_AUTHOR
(
"Jeremy McDermond <nh6z@nh6z.net>"
);
MODULE_LICENSE
(
"GPL"
);
sound/soc/codecs/tlv320aic32x4.c
浏览文件 @
84bf51ea
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
#include <linux/pm.h>
#include <linux/pm.h>
#include <linux/gpio.h>
#include <linux/gpio.h>
#include <linux/of_gpio.h>
#include <linux/of_gpio.h>
#include <linux/i2c.h>
#include <linux/cdev.h>
#include <linux/cdev.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/clk.h>
#include <linux/clk.h>
...
@@ -160,7 +159,10 @@ static const struct aic32x4_rate_divs aic32x4_divs[] = {
...
@@ -160,7 +159,10 @@ static const struct aic32x4_rate_divs aic32x4_divs[] = {
/* 48k rate */
/* 48k rate */
{
AIC32X4_FREQ_12000000
,
48000
,
1
,
8
,
1920
,
128
,
2
,
8
,
128
,
2
,
8
,
4
},
{
AIC32X4_FREQ_12000000
,
48000
,
1
,
8
,
1920
,
128
,
2
,
8
,
128
,
2
,
8
,
4
},
{
AIC32X4_FREQ_24000000
,
48000
,
2
,
8
,
1920
,
128
,
8
,
2
,
64
,
8
,
4
,
4
},
{
AIC32X4_FREQ_24000000
,
48000
,
2
,
8
,
1920
,
128
,
8
,
2
,
64
,
8
,
4
,
4
},
{
AIC32X4_FREQ_25000000
,
48000
,
2
,
7
,
8643
,
128
,
8
,
2
,
64
,
8
,
4
,
4
}
{
AIC32X4_FREQ_25000000
,
48000
,
2
,
7
,
8643
,
128
,
8
,
2
,
64
,
8
,
4
,
4
},
/* 96k rate */
{
AIC32X4_FREQ_25000000
,
96000
,
2
,
7
,
8643
,
64
,
4
,
4
,
64
,
4
,
4
,
1
},
};
};
static
const
struct
snd_kcontrol_new
hpl_output_mixer_controls
[]
=
{
static
const
struct
snd_kcontrol_new
hpl_output_mixer_controls
[]
=
{
...
@@ -181,16 +183,71 @@ static const struct snd_kcontrol_new lor_output_mixer_controls[] = {
...
@@ -181,16 +183,71 @@ static const struct snd_kcontrol_new lor_output_mixer_controls[] = {
SOC_DAPM_SINGLE
(
"R_DAC Switch"
,
AIC32X4_LORROUTE
,
3
,
1
,
0
),
SOC_DAPM_SINGLE
(
"R_DAC Switch"
,
AIC32X4_LORROUTE
,
3
,
1
,
0
),
};
};
static
const
struct
snd_kcontrol_new
left_input_mixer_controls
[]
=
{
static
const
char
*
const
resistor_text
[]
=
{
SOC_DAPM_SINGLE
(
"IN1_L P Switch"
,
AIC32X4_LMICPGAPIN
,
6
,
1
,
0
),
"Off"
,
"10 kOhm"
,
"20 kOhm"
,
"40 kOhm"
,
SOC_DAPM_SINGLE
(
"IN2_L P Switch"
,
AIC32X4_LMICPGAPIN
,
4
,
1
,
0
),
SOC_DAPM_SINGLE
(
"IN3_L P Switch"
,
AIC32X4_LMICPGAPIN
,
2
,
1
,
0
),
};
};
static
const
struct
snd_kcontrol_new
right_input_mixer_controls
[]
=
{
/* Left mixer pins */
SOC_DAPM_SINGLE
(
"IN1_R P Switch"
,
AIC32X4_RMICPGAPIN
,
6
,
1
,
0
),
static
SOC_ENUM_SINGLE_DECL
(
in1l_lpga_p_enum
,
AIC32X4_LMICPGAPIN
,
6
,
resistor_text
);
SOC_DAPM_SINGLE
(
"IN2_R P Switch"
,
AIC32X4_RMICPGAPIN
,
4
,
1
,
0
),
static
SOC_ENUM_SINGLE_DECL
(
in2l_lpga_p_enum
,
AIC32X4_LMICPGAPIN
,
4
,
resistor_text
);
SOC_DAPM_SINGLE
(
"IN3_R P Switch"
,
AIC32X4_RMICPGAPIN
,
2
,
1
,
0
),
static
SOC_ENUM_SINGLE_DECL
(
in3l_lpga_p_enum
,
AIC32X4_LMICPGAPIN
,
2
,
resistor_text
);
static
SOC_ENUM_SINGLE_DECL
(
in1r_lpga_p_enum
,
AIC32X4_LMICPGAPIN
,
0
,
resistor_text
);
static
SOC_ENUM_SINGLE_DECL
(
cml_lpga_n_enum
,
AIC32X4_LMICPGANIN
,
6
,
resistor_text
);
static
SOC_ENUM_SINGLE_DECL
(
in2r_lpga_n_enum
,
AIC32X4_LMICPGANIN
,
4
,
resistor_text
);
static
SOC_ENUM_SINGLE_DECL
(
in3r_lpga_n_enum
,
AIC32X4_LMICPGANIN
,
2
,
resistor_text
);
static
const
struct
snd_kcontrol_new
in1l_to_lmixer_controls
[]
=
{
SOC_DAPM_ENUM
(
"IN1_L L+ Switch"
,
in1l_lpga_p_enum
),
};
static
const
struct
snd_kcontrol_new
in2l_to_lmixer_controls
[]
=
{
SOC_DAPM_ENUM
(
"IN2_L L+ Switch"
,
in2l_lpga_p_enum
),
};
static
const
struct
snd_kcontrol_new
in3l_to_lmixer_controls
[]
=
{
SOC_DAPM_ENUM
(
"IN3_L L+ Switch"
,
in3l_lpga_p_enum
),
};
static
const
struct
snd_kcontrol_new
in1r_to_lmixer_controls
[]
=
{
SOC_DAPM_ENUM
(
"IN1_R L+ Switch"
,
in1r_lpga_p_enum
),
};
static
const
struct
snd_kcontrol_new
cml_to_lmixer_controls
[]
=
{
SOC_DAPM_ENUM
(
"CM_L L- Switch"
,
cml_lpga_n_enum
),
};
static
const
struct
snd_kcontrol_new
in2r_to_lmixer_controls
[]
=
{
SOC_DAPM_ENUM
(
"IN2_R L- Switch"
,
in2r_lpga_n_enum
),
};
static
const
struct
snd_kcontrol_new
in3r_to_lmixer_controls
[]
=
{
SOC_DAPM_ENUM
(
"IN3_R L- Switch"
,
in3r_lpga_n_enum
),
};
/* Right mixer pins */
static
SOC_ENUM_SINGLE_DECL
(
in1r_rpga_p_enum
,
AIC32X4_RMICPGAPIN
,
6
,
resistor_text
);
static
SOC_ENUM_SINGLE_DECL
(
in2r_rpga_p_enum
,
AIC32X4_RMICPGAPIN
,
4
,
resistor_text
);
static
SOC_ENUM_SINGLE_DECL
(
in3r_rpga_p_enum
,
AIC32X4_RMICPGAPIN
,
2
,
resistor_text
);
static
SOC_ENUM_SINGLE_DECL
(
in2l_rpga_p_enum
,
AIC32X4_RMICPGAPIN
,
0
,
resistor_text
);
static
SOC_ENUM_SINGLE_DECL
(
cmr_rpga_n_enum
,
AIC32X4_RMICPGANIN
,
6
,
resistor_text
);
static
SOC_ENUM_SINGLE_DECL
(
in1l_rpga_n_enum
,
AIC32X4_RMICPGANIN
,
4
,
resistor_text
);
static
SOC_ENUM_SINGLE_DECL
(
in3l_rpga_n_enum
,
AIC32X4_RMICPGANIN
,
2
,
resistor_text
);
static
const
struct
snd_kcontrol_new
in1r_to_rmixer_controls
[]
=
{
SOC_DAPM_ENUM
(
"IN1_R R+ Switch"
,
in1r_rpga_p_enum
),
};
static
const
struct
snd_kcontrol_new
in2r_to_rmixer_controls
[]
=
{
SOC_DAPM_ENUM
(
"IN2_R R+ Switch"
,
in2r_rpga_p_enum
),
};
static
const
struct
snd_kcontrol_new
in3r_to_rmixer_controls
[]
=
{
SOC_DAPM_ENUM
(
"IN3_R R+ Switch"
,
in3r_rpga_p_enum
),
};
static
const
struct
snd_kcontrol_new
in2l_to_rmixer_controls
[]
=
{
SOC_DAPM_ENUM
(
"IN2_L R+ Switch"
,
in2l_rpga_p_enum
),
};
static
const
struct
snd_kcontrol_new
cmr_to_rmixer_controls
[]
=
{
SOC_DAPM_ENUM
(
"CM_R R- Switch"
,
cmr_rpga_n_enum
),
};
static
const
struct
snd_kcontrol_new
in1l_to_rmixer_controls
[]
=
{
SOC_DAPM_ENUM
(
"IN1_L R- Switch"
,
in1l_rpga_n_enum
),
};
static
const
struct
snd_kcontrol_new
in3l_to_rmixer_controls
[]
=
{
SOC_DAPM_ENUM
(
"IN3_L R- Switch"
,
in3l_rpga_n_enum
),
};
};
static
const
struct
snd_soc_dapm_widget
aic32x4_dapm_widgets
[]
=
{
static
const
struct
snd_soc_dapm_widget
aic32x4_dapm_widgets
[]
=
{
...
@@ -214,14 +271,39 @@ static const struct snd_soc_dapm_widget aic32x4_dapm_widgets[] = {
...
@@ -214,14 +271,39 @@ static const struct snd_soc_dapm_widget aic32x4_dapm_widgets[] = {
&
lor_output_mixer_controls
[
0
],
&
lor_output_mixer_controls
[
0
],
ARRAY_SIZE
(
lor_output_mixer_controls
)),
ARRAY_SIZE
(
lor_output_mixer_controls
)),
SND_SOC_DAPM_PGA
(
"LOR Power"
,
AIC32X4_OUTPWRCTL
,
2
,
0
,
NULL
,
0
),
SND_SOC_DAPM_PGA
(
"LOR Power"
,
AIC32X4_OUTPWRCTL
,
2
,
0
,
NULL
,
0
),
SND_SOC_DAPM_MIXER
(
"Left Input Mixer"
,
SND_SOC_NOPM
,
0
,
0
,
&
left_input_mixer_controls
[
0
],
ARRAY_SIZE
(
left_input_mixer_controls
)),
SND_SOC_DAPM_MIXER
(
"Right Input Mixer"
,
SND_SOC_NOPM
,
0
,
0
,
&
right_input_mixer_controls
[
0
],
ARRAY_SIZE
(
right_input_mixer_controls
)),
SND_SOC_DAPM_ADC
(
"Left ADC"
,
"Left Capture"
,
AIC32X4_ADCSETUP
,
7
,
0
),
SND_SOC_DAPM_ADC
(
"Right ADC"
,
"Right Capture"
,
AIC32X4_ADCSETUP
,
6
,
0
),
SND_SOC_DAPM_ADC
(
"Right ADC"
,
"Right Capture"
,
AIC32X4_ADCSETUP
,
6
,
0
),
SND_SOC_DAPM_MUX
(
"IN1_R to Right Mixer Positive Resistor"
,
SND_SOC_NOPM
,
0
,
0
,
in1r_to_rmixer_controls
),
SND_SOC_DAPM_MUX
(
"IN2_R to Right Mixer Positive Resistor"
,
SND_SOC_NOPM
,
0
,
0
,
in2r_to_rmixer_controls
),
SND_SOC_DAPM_MUX
(
"IN3_R to Right Mixer Positive Resistor"
,
SND_SOC_NOPM
,
0
,
0
,
in3r_to_rmixer_controls
),
SND_SOC_DAPM_MUX
(
"IN2_L to Right Mixer Positive Resistor"
,
SND_SOC_NOPM
,
0
,
0
,
in2l_to_rmixer_controls
),
SND_SOC_DAPM_MUX
(
"CM_R to Right Mixer Negative Resistor"
,
SND_SOC_NOPM
,
0
,
0
,
cmr_to_rmixer_controls
),
SND_SOC_DAPM_MUX
(
"IN1_L to Right Mixer Negative Resistor"
,
SND_SOC_NOPM
,
0
,
0
,
in1l_to_rmixer_controls
),
SND_SOC_DAPM_MUX
(
"IN3_L to Right Mixer Negative Resistor"
,
SND_SOC_NOPM
,
0
,
0
,
in3l_to_rmixer_controls
),
SND_SOC_DAPM_ADC
(
"Left ADC"
,
"Left Capture"
,
AIC32X4_ADCSETUP
,
7
,
0
),
SND_SOC_DAPM_MUX
(
"IN1_L to Left Mixer Positive Resistor"
,
SND_SOC_NOPM
,
0
,
0
,
in1l_to_lmixer_controls
),
SND_SOC_DAPM_MUX
(
"IN2_L to Left Mixer Positive Resistor"
,
SND_SOC_NOPM
,
0
,
0
,
in2l_to_lmixer_controls
),
SND_SOC_DAPM_MUX
(
"IN3_L to Left Mixer Positive Resistor"
,
SND_SOC_NOPM
,
0
,
0
,
in3l_to_lmixer_controls
),
SND_SOC_DAPM_MUX
(
"IN1_R to Left Mixer Positive Resistor"
,
SND_SOC_NOPM
,
0
,
0
,
in1r_to_lmixer_controls
),
SND_SOC_DAPM_MUX
(
"CM_L to Left Mixer Negative Resistor"
,
SND_SOC_NOPM
,
0
,
0
,
cml_to_lmixer_controls
),
SND_SOC_DAPM_MUX
(
"IN2_R to Left Mixer Negative Resistor"
,
SND_SOC_NOPM
,
0
,
0
,
in2r_to_lmixer_controls
),
SND_SOC_DAPM_MUX
(
"IN3_R to Left Mixer Negative Resistor"
,
SND_SOC_NOPM
,
0
,
0
,
in3r_to_lmixer_controls
),
SND_SOC_DAPM_MICBIAS
(
"Mic Bias"
,
AIC32X4_MICBIAS
,
6
,
0
),
SND_SOC_DAPM_MICBIAS
(
"Mic Bias"
,
AIC32X4_MICBIAS
,
6
,
0
),
SND_SOC_DAPM_OUTPUT
(
"HPL"
),
SND_SOC_DAPM_OUTPUT
(
"HPL"
),
...
@@ -261,19 +343,77 @@ static const struct snd_soc_dapm_route aic32x4_dapm_routes[] = {
...
@@ -261,19 +343,77 @@ static const struct snd_soc_dapm_route aic32x4_dapm_routes[] = {
{
"LOR Power"
,
NULL
,
"LOR Output Mixer"
},
{
"LOR Power"
,
NULL
,
"LOR Output Mixer"
},
{
"LOR"
,
NULL
,
"LOR Power"
},
{
"LOR"
,
NULL
,
"LOR Power"
},
/* Left input */
{
"Left Input Mixer"
,
"IN1_L P Switch"
,
"IN1_L"
},
{
"Left Input Mixer"
,
"IN2_L P Switch"
,
"IN2_L"
},
{
"Left Input Mixer"
,
"IN3_L P Switch"
,
"IN3_L"
},
{
"Left ADC"
,
NULL
,
"Left Input Mixer"
},
/* Right Input */
/* Right Input */
{
"Right Input Mixer"
,
"IN1_R P Switch"
,
"IN1_R"
},
{
"Right ADC"
,
NULL
,
"IN1_R to Right Mixer Positive Resistor"
},
{
"Right Input Mixer"
,
"IN2_R P Switch"
,
"IN2_R"
},
{
"IN1_R to Right Mixer Positive Resistor"
,
"10 kOhm"
,
"IN1_R"
},
{
"Right Input Mixer"
,
"IN3_R P Switch"
,
"IN3_R"
},
{
"IN1_R to Right Mixer Positive Resistor"
,
"20 kOhm"
,
"IN1_R"
},
{
"IN1_R to Right Mixer Positive Resistor"
,
"40 kOhm"
,
"IN1_R"
},
{
"Right ADC"
,
NULL
,
"Right Input Mixer"
},
{
"Right ADC"
,
NULL
,
"IN2_R to Right Mixer Positive Resistor"
},
{
"IN2_R to Right Mixer Positive Resistor"
,
"10 kOhm"
,
"IN2_R"
},
{
"IN2_R to Right Mixer Positive Resistor"
,
"20 kOhm"
,
"IN2_R"
},
{
"IN2_R to Right Mixer Positive Resistor"
,
"40 kOhm"
,
"IN2_R"
},
{
"Right ADC"
,
NULL
,
"IN3_R to Right Mixer Positive Resistor"
},
{
"IN3_R to Right Mixer Positive Resistor"
,
"10 kOhm"
,
"IN3_R"
},
{
"IN3_R to Right Mixer Positive Resistor"
,
"20 kOhm"
,
"IN3_R"
},
{
"IN3_R to Right Mixer Positive Resistor"
,
"40 kOhm"
,
"IN3_R"
},
{
"Right ADC"
,
NULL
,
"IN2_L to Right Mixer Positive Resistor"
},
{
"IN2_L to Right Mixer Positive Resistor"
,
"10 kOhm"
,
"IN2_L"
},
{
"IN2_L to Right Mixer Positive Resistor"
,
"20 kOhm"
,
"IN2_L"
},
{
"IN2_L to Right Mixer Positive Resistor"
,
"40 kOhm"
,
"IN2_L"
},
{
"Right ADC"
,
NULL
,
"CM_R to Right Mixer Negative Resistor"
},
{
"CM_R to Right Mixer Negative Resistor"
,
"10 kOhm"
,
"CM_R"
},
{
"CM_R to Right Mixer Negative Resistor"
,
"20 kOhm"
,
"CM_R"
},
{
"CM_R to Right Mixer Negative Resistor"
,
"40 kOhm"
,
"CM_R"
},
{
"Right ADC"
,
NULL
,
"IN1_L to Right Mixer Negative Resistor"
},
{
"IN1_L to Right Mixer Negative Resistor"
,
"10 kOhm"
,
"IN1_L"
},
{
"IN1_L to Right Mixer Negative Resistor"
,
"20 kOhm"
,
"IN1_L"
},
{
"IN1_L to Right Mixer Negative Resistor"
,
"40 kOhm"
,
"IN1_L"
},
{
"Right ADC"
,
NULL
,
"IN3_L to Right Mixer Negative Resistor"
},
{
"IN3_L to Right Mixer Negative Resistor"
,
"10 kOhm"
,
"IN3_L"
},
{
"IN3_L to Right Mixer Negative Resistor"
,
"20 kOhm"
,
"IN3_L"
},
{
"IN3_L to Right Mixer Negative Resistor"
,
"40 kOhm"
,
"IN3_L"
},
/* Left Input */
{
"Left ADC"
,
NULL
,
"IN1_L to Left Mixer Positive Resistor"
},
{
"IN1_L to Left Mixer Positive Resistor"
,
"10 kOhm"
,
"IN1_L"
},
{
"IN1_L to Left Mixer Positive Resistor"
,
"20 kOhm"
,
"IN1_L"
},
{
"IN1_L to Left Mixer Positive Resistor"
,
"40 kOhm"
,
"IN1_L"
},
{
"Left ADC"
,
NULL
,
"IN2_L to Left Mixer Positive Resistor"
},
{
"IN2_L to Left Mixer Positive Resistor"
,
"10 kOhm"
,
"IN2_L"
},
{
"IN2_L to Left Mixer Positive Resistor"
,
"20 kOhm"
,
"IN2_L"
},
{
"IN2_L to Left Mixer Positive Resistor"
,
"40 kOhm"
,
"IN2_L"
},
{
"Left ADC"
,
NULL
,
"IN3_L to Left Mixer Positive Resistor"
},
{
"IN3_L to Left Mixer Positive Resistor"
,
"10 kOhm"
,
"IN3_L"
},
{
"IN3_L to Left Mixer Positive Resistor"
,
"20 kOhm"
,
"IN3_L"
},
{
"IN3_L to Left Mixer Positive Resistor"
,
"40 kOhm"
,
"IN3_L"
},
{
"Left ADC"
,
NULL
,
"IN1_R to Left Mixer Positive Resistor"
},
{
"IN1_R to Left Mixer Positive Resistor"
,
"10 kOhm"
,
"IN1_R"
},
{
"IN1_R to Left Mixer Positive Resistor"
,
"20 kOhm"
,
"IN1_R"
},
{
"IN1_R to Left Mixer Positive Resistor"
,
"40 kOhm"
,
"IN1_R"
},
{
"Left ADC"
,
NULL
,
"CM_L to Left Mixer Negative Resistor"
},
{
"CM_L to Left Mixer Negative Resistor"
,
"10 kOhm"
,
"CM_L"
},
{
"CM_L to Left Mixer Negative Resistor"
,
"20 kOhm"
,
"CM_L"
},
{
"CM_L to Left Mixer Negative Resistor"
,
"40 kOhm"
,
"CM_L"
},
{
"Left ADC"
,
NULL
,
"IN2_R to Left Mixer Negative Resistor"
},
{
"IN2_R to Left Mixer Negative Resistor"
,
"10 kOhm"
,
"IN2_R"
},
{
"IN2_R to Left Mixer Negative Resistor"
,
"20 kOhm"
,
"IN2_R"
},
{
"IN2_R to Left Mixer Negative Resistor"
,
"40 kOhm"
,
"IN2_R"
},
{
"Left ADC"
,
NULL
,
"IN3_R to Left Mixer Negative Resistor"
},
{
"IN3_R to Left Mixer Negative Resistor"
,
"10 kOhm"
,
"IN3_R"
},
{
"IN3_R to Left Mixer Negative Resistor"
,
"20 kOhm"
,
"IN3_R"
},
{
"IN3_R to Left Mixer Negative Resistor"
,
"40 kOhm"
,
"IN3_R"
},
};
};
static
const
struct
regmap_range_cfg
aic32x4_regmap_pages
[]
=
{
static
const
struct
regmap_range_cfg
aic32x4_regmap_pages
[]
=
{
...
@@ -287,14 +427,12 @@ static const struct regmap_range_cfg aic32x4_regmap_pages[] = {
...
@@ -287,14 +427,12 @@ static const struct regmap_range_cfg aic32x4_regmap_pages[] = {
},
},
};
};
static
const
struct
regmap_config
aic32x4_regmap
=
{
const
struct
regmap_config
aic32x4_regmap_config
=
{
.
reg_bits
=
8
,
.
val_bits
=
8
,
.
max_register
=
AIC32X4_RMICPGAVOL
,
.
max_register
=
AIC32X4_RMICPGAVOL
,
.
ranges
=
aic32x4_regmap_pages
,
.
ranges
=
aic32x4_regmap_pages
,
.
num_ranges
=
ARRAY_SIZE
(
aic32x4_regmap_pages
),
.
num_ranges
=
ARRAY_SIZE
(
aic32x4_regmap_pages
),
};
};
EXPORT_SYMBOL
(
aic32x4_regmap_config
);
static
inline
int
aic32x4_get_divs
(
int
mclk
,
int
rate
)
static
inline
int
aic32x4_get_divs
(
int
mclk
,
int
rate
)
{
{
...
@@ -567,7 +705,7 @@ static int aic32x4_set_bias_level(struct snd_soc_codec *codec,
...
@@ -567,7 +705,7 @@ static int aic32x4_set_bias_level(struct snd_soc_codec *codec,
return
0
;
return
0
;
}
}
#define AIC32X4_RATES SNDRV_PCM_RATE_8000_
48
000
#define AIC32X4_RATES SNDRV_PCM_RATE_8000_
96
000
#define AIC32X4_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE \
#define AIC32X4_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE \
| SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)
| SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)
...
@@ -596,7 +734,7 @@ static struct snd_soc_dai_driver aic32x4_dai = {
...
@@ -596,7 +734,7 @@ static struct snd_soc_dai_driver aic32x4_dai = {
.
symmetric_rates
=
1
,
.
symmetric_rates
=
1
,
};
};
static
int
aic32x4_probe
(
struct
snd_soc_codec
*
codec
)
static
int
aic32x4_
codec_
probe
(
struct
snd_soc_codec
*
codec
)
{
{
struct
aic32x4_priv
*
aic32x4
=
snd_soc_codec_get_drvdata
(
codec
);
struct
aic32x4_priv
*
aic32x4
=
snd_soc_codec_get_drvdata
(
codec
);
u32
tmp_reg
;
u32
tmp_reg
;
...
@@ -655,7 +793,7 @@ static int aic32x4_probe(struct snd_soc_codec *codec)
...
@@ -655,7 +793,7 @@ static int aic32x4_probe(struct snd_soc_codec *codec)
}
}
static
struct
snd_soc_codec_driver
soc_codec_dev_aic32x4
=
{
static
struct
snd_soc_codec_driver
soc_codec_dev_aic32x4
=
{
.
probe
=
aic32x4_probe
,
.
probe
=
aic32x4_
codec_
probe
,
.
set_bias_level
=
aic32x4_set_bias_level
,
.
set_bias_level
=
aic32x4_set_bias_level
,
.
suspend_bias_off
=
true
,
.
suspend_bias_off
=
true
,
...
@@ -777,24 +915,22 @@ static int aic32x4_setup_regulators(struct device *dev,
...
@@ -777,24 +915,22 @@ static int aic32x4_setup_regulators(struct device *dev,
return
ret
;
return
ret
;
}
}
static
int
aic32x4_i2c_probe
(
struct
i2c_client
*
i2c
,
int
aic32x4_probe
(
struct
device
*
dev
,
struct
regmap
*
regmap
)
const
struct
i2c_device_id
*
id
)
{
{
struct
aic32x4_pdata
*
pdata
=
i2c
->
dev
.
platform_data
;
struct
aic32x4_priv
*
aic32x4
;
struct
aic32x4_priv
*
aic32x4
;
struct
device_node
*
np
=
i2c
->
dev
.
of_node
;
struct
aic32x4_pdata
*
pdata
=
dev
->
platform_data
;
struct
device_node
*
np
=
dev
->
of_node
;
int
ret
;
int
ret
;
aic32x4
=
devm_kzalloc
(
&
i2c
->
dev
,
sizeof
(
struct
aic32x4_priv
),
if
(
IS_ERR
(
regmap
))
return
PTR_ERR
(
regmap
);
aic32x4
=
devm_kzalloc
(
dev
,
sizeof
(
struct
aic32x4_priv
),
GFP_KERNEL
);
GFP_KERNEL
);
if
(
aic32x4
==
NULL
)
if
(
aic32x4
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
aic32x4
->
regmap
=
devm_regmap_init_i2c
(
i2c
,
&
aic32x4_regmap
);
dev_set_drvdata
(
dev
,
aic32x4
);
if
(
IS_ERR
(
aic32x4
->
regmap
))
return
PTR_ERR
(
aic32x4
->
regmap
);
i2c_set_clientdata
(
i2c
,
aic32x4
);
if
(
pdata
)
{
if
(
pdata
)
{
aic32x4
->
power_cfg
=
pdata
->
power_cfg
;
aic32x4
->
power_cfg
=
pdata
->
power_cfg
;
...
@@ -804,7 +940,7 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c,
...
@@ -804,7 +940,7 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c,
}
else
if
(
np
)
{
}
else
if
(
np
)
{
ret
=
aic32x4_parse_dt
(
aic32x4
,
np
);
ret
=
aic32x4_parse_dt
(
aic32x4
,
np
);
if
(
ret
)
{
if
(
ret
)
{
dev_err
(
&
i2c
->
dev
,
"Failed to parse DT node
\n
"
);
dev_err
(
dev
,
"Failed to parse DT node
\n
"
);
return
ret
;
return
ret
;
}
}
}
else
{
}
else
{
...
@@ -814,71 +950,48 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c,
...
@@ -814,71 +950,48 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c,
aic32x4
->
rstn_gpio
=
-
1
;
aic32x4
->
rstn_gpio
=
-
1
;
}
}
aic32x4
->
mclk
=
devm_clk_get
(
&
i2c
->
dev
,
"mclk"
);
aic32x4
->
mclk
=
devm_clk_get
(
dev
,
"mclk"
);
if
(
IS_ERR
(
aic32x4
->
mclk
))
{
if
(
IS_ERR
(
aic32x4
->
mclk
))
{
dev_err
(
&
i2c
->
dev
,
"Failed getting the mclk. The current implementation does not support the usage of this codec without mclk
\n
"
);
dev_err
(
dev
,
"Failed getting the mclk. The current implementation does not support the usage of this codec without mclk
\n
"
);
return
PTR_ERR
(
aic32x4
->
mclk
);
return
PTR_ERR
(
aic32x4
->
mclk
);
}
}
if
(
gpio_is_valid
(
aic32x4
->
rstn_gpio
))
{
if
(
gpio_is_valid
(
aic32x4
->
rstn_gpio
))
{
ret
=
devm_gpio_request_one
(
&
i2c
->
dev
,
aic32x4
->
rstn_gpio
,
ret
=
devm_gpio_request_one
(
dev
,
aic32x4
->
rstn_gpio
,
GPIOF_OUT_INIT_LOW
,
"tlv320aic32x4 rstn"
);
GPIOF_OUT_INIT_LOW
,
"tlv320aic32x4 rstn"
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
return
ret
;
return
ret
;
}
}
ret
=
aic32x4_setup_regulators
(
&
i2c
->
dev
,
aic32x4
);
ret
=
aic32x4_setup_regulators
(
dev
,
aic32x4
);
if
(
ret
)
{
if
(
ret
)
{
dev_err
(
&
i2c
->
dev
,
"Failed to setup regulators
\n
"
);
dev_err
(
dev
,
"Failed to setup regulators
\n
"
);
return
ret
;
return
ret
;
}
}
ret
=
snd_soc_register_codec
(
&
i2c
->
dev
,
ret
=
snd_soc_register_codec
(
dev
,
&
soc_codec_dev_aic32x4
,
&
aic32x4_dai
,
1
);
&
soc_codec_dev_aic32x4
,
&
aic32x4_dai
,
1
);
if
(
ret
)
{
if
(
ret
)
{
dev_err
(
&
i2c
->
dev
,
"Failed to register codec
\n
"
);
dev_err
(
dev
,
"Failed to register codec
\n
"
);
aic32x4_disable_regulators
(
aic32x4
);
aic32x4_disable_regulators
(
aic32x4
);
return
ret
;
return
ret
;
}
}
i2c_set_clientdata
(
i2c
,
aic32x4
);
return
0
;
return
0
;
}
}
EXPORT_SYMBOL
(
aic32x4_probe
);
static
int
aic32x4_i2c_remove
(
struct
i2c_client
*
client
)
int
aic32x4_remove
(
struct
device
*
dev
)
{
{
struct
aic32x4_priv
*
aic32x4
=
i2c_get_clientdata
(
client
);
struct
aic32x4_priv
*
aic32x4
=
dev_get_drvdata
(
dev
);
aic32x4_disable_regulators
(
aic32x4
);
aic32x4_disable_regulators
(
aic32x4
);
snd_soc_unregister_codec
(
&
client
->
dev
);
snd_soc_unregister_codec
(
dev
);
return
0
;
return
0
;
}
}
EXPORT_SYMBOL
(
aic32x4_remove
);
static
const
struct
i2c_device_id
aic32x4_i2c_id
[]
=
{
{
"tlv320aic32x4"
,
0
},
{
}
};
MODULE_DEVICE_TABLE
(
i2c
,
aic32x4_i2c_id
);
static
const
struct
of_device_id
aic32x4_of_id
[]
=
{
{
.
compatible
=
"ti,tlv320aic32x4"
,
},
{
/* senitel */
}
};
MODULE_DEVICE_TABLE
(
of
,
aic32x4_of_id
);
static
struct
i2c_driver
aic32x4_i2c_driver
=
{
.
driver
=
{
.
name
=
"tlv320aic32x4"
,
.
of_match_table
=
aic32x4_of_id
,
},
.
probe
=
aic32x4_i2c_probe
,
.
remove
=
aic32x4_i2c_remove
,
.
id_table
=
aic32x4_i2c_id
,
};
module_i2c_driver
(
aic32x4_i2c_driver
);
MODULE_DESCRIPTION
(
"ASoC tlv320aic32x4 codec driver"
);
MODULE_DESCRIPTION
(
"ASoC tlv320aic32x4 codec driver"
);
MODULE_AUTHOR
(
"Javier Martin <javier.martin@vista-silicon.com>"
);
MODULE_AUTHOR
(
"Javier Martin <javier.martin@vista-silicon.com>"
);
...
...
sound/soc/codecs/tlv320aic32x4.h
浏览文件 @
84bf51ea
...
@@ -10,6 +10,13 @@
...
@@ -10,6 +10,13 @@
#ifndef _TLV320AIC32X4_H
#ifndef _TLV320AIC32X4_H
#define _TLV320AIC32X4_H
#define _TLV320AIC32X4_H
struct
device
;
struct
regmap_config
;
extern
const
struct
regmap_config
aic32x4_regmap_config
;
int
aic32x4_probe
(
struct
device
*
dev
,
struct
regmap
*
regmap
);
int
aic32x4_remove
(
struct
device
*
dev
);
/* tlv320aic32x4 register space (in decimal to match datasheet) */
/* tlv320aic32x4 register space (in decimal to match datasheet) */
#define AIC32X4_PAGE1 128
#define AIC32X4_PAGE1 128
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录