All of lore.kernel.org
 help / color / mirror / Atom feed
From: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	linux-input@vger.kernel.org
Subject: Re: Can a phone hook switch follow alsa jack model?
Date: Wed, 24 Jun 2009 15:28:11 +0200	[thread overview]
Message-ID: <4A4229EB.2090606@tis.icnet.pl> (raw)
In-Reply-To: <20090623222255.GA5617@sirena.org.uk>

Hi Mark,

Mark Brown wrote:
> On Tue, Jun 23, 2009 at 03:28:54PM +0200, Janusz Krzysztofik wrote:
>> However, I am not sure if the switch in question matches the alsa jack 
>> model closely enough. I see the switch usage not as simple as turning 
>> handset microphone/speaker on or off. It can be used for other purposes 
>> as well, like accepting a phone call or actually dialing a number that 
>> has been just typed in. Furthermore, it can be used to turn off a 
>> speakerphone function, while, in turn, the related handset 
>> microphone/speaker pair can be turned off not only with this switch, but 
>> with a handsfree button as well, for example.
> 
> That can all be accomodated within the ASoC jack framework (I'm assuming
> you'll be doing an ASoC rather than generic ALSA driver).

Right, thanks for pointing out the difference.

>  You get the
> input device just the same as you get with gpio-keys so you can do stuff
> in user space,

Yes, that was quite simple :). For now, I used SND_JACK_HEADSET report 
type. Don't you think that a new type like SND_JACK_PHONE_HOOK or 
SND_JACK_PHONE_HANDSET should be defined for the purpose? Even if 
HEADSET may not be very different from HANDSET, corresponding 
SW_HEADPHONE_INSERT and SW_MICROPHONE_INSERT event names seem have very 
little to do with picking up a phone.

> the main difference is that you can also arrange for some
> of the power management within ASoC to be hooked up with the jack
> automatically as well.
> 
> With what you're describing above I'd tie the mic and speaker in the
> headset to DAPM automatically.

OK, I'll try to follow your advice when I'm ready with a method of 
switching my microphones/speakers.

>> All that extra functionality looks like belonging to userspace rather 
>> then kernel, not like other alsa jack implementations that seem to do 
>> all the job of switching media paths inside the kernel. That is why I am 
>> not sure if the jack model is suitable for the purpose.
> 
> The switching in kernel for ASoC should generally be confined to marking
> outputs as powered or unpowered - things like marking a headphone jack
> as disabled when there's nothing plugged in to it that can be done
> unconditionally.  Everything else should get punted to user space.

So, if I want to follow the ASoC jack model, my in-kernel hook switch 
handler should only power on/off the handset, not touching the 
speakerphone at all. The latter should be controlled from userspace. 
Please correct me if I am missing something.

Thanks,
Janusz

  reply	other threads:[~2009-06-24 13:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-23 13:28 Can a phone hook switch follow alsa jack model? Janusz Krzysztofik
2009-06-23 22:22 ` Mark Brown
2009-06-24 13:28   ` Janusz Krzysztofik [this message]
2009-06-25 11:05     ` Mark Brown
2009-06-25 12:48       ` [alsa-devel] " Janusz Krzysztofik
2009-06-29 14:32         ` Mark Brown
2009-06-29 16:35           ` Janusz Krzysztofik
  -- strict thread matches above, loose matches on Subject: below --
2009-06-23 13:28 Janusz Krzysztofik

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=4A4229EB.2090606@tis.icnet.pl \
    --to=jkrzyszt@tis.icnet.pl \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.