Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* 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 Wagantall | 33d01f5 | 2012-02-23 23:27:44 -0800 | [diff] [blame] | 17 | #include <mach/clk-provider.h> |
| 18 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 19 | struct clk_ops; |
| 20 | extern struct clk_ops clk_ops_voter; |
| 21 | |
| 22 | struct clk_voter { |
| 23 | bool enabled; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 24 | struct clk *parent; |
| 25 | struct clk c; |
| 26 | }; |
| 27 | |
| 28 | static inline struct clk_voter *to_clk_voter(struct clk *clk) |
| 29 | { |
| 30 | return container_of(clk, struct clk_voter, c); |
| 31 | } |
| 32 | |
Matt Wagantall | 35e78fc | 2012-04-05 14:18:44 -0700 | [diff] [blame] | 33 | #define DEFINE_CLK_VOTER(clk_name, _parent, _default_rate) \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 34 | struct clk_voter clk_name = { \ |
| 35 | .parent = _parent, \ |
| 36 | .c = { \ |
| 37 | .dbg_name = #clk_name, \ |
| 38 | .ops = &clk_ops_voter, \ |
Matt Wagantall | 35e78fc | 2012-04-05 14:18:44 -0700 | [diff] [blame] | 39 | .rate = _default_rate, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 40 | CLK_INIT(clk_name.c), \ |
| 41 | }, \ |
| 42 | } |
| 43 | |
| 44 | #endif |