Linux Audio

Check our new training course

Loading...
v4.10.11
 
 1/*
 2 * Copyright (c) 2016 Maxime Ripard. 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 _CCU_NK_H_
15#define _CCU_NK_H_
16
17#include <linux/clk-provider.h>
18
19#include "ccu_common.h"
20#include "ccu_div.h"
21#include "ccu_mult.h"
22
23/*
24 * struct ccu_nk - Definition of an N-K clock
25 *
26 * Clocks based on the formula parent * N * K
27 */
28struct ccu_nk {
29	u16			reg;
30	u32			enable;
31	u32			lock;
32
33	struct ccu_mult_internal	n;
34	struct ccu_mult_internal	k;
35
36	unsigned int		fixed_post_div;
37
38	struct ccu_common	common;
39};
40
41#define SUNXI_CCU_NK_WITH_GATE_LOCK_POSTDIV(_struct, _name, _parent, _reg, \
42					    _nshift, _nwidth,		\
43					    _kshift, _kwidth,		\
44					    _gate, _lock, _postdiv,	\
45					    _flags)			\
46	struct ccu_nk _struct = {					\
47		.enable		= _gate,				\
48		.lock		= _lock,				\
49		.k		= _SUNXI_CCU_MULT(_kshift, _kwidth),	\
50		.n		= _SUNXI_CCU_MULT(_nshift, _nwidth),	\
51		.fixed_post_div	= _postdiv,				\
52		.common		= {					\
53			.reg		= _reg,				\
54			.features	= CCU_FEATURE_FIXED_POSTDIV,	\
55			.hw.init	= CLK_HW_INIT(_name,		\
56						      _parent,		\
57						      &ccu_nk_ops,	\
58						      _flags),		\
59		},							\
60	}
61
62static inline struct ccu_nk *hw_to_ccu_nk(struct clk_hw *hw)
63{
64	struct ccu_common *common = hw_to_ccu_common(hw);
65
66	return container_of(common, struct ccu_nk, common);
67}
68
69extern const struct clk_ops ccu_nk_ops;
70
71#endif /* _CCU_NK_H_ */
v6.8
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * Copyright (c) 2016 Maxime Ripard. All rights reserved.
 
 
 
 
 
 
 
 
 
 4 */
 5
 6#ifndef _CCU_NK_H_
 7#define _CCU_NK_H_
 8
 9#include <linux/clk-provider.h>
10
11#include "ccu_common.h"
12#include "ccu_div.h"
13#include "ccu_mult.h"
14
15/*
16 * struct ccu_nk - Definition of an N-K clock
17 *
18 * Clocks based on the formula parent * N * K
19 */
20struct ccu_nk {
21	u16			reg;
22	u32			enable;
23	u32			lock;
24
25	struct ccu_mult_internal	n;
26	struct ccu_mult_internal	k;
27
28	unsigned int		fixed_post_div;
29
30	struct ccu_common	common;
31};
32
33#define SUNXI_CCU_NK_WITH_GATE_LOCK_POSTDIV(_struct, _name, _parent, _reg, \
34					    _nshift, _nwidth,		\
35					    _kshift, _kwidth,		\
36					    _gate, _lock, _postdiv,	\
37					    _flags)			\
38	struct ccu_nk _struct = {					\
39		.enable		= _gate,				\
40		.lock		= _lock,				\
41		.k		= _SUNXI_CCU_MULT(_kshift, _kwidth),	\
42		.n		= _SUNXI_CCU_MULT(_nshift, _nwidth),	\
43		.fixed_post_div	= _postdiv,				\
44		.common		= {					\
45			.reg		= _reg,				\
46			.features	= CCU_FEATURE_FIXED_POSTDIV,	\
47			.hw.init	= CLK_HW_INIT(_name,		\
48						      _parent,		\
49						      &ccu_nk_ops,	\
50						      _flags),		\
51		},							\
52	}
53
54static inline struct ccu_nk *hw_to_ccu_nk(struct clk_hw *hw)
55{
56	struct ccu_common *common = hw_to_ccu_common(hw);
57
58	return container_of(common, struct ccu_nk, common);
59}
60
61extern const struct clk_ops ccu_nk_ops;
62
63#endif /* _CCU_NK_H_ */