2021-03-08 15:13:27 +03:00
#!/usr/bin/env python3
2021-10-01 13:49:36 +03:00
# SPDX-License-Identifier: BSD-3-Clause
2019-09-10 00:49:35 +03:00
# -*- coding: utf-8 -*-
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
2021-10-01 13:49:36 +03:00
# found in the LICENSES/BSD-3-Clause.txt file.
2019-09-10 00:49:35 +03:00
""" Autosuspend udev rule generator
This script is executed at build time to generate udev rules . The
resulting rules file is installed on the device , the script itself
is not .
"""
# List of USB devices (vendorid:productid) for which it is safe to enable
# autosuspend.
USB_IDS = [ ]
# Host Controllers and internal hubs
USB_IDS + = [
# Linux Host Controller (UHCI) (most older x86 boards)
2023-08-16 04:08:08 +03:00
" 1d6b:0001 " ,
2019-09-10 00:49:35 +03:00
# Linux Host Controller (EHCI) (all boards)
2023-08-16 04:08:08 +03:00
" 1d6b:0002 " ,
2019-09-10 00:49:35 +03:00
# Linux Host Controller (XHCI) (most newer boards)
2023-08-16 04:08:08 +03:00
" 1d6b:0003 " ,
2019-09-10 00:49:35 +03:00
# SMSC (Internal HSIC Hub) (most Exynos boards)
2023-08-16 04:08:08 +03:00
" 0424:3503 " ,
2019-09-10 00:49:35 +03:00
# Intel (Rate Matching Hub) (all x86 boards)
2023-08-16 04:08:08 +03:00
" 05e3:0610 " ,
2019-09-10 00:49:35 +03:00
# Intel (Internal Hub?) (peppy, falco)
2023-08-16 04:08:08 +03:00
" 8087:0024 " ,
2019-09-10 00:49:35 +03:00
# Genesys Logic (Internal Hub) (rambi)
2023-08-16 04:08:08 +03:00
" 8087:8000 " ,
2020-02-06 18:55:42 +03:00
# Microchip (Composite HID + CDC) (kefka)
2023-08-16 04:08:08 +03:00
" 04d8:0b28 " ,
2019-09-10 00:49:35 +03:00
]
# Webcams
USB_IDS + = [
# Chicony (zgb)
2023-08-16 04:08:08 +03:00
" 04f2:b1d8 " ,
2019-09-10 00:49:35 +03:00
# Chicony (mario)
2023-08-16 04:08:08 +03:00
" 04f2:b262 " ,
2019-09-10 00:49:35 +03:00
# Chicony (stout)
2023-08-16 04:08:08 +03:00
" 04f2:b2fe " ,
2019-09-10 00:49:35 +03:00
# Chicony (butterfly)
2023-08-16 04:08:08 +03:00
" 04f2:b35f " ,
2019-09-10 00:49:35 +03:00
# Chicony (rambi)
2023-08-16 04:08:08 +03:00
" 04f2:b443 " ,
2019-09-10 00:49:35 +03:00
# Chicony (glados)
2023-08-16 04:08:08 +03:00
" 04f2:b552 " ,
2019-09-10 00:49:35 +03:00
# LiteOn (spring)
2023-08-16 04:08:08 +03:00
" 058f:b001 " ,
2019-09-10 00:49:35 +03:00
# Foxlink? (butterfly)
2023-08-16 04:08:08 +03:00
" 05c8:0351 " ,
2019-09-10 00:49:35 +03:00
# Foxlink? (butterfly)
2023-08-16 04:08:08 +03:00
" 05c8:0355 " ,
2019-09-10 00:49:35 +03:00
# Cheng Uei? (falco)
2023-08-16 04:08:08 +03:00
" 05c8:036e " ,
2019-09-10 00:49:35 +03:00
# SuYin (parrot)
2023-08-16 04:08:08 +03:00
" 064e:d251 " ,
2019-09-10 00:49:35 +03:00
# Realtek (falco)
2023-08-16 04:08:08 +03:00
" 0bda:571c " ,
2019-09-10 00:49:35 +03:00
# IMC Networks (squawks)
2023-08-16 04:08:08 +03:00
" 13d3:5657 " ,
2019-09-10 00:49:35 +03:00
# Sunplus (parrot)
2023-08-16 04:08:08 +03:00
" 1bcf:2c17 " ,
2019-09-10 00:49:35 +03:00
# (C-13HDO10B39N) (alex)
2023-08-16 04:08:08 +03:00
" 2232:1013 " ,
2019-09-10 00:49:35 +03:00
# (C-10HDP11538N) (lumpy)
2023-08-16 04:08:08 +03:00
" 2232:1017 " ,
2019-09-10 00:49:35 +03:00
# (Namuga) (link)
2023-08-16 04:08:08 +03:00
" 2232:1033 " ,
2019-09-10 00:49:35 +03:00
# (C-03FFM12339N) (daisy)
2023-08-16 04:08:08 +03:00
" 2232:1037 " ,
2019-09-10 00:49:35 +03:00
# (C-10HDO13531N) (peach)
2023-08-16 04:08:08 +03:00
" 2232:1056 " ,
2019-09-10 00:49:35 +03:00
# (NCM-G102) (samus)
2023-08-16 04:08:08 +03:00
" 2232:6001 " ,
2019-09-10 00:49:35 +03:00
# Acer (stout)
2023-08-16 04:08:08 +03:00
" 5986:0299 " ,
2019-09-10 00:49:35 +03:00
]
# Bluetooth Host Controller
USB_IDS + = [
# Hon-hai (parrot)
2023-08-16 04:08:08 +03:00
" 0489:e04e " ,
2019-09-10 00:49:35 +03:00
# Hon-hai (peppy)
2023-08-16 04:08:08 +03:00
" 0489:e056 " ,
2019-09-10 00:49:35 +03:00
# Hon-hai (Kahlee)
2023-08-16 04:08:08 +03:00
" 0489:e09f " ,
2019-09-10 00:49:35 +03:00
# QCA6174A (delan)
2023-08-16 04:08:08 +03:00
" 0489:e0a2 " ,
2019-09-10 00:49:35 +03:00
# LiteOn (parrot)
2023-08-16 04:08:08 +03:00
" 04ca:3006 " ,
2019-09-10 00:49:35 +03:00
# LiteOn (aleena)
2023-08-16 04:08:08 +03:00
" 04ca:3016 " ,
2019-09-10 00:49:35 +03:00
# LiteOn (scarlet)
2023-08-16 04:08:08 +03:00
" 04ca:301a " ,
2020-02-06 18:55:42 +03:00
# Realtek (blooglet)
2023-08-16 04:08:08 +03:00
" 0bda:b00c " ,
2019-09-10 00:49:35 +03:00
# Atheros (stumpy, stout)
2023-08-16 04:08:08 +03:00
" 0cf3:3004 " ,
2019-09-10 00:49:35 +03:00
# Atheros (AR3011) (mario, alex, zgb)
2023-08-16 04:08:08 +03:00
" 0cf3:3005 " ,
2019-09-10 00:49:35 +03:00
# Atheros (stumyp)
2023-08-16 04:08:08 +03:00
" 0cf3:3007 " ,
2019-09-10 00:49:35 +03:00
# Atheros (butterfly)
2023-08-16 04:08:08 +03:00
" 0cf3:311e " ,
2019-09-10 00:49:35 +03:00
# Atheros (scarlet)
2023-08-16 04:08:08 +03:00
" 0cf3:e300 " ,
2019-09-10 00:49:35 +03:00
# Marvell (rambi)
2023-08-16 04:08:08 +03:00
" 1286:2046 " ,
2019-09-10 00:49:35 +03:00
# Marvell (gru)
2023-08-16 04:08:08 +03:00
" 1286:204e " ,
2019-09-10 00:49:35 +03:00
# Intel (rambi, samus)
2023-08-16 04:08:08 +03:00
" 8087:07dc " ,
2019-09-10 00:49:35 +03:00
# Intel (strago, glados)
2023-08-16 04:08:08 +03:00
" 8087:0a2a " ,
2019-09-10 00:49:35 +03:00
# Intel (octopus)
2023-08-16 04:08:08 +03:00
" 8087:0aaa " ,
2019-09-10 00:49:35 +03:00
# Intel (hatch)
2023-08-16 04:08:08 +03:00
" 8087:0026 " ,
2019-09-10 00:49:35 +03:00
# Intel (atlas)
2023-08-16 04:08:08 +03:00
" 8087:0025 " ,
2019-09-10 00:49:35 +03:00
]
# WWAN (LTE)
USB_IDS + = [
# Huawei (ME936) (kip)
2023-08-16 04:08:08 +03:00
" 12d1:15bb " ,
2019-09-10 00:49:35 +03:00
# Fibocom (L850-GL) (coral, nautilus, sarien)
2023-08-16 04:08:08 +03:00
" 2cb7:0007 " ,
2020-11-26 15:54:08 +03:00
# Fibocom (NL668, NL652)
2023-08-16 04:08:08 +03:00
" 2cb7:01a0 " ,
# Fibocom (FM101-GL) (mbim)
" 2cb7:01a2 " ,
# Fibocom (FM101-GL) (adb)
" 2cb7:01a4 " ,
2019-09-10 00:49:35 +03:00
]
# Mass Storage
USB_IDS + = [
# Genesys (SD card reader) (lumpy, link, peppy)
2023-08-16 04:08:08 +03:00
" 05e3:0727 " ,
2019-09-10 00:49:35 +03:00
# Realtek (SD card reader) (mario, alex)
2023-08-16 04:08:08 +03:00
" 0bda:0138 " ,
2019-09-10 00:49:35 +03:00
# Realtek (SD card reader) (helios)
2023-08-16 04:08:08 +03:00
" 0bda:0136 " ,
2019-09-10 00:49:35 +03:00
# Realtek (SD card reader) (falco)
2023-08-16 04:08:08 +03:00
" 0bda:0177 " ,
2023-11-01 16:44:24 +03:00
# Realtek (SD card reader) (pirrha)
" 0bda:0129 " ,
2019-09-10 00:49:35 +03:00
]
# Security Key
USB_IDS + = [
# Yubico.com
2023-08-16 04:08:08 +03:00
" 1050:0211 " ,
2019-09-10 00:49:35 +03:00
# Yubico.com (HID firmware)
2023-08-16 04:08:08 +03:00
" 1050:0200 " ,
2019-09-10 00:49:35 +03:00
# Google Titan key
2023-08-16 04:08:08 +03:00
" 18d1:5026 " ,
2019-09-10 00:49:35 +03:00
]
# USB Audio devices
USB_IDS + = [
# Google USB-C to 3.5mm Digital Headphone Jack Adapter 'Mir'
2023-08-16 04:08:08 +03:00
" 18d1:5025 " ,
2019-09-10 00:49:35 +03:00
# Google USB-C to 3.5mm Digital Headphone Jack Adapter 'Mir' (HID only)
2023-08-16 04:08:08 +03:00
" 18d1:5029 " ,
2019-09-10 00:49:35 +03:00
# Google USB-C to 3.5mm Digital Headphone Jack Adapter 2018 'Condor'
2023-08-16 04:08:08 +03:00
" 18d1:5034 " ,
2019-09-10 00:49:35 +03:00
# Google Pixel USB-C Earbuds 'Blackbird'
2023-08-16 04:08:08 +03:00
" 18d1:5033 " ,
2019-09-10 00:49:35 +03:00
# Libratone Q Adapt In-Ear USB-C Earphones, Made for Google
2023-08-16 04:08:08 +03:00
" 03eb:2433 " ,
2019-09-10 00:49:35 +03:00
# Moshi USB-C to 3.5 mm Adapter/Charger, Made for Google
2023-08-16 04:08:08 +03:00
" 282b:48f0 " ,
2019-09-10 00:49:35 +03:00
# Moshi USB-C to 3.5 mm Adapter/Charger, Made for Google (HID only)
2023-08-16 04:08:08 +03:00
" 282b:0026 " ,
2019-09-10 00:49:35 +03:00
# AiAiAi TMA-2 C60 Cable, Made for Google
2023-08-16 04:08:08 +03:00
" 0572:1a08 " ,
2019-09-10 00:49:35 +03:00
# Apple USB-C to 3.5mm Headphone Jack Adapter
2023-08-16 04:08:08 +03:00
" 05ac:110a " ,
]
# RGB Keyboard
USB_IDS + = [
# Google Prism
" 18d1:5022 " ,
2019-09-10 00:49:35 +03:00
]
# List of PCI devices (vendorid:deviceid) for which it is safe to enable
# autosuspend.
PCI_IDS = [ ]
# Intel
PCI_IDS + = [
# Host bridge
2023-08-16 04:08:08 +03:00
" 8086:590c " ,
2019-09-10 00:49:35 +03:00
# i915
2023-08-16 04:08:08 +03:00
" 8086:591e " ,
2019-09-10 00:49:35 +03:00
# proc_thermal
2023-08-16 04:08:08 +03:00
" 8086:1903 " ,
2019-10-05 04:57:46 +03:00
# SPT PCH xHCI controller
2023-08-16 04:08:08 +03:00
" 8086:9d2f " ,
2019-10-05 04:57:46 +03:00
# CNP PCH xHCI controller
2023-08-16 04:08:08 +03:00
" 8086:9ded " ,
2019-09-10 00:49:35 +03:00
# intel_pmc_core
2023-08-16 04:08:08 +03:00
" 8086:9d21 " ,
2019-09-10 00:49:35 +03:00
# i801_smbus
2023-08-16 04:08:08 +03:00
" 8086:9d23 " ,
2019-09-10 00:49:35 +03:00
# iwlwifi
2023-08-16 04:08:08 +03:00
" 8086:095a " ,
2019-09-10 00:49:35 +03:00
# GMM
2023-08-16 04:08:08 +03:00
" 8086:1911 " ,
2019-09-10 00:49:35 +03:00
# Thermal
2023-08-16 04:08:08 +03:00
" 8086:9d31 " ,
2019-09-10 00:49:35 +03:00
# MME
2023-08-16 04:08:08 +03:00
" 8086:9d3a " ,
2019-09-10 00:49:35 +03:00
# CrOS EC
2023-08-16 04:08:08 +03:00
" 8086:9d4b " ,
2019-09-10 00:49:35 +03:00
# PCH SPI
2023-08-16 04:08:08 +03:00
" 8086:9d24 " ,
2019-09-10 00:49:35 +03:00
# SATA
2023-08-16 04:08:08 +03:00
" 8086:02d3 " ,
2019-09-10 00:49:35 +03:00
# RAM memory
2023-08-16 04:08:08 +03:00
" 8086:02ef " ,
2019-09-10 00:49:35 +03:00
# ISA bridge
2023-08-16 04:08:08 +03:00
" 8086:0284 " ,
2019-09-10 00:49:35 +03:00
# Communication controller
2023-08-16 04:08:08 +03:00
" 8086:02e0 " ,
2019-09-10 00:49:35 +03:00
# Network controller
2023-08-16 04:08:08 +03:00
" 8086:02f0 " ,
2019-09-10 00:49:35 +03:00
# Serial bus controller
2023-08-16 04:08:08 +03:00
" 8086:02a4 " ,
2019-09-10 00:49:35 +03:00
# USB controller
2023-08-16 04:08:08 +03:00
" 8086:02ed " ,
# JSL xHCI controller
" 8086:4ded " ,
2020-10-15 13:33:12 +03:00
# Volteer xHCI controller
2023-08-16 04:08:08 +03:00
" 8086:a0ed " ,
# Brya xHCI controller
" 8086:51ed " ,
# ADL-N PCH xHCI controller
" 8086:54ed " ,
2019-09-10 00:49:35 +03:00
# Graphics
2023-08-16 04:08:08 +03:00
" 8086:9b41 " ,
2019-09-10 00:49:35 +03:00
# DSP
2023-08-16 04:08:08 +03:00
" 8086:02f9 " ,
2019-09-10 00:49:35 +03:00
# Host bridge
2023-08-16 04:08:08 +03:00
" 8086:9b61 " ,
2019-09-10 00:49:35 +03:00
# Host bridge
2023-08-16 04:08:08 +03:00
" 8086:9b71 " ,
2019-09-10 00:49:35 +03:00
# PCI Bridge
2023-08-16 04:08:08 +03:00
" 8086:02b0 " ,
2019-09-10 00:49:35 +03:00
# i915 (atlas)
2023-08-16 04:08:08 +03:00
" 8086:591c " ,
2019-09-10 00:49:35 +03:00
# iwlwifi (atlas)
2023-08-16 04:08:08 +03:00
" 8086:2526 " ,
2020-02-06 18:55:42 +03:00
# i915 (kefka)
2023-08-16 04:08:08 +03:00
" 8086:22b1 " ,
2020-02-06 18:55:42 +03:00
# proc_thermal (kefka)
2023-08-16 04:08:08 +03:00
" 8086:22dc " ,
2020-02-06 18:55:42 +03:00
# xchi_hdc (kefka)
2023-08-16 04:08:08 +03:00
" 8086:22b5 " ,
2020-02-06 18:55:42 +03:00
# snd_hda (kefka)
2023-08-16 04:08:08 +03:00
" 8086:2284 " ,
2020-02-06 18:55:42 +03:00
# pcieport (kefka)
2023-08-16 04:08:08 +03:00
" 8086:22c8 " ,
" 8086:22cc " ,
2020-02-06 18:55:42 +03:00
# lpc_ich (kefka)
2023-08-16 04:08:08 +03:00
" 8086:229c " ,
2020-02-06 18:55:42 +03:00
# iosf_mbi_pci (kefka)
2023-08-16 04:08:08 +03:00
" 8086:2280 " ,
# Host bridge (nami)
" 8086:5904 " ,
" 8086:5914 " ,
# Graphics (nami)
" 8086:5906 " ,
" 8086:5917 " ,
# ISA bridge (nami)
" 8086:9d4e " ,
# wifi 7265 (nami)
" 8086:095b " ,
# Graphics (brya)
" 8086:46a8 " ,
# Core 12G GNA (brya)
" 8086:464f " ,
# PCH Shared SRAM (brya)
" 8086:51ef " ,
# PCH eSPI (brya)
" 8086:5182 " ,
" 8086:4601 " ,
# Core 12G DTT (brya)
" 8086:461d " ,
# Wifi (Brya)
" 8086:51f0 " ,
# PCH SPI (brya)
" 8086:51a4 " ,
2019-09-10 00:49:35 +03:00
]
# Samsung
PCI_IDS + = [
# NVMe KUS030205M-B001
2023-08-16 04:08:08 +03:00
" 144d:a806 " ,
2019-09-10 00:49:35 +03:00
# NVMe MZVLB256HAHQ
2023-08-16 04:08:08 +03:00
" 144d:a808 " ,
# NVMe MZ9LQ256HBJD-00BH1 (brya)
" 144d:a809 " ,
2019-09-10 00:49:35 +03:00
]
# Lite-on
PCI_IDS + = [
# 3C07110288
2023-08-16 04:08:08 +03:00
" 14a4:9100 " ,
2019-09-10 00:49:35 +03:00
]
# Seagate
PCI_IDS + = [
# ZP256CM30011
2023-08-16 04:08:08 +03:00
" 7089:5012 " ,
2019-09-10 00:49:35 +03:00
]
# Kingston
PCI_IDS + = [
# RBUSNS8154P3128GJ3
2023-08-16 04:08:08 +03:00
" 2646:5008 " ,
]
# Genesys Logic
PCI_IDS + = [
# SD Host Controller (brya)
" 17a0:9755 " ,
]
# Phison
PCI_IDS + = [
# E13 NVMe Controller (redrix)
' 1987:5013 ' ,
# E18 PCIe4 NVMe Controller (vell)
' 1987:5018 ' ,
2019-09-10 00:49:35 +03:00
]
2020-02-06 18:55:42 +03:00
# Do not edit below this line. #################################################
2019-09-10 00:49:35 +03:00
UDEV_RULE = """ \
ACTION != " add " , GOTO = " autosuspend_end "
SUBSYSTEM != " i2c|pci|usb " , GOTO = " autosuspend_end "
SUBSYSTEM == " i2c " , GOTO = " autosuspend_i2c "
SUBSYSTEM == " pci " , GOTO = " autosuspend_pci "
SUBSYSTEM == " usb " , GOTO = " autosuspend_usb "
# I2C rules
LABEL = " autosuspend_i2c "
ATTR { name } == " cyapa " , ATTR { power / control } = " on " , GOTO = " autosuspend_end "
GOTO = " autosuspend_end "
# PCI rules
LABEL = " autosuspend_pci "
% ( pci_rules ) s \
GOTO = " autosuspend_end "
# USB rules
LABEL = " autosuspend_usb "
% ( usb_rules ) s \
GOTO = " autosuspend_end "
# Enable autosuspend
LABEL = " autosuspend_enable "
TEST == " power/control " , ATTR { power / control } = " auto " , GOTO = " autosuspend_end "
LABEL = " autosuspend_end "
"""
def main ( ) :
2023-08-16 04:08:08 +03:00
pci_rules = " "
for dev_ids in PCI_IDS :
vendor , device = dev_ids . split ( " : " )
pci_rules + = (
' ATTR {vendor} == " 0x %s " , ATTR {device} == " 0x %s " , '
' GOTO= " autosuspend_enable " \n ' % ( vendor , device )
)
2019-09-10 00:49:35 +03:00
2023-08-16 04:08:08 +03:00
usb_rules = " "
for dev_ids in USB_IDS :
vid , pid = dev_ids . split ( " : " )
usb_rules + = (
' ATTR {idVendor} == " %s " , ATTR {idProduct} == " %s " , '
' GOTO= " autosuspend_enable " \n ' % ( vid , pid )
)
2019-09-10 00:49:35 +03:00
2023-08-16 04:08:08 +03:00
print ( UDEV_RULE % { " pci_rules " : pci_rules , " usb_rules " : usb_rules } )
2019-09-10 00:49:35 +03:00
2023-08-16 04:08:08 +03:00
if __name__ == " __main__ " :
main ( )