Skip to content

Commit 9d33027

Browse files
committed
ASoC: codecs: wcd93xx: Drop enums for chipid values
Merge series from Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>: Minor cleanup while preparing for adding WCD9378 support: do not use enum for values which are not an enumeration.
2 parents 17cc308 + a483529 commit 9d33027

3 files changed

Lines changed: 20 additions & 21 deletions

File tree

sound/soc/codecs/wcd937x.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@
2424
#include "wcd-mbhc-v2.h"
2525
#include "wcd937x.h"
2626

27-
enum {
28-
CHIPID_WCD9370 = 0,
29-
CHIPID_WCD9375 = 5,
30-
};
27+
#define CHIPID_WCD9370 0x0
28+
#define CHIPID_WCD9375 0x5
3129

3230
/* Z value defined in milliohm */
3331
#define WCD937X_ZDET_VAL_32 (32000)

sound/soc/codecs/wcd938x.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
#include "wcd-mbhc-v2.h"
2626
#include "wcd938x.h"
2727

28+
#define CHIPID_WCD9380 0x0
29+
#define CHIPID_WCD9385 0x5
30+
2831
#define WCD938X_MAX_MICBIAS (4)
2932
#define WCD938X_MBHC_MAX_BUTTONS (8)
3033
#define TX_ADC_MAX (4)
@@ -72,11 +75,6 @@
7275
SOC_SINGLE_EXT_TLV(xname, reg, shift, max, invert, snd_soc_get_volsw, \
7376
wcd938x_ear_pa_put_gain, tlv_array)
7477

75-
enum {
76-
WCD9380 = 0,
77-
WCD9385 = 5,
78-
};
79-
8078
enum {
8179
/* INTR_CTRL_INT_MASK_0 */
8280
WCD938X_IRQ_MBHC_BUTTON_PRESS_DET = 0,
@@ -3119,7 +3117,7 @@ static int wcd938x_soc_codec_probe(struct snd_soc_component *component)
31193117
disable_irq_nosync(wcd938x->aux_pdm_wd_int);
31203118

31213119
switch (variant) {
3122-
case WCD9380:
3120+
case CHIPID_WCD9380:
31233121
ret = snd_soc_add_component_controls(component, wcd9380_snd_controls,
31243122
ARRAY_SIZE(wcd9380_snd_controls));
31253123
if (ret < 0) {
@@ -3129,7 +3127,7 @@ static int wcd938x_soc_codec_probe(struct snd_soc_component *component)
31293127
goto err_free_aux_pdm_wd_int;
31303128
}
31313129
break;
3132-
case WCD9385:
3130+
case CHIPID_WCD9385:
31333131
ret = snd_soc_add_component_controls(component, wcd9385_snd_controls,
31343132
ARRAY_SIZE(wcd9385_snd_controls));
31353133
if (ret < 0) {

sound/soc/codecs/wcd939x.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@
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+
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+
3947
enum {
4048
WCD939X_VERSION_1_0 = 0,
4149
WCD939X_VERSION_1_1,
@@ -85,11 +93,6 @@ enum {
8593
/* Z value compared in milliOhm */
8694
#define WCD939X_ANA_MBHC_ZDET_CONST (1018 * 1024)
8795

88-
enum {
89-
WCD9390 = 0,
90-
WCD9395 = 5,
91-
};
92-
9396
enum {
9497
/* INTR_CTRL_INT_MASK_0 */
9598
WCD939X_IRQ_MBHC_BUTTON_PRESS_DET = 0,
@@ -1483,7 +1486,7 @@ static int wcd939x_rx_hph_mode_put(struct snd_kcontrol *kcontrol,
14831486
if (mode_val == wcd939x->hph_mode)
14841487
return 0;
14851488

1486-
if (wcd939x->variant == WCD9390) {
1489+
if (wcd939x->variant == CHIPID_WCD9390) {
14871490
switch (mode_val) {
14881491
case CLS_H_NORMAL:
14891492
case CLS_H_LP:
@@ -3065,7 +3068,7 @@ static int wcd939x_soc_codec_probe(struct snd_soc_component *component)
30653068
disable_irq_nosync(wcd939x->ear_pdm_wd_int);
30663069

30673070
switch (wcd939x->variant) {
3068-
case WCD9390:
3071+
case CHIPID_WCD9390:
30693072
ret = snd_soc_add_component_controls(component, wcd9390_snd_controls,
30703073
ARRAY_SIZE(wcd9390_snd_controls));
30713074
if (ret < 0) {
@@ -3075,7 +3078,7 @@ static int wcd939x_soc_codec_probe(struct snd_soc_component *component)
30753078
goto err_free_ear_pdm_wd_int;
30763079
}
30773080
break;
3078-
case WCD9395:
3081+
case CHIPID_WCD9395:
30793082
ret = snd_soc_add_component_controls(component, wcd9395_snd_controls,
30803083
ARRAY_SIZE(wcd9395_snd_controls));
30813084
if (ret < 0) {
@@ -3451,8 +3454,8 @@ static int wcd939x_bind(struct device *dev)
34513454
regmap_read(wcd939x->regmap, WCD939X_DIGITAL_CHIP_ID1, &id1);
34523455
regmap_read(wcd939x->regmap, WCD939X_EAR_STATUS_REG_1, &status1);
34533456

3454-
if (id1 == 0)
3455-
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);
34563459
else
34573460
version = WCD939X_VERSION_2_0;
34583461

0 commit comments

Comments
 (0)