Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1198549ybc; Tue, 12 Nov 2019 16:19:26 -0800 (PST) X-Google-Smtp-Source: APXvYqxJ3dPiUhvy5vzvXJApQJ4t1ewJ92VFtzuyickHvPBNFQnItfx7paELK6n4amnZi+X9qLw8 X-Received: by 2002:a17:906:73d5:: with SMTP id n21mr90576ejl.228.1573604365886; Tue, 12 Nov 2019 16:19:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573604365; cv=none; d=google.com; s=arc-20160816; b=WCy6akLxX0ncac7csm23HWU8zwebwQKP6vmsORHPtmmqBEwiF80QNE2qC3uJfY6uUQ bgIyPsHW52rDpL2HpicTj0xC3PkR/nhKFpXM+1uyCswJsDYIIQCeQz5CNTa7328U5fpq TmF0NVO/gGKftzHbCXZu0p2NxggTMQZo2JGkfi5sjlw/92kpMfqd6CQRdJOYfTvN6TyA 7r6PIS4UVQx9VVJZN0gSUzA9zmp/P7iMQgPZ60u2UwZEBqGiHiKW68nypz6VobFw4T7h +OwaDYxj0bPPzeI1xvVcyFLed1ZwQQ0xlcrhsdfWEOMwh8CMf5mN9DZkilsvzkTa1Lcp 7qUw== 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=9BVcg7mrnh1ornsmpgFk8pqfUaRFmxz6BubuouxwlmI=; b=cls6DWVIxb6v5D0yryMuUMGIdqI4YJeSVl2ZeiUmDeX7wFyMXmmcEvnUenjr96w7nu +7wVdAksL0LYxL7qgS98lxWbKMuoIPdjAcqRXbNv6sIR4yDbJCrT1+pZSp1u0sgkEIj/ UrPEDn3syjaQVr3IKoY2whnGBYEkGKZGmXNSeOAd1F+SIk7Q+t/CPLR8iMsZpkNNzPJn oOwLhhY98zc2mB0R2rOa+q4k8CztgNwvmi5xW3auOVeKlvGz0mva0irdnjZWZx6YC2RM WU04q7RB3DqcqN5adCm7P7uraqGpgvoRZo3jNFdpSJooAMsEdRZKuEAv1AzA851xHy4a kNpQ== 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 h15si93567ejd.368.2019.11.12.16.19.00; Tue, 12 Nov 2019 16:19:25 -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 S1726936AbfKMAS4 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 12 Nov 2019 19:18:56 -0500 Received: from coyote.holtmann.net ([212.227.132.17]:53629 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726910AbfKMAS4 (ORCPT ); Tue, 12 Nov 2019 19:18:56 -0500 Received: from marcel-macbook.fritz.box (p4FF9F0D1.dip0.t-ipconnect.de [79.249.240.209]) by mail.holtmann.org (Postfix) with ESMTPSA id 92FB9CECF4; Wed, 13 Nov 2019 01:28:00 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3601.0.10\)) Subject: Re: [PATCH v4 3/4] Bluetooth: hci_bcm: Support pcm params in dts From: Marcel Holtmann In-Reply-To: <20191112230944.48716-4-abhishekpandit@chromium.org> Date: Wed, 13 Nov 2019 01:18:54 +0100 Cc: Johan Hedberg , Rob Herring , linux-bluetooth@vger.kernel.org, dianders@chromium.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: References: <20191112230944.48716-1-abhishekpandit@chromium.org> <20191112230944.48716-4-abhishekpandit@chromium.org> To: Abhishek Pandit-Subedi X-Mailer: Apple Mail (2.3601.0.10) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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. > + > + 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