From: Krzysztof Kozlowski Date: Mon, 16 Jun 2025 11:54:11 +0000 (+0200) Subject: ASoC: codecs: wcd939x: Add defines for major/minor version decoding X-Git-Tag: block-6.17-20250808~24^2^2~37^2 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=a48352921f0b15b1f7eff83f5b5613d6ae2350d3;p=linux-block.git ASoC: codecs: wcd939x: Add defines for major/minor version decoding Replace hard-coded register values with defines for checking major and minor versions of device. Signed-off-by: Krzysztof Kozlowski Link: https://patch.msgid.link/20250616-asoc-wcd93xx-enum-v1-4-a20a1b538509@linaro.org Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/wcd939x.c b/sound/soc/codecs/wcd939x.c index 7ec751a6cd26..64f082e474c1 100644 --- a/sound/soc/codecs/wcd939x.c +++ b/sound/soc/codecs/wcd939x.c @@ -39,6 +39,11 @@ #define CHIPID_WCD9390 0x0 #define CHIPID_WCD9395 0x5 +/* Version major: 1.x */ +#define CHIPID_WCD939X_VER_MAJOR_1 0x0 +/* Version minor: x.1 */ +#define CHIPID_WCD939X_VER_MINOR_1 0x3 + enum { WCD939X_VERSION_1_0 = 0, WCD939X_VERSION_1_1, @@ -3449,8 +3454,8 @@ static int wcd939x_bind(struct device *dev) regmap_read(wcd939x->regmap, WCD939X_DIGITAL_CHIP_ID1, &id1); regmap_read(wcd939x->regmap, WCD939X_EAR_STATUS_REG_1, &status1); - if (id1 == 0) - version = ((status1 & 0x3) ? WCD939X_VERSION_1_1 : WCD939X_VERSION_1_0); + if (id1 == CHIPID_WCD939X_VER_MAJOR_1) + version = ((status1 & CHIPID_WCD939X_VER_MINOR_1) ? WCD939X_VERSION_1_1 : WCD939X_VERSION_1_0); else version = WCD939X_VERSION_2_0;