Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Linux-御风守护者
linux
提交
a9c3c7e0
L
linux
项目概览
Linux-御风守护者
/
linux
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a9c3c7e0
编写于
12月 25, 2008
作者:
T
Takashi Iwai
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'topic/pcxhr-update' into to-push
上级
cc491085
ade9b2fb
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
1995 addition
and
521 deletion
+1995
-521
sound/pci/pcxhr/Makefile
sound/pci/pcxhr/Makefile
+1
-1
sound/pci/pcxhr/pcxhr.c
sound/pci/pcxhr/pcxhr.c
+382
-170
sound/pci/pcxhr/pcxhr.h
sound/pci/pcxhr/pcxhr.h
+51
-25
sound/pci/pcxhr/pcxhr_core.c
sound/pci/pcxhr/pcxhr_core.c
+186
-105
sound/pci/pcxhr/pcxhr_core.h
sound/pci/pcxhr/pcxhr_core.h
+4
-1
sound/pci/pcxhr/pcxhr_hwdep.c
sound/pci/pcxhr/pcxhr_hwdep.c
+113
-45
sound/pci/pcxhr/pcxhr_mix22.c
sound/pci/pcxhr/pcxhr_mix22.c
+820
-0
sound/pci/pcxhr/pcxhr_mix22.h
sound/pci/pcxhr/pcxhr_mix22.h
+56
-0
sound/pci/pcxhr/pcxhr_mixer.c
sound/pci/pcxhr/pcxhr_mixer.c
+382
-174
未找到文件。
sound/pci/pcxhr/Makefile
浏览文件 @
a9c3c7e0
snd-pcxhr-objs
:=
pcxhr.o pcxhr_hwdep.o pcxhr_mixer.o pcxhr_core.o
snd-pcxhr-objs
:=
pcxhr.o pcxhr_hwdep.o pcxhr_mixer.o pcxhr_core.o
pcxhr_mix22.o
obj-$(CONFIG_SND_PCXHR)
+=
snd-pcxhr.o
sound/pci/pcxhr/pcxhr.c
浏览文件 @
a9c3c7e0
此差异已折叠。
点击以展开。
sound/pci/pcxhr/pcxhr.h
浏览文件 @
a9c3c7e0
...
...
@@ -27,15 +27,18 @@
#include <linux/mutex.h>
#include <sound/pcm.h>
#define PCXHR_DRIVER_VERSION 0x000
804
/* 0.8.4
*/
#define PCXHR_DRIVER_VERSION_STRING "0.
8.4"
/* 0.8.4
*/
#define PCXHR_DRIVER_VERSION 0x000
905
/* 0.9.5
*/
#define PCXHR_DRIVER_VERSION_STRING "0.
9.5"
/* 0.9.5
*/
#define PCXHR_MAX_CARDS
6
#define PCXHR_PLAYBACK_STREAMS
4
#define PCXHR_MAX_CARDS 6
#define PCXHR_PLAYBACK_STREAMS 4
#define PCXHR_GRANULARITY 96
/* transfer granularity (should be min 96 and multiple of 48) */
#define PCXHR_GRANULARITY_MIN 96
/* transfer granularity of pipes and the dsp time (MBOX4) */
#define PCXHR_GRANULARITY 96
/* min 96 and multiple of 48 */
/* transfer granularity of pipes and the dsp time (MBOX4) */
#define PCXHR_GRANULARITY_MIN 96
/* TODO : granularity could be 64 or 128 */
#define PCXHR_GRANULARITY_HR22 192
/* granularity for stereo cards */
struct
snd_pcxhr
;
struct
pcxhr_mgr
;
...
...
@@ -51,6 +54,11 @@ enum pcxhr_clock_type {
PCXHR_CLOCK_TYPE_AES_2
,
PCXHR_CLOCK_TYPE_AES_3
,
PCXHR_CLOCK_TYPE_AES_4
,
PCXHR_CLOCK_TYPE_MAX
=
PCXHR_CLOCK_TYPE_AES_4
,
HR22_CLOCK_TYPE_INTERNAL
=
PCXHR_CLOCK_TYPE_INTERNAL
,
HR22_CLOCK_TYPE_AES_SYNC
,
HR22_CLOCK_TYPE_AES_1
,
HR22_CLOCK_TYPE_MAX
=
HR22_CLOCK_TYPE_AES_1
,
};
struct
pcxhr_mgr
{
...
...
@@ -61,6 +69,8 @@ struct pcxhr_mgr {
int
irq
;
int
granularity
;
/* card access with 1 mem bar and 2 io bar's */
unsigned
long
port
[
3
];
...
...
@@ -83,11 +93,16 @@ struct pcxhr_mgr {
/* hardware interface */
unsigned
int
dsp_loaded
;
/* bit flags of loaded dsp indices */
unsigned
int
dsp_version
;
/* read from embedded once firmware is loaded */
int
board_has_analog
;
/* if 0 the board is digital only */
int
mono_capture
;
/* if 1 the board does mono capture */
int
playback_chips
;
/* 4 or 6 */
int
capture_chips
;
/* 4 or 1 */
int
firmware_num
;
/* 41 or 42 */
int
playback_chips
;
int
capture_chips
;
int
fw_file_set
;
int
firmware_num
;
int
is_hr_stereo
:
1
;
int
board_has_aes1
:
1
;
/* if 1 board has AES1 plug and SRC */
int
board_has_analog
:
1
;
/* if 0 the board is digital only */
int
board_has_mic
:
1
;
/* if 1 the board has microphone input */
int
board_aes_in_192k
:
1
;
/* if 1 the aes input plugs do support 192kHz */
int
mono_capture
:
1
;
/* if 1 the board does mono capture */
struct
snd_dma_buffer
hostport
;
...
...
@@ -106,6 +121,9 @@ struct pcxhr_mgr {
int
async_err_stream_xrun
;
int
async_err_pipe_xrun
;
int
async_err_other_last
;
unsigned
char
xlx_cfg
;
/* copy of PCXHR_XLX_CFG register */
unsigned
char
xlx_selmic
;
/* copy of PCXHR_XLX_SELMIC register */
};
...
...
@@ -155,24 +173,30 @@ struct snd_pcxhr {
struct
snd_pcm
*
pcm
;
/* PCM */
struct
pcxhr_pipe
playback_pipe
;
/* 1 stereo pipe only */
struct
pcxhr_pipe
capture_pipe
[
2
];
/* 1 stereo pipe
or 2 mono pipes */
struct
pcxhr_pipe
playback_pipe
;
/* 1 stereo pipe only */
struct
pcxhr_pipe
capture_pipe
[
2
];
/* 1 stereo
or 2 mono pipes */
struct
pcxhr_stream
playback_stream
[
PCXHR_PLAYBACK_STREAMS
];
struct
pcxhr_stream
capture_stream
[
2
];
/* 1 stereo
stream
or 2 mono streams */
struct
pcxhr_stream
capture_stream
[
2
];
/* 1 stereo or 2 mono streams */
int
nb_streams_play
;
int
nb_streams_capt
;
int
analog_playback_active
[
2
];
/* Mixer : Master Playback active (!mute) */
int
analog_playback_volume
[
2
];
/* Mixer : Master Playback Volume */
int
analog_capture_volume
[
2
];
/* Mixer : Master Capture Volume */
int
digital_playback_active
[
PCXHR_PLAYBACK_STREAMS
][
2
];
/* Mixer : Digital Playback Active [streams][stereo]*/
int
digital_playback_volume
[
PCXHR_PLAYBACK_STREAMS
][
2
];
/* Mixer : Digital Playback Volume [streams][stereo]*/
int
digital_capture_volume
[
2
];
/* Mixer : Digital Capture Volume [stereo] */
int
monitoring_active
[
2
];
/* Mixer : Monitoring Active */
int
monitoring_volume
[
2
];
/* Mixer : Monitoring Volume */
int
audio_capture_source
;
/* Mixer : Audio Capture Source */
unsigned
char
aes_bits
[
5
];
/* Mixer : IEC958_AES bits */
int
analog_playback_active
[
2
];
/* Mixer : Master Playback !mute */
int
analog_playback_volume
[
2
];
/* Mixer : Master Playback Volume */
int
analog_capture_volume
[
2
];
/* Mixer : Master Capture Volume */
int
digital_playback_active
[
PCXHR_PLAYBACK_STREAMS
][
2
];
int
digital_playback_volume
[
PCXHR_PLAYBACK_STREAMS
][
2
];
int
digital_capture_volume
[
2
];
/* Mixer : Digital Capture Volume */
int
monitoring_active
[
2
];
/* Mixer : Monitoring Active */
int
monitoring_volume
[
2
];
/* Mixer : Monitoring Volume */
int
audio_capture_source
;
/* Mixer : Audio Capture Source */
int
mic_volume
;
/* used by cards with MIC only */
int
mic_boost
;
/* used by cards with MIC only */
int
mic_active
;
/* used by cards with MIC only */
int
analog_capture_active
;
/* used by cards with MIC only */
int
phantom_power
;
/* used by cards with MIC only */
unsigned
char
aes_bits
[
5
];
/* Mixer : IEC958_AES bits */
};
struct
pcxhr_hostport
...
...
@@ -184,6 +208,8 @@ struct pcxhr_hostport
/* exported */
int
pcxhr_create_pcm
(
struct
snd_pcxhr
*
chip
);
int
pcxhr_set_clock
(
struct
pcxhr_mgr
*
mgr
,
unsigned
int
rate
);
int
pcxhr_get_external_clock
(
struct
pcxhr_mgr
*
mgr
,
enum
pcxhr_clock_type
clock_type
,
int
*
sample_rate
);
int
pcxhr_get_external_clock
(
struct
pcxhr_mgr
*
mgr
,
enum
pcxhr_clock_type
clock_type
,
int
*
sample_rate
);
#endif
/* __SOUND_PCXHR_H */
sound/pci/pcxhr/pcxhr_core.c
浏览文件 @
a9c3c7e0
此差异已折叠。
点击以展开。
sound/pci/pcxhr/pcxhr_core.h
浏览文件 @
a9c3c7e0
...
...
@@ -65,7 +65,7 @@ enum {
CMD_RESYNC_AUDIO_INPUTS
,
/* cmd_len = 1 stat_len = 0 */
CMD_GET_DSP_RESOURCES
,
/* cmd_len = 1 stat_len = 4 */
CMD_SET_TIMER_INTERRUPT
,
/* cmd_len = 1 stat_len = 0 */
CMD_RES_PIPE
,
/* cmd_len
=
2 stat_len = 0 */
CMD_RES_PIPE
,
/* cmd_len
>=
2 stat_len = 0 */
CMD_FREE_PIPE
,
/* cmd_len = 1 stat_len = 0 */
CMD_CONF_PIPE
,
/* cmd_len = 2 stat_len = 0 */
CMD_STOP_PIPE
,
/* cmd_len = 1 stat_len = 0 */
...
...
@@ -96,6 +96,8 @@ void pcxhr_init_rmh(struct pcxhr_rmh *rmh, int cmd);
void
pcxhr_set_pipe_cmd_params
(
struct
pcxhr_rmh
*
rmh
,
int
capture
,
unsigned
int
param1
,
unsigned
int
param2
,
unsigned
int
param3
);
#define DSP_EXT_CMD_SET(x) (x->dsp_version > 0x012800)
/*
send the rmh
*/
...
...
@@ -110,6 +112,7 @@ int pcxhr_send_msg(struct pcxhr_mgr *mgr, struct pcxhr_rmh *rmh);
#define IO_NUM_REG_STATUS 5
#define IO_NUM_REG_CUER 10
#define IO_NUM_UER_CHIP_REG 11
#define IO_NUM_REG_CONFIG_SRC 12
#define IO_NUM_REG_OUT_ANA_LEVEL 20
#define IO_NUM_REG_IN_ANA_LEVEL 21
...
...
sound/pci/pcxhr/pcxhr_hwdep.c
浏览文件 @
a9c3c7e0
...
...
@@ -31,6 +31,7 @@
#include "pcxhr_mixer.h"
#include "pcxhr_hwdep.h"
#include "pcxhr_core.h"
#include "pcxhr_mix22.h"
#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
...
...
@@ -40,10 +41,10 @@
#endif
static
int
pcxhr_sub_init
(
struct
pcxhr_mgr
*
mgr
);
/*
* get basic information and init pcxhr card
*/
static
int
pcxhr_init_board
(
struct
pcxhr_mgr
*
mgr
)
{
int
err
;
...
...
@@ -68,7 +69,7 @@ static int pcxhr_init_board(struct pcxhr_mgr *mgr)
if
((
rmh
.
stat
[
0
]
&
MASK_FIRST_FIELD
)
!=
mgr
->
playback_chips
*
2
)
return
-
EINVAL
;
/* test 8 or 2 phys in */
if
(((
rmh
.
stat
[
0
]
>>
(
2
*
FIELD_SIZE
))
&
MASK_FIRST_FIELD
)
!=
if
(((
rmh
.
stat
[
0
]
>>
(
2
*
FIELD_SIZE
))
&
MASK_FIRST_FIELD
)
<
mgr
->
capture_chips
*
2
)
return
-
EINVAL
;
/* test max nb substream per board */
...
...
@@ -77,20 +78,34 @@ static int pcxhr_init_board(struct pcxhr_mgr *mgr)
/* test max nb substream per pipe */
if
(((
rmh
.
stat
[
1
]
>>
7
)
&
0x5F
)
<
PCXHR_PLAYBACK_STREAMS
)
return
-
EINVAL
;
snd_printdd
(
"supported formats : playback=%x capture=%x
\n
"
,
rmh
.
stat
[
2
],
rmh
.
stat
[
3
]);
pcxhr_init_rmh
(
&
rmh
,
CMD_VERSION
);
/* firmware num for DSP */
rmh
.
cmd
[
0
]
|=
mgr
->
firmware_num
;
/* transfer granularity in samples (should be multiple of 48) */
rmh
.
cmd
[
1
]
=
(
1
<<
23
)
+
PCXHR_GRANULARITY
;
rmh
.
cmd
[
1
]
=
(
1
<<
23
)
+
mgr
->
granularity
;
rmh
.
cmd_len
=
2
;
err
=
pcxhr_send_msg
(
mgr
,
&
rmh
);
if
(
err
)
return
err
;
snd_printdd
(
"PCXHR DSP version is %d.%d.%d
\n
"
,
(
rmh
.
stat
[
0
]
>>
16
)
&
0xff
,
(
rmh
.
stat
[
0
]
>>
8
)
&
0xff
,
rmh
.
stat
[
0
]
&
0xff
);
snd_printdd
(
"PCXHR DSP version is %d.%d.%d
\n
"
,
(
rmh
.
stat
[
0
]
>>
16
)
&
0xff
,
(
rmh
.
stat
[
0
]
>>
8
)
&
0xff
,
rmh
.
stat
[
0
]
&
0xff
);
mgr
->
dsp_version
=
rmh
.
stat
[
0
];
if
(
mgr
->
is_hr_stereo
)
err
=
hr222_sub_init
(
mgr
);
else
err
=
pcxhr_sub_init
(
mgr
);
return
err
;
}
static
int
pcxhr_sub_init
(
struct
pcxhr_mgr
*
mgr
)
{
int
err
;
struct
pcxhr_rmh
rmh
;
/* get options */
pcxhr_init_rmh
(
&
rmh
,
CMD_ACCESS_IO_READ
);
rmh
.
cmd
[
0
]
|=
IO_NUM_REG_STATUS
;
...
...
@@ -100,20 +115,22 @@ static int pcxhr_init_board(struct pcxhr_mgr *mgr)
if
(
err
)
return
err
;
if
((
rmh
.
stat
[
1
]
&
REG_STATUS_OPT_DAUGHTER_MASK
)
==
REG_STATUS_OPT_ANALOG_BOARD
)
mgr
->
board_has_analog
=
1
;
/* analog addon board available */
else
/* analog addon board not available -> no support for instance */
return
-
EINVAL
;
if
((
rmh
.
stat
[
1
]
&
REG_STATUS_OPT_DAUGHTER_MASK
)
==
REG_STATUS_OPT_ANALOG_BOARD
)
mgr
->
board_has_analog
=
1
;
/* analog addon board found */
/* unmute inputs */
err
=
pcxhr_write_io_num_reg_cont
(
mgr
,
REG_CONT_UNMUTE_INPUTS
,
REG_CONT_UNMUTE_INPUTS
,
NULL
);
if
(
err
)
return
err
;
/* unmute outputs */
pcxhr_init_rmh
(
&
rmh
,
CMD_ACCESS_IO_READ
);
/* a write to IO_NUM_REG_MUTE_OUT mutes! */
/* unmute outputs
(a write to IO_NUM_REG_MUTE_OUT mutes!)
*/
pcxhr_init_rmh
(
&
rmh
,
CMD_ACCESS_IO_READ
);
rmh
.
cmd
[
0
]
|=
IO_NUM_REG_MUTE_OUT
;
if
(
DSP_EXT_CMD_SET
(
mgr
))
{
rmh
.
cmd
[
1
]
=
1
;
/* unmute digital plugs */
rmh
.
cmd_len
=
2
;
}
err
=
pcxhr_send_msg
(
mgr
,
&
rmh
);
return
err
;
}
...
...
@@ -124,19 +141,25 @@ void pcxhr_reset_board(struct pcxhr_mgr *mgr)
if
(
mgr
->
dsp_loaded
&
(
1
<<
PCXHR_FIRMWARE_DSP_MAIN_INDEX
))
{
/* mute outputs */
if
(
!
mgr
->
is_hr_stereo
)
{
/* a read to IO_NUM_REG_MUTE_OUT register unmutes! */
pcxhr_init_rmh
(
&
rmh
,
CMD_ACCESS_IO_WRITE
);
rmh
.
cmd
[
0
]
|=
IO_NUM_REG_MUTE_OUT
;
pcxhr_send_msg
(
mgr
,
&
rmh
);
/* mute inputs */
pcxhr_write_io_num_reg_cont
(
mgr
,
REG_CONT_UNMUTE_INPUTS
,
0
,
NULL
);
pcxhr_write_io_num_reg_cont
(
mgr
,
REG_CONT_UNMUTE_INPUTS
,
0
,
NULL
);
}
/* stereo cards mute with reset of dsp */
}
/* reset pcxhr dsp */
if
(
mgr
->
dsp_loaded
&
(
1
<<
PCXHR_FIRMWARE_DSP_EPRM_INDEX
))
if
(
mgr
->
dsp_loaded
&
(
1
<<
PCXHR_FIRMWARE_DSP_EPRM_INDEX
))
pcxhr_reset_dsp
(
mgr
);
/* reset second xilinx */
if
(
mgr
->
dsp_loaded
&
(
1
<<
PCXHR_FIRMWARE_XLX_COM_INDEX
))
if
(
mgr
->
dsp_loaded
&
(
1
<<
PCXHR_FIRMWARE_XLX_COM_INDEX
))
{
pcxhr_reset_xilinx_com
(
mgr
);
mgr
->
dsp_loaded
=
1
;
}
return
;
}
...
...
@@ -144,8 +167,9 @@ void pcxhr_reset_board(struct pcxhr_mgr *mgr)
/*
* allocate a playback/capture pipe (pcmp0/pcmc0)
*/
static
int
pcxhr_dsp_allocate_pipe
(
struct
pcxhr_mgr
*
mgr
,
struct
pcxhr_pipe
*
pipe
,
int
is_capture
,
int
pin
)
static
int
pcxhr_dsp_allocate_pipe
(
struct
pcxhr_mgr
*
mgr
,
struct
pcxhr_pipe
*
pipe
,
int
is_capture
,
int
pin
)
{
int
stream_count
,
audio_count
;
int
err
;
...
...
@@ -161,15 +185,23 @@ static int pcxhr_dsp_allocate_pipe( struct pcxhr_mgr *mgr, struct pcxhr_pipe *pi
stream_count
=
PCXHR_PLAYBACK_STREAMS
;
audio_count
=
2
;
/* always stereo */
}
snd_printdd
(
"snd_add_ref_pipe pin(%d) pcm%c0
\n
"
,
pin
,
is_capture
?
'c'
:
'p'
);
snd_printdd
(
"snd_add_ref_pipe pin(%d) pcm%c0
\n
"
,
pin
,
is_capture
?
'c'
:
'p'
);
pipe
->
is_capture
=
is_capture
;
pipe
->
first_audio
=
pin
;
/* define pipe (P_PCM_ONLY_MASK (0x020000) is not necessary) */
pcxhr_init_rmh
(
&
rmh
,
CMD_RES_PIPE
);
pcxhr_set_pipe_cmd_params
(
&
rmh
,
is_capture
,
pin
,
audio_count
,
stream_count
);
pcxhr_set_pipe_cmd_params
(
&
rmh
,
is_capture
,
pin
,
audio_count
,
stream_count
);
rmh
.
cmd
[
1
]
|=
0x020000
;
/* add P_PCM_ONLY_MASK */
if
(
DSP_EXT_CMD_SET
(
mgr
))
{
/* add channel mask to command */
rmh
.
cmd
[
rmh
.
cmd_len
++
]
=
(
audio_count
==
1
)
?
0x01
:
0x03
;
}
err
=
pcxhr_send_msg
(
mgr
,
&
rmh
);
if
(
err
<
0
)
{
snd_printk
(
KERN_ERR
"error pipe allocation (CMD_RES_PIPE) err=%x!
\n
"
,
err
);
snd_printk
(
KERN_ERR
"error pipe allocation "
"(CMD_RES_PIPE) err=%x!
\n
"
,
err
);
return
err
;
}
pipe
->
status
=
PCXHR_PIPE_DEFINED
;
...
...
@@ -199,10 +231,12 @@ static int pcxhr_dsp_free_pipe( struct pcxhr_mgr *mgr, struct pcxhr_pipe *pipe)
snd_printk(KERN_ERR "error stopping pipe!\n");
/* release the pipe */
pcxhr_init_rmh(&rmh, CMD_FREE_PIPE);
pcxhr_set_pipe_cmd_params(&rmh, pipe->is_capture, pipe->first_audio, 0, 0);
pcxhr_set_pipe_cmd_params(&rmh, pipe->is_capture, pipe->first_audio,
0, 0);
err = pcxhr_send_msg(mgr, &rmh);
if (err < 0)
snd_printk(KERN_ERR "error pipe release (CMD_FREE_PIPE) err(%x)\n", err);
snd_printk(KERN_ERR "error pipe release "
"(CMD_FREE_PIPE) err(%x)\n", err);
pipe->status = PCXHR_PIPE_UNDEFINED;
return err;
}
...
...
@@ -248,15 +282,16 @@ static int pcxhr_start_pipes(struct pcxhr_mgr *mgr)
for
(
i
=
0
;
i
<
mgr
->
num_cards
;
i
++
)
{
chip
=
mgr
->
chip
[
i
];
if
(
chip
->
nb_streams_play
)
playback_mask
|=
(
1
<<
chip
->
playback_pipe
.
first_audio
)
;
playback_mask
|=
1
<<
chip
->
playback_pipe
.
first_audio
;
for
(
j
=
0
;
j
<
chip
->
nb_streams_capt
;
j
++
)
capture_mask
|=
(
1
<<
chip
->
capture_pipe
[
j
].
first_audio
)
;
capture_mask
|=
1
<<
chip
->
capture_pipe
[
j
].
first_audio
;
}
return
pcxhr_set_pipe_state
(
mgr
,
playback_mask
,
capture_mask
,
1
);
}
static
int
pcxhr_dsp_load
(
struct
pcxhr_mgr
*
mgr
,
int
index
,
const
struct
firmware
*
dsp
)
static
int
pcxhr_dsp_load
(
struct
pcxhr_mgr
*
mgr
,
int
index
,
const
struct
firmware
*
dsp
)
{
int
err
,
card_index
;
...
...
@@ -330,22 +365,33 @@ static int pcxhr_dsp_load(struct pcxhr_mgr *mgr, int index, const struct firmwar
int
pcxhr_setup_firmware
(
struct
pcxhr_mgr
*
mgr
)
{
static
char
*
fw_files
[
5
]
=
{
"xi_1_882.dat"
,
"xc_1_882.dat"
,
"e321_512.e56"
,
"b321_512.b56"
,
"d321_512.d56"
static
char
*
fw_files
[][
5
]
=
{
[
0
]
=
{
"xlxint.dat"
,
"xlxc882hr.dat"
,
"dspe882.e56"
,
"dspb882hr.b56"
,
"dspd882.d56"
},
[
1
]
=
{
"xlxint.dat"
,
"xlxc882e.dat"
,
"dspe882.e56"
,
"dspb882e.b56"
,
"dspd882.d56"
},
[
2
]
=
{
"xlxint.dat"
,
"xlxc1222hr.dat"
,
"dspe882.e56"
,
"dspb1222hr.b56"
,
"dspd1222.d56"
},
[
3
]
=
{
"xlxint.dat"
,
"xlxc1222e.dat"
,
"dspe882.e56"
,
"dspb1222e.b56"
,
"dspd1222.d56"
},
[
4
]
=
{
NULL
,
"xlxc222.dat"
,
"dspe924.e56"
,
"dspb924.b56"
,
"dspd222.d56"
},
[
5
]
=
{
NULL
,
"xlxc924.dat"
,
"dspe924.e56"
,
"dspb924.b56"
,
"dspd222.d56"
},
};
char
path
[
32
];
const
struct
firmware
*
fw_entry
;
int
i
,
err
;
int
fw_set
=
mgr
->
fw_file_set
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
fw_files
);
i
++
)
{
sprintf
(
path
,
"pcxhr/%s"
,
fw_files
[
i
]);
for
(
i
=
0
;
i
<
5
;
i
++
)
{
if
(
!
fw_files
[
fw_set
][
i
])
continue
;
sprintf
(
path
,
"pcxhr/%s"
,
fw_files
[
fw_set
][
i
]);
if
(
request_firmware
(
&
fw_entry
,
path
,
&
mgr
->
pci
->
dev
))
{
snd_printk
(
KERN_ERR
"pcxhr: can't load firmware %s
\n
"
,
path
);
snd_printk
(
KERN_ERR
"pcxhr: can't load firmware %s
\n
"
,
path
);
return
-
ENOENT
;
}
/* fake hwdep dsp record */
...
...
@@ -358,11 +404,26 @@ int pcxhr_setup_firmware(struct pcxhr_mgr *mgr)
return
0
;
}
MODULE_FIRMWARE
(
"pcxhr/xi_1_882.dat"
);
MODULE_FIRMWARE
(
"pcxhr/xc_1_882.dat"
);
MODULE_FIRMWARE
(
"pcxhr/e321_512.e56"
);
MODULE_FIRMWARE
(
"pcxhr/b321_512.b56"
);
MODULE_FIRMWARE
(
"pcxhr/d321_512.d56"
);
MODULE_FIRMWARE
(
"pcxhr/xlxint.dat"
);
MODULE_FIRMWARE
(
"pcxhr/xlxc882hr.dat"
);
MODULE_FIRMWARE
(
"pcxhr/xlxc882e.dat"
);
MODULE_FIRMWARE
(
"pcxhr/dspe882.e56"
);
MODULE_FIRMWARE
(
"pcxhr/dspb882hr.b56"
);
MODULE_FIRMWARE
(
"pcxhr/dspb882e.b56"
);
MODULE_FIRMWARE
(
"pcxhr/dspd882.d56"
);
MODULE_FIRMWARE
(
"pcxhr/xlxc1222hr.dat"
);
MODULE_FIRMWARE
(
"pcxhr/xlxc1222e.dat"
);
MODULE_FIRMWARE
(
"pcxhr/dspb1222hr.b56"
);
MODULE_FIRMWARE
(
"pcxhr/dspb1222e.b56"
);
MODULE_FIRMWARE
(
"pcxhr/dspd1222.d56"
);
MODULE_FIRMWARE
(
"pcxhr/xlxc222.dat"
);
MODULE_FIRMWARE
(
"pcxhr/xlxc924.dat"
);
MODULE_FIRMWARE
(
"pcxhr/dspe924.e56"
);
MODULE_FIRMWARE
(
"pcxhr/dspb924.b56"
);
MODULE_FIRMWARE
(
"pcxhr/dspd222.d56"
);
#else
/* old style firmware loading */
...
...
@@ -373,7 +434,8 @@ MODULE_FIRMWARE("pcxhr/d321_512.d56");
static
int
pcxhr_hwdep_dsp_status
(
struct
snd_hwdep
*
hw
,
struct
snd_hwdep_dsp_status
*
info
)
{
strcpy
(
info
->
id
,
"pcxhr"
);
struct
pcxhr_mgr
*
mgr
=
hw
->
private_data
;
sprintf
(
info
->
id
,
"pcxhr%d"
,
mgr
->
fw_file_set
);
info
->
num_dsps
=
PCXHR_FIRMWARE_FILES_MAX_INDEX
;
if
(
hw
->
dsp_loaded
&
(
1
<<
PCXHR_FIRMWARE_DSP_MAIN_INDEX
))
...
...
@@ -393,8 +455,8 @@ static int pcxhr_hwdep_dsp_load(struct snd_hwdep *hw,
fw
.
size
=
dsp
->
length
;
fw
.
data
=
vmalloc
(
fw
.
size
);
if
(
!
fw
.
data
)
{
snd_printk
(
KERN_ERR
"pcxhr: cannot allocate dsp image
(%lu bytes)
\n
"
,
(
unsigned
long
)
fw
.
size
);
snd_printk
(
KERN_ERR
"pcxhr: cannot allocate dsp image
"
"(%lu bytes)
\n
"
,
(
unsigned
long
)
fw
.
size
);
return
-
ENOMEM
;
}
if
(
copy_from_user
((
void
*
)
fw
.
data
,
dsp
->
image
,
dsp
->
length
))
{
...
...
@@ -424,8 +486,11 @@ int pcxhr_setup_firmware(struct pcxhr_mgr *mgr)
int
err
;
struct
snd_hwdep
*
hw
;
/* only create hwdep interface for first cardX (see "index" module parameter)*/
if
((
err
=
snd_hwdep_new
(
mgr
->
chip
[
0
]
->
card
,
PCXHR_HWDEP_ID
,
0
,
&
hw
))
<
0
)
/* only create hwdep interface for first cardX
* (see "index" module parameter)
*/
err
=
snd_hwdep_new
(
mgr
->
chip
[
0
]
->
card
,
PCXHR_HWDEP_ID
,
0
,
&
hw
);
if
(
err
<
0
)
return
err
;
hw
->
iface
=
SNDRV_HWDEP_IFACE_PCXHR
;
...
...
@@ -435,10 +500,13 @@ int pcxhr_setup_firmware(struct pcxhr_mgr *mgr)
hw
->
ops
.
dsp_status
=
pcxhr_hwdep_dsp_status
;
hw
->
ops
.
dsp_load
=
pcxhr_hwdep_dsp_load
;
hw
->
exclusive
=
1
;
/* stereo cards don't need fw_file_0 -> dsp_loaded = 1 */
hw
->
dsp_loaded
=
mgr
->
is_hr_stereo
?
1
:
0
;
mgr
->
dsp_loaded
=
0
;
sprintf
(
hw
->
name
,
PCXHR_HWDEP_ID
);
if
((
err
=
snd_card_register
(
mgr
->
chip
[
0
]
->
card
))
<
0
)
err
=
snd_card_register
(
mgr
->
chip
[
0
]
->
card
);
if
(
err
<
0
)
return
err
;
return
0
;
}
...
...
sound/pci/pcxhr/pcxhr_mix22.c
0 → 100644
浏览文件 @
a9c3c7e0
此差异已折叠。
点击以展开。
sound/pci/pcxhr/pcxhr_mix22.h
0 → 100644
浏览文件 @
a9c3c7e0
/*
* Driver for Digigram pcxhr compatible soundcards
*
* low level interface with interrupt ans message handling
*
* Copyright (c) 2004 by Digigram <alsa@digigram.com>
*
* 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.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __SOUND_PCXHR_MIX22_H
#define __SOUND_PCXHR_MIX22_H
struct
pcxhr_mgr
;
int
hr222_sub_init
(
struct
pcxhr_mgr
*
mgr
);
int
hr222_sub_set_clock
(
struct
pcxhr_mgr
*
mgr
,
unsigned
int
rate
,
int
*
changed
);
int
hr222_get_external_clock
(
struct
pcxhr_mgr
*
mgr
,
enum
pcxhr_clock_type
clock_type
,
int
*
sample_rate
);
#define HR222_LINE_PLAYBACK_LEVEL_MIN 0
/* -25.5 dB */
#define HR222_LINE_PLAYBACK_ZERO_LEVEL 51
/* 0.0 dB */
#define HR222_LINE_PLAYBACK_LEVEL_MAX 99
/* +24.0 dB */
#define HR222_LINE_CAPTURE_LEVEL_MIN 0
/* -111.5 dB */
#define HR222_LINE_CAPTURE_ZERO_LEVEL 223
/* 0.0 dB */
#define HR222_LINE_CAPTURE_LEVEL_MAX 255
/* +16 dB */
#define HR222_MICRO_CAPTURE_LEVEL_MIN 0
/* -98.5 dB */
#define HR222_MICRO_CAPTURE_LEVEL_MAX 210
/* +6.5 dB */
int
hr222_update_analog_audio_level
(
struct
snd_pcxhr
*
chip
,
int
is_capture
,
int
channel
);
int
hr222_set_audio_source
(
struct
snd_pcxhr
*
chip
);
int
hr222_iec958_capture_byte
(
struct
snd_pcxhr
*
chip
,
int
aes_idx
,
unsigned
char
*
aes_bits
);
int
hr222_iec958_update_byte
(
struct
snd_pcxhr
*
chip
,
int
aes_idx
,
unsigned
char
aes_bits
);
int
hr222_add_mic_controls
(
struct
snd_pcxhr
*
chip
);
#endif
/* __SOUND_PCXHR_MIX22_H */
sound/pci/pcxhr/pcxhr_mixer.c
浏览文件 @
a9c3c7e0
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录