| /* Copyright (c) 2010-2011, 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 |
| * only version 2 as published by the Free Software Foundation. |
| * |
| * This program is distributed in the hope that it will be useful, |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| * GNU General Public License for more details. |
| * |
| */ |
| |
| #ifndef __ARCH_ARM_MACH_MSM_CLOCK_RPM_H |
| #define __ARCH_ARM_MACH_MSM_CLOCK_RPM_H |
| |
| #include <mach/rpm.h> |
| |
| struct clk_ops; |
| extern struct clk_ops clk_ops_rpm; |
| |
| struct rpm_clk { |
| const int rpm_clk_id; |
| const int rpm_status_id; |
| const bool active_only; |
| unsigned last_set_khz; |
| /* 0 if active_only. Otherwise, same as last_set_khz. */ |
| unsigned last_set_sleep_khz; |
| bool enabled; |
| |
| struct rpm_clk *peer; |
| struct clk c; |
| }; |
| |
| static inline struct rpm_clk *to_rpm_clk(struct clk *clk) |
| { |
| return container_of(clk, struct rpm_clk, c); |
| } |
| |
| #define DEFINE_CLK_RPM(name, active, r_id, dep) \ |
| static struct rpm_clk active; \ |
| static struct rpm_clk name = { \ |
| .rpm_clk_id = MSM_RPM_ID_##r_id##_CLK, \ |
| .rpm_status_id = MSM_RPM_STATUS_ID_##r_id##_CLK, \ |
| .peer = &active, \ |
| .c = { \ |
| .ops = &clk_ops_rpm, \ |
| .flags = CLKFLAG_SKIP_AUTO_OFF | CLKFLAG_MIN, \ |
| .dbg_name = #name, \ |
| CLK_INIT(name.c), \ |
| .depends = dep, \ |
| }, \ |
| }; \ |
| static struct rpm_clk active = { \ |
| .rpm_clk_id = MSM_RPM_ID_##r_id##_CLK, \ |
| .rpm_status_id = MSM_RPM_STATUS_ID_##r_id##_CLK, \ |
| .peer = &name, \ |
| .active_only = true, \ |
| .c = { \ |
| .ops = &clk_ops_rpm, \ |
| .flags = CLKFLAG_SKIP_AUTO_OFF | CLKFLAG_MIN, \ |
| .dbg_name = #active, \ |
| CLK_INIT(active.c), \ |
| .depends = dep, \ |
| }, \ |
| }; |
| |
| #endif |