Message ID | 20240625165736.722106-1-krzysztof.kozlowski@linaro.org (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | [1/2] ASoC: codecs: lpass-macro: Gracefully handle unknown version | expand |
On Tue, Jun 25, 2024 at 06:57:35PM GMT, Krzysztof Kozlowski wrote: > 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> > --- > sound/soc/codecs/lpass-macro-common.h | 3 ++- > sound/soc/codecs/lpass-va-macro.c | 3 ++- > 2 files changed, 4 insertions(+), 2 deletions(-) > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
On Tue, 25 Jun 2024 18:57:35 +0200, Krzysztof Kozlowski wrote: > 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. > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next Thanks! [1/2] ASoC: codecs: lpass-macro: Gracefully handle unknown version commit: ebc1a54051b58d1aa3a8855faac8bf16b88b8af7 [2/2] ASoC: codecs: lpass-macro: Use enum for handling codec version commit: 06462d6f3fb3c445b5abac7b134d9fe9e361113f All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
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, diff --git a/sound/soc/codecs/lpass-va-macro.c b/sound/soc/codecs/lpass-va-macro.c index ae80865cd459..f9262d7d2c26 100644 --- a/sound/soc/codecs/lpass-va-macro.c +++ b/sound/soc/codecs/lpass-va-macro.c @@ -1463,7 +1463,8 @@ static int va_macro_validate_dmic_sample_rate(u32 dmic_sample_rate, static void va_macro_set_lpass_codec_version(struct va_macro *va) { - int core_id_0 = 0, core_id_1 = 0, core_id_2 = 0, version; + int core_id_0 = 0, core_id_1 = 0, core_id_2 = 0; + int version = LPASS_CODEC_VERSION_UNKNOWN; regmap_read(va->regmap, CDC_VA_TOP_CSR_CORE_ID_0, &core_id_0); regmap_read(va->regmap, CDC_VA_TOP_CSR_CORE_ID_1, &core_id_1);
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> --- sound/soc/codecs/lpass-macro-common.h | 3 ++- sound/soc/codecs/lpass-va-macro.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)