Skip to content

Commit a483529

Browse files
krzkbroonie
authored andcommitted
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 <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20250616-asoc-wcd93xx-enum-v1-4-a20a1b538509@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 5d3ccd3 commit a483529

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

sound/soc/codecs/wcd939x.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939
#define CHIPID_WCD9390 0x0
4040
#define CHIPID_WCD9395 0x5
4141

42+
/* Version major: 1.x */
43+
#define CHIPID_WCD939X_VER_MAJOR_1 0x0
44+
/* Version minor: x.1 */
45+
#define CHIPID_WCD939X_VER_MINOR_1 0x3
46+
4247
enum {
4348
WCD939X_VERSION_1_0 = 0,
4449
WCD939X_VERSION_1_1,
@@ -3449,8 +3454,8 @@ static int wcd939x_bind(struct device *dev)
34493454
regmap_read(wcd939x->regmap, WCD939X_DIGITAL_CHIP_ID1, &id1);
34503455
regmap_read(wcd939x->regmap, WCD939X_EAR_STATUS_REG_1, &status1);
34513456

3452-
if (id1 == 0)
3453-
version = ((status1 & 0x3) ? WCD939X_VERSION_1_1 : WCD939X_VERSION_1_0);
3457+
if (id1 == CHIPID_WCD939X_VER_MAJOR_1)
3458+
version = ((status1 & CHIPID_WCD939X_VER_MINOR_1) ? WCD939X_VERSION_1_1 : WCD939X_VERSION_1_0);
34543459
else
34553460
version = WCD939X_VERSION_2_0;
34563461

0 commit comments

Comments
 (0)