hc
2024-05-10 ee930fffee469d076998274a2ca55e13dc1efb67
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
/*
 * Copyright (c) 2023, Rockchip Electronics Co., Ltd
 */
 
#ifndef __SOC_ROCKCHIP_CSU_H
#define __SOC_ROCKCHIP_CSU_H
 
#include <dt-bindings/soc/rockchip-csu.h>
 
#define CSU_MAX_DIV        8
#define CSU_DIV_MASK        0x7
#define CSU_EN_MASK        0xefff
 
struct csu_clk;
 
#if IS_REACHABLE(CONFIG_ROCKCHIP_CSU)
struct csu_clk *rockchip_csu_get(struct device *dev, const char *name);
int rockchip_csu_enable(struct csu_clk *clk);
int rockchip_csu_disable(struct csu_clk *clk);
int rockchip_csu_set_div(struct csu_clk *clk, unsigned int div);
#else
static inline struct csu_clk *
rockchip_csu_get(struct device *dev, const char *name)
{
   return ERR_PTR(-EOPNOTSUPP);
}
 
static inline int rockchip_csu_enable(struct csu_clk *clk)
{
   return -EOPNOTSUPP;
}
 
static inline int rockchip_csu_disable(struct csu_clk *clk)
{
   return -EOPNOTSUPP;
}
 
static inline int
rockchip_csu_set_div(struct csu_clk *clk, unsigned int div)
{
   return -EOPNOTSUPP;
}
#endif
 
#endif