Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2372288ybc; Wed, 13 Nov 2019 13:25:44 -0800 (PST) X-Google-Smtp-Source: APXvYqxxsbBX2UXElxVzzM+UPvOohjFjjYokVk75TJzmS22A9p2pzIuEa7E0W/tAwdQr8/d0JTbK X-Received: by 2002:a17:906:f10:: with SMTP id z16mr5134984eji.211.1573680344301; Wed, 13 Nov 2019 13:25:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573680344; cv=none; d=google.com; s=arc-20160816; b=dbYjuteL+Rq409ML8CNna23hwCech63n/lXJw0ZH7roMSdxNTEJ1wsU62AnAWydELN 3dHyy7UvREzjNtV8iDyvLPd7geY3pEjb1QA/FNYAStrSCp9qADbPRM2zlYXmO5QlgmrI bYTtlVMqG/cVmuoNd0nlqMSPJ4v4jjOj4ltFyneccrZ3YVAVj5sJNwdntGKEzBTvQ/Jn 3HblZ3fpARsLsdUVMN2aZFa5Ph0JEWEohl17BkyXs5/Og1eAUBFrSxcswnXhjJOoe4UE D2ikFPW5Cx8g3iLgEKZokDm18KfSV5iZwqxwxQqAtMOp6h7UIQV4HyCux3GASJBgAbiY m48g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=H5D+0l5YX7kW94tdUvORkwws9N/E0rSMWEMH/aWYGCM=; b=EjJG29f67RzAwdKKH9Vj1mibSU+Sa38YCFyUvzAR42KnW4bGvFLZEFMnKQolIAaR+M o7pPQ9xXt7BNiLKId7XdcnkYZzrGIuz93t1bx5QDv0/dNa4FIgaUjZVb/biftAflCvYs iOj3MsT2MfdGASzho7MTsetIDj2F4FZ213qHCUP7+Wzi8+LKobM9X0RE+SClBHAksdrD /X+ADemMN1Ht8e2glkDX3PZ2snn3xB5u7kjD3/FFigEcGCRvxwkm0aUCwxne+BGNOQlr jX48HQLkPD7XaPSgMcnXCpZ5TfTcRvp5gfIQdmdAt5eAirIOP7nK/CAjiD/OgtCY6MZe YR4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RuGtcHgy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3si2582185eda.251.2019.11.13.13.25.04; Wed, 13 Nov 2019 13:25:44 -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; dkim=pass header.i=@chromium.org header.s=google header.b=RuGtcHgy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726548AbfKMVWq (ORCPT + 99 others); Wed, 13 Nov 2019 16:22:46 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:35771 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726162AbfKMVWp (ORCPT ); Wed, 13 Nov 2019 16:22:45 -0500 Received: by mail-qk1-f195.google.com with SMTP id i19so3145579qki.2 for ; Wed, 13 Nov 2019 13:22:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=H5D+0l5YX7kW94tdUvORkwws9N/E0rSMWEMH/aWYGCM=; b=RuGtcHgyES0alZRPSvzuMKMS1akTNwu8rQqiiE0qNV3Qy3YnFzheMDE/xjJqUpG0n9 EVGOjLnrQWIDNgAX0oTU7HKxDB6xJU2s7+XLerRGujebZFWK6n24xMEEQRgdD1lViHwG w8kUz0mo1XPBJQgPuFeKE7ef3jqWCBWgufGZE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=H5D+0l5YX7kW94tdUvORkwws9N/E0rSMWEMH/aWYGCM=; b=OLew7W04CGLO1WX2uPlwYMEF4RKOy+Lm1gmoIfPEOBhHcWfI97qGdqhVbWHlcMobwf EpheIbTzJLSdKpabK/NqlmiSTFWuLf3YYj/MuRLFvtU/qykaiUxckZEfILj5BoC2oBHG +7h6Y4AkhALw6Tz0EDYDqir+QtHlEx7EnEoH2Ug4CIMmRrjDFnd+HLgEj2FSrTebVm2g TOblXcKGY/OlocjZEy4vkgBb69EIn9pBaymteIiZLtav72tRdl22pFWbG32FSYHsnWEV OFv8CfDbxHeXJq1f9U3hygPm1xKL4hK3wbM93xYt1Ulb0NwYIkj2gCK0vrjjl9dILCu1 FsBw== X-Gm-Message-State: APjAAAUThmVZDBlc+frekfzRNuKfj70bioz+eW9Z0z8UK4t4dJa/NNZB mrOc2M/DejdxbUnt5VSxiNMJ+OUpO9f40RjdlAmV/g== X-Received: by 2002:a05:620a:1032:: with SMTP id a18mr3070746qkk.305.1573680162664; Wed, 13 Nov 2019 13:22:42 -0800 (PST) MIME-Version: 1.0 References: <20191112230944.48716-1-abhishekpandit@chromium.org> <20191112230944.48716-4-abhishekpandit@chromium.org> In-Reply-To: From: Abhishek Pandit-Subedi Date: Wed, 13 Nov 2019 13:22:31 -0800 Message-ID: Subject: Re: [PATCH v4 3/4] Bluetooth: hci_bcm: Support pcm params in dts To: Marcel Holtmann Cc: Johan Hedberg , Rob Herring , linux-bluetooth@vger.kernel.org, Douglas Anderson , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Marcel, On Tue, Nov 12, 2019 at 4:18 PM Marcel Holtmann wrote: > > Hi Abhishek, > > > BCM chips may require configuration of PCM to operate correctly and > > there is a vendor specific HCI command to do this. Add support in the > > hci_bcm driver to parse this from devicetree and configure the chip. > > > > Signed-off-by: Abhishek Pandit-Subedi > > --- > > > > Changes in v4: None > > Changes in v3: None > > Changes in v2: None > > > > drivers/bluetooth/hci_bcm.c | 32 ++++++++++++++++++++++++++++++++ > > 1 file changed, 32 insertions(+) > > > > diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c > > index 6134bff58748..4ee0b45be7e2 100644 > > --- a/drivers/bluetooth/hci_bcm.c > > +++ b/drivers/bluetooth/hci_bcm.c > > @@ -88,6 +88,8 @@ struct bcm_device_data { > > * used to disable flow control during runtime suspend and system sleep > > * @is_suspended: whether flow control is currently disabled > > * @disallow_set_baudrate: don't allow set_baudrate > > + * @has_pcm_params: whether PCM parameters need to be configured > > + * @pcm_params: PCM and routing parameters > > */ > > struct bcm_device { > > /* Must be the first member, hci_serdev.c expects this. */ > > @@ -122,6 +124,9 @@ struct bcm_device { > > bool is_suspended; > > #endif > > bool disallow_set_baudrate; > > + > > + bool has_pcm_params; > > + struct bcm_set_pcm_int_params pcm_params; > > }; > > > > /* generic bcm uart resources */ > > @@ -596,6 +601,16 @@ static int bcm_setup(struct hci_uart *hu) > > host_set_baudrate(hu, speed); > > } > > > > + /* PCM parameters if any*/ > > + if (bcm->dev && bcm->dev->has_pcm_params) { > > + err = btbcm_set_pcm_int_params(hu->hdev, &bcm->dev->pcm_params); > > + > > + if (err) { > > + bt_dev_info(hu->hdev, "BCM: Set pcm params failed (%d)", > > + err); > > + } > > + } > > + > > finalize: > > release_firmware(fw); > > > > @@ -1132,7 +1147,24 @@ static int bcm_acpi_probe(struct bcm_device *dev) > > > > static int bcm_of_probe(struct bcm_device *bdev) > > { > > + int err; > > + > > device_property_read_u32(bdev->dev, "max-speed", &bdev->oper_speed); > > + > > + err = device_property_read_u8(bdev->dev, "brcm,bt-sco-routing", > > + &bdev->pcm_params.routing); > > + if (!err) > > + bdev->has_pcm_params = true; > > I think in case of HCI as routing path, these should be using the default or zero values as defined by Broadcom. I'm not sure what these default values should be. Wouldn't it be reasonable to expect the user/developer to set the various brcm parameters in device tree? If unset, it's just 0. > > > + > > + device_property_read_u8(bdev->dev, "brcm,pcm-interface-rate", > > + &bdev->pcm_params.rate); > > + device_property_read_u8(bdev->dev, "brcm,pcm-frame-type", > > + &bdev->pcm_params.frame_sync); > > + device_property_read_u8(bdev->dev, "brcm,pcm-sync-mode", > > + &bdev->pcm_params.sync_mode); > > + device_property_read_u8(bdev->dev, "brcm,pcm-clock-mode", > > + &bdev->pcm_params.clock_mode); > > + > > I would add some sanity checks here. > > Regards > > Marcel >