* [PATCH 0/4] ASoC: codecs: wcd93xx: Drop enums for chipid values (minor cleanup)
@ 2025-06-16 11:54 Krzysztof Kozlowski
2025-06-16 11:54 ` [PATCH 1/4] ASoC: codecs: wcd937x: Use simple defines for chipid register value Krzysztof Kozlowski
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2025-06-16 11:54 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
Cc: linux-sound, linux-kernel, Krzysztof Kozlowski
Minor cleanup while preparing for adding WCD9378 support: do not use
enum for values which are not an enumeration.
Best regards,
Krzysztof
---
Krzysztof Kozlowski (4):
ASoC: codecs: wcd937x: Use simple defines for chipid register value
ASoC: codecs: wcd938x: Use simple defines for chipid register value
ASoC: codecs: wcd939x: Use simple defines for chipid register value
ASoC: codecs: wcd939x: Add defines for major/minor version decoding
sound/soc/codecs/wcd937x.c | 6 ++----
sound/soc/codecs/wcd938x.c | 12 +++++-------
sound/soc/codecs/wcd939x.c | 23 +++++++++++++----------
3 files changed, 20 insertions(+), 21 deletions(-)
---
base-commit: 050f8ad7b58d9079455af171ac279c4b9b828c11
change-id: 20250616-asoc-wcd93xx-enum-844fe185f0af
Best regards,
--
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] ASoC: codecs: wcd937x: Use simple defines for chipid register value
2025-06-16 11:54 [PATCH 0/4] ASoC: codecs: wcd93xx: Drop enums for chipid values (minor cleanup) Krzysztof Kozlowski
@ 2025-06-16 11:54 ` Krzysztof Kozlowski
2025-06-16 11:54 ` [PATCH 2/4] ASoC: codecs: wcd938x: " Krzysztof Kozlowski
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2025-06-16 11:54 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
Cc: linux-sound, linux-kernel, Krzysztof Kozlowski
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>
---
sound/soc/codecs/wcd937x.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/wcd937x.c b/sound/soc/codecs/wcd937x.c
index a5cf6015122cc9d30526dd4415a2b28353868d74..3b0a8cc314e05934bbffd38876b7ad7e0f444965 100644
--- a/sound/soc/codecs/wcd937x.c
+++ b/sound/soc/codecs/wcd937x.c
@@ -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)
--
2.45.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] ASoC: codecs: wcd938x: Use simple defines for chipid register value
2025-06-16 11:54 [PATCH 0/4] ASoC: codecs: wcd93xx: Drop enums for chipid values (minor cleanup) Krzysztof Kozlowski
2025-06-16 11:54 ` [PATCH 1/4] ASoC: codecs: wcd937x: Use simple defines for chipid register value Krzysztof Kozlowski
@ 2025-06-16 11:54 ` Krzysztof Kozlowski
2025-06-16 11:54 ` [PATCH 3/4] ASoC: codecs: wcd939x: " Krzysztof Kozlowski
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2025-06-16 11:54 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
Cc: linux-sound, linux-kernel, Krzysztof Kozlowski
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>
---
sound/soc/codecs/wcd938x.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c
index 6401ac32d1b6faf3f8c97be62e51c809016a954d..711f373ece24cf4e0db73e9e9b8432b3ce3a1717 100644
--- a/sound/soc/codecs/wcd938x.c
+++ b/sound/soc/codecs/wcd938x.c
@@ -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) {
--
2.45.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] ASoC: codecs: wcd939x: Use simple defines for chipid register value
2025-06-16 11:54 [PATCH 0/4] ASoC: codecs: wcd93xx: Drop enums for chipid values (minor cleanup) Krzysztof Kozlowski
2025-06-16 11:54 ` [PATCH 1/4] ASoC: codecs: wcd937x: Use simple defines for chipid register value Krzysztof Kozlowski
2025-06-16 11:54 ` [PATCH 2/4] ASoC: codecs: wcd938x: " Krzysztof Kozlowski
@ 2025-06-16 11:54 ` Krzysztof Kozlowski
2025-06-16 11:54 ` [PATCH 4/4] ASoC: codecs: wcd939x: Add defines for major/minor version decoding Krzysztof Kozlowski
2025-06-25 17:39 ` [PATCH 0/4] ASoC: codecs: wcd93xx: Drop enums for chipid values (minor cleanup) Mark Brown
4 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2025-06-16 11:54 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
Cc: linux-sound, linux-kernel, Krzysztof Kozlowski
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>
---
sound/soc/codecs/wcd939x.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/sound/soc/codecs/wcd939x.c b/sound/soc/codecs/wcd939x.c
index 45645abe3085662f7c4c6d76a590b98ad71fc56f..7ec751a6cd2610dd3c4eb2bb6556e8700b62427c 100644
--- a/sound/soc/codecs/wcd939x.c
+++ b/sound/soc/codecs/wcd939x.c
@@ -36,6 +36,9 @@
#define TX_ADC_MAX (4)
#define WCD_MBHC_HS_V_MAX 1600
+#define CHIPID_WCD9390 0x0
+#define CHIPID_WCD9395 0x5
+
enum {
WCD939X_VERSION_1_0 = 0,
WCD939X_VERSION_1_1,
@@ -85,11 +88,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 +1481,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 +3063,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 +3073,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) {
--
2.45.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] ASoC: codecs: wcd939x: Add defines for major/minor version decoding
2025-06-16 11:54 [PATCH 0/4] ASoC: codecs: wcd93xx: Drop enums for chipid values (minor cleanup) Krzysztof Kozlowski
` (2 preceding siblings ...)
2025-06-16 11:54 ` [PATCH 3/4] ASoC: codecs: wcd939x: " Krzysztof Kozlowski
@ 2025-06-16 11:54 ` Krzysztof Kozlowski
2025-06-25 17:39 ` [PATCH 0/4] ASoC: codecs: wcd93xx: Drop enums for chipid values (minor cleanup) Mark Brown
4 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2025-06-16 11:54 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
Cc: linux-sound, linux-kernel, Krzysztof Kozlowski
Replace hard-coded register values with defines for checking major and
minor versions of device.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
sound/soc/codecs/wcd939x.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/wcd939x.c b/sound/soc/codecs/wcd939x.c
index 7ec751a6cd2610dd3c4eb2bb6556e8700b62427c..64f082e474c1d404699e304743ed1ada3481effb 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;
--
2.45.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] ASoC: codecs: wcd93xx: Drop enums for chipid values (minor cleanup)
2025-06-16 11:54 [PATCH 0/4] ASoC: codecs: wcd93xx: Drop enums for chipid values (minor cleanup) Krzysztof Kozlowski
` (3 preceding siblings ...)
2025-06-16 11:54 ` [PATCH 4/4] ASoC: codecs: wcd939x: Add defines for major/minor version decoding Krzysztof Kozlowski
@ 2025-06-25 17:39 ` Mark Brown
4 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2025-06-25 17:39 UTC (permalink / raw)
To: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Krzysztof Kozlowski
Cc: linux-sound, linux-kernel
On Mon, 16 Jun 2025 13:54:07 +0200, Krzysztof Kozlowski wrote:
> Minor cleanup while preparing for adding WCD9378 support: do not use
> enum for values which are not an enumeration.
>
> Best regards,
> Krzysztof
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/4] ASoC: codecs: wcd937x: Use simple defines for chipid register value
commit: 2f6ff1e615cd4f8a86c9d0e4e778db9ae44d5481
[2/4] ASoC: codecs: wcd938x: Use simple defines for chipid register value
commit: 100877df34b00257c9ed6d279b06b3ed1da5e2c1
[3/4] ASoC: codecs: wcd939x: Use simple defines for chipid register value
commit: 5d3ccd356e2ce510bdbd4b0c389f2fe3deb41a45
[4/4] ASoC: codecs: wcd939x: Add defines for major/minor version decoding
commit: a48352921f0b15b1f7eff83f5b5613d6ae2350d3
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-06-25 17:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-16 11:54 [PATCH 0/4] ASoC: codecs: wcd93xx: Drop enums for chipid values (minor cleanup) Krzysztof Kozlowski
2025-06-16 11:54 ` [PATCH 1/4] ASoC: codecs: wcd937x: Use simple defines for chipid register value Krzysztof Kozlowski
2025-06-16 11:54 ` [PATCH 2/4] ASoC: codecs: wcd938x: " Krzysztof Kozlowski
2025-06-16 11:54 ` [PATCH 3/4] ASoC: codecs: wcd939x: " Krzysztof Kozlowski
2025-06-16 11:54 ` [PATCH 4/4] ASoC: codecs: wcd939x: Add defines for major/minor version decoding Krzysztof Kozlowski
2025-06-25 17:39 ` [PATCH 0/4] ASoC: codecs: wcd93xx: Drop enums for chipid values (minor cleanup) Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).