Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
24a6703a
K
Kernel
项目概览
openeuler
/
Kernel
大约 1 年 前同步成功
通知
5
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
24a6703a
编写于
10月 24, 2013
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'asoc/topic/tlv320aic32x4' into asoc-next
上级
3cabd442
4d208ca4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
71 deletion
+30
-71
sound/soc/codecs/tlv320aic32x4.c
sound/soc/codecs/tlv320aic32x4.c
+30
-71
未找到文件。
sound/soc/codecs/tlv320aic32x4.c
浏览文件 @
24a6703a
...
...
@@ -60,9 +60,8 @@ struct aic32x4_rate_divs {
};
struct
aic32x4_priv
{
struct
regmap
*
regmap
;
u32
sysclk
;
u8
page_no
;
void
*
control_data
;
u32
power_cfg
;
u32
micpga_routing
;
bool
swapdacs
;
...
...
@@ -262,67 +261,25 @@ static const struct snd_soc_dapm_route aic32x4_dapm_routes[] = {
{
"Right ADC"
,
NULL
,
"Right Input Mixer"
},
};
static
inline
int
aic32x4_change_page
(
struct
snd_soc_codec
*
codec
,
unsigned
int
new_page
)
{
struct
aic32x4_priv
*
aic32x4
=
snd_soc_codec_get_drvdata
(
codec
);
u8
data
[
2
];
int
ret
;
data
[
0
]
=
0x00
;
data
[
1
]
=
new_page
&
0xff
;
ret
=
codec
->
hw_write
(
codec
->
control_data
,
data
,
2
);
if
(
ret
==
2
)
{
aic32x4
->
page_no
=
new_page
;
return
0
;
}
else
{
return
ret
;
}
}
static
int
aic32x4_write
(
struct
snd_soc_codec
*
codec
,
unsigned
int
reg
,
unsigned
int
val
)
{
struct
aic32x4_priv
*
aic32x4
=
snd_soc_codec_get_drvdata
(
codec
);
unsigned
int
page
=
reg
/
128
;
unsigned
int
fixed_reg
=
reg
%
128
;
u8
data
[
2
];
int
ret
;
/* A write to AIC32X4_PSEL is really a non-explicit page change */
if
(
reg
==
AIC32X4_PSEL
)
return
aic32x4_change_page
(
codec
,
val
);
if
(
aic32x4
->
page_no
!=
page
)
{
ret
=
aic32x4_change_page
(
codec
,
page
);
if
(
ret
!=
0
)
return
ret
;
}
data
[
0
]
=
fixed_reg
&
0xff
;
data
[
1
]
=
val
&
0xff
;
if
(
codec
->
hw_write
(
codec
->
control_data
,
data
,
2
)
==
2
)
return
0
;
else
return
-
EIO
;
}
static
const
struct
regmap_range_cfg
aic32x4_regmap_pages
[]
=
{
{
.
selector_reg
=
0
,
.
selector_mask
=
0xff
,
.
window_start
=
0
,
.
window_len
=
128
,
.
range_min
=
AIC32X4_PAGE1
,
.
range_max
=
AIC32X4_PAGE1
+
127
,
},
};
static
unsigned
int
aic32x4_read
(
struct
snd_soc_codec
*
codec
,
unsigned
int
reg
)
{
struct
aic32x4_priv
*
aic32x4
=
snd_soc_codec_get_drvdata
(
codec
);
unsigned
int
page
=
reg
/
128
;
unsigned
int
fixed_reg
=
reg
%
128
;
int
ret
;
static
const
struct
regmap_config
aic32x4_regmap
=
{
.
reg_bits
=
8
,
.
val_bits
=
8
,
if
(
aic32x4
->
page_no
!=
page
)
{
ret
=
aic32x4_change_page
(
codec
,
page
);
if
(
ret
!=
0
)
return
ret
;
}
return
i2c_smbus_read_byte_data
(
codec
->
control_data
,
fixed_reg
&
0xff
);
}
.
max_register
=
AIC32X4_RMICPGAVOL
,
.
ranges
=
aic32x4_regmap_pages
,
.
num_ranges
=
ARRAY_SIZE
(
aic32x4_regmap_pages
),
};
static
inline
int
aic32x4_get_divs
(
int
mclk
,
int
rate
)
{
...
...
@@ -617,16 +574,10 @@ static int aic32x4_probe(struct snd_soc_codec *codec)
{
struct
aic32x4_priv
*
aic32x4
=
snd_soc_codec_get_drvdata
(
codec
);
u32
tmp_reg
;
int
ret
;
codec
->
hw_write
=
(
hw_write_t
)
i2c_master_send
;
codec
->
control_data
=
aic32x4
->
control_data
;
snd_soc_codec_set_cache_io
(
codec
,
8
,
8
,
SND_SOC_REGMAP
);
if
(
aic32x4
->
rstn_gpio
>=
0
)
{
ret
=
devm_gpio_request_one
(
codec
->
dev
,
aic32x4
->
rstn_gpio
,
GPIOF_OUT_INIT_LOW
,
"tlv320aic32x4 rstn"
);
if
(
ret
!=
0
)
return
ret
;
ndelay
(
10
);
gpio_set_value
(
aic32x4
->
rstn_gpio
,
1
);
}
...
...
@@ -692,8 +643,6 @@ static int aic32x4_remove(struct snd_soc_codec *codec)
}
static
struct
snd_soc_codec_driver
soc_codec_dev_aic32x4
=
{
.
read
=
aic32x4_read
,
.
write
=
aic32x4_write
,
.
probe
=
aic32x4_probe
,
.
remove
=
aic32x4_remove
,
.
suspend
=
aic32x4_suspend
,
...
...
@@ -720,7 +669,10 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c,
if
(
aic32x4
==
NULL
)
return
-
ENOMEM
;
aic32x4
->
control_data
=
i2c
;
aic32x4
->
regmap
=
devm_regmap_init_i2c
(
i2c
,
&
aic32x4_regmap
);
if
(
IS_ERR
(
aic32x4
->
regmap
))
return
PTR_ERR
(
aic32x4
->
regmap
);
i2c_set_clientdata
(
i2c
,
aic32x4
);
if
(
pdata
)
{
...
...
@@ -735,6 +687,13 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c,
aic32x4
->
rstn_gpio
=
-
1
;
}
if
(
aic32x4
->
rstn_gpio
>=
0
)
{
ret
=
devm_gpio_request_one
(
&
i2c
->
dev
,
aic32x4
->
rstn_gpio
,
GPIOF_OUT_INIT_LOW
,
"tlv320aic32x4 rstn"
);
if
(
ret
!=
0
)
return
ret
;
}
ret
=
snd_soc_register_codec
(
&
i2c
->
dev
,
&
soc_codec_dev_aic32x4
,
&
aic32x4_dai
,
1
);
return
ret
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录