blob: c9aebbab2dc42324a60c147978b4da79e976fafa [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2010-2011, 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
14#ifndef __ARCH_ARM_MACH_MSM_CLOCK_VOTER_H
15#define __ARCH_ARM_MACH_MSM_CLOCK_VOTER_H
16
17struct clk_ops;
18extern struct clk_ops clk_ops_voter;
19
20struct clk_voter {
21 bool enabled;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070022 struct clk *parent;
23 struct clk c;
24};
25
26static inline struct clk_voter *to_clk_voter(struct clk *clk)
27{
28 return container_of(clk, struct clk_voter, c);
29}
30
Matt Wagantall35e78fc2012-04-05 14:18:44 -070031#define DEFINE_CLK_VOTER(clk_name, _parent, _default_rate) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070032 struct clk_voter clk_name = { \
33 .parent = _parent, \
34 .c = { \
35 .dbg_name = #clk_name, \
36 .ops = &clk_ops_voter, \
37 .flags = CLKFLAG_SKIP_AUTO_OFF, \
Matt Wagantall35e78fc2012-04-05 14:18:44 -070038 .rate = _default_rate, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070039 CLK_INIT(clk_name.c), \
40 }, \
41 }
42
43#endif