alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Raymond Yau <superquad.vortex2@gmail.com>
To: ALSA Development Mailing List <alsa-devel@alsa-project.org>,
	Maciej Rutecki <maciej.rutecki@gmail.com>,
	akashi Iwai <tiwai@suse.de>
Subject: Re: [RFC] hda - is_jack_detectable()
Date: Sun, 6 Nov 2011 19:46:01 +0800	[thread overview]
Message-ID: <CAN8cciaiRi79gKXe4MyYPosqA9Tv-fwkSSzG3Uouk3ocJUVa8w@mail.gmail.com> (raw)
In-Reply-To: <4EB05EA1.1060701@canonical.com>

[-- Attachment #1: Type: text/plain, Size: 1249 bytes --]

2011/11/2 David Henningsson <david.henningsson@canonical.com>:
> 2011-10-24 23:31, Raymond Yau skrev:
>>
> I also think it is a good idea, in fact I thought it was this way already.
> Can we merge this patch?
>
> // David
>

commit	729d55ba972348234759f8e40abf8de020f0d505

ALSA: hda - Disable tigger at pin-sensing on AD codecs


It is possible to measure the impedance of the jack with modification
of hda-jack-sense-test.py with ad1988

The headphone was plugged into grey jack since my computer chassis
only have AC97 front audio panel

The result seem close to my headset specification


Pin 0x11 Green HP Out (Ext Front): No jack detect capability
Pin 0x12 Green Line Out (Ext Rear): present = YES   impedance = 3776
Pin 0x14 Pink Mic (Ext Front): No jack detect capability
Pin 0x15 Blue Line In (Ext Rear): present = No
Pin 0x16 Black Line Out (Ext Rear): present = YES   impedance = 6080
Pin 0x17 Pink Mic (Ext Rear): present = YES   impedance = 1008
Pin 0x18 Black CD (Int ATAPI): No jack detect capability
Pin 0x1a Other (Int ATAPI): No jack detect capability
Pin 0x1b Other SPDIF Out (Ext Rear): No jack detect capability
Pin 0x24 Orange Line Out (Ext Rear): present = No
Pin 0x25 Grey Line Out (Ext Rear): present = YES   impedance = 25

[-- Attachment #2: hda-jack-sense-test.py --]
[-- Type: application/octet-stream, Size: 1880 bytes --]

#!/usr/bin/env python
#
# Written by David Henningsson, Copyright 2011 Canonical Ltd. 
# Licensed under GPLv2+

# the hda_codec.py file comes from Jaroslav Kysela's hda_analyzer program.
from hda_codec import *
import time

def parseoptions():
    from optparse import OptionParser
    parser = OptionParser()
    parser.add_option("-c", "--card", dest="cardindex", default=0, metavar="CARD",
        help="card index (as can be seen in /proc/asound/cards)")
    parser.add_option("-i", "--codec", dest="codecindex", default=0, metavar="CODEC",
        help="codec index (as can be seen in /proc/asound/cardX/codecY)")
    (options, args) = parser.parse_args()
    return int(options.cardindex), int(options.codecindex)
    
def get_simplecaps(node):
    if node.jack_color_name == 'Unknown':
        return "%s (%s %s)" % (node.jack_type_name, node.jack_location_name, node.jack_location2_name)
    return "%s %s (%s %s)" % (node.jack_color_name, node.jack_type_name, node.jack_location_name, node.jack_location2_name)

cardindex, codecindex = parseoptions()
codec = HDACodec(cardindex, codecindex)
codec.analyze()
for nid in codec.nodes:
    node = codec.get_node(nid)
    if WIDGET_TYPE_IDS[node.wtype] == 'PIN':
        if ((node.defcfg_pincaps >> 30) & 0x03) != 1:
	    if (node.pincaps & 1):
                codec.rw(nid, VERBS['SET_PIN_SENSE'], 0)
                time.sleep(0.01)
            sense = codec.rw(nid, VERBS['GET_PIN_SENSE'], 0)
            if node.defcfg_pincaps & (1 << 8):
                print "Pin 0x%.2x %s: No jack detect capability" % (nid, get_simplecaps(node))
            else:
                if sense & 0x80000000:
                    print "Pin 0x%.2x %s: present = YES   impedance = %d" % (nid, get_simplecaps(node), sense - 0x80000000)
                else:
                    print "Pin 0x%.2x %s: present = No" % (nid, get_simplecaps(node))

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



      parent reply	other threads:[~2011-11-06 11:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-25  3:02 [RFC] hda - is_jack_detectable() Raymond Yau
2011-10-25  3:31 ` Raymond Yau
2011-10-25 11:31   ` Takashi Iwai
2011-11-01 21:03   ` David Henningsson
2011-11-02  7:02     ` Takashi Iwai
2011-11-05  5:30       ` Raymond Yau
2011-11-06 13:12         ` Takashi Iwai
2011-11-09  4:06           ` Raymond Yau
2011-11-09  7:08             ` Takashi Iwai
2011-11-09  7:50               ` Takashi Iwai
     [not found]                 ` <CAN8ccibAoNQfDNWJ-zE_DGH6mc-ipmmdhBDQW+fjOMT8xHcD+Q@mail.gmail.com>
     [not found]                   ` <s5h4ny76naa.wl%tiwai@suse.de>
2011-11-16  7:14                     ` Raymond Yau
2011-11-17 15:17                       ` Takashi Iwai
2011-12-23  2:37                         ` Raymond Yau
2011-12-23  9:26                           ` Takashi Iwai
2011-12-27  1:45                             ` Raymond Yau
2011-11-06 11:46     ` Raymond Yau [this message]

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=CAN8cciaiRi79gKXe4MyYPosqA9Tv-fwkSSzG3Uouk3ocJUVa8w@mail.gmail.com \
    --to=superquad.vortex2@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=maciej.rutecki@gmail.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 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).