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
Kirill Smelkov
linux
Commits
5b56eec7
Commit
5b56eec7
authored
Mar 24, 2009
by
Takashi Iwai
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'topic/jack' into for-linus
parents
c2f43981
662c319a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
24 deletions
+30
-24
Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl
Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl
+3
-0
include/linux/input.h
include/linux/input.h
+1
-0
include/sound/jack.h
include/sound/jack.h
+5
-0
sound/core/jack.c
sound/core/jack.c
+21
-24
No files found.
Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl
View file @
5b56eec7
...
@@ -88,6 +88,9 @@
...
@@ -88,6 +88,9 @@
<chapter><title>
Miscellaneous Functions
</title>
<chapter><title>
Miscellaneous Functions
</title>
<sect1><title>
Hardware-Dependent Devices API
</title>
<sect1><title>
Hardware-Dependent Devices API
</title>
!Esound/core/hwdep.c
!Esound/core/hwdep.c
</sect1>
<sect1><title>
Jack Abstraction Layer API
</title>
!Esound/core/jack.c
</sect1>
</sect1>
<sect1><title>
ISA DMA Helpers
</title>
<sect1><title>
ISA DMA Helpers
</title>
!Esound/core/isadma.c
!Esound/core/isadma.c
...
...
include/linux/input.h
View file @
5b56eec7
...
@@ -661,6 +661,7 @@ struct input_absinfo {
...
@@ -661,6 +661,7 @@ struct input_absinfo {
#define SW_DOCK 0x05
/* set = plugged into dock */
#define SW_DOCK 0x05
/* set = plugged into dock */
#define SW_LINEOUT_INSERT 0x06
/* set = inserted */
#define SW_LINEOUT_INSERT 0x06
/* set = inserted */
#define SW_JACK_PHYSICAL_INSERT 0x07
/* set = mechanical switch set */
#define SW_JACK_PHYSICAL_INSERT 0x07
/* set = mechanical switch set */
#define SW_VIDEOOUT_INSERT 0x08
/* set = inserted */
#define SW_MAX 0x0f
#define SW_MAX 0x0f
#define SW_CNT (SW_MAX+1)
#define SW_CNT (SW_MAX+1)
...
...
include/sound/jack.h
View file @
5b56eec7
...
@@ -30,6 +30,9 @@ struct input_dev;
...
@@ -30,6 +30,9 @@ struct input_dev;
/**
/**
* Jack types which can be reported. These values are used as a
* Jack types which can be reported. These values are used as a
* bitmask.
* bitmask.
*
* Note that this must be kept in sync with the lookup table in
* sound/core/jack.c.
*/
*/
enum
snd_jack_types
{
enum
snd_jack_types
{
SND_JACK_HEADPHONE
=
0x0001
,
SND_JACK_HEADPHONE
=
0x0001
,
...
@@ -37,6 +40,8 @@ enum snd_jack_types {
...
@@ -37,6 +40,8 @@ enum snd_jack_types {
SND_JACK_HEADSET
=
SND_JACK_HEADPHONE
|
SND_JACK_MICROPHONE
,
SND_JACK_HEADSET
=
SND_JACK_HEADPHONE
|
SND_JACK_MICROPHONE
,
SND_JACK_LINEOUT
=
0x0004
,
SND_JACK_LINEOUT
=
0x0004
,
SND_JACK_MECHANICAL
=
0x0008
,
/* If detected separately */
SND_JACK_MECHANICAL
=
0x0008
,
/* If detected separately */
SND_JACK_VIDEOOUT
=
0x0010
,
SND_JACK_AVOUT
=
SND_JACK_LINEOUT
|
SND_JACK_VIDEOOUT
,
};
};
struct
snd_jack
{
struct
snd_jack
{
...
...
sound/core/jack.c
View file @
5b56eec7
...
@@ -23,6 +23,14 @@
...
@@ -23,6 +23,14 @@
#include <sound/jack.h>
#include <sound/jack.h>
#include <sound/core.h>
#include <sound/core.h>
static
int
jack_types
[]
=
{
SW_HEADPHONE_INSERT
,
SW_MICROPHONE_INSERT
,
SW_LINEOUT_INSERT
,
SW_JACK_PHYSICAL_INSERT
,
SW_VIDEOOUT_INSERT
,
};
static
int
snd_jack_dev_free
(
struct
snd_device
*
device
)
static
int
snd_jack_dev_free
(
struct
snd_device
*
device
)
{
{
struct
snd_jack
*
jack
=
device
->
device_data
;
struct
snd_jack
*
jack
=
device
->
device_data
;
...
@@ -79,6 +87,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
...
@@ -79,6 +87,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
{
{
struct
snd_jack
*
jack
;
struct
snd_jack
*
jack
;
int
err
;
int
err
;
int
i
;
static
struct
snd_device_ops
ops
=
{
static
struct
snd_device_ops
ops
=
{
.
dev_free
=
snd_jack_dev_free
,
.
dev_free
=
snd_jack_dev_free
,
.
dev_register
=
snd_jack_dev_register
,
.
dev_register
=
snd_jack_dev_register
,
...
@@ -100,18 +109,10 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
...
@@ -100,18 +109,10 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
jack
->
type
=
type
;
jack
->
type
=
type
;
if
(
type
&
SND_JACK_HEADPHONE
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
jack_types
);
i
++
)
input_set_capability
(
jack
->
input_dev
,
EV_SW
,
if
(
type
&
(
1
<<
i
))
SW_HEADPHONE_INSERT
);
input_set_capability
(
jack
->
input_dev
,
EV_SW
,
if
(
type
&
SND_JACK_LINEOUT
)
jack_types
[
i
]);
input_set_capability
(
jack
->
input_dev
,
EV_SW
,
SW_LINEOUT_INSERT
);
if
(
type
&
SND_JACK_MICROPHONE
)
input_set_capability
(
jack
->
input_dev
,
EV_SW
,
SW_MICROPHONE_INSERT
);
if
(
type
&
SND_JACK_MECHANICAL
)
input_set_capability
(
jack
->
input_dev
,
EV_SW
,
SW_JACK_PHYSICAL_INSERT
);
err
=
snd_device_new
(
card
,
SNDRV_DEV_JACK
,
jack
,
&
ops
);
err
=
snd_device_new
(
card
,
SNDRV_DEV_JACK
,
jack
,
&
ops
);
if
(
err
<
0
)
if
(
err
<
0
)
...
@@ -154,21 +155,17 @@ EXPORT_SYMBOL(snd_jack_set_parent);
...
@@ -154,21 +155,17 @@ EXPORT_SYMBOL(snd_jack_set_parent);
*/
*/
void
snd_jack_report
(
struct
snd_jack
*
jack
,
int
status
)
void
snd_jack_report
(
struct
snd_jack
*
jack
,
int
status
)
{
{
int
i
;
if
(
!
jack
)
if
(
!
jack
)
return
;
return
;
if
(
jack
->
type
&
SND_JACK_HEADPHONE
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
jack_types
);
i
++
)
{
input_report_switch
(
jack
->
input_dev
,
SW_HEADPHONE_INSERT
,
int
testbit
=
1
<<
i
;
status
&
SND_JACK_HEADPHONE
);
if
(
jack
->
type
&
testbit
)
if
(
jack
->
type
&
SND_JACK_LINEOUT
)
input_report_switch
(
jack
->
input_dev
,
jack_types
[
i
],
input_report_switch
(
jack
->
input_dev
,
SW_LINEOUT_INSERT
,
status
&
testbit
);
status
&
SND_JACK_LINEOUT
);
}
if
(
jack
->
type
&
SND_JACK_MICROPHONE
)
input_report_switch
(
jack
->
input_dev
,
SW_MICROPHONE_INSERT
,
status
&
SND_JACK_MICROPHONE
);
if
(
jack
->
type
&
SND_JACK_MECHANICAL
)
input_report_switch
(
jack
->
input_dev
,
SW_JACK_PHYSICAL_INSERT
,
status
&
SND_JACK_MECHANICAL
);
input_sync
(
jack
->
input_dev
);
input_sync
(
jack
->
input_dev
);
}
}
...
...
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