blob: 4db20f8ec571a6fa97c91431c1c9334ef7a4fcf5 [file] [log] [blame]
Gabriel Fernandez8aac3072020-10-13 09:36:25 +02001/*
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
12struct clk_ops {
13 int (*enable)(unsigned long id);
14 void (*disable)(unsigned long id);
15 unsigned long (*get_rate)(unsigned long id);
Ghennadi Procopciuca55326b2024-06-01 00:04:31 +030016 int (*set_rate)(unsigned long id, unsigned long rate,
17 unsigned long *orate);
Gabriel Fernandez8aac3072020-10-13 09:36:25 +020018 int (*get_parent)(unsigned long id);
Ghennadi Procopciuc52f8b012024-06-03 09:16:41 +030019 int (*set_parent)(unsigned long id, unsigned long parent_id);
Gabriel Fernandez8aac3072020-10-13 09:36:25 +020020 bool (*is_enabled)(unsigned long id);
21};
22
23int clk_enable(unsigned long id);
24void clk_disable(unsigned long id);
25unsigned long clk_get_rate(unsigned long id);
Ghennadi Procopciuca55326b2024-06-01 00:04:31 +030026int clk_set_rate(unsigned long id, unsigned long rate, unsigned long *orate);
Gabriel Fernandez8aac3072020-10-13 09:36:25 +020027bool clk_is_enabled(unsigned long id);
28int clk_get_parent(unsigned long id);
Ghennadi Procopciuc52f8b012024-06-03 09:16:41 +030029int clk_set_parent(unsigned long id, unsigned long parent_id);
Gabriel Fernandez8aac3072020-10-13 09:36:25 +020030
31void clk_register(const struct clk_ops *ops);
32
33#endif /* CLK_H */