From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Takashi Iwai <tiwai@suse.de>,
Dmitry Torokhov <dtor@insightbb.com>,
Jaroslav Kysela <perex@perex.cz>
Cc: alsa-devel@alsa-project.org, linux-input@vger.kernel.org,
Liam Girdwood <lg@opensource.wolfsonmicro.com>,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: [PATCH/RFC 2/2] Add microphone and headset reporting
Date: Thu, 29 May 2008 22:09:05 +0100 [thread overview]
Message-ID: <12120953452074-git-send-email-broonie@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1212095345928-git-send-email-broonie@opensource.wolfsonmicro.com>
Add a new switch type to the input API for reporting microphone
insertion and extend the ALSA jack reporting API to include this.
Since a headset is a combination of a microphone and at least a mono
headphone a convenience defintion is provided for describing them.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
include/linux/input.h | 1 +
include/sound/jack.h | 4 +++-
sound/core/jack.c | 6 ++++++
3 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/include/linux/input.h b/include/linux/input.h
index d8521c7..07593f2 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -612,6 +612,7 @@ struct input_absinfo {
#define SW_TABLET_MODE 0x01 /* set = tablet mode */
#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */
#define SW_RADIO 0x03 /* set = radio enabled */
+#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */
#define SW_MAX 0x0f
/*
diff --git a/include/sound/jack.h b/include/sound/jack.h
index e5ac26c..1e080c2 100644
--- a/include/sound/jack.h
+++ b/include/sound/jack.h
@@ -32,7 +32,9 @@ struct input_dev;
* bitmask.
*/
enum snd_jack_types {
- SND_JACK_HEADPHONE = 0x0001,
+ SND_JACK_HEADPHONE = 0x0001,
+ SND_JACK_MICROPHONE = 0x0002,
+ SND_JACK_HEADSET = 0x0003, /* Both microphone and headphone */
};
struct snd_jack {
diff --git a/sound/core/jack.c b/sound/core/jack.c
index 1a52997..f030be9 100644
--- a/sound/core/jack.c
+++ b/sound/core/jack.c
@@ -99,6 +99,9 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
if (type & SND_JACK_HEADPHONE)
input_set_capability(jack->input_dev, EV_SW,
SW_HEADPHONE_INSERT);
+ if (type & SND_JACK_MICROPHONE)
+ input_set_capability(jack->input_dev, EV_SW,
+ SW_MICROPHONE_INSERT);
err = snd_device_new(card, SNDRV_DEV_JACK, jack, &ops);
if (err < 0)
@@ -126,6 +129,9 @@ void snd_jack_report(struct snd_jack *jack, int status)
if (jack->type & SND_JACK_HEADPHONE)
input_report_switch(jack->input_dev, SW_HEADPHONE_INSERT,
status & SND_JACK_HEADPHONE);
+ if (jack->type & SND_JACK_MICROPHONE)
+ input_report_switch(jack->input_dev, SW_MICROPHONE_INSERT,
+ status & SND_JACK_MICROPHONE);
input_sync(jack->input_dev);
}
--
1.5.5.1
next prev parent reply other threads:[~2008-05-29 21:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-29 21:09 [PATCH/RFC 1/2] Add jack reporting API for ALSA Mark Brown
2008-05-29 21:09 ` Mark Brown [this message]
2008-05-30 8:15 ` Takashi Iwai
2008-05-30 10:15 ` Mark Brown
2008-06-03 10:40 ` Jack reporting v2 Mark Brown
2008-06-03 10:42 ` [PATCH 1/2] Add jack reporting API for ALSA Mark Brown
2008-06-03 10:42 ` [PATCH 2/2] Add microphone and headset reporting Mark Brown
2008-06-03 14:49 ` Jack reporting v2 Takashi Iwai
2008-06-03 15:36 ` Mark Brown
2008-06-03 15:17 ` Dmitry Torokhov
2008-06-03 23:38 ` Mark Brown
2008-06-06 14:23 ` Mark Brown
2008-07-01 9:24 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=12120953452074-git-send-email-broonie@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=dtor@insightbb.com \
--cc=lg@opensource.wolfsonmicro.com \
--cc=linux-input@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).