Unverified Commit 9d330278 authored by Mark Brown's avatar Mark Brown
Browse files

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.
parents 17cc308b a4835292
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -24,10 +24,8 @@
#include "wcd-mbhc-v2.h"
#include "wcd937x.h"

enum {
	CHIPID_WCD9370 = 0,
	CHIPID_WCD9375 = 5,
};
#define CHIPID_WCD9370			0x0
#define CHIPID_WCD9375			0x5

/* Z value defined in milliohm */
#define WCD937X_ZDET_VAL_32		(32000)
+5 −7
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@
#include "wcd-mbhc-v2.h"
#include "wcd938x.h"

#define CHIPID_WCD9380			0x0
#define CHIPID_WCD9385			0x5

#define WCD938X_MAX_MICBIAS		(4)
#define WCD938X_MBHC_MAX_BUTTONS	(8)
#define TX_ADC_MAX			(4)
@@ -72,11 +75,6 @@
	SOC_SINGLE_EXT_TLV(xname, reg, shift, max, invert, snd_soc_get_volsw, \
			   wcd938x_ear_pa_put_gain, tlv_array)

enum {
	WCD9380 = 0,
	WCD9385 = 5,
};

enum {
	/* INTR_CTRL_INT_MASK_0 */
	WCD938X_IRQ_MBHC_BUTTON_PRESS_DET = 0,
@@ -3119,7 +3117,7 @@ static int wcd938x_soc_codec_probe(struct snd_soc_component *component)
	disable_irq_nosync(wcd938x->aux_pdm_wd_int);

	switch (variant) {
	case WCD9380:
	case CHIPID_WCD9380:
		ret = snd_soc_add_component_controls(component, wcd9380_snd_controls,
					ARRAY_SIZE(wcd9380_snd_controls));
		if (ret < 0) {
@@ -3129,7 +3127,7 @@ static int wcd938x_soc_codec_probe(struct snd_soc_component *component)
			goto err_free_aux_pdm_wd_int;
		}
		break;
	case WCD9385:
	case CHIPID_WCD9385:
		ret = snd_soc_add_component_controls(component, wcd9385_snd_controls,
					ARRAY_SIZE(wcd9385_snd_controls));
		if (ret < 0) {
+13 −10
Original line number Diff line number Diff line
@@ -36,6 +36,14 @@
#define TX_ADC_MAX			(4)
#define WCD_MBHC_HS_V_MAX		1600

#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,
@@ -85,11 +93,6 @@ enum {
/* Z value compared in milliOhm */
#define WCD939X_ANA_MBHC_ZDET_CONST	(1018 * 1024)

enum {
	WCD9390 = 0,
	WCD9395 = 5,
};

enum {
	/* INTR_CTRL_INT_MASK_0 */
	WCD939X_IRQ_MBHC_BUTTON_PRESS_DET = 0,
@@ -1483,7 +1486,7 @@ static int wcd939x_rx_hph_mode_put(struct snd_kcontrol *kcontrol,
	if (mode_val == wcd939x->hph_mode)
		return 0;

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

	switch (wcd939x->variant) {
	case WCD9390:
	case CHIPID_WCD9390:
		ret = snd_soc_add_component_controls(component, wcd9390_snd_controls,
						     ARRAY_SIZE(wcd9390_snd_controls));
		if (ret < 0) {
@@ -3075,7 +3078,7 @@ static int wcd939x_soc_codec_probe(struct snd_soc_component *component)
			goto err_free_ear_pdm_wd_int;
		}
		break;
	case WCD9395:
	case CHIPID_WCD9395:
		ret = snd_soc_add_component_controls(component, wcd9395_snd_controls,
						     ARRAY_SIZE(wcd9395_snd_controls));
		if (ret < 0) {
@@ -3451,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;