Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
0c1c7337
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看板
提交
0c1c7337
编写于
12月 02, 2012
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'asoc/topic/ak4104' into asoc-next
上级
0bfbbc00
a273cd13
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
70 addition
and
17 deletion
+70
-17
Documentation/devicetree/bindings/sound/ak4104.txt
Documentation/devicetree/bindings/sound/ak4104.txt
+22
-0
sound/soc/codecs/ak4104.c
sound/soc/codecs/ak4104.c
+48
-17
未找到文件。
Documentation/devicetree/bindings/sound/ak4104.txt
0 → 100644
浏览文件 @
0c1c7337
AK4104 S/PDIF transmitter
This device supports SPI mode only.
Required properties:
- compatible : "asahi-kasei,ak4104"
- reg : The chip select number on the SPI bus
Optional properties:
- reset-gpio : a GPIO spec for the reset pin. If specified, it will be
deasserted before communication to the device starts.
Example:
spdif: ak4104@0 {
compatible = "asahi-kasei,ak4104";
reg = <0>;
spi-max-frequency = <5000000>;
};
sound/soc/codecs/ak4104.c
浏览文件 @
0c1c7337
...
@@ -15,6 +15,8 @@
...
@@ -15,6 +15,8 @@
#include <sound/soc.h>
#include <sound/soc.h>
#include <sound/initval.h>
#include <sound/initval.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi.h>
#include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <sound/asoundef.h>
#include <sound/asoundef.h>
/* AK4104 registers addresses */
/* AK4104 registers addresses */
...
@@ -98,14 +100,32 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream,
...
@@ -98,14 +100,32 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream,
val
=
0
;
val
=
0
;
switch
(
params_rate
(
params
))
{
switch
(
params_rate
(
params
))
{
case
22050
:
val
|=
IEC958_AES3_CON_FS_22050
;
break
;
case
24000
:
val
|=
IEC958_AES3_CON_FS_24000
;
break
;
case
32000
:
val
|=
IEC958_AES3_CON_FS_32000
;
break
;
case
44100
:
case
44100
:
val
|=
IEC958_AES3_CON_FS_44100
;
val
|=
IEC958_AES3_CON_FS_44100
;
break
;
break
;
case
48000
:
case
48000
:
val
|=
IEC958_AES3_CON_FS_48000
;
val
|=
IEC958_AES3_CON_FS_48000
;
break
;
break
;
case
32000
:
case
88200
:
val
|=
IEC958_AES3_CON_FS_32000
;
val
|=
IEC958_AES3_CON_FS_88200
;
break
;
case
96000
:
val
|=
IEC958_AES3_CON_FS_96000
;
break
;
case
176400
:
val
|=
IEC958_AES3_CON_FS_176400
;
break
;
case
192000
:
val
|=
IEC958_AES3_CON_FS_192000
;
break
;
break
;
default:
default:
dev_err
(
codec
->
dev
,
"unsupported sampling rate
\n
"
);
dev_err
(
codec
->
dev
,
"unsupported sampling rate
\n
"
);
...
@@ -186,6 +206,7 @@ static const struct regmap_config ak4104_regmap = {
...
@@ -186,6 +206,7 @@ static const struct regmap_config ak4104_regmap = {
static
int
ak4104_spi_probe
(
struct
spi_device
*
spi
)
static
int
ak4104_spi_probe
(
struct
spi_device
*
spi
)
{
{
struct
device_node
*
np
=
spi
->
dev
.
of_node
;
struct
ak4104_private
*
ak4104
;
struct
ak4104_private
*
ak4104
;
unsigned
int
val
;
unsigned
int
val
;
int
ret
;
int
ret
;
...
@@ -201,49 +222,59 @@ static int ak4104_spi_probe(struct spi_device *spi)
...
@@ -201,49 +222,59 @@ static int ak4104_spi_probe(struct spi_device *spi)
if
(
ak4104
==
NULL
)
if
(
ak4104
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
ak4104
->
regmap
=
regmap_init_spi
(
spi
,
&
ak4104_regmap
);
ak4104
->
regmap
=
devm_
regmap_init_spi
(
spi
,
&
ak4104_regmap
);
if
(
IS_ERR
(
ak4104
->
regmap
))
{
if
(
IS_ERR
(
ak4104
->
regmap
))
{
ret
=
PTR_ERR
(
ak4104
->
regmap
);
ret
=
PTR_ERR
(
ak4104
->
regmap
);
return
ret
;
return
ret
;
}
}
if
(
np
)
{
enum
of_gpio_flags
flags
;
int
gpio
=
of_get_named_gpio_flags
(
np
,
"reset-gpio"
,
0
,
&
flags
);
if
(
gpio_is_valid
(
gpio
))
{
ret
=
devm_gpio_request_one
(
&
spi
->
dev
,
gpio
,
flags
&
OF_GPIO_ACTIVE_LOW
?
GPIOF_OUT_INIT_LOW
:
GPIOF_OUT_INIT_HIGH
,
"ak4104 reset"
);
if
(
ret
<
0
)
return
ret
;
}
}
/* read the 'reserved' register - according to the datasheet, it
/* read the 'reserved' register - according to the datasheet, it
* should contain 0x5b. Not a good way to verify the presence of
* should contain 0x5b. Not a good way to verify the presence of
* the device, but there is no hardware ID register. */
* the device, but there is no hardware ID register. */
ret
=
regmap_read
(
ak4104
->
regmap
,
AK4104_REG_RESERVED
,
&
val
);
ret
=
regmap_read
(
ak4104
->
regmap
,
AK4104_REG_RESERVED
,
&
val
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
goto
err
;
return
ret
;
if
(
val
!=
AK4104_RESERVED_VAL
)
{
if
(
val
!=
AK4104_RESERVED_VAL
)
ret
=
-
ENODEV
;
return
-
ENODEV
;
goto
err
;
}
spi_set_drvdata
(
spi
,
ak4104
);
spi_set_drvdata
(
spi
,
ak4104
);
ret
=
snd_soc_register_codec
(
&
spi
->
dev
,
ret
=
snd_soc_register_codec
(
&
spi
->
dev
,
&
soc_codec_device_ak4104
,
&
ak4104_dai
,
1
);
&
soc_codec_device_ak4104
,
&
ak4104_dai
,
1
);
if
(
ret
!=
0
)
goto
err
;
return
0
;
err:
regmap_exit
(
ak4104
->
regmap
);
return
ret
;
return
ret
;
}
}
static
int
__devexit
ak4104_spi_remove
(
struct
spi_device
*
spi
)
static
int
__devexit
ak4104_spi_remove
(
struct
spi_device
*
spi
)
{
{
struct
ak4104_private
*
ak4101
=
spi_get_drvdata
(
spi
);
regmap_exit
(
ak4101
->
regmap
);
snd_soc_unregister_codec
(
&
spi
->
dev
);
snd_soc_unregister_codec
(
&
spi
->
dev
);
return
0
;
return
0
;
}
}
static
const
struct
of_device_id
ak4104_of_match
[]
=
{
{
.
compatible
=
"asahi-kasei,ak4104"
,
},
{
}
};
MODULE_DEVICE_TABLE
(
of
,
ak4104_of_match
);
static
struct
spi_driver
ak4104_spi_driver
=
{
static
struct
spi_driver
ak4104_spi_driver
=
{
.
driver
=
{
.
driver
=
{
.
name
=
DRV_NAME
,
.
name
=
DRV_NAME
,
.
owner
=
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
.
of_match_table
=
ak4104_of_match
,
},
},
.
probe
=
ak4104_spi_probe
,
.
probe
=
ak4104_spi_probe
,
.
remove
=
__devexit_p
(
ak4104_spi_remove
),
.
remove
=
__devexit_p
(
ak4104_spi_remove
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录