1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (c) 2022, The Linux Foundation. All rights reserved. 4 */ 5 6 #ifndef __LPASS_MACRO_COMMON_H__ 7 #define __LPASS_MACRO_COMMON_H__ 8 9 /* NPL clock is expected */ 10 #define LPASS_MACRO_FLAG_HAS_NPL_CLOCK BIT(0) 11 /* The soundwire block should be internally reset at probe */ 12 #define LPASS_MACRO_FLAG_RESET_SWR BIT(1) 13 14 enum lpass_version { 15 LPASS_VER_9_0_0, 16 LPASS_VER_9_2_0, 17 LPASS_VER_10_0_0, 18 LPASS_VER_11_0_0, 19 }; 20 21 enum lpass_codec_version { 22 LPASS_CODEC_VERSION_UNKNOWN, 23 LPASS_CODEC_VERSION_1_0, 24 LPASS_CODEC_VERSION_1_1, 25 LPASS_CODEC_VERSION_1_2, 26 LPASS_CODEC_VERSION_2_0, 27 LPASS_CODEC_VERSION_2_1, 28 LPASS_CODEC_VERSION_2_5, 29 LPASS_CODEC_VERSION_2_6, 30 LPASS_CODEC_VERSION_2_7, 31 LPASS_CODEC_VERSION_2_8, 32 }; 33 34 struct lpass_macro { 35 struct device *macro_pd; 36 struct device *dcodec_pd; 37 }; 38 39 struct lpass_macro *lpass_macro_pds_init(struct device *dev); 40 void lpass_macro_pds_exit(struct lpass_macro *pds); 41 void lpass_macro_set_codec_version(enum lpass_codec_version version); 42 enum lpass_codec_version lpass_macro_get_codec_version(void); 43 44 static inline void lpass_macro_pds_exit_action(void *pds) 45 { 46 lpass_macro_pds_exit(pds); 47 } 48 49 static inline const char *lpass_macro_get_codec_version_string(int version) 50 { 51 switch (version) { 52 case LPASS_CODEC_VERSION_2_0: 53 return "v2.0"; 54 case LPASS_CODEC_VERSION_2_1: 55 return "v2.1"; 56 case LPASS_CODEC_VERSION_2_5: 57 return "v2.5"; 58 case LPASS_CODEC_VERSION_2_6: 59 return "v2.6"; 60 case LPASS_CODEC_VERSION_2_7: 61 return "v2.7"; 62 case LPASS_CODEC_VERSION_2_8: 63 return "v2.8"; 64 default: 65 break; 66 } 67 return "NA"; 68 } 69 70 #endif /* __LPASS_MACRO_COMMON_H__ */ 71