From patchwork Fri Mar 5 18:37:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 393581 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp670266jai; Fri, 5 Mar 2021 10:40:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxRilILyy+QppPdrcHMNP2ZVkxyo66ETSkEpRGYEgKZN54LmJETflIMczxrfWQKjOpIak5T X-Received: by 2002:a17:906:8904:: with SMTP id fr4mr3709886ejc.136.1614969619006; Fri, 05 Mar 2021 10:40:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614969619; cv=none; d=google.com; s=arc-20160816; b=DpNgpt7bzy3p2LK4r9W1FXu0zq5CckJDNLWCvoYl7zuZTCtZFG3FqyOXYJbrrci5hX O11lesNtDtmofWAj292QC19svoIx8WxxL3YDxiHX2iIcbCuqmlqCTQGKxmOlrvlUB1FS UDCAVy02WTaABudplQ1VGuYu9iEQVPiItF8XzDO33VAk1BIHgfzYy/cnuL0PwoLOY3eX SYY5rrLZHFLgt98zOHDeRwCSAkb6APqIe+2JHqWnDO1huvt9dLwSfbyoKB27pj69hf9x GxiiOK941tlf60MprkDcYD02mCJ0oaqnrQcsIpPSmUz89Cn/Qblnv4RYILkCjWNAGd9Z 1CIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/bUlq/wPF3yJYJShp7VG2mRZDBWcT8EiKpB3if3AI6c=; b=o1sGol0VJHhZqhBmfMkB7wM3TpXzz2/U21uH+OrmZpt4701RNk2VzPUT/h+geLRA3q ubBa8TxIkOUxfhJhlGwSxV3YPLZUEc95ZbGi0dtWPNByh23dwFla17CyoEajAd6eeSkH 2g/xMo3RTHO5sq/kQmTXjbiXQWk9LMZoB8cI4YhI65Ofrh4EoQBwfy/fLE+rQk854+o+ U8M76s1Q/N8AKLKzJ16V3IEqyUqgZyd9dPmTbS+ZRFj5NseokioStY/DYvFosc4Ct77o VIhVfFLRej7UEpnpBcSd9PcIHmEWLhWwJKcsF23UmKeEfR+YNaibGNoF2iLYvJ5TyiuN 27kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vyJcEoVK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bg8si1843228ejb.155.2021.03.05.10.40.18; Fri, 05 Mar 2021 10:40:18 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=vyJcEoVK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229563AbhCESjr (ORCPT + 1 other); Fri, 5 Mar 2021 13:39:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230113AbhCEShk (ORCPT ); Fri, 5 Mar 2021 13:37:40 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6816C061756 for ; Fri, 5 Mar 2021 10:37:39 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id z11so5227875lfb.9 for ; Fri, 05 Mar 2021 10:37:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/bUlq/wPF3yJYJShp7VG2mRZDBWcT8EiKpB3if3AI6c=; b=vyJcEoVKHnVIlXU3QVkMKljvyvfYOTgX8mO06rqy+CaMtP+6ytqA/t/nBbWcJLSHLs cjdIngnDqEN00+ykNDyLiZhm2eo6cwPgSQrD/kB/BM9AoJx6UCb3HvIlgOd9EGVsgewl Pe6v3KEEbs0VG0gu6nmhB+3RWnrgOFunALUVBseHJ3gMk9/JG7N+r2hFfM8oY8/0z/K1 kOSr3ckbONAKVh3bQy4KwLONzpHQGuNB1KurFLFd+9L3PbMYHf0fTvCpDjEVo+dfK/+s sPYC8H+WGJ7/xqK6mL+dEDqvxpUer+BBok0D0FPuwMxc/OZd/opK6KFhami6G9PqlTV+ jBLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/bUlq/wPF3yJYJShp7VG2mRZDBWcT8EiKpB3if3AI6c=; b=B+0gsAbNiZ81TbZ5pWumie/4X0IwHYbNFjegrUIABSRgIoCyTKhqBM5gz4TFu2LBi5 477Elwqb9mu/E6T82zez/32aWgY5dhX9kgUIDD76fxI/gNMou639p56UUqVbi99qPxHj pz6aJ7qBHV5kc86xEmmLPkgZ62b/BVlRYWjx/6GmnMCF/a2YOjyKlgJ6gwkJBLmh5sZ/ xSSwKXIaU7164G/1btrLAP5nRN7BUzcnAEe5aPg055kf8X5m/MBqq7OPTC+jFq8/3bpp e7ZbkMq/0B3RJD34ZLZk05ftOSDbYOylPlo0AAPSekwbH3qE7i52EKCW0ObOhj4Pt3cd +ppg== X-Gm-Message-State: AOAM530qvyip/pO3+RUhqnWrJqLuppIn7opfC79mUSFQIvYx+9MWWYVA 2jUloWhifm08bBCGDoKzCQ8uTg== X-Received: by 2002:a05:6512:303:: with SMTP id t3mr6436550lfp.196.1614969458136; Fri, 05 Mar 2021 10:37:38 -0800 (PST) Received: from localhost.localdomain (c-d7cb225c.014-348-6c756e10.bbcust.telenor.se. [92.34.203.215]) by smtp.gmail.com with ESMTPSA id o16sm400374lfo.166.2021.03.05.10.37.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 10:37:37 -0800 (PST) From: Linus Walleij To: Marcel Holtmann , Johan Hedberg Cc: linux-bluetooth@vger.kernel.org, Linus Walleij , devicetree@vger.kernel.org Subject: [PATCH 1/2 v3] Bluetooth: btbcm: Rewrite bindings in YAML and add reset Date: Fri, 5 Mar 2021 19:37:35 +0100 Message-Id: <20210305183736.2123083-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This rewrites the Broadcom bluetooth bindings in YAML and adds a GPIO handle for the BT_RST_N line as used on some platforms. The Ingenic UART binding was using this binding in its example DTS fragment, however mistakenly using "vcc-supply" for what is called "vbat-supply". The proper DTS files and the code in the kernel all use "vbat-supply" so fix up the example in this patch so we ge a clean check. Cc: devicetree@vger.kernel.org Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - Actually fold in the required fix. ChangeLog v1->v2: - Fix the error in the Ingenic UART binding example as part of adding this patch. --- .../bindings/net/broadcom-bluetooth.txt | 56 --------- .../bindings/net/broadcom-bluetooth.yaml | 117 ++++++++++++++++++ .../bindings/serial/ingenic,uart.yaml | 2 +- 3 files changed, 118 insertions(+), 57 deletions(-) delete mode 100644 Documentation/devicetree/bindings/net/broadcom-bluetooth.txt create mode 100644 Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml -- 2.29.2 diff --git a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt deleted file mode 100644 index a7d57ba5f2ac..000000000000 --- a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt +++ /dev/null @@ -1,56 +0,0 @@ -Broadcom Bluetooth Chips ---------------------- - -This documents the binding structure and common properties for serial -attached Broadcom devices. - -Serial attached Broadcom devices shall be a child node of the host UART -device the slave device is attached to. - -Required properties: - - - compatible: should contain one of the following: - * "brcm,bcm20702a1" - * "brcm,bcm4329-bt" - * "brcm,bcm4330-bt" - * "brcm,bcm43438-bt" - * "brcm,bcm4345c5" - * "brcm,bcm43540-bt" - * "brcm,bcm4335a0" - -Optional properties: - - - max-speed: see Documentation/devicetree/bindings/serial/serial.yaml - - shutdown-gpios: GPIO specifier, used to enable the BT module - - device-wakeup-gpios: GPIO specifier, used to wakeup the controller - - host-wakeup-gpios: GPIO specifier, used to wakeup the host processor. - deprecated, replaced by interrupts and - "host-wakeup" interrupt-names - - clocks: 1 or 2 clocks as defined in clock-names below, in that order - - clock-names: names for clock inputs, matching the clocks given - - "extclk": deprecated, replaced by "txco" - - "txco": external reference clock (not a standalone crystal) - - "lpo": external low power 32.768 kHz clock - - vbat-supply: phandle to regulator supply for VBAT - - vddio-supply: phandle to regulator supply for VDDIO - - brcm,bt-pcm-int-params: configure PCM parameters via a 5-byte array - - sco-routing: 0 = PCM, 1 = Transport, 2 = Codec, 3 = I2S - - pcm-interface-rate: 128KBps, 256KBps, 512KBps, 1024KBps, 2048KBps - - pcm-frame-type: short, long - - pcm-sync-mode: slave, master - - pcm-clock-mode: slave, master - - interrupts: must be one, used to wakeup the host processor - - interrupt-names: must be "host-wakeup" - -Example: - -&uart2 { - pinctrl-names = "default"; - pinctrl-0 = <&uart2_pins>; - - bluetooth { - compatible = "brcm,bcm43438-bt"; - max-speed = <921600>; - brcm,bt-pcm-int-params = [01 02 00 01 01]; - }; -}; diff --git a/Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml b/Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml new file mode 100644 index 000000000000..bdd6ca617e23 --- /dev/null +++ b/Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml @@ -0,0 +1,117 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/broadcom-bluetooth.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Broadcom Bluetooth Chips + +maintainers: + - Linus Walleij + +description: + This binding describes Broadcom UART-attached bluetooth chips. + +properties: + compatible: + enum: + - brcm,bcm20702a1 + - brcm,bcm4329-bt + - brcm,bcm4330-bt + - brcm,bcm43438-bt + - brcm,bcm4345c5 + - brcm,bcm43540-bt + - brcm,bcm4335a0 + + shutdown-gpios: + maxItems: 1 + description: GPIO specifier for the line BT_REG_ON used to + power on the BT module + + reset-gpios: + maxItems: 1 + description: GPIO specifier for the line BT_RST_N used to + reset the BT module. This should be marked as + GPIO_ACTIVE_LOW. + + device-wakeup-gpios: + maxItems: 1 + description: GPIO specifier for the line BT_WAKE used to + wakeup the controller. This is using the BT_GPIO_0 + pin on the chip when in use. + + host-wakeup-gpios: + maxItems: 1 + deprecated: true + description: GPIO specifier for the line HOST_WAKE used + to wakeup the host processor. This is using he BT_GPIO_1 + pin on the chip when in use. This is deprecated and replaced + by interrupts and "host-wakeup" interrupt-names + + clocks: + maxItems: 2 + description: 1 or 2 clocks as defined in clock-names below, + in that order + + clock-names: + description: Names of the 1 to 2 supplied clocks + items: + - const: txco + - const: lpo + - const: extclk + + vbat-supply: + description: phandle to regulator supply for VBAT + + vddio-supply: + description: phandle to regulator supply for VDDIO + + brcm,bt-pcm-int-params: + $ref: /schemas/types.yaml#/definitions/uint8-array + minItems: 5 + maxItems: 5 + description: |- + configure PCM parameters via a 5-byte array: + sco-routing: 0 = PCM, 1 = Transport, 2 = Codec, 3 = I2S + pcm-interface-rate: 128KBps, 256KBps, 512KBps, 1024KBps, 2048KBps + pcm-frame-type: short, long + pcm-sync-mode: slave, master + pcm-clock-mode: slave, master + + interrupts: + items: + - description: Handle to the line HOST_WAKE used to wake + up the host processor. This uses the BT_GPIO_1 pin on + the chip when in use. + + interrupt-names: + items: + - const: host-wakeup + + max-speed: true + current-speed: true + +required: + - compatible + +additionalProperties: false + +examples: + - | + #include + #include + + uart { + uart-has-rtscts; + + bluetooth { + compatible = "brcm,bcm4330-bt"; + max-speed = <921600>; + brcm,bt-pcm-int-params = [01 02 00 01 01]; + shutdown-gpios = <&gpio 30 GPIO_ACTIVE_HIGH>; + device-wakeup-gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio 9 GPIO_ACTIVE_LOW>; + interrupt-parent = <&gpio>; + interrupts = <8 IRQ_TYPE_EDGE_FALLING>; + }; + }; diff --git a/Documentation/devicetree/bindings/serial/ingenic,uart.yaml b/Documentation/devicetree/bindings/serial/ingenic,uart.yaml index 559213899d73..7748d8c3bab8 100644 --- a/Documentation/devicetree/bindings/serial/ingenic,uart.yaml +++ b/Documentation/devicetree/bindings/serial/ingenic,uart.yaml @@ -91,7 +91,7 @@ examples: bluetooth { compatible = "brcm,bcm4330-bt"; reset-gpios = <&gpf 8 GPIO_ACTIVE_HIGH>; - vcc-supply = <&wlan0_power>; + vbat-supply = <&wlan0_power>; device-wakeup-gpios = <&gpf 5 GPIO_ACTIVE_HIGH>; host-wakeup-gpios = <&gpf 6 GPIO_ACTIVE_HIGH>; shutdown-gpios = <&gpf 4 GPIO_ACTIVE_LOW>; From patchwork Fri Mar 5 18:37:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 393582 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp670284jai; Fri, 5 Mar 2021 10:40:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwif60DGspYmhpBEO4nrOLYl/cT/JxQPiZ8FvapBUdMBRvS7+S9lBUUsJPToBmFM4q5M0+J X-Received: by 2002:a17:906:fc5:: with SMTP id c5mr3457256ejk.538.1614969620023; Fri, 05 Mar 2021 10:40:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614969620; cv=none; d=google.com; s=arc-20160816; b=rmt9tUD2usc27Z+pUsVf+Lr4OY/ig3rHQru3faMWN4hjXnsiSZCuMS3yqAfuOMO+Jf WWKKppHrxenizCWftx0oS5Q0yqjJ2moft9yFAYh60HesUJTrjsfdHynxSY0RBxInC77O u12gWHq3Jl1DgL8q5rdUneqjlBd9ScGrxlWr7J1XKez3nZrAyz6cOwpXYplYKVMMKQ5X uCKEsZNMh0itPn3NViAli2ZZDhzOf+UhjAmCSCxuK1t2pg77/ltGJP9G+XDIZfXv1F9f Bz/p2a/LerapYVQ5UTd8HV7nexV6ti6bEonURTNS07+s9DW/73Aw6XY1oP8U1kil4o7r 5R+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+2ElZv11zdoL2qiA64ASUABXEbwM8MABPwhCs71wdjc=; b=q1Dsd1CrKaXz+uqHqvhQkLQgnxr5VuqJUKRjhCdOGEmq16KbCtgG3OtBOroolZHBmp dSP/YhVma6BmjjFnsvjESgpkOQKH+m3xn8dtBeFZvIgs+XblJK1oT8dIOK9xl5/lYpP+ /BEuNuVZw+1zuACvaSptiU42xhqFerKe++VIr69bbb5f6UUfeCKbqAgP+O7MjCg8c/d6 4Ubcna7S5xwQhCEnr5nMbCaAZnR6MRzMvGGWY+ASJWQ5TenyyToJcA5Zg/VGgZ9aGbvI rIDOcnvp3o64tq+IHXwV5QoLkwk15T0YLE6CQ+xHaTCyGY5hiH1F+6dlbVbq6LsGT8cb 1NLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=azUAvx7C; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bg8si1843228ejb.155.2021.03.05.10.40.19; Fri, 05 Mar 2021 10:40:20 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=azUAvx7C; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230113AbhCESju (ORCPT + 1 other); Fri, 5 Mar 2021 13:39:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230122AbhCESho (ORCPT ); Fri, 5 Mar 2021 13:37:44 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84DE0C061756 for ; Fri, 5 Mar 2021 10:37:44 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id m22so5259332lfg.5 for ; Fri, 05 Mar 2021 10:37:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+2ElZv11zdoL2qiA64ASUABXEbwM8MABPwhCs71wdjc=; b=azUAvx7CMf2XeiZiwrZ/U18kSPh9kV6DLCMfb20nYpgYOHPHR1N3QB2s8CPHIghUUd HTVTWhvXPoHFrhFXr9WiFCCikRBVQP2K0L3y/58qrMSkRHmc80Wf1YAt+w3EGGMuDm/Z qUnm0OOCi7X8QZ0qsYAz5LyIp4qv/AQulb31o7huSDjDD7o1A82+si21Xo6jCa1vsErT CT11dQn5sBCrZGSDWJvAEukcRhfCZsmS2GnvZcykGKQ3cEVQ7r4qhbKumQHZE2k6Pgza FTtuQtw05X9tAk7tk37FIXWAJgFevnWWvbmncQ4X0bpu+SOrUPVnBLIPn3jsWqWPn4Jn hNMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+2ElZv11zdoL2qiA64ASUABXEbwM8MABPwhCs71wdjc=; b=quFotabhn8fV10F9/lFyda7USt79h5MI5GZJPUi2IYmoNHbqSQkYMrT/CNGitvXLCf sd04zF8z4UoVN0loYhemWuLhVV2DNop2MpJdMLR4/ZmYNzF4aYVkZ8mUCIAz38ddP/S7 m95mKw29VOtgz6q7uRalyUo+tvH2wDfqrKDjK+hw5/pR9CEV4+BjiMeI1gFnm4LCuYd6 Xpdek1d4ghkKYxLg9hD0bSpfiPDJloFE0MqzqwaGgISqbCBxPhcN3npbJ2vNTqnRMLS2 remTSIPuOVFG+80NpHy0Zyl9d1VB53e73a8u4U+aSnpaKalaQ/Szll3LFPwwObU7TXn9 eivA== X-Gm-Message-State: AOAM532EIHO8c/IAH8ILlhuROxSKQUynUgiFGR1mcnc9OTwQctt18wxE me33qRyXxoOMY7HNNY8jZ2yp5g== X-Received: by 2002:a05:6512:1086:: with SMTP id j6mr6301673lfg.96.1614969463027; Fri, 05 Mar 2021 10:37:43 -0800 (PST) Received: from localhost.localdomain (c-d7cb225c.014-348-6c756e10.bbcust.telenor.se. [92.34.203.215]) by smtp.gmail.com with ESMTPSA id o16sm400374lfo.166.2021.03.05.10.37.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 10:37:42 -0800 (PST) From: Linus Walleij To: Marcel Holtmann , Johan Hedberg Cc: linux-bluetooth@vger.kernel.org, Linus Walleij Subject: [PATCH 2/2 v3] Bluetooth: btbcm: Obtain and handle reset GPIO Date: Fri, 5 Mar 2021 19:37:36 +0100 Message-Id: <20210305183736.2123083-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210305183736.2123083-1-linus.walleij@linaro.org> References: <20210305183736.2123083-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Obtain and drive the optional reset GPIO line if this is not hardwired in the platform. This is needed on the Samsung GT-I9070 mobile phone. The invers of power is used, this should be OK to apply simultaneously as the power signal according to figures 47-51 on pages 159-161 in the BCM4330 datasheet. Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - Resend with the other patch. ChangeLog v1->v2: - Rebase on v5.12-rc1 --- drivers/bluetooth/hci_bcm.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) -- 2.29.2 diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c index 3764ceb6fa0d..93a4c03a8787 100644 --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c @@ -68,6 +68,8 @@ struct bcm_device_data { * deassert = Bluetooth device may sleep when sleep criteria are met * @shutdown: BT_REG_ON pin, * power up or power down Bluetooth device internal regulators + * @reset: BT_RST_N pin, + * active low resets the Bluetooth logic core * @set_device_wakeup: callback to toggle BT_WAKE pin * either by accessing @device_wakeup or by calling @btlp * @set_shutdown: callback to toggle BT_REG_ON pin @@ -101,6 +103,7 @@ struct bcm_device { const char *name; struct gpio_desc *device_wakeup; struct gpio_desc *shutdown; + struct gpio_desc *reset; int (*set_device_wakeup)(struct bcm_device *, bool); int (*set_shutdown)(struct bcm_device *, bool); #ifdef CONFIG_ACPI @@ -985,6 +988,15 @@ static int bcm_gpio_set_device_wakeup(struct bcm_device *dev, bool awake) static int bcm_gpio_set_shutdown(struct bcm_device *dev, bool powered) { gpiod_set_value_cansleep(dev->shutdown, powered); + if (dev->reset) + /* + * The reset line is asserted on powerdown and deasserted + * on poweron so the inverse of powered is used. Notice + * that the GPIO line BT_RST_N needs to be specified as + * active low in the device tree or similar system + * description. + */ + gpiod_set_value_cansleep(dev->reset, !powered); return 0; } @@ -1050,6 +1062,11 @@ static int bcm_get_resources(struct bcm_device *dev) if (IS_ERR(dev->shutdown)) return PTR_ERR(dev->shutdown); + dev->reset = devm_gpiod_get_optional(dev->dev, "reset", + GPIOD_OUT_LOW); + if (IS_ERR(dev->reset)) + return PTR_ERR(dev->reset); + dev->set_device_wakeup = bcm_gpio_set_device_wakeup; dev->set_shutdown = bcm_gpio_set_shutdown;