Maxime Ripard | 89a3dfb | 2016-06-29 21:05:24 +0200 | [diff] [blame] | 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_FRAC_H_ |
| 15 | #define _CCU_FRAC_H_ |
| 16 | |
| 17 | #include <linux/clk-provider.h> |
| 18 | |
| 19 | #include "ccu_common.h" |
| 20 | |
Maxime Ripard | a501a14 | 2016-09-30 10:05:32 +0200 | [diff] [blame] | 21 | struct ccu_frac_internal { |
Maxime Ripard | 89a3dfb | 2016-06-29 21:05:24 +0200 | [diff] [blame] | 22 | u32 enable; |
| 23 | u32 select; |
| 24 | |
| 25 | unsigned long rates[2]; |
| 26 | }; |
| 27 | |
| 28 | #define _SUNXI_CCU_FRAC(_enable, _select, _rate1, _rate2) \ |
| 29 | { \ |
| 30 | .enable = _enable, \ |
| 31 | .select = _select, \ |
| 32 | .rates = { _rate1, _rate2 }, \ |
| 33 | } |
| 34 | |
| 35 | bool ccu_frac_helper_is_enabled(struct ccu_common *common, |
Maxime Ripard | a501a14 | 2016-09-30 10:05:32 +0200 | [diff] [blame] | 36 | struct ccu_frac_internal *cf); |
Maxime Ripard | 89a3dfb | 2016-06-29 21:05:24 +0200 | [diff] [blame] | 37 | void ccu_frac_helper_enable(struct ccu_common *common, |
Maxime Ripard | a501a14 | 2016-09-30 10:05:32 +0200 | [diff] [blame] | 38 | struct ccu_frac_internal *cf); |
Maxime Ripard | 89a3dfb | 2016-06-29 21:05:24 +0200 | [diff] [blame] | 39 | void ccu_frac_helper_disable(struct ccu_common *common, |
Maxime Ripard | a501a14 | 2016-09-30 10:05:32 +0200 | [diff] [blame] | 40 | struct ccu_frac_internal *cf); |
Maxime Ripard | 89a3dfb | 2016-06-29 21:05:24 +0200 | [diff] [blame] | 41 | |
| 42 | bool ccu_frac_helper_has_rate(struct ccu_common *common, |
Maxime Ripard | a501a14 | 2016-09-30 10:05:32 +0200 | [diff] [blame] | 43 | struct ccu_frac_internal *cf, |
Maxime Ripard | 89a3dfb | 2016-06-29 21:05:24 +0200 | [diff] [blame] | 44 | unsigned long rate); |
| 45 | |
| 46 | unsigned long ccu_frac_helper_read_rate(struct ccu_common *common, |
Maxime Ripard | a501a14 | 2016-09-30 10:05:32 +0200 | [diff] [blame] | 47 | struct ccu_frac_internal *cf); |
Maxime Ripard | 89a3dfb | 2016-06-29 21:05:24 +0200 | [diff] [blame] | 48 | |
| 49 | int ccu_frac_helper_set_rate(struct ccu_common *common, |
Maxime Ripard | a501a14 | 2016-09-30 10:05:32 +0200 | [diff] [blame] | 50 | struct ccu_frac_internal *cf, |
Maxime Ripard | 89a3dfb | 2016-06-29 21:05:24 +0200 | [diff] [blame] | 51 | unsigned long rate); |
| 52 | |
| 53 | #endif /* _CCU_FRAC_H_ */ |