From owner-svn-src-all@FreeBSD.ORG Fri Oct 25 19:46:52 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id EDF1CB21; Fri, 25 Oct 2013 19:46:52 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D92CE2D60; Fri, 25 Oct 2013 19:46:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9PJkqk0004707; Fri, 25 Oct 2013 19:46:52 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9PJkqGQ004704; Fri, 25 Oct 2013 19:46:52 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201310251946.r9PJkqGQ004704@svn.freebsd.org> From: Adrian Chadd Date: Fri, 25 Oct 2013 19:46:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r257134 - head/sys/dev/iwn X-SVN-Group: head 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: Fri, 25 Oct 2013 19:46:53 -0000 Author: adrian Date: Fri Oct 25 19:46:52 2013 New Revision: 257134 URL: http://svnweb.freebsd.org/changeset/base/257134 Log: Begin fleshing out a knob to enable/disable bluetooth coexistence. Some firmware versions seem to get very unhappy if they're sent btcoex commands when they don't actually have bluetooth hardware in them. So, disable sending them those commands. Tested: * 5100 (which has bluetooth, no problems) * 4965 (which doesn't have bluetooth, but didn't seem to crash) * 6200 (no bluetooth, seems to get unhappy being sent bluetooth commands.) Modified: head/sys/dev/iwn/if_iwn.c head/sys/dev/iwn/if_iwnvar.h Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Fri Oct 25 19:44:53 2013 (r257133) +++ head/sys/dev/iwn/if_iwn.c Fri Oct 25 19:46:52 2013 (r257134) @@ -705,6 +705,8 @@ iwn4965_attach(struct iwn_softc *sc, uin /* Override chains masks, ROM is known to be broken. */ sc->txchainmask = IWN_ANT_AB; sc->rxchainmask = IWN_ANT_ABC; + /* Enable normal btcoex */ + sc->sc_flags |= IWN_FLAG_BTCOEX; DPRINTF(sc, IWN_DEBUG_TRACE, "%s: end\n",__func__); @@ -752,23 +754,40 @@ iwn5000_attach(struct iwn_softc *sc, uin /* Override chains masks, ROM is known to be broken. */ sc->txchainmask = IWN_ANT_B; sc->rxchainmask = IWN_ANT_AB; + /* Enable normal btcoex */ + sc->sc_flags |= IWN_FLAG_BTCOEX; break; case IWN_HW_REV_TYPE_5150: sc->limits = &iwn5150_sensitivity_limits; sc->fwname = "iwn5150fw"; + /* Enable normal btcoex */ + sc->sc_flags |= IWN_FLAG_BTCOEX; break; case IWN_HW_REV_TYPE_5300: case IWN_HW_REV_TYPE_5350: sc->limits = &iwn5000_sensitivity_limits; sc->fwname = "iwn5000fw"; + /* Enable normal btcoex */ + sc->sc_flags |= IWN_FLAG_BTCOEX; break; case IWN_HW_REV_TYPE_1000: sc->limits = &iwn1000_sensitivity_limits; sc->fwname = "iwn1000fw"; + /* Enable normal btcoex */ + sc->sc_flags |= IWN_FLAG_BTCOEX; break; case IWN_HW_REV_TYPE_6000: sc->limits = &iwn6000_sensitivity_limits; sc->fwname = "iwn6000fw"; + /* + * Disable btcoex for 6200. + * XXX TODO: disable for 6205; no btcoex as well + * (6230/6235 - enable bluetooth) + */ + if (pid != 0x422c) { + /* Enable normal btcoex */ + sc->sc_flags |= IWN_FLAG_BTCOEX; + } if (pid == 0x422c || pid == 0x4239) { sc->sc_flags |= IWN_FLAG_INTERNAL_PA; /* Override chains masks, ROM is known to be broken. */ @@ -782,14 +801,20 @@ iwn5000_attach(struct iwn_softc *sc, uin /* Override chains masks, ROM is known to be broken. */ sc->txchainmask = IWN_ANT_AB; sc->rxchainmask = IWN_ANT_AB; + /* Enable normal btcoex */ + sc->sc_flags |= IWN_FLAG_BTCOEX; break; case IWN_HW_REV_TYPE_6005: sc->limits = &iwn6000_sensitivity_limits; if (pid != 0x0082 && pid != 0x0085) { sc->fwname = "iwn6000g2bfw"; sc->sc_flags |= IWN_FLAG_ADV_BTCOEX; - } else + } else { sc->fwname = "iwn6000g2afw"; + /* + * 6250 - disable bluetooth coexistence. + */ + } break; default: device_printf(sc->sc_dev, "adapter type %d not supported\n", @@ -797,6 +822,15 @@ iwn5000_attach(struct iwn_softc *sc, uin DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end in error\n",__func__); return ENOTSUP; } + if (sc->sc_flags & IWN_FLAG_BTCOEX) + device_printf(sc->sc_dev, + "enable basic bluetooth coexistence\n"); + else if (sc->sc_flags & IWN_FLAG_ADV_BTCOEX) + device_printf(sc->sc_dev, + "enable advanced bluetooth coexistence\n"); + else + device_printf(sc->sc_dev, + "disable bluetooth coexistence\n"); return 0; } @@ -5404,9 +5438,10 @@ iwn_config(struct iwn_softc *sc) } /* Configure bluetooth coexistence. */ + error = 0; if (sc->sc_flags & IWN_FLAG_ADV_BTCOEX) error = iwn_send_advanced_btcoex(sc); - else + else if (sc->sc_flags & IWN_FLAG_BTCOEX) error = iwn_send_btcoex(sc); if (error != 0) { device_printf(sc->sc_dev, Modified: head/sys/dev/iwn/if_iwnvar.h ============================================================================== --- head/sys/dev/iwn/if_iwnvar.h Fri Oct 25 19:44:53 2013 (r257133) +++ head/sys/dev/iwn/if_iwnvar.h Fri Oct 25 19:46:52 2013 (r257134) @@ -249,6 +249,7 @@ struct iwn_softc { #define IWN_FLAG_ENH_SENS (1 << 7) #define IWN_FLAG_ADV_BTCOEX (1 << 8) #define IWN_FLAG_PAN_SUPPORT (1 << 9) +#define IWN_FLAG_BTCOEX (1 << 10) uint8_t hw_type; /* subdevice_id used to adjust configuration */