Gabriel Fernandez | 8aac307 | 2020-10-13 09:36:25 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021, STMicroelectronics - All Rights Reserved |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef CLK_H |
| 8 | #define CLK_H |
| 9 | |
| 10 | #include <stdbool.h> |
| 11 | |
| 12 | struct clk_ops { |
| 13 | int (*enable)(unsigned long id); |
| 14 | void (*disable)(unsigned long id); |
| 15 | unsigned long (*get_rate)(unsigned long id); |
Ghennadi Procopciuc | a55326b | 2024-06-01 00:04:31 +0300 | [diff] [blame] | 16 | int (*set_rate)(unsigned long id, unsigned long rate, |
| 17 | unsigned long *orate); |
Gabriel Fernandez | 8aac307 | 2020-10-13 09:36:25 +0200 | [diff] [blame] | 18 | int (*get_parent)(unsigned long id); |
Ghennadi Procopciuc | 52f8b01 | 2024-06-03 09:16:41 +0300 | [diff] [blame] | 19 | int (*set_parent)(unsigned long id, unsigned long parent_id); |
Gabriel Fernandez | 8aac307 | 2020-10-13 09:36:25 +0200 | [diff] [blame] | 20 | bool (*is_enabled)(unsigned long id); |
| 21 | }; |
| 22 | |
| 23 | int clk_enable(unsigned long id); |
| 24 | void clk_disable(unsigned long id); |
| 25 | unsigned long clk_get_rate(unsigned long id); |
Ghennadi Procopciuc | a55326b | 2024-06-01 00:04:31 +0300 | [diff] [blame] | 26 | int clk_set_rate(unsigned long id, unsigned long rate, unsigned long *orate); |
Gabriel Fernandez | 8aac307 | 2020-10-13 09:36:25 +0200 | [diff] [blame] | 27 | bool clk_is_enabled(unsigned long id); |
| 28 | int clk_get_parent(unsigned long id); |
Ghennadi Procopciuc | 52f8b01 | 2024-06-03 09:16:41 +0300 | [diff] [blame] | 29 | int clk_set_parent(unsigned long id, unsigned long parent_id); |
Gabriel Fernandez | 8aac307 | 2020-10-13 09:36:25 +0200 | [diff] [blame] | 30 | |
| 31 | void clk_register(const struct clk_ops *ops); |
| 32 | |
| 33 | #endif /* CLK_H */ |