summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/lpass-macro-common.h
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>2024-06-25 18:57:35 +0200
committerMark Brown <broonie@kernel.org>2024-06-26 17:34:54 +0200
commitebc1a54051b58d1aa3a8855faac8bf16b88b8af7 (patch)
tree1b1764916d449028d3c9eac037ed07dc83d7539a /sound/soc/codecs/lpass-macro-common.h
parentASoC: codecs: lpass-wsa-macro: Correct support for newer v2.5 version (diff)
downloadlinux-ebc1a54051b58d1aa3a8855faac8bf16b88b8af7.tar.xz
linux-ebc1a54051b58d1aa3a8855faac8bf16b88b8af7.zip
ASoC: codecs: lpass-macro: Gracefully handle unknown version
Qualcomm LPASS macro codec driver parses registers in order to detect version of the codec. It recognizes codecs v2.0 - v2.8, however we know that there are earlier versions and 'enum lpass_codec_version' has also v1.0, v1.1 and v1.2. If by any chance we run on unrecognized version, driver will use random value from the stack as the codec version. Fix it by mapping such cases to an enum of value 0: LPASS_CODEC_VERSION_UNKNOWN. Fixes: 378918d59181 ("ASoC: codecs: lpass-macro: add helpers to get codec version") Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://patch.msgid.link/20240625165736.722106-1-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/lpass-macro-common.h')
-rw-r--r--sound/soc/codecs/lpass-macro-common.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/soc/codecs/lpass-macro-common.h b/sound/soc/codecs/lpass-macro-common.h
index f6f1bfe8eb77..94697d0ba8c9 100644
--- a/sound/soc/codecs/lpass-macro-common.h
+++ b/sound/soc/codecs/lpass-macro-common.h
@@ -19,7 +19,8 @@ enum lpass_version {
};
enum lpass_codec_version {
- LPASS_CODEC_VERSION_1_0 = 1,
+ LPASS_CODEC_VERSION_UNKNOWN,
+ LPASS_CODEC_VERSION_1_0,
LPASS_CODEC_VERSION_1_1,
LPASS_CODEC_VERSION_1_2,
LPASS_CODEC_VERSION_2_0,