From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 535943A9624; Wed, 24 Jun 2026 07:55:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.244.123.138 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782287718; cv=none; b=bTQoyTE5rbKyoXih06IhRR7dN7iuKjHGeN+DHOq+ZrlmezCy2q54ZiJOyvRtpTJhutxPfERgk8cQaV8CzPymuaSLolcD+IWnNQcPEstdCL2eFAQmIVl/eD3KgiwPH6K6IXQlSdvV8iqrO1Q+JeMEsGVt6QPVjHp7ix3nGfcAo0I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782287718; c=relaxed/simple; bh=c4WEYpdX3TBnXsEIPuHhD/JmKbQSMaNt6DSTnZpQOBA=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=QW0R4LURl/KDz3cQYLLuc6cIk17SFZ0M+WmV68Q5BNkk2WsLj94EKTXmbZElfQ46SoOr/SlVzcqAcumq4yvgJgpnEnjQNgl1vNtiU6Hg245PBxdCRWKrxhyNShjSA1iEG4C9MoGKY77pfGx0VrhzRvcSH7x8ZoiWs1R2Nbm0yx4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=QZc/55o2; arc=none smtp.client-ip=60.244.123.138 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="QZc/55o2" X-UUID: 049ad2986fa211f1b1788b6acf885367-20260624 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=6VCG6v+8XA2/B5x19Ry8OOA3z2LVXyd91grqtGUvXRQ=; b=QZc/55o2OZTNoRv549DjdeJ/pl1rEXFY6u7RBqsHBKypr2i1+9IzecsBxg+xdvIDSZ2wkIAC0ZE5nInG6eGkLxescckQGNztQh0eWbziJIt+CD7bO65Y5IvdjW5ebVD1eVZ56FC6tneE30Ff53lKYOm6eGc4OCZlbwZldGUT4lQ=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.17,REQID:21acba5c-118a-4bb3-933d-c83fabddd1dd,IP:0,U RL:0,TC:0,Content:0,EDM:-25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:d497b38,CLOUDID:e5ea6f45-d8c0-4c26-a341-e1551eb7b06d,B ulkID:nil,BulkQuantity:0,SF:102|136|836|865|888|898,TC:-5,Content:0|15|50, EDM:2,IP:nil,URL:0,File:130,RT:0,Bulk:nil,QS:nil,BEC:-1,COL:0,OSI:0,OSA:0, AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 049ad2986fa211f1b1788b6acf885367-20260624 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1165851499; Wed, 24 Jun 2026 15:55:07 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Wed, 24 Jun 2026 15:55:06 +0800 Received: from mtksitap99.mediatek.inc (10.233.130.16) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.2562.29 via Frontend Transport; Wed, 24 Jun 2026 15:55:06 +0800 From: Chris Lu To: Marcel Holtmann , Johan Hedberg , Luiz Von Dentz CC: Sean Wang , Will Lee , SS Wu , Steve Lee , linux-bluetooth , linux-kernel , linux-mediatek , Chris Lu Subject: [PATCH v5 0/3] Bluetooth: btmtk: Add MT7928 support Date: Wed, 24 Jun 2026 15:55:01 +0800 Message-ID: <20260624075505.1318804-1-chris.lu@mediatek.com> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain This patch series adds support for MT7928 (device ID 0x7935) to the btmtk driver, which requires a new two-stage firmware loading process with CBMCU firmware. Patch 1 refactors existing firmware download code by replacing magic numbers with a descriptive BTMTK_WMT_PKT_* enum, making the packet sequencing logic clearer. Patch 2 improves BT firmware logging to provide more useful information for debugging: adds firmware filename before loading and displays chip ID as HW version instead of firmware's hwver field. Patch 3 implements MT7928 firmware download flow, which requires loading CBMCU firmware before Bluetooth firmware. The CBMCU firmware uses a two-phase download sequence: Phase 1 downloads the section containing global descriptor and signature data, Phase 2 downloads the remaining firmware sections. After CBMCU firmware completes, the driver continues to load the Bluetooth firmware following the standard flow. Tested on MT7928 hardware with successful firmware loading and Bluetooth functionality verification. Changes in v5: - Split into three patches: refactoring, logging improvement, and new feature - Add Patch 2 to improve BT firmware logging independently * Add firmware filename before loading * Display chip ID (dev_id) as HW version * Use clearer log format with separate HW/SW version fields - Apply same logging improvements to CBMCU firmware in Patch 3 - Better separation of concerns for easier review Changes in v4: - Split into two patches: refactoring and new feature - Add BTMTK_WMT_PKT_* enum to improve code readability - Replace magic numbers (0xF0, 0xF1) with descriptive macros - Define MTK_SEC_CBMCU_DESC macro for section type - Add MT7928 marketing name comment - Include firmware filename in error messages - Add detailed size information in firmware validation errors - Use BTMTK_WMT_PKT_* enum in CBMCU download function Changes in v3: - Add firmware size validation with bounds checking - Improve error messages with context information - Add section offset validation for both phases Changes in v2: - Simplified enum usage by consolidating status definitions - Improved code maintainability Chris Lu (3): Bluetooth: btmtk: Replace magic numbers with WMT packet flag enum Bluetooth: btmtk: Improve BT firmware logging Bluetooth: btmtk: Add MT7928 support drivers/bluetooth/btmtk.c | 365 +++++++++++++++++++++++++++++++++++++- drivers/bluetooth/btmtk.h | 9 + 2 files changed, 370 insertions(+), 4 deletions(-) -- 2.45.2