Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Jul 2014 11:53:08 +0300
From:      Alexander Motin <mav@FreeBSD.org>
To:        Adrian Chadd <adrian@freebsd.org>
Cc:        "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, Mark Johnston <markj@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>
Subject:   Re: svn commit: r268584 - head/sys/dev/sound/pci/hda
Message-ID:  <53D4BDF4.3040207@FreeBSD.org>
In-Reply-To: <CAJ-Vmok06k=SmtkBeWaa-aQUQVsmeQAB6BFir4aBv6ojD8%2BUBQ@mail.gmail.com>
References:  <201407131031.s6DAVTja093433@svn.freebsd.org>	<CAJ-Vmo=hsK6k6VPcig69srL%2BV_AO5yQo4z%2B2XycvGB6_fRwSGg@mail.gmail.com>	<53C335EF.2090606@FreeBSD.org>	<CAJ-VmomUm7JdNk-aX2UOKQMO9LhRh6LhPTNBQu8MCJ%2BPtnWLKw@mail.gmail.com>	<CAJ-Vmo=SXQYHFFB3wg=CaC1w_ZJG7M1Hq5mW-nL1GRPYrq9tqQ@mail.gmail.com>	<CAJ-Vmo=UTQeETt3sqPSApFfoes-oRS7Akq_WOOd3Mdbi_Kr3Ug@mail.gmail.com>	<53D4BA51.7070505@FreeBSD.org>	<CAJ-Vmok0U%2B=Or2_vtLjpBqoPZ9bsHUFXMTrwV2E8K=f%2BQxVcSg@mail.gmail.com> <CAJ-Vmok06k=SmtkBeWaa-aQUQVsmeQAB6BFir4aBv6ojD8%2BUBQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 27.07.2014 11:42, Adrian Chadd wrote:
> ... aaand it worked. Woo!

It worked for playback, but completely broke recording. I've missed that
your CODEC does not support input switching in hardware, while driver
does not support that in software. For playback software switching is
supported by the driver, so it worked. Patch below should give you
automatic switching on playback, but still two separate recording devices.

> So how'd it actually map the correct selection between headphones and
> speaker? That's now cutting back and forth correctly as I plug in and
> out the headphone jack.

It tells the driver that those two inputs should be parts of one output
device, and driver following HDA specifications reads jack presence
information from respective CODEC pins. Sound actually played to both
outputs, but driver mutes one of them, depending on jack presence.

Lenovo engineers configured the CODEC to report each pin as separate
audio device, but the problem that our sound(4) does not support
automatic switching between them. :(

> On 27 July 2014 01:40, Adrian Chadd <adrian@freebsd.org> wrote:
>> ok, with that it looks like:
>>
>> hdaa0: 2 associations found:
>> hdaa0: Association 0 (1) out:
>> hdaa0:  Pin nid=26 seq=0
>> hdaa0:  Pin nid=22 seq=15
>> hdaa0: Association 1 (2) in:
>> hdaa0:  Pin nid=29 seq=0
>> hdaa0:  Pin nid=24 seq=14
>> hdaa0: Tracing association 0 (1)
>> hdaa0:  Pin 26 traced to DAC 16
>> hdaa0:  Pin 22 traced to DAC 16 and hpredir 0
>> hdaa0: Association 0 (1) trace succeeded
>> hdaa0: Tracing association 1 (2)
>> hdaa0:  Pin 29 traced to ADC 20
>> hdaa0:  Unable to trace pin 24 to ADC 20, undo traces
>> hdaa0:  Unable to trace pin 29 to ADC 21, undo traces
>> hdaa0: Association 1 (2) trace failed

Index: hdaa_patches.c
===================================================================
--- hdaa_patches.c      (revision 269151)
+++ hdaa_patches.c      (working copy)
@@ -346,6 +346,16 @@ hdac_pin_patch(struct hdaa_widget *w)
                        patch = "as=1 seq=15";
                        break;
                }
+       } else if (id == HDA_CODEC_CX20561 &&
+           subid == LENOVO_ZZZ_SUBVENDOR) {
+               switch (nid) {
+               case 22:
+                       patch = "as=1 seq=15";
+                       break;
+               case 26:
+                       patch = "as=1 seq=0";
+                       break;
+               }
        } else if (id == HDA_CODEC_CX20590 &&
            (subid == LENOVO_X1_SUBVENDOR ||
            subid == LENOVO_X220_SUBVENDOR ||
Index: hdac.h
===================================================================
--- hdac.h      (revision 269151)
+++ hdac.h      (working copy)
@@ -236,6 +236,7 @@
 #define        LENOVO_X1CRBN_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f9)
 #define LENOVO_X220_SUBVENDOR  HDA_MODEL_CONSTRUCT(LENOVO, 0x21da)
 #define LENOVO_X300_SUBVENDOR  HDA_MODEL_CONSTRUCT(LENOVO, 0x20ac)
+#define LENOVO_ZZZ_SUBVENDOR   HDA_MODEL_CONSTRUCT(LENOVO, 0x20f2)
 #define        LENOVO_T420_SUBVENDOR   HDA_MODEL_CONSTRUCT(LENOVO, 0x21ce)
 #define        LENOVO_T430_SUBVENDOR   HDA_MODEL_CONSTRUCT(LENOVO, 0x21f3)
 #define        LENOVO_T430S_SUBVENDOR  HDA_MODEL_CONSTRUCT(LENOVO, 0x21fb)


-- 
Alexander Motin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53D4BDF4.3040207>