diff options
author | Bai Ping <b51503@freescale.com> | 2014-12-26 21:37:31 +0800 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2015-01-15 21:18:56 -0600 |
commit | 884d14e58542125ba5f7568500e646be8ac46cc7 (patch) | |
tree | 69f35758a1f7cc0ce8ec45730b1197c5cb2b025c /arch/arm/mach-imx | |
parent | 61674e5ad59df590f8e858b8516477f8edd9ddf4 (diff) |
MLK-10018-01 arm: imx: Implement busfreq notifier calls for busfreq
Implement busfreq notifier calls used when busfreq entering low_bus_freq_mode.
When the system lower the bus frequency, some modules can be affected by bus
frequency change. Adding notifier call chains that allow driver affected by bus
frequency can be notified before and after low_bus_freq_mode.
Signed-off-by: Bai Ping <b51503@freescale.com>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r-- | arch/arm/mach-imx/busfreq-imx6.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/busfreq-imx6.c b/arch/arm/mach-imx/busfreq-imx6.c index e5bbc7aca0ef..0d74b9671d47 100644 --- a/arch/arm/mach-imx/busfreq-imx6.c +++ b/arch/arm/mach-imx/busfreq-imx6.c @@ -122,6 +122,29 @@ static u32 pll2_org_rate; static struct delayed_work low_bus_freq_handler; static struct delayed_work bus_freq_daemon; +static RAW_NOTIFIER_HEAD(busfreq_notifier_chain); + +static int busfreq_notify(enum busfreq_event event) +{ + int ret; + + ret = raw_notifier_call_chain(&busfreq_notifier_chain, event, NULL); + + return notifier_to_errno(ret); +} + +int register_busfreq_notifier(struct notifier_block *nb) +{ + return raw_notifier_chain_register(&busfreq_notifier_chain, nb); +} +EXPORT_SYMBOL(register_busfreq_notifier); + +int unregister_busfreq_notifier(struct notifier_block *nb) +{ + return raw_notifier_chain_unregister(&busfreq_notifier_chain, nb); +} +EXPORT_SYMBOL(unregister_busfreq_notifier); + static bool check_m4_sleep(void) { unsigned long timeout = jiffies + msecs_to_jiffies(500); @@ -398,6 +421,10 @@ static void exit_lpm_imx6sl(void) static void reduce_bus_freq(void) { clk_prepare_enable(pll3); + if (audio_bus_count && (low_bus_freq_mode || ultra_low_bus_freq_mode)) + busfreq_notify(LOW_BUSFREQ_EXIT); + else if (!audio_bus_count) + busfreq_notify(LOW_BUSFREQ_ENTER); if (cpu_is_imx6sl()) enter_lpm_imx6sl(); else if (cpu_is_imx6sx()) @@ -513,6 +540,9 @@ static int set_high_bus_freq(int high_bus_freq) if (med_bus_freq_mode && !high_bus_freq) return 0; + if (low_bus_freq_mode || ultra_low_bus_freq_mode) + busfreq_notify(LOW_BUSFREQ_EXIT); + clk_prepare_enable(pll3); if (cpu_is_imx6sl()) exit_lpm_imx6sl(); |