From patchwork Fri Apr 22 16:02:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: icenowy@outlook.com X-Patchwork-Id: 565029 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CC4EC433EF for ; Fri, 22 Apr 2022 16:03:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348447AbiDVQGD (ORCPT ); Fri, 22 Apr 2022 12:06:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376307AbiDVQGB (ORCPT ); Fri, 22 Apr 2022 12:06:01 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12olkn2031.outbound.protection.outlook.com [40.92.21.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C10BD5E157; Fri, 22 Apr 2022 09:03:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gXEfS3YzJHlPKKvo1soZeLQjCAqMPAeTQyQ1w/uqmXBi86Q41rVwexyxlw57RZINriVokLCn7eF8PMfZOeRm2ovJjfeNtHQ6UNxM8Y7d6BhTO52KTFw7uJ0ueuPEHg1JflNC+yfLtcBO2rojiZqDdpBTbwtxQxJNpVo9R6gPAEjHXf5Ne1PB0yzvdtXvysWnWA3cYQ3mRYi9J+xkhKwr2HixdjZEKsGK+rZ5QISA2K0RvQ6uixbBfXr7TfVNegmtIFfUE/jNQI+pKMgCIdPSkTV1v+S/MN50IFkOFRKjIei08WDzNqohKaV1n4GWeMnnp+Eo5O45vwLgc2nL98NPkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HBiWX7yEUfEk7mpXtQQGrm6vN3vRvCXaaarN+9t3hrc=; b=YVeyh16IGSjpy6mjcVpSG7Z08ezrMylszwHrtNxlba8DvN58m5pVJAeTJZHVaEamPrrhSQeL0TKoqhCYXDm+Xr9EQC/D7zJhV3Nvqia/dnQgyLuo61z3ozsuheQWZQGDTFghB5o/RzV2J7gxWXjjE9sKZrQgWKzZxqiGewIu9785Ql2BCGiBpHeltop6iguB0iyI7pylfjy9NJJuD/pDDcsj1+fRxkgFgqy1/8uFc57ND4w/SBxI2XNC4QwXS85jb/mopEpivG/xKNarqaEuVLFje+b3pQSO1YKdg9exLi3TClK9KhgJ1sD8CaMcvCmoOa9SLv5hclluvBtzvKb/Vg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HBiWX7yEUfEk7mpXtQQGrm6vN3vRvCXaaarN+9t3hrc=; b=FnJPc5OBzPHNMShuXOAbHjEahU4d/O3SwmWbkuRzkgLw2e+lKA0mooPaN3/w90i+Am0ui03gamueR3CwSMlvqcKZPvY7hDGyAiz7/kRz3nVcYaYTk1UvFP58tx56iHQgQbLE93RutOtynO5iBkpDx6D0+G1dg42X7YiQzuHnWJWJs6O0tbzlIKkqncjWluGVJLBQGvlOmWBhdSEnxO6GCZ9UhJHLVVxqdhM6K6uTTvGx9EsOu8mXrrV5mW+nzLqrlY0Q5xleR+CPqN2u4bdD6+64GLRE1jGcnzadS40Kr/yfSC+6ZFraU8f4Ff9/E+urUg24zGAdfD07LIA3jRXDGQ== Received: from BYAPR20MB2472.namprd20.prod.outlook.com (2603:10b6:a03:155::16) by CY4PR2001MB1685.namprd20.prod.outlook.com (2603:10b6:910:68::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.15; Fri, 22 Apr 2022 16:03:04 +0000 Received: from BYAPR20MB2472.namprd20.prod.outlook.com ([fe80::3480:160a:eb92:d6e3]) by BYAPR20MB2472.namprd20.prod.outlook.com ([fe80::3480:160a:eb92:d6e3%6]) with mapi id 15.20.5186.015; Fri, 22 Apr 2022 16:03:04 +0000 From: icenowy@outlook.com To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev, Icenowy Zheng Subject: [PATCH 2/3] Bluetooth: btrtl: use board DT compatible string as config postfix Date: Sat, 23 Apr 2022 00:02:30 +0800 Message-ID: X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220422160231.1072810-1-icenowy@outlook.com> References: <20220422160231.1072810-1-icenowy@outlook.com> X-TMN: [J9oeLPeTfYsRuFZxyCX9oQJldRlnxkhq] X-ClientProxiedBy: HK2PR04CA0070.apcprd04.prod.outlook.com (2603:1096:202:15::14) To BYAPR20MB2472.namprd20.prod.outlook.com (2603:10b6:a03:155::16) X-Microsoft-Original-Message-ID: <20220422160231.1072810-3-icenowy@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1e54a173-6c65-4a66-dabb-08da247994ee X-MS-TrafficTypeDiagnostic: CY4PR2001MB1685:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IlVPdg8toQQFsGTLZRlSh7bGTDqWVrY23i4OGekRPavASQjiQ0UxNM4xSPn3nZweYfXNOvO62s45nSo6eeUJiFuGgT0QMKwMcE0MikfhJweJDkKZJVZA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36HKBtiLpB3l2mv1AeFQDT4bx1otLZSX/N1SUvO/iqgTkYTVQ2COVEcRy/u2LF6uQ99+DOgMIcJks2uptLVyC4G//1NqX8g6z8rSdzVC54xB8SEC3iQAUyicTi/B7ShM+6h+VXDD5iMe2XIWZ857qISyQHlkV/YovDEFWqKUiGvG48SjhojneYkXzOJvYveUBRl95n/Swt+/sRcVBEpBJ7ht+cAFfbO7bXTYSyUY917ZF5Tb1xVZ+tl0JixSQcd/5GRa7pBz7a0ktqLuYgw7VOlindaMCKO8jeaaXUuyFeHmlfOTDVJIKO4uZ0JIaKDGTdiQAvODvXe2Y2wPBPf6qZr77pT3PhtCOxFNhsRN3LTWdZ8YQY/KznV1UxoTPHlavrnZ6zPW8/bZUHkoi2bB2PJ5zeS/m31BxIDt6exxa9aUJ8pLhUUrX6C9K5hHZxLRUm6R1UfOiJradR2z89upFNL7L8bNr8/iwS5vBkFogYlPv4gyipbDAaE7oANi37Ycx2Az7w6aUKZCGB2VTs9PbXa3Qub2m8AyAEatGxclTn5cZDNqrch5T1IYJTCsVLI3h36wQwzOlTS9qbS8RvhYl1VLB4tRuz68pcnJ6vKudY7mGd60EBWR32GAk78AcmMacR9CLigLVWj4miHVk5z7kz+lti7HdVdEZ2oyMvkVAwqLE0nJOGxDbqYI/zNKyjoQB8jvbbeYZB/nnYUO75Yreeq23o/Cpob2qFNQ2+RaHJIYvGXJkFyFNxikISeXyd68KeDnIa6g4Gghh0nQ0cHNjISBviFjghdL4CZ5Pg4ecGbJ/qFh0VztHQesw/BnCSdSTXDQT602H5TE3J5ITOmBX1b/wJNJRhsC86QIo/Ena02sXn1kXfTRQxOfQ+Q6Rcjhy9XaSFHvJmZdJWY= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e54a173-6c65-4a66-dabb-08da247994ee X-MS-Exchange-CrossTenant-AuthSource: BYAPR20MB2472.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2022 16:03:03.9982 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR2001MB1685 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Icenowy Zheng Mimic the behavior of brcmfmac driver, which uses the DT compatible string of the board as the NVRAM postfix. Signed-off-by: Icenowy Zheng --- drivers/bluetooth/hci_h5.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c index c5a0409ef84f..d1f90b23a5e0 100644 --- a/drivers/bluetooth/hci_h5.c +++ b/drivers/bluetooth/hci_h5.c @@ -817,6 +817,7 @@ static int h5_serdev_probe(struct serdev_device *serdev) { struct device *dev = &serdev->dev; struct h5 *h5; + struct device_node *root; const struct h5_device_data *data; h5 = devm_kzalloc(dev, sizeof(*h5), GFP_KERNEL); @@ -847,6 +848,32 @@ static int h5_serdev_probe(struct serdev_device *serdev) return -ENODEV; h5->vnd = data->vnd; + + /* Set id to the first string of the machine compatible prop */ + root = of_find_node_by_path("/"); + if (root) { + int i, len; + char *id; + const char *tmp; + + of_property_read_string_index(root, "compatible", 0, + &tmp); + + /* + * get rid of '/' in the compatible string to be able + * to find the FW + */ + len = strlen(tmp) + 1; + id = devm_kzalloc(dev, len, GFP_KERNEL); + strscpy(id, tmp, len); + for (i = 0; i < id[i]; i++) { + if (id[i] == '/') + id[i] = '-'; + } + h5->id = id; + + of_node_put(root); + } } if (data->driver_info & H5_INFO_WAKEUP_DISABLE)