* [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support
@ 2024-07-29 5:09 kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 01/33] ASoC: codecs: ES8316: fix build warning kovalev
` (33 more replies)
0 siblings, 34 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:09 UTC (permalink / raw)
To: devel-kernel
Эти патчи для ядра 6.1 веток c10f1 и c10f2
- ASoC: codecs: ES8316: fix build warning.
- ASoC: codecs: ES8326: fix support (backport from upstream).
- ASoC: Intel: sof-essx8336: add more DMI info.
[PATCH 01/33] ASoC: codecs: ES8316: fix build warning
[PATCH 02/33] ASoC: codecs: ES8326: Add es8326_mute function
[PATCH 03/33] ASoC: codecs: ES8326: Change Hp_detect register names
[PATCH 04/33] ASoC: codecs: ES8326: Change Volatile Reg function
[PATCH 05/33] ASoC: codecs: ES8326: Fix power-up sequence
[PATCH 06/33] ASOC: codecs: ES8326: Add calibration support for
[PATCH 07/33] ASoC: codecs: ES8326: Update jact detection function
[PATCH 08/33] ASoC: codecs: ES8326: Add chip version flag
[PATCH 09/33] ASoC: codecs: ES8326: Changing initialisation and
[PATCH 10/33] ASoC: codecs: ES8326: Changing the headset detection
[PATCH 11/33] ASoC: codecs: ES8326: improving crosstalk performance
[PATCH 12/33] ASoC: codecs: ES8326: Improving the THD+N performance
[PATCH 13/33] ASoC: codecs: ES8326: Minimize the pop noise on
[PATCH 14/33] ASoC: codecs: ES8326: fix the capture noise issue
[PATCH 15/33] ASoC: codecs: ES8326: Remove executable bit
[PATCH 16/33] ASoC: codecs: ES8326: Adding new volume kcontrols
[PATCH 17/33] ASoC: codecs: ES8326: Changing members of private
[PATCH 18/33] ASoC: codecs: ES8326: Reducing power consumption
[PATCH 19/33] ASoC: codecs: ES8326: Delete unused REG_SUPPLY
[PATCH 20/33] ASoC: codecs: ES8326: Solve error interruption issue
[PATCH 21/33] ASoC: codecs: ES8326: modify clock table
[PATCH 22/33] ASoC: codecs: ES8326: Solve a headphone detection issue
[PATCH 23/33] ASoC: codecs: ES8326: Removing the control of ADC_SCALE
[PATCH 24/33] ASoC: codecs: ES8326: solve hp and button detect issue
[PATCH 25/33] ASoC: codecs: ES8326: Solve headphone detection issue
[PATCH 26/33] ASoC: codecs: ES8326: Slove headphone detection issue
[PATCH 27/33] ASoC: codecs: ES8326: Minimize the pop noise
[PATCH 28/33] ASoC: codecs: ES8326: regcache_sync error issue
[PATCH 29/33] ASoC: codecs: ES8326: suspend issue
[PATCH 30/33] ASoC: Intel: sof-essx8336 - add DMI info for Aquarius
[PATCH 31/33] ASoC: Intel: sof-essx8336 - add DMI info of the
[PATCH 32/33] ASoC: Intel: sof-essx8336 - add DMI info of the ACD
[PATCH 33/33] ASoC: Intel: sof-essx8336: force card->name for the
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 01/33] ASoC: codecs: ES8316: fix build warning
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
@ 2024-07-29 5:09 ` kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 02/33] ASoC: codecs: ES8326: Add es8326_mute function kovalev
` (32 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:09 UTC (permalink / raw)
To: devel-kernel
From: Vasiliy Kovalev <kovalev@altlinux.org>
sound/soc/codecs/es8316.c:517:2: warning: ISO C90 forbids mixed
declarations and code [-Wdeclaration-after-statement]
517 | static u8 only_one = 0;
| ^~~~~~
Fixes: f63b2a193575f82 ("ASoC: AMD: add ACP machine driver for ES8336")
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8316.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
index f6e3f0e7e56583..754d9e62a7e6a2 100644
--- a/sound/soc/codecs/es8316.c
+++ b/sound/soc/codecs/es8316.c
@@ -460,6 +460,8 @@ static int es8316_pcm_startup(struct snd_pcm_substream *substream,
return 0;
}
+static u8 flag_print_div_once = 0;
+
static int es8316_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
@@ -513,9 +515,8 @@ static int es8316_pcm_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
- static u8 only_one = 0;
- if (!only_one) {
- only_one = 1;
+ if (!flag_print_div_once) {
+ flag_print_div_once = 1;
if (mclk_div == 2)
dev_info(component->dev, "Activating MCLK div by 2\n");
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 02/33] ASoC: codecs: ES8326: Add es8326_mute function
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 01/33] ASoC: codecs: ES8316: fix build warning kovalev
@ 2024-07-29 5:09 ` kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 03/33] ASoC: codecs: ES8326: Change Hp_detect register names kovalev
` (31 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:09 UTC (permalink / raw)
To: devel-kernel
From: Zhu Ning <zhuning0077@gmail.com>
commit 083912c240de0c5f797da0443f5a99e87b75fcb3 upstream.
The internal analog power and hp Vref of es8326 should always be on to
reduce pop noise. The HP_VOL and HP_CAL are moved to es8326_mute function
so they are turned on at last and turned off at first.
Also, the calibration should be done manually once during start-up
to reduce DC offset on headphone.
Signed-off-by: Zhu Ning <zhuning0077@gmail.com>
Link: https://lore.kernel.org/r/20230714032453.3334-1-zhuning0077@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 75 ++++++++++++++++-----------------------
sound/soc/codecs/es8326.h | 8 +++--
2 files changed, 36 insertions(+), 47 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 555125efd9ad3f..caee0d66ce47a8 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -38,6 +38,9 @@ struct es8326_priv {
u8 interrupt_clk;
bool jd_inverted;
unsigned int sysclk;
+
+ bool calibrated;
+ int version;
};
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(dac_vol_tlv, -9550, 50, 0);
@@ -121,33 +124,12 @@ static const struct snd_soc_dapm_widget es8326_dapm_widgets[] = {
/* Analog Power Supply*/
SND_SOC_DAPM_DAC("Right DAC", NULL, ES8326_ANA_PDN, 0, 1),
SND_SOC_DAPM_DAC("Left DAC", NULL, ES8326_ANA_PDN, 1, 1),
- SND_SOC_DAPM_SUPPLY("Analog Power", ES8326_ANA_PDN, 7, 1, NULL, 0),
- SND_SOC_DAPM_SUPPLY("IBias Power", ES8326_ANA_PDN, 6, 1, NULL, 0),
- SND_SOC_DAPM_SUPPLY("ADC Vref", ES8326_ANA_PDN, 5, 1, NULL, 0),
- SND_SOC_DAPM_SUPPLY("DAC Vref", ES8326_ANA_PDN, 4, 1, NULL, 0),
- SND_SOC_DAPM_SUPPLY("Vref Power", ES8326_ANA_PDN, 3, 1, NULL, 0),
SND_SOC_DAPM_SUPPLY("MICBIAS1", ES8326_ANA_MICBIAS, 2, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY("MICBIAS2", ES8326_ANA_MICBIAS, 3, 0, NULL, 0),
SND_SOC_DAPM_PGA("LHPMIX", ES8326_DAC2HPMIX, 7, 0, NULL, 0),
SND_SOC_DAPM_PGA("RHPMIX", ES8326_DAC2HPMIX, 3, 0, NULL, 0),
- /* Headphone Charge Pump and Output */
- SND_SOC_DAPM_SUPPLY("HPOR Cal", ES8326_HP_CAL, 7, 1, NULL, 0),
- SND_SOC_DAPM_SUPPLY("HPOL Cal", ES8326_HP_CAL, 3, 1, NULL, 0),
- SND_SOC_DAPM_SUPPLY("Headphone Charge Pump", ES8326_HP_DRIVER,
- 3, 1, NULL, 0),
- SND_SOC_DAPM_SUPPLY("Headphone Driver Bias", ES8326_HP_DRIVER,
- 2, 1, NULL, 0),
- SND_SOC_DAPM_SUPPLY("Headphone LDO", ES8326_HP_DRIVER,
- 1, 1, NULL, 0),
- SND_SOC_DAPM_SUPPLY("Headphone Reference", ES8326_HP_DRIVER,
- 0, 1, NULL, 0),
- SND_SOC_DAPM_REG(snd_soc_dapm_supply, "HPOR Supply", ES8326_HP_CAL,
- ES8326_HPOR_SHIFT, 7, 7, 0),
- SND_SOC_DAPM_REG(snd_soc_dapm_supply, "HPOL Supply", ES8326_HP_CAL,
- 0, 7, 7, 0),
-
SND_SOC_DAPM_OUTPUT("HPOL"),
SND_SOC_DAPM_OUTPUT("HPOR"),
};
@@ -166,34 +148,12 @@ static const struct snd_soc_dapm_route es8326_dapm_routes[] = {
{"I2S OUT", NULL, "ADC L"},
{"I2S OUT", NULL, "ADC R"},
- {"I2S OUT", NULL, "Analog Power"},
- {"I2S OUT", NULL, "ADC Vref"},
- {"I2S OUT", NULL, "Vref Power"},
- {"I2S OUT", NULL, "IBias Power"},
- {"I2S IN", NULL, "Analog Power"},
- {"I2S IN", NULL, "DAC Vref"},
- {"I2S IN", NULL, "Vref Power"},
- {"I2S IN", NULL, "IBias Power"},
-
{"Right DAC", NULL, "I2S IN"},
{"Left DAC", NULL, "I2S IN"},
{"LHPMIX", NULL, "Left DAC"},
{"RHPMIX", NULL, "Right DAC"},
- {"HPOR", NULL, "HPOR Cal"},
- {"HPOL", NULL, "HPOL Cal"},
- {"HPOR", NULL, "HPOR Supply"},
- {"HPOL", NULL, "HPOL Supply"},
- {"HPOL", NULL, "Headphone Charge Pump"},
- {"HPOR", NULL, "Headphone Charge Pump"},
- {"HPOL", NULL, "Headphone Driver Bias"},
- {"HPOR", NULL, "Headphone Driver Bias"},
- {"HPOL", NULL, "Headphone LDO"},
- {"HPOR", NULL, "Headphone LDO"},
- {"HPOL", NULL, "Headphone Reference"},
- {"HPOR", NULL, "Headphone Reference"},
-
{"HPOL", NULL, "LHPMIX"},
{"HPOR", NULL, "RHPMIX"},
};
@@ -419,6 +379,31 @@ static int es8326_pcm_hw_params(struct snd_pcm_substream *substream,
return 0;
}
+static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction)
+{
+ struct snd_soc_component *component = dai->component;
+ struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
+
+ if (mute) {
+ regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_OFF);
+ regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE,
+ ES8326_MUTE_MASK, ES8326_MUTE);
+ regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xf0);
+ } else {
+ if (!es8326->calibrated) {
+ regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_FORCE_CAL);
+ msleep(30);
+ es8326->calibrated = true;
+ }
+ regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa0);
+ regmap_write(es8326->regmap, ES8326_HP_VOL, 0x00);
+ regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_ON);
+ regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE,
+ ES8326_MUTE_MASK, ~(ES8326_MUTE));
+ }
+ return 0;
+}
+
static int es8326_set_bias_level(struct snd_soc_component *codec,
enum snd_soc_bias_level level)
{
@@ -469,6 +454,8 @@ static const struct snd_soc_dai_ops es8326_ops = {
.hw_params = es8326_pcm_hw_params,
.set_fmt = es8326_set_dai_fmt,
.set_sysclk = es8326_set_dai_sysclk,
+ .mute_stream = es8326_mute,
+ .no_capture_mute = 1,
};
static struct snd_soc_dai_driver es8326_dai = {
@@ -691,7 +678,7 @@ static int es8326_suspend(struct snd_soc_component *component)
cancel_delayed_work_sync(&es8326->jack_detect_work);
es8326_disable_micbias(component);
-
+ es8326->calibrated = false;
regmap_write(es8326->regmap, ES8326_CLK_CTL, ES8326_CLK_OFF);
regcache_cache_only(es8326->regmap, true);
regcache_mark_dirty(es8326->regmap);
diff --git a/sound/soc/codecs/es8326.h b/sound/soc/codecs/es8326.h
index 8e5ffe5ee10da3..65ed4d1dc7da09 100644
--- a/sound/soc/codecs/es8326.h
+++ b/sound/soc/codecs/es8326.h
@@ -9,8 +9,6 @@
#ifndef _ES8326_H
#define _ES8326_H
-#define CONFIG_HHTECH_MINIPMP 1
-
/* ES8326 register space */
#define ES8326_RESET 0x00
#define ES8326_CLK_CTL 0x01
@@ -94,6 +92,8 @@
#define ES8326_PWRUP_SEQ_EN (1 << 5)
#define ES8326_CODEC_RESET (0x0f << 0)
#define ES8326_CSM_OFF (0 << 7)
+#define ES8326_MUTE_MASK (3 << 0)
+#define ES8326_MUTE (3 << 0)
/* ES8326_CLK_CTL */
#define ES8326_CLK_ON (0x7f << 0)
@@ -122,7 +122,9 @@
#define ES8326_MIC2_SEL (1 << 5)
/* ES8326_HP_CAL */
-#define ES8326_HPOR_SHIFT 4
+#define ES8326_HP_OFF 0
+#define ES8326_HP_FORCE_CAL ((1 << 7) | (1 << 3))
+#define ES8326_HP_ON ((7 << 4) | (7 << 0))
/* ES8326_ADC1_SRC */
#define ES8326_ADC1_SHIFT 0
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 03/33] ASoC: codecs: ES8326: Change Hp_detect register names
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 01/33] ASoC: codecs: ES8316: fix build warning kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 02/33] ASoC: codecs: ES8326: Add es8326_mute function kovalev
@ 2024-07-29 5:09 ` kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 04/33] ASoC: codecs: ES8326: Change Volatile Reg function kovalev
` (30 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:09 UTC (permalink / raw)
To: devel-kernel
From: Zhu Ning <zhuning0077@gmail.com>
commit 4ddad00c609bdcd6635537d3acb9bd57a5fc79e6 upstream.
The old register naming method is confusing. The reg 0x57 decides
the default headset hardware connection type, and the reg 0xfb is
the headset detection status register, which changes during headset
insertion. Change the name to ES8326_HPDET_TYPE and ES8326_HPDET_STA.
Signed-off-by: Zhu Ning <zhuning0077@gmail.com>
Link: https://lore.kernel.org/r/20230717033223.42506-1-zhuning0077@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 10 +++++-----
sound/soc/codecs/es8326.h | 12 ++++++++----
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index caee0d66ce47a8..c60cb081b5a26f 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -159,7 +159,7 @@ static const struct snd_soc_dapm_route es8326_dapm_routes[] = {
};
static const struct regmap_range es8326_volatile_ranges[] = {
- regmap_reg_range(ES8326_HP_DETECT, ES8326_HP_DETECT),
+ regmap_reg_range(ES8326_HPDET_STA, ES8326_HPDET_STA),
};
static const struct regmap_access_table es8326_volatile_table = {
@@ -519,7 +519,7 @@ static void es8326_jack_button_handler(struct work_struct *work)
return;
mutex_lock(&es8326->lock);
- iface = snd_soc_component_read(comp, ES8326_HP_DETECT);
+ iface = snd_soc_component_read(comp, ES8326_HPDET_STA);
switch (iface) {
case 0x93:
/* pause button detected */
@@ -578,7 +578,7 @@ static void es8326_jack_detect_handler(struct work_struct *work)
unsigned int iface;
mutex_lock(&es8326->lock);
- iface = snd_soc_component_read(comp, ES8326_HP_DETECT);
+ iface = snd_soc_component_read(comp, ES8326_HPDET_STA);
dev_dbg(comp->dev, "gpio flag %#04x", iface);
if ((iface & ES8326_HPINSERT_FLAG) == 0) {
/* Jack unplugged or spurious IRQ */
@@ -651,7 +651,7 @@ static int es8326_resume(struct snd_soc_component *component)
regmap_write(es8326->regmap, ES8326_ADC1_SRC, es8326->mic1_src);
regmap_write(es8326->regmap, ES8326_ADC2_SRC, es8326->mic2_src);
regmap_write(es8326->regmap, ES8326_HPJACK_TIMER, 0x88);
- regmap_write(es8326->regmap, ES8326_HP_DET,
+ regmap_write(es8326->regmap, ES8326_HPDET_TYPE,
ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol);
regmap_write(es8326->regmap, ES8326_INT_SOURCE, es8326->interrupt_src);
regmap_write(es8326->regmap, ES8326_INTOUT_IO, es8326->interrupt_clk);
@@ -743,7 +743,7 @@ static void es8326_enable_jack_detect(struct snd_soc_component *component,
mutex_lock(&es8326->lock);
if (es8326->jd_inverted)
- snd_soc_component_update_bits(component, ES8326_HP_DET,
+ snd_soc_component_update_bits(component, ES8326_HPDET_TYPE,
ES8326_HP_DET_JACK_POL, ~es8326->jack_pol);
es8326->jack = jack;
diff --git a/sound/soc/codecs/es8326.h b/sound/soc/codecs/es8326.h
index 65ed4d1dc7da09..cd04d11a88d96a 100644
--- a/sound/soc/codecs/es8326.h
+++ b/sound/soc/codecs/es8326.h
@@ -73,15 +73,19 @@
#define ES8326_DRC_RECOVERY 0x53
#define ES8326_DRC_WINSIZE 0x54
#define ES8326_HPJACK_TIMER 0x56
-#define ES8326_HP_DET 0x57
+#define ES8326_HPDET_TYPE 0x57
#define ES8326_INT_SOURCE 0x58
#define ES8326_INTOUT_IO 0x59
#define ES8326_SDINOUT1_IO 0x5A
#define ES8326_SDINOUT23_IO 0x5B
#define ES8326_JACK_PULSE 0x5C
+#define ES8326_HP_MISC 0xF7
+#define ES8326_CTIA_OMTP_STA 0xF8
#define ES8326_PULLUP_CTL 0xF9
-#define ES8326_HP_DETECT 0xFB
+#define ES8326_CSM_I2C_STA 0xFA
+#define ES8326_HPDET_STA 0xFB
+#define ES8326_CSM_MUTE_STA 0xFC
#define ES8326_CHIP_ID1 0xFD
#define ES8326_CHIP_ID2 0xFE
#define ES8326_CHIP_VERSION 0xFF
@@ -146,7 +150,7 @@
#define ES8326_ADC3_SHIFT 0
#define ES8326_ADC4_SHIFT 3
-/* ES8326_HP_DET */
+/* ES8326_HPDET_TYPE */
#define ES8326_HP_DET_SRC_PIN27 (1 << 5)
#define ES8326_HP_DET_SRC_PIN9 (1 << 4)
#define ES8326_HP_DET_JACK_POL (1 << 3)
@@ -174,7 +178,7 @@
#define ES8326_SDINOUT2_SHIFT 4
#define ES8326_SDINOUT3_SHIFT 0
-/* ES8326_HP_DETECT */
+/* ES8326_HPDET_STA */
#define ES8326_HPINSERT_FLAG (1 << 1)
#define ES8326_HPBUTTON_FLAG (1 << 0)
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 04/33] ASoC: codecs: ES8326: Change Volatile Reg function
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (2 preceding siblings ...)
2024-07-29 5:09 ` [d-kernel] [PATCH 03/33] ASoC: codecs: ES8326: Change Hp_detect register names kovalev
@ 2024-07-29 5:09 ` kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 05/33] ASoC: codecs: ES8326: Fix power-up sequence kovalev
` (29 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:09 UTC (permalink / raw)
To: devel-kernel
From: Zhu Ning <zhuning0077@gmail.com>
commit f1230a27c14b4d05e1d6af02be55c617b53728a4 upstream.
The new calibration and headphone detection function
require reading new volatile registers. Add them in
the volatile register function.
Signed-off-by: Zhu Ning <zhuning0077@gmail.com>
Link: https://lore.kernel.org/r/20230717033223.42506-2-zhuning0077@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index c60cb081b5a26f..04d7403bfe9064 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -158,20 +158,25 @@ static const struct snd_soc_dapm_route es8326_dapm_routes[] = {
{"HPOR", NULL, "RHPMIX"},
};
-static const struct regmap_range es8326_volatile_ranges[] = {
- regmap_reg_range(ES8326_HPDET_STA, ES8326_HPDET_STA),
-};
-
-static const struct regmap_access_table es8326_volatile_table = {
- .yes_ranges = es8326_volatile_ranges,
- .n_yes_ranges = ARRAY_SIZE(es8326_volatile_ranges),
-};
+static bool es8326_volatile_register(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case ES8326_HPL_OFFSET_INI:
+ case ES8326_HPR_OFFSET_INI:
+ case ES8326_HPDET_STA:
+ case ES8326_CTIA_OMTP_STA:
+ case ES8326_CSM_MUTE_STA:
+ return true;
+ default:
+ return false;
+ }
+}
static const struct regmap_config es8326_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = 0xff,
- .volatile_table = &es8326_volatile_table,
+ .volatile_reg = es8326_volatile_register,
.cache_type = REGCACHE_RBTREE,
};
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 05/33] ASoC: codecs: ES8326: Fix power-up sequence
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (3 preceding siblings ...)
2024-07-29 5:09 ` [d-kernel] [PATCH 04/33] ASoC: codecs: ES8326: Change Volatile Reg function kovalev
@ 2024-07-29 5:09 ` kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 06/33] ASOC: codecs: ES8326: Add calibration support for version_b kovalev
` (28 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:09 UTC (permalink / raw)
To: devel-kernel
From: Zhu Ning <zhuning0077@gmail.com>
commit ac20a73d765c0374f5e7b5d0f2f43c4598d69c66 upstream.
Old power-up sequence causes large pop noise during start-up.
Using a new sequence instead.
Also, the registers are now reset to default value in suspend
function.
Signed-off-by: Zhu Ning <zhuning0077@gmail.com>
Link: https://lore.kernel.org/r/20230717033223.42506-3-zhuning0077@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 95 ++++++++++++++++++++++++++++-----------
sound/soc/codecs/es8326.h | 10 ++++-
2 files changed, 77 insertions(+), 28 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 04d7403bfe9064..00ffe788bc8c6f 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -638,40 +638,77 @@ static irqreturn_t es8326_irq(int irq, void *dev_id)
static int es8326_resume(struct snd_soc_component *component)
{
struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
- unsigned int reg;
regcache_cache_only(es8326->regmap, false);
regcache_sync(es8326->regmap);
+ /* reset internal clock state */
+ regmap_write(es8326->regmap, ES8326_RESET, 0x1f);
+ regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x0E);
+ usleep_range(10000, 15000);
+ regmap_write(es8326->regmap, ES8326_HPJACK_TIMER, 0x88);
+ /* set headphone default type and detect pin */
+ regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x81);
+ regmap_write(es8326->regmap, ES8326_CLK_RESAMPLE, 0x05);
+
+ /* set internal oscillator as clock source of headpone cp */
+ regmap_write(es8326->regmap, ES8326_CLK_DIV_CPC, 0x84);
regmap_write(es8326->regmap, ES8326_CLK_CTL, ES8326_CLK_ON);
- /* Two channel ADC */
- regmap_write(es8326->regmap, ES8326_PULLUP_CTL, 0x02);
+ /* clock manager reset release */
+ regmap_write(es8326->regmap, ES8326_RESET, 0x17);
+ /* set headphone detection as half scan mode */
+ regmap_write(es8326->regmap, ES8326_HP_MISC, 0x08);
+ regmap_write(es8326->regmap, ES8326_PULLUP_CTL, 0x00);
+
+ /* enable headphone driver */
+ regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa7);
+ usleep_range(2000, 5000);
+ regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0xab);
+ usleep_range(2000, 5000);
+ regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0xbb);
+ usleep_range(2000, 5000);
+ regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa1);
+
regmap_write(es8326->regmap, ES8326_CLK_INV, 0x00);
- regmap_write(es8326->regmap, ES8326_CLK_DIV_CPC, 0x1F);
- regmap_write(es8326->regmap, ES8326_CLK_VMIDS1, 0xC8);
- regmap_write(es8326->regmap, ES8326_CLK_VMIDS2, 0x88);
- regmap_write(es8326->regmap, ES8326_CLK_CAL_TIME, 0x20);
+ regmap_write(es8326->regmap, ES8326_CLK_VMIDS1, 0xc4);
+ regmap_write(es8326->regmap, ES8326_CLK_VMIDS2, 0x81);
+ regmap_write(es8326->regmap, ES8326_CLK_CAL_TIME, 0x00);
+
+ /* turn off headphone out */
+ regmap_write(es8326->regmap, ES8326_HP_CAL, 0x00);
+ /* set ADC and DAC in low power mode */
+ regmap_write(es8326->regmap, ES8326_ANA_LP, 0xf0);
+
+ /* force micbias on */
+ regmap_write(es8326->regmap, ES8326_ANA_MICBIAS, 0x4f);
regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x08);
- regmap_write(es8326->regmap, ES8326_DAC2HPMIX, 0x22);
- regmap_write(es8326->regmap, ES8326_ADC1_SRC, es8326->mic1_src);
- regmap_write(es8326->regmap, ES8326_ADC2_SRC, es8326->mic2_src);
- regmap_write(es8326->regmap, ES8326_HPJACK_TIMER, 0x88);
- regmap_write(es8326->regmap, ES8326_HPDET_TYPE,
- ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol);
- regmap_write(es8326->regmap, ES8326_INT_SOURCE, es8326->interrupt_src);
- regmap_write(es8326->regmap, ES8326_INTOUT_IO, es8326->interrupt_clk);
+ regmap_write(es8326->regmap, ES8326_ANA_VSEL, 0x7F);
+ /* select vdda as micbias source */
+ regmap_write(es8326->regmap, ES8326_VMIDLOW, 0x23);
+ /* set dac dsmclip = 1 */
+ regmap_write(es8326->regmap, ES8326_DAC_DSM, 0x08);
+ regmap_write(es8326->regmap, ES8326_DAC_VPPSCALE, 0x15);
+
+ regmap_write(es8326->regmap, ES8326_INT_SOURCE,
+ (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
+ regmap_write(es8326->regmap, ES8326_INTOUT_IO,
+ es8326->interrupt_clk);
+ regmap_write(es8326->regmap, ES8326_SDINOUT1_IO,
+ (ES8326_IO_DMIC_CLK << ES8326_SDINOUT1_SHIFT));
+ regmap_write(es8326->regmap, ES8326_SDINOUT23_IO, ES8326_IO_INPUT);
+
+ regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x3b);
regmap_write(es8326->regmap, ES8326_RESET, ES8326_CSM_ON);
- snd_soc_component_update_bits(component, ES8326_PGAGAIN,
- ES8326_MIC_SEL_MASK, ES8326_MIC1_SEL);
-
- regmap_read(es8326->regmap, ES8326_CHIP_VERSION, ®);
- if ((reg & ES8326_VERSION_B) == 1) {
- regmap_write(es8326->regmap, ES8326_ANA_MICBIAS, 0xDD);
- regmap_write(es8326->regmap, ES8326_ANA_VSEL, 0x7F);
- regmap_write(es8326->regmap, ES8326_VMIDLOW, 0x0F);
- /* enable button detect */
- regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xA0);
- }
+ regmap_update_bits(es8326->regmap, ES8326_PGAGAIN, ES8326_MIC_SEL_MASK,
+ ES8326_MIC1_SEL);
+
+ regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE, ES8326_MUTE_MASK,
+ ES8326_MUTE);
+
+ regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x80 |
+ ((es8326->version == ES8326_VERSION_B) ?
+ (ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol) :
+ (ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol | 0x04)));
es8326_irq(es8326->irq, es8326);
return 0;
@@ -688,6 +725,10 @@ static int es8326_suspend(struct snd_soc_component *component)
regcache_cache_only(es8326->regmap, true);
regcache_mark_dirty(es8326->regmap);
+ /* reset register value to default */
+ regmap_write(es8326->regmap, ES8326_CSM_I2C_STA, 0x01);
+ usleep_range(1000, 3000);
+ regmap_write(es8326->regmap, ES8326_CSM_I2C_STA, 0x00);
return 0;
}
@@ -717,7 +758,7 @@ static int es8326_probe(struct snd_soc_component *component)
ret = device_property_read_u8(component->dev, "everest,jack-pol", &es8326->jack_pol);
if (ret != 0) {
dev_dbg(component->dev, "jack-pol return %d", ret);
- es8326->jack_pol = ES8326_HP_DET_BUTTON_POL | ES8326_HP_TYPE_OMTP;
+ es8326->jack_pol = ES8326_HP_TYPE_AUTO;
}
dev_dbg(component->dev, "jack-pol %x", es8326->jack_pol);
diff --git a/sound/soc/codecs/es8326.h b/sound/soc/codecs/es8326.h
index cd04d11a88d96a..90a08351d6acd0 100644
--- a/sound/soc/codecs/es8326.h
+++ b/sound/soc/codecs/es8326.h
@@ -160,6 +160,13 @@
#define ES8326_HP_TYPE_AUTO (1 << 0)
#define ES8326_HP_TYPE_AUTO_INV (0 << 0)
+/* ES8326_INT_SOURCE */
+#define ES8326_INT_SRC_DAC_MOZ (1 << 0)
+#define ES8326_INT_SRC_ADC_MOZ (1 << 1)
+#define ES8326_INT_SRC_BUTTON (1 << 2)
+#define ES8326_INT_SRC_PIN9 (1 << 3)
+#define ES8326_INT_SRC_PIN27 (1 << 4)
+
/* ES8326_SDINOUT1_IO */
#define ES8326_IO_INPUT (0 << 0)
#define ES8326_IO_SDIN_SLOT0 (1 << 0)
@@ -183,6 +190,7 @@
#define ES8326_HPBUTTON_FLAG (1 << 0)
/* ES8326_CHIP_VERSION 0xFF */
-#define ES8326_VERSION_B (1 << 0)
+#define ES8326_VERSION (1 << 0)
+#define ES8326_VERSION_B (3 << 0)
#endif
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 06/33] ASOC: codecs: ES8326: Add calibration support for version_b
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (4 preceding siblings ...)
2024-07-29 5:09 ` [d-kernel] [PATCH 05/33] ASoC: codecs: ES8326: Fix power-up sequence kovalev
@ 2024-07-29 5:09 ` kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 07/33] ASoC: codecs: ES8326: Update jact detection function kovalev
` (27 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:09 UTC (permalink / raw)
To: devel-kernel
From: Zhu Ning <zhuning0077@gmail.com>
commit 0663286e58e6f611f3578b5e63e1faa576d139fd upstream.
Version_b requires a new way of calibrating headset offset. A new
calibration function is added.
Signed-off-by: Zhu Ning <zhuning0077@gmail.com>
Link: https://lore.kernel.org/r/20230717033223.42506-4-zhuning0077@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 83 ++++++++++++++++++++++++++++++++-------
1 file changed, 68 insertions(+), 15 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 00ffe788bc8c6f..eda0e53a1d8e43 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -388,6 +388,7 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction)
{
struct snd_soc_component *component = dai->component;
struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
+ unsigned int offset_l, offset_r;
if (mute) {
regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_OFF);
@@ -398,10 +399,16 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction)
if (!es8326->calibrated) {
regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_FORCE_CAL);
msleep(30);
+ regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_OFF);
+ regmap_read(es8326->regmap, ES8326_HPL_OFFSET_INI, &offset_l);
+ regmap_read(es8326->regmap, ES8326_HPR_OFFSET_INI, &offset_r);
+ regmap_write(es8326->regmap, ES8326_HP_OFFSET_CAL, 0x8c);
+ regmap_write(es8326->regmap, ES8326_HPL_OFFSET_INI, offset_l);
+ regmap_write(es8326->regmap, ES8326_HPR_OFFSET_INI, offset_r);
es8326->calibrated = true;
}
regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa0);
- regmap_write(es8326->regmap, ES8326_HP_VOL, 0x00);
+ regmap_write(es8326->regmap, ES8326_HP_VOL, 0x80);
regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_ON);
regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE,
ES8326_MUTE_MASK, ~(ES8326_MUTE));
@@ -420,15 +427,17 @@ static int es8326_set_bias_level(struct snd_soc_component *codec,
ret = clk_prepare_enable(es8326->mclk);
if (ret)
return ret;
- regmap_write(es8326->regmap, ES8326_RESET, ES8326_PWRUP_SEQ_EN);
- regmap_write(es8326->regmap, ES8326_INTOUT_IO, 0x45);
+
+ regmap_write(es8326->regmap, ES8326_RESET, 0x9f);
+ msleep(20);
+ regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x00);
+ regmap_write(es8326->regmap, ES8326_INTOUT_IO, es8326->interrupt_clk);
regmap_write(es8326->regmap, ES8326_SDINOUT1_IO,
(ES8326_IO_DMIC_CLK << ES8326_SDINOUT1_SHIFT));
- regmap_write(es8326->regmap, ES8326_SDINOUT23_IO, ES8326_IO_INPUT);
- regmap_write(es8326->regmap, ES8326_CLK_RESAMPLE, 0x05);
- regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x02);
+ regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x0E);
regmap_write(es8326->regmap, ES8326_PGA_PDN, 0x40);
- regmap_write(es8326->regmap, ES8326_DAC2HPMIX, 0xAA);
+ regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x00);
+ regmap_update_bits(es8326->regmap, ES8326_CLK_CTL, 0x20, 0x20);
regmap_write(es8326->regmap, ES8326_RESET, ES8326_CSM_ON);
break;
case SND_SOC_BIAS_PREPARE:
@@ -437,15 +446,10 @@ static int es8326_set_bias_level(struct snd_soc_component *codec,
break;
case SND_SOC_BIAS_OFF:
clk_disable_unprepare(es8326->mclk);
- regmap_write(es8326->regmap, ES8326_DAC2HPMIX, 0x11);
- regmap_write(es8326->regmap, ES8326_RESET, ES8326_CSM_OFF);
- regmap_write(es8326->regmap, ES8326_PGA_PDN, 0xF8);
+ regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x3b);
regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x00);
- regmap_write(es8326->regmap, ES8326_INT_SOURCE, 0x08);
+ regmap_update_bits(es8326->regmap, ES8326_CLK_CTL, 0x20, 0x00);
regmap_write(es8326->regmap, ES8326_SDINOUT1_IO, ES8326_IO_INPUT);
- regmap_write(es8326->regmap, ES8326_SDINOUT23_IO, ES8326_IO_INPUT);
- regmap_write(es8326->regmap, ES8326_RESET,
- ES8326_CODEC_RESET | ES8326_PWRUP_SEQ_EN);
break;
}
@@ -635,6 +639,54 @@ static irqreturn_t es8326_irq(int irq, void *dev_id)
return IRQ_HANDLED;
}
+static int es8326_calibrate(struct snd_soc_component *component)
+{
+ struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
+ unsigned int reg;
+ unsigned int offset_l, offset_r;
+
+ regmap_read(es8326->regmap, ES8326_CHIP_VERSION, ®);
+ es8326->version = reg;
+
+ if ((es8326->version == ES8326_VERSION_B) && (es8326->calibrated == false)) {
+ dev_dbg(component->dev, "ES8326_VERSION_B, calibrating\n");
+ regmap_write(es8326->regmap, ES8326_CLK_INV, 0xc0);
+ regmap_write(es8326->regmap, ES8326_CLK_DIV1, 0x01);
+ regmap_write(es8326->regmap, ES8326_CLK_DLL, 0x30);
+ regmap_write(es8326->regmap, ES8326_CLK_MUX, 0xed);
+ regmap_write(es8326->regmap, ES8326_CLK_TRI, 0xc1);
+ regmap_write(es8326->regmap, ES8326_DAC_MUTE, 0x03);
+ regmap_write(es8326->regmap, ES8326_ANA_VSEL, 0x7f);
+ regmap_write(es8326->regmap, ES8326_VMIDLOW, 0x33);
+ regmap_write(es8326->regmap, ES8326_DAC2HPMIX, 0x88);
+ regmap_write(es8326->regmap, ES8326_HP_VOL, 0x80);
+ regmap_write(es8326->regmap, ES8326_HP_OFFSET_CAL, 0x8c);
+ regmap_write(es8326->regmap, ES8326_RESET, 0xc0);
+ usleep_range(15000, 20000);
+
+ regmap_write(es8326->regmap, ES8326_HP_OFFSET_CAL, ES8326_HP_OFF);
+ regmap_read(es8326->regmap, ES8326_CSM_MUTE_STA, ®);
+ if ((reg & 0xf0) != 0x40)
+ msleep(50);
+
+ regmap_write(es8326->regmap, ES8326_HP_CAL, 0xd4);
+ msleep(200);
+ regmap_write(es8326->regmap, ES8326_HP_CAL, 0x4d);
+ msleep(200);
+ regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_OFF);
+ regmap_read(es8326->regmap, ES8326_HPL_OFFSET_INI, &offset_l);
+ regmap_read(es8326->regmap, ES8326_HPR_OFFSET_INI, &offset_r);
+ regmap_write(es8326->regmap, ES8326_HP_OFFSET_CAL, 0x8c);
+ regmap_write(es8326->regmap, ES8326_HPL_OFFSET_INI, offset_l);
+ regmap_write(es8326->regmap, ES8326_HPR_OFFSET_INI, offset_r);
+ regmap_write(es8326->regmap, ES8326_CLK_INV, 0x00);
+
+ es8326->calibrated = true;
+ }
+
+ return 0;
+}
+
static int es8326_resume(struct snd_soc_component *component)
{
struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
@@ -673,7 +725,8 @@ static int es8326_resume(struct snd_soc_component *component)
regmap_write(es8326->regmap, ES8326_CLK_VMIDS1, 0xc4);
regmap_write(es8326->regmap, ES8326_CLK_VMIDS2, 0x81);
regmap_write(es8326->regmap, ES8326_CLK_CAL_TIME, 0x00);
-
+ /* calibrate for B version */
+ es8326_calibrate(component);
/* turn off headphone out */
regmap_write(es8326->regmap, ES8326_HP_CAL, 0x00);
/* set ADC and DAC in low power mode */
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 07/33] ASoC: codecs: ES8326: Update jact detection function
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (5 preceding siblings ...)
2024-07-29 5:09 ` [d-kernel] [PATCH 06/33] ASOC: codecs: ES8326: Add calibration support for version_b kovalev
@ 2024-07-29 5:09 ` kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 08/33] ASoC: codecs: ES8326: Add chip version flag kovalev
` (26 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:09 UTC (permalink / raw)
To: devel-kernel
From: Zhu Ning <zhuning0077@gmail.com>
commit 04f96c9340463aae20d2511a3d6cb0b005b07d24 upstream.
The old jack detection function only supports fixed OMTP/CTIA
hardware connection. The new one supports auto OMTP/CTIA
headset detection
Signed-off-by: Zhu Ning <zhuning0077@gmail.com>
Link: https://lore.kernel.org/r/20230717033223.42506-5-zhuning0077@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 109 +++++++++++++++++++++++++++++++-------
1 file changed, 89 insertions(+), 20 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index eda0e53a1d8e43..bee505b5fa0b68 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -41,6 +41,8 @@ struct es8326_priv {
bool calibrated;
int version;
+ int hp;
+ int jack_remove_retry;
};
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(dac_vol_tlv, -9550, 50, 0);
@@ -535,6 +537,7 @@ static void es8326_jack_button_handler(struct work_struct *work)
cur_button = SND_JACK_BTN_0;
break;
case 0x6f:
+ case 0x4b:
/* button volume up */
cur_button = SND_JACK_BTN_1;
break;
@@ -543,6 +546,7 @@ static void es8326_jack_button_handler(struct work_struct *work)
cur_button = SND_JACK_BTN_2;
break;
case 0x1e:
+ case 0xe2:
/* button released or not pressed */
cur_button = 0;
break;
@@ -552,20 +556,20 @@ static void es8326_jack_button_handler(struct work_struct *work)
if ((prev_button == cur_button) && (cur_button != 0)) {
press_count++;
- if (press_count > 10) {
- /* report a press every 500ms */
+ if (press_count > 3) {
+ /* report a press every 120ms */
snd_soc_jack_report(es8326->jack, cur_button,
SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2);
press_count = 0;
}
button_to_report = cur_button;
queue_delayed_work(system_wq, &es8326->button_press_work,
- msecs_to_jiffies(50));
+ msecs_to_jiffies(35));
} else if (prev_button != cur_button) {
/* mismatch, detect again */
prev_button = cur_button;
queue_delayed_work(system_wq, &es8326->button_press_work,
- msecs_to_jiffies(50));
+ msecs_to_jiffies(35));
} else {
/* released or no pressed */
if (button_to_report != 0) {
@@ -589,32 +593,96 @@ static void es8326_jack_detect_handler(struct work_struct *work)
mutex_lock(&es8326->lock);
iface = snd_soc_component_read(comp, ES8326_HPDET_STA);
dev_dbg(comp->dev, "gpio flag %#04x", iface);
+
+ if (es8326->jack_remove_retry == 1) {
+ if (iface & ES8326_HPINSERT_FLAG)
+ es8326->jack_remove_retry = 2;
+ else
+ es8326->jack_remove_retry = 0;
+
+ dev_dbg(comp->dev, "remove event check, set HPJACK_POL normal, cnt = %d\n",
+ es8326->jack_remove_retry);
+ /*
+ * Inverted HPJACK_POL bit to trigger one IRQ to double check HP Removal event
+ */
+ regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE,
+ ES8326_HP_DET_JACK_POL, (es8326->jd_inverted ?
+ ~es8326->jack_pol : es8326->jack_pol));
+ goto exit;
+ }
+
if ((iface & ES8326_HPINSERT_FLAG) == 0) {
/* Jack unplugged or spurious IRQ */
- dev_dbg(comp->dev, "No headset detected");
+ dev_dbg(comp->dev, "No headset detected\n");
+ es8326_disable_micbias(es8326->component);
if (es8326->jack->status & SND_JACK_HEADPHONE) {
+ dev_dbg(comp->dev, "Report hp remove event\n");
snd_soc_jack_report(es8326->jack, 0, SND_JACK_HEADSET);
- snd_soc_component_write(comp, ES8326_ADC1_SRC, es8326->mic2_src);
- es8326_disable_micbias(comp);
+ /* mute adc when mic path switch */
+ regmap_write(es8326->regmap, ES8326_ADC_SCALE, 0x33);
+ regmap_write(es8326->regmap, ES8326_ADC1_SRC, 0x44);
+ regmap_write(es8326->regmap, ES8326_ADC2_SRC, 0x66);
+ es8326->hp = 0;
+ }
+ regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01);
+ /*
+ * Inverted HPJACK_POL bit to trigger one IRQ to double check HP Removal event
+ */
+ if (es8326->jack_remove_retry == 0) {
+ es8326->jack_remove_retry = 1;
+ dev_dbg(comp->dev, "remove event check, invert HPJACK_POL, cnt = %d\n",
+ es8326->jack_remove_retry);
+ regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE,
+ ES8326_HP_DET_JACK_POL, (es8326->jd_inverted ?
+ es8326->jack_pol : ~es8326->jack_pol));
+
+ } else {
+ es8326->jack_remove_retry = 0;
}
} else if ((iface & ES8326_HPINSERT_FLAG) == ES8326_HPINSERT_FLAG) {
+ es8326->jack_remove_retry = 0;
+ if (es8326->hp == 0) {
+ dev_dbg(comp->dev, "First insert, start OMTP/CTIA type check\n");
+ /*
+ * set auto-check mode, then restart jack_detect_work after 100ms.
+ * Don't report jack status.
+ */
+ regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01);
+ usleep_range(50000, 70000);
+ regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00);
+ queue_delayed_work(system_wq, &es8326->jack_detect_work,
+ msecs_to_jiffies(100));
+ es8326->hp = 1;
+ goto exit;
+ }
if (es8326->jack->status & SND_JACK_HEADSET) {
/* detect button */
+ dev_dbg(comp->dev, "button pressed\n");
queue_delayed_work(system_wq, &es8326->button_press_work, 10);
+ goto exit;
+ }
+ if ((iface & ES8326_HPBUTTON_FLAG) == 0x01) {
+ dev_dbg(comp->dev, "Headphone detected\n");
+ snd_soc_jack_report(es8326->jack,
+ SND_JACK_HEADPHONE, SND_JACK_HEADSET);
} else {
- if ((iface & ES8326_HPBUTTON_FLAG) == 0x00) {
- dev_dbg(comp->dev, "Headset detected");
- snd_soc_jack_report(es8326->jack,
- SND_JACK_HEADSET, SND_JACK_HEADSET);
- snd_soc_component_write(comp,
- ES8326_ADC1_SRC, es8326->mic1_src);
- } else {
- dev_dbg(comp->dev, "Headphone detected");
- snd_soc_jack_report(es8326->jack,
- SND_JACK_HEADPHONE, SND_JACK_HEADSET);
- }
+ dev_dbg(comp->dev, "Headset detected\n");
+ snd_soc_jack_report(es8326->jack,
+ SND_JACK_HEADSET, SND_JACK_HEADSET);
+
+ regmap_write(es8326->regmap, ES8326_ADC_SCALE, 0x33);
+ regmap_update_bits(es8326->regmap, ES8326_PGA_PDN,
+ 0x08, 0x08);
+ regmap_update_bits(es8326->regmap, ES8326_PGAGAIN,
+ 0x80, 0x80);
+ regmap_write(es8326->regmap, ES8326_ADC1_SRC, 0x00);
+ regmap_write(es8326->regmap, ES8326_ADC2_SRC, 0x00);
+ regmap_update_bits(es8326->regmap, ES8326_PGA_PDN,
+ 0x08, 0x00);
+ usleep_range(10000, 15000);
}
}
+exit:
mutex_unlock(&es8326->lock);
}
@@ -633,7 +701,7 @@ static irqreturn_t es8326_irq(int irq, void *dev_id)
msecs_to_jiffies(10));
else
queue_delayed_work(system_wq, &es8326->jack_detect_work,
- msecs_to_jiffies(300));
+ msecs_to_jiffies(600));
out:
return IRQ_HANDLED;
@@ -763,7 +831,8 @@ static int es8326_resume(struct snd_soc_component *component)
(ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol) :
(ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol | 0x04)));
- es8326_irq(es8326->irq, es8326);
+ es8326->jack_remove_retry = 0;
+ es8326->hp = 0;
return 0;
}
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 08/33] ASoC: codecs: ES8326: Add chip version flag
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (6 preceding siblings ...)
2024-07-29 5:09 ` [d-kernel] [PATCH 07/33] ASoC: codecs: ES8326: Update jact detection function kovalev
@ 2024-07-29 5:09 ` kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 09/33] ASoC: codecs: ES8326: Changing initialisation and broadcasting kovalev
` (25 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:09 UTC (permalink / raw)
To: devel-kernel
From: Zhu Ning <zhuning0077@gmail.com>
commit ee09084fbf9fdda6bf0179bcdca52196d0cde8a1 upstream.
The new chip version requires the addition of a new clock table.
We determine which clock table to choose based on the version.
Newer versions of the chip have fewer processes to go through
in the headset detection, so the version flag is used to skip them.
Signed-off-by: Zhu Ning <zhuning0077@gmail.com>
Link: https://lore.kernel.org/r/20231101072702.91316-2-zhuning0077@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 176 +++++++++++++++++++++++---------------
1 file changed, 108 insertions(+), 68 deletions(-)
mode change 100644 => 100755 sound/soc/codecs/es8326.c
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
old mode 100644
new mode 100755
index bee505b5fa0b68..ce7dea5e91229a
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -198,77 +198,108 @@ struct _coeff_div {
/* codec hifi mclk clock divider coefficients */
/* {ratio, LRCK, MCLK, REG04, REG05, REG06, REG07, REG08, REG09, REG10, REG11} */
-static const struct _coeff_div coeff_div[] = {
- {32, 8000, 256000, 0x60, 0x00, 0x0F, 0x75, 0x0A, 0x1B, 0x1F, 0x7F},
- {32, 16000, 512000, 0x20, 0x00, 0x0D, 0x75, 0x0A, 0x1B, 0x1F, 0x3F},
- {32, 44100, 1411200, 0x00, 0x00, 0x13, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
- {32, 48000, 1536000, 0x00, 0x00, 0x13, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
- {36, 8000, 288000, 0x20, 0x00, 0x0D, 0x75, 0x0A, 0x1B, 0x23, 0x47},
- {36, 16000, 576000, 0x20, 0x00, 0x0D, 0x75, 0x0A, 0x1B, 0x23, 0x47},
- {48, 8000, 384000, 0x60, 0x02, 0x1F, 0x75, 0x0A, 0x1B, 0x1F, 0x7F},
- {48, 16000, 768000, 0x20, 0x02, 0x0F, 0x75, 0x0A, 0x1B, 0x1F, 0x3F},
- {48, 48000, 2304000, 0x00, 0x02, 0x0D, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
- {64, 8000, 512000, 0x60, 0x00, 0x0D, 0x75, 0x0A, 0x1B, 0x1F, 0x7F},
- {64, 16000, 1024000, 0x20, 0x00, 0x05, 0x75, 0x0A, 0x1B, 0x1F, 0x3F},
-
- {64, 44100, 2822400, 0x00, 0x00, 0x11, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
- {64, 48000, 3072000, 0x00, 0x00, 0x11, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
- {72, 8000, 576000, 0x20, 0x00, 0x13, 0x35, 0x0A, 0x1B, 0x23, 0x47},
- {72, 16000, 1152000, 0x20, 0x00, 0x05, 0x75, 0x0A, 0x1B, 0x23, 0x47},
- {96, 8000, 768000, 0x60, 0x02, 0x1D, 0x75, 0x0A, 0x1B, 0x1F, 0x7F},
- {96, 16000, 1536000, 0x20, 0x02, 0x0D, 0x75, 0x0A, 0x1B, 0x1F, 0x3F},
- {100, 48000, 4800000, 0x04, 0x04, 0x3F, 0x6D, 0x38, 0x08, 0x4f, 0x1f},
- {125, 48000, 6000000, 0x04, 0x04, 0x1F, 0x2D, 0x0A, 0x0A, 0x27, 0x27},
- {128, 8000, 1024000, 0x60, 0x00, 0x13, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
- {128, 16000, 2048000, 0x20, 0x00, 0x11, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
-
- {128, 44100, 5644800, 0x00, 0x00, 0x01, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
- {128, 48000, 6144000, 0x00, 0x00, 0x01, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
- {144, 8000, 1152000, 0x20, 0x00, 0x03, 0x35, 0x0A, 0x1B, 0x23, 0x47},
- {144, 16000, 2304000, 0x20, 0x00, 0x11, 0x35, 0x0A, 0x1B, 0x23, 0x47},
- {192, 8000, 1536000, 0x60, 0x02, 0x0D, 0x75, 0x0A, 0x1B, 0x1F, 0x7F},
- {192, 16000, 3072000, 0x20, 0x02, 0x05, 0x75, 0x0A, 0x1B, 0x1F, 0x3F},
- {200, 48000, 9600000, 0x04, 0x04, 0x0F, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
- {250, 48000, 12000000, 0x04, 0x04, 0x0F, 0x2D, 0x0A, 0x0A, 0x27, 0x27},
- {256, 8000, 2048000, 0x60, 0x00, 0x11, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
- {256, 16000, 4096000, 0x20, 0x00, 0x01, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
-
- {256, 44100, 11289600, 0x00, 0x00, 0x10, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
- {256, 48000, 12288000, 0x00, 0x00, 0x30, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
- {288, 8000, 2304000, 0x20, 0x00, 0x01, 0x35, 0x0A, 0x1B, 0x23, 0x47},
- {384, 8000, 3072000, 0x60, 0x02, 0x05, 0x75, 0x0A, 0x1B, 0x1F, 0x7F},
- {384, 16000, 6144000, 0x20, 0x02, 0x03, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
- {384, 48000, 18432000, 0x00, 0x02, 0x01, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
- {400, 48000, 19200000, 0x09, 0x04, 0x0f, 0x6d, 0x3a, 0x0A, 0x4F, 0x1F},
- {500, 48000, 24000000, 0x18, 0x04, 0x1F, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
- {512, 8000, 4096000, 0x60, 0x00, 0x01, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
- {512, 16000, 8192000, 0x20, 0x00, 0x10, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
-
- {512, 44100, 22579200, 0x00, 0x00, 0x00, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
- {512, 48000, 24576000, 0x00, 0x00, 0x00, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
- {768, 8000, 6144000, 0x60, 0x02, 0x11, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
- {768, 16000, 12288000, 0x20, 0x02, 0x01, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
- {800, 48000, 38400000, 0x00, 0x18, 0x13, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
- {1024, 8000, 8192000, 0x60, 0x00, 0x10, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
+static const struct _coeff_div coeff_div_v0[] = {
+ {64, 8000, 512000, 0x60, 0x01, 0x0F, 0x75, 0x0A, 0x1B, 0x1F, 0x7F},
+ {64, 16000, 1024000, 0x20, 0x00, 0x33, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
+ {64, 44100, 2822400, 0xE0, 0x00, 0x03, 0x2D, 0x4A, 0x0A, 0x1F, 0x1F},
+ {64, 48000, 3072000, 0xE0, 0x00, 0x03, 0x2D, 0x4A, 0x0A, 0x1F, 0x1F},
+ {128, 8000, 1024000, 0x60, 0x00, 0x33, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
+ {128, 16000, 2048000, 0x20, 0x00, 0x03, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
+ {128, 44100, 5644800, 0xE0, 0x01, 0x03, 0x2D, 0x4A, 0x0A, 0x1F, 0x1F},
+ {128, 48000, 6144000, 0xE0, 0x01, 0x03, 0x2D, 0x4A, 0x0A, 0x1F, 0x1F},
+
+ {192, 32000, 6144000, 0xE0, 0x02, 0x03, 0x2D, 0x4A, 0x0A, 0x1F, 0x1F},
+ {256, 8000, 2048000, 0x60, 0x00, 0x03, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
+ {256, 16000, 4096000, 0x20, 0x01, 0x03, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
+ {256, 44100, 11289600, 0xE0, 0x00, 0x30, 0x2D, 0x4A, 0x0A, 0x1F, 0x1F},
+ {256, 48000, 12288000, 0xE0, 0x00, 0x30, 0x2D, 0x4A, 0x0A, 0x1F, 0x1F},
+ {384, 32000, 12288000, 0xE0, 0x05, 0x03, 0x2D, 0x4A, 0x0A, 0x1F, 0x1F},
+ {400, 48000, 19200000, 0xE9, 0x04, 0x0F, 0x6d, 0x4A, 0x0A, 0x1F, 0x1F},
+
+ {500, 48000, 24000000, 0xF8, 0x04, 0x3F, 0x6D, 0x4A, 0x0A, 0x1F, 0x1F},
+ {512, 8000, 4096000, 0x60, 0x01, 0x03, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
+ {512, 16000, 8192000, 0x20, 0x00, 0x30, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
+ {512, 44100, 22579200, 0xE0, 0x00, 0x00, 0x2D, 0x4A, 0x0A, 0x1F, 0x1F},
+ {512, 48000, 24576000, 0xE0, 0x00, 0x00, 0x2D, 0x4A, 0x0A, 0x1F, 0x1F},
+ {768, 32000, 24576000, 0xE0, 0x02, 0x30, 0x2D, 0x4A, 0x0A, 0x1F, 0x1F},
+ {1024, 8000, 8192000, 0x60, 0x00, 0x30, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
{1024, 16000, 16384000, 0x20, 0x00, 0x00, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
- {1152, 16000, 18432000, 0x20, 0x08, 0x11, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
- {1536, 8000, 12288000, 0x60, 0x02, 0x01, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
-
- {1536, 16000, 24576000, 0x20, 0x02, 0x10, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
- {1625, 8000, 13000000, 0x0C, 0x18, 0x1F, 0x2D, 0x0A, 0x0A, 0x27, 0x27},
- {1625, 16000, 26000000, 0x0C, 0x18, 0x1F, 0x2D, 0x0A, 0x0A, 0x27, 0x27},
- {2048, 8000, 16384000, 0x60, 0x00, 0x00, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
- {2304, 8000, 18432000, 0x40, 0x02, 0x10, 0x35, 0x0A, 0x1B, 0x1F, 0x5F},
- {3072, 8000, 24576000, 0x60, 0x02, 0x10, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
- {3250, 8000, 26000000, 0x0C, 0x18, 0x0F, 0x2D, 0x0A, 0x0A, 0x27, 0x27},
+};
+static const struct _coeff_div coeff_div_v3[] = {
+ {32, 8000, 256000, 0x60, 0x00, 0x0F, 0x75, 0x8A, 0x1B, 0x1F, 0x7F},
+ {32, 16000, 512000, 0x20, 0x00, 0x0D, 0x75, 0x8A, 0x1B, 0x1F, 0x3F},
+ {32, 44100, 1411200, 0x00, 0x00, 0x13, 0x2D, 0x8A, 0x0A, 0x1F, 0x1F},
+ {32, 48000, 1536000, 0x00, 0x00, 0x13, 0x2D, 0x8A, 0x0A, 0x1F, 0x1F},
+ {36, 8000, 288000, 0x20, 0x00, 0x0D, 0x75, 0x8A, 0x1B, 0x23, 0x47},
+ {36, 16000, 576000, 0x20, 0x00, 0x0D, 0x75, 0x8A, 0x1B, 0x23, 0x47},
+ {48, 8000, 384000, 0x60, 0x02, 0x1F, 0x75, 0x8A, 0x1B, 0x1F, 0x7F},
+ {48, 16000, 768000, 0x20, 0x02, 0x0F, 0x75, 0x8A, 0x1B, 0x1F, 0x3F},
+ {48, 48000, 2304000, 0x00, 0x02, 0x0D, 0x2D, 0x8A, 0x0A, 0x1F, 0x1F},
+
+ {64, 8000, 512000, 0x60, 0x00, 0x35, 0x75, 0x8A, 0x1B, 0x1F, 0x7F},
+ {64, 16000, 1024000, 0x20, 0x00, 0x05, 0x75, 0x8A, 0x1B, 0x1F, 0x3F},
+ {64, 44100, 2822400, 0xE0, 0x00, 0x31, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
+ {64, 48000, 3072000, 0xE0, 0x00, 0x31, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
+ {72, 8000, 576000, 0x20, 0x00, 0x13, 0x35, 0x8A, 0x1B, 0x23, 0x47},
+ {72, 16000, 1152000, 0x20, 0x00, 0x05, 0x75, 0x8A, 0x1B, 0x23, 0x47},
+ {96, 8000, 768000, 0x60, 0x02, 0x1D, 0x75, 0x8A, 0x1B, 0x1F, 0x7F},
+ {96, 16000, 1536000, 0x20, 0x02, 0x0D, 0x75, 0x8A, 0x1B, 0x1F, 0x3F},
+ {100, 48000, 4800000, 0x04, 0x04, 0x3F, 0x6D, 0xB8, 0x08, 0x4f, 0x1f},
+ {125, 48000, 6000000, 0x04, 0x04, 0x1F, 0x2D, 0x8A, 0x0A, 0x27, 0x27},
+
+ {128, 8000, 1024000, 0x60, 0x00, 0x05, 0x75, 0x8A, 0x1B, 0x1F, 0x7F},
+ {128, 16000, 2048000, 0x20, 0x00, 0x31, 0x35, 0x8A, 0x1B, 0x1F, 0x3F},
+ {128, 44100, 5644800, 0xE0, 0x00, 0x01, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
+ {128, 48000, 6144000, 0xE0, 0x00, 0x01, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
+ {144, 8000, 1152000, 0x20, 0x00, 0x03, 0x35, 0x8A, 0x1B, 0x23, 0x47},
+ {144, 16000, 2304000, 0x20, 0x00, 0x11, 0x35, 0x8A, 0x1B, 0x23, 0x47},
+ {192, 8000, 1536000, 0x60, 0x02, 0x0D, 0x75, 0x8A, 0x1B, 0x1F, 0x7F},
+ {192, 32000, 6144000, 0xE0, 0x02, 0x31, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
+ {192, 16000, 3072000, 0x20, 0x02, 0x05, 0x75, 0xCA, 0x1B, 0x1F, 0x3F},
+
+ {200, 48000, 9600000, 0x04, 0x04, 0x0F, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
+ {250, 48000, 12000000, 0x04, 0x04, 0x0F, 0x2D, 0xCA, 0x0A, 0x27, 0x27},
+ {256, 8000, 2048000, 0x60, 0x00, 0x31, 0x35, 0x8A, 0x1B, 0x1F, 0x7F},
+ {256, 16000, 4096000, 0x20, 0x00, 0x01, 0x35, 0x8A, 0x1B, 0x1F, 0x3F},
+ {256, 44100, 11289600, 0xE0, 0x00, 0x30, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
+ {256, 48000, 12288000, 0xE0, 0x00, 0x30, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
+ {288, 8000, 2304000, 0x20, 0x00, 0x01, 0x35, 0x8A, 0x1B, 0x23, 0x47},
+ {384, 8000, 3072000, 0x60, 0x02, 0x05, 0x75, 0x8A, 0x1B, 0x1F, 0x7F},
+ {384, 16000, 6144000, 0x20, 0x02, 0x03, 0x35, 0x8A, 0x1B, 0x1F, 0x3F},
+ {384, 32000, 12288000, 0xE0, 0x02, 0x01, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
+ {384, 48000, 18432000, 0x00, 0x02, 0x01, 0x2D, 0x8A, 0x0A, 0x1F, 0x1F},
+
+ {400, 48000, 19200000, 0xE4, 0x04, 0x35, 0x6d, 0xCA, 0x0A, 0x1F, 0x1F},
+ {500, 48000, 24000000, 0xF8, 0x04, 0x3F, 0x6D, 0xCA, 0x0A, 0x1F, 0x1F},
+ {512, 8000, 4096000, 0x60, 0x00, 0x01, 0x35, 0x8A, 0x1B, 0x1F, 0x7F},
+ {512, 16000, 8192000, 0x20, 0x00, 0x30, 0x35, 0x8A, 0x1B, 0x1F, 0x3F},
+ {512, 44100, 22579200, 0xE0, 0x00, 0x00, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
+ {512, 48000, 24576000, 0xE0, 0x00, 0x00, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
+ {768, 8000, 6144000, 0x60, 0x02, 0x11, 0x35, 0x8A, 0x1B, 0x1F, 0x7F},
+ {768, 16000, 12288000, 0x20, 0x02, 0x01, 0x35, 0x8A, 0x1B, 0x1F, 0x3F},
+ {768, 32000, 24576000, 0xE0, 0x02, 0x30, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
+ {800, 48000, 38400000, 0x00, 0x18, 0x13, 0x2D, 0x8A, 0x0A, 0x1F, 0x1F},
+
+ {1024, 8000, 8192000, 0x60, 0x00, 0x30, 0x35, 0x8A, 0x1B, 0x1F, 0x7F},
+ {1024, 16000, 16384000, 0x20, 0x00, 0x00, 0x35, 0x8A, 0x1B, 0x1F, 0x3F},
+ {1152, 16000, 18432000, 0x20, 0x08, 0x11, 0x35, 0x8A, 0x1B, 0x1F, 0x3F},
+ {1536, 8000, 12288000, 0x60, 0x02, 0x01, 0x35, 0x8A, 0x1B, 0x1F, 0x7F},
+ {1536, 16000, 24576000, 0x20, 0x02, 0x10, 0x35, 0x8A, 0x1B, 0x1F, 0x3F},
+ {1625, 8000, 13000000, 0x0C, 0x18, 0x1F, 0x2D, 0x8A, 0x0A, 0x27, 0x27},
+ {1625, 16000, 26000000, 0x0C, 0x18, 0x1F, 0x2D, 0x8A, 0x0A, 0x27, 0x27},
+ {2048, 8000, 16384000, 0x60, 0x00, 0x00, 0x35, 0x8A, 0x1B, 0x1F, 0x7F},
+ {2304, 8000, 18432000, 0x40, 0x02, 0x10, 0x35, 0x8A, 0x1B, 0x1F, 0x5F},
+ {3072, 8000, 24576000, 0x60, 0x02, 0x10, 0x35, 0x8A, 0x1B, 0x1F, 0x7F},
+ {3250, 8000, 26000000, 0x0C, 0x18, 0x0F, 0x2D, 0x8A, 0x0A, 0x27, 0x27},
};
-static inline int get_coeff(int mclk, int rate)
+static inline int get_coeff(int mclk, int rate, int array,
+ const struct _coeff_div *coeff_div)
{
int i;
- for (i = 0; i < ARRAY_SIZE(coeff_div); i++) {
+ for (i = 0; i < array; i++) {
if (coeff_div[i].rate == rate && coeff_div[i].mclk == mclk)
return i;
}
@@ -276,6 +307,7 @@ static inline int get_coeff(int mclk, int rate)
return -EINVAL;
}
+
static int es8326_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{
@@ -333,11 +365,19 @@ static int es8326_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_component *component = dai->component;
+ const struct _coeff_div *coeff_div;
struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
u8 srate = 0;
- int coeff;
+ int coeff, array;
- coeff = get_coeff(es8326->sysclk, params_rate(params));
+ if (es8326->version == 0) {
+ coeff_div = coeff_div_v0;
+ array = ARRAY_SIZE(coeff_div_v0);
+ } else {
+ coeff_div = coeff_div_v3;
+ array = ARRAY_SIZE(coeff_div_v3);
+ }
+ coeff = get_coeff(es8326->sysclk, params_rate(params), array, coeff_div);
/* bit size */
switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S16_LE:
@@ -594,7 +634,7 @@ static void es8326_jack_detect_handler(struct work_struct *work)
iface = snd_soc_component_read(comp, ES8326_HPDET_STA);
dev_dbg(comp->dev, "gpio flag %#04x", iface);
- if (es8326->jack_remove_retry == 1) {
+ if ((es8326->jack_remove_retry == 1) && (es8326->version != ES8326_VERSION_B)) {
if (iface & ES8326_HPINSERT_FLAG)
es8326->jack_remove_retry = 2;
else
@@ -628,7 +668,7 @@ static void es8326_jack_detect_handler(struct work_struct *work)
/*
* Inverted HPJACK_POL bit to trigger one IRQ to double check HP Removal event
*/
- if (es8326->jack_remove_retry == 0) {
+ if ((es8326->jack_remove_retry == 0) && (es8326->version != ES8326_VERSION_B)) {
es8326->jack_remove_retry = 1;
dev_dbg(comp->dev, "remove event check, invert HPJACK_POL, cnt = %d\n",
es8326->jack_remove_retry);
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 09/33] ASoC: codecs: ES8326: Changing initialisation and broadcasting
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (7 preceding siblings ...)
2024-07-29 5:09 ` [d-kernel] [PATCH 08/33] ASoC: codecs: ES8326: Add chip version flag kovalev
@ 2024-07-29 5:09 ` kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 10/33] ASoC: codecs: ES8326: Changing the headset detection time kovalev
` (24 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:09 UTC (permalink / raw)
To: devel-kernel
From: Zhu Ning <zhuning0077@gmail.com>
commit fc702b2c04d778d7e3a4091ebe54a86c5d0a0d96 upstream.
New chip versions require new initialisation and playback processes.
Changing the initialisation and playback process for better results.
The old chip versions are going to work well with the new sequences.
We've tested this with version_v0 and version_v3 chips
under the new sequence and they both pass.
Signed-off-by: Zhu Ning <zhuning0077@gmail.com>
Link: https://lore.kernel.org/r/20231101072702.91316-3-zhuning0077@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 51 ++++++++++++++++++++++-----------------
1 file changed, 29 insertions(+), 22 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index ce7dea5e91229a..57c55de69f1923 100755
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -132,6 +132,11 @@ static const struct snd_soc_dapm_widget es8326_dapm_widgets[] = {
SND_SOC_DAPM_PGA("LHPMIX", ES8326_DAC2HPMIX, 7, 0, NULL, 0),
SND_SOC_DAPM_PGA("RHPMIX", ES8326_DAC2HPMIX, 3, 0, NULL, 0),
+ SND_SOC_DAPM_REG(snd_soc_dapm_supply, "HPOR Supply", ES8326_HP_CAL,
+ 4, 7, 0, 0),
+ SND_SOC_DAPM_REG(snd_soc_dapm_supply, "HPOL Supply", ES8326_HP_CAL,
+ 0, 7, 0, 0),
+
SND_SOC_DAPM_OUTPUT("HPOL"),
SND_SOC_DAPM_OUTPUT("HPOR"),
};
@@ -156,6 +161,9 @@ static const struct snd_soc_dapm_route es8326_dapm_routes[] = {
{"LHPMIX", NULL, "Left DAC"},
{"RHPMIX", NULL, "Right DAC"},
+ {"HPOR", NULL, "HPOR Supply"},
+ {"HPOL", NULL, "HPOL Supply"},
+
{"HPOL", NULL, "LHPMIX"},
{"HPOR", NULL, "RHPMIX"},
};
@@ -307,7 +315,6 @@ static inline int get_coeff(int mclk, int rate, int array,
return -EINVAL;
}
-
static int es8326_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{
@@ -449,8 +456,8 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction)
regmap_write(es8326->regmap, ES8326_HPR_OFFSET_INI, offset_r);
es8326->calibrated = true;
}
- regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa0);
- regmap_write(es8326->regmap, ES8326_HP_VOL, 0x80);
+ regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa1);
+ regmap_write(es8326->regmap, ES8326_HP_VOL, 0x91);
regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_ON);
regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE,
ES8326_MUTE_MASK, ~(ES8326_MUTE));
@@ -470,8 +477,6 @@ static int es8326_set_bias_level(struct snd_soc_component *codec,
if (ret)
return ret;
- regmap_write(es8326->regmap, ES8326_RESET, 0x9f);
- msleep(20);
regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x00);
regmap_write(es8326->regmap, ES8326_INTOUT_IO, es8326->interrupt_clk);
regmap_write(es8326->regmap, ES8326_SDINOUT1_IO,
@@ -480,19 +485,21 @@ static int es8326_set_bias_level(struct snd_soc_component *codec,
regmap_write(es8326->regmap, ES8326_PGA_PDN, 0x40);
regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x00);
regmap_update_bits(es8326->regmap, ES8326_CLK_CTL, 0x20, 0x20);
- regmap_write(es8326->regmap, ES8326_RESET, ES8326_CSM_ON);
+
+ regmap_update_bits(es8326->regmap, ES8326_RESET,
+ ES8326_CSM_ON, ES8326_CSM_ON);
break;
case SND_SOC_BIAS_PREPARE:
break;
case SND_SOC_BIAS_STANDBY:
- break;
- case SND_SOC_BIAS_OFF:
- clk_disable_unprepare(es8326->mclk);
regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x3b);
regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x00);
regmap_update_bits(es8326->regmap, ES8326_CLK_CTL, 0x20, 0x00);
regmap_write(es8326->regmap, ES8326_SDINOUT1_IO, ES8326_IO_INPUT);
break;
+ case SND_SOC_BIAS_OFF:
+ clk_disable_unprepare(es8326->mclk);
+ break;
}
return 0;
@@ -762,13 +769,15 @@ static int es8326_calibrate(struct snd_soc_component *component)
regmap_write(es8326->regmap, ES8326_CLK_DIV1, 0x01);
regmap_write(es8326->regmap, ES8326_CLK_DLL, 0x30);
regmap_write(es8326->regmap, ES8326_CLK_MUX, 0xed);
+ regmap_write(es8326->regmap, ES8326_CLK_DAC_SEL, 0x08);
regmap_write(es8326->regmap, ES8326_CLK_TRI, 0xc1);
regmap_write(es8326->regmap, ES8326_DAC_MUTE, 0x03);
regmap_write(es8326->regmap, ES8326_ANA_VSEL, 0x7f);
- regmap_write(es8326->regmap, ES8326_VMIDLOW, 0x33);
+ regmap_write(es8326->regmap, ES8326_VMIDLOW, 0x03);
regmap_write(es8326->regmap, ES8326_DAC2HPMIX, 0x88);
- regmap_write(es8326->regmap, ES8326_HP_VOL, 0x80);
+ usleep_range(15000, 20000);
regmap_write(es8326->regmap, ES8326_HP_OFFSET_CAL, 0x8c);
+ usleep_range(15000, 20000);
regmap_write(es8326->regmap, ES8326_RESET, 0xc0);
usleep_range(15000, 20000);
@@ -806,27 +815,27 @@ static int es8326_resume(struct snd_soc_component *component)
regmap_write(es8326->regmap, ES8326_RESET, 0x1f);
regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x0E);
usleep_range(10000, 15000);
- regmap_write(es8326->regmap, ES8326_HPJACK_TIMER, 0x88);
+ regmap_write(es8326->regmap, ES8326_HPJACK_TIMER, 0xe9);
+ regmap_write(es8326->regmap, ES8326_ANA_MICBIAS, 0x4b);
/* set headphone default type and detect pin */
- regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x81);
+ regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x83);
regmap_write(es8326->regmap, ES8326_CLK_RESAMPLE, 0x05);
+ regmap_write(es8326->regmap, ES8326_HP_MISC, 0x30);
/* set internal oscillator as clock source of headpone cp */
- regmap_write(es8326->regmap, ES8326_CLK_DIV_CPC, 0x84);
+ regmap_write(es8326->regmap, ES8326_CLK_DIV_CPC, 0x89);
regmap_write(es8326->regmap, ES8326_CLK_CTL, ES8326_CLK_ON);
/* clock manager reset release */
regmap_write(es8326->regmap, ES8326_RESET, 0x17);
/* set headphone detection as half scan mode */
- regmap_write(es8326->regmap, ES8326_HP_MISC, 0x08);
+ regmap_write(es8326->regmap, ES8326_HP_MISC, 0x30);
regmap_write(es8326->regmap, ES8326_PULLUP_CTL, 0x00);
/* enable headphone driver */
regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa7);
usleep_range(2000, 5000);
- regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0xab);
- usleep_range(2000, 5000);
- regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0xbb);
- usleep_range(2000, 5000);
+ regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0xa3);
+ regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0xb3);
regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa1);
regmap_write(es8326->regmap, ES8326_CLK_INV, 0x00);
@@ -840,9 +849,6 @@ static int es8326_resume(struct snd_soc_component *component)
/* set ADC and DAC in low power mode */
regmap_write(es8326->regmap, ES8326_ANA_LP, 0xf0);
- /* force micbias on */
- regmap_write(es8326->regmap, ES8326_ANA_MICBIAS, 0x4f);
- regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x08);
regmap_write(es8326->regmap, ES8326_ANA_VSEL, 0x7F);
/* select vdda as micbias source */
regmap_write(es8326->regmap, ES8326_VMIDLOW, 0x23);
@@ -870,6 +876,7 @@ static int es8326_resume(struct snd_soc_component *component)
((es8326->version == ES8326_VERSION_B) ?
(ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol) :
(ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol | 0x04)));
+ regmap_write(es8326->regmap, ES8326_HP_VOL, 0x11);
es8326->jack_remove_retry = 0;
es8326->hp = 0;
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 10/33] ASoC: codecs: ES8326: Changing the headset detection time
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (8 preceding siblings ...)
2024-07-29 5:09 ` [d-kernel] [PATCH 09/33] ASoC: codecs: ES8326: Changing initialisation and broadcasting kovalev
@ 2024-07-29 5:09 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 11/33] ASoC: codecs: ES8326: improving crosstalk performance kovalev
` (23 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:09 UTC (permalink / raw)
To: devel-kernel
From: Zhu Ning <zhuning0077@gmail.com>
commit 8a81491adbd9b25a648704c9825adaefb0c31868 upstream.
The old headset detection time is not enough for the new chip version.
An error occurs with the old detection time.According to tests,
400ms is the best detection time that does not trigger an error.
The delay time after the trigger is reduced by 300ms to
keep the whole detection time unchanged.
Signed-off-by: Zhu Ning <zhuning0077@gmail.com>
Link: https://lore.kernel.org/r/20231101072702.91316-4-zhuning0077@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 57c55de69f1923..28522a792d4b89 100755
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -691,14 +691,14 @@ static void es8326_jack_detect_handler(struct work_struct *work)
if (es8326->hp == 0) {
dev_dbg(comp->dev, "First insert, start OMTP/CTIA type check\n");
/*
- * set auto-check mode, then restart jack_detect_work after 100ms.
+ * set auto-check mode, then restart jack_detect_work after 400ms.
* Don't report jack status.
*/
regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01);
usleep_range(50000, 70000);
regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00);
queue_delayed_work(system_wq, &es8326->jack_detect_work,
- msecs_to_jiffies(100));
+ msecs_to_jiffies(400));
es8326->hp = 1;
goto exit;
}
@@ -748,7 +748,7 @@ static irqreturn_t es8326_irq(int irq, void *dev_id)
msecs_to_jiffies(10));
else
queue_delayed_work(system_wq, &es8326->jack_detect_work,
- msecs_to_jiffies(600));
+ msecs_to_jiffies(300));
out:
return IRQ_HANDLED;
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 11/33] ASoC: codecs: ES8326: improving crosstalk performance
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (9 preceding siblings ...)
2024-07-29 5:09 ` [d-kernel] [PATCH 10/33] ASoC: codecs: ES8326: Changing the headset detection time kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 12/33] ASoC: codecs: ES8326: Improving the THD+N performance kovalev
` (22 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Zhu Ning <zhuning0077@gmail.com>
commit 523d242d4309797e6b27c708fbd1463f301c199a upstream.
We change the crosstalk parameter in es8326_resume function
to improve crosstalk performance.
Adding crosstalk kcontrol to enhance the flexibility of crosstalk
debugging in machine.
Adding ES8326_DAC_CROSSTALK macro to declare the crosstalk register.
Signed-off-by: Zhu Ning <zhuning0077@gmail.com>
Link: https://msgid.link/r/20240120101240.12496-2-zhuning0077@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 82 +++++++++++++++++++++++++++++++++++++++
sound/soc/codecs/es8326.h | 1 +
2 files changed, 83 insertions(+)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 28522a792d4b89..0e3b421e36e0a8 100755
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -45,6 +45,82 @@ struct es8326_priv {
int jack_remove_retry;
};
+static int es8326_crosstalk1_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
+ unsigned int crosstalk_h, crosstalk_l;
+ unsigned int crosstalk;
+
+ regmap_read(es8326->regmap, ES8326_DAC_RAMPRATE, &crosstalk_h);
+ regmap_read(es8326->regmap, ES8326_DAC_CROSSTALK, &crosstalk_l);
+ crosstalk_h &= 0x20;
+ crosstalk_l &= 0xf0;
+ crosstalk = crosstalk_h >> 1 | crosstalk_l >> 4;
+ ucontrol->value.integer.value[0] = crosstalk;
+
+ return 0;
+}
+
+static int es8326_crosstalk1_set(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
+ unsigned int crosstalk_h, crosstalk_l;
+ unsigned int crosstalk;
+
+ crosstalk = ucontrol->value.integer.value[0];
+ regmap_read(es8326->regmap, ES8326_DAC_CROSSTALK, &crosstalk_l);
+ crosstalk_h = (crosstalk & 0x10) << 1;
+ crosstalk_l &= 0x0f;
+ crosstalk_l |= (crosstalk & 0x0f) << 4;
+ regmap_update_bits(es8326->regmap, ES8326_DAC_RAMPRATE,
+ 0x20, crosstalk_h);
+ regmap_write(es8326->regmap, ES8326_DAC_CROSSTALK, crosstalk_l);
+
+ return 0;
+}
+
+static int es8326_crosstalk2_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
+ unsigned int crosstalk_h, crosstalk_l;
+ unsigned int crosstalk;
+
+ regmap_read(es8326->regmap, ES8326_DAC_RAMPRATE, &crosstalk_h);
+ regmap_read(es8326->regmap, ES8326_DAC_CROSSTALK, &crosstalk_l);
+ crosstalk_h &= 0x10;
+ crosstalk_l &= 0x0f;
+ crosstalk = crosstalk_h | crosstalk_l;
+ ucontrol->value.integer.value[0] = crosstalk;
+
+ return 0;
+}
+
+static int es8326_crosstalk2_set(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
+ unsigned int crosstalk_h, crosstalk_l;
+ unsigned int crosstalk;
+
+ crosstalk = ucontrol->value.integer.value[0];
+ regmap_read(es8326->regmap, ES8326_DAC_CROSSTALK, &crosstalk_l);
+ crosstalk_h = crosstalk & 0x10;
+ crosstalk_l &= 0xf0;
+ crosstalk_l |= crosstalk & 0x0f;
+ regmap_update_bits(es8326->regmap, ES8326_DAC_RAMPRATE,
+ 0x10, crosstalk_h);
+ regmap_write(es8326->regmap, ES8326_DAC_CROSSTALK, crosstalk_l);
+
+ return 0;
+}
+
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(dac_vol_tlv, -9550, 50, 0);
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(adc_vol_tlv, -9550, 50, 0);
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(adc_analog_pga_tlv, 0, 300, 0);
@@ -102,6 +178,10 @@ static const struct snd_kcontrol_new es8326_snd_controls[] = {
SOC_SINGLE_TLV("ALC Capture Target Level", ES8326_ALC_LEVEL,
0, 0x0f, 0, drc_target_tlv),
+ SOC_SINGLE_EXT("CROSSTALK1", SND_SOC_NOPM, 0, 31, 0,
+ es8326_crosstalk1_get, es8326_crosstalk1_set),
+ SOC_SINGLE_EXT("CROSSTALK2", SND_SOC_NOPM, 0, 31, 0,
+ es8326_crosstalk2_get, es8326_crosstalk2_set),
};
static const struct snd_soc_dapm_widget es8326_dapm_widgets[] = {
@@ -844,6 +924,8 @@ static int es8326_resume(struct snd_soc_component *component)
regmap_write(es8326->regmap, ES8326_CLK_CAL_TIME, 0x00);
/* calibrate for B version */
es8326_calibrate(component);
+ regmap_write(es8326->regmap, ES8326_DAC_CROSSTALK, 0xaa);
+ regmap_write(es8326->regmap, ES8326_DAC_RAMPRATE, 0x00);
/* turn off headphone out */
regmap_write(es8326->regmap, ES8326_HP_CAL, 0x00);
/* set ADC and DAC in low power mode */
diff --git a/sound/soc/codecs/es8326.h b/sound/soc/codecs/es8326.h
index 90a08351d6acd0..dfef808673f4ab 100644
--- a/sound/soc/codecs/es8326.h
+++ b/sound/soc/codecs/es8326.h
@@ -72,6 +72,7 @@
#define ES8326_DAC_VOL 0x50
#define ES8326_DRC_RECOVERY 0x53
#define ES8326_DRC_WINSIZE 0x54
+#define ES8326_DAC_CROSSTALK 0x55
#define ES8326_HPJACK_TIMER 0x56
#define ES8326_HPDET_TYPE 0x57
#define ES8326_INT_SOURCE 0x58
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 12/33] ASoC: codecs: ES8326: Improving the THD+N performance
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (10 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 11/33] ASoC: codecs: ES8326: improving crosstalk performance kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 13/33] ASoC: codecs: ES8326: Minimize the pop noise on headphone kovalev
` (21 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Zhu Ning <zhuning0077@gmail.com>
commit 14a0a1ec3335ac3945a96437c35465e4a9616b88 upstream.
We update the values of some registers in the initialization
sequence in es8326_resume function to improve THD+N performance.
THD+N performance decreases if the output level on headphone is
close to full scale. So we change the register setting in
es8326_jack_detect_handler function to improve THD+N performance
if headphone pulgged. Also, the register setting should be restored
when the headset is unplugged
Signed-off-by: Zhu Ning <zhuning0077@gmail.com>
Link: https://msgid.link/r/20240120101240.12496-3-zhuning0077@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 21 +++++++++++++--------
sound/soc/codecs/es8326.h | 2 +-
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 0e3b421e36e0a8..3a57a450a1c86b 100755
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -752,6 +752,8 @@ static void es8326_jack_detect_handler(struct work_struct *work)
es8326->hp = 0;
}
regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01);
+ regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x0a);
+ regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x0f, 0x03);
/*
* Inverted HPJACK_POL bit to trigger one IRQ to double check HP Removal event
*/
@@ -777,6 +779,8 @@ static void es8326_jack_detect_handler(struct work_struct *work)
regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01);
usleep_range(50000, 70000);
regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00);
+ regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x1f);
+ regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x0f, 0x08);
queue_delayed_work(system_wq, &es8326->jack_detect_work,
msecs_to_jiffies(400));
es8326->hp = 1;
@@ -846,14 +850,14 @@ static int es8326_calibrate(struct snd_soc_component *component)
if ((es8326->version == ES8326_VERSION_B) && (es8326->calibrated == false)) {
dev_dbg(component->dev, "ES8326_VERSION_B, calibrating\n");
regmap_write(es8326->regmap, ES8326_CLK_INV, 0xc0);
- regmap_write(es8326->regmap, ES8326_CLK_DIV1, 0x01);
+ regmap_write(es8326->regmap, ES8326_CLK_DIV1, 0x03);
regmap_write(es8326->regmap, ES8326_CLK_DLL, 0x30);
regmap_write(es8326->regmap, ES8326_CLK_MUX, 0xed);
regmap_write(es8326->regmap, ES8326_CLK_DAC_SEL, 0x08);
regmap_write(es8326->regmap, ES8326_CLK_TRI, 0xc1);
regmap_write(es8326->regmap, ES8326_DAC_MUTE, 0x03);
regmap_write(es8326->regmap, ES8326_ANA_VSEL, 0x7f);
- regmap_write(es8326->regmap, ES8326_VMIDLOW, 0x03);
+ regmap_write(es8326->regmap, ES8326_VMIDLOW, 0x23);
regmap_write(es8326->regmap, ES8326_DAC2HPMIX, 0x88);
usleep_range(15000, 20000);
regmap_write(es8326->regmap, ES8326_HP_OFFSET_CAL, 0x8c);
@@ -894,13 +898,13 @@ static int es8326_resume(struct snd_soc_component *component)
/* reset internal clock state */
regmap_write(es8326->regmap, ES8326_RESET, 0x1f);
regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x0E);
+ regmap_write(es8326->regmap, ES8326_ANA_LP, 0xf0);
usleep_range(10000, 15000);
regmap_write(es8326->regmap, ES8326_HPJACK_TIMER, 0xe9);
- regmap_write(es8326->regmap, ES8326_ANA_MICBIAS, 0x4b);
+ regmap_write(es8326->regmap, ES8326_ANA_MICBIAS, 0xcb);
/* set headphone default type and detect pin */
regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x83);
regmap_write(es8326->regmap, ES8326_CLK_RESAMPLE, 0x05);
- regmap_write(es8326->regmap, ES8326_HP_MISC, 0x30);
/* set internal oscillator as clock source of headpone cp */
regmap_write(es8326->regmap, ES8326_CLK_DIV_CPC, 0x89);
@@ -908,14 +912,15 @@ static int es8326_resume(struct snd_soc_component *component)
/* clock manager reset release */
regmap_write(es8326->regmap, ES8326_RESET, 0x17);
/* set headphone detection as half scan mode */
- regmap_write(es8326->regmap, ES8326_HP_MISC, 0x30);
+ regmap_write(es8326->regmap, ES8326_HP_MISC, 0x3d);
regmap_write(es8326->regmap, ES8326_PULLUP_CTL, 0x00);
/* enable headphone driver */
+ regmap_write(es8326->regmap, ES8326_HP_VOL, 0xc4);
regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa7);
usleep_range(2000, 5000);
- regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0xa3);
- regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0xb3);
+ regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0x23);
+ regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0x33);
regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa1);
regmap_write(es8326->regmap, ES8326_CLK_INV, 0x00);
@@ -946,7 +951,7 @@ static int es8326_resume(struct snd_soc_component *component)
(ES8326_IO_DMIC_CLK << ES8326_SDINOUT1_SHIFT));
regmap_write(es8326->regmap, ES8326_SDINOUT23_IO, ES8326_IO_INPUT);
- regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x3b);
+ regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x00);
regmap_write(es8326->regmap, ES8326_RESET, ES8326_CSM_ON);
regmap_update_bits(es8326->regmap, ES8326_PGAGAIN, ES8326_MIC_SEL_MASK,
ES8326_MIC1_SEL);
diff --git a/sound/soc/codecs/es8326.h b/sound/soc/codecs/es8326.h
index dfef808673f4ab..4234bbb900c453 100644
--- a/sound/soc/codecs/es8326.h
+++ b/sound/soc/codecs/es8326.h
@@ -101,7 +101,7 @@
#define ES8326_MUTE (3 << 0)
/* ES8326_CLK_CTL */
-#define ES8326_CLK_ON (0x7f << 0)
+#define ES8326_CLK_ON (0x7e << 0)
#define ES8326_CLK_OFF (0 << 0)
/* ES8326_CLK_INV */
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 13/33] ASoC: codecs: ES8326: Minimize the pop noise on headphone
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (11 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 12/33] ASoC: codecs: ES8326: Improving the THD+N performance kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 14/33] ASoC: codecs: ES8326: fix the capture noise issue kovalev
` (20 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Zhu Ning <zhuning0077@gmail.com>
commit a3aa9255d6ccb1bff13c7c98e5d3bf10ba67f92e upstream.
We modify the register settings to minimize headphone pop noise
during ES8326 power-up and music start/stop.
Signed-off-by: Zhu Ning <zhuning0077@gmail.com>
Link: https://msgid.link/r/20240120101240.12496-5-zhuning0077@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 36 ++++++++++++++++++++----------------
1 file changed, 20 insertions(+), 16 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 3a57a450a1c86b..206f70a7ecca4b 100755
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -523,7 +523,8 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction)
regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_OFF);
regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE,
ES8326_MUTE_MASK, ES8326_MUTE);
- regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xf0);
+ regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF,
+ 0x30, 0x00);
} else {
if (!es8326->calibrated) {
regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_FORCE_CAL);
@@ -536,8 +537,13 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction)
regmap_write(es8326->regmap, ES8326_HPR_OFFSET_INI, offset_r);
es8326->calibrated = true;
}
+ regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x01);
+ usleep_range(1000, 5000);
+ regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x00);
+ usleep_range(1000, 5000);
+ regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x30, 0x20);
+ regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x30, 0x30);
regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa1);
- regmap_write(es8326->regmap, ES8326_HP_VOL, 0x91);
regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_ON);
regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE,
ES8326_MUTE_MASK, ~(ES8326_MUTE));
@@ -557,23 +563,20 @@ static int es8326_set_bias_level(struct snd_soc_component *codec,
if (ret)
return ret;
- regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x00);
+ regmap_update_bits(es8326->regmap, ES8326_RESET, 0x02, 0x02);
+ usleep_range(5000, 10000);
regmap_write(es8326->regmap, ES8326_INTOUT_IO, es8326->interrupt_clk);
regmap_write(es8326->regmap, ES8326_SDINOUT1_IO,
(ES8326_IO_DMIC_CLK << ES8326_SDINOUT1_SHIFT));
- regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x0E);
regmap_write(es8326->regmap, ES8326_PGA_PDN, 0x40);
regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x00);
regmap_update_bits(es8326->regmap, ES8326_CLK_CTL, 0x20, 0x20);
-
- regmap_update_bits(es8326->regmap, ES8326_RESET,
- ES8326_CSM_ON, ES8326_CSM_ON);
+ regmap_update_bits(es8326->regmap, ES8326_RESET, 0x02, 0x00);
break;
case SND_SOC_BIAS_PREPARE:
break;
case SND_SOC_BIAS_STANDBY:
regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x3b);
- regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x00);
regmap_update_bits(es8326->regmap, ES8326_CLK_CTL, 0x20, 0x00);
regmap_write(es8326->regmap, ES8326_SDINOUT1_IO, ES8326_IO_INPUT);
break;
@@ -777,6 +780,7 @@ static void es8326_jack_detect_handler(struct work_struct *work)
* Don't report jack status.
*/
regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01);
+ es8326_enable_micbias(es8326->component);
usleep_range(50000, 70000);
regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00);
regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x1f);
@@ -820,13 +824,10 @@ static void es8326_jack_detect_handler(struct work_struct *work)
static irqreturn_t es8326_irq(int irq, void *dev_id)
{
struct es8326_priv *es8326 = dev_id;
- struct snd_soc_component *comp = es8326->component;
if (!es8326->jack)
goto out;
- es8326_enable_micbias(comp);
-
if (es8326->jack->status & SND_JACK_HEADSET)
queue_delayed_work(system_wq, &es8326->jack_detect_work,
msecs_to_jiffies(10));
@@ -943,6 +944,14 @@ static int es8326_resume(struct snd_soc_component *component)
regmap_write(es8326->regmap, ES8326_DAC_DSM, 0x08);
regmap_write(es8326->regmap, ES8326_DAC_VPPSCALE, 0x15);
+ regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x80 |
+ ((es8326->version == ES8326_VERSION_B) ?
+ (ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol) :
+ (ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol | 0x04)));
+ usleep_range(5000, 10000);
+ es8326_enable_micbias(es8326->component);
+ usleep_range(50000, 70000);
+ regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00);
regmap_write(es8326->regmap, ES8326_INT_SOURCE,
(ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
regmap_write(es8326->regmap, ES8326_INTOUT_IO,
@@ -959,11 +968,6 @@ static int es8326_resume(struct snd_soc_component *component)
regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE, ES8326_MUTE_MASK,
ES8326_MUTE);
- regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x80 |
- ((es8326->version == ES8326_VERSION_B) ?
- (ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol) :
- (ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol | 0x04)));
- regmap_write(es8326->regmap, ES8326_HP_VOL, 0x11);
es8326->jack_remove_retry = 0;
es8326->hp = 0;
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 14/33] ASoC: codecs: ES8326: fix the capture noise issue
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (12 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 13/33] ASoC: codecs: ES8326: Minimize the pop noise on headphone kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 15/33] ASoC: codecs: ES8326: Remove executable bit kovalev
` (19 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Zhu Ning <zhuning0077@gmail.com>
commit 8c99a0a607b5e0cf6b79b283d7bb2c2b84e01da5 upstream.
We get a noise issue during the startup of recording. We update the
register setting and dapm widgets to fix this issue.
we change callback type of es8326_mute function to mute_stream.
ES8326_ADC_MUTE is moved to es8326_mute function so it can
be turned on at last and turned off at first.
Signed-off-by: Zhu Ning <zhuning0077@gmail.com>
Link: https://msgid.link/r/20240120101240.12496-6-zhuning0077@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 63 ++++++++++++++++++++-------------------
1 file changed, 32 insertions(+), 31 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 206f70a7ecca4b..92047b3c3bac36 100755
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -197,12 +197,6 @@ static const struct snd_soc_dapm_widget es8326_dapm_widgets[] = {
SND_SOC_DAPM_AIF_OUT("I2S OUT", "I2S1 Capture", 0, SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_AIF_IN("I2S IN", "I2S1 Playback", 0, SND_SOC_NOPM, 0, 0),
- /* ADC Digital Mute */
- SND_SOC_DAPM_PGA("ADC L1", ES8326_ADC_MUTE, 0, 1, NULL, 0),
- SND_SOC_DAPM_PGA("ADC R1", ES8326_ADC_MUTE, 1, 1, NULL, 0),
- SND_SOC_DAPM_PGA("ADC L2", ES8326_ADC_MUTE, 2, 1, NULL, 0),
- SND_SOC_DAPM_PGA("ADC R2", ES8326_ADC_MUTE, 3, 1, NULL, 0),
-
/* Analog Power Supply*/
SND_SOC_DAPM_DAC("Right DAC", NULL, ES8326_ANA_PDN, 0, 1),
SND_SOC_DAPM_DAC("Left DAC", NULL, ES8326_ANA_PDN, 1, 1),
@@ -222,15 +216,10 @@ static const struct snd_soc_dapm_widget es8326_dapm_widgets[] = {
};
static const struct snd_soc_dapm_route es8326_dapm_routes[] = {
- {"ADC L1", NULL, "MIC1"},
- {"ADC R1", NULL, "MIC2"},
- {"ADC L2", NULL, "MIC3"},
- {"ADC R2", NULL, "MIC4"},
-
- {"ADC L", NULL, "ADC L1"},
- {"ADC R", NULL, "ADC R1"},
- {"ADC L", NULL, "ADC L2"},
- {"ADC R", NULL, "ADC R2"},
+ {"ADC L", NULL, "MIC1"},
+ {"ADC R", NULL, "MIC2"},
+ {"ADC L", NULL, "MIC3"},
+ {"ADC R", NULL, "MIC4"},
{"I2S OUT", NULL, "ADC L"},
{"I2S OUT", NULL, "ADC R"},
@@ -520,11 +509,16 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction)
unsigned int offset_l, offset_r;
if (mute) {
- regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_OFF);
- regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE,
- ES8326_MUTE_MASK, ES8326_MUTE);
- regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF,
- 0x30, 0x00);
+ if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_OFF);
+ regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE,
+ ES8326_MUTE_MASK, ES8326_MUTE);
+ regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF,
+ 0x30, 0x00);
+ } else {
+ regmap_update_bits(es8326->regmap, ES8326_ADC_MUTE,
+ 0x0F, 0x0F);
+ }
} else {
if (!es8326->calibrated) {
regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_FORCE_CAL);
@@ -537,16 +531,22 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction)
regmap_write(es8326->regmap, ES8326_HPR_OFFSET_INI, offset_r);
es8326->calibrated = true;
}
- regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x01);
- usleep_range(1000, 5000);
- regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x00);
- usleep_range(1000, 5000);
- regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x30, 0x20);
- regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x30, 0x30);
- regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa1);
- regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_ON);
- regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE,
- ES8326_MUTE_MASK, ~(ES8326_MUTE));
+ if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x01);
+ usleep_range(1000, 5000);
+ regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x00);
+ usleep_range(1000, 5000);
+ regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x30, 0x20);
+ regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x30, 0x30);
+ regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa1);
+ regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_ON);
+ regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE,
+ ES8326_MUTE_MASK, ~(ES8326_MUTE));
+ } else {
+ msleep(300);
+ regmap_update_bits(es8326->regmap, ES8326_ADC_MUTE,
+ 0x0F, 0x00);
+ }
}
return 0;
}
@@ -596,7 +596,7 @@ static const struct snd_soc_dai_ops es8326_ops = {
.set_fmt = es8326_set_dai_fmt,
.set_sysclk = es8326_set_dai_sysclk,
.mute_stream = es8326_mute,
- .no_capture_mute = 1,
+ .no_capture_mute = 0,
};
static struct snd_soc_dai_driver es8326_dai = {
@@ -968,6 +968,7 @@ static int es8326_resume(struct snd_soc_component *component)
regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE, ES8326_MUTE_MASK,
ES8326_MUTE);
+ regmap_write(es8326->regmap, ES8326_ADC_MUTE, 0x0f);
es8326->jack_remove_retry = 0;
es8326->hp = 0;
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 15/33] ASoC: codecs: ES8326: Remove executable bit
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (13 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 14/33] ASoC: codecs: ES8326: fix the capture noise issue kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 16/33] ASoC: codecs: ES8326: Adding new volume kcontrols kovalev
` (18 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Fei Shao <fshao@chromium.org>
commit 92c02d74ba7b7cdf3887ed56bc9af38c3ee17a8b upstream.
Remove the executable bit that was unintentionally turned on.
Fixes: ee09084fbf9f ("ASoC: codecs: ES8326: Add chip version flag")
Signed-off-by: Fei Shao <fshao@chromium.org>
Link: https://msgid.link/r/20240122062055.1673597-1-fshao@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 0
1 file changed, 0 insertions(+), 0 deletions(-)
mode change 100755 => 100644 sound/soc/codecs/es8326.c
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
old mode 100755
new mode 100644
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 16/33] ASoC: codecs: ES8326: Adding new volume kcontrols
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (14 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 15/33] ASoC: codecs: ES8326: Remove executable bit kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 17/33] ASoC: codecs: ES8326: Changing members of private structure kovalev
` (17 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Zhu Ning <zhuning0077@gmail.com>
commit 966323dd9a65dde599f59176280468a0cb04c875 upstream.
ES8326 features a headphone volume control register and four DAC
volume control registers.
We add new volume Kcontrols for these registers to enhance the
configurability of the volume settings, providing users with
greater flexibility.
Signed-off-by: Zhu Ning <zhuning0077@gmail.com>
Link: https://msgid.link/r/20240124064806.30511-2-zhuning0077@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 92 ++++++++++++++++++++++++++++++++++++++-
sound/soc/codecs/es8326.h | 5 ++-
2 files changed, 95 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 92047b3c3bac36..6effbe3d31ddf1 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -36,6 +36,8 @@ struct es8326_priv {
u8 jack_pol;
u8 interrupt_src;
u8 interrupt_clk;
+ u8 hpl_vol;
+ u8 hpr_vol;
bool jd_inverted;
unsigned int sysclk;
@@ -121,6 +123,72 @@ static int es8326_crosstalk2_set(struct snd_kcontrol *kcontrol,
return 0;
}
+static int es8326_hplvol_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
+
+ ucontrol->value.integer.value[0] = es8326->hpl_vol;
+
+ return 0;
+}
+
+static int es8326_hplvol_set(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
+ unsigned int hp_vol;
+
+ hp_vol = ucontrol->value.integer.value[0];
+ if (hp_vol > 5)
+ return -EINVAL;
+ if (es8326->hpl_vol != hp_vol) {
+ es8326->hpl_vol = hp_vol;
+ if (hp_vol >= 3)
+ hp_vol++;
+ regmap_update_bits(es8326->regmap, ES8326_HP_VOL,
+ 0x70, (hp_vol << 4));
+ return 1;
+ }
+
+ return 0;
+}
+
+static int es8326_hprvol_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
+
+ ucontrol->value.integer.value[0] = es8326->hpr_vol;
+
+ return 0;
+}
+
+static int es8326_hprvol_set(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
+ unsigned int hp_vol;
+
+ hp_vol = ucontrol->value.integer.value[0];
+ if (hp_vol > 5)
+ return -EINVAL;
+ if (es8326->hpr_vol != hp_vol) {
+ es8326->hpr_vol = hp_vol;
+ if (hp_vol >= 3)
+ hp_vol++;
+ regmap_update_bits(es8326->regmap, ES8326_HP_VOL,
+ 0x07, hp_vol);
+ return 1;
+ }
+
+ return 0;
+}
+
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(dac_vol_tlv, -9550, 50, 0);
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(adc_vol_tlv, -9550, 50, 0);
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(adc_analog_pga_tlv, 0, 300, 0);
@@ -151,15 +219,24 @@ static const char *const winsize[] = {
static const char *const dacpol_txt[] = {
"Normal", "R Invert", "L Invert", "L + R Invert" };
+static const char *const hp_spkvol_switch[] = {
+ "HPVOL: HPL+HPL, SPKVOL: HPL+HPL",
+ "HPVOL: HPL+HPR, SPKVOL: HPL+HPR",
+ "HPVOL: HPL+HPL, SPKVOL: SPKL+SPKR",
+ "HPVOL: HPL+HPR, SPKVOL: SPKL+SPKR",
+};
+
static const struct soc_enum dacpol =
SOC_ENUM_SINGLE(ES8326_DAC_DSM, 4, 4, dacpol_txt);
static const struct soc_enum alc_winsize =
SOC_ENUM_SINGLE(ES8326_ADC_RAMPRATE, 4, 16, winsize);
static const struct soc_enum drc_winsize =
SOC_ENUM_SINGLE(ES8326_DRC_WINSIZE, 4, 16, winsize);
+static const struct soc_enum hpvol_spkvol_switch =
+ SOC_ENUM_SINGLE(ES8326_HP_MISC, 6, 4, hp_spkvol_switch);
static const struct snd_kcontrol_new es8326_snd_controls[] = {
- SOC_SINGLE_TLV("DAC Playback Volume", ES8326_DAC_VOL, 0, 0xbf, 0, dac_vol_tlv),
+ SOC_SINGLE_TLV("DAC Playback Volume", ES8326_DACL_VOL, 0, 0xbf, 0, dac_vol_tlv),
SOC_ENUM("Playback Polarity", dacpol),
SOC_SINGLE_TLV("DAC Ramp Rate", ES8326_DAC_RAMPRATE, 0, 0x0f, 0, softramp_rate),
SOC_SINGLE_TLV("DRC Recovery Level", ES8326_DRC_RECOVERY, 0, 4, 0, drc_recovery_tlv),
@@ -182,6 +259,17 @@ static const struct snd_kcontrol_new es8326_snd_controls[] = {
es8326_crosstalk1_get, es8326_crosstalk1_set),
SOC_SINGLE_EXT("CROSSTALK2", SND_SOC_NOPM, 0, 31, 0,
es8326_crosstalk2_get, es8326_crosstalk2_set),
+ SOC_SINGLE_EXT("HPL Volume", SND_SOC_NOPM, 0, 5, 0,
+ es8326_hplvol_get, es8326_hplvol_set),
+ SOC_SINGLE_EXT("HPR Volume", SND_SOC_NOPM, 0, 5, 0,
+ es8326_hprvol_get, es8326_hprvol_set),
+
+ SOC_SINGLE_TLV("HPL Playback Volume", ES8326_DACL_VOL, 0, 0xbf, 0, dac_vol_tlv),
+ SOC_SINGLE_TLV("HPR Playback Volume", ES8326_DACR_VOL, 0, 0xbf, 0, dac_vol_tlv),
+ SOC_SINGLE_TLV("SPKL Playback Volume", ES8326_SPKL_VOL, 0, 0xbf, 0, dac_vol_tlv),
+ SOC_SINGLE_TLV("SPKR Playback Volume", ES8326_SPKR_VOL, 0, 0xbf, 0, dac_vol_tlv),
+
+ SOC_ENUM("HPVol SPKVol Switch", hpvol_spkvol_switch),
};
static const struct snd_soc_dapm_widget es8326_dapm_widgets[] = {
@@ -972,6 +1060,8 @@ static int es8326_resume(struct snd_soc_component *component)
es8326->jack_remove_retry = 0;
es8326->hp = 0;
+ es8326->hpl_vol = 0x03;
+ es8326->hpr_vol = 0x03;
return 0;
}
diff --git a/sound/soc/codecs/es8326.h b/sound/soc/codecs/es8326.h
index 4234bbb900c453..ee12caef810532 100644
--- a/sound/soc/codecs/es8326.h
+++ b/sound/soc/codecs/es8326.h
@@ -69,7 +69,7 @@
#define ES8326_DAC_DSM 0x4D
#define ES8326_DAC_RAMPRATE 0x4E
#define ES8326_DAC_VPPSCALE 0x4F
-#define ES8326_DAC_VOL 0x50
+#define ES8326_DACL_VOL 0x50
#define ES8326_DRC_RECOVERY 0x53
#define ES8326_DRC_WINSIZE 0x54
#define ES8326_DAC_CROSSTALK 0x55
@@ -81,6 +81,9 @@
#define ES8326_SDINOUT23_IO 0x5B
#define ES8326_JACK_PULSE 0x5C
+#define ES8326_DACR_VOL 0xF4
+#define ES8326_SPKL_VOL 0xF5
+#define ES8326_SPKR_VOL 0xF6
#define ES8326_HP_MISC 0xF7
#define ES8326_CTIA_OMTP_STA 0xF8
#define ES8326_PULLUP_CTL 0xF9
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 17/33] ASoC: codecs: ES8326: Changing members of private structure
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (15 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 16/33] ASoC: codecs: ES8326: Adding new volume kcontrols kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 18/33] ASoC: codecs: ES8326: Reducing power consumption kovalev
` (16 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Zhang Yi <zhangyi@everest-semi.com>
commit bb6983847fb4535bb0386a91dd523088ece36450 upstream.
We don't use mic1_src and mic2_src.so we delete these two members.
We changed the default value of interrupt-clk for headphone detection
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://msgid.link/r/20240307051222.24010-2-zhangyi@everest-semi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 6effbe3d31ddf1..ff8be490783ed1 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -31,8 +31,6 @@ struct es8326_priv {
* while enabling or disabling or during an irq.
*/
struct mutex lock;
- u8 mic1_src;
- u8 mic2_src;
u8 jack_pol;
u8 interrupt_src;
u8 interrupt_clk;
@@ -1092,20 +1090,6 @@ static int es8326_probe(struct snd_soc_component *component)
es8326->jd_inverted = device_property_read_bool(component->dev,
"everest,jack-detect-inverted");
- ret = device_property_read_u8(component->dev, "everest,mic1-src", &es8326->mic1_src);
- if (ret != 0) {
- dev_dbg(component->dev, "mic1-src return %d", ret);
- es8326->mic1_src = ES8326_ADC_AMIC;
- }
- dev_dbg(component->dev, "mic1-src %x", es8326->mic1_src);
-
- ret = device_property_read_u8(component->dev, "everest,mic2-src", &es8326->mic2_src);
- if (ret != 0) {
- dev_dbg(component->dev, "mic2-src return %d", ret);
- es8326->mic2_src = ES8326_ADC_DMIC;
- }
- dev_dbg(component->dev, "mic2-src %x", es8326->mic2_src);
-
ret = device_property_read_u8(component->dev, "everest,jack-pol", &es8326->jack_pol);
if (ret != 0) {
dev_dbg(component->dev, "jack-pol return %d", ret);
@@ -1125,7 +1109,7 @@ static int es8326_probe(struct snd_soc_component *component)
&es8326->interrupt_clk);
if (ret != 0) {
dev_dbg(component->dev, "interrupt-clk return %d", ret);
- es8326->interrupt_clk = 0x45;
+ es8326->interrupt_clk = 0x00;
}
dev_dbg(component->dev, "interrupt-clk %x", es8326->interrupt_clk);
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 18/33] ASoC: codecs: ES8326: Reducing power consumption
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (16 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 17/33] ASoC: codecs: ES8326: Changing members of private structure kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 19/33] ASoC: codecs: ES8326: Delete unused REG_SUPPLY kovalev
` (15 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Zhang Yi <zhangyi@everest-semi.com>
commit 39938bb1bb23fd70f1c75ce9f52d92185403b89a upstream.
For lower power consumption during hibernation, the configuration of
es8326_suspend and es8326_remove will be adjusted.
Adding es8326_i2c_shutdown and es8326_i2c_remove to cover different
situations
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://msgid.link/r/20240320083012.4282-2-zhangyi@everest-semi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index ff8be490783ed1..16ea423b10bc01 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -1072,12 +1072,13 @@ static int es8326_suspend(struct snd_soc_component *component)
es8326->calibrated = false;
regmap_write(es8326->regmap, ES8326_CLK_CTL, ES8326_CLK_OFF);
regcache_cache_only(es8326->regmap, true);
- regcache_mark_dirty(es8326->regmap);
/* reset register value to default */
regmap_write(es8326->regmap, ES8326_CSM_I2C_STA, 0x01);
usleep_range(1000, 3000);
regmap_write(es8326->regmap, ES8326_CSM_I2C_STA, 0x00);
+
+ regcache_mark_dirty(es8326->regmap);
return 0;
}
@@ -1163,8 +1164,13 @@ static int es8326_set_jack(struct snd_soc_component *component,
static void es8326_remove(struct snd_soc_component *component)
{
+ struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
+
es8326_disable_jack_detect(component);
es8326_set_bias_level(component, SND_SOC_BIAS_OFF);
+ regmap_write(es8326->regmap, ES8326_CSM_I2C_STA, 0x01);
+ usleep_range(1000, 3000);
+ regmap_write(es8326->regmap, ES8326_CSM_I2C_STA, 0x00);
}
static const struct snd_soc_component_driver soc_component_dev_es8326 = {
@@ -1237,6 +1243,29 @@ static int es8326_i2c_probe(struct i2c_client *i2c,
&es8326_dai, 1);
}
+
+static void es8326_i2c_shutdown(struct i2c_client *i2c)
+{
+ struct snd_soc_component *component;
+ struct es8326_priv *es8326;
+
+ es8326 = i2c_get_clientdata(i2c);
+ component = es8326->component;
+ dev_dbg(component->dev, "Enter into %s\n", __func__);
+ cancel_delayed_work_sync(&es8326->jack_detect_work);
+ cancel_delayed_work_sync(&es8326->button_press_work);
+
+ regmap_write(es8326->regmap, ES8326_CSM_I2C_STA, 0x01);
+ usleep_range(1000, 3000);
+ regmap_write(es8326->regmap, ES8326_CSM_I2C_STA, 0x00);
+
+}
+
+static void es8326_i2c_remove(struct i2c_client *i2c)
+{
+ es8326_i2c_shutdown(i2c);
+}
+
static const struct i2c_device_id es8326_i2c_id[] = {
{"es8326", 0 },
{}
@@ -1266,6 +1295,8 @@ static struct i2c_driver es8326_i2c_driver = {
.of_match_table = of_match_ptr(es8326_of_match),
},
.probe = es8326_i2c_probe,
+ .shutdown = es8326_i2c_shutdown,
+ .remove = es8326_i2c_remove,
.id_table = es8326_i2c_id,
};
module_i2c_driver(es8326_i2c_driver);
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 19/33] ASoC: codecs: ES8326: Delete unused REG_SUPPLY
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (17 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 18/33] ASoC: codecs: ES8326: Reducing power consumption kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 20/33] ASoC: codecs: ES8326: Solve error interruption issue kovalev
` (14 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Zhang Yi <zhangyi@everest-semi.com>
commit e6913c6ef83c80aa7569c9e08204542222fbf542 upstream.
REG_SUPPLY mutes the DAC when switching between
HDMI and speaker, so remove it to fix the mute issues
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://msgid.link/r/20240320083012.4282-3-zhangyi@everest-semi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 16ea423b10bc01..93e42777b4a87f 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -292,11 +292,6 @@ static const struct snd_soc_dapm_widget es8326_dapm_widgets[] = {
SND_SOC_DAPM_PGA("LHPMIX", ES8326_DAC2HPMIX, 7, 0, NULL, 0),
SND_SOC_DAPM_PGA("RHPMIX", ES8326_DAC2HPMIX, 3, 0, NULL, 0),
- SND_SOC_DAPM_REG(snd_soc_dapm_supply, "HPOR Supply", ES8326_HP_CAL,
- 4, 7, 0, 0),
- SND_SOC_DAPM_REG(snd_soc_dapm_supply, "HPOL Supply", ES8326_HP_CAL,
- 0, 7, 0, 0),
-
SND_SOC_DAPM_OUTPUT("HPOL"),
SND_SOC_DAPM_OUTPUT("HPOR"),
};
@@ -316,9 +311,6 @@ static const struct snd_soc_dapm_route es8326_dapm_routes[] = {
{"LHPMIX", NULL, "Left DAC"},
{"RHPMIX", NULL, "Right DAC"},
- {"HPOR", NULL, "HPOR Supply"},
- {"HPOL", NULL, "HPOL Supply"},
-
{"HPOL", NULL, "LHPMIX"},
{"HPOR", NULL, "RHPMIX"},
};
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 20/33] ASoC: codecs: ES8326: Solve error interruption issue
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (18 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 19/33] ASoC: codecs: ES8326: Delete unused REG_SUPPLY kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 21/33] ASoC: codecs: ES8326: modify clock table kovalev
` (13 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Zhang Yi <zhangyi@everest-semi.com>
commit 8a655cee6c9d4588570ad0cb099c5660f9a44a12 upstream.
We got an error report about headphone type detection and button detection.
We fixed the headphone type detection error by adjusting the debounce timer
configuration. And we fixed the button detection error by disabling the
button detection feature when the headphone are unplugged and enabling it
when headphone are plugged in.
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://msgid.link/r/20240402062043.20608-2-zhangyi@everest-semi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 93e42777b4a87f..4f6f2e3aeced83 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -835,6 +835,7 @@ static void es8326_jack_detect_handler(struct work_struct *work)
regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01);
regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x0a);
regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x0f, 0x03);
+ regmap_write(es8326->regmap, ES8326_INT_SOURCE, ES8326_INT_SRC_PIN9);
/*
* Inverted HPJACK_POL bit to trigger one IRQ to double check HP Removal event
*/
@@ -857,6 +858,8 @@ static void es8326_jack_detect_handler(struct work_struct *work)
* set auto-check mode, then restart jack_detect_work after 400ms.
* Don't report jack status.
*/
+ regmap_write(es8326->regmap, ES8326_INT_SOURCE,
+ (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01);
es8326_enable_micbias(es8326->component);
usleep_range(50000, 70000);
@@ -979,7 +982,7 @@ static int es8326_resume(struct snd_soc_component *component)
regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x0E);
regmap_write(es8326->regmap, ES8326_ANA_LP, 0xf0);
usleep_range(10000, 15000);
- regmap_write(es8326->regmap, ES8326_HPJACK_TIMER, 0xe9);
+ regmap_write(es8326->regmap, ES8326_HPJACK_TIMER, 0xd9);
regmap_write(es8326->regmap, ES8326_ANA_MICBIAS, 0xcb);
/* set headphone default type and detect pin */
regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x83);
@@ -1030,8 +1033,7 @@ static int es8326_resume(struct snd_soc_component *component)
es8326_enable_micbias(es8326->component);
usleep_range(50000, 70000);
regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00);
- regmap_write(es8326->regmap, ES8326_INT_SOURCE,
- (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
+ regmap_write(es8326->regmap, ES8326_INT_SOURCE, ES8326_INT_SRC_PIN9);
regmap_write(es8326->regmap, ES8326_INTOUT_IO,
es8326->interrupt_clk);
regmap_write(es8326->regmap, ES8326_SDINOUT1_IO,
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 21/33] ASoC: codecs: ES8326: modify clock table
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (19 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 20/33] ASoC: codecs: ES8326: Solve error interruption issue kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 22/33] ASoC: codecs: ES8326: Solve a headphone detection issue after suspend and resume kovalev
` (12 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Zhang Yi <zhangyi@everest-semi.com>
commit 4581468d071b64a2e3c2ae333fff82dc0391a306 upstream.
We got a digital microphone feature issue. And we fixed it by modifying
the clock table. Also, we changed the marco ES8326_CLK_ON declaration
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://msgid.link/r/20240402062043.20608-3-zhangyi@everest-semi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 22 +++++++++++-----------
sound/soc/codecs/es8326.h | 2 +-
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 4f6f2e3aeced83..228822726fb799 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -404,9 +404,9 @@ static const struct _coeff_div coeff_div_v3[] = {
{125, 48000, 6000000, 0x04, 0x04, 0x1F, 0x2D, 0x8A, 0x0A, 0x27, 0x27},
{128, 8000, 1024000, 0x60, 0x00, 0x05, 0x75, 0x8A, 0x1B, 0x1F, 0x7F},
- {128, 16000, 2048000, 0x20, 0x00, 0x31, 0x35, 0x8A, 0x1B, 0x1F, 0x3F},
- {128, 44100, 5644800, 0xE0, 0x00, 0x01, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
- {128, 48000, 6144000, 0xE0, 0x00, 0x01, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
+ {128, 16000, 2048000, 0x20, 0x00, 0x31, 0x35, 0x08, 0x19, 0x1F, 0x3F},
+ {128, 44100, 5644800, 0xE0, 0x00, 0x01, 0x2D, 0x48, 0x08, 0x1F, 0x1F},
+ {128, 48000, 6144000, 0xE0, 0x00, 0x01, 0x2D, 0x48, 0x08, 0x1F, 0x1F},
{144, 8000, 1152000, 0x20, 0x00, 0x03, 0x35, 0x8A, 0x1B, 0x23, 0x47},
{144, 16000, 2304000, 0x20, 0x00, 0x11, 0x35, 0x8A, 0x1B, 0x23, 0x47},
{192, 8000, 1536000, 0x60, 0x02, 0x0D, 0x75, 0x8A, 0x1B, 0x1F, 0x7F},
@@ -415,10 +415,10 @@ static const struct _coeff_div coeff_div_v3[] = {
{200, 48000, 9600000, 0x04, 0x04, 0x0F, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
{250, 48000, 12000000, 0x04, 0x04, 0x0F, 0x2D, 0xCA, 0x0A, 0x27, 0x27},
- {256, 8000, 2048000, 0x60, 0x00, 0x31, 0x35, 0x8A, 0x1B, 0x1F, 0x7F},
- {256, 16000, 4096000, 0x20, 0x00, 0x01, 0x35, 0x8A, 0x1B, 0x1F, 0x3F},
- {256, 44100, 11289600, 0xE0, 0x00, 0x30, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
- {256, 48000, 12288000, 0xE0, 0x00, 0x30, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
+ {256, 8000, 2048000, 0x60, 0x00, 0x31, 0x35, 0x08, 0x19, 0x1F, 0x7F},
+ {256, 16000, 4096000, 0x20, 0x00, 0x01, 0x35, 0x08, 0x19, 0x1F, 0x3F},
+ {256, 44100, 11289600, 0xE0, 0x01, 0x01, 0x2D, 0x48, 0x08, 0x1F, 0x1F},
+ {256, 48000, 12288000, 0xE0, 0x01, 0x01, 0x2D, 0x48, 0x08, 0x1F, 0x1F},
{288, 8000, 2304000, 0x20, 0x00, 0x01, 0x35, 0x8A, 0x1B, 0x23, 0x47},
{384, 8000, 3072000, 0x60, 0x02, 0x05, 0x75, 0x8A, 0x1B, 0x1F, 0x7F},
{384, 16000, 6144000, 0x20, 0x02, 0x03, 0x35, 0x8A, 0x1B, 0x1F, 0x3F},
@@ -427,10 +427,10 @@ static const struct _coeff_div coeff_div_v3[] = {
{400, 48000, 19200000, 0xE4, 0x04, 0x35, 0x6d, 0xCA, 0x0A, 0x1F, 0x1F},
{500, 48000, 24000000, 0xF8, 0x04, 0x3F, 0x6D, 0xCA, 0x0A, 0x1F, 0x1F},
- {512, 8000, 4096000, 0x60, 0x00, 0x01, 0x35, 0x8A, 0x1B, 0x1F, 0x7F},
- {512, 16000, 8192000, 0x20, 0x00, 0x30, 0x35, 0x8A, 0x1B, 0x1F, 0x3F},
- {512, 44100, 22579200, 0xE0, 0x00, 0x00, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
- {512, 48000, 24576000, 0xE0, 0x00, 0x00, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
+ {512, 8000, 4096000, 0x60, 0x00, 0x01, 0x08, 0x19, 0x1B, 0x1F, 0x7F},
+ {512, 16000, 8192000, 0x20, 0x00, 0x30, 0x35, 0x08, 0x19, 0x1F, 0x3F},
+ {512, 44100, 22579200, 0xE0, 0x00, 0x00, 0x2D, 0x48, 0x08, 0x1F, 0x1F},
+ {512, 48000, 24576000, 0xE0, 0x00, 0x00, 0x2D, 0x48, 0x08, 0x1F, 0x1F},
{768, 8000, 6144000, 0x60, 0x02, 0x11, 0x35, 0x8A, 0x1B, 0x1F, 0x7F},
{768, 16000, 12288000, 0x20, 0x02, 0x01, 0x35, 0x8A, 0x1B, 0x1F, 0x3F},
{768, 32000, 24576000, 0xE0, 0x02, 0x30, 0x2D, 0xCA, 0x0A, 0x1F, 0x1F},
diff --git a/sound/soc/codecs/es8326.h b/sound/soc/codecs/es8326.h
index ee12caef810532..c3e52e7bdef57d 100644
--- a/sound/soc/codecs/es8326.h
+++ b/sound/soc/codecs/es8326.h
@@ -104,7 +104,7 @@
#define ES8326_MUTE (3 << 0)
/* ES8326_CLK_CTL */
-#define ES8326_CLK_ON (0x7e << 0)
+#define ES8326_CLK_ON (0x7f << 0)
#define ES8326_CLK_OFF (0 << 0)
/* ES8326_CLK_INV */
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 22/33] ASoC: codecs: ES8326: Solve a headphone detection issue after suspend and resume
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (20 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 21/33] ASoC: codecs: ES8326: modify clock table kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 23/33] ASoC: codecs: ES8326: Removing the control of ADC_SCALE kovalev
` (11 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Zhang Yi <zhangyi@everest-semi.com>
commit 6e5f5bf894eb9260f07ad0da4e2dd2efd616ed59 upstream.
We got a headphone detection issue after suspend and resume.
And we fixed it by modifying the configuration at es8326_suspend
and invoke es8326_irq at es8326_resume.
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://msgid.link/r/20240402062043.20608-4-zhangyi@everest-semi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 228822726fb799..4e132daeb6a2d5 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -1054,6 +1054,8 @@ static int es8326_resume(struct snd_soc_component *component)
es8326->hp = 0;
es8326->hpl_vol = 0x03;
es8326->hpr_vol = 0x03;
+
+ es8326_irq(es8326->irq, es8326);
return 0;
}
@@ -1064,6 +1066,9 @@ static int es8326_suspend(struct snd_soc_component *component)
cancel_delayed_work_sync(&es8326->jack_detect_work);
es8326_disable_micbias(component);
es8326->calibrated = false;
+ regmap_write(es8326->regmap, ES8326_CLK_MUX, 0x2d);
+ regmap_write(es8326->regmap, ES8326_DAC2HPMIX, 0x00);
+ regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x3b);
regmap_write(es8326->regmap, ES8326_CLK_CTL, ES8326_CLK_OFF);
regcache_cache_only(es8326->regmap, true);
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 23/33] ASoC: codecs: ES8326: Removing the control of ADC_SCALE
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (21 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 22/33] ASoC: codecs: ES8326: Solve a headphone detection issue after suspend and resume kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 24/33] ASoC: codecs: ES8326: solve hp and button detect issue kovalev
` (10 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Zhang Yi <zhangyi@everest-semi.com>
commit fec9c7f668ac5dd107f4da5a3b18379e07ec1a41 upstream.
We removed the configuration of ES8326_ADC_SCALE
in es8326_jack_detect_handler because user changed
the configuration by snd_controls
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://msgid.link/r/20240402062043.20608-5-zhangyi@everest-semi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 4e132daeb6a2d5..d8bb5d80006637 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -827,7 +827,6 @@ static void es8326_jack_detect_handler(struct work_struct *work)
dev_dbg(comp->dev, "Report hp remove event\n");
snd_soc_jack_report(es8326->jack, 0, SND_JACK_HEADSET);
/* mute adc when mic path switch */
- regmap_write(es8326->regmap, ES8326_ADC_SCALE, 0x33);
regmap_write(es8326->regmap, ES8326_ADC1_SRC, 0x44);
regmap_write(es8326->regmap, ES8326_ADC2_SRC, 0x66);
es8326->hp = 0;
@@ -886,7 +885,6 @@ static void es8326_jack_detect_handler(struct work_struct *work)
snd_soc_jack_report(es8326->jack,
SND_JACK_HEADSET, SND_JACK_HEADSET);
- regmap_write(es8326->regmap, ES8326_ADC_SCALE, 0x33);
regmap_update_bits(es8326->regmap, ES8326_PGA_PDN,
0x08, 0x08);
regmap_update_bits(es8326->regmap, ES8326_PGAGAIN,
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 24/33] ASoC: codecs: ES8326: solve hp and button detect issue
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (22 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 23/33] ASoC: codecs: ES8326: Removing the control of ADC_SCALE kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 25/33] ASoC: codecs: ES8326: Solve headphone detection issue kovalev
` (9 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Zhang Yi <zhangyi@everest-semi.com>
commit 714f5df027b085c19c32af6f08a959bf35b9fb7c upstream.
We got an error report about headphone type detection and button detection.
We fixed the headphone type detection error by adjusting the condition
of setting es8326->hp to 0.And we fixed the button detection error by
adjusting micbias and vref.
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://msgid.link/r/20240515062517.23661-1-zhangyi@everest-semi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index d8bb5d80006637..1bb75a187e76ca 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -829,8 +829,8 @@ static void es8326_jack_detect_handler(struct work_struct *work)
/* mute adc when mic path switch */
regmap_write(es8326->regmap, ES8326_ADC1_SRC, 0x44);
regmap_write(es8326->regmap, ES8326_ADC2_SRC, 0x66);
- es8326->hp = 0;
}
+ es8326->hp = 0;
regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01);
regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x0a);
regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x0f, 0x03);
@@ -981,7 +981,7 @@ static int es8326_resume(struct snd_soc_component *component)
regmap_write(es8326->regmap, ES8326_ANA_LP, 0xf0);
usleep_range(10000, 15000);
regmap_write(es8326->regmap, ES8326_HPJACK_TIMER, 0xd9);
- regmap_write(es8326->regmap, ES8326_ANA_MICBIAS, 0xcb);
+ regmap_write(es8326->regmap, ES8326_ANA_MICBIAS, 0xd8);
/* set headphone default type and detect pin */
regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x83);
regmap_write(es8326->regmap, ES8326_CLK_RESAMPLE, 0x05);
@@ -1018,7 +1018,7 @@ static int es8326_resume(struct snd_soc_component *component)
regmap_write(es8326->regmap, ES8326_ANA_VSEL, 0x7F);
/* select vdda as micbias source */
- regmap_write(es8326->regmap, ES8326_VMIDLOW, 0x23);
+ regmap_write(es8326->regmap, ES8326_VMIDLOW, 0x03);
/* set dac dsmclip = 1 */
regmap_write(es8326->regmap, ES8326_DAC_DSM, 0x08);
regmap_write(es8326->regmap, ES8326_DAC_VPPSCALE, 0x15);
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 25/33] ASoC: codecs: ES8326: Solve headphone detection issue
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (23 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 24/33] ASoC: codecs: ES8326: solve hp and button detect issue kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 26/33] ASoC: codecs: ES8326: Slove " kovalev
` (8 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Zhang Yi <zhangyi@everest-semi.com>
commit b7c40988808f8d7426dee1e4d96a4e204de4a8bc upstream.
When switching between OMTP and CTIA headset, we can hear pop noise.
To solve this issue, We modified the configuration for headphone detection
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://msgid.link/r/20240604021946.2911-1-zhangyi@everest-semi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 1bb75a187e76ca..87ee15cc7e2add 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -857,12 +857,16 @@ static void es8326_jack_detect_handler(struct work_struct *work)
* set auto-check mode, then restart jack_detect_work after 400ms.
* Don't report jack status.
*/
- regmap_write(es8326->regmap, ES8326_INT_SOURCE,
- (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
+ regmap_write(es8326->regmap, ES8326_INT_SOURCE, 0x00);
regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01);
+ regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x10, 0x00);
es8326_enable_micbias(es8326->component);
usleep_range(50000, 70000);
regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00);
+ regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x10, 0x10);
+ usleep_range(50000, 70000);
+ regmap_write(es8326->regmap, ES8326_INT_SOURCE,
+ (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x1f);
regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x0f, 0x08);
queue_delayed_work(system_wq, &es8326->jack_detect_work,
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 26/33] ASoC: codecs: ES8326: Slove headphone detection issue
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (24 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 25/33] ASoC: codecs: ES8326: Solve headphone detection issue kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 27/33] ASoC: codecs: ES8326: Minimize the pop noise kovalev
` (7 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Zhang Yi <zhangyi@everest-semi.com>
commit 4eed78198b30c4c5975e454e7b1e6e25a7ac7353 upstream.
We modified the headphone detection setting to avoid an error button state
after codec resume from suspend state
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://patch.msgid.link/20240624030607.4307-2-zhangyi@everest-semi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 87ee15cc7e2add..4a47b4a1edd22c 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -877,6 +877,8 @@ static void es8326_jack_detect_handler(struct work_struct *work)
if (es8326->jack->status & SND_JACK_HEADSET) {
/* detect button */
dev_dbg(comp->dev, "button pressed\n");
+ regmap_write(es8326->regmap, ES8326_INT_SOURCE,
+ (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
queue_delayed_work(system_wq, &es8326->button_press_work, 10);
goto exit;
}
@@ -1052,11 +1054,6 @@ static int es8326_resume(struct snd_soc_component *component)
regmap_write(es8326->regmap, ES8326_ADC_MUTE, 0x0f);
- es8326->jack_remove_retry = 0;
- es8326->hp = 0;
- es8326->hpl_vol = 0x03;
- es8326->hpr_vol = 0x03;
-
es8326_irq(es8326->irq, es8326);
return 0;
}
@@ -1212,6 +1209,10 @@ static int es8326_i2c_probe(struct i2c_client *i2c,
}
es8326->irq = i2c->irq;
+ es8326->jack_remove_retry = 0;
+ es8326->hp = 0;
+ es8326->hpl_vol = 0x03;
+ es8326->hpr_vol = 0x03;
INIT_DELAYED_WORK(&es8326->jack_detect_work,
es8326_jack_detect_handler);
INIT_DELAYED_WORK(&es8326->button_press_work,
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 27/33] ASoC: codecs: ES8326: Minimize the pop noise
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (25 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 26/33] ASoC: codecs: ES8326: Slove " kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 28/33] ASoC: codecs: ES8326: regcache_sync error issue kovalev
` (6 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Zhang Yi <zhangyi@everest-semi.com>
commit 7e7dbdee96cbc660e7e8d3d9d7a512acaa6ca69d upstream.
Executing regcache_sync at initialization, we can hear a gentle pop
noise. So we created es8326_init for initialization instead of
executing es8326_resume
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://patch.msgid.link/20240624030607.4307-4-zhangyi@everest-semi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 31 ++++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 4a47b4a1edd22c..2b02ef8ce5a50a 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -974,14 +974,10 @@ static int es8326_calibrate(struct snd_soc_component *component)
return 0;
}
-static int es8326_resume(struct snd_soc_component *component)
+static void es8326_init(struct snd_soc_component *component)
{
struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
- regcache_cache_only(es8326->regmap, false);
- regcache_sync(es8326->regmap);
-
- /* reset internal clock state */
regmap_write(es8326->regmap, ES8326_RESET, 0x1f);
regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x0E);
regmap_write(es8326->regmap, ES8326_ANA_LP, 0xf0);
@@ -1037,7 +1033,6 @@ static int es8326_resume(struct snd_soc_component *component)
es8326_enable_micbias(es8326->component);
usleep_range(50000, 70000);
regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00);
- regmap_write(es8326->regmap, ES8326_INT_SOURCE, ES8326_INT_SRC_PIN9);
regmap_write(es8326->regmap, ES8326_INTOUT_IO,
es8326->interrupt_clk);
regmap_write(es8326->regmap, ES8326_SDINOUT1_IO,
@@ -1053,6 +1048,28 @@ static int es8326_resume(struct snd_soc_component *component)
ES8326_MUTE);
regmap_write(es8326->regmap, ES8326_ADC_MUTE, 0x0f);
+ regmap_write(es8326->regmap, ES8326_CLK_DIV_LRCK, 0xff);
+
+ msleep(200);
+ regmap_write(es8326->regmap, ES8326_INT_SOURCE, ES8326_INT_SRC_PIN9);
+}
+
+static int es8326_resume(struct snd_soc_component *component)
+{
+ struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
+ unsigned int reg;
+
+ regcache_cache_only(es8326->regmap, false);
+ regcache_cache_bypass(es8326->regmap, true);
+ regmap_read(es8326->regmap, ES8326_CLK_RESAMPLE, ®);
+ regcache_cache_bypass(es8326->regmap, false);
+ /* reset internal clock state */
+ if (reg == 0x05)
+ regmap_write(es8326->regmap, ES8326_CLK_CTL, ES8326_CLK_ON);
+ else
+ es8326_init(component);
+
+ regcache_sync(es8326->regmap);
es8326_irq(es8326->irq, es8326);
return 0;
@@ -1112,7 +1129,7 @@ static int es8326_probe(struct snd_soc_component *component)
}
dev_dbg(component->dev, "interrupt-clk %x", es8326->interrupt_clk);
- es8326_resume(component);
+ es8326_init(component);
return 0;
}
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 28/33] ASoC: codecs: ES8326: regcache_sync error issue
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (26 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 27/33] ASoC: codecs: ES8326: Minimize the pop noise kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 29/33] ASoC: codecs: ES8326: suspend issue kovalev
` (5 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Zhang Yi <zhangyi@everest-semi.com>
commit 34fa846f52f9fbef8aa262d3b39e71188e8dd884 upstream.
We modified the regmap_config members to fix cach sync error.
There are several registers that should be read-only registers.
If these registers are written while synchronizing the register values,
the codec will enter an error state.So we create es8326_writeable_register,
and set these registers to false
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://patch.msgid.link/20240624030607.4307-5-zhangyi@everest-semi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 2b02ef8ce5a50a..016cb3c7b7b57b 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -329,11 +329,29 @@ static bool es8326_volatile_register(struct device *dev, unsigned int reg)
}
}
+static bool es8326_writeable_register(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case ES8326_BIAS_SW1:
+ case ES8326_BIAS_SW2:
+ case ES8326_BIAS_SW3:
+ case ES8326_BIAS_SW4:
+ case ES8326_ADC_HPFS1:
+ case ES8326_ADC_HPFS2:
+ return false;
+ default:
+ return true;
+ }
+}
+
static const struct regmap_config es8326_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = 0xff,
+ .use_single_read = true,
+ .use_single_write = true,
.volatile_reg = es8326_volatile_register,
+ .writeable_reg = es8326_writeable_register,
.cache_type = REGCACHE_RBTREE,
};
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 29/33] ASoC: codecs: ES8326: suspend issue
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (27 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 28/33] ASoC: codecs: ES8326: regcache_sync error issue kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 30/33] ASoC: Intel: sof-essx8336 - add DMI info for Aquarius laptops kovalev
` (4 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Zhang Yi <zhangyi@everest-semi.com>
We find that we need to disable micbias for the codec to enter suspend
So We modify the trigger conditions for enable_micbias and disable_micbias
(kovalev)
This patch is taken from the mailing list. At the time of application,
this patch was not noticed by the maintainers of the sound subsystem,
but it will happen soon.
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://lore.kernel.org/all/20240702052610.24259-1-zhangyi@everest-semi.com/
Link: https://lore.kernel.org/all/20240726031002.35055-1-zhangyi@everest-semi.com/
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/codecs/es8326.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 016cb3c7b7b57b..873082dce133fb 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -805,6 +805,7 @@ static void es8326_jack_button_handler(struct work_struct *work)
SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2);
button_to_report = 0;
}
+ es8326_disable_micbias(es8326->component);
}
mutex_unlock(&es8326->lock);
}
@@ -878,7 +879,6 @@ static void es8326_jack_detect_handler(struct work_struct *work)
regmap_write(es8326->regmap, ES8326_INT_SOURCE, 0x00);
regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01);
regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x10, 0x00);
- es8326_enable_micbias(es8326->component);
usleep_range(50000, 70000);
regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00);
regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x10, 0x10);
@@ -897,6 +897,7 @@ static void es8326_jack_detect_handler(struct work_struct *work)
dev_dbg(comp->dev, "button pressed\n");
regmap_write(es8326->regmap, ES8326_INT_SOURCE,
(ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
+ es8326_enable_micbias(es8326->component);
queue_delayed_work(system_wq, &es8326->button_press_work, 10);
goto exit;
}
@@ -1067,6 +1068,7 @@ static void es8326_init(struct snd_soc_component *component)
regmap_write(es8326->regmap, ES8326_ADC_MUTE, 0x0f);
regmap_write(es8326->regmap, ES8326_CLK_DIV_LRCK, 0xff);
+ es8326_disable_micbias(es8326->component);
msleep(200);
regmap_write(es8326->regmap, ES8326_INT_SOURCE, ES8326_INT_SRC_PIN9);
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 30/33] ASoC: Intel: sof-essx8336 - add DMI info for Aquarius laptops
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (28 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 29/33] ASoC: codecs: ES8326: suspend issue kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 31/33] ASoC: Intel: sof-essx8336 - add DMI info of the Kraftway ACCORD S15T laptop kovalev
` (3 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Vasiliy Kovalev <kovalev@altlinux.org>
Fix inverted jack detection for next boards:
- "EM_CM525_PRO"
- "NS483"
- "NS685"
Link: https://bugzilla.altlinux.org/49475
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/intel/boards/sof_es8336.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/sof_es8336.c
index e22d767b6e97a3..ccd25b6aa02391 100644
--- a/sound/soc/intel/boards/sof_es8336.c
+++ b/sound/soc/intel/boards/sof_es8336.c
@@ -332,6 +332,30 @@ static int sof_es8336_quirk_cb(const struct dmi_system_id *id)
* if the topology file is modified as well.
*/
static const struct dmi_system_id sof_es8336_quirk_table[] = {
+ {
+ .callback = sof_es8336_quirk_cb,
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Aquarius"),
+ DMI_MATCH(DMI_BOARD_NAME, "EM_CM525_PRO"),
+ },
+ .driver_data = (void *)(SOF_ES8336_JD_INVERTED)
+ },
+ {
+ .callback = sof_es8336_quirk_cb,
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Aquarius"),
+ DMI_MATCH(DMI_BOARD_NAME, "NS483"),
+ },
+ .driver_data = (void *)(SOF_ES8336_JD_INVERTED)
+ },
+ {
+ .callback = sof_es8336_quirk_cb,
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Aquarius"),
+ DMI_MATCH(DMI_BOARD_NAME, "NS685"),
+ },
+ .driver_data = (void *)(SOF_ES8336_JD_INVERTED)
+ },
{
.callback = sof_es8336_quirk_cb,
.matches = {
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 31/33] ASoC: Intel: sof-essx8336 - add DMI info of the Kraftway ACCORD S15T laptop
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (29 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 30/33] ASoC: Intel: sof-essx8336 - add DMI info for Aquarius laptops kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 32/33] ASoC: Intel: sof-essx8336 - add DMI info of the ACD Smart Solutions TG819S laptop kovalev
` (2 subsequent siblings)
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Vasiliy Kovalev <kovalev@altlinux.org>
Fix inverted jack detection.
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/intel/boards/sof_es8336.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/sof_es8336.c
index ccd25b6aa02391..cfa488b0a7b4d9 100644
--- a/sound/soc/intel/boards/sof_es8336.c
+++ b/sound/soc/intel/boards/sof_es8336.c
@@ -373,6 +373,14 @@ static const struct dmi_system_id sof_es8336_quirk_table[] = {
.driver_data = (void *)(SOF_ES8336_HEADPHONE_GPIO |
SOC_ES8336_HEADSET_MIC1)
},
+ {
+ .callback = sof_es8336_quirk_cb,
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Kraftway"),
+ DMI_MATCH(DMI_BOARD_NAME, "S15T"),
+ },
+ .driver_data = (void *)(SOF_ES8336_JD_INVERTED)
+ },
{}
};
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 32/33] ASoC: Intel: sof-essx8336 - add DMI info of the ACD Smart Solutions TG819S laptop
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (30 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 31/33] ASoC: Intel: sof-essx8336 - add DMI info of the Kraftway ACCORD S15T laptop kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 33/33] ASoC: Intel: sof-essx8336: force card->name for the es8326 codec kovalev
2024-07-29 5:47 ` [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support Vitaly Chikunov
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Vasiliy Kovalev <kovalev@altlinux.org>
Fix inverted jack detection.
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/intel/boards/sof_es8336.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/sof_es8336.c
index cfa488b0a7b4d9..db958e3911d9d3 100644
--- a/sound/soc/intel/boards/sof_es8336.c
+++ b/sound/soc/intel/boards/sof_es8336.c
@@ -332,6 +332,14 @@ static int sof_es8336_quirk_cb(const struct dmi_system_id *id)
* if the topology file is modified as well.
*/
static const struct dmi_system_id sof_es8336_quirk_table[] = {
+ {
+ .callback = sof_es8336_quirk_cb,
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "ACD Smart Solutions"),
+ DMI_MATCH(DMI_BOARD_NAME, "TG819S"),
+ },
+ .driver_data = (void *)(SOF_ES8336_JD_INVERTED)
+ },
{
.callback = sof_es8336_quirk_cb,
.matches = {
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* [d-kernel] [PATCH 33/33] ASoC: Intel: sof-essx8336: force card->name for the es8326 codec
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (31 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 32/33] ASoC: Intel: sof-essx8336 - add DMI info of the ACD Smart Solutions TG819S laptop kovalev
@ 2024-07-29 5:10 ` kovalev
2024-07-29 5:47 ` [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support Vitaly Chikunov
33 siblings, 0 replies; 36+ messages in thread
From: kovalev @ 2024-07-29 5:10 UTC (permalink / raw)
To: devel-kernel
From: Vasiliy Kovalev <kovalev@altlinux.org>
This is done for the subsequent correct configuration of UCM alsa.
Thanks to the Aquarius developers for this workaround.
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
sound/soc/intel/boards/sof_es8336.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/sof_es8336.c
index db958e3911d9d3..bd07b90e1ed2cb 100644
--- a/sound/soc/intel/boards/sof_es8336.c
+++ b/sound/soc/intel/boards/sof_es8336.c
@@ -724,8 +724,10 @@ static int sof_es8336_probe(struct platform_device *pdev)
dai_links[0].codecs->name = codec_name;
/* also fixup codec dai name if relevant */
- if (!strncmp(mach->id, "ESSX8326", SND_ACPI_I2C_ID_LEN))
+ if (!strncmp(mach->id, "ESSX8326", SND_ACPI_I2C_ID_LEN)) {
dai_links[0].codecs->dai_name = "ES8326 HiFi";
+ card->name = "essx8326";
+ }
} else {
dev_err(dev, "Error cannot find '%s' dev\n", mach->id);
return -ENXIO;
--
2.33.8
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
` (32 preceding siblings ...)
2024-07-29 5:10 ` [d-kernel] [PATCH 33/33] ASoC: Intel: sof-essx8336: force card->name for the es8326 codec kovalev
@ 2024-07-29 5:47 ` Vitaly Chikunov
2024-07-30 7:48 ` Vasiliy Kovalev
33 siblings, 1 reply; 36+ messages in thread
From: Vitaly Chikunov @ 2024-07-29 5:47 UTC (permalink / raw)
To: ALT Linux kernel packages development
Vasiliy,
On Mon, Jul 29, 2024 at 08:09:49AM +0300, kovalev@altlinux.org wrote:
> Эти патчи для ядра 6.1 веток c10f1 и c10f2
1. Надеюсь эти путчи очень важны, потому что это бомба замедленного
действия.
2. Ревьювить и тестировать всё это возможности у меня нет.
3. В случае возникновения merge conflicts - в git простого способа
определить с каким коммитом возник конфликт нет. Коммиты могут даже не
отревертится в случае зависимых коммитов или изменения контекстов.
Возможно рассогласование коммитов даже при успешном реверте.
4. В случае бага репортить их будет некуда, понять, что произошло будет
нельзя, нагулить ошибку или решение будет нельзя. А к багам вплоть до
зависания системы могут приводить и банальное рассогласование изменений
в коммитах при реверте или приходящих из апстрима.
Applied, thanks
2024-07-29 un-def/c10f2 [kernelbot/un-def/c10f2] ASoC: Intel: sof-essx8336: force card->name for the es8326 codec
2024-07-29 un-def/c10f1 [kernelbot/un-def/c10f1] ASoC: Intel: sof-essx8336: force card->name for the es8326 codec
kernel-image (un-def/c10f1)$ git diff --stat '@^{/fix build warning}~'
sound/soc/codecs/es8316.c | 7 +-
sound/soc/codecs/es8326.c | 884 +++++++++++++++++++++++++++---------
sound/soc/codecs/es8326.h | 36 +-
sound/soc/intel/boards/sof_es8336.c | 44 +-
4 files changed, 735 insertions(+), 236 deletions(-)
>
> - ASoC: codecs: ES8316: fix build warning.
> - ASoC: codecs: ES8326: fix support (backport from upstream).
> - ASoC: Intel: sof-essx8336: add more DMI info.
>
> [PATCH 01/33] ASoC: codecs: ES8316: fix build warning
> [PATCH 02/33] ASoC: codecs: ES8326: Add es8326_mute function
> [PATCH 03/33] ASoC: codecs: ES8326: Change Hp_detect register names
> [PATCH 04/33] ASoC: codecs: ES8326: Change Volatile Reg function
> [PATCH 05/33] ASoC: codecs: ES8326: Fix power-up sequence
> [PATCH 06/33] ASOC: codecs: ES8326: Add calibration support for
> [PATCH 07/33] ASoC: codecs: ES8326: Update jact detection function
> [PATCH 08/33] ASoC: codecs: ES8326: Add chip version flag
> [PATCH 09/33] ASoC: codecs: ES8326: Changing initialisation and
> [PATCH 10/33] ASoC: codecs: ES8326: Changing the headset detection
> [PATCH 11/33] ASoC: codecs: ES8326: improving crosstalk performance
> [PATCH 12/33] ASoC: codecs: ES8326: Improving the THD+N performance
> [PATCH 13/33] ASoC: codecs: ES8326: Minimize the pop noise on
> [PATCH 14/33] ASoC: codecs: ES8326: fix the capture noise issue
> [PATCH 15/33] ASoC: codecs: ES8326: Remove executable bit
> [PATCH 16/33] ASoC: codecs: ES8326: Adding new volume kcontrols
> [PATCH 17/33] ASoC: codecs: ES8326: Changing members of private
> [PATCH 18/33] ASoC: codecs: ES8326: Reducing power consumption
> [PATCH 19/33] ASoC: codecs: ES8326: Delete unused REG_SUPPLY
> [PATCH 20/33] ASoC: codecs: ES8326: Solve error interruption issue
> [PATCH 21/33] ASoC: codecs: ES8326: modify clock table
> [PATCH 22/33] ASoC: codecs: ES8326: Solve a headphone detection issue
> [PATCH 23/33] ASoC: codecs: ES8326: Removing the control of ADC_SCALE
> [PATCH 24/33] ASoC: codecs: ES8326: solve hp and button detect issue
> [PATCH 25/33] ASoC: codecs: ES8326: Solve headphone detection issue
> [PATCH 26/33] ASoC: codecs: ES8326: Slove headphone detection issue
> [PATCH 27/33] ASoC: codecs: ES8326: Minimize the pop noise
> [PATCH 28/33] ASoC: codecs: ES8326: regcache_sync error issue
> [PATCH 29/33] ASoC: codecs: ES8326: suspend issue
> [PATCH 30/33] ASoC: Intel: sof-essx8336 - add DMI info for Aquarius
> [PATCH 31/33] ASoC: Intel: sof-essx8336 - add DMI info of the
> [PATCH 32/33] ASoC: Intel: sof-essx8336 - add DMI info of the ACD
> [PATCH 33/33] ASoC: Intel: sof-essx8336: force card->name for the
>
> _______________________________________________
> devel-kernel mailing list
> devel-kernel@lists.altlinux.org
> https://lists.altlinux.org/mailman/listinfo/devel-kernel
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support
2024-07-29 5:47 ` [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support Vitaly Chikunov
@ 2024-07-30 7:48 ` Vasiliy Kovalev
0 siblings, 0 replies; 36+ messages in thread
From: Vasiliy Kovalev @ 2024-07-30 7:48 UTC (permalink / raw)
To: devel-kernel
29.07.2024 08:47, Vitaly Chikunov пишет:
> Vasiliy,
>
> On Mon, Jul 29, 2024 at 08:09:49AM +0300, kovalev@altlinux.org wrote:
>> Эти патчи для ядра 6.1 веток c10f1 и c10f2
>
> 1. Надеюсь эти путчи очень важны, потому что это бомба замедленного
> действия.
>
> 2. Ревьювить и тестировать всё это возможности у меня нет.
>
> 3. В случае возникновения merge conflicts - в git простого способа
> определить с каким коммитом возник конфликт нет. Коммиты могут даже не
> отревертится в случае зависимых коммитов или изменения контекстов.
> Возможно рассогласование коммитов даже при успешном реверте.
>
> 4. В случае бага репортить их будет некуда, понять, что произошло будет
> нельзя, нагулить ошибку или решение будет нельзя. А к багам вплоть до
> зависания системы могут приводить и банальное рассогласование изменений
> в коммитах при реверте или приходящих из апстрима.
>
> Applied, thanks
>
> 2024-07-29 un-def/c10f2 [kernelbot/un-def/c10f2] ASoC: Intel: sof-essx8336: force card->name for the es8326 codec
> 2024-07-29 un-def/c10f1 [kernelbot/un-def/c10f1] ASoC: Intel: sof-essx8336: force card->name for the es8326 codec
>
> kernel-image (un-def/c10f1)$ git diff --stat '@^{/fix build warning}~'
> sound/soc/codecs/es8316.c | 7 +-
> sound/soc/codecs/es8326.c | 884 +++++++++++++++++++++++++++---------
> sound/soc/codecs/es8326.h | 36 +-
> sound/soc/intel/boards/sof_es8336.c | 44 +-
> 4 files changed, 735 insertions(+), 236 deletions(-)
Спасибо!
На текущий момент все патчи, которые затрагивают кодеки es8326, es8316 и
драйвер sof_es8336, не бэкпортируется на стабильные ветки, поэтому мерж
конфликт маловероятен, но если возникнут какие-либо проблемы, обязуюсь
помочь с их решением.
В скором времени закончу отладку встроенного микрофона с разработчиками
драйвера и пришлю еще один патч, чтобы драйвер работал "из коробки".
>>
>> - ASoC: codecs: ES8316: fix build warning.
>> - ASoC: codecs: ES8326: fix support (backport from upstream).
>> - ASoC: Intel: sof-essx8336: add more DMI info.
>>
>> [PATCH 01/33] ASoC: codecs: ES8316: fix build warning
>> [PATCH 02/33] ASoC: codecs: ES8326: Add es8326_mute function
>> [PATCH 03/33] ASoC: codecs: ES8326: Change Hp_detect register names
>> [PATCH 04/33] ASoC: codecs: ES8326: Change Volatile Reg function
>> [PATCH 05/33] ASoC: codecs: ES8326: Fix power-up sequence
>> [PATCH 06/33] ASOC: codecs: ES8326: Add calibration support for
>> [PATCH 07/33] ASoC: codecs: ES8326: Update jact detection function
>> [PATCH 08/33] ASoC: codecs: ES8326: Add chip version flag
>> [PATCH 09/33] ASoC: codecs: ES8326: Changing initialisation and
>> [PATCH 10/33] ASoC: codecs: ES8326: Changing the headset detection
>> [PATCH 11/33] ASoC: codecs: ES8326: improving crosstalk performance
>> [PATCH 12/33] ASoC: codecs: ES8326: Improving the THD+N performance
>> [PATCH 13/33] ASoC: codecs: ES8326: Minimize the pop noise on
>> [PATCH 14/33] ASoC: codecs: ES8326: fix the capture noise issue
>> [PATCH 15/33] ASoC: codecs: ES8326: Remove executable bit
>> [PATCH 16/33] ASoC: codecs: ES8326: Adding new volume kcontrols
>> [PATCH 17/33] ASoC: codecs: ES8326: Changing members of private
>> [PATCH 18/33] ASoC: codecs: ES8326: Reducing power consumption
>> [PATCH 19/33] ASoC: codecs: ES8326: Delete unused REG_SUPPLY
>> [PATCH 20/33] ASoC: codecs: ES8326: Solve error interruption issue
>> [PATCH 21/33] ASoC: codecs: ES8326: modify clock table
>> [PATCH 22/33] ASoC: codecs: ES8326: Solve a headphone detection issue
>> [PATCH 23/33] ASoC: codecs: ES8326: Removing the control of ADC_SCALE
>> [PATCH 24/33] ASoC: codecs: ES8326: solve hp and button detect issue
>> [PATCH 25/33] ASoC: codecs: ES8326: Solve headphone detection issue
>> [PATCH 26/33] ASoC: codecs: ES8326: Slove headphone detection issue
>> [PATCH 27/33] ASoC: codecs: ES8326: Minimize the pop noise
>> [PATCH 28/33] ASoC: codecs: ES8326: regcache_sync error issue
>> [PATCH 29/33] ASoC: codecs: ES8326: suspend issue
>> [PATCH 30/33] ASoC: Intel: sof-essx8336 - add DMI info for Aquarius
>> [PATCH 31/33] ASoC: Intel: sof-essx8336 - add DMI info of the
>> [PATCH 32/33] ASoC: Intel: sof-essx8336 - add DMI info of the ACD
>> [PATCH 33/33] ASoC: Intel: sof-essx8336: force card->name for the
>>
>> _______________________________________________
>> devel-kernel mailing list
>> devel-kernel@lists.altlinux.org
>> https://lists.altlinux.org/mailman/listinfo/devel-kernel
> _______________________________________________
> devel-kernel mailing list
> devel-kernel@lists.altlinux.org
> https://lists.altlinux.org/mailman/listinfo/devel-kernel
--
Vasiliy Kovalev
^ permalink raw reply [flat|nested] 36+ messages in thread
end of thread, other threads:[~2024-07-30 7:48 UTC | newest]
Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-29 5:09 [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 01/33] ASoC: codecs: ES8316: fix build warning kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 02/33] ASoC: codecs: ES8326: Add es8326_mute function kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 03/33] ASoC: codecs: ES8326: Change Hp_detect register names kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 04/33] ASoC: codecs: ES8326: Change Volatile Reg function kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 05/33] ASoC: codecs: ES8326: Fix power-up sequence kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 06/33] ASOC: codecs: ES8326: Add calibration support for version_b kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 07/33] ASoC: codecs: ES8326: Update jact detection function kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 08/33] ASoC: codecs: ES8326: Add chip version flag kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 09/33] ASoC: codecs: ES8326: Changing initialisation and broadcasting kovalev
2024-07-29 5:09 ` [d-kernel] [PATCH 10/33] ASoC: codecs: ES8326: Changing the headset detection time kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 11/33] ASoC: codecs: ES8326: improving crosstalk performance kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 12/33] ASoC: codecs: ES8326: Improving the THD+N performance kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 13/33] ASoC: codecs: ES8326: Minimize the pop noise on headphone kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 14/33] ASoC: codecs: ES8326: fix the capture noise issue kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 15/33] ASoC: codecs: ES8326: Remove executable bit kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 16/33] ASoC: codecs: ES8326: Adding new volume kcontrols kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 17/33] ASoC: codecs: ES8326: Changing members of private structure kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 18/33] ASoC: codecs: ES8326: Reducing power consumption kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 19/33] ASoC: codecs: ES8326: Delete unused REG_SUPPLY kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 20/33] ASoC: codecs: ES8326: Solve error interruption issue kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 21/33] ASoC: codecs: ES8326: modify clock table kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 22/33] ASoC: codecs: ES8326: Solve a headphone detection issue after suspend and resume kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 23/33] ASoC: codecs: ES8326: Removing the control of ADC_SCALE kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 24/33] ASoC: codecs: ES8326: solve hp and button detect issue kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 25/33] ASoC: codecs: ES8326: Solve headphone detection issue kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 26/33] ASoC: codecs: ES8326: Slove " kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 27/33] ASoC: codecs: ES8326: Minimize the pop noise kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 28/33] ASoC: codecs: ES8326: regcache_sync error issue kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 29/33] ASoC: codecs: ES8326: suspend issue kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 30/33] ASoC: Intel: sof-essx8336 - add DMI info for Aquarius laptops kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 31/33] ASoC: Intel: sof-essx8336 - add DMI info of the Kraftway ACCORD S15T laptop kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 32/33] ASoC: Intel: sof-essx8336 - add DMI info of the ACD Smart Solutions TG819S laptop kovalev
2024-07-29 5:10 ` [d-kernel] [PATCH 33/33] ASoC: Intel: sof-essx8336: force card->name for the es8326 codec kovalev
2024-07-29 5:47 ` [d-kernel] [PATCH c10f2/c10f1 6.1.y 0/33] ASoC: codecs: es83x6: fix support Vitaly Chikunov
2024-07-30 7:48 ` Vasiliy Kovalev
ALT Linux kernel packages development
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel-kernel/0 devel-kernel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel-kernel devel-kernel/ http://lore.altlinux.org/devel-kernel \
devel-kernel@altlinux.org devel-kernel@altlinux.ru devel-kernel@altlinux.com
public-inbox-index devel-kernel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel-kernel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git