Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
30ede1b9
Commit
30ede1b9
authored
Feb 01, 2010
by
Takashi Iwai
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote branch 'alsa/devel' into topic/misc
parents
d0d2c38e
6123637f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
6 deletions
+40
-6
sound/core/control.c
sound/core/control.c
+4
-3
sound/core/pcm_native.c
sound/core/pcm_native.c
+36
-3
No files found.
sound/core/control.c
View file @
30ede1b9
...
@@ -238,6 +238,7 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol,
...
@@ -238,6 +238,7 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol,
(
ncontrol
->
access
&
(
SNDRV_CTL_ELEM_ACCESS_READWRITE
|
(
ncontrol
->
access
&
(
SNDRV_CTL_ELEM_ACCESS_READWRITE
|
SNDRV_CTL_ELEM_ACCESS_INACTIVE
|
SNDRV_CTL_ELEM_ACCESS_INACTIVE
|
SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE
|
SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE
|
SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND
|
SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK
));
SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK
));
kctl
.
info
=
ncontrol
->
info
;
kctl
.
info
=
ncontrol
->
info
;
kctl
.
get
=
ncontrol
->
get
;
kctl
.
get
=
ncontrol
->
get
;
...
@@ -1099,7 +1100,7 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file,
...
@@ -1099,7 +1100,7 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file,
if
(
copy_from_user
(
&
tlv
,
_tlv
,
sizeof
(
tlv
)))
if
(
copy_from_user
(
&
tlv
,
_tlv
,
sizeof
(
tlv
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
tlv
.
length
<
sizeof
(
unsigned
int
)
*
3
)
if
(
tlv
.
length
<
sizeof
(
unsigned
int
)
*
2
)
return
-
EINVAL
;
return
-
EINVAL
;
down_read
(
&
card
->
controls_rwsem
);
down_read
(
&
card
->
controls_rwsem
);
kctl
=
snd_ctl_find_numid
(
card
,
tlv
.
numid
);
kctl
=
snd_ctl_find_numid
(
card
,
tlv
.
numid
);
...
...
sound/core/pcm_native.c
View file @
30ede1b9
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include <linux/pm_qos_params.h>
#include <linux/pm_qos_params.h>
#include <linux/uio.h>
#include <linux/uio.h>
#include <linux/dma-mapping.h>
#include <linux/dma-mapping.h>
#include <linux/math64.h>
#include <sound/core.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/control.h>
#include <sound/info.h>
#include <sound/info.h>
...
@@ -366,6 +367,38 @@ static int period_to_usecs(struct snd_pcm_runtime *runtime)
...
@@ -366,6 +367,38 @@ static int period_to_usecs(struct snd_pcm_runtime *runtime)
return
usecs
;
return
usecs
;
}
}
static
int
calc_boundary
(
struct
snd_pcm_runtime
*
runtime
)
{
u_int64_t
boundary
;
boundary
=
(
u_int64_t
)
runtime
->
buffer_size
*
(
u_int64_t
)
runtime
->
period_size
;
#if BITS_PER_LONG < 64
/* try to find lowest common multiple for buffer and period */
if
(
boundary
>
LONG_MAX
-
runtime
->
buffer_size
)
{
u_int32_t
remainder
=
-
1
;
u_int32_t
divident
=
runtime
->
buffer_size
;
u_int32_t
divisor
=
runtime
->
period_size
;
while
(
remainder
)
{
remainder
=
divident
%
divisor
;
if
(
remainder
)
{
divident
=
divisor
;
divisor
=
remainder
;
}
}
boundary
=
div_u64
(
boundary
,
divisor
);
if
(
boundary
>
LONG_MAX
-
runtime
->
buffer_size
)
return
-
ERANGE
;
}
#endif
if
(
boundary
==
0
)
return
-
ERANGE
;
runtime
->
boundary
=
boundary
;
while
(
runtime
->
boundary
*
2
<=
LONG_MAX
-
runtime
->
buffer_size
)
runtime
->
boundary
*=
2
;
return
0
;
}
static
int
snd_pcm_hw_params
(
struct
snd_pcm_substream
*
substream
,
static
int
snd_pcm_hw_params
(
struct
snd_pcm_substream
*
substream
,
struct
snd_pcm_hw_params
*
params
)
struct
snd_pcm_hw_params
*
params
)
{
{
...
@@ -441,9 +474,9 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
...
@@ -441,9 +474,9 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
runtime
->
stop_threshold
=
runtime
->
buffer_size
;
runtime
->
stop_threshold
=
runtime
->
buffer_size
;
runtime
->
silence_threshold
=
0
;
runtime
->
silence_threshold
=
0
;
runtime
->
silence_size
=
0
;
runtime
->
silence_size
=
0
;
runtime
->
boundary
=
runtime
->
buffer_size
;
err
=
calc_boundary
(
runtime
)
;
while
(
runtime
->
boundary
*
2
<=
LONG_MAX
-
runtime
->
buffer_size
)
if
(
err
<
0
)
runtime
->
boundary
*=
2
;
goto
_error
;
snd_pcm_timer_resolution_change
(
substream
);
snd_pcm_timer_resolution_change
(
substream
);
runtime
->
status
->
state
=
SNDRV_PCM_STATE_SETUP
;
runtime
->
status
->
state
=
SNDRV_PCM_STATE_SETUP
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment