Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
5fa87d34
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
5fa87d34
编写于
4月 05, 2012
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ASoC: wm8400: Use snd_soc_write() and snd_soc_read()
Signed-off-by:
N
Mark Brown
<
broonie@opensource.wolfsonmicro.com
>
上级
7e811ae7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
66 addition
and
66 deletion
+66
-66
sound/soc/codecs/wm8400.c
sound/soc/codecs/wm8400.c
+66
-66
未找到文件。
sound/soc/codecs/wm8400.c
浏览文件 @
5fa87d34
...
...
@@ -138,8 +138,8 @@ static int wm8400_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol,
return
ret
;
/* now hit the volume update bits (always bit 8) */
val
=
wm8400
_read
(
codec
,
reg
);
return
wm8400
_write
(
codec
,
reg
,
val
|
0x0100
);
val
=
snd_soc
_read
(
codec
,
reg
);
return
snd_soc
_write
(
codec
,
reg
,
val
|
0x0100
);
}
#define WM8400_OUTPGA_SINGLE_R_TLV(xname, reg, shift, max, invert, tlv_array) \
...
...
@@ -362,8 +362,8 @@ static int inmixer_event (struct snd_soc_dapm_widget *w,
{
u16
reg
,
fakepower
;
reg
=
wm8400
_read
(
w
->
codec
,
WM8400_POWER_MANAGEMENT_2
);
fakepower
=
wm8400
_read
(
w
->
codec
,
WM8400_INTDRIVBITS
);
reg
=
snd_soc
_read
(
w
->
codec
,
WM8400_POWER_MANAGEMENT_2
);
fakepower
=
snd_soc
_read
(
w
->
codec
,
WM8400_INTDRIVBITS
);
if
(
fakepower
&
((
1
<<
WM8400_INMIXL_PWR
)
|
(
1
<<
WM8400_AINLMUX_PWR
)))
{
...
...
@@ -378,7 +378,7 @@ static int inmixer_event (struct snd_soc_dapm_widget *w,
}
else
{
reg
&=
~
WM8400_AINR_ENA
;
}
wm8400
_write
(
w
->
codec
,
WM8400_POWER_MANAGEMENT_2
,
reg
);
snd_soc
_write
(
w
->
codec
,
WM8400_POWER_MANAGEMENT_2
,
reg
);
return
0
;
}
...
...
@@ -394,7 +394,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w,
switch
(
reg_shift
)
{
case
WM8400_SPEAKER_MIXER
|
(
WM8400_LDSPK
<<
8
)
:
reg
=
wm8400
_read
(
w
->
codec
,
WM8400_OUTPUT_MIXER1
);
reg
=
snd_soc
_read
(
w
->
codec
,
WM8400_OUTPUT_MIXER1
);
if
(
reg
&
WM8400_LDLO
)
{
printk
(
KERN_WARNING
"Cannot set as Output Mixer 1 LDLO Set
\n
"
);
...
...
@@ -402,7 +402,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w,
}
break
;
case
WM8400_SPEAKER_MIXER
|
(
WM8400_RDSPK
<<
8
):
reg
=
wm8400
_read
(
w
->
codec
,
WM8400_OUTPUT_MIXER2
);
reg
=
snd_soc
_read
(
w
->
codec
,
WM8400_OUTPUT_MIXER2
);
if
(
reg
&
WM8400_RDRO
)
{
printk
(
KERN_WARNING
"Cannot set as Output Mixer 2 RDRO Set
\n
"
);
...
...
@@ -410,7 +410,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w,
}
break
;
case
WM8400_OUTPUT_MIXER1
|
(
WM8400_LDLO
<<
8
):
reg
=
wm8400
_read
(
w
->
codec
,
WM8400_SPEAKER_MIXER
);
reg
=
snd_soc
_read
(
w
->
codec
,
WM8400_SPEAKER_MIXER
);
if
(
reg
&
WM8400_LDSPK
)
{
printk
(
KERN_WARNING
"Cannot set as Speaker Mixer LDSPK Set
\n
"
);
...
...
@@ -418,7 +418,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w,
}
break
;
case
WM8400_OUTPUT_MIXER2
|
(
WM8400_RDRO
<<
8
):
reg
=
wm8400
_read
(
w
->
codec
,
WM8400_SPEAKER_MIXER
);
reg
=
snd_soc
_read
(
w
->
codec
,
WM8400_SPEAKER_MIXER
);
if
(
reg
&
WM8400_RDSPK
)
{
printk
(
KERN_WARNING
"Cannot set as Speaker Mixer RDSPK Set
\n
"
);
...
...
@@ -1021,13 +1021,13 @@ static int wm8400_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
wm8400
->
fll_in
=
freq_in
;
/* We *must* disable the FLL before any changes */
reg
=
wm8400
_read
(
codec
,
WM8400_POWER_MANAGEMENT_2
);
reg
=
snd_soc
_read
(
codec
,
WM8400_POWER_MANAGEMENT_2
);
reg
&=
~
WM8400_FLL_ENA
;
wm8400
_write
(
codec
,
WM8400_POWER_MANAGEMENT_2
,
reg
);
snd_soc
_write
(
codec
,
WM8400_POWER_MANAGEMENT_2
,
reg
);
reg
=
wm8400
_read
(
codec
,
WM8400_FLL_CONTROL_1
);
reg
=
snd_soc
_read
(
codec
,
WM8400_FLL_CONTROL_1
);
reg
&=
~
WM8400_FLL_OSC_ENA
;
wm8400
_write
(
codec
,
WM8400_FLL_CONTROL_1
,
reg
);
snd_soc
_write
(
codec
,
WM8400_FLL_CONTROL_1
,
reg
);
if
(
!
freq_out
)
return
0
;
...
...
@@ -1035,15 +1035,15 @@ static int wm8400_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
reg
&=
~
(
WM8400_FLL_REF_FREQ
|
WM8400_FLL_FRATIO_MASK
);
reg
|=
WM8400_FLL_FRAC
|
factors
.
fratio
;
reg
|=
factors
.
freq_ref
<<
WM8400_FLL_REF_FREQ_SHIFT
;
wm8400
_write
(
codec
,
WM8400_FLL_CONTROL_1
,
reg
);
snd_soc
_write
(
codec
,
WM8400_FLL_CONTROL_1
,
reg
);
wm8400
_write
(
codec
,
WM8400_FLL_CONTROL_2
,
factors
.
k
);
wm8400
_write
(
codec
,
WM8400_FLL_CONTROL_3
,
factors
.
n
);
snd_soc
_write
(
codec
,
WM8400_FLL_CONTROL_2
,
factors
.
k
);
snd_soc
_write
(
codec
,
WM8400_FLL_CONTROL_3
,
factors
.
n
);
reg
=
wm8400
_read
(
codec
,
WM8400_FLL_CONTROL_4
);
reg
=
snd_soc
_read
(
codec
,
WM8400_FLL_CONTROL_4
);
reg
&=
~
WM8400_FLL_OUTDIV_MASK
;
reg
|=
factors
.
outdiv
;
wm8400
_write
(
codec
,
WM8400_FLL_CONTROL_4
,
reg
);
snd_soc
_write
(
codec
,
WM8400_FLL_CONTROL_4
,
reg
);
return
0
;
}
...
...
@@ -1057,8 +1057,8 @@ static int wm8400_set_dai_fmt(struct snd_soc_dai *codec_dai,
struct
snd_soc_codec
*
codec
=
codec_dai
->
codec
;
u16
audio1
,
audio3
;
audio1
=
wm8400
_read
(
codec
,
WM8400_AUDIO_INTERFACE_1
);
audio3
=
wm8400
_read
(
codec
,
WM8400_AUDIO_INTERFACE_3
);
audio1
=
snd_soc
_read
(
codec
,
WM8400_AUDIO_INTERFACE_1
);
audio3
=
snd_soc
_read
(
codec
,
WM8400_AUDIO_INTERFACE_3
);
/* set master/slave audio interface */
switch
(
fmt
&
SND_SOC_DAIFMT_MASTER_MASK
)
{
...
...
@@ -1099,8 +1099,8 @@ static int wm8400_set_dai_fmt(struct snd_soc_dai *codec_dai,
return
-
EINVAL
;
}
wm8400
_write
(
codec
,
WM8400_AUDIO_INTERFACE_1
,
audio1
);
wm8400
_write
(
codec
,
WM8400_AUDIO_INTERFACE_3
,
audio3
);
snd_soc
_write
(
codec
,
WM8400_AUDIO_INTERFACE_1
,
audio1
);
snd_soc
_write
(
codec
,
WM8400_AUDIO_INTERFACE_3
,
audio3
);
return
0
;
}
...
...
@@ -1112,24 +1112,24 @@ static int wm8400_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
switch
(
div_id
)
{
case
WM8400_MCLK_DIV
:
reg
=
wm8400
_read
(
codec
,
WM8400_CLOCKING_2
)
&
reg
=
snd_soc
_read
(
codec
,
WM8400_CLOCKING_2
)
&
~
WM8400_MCLK_DIV_MASK
;
wm8400
_write
(
codec
,
WM8400_CLOCKING_2
,
reg
|
div
);
snd_soc
_write
(
codec
,
WM8400_CLOCKING_2
,
reg
|
div
);
break
;
case
WM8400_DACCLK_DIV
:
reg
=
wm8400
_read
(
codec
,
WM8400_CLOCKING_2
)
&
reg
=
snd_soc
_read
(
codec
,
WM8400_CLOCKING_2
)
&
~
WM8400_DAC_CLKDIV_MASK
;
wm8400
_write
(
codec
,
WM8400_CLOCKING_2
,
reg
|
div
);
snd_soc
_write
(
codec
,
WM8400_CLOCKING_2
,
reg
|
div
);
break
;
case
WM8400_ADCCLK_DIV
:
reg
=
wm8400
_read
(
codec
,
WM8400_CLOCKING_2
)
&
reg
=
snd_soc
_read
(
codec
,
WM8400_CLOCKING_2
)
&
~
WM8400_ADC_CLKDIV_MASK
;
wm8400
_write
(
codec
,
WM8400_CLOCKING_2
,
reg
|
div
);
snd_soc
_write
(
codec
,
WM8400_CLOCKING_2
,
reg
|
div
);
break
;
case
WM8400_BCLK_DIV
:
reg
=
wm8400
_read
(
codec
,
WM8400_CLOCKING_1
)
&
reg
=
snd_soc
_read
(
codec
,
WM8400_CLOCKING_1
)
&
~
WM8400_BCLK_DIV_MASK
;
wm8400
_write
(
codec
,
WM8400_CLOCKING_1
,
reg
|
div
);
snd_soc
_write
(
codec
,
WM8400_CLOCKING_1
,
reg
|
div
);
break
;
default:
return
-
EINVAL
;
...
...
@@ -1146,7 +1146,7 @@ static int wm8400_hw_params(struct snd_pcm_substream *substream,
struct
snd_soc_dai
*
dai
)
{
struct
snd_soc_codec
*
codec
=
dai
->
codec
;
u16
audio1
=
wm8400
_read
(
codec
,
WM8400_AUDIO_INTERFACE_1
);
u16
audio1
=
snd_soc
_read
(
codec
,
WM8400_AUDIO_INTERFACE_1
);
audio1
&=
~
WM8400_AIF_WL_MASK
;
/* bit size */
...
...
@@ -1164,19 +1164,19 @@ static int wm8400_hw_params(struct snd_pcm_substream *substream,
break
;
}
wm8400
_write
(
codec
,
WM8400_AUDIO_INTERFACE_1
,
audio1
);
snd_soc
_write
(
codec
,
WM8400_AUDIO_INTERFACE_1
,
audio1
);
return
0
;
}
static
int
wm8400_mute
(
struct
snd_soc_dai
*
dai
,
int
mute
)
{
struct
snd_soc_codec
*
codec
=
dai
->
codec
;
u16
val
=
wm8400
_read
(
codec
,
WM8400_DAC_CTRL
)
&
~
WM8400_DAC_MUTE
;
u16
val
=
snd_soc
_read
(
codec
,
WM8400_DAC_CTRL
)
&
~
WM8400_DAC_MUTE
;
if
(
mute
)
wm8400
_write
(
codec
,
WM8400_DAC_CTRL
,
val
|
WM8400_DAC_MUTE
);
snd_soc
_write
(
codec
,
WM8400_DAC_CTRL
,
val
|
WM8400_DAC_MUTE
);
else
wm8400
_write
(
codec
,
WM8400_DAC_CTRL
,
val
);
snd_soc
_write
(
codec
,
WM8400_DAC_CTRL
,
val
);
return
0
;
}
...
...
@@ -1195,9 +1195,9 @@ static int wm8400_set_bias_level(struct snd_soc_codec *codec,
case
SND_SOC_BIAS_PREPARE
:
/* VMID=2*50k */
val
=
wm8400
_read
(
codec
,
WM8400_POWER_MANAGEMENT_1
)
&
val
=
snd_soc
_read
(
codec
,
WM8400_POWER_MANAGEMENT_1
)
&
~
WM8400_VMID_MODE_MASK
;
wm8400
_write
(
codec
,
WM8400_POWER_MANAGEMENT_1
,
val
|
0x2
);
snd_soc
_write
(
codec
,
WM8400_POWER_MANAGEMENT_1
,
val
|
0x2
);
break
;
case
SND_SOC_BIAS_STANDBY
:
...
...
@@ -1211,74 +1211,74 @@ static int wm8400_set_bias_level(struct snd_soc_codec *codec,
return
ret
;
}
wm8400
_write
(
codec
,
WM8400_POWER_MANAGEMENT_1
,
snd_soc
_write
(
codec
,
WM8400_POWER_MANAGEMENT_1
,
WM8400_CODEC_ENA
|
WM8400_SYSCLK_ENA
);
/* Enable POBCTRL, SOFT_ST, VMIDTOG and BUFDCOPEN */
wm8400
_write
(
codec
,
WM8400_ANTIPOP2
,
WM8400_SOFTST
|
snd_soc
_write
(
codec
,
WM8400_ANTIPOP2
,
WM8400_SOFTST
|
WM8400_BUFDCOPEN
|
WM8400_POBCTRL
);
msleep
(
50
);
/* Enable VREF & VMID at 2x50k */
val
=
wm8400
_read
(
codec
,
WM8400_POWER_MANAGEMENT_1
);
val
=
snd_soc
_read
(
codec
,
WM8400_POWER_MANAGEMENT_1
);
val
|=
0x2
|
WM8400_VREF_ENA
;
wm8400
_write
(
codec
,
WM8400_POWER_MANAGEMENT_1
,
val
);
snd_soc
_write
(
codec
,
WM8400_POWER_MANAGEMENT_1
,
val
);
/* Enable BUFIOEN */
wm8400
_write
(
codec
,
WM8400_ANTIPOP2
,
WM8400_SOFTST
|
snd_soc
_write
(
codec
,
WM8400_ANTIPOP2
,
WM8400_SOFTST
|
WM8400_BUFDCOPEN
|
WM8400_POBCTRL
|
WM8400_BUFIOEN
);
/* disable POBCTRL, SOFT_ST and BUFDCOPEN */
wm8400
_write
(
codec
,
WM8400_ANTIPOP2
,
WM8400_BUFIOEN
);
snd_soc
_write
(
codec
,
WM8400_ANTIPOP2
,
WM8400_BUFIOEN
);
}
/* VMID=2*300k */
val
=
wm8400
_read
(
codec
,
WM8400_POWER_MANAGEMENT_1
)
&
val
=
snd_soc
_read
(
codec
,
WM8400_POWER_MANAGEMENT_1
)
&
~
WM8400_VMID_MODE_MASK
;
wm8400
_write
(
codec
,
WM8400_POWER_MANAGEMENT_1
,
val
|
0x4
);
snd_soc
_write
(
codec
,
WM8400_POWER_MANAGEMENT_1
,
val
|
0x4
);
break
;
case
SND_SOC_BIAS_OFF
:
/* Enable POBCTRL and SOFT_ST */
wm8400
_write
(
codec
,
WM8400_ANTIPOP2
,
WM8400_SOFTST
|
snd_soc
_write
(
codec
,
WM8400_ANTIPOP2
,
WM8400_SOFTST
|
WM8400_POBCTRL
|
WM8400_BUFIOEN
);
/* Enable POBCTRL, SOFT_ST and BUFDCOPEN */
wm8400
_write
(
codec
,
WM8400_ANTIPOP2
,
WM8400_SOFTST
|
snd_soc
_write
(
codec
,
WM8400_ANTIPOP2
,
WM8400_SOFTST
|
WM8400_BUFDCOPEN
|
WM8400_POBCTRL
|
WM8400_BUFIOEN
);
/* mute DAC */
val
=
wm8400
_read
(
codec
,
WM8400_DAC_CTRL
);
wm8400
_write
(
codec
,
WM8400_DAC_CTRL
,
val
|
WM8400_DAC_MUTE
);
val
=
snd_soc
_read
(
codec
,
WM8400_DAC_CTRL
);
snd_soc
_write
(
codec
,
WM8400_DAC_CTRL
,
val
|
WM8400_DAC_MUTE
);
/* Enable any disabled outputs */
val
=
wm8400
_read
(
codec
,
WM8400_POWER_MANAGEMENT_1
);
val
=
snd_soc
_read
(
codec
,
WM8400_POWER_MANAGEMENT_1
);
val
|=
WM8400_SPK_ENA
|
WM8400_OUT3_ENA
|
WM8400_OUT4_ENA
|
WM8400_LOUT_ENA
|
WM8400_ROUT_ENA
;
wm8400
_write
(
codec
,
WM8400_POWER_MANAGEMENT_1
,
val
);
snd_soc
_write
(
codec
,
WM8400_POWER_MANAGEMENT_1
,
val
);
/* Disable VMID */
val
&=
~
WM8400_VMID_MODE_MASK
;
wm8400
_write
(
codec
,
WM8400_POWER_MANAGEMENT_1
,
val
);
snd_soc
_write
(
codec
,
WM8400_POWER_MANAGEMENT_1
,
val
);
msleep
(
300
);
/* Enable all output discharge bits */
wm8400
_write
(
codec
,
WM8400_ANTIPOP1
,
WM8400_DIS_LLINE
|
snd_soc
_write
(
codec
,
WM8400_ANTIPOP1
,
WM8400_DIS_LLINE
|
WM8400_DIS_RLINE
|
WM8400_DIS_OUT3
|
WM8400_DIS_OUT4
|
WM8400_DIS_LOUT
|
WM8400_DIS_ROUT
);
/* Disable VREF */
val
&=
~
WM8400_VREF_ENA
;
wm8400
_write
(
codec
,
WM8400_POWER_MANAGEMENT_1
,
val
);
snd_soc
_write
(
codec
,
WM8400_POWER_MANAGEMENT_1
,
val
);
/* disable POBCTRL, SOFT_ST and BUFDCOPEN */
wm8400
_write
(
codec
,
WM8400_ANTIPOP2
,
0x0
);
snd_soc
_write
(
codec
,
WM8400_ANTIPOP2
,
0x0
);
ret
=
regulator_bulk_disable
(
ARRAY_SIZE
(
power
),
&
power
[
0
]);
...
...
@@ -1384,19 +1384,19 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
wm8400_codec_reset
(
codec
);
reg
=
wm8400
_read
(
codec
,
WM8400_POWER_MANAGEMENT_1
);
wm8400
_write
(
codec
,
WM8400_POWER_MANAGEMENT_1
,
reg
|
WM8400_CODEC_ENA
);
reg
=
snd_soc
_read
(
codec
,
WM8400_POWER_MANAGEMENT_1
);
snd_soc
_write
(
codec
,
WM8400_POWER_MANAGEMENT_1
,
reg
|
WM8400_CODEC_ENA
);
/* Latch volume update bits */
reg
=
wm8400
_read
(
codec
,
WM8400_LEFT_LINE_INPUT_1_2_VOLUME
);
wm8400
_write
(
codec
,
WM8400_LEFT_LINE_INPUT_1_2_VOLUME
,
reg
=
snd_soc
_read
(
codec
,
WM8400_LEFT_LINE_INPUT_1_2_VOLUME
);
snd_soc
_write
(
codec
,
WM8400_LEFT_LINE_INPUT_1_2_VOLUME
,
reg
&
WM8400_IPVU
);
reg
=
wm8400
_read
(
codec
,
WM8400_RIGHT_LINE_INPUT_1_2_VOLUME
);
wm8400
_write
(
codec
,
WM8400_RIGHT_LINE_INPUT_1_2_VOLUME
,
reg
=
snd_soc
_read
(
codec
,
WM8400_RIGHT_LINE_INPUT_1_2_VOLUME
);
snd_soc
_write
(
codec
,
WM8400_RIGHT_LINE_INPUT_1_2_VOLUME
,
reg
&
WM8400_IPVU
);
wm8400
_write
(
codec
,
WM8400_LEFT_OUTPUT_VOLUME
,
0x50
|
(
1
<<
8
));
wm8400
_write
(
codec
,
WM8400_RIGHT_OUTPUT_VOLUME
,
0x50
|
(
1
<<
8
));
snd_soc
_write
(
codec
,
WM8400_LEFT_OUTPUT_VOLUME
,
0x50
|
(
1
<<
8
));
snd_soc
_write
(
codec
,
WM8400_RIGHT_OUTPUT_VOLUME
,
0x50
|
(
1
<<
8
));
if
(
!
schedule_work
(
&
priv
->
work
))
{
ret
=
-
EINVAL
;
...
...
@@ -1413,8 +1413,8 @@ static int wm8400_codec_remove(struct snd_soc_codec *codec)
{
u16
reg
;
reg
=
wm8400
_read
(
codec
,
WM8400_POWER_MANAGEMENT_1
);
wm8400
_write
(
codec
,
WM8400_POWER_MANAGEMENT_1
,
reg
=
snd_soc
_read
(
codec
,
WM8400_POWER_MANAGEMENT_1
);
snd_soc
_write
(
codec
,
WM8400_POWER_MANAGEMENT_1
,
reg
&
(
~
WM8400_CODEC_ENA
));
regulator_bulk_free
(
ARRAY_SIZE
(
power
),
power
);
...
...
@@ -1427,7 +1427,7 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8400 = {
.
remove
=
wm8400_codec_remove
,
.
suspend
=
wm8400_suspend
,
.
resume
=
wm8400_resume
,
.
read
=
wm8400
_read
,
.
read
=
snd_soc
_read
,
.
write
=
wm8400_write
,
.
set_bias_level
=
wm8400_set_bias_level
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录