Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
5f5eb4ef
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
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看板
提交
5f5eb4ef
编写于
6月 17, 2013
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'asoc/topic/spear' into asoc-next
上级
d238ffab
fc09cfbe
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
52 addition
and
193 deletion
+52
-193
sound/soc/Kconfig
sound/soc/Kconfig
+1
-0
sound/soc/Makefile
sound/soc/Makefile
+1
-0
sound/soc/spear/Kconfig
sound/soc/spear/Kconfig
+9
-0
sound/soc/spear/Makefile
sound/soc/spear/Makefile
+8
-0
sound/soc/spear/spdif_in.c
sound/soc/spear/spdif_in.c
+7
-24
sound/soc/spear/spdif_out.c
sound/soc/spear/spdif_out.c
+11
-32
sound/soc/spear/spear_pcm.c
sound/soc/spear/spear_pcm.c
+15
-137
未找到文件。
sound/soc/Kconfig
浏览文件 @
5f5eb4ef
...
...
@@ -51,6 +51,7 @@ source "sound/soc/pxa/Kconfig"
source "sound/soc/samsung/Kconfig"
source "sound/soc/s6000/Kconfig"
source "sound/soc/sh/Kconfig"
source "sound/soc/spear/Kconfig"
source "sound/soc/tegra/Kconfig"
source "sound/soc/txx9/Kconfig"
source "sound/soc/ux500/Kconfig"
...
...
sound/soc/Makefile
浏览文件 @
5f5eb4ef
...
...
@@ -29,6 +29,7 @@ obj-$(CONFIG_SND_SOC) += pxa/
obj-$(CONFIG_SND_SOC)
+=
samsung/
obj-$(CONFIG_SND_SOC)
+=
s6000/
obj-$(CONFIG_SND_SOC)
+=
sh/
obj-$(CONFIG_SND_SOC)
+=
spear/
obj-$(CONFIG_SND_SOC)
+=
tegra/
obj-$(CONFIG_SND_SOC)
+=
txx9/
obj-$(CONFIG_SND_SOC)
+=
ux500/
sound/soc/spear/Kconfig
0 → 100644
浏览文件 @
5f5eb4ef
config SND_SPEAR_SOC
tristate
select SND_SOC_DMAENGINE_PCM
config SND_SPEAR_SPDIF_OUT
tristate
config SND_SPEAR_SPDIF_IN
tristate
sound/soc/spear/Makefile
0 → 100644
浏览文件 @
5f5eb4ef
# SPEAR Platform Support
snd-soc-spear-pcm-objs
:=
spear_pcm.o
snd-soc-spear-spdif-in-objs
:=
spdif_in.o
snd-soc-spear-spdif-out-objs
:=
spdif_out.o
obj-$(CONFIG_SND_SPEAR_SOC)
+=
snd-soc-spear-pcm.o
obj-$(CONFIG_SND_SPEAR_SPDIF_IN)
+=
snd-soc-spear-spdif-in.o
obj-$(CONFIG_SND_SPEAR_SPDIF_OUT)
+=
snd-soc-spear-spdif-out.o
sound/soc/spear/spdif_in.c
浏览文件 @
5f5eb4ef
...
...
@@ -49,15 +49,12 @@ static void spdif_in_configure(struct spdif_in_dev *host)
writel
(
0xF
,
host
->
io_base
+
SPDIF_IN_IRQ_MASK
);
}
static
int
spdif_in_startup
(
struct
snd_pcm_substream
*
substream
,
struct
snd_soc_dai
*
cpu_dai
)
static
int
spdif_in_dai_probe
(
struct
snd_soc_dai
*
dai
)
{
struct
spdif_in_dev
*
host
=
snd_soc_dai_get_drvdata
(
cpu_
dai
);
struct
spdif_in_dev
*
host
=
snd_soc_dai_get_drvdata
(
dai
);
if
(
substream
->
stream
!=
SNDRV_PCM_STREAM_CAPTURE
)
return
-
EINVAL
;
dai
->
capture_dma_data
=
&
host
->
dma_params
;
snd_soc_dai_set_dma_data
(
cpu_dai
,
substream
,
(
void
*
)
&
host
->
dma_params
);
return
0
;
}
...
...
@@ -70,7 +67,6 @@ static void spdif_in_shutdown(struct snd_pcm_substream *substream,
return
;
writel
(
0x0
,
host
->
io_base
+
SPDIF_IN_IRQ_MASK
);
snd_soc_dai_set_dma_data
(
dai
,
substream
,
NULL
);
}
static
void
spdif_in_format
(
struct
spdif_in_dev
*
host
,
u32
format
)
...
...
@@ -151,13 +147,13 @@ static int spdif_in_trigger(struct snd_pcm_substream *substream, int cmd,
}
static
struct
snd_soc_dai_ops
spdif_in_dai_ops
=
{
.
startup
=
spdif_in_startup
,
.
shutdown
=
spdif_in_shutdown
,
.
trigger
=
spdif_in_trigger
,
.
hw_params
=
spdif_in_hw_params
,
};
struct
snd_soc_dai_driver
spdif_in_dai
=
{
static
struct
snd_soc_dai_driver
spdif_in_dai
=
{
.
probe
=
spdif_in_dai_probe
,
.
capture
=
{
.
channels_min
=
2
,
.
channels_max
=
2
,
...
...
@@ -235,7 +231,7 @@ static int spdif_in_probe(struct platform_device *pdev)
if
(
host
->
irq
<
0
)
return
-
EINVAL
;
host
->
clk
=
clk_get
(
&
pdev
->
dev
,
NULL
);
host
->
clk
=
devm_
clk_get
(
&
pdev
->
dev
,
NULL
);
if
(
IS_ERR
(
host
->
clk
))
return
PTR_ERR
(
host
->
clk
);
...
...
@@ -257,34 +253,21 @@ static int spdif_in_probe(struct platform_device *pdev)
ret
=
devm_request_irq
(
&
pdev
->
dev
,
host
->
irq
,
spdif_in_irq
,
0
,
"spdif-in"
,
host
);
if
(
ret
)
{
clk_put
(
host
->
clk
);
dev_warn
(
&
pdev
->
dev
,
"request_irq failed
\n
"
);
return
ret
;
}
ret
=
snd_soc_register_component
(
&
pdev
->
dev
,
&
spdif_in_component
,
ret
urn
snd_soc_register_component
(
&
pdev
->
dev
,
&
spdif_in_component
,
&
spdif_in_dai
,
1
);
if
(
ret
!=
0
)
{
clk_put
(
host
->
clk
);
return
ret
;
}
return
0
;
}
static
int
spdif_in_remove
(
struct
platform_device
*
pdev
)
{
struct
spdif_in_dev
*
host
=
dev_get_drvdata
(
&
pdev
->
dev
);
snd_soc_unregister_component
(
&
pdev
->
dev
);
dev_set_drvdata
(
&
pdev
->
dev
,
NULL
);
clk_put
(
host
->
clk
);
return
0
;
}
static
struct
platform_driver
spdif_in_driver
=
{
.
probe
=
spdif_in_probe
,
.
remove
=
spdif_in_remove
,
...
...
sound/soc/spear/spdif_out.c
浏览文件 @
5f5eb4ef
...
...
@@ -62,8 +62,6 @@ static int spdif_out_startup(struct snd_pcm_substream *substream,
if
(
substream
->
stream
!=
SNDRV_PCM_STREAM_PLAYBACK
)
return
-
EINVAL
;
snd_soc_dai_set_dma_data
(
cpu_dai
,
substream
,
(
void
*
)
&
host
->
dma_params
);
ret
=
clk_enable
(
host
->
clk
);
if
(
ret
)
return
ret
;
...
...
@@ -84,7 +82,6 @@ static void spdif_out_shutdown(struct snd_pcm_substream *substream,
clk_disable
(
host
->
clk
);
host
->
running
=
false
;
snd_soc_dai_set_dma_data
(
dai
,
substream
,
NULL
);
}
static
void
spdif_out_clock
(
struct
spdif_out_dev
*
host
,
u32
core_freq
,
...
...
@@ -243,8 +240,12 @@ static const struct snd_kcontrol_new spdif_out_controls[] = {
spdif_mute_get
,
spdif_mute_put
),
};
int
spdif_soc_dai_probe
(
struct
snd_soc_dai
*
dai
)
static
int
spdif_soc_dai_probe
(
struct
snd_soc_dai
*
dai
)
{
struct
spdif_out_dev
*
host
=
snd_soc_dai_get_drvdata
(
dai
);
dai
->
playback_dma_data
=
&
host
->
dma_params
;
return
snd_soc_add_dai_controls
(
dai
,
spdif_out_controls
,
ARRAY_SIZE
(
spdif_out_controls
));
}
...
...
@@ -281,30 +282,18 @@ static int spdif_out_probe(struct platform_device *pdev)
struct
resource
*
res
;
int
ret
;
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
if
(
!
res
)
return
-
EINVAL
;
if
(
!
devm_request_mem_region
(
&
pdev
->
dev
,
res
->
start
,
resource_size
(
res
),
pdev
->
name
))
{
dev_warn
(
&
pdev
->
dev
,
"Failed to get memory resourse
\n
"
);
return
-
ENOENT
;
}
host
=
devm_kzalloc
(
&
pdev
->
dev
,
sizeof
(
*
host
),
GFP_KERNEL
);
if
(
!
host
)
{
dev_warn
(
&
pdev
->
dev
,
"kzalloc fail
\n
"
);
return
-
ENOMEM
;
}
host
->
io_base
=
devm_ioremap
(
&
pdev
->
dev
,
res
->
start
,
resource_size
(
res
));
if
(
!
host
->
io_base
)
{
dev_warn
(
&
pdev
->
dev
,
"ioremap failed
\n
"
);
return
-
ENOMEM
;
}
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
host
->
io_base
=
devm_ioremap_resource
(
&
pdev
->
dev
,
res
);
if
(
IS_ERR
(
host
->
io_base
))
return
PTR_ERR
(
host
->
io_base
);
host
->
clk
=
clk_get
(
&
pdev
->
dev
,
NULL
);
host
->
clk
=
devm_
clk_get
(
&
pdev
->
dev
,
NULL
);
if
(
IS_ERR
(
host
->
clk
))
return
PTR_ERR
(
host
->
clk
);
...
...
@@ -320,22 +309,12 @@ static int spdif_out_probe(struct platform_device *pdev)
ret
=
snd_soc_register_component
(
&
pdev
->
dev
,
&
spdif_out_component
,
&
spdif_out_dai
,
1
);
if
(
ret
!=
0
)
{
clk_put
(
host
->
clk
);
return
ret
;
}
return
0
;
return
ret
;
}
static
int
spdif_out_remove
(
struct
platform_device
*
pdev
)
{
struct
spdif_out_dev
*
host
=
dev_get_drvdata
(
&
pdev
->
dev
);
snd_soc_unregister_component
(
&
pdev
->
dev
);
dev_set_drvdata
(
&
pdev
->
dev
,
NULL
);
clk_put
(
host
->
clk
);
return
0
;
}
...
...
sound/soc/spear/spear_pcm.c
浏览文件 @
5f5eb4ef
...
...
@@ -13,19 +13,13 @@
#include <linux/module.h>
#include <linux/dmaengine.h>
#include <linux/dma-mapping.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/scatterlist.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/dmaengine_pcm.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/spear_dma.h>
static
struct
snd_pcm_hardware
spear_pcm_hardware
=
{
static
const
struct
snd_pcm_hardware
spear_pcm_hardware
=
{
.
info
=
(
SNDRV_PCM_INFO_INTERLEAVED
|
SNDRV_PCM_INFO_BLOCK_TRANSFER
|
SNDRV_PCM_INFO_MMAP
|
SNDRV_PCM_INFO_MMAP_VALID
|
SNDRV_PCM_INFO_PAUSE
|
SNDRV_PCM_INFO_RESUME
),
...
...
@@ -37,149 +31,33 @@ static struct snd_pcm_hardware spear_pcm_hardware = {
.
fifo_size
=
0
,
/* fifo size in bytes */
};
static
int
spear_pcm_hw_params
(
struct
snd_pcm_substream
*
substream
,
struct
snd_pcm_hw_params
*
params
)
static
struct
dma_chan
*
spear_pcm_request_chan
(
struct
snd_soc_pcm_runtime
*
rtd
,
struct
snd_pcm_substream
*
substream
)
{
s
nd_pcm_set_runtime_buffer
(
substream
,
&
substream
->
dma_buffer
)
;
s
truct
spear_dma_data
*
dma_data
;
return
0
;
}
static
int
spear_pcm_hw_free
(
struct
snd_pcm_substream
*
substream
)
{
snd_pcm_set_runtime_buffer
(
substream
,
NULL
);
return
0
;
}
static
int
spear_pcm_open
(
struct
snd_pcm_substream
*
substream
)
{
struct
snd_soc_pcm_runtime
*
rtd
=
substream
->
private_data
;
struct
spear_dma_data
*
dma_data
=
(
struct
spear_dma_data
*
)
snd_soc_dai_get_dma_data
(
rtd
->
cpu_dai
,
substream
);
int
ret
;
ret
=
snd_soc_set_runtime_hwparams
(
substream
,
&
spear_pcm_hardware
);
if
(
ret
)
return
ret
;
dma_data
=
snd_soc_dai_get_dma_data
(
rtd
->
cpu_dai
,
substream
);
return
snd_dmaengine_pcm_open_request_chan
(
substream
,
dma_data
->
filter
,
dma_data
);
return
snd_dmaengine_pcm_request_channel
(
dma_data
->
filter
,
dma_data
);
}
static
int
spear_pcm_mmap
(
struct
snd_pcm_substream
*
substream
,
struct
vm_area_struct
*
vma
)
{
struct
snd_pcm_runtime
*
runtime
=
substream
->
runtime
;
return
dma_mmap_writecombine
(
substream
->
pcm
->
card
->
dev
,
vma
,
runtime
->
dma_area
,
runtime
->
dma_addr
,
runtime
->
dma_bytes
);
}
static
struct
snd_pcm_ops
spear_pcm_ops
=
{
.
open
=
spear_pcm_open
,
.
close
=
snd_dmaengine_pcm_close_release_chan
,
.
ioctl
=
snd_pcm_lib_ioctl
,
.
hw_params
=
spear_pcm_hw_params
,
.
hw_free
=
spear_pcm_hw_free
,
.
trigger
=
snd_dmaengine_pcm_trigger
,
.
pointer
=
snd_dmaengine_pcm_pointer
,
.
mmap
=
spear_pcm_mmap
,
};
static
int
spear_pcm_preallocate_dma_buffer
(
struct
snd_pcm
*
pcm
,
int
stream
,
size_t
size
)
{
struct
snd_pcm_substream
*
substream
=
pcm
->
streams
[
stream
].
substream
;
struct
snd_dma_buffer
*
buf
=
&
substream
->
dma_buffer
;
buf
->
dev
.
type
=
SNDRV_DMA_TYPE_DEV
;
buf
->
dev
.
dev
=
pcm
->
card
->
dev
;
buf
->
private_data
=
NULL
;
buf
->
area
=
dma_alloc_writecombine
(
pcm
->
card
->
dev
,
size
,
&
buf
->
addr
,
GFP_KERNEL
);
if
(
!
buf
->
area
)
return
-
ENOMEM
;
dev_info
(
buf
->
dev
.
dev
,
" preallocate_dma_buffer: area=%p, addr=%p, size=%d
\n
"
,
(
void
*
)
buf
->
area
,
(
void
*
)
buf
->
addr
,
size
);
buf
->
bytes
=
size
;
return
0
;
}
static
void
spear_pcm_free
(
struct
snd_pcm
*
pcm
)
{
struct
snd_pcm_substream
*
substream
;
struct
snd_dma_buffer
*
buf
;
int
stream
;
for
(
stream
=
0
;
stream
<
2
;
stream
++
)
{
substream
=
pcm
->
streams
[
stream
].
substream
;
if
(
!
substream
)
continue
;
buf
=
&
substream
->
dma_buffer
;
if
(
!
buf
||
!
buf
->
area
)
continue
;
dma_free_writecombine
(
pcm
->
card
->
dev
,
buf
->
bytes
,
buf
->
area
,
buf
->
addr
);
buf
->
area
=
NULL
;
}
}
static
u64
spear_pcm_dmamask
=
DMA_BIT_MASK
(
32
);
static
int
spear_pcm_new
(
struct
snd_soc_pcm_runtime
*
rtd
)
{
struct
snd_card
*
card
=
rtd
->
card
->
snd_card
;
int
ret
;
if
(
!
card
->
dev
->
dma_mask
)
card
->
dev
->
dma_mask
=
&
spear_pcm_dmamask
;
if
(
!
card
->
dev
->
coherent_dma_mask
)
card
->
dev
->
coherent_dma_mask
=
DMA_BIT_MASK
(
32
);
if
(
rtd
->
cpu_dai
->
driver
->
playback
.
channels_min
)
{
ret
=
spear_pcm_preallocate_dma_buffer
(
rtd
->
pcm
,
SNDRV_PCM_STREAM_PLAYBACK
,
spear_pcm_hardware
.
buffer_bytes_max
);
if
(
ret
)
return
ret
;
}
if
(
rtd
->
cpu_dai
->
driver
->
capture
.
channels_min
)
{
ret
=
spear_pcm_preallocate_dma_buffer
(
rtd
->
pcm
,
SNDRV_PCM_STREAM_CAPTURE
,
spear_pcm_hardware
.
buffer_bytes_max
);
if
(
ret
)
return
ret
;
}
return
0
;
}
static
struct
snd_soc_platform_driver
spear_soc_platform
=
{
.
ops
=
&
spear_pcm_ops
,
.
pcm_new
=
spear_pcm_new
,
.
pcm_free
=
spear_pcm_free
,
static
const
struct
snd_dmaengine_pcm_config
spear_dmaengine_pcm_config
=
{
.
pcm_hardware
=
&
spear_pcm_hardware
,
.
compat_request_channel
=
spear_pcm_request_chan
,
.
prealloc_buffer_size
=
16
*
1024
,
};
static
int
spear_soc_platform_probe
(
struct
platform_device
*
pdev
)
{
return
snd_soc_register_platform
(
&
pdev
->
dev
,
&
spear_soc_platform
);
return
snd_dmaengine_pcm_register
(
&
pdev
->
dev
,
&
spear_dmaengine_pcm_config
,
SND_DMAENGINE_PCM_FLAG_NO_DT
|
SND_DMAENGINE_PCM_FLAG_COMPAT
);
}
static
int
spear_soc_platform_remove
(
struct
platform_device
*
pdev
)
{
snd_soc_unregister_platform
(
&
pdev
->
dev
);
snd_dmaengine_pcm_unregister
(
&
pdev
->
dev
);
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录