Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1449793ybv; Thu, 13 Feb 2020 23:40:16 -0800 (PST) X-Google-Smtp-Source: APXvYqyQUKgSaZOrRPT3MCwy4Rajcwzv/mkaIh+oOhRDdF8c1CxeopejVNxcjJoOAYFp6Gmv0kJu X-Received: by 2002:a05:6808:2d9:: with SMTP id a25mr1019756oid.172.1581666016187; Thu, 13 Feb 2020 23:40:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581666016; cv=none; d=google.com; s=arc-20160816; b=MlGWnFGd3KG7cLjUnMqGQuWa/wEWbFy3/s652Uq75ekLLpK/rSxHR9iRltbHB2XVwR eSLmmiECa6udo8BMdRi2yNJFREyIcfUFGLa4vVjHIs0ha4Ul9XVQvW1WT0CSX9C+x4n+ ivWeswfD333HPkHjecQWUlpyIjSkerAplAoiKbEfGC7sQL9BH0xO18jXCDOko/PL8rZ+ GuKNASQSKlnrVrsVIg1UP7gxyBeA2V2/P63GR26kWZHtqvY5C3w1WJY4s0lKg6mTR4Un TQCiBKDmDg2lASlbTZPAo21aEvKZVXrjydVVXu8Vk8t2WwgDW5pTEkLozqrPD6NAcp87 tV/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=0vM9b8K/UJORLKnRRCKx9e/7lzHed4RGigtq2Lj4prc=; b=DpyEJPOnWHiZd65pmz/GkCMJYbP0olOVSYw/tDIIdEsXJRec4YDokHqFBC+hJrIGzw Lec2UopBecvibud7oYYiq6fGo5wRW/VNK/husRSZPh+1/N04ZsY0pKgRTqNInAo5kuC+ IiCQXNyNPViuyeZBT/LK8phVLQMrSz71Ze1ZOrDvpFeMoYtzgZaVvfIVayQzjvMTNsUx Y+js6LoiBsZ654fes+FAITcyyVg455QRgSKYDmyvE7kZNg7e826HT9yh8bibyAGrDxR6 hwOT2RUtTqicJEie/lJQujjVGt+FLKRZBZzlWzOX9blSA9B/84IYwQ6u3vCjcDex6hnL n1jg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t20si2150267oih.70.2020.02.13.23.40.03; Thu, 13 Feb 2020 23:40:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728773AbgBNHj7 convert rfc822-to-8bit (ORCPT + 99 others); Fri, 14 Feb 2020 02:39:59 -0500 Received: from coyote.holtmann.net ([212.227.132.17]:50319 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728691AbgBNHj7 (ORCPT ); Fri, 14 Feb 2020 02:39:59 -0500 Received: from marcel-macbook.fritz.box (p4FEFC5A7.dip0.t-ipconnect.de [79.239.197.167]) by mail.holtmann.org (Postfix) with ESMTPSA id C1C4DCECE1; Fri, 14 Feb 2020 08:49:20 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) Subject: Re: [PATCH] Bluetooth: hci_h5: btrtl: Add support for RTL8822C From: Marcel Holtmann In-Reply-To: <20200213075140.25105-1-max.chou@realtek.com> Date: Fri, 14 Feb 2020 08:39:56 +0100 Cc: Johan Hedberg , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, alex_lu@realsil.com.cn, hildawu@realtek.com, kidman@realtek.com Content-Transfer-Encoding: 8BIT Message-Id: References: <20200213075140.25105-1-max.chou@realtek.com> To: Max Chou X-Mailer: Apple Mail (2.3608.60.0.2.5) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Max, > Add new compatible and FW loading support for RTL8822C. > > Signed-off-by: Max Chou > --- > drivers/bluetooth/Kconfig | 2 +- > drivers/bluetooth/btrtl.c | 12 ++++++++++++ > drivers/bluetooth/hci_h5.c | 18 +++++++++++++++++- > 3 files changed, 30 insertions(+), 2 deletions(-) > > diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig > index f7aa2dc1ff85..052020b07e56 100644 > --- a/drivers/bluetooth/Kconfig > +++ b/drivers/bluetooth/Kconfig > @@ -211,7 +211,7 @@ config BT_HCIUART_RTL > depends on BT_HCIUART > depends on BT_HCIUART_SERDEV > depends on GPIOLIB > - depends on ACPI > + depends on (ACPI || SERIAL_DEV_CTRL_TTYPORT) > select BT_HCIUART_3WIRE > select BT_RTL > help > diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c > index 577cfa3329db..67f4bc21e7c5 100644 > --- a/drivers/bluetooth/btrtl.c > +++ b/drivers/bluetooth/btrtl.c > @@ -136,6 +136,18 @@ static const struct id_table ic_id_table[] = { > .fw_name = "rtl_bt/rtl8761a_fw.bin", > .cfg_name = "rtl_bt/rtl8761a_config" }, > > + /* 8822C with UART interface */ > + { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV | > + IC_MATCH_FL_HCIBUS, > + .lmp_subver = RTL_ROM_LMP_8822B, > + .hci_rev = 0x000c, > + .hci_ver = 0x0a, > + .hci_bus = HCI_UART, > + .config_needed = true, > + .has_rom_version = true, > + .fw_name = "rtl_bt/rtl8822cs_fw.bin", > + .cfg_name = "rtl_bt/rtl8822cs_config" }, > + > /* 8822C with USB interface */ > { IC_INFO(RTL_ROM_LMP_8822B, 0xc), > .config_needed = false, > diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c > index 0b14547482a7..666b0c009004 100644 > --- a/drivers/bluetooth/hci_h5.c > +++ b/drivers/bluetooth/hci_h5.c > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -786,6 +787,7 @@ static const struct hci_uart_proto h5p = { > static int h5_serdev_probe(struct serdev_device *serdev) > { > const struct acpi_device_id *match; > + const void *data; > struct device *dev = &serdev->dev; > struct h5 *h5; > > @@ -799,7 +801,11 @@ static int h5_serdev_probe(struct serdev_device *serdev) > h5->serdev_hu.serdev = serdev; > serdev_device_set_drvdata(serdev, h5); > > - if (has_acpi_companion(dev)) { > + data = of_device_get_match_data(dev); > + if (data) > + h5->vnd = (const struct h5_vnd *)data; > + > + if (!data && has_acpi_companion(dev)) { > match = acpi_match_device(dev->driver->acpi_match_table, dev); > if (!match) > return -ENODEV; why is this change done this way? if (has_acpi_companion(dev)) { /* do the ACPI stuff */ } else { /* do the OF stuff */ } > @@ -1003,6 +1009,15 @@ static const struct dev_pm_ops h5_serdev_pm_ops = { > SET_SYSTEM_SLEEP_PM_OPS(h5_serdev_suspend, h5_serdev_resume) > }; > > +static const struct of_device_id rtl_bluetooth_of_match[] = { > +#ifdef CONFIG_BT_HCIUART_RTL > + { .compatible = "realtek,rtl8822cs-bt", > + .data = (const void *)&rtl_vnd }, > +#endif > + { }, > +}; > +MODULE_DEVICE_TABLE(of, rtl_bluetooth_of_match); > + > static struct serdev_device_driver h5_serdev_driver = { > .probe = h5_serdev_probe, > .remove = h5_serdev_remove, > @@ -1010,6 +1025,7 @@ static struct serdev_device_driver h5_serdev_driver = { > .name = "hci_uart_h5", > .acpi_match_table = ACPI_PTR(h5_acpi_match), > .pm = &h5_serdev_pm_ops, > + .of_match_table = rtl_bluetooth_of_match, > }, > }; And I did post an initial bt3wire.c driver that would be a lot better and cleaner than trying to add everything to hci_h5.c. Regards Marcel