Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
313769d9
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看板
提交
313769d9
编写于
12月 25, 2008
作者:
T
Takashi Iwai
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'topic/cs5535audio' into to-push
上级
8afabfa7
f144b7f6
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
252 addition
and
3 deletion
+252
-3
include/sound/ac97_codec.h
include/sound/ac97_codec.h
+2
-0
sound/pci/ac97/ac97_patch.c
sound/pci/ac97/ac97_patch.c
+3
-2
sound/pci/cs5535audio/Makefile
sound/pci/cs5535audio/Makefile
+3
-0
sound/pci/cs5535audio/cs5535audio.c
sound/pci/cs5535audio/cs5535audio.c
+11
-1
sound/pci/cs5535audio/cs5535audio.h
sound/pci/cs5535audio/cs5535audio.h
+39
-0
sound/pci/cs5535audio/cs5535audio_olpc.c
sound/pci/cs5535audio/cs5535audio_olpc.c
+179
-0
sound/pci/cs5535audio/cs5535audio_pcm.c
sound/pci/cs5535audio/cs5535audio_pcm.c
+15
-0
未找到文件。
include/sound/ac97_codec.h
浏览文件 @
313769d9
...
@@ -281,10 +281,12 @@
...
@@ -281,10 +281,12 @@
/* specific - Analog Devices */
/* specific - Analog Devices */
#define AC97_AD_TEST 0x5a
/* test register */
#define AC97_AD_TEST 0x5a
/* test register */
#define AC97_AD_TEST2 0x5c
/* undocumented test register 2 */
#define AC97_AD_TEST2 0x5c
/* undocumented test register 2 */
#define AC97_AD_HPFD_SHIFT 12
/* High Pass Filter Disable */
#define AC97_AD_CODEC_CFG 0x70
/* codec configuration */
#define AC97_AD_CODEC_CFG 0x70
/* codec configuration */
#define AC97_AD_JACK_SPDIF 0x72
/* Jack Sense & S/PDIF */
#define AC97_AD_JACK_SPDIF 0x72
/* Jack Sense & S/PDIF */
#define AC97_AD_SERIAL_CFG 0x74
/* Serial Configuration */
#define AC97_AD_SERIAL_CFG 0x74
/* Serial Configuration */
#define AC97_AD_MISC 0x76
/* Misc Control Bits */
#define AC97_AD_MISC 0x76
/* Misc Control Bits */
#define AC97_AD_VREFD_SHIFT 2
/* V_REFOUT Disable (AD1888) */
/* specific - Cirrus Logic */
/* specific - Cirrus Logic */
#define AC97_CSR_ACMODE 0x5e
/* AC Mode Register */
#define AC97_CSR_ACMODE 0x5e
/* AC Mode Register */
...
...
sound/pci/ac97/ac97_patch.c
浏览文件 @
313769d9
...
@@ -2054,8 +2054,9 @@ static const struct snd_kcontrol_new snd_ac97_ad1888_controls[] = {
...
@@ -2054,8 +2054,9 @@ static const struct snd_kcontrol_new snd_ac97_ad1888_controls[] = {
.
get
=
snd_ac97_ad1888_lohpsel_get
,
.
get
=
snd_ac97_ad1888_lohpsel_get
,
.
put
=
snd_ac97_ad1888_lohpsel_put
.
put
=
snd_ac97_ad1888_lohpsel_put
},
},
AC97_SINGLE
(
"V_REFOUT Enable"
,
AC97_AD_MISC
,
2
,
1
,
1
),
AC97_SINGLE
(
"V_REFOUT Enable"
,
AC97_AD_MISC
,
AC97_AD_VREFD_SHIFT
,
1
,
1
),
AC97_SINGLE
(
"High Pass Filter Enable"
,
AC97_AD_TEST2
,
12
,
1
,
1
),
AC97_SINGLE
(
"High Pass Filter Enable"
,
AC97_AD_TEST2
,
AC97_AD_HPFD_SHIFT
,
1
,
1
),
AC97_SINGLE
(
"Spread Front to Surround and Center/LFE"
,
AC97_AD_MISC
,
7
,
1
,
0
),
AC97_SINGLE
(
"Spread Front to Surround and Center/LFE"
,
AC97_AD_MISC
,
7
,
1
,
0
),
{
{
.
iface
=
SNDRV_CTL_ELEM_IFACE_MIXER
,
.
iface
=
SNDRV_CTL_ELEM_IFACE_MIXER
,
...
...
sound/pci/cs5535audio/Makefile
浏览文件 @
313769d9
...
@@ -4,6 +4,9 @@
...
@@ -4,6 +4,9 @@
snd-cs5535audio-y
:=
cs5535audio.o cs5535audio_pcm.o
snd-cs5535audio-y
:=
cs5535audio.o cs5535audio_pcm.o
snd-cs5535audio-$(CONFIG_PM)
+=
cs5535audio_pm.o
snd-cs5535audio-$(CONFIG_PM)
+=
cs5535audio_pm.o
ifdef
CONFIG_MGEODE_LX
snd-cs5535audio-$(CONFIG_OLPC)
+=
cs5535audio_olpc.o
endif
# Toplevel Module Dependency
# Toplevel Module Dependency
obj-$(CONFIG_SND_CS5535AUDIO)
+=
snd-cs5535audio.o
obj-$(CONFIG_SND_CS5535AUDIO)
+=
snd-cs5535audio.o
sound/pci/cs5535audio/cs5535audio.c
浏览文件 @
313769d9
...
@@ -159,10 +159,14 @@ static int __devinit snd_cs5535audio_mixer(struct cs5535audio *cs5535au)
...
@@ -159,10 +159,14 @@ static int __devinit snd_cs5535audio_mixer(struct cs5535audio *cs5535au)
return
err
;
return
err
;
memset
(
&
ac97
,
0
,
sizeof
(
ac97
));
memset
(
&
ac97
,
0
,
sizeof
(
ac97
));
ac97
.
scaps
=
AC97_SCAP_AUDIO
|
AC97_SCAP_SKIP_MODEM
;
ac97
.
scaps
=
AC97_SCAP_AUDIO
|
AC97_SCAP_SKIP_MODEM
|
AC97_SCAP_POWER_SAVE
;
ac97
.
private_data
=
cs5535au
;
ac97
.
private_data
=
cs5535au
;
ac97
.
pci
=
cs5535au
->
pci
;
ac97
.
pci
=
cs5535au
->
pci
;
/* set any OLPC-specific scaps */
olpc_prequirks
(
card
,
&
ac97
);
if
((
err
=
snd_ac97_mixer
(
pbus
,
&
ac97
,
&
cs5535au
->
ac97
))
<
0
)
{
if
((
err
=
snd_ac97_mixer
(
pbus
,
&
ac97
,
&
cs5535au
->
ac97
))
<
0
)
{
snd_printk
(
KERN_ERR
"mixer failed
\n
"
);
snd_printk
(
KERN_ERR
"mixer failed
\n
"
);
return
err
;
return
err
;
...
@@ -170,6 +174,12 @@ static int __devinit snd_cs5535audio_mixer(struct cs5535audio *cs5535au)
...
@@ -170,6 +174,12 @@ static int __devinit snd_cs5535audio_mixer(struct cs5535audio *cs5535au)
snd_ac97_tune_hardware
(
cs5535au
->
ac97
,
ac97_quirks
,
ac97_quirk
);
snd_ac97_tune_hardware
(
cs5535au
->
ac97
,
ac97_quirks
,
ac97_quirk
);
err
=
olpc_quirks
(
card
,
cs5535au
->
ac97
);
if
(
err
<
0
)
{
snd_printk
(
KERN_ERR
"olpc quirks failed
\n
"
);
return
err
;
}
return
0
;
return
0
;
}
}
...
...
sound/pci/cs5535audio/cs5535audio.h
浏览文件 @
313769d9
...
@@ -78,6 +78,7 @@ struct cs5535audio_dma {
...
@@ -78,6 +78,7 @@ struct cs5535audio_dma {
unsigned
int
buf_addr
,
buf_bytes
;
unsigned
int
buf_addr
,
buf_bytes
;
unsigned
int
period_bytes
,
periods
;
unsigned
int
period_bytes
,
periods
;
u32
saved_prd
;
u32
saved_prd
;
int
pcm_open_flag
;
};
};
struct
cs5535audio
{
struct
cs5535audio
{
...
@@ -93,8 +94,46 @@ struct cs5535audio {
...
@@ -93,8 +94,46 @@ struct cs5535audio {
struct
cs5535audio_dma
dmas
[
NUM_CS5535AUDIO_DMAS
];
struct
cs5535audio_dma
dmas
[
NUM_CS5535AUDIO_DMAS
];
};
};
#ifdef CONFIG_PM
int
snd_cs5535audio_suspend
(
struct
pci_dev
*
pci
,
pm_message_t
state
);
int
snd_cs5535audio_suspend
(
struct
pci_dev
*
pci
,
pm_message_t
state
);
int
snd_cs5535audio_resume
(
struct
pci_dev
*
pci
);
int
snd_cs5535audio_resume
(
struct
pci_dev
*
pci
);
#endif
#if defined(CONFIG_OLPC) && defined(CONFIG_MGEODE_LX)
void
__devinit
olpc_prequirks
(
struct
snd_card
*
card
,
struct
snd_ac97_template
*
ac97
);
int
__devinit
olpc_quirks
(
struct
snd_card
*
card
,
struct
snd_ac97
*
ac97
);
void
olpc_analog_input
(
struct
snd_ac97
*
ac97
,
int
on
);
void
olpc_mic_bias
(
struct
snd_ac97
*
ac97
,
int
on
);
static
inline
void
olpc_capture_open
(
struct
snd_ac97
*
ac97
)
{
/* default to Analog Input off */
olpc_analog_input
(
ac97
,
0
);
/* enable MIC Bias for recording */
olpc_mic_bias
(
ac97
,
1
);
}
static
inline
void
olpc_capture_close
(
struct
snd_ac97
*
ac97
)
{
/* disable Analog Input */
olpc_analog_input
(
ac97
,
0
);
/* disable the MIC Bias (so the recording LED turns off) */
olpc_mic_bias
(
ac97
,
0
);
}
#else
static
inline
void
olpc_prequirks
(
struct
snd_card
*
card
,
struct
snd_ac97_template
*
ac97
)
{
}
static
inline
int
olpc_quirks
(
struct
snd_card
*
card
,
struct
snd_ac97
*
ac97
)
{
return
0
;
}
static
inline
void
olpc_analog_input
(
struct
snd_ac97
*
ac97
,
int
on
)
{
}
static
inline
void
olpc_mic_bias
(
struct
snd_ac97
*
ac97
,
int
on
)
{
}
static
inline
void
olpc_capture_open
(
struct
snd_ac97
*
ac97
)
{
}
static
inline
void
olpc_capture_close
(
struct
snd_ac97
*
ac97
)
{
}
#endif
int
__devinit
snd_cs5535audio_pcm
(
struct
cs5535audio
*
cs5535audio
);
int
__devinit
snd_cs5535audio_pcm
(
struct
cs5535audio
*
cs5535audio
);
#endif
/* __SOUND_CS5535AUDIO_H */
#endif
/* __SOUND_CS5535AUDIO_H */
...
...
sound/pci/cs5535audio/cs5535audio_olpc.c
0 → 100644
浏览文件 @
313769d9
/*
* OLPC XO-1 additional sound features
*
* Copyright © 2006 Jaya Kumar <jayakumar.lkml@gmail.com>
* Copyright © 2007-2008 Andres Salomon <dilinger@debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <sound/core.h>
#include <sound/info.h>
#include <sound/control.h>
#include <sound/ac97_codec.h>
#include <asm/olpc.h>
#include "cs5535audio.h"
/*
* OLPC has an additional feature on top of the regular AD1888 codec features.
* It has an Analog Input mode that is switched into (after disabling the
* High Pass Filter) via GPIO. It is supported on B2 and later models.
*/
void
olpc_analog_input
(
struct
snd_ac97
*
ac97
,
int
on
)
{
int
err
;
if
(
!
machine_is_olpc
())
return
;
/* update the High Pass Filter (via AC97_AD_TEST2) */
err
=
snd_ac97_update_bits
(
ac97
,
AC97_AD_TEST2
,
1
<<
AC97_AD_HPFD_SHIFT
,
on
<<
AC97_AD_HPFD_SHIFT
);
if
(
err
<
0
)
{
snd_printk
(
KERN_ERR
"setting High Pass Filter - %d
\n
"
,
err
);
return
;
}
/* set Analog Input through GPIO */
if
(
on
)
geode_gpio_set
(
OLPC_GPIO_MIC_AC
,
GPIO_OUTPUT_VAL
);
else
geode_gpio_clear
(
OLPC_GPIO_MIC_AC
,
GPIO_OUTPUT_VAL
);
}
/*
* OLPC XO-1's V_REFOUT is a mic bias enable.
*/
void
olpc_mic_bias
(
struct
snd_ac97
*
ac97
,
int
on
)
{
int
err
;
if
(
!
machine_is_olpc
())
return
;
on
=
on
?
0
:
1
;
err
=
snd_ac97_update_bits
(
ac97
,
AC97_AD_MISC
,
1
<<
AC97_AD_VREFD_SHIFT
,
on
<<
AC97_AD_VREFD_SHIFT
);
if
(
err
<
0
)
snd_printk
(
KERN_ERR
"setting MIC Bias - %d
\n
"
,
err
);
}
static
int
olpc_dc_info
(
struct
snd_kcontrol
*
kctl
,
struct
snd_ctl_elem_info
*
uinfo
)
{
uinfo
->
type
=
SNDRV_CTL_ELEM_TYPE_BOOLEAN
;
uinfo
->
count
=
1
;
uinfo
->
value
.
integer
.
min
=
0
;
uinfo
->
value
.
integer
.
max
=
1
;
return
0
;
}
static
int
olpc_dc_get
(
struct
snd_kcontrol
*
kctl
,
struct
snd_ctl_elem_value
*
v
)
{
v
->
value
.
integer
.
value
[
0
]
=
geode_gpio_isset
(
OLPC_GPIO_MIC_AC
,
GPIO_OUTPUT_VAL
);
return
0
;
}
static
int
olpc_dc_put
(
struct
snd_kcontrol
*
kctl
,
struct
snd_ctl_elem_value
*
v
)
{
struct
cs5535audio
*
cs5535au
=
snd_kcontrol_chip
(
kctl
);
olpc_analog_input
(
cs5535au
->
ac97
,
v
->
value
.
integer
.
value
[
0
]);
return
1
;
}
static
int
olpc_mic_info
(
struct
snd_kcontrol
*
kctl
,
struct
snd_ctl_elem_info
*
uinfo
)
{
uinfo
->
type
=
SNDRV_CTL_ELEM_TYPE_BOOLEAN
;
uinfo
->
count
=
1
;
uinfo
->
value
.
integer
.
min
=
0
;
uinfo
->
value
.
integer
.
max
=
1
;
return
0
;
}
static
int
olpc_mic_get
(
struct
snd_kcontrol
*
kctl
,
struct
snd_ctl_elem_value
*
v
)
{
struct
cs5535audio
*
cs5535au
=
snd_kcontrol_chip
(
kctl
);
struct
snd_ac97
*
ac97
=
cs5535au
->
ac97
;
int
i
;
i
=
(
snd_ac97_read
(
ac97
,
AC97_AD_MISC
)
>>
AC97_AD_VREFD_SHIFT
)
&
0x1
;
v
->
value
.
integer
.
value
[
0
]
=
i
?
0
:
1
;
return
0
;
}
static
int
olpc_mic_put
(
struct
snd_kcontrol
*
kctl
,
struct
snd_ctl_elem_value
*
v
)
{
struct
cs5535audio
*
cs5535au
=
snd_kcontrol_chip
(
kctl
);
olpc_mic_bias
(
cs5535au
->
ac97
,
v
->
value
.
integer
.
value
[
0
]);
return
1
;
}
static
struct
snd_kcontrol_new
olpc_cs5535audio_ctls
[]
__devinitdata
=
{
{
.
iface
=
SNDRV_CTL_ELEM_IFACE_MIXER
,
.
name
=
"DC Mode Enable"
,
.
info
=
olpc_dc_info
,
.
get
=
olpc_dc_get
,
.
put
=
olpc_dc_put
,
.
private_value
=
0
,
},
{
.
iface
=
SNDRV_CTL_ELEM_IFACE_MIXER
,
.
name
=
"MIC Bias Enable"
,
.
info
=
olpc_mic_info
,
.
get
=
olpc_mic_get
,
.
put
=
olpc_mic_put
,
.
private_value
=
0
,
},
};
void
__devinit
olpc_prequirks
(
struct
snd_card
*
card
,
struct
snd_ac97_template
*
ac97
)
{
if
(
!
machine_is_olpc
())
return
;
/* invert EAPD if on an OLPC B3 or higher */
if
(
olpc_board_at_least
(
olpc_board_pre
(
0xb3
)))
ac97
->
scaps
|=
AC97_SCAP_INV_EAPD
;
}
int
__devinit
olpc_quirks
(
struct
snd_card
*
card
,
struct
snd_ac97
*
ac97
)
{
struct
snd_ctl_elem_id
elem
;
int
i
,
err
;
if
(
!
machine_is_olpc
())
return
0
;
/* drop the original AD1888 HPF control */
memset
(
&
elem
,
0
,
sizeof
(
elem
));
elem
.
iface
=
SNDRV_CTL_ELEM_IFACE_MIXER
;
strncpy
(
elem
.
name
,
"High Pass Filter Enable"
,
sizeof
(
elem
.
name
));
snd_ctl_remove_id
(
card
,
&
elem
);
/* drop the original V_REFOUT control */
memset
(
&
elem
,
0
,
sizeof
(
elem
));
elem
.
iface
=
SNDRV_CTL_ELEM_IFACE_MIXER
;
strncpy
(
elem
.
name
,
"V_REFOUT Enable"
,
sizeof
(
elem
.
name
));
snd_ctl_remove_id
(
card
,
&
elem
);
/* add the OLPC-specific controls */
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
olpc_cs5535audio_ctls
);
i
++
)
{
err
=
snd_ctl_add
(
card
,
snd_ctl_new1
(
&
olpc_cs5535audio_ctls
[
i
],
ac97
->
private_data
));
if
(
err
<
0
)
return
err
;
}
/* turn off the mic by default */
olpc_mic_bias
(
ac97
,
0
);
return
0
;
}
sound/pci/cs5535audio/cs5535audio_pcm.c
浏览文件 @
313769d9
...
@@ -260,6 +260,9 @@ static int snd_cs5535audio_hw_params(struct snd_pcm_substream *substream,
...
@@ -260,6 +260,9 @@ static int snd_cs5535audio_hw_params(struct snd_pcm_substream *substream,
err
=
cs5535audio_build_dma_packets
(
cs5535au
,
dma
,
substream
,
err
=
cs5535audio_build_dma_packets
(
cs5535au
,
dma
,
substream
,
params_periods
(
hw_params
),
params_periods
(
hw_params
),
params_period_bytes
(
hw_params
));
params_period_bytes
(
hw_params
));
if
(
!
err
)
dma
->
pcm_open_flag
=
1
;
return
err
;
return
err
;
}
}
...
@@ -268,6 +271,15 @@ static int snd_cs5535audio_hw_free(struct snd_pcm_substream *substream)
...
@@ -268,6 +271,15 @@ static int snd_cs5535audio_hw_free(struct snd_pcm_substream *substream)
struct
cs5535audio
*
cs5535au
=
snd_pcm_substream_chip
(
substream
);
struct
cs5535audio
*
cs5535au
=
snd_pcm_substream_chip
(
substream
);
struct
cs5535audio_dma
*
dma
=
substream
->
runtime
->
private_data
;
struct
cs5535audio_dma
*
dma
=
substream
->
runtime
->
private_data
;
if
(
dma
->
pcm_open_flag
)
{
if
(
substream
==
cs5535au
->
playback_substream
)
snd_ac97_update_power
(
cs5535au
->
ac97
,
AC97_PCM_FRONT_DAC_RATE
,
0
);
else
snd_ac97_update_power
(
cs5535au
->
ac97
,
AC97_PCM_LR_ADC_RATE
,
0
);
dma
->
pcm_open_flag
=
0
;
}
cs5535audio_clear_dma_packets
(
cs5535au
,
dma
,
substream
);
cs5535audio_clear_dma_packets
(
cs5535au
,
dma
,
substream
);
return
snd_pcm_lib_free_pages
(
substream
);
return
snd_pcm_lib_free_pages
(
substream
);
}
}
...
@@ -351,11 +363,14 @@ static int snd_cs5535audio_capture_open(struct snd_pcm_substream *substream)
...
@@ -351,11 +363,14 @@ static int snd_cs5535audio_capture_open(struct snd_pcm_substream *substream)
if
((
err
=
snd_pcm_hw_constraint_integer
(
runtime
,
if
((
err
=
snd_pcm_hw_constraint_integer
(
runtime
,
SNDRV_PCM_HW_PARAM_PERIODS
))
<
0
)
SNDRV_PCM_HW_PARAM_PERIODS
))
<
0
)
return
err
;
return
err
;
olpc_capture_open
(
cs5535au
->
ac97
);
return
0
;
return
0
;
}
}
static
int
snd_cs5535audio_capture_close
(
struct
snd_pcm_substream
*
substream
)
static
int
snd_cs5535audio_capture_close
(
struct
snd_pcm_substream
*
substream
)
{
{
struct
cs5535audio
*
cs5535au
=
snd_pcm_substream_chip
(
substream
);
olpc_capture_close
(
cs5535au
->
ac97
);
return
0
;
return
0
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录