Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
357c59a9
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
357c59a9
编写于
11月 10, 2017
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'asoc/topic/rockchip' into asoc-next
上级
f904f846
8eae6c25
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
133 addition
and
26 deletion
+133
-26
sound/soc/rockchip/rk3399_gru_sound.c
sound/soc/rockchip/rk3399_gru_sound.c
+133
-26
未找到文件。
sound/soc/rockchip/rk3399_gru_sound.c
浏览文件 @
357c59a9
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include <linux/of_gpio.h>
#include <linux/of_gpio.h>
#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi.h>
#include <linux/i2c.h>
#include <linux/input.h>
#include <linux/input.h>
#include <sound/core.h>
#include <sound/core.h>
#include <sound/jack.h>
#include <sound/jack.h>
...
@@ -47,18 +48,7 @@ static const struct snd_soc_dapm_widget rockchip_dapm_widgets[] = {
...
@@ -47,18 +48,7 @@ static const struct snd_soc_dapm_widget rockchip_dapm_widgets[] = {
SND_SOC_DAPM_SPK
(
"Speakers"
,
NULL
),
SND_SOC_DAPM_SPK
(
"Speakers"
,
NULL
),
SND_SOC_DAPM_MIC
(
"Headset Mic"
,
NULL
),
SND_SOC_DAPM_MIC
(
"Headset Mic"
,
NULL
),
SND_SOC_DAPM_MIC
(
"Int Mic"
,
NULL
),
SND_SOC_DAPM_MIC
(
"Int Mic"
,
NULL
),
};
SND_SOC_DAPM_LINE
(
"HDMI"
,
NULL
),
static
const
struct
snd_soc_dapm_route
rockchip_dapm_routes
[]
=
{
/* Input Lines */
{
"MIC"
,
NULL
,
"Headset Mic"
},
{
"DMIC1L"
,
NULL
,
"Int Mic"
},
{
"DMIC1R"
,
NULL
,
"Int Mic"
},
/* Output Lines */
{
"Headphones"
,
NULL
,
"HPL"
},
{
"Headphones"
,
NULL
,
"HPR"
},
{
"Speakers"
,
NULL
,
"Speaker"
},
};
};
static
const
struct
snd_kcontrol_new
rockchip_controls
[]
=
{
static
const
struct
snd_kcontrol_new
rockchip_controls
[]
=
{
...
@@ -66,6 +56,7 @@ static const struct snd_kcontrol_new rockchip_controls[] = {
...
@@ -66,6 +56,7 @@ static const struct snd_kcontrol_new rockchip_controls[] = {
SOC_DAPM_PIN_SWITCH
(
"Speakers"
),
SOC_DAPM_PIN_SWITCH
(
"Speakers"
),
SOC_DAPM_PIN_SWITCH
(
"Headset Mic"
),
SOC_DAPM_PIN_SWITCH
(
"Headset Mic"
),
SOC_DAPM_PIN_SWITCH
(
"Int Mic"
),
SOC_DAPM_PIN_SWITCH
(
"Int Mic"
),
SOC_DAPM_PIN_SWITCH
(
"HDMI"
),
};
};
static
int
rockchip_sound_max98357a_hw_params
(
struct
snd_pcm_substream
*
substream
,
static
int
rockchip_sound_max98357a_hw_params
(
struct
snd_pcm_substream
*
substream
,
...
@@ -314,8 +305,6 @@ static struct snd_soc_card rockchip_sound_card = {
...
@@ -314,8 +305,6 @@ static struct snd_soc_card rockchip_sound_card = {
.
owner
=
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
.
dapm_widgets
=
rockchip_dapm_widgets
,
.
dapm_widgets
=
rockchip_dapm_widgets
,
.
num_dapm_widgets
=
ARRAY_SIZE
(
rockchip_dapm_widgets
),
.
num_dapm_widgets
=
ARRAY_SIZE
(
rockchip_dapm_widgets
),
.
dapm_routes
=
rockchip_dapm_routes
,
.
num_dapm_routes
=
ARRAY_SIZE
(
rockchip_dapm_routes
),
.
controls
=
rockchip_controls
,
.
controls
=
rockchip_controls
,
.
num_controls
=
ARRAY_SIZE
(
rockchip_controls
),
.
num_controls
=
ARRAY_SIZE
(
rockchip_controls
),
};
};
...
@@ -329,15 +318,6 @@ enum {
...
@@ -329,15 +318,6 @@ enum {
DAILINK_RT5514_DSP
,
DAILINK_RT5514_DSP
,
};
};
static
const
char
*
const
dailink_compat
[]
=
{
[
DAILINK_CDNDP
]
=
"rockchip,rk3399-cdn-dp"
,
[
DAILINK_DA7219
]
=
"dlg,da7219"
,
[
DAILINK_DMIC
]
=
"dmic-codec"
,
[
DAILINK_MAX98357A
]
=
"maxim,max98357a"
,
[
DAILINK_RT5514
]
=
"realtek,rt5514-i2c"
,
[
DAILINK_RT5514_DSP
]
=
"realtek,rt5514-spi"
,
};
static
const
struct
snd_soc_dai_link
rockchip_dais
[]
=
{
static
const
struct
snd_soc_dai_link
rockchip_dais
[]
=
{
[
DAILINK_CDNDP
]
=
{
[
DAILINK_CDNDP
]
=
{
.
name
=
"DP"
,
.
name
=
"DP"
,
...
@@ -391,13 +371,117 @@ static const struct snd_soc_dai_link rockchip_dais[] = {
...
@@ -391,13 +371,117 @@ static const struct snd_soc_dai_link rockchip_dais[] = {
},
},
};
};
static
const
struct
snd_soc_dapm_route
rockchip_sound_cdndp_routes
[]
=
{
/* Output */
{
"HDMI"
,
NULL
,
"TX"
},
};
static
const
struct
snd_soc_dapm_route
rockchip_sound_da7219_routes
[]
=
{
/* Output */
{
"Headphones"
,
NULL
,
"HPL"
},
{
"Headphones"
,
NULL
,
"HPR"
},
/* Input */
{
"MIC"
,
NULL
,
"Headset Mic"
},
};
static
const
struct
snd_soc_dapm_route
rockchip_sound_dmic_routes
[]
=
{
/* Input */
{
"DMic"
,
NULL
,
"Int Mic"
},
};
static
const
struct
snd_soc_dapm_route
rockchip_sound_max98357a_routes
[]
=
{
/* Output */
{
"Speakers"
,
NULL
,
"Speaker"
},
};
static
const
struct
snd_soc_dapm_route
rockchip_sound_rt5514_routes
[]
=
{
/* Input */
{
"DMIC1L"
,
NULL
,
"Int Mic"
},
{
"DMIC1R"
,
NULL
,
"Int Mic"
},
};
struct
rockchip_sound_route
{
const
struct
snd_soc_dapm_route
*
routes
;
int
num_routes
;
};
static
const
struct
rockchip_sound_route
rockchip_routes
[]
=
{
[
DAILINK_CDNDP
]
=
{
.
routes
=
rockchip_sound_cdndp_routes
,
.
num_routes
=
ARRAY_SIZE
(
rockchip_sound_cdndp_routes
),
},
[
DAILINK_DA7219
]
=
{
.
routes
=
rockchip_sound_da7219_routes
,
.
num_routes
=
ARRAY_SIZE
(
rockchip_sound_da7219_routes
),
},
[
DAILINK_DMIC
]
=
{
.
routes
=
rockchip_sound_dmic_routes
,
.
num_routes
=
ARRAY_SIZE
(
rockchip_sound_dmic_routes
),
},
[
DAILINK_MAX98357A
]
=
{
.
routes
=
rockchip_sound_max98357a_routes
,
.
num_routes
=
ARRAY_SIZE
(
rockchip_sound_max98357a_routes
),
},
[
DAILINK_RT5514
]
=
{
.
routes
=
rockchip_sound_rt5514_routes
,
.
num_routes
=
ARRAY_SIZE
(
rockchip_sound_rt5514_routes
),
},
[
DAILINK_RT5514_DSP
]
=
{},
};
struct
dailink_match_data
{
const
char
*
compatible
;
struct
bus_type
*
bus_type
;
};
static
const
struct
dailink_match_data
dailink_match
[]
=
{
[
DAILINK_CDNDP
]
=
{
.
compatible
=
"rockchip,rk3399-cdn-dp"
,
},
[
DAILINK_DA7219
]
=
{
.
compatible
=
"dlg,da7219"
,
},
[
DAILINK_DMIC
]
=
{
.
compatible
=
"dmic-codec"
,
},
[
DAILINK_MAX98357A
]
=
{
.
compatible
=
"maxim,max98357a"
,
},
[
DAILINK_RT5514
]
=
{
.
compatible
=
"realtek,rt5514"
,
.
bus_type
=
&
i2c_bus_type
,
},
[
DAILINK_RT5514_DSP
]
=
{
.
compatible
=
"realtek,rt5514"
,
.
bus_type
=
&
spi_bus_type
,
},
};
static
int
of_dev_node_match
(
struct
device
*
dev
,
void
*
data
)
{
return
dev
->
of_node
==
data
;
}
static
int
rockchip_sound_codec_node_match
(
struct
device_node
*
np_codec
)
static
int
rockchip_sound_codec_node_match
(
struct
device_node
*
np_codec
)
{
{
struct
device
*
dev
;
int
i
;
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
dailink_compat
);
i
++
)
{
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
dailink_match
);
i
++
)
{
if
(
of_device_is_compatible
(
np_codec
,
dailink_compat
[
i
]))
if
(
!
of_device_is_compatible
(
np_codec
,
return
i
;
dailink_match
[
i
].
compatible
))
continue
;
if
(
dailink_match
[
i
].
bus_type
)
{
dev
=
bus_find_device
(
dailink_match
[
i
].
bus_type
,
NULL
,
np_codec
,
of_dev_node_match
);
if
(
!
dev
)
continue
;
put_device
(
dev
);
}
return
i
;
}
}
return
-
1
;
return
-
1
;
}
}
...
@@ -408,16 +492,28 @@ static int rockchip_sound_of_parse_dais(struct device *dev,
...
@@ -408,16 +492,28 @@ static int rockchip_sound_of_parse_dais(struct device *dev,
struct
device_node
*
np_cpu
,
*
np_cpu0
,
*
np_cpu1
;
struct
device_node
*
np_cpu
,
*
np_cpu0
,
*
np_cpu1
;
struct
device_node
*
np_codec
;
struct
device_node
*
np_codec
;
struct
snd_soc_dai_link
*
dai
;
struct
snd_soc_dai_link
*
dai
;
struct
snd_soc_dapm_route
*
routes
;
int
i
,
index
;
int
i
,
index
;
int
num_routes
;
card
->
dai_link
=
devm_kzalloc
(
dev
,
sizeof
(
rockchip_dais
),
card
->
dai_link
=
devm_kzalloc
(
dev
,
sizeof
(
rockchip_dais
),
GFP_KERNEL
);
GFP_KERNEL
);
if
(
!
card
->
dai_link
)
if
(
!
card
->
dai_link
)
return
-
ENOMEM
;
return
-
ENOMEM
;
num_routes
=
0
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
rockchip_routes
);
i
++
)
num_routes
+=
rockchip_routes
[
i
].
num_routes
;
routes
=
devm_kzalloc
(
dev
,
num_routes
*
sizeof
(
*
routes
),
GFP_KERNEL
);
if
(
!
routes
)
return
-
ENOMEM
;
card
->
dapm_routes
=
routes
;
np_cpu0
=
of_parse_phandle
(
dev
->
of_node
,
"rockchip,cpu"
,
0
);
np_cpu0
=
of_parse_phandle
(
dev
->
of_node
,
"rockchip,cpu"
,
0
);
np_cpu1
=
of_parse_phandle
(
dev
->
of_node
,
"rockchip,cpu"
,
1
);
np_cpu1
=
of_parse_phandle
(
dev
->
of_node
,
"rockchip,cpu"
,
1
);
card
->
num_dapm_routes
=
0
;
card
->
num_links
=
0
;
card
->
num_links
=
0
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
rockchip_dais
);
i
++
)
{
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
rockchip_dais
);
i
++
)
{
np_codec
=
of_parse_phandle
(
dev
->
of_node
,
np_codec
=
of_parse_phandle
(
dev
->
of_node
,
...
@@ -445,6 +541,17 @@ static int rockchip_sound_of_parse_dais(struct device *dev,
...
@@ -445,6 +541,17 @@ static int rockchip_sound_of_parse_dais(struct device *dev,
dai
->
codec_of_node
=
np_codec
;
dai
->
codec_of_node
=
np_codec
;
dai
->
platform_of_node
=
np_cpu
;
dai
->
platform_of_node
=
np_cpu
;
dai
->
cpu_of_node
=
np_cpu
;
dai
->
cpu_of_node
=
np_cpu
;
if
(
card
->
num_dapm_routes
+
rockchip_routes
[
index
].
num_routes
>
num_routes
)
{
dev_err
(
dev
,
"Too many routes
\n
"
);
return
-
EINVAL
;
}
memcpy
(
routes
+
card
->
num_dapm_routes
,
rockchip_routes
[
index
].
routes
,
rockchip_routes
[
index
].
num_routes
*
sizeof
(
*
routes
));
card
->
num_dapm_routes
+=
rockchip_routes
[
index
].
num_routes
;
}
}
return
0
;
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录