Commit 06462d6f authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Mark Brown

ASoC: codecs: lpass-macro: Use enum for handling codec version

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: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patch.msgid.link/20240625165736.722106-2-krzysztof.kozlowski@linaro.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent ebc1a540
......@@ -12,7 +12,7 @@
#include "lpass-macro-common.h"
static DEFINE_MUTEX(lpass_codec_mutex);
static int lpass_codec_version;
static enum lpass_codec_version lpass_codec_version;
struct lpass_macro *lpass_macro_pds_init(struct device *dev)
{
......@@ -69,7 +69,7 @@ void lpass_macro_pds_exit(struct lpass_macro *pds)
}
EXPORT_SYMBOL_GPL(lpass_macro_pds_exit);
void lpass_macro_set_codec_version(int version)
void lpass_macro_set_codec_version(enum lpass_codec_version version)
{
mutex_lock(&lpass_codec_mutex);
lpass_codec_version = version;
......@@ -77,9 +77,9 @@ void lpass_macro_set_codec_version(int version)
}
EXPORT_SYMBOL_GPL(lpass_macro_set_codec_version);
int lpass_macro_get_codec_version(void)
enum lpass_codec_version lpass_macro_get_codec_version(void)
{
int ver;
enum lpass_codec_version ver;
mutex_lock(&lpass_codec_mutex);
ver = lpass_codec_version;
......
......@@ -38,8 +38,8 @@ struct lpass_macro {
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(int version);
int lpass_macro_get_codec_version(void);
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)
{
......
......@@ -642,7 +642,7 @@ struct rx_macro {
int rx_mclk_users;
int clsh_users;
int rx_mclk_cnt;
int codec_version;
enum lpass_codec_version codec_version;
int rxn_reg_stride;
bool is_ear_mode_on;
bool hph_pwr_mode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment