0001
0002
0003
0004
0005
0006 #ifndef _CCU_SDM_H
0007 #define _CCU_SDM_H
0008
0009 #include <linux/clk-provider.h>
0010
0011 #include "ccu_common.h"
0012
0013 struct ccu_sdm_setting {
0014 unsigned long rate;
0015
0016
0017
0018
0019
0020
0021 u32 pattern;
0022
0023
0024
0025
0026
0027 u32 m;
0028 u32 n;
0029 };
0030
0031 struct ccu_sdm_internal {
0032 struct ccu_sdm_setting *table;
0033 u32 table_size;
0034
0035 u32 enable;
0036
0037 u32 tuning_enable;
0038 u16 tuning_reg;
0039 };
0040
0041 #define _SUNXI_CCU_SDM(_table, _enable, \
0042 _reg, _reg_enable) \
0043 { \
0044 .table = _table, \
0045 .table_size = ARRAY_SIZE(_table), \
0046 .enable = _enable, \
0047 .tuning_enable = _reg_enable, \
0048 .tuning_reg = _reg, \
0049 }
0050
0051 bool ccu_sdm_helper_is_enabled(struct ccu_common *common,
0052 struct ccu_sdm_internal *sdm);
0053 void ccu_sdm_helper_enable(struct ccu_common *common,
0054 struct ccu_sdm_internal *sdm,
0055 unsigned long rate);
0056 void ccu_sdm_helper_disable(struct ccu_common *common,
0057 struct ccu_sdm_internal *sdm);
0058
0059 bool ccu_sdm_helper_has_rate(struct ccu_common *common,
0060 struct ccu_sdm_internal *sdm,
0061 unsigned long rate);
0062
0063 unsigned long ccu_sdm_helper_read_rate(struct ccu_common *common,
0064 struct ccu_sdm_internal *sdm,
0065 u32 m, u32 n);
0066
0067 int ccu_sdm_helper_get_factors(struct ccu_common *common,
0068 struct ccu_sdm_internal *sdm,
0069 unsigned long rate,
0070 unsigned long *m, unsigned long *n);
0071
0072 #endif