Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
0ee6f750
cloud-kernel
项目概览
openanolis
/
cloud-kernel
接近 2 年 前同步成功
通知
169
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看板
提交
0ee6f750
编写于
6月 17, 2013
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'asoc/topic/adau1701' into asoc-next
上级
b2772934
f724ba3b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
86 addition
and
6 deletion
+86
-6
Documentation/devicetree/bindings/sound/adi,adau1701.txt
Documentation/devicetree/bindings/sound/adi,adau1701.txt
+23
-0
sound/soc/codecs/adau1701.c
sound/soc/codecs/adau1701.c
+63
-6
未找到文件。
Documentation/devicetree/bindings/sound/adi,adau1701.txt
0 → 100644
浏览文件 @
0ee6f750
Analog Devices ADAU1701
Required properties:
- compatible: Should contain "adi,adau1701"
- reg: The i2c address. Value depends on the state of ADDR0
and ADDR1, as wired in hardware.
Optional properties:
- reset-gpio: A GPIO spec to define which pin is connected to the
chip's !RESET pin. If specified, the driver will
assert a hardware reset at probe time.
Examples:
i2c_bus {
adau1701@34 {
compatible = "adi,adau1701";
reg = <0x34>;
reset-gpio = <&gpio 23 0>;
};
};
sound/soc/codecs/adau1701.c
浏览文件 @
0ee6f750
...
@@ -13,6 +13,9 @@
...
@@ -13,6 +13,9 @@
#include <linux/i2c.h>
#include <linux/i2c.h>
#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/of_device.h>
#include <sound/core.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/pcm_params.h>
...
@@ -87,6 +90,7 @@
...
@@ -87,6 +90,7 @@
#define ADAU1701_FIRMWARE "adau1701.bin"
#define ADAU1701_FIRMWARE "adau1701.bin"
struct
adau1701
{
struct
adau1701
{
int
gpio_nreset
;
unsigned
int
dai_fmt
;
unsigned
int
dai_fmt
;
};
};
...
@@ -180,9 +184,37 @@ static unsigned int adau1701_read(struct snd_soc_codec *codec, unsigned int reg)
...
@@ -180,9 +184,37 @@ static unsigned int adau1701_read(struct snd_soc_codec *codec, unsigned int reg)
return
value
;
return
value
;
}
}
static
int
adau1701_load_firmware
(
struct
snd_soc_codec
*
codec
)
static
void
adau1701_reset
(
struct
snd_soc_codec
*
codec
)
{
{
return
process_sigma_firmware
(
codec
->
control_data
,
ADAU1701_FIRMWARE
);
struct
adau1701
*
adau1701
=
snd_soc_codec_get_drvdata
(
codec
);
if
(
!
gpio_is_valid
(
adau1701
->
gpio_nreset
))
return
;
gpio_set_value
(
adau1701
->
gpio_nreset
,
0
);
/* minimum reset time is 20ns */
udelay
(
1
);
gpio_set_value
(
adau1701
->
gpio_nreset
,
1
);
/* power-up time may be as long as 85ms */
mdelay
(
85
);
}
static
int
adau1701_init
(
struct
snd_soc_codec
*
codec
)
{
int
ret
;
struct
i2c_client
*
client
=
to_i2c_client
(
codec
->
dev
);
adau1701_reset
(
codec
);
ret
=
process_sigma_firmware
(
client
,
ADAU1701_FIRMWARE
);
if
(
ret
)
{
dev_warn
(
codec
->
dev
,
"Failed to load firmware
\n
"
);
return
ret
;
}
snd_soc_write
(
codec
,
ADAU1701_DACSET
,
ADAU1701_DACSET_DACINIT
);
return
0
;
}
}
static
int
adau1701_set_capture_pcm_format
(
struct
snd_soc_codec
*
codec
,
static
int
adau1701_set_capture_pcm_format
(
struct
snd_soc_codec
*
codec
,
...
@@ -452,17 +484,24 @@ static struct snd_soc_dai_driver adau1701_dai = {
...
@@ -452,17 +484,24 @@ static struct snd_soc_dai_driver adau1701_dai = {
.
symmetric_rates
=
1
,
.
symmetric_rates
=
1
,
};
};
#ifdef CONFIG_OF
static
const
struct
of_device_id
adau1701_dt_ids
[]
=
{
{
.
compatible
=
"adi,adau1701"
,
},
{
}
};
MODULE_DEVICE_TABLE
(
of
,
adau1701_dt_ids
);
#endif
static
int
adau1701_probe
(
struct
snd_soc_codec
*
codec
)
static
int
adau1701_probe
(
struct
snd_soc_codec
*
codec
)
{
{
int
ret
;
int
ret
;
codec
->
control_data
=
to_i2c_client
(
codec
->
dev
);
codec
->
control_data
=
to_i2c_client
(
codec
->
dev
);
ret
=
adau1701_
load_firmware
(
codec
);
ret
=
adau1701_
init
(
codec
);
if
(
ret
)
if
(
ret
)
dev_warn
(
codec
->
dev
,
"Failed to load firmware
\n
"
)
;
return
ret
;
snd_soc_write
(
codec
,
ADAU1701_DACSET
,
ADAU1701_DACSET_DACINIT
);
snd_soc_write
(
codec
,
ADAU1701_DSPCTRL
,
ADAU1701_DSPCTRL_CR
);
snd_soc_write
(
codec
,
ADAU1701_DSPCTRL
,
ADAU1701_DSPCTRL_CR
);
return
0
;
return
0
;
...
@@ -493,12 +532,29 @@ static int adau1701_i2c_probe(struct i2c_client *client,
...
@@ -493,12 +532,29 @@ static int adau1701_i2c_probe(struct i2c_client *client,
const
struct
i2c_device_id
*
id
)
const
struct
i2c_device_id
*
id
)
{
{
struct
adau1701
*
adau1701
;
struct
adau1701
*
adau1701
;
struct
device
*
dev
=
&
client
->
dev
;
int
gpio_nreset
=
-
EINVAL
;
int
ret
;
int
ret
;
adau1701
=
devm_kzalloc
(
&
client
->
dev
,
sizeof
(
*
adau1701
),
GFP_KERNEL
);
adau1701
=
devm_kzalloc
(
dev
,
sizeof
(
*
adau1701
),
GFP_KERNEL
);
if
(
!
adau1701
)
if
(
!
adau1701
)
return
-
ENOMEM
;
return
-
ENOMEM
;
if
(
dev
->
of_node
)
{
gpio_nreset
=
of_get_named_gpio
(
dev
->
of_node
,
"reset-gpio"
,
0
);
if
(
gpio_nreset
<
0
&&
gpio_nreset
!=
-
ENOENT
)
return
gpio_nreset
;
}
if
(
gpio_is_valid
(
gpio_nreset
))
{
ret
=
devm_gpio_request_one
(
dev
,
gpio_nreset
,
GPIOF_OUT_INIT_LOW
,
"ADAU1701 Reset"
);
if
(
ret
<
0
)
return
ret
;
}
adau1701
->
gpio_nreset
=
gpio_nreset
;
i2c_set_clientdata
(
client
,
adau1701
);
i2c_set_clientdata
(
client
,
adau1701
);
ret
=
snd_soc_register_codec
(
&
client
->
dev
,
&
adau1701_codec_drv
,
ret
=
snd_soc_register_codec
(
&
client
->
dev
,
&
adau1701_codec_drv
,
&
adau1701_dai
,
1
);
&
adau1701_dai
,
1
);
...
@@ -521,6 +577,7 @@ static struct i2c_driver adau1701_i2c_driver = {
...
@@ -521,6 +577,7 @@ static struct i2c_driver adau1701_i2c_driver = {
.
driver
=
{
.
driver
=
{
.
name
=
"adau1701"
,
.
name
=
"adau1701"
,
.
owner
=
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
.
of_match_table
=
of_match_ptr
(
adau1701_dt_ids
),
},
},
.
probe
=
adau1701_i2c_probe
,
.
probe
=
adau1701_i2c_probe
,
.
remove
=
adau1701_i2c_remove
,
.
remove
=
adau1701_i2c_remove
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录