Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1012754ybg; Mon, 1 Jun 2020 22:08:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFYmeo52yjtUCDHqPOtpRHt4H7Moq76OYue4TKMt7JKiLXG4jZHtEBvE3WgpTdxnmTMD6b X-Received: by 2002:a17:906:22da:: with SMTP id q26mr9570809eja.256.1591074486605; Mon, 01 Jun 2020 22:08:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591074486; cv=none; d=google.com; s=arc-20160816; b=EBpJqPQ0EqC04wkYAfG6a4yIlLEnI+NpZWvHR/hLADAUAd1jUGDCKVZ6VfF4GJKn24 DTZjqAgnAhBV1f/FoaKukWn3YictAkCIETBiNeGZMtZsvQHGv7cdN2/pkvz3n/jc8Jlg Oq+PuKE47XP8FuAWD1BT4HZ4JuGGhud9BJGezou8ogh86QGFgG5K3pvuB74T1F6vW/XY LVQJwwzaq8XnyWCeciJm2nAYvejZf9y24reesmYHQHJPScWSAXXbZgtomCNN2TnpzDuz 8PhaavGLmnoYYjtnl9gZBhz73oW5vLx6zDLFdgvOy5VkxBKxzPJK7BYh04cuaIDzi2KX 4fpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=z19FDEkX1NfvYMZQyqtThJwKumIRfxkjKJ5+hIZNR6k=; b=MRFCM9hZg0HwI1FYxM8/80/6G7X+9lCRa/CaLLi2Y4qak56kqqt0vf3zQ9Oa22E/uY +FLVgyxPi/m7bffuAfKXozOXDfR4cdhhv7gaVy8UkBsE2xURWtVZuf33uYeogTrY6SRQ HqFmkwByxwthMXtbRLQ4G2s7BfymuFZK0eFDEUef25NfpfhE5J7/TrBbRF8t8YKvzGDA btgFQemJgSdnPNE9yJf1EU6dbTV0r29OmjYZMbk1mI7nr8YsfY2RhyF77UTm/dgLbP4x xGk+tFirCC2ahVQ7oHFINYzKn4y3Cr2hvOoOEH+sjvHxGRGYc7MZ4zrYPS2Elk6qtBn2 6b+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a6si825816edu.275.2020.06.01.22.07.24; Mon, 01 Jun 2020 22:08:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725787AbgFBFGu (ORCPT + 99 others); Tue, 2 Jun 2020 01:06:50 -0400 Received: from mga05.intel.com ([192.55.52.43]:61114 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725781AbgFBFGu (ORCPT ); Tue, 2 Jun 2020 01:06:50 -0400 IronPort-SDR: Nxj0k7mGyF4bzD0KgW8AhCY7s722ioapwwyso3K+CgrEO80P84q1IuPMI0rP4xqwfXQVdxPRsK HGZfdAHDd4Ug== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2020 22:06:49 -0700 IronPort-SDR: i8tII4w7vdtkx0bth2vA9NYRyCN7DCA3pQ3zEVu5OUS/r9Kx3wo15WTAQGIxx8yRer2RFaTo9w YKX5iEpt7q1A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,463,1583222400"; d="scan'208";a="258162629" Received: from unknown (HELO intel-Lenovo-Legion-Y540-15IRH-PG0.iind.intel.com) ([10.224.186.95]) by fmsmga008.fm.intel.com with ESMTP; 01 Jun 2020 22:06:47 -0700 From: Kiran K To: linux-bluetooth@vger.kernel.org Cc: ravishankar.srivatsa@intel.com, Chethan T N , Ps@vger.kernel.org, AyappadasX , Kiran K Subject: [PATCH 1/2] Bluetooth: Add support to Intel read supported feature Date: Tue, 2 Jun 2020 10:37:51 +0530 Message-Id: <20200602050752.7470-1-kiran.k@intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Chethan T N The command shall read the Intel controller supported feature. Based on the supported features addtional debug configuration shall be enabled. Signed-off-by: Chethan T N Signed-off-by: Ps, AyappadasX Signed-off-by: Kiran K --- drivers/bluetooth/btintel.c | 34 ++++++++++++++++++++++++++++++++++ drivers/bluetooth/btintel.h | 14 ++++++++++++++ drivers/bluetooth/btusb.c | 8 +++++++- 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c index 6a0e2c5a8beb..09e697b92426 100644 --- a/drivers/bluetooth/btintel.c +++ b/drivers/bluetooth/btintel.c @@ -754,6 +754,40 @@ void btintel_reset_to_bootloader(struct hci_dev *hdev) } EXPORT_SYMBOL_GPL(btintel_reset_to_bootloader); +int btintel_read_supported_features(struct hci_dev *hdev, + struct intel_supported_features *supported_features) +{ + struct sk_buff *skb; + u8 page_no = 1; + + /* Intel controller supports two pages, each page is of 128-bit + * feature bit mask. And each bit defines specific feature support + */ + skb = __hci_cmd_sync(hdev, 0xfca6, sizeof(page_no), &page_no, + HCI_INIT_TIMEOUT); + if (IS_ERR(skb)) { + BT_ERR("Reading supported features(page1) failed (%ld)", + PTR_ERR(skb)); + return PTR_ERR(skb); + } + + if (skb->len != (sizeof(supported_features->page1) + 3)) { + bt_dev_err(hdev, + "Supported feature(page1) event size mismatch"); + kfree_skb(skb); + return -EILSEQ; + } + + memcpy(supported_features->page1, skb->data + 3, + sizeof(supported_features->page1)); + + /* Read the supported features page2 if required in future. + */ + kfree_skb(skb); + return 0; +} +EXPORT_SYMBOL_GPL(btintel_read_supported_features); + MODULE_AUTHOR("Marcel Holtmann "); MODULE_DESCRIPTION("Bluetooth support for Intel devices ver " VERSION); MODULE_VERSION(VERSION); diff --git a/drivers/bluetooth/btintel.h b/drivers/bluetooth/btintel.h index a69ea8a87b9b..f3892c0233f4 100644 --- a/drivers/bluetooth/btintel.h +++ b/drivers/bluetooth/btintel.h @@ -62,6 +62,11 @@ struct intel_reset { __le32 boot_param; } __packed; + +struct intel_supported_features { + __u8 page1[16]; +} __packed; + #if IS_ENABLED(CONFIG_BT_INTEL) int btintel_check_bdaddr(struct hci_dev *hdev); @@ -88,6 +93,9 @@ int btintel_read_boot_params(struct hci_dev *hdev, int btintel_download_firmware(struct hci_dev *dev, const struct firmware *fw, u32 *boot_param); void btintel_reset_to_bootloader(struct hci_dev *hdev); +int btintel_read_supported_features(struct hci_dev *hdev, + struct intel_supported_features *supported_features); + #else static inline int btintel_check_bdaddr(struct hci_dev *hdev) @@ -186,4 +194,10 @@ static inline int btintel_download_firmware(struct hci_dev *dev, static inline void btintel_reset_to_bootloader(struct hci_dev *hdev) { } +static int btintel_read_supported_features(struct hci_dev *hdev, + struct intel_supported_features *supported_features) +{ + return -EOPNOTSUPP; +} + #endif diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 5f022e9cf667..a5a971e7025b 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -5,7 +5,6 @@ * * Copyright (C) 2005-2008 Marcel Holtmann */ - #include #include #include @@ -2273,6 +2272,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) ktime_t calltime, delta, rettime; unsigned long long duration; int err; + struct intel_supported_features supported_features; BT_DBG("%s", hdev->name); @@ -2542,6 +2542,12 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) */ btintel_load_ddc_config(hdev, fwname); + /* Read the Intel supported features and if new exception formats + * supported, need to load the additional DDC config to enable. + */ + btintel_read_supported_features(hdev, &supported_features); + + /* Read the Intel version information after loading the FW */ err = btintel_read_version(hdev, &ver); if (err) -- 2.17.1