From owner-svn-src-all@FreeBSD.ORG Thu Nov 15 05:57:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 98CDA95; Thu, 15 Nov 2012 05:57:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7D7198FC13; Thu, 15 Nov 2012 05:57:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAF5vKeF029596; Thu, 15 Nov 2012 05:57:20 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAF5vKPq029595; Thu, 15 Nov 2012 05:57:20 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201211150557.qAF5vKPq029595@svn.freebsd.org> From: Alexander Motin Date: Thu, 15 Nov 2012 05:57:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r243062 - stable/9/sys/dev/sound/pci/hda X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Nov 2012 05:57:20 -0000 Author: mav Date: Thu Nov 15 05:57:20 2012 New Revision: 243062 URL: http://svnweb.freebsd.org/changeset/base/243062 Log: MFC r242357: Set all pins initial connection status to unknown (2) and then update it with the real value in regular way if sensing is supported. This fixes minor inconsistency when playback redirection appeared in undefined state on boot if headphones were not connected. Modified: stable/9/sys/dev/sound/pci/hda/hdaa.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/sound/pci/hda/hdaa.c ============================================================================== --- stable/9/sys/dev/sound/pci/hda/hdaa.c Thu Nov 15 05:55:30 2012 (r243061) +++ stable/9/sys/dev/sound/pci/hda/hdaa.c Thu Nov 15 05:57:20 2012 (r243062) @@ -400,7 +400,7 @@ hdaa_presence_handler(struct hdaa_widget struct hdaa_devinfo *devinfo = w->devinfo; struct hdaa_audio_as *as; uint32_t res; - int connected; + int connected, old; if (w->enable == 0 || w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) @@ -414,19 +414,22 @@ hdaa_presence_handler(struct hdaa_widget connected = (res & HDA_CMD_GET_PIN_SENSE_PRESENCE_DETECT) != 0; if (devinfo->quirks & HDAA_QUIRK_SENSEINV) connected = !connected; - if (connected == w->wclass.pin.connected) + old = w->wclass.pin.connected; + if (connected == old) return; w->wclass.pin.connected = connected; HDA_BOOTVERBOSE( - device_printf(devinfo->dev, - "Pin sense: nid=%d sence=0x%08x (%sconnected)\n", - w->nid, res, !w->wclass.pin.connected ? "dis" : ""); + if (connected || old != 2) { + device_printf(devinfo->dev, + "Pin sense: nid=%d sence=0x%08x (%sconnected)\n", + w->nid, res, !connected ? "dis" : ""); + } ); as = &devinfo->as[w->bindas]; if (as->hpredir >= 0 && as->pins[15] == w->nid) hdaa_hpredir_handler(w); - if (as->dir == HDAA_CTL_IN) + if (as->dir == HDAA_CTL_IN && old != 2) hdaa_autorecsrc_handler(as, w); } @@ -1151,6 +1154,7 @@ hdaa_widget_parse(struct hdaa_widget *w) HDA_CMD_GET_PARAMETER(0, w->nid, HDA_PARAM_PIN_CAP)); w->wclass.pin.ctrl = hda_command(dev, HDA_CMD_GET_PIN_WIDGET_CTRL(0, nid)); + w->wclass.pin.connected = 2; if (HDA_PARAM_PIN_CAP_EAPD_CAP(w->wclass.pin.cap)) { w->param.eapdbtl = hda_command(dev, HDA_CMD_GET_EAPD_BTL_ENABLE(0, nid)); @@ -1238,10 +1242,6 @@ hdaa_widget_postprocess(struct hdaa_widg } strlcat(w->name, HDA_CONNS[conn], sizeof(w->name)); strlcat(w->name, ")", sizeof(w->name)); - - if (HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP(w->wclass.pin.cap) == 0 || - (HDA_CONFIG_DEFAULTCONF_MISC(w->wclass.pin.config) & 1) != 0) - w->wclass.pin.connected = 2; } }