• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""Functions related to software configs.
2
3See proto definitions for descriptions of arguments.
4"""
5
6load(
7    "@proto//chromiumos/build/api/firmware_config.proto",
8    fw_pb = "chromiumos.build.api",
9)
10load(
11    "@proto//chromiumos/config/api/resource_config.proto",
12    resource_pb = "chromiumos.config.api",
13)
14load(
15    "@proto//chromiumos/config/api/software/audio_config.proto",
16    audio_pb = "chromiumos.config.api.software",
17)
18load(
19    "@proto//chromiumos/config/api/software/bluetooth_config.proto",
20    bt_pb = "chromiumos.config.api.software",
21)
22load(
23    "@proto//chromiumos/config/api/software/camera_config.proto",
24    cam_pb = "chromiumos.config.api.software",
25)
26load(
27    "@proto//chromiumos/config/api/software/disk_layout.proto",
28    disk_layout_pb = "chromiumos.config.api.software",
29)
30load(
31    "@proto//chromiumos/config/api/software/firmware_info.proto",
32    fw_info_pb = "chromiumos.config.api.software",
33)
34load(
35    "@proto//chromiumos/config/api/software/health_config.proto",
36    health_pb = "chromiumos.config.api.software",
37)
38load(
39    "@proto//chromiumos/config/api/software/nnpalm_config.proto",
40    nnpalm_pb = "chromiumos.config.api.software",
41)
42load(
43    "@proto//chromiumos/config/api/software/power_config.proto",
44    pc_pb = "chromiumos.config.api.software",
45)
46load(
47    "@proto//chromiumos/config/api/software/rma_config.proto",
48    rma_pb = "chromiumos.config.api.software",
49)
50load(
51    "@proto//chromiumos/config/api/software/ui_config.proto",
52    ui_pb = "chromiumos.config.api.software",
53)
54load(
55    "@proto//chromiumos/config/api/software/usb_config.proto",
56    usb_pb = "chromiumos.config.api.software",
57)
58load(
59    "@proto//chromiumos/config/api/wifi_config.proto",
60    wf_pb = "chromiumos.config.api",
61)
62
63# Needed to load from @proto. Add @unused to silence lint.
64load("//config/util/bindings/proto.star", "protos")
65load("//config/util/public_replication.star", "public_replication")
66
67_FW_TYPE = struct(
68    MAIN = fw_pb.FirmwareType.MAIN,
69    EC = fw_pb.FirmwareType.EC,
70    PD = fw_pb.FirmwareType.PD,
71    ISH = fw_pb.FirmwareType.ISH,
72)
73
74_HASH_ALGORITHM = struct(
75    MD5SUM = fw_pb.FirmwarePayloadHash.MD5SUM,
76)
77
78_SUPPORT_BAND = struct(
79    DISABLED = 0,
80    BIOS_AND_OS = 1,
81    OS_ONLY = 2,
82)
83
84def _create_fw_version(major_version = None, minor_version = None, patch_version = None):
85    """
86    Builds a firmware Version proto.
87
88    If major_version is not specified, None is returned.
89    """
90    return fw_pb.Version(
91        major = major_version,
92        minor = minor_version,
93        patch = patch_version,
94    ) if major_version else None
95
96def _create_fw_payload(
97        name = None,
98        fw_type = _FW_TYPE.MAIN,
99        major_version = 0,
100        minor_version = 0,
101        patch_version = 0):
102    """Builds a FirmwarePayload proto."""
103    return fw_pb.FirmwarePayload(
104        firmware_image_name = name,
105        type = fw_type,
106        version = fw_pb.Version(major = major_version, minor = minor_version, patch = patch_version),
107    )
108
109def _create_fw_build_targets(
110        bmpblk = None,
111        coreboot = None,
112        depthcharge = None,
113        ec = None,
114        ec_extras = None,
115        ish = None,
116        libpayload = None,
117        zephyr_ec = None,
118        zephyr_detachable_base = None):
119    """Builds a Firmware.BuildTargets proto."""
120    return fw_pb.Firmware.BuildTargets(
121        bmpblk = bmpblk,
122        coreboot = coreboot,
123        depthcharge = depthcharge,
124        ec = ec,
125        ec_extras = ec_extras,
126        ish = ish,
127        libpayload = libpayload,
128        zephyr_ec = zephyr_ec,
129        zephyr_detachable_base = zephyr_detachable_base,
130    )
131
132def _create_fw_build_config(build_targets):
133    """Builds a FirmwareBuildConfig proto."""
134    return fw_pb.FirmwareBuildConfig(build_targets = build_targets)
135
136def _create_fw_build_config_by_names(
137        coreboot_name,
138        bmpblk_name = None,
139        ec_name = None,
140        depthcharge_name = None,
141        ish_name = None,
142        libpayload_name = None,
143        ec_extras = None,
144        zephyr_ec_name = None,
145        zephyr_detachable_base_name = None):
146    """Builds a FirmwareBuildConfig proto using common naming patterns.
147
148    Build targets are set to be coreboot_name unless they are otherwise
149    specified, e.g. depthcharge is set to coreboot_name unless
150    depthcharge_name is specified. This function is provided as a convenience,
151    as different firmware build targets often share the same name.
152    """
153    return fw_pb.FirmwareBuildConfig(
154        build_targets = fw_pb.Firmware.BuildTargets(
155            bmpblk = bmpblk_name,
156            coreboot = coreboot_name,
157            ec = ec_name,
158            ec_extras = ec_extras,
159            depthcharge = depthcharge_name if depthcharge_name else coreboot_name,
160            ish = ish_name,
161            libpayload = libpayload_name if libpayload_name else coreboot_name,
162            zephyr_ec = zephyr_ec_name,
163            zephyr_detachable_base = zephyr_detachable_base_name,
164        ),
165    )
166
167def _create_fw_config(
168        ro = None,
169        rw = None,
170        ec_ro = None,
171        ec_rw = None,
172        pd = None,
173        ap_rw_a_hash = None,
174        ap_rw_a_hash_algorithm = _HASH_ALGORITHM.MD5SUM,
175        has_ec_component_manifest = False):
176    """Builds a FirmwareConfig proto."""
177    return fw_pb.FirmwareConfig(
178        main_ro_payload = ro,
179        main_rw_payload = rw,
180        ec_ro_payload = ec_ro,
181        ec_rw_payload = ec_rw,
182        pd_ro_payload = pd,
183        main_rw_a_hash = fw_pb.FirmwarePayloadHash(
184            algorithm = ap_rw_a_hash_algorithm,
185            digest = ap_rw_a_hash,
186        ) if ap_rw_a_hash else None,
187        has_ec_component_manifest = has_ec_component_manifest,
188    )
189
190def _create_fw_payloads_by_names(
191        ap_fw_name = None,
192        ec_fw_name = None,
193        pd_fw_name = None,
194        ish_fw_name = None,
195        ap_ro_version = None,
196        ap_rw_version = None,
197        ec_ro_version = None,
198        ec_rw_version = None,
199        ec_version = None,
200        pd_version = None,
201        ish_version = None,
202        ap_rw_a_hash = None,
203        ap_rw_a_hash_algorithm = _HASH_ALGORITHM.MD5SUM,
204        has_ec_component_manifest = False):
205    """Builds a FirmwareConfig proto using common naming patterns.
206
207    NOTE: `ec_version` is deprecated. Please use `ec_ro_version` and
208    `ec_rw_version`.
209    """
210    sc_fw_config = fw_pb.FirmwareConfig()
211    if ap_fw_name:
212        sc_fw_config.main_ro_payload = fw_pb.FirmwarePayload(
213            firmware_image_name = ap_fw_name,
214            type = _FW_TYPE.MAIN,
215            version = ap_ro_version,
216        )
217        if ap_rw_version:
218            sc_fw_config.main_rw_payload = fw_pb.FirmwarePayload(
219                firmware_image_name = ap_fw_name,
220                type = _FW_TYPE.MAIN,
221                version = ap_rw_version,
222            )
223    if ec_fw_name or ap_fw_name:
224        ec_fw_name = ec_fw_name or "%s_EC" % ap_fw_name
225        sc_fw_config.ec_ro_payload = fw_pb.FirmwarePayload(
226            firmware_image_name = ec_fw_name,
227            type = _FW_TYPE.EC,
228            version = ec_ro_version or ec_version,
229        )
230        if ec_rw_version:
231            sc_fw_config.ec_rw_payload = fw_pb.FirmwarePayload(
232                firmware_image_name = ec_fw_name,
233                type = _FW_TYPE.EC,
234                version = ec_rw_version,
235            )
236    if pd_fw_name:
237        sc_fw_config.pd_ro_payload = fw_pb.FirmwarePayload(
238            firmware_image_name = pd_fw_name,
239            type = _FW_TYPE.PD,
240            version = pd_version,
241        )
242    if ish_fw_name:
243        sc_fw_config.ish_payload = fw_pb.FirmwarePayload(
244            firmware_image_name = ish_fw_name,
245            type = _FW_TYPE.ISH,
246            version = ish_version,
247        )
248
249    if ap_rw_a_hash:
250        sc_fw_config.main_rw_a_hash = fw_pb.FirmwarePayloadHash(
251            algorithm = ap_rw_a_hash_algorithm,
252            digest = ap_rw_a_hash,
253        )
254
255    sc_fw_config.has_ec_component_manifest = has_ec_component_manifest
256
257    return sc_fw_config if ap_fw_name else None
258
259def _create_audio(
260        card_name,
261        cras_custom_name = None,
262        card_config_file = None,
263        dsp_file = None,
264        ucm_file = None,
265        ucm_master_file = None,
266        ucm_suffix = None,
267        module_file = None,
268        board_file = None,
269        sound_card_init_file = None,
270        card_id = None,
271        public_fields = ["card_name"]):
272    """Builds an AudioConfig proto."""
273    return audio_pb.AudioConfig(
274        public_replication = public_replication.create(public_fields = public_fields),
275        card_name = card_name,
276        cras_custom_name = cras_custom_name,
277        card_config_file = card_config_file,
278        dsp_file = dsp_file,
279        ucm_file = ucm_file if ucm_file else ("ucm-config/%s/HiFi.conf" % card_name),
280        ucm_master_file = ucm_master_file if ucm_master_file else ("ucm-config/%s/%s.conf" % (card_name, card_name)),
281        ucm_suffix = ucm_suffix,
282        module_file = module_file,
283        board_file = board_file,
284        sound_card_init_file = sound_card_init_file,
285        card_id = card_id,
286    )
287
288def _create_bluetooth(flags):
289    """Builds a BluetoothConfig proto."""
290    return bt_pb.BluetoothConfig(flags = flags)
291
292def _create_health(
293        vpd_has_sku_number = None,
294        battery_has_smart_battery_info = None,
295        routines_battery_health_percent_battery_wear_allowed = None,
296        routines_nvme_wear_level_wear_level_threshold = None):
297    """Builds a HealthConfig proto."""
298    routines = None
299    battery_health = None
300    nvme_wear_level = None
301    if routines_battery_health_percent_battery_wear_allowed != None:
302        battery_health = health_pb.HealthConfig.BatteryHealth(
303            percent_battery_wear_allowed =
304                routines_battery_health_percent_battery_wear_allowed,
305        )
306    if routines_nvme_wear_level_wear_level_threshold != None:
307        nvme_wear_level = health_pb.HealthConfig.NvmeWearLevel(
308            wear_level_threshold =
309                routines_nvme_wear_level_wear_level_threshold,
310        )
311    if battery_health or nvme_wear_level:
312        routines = health_pb.HealthConfig.Routines(
313            battery_health = battery_health,
314            nvme_wear_level = nvme_wear_level,
315        )
316    return health_pb.HealthConfig(
317        cached_vpd = health_pb.HealthConfig.CachedVpd(
318            has_sku_number = vpd_has_sku_number,
319        ),
320        battery = health_pb.HealthConfig.Battery(
321            has_smart_battery_info = battery_has_smart_battery_info,
322        ),
323        routines = routines,
324    )
325
326def _create_fw_info(
327        has_alt_fw = None,
328        has_splash_screen = None):
329    """Builds an FirmwareInfo proto."""
330    firmware_info = None
331
332    if has_alt_fw or has_splash_screen:
333        firmware_info = fw_info_pb.FirmwareInfo(
334            has_alt_firmware = has_alt_fw,
335            has_splash_screen = has_splash_screen,
336        )
337
338    return firmware_info
339
340def _create_disk_layout(
341        default_key_stateful = False):
342    """Builds an DiskLayout proto."""
343    disk_layout = None
344    if default_key_stateful:
345        disk_layout = disk_layout_pb.DiskLayout(default_key_stateful = default_key_stateful)
346
347    return disk_layout
348
349def _create_ssfc_probeable_component(
350        identifier = None,
351        value = None):
352    """Builds an SsfcProbeableComponent proto."""
353    return rma_pb.RmaConfig.SsfcConfig.SsfcComponentTypeConfig.SsfcProbeableComponent(
354        identifier = identifier,
355        value = value,
356    )
357
358def _create_ssfc_component_type_config(
359        component_type = None,
360        default_value = None,
361        probeable_components = None):
362    """Builds an SsfcComponentTypeConfig proto."""
363    return rma_pb.RmaConfig.SsfcConfig.SsfcComponentTypeConfig(
364        component_type = component_type,
365        default_value = default_value,
366        probeable_components = probeable_components,
367    )
368
369def _create_ssfc(
370        mask = None,
371        component_type_configs = None):
372    """Builds an SsfcConfig proto."""
373    return rma_pb.RmaConfig.SsfcConfig(
374        mask = mask,
375        component_type_configs = component_type_configs,
376    )
377
378def _create_rma(
379        enabled = None,
380        has_cbi = None,
381        ssfc_config = None,
382        use_legacy_custom_label = None):
383    """Builds an RmaConfig proto."""
384    return rma_pb.RmaConfig(
385        enabled = enabled,
386        has_cbi = has_cbi,
387        ssfc_config = ssfc_config,
388        use_legacy_custom_label = use_legacy_custom_label,
389    )
390
391def _create_nnpalm(
392        model = None,
393        radius_polynomial = None,
394        touch_compatible = None):
395    """Builds a NnpalmConfig proto."""
396    return nnpalm_pb.NnpalmConfig(
397        model = model,
398        radius_polynomial = radius_polynomial,
399        touch_compatible = touch_compatible,
400    )
401
402def _create_power(preferences):
403    """Builds a PowerConfig proto."""
404    return pc_pb.PowerConfig(preferences = preferences)
405
406def _create_resource(ac = None, dc = None):
407    """Builds a ResourceConfig proto.
408
409    Args:
410        ac: PowerSourcePreferences
411        dc: PowerSourcePreferences
412    """
413    return resource_pb.ResourceConfig(
414        ac = ac,
415        dc = dc,
416    )
417
418def _create_power_source_preference(
419        default = None,
420        web_rtc = None,
421        fullscreen_video = None,
422        vm_boot = None,
423        borealis_gaming = None,
424        arcvm_gaming = None,
425        battery_saver = None):
426    """Builds a PowerSourcePreferences proto.
427
428    Args:
429        default: PowerPreferences
430        web_rtc: PowerPreferences
431        fullscreen_video: PowerPreferences
432        vm_boot: PowerPreferences
433        borealis_gaming: PowerPreferences
434        arcvm_gaming: PowerPreferences
435    """
436    return resource_pb.ResourceConfig.PowerSourcePreferences(
437        default_power_preferences = default,
438        web_rtc_power_preferences = web_rtc,
439        fullscreen_video_power_preferences = fullscreen_video,
440        vm_boot_power_preferences = vm_boot,
441        borealis_gaming_power_preferences = borealis_gaming,
442        arcvm_gaming_power_preferences = arcvm_gaming,
443        battery_saver_power_preferences = battery_saver,
444    )
445
446def _create_power_preference(governor = None, epp = None, cpu_offline = None, cpufreq_disable_boost = False):
447    """Builds a PowerPreferences proto.
448
449    Args:
450        governor: Governor
451        epp: EnergyPerformancePreference
452        cpu_offline: CpuOfflinePreference
453        cpufreq_disable_boost: bool
454    """
455    return resource_pb.ResourceConfig.PowerPreferences(
456        governor = governor,
457        epp = epp,
458        cpu_offline = cpu_offline,
459        cpufreq_disable_boost = cpufreq_disable_boost,
460    )
461
462def _create_conservative_governor():
463    """Builds a conservative governor Governor proto"""
464    return resource_pb.ResourceConfig.Governor(
465        conservative = resource_pb.ResourceConfig.ConservativeGovernor(),
466    )
467
468def _create_ondemand_governor(powersave_bias, sampling_rate_ms = 0):
469    """Builds an ondemand governor Governor proto
470
471    Args:
472        powersave_bias: powersave bias for the ondemand governor
473        sampling_rate_ms: sampling rate in ms for the ondemand governor
474    """
475    if sampling_rate_ms == 1:
476        fail("sampling_rate_ms should be set to 0 or >= 2")
477
478    return resource_pb.ResourceConfig.Governor(
479        ondemand = resource_pb.ResourceConfig.OndemandGovernor(
480            powersave_bias = powersave_bias,
481            sampling_rate_ms = sampling_rate_ms,
482        ),
483    )
484
485def _create_performance_governor():
486    """Builds a performance governor Governor proto"""
487    return resource_pb.ResourceConfig.Governor(
488        performance = resource_pb.ResourceConfig.PerformanceGovernor(),
489    )
490
491def _create_powersave_governor():
492    """Builds a powersave governor Governor proto"""
493    return resource_pb.ResourceConfig.Governor(
494        powersave = resource_pb.ResourceConfig.PowersaveGovernor(),
495    )
496
497def _create_schedutil_governor():
498    """Builds a schedutil governor Governor proto"""
499    return resource_pb.ResourceConfig.Governor(
500        schedutil = resource_pb.ResourceConfig.SchedutilGovernor(),
501    )
502
503def _create_userspace_governor():
504    """Builds an userspace governor Governor proto"""
505    return resource_pb.ResourceConfig.Governor(
506        userspace = resource_pb.ResourceConfig.UserspaceGovernor(),
507    )
508
509def _create_default_epp():
510    """Builds a default epp EnergyPerformancePreference proto"""
511    return resource_pb.ResourceConfig.EnergyPerformancePreference(
512        default = resource_pb.ResourceConfig.DefaultEpp(),
513    )
514
515def _create_performance_epp():
516    """Builds a performance epp EnergyPerformancePreference proto"""
517    return resource_pb.ResourceConfig.EnergyPerformancePreference(
518        performance = resource_pb.ResourceConfig.PerformanceEpp(),
519    )
520
521def _create_balance_performance_epp():
522    """Builds a balance_performance epp EnergyPerformancePreference proto"""
523    return resource_pb.ResourceConfig.EnergyPerformancePreference(
524        balance_performance = resource_pb.ResourceConfig.BalancePerformanceEpp(),
525    )
526
527def _create_balance_power_epp():
528    """Builds a balance_power epp EnergyPerformancePreference proto"""
529    return resource_pb.ResourceConfig.EnergyPerformancePreference(
530        balance_power = resource_pb.ResourceConfig.BalancePowerEpp(),
531    )
532
533def _create_power_epp():
534    """Builds a power epp EnergyPerformancePreference proto"""
535    return resource_pb.ResourceConfig.EnergyPerformancePreference(
536        power = resource_pb.ResourceConfig.PowerEpp(),
537    )
538
539def _create_cpu_offline_small_core(min_active_threads = None):
540    """Builds a cpu offline small core policy CpuOfflinePreference proto"""
541    return resource_pb.ResourceConfig.CpuOfflinePreference(
542        small_core = resource_pb.ResourceConfig.CpuOfflineSmallCore(
543            min_active_threads = min_active_threads,
544        ),
545    )
546
547def _create_cpu_offline_smt(min_active_threads = None):
548    """Builds a cpu offline SMT policy CpuOfflinePreference proto"""
549    return resource_pb.ResourceConfig.CpuOfflinePreference(
550        smt = resource_pb.ResourceConfig.CpuOfflineSMT(
551            min_active_threads = min_active_threads,
552        ),
553    )
554
555def _create_cpu_offline_half(min_active_threads = None):
556    """Builds a cpu offline half policy CpuOfflinePreference proto"""
557    return resource_pb.ResourceConfig.CpuOfflinePreference(
558        half = resource_pb.ResourceConfig.CpuOfflineHalf(
559            min_active_threads = min_active_threads,
560        ),
561    )
562
563def _create_ath10k_power_chain(limit_2g, limit_5g):
564    """Builds a TransmitPowerChain for ath10k drivers.
565
566    Args:
567        limit_2g: 2G band power limit (dBm). Required.
568        limit_5g: 5G band power limit (dBm). Required.
569    """
570    return wf_pb.WifiConfig.Ath10kConfig.TransmitPowerChain(
571        limit_2g = limit_2g,
572        limit_5g = limit_5g,
573    )
574
575def _create_ath10k(non_tablet_mode_transmit_power_chain, tablet_mode_transmit_power_chain):
576    """Builds a WifiConfig proto for use with ath10k drivers.
577
578    Args:
579        non_tablet_mode_transmit_power_chain: non-tablet mode power chain. Required.
580        tablet_mode_transmit_power_chain: tablet mode power chain. Required.
581    """
582    return wf_pb.WifiConfig(
583        ath10k_config = wf_pb.WifiConfig.Ath10kConfig(
584            non_tablet_mode_power_table = non_tablet_mode_transmit_power_chain,
585            tablet_mode_power_table = tablet_mode_transmit_power_chain,
586        ),
587    )
588
589def _create_rtw88_power_chain(
590        limit_2g,
591        limit_5g_1,
592        limit_5g_3,
593        limit_5g_4):
594    """Builds a TransmitPowerChain for rtw88 drivers.
595
596    Args:
597        limit_2g: 2G band power limit: All 2G band channels. (0.125 dBm). Required.
598        limit_5g_1: 5G band 1 power limit: 5.15G-5.35G channels. (0.125 dBm). Required.
599        limit_5g_3: 5G band 3 power limit: 5.47G-5.725G channels. (0.125 dBm). Required.
600        limit_5g_4: 5G band 4 power limit: 5.725G-5.95G channels. (0.125 dBm). Required.
601    """
602    return wf_pb.WifiConfig.Rtw88Config.TransmitPowerChain(
603        limit_2g = limit_2g,
604        limit_5g_1 = limit_5g_1,
605        limit_5g_3 = limit_5g_3,
606        limit_5g_4 = limit_5g_4,
607    )
608
609def _create_rtw88_geo_offsets(offset_2g, offset_5g):
610    """Builds a GeoOffsets from rtw88 drivers.
611
612    Args:
613        offset_2g: Value to be added to the 2.4GHz WiFi band. (0.125 dBm) Required.
614        offset_5g: Value to be added to all 5GHz WiFi bands. (0.125 dBm) Required.
615    """
616    return wf_pb.WifiConfig.Rtw88Config.GeoOffsets(
617        offset_2g = offset_2g,
618        offset_5g = offset_5g,
619    )
620
621def _create_rtw88(
622        non_tablet_mode_transmit_power_chain,
623        tablet_mode_transmit_power_chain,
624        fcc_offsets = None,
625        eu_offsets = None,
626        other_offsets = None):
627    """Builds a WifiConfig proto for use with rtw88 drivers.
628
629    Args:
630        non_tablet_mode_transmit_power_chain: non-tablet mode power chain. Required.
631        tablet_mode_transmit_power_chain: tablet mode power chain. Required.
632        fcc_offsets: Offsets used for regulatory domains that follow FCC guidelines
633        eu_offsets: Offsets used for regulatory domains that follow ESTI guidelines
634        other_offsets: Offsets for regulatory domains that don't follow FCC or ETSI guidelines
635    """
636    return wf_pb.WifiConfig(
637        rtw88_config = wf_pb.WifiConfig.Rtw88Config(
638            non_tablet_mode_power_table = non_tablet_mode_transmit_power_chain,
639            tablet_mode_power_table = tablet_mode_transmit_power_chain,
640            offset_fcc = fcc_offsets,
641            offset_eu = eu_offsets,
642            offset_other = other_offsets,
643        ),
644    )
645
646def _create_rtw89_power_chain(
647        limit_2g,
648        limit_5g_1,
649        limit_5g_3,
650        limit_5g_4,
651        limit_6g_1 = None,
652        limit_6g_2 = None,
653        limit_6g_3 = None,
654        limit_6g_4 = None,
655        limit_6g_5 = None,
656        limit_6g_6 = None):
657    """Builds a TransmitPowerChain for rtw89 drivers.
658
659    Args:
660        limit_2g: 2G band power limit: All 2G band channels. (0.25 dBm). Required.
661        limit_5g_1: 5G band 1 power limit: 5.15G-5.35G channels. (0.25 dBm). Required.
662        limit_5g_3: 5G band 3 power limit: 5.47G-5.725G channels. (0.25 dBm). Required.
663        limit_5g_4: 5G band 4 power limit: 5.725G-5.95G channels. (0.25 dBm). Required.
664        limit_6g_1: 6G band 1 power limit: 5.955G-6.155G channels. (0.25 dBm). Required.
665        limit_6g_2: 6G band 2 power limit: 6.175G-6.415G channels. (0.25 dBm). Required.
666        limit_6g_3: 6G band 3 power limit: 6.435G-6.515G channels. (0.25 dBm). Required.
667        limit_6g_4: 6G band 4 power limit: 6.535G-6.695G channels. (0.25 dBm). Required.
668        limit_6g_5: 6G band 5 power limit: 6.715G-6.855G channels. (0.25 dBm). Required
669        limit_6g_6: 6G band 6 power limit: 6.895G-7.115G channels. (0.25 dBm). Required.
670    """
671    return wf_pb.WifiConfig.Rtw89Config.TransmitPowerChain(
672        limit_2g = limit_2g,
673        limit_5g_1 = limit_5g_1,
674        limit_5g_3 = limit_5g_3,
675        limit_5g_4 = limit_5g_4,
676        limit_6g_1 = limit_6g_1,
677        limit_6g_2 = limit_6g_2,
678        limit_6g_3 = limit_6g_3,
679        limit_6g_4 = limit_6g_4,
680        limit_6g_5 = limit_6g_5,
681        limit_6g_6 = limit_6g_6,
682    )
683
684def _create_rtw89_geo_offsets(offset_2g, offset_5g, offset_6g = None):
685    """Builds a GeoOffsets from rtw89 drivers.
686
687    Args:
688        offset_2g: Value to be added to the 2.4GHz WiFi band. (0.25 dBm) Required.
689        offset_5g: Value to be added to all 5GHz WiFi bands. (0.25 dBm) Required.
690        offset_6g: Value to be added to all 6GHz WiFi bands. (0.25 dBm) Required.
691    """
692    return wf_pb.WifiConfig.Rtw89Config.GeoOffsets(
693        offset_2g = offset_2g,
694        offset_5g = offset_5g,
695        offset_6g = offset_6g,
696    )
697
698def _create_rtw89(
699        non_tablet_mode_transmit_power_chain,
700        tablet_mode_transmit_power_chain,
701        fcc_offsets = None,
702        eu_offsets = None,
703        other_offsets = None):
704    """Builds a WifiConfig proto for use with rtw89 drivers.
705
706    Args:
707        non_tablet_mode_transmit_power_chain: non-tablet mode power chain. Required.
708        tablet_mode_transmit_power_chain: tablet mode power chain. Required.
709        fcc_offsets: Offsets used for regulatory domains that follow FCC guidelines
710        eu_offsets: Offsets used for regulatory domains that follow ESTI guidelines
711        other_offsets: Offsets for regulatory domains that don't follow FCC or ETSI guidelines
712    """
713    return wf_pb.WifiConfig(
714        rtw89_config = wf_pb.WifiConfig.Rtw89Config(
715            non_tablet_mode_power_table = non_tablet_mode_transmit_power_chain,
716            tablet_mode_power_table = tablet_mode_transmit_power_chain,
717            offset_fcc = fcc_offsets,
718            offset_eu = eu_offsets,
719            offset_other = other_offsets,
720        ),
721    )
722
723def _create_intel_antenna_gain(
724        ant_gain_2g,
725        ant_gain_5g_1,
726        ant_gain_5g_2,
727        ant_gain_5g_3,
728        ant_gain_5g_4,
729        ant_gain_5g_5 = None,
730        ant_gain_6g_1 = None,
731        ant_gain_6g_2 = None,
732        ant_gain_6g_3 = None,
733        ant_gain_6g_4 = None,
734        ant_gain_6g_5 = None):
735    """Builds AntennaGain for intel drivers.
736
737    Args:
738        ant_gain_2g: Antenna gain used for 2400MHz frequency.
739        ant_gain_5g_1: Antenna gain used for 5150–5350MHz frequency. Required.
740        ant_gain_5g_2: Antenna gain used for 5350–5470MHz frequency. Required.
741        ant_gain_5g_3: Antenna gain used for 5470–5725MHz frequency. Required.
742        ant_gain_5g_4: Antenna gain used for 5725–5950MHz frequency. Required.
743        ant_gain_5g_5: Antenna gain used for 5945–6165MHz frequency. Rev 1 & 2.
744        ant_gain_6g_1: Antenna gain used for 6165–6405MHz frequency. Rev 1 & 2.
745        ant_gain_6g_2: Antenna gain used for 6405–6525MHz frequency. Rev 1 & 2.
746        ant_gain_6g_3: Antenna gain used for 6525–6705MHz frequency. Rev 1 & 2.
747        ant_gain_6g_4: Antenna gain used for 6705–6865MHz frequency. Rev 1 & 2.
748        ant_gain_6g_5: Antenna gain used for 6865–7105MHz frequency. Rev 1 & 2.
749    """
750    return wf_pb.WifiConfig.IntelConfig.Gains.AntennaGain(
751        ant_gain_2g = ant_gain_2g,
752        ant_gain_5g_1 = ant_gain_5g_1,
753        ant_gain_5g_2 = ant_gain_5g_2,
754        ant_gain_5g_3 = ant_gain_5g_3,
755        ant_gain_5g_4 = ant_gain_5g_4,
756        ant_gain_5g_5 = ant_gain_5g_5,
757        ant_gain_6g_1 = ant_gain_6g_1,
758        ant_gain_6g_2 = ant_gain_6g_2,
759        ant_gain_6g_3 = ant_gain_6g_3,
760        ant_gain_6g_4 = ant_gain_6g_4,
761        ant_gain_6g_5 = ant_gain_6g_5,
762    )
763
764def _create_intel_power_chain(
765        limit_2g,
766        limit_5g_1,
767        limit_5g_2,
768        limit_5g_3,
769        limit_5g_4,
770        limit_5g_5 = None,
771        limit_6g_1 = None,
772        limit_6g_2 = None,
773        limit_6g_3 = None,
774        limit_6g_4 = None,
775        limit_6g_5 = None):
776    """Builds a TransmitPowerChain for intel drivers.
777
778    Args:
779        limit_2g: 2G band power limit: All 2G band channels. (0.125 dBm). Required.
780        limit_5g_1: 5G band 1 power limit: 5.15G-5.35G channels. (0.125 dBm). Required.
781        limit_5g_2: 5G band 2 power limit: 5.35G-5.47G channels. (0.125 dBm). Required.
782        limit_5g_3: 5G band 3 power limit: 5.47G-5.725G channels. (0.125 dBm). Required.
783        limit_5g_4: 5G band 4 power limit: 5.725G-5.95G channels. (0.125 dBm). Required.
784        limit_5g_5: 5G band 5 power limit: 5.95G-6.165G channels. (0.125 dBm). Rev 1 & 2.
785        limit_6g_1: 6G band 1 power limit: 6.165G-6.405G channels. (0.125 dBm). Rev 1 & 2.
786        limit_6g_2: 6G band 2 power limit: 6.405G-6.525G channels. (0.125 dBm). Rev 1 & 2.
787        limit_6g_3: 6G band 3 power limit: 6.525G-6.705G channels. (0.125 dBm). Rev 1 & 2.
788        limit_6g_4: 6G band 4 power limit: 6.705G-6.865G channels. (0.125 dBm). Rev 1 & 2.
789        limit_6g_5: 6G band 5 power limit: 6.865G-7.105G channels. (0.125 dBm). Rev 1 & 2.
790    """
791    return wf_pb.WifiConfig.IntelConfig.SarTable.TransmitPowerChain(
792        limit_2g = limit_2g,
793        limit_5g_1 = limit_5g_1,
794        limit_5g_2 = limit_5g_2,
795        limit_5g_3 = limit_5g_3,
796        limit_5g_4 = limit_5g_4,
797        limit_5g_5 = limit_5g_5,
798        limit_6g_1 = limit_6g_1,
799        limit_6g_2 = limit_6g_2,
800        limit_6g_3 = limit_6g_3,
801        limit_6g_4 = limit_6g_4,
802        limit_6g_5 = limit_6g_5,
803    )
804
805def _create_intel_geo_offsets(
806        max_2g,
807        offset_2g_a,
808        offset_2g_b,
809        max_5g,
810        offset_5g_a,
811        offset_5g_b,
812        max_6g = None,
813        offset_6g_a = None,
814        offset_6g_b = None):
815    """Builds a GeoOffsets for intel drivers.
816
817    Args:
818        max_2g: Defines the 2.4 GHz upper value for the allowed power to not be
819                crossed by applying the Geo offset. Required.
820        offset_2g_a: Value to be added to the 2.4GHz WiFi band for chain a. (0.125 dBm) Required.
821        offset_2g_b: Value to be added to the 2.4GHz WiFi band for chain b. (0.125 dBm) Required.
822        max_5g: Defines the 5 GHz upper value for the allowed power to not be
823                crossed by applying the Geo offset. Required.
824        offset_5g_a: Value to be added to 5GHz WiFi bands for chain a. (0.125 dBm) Required.
825        offset_5g_b: Value to be added to 5GHz WiFi bands for chain b. (0.125 dBm) Required.
826        max_6g: Defines the 6 GHz upper value for the allowed power to not be
827                crossed by applying the Geo offset. Rev 1 & 2.
828        offset_6g_a: Value to be added to 6GHz WiFi bands for chain a. (0.125 dBm) Rev 1 & 2.
829        offset_6g_b: Value to be added to 6GHz WiFi bands for chain b. (0.125 dBm) Rev 1 & 2.
830    """
831    return wf_pb.WifiConfig.IntelConfig.Offsets.GeoOffsets(
832        max_2g = max_2g,
833        offset_2g_a = offset_2g_a,
834        offset_2g_b = offset_2g_b,
835        max_5g = max_5g,
836        offset_5g_a = offset_5g_a,
837        offset_5g_b = offset_5g_b,
838        max_6g = max_6g,
839        offset_6g_a = offset_6g_a,
840        offset_6g_b = offset_6g_b,
841    )
842
843def _create_intel_antgain_table(
844        ant_table_revision = 0xff,
845        ant_ppag_mode = None,
846        ant_gain_chain_a = None,
847        ant_gain_chain_b = None):
848    """Builds a antenna Gains for intel drivers.
849
850    Args:
851        ant_table_revision: Antenna gains table revision
852        ant_ppag_mode: Defines the mode of the ANT_gain control to be used.
853        ant_gain_chain_a: Defines the ANT_gain in dBi for chain A to be used.
854        ant_gain_chain_b: Defines the ANT_gain in dBi for chain B to be used.
855    """
856    return wf_pb.WifiConfig.IntelConfig.Gains(
857        ant_table_version = ant_table_revision,
858        ant_mode_ppag = ant_ppag_mode,
859        ant_gain_table_a = ant_gain_chain_a,
860        ant_gain_table_b = ant_gain_chain_b,
861    )
862
863def _create_intel_dsm_enablement_11be_countries(
864        china = False,
865        south_korea = False):
866    """Builds enablement11be parameters for intel drivers.
867
868    Args:
869        china: enable channel for China region.
870        south_korea: enable channel for South Korea region.
871    """
872    return wf_pb.WifiConfig.IntelConfig.Dsm.Enablement11beCountries(
873        china = china,
874        south_korea = south_korea,
875    )
876
877def _create_intel_dsm_energy_detection_threshold(
878        revision = 0,
879        etsi_hb = False,
880        fcc_uhb = False,
881        hb_5g2_3 = False,
882        hb_5g4 = False,
883        hb_5g6 = False,
884        hb_5g8_9 = False,
885        uhb_6g1 = False,
886        uhb_6g3 = False,
887        uhb_6g5 = False,
888        uhb_6g6 = False,
889        uhb_6g8 = False,
890        uhb_7g0 = False):
891    """Builds energy_detection_threshold parameters for Intel drivers.
892
893    Args:
894        revision: Revision of the EDT
895        etsi_hb: Enable EDT optimization for ETSI HB,
896        fcc_uhb: Enable EDT optimization for FCC UHB
897        hb_5g2_3: Enable EDT optimization for HB_5G2/3
898        hb_5g4: Enable EDT optimization for HB_5G4
899        hb_5g6: Enable EDT optimization for HB_5G6
900        hb_5g8_9: Enable EDT optimization for HB_5G8/9
901        uhb_6g1: Enable EDT optimization for UHB_6G1
902        uhb_6g3: Enable EDT optimization for UHB_6G3
903        uhb_6g5: Enable EDT optimization for UHB_6G5
904        uhb_6g6: Enable EDT optimization for UHB_6G6
905        uhb_6g8: Enable EDT optimization for UHB_6G8
906        uhb_7g0: Enable EDT optimization for UHB_7G0
907    """
908    return wf_pb.WifiConfig.IntelConfig.Dsm.EnergyDetectionThreshold(
909        revision = revision,
910        etsi_hb = etsi_hb,
911        fcc_uhb = fcc_uhb,
912        hb_5g2_3 = hb_5g2_3,
913        hb_5g4 = hb_5g4,
914        hb_5g6 = hb_5g6,
915        hb_5g8_9 = hb_5g8_9,
916        uhb_6g1 = uhb_6g1,
917        uhb_6g3 = uhb_6g3,
918        uhb_6g5 = uhb_6g5,
919        uhb_6g6 = uhb_6g6,
920        uhb_6g8 = uhb_6g8,
921        uhb_7g0 = uhb_7g0,
922    )
923
924def _create_intel_dsm_rfi_mitigation(
925        dlvr = False,
926        ddr = False):
927    """Builds rfi_mitigation for Intel drivers.
928
929    Args:
930        dlvr: Enable DLVR mitigation
931        ddr: Enable DDR mitigation
932    """
933    return wf_pb.WifiConfig.IntelConfig.Dsm.RfiMitigation(
934        dlvr = dlvr,
935        ddr = ddr,
936    )
937
938def _create_intel_dsm(
939        disable_active_sdr_channels = -1,
940        support_indonesia_5g_band = -1,
941        support_ultra_high_band = -1,
942        regulatory_configurations = -1,
943        uart_configurations = -1,
944        enablement_11ax = -1,
945        unii_4 = -1,
946        enablement_11be_countries = None,
947        rfi_mitigation = None,
948        energy_detection_threshold = None):
949    """Builds a Dsm for intel drivers.
950
951    Args:
952        disable_active_sdr_channels: Allow OEMs to set ETSI 5.8GHz SRD Channels to Passive/Disabled.
953        support_indonesia_5g_band: Enable/Disable 5.15-5.35GHz band support in Indonesia.
954        support_ultra_high_band: Control the enablement of 6 GHz band.
955        regulatory_configurations: Regulatory special configurations enablements value.
956        uart_configurations: M.2 UART interface configuration.
957        enablement_11ax: Control enablement of 11ax on certificated modules.
958        unii_4: Control enablement of UNII-4 over certificate modules.
959        enablement_11be_countries: Control enablement of 11be on certificated modules.
960        energy_detection_threshold: Control enablement of EDT optimization.
961        rfi_mitigation: Control of RFI mitigation
962    """
963    return wf_pb.WifiConfig.IntelConfig.Dsm(
964        disable_active_sdr_channels = disable_active_sdr_channels,
965        support_indonesia_5g_band = support_indonesia_5g_band,
966        support_ultra_high_band = support_ultra_high_band,
967        regulatory_configurations = regulatory_configurations,
968        uart_configurations = uart_configurations,
969        enablement_11ax = enablement_11ax,
970        unii_4 = unii_4,
971        enablement_11be_countries = enablement_11be_countries,
972        energy_detection_threshold = energy_detection_threshold,
973        rfi_mitigation = rfi_mitigation,
974    )
975
976def _create_intel_sar_table(
977        sar_table_revision = 0xff,
978        tablet_mode_transmit_power_chain_a = None,
979        tablet_mode_transmit_power_chain_b = None,
980        non_tablet_mode_transmit_power_chain_a = None,
981        non_tablet_mode_transmit_power_chain_b = None,
982        cdb_tablet_mode_transmit_power_chain_a = None,
983        cdb_tablet_mode_transmit_power_chain_b = None,
984        cdb_non_tablet_mode_transmit_power_chain_a = None,
985        cdb_non_tablet_mode_transmit_power_chain_b = None):
986    """Builds a SarTable proto for use with intel drivers.
987
988    Args:
989        sar_table_revision: SAR table revision.
990        tablet_mode_transmit_power_chain_a: Tablet mode power chain for chain a.
991        tablet_mode_transmit_power_chain_b: Tablet mode power chain for chain b.
992        non_tablet_mode_transmit_power_chain_a: Non-tablet mode power chain for chain a.
993        non_tablet_mode_transmit_power_chain_b: Non-tablet mode power chain for chain b.
994        cdb_tablet_mode_transmit_power_chain_a: Tablet mode concurrency dual band power chain for chain a.
995        cdb_tablet_mode_transmit_power_chain_b: Tablet mode concurrency dual band power chain for chain b.
996        cdb_non_tablet_mode_transmit_power_chain_a: Non-tablet mode concurrency dual band power chain for chain a.
997        cdb_non_tablet_mode_transmit_power_chain_b: Non-tablet mode concurrency dual band power chain for chain b.
998    """
999    return wf_pb.WifiConfig.IntelConfig.SarTable(
1000        sar_table_version = sar_table_revision,
1001        tablet_mode_power_table_a = tablet_mode_transmit_power_chain_a,
1002        tablet_mode_power_table_b = tablet_mode_transmit_power_chain_b,
1003        non_tablet_mode_power_table_a = non_tablet_mode_transmit_power_chain_a,
1004        non_tablet_mode_power_table_b = non_tablet_mode_transmit_power_chain_b,
1005        cdb_tablet_mode_power_table_a = cdb_tablet_mode_transmit_power_chain_a,
1006        cdb_tablet_mode_power_table_b = cdb_tablet_mode_transmit_power_chain_b,
1007        cdb_non_tablet_mode_power_table_a = cdb_non_tablet_mode_transmit_power_chain_a,
1008        cdb_non_tablet_mode_power_table_b = cdb_non_tablet_mode_transmit_power_chain_b,
1009    )
1010
1011def _create_intel_bluetooth_sar_power_table(
1012        restriction_for_2g4 = 0,
1013        restriction_for_5g2 = 0,
1014        restriction_for_5g8_5g9 = 0,
1015        restriction_for_6g1 = 0,
1016        restriction_for_6g3 = 0):
1017    """Builds Bluetooth SAR Power Table for intel drivers.
1018
1019    Args:
1020        restriction_for_2g4: power restriction for chain in sub-band 2G4.
1021        restriction_for_5g2: power restriction for chain in sub-band 5G2.
1022        restriction_for_5g8_5g9: power restriction for chain in sub-band 5G8 and 5G9.
1023        restriction_for_6g1: power restriction for chain in sub-band 6G1.
1024        restriction_for_6g3: power restriction for chain in sub-band 6G3.
1025    """
1026    return wf_pb.WifiConfig.IntelConfig.BluetoothSarPowerTable(
1027        restriction_for_2g4 = restriction_for_2g4,
1028        restriction_for_5g2 = restriction_for_5g2,
1029        restriction_for_5g8_5g9 = restriction_for_5g8_5g9,
1030        restriction_for_6g1 = restriction_for_6g1,
1031        restriction_for_6g3 = restriction_for_6g3,
1032    )
1033
1034def _create_intel_bt_sar(
1035        revision,  # only revision 1 and 2 are supported at the moment
1036        increased_power_mode_limitation = 0,
1037        sar_lb_power_restriction = 0,
1038        br_modulation = 0,
1039        edr2_modulation = 0,
1040        edr3_modulation = 0,
1041        le_modulation = 0,
1042        le2_mhz_modulation = 0,
1043        le_lr_modulation = 0,
1044        set_1_chain_a = None,
1045        set_1_chain_b = None):
1046    """Builds a Bluetooth SAR proto for use with intel drivers.
1047
1048    Args:
1049        revision: Bluetooth SAR table revision.
1050        increased_power_mode_limitation: Enable/Disable Increased Power Mode Limitation.
1051        sar_lb_power_restriction: Power Restriction for the Lower Band (LB).
1052        br_modulation: power restriction for BR Modulation.
1053        edr2_modulation: power restriction for EDR2 Modulation.
1054        edr3_modulation: power restriction for EDR3 Modulation.
1055        le_modulation: power restriction for LE Modulation.
1056        le2_mhz_modulation: power restriction for LE 2 MHz Modulation.
1057        le_lr_modulation: power restriction for LE LR Modulation.
1058        set_1_chain_a: First set Chain A SAR power table.
1059        set_1_chain_b: First set Chain B SAR power table.
1060    """
1061    if revision not in [1, 2]:
1062        fail("Invalid Intel Bluetooth SAR revision (should be 1 or 2)")
1063    elif revision == 1:
1064        return wf_pb.WifiConfig.IntelConfig.BluetoothSar(
1065            revision = revision,
1066            increased_power_mode_limitation = increased_power_mode_limitation,
1067            sar_lb_power_restriction = sar_lb_power_restriction,
1068            br_modulation = br_modulation,
1069            edr2_modulation = edr2_modulation,
1070            edr3_modulation = edr3_modulation,
1071            le_modulation = le_modulation,
1072            le2_mhz_modulation = le2_mhz_modulation,
1073            le_lr_modulation = le_lr_modulation,
1074        )
1075    else:
1076        return wf_pb.WifiConfig.IntelConfig.BluetoothSar(
1077            revision = revision,
1078            increased_power_mode_limitation = increased_power_mode_limitation,
1079            set_1_chain_a = set_1_chain_a or _create_intel_bluetooth_sar_power_table(),
1080            set_1_chain_b = set_1_chain_b or _create_intel_bluetooth_sar_power_table(),
1081        )
1082
1083def _create_intel_wbem_country_enablement(
1084        japan = False,
1085        south_korea = False):
1086    """Builds country enablement parameters for intel drivers.
1087
1088    Args:
1089        japan: enable channel for Japan region.
1090        south_korea: enable channel for South Korea region.
1091    """
1092    return wf_pb.WifiConfig.IntelConfig.Wbem.EnablementWbemCountries(
1093        japan = japan,
1094        south_korea = south_korea,
1095    )
1096
1097def _create_intel_wbem(
1098        revision,  # only revision 0 is supported at the moment
1099        enablement_wbem_countries = _create_intel_wbem_country_enablement()):
1100    """Builds a Wbem proto for use with intel drivers.
1101
1102    Args:
1103        revision: WBEM table revision.
1104        enablement_wbem_countries: Enable/Disable of Wi-Fi 320MHz per MCC.
1105    """
1106    if revision != 0:
1107        fail("Invalid Intel WBEM revision (should be 0)")
1108    return wf_pb.WifiConfig.IntelConfig.Wbem(
1109        revision = revision,
1110        enablement_wbem_countries = enablement_wbem_countries,
1111    )
1112
1113def _create_intel_bpag_country_enablement(
1114        eu = False,
1115        china = False,
1116        eu_uhb = False,
1117        fcc_uhb = False,
1118        ised_uhb = False):
1119    """Builds country enablement parameters for intel drivers.
1120
1121    Args:
1122        eu: enable per platform antenna gain mode for EU region.
1123        china: enable per platform antenna gain mode for china region.
1124        eu_uhb: enable per platform antenna gain mode for EU UHB region.
1125        fcc_uhb: enable per platform antenna gain mode for FCC UHB region.
1126        ised_uhb: enable per platform antenna gain mode for ISED UHB region.
1127
1128    """
1129    return wf_pb.WifiConfig.IntelConfig.BluetoothPpag.EnablementBpagCountries(
1130        eu = eu,
1131        china = china,
1132        eu_uhb = eu_uhb,
1133        fcc_uhb = fcc_uhb,
1134        ised_uhb = ised_uhb,
1135    )
1136
1137def _create_intel_bpag(
1138        revision,  # only revision 1 and 2 are supported at the moment
1139        enablement_bpag_countries = _create_intel_bpag_country_enablement()):
1140    """Builds a BluetoothPpag proto for use with intel drivers.
1141
1142    Args:
1143        revision: BluetoothPPAG table revision.
1144        enablement_bpag_countries: Enable/Disable Antenna Gain Mode per region.
1145    """
1146    if revision not in [1, 2]:
1147        fail("Invalid Intel BPAG revision (should be 1 or 2)")
1148    return wf_pb.WifiConfig.IntelConfig.BluetoothPpag(
1149        revision = revision,
1150        enablement_bpag_countries = enablement_bpag_countries,
1151    )
1152
1153def _create_intel_bbfb(
1154        revision,  # only revision 1 is supported at the moment
1155        enable_quad_filter_bypass = False):
1156    """Builds a Bbfb proto for use with intel drivers.
1157
1158    Args:
1159        revision: BBFB table revision.
1160        enable_quad_filter_bypass: Enable/Disable quad filter bypass.
1161    """
1162    if revision != 1:
1163        fail("Invalid Intel BBFB revision (should be 1)")
1164    return wf_pb.WifiConfig.IntelConfig.Bbfb(
1165        revision = revision,
1166        enable_quad_filter_bypass = enable_quad_filter_bypass,
1167    )
1168
1169def _create_intel_bdcm_dual_chain_mode(
1170        chain_a_and_chain_b = False):
1171    """Builds dual chain mode parameters for intel drivers.
1172
1173    Args:
1174        chain_a_and_chain_b: enable chain A and chain B dual mode.
1175    """
1176    return wf_pb.WifiConfig.IntelConfig.Bdcm.BdcmDualChainMode(
1177        chain_a_and_chain_b = chain_a_and_chain_b,
1178    )
1179
1180def _create_intel_bdcm(
1181        revision,  # only revision 1 is supported at the moment
1182        bdcm_dual_chain_mode = _create_intel_bdcm_dual_chain_mode()):
1183    """Builds a Bdcm proto for use with intel drivers.
1184
1185    Args:
1186        revision: BDCM table revision.
1187        bdcm_dual_chain_mode: Dual Chain Mode setting.
1188    """
1189    if revision != 1:
1190        fail("Invalid Intel BDCM revision (should be 1)")
1191    return wf_pb.WifiConfig.IntelConfig.Bdcm(
1192        revision = revision,
1193        bdcm_dual_chain_mode = bdcm_dual_chain_mode,
1194    )
1195
1196def _create_intel_bbsm_bands_selection(
1197        band_2_4_ghz_disable = False,
1198        band_5_2_ghz_disable = False,
1199        band_5_8_ghz_disable = False,
1200        band_6_2_ghz_disable = False):
1201    """Builds Bluetooth bands selection parameters for intel drivers.
1202
1203    Args:
1204        band_2_4_ghz_disable: Force disable 2.4 GHz band.
1205        band_5_2_ghz_disable: Force disable 5.2 GHz band.
1206        band_5_8_ghz_disable: Force disable 5.8 GHz band.
1207        band_6_2_ghz_disable: Force disable 6.2 GHz band.
1208    """
1209    return wf_pb.WifiConfig.IntelConfig.Bbsm.BbsmBandsSelection(
1210        band_2_4_ghz_disable = band_2_4_ghz_disable,
1211        band_5_2_ghz_disable = band_5_2_ghz_disable,
1212        band_5_8_ghz_disable = band_5_8_ghz_disable,
1213        band_6_2_ghz_disable = band_6_2_ghz_disable,
1214    )
1215
1216def _create_intel_bbsm(
1217        revision,  # only revision 1 is supported at the moment
1218        bands_selection = _create_intel_bbsm_bands_selection()):
1219    """Builds a Bbsm proto for use with intel drivers.
1220
1221    Args:
1222        revision: BBSM table revision.
1223        bands_selection: Bluetooth bands selection.
1224    """
1225    if revision != 1:
1226        fail("Invalid Intel BBSM revision (should be 1)")
1227    return wf_pb.WifiConfig.IntelConfig.Bbsm(
1228        revision = revision,
1229        bands_selection = bands_selection,
1230    )
1231
1232def _create_intel_bucs_uhb_country_selection(
1233        force_disable_bt_in_all_other_countries = False,
1234        allow_6_ghz_in_usa = False,
1235        allow_6_ghz_in_rest_of_the_world = False,
1236        allow_6_ghz_in_eu = False,
1237        allow_6_ghz_in_south_korea = False,
1238        allow_6_ghz_in_brazil = False,
1239        allow_6_ghz_in_chile = False,
1240        allow_6_ghz_in_japan = False,
1241        allow_6_ghz_in_canada = False,
1242        allow_6_ghz_in_morocco = False,
1243        allow_6_ghz_in_mongolia = False,
1244        allow_6_ghz_in_malaysia = False,
1245        allow_6_ghz_in_saudi_arabia = False,
1246        allow_6_ghz_in_mexico = False,
1247        allow_6_ghz_in_nigeria = False,
1248        allow_6_ghz_in_thailand = False,
1249        allow_6_ghz_in_singapore = False,
1250        allow_6_ghz_in_taiwan = False,
1251        allow_6_ghz_in_south_africa = False):
1252    """Builds Bluetooth Ultra-High band country selection parameters for intel drivers.
1253
1254    Args:
1255        force_disable_bt_in_all_other_countries: Disable for all countries not covered by the other fields,
1256        allow_6_ghz_in_usa: Allow 6 GHz band for the Allow 6 GHz band for the USA
1257        allow_6_ghz_in_rest_of_the_world: Allow 6 GHz band for the rest of the world
1258        allow_6_ghz_in_eu: Allow 6 GHz band for the European Union
1259        allow_6_ghz_in_south_korea: Allow 6 GHz band for South Korea
1260        allow_6_ghz_in_brazil: Allow 6 GHz band for Brazil
1261        allow_6_ghz_in_chile: Allow 6 GHz band for Chile
1262        allow_6_ghz_in_japan: Allow 6 GHz band for Japan
1263        allow_6_ghz_in_canada: Allow 6 GHz band for Canada
1264        allow_6_ghz_in_morocco: Allow 6 GHz band for Morocco
1265        allow_6_ghz_in_mongolia: Allow 6 GHz band for the Mongolia
1266        allow_6_ghz_in_malaysia: Allow 6 GHz band for the Malaysia
1267        allow_6_ghz_in_saudi_arabia = Allow 6 GHz band for Saudi Arabia
1268        allow_6_ghz_in_mexico = Allow 6 GHz band for Mexico
1269        allow_6_ghz_in_nigeria = Allow 6 GHz band for Nigeria
1270        allow_6_ghz_in_thailand = Allow 6 GHz band for Thailand
1271        allow_6_ghz_in_singapore = Allow 6 GHz band for Singapore
1272        allow_6_ghz_in_taiwan = Allow 6 GHz band for Taiwan
1273        allow_6_ghz_in_south_africa = Allow 6 GHz band for South Africa
1274    """
1275    return wf_pb.WifiConfig.IntelConfig.Bucs.BucsUhbCountrySelection(
1276        force_disable_bt_in_all_other_countries = force_disable_bt_in_all_other_countries,
1277        allow_6_ghz_in_usa = allow_6_ghz_in_usa,
1278        allow_6_ghz_in_rest_of_the_world = allow_6_ghz_in_rest_of_the_world,
1279        allow_6_ghz_in_eu = allow_6_ghz_in_eu,
1280        allow_6_ghz_in_south_korea = allow_6_ghz_in_south_korea,
1281        allow_6_ghz_in_brazil = allow_6_ghz_in_brazil,
1282        allow_6_ghz_in_chile = allow_6_ghz_in_chile,
1283        allow_6_ghz_in_japan = allow_6_ghz_in_japan,
1284        allow_6_ghz_in_canada = allow_6_ghz_in_canada,
1285        allow_6_ghz_in_morocco = allow_6_ghz_in_morocco,
1286        allow_6_ghz_in_mongolia = allow_6_ghz_in_mongolia,
1287        allow_6_ghz_in_malaysia = allow_6_ghz_in_malaysia,
1288        allow_6_ghz_in_saudi_arabia = allow_6_ghz_in_saudi_arabia,
1289        allow_6_ghz_in_mexico = allow_6_ghz_in_mexico,
1290        allow_6_ghz_in_nigeria = allow_6_ghz_in_nigeria,
1291        allow_6_ghz_in_thailand = allow_6_ghz_in_thailand,
1292        allow_6_ghz_in_singapore = allow_6_ghz_in_singapore,
1293        allow_6_ghz_in_taiwan = allow_6_ghz_in_taiwan,
1294        allow_6_ghz_in_south_africa = allow_6_ghz_in_south_africa,
1295    )
1296
1297def _create_intel_bucs(
1298        revision,  # only revision 1 is supported at the moment
1299        uhb_country_selection = _create_intel_bucs_uhb_country_selection()):
1300    """Builds a Bucs proto for use with intel drivers.
1301
1302    Args:
1303        revision: BUCS table revision.
1304        uhb_country_selection: Ultra-High Band Country selection.
1305    """
1306    if revision != 1:
1307        fail("Invalid Intel BUCS revision (should be 1)")
1308    return wf_pb.WifiConfig.IntelConfig.Bucs(
1309        revision = revision,
1310        uhb_country_selection = uhb_country_selection,
1311    )
1312
1313def _create_intel_bdmm(
1314        revision,  # only revision 1 is supported at the moment
1315        dual_mac_enable = False):
1316    """Builds a Bdmm proto for use with intel drivers.
1317
1318    Args:
1319        revision: BDMM table revision.
1320        dual_mac_enable: Bluetooth Dual Mac enable.
1321    """
1322    if revision != 1:
1323        fail("Invalid Intel BDMM revision (should be 1)")
1324    return wf_pb.WifiConfig.IntelConfig.Bdmm(
1325        revision = revision,
1326        dual_mac_enable = dual_mac_enable,
1327    )
1328
1329def _create_intel_ebrd(
1330        revision,  # only revision 1 is supported at the moment
1331        dynamic_sar_enable = False,
1332        number_of_optional_sar = 0,
1333        set_2_chain_a = _create_intel_bluetooth_sar_power_table(),
1334        set_2_chain_b = _create_intel_bluetooth_sar_power_table(),
1335        set_3_chain_a = _create_intel_bluetooth_sar_power_table(),
1336        set_3_chain_b = _create_intel_bluetooth_sar_power_table(),
1337        set_4_chain_a = _create_intel_bluetooth_sar_power_table(),
1338        set_4_chain_b = _create_intel_bluetooth_sar_power_table()):
1339    """Builds a Extended Bluetooth Regulatory Descriptor (Ebrd) proto for use with intel drivers.
1340
1341    Args:
1342        revision: EBRD table revision.
1343        dynamic_sar_enable: Enable Bluetooth Dynamic SAR.
1344        number_of_optional_sar = Number of optional sets defined.
1345        set_2_chain_a: Second set Chain A SAR power table.
1346        set_2_chain_b: Second set Chain B SAR power table.
1347        set_3_chain_a: Third set Chain A SAR power table.
1348        set_3_chain_b: Third set Chain B SAR power table.
1349        set_4_chain_a: Fourth set Chain A SAR power table.
1350        set_4_chain_b: Fourth set Chain B SAR power table.
1351    """
1352    if revision != 1:
1353        fail("Invalid Intel EBRD revision (should be 1)")
1354    return wf_pb.WifiConfig.IntelConfig.Ebrd(
1355        revision = revision,
1356        dynamic_sar_enable = dynamic_sar_enable,
1357        number_of_optional_sar = number_of_optional_sar,
1358        set_2_chain_a = set_2_chain_a,
1359        set_2_chain_b = set_2_chain_b,
1360        set_3_chain_a = set_3_chain_a,
1361        set_3_chain_b = set_3_chain_b,
1362        set_4_chain_a = set_4_chain_a,
1363        set_4_chain_b = set_4_chain_b,
1364    )
1365
1366def _create_intel_wpfc(
1367        revision,  # only revision 0 is supported at the moment
1368        filter_cfg_chain_a = 0,
1369        filter_cfg_chain_b = 0,
1370        filter_cfg_chain_c = 0,
1371        filter_cfg_chain_d = 0):
1372    """Builds a Wpfc proto for use with intel drivers.
1373
1374    Args:
1375        revision: WPFC table revision.
1376        filter_cfg_chain_a: Chain A Filter Platform Configuration
1377        filter_cfg_chain_b: Chain B Filter Platform Configuration
1378        filter_cfg_chain_c: Chain C Filter Platform Configuration
1379        filter_cfg_chain_d: Chain D Filter Platform Configuration
1380    """
1381    if revision != 0:
1382        fail("Invalid Intel WPFC revision (should be 0)")
1383    return wf_pb.WifiConfig.IntelConfig.Wpfc(
1384        revision = revision,
1385        filter_cfg_chain_a = filter_cfg_chain_a,
1386        filter_cfg_chain_b = filter_cfg_chain_b,
1387        filter_cfg_chain_c = filter_cfg_chain_c,
1388        filter_cfg_chain_d = filter_cfg_chain_d,
1389    )
1390
1391def _create_intel_dsbr(
1392        revision,  # only revision 0 and 1 are supported at the moment
1393        override = True,
1394        bluetooth_radio_resistor_ohm = 33):
1395    """Builds a Dsbr proto for use with intel drivers.
1396
1397    Args:
1398        revision: DSBR table revision.
1399        override: Override device FW default values
1400        bluetooth_radio_resistor_ohm: Override value
1401    """
1402    if revision not in [0, 1]:
1403        fail("Invalid Intel DSBR revision (should be 0 or 1)")
1404    return wf_pb.WifiConfig.IntelConfig.Dsbr(
1405        revision = revision,
1406        override = override,
1407        bluetooth_radio_resistor_ohm = bluetooth_radio_resistor_ohm,
1408    )
1409
1410def _create_intel_offsets_table(
1411        wgds_revision = 0xff,
1412        fcc_offsets = None,
1413        eu_offsets = None,
1414        other_offsets = None):
1415    """Builds a Geo Offsets proto for use with intel drivers.
1416
1417    Args:
1418        wgds_revision: Geo delta table revision,
1419        fcc_offsets: Offsets used for regulatory domains that follow FCC guidelines.
1420        eu_offsets: Offsets used for regulatory domains that follow ESTI guidelines.
1421        other_offsets: Offsets for regulatory domains that don't follow FCC or ETSI guidelines.
1422    """
1423    return wf_pb.WifiConfig.IntelConfig.Offsets(
1424        wgds_version = wgds_revision,
1425        offset_fcc = fcc_offsets,
1426        offset_eu = eu_offsets,
1427        offset_other = other_offsets,
1428    )
1429
1430def _create_intel_sar_avg_table(
1431        wtas_revision = 0xffff,
1432        tas_selection = 0,
1433        tas_list_size = 0,
1434        deny_list_entry_1 = 0,
1435        deny_list_entry_2 = 0,
1436        deny_list_entry_3 = 0,
1437        deny_list_entry_4 = 0,
1438        deny_list_entry_5 = 0,
1439        deny_list_entry_6 = 0,
1440        deny_list_entry_7 = 0,
1441        deny_list_entry_8 = 0,
1442        deny_list_entry_9 = 0,
1443        deny_list_entry_10 = 0,
1444        deny_list_entry_11 = 0,
1445        deny_list_entry_12 = 0,
1446        deny_list_entry_13 = 0,
1447        deny_list_entry_14 = 0,
1448        deny_list_entry_15 = 0,
1449        deny_list_entry_16 = 0):
1450    """Builds a wifi time average SAR proto for use with intel drivers.
1451
1452    Args:
1453        wtas_revision: Wifi time average SAR version.
1454        tas_selection: Enable/disable the TAS feature.
1455        tas_list_size: Represents the number of blocked countries that are not approved by the
1456                       OEM to support this feature, even if that feature is enabled.
1457        deny_list_entry_1: ISO country code 1 to block.
1458        deny_list_entry_2: ISO country code 2 to block.
1459        deny_list_entry_3: ISO country code 3 to block.
1460        deny_list_entry_4: ISO country code 4 to block.
1461        deny_list_entry_5: ISO country code 5 to block.
1462        deny_list_entry_6: ISO country code 6 to block.
1463        deny_list_entry_7: ISO country code 7 to block.
1464        deny_list_entry_8: ISO country code 8 to block.
1465        deny_list_entry_9: ISO country code 9 to block.
1466        deny_list_entry_10: ISO country code 10 to block.
1467        deny_list_entry_11: ISO country code 11 to block.
1468        deny_list_entry_12: ISO country code 12 to block.
1469        deny_list_entry_13: ISO country code 13 to block.
1470        deny_list_entry_14: ISO country code 14 to block.
1471        deny_list_entry_15: ISO country code 15 to block.
1472        deny_list_entry_16: ISO country code 16 to block.
1473    """
1474    return wf_pb.WifiConfig.IntelConfig.Average(
1475        sar_avg_version = wtas_revision,
1476        tas_selection = tas_selection,
1477        tas_list_size = tas_list_size,
1478        deny_list_entry_1 = deny_list_entry_1,
1479        deny_list_entry_2 = deny_list_entry_2,
1480        deny_list_entry_3 = deny_list_entry_3,
1481        deny_list_entry_4 = deny_list_entry_4,
1482        deny_list_entry_5 = deny_list_entry_5,
1483        deny_list_entry_6 = deny_list_entry_6,
1484        deny_list_entry_7 = deny_list_entry_7,
1485        deny_list_entry_8 = deny_list_entry_8,
1486        deny_list_entry_9 = deny_list_entry_9,
1487        deny_list_entry_10 = deny_list_entry_10,
1488        deny_list_entry_11 = deny_list_entry_11,
1489        deny_list_entry_12 = deny_list_entry_12,
1490        deny_list_entry_13 = deny_list_entry_13,
1491        deny_list_entry_14 = deny_list_entry_14,
1492        deny_list_entry_15 = deny_list_entry_15,
1493        deny_list_entry_16 = deny_list_entry_16,
1494    )
1495
1496def _create_intel_wifi(
1497        sar_table = None,
1498        wgds_table = None,
1499        ant_table = None,
1500        wtas_table = None,
1501        dsm = None,
1502        bt_sar = None,
1503        wbem = None,
1504        bpag = None,
1505        bbfb = None,
1506        bdcm = None,
1507        bbsm = None,
1508        bucs = None,
1509        bdmm = None,
1510        ebrd = None,
1511        wpfc = None,
1512        dsbr = None):
1513    """Builds a IntelConfig proto for use with intel drivers.
1514
1515    Args:
1516        sar_table: SarTable proto for use with intel driver.
1517        wgds_table: Geo Offsets proto for use with intel driver.
1518        ant_table: Antenna Gains for use with intel driver.
1519        wtas_table: Time average SAR for use with intel driver.
1520        dsm: Device specific methods return values for intel driver.
1521        bt_sar: BluetoothSar proto for use with intel driver.
1522        wbem: Wbem proto for use with intel driver.
1523        bpag: BluetoothPpag proto for use with intel driver.
1524        bbfb: Bbfb proto for use with intel driver.
1525        bdcm: Bdcm proto for use with intel driver.
1526        bbsm: Bbsm proto for use with intel driver.
1527        bucs: Bucs proto for use with intel driver.
1528        bdmm: Bdmm proto for use with intel driver.
1529        ebrd: Ebrd proto for use with intel driver.
1530        wpfc: Wpfc proto for use with intel driver.
1531        dsbr: Dsbr proto for use with intel driver.
1532    """
1533    return wf_pb.WifiConfig(
1534        intel_config = wf_pb.WifiConfig.IntelConfig(
1535            sar_table = sar_table,
1536            wgds_table = wgds_table,
1537            ant_table = ant_table,
1538            wtas_table = wtas_table,
1539            dsm = dsm,
1540            bt_sar = bt_sar,
1541            wbem = wbem,
1542            bpag = bpag,
1543            bbfb = bbfb,
1544            bdcm = bdcm,
1545            bbsm = bbsm,
1546            bucs = bucs,
1547            bdmm = bdmm,
1548            ebrd = ebrd,
1549            wpfc = wpfc,
1550            dsbr = dsbr,
1551        ),
1552    )
1553
1554def _create_legacy_intel_wifi():
1555    return wf_pb.WifiConfig(
1556        legacy_intel_config = wf_pb.WifiConfig.LegacyIntelConfig(),
1557    )
1558
1559def _create_mtk_geo_power_chain(
1560        limit_2g,
1561        limit_5g,
1562        offset_2g,
1563        offset_5g,
1564        limit_6g = None,
1565        offset_6g = None):
1566    """Builds a GeoTransmitPowerChain for mtk drivers.
1567
1568    Args:
1569        limit_2g: 2G band geo power limit. (0.25 dBm). Required.
1570        limit_5g: 5G band geo power limit. (0.25 dBm). Required.
1571        offset_2g: Value to be added to the 2.4GHz WiFi band. (0.25 dBm). Required.
1572        offset_5g: Value to be added to all 5GHz WiFi bands. (0.25 dBm). Required.
1573        limit_6g: 6G band geo power limit. (0.25 dBm).
1574        offset_6g: Value to be added to all 6GHz WiFi bands. (0.25 dBm).
1575    """
1576    return wf_pb.WifiConfig.MtkConfig.GeoTransmitPowerChain(
1577        limit_2g = limit_2g,
1578        limit_5g = limit_5g,
1579        offset_2g = offset_2g,
1580        offset_5g = offset_5g,
1581        limit_6g = limit_6g,
1582        offset_6g = offset_6g,
1583    )
1584
1585def _create_mtk_power_chain(
1586        limit_2g,
1587        limit_5g_1,
1588        limit_5g_2,
1589        limit_5g_3,
1590        limit_5g_4,
1591        limit_6g_1 = None,
1592        limit_6g_2 = None,
1593        limit_6g_3 = None,
1594        limit_6g_4 = None,
1595        limit_6g_5 = None,
1596        limit_6g_6 = None):
1597    """Builds a TransmitPowerChain for mtk drivers.
1598
1599    Args:
1600        limit_2g: 2G band power limit. (0.25 dBm). Required.
1601        limit_5g_1: 5G band 1 power limit: 5.15G-5.35G frequency. (0.25 dBm). Required.
1602        limit_5g_2: 5G band 2 power limit: 5.35G-5.47G frequency. (0.25 dBm). Required.
1603        limit_5g_3: 5G band 3 power limit: 5.47G-5.725G frequency. (0.25 dBm). Required.
1604        limit_5g_4: 5G band 4 power limit: 5.725G-5.95G frequency. (0.25 dBm). Required.
1605        limit_6g_1: 6G band 1 power limit: 5.945G-6.165G frequency. (0.25 dBm).
1606        limit_6g_2: 6G band 2 power limit: 6.165G-6.405G frequency. (0.25 dBm).
1607        limit_6g_3: 6G band 3 power limit: 6.405G-6.525G frequency. (0.25 dBm).
1608        limit_6g_4: 6G band 4 power limit: 6.525G-6.705G frequency. (0.25 dBm).
1609        limit_6g_5: 6G band 5 power limit: 6.705G-6.865G frequency. (0.25 dBm).
1610        limit_6g_6: 6G band 6 power limit: 6.865G-7.125G frequency. (0.25 dBm).
1611    """
1612    return wf_pb.WifiConfig.MtkConfig.TransmitPowerChain(
1613        limit_2g = limit_2g,
1614        limit_5g_1 = limit_5g_1,
1615        limit_5g_2 = limit_5g_2,
1616        limit_5g_3 = limit_5g_3,
1617        limit_5g_4 = limit_5g_4,
1618        limit_6g_1 = limit_6g_1,
1619        limit_6g_2 = limit_6g_2,
1620        limit_6g_3 = limit_6g_3,
1621        limit_6g_4 = limit_6g_4,
1622        limit_6g_5 = limit_6g_5,
1623        limit_6g_6 = limit_6g_6,
1624    )
1625
1626def _create_mtcl_table(
1627        version,
1628        support_6ghz,
1629        bitmask_6ghz,
1630        support_5p9ghz,
1631        bitmask_5p9ghz):
1632    """Builds a MtclTable for mtk drivers.
1633
1634    Args:
1635        version: The version of the MTCL payload. Only version 2 is supported. Required.
1636        support_6ghz: Support 6GHz operation. 0 disables, 1 enables if the driver and BIOS support this country, 2 enables if the kernel driver would enable operation. Required.
1637        bitmask_6ghz: The bitmask representing which countries should have 6GHz operation enabled. Valid values are 0x0 - 0xFFFFFFFF0000 where the final two bytes MUST be zero. Required.
1638        support_5p9ghz: Support 5.9GHz operation. 0 disables, 1 enables if the driver and BIOS support this country, 2 enables if the kernel driver would enable operation. Required.
1639        bitmask_5p9ghz: The bitmask representing which countries should have 5.9GHz operation enabled. Valid values are 0x0 - 0xFFFFFFFF0000 where the final two bytes MUST be zero. Required.
1640    """
1641    return wf_pb.WifiConfig.MtkConfig.MtclTable(
1642        version = version,
1643        support_6ghz = support_6ghz,
1644        bitmask_6ghz = bitmask_6ghz,
1645        support_5p9ghz = support_5p9ghz,
1646        bitmask_5p9ghz = bitmask_5p9ghz,
1647    )
1648
1649def _create_mtk_wifi(
1650        non_tablet_mode_transmit_power_chain,
1651        tablet_mode_transmit_power_chain,
1652        fcc_transmit_power_chain = None,
1653        eu_transmit_power_chain = None,
1654        other_transmit_power_chain = None,
1655        country_list = None):
1656    """Builds a WifiConfig proto for use with mtk drivers.
1657
1658    Args:
1659        non_tablet_mode_transmit_power_chain: non-tablet mode power chain. Required.
1660        tablet_mode_transmit_power_chain: tablet mode power chain. Required.
1661        fcc_transmit_power_chain: power chain for regulatory domains that follow FCC guidelines.
1662        eu_transmit_power_chain: power chain for regulatory domains that follow ESTI guidelines.
1663        other_transmit_power_chain: power chain for regulatory domains that don't follow FCC or ETSI guidelines.
1664        country_list: country list definition for MTCL ACPI method.
1665    """
1666    return wf_pb.WifiConfig(
1667        mtk_config = wf_pb.WifiConfig.MtkConfig(
1668            non_tablet_mode_power_table = non_tablet_mode_transmit_power_chain,
1669            tablet_mode_power_table = tablet_mode_transmit_power_chain,
1670            fcc_power_table = fcc_transmit_power_chain,
1671            eu_power_table = eu_transmit_power_chain,
1672            other_power_table = other_transmit_power_chain,
1673            country_list = country_list,
1674        ),
1675    )
1676
1677def _create_camera(
1678        generate_media_profiles = False,
1679        camcorder_resolutions = None,
1680        has_external_camera = False):
1681    """Builds a CameraConfig proto."""
1682    return cam_pb.CameraConfig(
1683        generate_media_profiles = generate_media_profiles,
1684        camcorder_resolutions = camcorder_resolutions if camcorder_resolutions else [],
1685        has_external_camera = has_external_camera,
1686    )
1687
1688_UI_REQUISITION = struct(
1689    CHROMEOS = ui_pb.UiConfig.REQUISITION_CHROMEOS,
1690    MEETHW = ui_pb.UiConfig.REQUISITION_MEETHW,
1691)
1692
1693def _create_ui(
1694        extra_web_apps_dir = None,
1695        requisition = None,
1696        cloud_gaming_device = None):
1697    return ui_pb.UiConfig(
1698        extra_web_apps_dir = extra_web_apps_dir,
1699        requisition = requisition,
1700        cloud_gaming_device = cloud_gaming_device,
1701    )
1702
1703def _create_usb(
1704        dp_only = None):
1705    return usb_pb.UsbConfig(
1706        typecd = usb_pb.UsbConfig.TypeCD(
1707            dp_only = dp_only or False,
1708        ),
1709    )
1710
1711def _make_resolution(width, height):
1712    return cam_pb.Resolution(width = width, height = height)
1713
1714sw_config = struct(
1715    create_ath10k = _create_ath10k,
1716    create_ath10k_power_chain = _create_ath10k_power_chain,
1717    create_audio = _create_audio,
1718    create_bluetooth = _create_bluetooth,
1719    create_camera = _create_camera,
1720    create_disk_layout = _create_disk_layout,
1721    create_fw_info = _create_fw_info,
1722    create_fw_version = _create_fw_version,
1723    create_fw_payload = _create_fw_payload,
1724    create_fw_config = _create_fw_config,
1725    create_fw_payloads_by_names = _create_fw_payloads_by_names,
1726    create_fw_build_config = _create_fw_build_config,
1727    create_fw_build_config_by_names = _create_fw_build_config_by_names,
1728    create_fw_build_targets = _create_fw_build_targets,
1729    create_health = _create_health,
1730    create_ssfc_probeable_component = _create_ssfc_probeable_component,
1731    create_ssfc_component_type_config = _create_ssfc_component_type_config,
1732    create_ssfc = _create_ssfc,
1733    create_rma = _create_rma,
1734    create_nnpalm = _create_nnpalm,
1735    create_power = _create_power,
1736    create_resource = _create_resource,
1737    create_power_source_preference = _create_power_source_preference,
1738    create_power_preference = _create_power_preference,
1739    create_conservative_governor = _create_conservative_governor,
1740    create_ondemand_governor = _create_ondemand_governor,
1741    create_performance_governor = _create_performance_governor,
1742    create_powersave_governor = _create_powersave_governor,
1743    create_schedutil_governor = _create_schedutil_governor,
1744    create_userspace_governor = _create_userspace_governor,
1745    create_default_epp = _create_default_epp,
1746    create_performance_epp = _create_performance_epp,
1747    create_balance_performance_epp = _create_balance_performance_epp,
1748    create_balance_power_epp = _create_balance_power_epp,
1749    create_power_epp = _create_power_epp,
1750    create_cpu_offline_small_core = _create_cpu_offline_small_core,
1751    create_cpu_offline_smt = _create_cpu_offline_smt,
1752    create_cpu_offline_half = _create_cpu_offline_half,
1753    create_intel_antenna_gain = _create_intel_antenna_gain,
1754    create_intel_antgain_table = _create_intel_antgain_table,
1755    create_intel_dsm_enablement_11be_countries = _create_intel_dsm_enablement_11be_countries,
1756    create_intel_dsm_energy_detection_threshold = _create_intel_dsm_energy_detection_threshold,
1757    create_intel_dsm_rfi_mitigation = _create_intel_dsm_rfi_mitigation,
1758    create_intel_dsm = _create_intel_dsm,
1759    create_intel_bluetooth_sar_power_table = _create_intel_bluetooth_sar_power_table,
1760    create_intel_bt_sar = _create_intel_bt_sar,
1761    create_intel_wbem_country_enablement = _create_intel_wbem_country_enablement,
1762    create_intel_wbem = _create_intel_wbem,
1763    create_intel_bpag_country_enablement = _create_intel_bpag_country_enablement,
1764    create_intel_bpag = _create_intel_bpag,
1765    create_intel_bbfb = _create_intel_bbfb,
1766    create_intel_bdcm_dual_chain_mode = _create_intel_bdcm_dual_chain_mode,
1767    create_intel_bdcm = _create_intel_bdcm,
1768    create_intel_bbsm_bands_selection = _create_intel_bbsm_bands_selection,
1769    create_intel_bbsm = _create_intel_bbsm,
1770    create_intel_bucs_uhb_country_selection = _create_intel_bucs_uhb_country_selection,
1771    create_intel_bucs = _create_intel_bucs,
1772    create_intel_bdmm = _create_intel_bdmm,
1773    create_intel_ebrd = _create_intel_ebrd,
1774    create_intel_wpfc = _create_intel_wpfc,
1775    create_intel_dsbr = _create_intel_dsbr,
1776    create_intel_geo_offsets = _create_intel_geo_offsets,
1777    create_intel_offsets_table = _create_intel_offsets_table,
1778    create_intel_power_chain = _create_intel_power_chain,
1779    create_intel_sar_table = _create_intel_sar_table,
1780    create_intel_sar_avg_table = _create_intel_sar_avg_table,
1781    create_intel_wifi = _create_intel_wifi,
1782    create_legacy_intel_wifi = _create_legacy_intel_wifi,
1783    create_mtcl_table = _create_mtcl_table,
1784    create_mtk_geo_power_chain = _create_mtk_geo_power_chain,
1785    create_mtk_power_chain = _create_mtk_power_chain,
1786    create_mtk_wifi = _create_mtk_wifi,
1787    create_rtw88 = _create_rtw88,
1788    create_rtw88_geo_offsets = _create_rtw88_geo_offsets,
1789    create_rtw88_power_chain = _create_rtw88_power_chain,
1790    create_rtw89 = _create_rtw89,
1791    create_rtw89_geo_offsets = _create_rtw89_geo_offsets,
1792    create_rtw89_power_chain = _create_rtw89_power_chain,
1793    create_ui = _create_ui,
1794    create_usb = _create_usb,
1795    fw_type = _FW_TYPE,
1796    hash_algorithm = _HASH_ALGORITHM,
1797    support_band = _SUPPORT_BAND,
1798    ui_requisition = _UI_REQUISITION,
1799    make_resolution = _make_resolution,
1800)
1801