From: Matthew Ranostay <mranostay@embeddedalley.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: Re: [PATCH] hda: add support for jack detection on IDT/Sigmatel
Date: Wed, 15 Oct 2008 11:19:10 -0400 [thread overview]
Message-ID: <48F609EE.1040908@embeddedalley.com> (raw)
In-Reply-To: <s5hvdvtzytl.wl%tiwai@suse.de>
Takashi Iwai wrote:
> At Wed, 15 Oct 2008 10:43:28 -0400,
> Matthew Ranostay wrote:
>> diff --git a/core/jack.c b/core/jack.c
>> index 8133a2b..7a5b07b 100644
>> --- a/core/jack.c
>> +++ b/core/jack.c
>> @@ -95,7 +95,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
>> goto fail_input;
>> }
>>
>> - jack->input_dev->phys = "ALSA";
>> + jack->input_dev->phys = "ALSA Jack Detection";
>
> Any reason to change?
>
> Well, I think even the original phys value "ALSA" is a bit strange in
> comparison with values of other input drivers, such as
> "isa0060/serio0/input0", "PNP0C0C/button/input0", too...
> Mark, what do you think?
>
>
>> jack->type = type;
>>
>> diff --git a/pci/Kconfig b/pci/Kconfig
>> index 7003711..7e40890 100644
>> --- a/pci/Kconfig
>> +++ b/pci/Kconfig
>> @@ -501,6 +501,7 @@ config SND_HDA_INTEL
>> tristate "Intel HD Audio"
>> select SND_PCM
>> select SND_VMASTER
>> + select SND_JACK if INPUT=y || INPUT=SND
>> help
>> Say Y here to include support for Intel "High Definition
>> Audio" (Azalia) motherboard devices.
>> diff --git a/pci/hda/hda_codec.h b/pci/hda/hda_codec.h
>> index 60468f5..93dc961 100644
>> --- a/pci/hda/hda_codec.h
>> +++ b/pci/hda/hda_codec.h
>> @@ -729,6 +729,9 @@ struct hda_codec {
>>
>> struct snd_hwdep *hwdep; /* assigned hwdep device */
>>
>> + /* jack detection */
>> + struct snd_jack *jack;
>> +
>> /* misc flags */
>> unsigned int spdif_status_reset :1; /* needs to toggle SPDIF for each
>> * status change
>
> Does this have to be in hda_codec core now? Maybe later, but I feel
> it's too early to change the core side unless you really need it.
> Note that you may have multiple headphone, mic, line-in and whatever
> jacks. So, if any, it should be either an array or a list as a more
> generic representation.
>
> And, if you add struct snd_jack there, include <sound/jack.h> in that
> header, or add a forward declaration of the struct.
>
>
>> diff --git a/pci/hda/hda_proc.c b/pci/hda/hda_proc.c
>> index 743d779..e07652a 100644
>> --- a/pci/hda/hda_proc.c
>> +++ b/pci/hda/hda_proc.c
>> @@ -425,6 +425,22 @@ static void print_unsol_cap(struct snd_info_buffer *buffer,
>> (unsol & AC_UNSOL_ENABLED) ? 1 : 0);
>> }
>>
>> +static void print_presence_cap(struct snd_info_buffer *buffer,
>> + struct hda_codec *codec, hda_nid_t nid)
>> +{
>> + int presence = snd_hda_codec_read(codec, nid, 0,
>> + AC_VERB_GET_PIN_SENSE, 0);
>> + int def_conf = snd_hda_codec_read(codec, nid, 0,
>> + AC_VERB_GET_CONFIG_DEFAULT, 0x00);
>> + def_conf = get_defcfg_connect(def_conf);
>> + if (def_conf && def_conf != AC_JACK_PORT_FIXED)
>> + return;
>> + snd_iprintf(buffer,
>> + " Jack Presence: %s\n",
>> + (presence & AC_PINSENSE_PRESENCE)
>> + ? "Plugged in" : "Unplugged");
>> +}
>> +
>> static void print_proc_caps(struct snd_info_buffer *buffer,
>> struct hda_codec *codec, hda_nid_t nid)
>> {
>> @@ -552,6 +568,9 @@ static void print_codec_info(struct snd_info_entry *entry,
>> AC_PAR_AUDIO_WIDGET_CAP);
>> unsigned int wid_type =
>> (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
>> + unsigned int pincap = snd_hda_param_read(codec, nid,
>> + AC_PAR_PIN_CAP);
>> +
>> hda_nid_t conn[HDA_MAX_CONNECTIONS];
>> int conn_len = 0;
>>
>> @@ -632,6 +651,9 @@ static void print_codec_info(struct snd_info_entry *entry,
>> if (wid_caps & AC_WCAP_UNSOL_CAP)
>> print_unsol_cap(buffer, codec, nid);
>>
>> + if (pincap & AC_PINCAP_PRES_DETECT)
>> + print_presence_cap(buffer, codec, nid);
>> +
>> if (wid_caps & AC_WCAP_POWER)
>> print_power_state(buffer, codec, nid);
>
> Sorry, I don't want to put this into proc file. In some obscure
> hardwares, you can't call jack-detect verb always even if the pin
> shows it's possible, and it breaks the later jack-sense reading
> (believe nor not :) In some cases, it needs triggering.
> So, "just read" is dangerous.
So what is the safest way to report the initial state of the jacks then?
>
> BTW, this change has nothing to do with the addition of jack layer
> support. If this addition is inevitably necessary, please split to an
> individual patch.
>
>
> Thanks,
>
> Takashi
>
next prev parent reply other threads:[~2008-10-15 15:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-15 14:43 [PATCH] hda: add support for jack detection on IDT/Sigmatel Matthew Ranostay
2008-10-15 15:02 ` Takashi Iwai
2008-10-15 15:19 ` Matthew Ranostay [this message]
2008-10-15 15:35 ` Takashi Iwai
2008-10-15 15:32 ` Mark Brown
2008-10-15 15:44 ` Mark Brown
2008-10-15 15:45 ` Matthew Ranostay
2008-10-15 15:47 ` Takashi Iwai
-- strict thread matches above, loose matches on Subject: below --
2008-10-15 18:45 Matthew Ranostay
2008-10-16 6:54 ` Takashi Iwai
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=48F609EE.1040908@embeddedalley.com \
--to=mranostay@embeddedalley.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--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 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.