Received: by 10.192.165.148 with SMTP id m20csp481015imm; Fri, 27 Apr 2018 02:17:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqDWbeqFJ3RaeIL3nTuAE6inllAswwnB93IVVPJvuKSFQD/KKn+vTfab5I31zuKGDReofMv X-Received: by 2002:a17:902:9303:: with SMTP id bc3-v6mr1579319plb.18.1524820625773; Fri, 27 Apr 2018 02:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524820625; cv=none; d=google.com; s=arc-20160816; b=uVYtTNLaFldGXnu+A/h/Pp8VnGXGOsDhWz/unqOreSzQQSiuO/UvnSi4zrj+DSYkHT Na/7HxjHZtgqQ6x94SwwWwLqgqorKXH3hX7VQDfeoturPzfJRk4Ke9qINM1tYEfeoOyj Djau3LGX9sO1wWz/2kN96UgVFqwmP4pFhnRpeLk81FvLnfNxAPaGpSCIMxUmZbLddzwT xrGwxLBusG4Vew6aIkEqb8Qo8rC8rfIowmDbtli6PWLl4ODue/CeNUToC2xuzi5Hwr2V YH3ONwleysCRBWqhbrXRBmNzuagsVbaxHcrX0RIzahCXUKg9o7/6Zs2KQpGajIOwwZI3 jUaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=Ar72JZjzGnL8nRprvwZodMQigOhM3JHHRgYDbm6SBus=; b=sCcVCwVWXLQfG95EhJHB1bzoBQHPW1BP3994NyE/BTylTtHFiTW503WOQtrjm4NwH3 2HNfH+e+tRF62srbluu/07R6exzVhq1sH6ZgCg5T/3WBd6b3LMmSaEx6sKsfNy/tj+Aw FJ3OuX4TyOT2YcsCu3gfMi26Q7EDJuqnMtEhYMwwArfkvmjAx/HwSeEwlVC+EhFQjcgs CC79Q6Ma5GYC6i2hs3ePVS5nrynurxd7oJcFr4ffUm1YLO01k2Hc4sNFU23fNP7ngxIn 0c4uOejczaMA2XVkqqd7yDJmS35C7PLXJFu+StGhdO/1jLPfCo4NRCyCTc32PYWA5cKD TZMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 l4-v6si898889plb.213.2018.04.27.02.16.51; Fri, 27 Apr 2018 02:17:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757645AbeD0JOf (ORCPT + 99 others); Fri, 27 Apr 2018 05:14:35 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:64458 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751557AbeD0JOc (ORCPT ); Fri, 27 Apr 2018 05:14:32 -0400 X-UUID: 4492efed9df9431ba4bb76e7778f9e04-20180427 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1681407856; Fri, 27 Apr 2018 17:14:30 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 27 Apr 2018 17:14:28 +0800 Received: from [172.21.77.33] (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Fri, 27 Apr 2018 17:14:28 +0800 Message-ID: <1524820468.12322.205.camel@mtkswgap22> Subject: Re: [PATCH v1 6/7] Bluetooth: hci_mediatek: Add protocol support for MediaTek serial devices From: Sean Wang To: Marcel Holtmann CC: Rob Herring , Mark Rutland , Johan Hedberg , devicetree , BlueZ development , linux-arm-kernel , , Date: Fri, 27 Apr 2018 17:14:28 +0800 In-Reply-To: References: <1524728068.12322.125.camel@mtkswgap22> <0DB4E6C1-28AD-41B7-8623-10046809A686@holtmann.org> <1524802381.12322.164.camel@mtkswgap22> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 8bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-04-27 at 07:25 +0200, Marcel Holtmann wrote: > Hi Sean, > > >>>>> This adds a driver for the MediaTek serial protocol based on H4 protocol, > >>>>> which can enable the built-in Bluetooth device inside MT7622 SoC. > >>>>> > >>>>> Signed-off-by: Sean Wang > >>>>> --- > > [... snip ...] > > > > where could I find the newest btuart.c (which seems cannot be found in > > 4.17 rc2)? It seems a time to rewrite the driver based on btuart.c > > It is not merged yet. I posted RFC patches to the mailing list. > got it. > > > > the Bluetooth device can't survive in a power/down cycle and > > > > * power on should be including > > - enable clk and power domain > > - download firmware through specific ACL command > > - send specific commands to configure bluetooth (Required to note that > > the steps should be after downloading firmware because the behavior for > > the command might be changed by the firmware) > > Then this sounds like you need a quirk that runs setup() after every open() and not just after the first open(). You would be the first hardware that looses their firmware, but that is fine, I almost expect that at some point someone comes along and requires this. So just create a new HCI_QUIRK_NON_PERSISTENT_SETUP. > Yes, it should be good to have an option HCI_QUIRK_NON_PERSISTENT_SETUP to allow us to run setup() for every open(). When users are feeling unexpected thing happening on its device, they always have a habit trying to restart device from UI. If close() -> open() can completely power reset a bluetooth device and then it can recover from any fatal error to the initial state as at boot. It's good for these problems specially hard to be reproduced and required to reboot the whole machine to save. However, it would take a little longer time on open() since it takes extra time to make firmware download and reconfiguration. > > * power off should be including > > - send specific commands, such as to disable bluetooth > > So try to put these in shutdown() > got it. > > - disable power domain and clk > > And do this in close(). > got it. > > > >>> > >>>>> + > >>>>> + return err; [ ... snip ....] > .open = mtk_open, > >> > > Go with a brand new btmtkuart.c driver. I really sounds you don’t want the hci_ldisc.c framework in your way. You want direct control over the core callbacks. > 1) In fact. the device is working via a internal serial bus, rather than via uart for mt7622. so could i call it btmtkserial.c ? Becasue mediatek indeed also have bluetooth over uart, if i called it btmtkserialc, the same code logic I think can be fit to all other devices using either uart or internal serial bus. 2) Yes, i don't want hci_ldisc. so far i thought serdev version is enough, and i preferred that bluetotoh device don't depend on any utility on user space to launch. 3) last question if i have bluetooth over usb, the usb version bluetooth can reuse btmtkserial.c code? > Regards > > Marcel >