mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-06 05:06:29 +00:00
06462d6f3f
Replace 'int' with proper 'enum lpass_codec_version' in every place which handles the parsed codec version (not raw register values!) to be explicit about contents of the variable. This makes code easier to read and compilers could check missing switch cases. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://patch.msgid.link/20240625165736.722106-2-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
66 lines
1.5 KiB
C
66 lines
1.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (c) 2022, The Linux Foundation. All rights reserved.
|
|
*/
|
|
|
|
#ifndef __LPASS_MACRO_COMMON_H__
|
|
#define __LPASS_MACRO_COMMON_H__
|
|
|
|
/* NPL clock is expected */
|
|
#define LPASS_MACRO_FLAG_HAS_NPL_CLOCK BIT(0)
|
|
/* The soundwire block should be internally reset at probe */
|
|
#define LPASS_MACRO_FLAG_RESET_SWR BIT(1)
|
|
|
|
enum lpass_version {
|
|
LPASS_VER_9_0_0,
|
|
LPASS_VER_9_2_0,
|
|
LPASS_VER_10_0_0,
|
|
LPASS_VER_11_0_0,
|
|
};
|
|
|
|
enum lpass_codec_version {
|
|
LPASS_CODEC_VERSION_UNKNOWN,
|
|
LPASS_CODEC_VERSION_1_0,
|
|
LPASS_CODEC_VERSION_1_1,
|
|
LPASS_CODEC_VERSION_1_2,
|
|
LPASS_CODEC_VERSION_2_0,
|
|
LPASS_CODEC_VERSION_2_1,
|
|
LPASS_CODEC_VERSION_2_5,
|
|
LPASS_CODEC_VERSION_2_6,
|
|
LPASS_CODEC_VERSION_2_7,
|
|
LPASS_CODEC_VERSION_2_8,
|
|
};
|
|
|
|
struct lpass_macro {
|
|
struct device *macro_pd;
|
|
struct device *dcodec_pd;
|
|
};
|
|
|
|
struct lpass_macro *lpass_macro_pds_init(struct device *dev);
|
|
void lpass_macro_pds_exit(struct lpass_macro *pds);
|
|
void lpass_macro_set_codec_version(enum lpass_codec_version version);
|
|
enum lpass_codec_version lpass_macro_get_codec_version(void);
|
|
|
|
static inline const char *lpass_macro_get_codec_version_string(int version)
|
|
{
|
|
switch (version) {
|
|
case LPASS_CODEC_VERSION_2_0:
|
|
return "v2.0";
|
|
case LPASS_CODEC_VERSION_2_1:
|
|
return "v2.1";
|
|
case LPASS_CODEC_VERSION_2_5:
|
|
return "v2.5";
|
|
case LPASS_CODEC_VERSION_2_6:
|
|
return "v2.6";
|
|
case LPASS_CODEC_VERSION_2_7:
|
|
return "v2.7";
|
|
case LPASS_CODEC_VERSION_2_8:
|
|
return "v2.8";
|
|
default:
|
|
break;
|
|
}
|
|
return "NA";
|
|
}
|
|
|
|
#endif /* __LPASS_MACRO_COMMON_H__ */
|