Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
8f9aa252
cloud-kernel
项目概览
openanolis
/
cloud-kernel
接近 2 年 前同步成功
通知
170
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8f9aa252
编写于
11月 14, 2011
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'for-3.2' into for-3.3
上级
a9317e8b
54dc6cab
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
63 addition
and
1 deletion
+63
-1
sound/soc/codecs/sta32x.c
sound/soc/codecs/sta32x.c
+62
-1
sound/soc/codecs/sta32x.h
sound/soc/codecs/sta32x.h
+1
-0
未找到文件。
sound/soc/codecs/sta32x.c
浏览文件 @
8f9aa252
...
...
@@ -76,6 +76,8 @@ struct sta32x_priv {
unsigned
int
mclk
;
unsigned
int
format
;
u32
coef_shadow
[
STA32X_COEF_COUNT
];
};
static
const
DECLARE_TLV_DB_SCALE
(
mvol_tlv
,
-
12700
,
50
,
1
);
...
...
@@ -227,6 +229,7 @@ static int sta32x_coefficient_put(struct snd_kcontrol *kcontrol,
struct
snd_ctl_elem_value
*
ucontrol
)
{
struct
snd_soc_codec
*
codec
=
snd_kcontrol_chip
(
kcontrol
);
struct
sta32x_priv
*
sta32x
=
snd_soc_codec_get_drvdata
(
codec
);
int
numcoef
=
kcontrol
->
private_value
>>
16
;
int
index
=
kcontrol
->
private_value
&
0xffff
;
unsigned
int
cfud
;
...
...
@@ -239,6 +242,11 @@ static int sta32x_coefficient_put(struct snd_kcontrol *kcontrol,
snd_soc_write
(
codec
,
STA32X_CFUD
,
cfud
);
snd_soc_write
(
codec
,
STA32X_CFADDR2
,
index
);
for
(
i
=
0
;
i
<
numcoef
&&
(
index
+
i
<
STA32X_COEF_COUNT
);
i
++
)
sta32x
->
coef_shadow
[
index
+
i
]
=
(
ucontrol
->
value
.
bytes
.
data
[
3
*
i
]
<<
16
)
|
(
ucontrol
->
value
.
bytes
.
data
[
3
*
i
+
1
]
<<
8
)
|
(
ucontrol
->
value
.
bytes
.
data
[
3
*
i
+
2
]);
for
(
i
=
0
;
i
<
3
*
numcoef
;
i
++
)
snd_soc_write
(
codec
,
STA32X_B1CF1
+
i
,
ucontrol
->
value
.
bytes
.
data
[
i
]);
...
...
@@ -252,6 +260,48 @@ static int sta32x_coefficient_put(struct snd_kcontrol *kcontrol,
return
0
;
}
int
sta32x_sync_coef_shadow
(
struct
snd_soc_codec
*
codec
)
{
struct
sta32x_priv
*
sta32x
=
snd_soc_codec_get_drvdata
(
codec
);
unsigned
int
cfud
;
int
i
;
/* preserve reserved bits in STA32X_CFUD */
cfud
=
snd_soc_read
(
codec
,
STA32X_CFUD
)
&
0xf0
;
for
(
i
=
0
;
i
<
STA32X_COEF_COUNT
;
i
++
)
{
snd_soc_write
(
codec
,
STA32X_CFADDR2
,
i
);
snd_soc_write
(
codec
,
STA32X_B1CF1
,
(
sta32x
->
coef_shadow
[
i
]
>>
16
)
&
0xff
);
snd_soc_write
(
codec
,
STA32X_B1CF2
,
(
sta32x
->
coef_shadow
[
i
]
>>
8
)
&
0xff
);
snd_soc_write
(
codec
,
STA32X_B1CF3
,
(
sta32x
->
coef_shadow
[
i
])
&
0xff
);
/* chip documentation does not say if the bits are
* self-clearing, so do it explicitly */
snd_soc_write
(
codec
,
STA32X_CFUD
,
cfud
);
snd_soc_write
(
codec
,
STA32X_CFUD
,
cfud
|
0x01
);
}
return
0
;
}
int
sta32x_cache_sync
(
struct
snd_soc_codec
*
codec
)
{
unsigned
int
mute
;
int
rc
;
if
(
!
codec
->
cache_sync
)
return
0
;
/* mute during register sync */
mute
=
snd_soc_read
(
codec
,
STA32X_MMUTE
);
snd_soc_write
(
codec
,
STA32X_MMUTE
,
mute
|
STA32X_MMUTE_MMUTE
);
sta32x_sync_coef_shadow
(
codec
);
rc
=
snd_soc_cache_sync
(
codec
);
snd_soc_write
(
codec
,
STA32X_MMUTE
,
mute
);
return
rc
;
}
#define SINGLE_COEF(xname, index) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
.info = sta32x_coefficient_info, \
...
...
@@ -661,7 +711,7 @@ static int sta32x_set_bias_level(struct snd_soc_codec *codec,
return
ret
;
}
s
nd_soc
_cache_sync
(
codec
);
s
ta32x
_cache_sync
(
codec
);
}
/* Power up to mute */
...
...
@@ -790,6 +840,17 @@ static int sta32x_probe(struct snd_soc_codec *codec)
STA32X_CxCFG_OM_MASK
,
2
<<
STA32X_CxCFG_OM_SHIFT
);
/* initialize coefficient shadow RAM with reset values */
for
(
i
=
4
;
i
<=
49
;
i
+=
5
)
sta32x
->
coef_shadow
[
i
]
=
0x400000
;
for
(
i
=
50
;
i
<=
54
;
i
++
)
sta32x
->
coef_shadow
[
i
]
=
0x7fffff
;
sta32x
->
coef_shadow
[
55
]
=
0x5a9df7
;
sta32x
->
coef_shadow
[
56
]
=
0x7fffff
;
sta32x
->
coef_shadow
[
59
]
=
0x7fffff
;
sta32x
->
coef_shadow
[
60
]
=
0x400000
;
sta32x
->
coef_shadow
[
61
]
=
0x400000
;
sta32x_set_bias_level
(
codec
,
SND_SOC_BIAS_STANDBY
);
/* Bias level configuration will have done an extra enable */
regulator_bulk_disable
(
ARRAY_SIZE
(
sta32x
->
supplies
),
sta32x
->
supplies
);
...
...
sound/soc/codecs/sta32x.h
浏览文件 @
8f9aa252
...
...
@@ -19,6 +19,7 @@
/* STA326 register addresses */
#define STA32X_REGISTER_COUNT 0x2d
#define STA32X_COEF_COUNT 62
#define STA32X_CONFA 0x00
#define STA32X_CONFB 0x01
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录