xref: /openbmc/linux/drivers/clk/qcom/clk-regmap.h (revision 9cfc5c90)
1 /*
2  * Copyright (c) 2014, The Linux Foundation. All rights reserved.
3  *
4  * This software is licensed under the terms of the GNU General Public
5  * License version 2, as published by the Free Software Foundation, and
6  * may be copied, distributed, and modified under those terms.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  */
13 
14 #ifndef __QCOM_CLK_REGMAP_H__
15 #define __QCOM_CLK_REGMAP_H__
16 
17 #include <linux/clk-provider.h>
18 
19 struct regmap;
20 
21 /**
22  * struct clk_regmap - regmap supporting clock
23  * @hw:		handle between common and hardware-specific interfaces
24  * @regmap:	regmap to use for regmap helpers and/or by providers
25  * @enable_reg: register when using regmap enable/disable ops
26  * @enable_mask: mask when using regmap enable/disable ops
27  * @enable_is_inverted: flag to indicate set enable_mask bits to disable
28  *                      when using clock_enable_regmap and friends APIs.
29  */
30 struct clk_regmap {
31 	struct clk_hw hw;
32 	struct regmap *regmap;
33 	unsigned int enable_reg;
34 	unsigned int enable_mask;
35 	bool enable_is_inverted;
36 };
37 #define to_clk_regmap(_hw) container_of(_hw, struct clk_regmap, hw)
38 
39 int clk_is_enabled_regmap(struct clk_hw *hw);
40 int clk_enable_regmap(struct clk_hw *hw);
41 void clk_disable_regmap(struct clk_hw *hw);
42 struct clk *
43 devm_clk_register_regmap(struct device *dev, struct clk_regmap *rclk);
44 
45 #endif
46