Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
da88b48b
L
linux
项目概览
xiphi1978
/
linux
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
da88b48b
编写于
3月 17, 2009
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'pxa-ssp' into for-2.6.30
上级
d2314e0e
85fab780
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
68 addition
and
42 deletion
+68
-42
sound/soc/pxa/pxa-ssp.c
sound/soc/pxa/pxa-ssp.c
+43
-12
sound/soc/pxa/zylonite.c
sound/soc/pxa/zylonite.c
+25
-30
未找到文件。
sound/soc/pxa/pxa-ssp.c
浏览文件 @
da88b48b
#define DEBUG
/*
* pxa-ssp.c -- ALSA Soc Audio Layer
*
...
...
@@ -558,18 +557,18 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
switch
(
fmt
&
SND_SOC_DAIFMT_FORMAT_MASK
)
{
case
SND_SOC_DAIFMT_I2S
:
sscr0
|=
SSCR0_
MOD
|
SSCR0_
PSP
;
sscr0
|=
SSCR0_PSP
;
sscr1
|=
SSCR1_RWOT
|
SSCR1_TRAIL
;
/* See hw_params() */
switch
(
fmt
&
SND_SOC_DAIFMT_INV_MASK
)
{
case
SND_SOC_DAIFMT_NB_NF
:
sspsp
|=
SSPSP_
FSRT
;
sspsp
|=
SSPSP_
SFRMP
;
break
;
case
SND_SOC_DAIFMT_NB_IF
:
sspsp
|=
SSPSP_SFRMP
|
SSPSP_FSRT
;
break
;
case
SND_SOC_DAIFMT_IB_IF
:
sspsp
|=
SSPSP_S
FRMP
;
sspsp
|=
SSPSP_S
CMODE
(
3
)
;
break
;
default:
return
-
EINVAL
;
...
...
@@ -655,33 +654,65 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
sscr0
|=
SSCR0_FPCKE
;
#endif
sscr0
|=
SSCR0_DataSize
(
16
);
/* use network mode (2 slots) for 16 bit stereo */
break
;
case
SNDRV_PCM_FORMAT_S24_LE
:
sscr0
|=
(
SSCR0_EDSS
|
SSCR0_DataSize
(
8
));
/* we must be in network mode (2 slots) for 24 bit stereo */
break
;
case
SNDRV_PCM_FORMAT_S32_LE
:
sscr0
|=
(
SSCR0_EDSS
|
SSCR0_DataSize
(
16
));
/* we must be in network mode (2 slots) for 32 bit stereo */
break
;
}
ssp_write_reg
(
ssp
,
SSCR0
,
sscr0
);
switch
(
priv
->
dai_fmt
&
SND_SOC_DAIFMT_FORMAT_MASK
)
{
case
SND_SOC_DAIFMT_I2S
:
/* Cleared when the DAI format is set */
sspsp
=
ssp_read_reg
(
ssp
,
SSPSP
)
|
SSPSP_SFRMWDTH
(
width
);
sspsp
=
ssp_read_reg
(
ssp
,
SSPSP
);
if
(((
sscr0
&
SSCR0_SCR
)
==
SSCR0_SerClkDiv
(
4
))
&&
(
width
==
16
))
{
/* This is a special case where the bitclk is 64fs
* and we're not dealing with 2*32 bits of audio
* samples.
*
* The SSP values used for that are all found out by
* trying and failing a lot; some of the registers
* needed for that mode are only available on PXA3xx.
*/
#ifdef CONFIG_PXA3xx
if
(
!
cpu_is_pxa3xx
())
return
-
EINVAL
;
sspsp
|=
SSPSP_SFRMWDTH
(
width
*
2
);
sspsp
|=
SSPSP_SFRMDLY
(
width
*
4
);
sspsp
|=
SSPSP_EDMYSTOP
(
3
);
sspsp
|=
SSPSP_DMYSTOP
(
3
);
sspsp
|=
SSPSP_DMYSTRT
(
1
);
#else
return
-
EINVAL
;
#endif
}
else
{
/* The frame width is the width the LRCLK is
* asserted for; the delay is expressed in
* half cycle units. We need the extra cycle
* because the data starts clocking out one BCLK
* after LRCLK changes polarity.
*/
sspsp
|=
SSPSP_SFRMWDTH
(
width
+
1
);
sspsp
|=
SSPSP_SFRMDLY
((
width
+
1
)
*
2
);
sspsp
|=
SSPSP_DMYSTRT
(
1
);
}
ssp_write_reg
(
ssp
,
SSPSP
,
sspsp
);
break
;
default:
break
;
}
/* W
e always use a network mode so
we always require TDM slots
/* W
hen we use a network mode,
we always require TDM slots
* - complain loudly and fail if they've not been set up yet.
*/
if
(
!
(
ssp_read_reg
(
ssp
,
SSTSA
)
&
0xf
))
{
if
(
(
sscr0
&
SSCR0_MOD
)
&&
!
(
ssp_read_reg
(
ssp
,
SSTSA
)
&
0xf
))
{
dev_err
(
&
ssp
->
pdev
->
dev
,
"No TDM timeslot configured
\n
"
);
return
-
EINVAL
;
}
...
...
sound/soc/pxa/zylonite.c
浏览文件 @
da88b48b
...
...
@@ -96,42 +96,35 @@ static int zylonite_voice_hw_params(struct snd_pcm_substream *substream,
struct
snd_soc_dai
*
codec_dai
=
rtd
->
dai
->
codec_dai
;
struct
snd_soc_dai
*
cpu_dai
=
rtd
->
dai
->
cpu_dai
;
unsigned
int
pll_out
=
0
;
unsigned
int
acds
=
0
;
unsigned
int
wm9713_div
=
0
;
int
ret
=
0
;
switch
(
params_rate
(
params
))
{
int
rate
=
params_rate
(
params
);
int
width
=
snd_pcm_format_physical_width
(
params_format
(
params
));
/* Only support ratios that we can generate neatly from the AC97
* based master clock - in particular, this excludes 44.1kHz.
* In most applications the voice DAC will be used for telephony
* data so multiples of 8kHz will be the common case.
*/
switch
(
rate
)
{
case
8000
:
wm9713_div
=
12
;
pll_out
=
2048000
;
break
;
case
16000
:
wm9713_div
=
6
;
pll_out
=
4096000
;
break
;
case
48000
:
default:
wm9713_div
=
2
;
pll_out
=
12288000
;
acds
=
1
;
break
;
default:
/* Don't support OSS emulation */
return
-
EINVAL
;
}
ret
=
snd_soc_dai_set_fmt
(
codec_dai
,
SND_SOC_DAIFMT_I2S
|
SND_SOC_DAIFMT_NB_NF
|
SND_SOC_DAIFMT_CBS_CFS
);
if
(
ret
<
0
)
return
ret
;
ret
=
snd_soc_dai_set_fmt
(
cpu_dai
,
SND_SOC_DAIFMT_I2S
|
SND_SOC_DAIFMT_NB_NF
|
SND_SOC_DAIFMT_CBS_CFS
);
if
(
ret
<
0
)
return
ret
;
/* Add 1 to the width for the leading clock cycle */
pll_out
=
rate
*
(
width
+
1
)
*
8
;
/* Use network mode for stereo, one slot per channel. */
if
(
params_channels
(
params
)
>
1
)
ret
=
snd_soc_dai_set_tdm_slot
(
cpu_dai
,
0x3
,
2
);
else
ret
=
snd_soc_dai_set_tdm_slot
(
cpu_dai
,
1
,
1
);
ret
=
snd_soc_dai_set_sysclk
(
cpu_dai
,
PXA_SSP_CLK_AUDIO
,
0
,
1
);
if
(
ret
<
0
)
return
ret
;
...
...
@@ -139,14 +132,6 @@ static int zylonite_voice_hw_params(struct snd_pcm_substream *substream,
if
(
ret
<
0
)
return
ret
;
ret
=
snd_soc_dai_set_clkdiv
(
cpu_dai
,
PXA_SSP_AUDIO_DIV_ACDS
,
acds
);
if
(
ret
<
0
)
return
ret
;
ret
=
snd_soc_dai_set_sysclk
(
cpu_dai
,
PXA_SSP_CLK_AUDIO
,
0
,
1
);
if
(
ret
<
0
)
return
ret
;
if
(
clk_pout
)
ret
=
snd_soc_dai_set_clkdiv
(
codec_dai
,
WM9713_PCMCLK_PLL_DIV
,
WM9713_PCMDIV
(
wm9713_div
));
...
...
@@ -156,6 +141,16 @@ static int zylonite_voice_hw_params(struct snd_pcm_substream *substream,
if
(
ret
<
0
)
return
ret
;
ret
=
snd_soc_dai_set_fmt
(
codec_dai
,
SND_SOC_DAIFMT_I2S
|
SND_SOC_DAIFMT_NB_NF
|
SND_SOC_DAIFMT_CBS_CFS
);
if
(
ret
<
0
)
return
ret
;
ret
=
snd_soc_dai_set_fmt
(
cpu_dai
,
SND_SOC_DAIFMT_I2S
|
SND_SOC_DAIFMT_NB_NF
|
SND_SOC_DAIFMT_CBS_CFS
);
if
(
ret
<
0
)
return
ret
;
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录