blob: 11e25c992948fdcc7ea00c5cfa31f0274e6dfb53 [file] [log] [blame]
James Liao9741b1a2015-04-23 10:35:39 +02001/*
2 * Copyright (c) 2014 MediaTek Inc.
3 * Author: James Liao <jamesjj.liao@mediatek.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __DRV_CLK_GATE_H
16#define __DRV_CLK_GATE_H
17
18#include <linux/regmap.h>
James Liao9741b1a2015-04-23 10:35:39 +020019#include <linux/clk-provider.h>
20
Stephen Boydc7266392015-06-19 15:00:46 -070021struct clk;
22
James Liao9741b1a2015-04-23 10:35:39 +020023struct mtk_clk_gate {
24 struct clk_hw hw;
25 struct regmap *regmap;
26 int set_ofs;
27 int clr_ofs;
28 int sta_ofs;
29 u8 bit;
30};
31
32static inline struct mtk_clk_gate *to_clk_gate(struct clk_hw *hw)
33{
34 return container_of(hw, struct mtk_clk_gate, hw);
35}
36
37extern const struct clk_ops mtk_clk_gate_ops_setclr;
38extern const struct clk_ops mtk_clk_gate_ops_setclr_inv;
39
40struct clk *mtk_clk_register_gate(
41 const char *name,
42 const char *parent_name,
43 struct regmap *regmap,
44 int set_ofs,
45 int clr_ofs,
46 int sta_ofs,
47 u8 bit,
48 const struct clk_ops *ops);
49
50#endif /* __DRV_CLK_GATE_H */