Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
a6ba2b2d
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看板
提交
a6ba2b2d
编写于
1月 08, 2009
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ASoC: Implement WM8350 headphone jack detection
Signed-off-by:
N
Mark Brown
<
broonie@opensource.wolfsonmicro.com
>
上级
8a2cd618
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
125 addition
and
0 deletion
+125
-0
include/linux/mfd/wm8350/audio.h
include/linux/mfd/wm8350/audio.h
+1
-0
sound/soc/codecs/wm8350.c
sound/soc/codecs/wm8350.c
+116
-0
sound/soc/codecs/wm8350.h
sound/soc/codecs/wm8350.h
+8
-0
未找到文件。
include/linux/mfd/wm8350/audio.h
浏览文件 @
a6ba2b2d
...
...
@@ -490,6 +490,7 @@
/*
* R231 (0xE7) - Jack Status
*/
#define WM8350_JACK_L_LVL 0x0800
#define WM8350_JACK_R_LVL 0x0400
/*
...
...
sound/soc/codecs/wm8350.c
浏览文件 @
a6ba2b2d
...
...
@@ -51,10 +51,17 @@ struct wm8350_output {
u16
mute
;
};
struct
wm8350_jack_data
{
struct
snd_soc_jack
*
jack
;
int
report
;
};
struct
wm8350_data
{
struct
snd_soc_codec
codec
;
struct
wm8350_output
out1
;
struct
wm8350_output
out2
;
struct
wm8350_jack_data
hpl
;
struct
wm8350_jack_data
hpr
;
struct
regulator_bulk_data
supplies
[
ARRAY_SIZE
(
supply_names
)];
};
...
...
@@ -1328,6 +1335,95 @@ static int wm8350_resume(struct platform_device *pdev)
return
0
;
}
static
void
wm8350_hp_jack_handler
(
struct
wm8350
*
wm8350
,
int
irq
,
void
*
data
)
{
struct
wm8350_data
*
priv
=
data
;
u16
reg
;
int
report
;
int
mask
;
struct
wm8350_jack_data
*
jack
=
NULL
;
switch
(
irq
)
{
case
WM8350_IRQ_CODEC_JCK_DET_L
:
jack
=
&
priv
->
hpl
;
mask
=
WM8350_JACK_L_LVL
;
break
;
case
WM8350_IRQ_CODEC_JCK_DET_R
:
jack
=
&
priv
->
hpr
;
mask
=
WM8350_JACK_R_LVL
;
break
;
default:
BUG
();
}
if
(
!
jack
->
jack
)
{
dev_warn
(
wm8350
->
dev
,
"Jack interrupt called with no jack
\n
"
);
return
;
}
/* Debounce */
msleep
(
200
);
reg
=
wm8350_reg_read
(
wm8350
,
WM8350_JACK_PIN_STATUS
);
if
(
reg
&
mask
)
report
=
jack
->
report
;
else
report
=
0
;
snd_soc_jack_report
(
jack
->
jack
,
report
,
jack
->
report
);
}
/**
* wm8350_hp_jack_detect - Enable headphone jack detection.
*
* @codec: WM8350 codec
* @which: left or right jack detect signal
* @jack: jack to report detection events on
* @report: value to report
*
* Enables the headphone jack detection of the WM8350.
*/
int
wm8350_hp_jack_detect
(
struct
snd_soc_codec
*
codec
,
enum
wm8350_jack
which
,
struct
snd_soc_jack
*
jack
,
int
report
)
{
struct
wm8350_data
*
priv
=
codec
->
private_data
;
struct
wm8350
*
wm8350
=
codec
->
control_data
;
int
irq
;
int
ena
;
switch
(
which
)
{
case
WM8350_JDL
:
priv
->
hpl
.
jack
=
jack
;
priv
->
hpl
.
report
=
report
;
irq
=
WM8350_IRQ_CODEC_JCK_DET_L
;
ena
=
WM8350_JDL_ENA
;
break
;
case
WM8350_JDR
:
priv
->
hpr
.
jack
=
jack
;
priv
->
hpr
.
report
=
report
;
irq
=
WM8350_IRQ_CODEC_JCK_DET_R
;
ena
=
WM8350_JDR_ENA
;
break
;
default:
return
-
EINVAL
;
}
wm8350_set_bits
(
wm8350
,
WM8350_POWER_MGMT_4
,
WM8350_TOCLK_ENA
);
wm8350_set_bits
(
wm8350
,
WM8350_JACK_DETECT
,
ena
);
/* Sync status */
wm8350_hp_jack_handler
(
wm8350
,
irq
,
priv
);
wm8350_unmask_irq
(
wm8350
,
irq
);
return
0
;
}
EXPORT_SYMBOL_GPL
(
wm8350_hp_jack_detect
);
static
struct
snd_soc_codec
*
wm8350_codec
;
static
int
wm8350_probe
(
struct
platform_device
*
pdev
)
...
...
@@ -1381,6 +1477,13 @@ static int wm8350_probe(struct platform_device *pdev)
wm8350_set_bits
(
wm8350
,
WM8350_ROUT2_VOLUME
,
WM8350_OUT2_VU
|
WM8350_OUT2R_MUTE
);
wm8350_mask_irq
(
wm8350
,
WM8350_IRQ_CODEC_JCK_DET_L
);
wm8350_mask_irq
(
wm8350
,
WM8350_IRQ_CODEC_JCK_DET_R
);
wm8350_register_irq
(
wm8350
,
WM8350_IRQ_CODEC_JCK_DET_L
,
wm8350_hp_jack_handler
,
priv
);
wm8350_register_irq
(
wm8350
,
WM8350_IRQ_CODEC_JCK_DET_R
,
wm8350_hp_jack_handler
,
priv
);
ret
=
snd_soc_new_pcms
(
socdev
,
SNDRV_DEFAULT_IDX1
,
SNDRV_DEFAULT_STR1
);
if
(
ret
<
0
)
{
dev_err
(
&
pdev
->
dev
,
"failed to create pcms
\n
"
);
...
...
@@ -1411,8 +1514,21 @@ static int wm8350_remove(struct platform_device *pdev)
struct
snd_soc_device
*
socdev
=
platform_get_drvdata
(
pdev
);
struct
snd_soc_codec
*
codec
=
socdev
->
codec
;
struct
wm8350
*
wm8350
=
codec
->
control_data
;
struct
wm8350_data
*
priv
=
codec
->
private_data
;
int
ret
;
wm8350_clear_bits
(
wm8350
,
WM8350_JACK_DETECT
,
WM8350_JDL_ENA
|
WM8350_JDR_ENA
);
wm8350_clear_bits
(
wm8350
,
WM8350_POWER_MGMT_4
,
WM8350_TOCLK_ENA
);
wm8350_mask_irq
(
wm8350
,
WM8350_IRQ_CODEC_JCK_DET_L
);
wm8350_mask_irq
(
wm8350
,
WM8350_IRQ_CODEC_JCK_DET_R
);
wm8350_free_irq
(
wm8350
,
WM8350_IRQ_CODEC_JCK_DET_L
);
wm8350_free_irq
(
wm8350
,
WM8350_IRQ_CODEC_JCK_DET_R
);
priv
->
hpl
.
jack
=
NULL
;
priv
->
hpr
.
jack
=
NULL
;
/* cancel any work waiting to be queued. */
ret
=
cancel_delayed_work
(
&
codec
->
delayed_work
);
...
...
sound/soc/codecs/wm8350.h
浏览文件 @
a6ba2b2d
...
...
@@ -17,4 +17,12 @@
extern
struct
snd_soc_dai
wm8350_dai
;
extern
struct
snd_soc_codec_device
soc_codec_dev_wm8350
;
enum
wm8350_jack
{
WM8350_JDL
=
1
,
WM8350_JDR
=
2
,
};
int
wm8350_hp_jack_detect
(
struct
snd_soc_codec
*
codec
,
enum
wm8350_jack
which
,
struct
snd_soc_jack
*
jack
,
int
report
);
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录