xref: /aosp_15_r20/external/autotest/client/common_lib/cros/bluetooth/chipinfo.py (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1# Lint as: python3
2# Copyright 2022 The Chromium OS Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6from autotest_lib.client.common_lib import error
7from typing import NamedTuple
8
9
10class ChipInfo(NamedTuple):
11    """Checks vendor support for the specific chipsets."""
12    aosp_support: bool
13    msft_support: bool
14    msft_ocf: int
15
16
17_chip_info = {
18        'MVL-8897': ChipInfo(False, False, 0),
19        'MVL-8997': ChipInfo(False, False, 0),
20        'QCA-6174A-5-USB': ChipInfo(False, False, 0),
21        'QCA-6174A-3-UART': ChipInfo(False, False, 0),
22        'QCA-WCN6856': ChipInfo(True, True, 0x0170),
23        'WCN3991': ChipInfo(True, True, 0x0170),
24        'WCN6750': ChipInfo(True, True, 0x0170),
25        'Intel-AX200': ChipInfo(False, True, 0x001e),
26        'Intel-AX201': ChipInfo(False, True, 0x001e),
27        'Intel-AC9260': ChipInfo(False, True, 0x001e),
28        'Intel-AC9560': ChipInfo(False, True, 0x001e),
29        'Intel-AC7260': ChipInfo(False, False, 0),
30        'Intel-AC7265': ChipInfo(False, False, 0),
31        'Realtek-RTL8822C-USB': ChipInfo(True, False, 0),
32        'Realtek-RTL8822C-UART': ChipInfo(True, False, 0),
33        'Realtek-RTL8852A-USB': ChipInfo(True, False, 0),
34        'Mediatek-MTK7921-USB': ChipInfo(True, True, 0x0130),
35        'Mediatek-MTK7921-SDIO': ChipInfo(True, True, 0x0130)
36}
37
38
39def query(chip_name):
40    """Returns chip info for the specific chipset name.
41
42    @param chip_name: chipset name.
43
44    @return: named tuple ChipInfo(aosp_support, msft_support, msft_ocf).
45    """
46
47    chip_info = _chip_info.get(chip_name)
48    if chip_info is None:
49        raise error.TestError('Chipset name %r does not exist, please update '
50                              'the list of chipsets' % chip_name)
51    return chip_info