msm: acpuclock: Support tracing of CPU frequency changes

Utilize the cpu_frequency traces to profile CPU frequency switching.

Change-Id: I5f7b5ea9ab0bd70deb3d64c9361c4b56ab63466d
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
(cherry picked from commit 7c57b5dfc88a77a7d0c1d7820cf0baa3c37210fc)
(cherry picked from commit e759493b08da1c1d39e68849b6092b3dac3928aa)
diff --git a/arch/arm/mach-msm/acpuclock.c b/arch/arm/mach-msm/acpuclock.c
index be056e6..2b33c4c 100644
--- a/arch/arm/mach-msm/acpuclock.c
+++ b/arch/arm/mach-msm/acpuclock.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -13,6 +13,7 @@
 #include <linux/cpu.h>
 #include <linux/smp.h>
 #include "acpuclock.h"
+#include <trace/events/power.h>
 
 static struct acpuclk_data *acpuclk_data;
 
@@ -26,10 +27,19 @@
 
 int acpuclk_set_rate(int cpu, unsigned long rate, enum setrate_reason reason)
 {
+	int ret;
+
 	if (!acpuclk_data->set_rate)
 		return 0;
 
-	return acpuclk_data->set_rate(cpu, rate, reason);
+	trace_cpu_frequency_switch_start(acpuclk_get_rate(cpu), rate, cpu);
+	ret = acpuclk_data->set_rate(cpu, rate, reason);
+	if (!ret) {
+		trace_cpu_frequency_switch_end(cpu);
+		trace_cpu_frequency(rate, cpu);
+	}
+
+	return ret;
 }
 
 uint32_t acpuclk_get_switch_time(void)