Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1445442ybx; Tue, 5 Nov 2019 16:30:52 -0800 (PST) X-Google-Smtp-Source: APXvYqwF1t4GTCF1qUpgpiXOlTjPloyd53KHANF4Vsp+AR+PIoyDbqMJVb18n6cH6C6G3vJVIZII X-Received: by 2002:a17:906:4d93:: with SMTP id s19mr21445798eju.285.1573000252301; Tue, 05 Nov 2019 16:30:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573000252; cv=none; d=google.com; s=arc-20160816; b=iKy2rx/kVV5CV06NR49CCiVCpJV3FUsRmQmyUv+bsJqdJo42oVycb5HPANYK0sYgNz OEbWez3p+3oxJ6wu4i+6gzto8H3aRlsNeZcFqE4vj5bvCkqZMvfWGS7c2wN2sPDg41TR otYxk1CAw722CcDOgqLz14pbQ2xUfmDhEod256q76ZmSnE4cazCa4Y04CbqXFCSEw/1s AjKrj0lxmR0HaoNnPQgr+LQuyPpJSo9hckZvaEAbntLMEv6K7bV3jOV1u9aHG3Ylip+D iD8fhsMT2fffyxAFr/nZhHbZ6JhIOsvEqOVcmrwi9rGWelOQiK1QQ0qp88iVD2ayIz/+ aYyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qn/J/1PPzN9yYPx8ms3UdKQj06L6swPahcKzYXCyGo4=; b=HQkePAIAQNc10MJNpH7EPlq5FKe3IDXQTq8h5cRRPm4iP5lZ/VZvIV3MAo9jrB2ITG RklfBAEvoaSfKBNszajimO6ryTiVluTq4uEaKYbD2bEXIzO2cm+KkzgofEfNoQaaHHKG LUFq1A4b/ANWXmzkmrd8FmBuuYOAkQe4j0g5paR36vQj6TFCA2wJVeTwj54q0DNYbkAD IUNq08LU1HtBgm5aAhud7Yp8VV+zrHT9OpWaLNgyv53qFCHkGWI4TOOQIH9LQARxFxAB FsLzBwy6Q6tV3OMYUFjLVBC/LZYDYAx8XcTzjVPTx8XrhOoZ8m4zOfdcWcMp2r6QdZzv kQCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZOQEjBet; 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 y61si11876743ede.24.2019.11.05.16.30.28; Tue, 05 Nov 2019 16:30:52 -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=ZOQEjBet; 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 S1730319AbfKFAaL (ORCPT + 99 others); Tue, 5 Nov 2019 19:30:11 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:43831 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730620AbfKFAaJ (ORCPT ); Tue, 5 Nov 2019 19:30:09 -0500 Received: by mail-pf1-f196.google.com with SMTP id 3so17406882pfb.10 for ; Tue, 05 Nov 2019 16:30:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qn/J/1PPzN9yYPx8ms3UdKQj06L6swPahcKzYXCyGo4=; b=ZOQEjBetAhlpeBEjjy35YzhHVGrbMEHXWH4SxMAcEk6gHOyX7cYfh0qG3+v3Gnxete swT0iYfkaaiadSbE9Sqn6OK0nwyZ9P3n6d9NzICQ6h5urypunAwaZBqNk6fuXPcAgtEr FuKAnkmA3RLkbRVUYXbtQPDrh8e+iM3AsTFHk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qn/J/1PPzN9yYPx8ms3UdKQj06L6swPahcKzYXCyGo4=; b=INUDN1qimyTiPP04g0Stgq1iVV/QjuLwJhbi7HTcTu23F5adoBgdjkGZft9tVW5UaN aCGwtjHj1Ds0n5ns8XQHWEED84iOngVx6BmwFh7c4CBbDMSHx27ORfPEpG1rqxx+FgSQ aFid6K2KF0Cew0bQ3+WVBGwy8GQpCLJwy42Ts63Vg49py3p/jGJt2NBbtUq7FVL+2LIW gKQwlVH06A2R2paZZPEjrigvp2Y+rZx+GEjwj3woBF4E56acdEnRhrFlcaeqf6XErHyv 0cAlFFMBqTm9AQPwYHHKUi3iNRyjRirjU27OQtTjKgTHVWQPjEv89HPEt/an0RRPzhx0 gRfw== X-Gm-Message-State: APjAAAU7dUUXM2f9fF9g3hzF2IzvMRaL6pamo632BhwIFaB94M9uNYEe yfH7/XzFvYtpm/+RVTtxR92nYw== X-Received: by 2002:a63:ff26:: with SMTP id k38mr40736136pgi.128.1573000208956; Tue, 05 Nov 2019 16:30:08 -0800 (PST) Received: from apsdesk.mtv.corp.google.com ([2620:15c:202:1:e09a:8d06:a338:aafb]) by smtp.gmail.com with ESMTPSA id k9sm21032835pfk.72.2019.11.05.16.30.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 16:30:08 -0800 (PST) From: Abhishek Pandit-Subedi To: Marcel Holtmann , Johan Hedberg Cc: linux-bluetooth@vger.kernel.org, Abhishek Pandit-Subedi , linux-kernel@vger.kernel.org Subject: [PATCH 3/4] Bluetooth: hci_bcm: Support pcm params in dts Date: Tue, 5 Nov 2019 16:29:22 -0800 Message-Id: <20191106002923.109344-4-abhishekpandit@chromium.org> X-Mailer: git-send-email 2.24.0.rc1.363.gb1bccd3e3d-goog In-Reply-To: <20191106002923.109344-1-abhishekpandit@chromium.org> References: <20191106002923.109344-1-abhishekpandit@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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 --- drivers/bluetooth/hci_bcm.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c index 4fe66e52927d..e94908a7e407 100644 --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c @@ -79,6 +79,7 @@ * @hu: pointer to HCI UART controller struct, * used to disable flow control during runtime suspend and system sleep * @is_suspended: whether flow control is currently disabled + * @pcm_params: Bytestring of pcm int and format params. */ struct bcm_device { /* Must be the first member, hci_serdev.c expects this. */ @@ -112,6 +113,9 @@ struct bcm_device { struct hci_uart *hu; bool is_suspended; #endif + + bool has_pcm_params; + u8 pcm_params[BCM_PCM_PARAMS_COUNT]; }; /* generic bcm uart resources */ @@ -529,6 +533,8 @@ static int bcm_setup(struct hci_uart *hu) const struct firmware *fw; unsigned int speed; int err; + struct bcm_set_pcm_int_params int_params; + struct bcm_set_pcm_format_params format_params; bt_dev_dbg(hu->hdev, "hu %p", hu); @@ -576,6 +582,23 @@ 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) { + memcpy(&int_params, &(bcm->dev->pcm_params[0]), + sizeof(int_params)); + memcpy(&format_params, &(bcm->dev->pcm_params[5]), + sizeof(format_params)); + + err = btbcm_set_pcm_params(hu->hdev, &int_params, + &format_params); + + if (err) { + bt_dev_info(hu->hdev, "BCM: Set pcm params failed (%d)", + err); + } + + } + finalize: release_firmware(fw); @@ -1112,7 +1135,15 @@ static int bcm_acpi_probe(struct bcm_device *dev) static int bcm_of_probe(struct bcm_device *bdev) { + int plen; + device_property_read_u32(bdev->dev, "max-speed", &bdev->oper_speed); + plen = device_property_read_u8_array(bdev->dev, "pcm-parameters", + bdev->pcm_params, + BCM_PCM_PARAMS_COUNT); + if (plen == 0) + bdev->has_pcm_params = true; + return 0; } -- 2.24.0.rc1.363.gb1bccd3e3d-goog