Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2705557pxm; Mon, 28 Feb 2022 04:45:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/ITiWm47TeC8wlpWx5W9MVvHsVOzoR6V+8KSztCKYm7yaB2hHFGXr7oGc2eCTtm/8pPaW X-Received: by 2002:a63:2204:0:b0:378:9f08:206d with SMTP id i4-20020a632204000000b003789f08206dmr4401917pgi.3.1646052341047; Mon, 28 Feb 2022 04:45:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646052341; cv=none; d=google.com; s=arc-20160816; b=EF8TCpTcIzWwSMCrTtXRNlM3QgqjfFBj9VH9gaBFUfd+A8Pm+WG0w9qkKQ3kEyWNEr 3J4BIRh9eecpUqk/HTpo/sfhOSjTMjLEBVsfG2XNORGgfhk1EAJpTgAbNkl5IiDqS3e9 KXKV4imNt/YACcVNvzux+qgNxdB5Rt3IXw4aTvuORkFkEJRhvbp8Cu/WuLQD4uazp6LT jfpxqLCJllF6uTp1F6jCxGMeXy6IZcygq492oeX5o9iIMhokTroZgRUiOXKBfstM/II9 fChV33P7BM1ad+FNgdvj2nAh8Qnxomv6f4L+2txoMMXMXguN2EsIn1KXhBttcPiXKS6N 7mwA== 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=7H8CeIdDiRylBzBEy/YCcLXb7VJ80rA5l7+uhfxGm2k=; b=TsZrfW4aYCLokUihFuppk7X22+0sbuC0W8Z9XA1oIGdUqnE6nYlY7dmgZ0oRdb4t1n D6B/E7Ub13x2Xd4oWwe7DBkzG846GSXbHZEDuGk86klwPviGiiIXsJADLr5+YTkhAj4d ng6S+JB6Hl4Oj23gxfTekMwj82Z7vYk9Twek7ezzNX70BU82UZOZBbpXOnbSIOSwAnXd tPJ0ua8+T3QvelFmZkHb4AgqL480ePbHivP31uGtAlng/JaSzovTMXnkEBGJYpYPVofk IJxdjsJ6sCqG0y/vNWartNLKowE3d2dSs7kYoFKZBUTSff6lF8a6KTgkpCIvv5xcDpEB 4UqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=asbFmeFA; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u193-20020a6279ca000000b004f10a245e73si8419834pfc.200.2022.02.28.04.44.51; Mon, 28 Feb 2022 04:45:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=asbFmeFA; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233927AbiB1Lje (ORCPT + 99 others); Mon, 28 Feb 2022 06:39:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233563AbiB1Ljc (ORCPT ); Mon, 28 Feb 2022 06:39:32 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5A2D51AD9A for ; Mon, 28 Feb 2022 03:38:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646048333; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7H8CeIdDiRylBzBEy/YCcLXb7VJ80rA5l7+uhfxGm2k=; b=asbFmeFA7Qis6/VGOHtusT6OCcshiwn5Jfu06YrOnTsPNDWpPx6KVg81ss6/7TTTAh1ENN b1QkNzl8Saseq7FKsgDLpcYqMdl9CNSSDmmoDiNVlRvxJGUtpjM/baBZ+AOU6EYHPkjTz/ vBWte0lwBnF6Z02I34tqUGBW8ZXFXFc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-91-ZA_4lcbgNFyUZDZ6mpsqbQ-1; Mon, 28 Feb 2022 06:38:50 -0500 X-MC-Unique: ZA_4lcbgNFyUZDZ6mpsqbQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 123DE824FA8; Mon, 28 Feb 2022 11:38:49 +0000 (UTC) Received: from x1.localdomain.com (unknown [10.39.193.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7FB9D8306D; Mon, 28 Feb 2022 11:38:47 +0000 (UTC) From: Hans de Goede To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: Hans de Goede , linux-bluetooth@vger.kernel.org Subject: [PATCH resend 1/1] Bluetooth: hci_bcm: Add the Asus TF103C to the bcm_broken_irq_dmi_table Date: Mon, 28 Feb 2022 12:38:41 +0100 Message-Id: <20220228113841.476174-2-hdegoede@redhat.com> In-Reply-To: <20220228113841.476174-1-hdegoede@redhat.com> References: <20220228113841.476174-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org The DSDT for the Asus TF103C specifies a IOAPIC IRQ for the HCI -> host IRQ but this is not correct. Unlike the previous entries in the table, this time the correct GPIO to use instead is known; and the TF103C is battery powered making runtime-pm support more important. Extend the bcm_broken_irq_dmi_table mechanism to allow specifying the right GPIO instead of just always disabling runtime-pm and add an entry to it for the Asus TF103C. Signed-off-by: Hans de Goede --- drivers/bluetooth/hci_bcm.c | 44 ++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c index d634a27bc850..d3747e049cb7 100644 --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -870,7 +871,23 @@ static int bcm_resume(struct device *dev) #endif /* Some firmware reports an IRQ which does not work (wrong pin in fw table?) */ +static struct gpiod_lookup_table asus_tf103c_irq_gpios = { + .dev_id = "serial0-0", + .table = { + GPIO_LOOKUP("INT33FC:02", 17, "host-wakeup-alt", GPIO_ACTIVE_HIGH), + { } + }, +}; + static const struct dmi_system_id bcm_broken_irq_dmi_table[] = { + { + .ident = "Asus TF103C", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "TF103C"), + }, + .driver_data = &asus_tf103c_irq_gpios, + }, { .ident = "Meegopad T08", .matches = { @@ -1027,7 +1044,8 @@ static struct clk *bcm_get_txco(struct device *dev) static int bcm_get_resources(struct bcm_device *dev) { - const struct dmi_system_id *dmi_id; + const struct dmi_system_id *broken_irq_dmi_id; + const char *irq_con_id = "host-wakeup"; int err; dev->name = dev_name(dev->dev); @@ -1083,23 +1101,33 @@ static int bcm_get_resources(struct bcm_device *dev) if (err) return err; + broken_irq_dmi_id = dmi_first_match(bcm_broken_irq_dmi_table); + if (broken_irq_dmi_id && broken_irq_dmi_id->driver_data) { + gpiod_add_lookup_table(broken_irq_dmi_id->driver_data); + irq_con_id = "host-wakeup-alt"; + dev->irq_active_low = false; + dev->irq = 0; + } + /* IRQ can be declared in ACPI table as Interrupt or GpioInt */ if (dev->irq <= 0) { struct gpio_desc *gpio; - gpio = devm_gpiod_get_optional(dev->dev, "host-wakeup", - GPIOD_IN); + gpio = devm_gpiod_get_optional(dev->dev, irq_con_id, GPIOD_IN); if (IS_ERR(gpio)) return PTR_ERR(gpio); dev->irq = gpiod_to_irq(gpio); } - dmi_id = dmi_first_match(bcm_broken_irq_dmi_table); - if (dmi_id) { - dev_info(dev->dev, "%s: Has a broken IRQ config, disabling IRQ support / runtime-pm\n", - dmi_id->ident); - dev->irq = 0; + if (broken_irq_dmi_id) { + if (broken_irq_dmi_id->driver_data) { + gpiod_remove_lookup_table(broken_irq_dmi_id->driver_data); + } else { + dev_info(dev->dev, "%s: Has a broken IRQ config, disabling IRQ support / runtime-pm\n", + broken_irq_dmi_id->ident); + dev->irq = 0; + } } dev_dbg(dev->dev, "BCM irq: %d\n", dev->irq); -- 2.35.1