blob: c74395900a1b9a0ec385e4d24e20ba2b80f5f407 [file] [log] [blame]
Duy Truong790f06d2013-02-13 16:38:12 -08001/* Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
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
Matt Wagantall33d01f52012-02-23 23:27:44 -080017#include <mach/clk-provider.h>
18
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070019struct clk_ops;
20extern struct clk_ops clk_ops_voter;
21
22struct clk_voter {
23 bool enabled;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070024 struct clk c;
25};
26
27static inline struct clk_voter *to_clk_voter(struct clk *clk)
28{
29 return container_of(clk, struct clk_voter, c);
30}
31
Matt Wagantall35e78fc2012-04-05 14:18:44 -070032#define DEFINE_CLK_VOTER(clk_name, _parent, _default_rate) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070033 struct clk_voter clk_name = { \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070034 .c = { \
Saravana Kannan7a6532e2012-10-18 20:51:13 -070035 .parent = _parent, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070036 .dbg_name = #clk_name, \
37 .ops = &clk_ops_voter, \
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