From patchwork Thu Sep 3 18:48:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11754513 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E920746 for ; Thu, 3 Sep 2020 18:48:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 03920208FE for ; Thu, 3 Sep 2020 18:48:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728688AbgICSs4 (ORCPT ); Thu, 3 Sep 2020 14:48:56 -0400 Received: from mga18.intel.com ([134.134.136.126]:5597 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728358AbgICSsy (ORCPT ); Thu, 3 Sep 2020 14:48:54 -0400 IronPort-SDR: cX7RIt8mOU9XYajnDl8i51bOwBDXPgS4OEJo31cH8SY0sLMYopnmbYi7y/CBKk5FCNHNf7B5dT FZVQ9mRG5clw== X-IronPort-AV: E=McAfee;i="6000,8403,9733"; a="145339778" X-IronPort-AV: E=Sophos;i="5.76,387,1592895600"; d="scan'208";a="145339778" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Sep 2020 11:48:53 -0700 IronPort-SDR: AxVQagXXeA9mwAZXm0ncCysWDVDq2yVqPWetu9TCqE+KkzD+ZO9kD09mywrPxHMVB7ZQLlZgs0 W8qiAOwuPK0A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,387,1592895600"; d="scan'208";a="284172582" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 03 Sep 2020 11:48:51 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1A27C11C; Thu, 3 Sep 2020 21:48:50 +0300 (EEST) From: Andy Shevchenko To: Marcel Holtmann , Johan Hedberg , linux-bluetooth@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 1/4] Bluetooth: hci_intel: enable on new platform Date: Thu, 3 Sep 2020 21:48:47 +0300 Message-Id: <20200903184850.53055-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On new Intel platform the device is provided with INT33E3 ID. Append it to the list. This will require ACPI_GPIO_QUIRK_ONLY_GPIOIO to be enabled because the relevant ASL looks like: UartSerialBusV2 ( ... ) GpioInt ( ... ) { ... } GpioIo ( ... ) { ... } which means that first GPIO resource is an interrupt, while we are expecting it to be reset one (output). Do the same for host-wake because in case of GpioInt() the platform_get_irq() will do the job and should return correct Linux IRQ number. That said, host-wake GPIO can only be GpioIo() resource. While here, drop commas in terminator lines. Signed-off-by: Andy Shevchenko --- drivers/bluetooth/hci_intel.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c index f1299da6eed8..703d774be5a6 100644 --- a/drivers/bluetooth/hci_intel.c +++ b/drivers/bluetooth/hci_intel.c @@ -1076,7 +1076,8 @@ static const struct hci_uart_proto intel_proto = { #ifdef CONFIG_ACPI static const struct acpi_device_id intel_acpi_match[] = { { "INT33E1", 0 }, - { }, + { "INT33E3", 0 }, + { } }; MODULE_DEVICE_TABLE(acpi, intel_acpi_match); #endif @@ -1138,9 +1139,9 @@ static const struct acpi_gpio_params reset_gpios = { 0, 0, false }; static const struct acpi_gpio_params host_wake_gpios = { 1, 0, false }; static const struct acpi_gpio_mapping acpi_hci_intel_gpios[] = { - { "reset-gpios", &reset_gpios, 1 }, - { "host-wake-gpios", &host_wake_gpios, 1 }, - { }, + { "reset-gpios", &reset_gpios, 1, ACPI_GPIO_QUIRK_ONLY_GPIOIO }, + { "host-wake-gpios", &host_wake_gpios, 1, ACPI_GPIO_QUIRK_ONLY_GPIOIO }, + { } }; static int intel_probe(struct platform_device *pdev) From patchwork Thu Sep 3 18:48:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11754511 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D3ED11575 for ; Thu, 3 Sep 2020 18:48:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BF8C1208FE for ; Thu, 3 Sep 2020 18:48:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728677AbgICSsz (ORCPT ); Thu, 3 Sep 2020 14:48:55 -0400 Received: from mga04.intel.com ([192.55.52.120]:4301 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728304AbgICSsy (ORCPT ); Thu, 3 Sep 2020 14:48:54 -0400 IronPort-SDR: 847C3m88iI1t3pCpCB+MVtPWDPBRBJNVRjyRxWobTCoC25rjykS1iKdVpTLGZiQLEXSglOmklm qQJumFc1g1dQ== X-IronPort-AV: E=McAfee;i="6000,8403,9733"; a="155037267" X-IronPort-AV: E=Sophos;i="5.76,387,1592895600"; d="scan'208";a="155037267" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Sep 2020 11:48:53 -0700 IronPort-SDR: zlmlb0keiLm9Oo+VY+pLO+INVq+KgL/+scd2WeN0ehbEGz8unYDKYO5mC0m8K16TUKzoivGynd In/R6CXTsakQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,387,1592895600"; d="scan'208";a="339391380" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 03 Sep 2020 11:48:52 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 24E26E1; Thu, 3 Sep 2020 21:48:51 +0300 (EEST) From: Andy Shevchenko To: Marcel Holtmann , Johan Hedberg , linux-bluetooth@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 2/4] Bluetooth: hci_intel: drop strange le16_to_cpu() against u8 values Date: Thu, 3 Sep 2020 21:48:48 +0300 Message-Id: <20200903184850.53055-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200903184850.53055-1-andriy.shevchenko@linux.intel.com> References: <20200903184850.53055-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Sparse rightfully complains: hci_intel.c:696:26: warning: cast to restricted __le16 hci_intel.c:701:26: warning: cast to restricted __le16 hci_intel.c:702:26: warning: cast to restricted __le16 hci_intel.c:703:26: warning: cast to restricted __le16 hci_intel.c:725:26: warning: cast to restricted __le16 hci_intel.c:730:26: warning: cast to restricted __le16 hci_intel.c:731:26: warning: cast to restricted __le16 hci_intel.c:732:26: warning: cast to restricted __le16 because we access non-restricted types with le16_to_cpu(). More confusion is added by using above against u8. On big-endian architecture we will get all zeroes. I bet it's not what should be in such case. Signed-off-by: Andy Shevchenko --- drivers/bluetooth/hci_intel.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c index 703d774be5a6..50e4fc6813c2 100644 --- a/drivers/bluetooth/hci_intel.c +++ b/drivers/bluetooth/hci_intel.c @@ -693,14 +693,11 @@ static int intel_setup(struct hci_uart *hu) case 0x0b: /* SfP */ case 0x0c: /* WsP */ snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u.sfi", - le16_to_cpu(ver.hw_variant), - le16_to_cpu(params.dev_revid)); + ver.hw_variant, le16_to_cpu(params.dev_revid)); break; case 0x12: /* ThP */ snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u-%u.sfi", - le16_to_cpu(ver.hw_variant), - le16_to_cpu(ver.hw_revision), - le16_to_cpu(ver.fw_revision)); + ver.hw_variant, ver.hw_revision, ver.fw_revision); break; default: bt_dev_err(hdev, "Unsupported Intel hardware variant (%u)", @@ -722,14 +719,11 @@ static int intel_setup(struct hci_uart *hu) case 0x0b: /* SfP */ case 0x0c: /* WsP */ snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u.ddc", - le16_to_cpu(ver.hw_variant), - le16_to_cpu(params.dev_revid)); + ver.hw_variant, le16_to_cpu(params.dev_revid)); break; case 0x12: /* ThP */ snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u-%u.ddc", - le16_to_cpu(ver.hw_variant), - le16_to_cpu(ver.hw_revision), - le16_to_cpu(ver.fw_revision)); + ver.hw_variant, ver.hw_revision, ver.fw_revision); break; default: bt_dev_err(hdev, "Unsupported Intel hardware variant (%u)", From patchwork Thu Sep 3 18:48:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11754517 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7017A746 for ; Thu, 3 Sep 2020 18:49:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5B371208FE for ; Thu, 3 Sep 2020 18:49:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728975AbgICSs6 (ORCPT ); Thu, 3 Sep 2020 14:48:58 -0400 Received: from mga01.intel.com ([192.55.52.88]:63136 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728419AbgICSsy (ORCPT ); Thu, 3 Sep 2020 14:48:54 -0400 IronPort-SDR: G7Y5XBluCA/hm+mqBLsNsIBP+DtII0b4kM/Lt7wU2EJVEhQEQta4HWgIv3/1V2u7qC13RU63rj lkS5OeVWsj4w== X-IronPort-AV: E=McAfee;i="6000,8403,9733"; a="175694214" X-IronPort-AV: E=Sophos;i="5.76,387,1592895600"; d="scan'208";a="175694214" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Sep 2020 11:48:53 -0700 IronPort-SDR: DMaS1KQ6rL7UZZnHjyRqP4fak2kr+mHgcGlxhj4ny2Rfp4aIRJlqwP0JGYZ1noXfjzOzGIwez6 6eIYJKBTlh8A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,387,1592895600"; d="scan'208";a="302317754" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 03 Sep 2020 11:48:52 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 2B957182; Thu, 3 Sep 2020 21:48:51 +0300 (EEST) From: Andy Shevchenko To: Marcel Holtmann , Johan Hedberg , linux-bluetooth@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 3/4] Bluetooth: hci_intel: switch to list_for_each_entry() Date: Thu, 3 Sep 2020 21:48:49 +0300 Message-Id: <20200903184850.53055-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200903184850.53055-1-andriy.shevchenko@linux.intel.com> References: <20200903184850.53055-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org There is no need to have list_for_each() followed by list_entry() when we simply may use list_for_each_entry() directly. Signed-off-by: Andy Shevchenko --- drivers/bluetooth/hci_intel.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c index 50e4fc6813c2..b20a40fab83e 100644 --- a/drivers/bluetooth/hci_intel.c +++ b/drivers/bluetooth/hci_intel.c @@ -288,7 +288,7 @@ static irqreturn_t intel_irq(int irq, void *dev_id) static int intel_set_power(struct hci_uart *hu, bool powered) { - struct list_head *p; + struct intel_device *idev; int err = -ENODEV; if (!hu->tty->dev) @@ -296,10 +296,7 @@ static int intel_set_power(struct hci_uart *hu, bool powered) mutex_lock(&intel_device_list_lock); - list_for_each(p, &intel_device_list) { - struct intel_device *idev = list_entry(p, struct intel_device, - list); - + list_for_each_entry(idev, &intel_device_list, list) { /* tty device and pdev device should share the same parent * which is the UART port. */ @@ -362,19 +359,16 @@ static int intel_set_power(struct hci_uart *hu, bool powered) static void intel_busy_work(struct work_struct *work) { - struct list_head *p; struct intel_data *intel = container_of(work, struct intel_data, busy_work); + struct intel_device *idev; if (!intel->hu->tty->dev) return; /* Link is busy, delay the suspend */ mutex_lock(&intel_device_list_lock); - list_for_each(p, &intel_device_list) { - struct intel_device *idev = list_entry(p, struct intel_device, - list); - + list_for_each_entry(idev, &intel_device_list, list) { if (intel->hu->tty->dev->parent == idev->pdev->dev.parent) { pm_runtime_get(&idev->pdev->dev); pm_runtime_mark_last_busy(&idev->pdev->dev); @@ -533,7 +527,7 @@ static int intel_setup(struct hci_uart *hu) struct sk_buff *skb; struct intel_version ver; struct intel_boot_params params; - struct list_head *p; + struct intel_device *idev; const struct firmware *fw; char fwname[64]; u32 boot_param; @@ -833,13 +827,11 @@ static int intel_setup(struct hci_uart *hu) * until further LPM TX notification. */ mutex_lock(&intel_device_list_lock); - list_for_each(p, &intel_device_list) { - struct intel_device *dev = list_entry(p, struct intel_device, - list); + list_for_each_entry(idev, &intel_device_list, list) { if (!hu->tty->dev) break; - if (hu->tty->dev->parent == dev->pdev->dev.parent) { - if (device_may_wakeup(&dev->pdev->dev)) { + if (hu->tty->dev->parent == idev->pdev->dev.parent) { + if (device_may_wakeup(&idev->pdev->dev)) { set_bit(STATE_LPM_ENABLED, &intel->flags); set_bit(STATE_TX_ACTIVE, &intel->flags); } @@ -993,7 +985,7 @@ static int intel_recv(struct hci_uart *hu, const void *data, int count) static int intel_enqueue(struct hci_uart *hu, struct sk_buff *skb) { struct intel_data *intel = hu->priv; - struct list_head *p; + struct intel_device *idev; BT_DBG("hu %p skb %p", hu, skb); @@ -1004,10 +996,7 @@ static int intel_enqueue(struct hci_uart *hu, struct sk_buff *skb) * completed before enqueuing any packet. */ mutex_lock(&intel_device_list_lock); - list_for_each(p, &intel_device_list) { - struct intel_device *idev = list_entry(p, struct intel_device, - list); - + list_for_each_entry(idev, &intel_device_list, list) { if (hu->tty->dev->parent == idev->pdev->dev.parent) { pm_runtime_get_sync(&idev->pdev->dev); pm_runtime_mark_last_busy(&idev->pdev->dev); From patchwork Thu Sep 3 18:48:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11754515 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 04C821575 for ; Thu, 3 Sep 2020 18:49:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DAC19208CA for ; Thu, 3 Sep 2020 18:49:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728852AbgICSs5 (ORCPT ); Thu, 3 Sep 2020 14:48:57 -0400 Received: from mga03.intel.com ([134.134.136.65]:2719 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728312AbgICSsy (ORCPT ); Thu, 3 Sep 2020 14:48:54 -0400 IronPort-SDR: bf7bqfuTGKMG01nEz0iB7v7SF1q2X4oeTDFLVvg/iMvpAAh+jyfplUd8AMaY9oHl67GjRCocdV kwXRPSFtYf9Q== X-IronPort-AV: E=McAfee;i="6000,8403,9733"; a="157648334" X-IronPort-AV: E=Sophos;i="5.76,387,1592895600"; d="scan'208";a="157648334" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Sep 2020 11:48:53 -0700 IronPort-SDR: vbaEYy4SvjTnc5ZeAisbk3O8Wau4H4/kRKXTmU+66LMX2a5N0JQGh8EV2sgABdhPNB6Lc14XvA qg1olUTIKJ4A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,387,1592895600"; d="scan'208";a="282774887" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 03 Sep 2020 11:48:52 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3535621D; Thu, 3 Sep 2020 21:48:51 +0300 (EEST) From: Andy Shevchenko To: Marcel Holtmann , Johan Hedberg , linux-bluetooth@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 4/4] Bluetooth: hci_intel: sort headers alphabetically Date: Thu, 3 Sep 2020 21:48:50 +0300 Message-Id: <20200903184850.53055-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200903184850.53055-1-andriy.shevchenko@linux.intel.com> References: <20200903184850.53055-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Sort headers alphabetically to increase readability and make maintenance easier. While here, update copyright year. Signed-off-by: Andy Shevchenko --- drivers/bluetooth/hci_intel.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c index b20a40fab83e..17f51bc17bb5 100644 --- a/drivers/bluetooth/hci_intel.c +++ b/drivers/bluetooth/hci_intel.c @@ -3,21 +3,21 @@ * * Bluetooth HCI UART driver for Intel devices * - * Copyright (C) 2015 Intel Corporation + * Copyright (C) 2015,2020 Intel Corporation */ -#include +#include #include -#include #include -#include -#include -#include -#include #include -#include #include +#include +#include +#include #include +#include +#include +#include #include #include