summaryrefslogtreecommitdiff
path: root/include/linux/units.h
diff options
context:
space:
mode:
authorMaxime Ripard <mripard@kernel.org>2026-02-23 10:09:45 +0100
committerMaxime Ripard <mripard@kernel.org>2026-02-23 10:09:45 +0100
commitc17ee635fd3a482b2ad2bf5e269755c2eae5f25e (patch)
treee3f147462d8a9fd0cf2312c8cd3c5a94da15c3e4 /include/linux/units.h
parent803ec1faf7c1823e6e3b1f2aaa81be18528c9436 (diff)
parent6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f (diff)
Merge drm/drm-fixes into drm-misc-fixes
7.0-rc1 was just released, let's merge it to kick the new release cycle. Signed-off-by: Maxime Ripard <mripard@kernel.org>
Diffstat (limited to 'include/linux/units.h')
-rw-r--r--include/linux/units.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/units.h b/include/linux/units.h
index 00e15de33eca..80d57c50b9e3 100644
--- a/include/linux/units.h
+++ b/include/linux/units.h
@@ -21,13 +21,35 @@
#define PICO 1000000000000ULL
#define FEMTO 1000000000000000ULL
+/*
+ * Percentage and related scaling units
+ *
+ * These macros define scaling factors used to convert between ratio and
+ * percentage-based representations with different decimal resolutions.
+ * They are used for precise fractional calculations in engineering, finance,
+ * and measurement applications.
+ *
+ * Examples:
+ * 1% = 0.01 = 1 / PERCENT
+ * 0.1% = 0.001 = 1 / PERMILLE
+ * 0.01% = 0.0001 = 1 / PERMYRIAD (1 basis point)
+ * 0.001% = 0.00001 = 1 / PERCENTMILLE
+ */
+#define PERCENT 100
+#define PERMILLE 1000
+#define PERMYRIAD 10000
+#define PERCENTMILLE 100000
+
#define NANOHZ_PER_HZ 1000000000UL
#define MICROHZ_PER_HZ 1000000UL
#define MILLIHZ_PER_HZ 1000UL
+/* Hz based multipliers */
#define HZ_PER_KHZ 1000UL
#define HZ_PER_MHZ 1000000UL
+#define HZ_PER_GHZ 1000000000UL
+/* kHz based multipliers */
#define KHZ_PER_MHZ 1000UL
#define KHZ_PER_GHZ 1000000UL