blob: 7fdc4d30497045d4533b9edd1acd9bddeeb09f60 [file] [log] [blame]
Pratik Patel74929432011-12-26 12:03:41 -08001/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <linux/kernel.h>
14#include <linux/module.h>
15#include <linux/init.h>
16#include <linux/types.h>
17#include <linux/device.h>
18#include <linux/platform_device.h>
19#include <linux/io.h>
20#include <linux/err.h>
21#include <mach/rpm.h>
22
23#include "rpm_resources.h"
24#include "qdss.h"
25
26enum {
27 QDSS_CLK_OFF,
28 QDSS_CLK_ON_DBG,
29 QDSS_CLK_ON_HSDBG,
30};
31
32
33int qdss_clk_enable(void)
34{
35 int ret;
36
37 struct msm_rpm_iv_pair iv;
38 iv.id = MSM_RPM_ID_QDSS_CLK;
39 iv.value = QDSS_CLK_ON_DBG;
40 ret = msm_rpmrs_set(MSM_RPM_CTX_SET_0, &iv, 1);
41 if (WARN(ret, "qdss clks not enabled (%d)\n", ret))
42 goto err_clk;
43
44 return 0;
45
46err_clk:
47 return ret;
48}
49
50void qdss_clk_disable(void)
51{
52 int ret;
53 struct msm_rpm_iv_pair iv;
54
55 iv.id = MSM_RPM_ID_QDSS_CLK;
56 iv.value = QDSS_CLK_OFF;
57 ret = msm_rpmrs_set(MSM_RPM_CTX_SET_0, &iv, 1);
58 WARN(ret, "qdss clks not disabled (%d)\n", ret);
59}