blob: 82c071b770c359ebd8ee29b3ced63761a8c8c1be [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
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 *parent;
25 struct clk c;
26};
27
28static inline struct clk_voter *to_clk_voter(struct clk *clk)
29{
30 return container_of(clk, struct clk_voter, c);
31}
32
Matt Wagantall35e78fc2012-04-05 14:18:44 -070033#define DEFINE_CLK_VOTER(clk_name, _parent, _default_rate) \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070034 struct clk_voter clk_name = { \
35 .parent = _parent, \
36 .c = { \
37 .dbg_name = #clk_name, \
38 .ops = &clk_ops_voter, \
Matt Wagantall35e78fc2012-04-05 14:18:44 -070039 .rate = _default_rate, \
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070040 CLK_INIT(clk_name.c), \
41 }, \
42 }
43
44#endif