Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
20694ad2
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看板
提交
20694ad2
编写于
12月 15, 2012
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'asoc/topic/cs42l73' into asoc-next
上级
326b06a8
7f3dd4a8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
89 addition
and
27 deletion
+89
-27
sound/soc/codecs/cs42l73.c
sound/soc/codecs/cs42l73.c
+89
-27
未找到文件。
sound/soc/codecs/cs42l73.c
浏览文件 @
20694ad2
...
@@ -40,6 +40,7 @@ struct cs42l73_private {
...
@@ -40,6 +40,7 @@ struct cs42l73_private {
u32
sysclk
;
u32
sysclk
;
u8
mclksel
;
u8
mclksel
;
u32
mclk
;
u32
mclk
;
int
shutdwn_delay
;
};
};
static
const
struct
reg_default
cs42l73_reg_defaults
[]
=
{
static
const
struct
reg_default
cs42l73_reg_defaults
[]
=
{
...
@@ -588,7 +589,60 @@ static const struct snd_kcontrol_new cs42l73_snd_controls[] = {
...
@@ -588,7 +589,60 @@ static const struct snd_kcontrol_new cs42l73_snd_controls[] = {
SOC_ENUM
(
"XSPOUT Mono/Stereo Select"
,
xsp_output_mux_enum
),
SOC_ENUM
(
"XSPOUT Mono/Stereo Select"
,
xsp_output_mux_enum
),
};
};
static
int
cs42l73_spklo_spk_amp_event
(
struct
snd_soc_dapm_widget
*
w
,
struct
snd_kcontrol
*
kcontrol
,
int
event
)
{
struct
snd_soc_codec
*
codec
=
w
->
codec
;
struct
cs42l73_private
*
priv
=
snd_soc_codec_get_drvdata
(
codec
);
switch
(
event
)
{
case
SND_SOC_DAPM_POST_PMD
:
/* 150 ms delay between setting PDN and MCLKDIS */
priv
->
shutdwn_delay
=
150
;
break
;
default:
pr_err
(
"Invalid event = 0x%x
\n
"
,
event
);
}
return
0
;
}
static
int
cs42l73_ear_amp_event
(
struct
snd_soc_dapm_widget
*
w
,
struct
snd_kcontrol
*
kcontrol
,
int
event
)
{
struct
snd_soc_codec
*
codec
=
w
->
codec
;
struct
cs42l73_private
*
priv
=
snd_soc_codec_get_drvdata
(
codec
);
switch
(
event
)
{
case
SND_SOC_DAPM_POST_PMD
:
/* 50 ms delay between setting PDN and MCLKDIS */
if
(
priv
->
shutdwn_delay
<
50
)
priv
->
shutdwn_delay
=
50
;
break
;
default:
pr_err
(
"Invalid event = 0x%x
\n
"
,
event
);
}
return
0
;
}
static
int
cs42l73_hp_amp_event
(
struct
snd_soc_dapm_widget
*
w
,
struct
snd_kcontrol
*
kcontrol
,
int
event
)
{
struct
snd_soc_codec
*
codec
=
w
->
codec
;
struct
cs42l73_private
*
priv
=
snd_soc_codec_get_drvdata
(
codec
);
switch
(
event
)
{
case
SND_SOC_DAPM_POST_PMD
:
/* 30 ms delay between setting PDN and MCLKDIS */
if
(
priv
->
shutdwn_delay
<
30
)
priv
->
shutdwn_delay
=
30
;
break
;
default:
pr_err
(
"Invalid event = 0x%x
\n
"
,
event
);
}
return
0
;
}
static
const
struct
snd_soc_dapm_widget
cs42l73_dapm_widgets
[]
=
{
static
const
struct
snd_soc_dapm_widget
cs42l73_dapm_widgets
[]
=
{
SND_SOC_DAPM_INPUT
(
"DMICA"
),
SND_SOC_DAPM_INPUT
(
"DMICB"
),
SND_SOC_DAPM_INPUT
(
"LINEINA"
),
SND_SOC_DAPM_INPUT
(
"LINEINA"
),
SND_SOC_DAPM_INPUT
(
"LINEINB"
),
SND_SOC_DAPM_INPUT
(
"LINEINB"
),
SND_SOC_DAPM_INPUT
(
"MIC1"
),
SND_SOC_DAPM_INPUT
(
"MIC1"
),
...
@@ -604,9 +658,7 @@ static const struct snd_soc_dapm_widget cs42l73_dapm_widgets[] = {
...
@@ -604,9 +658,7 @@ static const struct snd_soc_dapm_widget cs42l73_dapm_widgets[] = {
CS42L73_PWRCTL2
,
3
,
1
),
CS42L73_PWRCTL2
,
3
,
1
),
SND_SOC_DAPM_AIF_OUT
(
"ASPOUTR"
,
NULL
,
0
,
SND_SOC_DAPM_AIF_OUT
(
"ASPOUTR"
,
NULL
,
0
,
CS42L73_PWRCTL2
,
3
,
1
),
CS42L73_PWRCTL2
,
3
,
1
),
SND_SOC_DAPM_AIF_OUT
(
"VSPOUTL"
,
NULL
,
0
,
SND_SOC_DAPM_AIF_OUT
(
"VSPINOUT"
,
NULL
,
0
,
CS42L73_PWRCTL2
,
4
,
1
),
SND_SOC_DAPM_AIF_OUT
(
"VSPOUTR"
,
NULL
,
0
,
CS42L73_PWRCTL2
,
4
,
1
),
CS42L73_PWRCTL2
,
4
,
1
),
SND_SOC_DAPM_PGA
(
"PGA Left"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_PGA
(
"PGA Left"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
...
@@ -632,8 +684,7 @@ static const struct snd_soc_dapm_widget cs42l73_dapm_widgets[] = {
...
@@ -632,8 +684,7 @@ static const struct snd_soc_dapm_widget cs42l73_dapm_widgets[] = {
SND_SOC_DAPM_MIXER
(
"ASPR Output Mixer"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_MIXER
(
"ASPR Output Mixer"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_MIXER
(
"XSPL Output Mixer"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_MIXER
(
"XSPL Output Mixer"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_MIXER
(
"XSPR Output Mixer"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_MIXER
(
"XSPR Output Mixer"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_MIXER
(
"VSPL Output Mixer"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_MIXER
(
"VSP Output Mixer"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_MIXER
(
"VSPR Output Mixer"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_AIF_IN
(
"XSPINL"
,
NULL
,
0
,
SND_SOC_DAPM_AIF_IN
(
"XSPINL"
,
NULL
,
0
,
CS42L73_PWRCTL2
,
0
,
1
),
CS42L73_PWRCTL2
,
0
,
1
),
...
@@ -649,7 +700,7 @@ static const struct snd_soc_dapm_widget cs42l73_dapm_widgets[] = {
...
@@ -649,7 +700,7 @@ static const struct snd_soc_dapm_widget cs42l73_dapm_widgets[] = {
SND_SOC_DAPM_AIF_IN
(
"ASPINM"
,
NULL
,
0
,
SND_SOC_DAPM_AIF_IN
(
"ASPINM"
,
NULL
,
0
,
CS42L73_PWRCTL2
,
2
,
1
),
CS42L73_PWRCTL2
,
2
,
1
),
SND_SOC_DAPM_AIF_IN
(
"VSPIN"
,
NULL
,
0
,
SND_SOC_DAPM_AIF_IN
(
"VSPIN
OUT
"
,
NULL
,
0
,
CS42L73_PWRCTL2
,
4
,
1
),
CS42L73_PWRCTL2
,
4
,
1
),
SND_SOC_DAPM_MIXER
(
"HL Left Mixer"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_MIXER
(
"HL Left Mixer"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
...
@@ -674,16 +725,20 @@ static const struct snd_soc_dapm_widget cs42l73_dapm_widgets[] = {
...
@@ -674,16 +725,20 @@ static const struct snd_soc_dapm_widget cs42l73_dapm_widgets[] = {
SND_SOC_DAPM_PGA
(
"SPK DAC"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_PGA
(
"SPK DAC"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_PGA
(
"ESL DAC"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_PGA
(
"ESL DAC"
,
SND_SOC_NOPM
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_SWITCH
(
"HP Amp"
,
CS42L73_PWRCTL3
,
0
,
1
,
SND_SOC_DAPM_SWITCH_E
(
"HP Amp"
,
CS42L73_PWRCTL3
,
0
,
1
,
&
hp_amp_ctl
),
&
hp_amp_ctl
,
cs42l73_hp_amp_event
,
SND_SOC_DAPM_POST_PMD
),
SND_SOC_DAPM_SWITCH
(
"LO Amp"
,
CS42L73_PWRCTL3
,
1
,
1
,
SND_SOC_DAPM_SWITCH
(
"LO Amp"
,
CS42L73_PWRCTL3
,
1
,
1
,
&
lo_amp_ctl
),
&
lo_amp_ctl
),
SND_SOC_DAPM_SWITCH
(
"SPK Amp"
,
CS42L73_PWRCTL3
,
2
,
1
,
SND_SOC_DAPM_SWITCH_E
(
"SPK Amp"
,
CS42L73_PWRCTL3
,
2
,
1
,
&
spk_amp_ctl
),
&
spk_amp_ctl
,
cs42l73_spklo_spk_amp_event
,
SND_SOC_DAPM_SWITCH
(
"EAR Amp"
,
CS42L73_PWRCTL3
,
3
,
1
,
SND_SOC_DAPM_POST_PMD
),
&
ear_amp_ctl
),
SND_SOC_DAPM_SWITCH_E
(
"EAR Amp"
,
CS42L73_PWRCTL3
,
3
,
1
,
SND_SOC_DAPM_SWITCH
(
"SPKLO Amp"
,
CS42L73_PWRCTL3
,
4
,
1
,
&
ear_amp_ctl
,
cs42l73_ear_amp_event
,
&
spklo_amp_ctl
),
SND_SOC_DAPM_POST_PMD
),
SND_SOC_DAPM_SWITCH_E
(
"SPKLO Amp"
,
CS42L73_PWRCTL3
,
4
,
1
,
&
spklo_amp_ctl
,
cs42l73_spklo_spk_amp_event
,
SND_SOC_DAPM_POST_PMD
),
SND_SOC_DAPM_OUTPUT
(
"HPOUTA"
),
SND_SOC_DAPM_OUTPUT
(
"HPOUTA"
),
SND_SOC_DAPM_OUTPUT
(
"HPOUTB"
),
SND_SOC_DAPM_OUTPUT
(
"HPOUTB"
),
...
@@ -705,7 +760,7 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = {
...
@@ -705,7 +760,7 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = {
{
"ESL DAC"
,
"ESL-ASP Mono Volume"
,
"ESL Mixer"
},
{
"ESL DAC"
,
"ESL-ASP Mono Volume"
,
"ESL Mixer"
},
{
"ESL DAC"
,
"ESL-XSP Mono Volume"
,
"ESL Mixer"
},
{
"ESL DAC"
,
"ESL-XSP Mono Volume"
,
"ESL Mixer"
},
{
"ESL DAC"
,
"ESL-VSP Mono Volume"
,
"VSPIN"
},
{
"ESL DAC"
,
"ESL-VSP Mono Volume"
,
"VSPIN
OUT
"
},
/* Loopback */
/* Loopback */
{
"ESL DAC"
,
"ESL-IP Mono Volume"
,
"Input Left Capture"
},
{
"ESL DAC"
,
"ESL-IP Mono Volume"
,
"Input Left Capture"
},
{
"ESL DAC"
,
"ESL-IP Mono Volume"
,
"Input Right Capture"
},
{
"ESL DAC"
,
"ESL-IP Mono Volume"
,
"Input Right Capture"
},
...
@@ -727,7 +782,7 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = {
...
@@ -727,7 +782,7 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = {
{
"SPK DAC"
,
"SPK-ASP Mono Volume"
,
"SPK Mixer"
},
{
"SPK DAC"
,
"SPK-ASP Mono Volume"
,
"SPK Mixer"
},
{
"SPK DAC"
,
"SPK-XSP Mono Volume"
,
"SPK Mixer"
},
{
"SPK DAC"
,
"SPK-XSP Mono Volume"
,
"SPK Mixer"
},
{
"SPK DAC"
,
"SPK-VSP Mono Volume"
,
"VSPIN"
},
{
"SPK DAC"
,
"SPK-VSP Mono Volume"
,
"VSPIN
OUT
"
},
/* Loopback */
/* Loopback */
{
"SPK DAC"
,
"SPK-IP Mono Volume"
,
"Input Left Capture"
},
{
"SPK DAC"
,
"SPK-IP Mono Volume"
,
"Input Left Capture"
},
{
"SPK DAC"
,
"SPK-IP Mono Volume"
,
"Input Right Capture"
},
{
"SPK DAC"
,
"SPK-IP Mono Volume"
,
"Input Right Capture"
},
...
@@ -770,8 +825,8 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = {
...
@@ -770,8 +825,8 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = {
{
"HL Right Mixer"
,
NULL
,
"ASPINR"
},
{
"HL Right Mixer"
,
NULL
,
"ASPINR"
},
{
"HL Left Mixer"
,
NULL
,
"XSPINL"
},
{
"HL Left Mixer"
,
NULL
,
"XSPINL"
},
{
"HL Right Mixer"
,
NULL
,
"XSPINR"
},
{
"HL Right Mixer"
,
NULL
,
"XSPINR"
},
{
"HL Left Mixer"
,
NULL
,
"VSPIN"
},
{
"HL Left Mixer"
,
NULL
,
"VSPIN
OUT
"
},
{
"HL Right Mixer"
,
NULL
,
"VSPIN"
},
{
"HL Right Mixer"
,
NULL
,
"VSPIN
OUT
"
},
{
"ASPINL"
,
NULL
,
"ASP Playback"
},
{
"ASPINL"
,
NULL
,
"ASP Playback"
},
{
"ASPINM"
,
NULL
,
"ASP Playback"
},
{
"ASPINM"
,
NULL
,
"ASP Playback"
},
...
@@ -779,7 +834,7 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = {
...
@@ -779,7 +834,7 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = {
{
"XSPINL"
,
NULL
,
"XSP Playback"
},
{
"XSPINL"
,
NULL
,
"XSP Playback"
},
{
"XSPINM"
,
NULL
,
"XSP Playback"
},
{
"XSPINM"
,
NULL
,
"XSP Playback"
},
{
"XSPINR"
,
NULL
,
"XSP Playback"
},
{
"XSPINR"
,
NULL
,
"XSP Playback"
},
{
"VSPIN"
,
NULL
,
"VSP Playback"
},
{
"VSPIN
OUT
"
,
NULL
,
"VSP Playback"
},
/* Capture Paths */
/* Capture Paths */
{
"MIC1"
,
NULL
,
"MIC1 Bias"
},
{
"MIC1"
,
NULL
,
"MIC1 Bias"
},
...
@@ -795,6 +850,8 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = {
...
@@ -795,6 +850,8 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = {
{
"ADC Left"
,
NULL
,
"PGA Left"
},
{
"ADC Left"
,
NULL
,
"PGA Left"
},
{
"ADC Right"
,
NULL
,
"PGA Right"
},
{
"ADC Right"
,
NULL
,
"PGA Right"
},
{
"DMIC Left"
,
NULL
,
"DMICA"
},
{
"DMIC Right"
,
NULL
,
"DMICB"
},
{
"Input Left Capture"
,
"ADC Left Input"
,
"ADC Left"
},
{
"Input Left Capture"
,
"ADC Left Input"
,
"ADC Left"
},
{
"Input Right Capture"
,
"ADC Right Input"
,
"ADC Right"
},
{
"Input Right Capture"
,
"ADC Right Input"
,
"ADC Right"
},
...
@@ -819,21 +876,18 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = {
...
@@ -819,21 +876,18 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = {
{
"XSPOUTR"
,
NULL
,
"XSPR Output Mixer"
},
{
"XSPOUTR"
,
NULL
,
"XSPR Output Mixer"
},
/* Voice Capture */
/* Voice Capture */
{
"VSP
L
Output Mixer"
,
NULL
,
"Input Left Capture"
},
{
"VSP Output Mixer"
,
NULL
,
"Input Left Capture"
},
{
"VSP
R Output Mixer"
,
NULL
,
"Input Lef
t Capture"
},
{
"VSP
Output Mixer"
,
NULL
,
"Input Righ
t Capture"
},
{
"VSPOUTL"
,
"VSP-IP Volume"
,
"VSPL Output Mixer"
},
{
"VSPINOUT"
,
"VSP-IP Volume"
,
"VSP Output Mixer"
},
{
"VSPOUTR"
,
"VSP-IP Volume"
,
"VSPR Output Mixer"
},
{
"VSPOUTL"
,
NULL
,
"VSPL Output Mixer"
},
{
"VSPINOUT"
,
NULL
,
"VSP Output Mixer"
},
{
"VSPOUTR"
,
NULL
,
"VSPR Output Mixer"
},
{
"ASP Capture"
,
NULL
,
"ASPOUTL"
},
{
"ASP Capture"
,
NULL
,
"ASPOUTL"
},
{
"ASP Capture"
,
NULL
,
"ASPOUTR"
},
{
"ASP Capture"
,
NULL
,
"ASPOUTR"
},
{
"XSP Capture"
,
NULL
,
"XSPOUTL"
},
{
"XSP Capture"
,
NULL
,
"XSPOUTL"
},
{
"XSP Capture"
,
NULL
,
"XSPOUTR"
},
{
"XSP Capture"
,
NULL
,
"XSPOUTR"
},
{
"VSP Capture"
,
NULL
,
"VSPOUTL"
},
{
"VSP Capture"
,
NULL
,
"VSPINOUT"
},
{
"VSP Capture"
,
NULL
,
"VSPOUTR"
},
};
};
struct
cs42l73_mclk_div
{
struct
cs42l73_mclk_div
{
...
@@ -1167,6 +1221,14 @@ static int cs42l73_set_bias_level(struct snd_soc_codec *codec,
...
@@ -1167,6 +1221,14 @@ static int cs42l73_set_bias_level(struct snd_soc_codec *codec,
case
SND_SOC_BIAS_OFF
:
case
SND_SOC_BIAS_OFF
:
snd_soc_update_bits
(
codec
,
CS42L73_PWRCTL1
,
PDN
,
1
);
snd_soc_update_bits
(
codec
,
CS42L73_PWRCTL1
,
PDN
,
1
);
if
(
cs42l73
->
shutdwn_delay
>
0
)
{
mdelay
(
cs42l73
->
shutdwn_delay
);
cs42l73
->
shutdwn_delay
=
0
;
}
else
{
mdelay
(
15
);
/* Min amount of time requred to power
* down.
*/
}
snd_soc_update_bits
(
codec
,
CS42L73_DMMCC
,
MCLKDIS
,
1
);
snd_soc_update_bits
(
codec
,
CS42L73_DMMCC
,
MCLKDIS
,
1
);
break
;
break
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录