# SPDX-License-Identifier: MIT
 
 """
-Device Tree Alias Functions
+Functions to find aliases for all hardware,
+including those defined in the device tree.
 """
 
 from typing import Optional
                 if match:
                     return match.group(1).upper()
     return None
+
+
+def get_pwm_chipid(device: str):
+    """Get the PWM Chip ID"""
+    for chipid in range(32):
+        pwm_sys_path = "/sys/class/pwm/pwmchip{}".format(chipid)
+        if not os.path.exists(pwm_sys_path):
+            continue
+        if device in os.path.realpath(pwm_sys_path):
+            alias = "PWM" + str(chipid)
+            return alias
+    return None