Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
ab052d46
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看板
提交
ab052d46
编写于
4月 18, 2014
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge commit 'topic/omap' into asoc-davinci
上级
40448e5e
fe7b5868
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
109 addition
and
105 deletion
+109
-105
include/sound/soc.h
include/sound/soc.h
+2
-0
sound/soc/omap/ams-delta.c
sound/soc/omap/ams-delta.c
+21
-43
sound/soc/omap/omap-pcm.c
sound/soc/omap/omap-pcm.c
+6
-0
sound/soc/omap/omap-pcm.h
sound/soc/omap/omap-pcm.h
+30
-0
sound/soc/omap/omap3pandora.c
sound/soc/omap/omap3pandora.c
+9
-22
sound/soc/omap/rx51.c
sound/soc/omap/rx51.c
+7
-40
sound/soc/soc-devres.c
sound/soc/soc-devres.c
+34
-0
未找到文件。
include/sound/soc.h
浏览文件 @
ab052d46
...
@@ -377,6 +377,8 @@ int snd_soc_resume(struct device *dev);
...
@@ -377,6 +377,8 @@ int snd_soc_resume(struct device *dev);
int
snd_soc_poweroff
(
struct
device
*
dev
);
int
snd_soc_poweroff
(
struct
device
*
dev
);
int
snd_soc_register_platform
(
struct
device
*
dev
,
int
snd_soc_register_platform
(
struct
device
*
dev
,
const
struct
snd_soc_platform_driver
*
platform_drv
);
const
struct
snd_soc_platform_driver
*
platform_drv
);
int
devm_snd_soc_register_platform
(
struct
device
*
dev
,
const
struct
snd_soc_platform_driver
*
platform_drv
);
void
snd_soc_unregister_platform
(
struct
device
*
dev
);
void
snd_soc_unregister_platform
(
struct
device
*
dev
);
int
snd_soc_add_platform
(
struct
device
*
dev
,
struct
snd_soc_platform
*
platform
,
int
snd_soc_add_platform
(
struct
device
*
dev
,
struct
snd_soc_platform
*
platform
,
const
struct
snd_soc_platform_driver
*
platform_drv
);
const
struct
snd_soc_platform_driver
*
platform_drv
);
...
...
sound/soc/omap/ams-delta.c
浏览文件 @
ab052d46
...
@@ -38,7 +38,6 @@
...
@@ -38,7 +38,6 @@
#include "omap-mcbsp.h"
#include "omap-mcbsp.h"
#include "../codecs/cx20442.h"
#include "../codecs/cx20442.h"
/* Board specific DAPM widgets */
/* Board specific DAPM widgets */
static
const
struct
snd_soc_dapm_widget
ams_delta_dapm_widgets
[]
=
{
static
const
struct
snd_soc_dapm_widget
ams_delta_dapm_widgets
[]
=
{
/* Handset */
/* Handset */
...
@@ -90,17 +89,23 @@ static const unsigned short ams_delta_audio_mode_pins[] = {
...
@@ -90,17 +89,23 @@ static const unsigned short ams_delta_audio_mode_pins[] = {
static
unsigned
short
ams_delta_audio_agc
;
static
unsigned
short
ams_delta_audio_agc
;
/*
* Used for passing a codec structure pointer
* from the board initialization code to the tty line discipline.
*/
static
struct
snd_soc_codec
*
cx20442_codec
;
static
int
ams_delta_set_audio_mode
(
struct
snd_kcontrol
*
kcontrol
,
static
int
ams_delta_set_audio_mode
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_value
*
ucontrol
)
struct
snd_ctl_elem_value
*
ucontrol
)
{
{
struct
snd_soc_c
odec
*
codec
=
snd_kcontrol_chip
(
kcontrol
);
struct
snd_soc_c
ard
*
card
=
snd_kcontrol_chip
(
kcontrol
);
struct
snd_soc_dapm_context
*
dapm
=
&
c
odec
->
dapm
;
struct
snd_soc_dapm_context
*
dapm
=
&
c
ard
->
dapm
;
struct
soc_enum
*
control
=
(
struct
soc_enum
*
)
kcontrol
->
private_value
;
struct
soc_enum
*
control
=
(
struct
soc_enum
*
)
kcontrol
->
private_value
;
unsigned
short
pins
;
unsigned
short
pins
;
int
pin
,
changed
=
0
;
int
pin
,
changed
=
0
;
/* Refuse any mode changes if we are not able to control the codec. */
/* Refuse any mode changes if we are not able to control the codec. */
if
(
!
codec
->
hw_write
)
if
(
!
c
x20442_c
odec
->
hw_write
)
return
-
EUNATCH
;
return
-
EUNATCH
;
if
(
ucontrol
->
value
.
enumerated
.
item
[
0
]
>=
control
->
items
)
if
(
ucontrol
->
value
.
enumerated
.
item
[
0
]
>=
control
->
items
)
...
@@ -166,8 +171,8 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol,
...
@@ -166,8 +171,8 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol,
static
int
ams_delta_get_audio_mode
(
struct
snd_kcontrol
*
kcontrol
,
static
int
ams_delta_get_audio_mode
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_value
*
ucontrol
)
struct
snd_ctl_elem_value
*
ucontrol
)
{
{
struct
snd_soc_c
odec
*
codec
=
snd_kcontrol_chip
(
kcontrol
);
struct
snd_soc_c
ard
*
card
=
snd_kcontrol_chip
(
kcontrol
);
struct
snd_soc_dapm_context
*
dapm
=
&
c
odec
->
dapm
;
struct
snd_soc_dapm_context
*
dapm
=
&
c
ard
->
dapm
;
unsigned
short
pins
,
mode
;
unsigned
short
pins
,
mode
;
pins
=
((
snd_soc_dapm_get_pin_status
(
dapm
,
"Mouthpiece"
)
<<
pins
=
((
snd_soc_dapm_get_pin_status
(
dapm
,
"Mouthpiece"
)
<<
...
@@ -270,12 +275,6 @@ static void cx81801_timeout(unsigned long data)
...
@@ -270,12 +275,6 @@ static void cx81801_timeout(unsigned long data)
ams_delta_latch2_write
(
AMS_DELTA_LATCH2_MODEM_CODEC
,
0
);
ams_delta_latch2_write
(
AMS_DELTA_LATCH2_MODEM_CODEC
,
0
);
}
}
/*
* Used for passing a codec structure pointer
* from the board initialization code to the tty line discipline.
*/
static
struct
snd_soc_codec
*
cx20442_codec
;
/* Line discipline .open() */
/* Line discipline .open() */
static
int
cx81801_open
(
struct
tty_struct
*
tty
)
static
int
cx81801_open
(
struct
tty_struct
*
tty
)
{
{
...
@@ -302,7 +301,7 @@ static int cx81801_open(struct tty_struct *tty)
...
@@ -302,7 +301,7 @@ static int cx81801_open(struct tty_struct *tty)
static
void
cx81801_close
(
struct
tty_struct
*
tty
)
static
void
cx81801_close
(
struct
tty_struct
*
tty
)
{
{
struct
snd_soc_codec
*
codec
=
tty
->
disc_data
;
struct
snd_soc_codec
*
codec
=
tty
->
disc_data
;
struct
snd_soc_dapm_context
*
dapm
=
&
codec
->
dapm
;
struct
snd_soc_dapm_context
*
dapm
=
&
codec
->
card
->
dapm
;
del_timer_sync
(
&
cx81801_timer
);
del_timer_sync
(
&
cx81801_timer
);
...
@@ -475,15 +474,14 @@ static void ams_delta_shutdown(struct snd_pcm_substream *substream)
...
@@ -475,15 +474,14 @@ static void ams_delta_shutdown(struct snd_pcm_substream *substream)
static
int
ams_delta_cx20442_init
(
struct
snd_soc_pcm_runtime
*
rtd
)
static
int
ams_delta_cx20442_init
(
struct
snd_soc_pcm_runtime
*
rtd
)
{
{
struct
snd_soc_codec
*
codec
=
rtd
->
codec
;
struct
snd_soc_dapm_context
*
dapm
=
&
codec
->
dapm
;
struct
snd_soc_dai
*
codec_dai
=
rtd
->
codec_dai
;
struct
snd_soc_dai
*
codec_dai
=
rtd
->
codec_dai
;
struct
snd_soc_card
*
card
=
rtd
->
card
;
struct
snd_soc_card
*
card
=
rtd
->
card
;
struct
snd_soc_dapm_context
*
dapm
=
&
card
->
dapm
;
int
ret
;
int
ret
;
/* Codec is ready, now add/activate board specific controls */
/* Codec is ready, now add/activate board specific controls */
/* Store a pointer to the codec structure for tty ldisc use */
/* Store a pointer to the codec structure for tty ldisc use */
cx20442_codec
=
codec
;
cx20442_codec
=
rtd
->
codec
;
/* Set up digital mute if not provided by the codec */
/* Set up digital mute if not provided by the codec */
if
(
!
codec_dai
->
driver
->
ops
)
{
if
(
!
codec_dai
->
driver
->
ops
)
{
...
@@ -520,25 +518,6 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
...
@@ -520,25 +518,6 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
return
0
;
return
0
;
}
}
/* Add board specific DAPM widgets and routes */
ret
=
snd_soc_dapm_new_controls
(
dapm
,
ams_delta_dapm_widgets
,
ARRAY_SIZE
(
ams_delta_dapm_widgets
));
if
(
ret
)
{
dev_warn
(
card
->
dev
,
"Failed to register DAPM controls, "
"will continue without any.
\n
"
);
return
0
;
}
ret
=
snd_soc_dapm_add_routes
(
dapm
,
ams_delta_audio_map
,
ARRAY_SIZE
(
ams_delta_audio_map
));
if
(
ret
)
{
dev_warn
(
card
->
dev
,
"Failed to set up DAPM routes, "
"will continue with codec default map.
\n
"
);
return
0
;
}
/* Set up initial pin constellation */
/* Set up initial pin constellation */
snd_soc_dapm_disable_pin
(
dapm
,
"Mouthpiece"
);
snd_soc_dapm_disable_pin
(
dapm
,
"Mouthpiece"
);
snd_soc_dapm_enable_pin
(
dapm
,
"Earpiece"
);
snd_soc_dapm_enable_pin
(
dapm
,
"Earpiece"
);
...
@@ -547,14 +526,6 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
...
@@ -547,14 +526,6 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_disable_pin
(
dapm
,
"AGCIN"
);
snd_soc_dapm_disable_pin
(
dapm
,
"AGCIN"
);
snd_soc_dapm_disable_pin
(
dapm
,
"AGCOUT"
);
snd_soc_dapm_disable_pin
(
dapm
,
"AGCOUT"
);
/* Add virtual switch */
ret
=
snd_soc_add_codec_controls
(
codec
,
ams_delta_audio_controls
,
ARRAY_SIZE
(
ams_delta_audio_controls
));
if
(
ret
)
dev_warn
(
card
->
dev
,
"Failed to register audio mode control, "
"will continue without it.
\n
"
);
return
0
;
return
0
;
}
}
...
@@ -576,6 +547,13 @@ static struct snd_soc_card ams_delta_audio_card = {
...
@@ -576,6 +547,13 @@ static struct snd_soc_card ams_delta_audio_card = {
.
owner
=
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
.
dai_link
=
&
ams_delta_dai_link
,
.
dai_link
=
&
ams_delta_dai_link
,
.
num_links
=
1
,
.
num_links
=
1
,
.
controls
=
ams_delta_audio_controls
,
.
num_controls
=
ARRAY_SIZE
(
ams_delta_audio_controls
),
.
dapm_widgets
=
ams_delta_dapm_widgets
,
.
num_dapm_widgets
=
ARRAY_SIZE
(
ams_delta_dapm_widgets
),
.
dapm_routes
=
ams_delta_audio_map
,
.
num_dapm_routes
=
ARRAY_SIZE
(
ams_delta_audio_map
),
};
};
/* Module init/exit */
/* Module init/exit */
...
...
sound/soc/omap/omap-pcm.c
浏览文件 @
ab052d46
...
@@ -232,6 +232,12 @@ static struct snd_soc_platform_driver omap_soc_platform = {
...
@@ -232,6 +232,12 @@ static struct snd_soc_platform_driver omap_soc_platform = {
.
pcm_free
=
omap_pcm_free_dma_buffers
,
.
pcm_free
=
omap_pcm_free_dma_buffers
,
};
};
int
omap_pcm_platform_register
(
struct
device
*
dev
)
{
return
devm_snd_soc_register_platform
(
dev
,
&
omap_soc_platform
);
}
EXPORT_SYMBOL_GPL
(
omap_pcm_platform_register
);
static
int
omap_pcm_probe
(
struct
platform_device
*
pdev
)
static
int
omap_pcm_probe
(
struct
platform_device
*
pdev
)
{
{
return
snd_soc_register_platform
(
&
pdev
->
dev
,
return
snd_soc_register_platform
(
&
pdev
->
dev
,
...
...
sound/soc/omap/omap-pcm.h
0 → 100644
浏览文件 @
ab052d46
/*
* omap-pcm.h - OMAP PCM driver
*
* Copyright (C) 2014 Texas Instruments, Inc.
*
* Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
#ifndef __OMAP_PCM_H__
#define __OMAP_PCM_H__
#if IS_ENABLED(CONFIG_SND_OMAP_SOC)
int
omap_pcm_platform_register
(
struct
device
*
dev
);
#else
static
inline
int
omap_pcm_platform_register
(
struct
device
*
dev
)
{
return
0
;
}
#endif
/* CONFIG_SND_OMAP_SOC */
#endif
/* __OMAP_PCM_H__ */
sound/soc/omap/omap3pandora.c
浏览文件 @
ab052d46
...
@@ -121,7 +121,7 @@ static int omap3pandora_hp_event(struct snd_soc_dapm_widget *w,
...
@@ -121,7 +121,7 @@ static int omap3pandora_hp_event(struct snd_soc_dapm_widget *w,
* |A| <~~clk~~+
* |A| <~~clk~~+
* |P| <--- TWL4030 <--------- Line In and MICs
* |P| <--- TWL4030 <--------- Line In and MICs
*/
*/
static
const
struct
snd_soc_dapm_widget
omap3pandora_
out_
dapm_widgets
[]
=
{
static
const
struct
snd_soc_dapm_widget
omap3pandora_dapm_widgets
[]
=
{
SND_SOC_DAPM_DAC_E
(
"PCM DAC"
,
"HiFi Playback"
,
SND_SOC_NOPM
,
SND_SOC_DAPM_DAC_E
(
"PCM DAC"
,
"HiFi Playback"
,
SND_SOC_NOPM
,
0
,
0
,
omap3pandora_dac_event
,
0
,
0
,
omap3pandora_dac_event
,
SND_SOC_DAPM_POST_PMU
|
SND_SOC_DAPM_PRE_PMD
),
SND_SOC_DAPM_POST_PMU
|
SND_SOC_DAPM_PRE_PMD
),
...
@@ -130,22 +130,18 @@ static const struct snd_soc_dapm_widget omap3pandora_out_dapm_widgets[] = {
...
@@ -130,22 +130,18 @@ static const struct snd_soc_dapm_widget omap3pandora_out_dapm_widgets[] = {
SND_SOC_DAPM_POST_PMU
|
SND_SOC_DAPM_PRE_PMD
),
SND_SOC_DAPM_POST_PMU
|
SND_SOC_DAPM_PRE_PMD
),
SND_SOC_DAPM_HP
(
"Headphone Jack"
,
NULL
),
SND_SOC_DAPM_HP
(
"Headphone Jack"
,
NULL
),
SND_SOC_DAPM_LINE
(
"Line Out"
,
NULL
),
SND_SOC_DAPM_LINE
(
"Line Out"
,
NULL
),
};
static
const
struct
snd_soc_dapm_widget
omap3pandora_in_dapm_widgets
[]
=
{
SND_SOC_DAPM_MIC
(
"Mic (internal)"
,
NULL
),
SND_SOC_DAPM_MIC
(
"Mic (internal)"
,
NULL
),
SND_SOC_DAPM_MIC
(
"Mic (external)"
,
NULL
),
SND_SOC_DAPM_MIC
(
"Mic (external)"
,
NULL
),
SND_SOC_DAPM_LINE
(
"Line In"
,
NULL
),
SND_SOC_DAPM_LINE
(
"Line In"
,
NULL
),
};
};
static
const
struct
snd_soc_dapm_route
omap3pandora_
out_
map
[]
=
{
static
const
struct
snd_soc_dapm_route
omap3pandora_map
[]
=
{
{
"PCM DAC"
,
NULL
,
"APLL Enable"
},
{
"PCM DAC"
,
NULL
,
"APLL Enable"
},
{
"Headphone Amplifier"
,
NULL
,
"PCM DAC"
},
{
"Headphone Amplifier"
,
NULL
,
"PCM DAC"
},
{
"Line Out"
,
NULL
,
"PCM DAC"
},
{
"Line Out"
,
NULL
,
"PCM DAC"
},
{
"Headphone Jack"
,
NULL
,
"Headphone Amplifier"
},
{
"Headphone Jack"
,
NULL
,
"Headphone Amplifier"
},
};
static
const
struct
snd_soc_dapm_route
omap3pandora_in_map
[]
=
{
{
"AUXL"
,
NULL
,
"Line In"
},
{
"AUXL"
,
NULL
,
"Line In"
},
{
"AUXR"
,
NULL
,
"Line In"
},
{
"AUXR"
,
NULL
,
"Line In"
},
...
@@ -160,7 +156,6 @@ static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd)
...
@@ -160,7 +156,6 @@ static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd)
{
{
struct
snd_soc_codec
*
codec
=
rtd
->
codec
;
struct
snd_soc_codec
*
codec
=
rtd
->
codec
;
struct
snd_soc_dapm_context
*
dapm
=
&
codec
->
dapm
;
struct
snd_soc_dapm_context
*
dapm
=
&
codec
->
dapm
;
int
ret
;
/* All TWL4030 output pins are floating */
/* All TWL4030 output pins are floating */
snd_soc_dapm_nc_pin
(
dapm
,
"EARPIECE"
);
snd_soc_dapm_nc_pin
(
dapm
,
"EARPIECE"
);
...
@@ -174,20 +169,13 @@ static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd)
...
@@ -174,20 +169,13 @@ static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_nc_pin
(
dapm
,
"HFR"
);
snd_soc_dapm_nc_pin
(
dapm
,
"HFR"
);
snd_soc_dapm_nc_pin
(
dapm
,
"VIBRA"
);
snd_soc_dapm_nc_pin
(
dapm
,
"VIBRA"
);
ret
=
snd_soc_dapm_new_controls
(
dapm
,
omap3pandora_out_dapm_widgets
,
return
0
;
ARRAY_SIZE
(
omap3pandora_out_dapm_widgets
));
if
(
ret
<
0
)
return
ret
;
return
snd_soc_dapm_add_routes
(
dapm
,
omap3pandora_out_map
,
ARRAY_SIZE
(
omap3pandora_out_map
));
}
}
static
int
omap3pandora_in_init
(
struct
snd_soc_pcm_runtime
*
rtd
)
static
int
omap3pandora_in_init
(
struct
snd_soc_pcm_runtime
*
rtd
)
{
{
struct
snd_soc_codec
*
codec
=
rtd
->
codec
;
struct
snd_soc_codec
*
codec
=
rtd
->
codec
;
struct
snd_soc_dapm_context
*
dapm
=
&
codec
->
dapm
;
struct
snd_soc_dapm_context
*
dapm
=
&
codec
->
dapm
;
int
ret
;
/* Not comnnected */
/* Not comnnected */
snd_soc_dapm_nc_pin
(
dapm
,
"HSMIC"
);
snd_soc_dapm_nc_pin
(
dapm
,
"HSMIC"
);
...
@@ -195,13 +183,7 @@ static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd)
...
@@ -195,13 +183,7 @@ static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_nc_pin
(
dapm
,
"DIGIMIC0"
);
snd_soc_dapm_nc_pin
(
dapm
,
"DIGIMIC0"
);
snd_soc_dapm_nc_pin
(
dapm
,
"DIGIMIC1"
);
snd_soc_dapm_nc_pin
(
dapm
,
"DIGIMIC1"
);
ret
=
snd_soc_dapm_new_controls
(
dapm
,
omap3pandora_in_dapm_widgets
,
return
0
;
ARRAY_SIZE
(
omap3pandora_in_dapm_widgets
));
if
(
ret
<
0
)
return
ret
;
return
snd_soc_dapm_add_routes
(
dapm
,
omap3pandora_in_map
,
ARRAY_SIZE
(
omap3pandora_in_map
));
}
}
static
struct
snd_soc_ops
omap3pandora_ops
=
{
static
struct
snd_soc_ops
omap3pandora_ops
=
{
...
@@ -241,6 +223,11 @@ static struct snd_soc_card snd_soc_card_omap3pandora = {
...
@@ -241,6 +223,11 @@ static struct snd_soc_card snd_soc_card_omap3pandora = {
.
owner
=
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
.
dai_link
=
omap3pandora_dai
,
.
dai_link
=
omap3pandora_dai
,
.
num_links
=
ARRAY_SIZE
(
omap3pandora_dai
),
.
num_links
=
ARRAY_SIZE
(
omap3pandora_dai
),
.
dapm_widgets
=
omap3pandora_dapm_widgets
,
.
num_dapm_widgets
=
ARRAY_SIZE
(
omap3pandora_dapm_widgets
),
.
dapm_routes
=
omap3pandora_map
,
.
num_dapm_routes
=
ARRAY_SIZE
(
omap3pandora_map
),
};
};
static
struct
platform_device
*
omap3pandora_snd_device
;
static
struct
platform_device
*
omap3pandora_snd_device
;
...
...
sound/soc/omap/rx51.c
浏览文件 @
ab052d46
...
@@ -237,9 +237,6 @@ static const struct snd_soc_dapm_widget aic34_dapm_widgets[] = {
...
@@ -237,9 +237,6 @@ static const struct snd_soc_dapm_widget aic34_dapm_widgets[] = {
SND_SOC_DAPM_HP
(
"Headphone Jack"
,
rx51_hp_event
),
SND_SOC_DAPM_HP
(
"Headphone Jack"
,
rx51_hp_event
),
SND_SOC_DAPM_MIC
(
"HS Mic"
,
NULL
),
SND_SOC_DAPM_MIC
(
"HS Mic"
,
NULL
),
SND_SOC_DAPM_LINE
(
"FM Transmitter"
,
NULL
),
SND_SOC_DAPM_LINE
(
"FM Transmitter"
,
NULL
),
};
static
const
struct
snd_soc_dapm_widget
aic34_dapm_widgetsb
[]
=
{
SND_SOC_DAPM_SPK
(
"Earphone"
,
NULL
),
SND_SOC_DAPM_SPK
(
"Earphone"
,
NULL
),
};
};
...
@@ -253,9 +250,7 @@ static const struct snd_soc_dapm_route audio_map[] = {
...
@@ -253,9 +250,7 @@ static const struct snd_soc_dapm_route audio_map[] = {
{
"DMic Rate 64"
,
NULL
,
"Mic Bias"
},
{
"DMic Rate 64"
,
NULL
,
"Mic Bias"
},
{
"Mic Bias"
,
NULL
,
"DMic"
},
{
"Mic Bias"
,
NULL
,
"DMic"
},
};
static
const
struct
snd_soc_dapm_route
audio_mapb
[]
=
{
{
"b LINE2R"
,
NULL
,
"MONO_LOUT"
},
{
"b LINE2R"
,
NULL
,
"MONO_LOUT"
},
{
"Earphone"
,
NULL
,
"b HPLOUT"
},
{
"Earphone"
,
NULL
,
"b HPLOUT"
},
...
@@ -281,9 +276,6 @@ static const struct snd_kcontrol_new aic34_rx51_controls[] = {
...
@@ -281,9 +276,6 @@ static const struct snd_kcontrol_new aic34_rx51_controls[] = {
SOC_ENUM_EXT
(
"Jack Function"
,
rx51_enum
[
2
],
SOC_ENUM_EXT
(
"Jack Function"
,
rx51_enum
[
2
],
rx51_get_jack
,
rx51_set_jack
),
rx51_get_jack
,
rx51_set_jack
),
SOC_DAPM_PIN_SWITCH
(
"FM Transmitter"
),
SOC_DAPM_PIN_SWITCH
(
"FM Transmitter"
),
};
static
const
struct
snd_kcontrol_new
aic34_rx51_controlsb
[]
=
{
SOC_DAPM_PIN_SWITCH
(
"Earphone"
),
SOC_DAPM_PIN_SWITCH
(
"Earphone"
),
};
};
...
@@ -298,19 +290,6 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
...
@@ -298,19 +290,6 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_nc_pin
(
dapm
,
"MIC3R"
);
snd_soc_dapm_nc_pin
(
dapm
,
"MIC3R"
);
snd_soc_dapm_nc_pin
(
dapm
,
"LINE1R"
);
snd_soc_dapm_nc_pin
(
dapm
,
"LINE1R"
);
/* Add RX-51 specific controls */
err
=
snd_soc_add_card_controls
(
rtd
->
card
,
aic34_rx51_controls
,
ARRAY_SIZE
(
aic34_rx51_controls
));
if
(
err
<
0
)
return
err
;
/* Add RX-51 specific widgets */
snd_soc_dapm_new_controls
(
dapm
,
aic34_dapm_widgets
,
ARRAY_SIZE
(
aic34_dapm_widgets
));
/* Set up RX-51 specific audio path audio_map */
snd_soc_dapm_add_routes
(
dapm
,
audio_map
,
ARRAY_SIZE
(
audio_map
));
err
=
tpa6130a2_add_controls
(
codec
);
err
=
tpa6130a2_add_controls
(
codec
);
if
(
err
<
0
)
if
(
err
<
0
)
return
err
;
return
err
;
...
@@ -333,24 +312,6 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
...
@@ -333,24 +312,6 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
return
err
;
return
err
;
}
}
static
int
rx51_aic34b_init
(
struct
snd_soc_dapm_context
*
dapm
)
{
int
err
;
err
=
snd_soc_add_card_controls
(
dapm
->
card
,
aic34_rx51_controlsb
,
ARRAY_SIZE
(
aic34_rx51_controlsb
));
if
(
err
<
0
)
return
err
;
err
=
snd_soc_dapm_new_controls
(
dapm
,
aic34_dapm_widgetsb
,
ARRAY_SIZE
(
aic34_dapm_widgetsb
));
if
(
err
<
0
)
return
0
;
return
snd_soc_dapm_add_routes
(
dapm
,
audio_mapb
,
ARRAY_SIZE
(
audio_mapb
));
}
/* Digital audio interface glue - connects codec <--> CPU */
/* Digital audio interface glue - connects codec <--> CPU */
static
struct
snd_soc_dai_link
rx51_dai
[]
=
{
static
struct
snd_soc_dai_link
rx51_dai
[]
=
{
{
{
...
@@ -371,7 +332,6 @@ static struct snd_soc_aux_dev rx51_aux_dev[] = {
...
@@ -371,7 +332,6 @@ static struct snd_soc_aux_dev rx51_aux_dev[] = {
{
{
.
name
=
"TLV320AIC34b"
,
.
name
=
"TLV320AIC34b"
,
.
codec_name
=
"tlv320aic3x-codec.2-0019"
,
.
codec_name
=
"tlv320aic3x-codec.2-0019"
,
.
init
=
rx51_aic34b_init
,
},
},
};
};
...
@@ -392,6 +352,13 @@ static struct snd_soc_card rx51_sound_card = {
...
@@ -392,6 +352,13 @@ static struct snd_soc_card rx51_sound_card = {
.
num_aux_devs
=
ARRAY_SIZE
(
rx51_aux_dev
),
.
num_aux_devs
=
ARRAY_SIZE
(
rx51_aux_dev
),
.
codec_conf
=
rx51_codec_conf
,
.
codec_conf
=
rx51_codec_conf
,
.
num_configs
=
ARRAY_SIZE
(
rx51_codec_conf
),
.
num_configs
=
ARRAY_SIZE
(
rx51_codec_conf
),
.
controls
=
aic34_rx51_controls
,
.
num_controls
=
ARRAY_SIZE
(
aic34_rx51_controls
),
.
dapm_widgets
=
aic34_dapm_widgets
,
.
num_dapm_widgets
=
ARRAY_SIZE
(
aic34_dapm_widgets
),
.
dapm_routes
=
audio_map
,
.
num_dapm_routes
=
ARRAY_SIZE
(
audio_map
),
};
};
static
struct
platform_device
*
rx51_snd_device
;
static
struct
platform_device
*
rx51_snd_device
;
...
...
sound/soc/soc-devres.c
浏览文件 @
ab052d46
...
@@ -52,6 +52,40 @@ int devm_snd_soc_register_component(struct device *dev,
...
@@ -52,6 +52,40 @@ int devm_snd_soc_register_component(struct device *dev,
}
}
EXPORT_SYMBOL_GPL
(
devm_snd_soc_register_component
);
EXPORT_SYMBOL_GPL
(
devm_snd_soc_register_component
);
static
void
devm_platform_release
(
struct
device
*
dev
,
void
*
res
)
{
snd_soc_unregister_platform
(
*
(
struct
device
**
)
res
);
}
/**
* devm_snd_soc_register_platform - resource managed platform registration
* @dev: Device used to manage platform
* @platform: platform to register
*
* Register a platform driver with automatic unregistration when the device is
* unregistered.
*/
int
devm_snd_soc_register_platform
(
struct
device
*
dev
,
const
struct
snd_soc_platform_driver
*
platform_drv
)
{
struct
device
**
ptr
;
int
ret
;
ptr
=
devres_alloc
(
devm_platform_release
,
sizeof
(
*
ptr
),
GFP_KERNEL
);
if
(
!
ptr
)
return
-
ENOMEM
;
ret
=
snd_soc_register_platform
(
dev
,
platform_drv
);
if
(
ret
==
0
)
{
*
ptr
=
dev
;
devres_add
(
dev
,
ptr
);
}
else
{
devres_free
(
ptr
);
}
return
ret
;
}
static
void
devm_card_release
(
struct
device
*
dev
,
void
*
res
)
static
void
devm_card_release
(
struct
device
*
dev
,
void
*
res
)
{
{
snd_soc_unregister_card
(
*
(
struct
snd_soc_card
**
)
res
);
snd_soc_unregister_card
(
*
(
struct
snd_soc_card
**
)
res
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录