blob: e7a31c551e33a7c8285c00aec24feb4c4c29aedd [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From c8055614385c90accdea4e7a046c5560bccc84cf Mon Sep 17 00:00:00 2001
2From: Leonard Crestez <leonard.crestez@nxp.com>
3Date: Mon, 13 May 2019 15:06:37 +0300
4Subject: [PATCH] imx busfreq: Add API header file
5
6Add sufficient enough definitions so that drivers which call
7request_bus_freq and release_bus_freq can compile even if
8CONFIG_HAVE_IMX_BUSFREQ is missing.
9
10Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
11---
12 include/linux/busfreq-imx.h | 77 +++++++++++++++++++++++++++++++++++++++++++++
13 1 file changed, 77 insertions(+)
14 create mode 100644 include/linux/busfreq-imx.h
15
16--- /dev/null
17+++ b/include/linux/busfreq-imx.h
18@@ -0,0 +1,77 @@
19+/*
20+ * Copyright 2012-2016 Freescale Semiconductor, Inc. All Rights Reserved.
21+ *
22+ * This program is free software; you can redistribute it and/or modify
23+ * it under the terms of the GNU General Public License version 2 as
24+ * published by the Free Software Foundation.
25+ */
26+
27+#ifndef __ASM_ARCH_MXC_BUSFREQ_H__
28+#define __ASM_ARCH_MXC_BUSFREQ_H__
29+
30+#include <linux/notifier.h>
31+#include <linux/regulator/consumer.h>
32+
33+/*
34+ * This enumerates busfreq low power mode entry and exit.
35+ */
36+enum busfreq_event {
37+ LOW_BUSFREQ_ENTER,
38+ LOW_BUSFREQ_EXIT,
39+};
40+
41+/*
42+ * This enumerates the system bus and ddr frequencies in various modes.
43+ * BUS_FREQ_HIGH - DDR @ 528MHz, AHB @ 132MHz.
44+ * BUS_FREQ_MED - DDR @ 400MHz, AHB @ 132MHz
45+ * BUS_FREQ_AUDIO - DDR @ 50MHz/100MHz, AHB @ 24MHz.
46+ * BUS_FREQ_LOW - DDR @ 24MHz, AHB @ 24MHz.
47+ * BUS_FREQ_ULTRA_LOW - DDR @ 1MHz, AHB - 3MHz.
48+ *
49+ * Drivers need to request/release the bus/ddr frequencies based on
50+ * their performance requirements. Drivers cannot request/release
51+ * BUS_FREQ_ULTRA_LOW mode as this mode is automatically entered from
52+ * either BUS_FREQ_AUDIO or BUS_FREQ_LOW
53+ * modes.
54+ */
55+enum bus_freq_mode {
56+ BUS_FREQ_HIGH,
57+ BUS_FREQ_MED,
58+ BUS_FREQ_AUDIO,
59+ BUS_FREQ_LOW,
60+ BUS_FREQ_ULTRA_LOW,
61+};
62+
63+#if defined(CONFIG_HAVE_IMX_BUSFREQ) && !defined(CONFIG_ARM64)
64+extern struct regulator *arm_reg;
65+extern struct regulator *soc_reg;
66+void request_bus_freq(enum bus_freq_mode mode);
67+void release_bus_freq(enum bus_freq_mode mode);
68+int register_busfreq_notifier(struct notifier_block *nb);
69+int unregister_busfreq_notifier(struct notifier_block *nb);
70+int get_bus_freq_mode(void);
71+#elif defined(CONFIG_HAVE_IMX_BUSFREQ)
72+void request_bus_freq(enum bus_freq_mode mode);
73+void release_bus_freq(enum bus_freq_mode mode);
74+int get_bus_freq_mode(void);
75+#else
76+static inline void request_bus_freq(enum bus_freq_mode mode)
77+{
78+}
79+static inline void release_bus_freq(enum bus_freq_mode mode)
80+{
81+}
82+static inline int register_busfreq_notifier(struct notifier_block *nb)
83+{
84+ return 0;
85+}
86+static inline int unregister_busfreq_notifier(struct notifier_block *nb)
87+{
88+ return 0;
89+}
90+static inline int get_bus_freq_mode(void)
91+{
92+ return BUS_FREQ_HIGH;
93+}
94+#endif
95+#endif