Skip to content

Commit 5d3ccd3

Browse files
krzkbroonie
authored andcommitted
ASoC: codecs: wcd939x: Use simple defines for chipid register value
The value used to identify chip variant is not an enumeration, but raw value used to compare registers with. The 'enum' is not used in the code at all, so simplify and make it a raw hex value define, so intention will be explicit. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20250616-asoc-wcd93xx-enum-v1-3-a20a1b538509@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 100877d commit 5d3ccd3

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

sound/soc/codecs/wcd939x.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
#define TX_ADC_MAX (4)
3737
#define WCD_MBHC_HS_V_MAX 1600
3838

39+
#define CHIPID_WCD9390 0x0
40+
#define CHIPID_WCD9395 0x5
41+
3942
enum {
4043
WCD939X_VERSION_1_0 = 0,
4144
WCD939X_VERSION_1_1,
@@ -85,11 +88,6 @@ enum {
8588
/* Z value compared in milliOhm */
8689
#define WCD939X_ANA_MBHC_ZDET_CONST (1018 * 1024)
8790

88-
enum {
89-
WCD9390 = 0,
90-
WCD9395 = 5,
91-
};
92-
9391
enum {
9492
/* INTR_CTRL_INT_MASK_0 */
9593
WCD939X_IRQ_MBHC_BUTTON_PRESS_DET = 0,
@@ -1483,7 +1481,7 @@ static int wcd939x_rx_hph_mode_put(struct snd_kcontrol *kcontrol,
14831481
if (mode_val == wcd939x->hph_mode)
14841482
return 0;
14851483

1486-
if (wcd939x->variant == WCD9390) {
1484+
if (wcd939x->variant == CHIPID_WCD9390) {
14871485
switch (mode_val) {
14881486
case CLS_H_NORMAL:
14891487
case CLS_H_LP:
@@ -3065,7 +3063,7 @@ static int wcd939x_soc_codec_probe(struct snd_soc_component *component)
30653063
disable_irq_nosync(wcd939x->ear_pdm_wd_int);
30663064

30673065
switch (wcd939x->variant) {
3068-
case WCD9390:
3066+
case CHIPID_WCD9390:
30693067
ret = snd_soc_add_component_controls(component, wcd9390_snd_controls,
30703068
ARRAY_SIZE(wcd9390_snd_controls));
30713069
if (ret < 0) {
@@ -3075,7 +3073,7 @@ static int wcd939x_soc_codec_probe(struct snd_soc_component *component)
30753073
goto err_free_ear_pdm_wd_int;
30763074
}
30773075
break;
3078-
case WCD9395:
3076+
case CHIPID_WCD9395:
30793077
ret = snd_soc_add_component_controls(component, wcd9395_snd_controls,
30803078
ARRAY_SIZE(wcd9395_snd_controls));
30813079
if (ret < 0) {

0 commit comments

Comments
 (0)