alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* question on snd_soc_jack_report
@ 2011-01-14 11:40 Harsha, Priya
  2011-01-14 12:00 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Harsha, Priya @ 2011-01-14 11:40 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel@alsa-project.org

Hi,

I am using snd_soc_jack_report and I send the parameter as follows to report
headphones.

struct snd_soc_jack *soc_jack;
snd_soc_jack_report (soc_jack, SND_JACK_HEADPHONE, SND_JACK_HEADPHONE);

I don't find the reporting to be happening. When I looked at the snd_jack_report 
code, I found that jack->type needs to be set and that was not being set.
So when I added the following line in my code, it started reporting.
soc_jack->jack->type = SND_JACK_HEADPHONE;

Is it expected that the driver sets the 'type' of the instance of 'snd_jack' inside 
snd_soc_jack structure. I was actually thinking that snd_soc_jack_report would 
need to do this.

I did not find any other drivers doing that. Is there something that I am 
missing?

Also, to report button press events, I had to add the following line of code
soc_jack->jack->key[0] = BTN_0;
Is this also an expected thing to be set.

-Harsha

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: question on snd_soc_jack_report
  2011-01-14 11:40 question on snd_soc_jack_report Harsha, Priya
@ 2011-01-14 12:00 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2011-01-14 12:00 UTC (permalink / raw)
  To: Harsha, Priya; +Cc: alsa-devel@alsa-project.org

On Fri, Jan 14, 2011 at 05:10:01PM +0530, Harsha, Priya wrote:

> struct snd_soc_jack *soc_jack;
> snd_soc_jack_report (soc_jack, SND_JACK_HEADPHONE, SND_JACK_HEADPHONE);

> I don't find the reporting to be happening. When I looked at the snd_jack_report 
> code, I found that jack->type needs to be set and that was not being set.
> So when I added the following line in my code, it started reporting.
> soc_jack->jack->type = SND_JACK_HEADPHONE;

> Is it expected that the driver sets the 'type' of the instance of 'snd_jack' inside 
> snd_soc_jack structure. I was actually thinking that snd_soc_jack_report would 
> need to do this.

> I did not find any other drivers doing that. Is there something that I am 
> missing?

No, you should be passing the full set of capabilities for the jack in
when you call snd_soc_jack_new().  It's not possible to change the
capabilities dynamically at runtime, these need to be fixed when
registering the jack.

> Also, to report button press events, I had to add the following line of code
> soc_jack->jack->key[0] = BTN_0;
> Is this also an expected thing to be set.

You've not said where you did this but the API for configuring button
types is snd_jac_set_key().  BTN_0 should be being used as a default
when the jack is registered if nothing has been explicitly configured
(see snd_jack_register()).  If you're not specifying the capabilities as
your above issue suggests this won't happen.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-14 12:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-14 11:40 question on snd_soc_jack_report Harsha, Priya
2011-01-14 12:00 ` Mark Brown

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).