Skip to contentSkip to conversation

ASoC: add support for CX2072X CODEC

PATCH In review [email protected] 3 participants 11 messages Apr 5, 2017 – Oct 13, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover ASoC: add support for CX2072X CODEC

From: Simon Ho <[email protected]>

Hi Takashi, Mark

I corrected the driver based on your input as below. Please help review the code.

Mark:
- Corrected the coding style.
- EQ/DRC settings can be configured from userspace via mixer controls.
- Wrongly cast void pointers.
- Print I2C error code.
- Use memcmp() to check if the new EQ value is different.
- Removed unused TDM code.
- Removed noisy "out of memory" message.
- Corrected ACPI and I2C match table.
- Removed unnessary CONFIG_ACPI define.

Takashi:
- Fixed printf int argument.
- Fixed unexpected error code at no MCLK fallback.

Thanks,

Simon

Simon Ho (2):
ASoC: cx2072x: Add DT bingings documentation for CX2072X CODEC
ASoC: add support for Conexant CX2072X CODEC

 .../devicetree/bindings/sound/cx2072x.txt          |   36 +
 sound/soc/codecs/Kconfig                           |    5 +
 sound/soc/codecs/Makefile                          |    2 +
 sound/soc/codecs/cx2072x.c                         | 2253 ++++++++++++++++++++
 sound/soc/codecs/cx2072x.h                         |  319 +++
 5 files changed, 2615 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/cx2072x.txt
 create mode 100644 sound/soc/codecs/cx2072x.c
 create mode 100644 sound/soc/codecs/cx2072x.h
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/2 ASoC: cx2072x: Add DT bingings documentation for CX2072X CODEC

From: Simon Ho <[email protected]>

Initial version of CX2072X device tree bindings document.

---
 .../devicetree/bindings/sound/cx2072x.txt          | 36 ++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/cx2072x.txt
Documentation/devicetree/bindings/sound/cx2072x.txt new file +36 -0
new file mode 100644
index 0000000..05ddf7c
@@ -0,0 +1,36 @@
+Conexant CX20721/CX20723/CX7601 audio CODEC
+
+The devices support I2C only.
+
+Required properties:
+
+  - compatible : One of "cnxt,cx20721", "cnxt,cx20723", "cnxt,cx7601".
+
+  - reg : the I2C address of the device for I2C, it should be <0x33>
+
+Optional properties:
+
+  - clocks : phandle and clock specifier for codec MCLK.
+  - clock-names : Clock name string for 'clocks' attribute, should be "mclk".
+
+CODEC output pins:
+  "PORTA"	- Headphone
+  "PORTG"	- Class-D output
+  "PORTE"	- Line out
+
+CODEC output pins for Conexant DSP chip:
+  "AEC REF"	- AEC reference signal
+
+CODEC input pins:
+  "PORTB"	- Analog mic
+  "PORTC"	- Digital mic
+  "PORTD"	- Headset mic
+
+Example:
+
+codec: cx20721@33 {
+	compatible = "cnxt,cx20721";
+	reg = <0x33>;
+	clocks = <&sco>;
+	clock-names = "mclk";
+};
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 2/2 ASoC: add support for Conexant CX2072X CODEC

In reply to [email protected]

From: Simon Ho <[email protected]>

Initial commit of the Conexant CX2072X CODEC driver. Some features are not present.

The CX2072X is a ultra low power stereo audio codec supports I2S/TDM host interface with EQ, DRC features in playback mode.

Featues of CX2072X codec:

* Two 24 bits DACs and DACs.
* Stereo Headphone AMP.
* 2.8W per channel class-D output.
* Integrated seven bands per channel EQ and DRC.
* Fully integrated headset support with detect/switch.
* Stereo digital microphone for array applications.
* S/PDIF output.
* Bi-directional GPIOs.
* Support analog and digital PC Beeep.
* One headset button support.
* Supports a wide variety of host interfaces. -wide variety of I2S and similar bit-stream formats with word lengths of up to 24 bits.
-TDM stream supports up to 4 channels.
* AEC loopback support.

---
 sound/soc/codecs/Kconfig   |    5 +
 sound/soc/codecs/Makefile  |    2 +
 sound/soc/codecs/cx2072x.c | 2253 ++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/cx2072x.h |  319 +++++++
 4 files changed, 2579 insertions(+)
 create mode 100644 sound/soc/codecs/cx2072x.c
 create mode 100644 sound/soc/codecs/cx2072x.h
sound/soc/codecs/Kconfig +5 -0
index 70decab..d5cfdbe 100644
@@ -64,6 +64,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_CS47L24 if MFD_CS47L24
 	select SND_SOC_CS53L30 if I2C
 	select SND_SOC_CX20442 if TTY
+	select SND_SOC_CX2072X if I2C
 	select SND_SOC_DA7210 if SND_SOC_I2C_AND_SPI
 	select SND_SOC_DA7213 if I2C
 	select SND_SOC_DA7218 if I2C
@@ -500,6 +501,10 @@ config SND_SOC_CX20442
 	tristate
 	depends on TTY
 
+config SND_SOC_CX2072X
+	tristate "Conexant CX2072X CODEC"
+	depends on I2C
+
 config SND_SOC_JZ4740_CODEC
 	select REGMAP_MMIO
 	tristate
sound/soc/codecs/Makefile +2 -0
index bbef31e..9181792 100644
@@ -57,6 +57,7 @@ snd-soc-cs4349-objs := cs4349.o
 snd-soc-cs47l24-objs := cs47l24.o
 snd-soc-cs53l30-objs := cs53l30.o
 snd-soc-cx20442-objs := cx20442.o
+snd-soc-cx2072x-objs := cx2072x.o
 snd-soc-da7210-objs := da7210.o
 snd-soc-da7213-objs := da7213.o
 snd-soc-da7218-objs := da7218.o
@@ -290,6 +291,7 @@ obj-$(CONFIG_SND_SOC_CS4349)	+= snd-soc-cs4349.o
 obj-$(CONFIG_SND_SOC_CS47L24)	+= snd-soc-cs47l24.o
 obj-$(CONFIG_SND_SOC_CS53L30)	+= snd-soc-cs53l30.o
 obj-$(CONFIG_SND_SOC_CX20442)	+= snd-soc-cx20442.o
+obj-$(CONFIG_SND_SOC_CX2072X)	+= snd-soc-cx2072x.o
 obj-$(CONFIG_SND_SOC_DA7210)	+= snd-soc-da7210.o
 obj-$(CONFIG_SND_SOC_DA7213)	+= snd-soc-da7213.o
 obj-$(CONFIG_SND_SOC_DA7218)	+= snd-soc-da7218.o
sound/soc/codecs/cx2072x.c new file +2253 -0

2,253 lines not on this page · raw message

sound/soc/codecs/cx2072x.h new file +319 -0

319 lines not on this page · raw message

Signature · 1 line
2.7.4
#3 lore raw

Re: [PATCH v2 2/2] ASoC: add support for Conexant CX2072X CODEC

Quoted 10 lines · On Wed, 05 Apr 2017 11:07:14 +0200, <[email protected]> wrote:
sound/soc/codecs/cx2072x.c new file +7 -0
+/**
+ * cx2072x_enable_detect - Enable CX2072X jack detection
+ * @codec : pointer variable to codec having information related to codec
+ *
+ */
+int cx2072x_enable_detect(struct snd_soc_codec *codec)
+{

.....

Quoted 10 lines
sound/soc/codecs/cx2072x.c new file +10 -0
+}
+EXPORT_SYMBOL_GPL(cx2072x_enable_detect);
+
+/*
+ * cx2072x_get_jack_state: Return current jack state.
+ * @codec : pointer variable to codec having information related to codec
+ *
+ */
+int cx2072x_get_jack_state(struct snd_soc_codec *codec)
+{

....

Quoted 4 lines
sound/soc/codecs/cx2072x.c new file +2 -0
+}
+EXPORT_SYMBOL_GPL(cx2072x_get_jack_state);
sound/soc/codecs/cx2072x.h new file +0 -0

....

sound/soc/codecs/cx2072x.h line 190

Quoted 8 lines
sound/soc/codecs/cx2072x.h new file +8 -0
+enum cx2072x_jack_types {
+	CX_JACK_NONE = 0x0000,
+	CX_JACK_HEADPHONE = 0x0001,
+	CX_JACK_APPLE_HEADSET = 0x0002,
+	CX_JACK_NOKIE_HEADSET = 0x0003,
+};
+
+int cx2072x_hs_jack_report(struct snd_soc_codec *codec);

This function is nowhere defined. And the new jack functions cx2072x_enable_detect() and cx2072x_get_jack_state() are not declared here, either.

Takashi

#4 lore raw

Re: [PATCH v2 2/2] ASoC: add support for Conexant CX2072X CODEC

Quoted 30 lines · Takashi Iwai
Quoted 10 lines · On Wed, 05 Apr 2017 11:07:14 +0200, <[email protected]> wrote:
sound/soc/codecs/cx2072x.c new file +7 -0
+/**
+ * cx2072x_enable_detect - Enable CX2072X jack detection
+ * @codec : pointer variable to codec having information related to codec
+ *
+ */
+int cx2072x_enable_detect(struct snd_soc_codec *codec)
+{

.....

Quoted 10 lines
sound/soc/codecs/cx2072x.c new file +10 -0
+}
+EXPORT_SYMBOL_GPL(cx2072x_enable_detect);
+
+/*
+ * cx2072x_get_jack_state: Return current jack state.
+ * @codec : pointer variable to codec having information related to codec
+ *
+ */
+int cx2072x_get_jack_state(struct snd_soc_codec *codec)
+{

....

Quoted 4 lines
sound/soc/codecs/cx2072x.c new file +2 -0
+}
+EXPORT_SYMBOL_GPL(cx2072x_get_jack_state);
sound/soc/codecs/cx2072x.h new file +0 -0

....

Quoted 12 lines

sound/soc/codecs/cx2072x.h

Quoted 8 lines
sound/soc/codecs/cx2072x.h new file +8 -0
+enum cx2072x_jack_types {
+	CX_JACK_NONE = 0x0000,
+	CX_JACK_HEADPHONE = 0x0001,
+	CX_JACK_APPLE_HEADSET = 0x0002,
+	CX_JACK_NOKIE_HEADSET = 0x0003,
+};
+
+int cx2072x_hs_jack_report(struct snd_soc_codec *codec);

This function is nowhere defined. And the new jack functions cx2072x_enable_detect() and cx2072x_get_jack_state() are not declared here, either.

Also, some DAPM entries are missing / wrong, obviously.

Takashi

---
 sound/soc/codecs/cx2072x.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
sound/soc/codecs/cx2072x.c +5 -4
index 52fc2d67d9ed..d095b29420b9 100644
@@ -1629,10 +1629,10 @@ static const struct snd_soc_dapm_widget cx2072x_dapm_widgets[] = {
 	/*Capture*/
 	SND_SOC_DAPM_AIF_OUT("Out AIF", "Capture", 0, SND_SOC_NOPM, 0, 0),
 
-	SND_SOC_DAPM_SWITCH("I2S ADC1", SND_SOC_NOPM, 0, 0, &i2sadc1l_ctl),
-	SND_SOC_DAPM_SWITCH("I2S ADC1", SND_SOC_NOPM, 0, 0, &i2sadc1r_ctl),
-	SND_SOC_DAPM_SWITCH("I2S ADC2", SND_SOC_NOPM, 0, 0, &i2sadc2l_ctl),
-	SND_SOC_DAPM_SWITCH("I2S ADC2", SND_SOC_NOPM, 0, 0, &i2sadc2r_ctl),
+	SND_SOC_DAPM_SWITCH("I2S ADC1L", SND_SOC_NOPM, 0, 0, &i2sadc1l_ctl),
+	SND_SOC_DAPM_SWITCH("I2S ADC1R", SND_SOC_NOPM, 0, 0, &i2sadc1r_ctl),
+	SND_SOC_DAPM_SWITCH("I2S ADC2L", SND_SOC_NOPM, 0, 0, &i2sadc2l_ctl),
+	SND_SOC_DAPM_SWITCH("I2S ADC2R", SND_SOC_NOPM, 0, 0, &i2sadc2r_ctl),
 
 	SND_SOC_DAPM_REG(snd_soc_dapm_adc, "ADC1", CX2072X_ADC1_POWER_STATE,
 			 0, 0xFF, 0x00, 0x03),
@@ -1640,6 +1640,7 @@ static const struct snd_soc_dapm_widget cx2072x_dapm_widgets[] = {
 			 0, 0xFF, 0x00, 0x03),
 
 	SND_SOC_DAPM_MUX("ADC1 Mux", SND_SOC_NOPM, 0, 0, &adc1_mux),
+	SND_SOC_DAPM_MUX("ADC2 Mux", SND_SOC_NOPM, 0, 0, &adc2_mux),
 
 	SND_SOC_DAPM_REG(snd_soc_dapm_supply, "PortB Power",
 			 CX2072X_PORTB_POWER_STATE, 0, 0xFFF, 0x00, 0x03),
Signature · 1 line
2.11.1
#5 lore raw

Re: [PATCH v2 2/2] ASoC: add support for Conexant CX2072X CODEC

Quoted 46 lines · Takashi Iwai
Quoted 30 lines · Takashi Iwai
Quoted 10 lines · On Wed, 05 Apr 2017 11:07:14 +0200, <[email protected]> wrote:
sound/soc/codecs/cx2072x.c new file +7 -0
+/**
+ * cx2072x_enable_detect - Enable CX2072X jack detection
+ * @codec : pointer variable to codec having information related to codec
+ *
+ */
+int cx2072x_enable_detect(struct snd_soc_codec *codec)
+{

.....

Quoted 10 lines
sound/soc/codecs/cx2072x.c new file +10 -0
+}
+EXPORT_SYMBOL_GPL(cx2072x_enable_detect);
+
+/*
+ * cx2072x_get_jack_state: Return current jack state.
+ * @codec : pointer variable to codec having information related to codec
+ *
+ */
+int cx2072x_get_jack_state(struct snd_soc_codec *codec)
+{

....

Quoted 4 lines
sound/soc/codecs/cx2072x.c new file +2 -0
+}
+EXPORT_SYMBOL_GPL(cx2072x_get_jack_state);
sound/soc/codecs/cx2072x.h new file +0 -0

....

Quoted 12 lines

sound/soc/codecs/cx2072x.h

Quoted 8 lines
sound/soc/codecs/cx2072x.h new file +8 -0
+enum cx2072x_jack_types {
+	CX_JACK_NONE = 0x0000,
+	CX_JACK_HEADPHONE = 0x0001,
+	CX_JACK_APPLE_HEADSET = 0x0002,
+	CX_JACK_NOKIE_HEADSET = 0x0003,
+};
+
+int cx2072x_hs_jack_report(struct snd_soc_codec *codec);

This function is nowhere defined. And the new jack functions cx2072x_enable_detect() and cx2072x_get_jack_state() are not declared here, either.

Quoted 1 line

Also, some DAPM entries are missing / wrong, obviously.

... and yet another missing ones, the powers for some pins aren't hooked.

Takashi

sound/soc/codecs/cx2072x.c +4 -0
@@ -1737,6 +1737,10 @@ static const struct snd_soc_dapm_route cx2072x_intercon[] = {
 	{"Out AIF", NULL, "I2S ADC2R"},
 	{"Out AIF", NULL, "AFG Power"},
 	{"AEC REF", NULL, "Out AIF"},
+	{"PortB In En", NULL, "PortB Power"},
+	{"PortC In En", NULL, "PortC Power"},
+	{"PortD In En", NULL, "PortD Power"},
+	{"PortE In En", NULL, "PortE Power"},
 };
 
 static void cx2072x_sw_reset(struct cx2072x_priv *cx2072x)
#6 lore raw

Re: [PATCH v2 2/2] ASoC: add support for Conexant CX2072X CODEC

Quoted 49 lines · Takashi Iwai
Quoted 46 lines · Takashi Iwai
Quoted 42 lines · Takashi Iwai
Quoted 10 lines · On Wed, 05 Apr 2017 11:07:14 +0200, <[email protected]> wrote:
sound/soc/codecs/cx2072x.c new file +7 -0
+/**
+ * cx2072x_enable_detect - Enable CX2072X jack detection
+ * @codec : pointer variable to codec having information related to codec
+ *
+ */
+int cx2072x_enable_detect(struct snd_soc_codec *codec)
+{

.....

Quoted 10 lines
sound/soc/codecs/cx2072x.c new file +10 -0
+}
+EXPORT_SYMBOL_GPL(cx2072x_enable_detect);
+
+/*
+ * cx2072x_get_jack_state: Return current jack state.
+ * @codec : pointer variable to codec having information related to codec
+ *
+ */
+int cx2072x_get_jack_state(struct snd_soc_codec *codec)
+{

....

Quoted 4 lines
sound/soc/codecs/cx2072x.c new file +2 -0
+}
+EXPORT_SYMBOL_GPL(cx2072x_get_jack_state);
sound/soc/codecs/cx2072x.h new file +0 -0

....

sound/soc/codecs/cx2072x.h

Quoted 8 lines
sound/soc/codecs/cx2072x.h new file +8 -0
+enum cx2072x_jack_types {
+	CX_JACK_NONE = 0x0000,
+	CX_JACK_HEADPHONE = 0x0001,
+	CX_JACK_APPLE_HEADSET = 0x0002,
+	CX_JACK_NOKIE_HEADSET = 0x0003,
+};
+
+int cx2072x_hs_jack_report(struct snd_soc_codec *codec);

This function is nowhere defined. And the new jack functions cx2072x_enable_detect() and cx2072x_get_jack_state() are not declared here, either.

Quoted 4 lines
Quoted 1 line

Also, some DAPM entries are missing / wrong, obviously.

... and yet another missing ones, the powers for some pins aren't hooked.

Last but not least: the regcache_cache_bypass() calls in the jack detection function don't look good.

These registers are volatile, and if the cache_only isn't set via bias ctl, we need no bypass. And, if cache_only is at BIAS_OFF and the jack detection gets triggered during that, it screws up, spewing a kernel warning because of the check below:

void regcache_cache_bypass(struct regmap *map, bool enable)

{
	map->lock(map->lock_arg);
	WARN_ON(map->cache_only && enable);

So, either we should remove these bypass calls, or turn on/off cache_only temporarily during the jack detection like below -- the latter is so ugly, and better to avoid, though.

Takashi

===

sound/soc/codecs/cx2072x.c +6 -2
index fab564cb1176..5b3c4939e653 100644
@@ -1246,13 +1246,17 @@ int cx2072x_get_jack_state(struct snd_soc_codec *codec)
 	unsigned int type = 0;
 	int  state = 0;
 	struct cx2072x_priv *cx2072x = snd_soc_codec_get_drvdata(codec);
+	bool need_cache_bypass =
+		snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF;
 
-	regcache_cache_bypass(cx2072x->regmap, true);
+	if (need_cache_bypass)
+		regcache_cache_only(cx2072x->regmap, false);
 	cx2072x->jack_state = CX_JACK_NONE;
 	regmap_read(cx2072x->regmap, CX2072X_PORTA_PIN_SENSE, &jack);
 	jack = jack >> 24;
 	regmap_read(cx2072x->regmap, CX2072X_DIGITAL_TEST11, &type);
-	regcache_cache_bypass(cx2072x->regmap, false);
+	if (need_cache_bypass)
+		regcache_cache_only(cx2072x->regmap, true);
 	if (jack == 0x80) {
 		type = type >> 8;
author
#7 lore raw

Re: [PATCH v2 2/2] ASoC: add support for Conexant CX2072X CODEC

Quoted 70 lines · Takashi Iwai
Quoted 49 lines · Takashi Iwai
Quoted 46 lines · Takashi Iwai
Quoted 42 lines · Takashi Iwai
Quoted 10 lines · On Wed, 05 Apr 2017 11:07:14 +0200, <[email protected]> wrote:
sound/soc/codecs/cx2072x.c new file +7 -0
+/**
+ * cx2072x_enable_detect - Enable CX2072X jack detection
+ * @codec : pointer variable to codec having information related to codec
+ *
+ */
+int cx2072x_enable_detect(struct snd_soc_codec *codec)
+{

.....

Quoted 10 lines
sound/soc/codecs/cx2072x.c new file +10 -0
+}
+EXPORT_SYMBOL_GPL(cx2072x_enable_detect);
+
+/*
+ * cx2072x_get_jack_state: Return current jack state.
+ * @codec : pointer variable to codec having information related to codec
+ *
+ */
+int cx2072x_get_jack_state(struct snd_soc_codec *codec)
+{

....

Quoted 4 lines
sound/soc/codecs/cx2072x.c new file +2 -0
+}
+EXPORT_SYMBOL_GPL(cx2072x_get_jack_state);
sound/soc/codecs/cx2072x.h new file +0 -0

....

sound/soc/codecs/cx2072x.h

Quoted 8 lines
sound/soc/codecs/cx2072x.h new file +8 -0
+enum cx2072x_jack_types {
+	CX_JACK_NONE = 0x0000,
+	CX_JACK_HEADPHONE = 0x0001,
+	CX_JACK_APPLE_HEADSET = 0x0002,
+	CX_JACK_NOKIE_HEADSET = 0x0003,
+};
+
+int cx2072x_hs_jack_report(struct snd_soc_codec *codec);

This function is nowhere defined. And the new jack functions cx2072x_enable_detect() and cx2072x_get_jack_state() are not declared here, either.

Quoted 4 lines
Quoted 1 line

Also, some DAPM entries are missing / wrong, obviously.

... and yet another missing ones, the powers for some pins aren't hooked.

Last but not least: the regcache_cache_bypass() calls in the jack detection function don't look good.

These registers are volatile, and if the cache_only isn't set via bias ctl, we need no bypass. And, if cache_only is at BIAS_OFF and the jack detection gets triggered during that, it screws up, spewing a kernel warning because of the check below:

void regcache_cache_bypass(struct regmap *map, bool enable)

{
	map->lock(map->lock_arg);
	WARN_ON(map->cache_only && enable);
Quoted 7 lines

So, either we should remove these bypass calls, or turn on/off cache_only temporarily during the jack detection like below -- the latter is so ugly, and better to avoid, though.

Takashi

Thank you for the detailed and informative review. I will try both appraoches.

Thanks,

Simon

Quoted 24 lines

===

sound/soc/codecs/cx2072x.c +6 -2
index fab564cb1176..5b3c4939e653 100644
@@ -1246,13 +1246,17 @@ int cx2072x_get_jack_state(struct snd_soc_codec *codec)
 	unsigned int type = 0;
 	int  state = 0;
 	struct cx2072x_priv *cx2072x = snd_soc_codec_get_drvdata(codec);
+	bool need_cache_bypass =
+		snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF;
 
-	regcache_cache_bypass(cx2072x->regmap, true);
+	if (need_cache_bypass)
+		regcache_cache_only(cx2072x->regmap, false);
 	cx2072x->jack_state = CX_JACK_NONE;
 	regmap_read(cx2072x->regmap, CX2072X_PORTA_PIN_SENSE, &jack);
 	jack = jack >> 24;
 	regmap_read(cx2072x->regmap, CX2072X_DIGITAL_TEST11, &type);
-	regcache_cache_bypass(cx2072x->regmap, false);
+	if (need_cache_bypass)
+		regcache_cache_only(cx2072x->regmap, true);
 	if (jack == 0x80) {
 		type = type >> 8;
author
#8 lore raw

Re: [PATCH v2 2/2] ASoC: add support for Conexant CX2072X CODEC

In reply to Takashi Iwai
Quoted 48 lines · Takashi Iwai
Quoted 46 lines · Takashi Iwai
Quoted 42 lines · Takashi Iwai
Quoted 10 lines · On Wed, 05 Apr 2017 11:07:14 +0200, <[email protected]> wrote:
sound/soc/codecs/cx2072x.c new file +7 -0
+/**
+ * cx2072x_enable_detect - Enable CX2072X jack detection
+ * @codec : pointer variable to codec having information related to codec
+ *
+ */
+int cx2072x_enable_detect(struct snd_soc_codec *codec)
+{

.....

Quoted 10 lines
sound/soc/codecs/cx2072x.c new file +10 -0
+}
+EXPORT_SYMBOL_GPL(cx2072x_enable_detect);
+
+/*
+ * cx2072x_get_jack_state: Return current jack state.
+ * @codec : pointer variable to codec having information related to codec
+ *
+ */
+int cx2072x_get_jack_state(struct snd_soc_codec *codec)
+{

....

Quoted 4 lines
sound/soc/codecs/cx2072x.c new file +2 -0
+}
+EXPORT_SYMBOL_GPL(cx2072x_get_jack_state);
sound/soc/codecs/cx2072x.h new file +0 -0

....

sound/soc/codecs/cx2072x.h

Quoted 8 lines
sound/soc/codecs/cx2072x.h new file +8 -0
+enum cx2072x_jack_types {
+	CX_JACK_NONE = 0x0000,
+	CX_JACK_HEADPHONE = 0x0001,
+	CX_JACK_APPLE_HEADSET = 0x0002,
+	CX_JACK_NOKIE_HEADSET = 0x0003,
+};
+
+int cx2072x_hs_jack_report(struct snd_soc_codec *codec);

This function is nowhere defined. And the new jack functions cx2072x_enable_detect() and cx2072x_get_jack_state() are not declared here, either.

Quoted 8 lines
Quoted 1 line

Also, some DAPM entries are missing / wrong, obviously.

... and yet another missing ones, the powers for some pins aren't hooked.

Takashi

You are right, thanks for caching that.

Simon

Quoted 13 lines
sound/soc/codecs/cx2072x.c +4 -0
@@ -1737,6 +1737,10 @@ static const struct snd_soc_dapm_route cx2072x_intercon[] = {
 	{"Out AIF", NULL, "I2S ADC2R"},
 	{"Out AIF", NULL, "AFG Power"},
 	{"AEC REF", NULL, "Out AIF"},
+	{"PortB In En", NULL, "PortB Power"},
+	{"PortC In En", NULL, "PortC Power"},
+	{"PortD In En", NULL, "PortD Power"},
+	{"PortE In En", NULL, "PortE Power"},
 };
 
 static void cx2072x_sw_reset(struct cx2072x_priv *cx2072x)
author
#9 lore raw

Re: [PATCH v2 2/2] ASoC: add support for Conexant CX2072X CODEC

In reply to Takashi Iwai
Quoted 43 lines · Takashi Iwai
Quoted 10 lines · On Wed, 05 Apr 2017 11:07:14 +0200, <[email protected]> wrote:
sound/soc/codecs/cx2072x.c new file +7 -0
+/**
+ * cx2072x_enable_detect - Enable CX2072X jack detection
+ * @codec : pointer variable to codec having information related to codec
+ *
+ */
+int cx2072x_enable_detect(struct snd_soc_codec *codec)
+{

.....

Quoted 10 lines
sound/soc/codecs/cx2072x.c new file +10 -0
+}
+EXPORT_SYMBOL_GPL(cx2072x_enable_detect);
+
+/*
+ * cx2072x_get_jack_state: Return current jack state.
+ * @codec : pointer variable to codec having information related to codec
+ *
+ */
+int cx2072x_get_jack_state(struct snd_soc_codec *codec)
+{

....

Quoted 4 lines
sound/soc/codecs/cx2072x.c new file +2 -0
+}
+EXPORT_SYMBOL_GPL(cx2072x_get_jack_state);
sound/soc/codecs/cx2072x.h new file +0 -0

....

sound/soc/codecs/cx2072x.h line 190

Quoted 8 lines
sound/soc/codecs/cx2072x.h new file +8 -0
+enum cx2072x_jack_types {
+	CX_JACK_NONE = 0x0000,
+	CX_JACK_HEADPHONE = 0x0001,
+	CX_JACK_APPLE_HEADSET = 0x0002,
+	CX_JACK_NOKIE_HEADSET = 0x0003,
+};
+
+int cx2072x_hs_jack_report(struct snd_soc_codec *codec);

This function is nowhere defined. And the new jack functions cx2072x_enable_detect() and cx2072x_get_jack_state() are not declared here, either.

Quoted 1 line

Takashi

Sorry, I did not verify this feature after jack sense code changed.

BTW, the cx2072x_jack_types is no longer used, we can remove it.

Simon